From 2aed5c9968c48f665b85569333aa61011e611321 Mon Sep 17 00:00:00 2001 From: Pavel Aharoni Date: Thu, 25 May 2017 20:29:43 +0300 Subject: [SDC-24] sdnc problems Change-Id: I5bb5fd91ae1daf73fdf63cf8108531295bb8e96d Signed-off-by: Pavel Aharoni --- .../sdc/impl/SdcToscaParserBasicTest.java | 5 +- .../openecomp/sdc/impl/ToscaParserGroupTest.java | 7 +++ .../sdc/impl/ToscaParserNodeTemplateTest.java | 53 +++++++++++++++++----- .../sdc/impl/ToscaParserServiceInputTest.java | 6 +++ 4 files changed, 59 insertions(+), 12 deletions(-) (limited to 'sdc-tosca-parser/src/test/java/org') diff --git a/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java b/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java index 6746df7..7ea231c 100644 --- a/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java +++ b/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java @@ -25,6 +25,7 @@ public abstract class SdcToscaParserBasicTest { static ISdcCsarHelper rainyCsarHelperMultiVfs; static ISdcCsarHelper fdntCsarHelper; static ISdcCsarHelper complexCps; + static ISdcCsarHelper fdntCsarHelperWithInputs; static Map>> fdntCsarHelper_Data; @BeforeClass @@ -34,7 +35,9 @@ public abstract class SdcToscaParserBasicTest { fdntCsarHelper = getCsarHelper("csars/service-ServiceFdnt-with-allotted.csar"); rainyCsarHelperMultiVfs = getCsarHelper("csars/service-ServiceFdnt-csar-rainy.csar"); rainyCsarHelperSingleVf = getCsarHelper("csars/service-ServiceFdnt-csar.csar"); - complexCps = getCsarHelper("csars/1service-ServiceWithPorts.csar"); + complexCps = getCsarHelper("csars/service-Renanatst2-csar.csar"); + fdntCsarHelperWithInputs = getCsarHelper("csars/service-ServiceFdnt-with-get-input.csar"); + fdntCsarHelper_Data = new HashMap>>(){ { HashMap> FDNT ; diff --git a/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserGroupTest.java b/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserGroupTest.java index 01c888f..d7321d1 100644 --- a/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserGroupTest.java +++ b/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserGroupTest.java @@ -76,6 +76,13 @@ public class ToscaParserGroupTest extends SdcToscaParserBasicTest{ assertEquals("false", volumeGroup); } +// @Test +// public void testGroupFlatGetInputProperty() throws SdcToscaParserException { +// List vfModulesByVf = fdntCsarHelperWithInputs.getVfModulesByVf(VF_CUSTOMIZATION_UUID); +// String volumeGroup = fdntCsarHelperWithInputs.getGroupPropertyLeafValue(vfModulesByVf.get(1), "volume_group"); +// assertEquals("false", volumeGroup); +// } + @Test public void testGroupPropertyLeafValueByNullProperty() { List vfModulesByVf = fdntCsarHelper.getVfModulesByVf(VF_CUSTOMIZATION_UUID); diff --git a/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java b/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java index dd895c3..61d8781 100644 --- a/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java +++ b/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java @@ -3,16 +3,18 @@ package org.openecomp.sdc.impl; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; +import static org.testng.Assert.assertTrue; + import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.commons.lang3.tuple.Pair; -import org.testng.annotations.Test; import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException; import org.openecomp.sdc.toscaparser.api.Group; import org.openecomp.sdc.toscaparser.api.NodeTemplate; +import org.testng.annotations.Test; public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest { @@ -42,6 +44,12 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest { assertEquals("some code", fdntCsarHelper.getNodeTemplatePropertyLeafValue(serviceVfList.get(0), "nf_naming_code")); } + @Test + public void testNodeTemplateFlatFunctionProperty() throws SdcToscaParserException { + List serviceVfList = fdntCsarHelperWithInputs.getServiceVfList(); + assertEquals(null, fdntCsarHelperWithInputs.getNodeTemplatePropertyLeafValue(serviceVfList.get(1), "target_network_role")); + } + @Test public void testNodeTemplateNestedProperty() throws SdcToscaParserException { List serviceVlList = fdntCsarHelper.getServiceVlList(); @@ -50,7 +58,7 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest { assertEquals("24", fdntCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, "network_assignments#ipv4_subnet_default_assignment#cidr_mask")); assertEquals("7a6520b-9982354-ee82992c-105720", fdntCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, "network_flows#vpn_binding")); } - + @Test public void testNodeTemplateNestedPropertyFromInput() throws SdcToscaParserException { List serviceVfList = fdntCsarHelper.getServiceVfList(); @@ -308,20 +316,43 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest { //region getCpPropertiesFromVfc @Test public void testGetCpPropertiesFromVfc() { - List vfcs = complexCps.getVfcListByVf(VF_CUSTOMIZATION_UUID); - Map> cps = complexCps.getCpPropertiesFromVfc(vfcs.get(0)); + List vfcs = complexCps.getVfcListByVf("f999e2ca-72c0-42d3-9b11-13f2122fb8ef"); + boolean isChecked = false; + boolean isChecked1 = false; + for (int i = 0; i < vfcs.size(); i++) { + + if(vfcs.get(i).getName().equalsIgnoreCase("abstract_ddc")) + { + isChecked = true; + Map> cps = complexCps.getCpPropertiesFromVfc(vfcs.get(i)); - assertEquals(5, cps.size()); + assertEquals(3,cps.size()); - assertEquals(1, cps.get("port_fe1_sigtran").get("ip_requirements#ip_count_required#count")); - assertEquals(true, cps.get("port_fe1_sigtran").get("ip_requirements#dhcp_enabled")); - assertEquals(4, cps.get("port_fe1_sigtran").get("ip_requirements#ip_version")); + assertEquals(new Integer(1), cps.get("ddc_int_imbl__port").get("ip_requirements#ip_count_required#count")); + assertEquals(new Boolean(true), cps.get("ddc_int_imbl__port").get("ip_requirements#dhcp_enabled")); + assertEquals(new Integer(6), cps.get("ddc_int_imbl__port").get("ip_requirements#ip_version")); + assertEquals(null, cps.get("ddc_int_imbl__port").get("subnetpoolid")); - assertEquals(2, cps.get("port_fe_cluster").get("ip_requirements#ip_count_required#count")); - assertEquals(true, cps.get("port_fe_cluster").get("ip_requirements#dhcp_enabled")); - assertEquals(4, cps.get("port_fe_cluster").get("ip_requirements#ip_version")); + //assertEquals("\"int_imsp\"", cps.get("mon_ist_imsp__port").get("network_role_tag")); + + } + + if(vfcs.get(i).getName().equalsIgnoreCase("abstract_mda")) + { + isChecked1 = true; + Map> cps1 = complexCps.getCpPropertiesFromVfc(vfcs.get(i)); + + assertEquals(new Integer(4), cps1.get("mda_int_imsp__port").get("ip_requirements#ip_version")); + assertEquals(null, cps1.get("mda_int_imsp__port").get("ip_requirements#ip_count_required#count")); + + } + + } + assertTrue(isChecked); + assertTrue(isChecked1); } + @Test public void testGetCpPropertiesFromVfcForNullVFC() { Map> cps = complexCps.getCpPropertiesFromVfc(null); diff --git a/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserServiceInputTest.java b/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserServiceInputTest.java index 0b172f5..ea5c2ef 100644 --- a/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserServiceInputTest.java +++ b/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserServiceInputTest.java @@ -34,6 +34,12 @@ public class ToscaParserServiceInputTest extends SdcToscaParserBasicTest { assertEquals("test service naming", serviceInputLeafValue); } +// @Test +// public void testGetServiceInputLeafValueWithGetInput(){ +// String serviceInputLeafValue = fdntCsarHelperWithInputs.getServiceInputLeafValueOfDefault("my_input#default"); +// assertEquals(null, serviceInputLeafValue); +// } + @Test public void testGetServiceInputLeafValueNotExists(){ String serviceInputLeafValue = fdntCsarHelper.getServiceInputLeafValueOfDefault("service_naming#default#kuku"); -- cgit 1.2.3-korg