summaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorPavel Aharoni <pa0916@att.com>2017-07-17 16:45:26 +0300
committerPavel Aharoni <pa0916@att.com>2017-07-17 16:45:41 +0300
commit3b2a4a9f36d21c0d5519e83551fde633945eb3a7 (patch)
tree85a981e90872bdb23e181009ea8af940473889e6 /src/test/java
parent9f2d31d8cb8c4e28c3b1bea809867d39df36e502 (diff)
[SDC-137] update port properties function
Change-Id: I1e2de708ca8fc327941cbb04290d52f07e243ecd Signed-off-by: Pavel Aharoni <pa0916@att.com>
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java4
-rw-r--r--src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java50
2 files changed, 26 insertions, 28 deletions
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<String, HashMap<String, List<String>>> 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<String, HashMap<String, List<String>>>(){
{
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<NodeTemplate> vfcs = complexCps.getVfcListByVf("f999e2ca-72c0-42d3-9b11-13f2122fb8ef");
+ List<NodeTemplate> 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<String, Map<String, Object>> 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<String, Map<String, Object>> 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<String, Map<String, Object>> cps = ipAssignCsarHelper.getCpPropertiesFromVfcAsObject(vfc);
+
+ assertEquals(2,cps.size());
+ Map<String, Object> pd01 = cps.get("port_pd01_port");
+ assertEquals(5, pd01.size());
+
+ Map<String, Object> firstIpRequirements = (Map<String, Object>) ((List<Object>)pd01.get("ip_requirements")).get(0);
+ Map<String, Object> secondIpRequirements = (Map<String, Object>) ((List<Object>)pd01.get("ip_requirements")).get(1);
+
+ assertEquals("subnet_role_4", firstIpRequirements.get("subnet_role"));
+ assertEquals(4, firstIpRequirements.get("ip_version"));
+ assertEquals(true, ((Map<String, Object>) firstIpRequirements.get("ip_count_required")).get("is_required"));
+ assertEquals(4, ((Map<String, Object>) firstIpRequirements.get("ip_count_required")).get("count"));
+ assertEquals(false, ((Map<String, Object>)((Map<String, Object>)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<String, Map<String, Object>> cps = complexCps.getCpPropertiesFromVfc(null);
+ Map<String, Map<String, Object>> cps = ipAssignCsarHelper.getCpPropertiesFromVfcAsObject(null);
assertNotNull(cps);
assertEquals(0, cps.size());
}