From 3b2a4a9f36d21c0d5519e83551fde633945eb3a7 Mon Sep 17 00:00:00 2001 From: Pavel Aharoni Date: Mon, 17 Jul 2017 16:45:26 +0300 Subject: [SDC-137] update port properties function Change-Id: I1e2de708ca8fc327941cbb04290d52f07e243ecd Signed-off-by: Pavel Aharoni --- .../sdc/impl/SdcToscaParserBasicTest.java | 4 +- .../sdc/impl/ToscaParserNodeTemplateTest.java | 50 ++++++++++------------ 2 files changed, 26 insertions(+), 28 deletions(-) (limited to 'src/test/java') diff --git a/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java b/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java index 471fbc0..817ac92 100644 --- a/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java +++ b/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java @@ -27,7 +27,8 @@ public abstract class SdcToscaParserBasicTest { static ISdcCsarHelper complexCps; static ISdcCsarHelper fdntCsarHelperWithInputs; static ISdcCsarHelper nfodCsarHlper; - static ISdcCsarHelper nestedVfcCsarHlper; + static ISdcCsarHelper ipAssignCsarHelper; + static ISdcCsarHelper nestedVfcCsarHlper; static Map>> fdntCsarHelper_Data; @BeforeClass @@ -40,6 +41,7 @@ public abstract class SdcToscaParserBasicTest { complexCps = getCsarHelper("csars/service-consolidated-props-csar.csar"); fdntCsarHelperWithInputs = getCsarHelper("csars/service-ServiceFdnt-with-get-input.csar"); nfodCsarHlper = getCsarHelper("csars/service-NfodService-csar.csar"); + ipAssignCsarHelper = getCsarHelper("csars/service-Ipassignservice-csar.csar"); nestedVfcCsarHlper = getCsarHelper("csars/service-nested-vfc-csar.csar"); fdntCsarHelper_Data = new HashMap>>(){ { diff --git a/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java b/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java index d8e065b..9818a89 100644 --- a/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java +++ b/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java @@ -331,45 +331,41 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest { //region getCpPropertiesFromVfc @Test public void testGetCpPropertiesFromVfc() { - List vfcs = complexCps.getVfcListByVf("f999e2ca-72c0-42d3-9b11-13f2122fb8ef"); + List vfcs = ipAssignCsarHelper.getVfcListByVf("b5190df2-7880-4d6f-836f-56ab17e1b85b"); 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(3,cps.size()); - assertEquals(new Integer(1), cps.get("port_ddc_int_imbl__port").get("ip_requirements#ip_count_required#count")); - assertEquals(new Boolean(true), cps.get("port_ddc_int_imbl__port").get("ip_requirements#dhcp_enabled")); - assertEquals(new Integer(6), cps.get("port_ddc_int_imbl__port").get("ip_requirements#ip_version")); - assertEquals("subnetpoolid_test", cps.get("port_ddc_int_imbl__port").get("subnetpoolid")); - assertEquals("int_imbl", cps.get("port_ddc_int_imbl__port").get("network_role_tag")); + for (NodeTemplate vfc: vfcs) { - } - - if(vfcs.get(i).getName().equalsIgnoreCase("abstract_mda")) + if(vfc.getName().equalsIgnoreCase("abstract_pd_server")) { - isChecked1 = true; - Map> cps1 = complexCps.getCpPropertiesFromVfc(vfcs.get(i)); - - assertEquals(new Integer(4), cps1.get("port_mda_int_imsp__port").get("ip_requirements#ip_version")); - assertEquals(null, cps1.get("port_mda_int_imsp__port").get("ip_requirements#ip_count_required#count")); - - } + isChecked = true; + Map> cps = ipAssignCsarHelper.getCpPropertiesFromVfcAsObject(vfc); + + assertEquals(2,cps.size()); + Map pd01 = cps.get("port_pd01_port"); + assertEquals(5, pd01.size()); + + Map firstIpRequirements = (Map) ((List)pd01.get("ip_requirements")).get(0); + Map secondIpRequirements = (Map) ((List)pd01.get("ip_requirements")).get(1); + + assertEquals("subnet_role_4", firstIpRequirements.get("subnet_role")); + assertEquals(4, firstIpRequirements.get("ip_version")); + assertEquals(true, ((Map) firstIpRequirements.get("ip_count_required")).get("is_required")); + assertEquals(4, ((Map) firstIpRequirements.get("ip_count_required")).get("count")); + assertEquals(false, ((Map)((Map)pd01.get("mac_requirements")).get("mac_count_required")).get("is_required")); + assertEquals("test_subnetpoolid", pd01.get("subnetpoolid")); + assertEquals("oam", pd01.get("network_role_tag")); + assertEquals(6, secondIpRequirements.get("ip_version")); + } } assertTrue(isChecked); - assertTrue(isChecked1); } @Test public void testGetCpPropertiesFromVfcForNullVFC() { - Map> cps = complexCps.getCpPropertiesFromVfc(null); + Map> cps = ipAssignCsarHelper.getCpPropertiesFromVfcAsObject(null); assertNotNull(cps); assertEquals(0, cps.size()); } -- cgit 1.2.3-korg