diff options
author | Pavel Aharoni <pa0916@att.com> | 2017-05-25 20:29:43 +0300 |
---|---|---|
committer | Pavel Aharoni <pa0916@att.com> | 2017-05-25 20:29:43 +0300 |
commit | 2aed5c9968c48f665b85569333aa61011e611321 (patch) | |
tree | 89d369125093e7d621d795808679234f954f5c0f /sdc-tosca-parser/src/test | |
parent | 9e430cd9d4722c3e614c8a2fd822cff1604be1f2 (diff) |
[SDC-24] sdnc problems
Change-Id: I5bb5fd91ae1daf73fdf63cf8108531295bb8e96d
Signed-off-by: Pavel Aharoni <pa0916@att.com>
Diffstat (limited to 'sdc-tosca-parser/src/test')
6 files changed, 59 insertions, 12 deletions
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<String, HashMap<String, List<String>>> 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<String, HashMap<String, List<String>>>(){ { HashMap<String, List<String>> 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<Group> vfModulesByVf = fdntCsarHelperWithInputs.getVfModulesByVf(VF_CUSTOMIZATION_UUID); +// String volumeGroup = fdntCsarHelperWithInputs.getGroupPropertyLeafValue(vfModulesByVf.get(1), "volume_group"); +// assertEquals("false", volumeGroup); +// } + @Test public void testGroupPropertyLeafValueByNullProperty() { List<Group> 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 { @@ -43,6 +45,12 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest { } @Test + public void testNodeTemplateFlatFunctionProperty() throws SdcToscaParserException { + List<NodeTemplate> serviceVfList = fdntCsarHelperWithInputs.getServiceVfList(); + assertEquals(null, fdntCsarHelperWithInputs.getNodeTemplatePropertyLeafValue(serviceVfList.get(1), "target_network_role")); + } + + @Test public void testNodeTemplateNestedProperty() throws SdcToscaParserException { List<NodeTemplate> serviceVlList = fdntCsarHelper.getServiceVlList(); NodeTemplate nodeTemplate = serviceVlList.get(0); @@ -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<NodeTemplate> serviceVfList = fdntCsarHelper.getServiceVfList(); @@ -308,20 +316,43 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest { //region getCpPropertiesFromVfc @Test public void testGetCpPropertiesFromVfc() { - List<NodeTemplate> vfcs = complexCps.getVfcListByVf(VF_CUSTOMIZATION_UUID); - Map<String, Map<String, Object>> cps = complexCps.getCpPropertiesFromVfc(vfcs.get(0)); + List<NodeTemplate> 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<String, Map<String, Object>> 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<String, Map<String, Object>> 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<String, Map<String, Object>> 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"); diff --git a/sdc-tosca-parser/src/test/resources/csars/service-Renanatst2-csar.csar b/sdc-tosca-parser/src/test/resources/csars/service-Renanatst2-csar.csar Binary files differnew file mode 100644 index 0000000..37baffb --- /dev/null +++ b/sdc-tosca-parser/src/test/resources/csars/service-Renanatst2-csar.csar diff --git a/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-with-get-input.csar b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-with-get-input.csar Binary files differnew file mode 100644 index 0000000..53aea49 --- /dev/null +++ b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-with-get-input.csar |