summaryrefslogtreecommitdiffstats
path: root/src/test/java/org
diff options
context:
space:
mode:
authorShay Weizman <sw594b@att.com>2017-07-25 09:34:35 +0300
committerShay Weizman <sw594b@att.com>2017-07-25 09:34:35 +0300
commit1bdf71ac5cde8fd71326934223ceff95ac8c3eb4 (patch)
tree72b843dcfd9bb6c758743f1f4f73508f6ed7a197 /src/test/java/org
parentfc5eb8622019f06498a05b8dadef7f0a7bb3ab4b (diff)
[SDC-43] - New tests for NFOD
Change-Id: Ic992ae02498328972d73019d5024b81914917984 Signed-off-by: Shay Weizman <sw594b@att.com>
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java5
-rw-r--r--src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java79
2 files changed, 84 insertions, 0 deletions
diff --git a/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java b/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java
index 817ac92..2f41c6c 100644
--- a/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java
+++ b/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java
@@ -29,6 +29,9 @@ public abstract class SdcToscaParserBasicTest {
static ISdcCsarHelper nfodCsarHlper;
static ISdcCsarHelper ipAssignCsarHelper;
static ISdcCsarHelper nestedVfcCsarHlper;
+ static ISdcCsarHelper nfodNEWCsarHlper;
+
+
static Map<String, HashMap<String, List<String>>> fdntCsarHelper_Data;
@BeforeClass
@@ -43,6 +46,8 @@ public abstract class SdcToscaParserBasicTest {
nfodCsarHlper = getCsarHelper("csars/service-NfodService-csar.csar");
ipAssignCsarHelper = getCsarHelper("csars/service-Ipassignservice-csar.csar");
nestedVfcCsarHlper = getCsarHelper("csars/service-nested-vfc-csar.csar");
+ nfodNEWCsarHlper = getCsarHelper("csars/service-Nfod2images-csar.csar");
+
fdntCsarHelper_Data = new HashMap<String, HashMap<String, List<String>>>(){
{
HashMap<String, List<String>> FDNT ;
diff --git a/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java b/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java
index 4ab9af3..4095429 100644
--- a/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java
+++ b/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java
@@ -8,8 +8,10 @@ import static org.testng.Assert.assertTrue;
import java.util.ArrayList;
import java.util.Comparator;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.commons.lang3.tuple.Pair;
import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
@@ -17,8 +19,11 @@ import org.openecomp.sdc.tosca.parser.impl.FilterType;
import org.openecomp.sdc.tosca.parser.impl.SdcTypes;
import org.openecomp.sdc.toscaparser.api.Group;
import org.openecomp.sdc.toscaparser.api.NodeTemplate;
+import org.openecomp.sdc.toscaparser.api.Property;
import org.testng.annotations.Test;
+import fj.data.fingertrees.Node;
+
public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest {
//region getServiceVfList
@@ -649,4 +654,78 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest {
assertEquals(0, children.size());
}
//endregion
+
+ // added by QA
+ // Get specific VNF properties
+ @Test
+ public void testGetVnfConfigGetProperties() {
+ NodeTemplate vnfConfig = nfodCsarHlper.getVnfConfig("9bb2ef82-f8f6-4391-bc71-db063f15bf57");
+ assertNotNull(vnfConfig);
+ assertEquals("vnfConfiguration", vnfConfig.getMetaData().getValue("name"));
+
+ String manufacturer_reference_number = nfodCsarHlper.getNodeTemplatePropertyLeafValue(vnfConfig, "allowed_flavors#ATT_part_12345_for_FortiGate-VM00#vendor_info#manufacturer_reference_number");
+ String num_cpus = nfodCsarHlper.getNodeTemplatePropertyLeafValue(vnfConfig, "allowed_flavors#ATT_part_67890_for_FortiGate-VM01#compute_flavor#num_cpus");
+ String sp_part_number = nfodCsarHlper.getNodeTemplatePropertyLeafValue(vnfConfig, "allowed_flavors#ATT_part_67890_for_FortiGate-VM01#sp_part_number");
+
+ assertEquals("FortiGate-VM00",manufacturer_reference_number);
+ assertEquals("10",num_cpus);
+ assertEquals("ATT_part_67890_for_FortiGate-VM01",sp_part_number);
+ }
+
+ // added by QA
+ // Check that get vnfconfiguration not return as VFC
+ @Test
+ public void testGetVfcTypWithoutVnfCheckNames() {
+ List<NodeTemplate> vfcList = nfodCsarHlper.getVfcListByVf("9bb2ef82-f8f6-4391-bc71-db063f15bf57");
+ assertNotNull(vfcList);
+ assertEquals(2, vfcList.size());
+ for (int i = 0; i < vfcList.size(); i++) {
+
+ String Name= vfcList.get(i).getName();
+
+ assertEquals(false, Name.equals("vFW_VNF_Configuration"));
+
+ }
+ }
+
+ @Test
+ public void testNewGetVnfConfigGetProperties() {
+ NodeTemplate vnfConfig = nfodNEWCsarHlper.getVnfConfig("a6587663-b27f-4e88-8a86-604604302ce6");
+ assertNotNull(vnfConfig);
+ assertEquals("vnfConfiguration", vnfConfig.getMetaData().getValue("name"));
+
+ //Deployment flavor 1
+ String manufacturer_reference_number = nfodNEWCsarHlper.getNodeTemplatePropertyLeafValue(vnfConfig, "allowed_flavors#123456#vendor_info#manufacturer_reference_number");
+ String num_cpus = nfodNEWCsarHlper.getNodeTemplatePropertyLeafValue(vnfConfig, "allowed_flavors#123456#compute_flavor#num_cpus");
+ String sp_part_number = nfodNEWCsarHlper.getNodeTemplatePropertyLeafValue(vnfConfig, "allowed_flavors#123456#sp_part_number");
+
+ assertEquals("234567",manufacturer_reference_number);
+ assertEquals("2",num_cpus);
+ assertEquals("123456",sp_part_number);
+
+ //Deployment flavor 2
+ manufacturer_reference_number = nfodNEWCsarHlper.getNodeTemplatePropertyLeafValue(vnfConfig, "allowed_flavors#FG_partNumbereJqQjUkteF1#vendor_info#manufacturer_reference_number");
+ num_cpus = nfodNEWCsarHlper.getNodeTemplatePropertyLeafValue(vnfConfig, "allowed_flavors#FG_partNumbereJqQjUkteF1#compute_flavor#num_cpus");
+ sp_part_number = nfodNEWCsarHlper.getNodeTemplatePropertyLeafValue(vnfConfig, "allowed_flavors#FG_partNumbereJqQjUkteF1#sp_part_number");
+
+ assertEquals("EP_manufacturerReferenceNumberkbAiqZZNzx1",manufacturer_reference_number);
+ assertEquals("1",num_cpus);
+ assertEquals("FG_partNumbereJqQjUkteF1",sp_part_number);
+ }
+
+ // added by QA
+ // Check that get vnfconfiguration not return as VFC
+ @Test
+ public void testNewGetVfcTypWithoutVnfCheckNames() {
+ List<NodeTemplate> vfcList = nfodNEWCsarHlper.getVfcListByVf("a6587663-b27f-4e88-8a86-604604302ce6");
+ assertNotNull(vfcList);
+ assertEquals(1, vfcList.size());
+ for (int i = 0; i < vfcList.size(); i++) {
+
+ String Name= vfcList.get(i).getName();
+
+ assertEquals(false, Name.equals("name_6GkVrOjnGp1_VNF_Configuration"));
+ }
+ }
+
}