Change code in appc dispatcher for new LCMs in R6
[appc.git] / appc-inbound / appc-artifact-handler / provider / src / test / java / org / onap / appc / artifact / handler / node / ArtifactHandlerNodeTest.java
index cb3a462..98df4d2 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP : APPC
  * ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Copyright (C) 2017 Amdocs
  * ================================================================================
@@ -76,7 +76,8 @@ public class ArtifactHandlerNodeTest {
         artifactHandlerNode = Mockito.spy(new ArtifactHandlerNode());
         PowerMockito.mockStatic(DBService.class);
         dbServiceMock = Mockito.mock(DBService.class);
-        Mockito.doReturn("12345").when(dbServiceMock).getInternalVersionNumber(Mockito.any(), Mockito.anyString(), Mockito.anyString());
+        Mockito.doReturn("12345")
+                .when(dbServiceMock).getInternalVersionNumber(Mockito.any(), Mockito.anyString(), Mockito.anyString());
         PowerMockito.when(DBService.initialise()).thenReturn(dbServiceMock);
         PowerMockito.mockStatic(YANGGeneratorFactory.class);
         YANGGenerator yangGeneratorMock = Mockito.mock(YANGGenerator.class);
@@ -97,7 +98,7 @@ public class ArtifactHandlerNodeTest {
         JSONObject documentInfo = getDocumentInfo("templates/reference_template");
         documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, "reference_Junit.json");
         requestInfo.put("RequestInfo", "testValue");
-        requestInfo.put("request-id","testREQUEST_ID");
+        requestInfo.put("request-id", "testREQUEST_ID");
         input.put(SdcArtifactHandlerConstants.DOCUMENT_PARAMETERS, documentInfo);
         input.put(SdcArtifactHandlerConstants.REQUEST_INFORMATION, requestInfo);
         postData.put("input", input);
@@ -139,25 +140,39 @@ public class ArtifactHandlerNodeTest {
         String artifactId = "1";
         String yangContents = "SomeContent";
         Whitebox.invokeMethod(artifactHandlerNode, "updateYangContents", artifactId, yangContents);
-        Mockito.verify(dbServiceMock).updateYangContents(Mockito.any(SvcLogicContext.class),
-                Mockito.anyString(), Mockito.anyString());
+        Mockito.verify(dbServiceMock)
+                .updateYangContents(Mockito.any(SvcLogicContext.class), Mockito.anyString(), Mockito.anyString());
     }
 
     @Test
     public void testProcessVmList() throws Exception{
         String contentStr = "{\r\n\t\"action\": \"ConfigScaleOut\",\r\n\t\"action-level\": \"VNF\",\r\n\t\"scope\": "
-                + "{\r\n\t\t\"vnf-type\": \"ScaleOutVNF\",\r\n\t\t\"vnfc-type\": \"\"\r\n\t},\r\n\t\"template\": \"Y\",\r\n\t\"vm\": "
-                + "[\r\n\t{ \r\n\t\t\"vm-instance\": 1,\r\n\t\t\"template-id\":\"id1\",\r\n\t\t\r\n\t\t\"vnfc\": [{\r\n\t\t\t\"vnfc-instance\": 1,\r\n\t\t\t\"vnfc-type\": \"t1\",\r\n\t\t\t\"vnfc-function-code\": "
-                + "\"Testdbg\",\r\n\t\t\t\"group-notation-type\": \"GNType\",\r\n\t\t\t\"ipaddress-v4-oam-vip\": \"N\",\r\n\t\t\t\"group-notation-value\": "
-                + "\"GNValue\"\r\n\t\t}]\r\n\t},\r\n\t{ \r\n\t\t\"vm-instance\": 1,\r\n\t\t\"template-id\":\"id2\",\r\n\t\t\r\n\t\t\"vnfc\": [{\r\n\t\t\t\"vnfc-instance\": 1,\r\n\t\t\t\"vnfc-type\": "
-                + "\"t1\",\r\n\t\t\t\"vnfc-function-code\": \"Testdbg\",\r\n\t\t\t\"group-notation-type\": \"GNType\",\r\n\t\t\t\"ipaddress-v4-oam-vip\": \"N\",\r\n\t\t\t\"group-notation-value\": "
-                + "\"GNValue\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"vnfc-instance\": 2,\r\n\t\t\t\"vnfc-type\": \"t2\",\r\n\t\t\t\"vnfc-function-code\": \"Testdbg\",\r\n\t\t\t\"group-notation-type\": "
-                + "\"GNType\",\r\n\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n\t\t\t\"group-notation-value\": \"GNValue\"\r\n\t\t}]\r\n\t},\r\n\t{\r\n\t\t\"vm-instance\": 2,\r\n\t\t\"template-id\":\"id3\",\r\n\t\t\"vnfc\": "
-                + "[{\r\n\t\t\t\"vnfc-instance\": 1,\r\n\t\t\t\"vnfc-type\": \"t3\",\r\n\t\t\t\"vnfc-function-code\": \"Testdbg\",\r\n\t\t\t\"group-notation-type\": "
-                + "\"GNType\",\r\n\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n\t\t\t\"group-notation-value\": \"GNValue\"\r\n\t\t}]\r\n\t}],\r\n\t\"device-protocol\": "
-                + "\"TEST-PROTOCOL\",\r\n\t\"user-name\": \"Testnetconf\",\r\n\t\"port-number\": \"22\",\r\n\t\"artifact-list\": [{\r\n\t\t\"artifact-name\": \"Testv_template.json\",\r\n\t\t\"artifact-type\": "
-                + "\"Testconfig_template\"\r\n\t},\r\n\t{\r\n\t\t\"artifact-name\": \"TESTv_parameter_definitions.json\",\r\n\t\t\"artifact-type\": \"Testparameter_definitions\"\r\n\t},\r\n\t{\r\n\t\t\"artifact-name\": "
-                + "\"PD_JunitTESTv_parameter_yang.json\",\r\n\t\t\"artifact-type\": \"PD_definations\"\r\n\t}]\r\n}";
+                + "{\r\n\t\t\"vnf-type\": \"ScaleOutVNF\",\r\n\t\t\"vnfc-type\": \"\"\r\n\t},\r\n"
+                + "\t\"template\": \"Y\",\r\n\t\"vm\": "
+                + "[\r\n\t{ \r\n\t\t\"vm-instance\": 1,\r\n\t\t\"template-id\":\"id1\",\r\n\t\t\r\n\t\t\"vnfc\": "
+                + "[{\r\n\t\t\t\"vnfc-instance\": 1,\r\n\t\t\t\"vnfc-type\": \"t1\",\r\n\t\t\t\"vnfc-function-code\": "
+                + "\"Testdbg\",\r\n\t\t\t\"group-notation-type\": \"GNType\",\r\n"
+                + "\t\t\t\"ipaddress-v4-oam-vip\": \"N\",\r\n"
+                + "\t\t\t\"group-notation-value\": \"GNValue\"\r\n\t\t}]\r\n\t},\r\n"
+                + "\t{ \r\n\t\t\"vm-instance\": 1,\r\n\t\t\"template-id\":\"id2\",\r\n"
+                + "\t\t\r\n\t\t\"vnfc\": [{\r\n\t\t\t\"vnfc-instance\": 1,\r\n\t\t\t\"vnfc-type\": \"t1\",\r\n"
+                + "\t\t\t\"vnfc-function-code\": \"Testdbg\",\r\n\t\t\t\"group-notation-type\": \"GNType\",\r\n"
+                + "\t\t\t\"ipaddress-v4-oam-vip\": \"N\",\r\n\t\t\t\"group-notation-value\": \"GNValue\"\r\n\t\t},\r\n"
+                + "\t\t{\r\n\t\t\t\"vnfc-instance\": 2,\r\n\t\t\t\"vnfc-type\": \"t2\",\r\n"
+                + "\t\t\t\"vnfc-function-code\": \"Testdbg\",\r\n\t\t\t\"group-notation-type\": \"GNType\",\r\n"
+                + "\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n\t\t\t\"group-notation-value\": \"GNValue\"\r\n\t\t}]\r\n"
+                + "\t},\r\n\t{\r\n\t\t\"vm-instance\": 2,\r\n\t\t\"template-id\":\"id3\",\r\n"
+                + "\t\t\"vnfc\": [{\r\n\t\t\t\"vnfc-instance\": 1,\r\n\t\t\t\"vnfc-type\": \"t3\",\r\n"
+                + "\t\t\t\"vnfc-function-code\": \"Testdbg\",\r\n\t\t\t\"group-notation-type\": \"GNType\",\r\n"
+                + "\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n\t\t\t\"group-notation-value\": \"GNValue\"\r\n\t\t}]\r\n"
+                + "\t}],\r\n\t\"device-protocol\": \"TEST-PROTOCOL\",\r\n\t\"user-name\": \"Testnetconf\",\r\n"
+                + "\t\"port-number\": \"22\",\r\n\t\"artifact-list\": [{\r\n"
+                + "\t\t\"artifact-name\": \"Testv_template.json\",\r\n"
+                + "\t\t\"artifact-type\": \"Testconfig_template\"\r\n\t},\r\n"
+                + "\t{\r\n\t\t\"artifact-name\": \"TESTv_parameter_definitions.json\",\r\n"
+                + "\t\t\"artifact-type\": \"Testparameter_definitions\"\r\n\t},\r\n\t{\r\n"
+                + "\t\t\"artifact-name\": \"PD_JunitTESTv_parameter_yang.json\",\r\n"
+                + "\t\t\"artifact-type\": \"PD_definations\"\r\n\t}]\r\n}";
         JSONObject content=new JSONObject(contentStr);
         MockDBService dbService = MockDBService.initialise();
         SvcLogicContext context = new SvcLogicContext();
@@ -165,20 +180,20 @@ public class ArtifactHandlerNodeTest {
     }
 
     @Test
-    public void testProcessConfigTypeActions() throws Exception{
+    public void testProcessConfigTypeActions() throws Exception {
         String contentStr = "{\"action\": \"ConfigScaleOut\"}";
-        JSONObject content=new JSONObject(contentStr);
+        JSONObject content = new JSONObject(contentStr);
         MockDBService dbService = MockDBService.initialise();
         SvcLogicContext context = new SvcLogicContext();
-        context.setAttribute(SdcArtifactHandlerConstants.DEVICE_PROTOCOL,"Test");
+        context.setAttribute(SdcArtifactHandlerConstants.DEVICE_PROTOCOL, "Test");
         artifactHandlerNode.processConfigTypeActions(content, dbService, context);
     }
 
     @Test
     public void testProcessActionLists() throws Exception {
         String contentStr = "{\r\n\t\"action\": \"HealthCheck\",\r\n\t\"action-level\": \"vm\",\r\n\t\"scope\":"
-                + " {\r\n\t\t\"vnf-type\": \"vDBE-I\",\r\n\t\t\"vnfc-type\": null\r\n\t},\r\n\t\"template\": "
-                + "\"N\",\r\n\t\"device-protocol\": \"REST\",\r\n\t\"vnfc-function-code-list\": [\"SSC\", \"MMSC\"]\r\n}";
+                + " {\r\n\t\t\"vnf-type\": \"vDBE-I\",\r\n\t\t\"vnfc-type\": null\r\n\t},\r\n\t\"template\": \"N\",\r\n"
+                + "\t\"device-protocol\": \"REST\",\r\n\t\"vnfc-function-code-list\": [\"SSC\", \"MMSC\"]\r\n}";
         JSONObject content = new JSONObject(contentStr);
         JSONArray vmActionVnfcFunctionCodesList = new JSONArray();
         JSONArray vnfActionList = new JSONArray();
@@ -193,8 +208,8 @@ public class ArtifactHandlerNodeTest {
 
     @Test
     public void testIsCapabilityArtifactNeeded() throws Exception {
-        String scopeObjStr1= "{\"vnf-type\":\"someVnf\",\"vnfc-type\":\"somVnfc\"}";
-        String scopeObjStr2= "{\"vnf-type\":\"someVnf\",\"vnfc-type\":\"\"}";
+        String scopeObjStr1 = "{\"vnf-type\":\"someVnf\",\"vnfc-type\":\"somVnfc\"}";
+        String scopeObjStr2 = "{\"vnf-type\":\"someVnf\",\"vnfc-type\":\"\"}";
         JSONObject scope1 = new JSONObject(scopeObjStr1);
         JSONObject scope2 = new JSONObject(scopeObjStr2);
         SvcLogicContext context = new SvcLogicContext();
@@ -206,20 +221,30 @@ public class ArtifactHandlerNodeTest {
 
     @Test
     public void testProcessArtifactListsWithMultipleTemplates() throws Exception {
-        String contentStr = "{\r\n\t\t\"action\": \"ConfigScaleOut\",\r\n\t\t\"action-level\": \"vnf\",\r\n\t\t\"scope\": {\r\n\t\t\t\"vnf-type\": "
-                + "\"vCfgSO-0405\",\r\n\t\t\t\"vnfc-type\": \"\"\r\n\t\t},\r\n\t\t\"template\": \"Y\",\r\n\t\t\"vm\": [{\r\n\t\t\t\"template-id\": "
-                + "\"TID-0405-EZ\",\r\n\t\t\t\"vm-instance\": 1,\r\n\t\t\t\"vnfc\": [{\r\n\t\t\t\t\"vnfc-instance\": \"1\",\r\n\t\t\t\t\"vnfc-function-code\": "
-                + "\"Cfg-ez\",\r\n\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n\t\t\t\t\"group-notation-type\": \"first-vnfc-name\",\r\n\t\t\t\t\"group-notation-value\":"
-                + " \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vCfg-0405-ez\"\r\n\t\t\t}]\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"template-id\": "
-                + "\"TID-0405-EZ\",\r\n\t\t\t\"vm-instance\": 2,\r\n\t\t\t\"vnfc\": [{\r\n\t\t\t\t\"vnfc-instance\": \"1\",\r\n\t\t\t\t\"vnfc-function-code\": "
-                + "\"Cfg-ez\",\r\n\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n\t\t\t\t\"group-notation-type\": \"first-vnfc-name\",\r\n\t\t\t\t\"group-notation-value\":"
-                + " \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vCfg-0405-ez\"\r\n\t\t\t}]\r\n\t\t}],\r\n\t\t\"device-protocol\": \"ANSIBLE\",\r\n\t\t\"user-name\": \"root\","
-                + "\r\n\t\t\"port-number\": \"22\",\r\n\t\t\"artifact-list\": [{\r\n\t\t\t\"artifact-name\": \"template_ConfigScaleOut_vCfgSO-0405_0.0.1V_TID-0405-EZ.json\","
-                + "\r\n\t\t\t\"artifact-type\": \"config_template\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"artifact-name\": \"pd_ConfigScaleOut_vCfgSO-0405_0.0.1V_TID-0405-EZ.yaml\","
-                + "\r\n\t\t\t\"artifact-type\": \"parameter_definitions\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"artifact-name\": "
-                + "\"template_ConfigScaleOut_vCfgSO-0405_0.0.1V_TID-0405-EZ-2.json\",\r\n\t\t\t\"artifact-type\": \"config_template\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"artifact-name\": "
-                + "\"pd_ConfigScaleOut_vCfgSO-0405_0.0.1V_TID-0405-EZ-2.yaml\",\r\n\t\t\t\"artifact-type\": \"parameter_definitions\"\r\n\t\t}],\r\n\t\t\"template-id-list\":"
-                + " [\"TID-0405-EZ\",\r\n\t\t\"TID-0405-EZ-2\"],\r\n\t\t\"scopeType\": \"vnf-type\"\r\n\t}";
+        String contentStr = "{\r\n\t\t\"action\": \"ConfigScaleOut\",\r\n\t\t\"action-level\": \"vnf\",\r\n"
+                + "\t\t\"scope\": {\r\n\t\t\t\"vnf-type\": \"vCfgSO-0405\",\r\n\t\t\t\"vnfc-type\": \"\"\r\n\t\t},\r\n"
+                + "\t\t\"template\": \"Y\",\r\n\t\t\"vm\": [{\r\n\t\t\t\"template-id\": \"TID-0405-EZ\",\r\n"
+                + "\t\t\t\"vm-instance\": 1,\r\n\t\t\t\"vnfc\": [{\r\n\t\t\t\t\"vnfc-instance\": \"1\",\r\n"
+                + "\t\t\t\t\"vnfc-function-code\": \"Cfg-ez\",\r\n\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n"
+                + "\t\t\t\t\"group-notation-type\": \"first-vnfc-name\",\r\n"
+                + "\t\t\t\t\"group-notation-value\": \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vCfg-0405-ez\"\r\n"
+                + "\t\t\t}]\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"template-id\": \"TID-0405-EZ\",\r\n"
+                + "\t\t\t\"vm-instance\": 2,\r\n\t\t\t\"vnfc\": [{\r\n\t\t\t\t\"vnfc-instance\": \"1\",\r\n"
+                + "\t\t\t\t\"vnfc-function-code\": \"Cfg-ez\",\r\n\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n"
+                + "\t\t\t\t\"group-notation-type\": \"first-vnfc-name\",\r\n"
+                + "\t\t\t\t\"group-notation-value\": \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vCfg-0405-ez\"\r\n"
+                + "\t\t\t}]\r\n\t\t}],\r\n\t\t\"device-protocol\": \"ANSIBLE\",\r\n\t\t\"user-name\": \"root\",\r\n"
+                + "\t\t\"port-number\": \"22\",\r\n\t\t\"artifact-list\": [{\r\n"
+                + "\t\t\t\"artifact-name\": \"template_ConfigScaleOut_vCfgSO-0405_0.0.1V_TID-0405-EZ.json\",\r\n"
+                + "\t\t\t\"artifact-type\": \"config_template\"\r\n\t\t},\r\n\t\t{\r\n"
+                + "\t\t\t\"artifact-name\": \"pd_ConfigScaleOut_vCfgSO-0405_0.0.1V_TID-0405-EZ.yaml\",\r\n"
+                + "\t\t\t\"artifact-type\": \"parameter_definitions\"\r\n\t\t},\r\n\t\t{\r\n"
+                + "\t\t\t\"artifact-name\": \"template_ConfigScaleOut_vCfgSO-0405_0.0.1V_TID-0405-EZ-2.json\",\r\n"
+                + "\t\t\t\"artifact-type\": \"config_template\"\r\n\t\t},\r\n\t\t{\r\n"
+                + "\t\t\t\"artifact-name\": \"pd_ConfigScaleOut_vCfgSO-0405_0.0.1V_TID-0405-EZ-2.yaml\",\r\n"
+                + "\t\t\t\"artifact-type\": \"parameter_definitions\"\r\n\t\t}],\r\n"
+                + "\t\t\"template-id-list\": [\"TID-0405-EZ\",\r\n\t\t\"TID-0405-EZ-2\"],\r\n"
+                + "\t\t\"scopeType\": \"vnf-type\"\r\n\t}";
         JSONObject content = new JSONObject(contentStr);
         MockDBService dbService = MockDBService.initialise();
         SvcLogicContext context = new SvcLogicContext();
@@ -230,24 +255,35 @@ public class ArtifactHandlerNodeTest {
 
     @Test
     public void testProcessArtifactListsWithVnfcTypeList() throws Exception {
-        String contentStr = "{\r\n\t\"action\": \"Configure\",\r\n\t\"action-level\": \"vnf\",\r\n\t\"scope\": {\r\n\t\t\"vnf-type\": "
-                + "\"newtypeofvnf\",\r\n\t\t\"vnfc-type-list\": [\"vnfctype1\",\"vnfctype2\"]\r\n\t},\r\n\t\"template\": \"Y\",\r\n\t\"vm\":"
-                + " [{\r\n\t\t\t\"vm-instance\": 1,\r\n\t\t\t\"template-id\": \"vnfctype1\",\r\n\t\t\t\"vnfc\": [{\r\n\t\t\t\t\"vnfc-instance\": "
-                + "\"1\",\r\n\t\t\t\t\"vnfc-function-code\": \"fcx\",\r\n\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n\t\t\t\t\"group-notation-type\": "
-                + "\"first-vnfc-name\",\r\n\t\t\t\t\"group-notation-value\": \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vDBE\"\r\n\t\t\t}]\r\n\t\t},"
-                + "\r\n\t\t{\r\n\t\t\t\"vm-instance\": 1,\r\n\t\t\t\"template-id\": \"vnfctype2\",\r\n\t\t\t\"vnfc\": [{\r\n\t\t\t\t\"vnfc-instance\": "
-                + "\"1\",\r\n\t\t\t\t\"vnfc-function-code\": \"fcx\",\r\n\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n\t\t\t\t\"group-notation-type\": "
-                + "\"first-vnfc-name\",\r\n\t\t\t\t\"group-notation-value\": \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vDBE\"\r\n\t\t\t}]\r\n\t\t},"
-                + "\r\n\t\t{\r\n\t\t\t\"vm-instance\": 2,\r\n\t\t\t\"template-id\": \"vnfctype2\",\r\n\t\t\t\"vnfc\": [{\r\n\t\t\t\t\"vnfc-instance\": "
-                + "\"1\",\r\n\t\t\t\t\"vnfc-function-code\": \"fcx\",\r\n\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n\t\t\t\t\"group-notation-type\": "
-                + "\"first-vnfc-name\",\r\n\t\t\t\t\"group-notation-value\": \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vDBE\"\r\n\t\t\t}]\r\n\t\t}\r\n\t],"
-                + "\r\n\t\"device-protocol\": \"NETCONF-XML\",\r\n\t\"user-name\": \"netconf\",\r\n\t\"port-number\": \"20\",\r\n\t\"artifact-list\": "
-                + "[{\r\n\t\t\t\"artifact-name\": \"template_ConfigScaleOut_newtypeofvnf_0.0.1V_vnfctype1.xml\",\r\n\t\t\t\"artifact-type\": "
-                + "\"config_template\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"artifact-name\": \"pd_ConfigScaleOut_newtypeofvnf_0.0.1V_vnfctype1.yaml\","
-                + "\r\n\t\t\t\"artifact-type\": \"parameter_definitions\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"artifact-name\": "
-                + "\"template_ConfigScaleOut_newtypeofvnf_0.0.1V_vnfctype2.xml\",\r\n\t\t\t\"artifact-type\": "
-                + "\"config_template\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"artifact-name\": \"pd_ConfigScaleOut_newtypeofvnf_0.0.1V_vnfctype2.yaml\","
-                + "\r\n\t\t\t\"artifact-type\": \"parameter_definitions\"\r\n\t\t}\r\n\t],\r\n\t\"scopeType\": \"vnf-type\"\r\n}";
+        String contentStr = "{\r\n\t\"action\": \"Configure\",\r\n\t\"action-level\": \"vnf\",\r\n\t\"scope\": {\r\n"
+                + "\t\t\"vnf-type\": \"newtypeofvnf\",\r\n\t\t\"vnfc-type-list\": [\"vnfctype1\",\"vnfctype2\"]\r\n"
+                + "\t},\r\n\t\"template\": \"Y\",\r\n\t\"vm\": [{\r\n\t\t\t\"vm-instance\": 1,\r\n"
+                + "\t\t\t\"template-id\": \"vnfctype1\",\r\n\t\t\t\"vnfc\": [{\r\n"
+                + "\t\t\t\t\"vnfc-instance\": \"1\",\r\n\t\t\t\t\"vnfc-function-code\": \"fcx\",\r\n"
+                + "\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n"
+                + "\t\t\t\t\"group-notation-type\": \"first-vnfc-name\",\r\n"
+                + "\t\t\t\t\"group-notation-value\": \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vDBE\"\r\n\t\t\t}]\r\n"
+                + "\t\t},\r\n\t\t{\r\n\t\t\t\"vm-instance\": 1,\r\n\t\t\t\"template-id\": \"vnfctype2\",\r\n"
+                + "\t\t\t\"vnfc\": [{\r\n\t\t\t\t\"vnfc-instance\": \"1\",\r\n"
+                + "\t\t\t\t\"vnfc-function-code\": \"fcx\",\r\n\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n"
+                + "\t\t\t\t\"group-notation-type\": \"first-vnfc-name\",\r\n"
+                + "\t\t\t\t\"group-notation-value\": \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vDBE\"\r\n\t\t\t}]\r\n"
+                + "\t\t},\r\n\t\t{\r\n\t\t\t\"vm-instance\": 2,\r\n\t\t\t\"template-id\": \"vnfctype2\",\r\n"
+                + "\t\t\t\"vnfc\": [{\r\n\t\t\t\t\"vnfc-instance\": \"1\",\r\n"
+                + "\t\t\t\t\"vnfc-function-code\": \"fcx\",\r\n\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n"
+                + "\t\t\t\t\"group-notation-type\": \"first-vnfc-name\",\r\n"
+                + "\t\t\t\t\"group-notation-value\": \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vDBE\"\r\n\t\t\t}]\r\n"
+                + "\t\t}\r\n\t],\r\n\t\"device-protocol\": \"NETCONF-XML\",\r\n\t\"user-name\": \"netconf\",\r\n"
+                + "\t\"port-number\": \"20\",\r\n\t\"artifact-list\": [{\r\n"
+                + "\t\t\t\"artifact-name\": \"template_ConfigScaleOut_newtypeofvnf_0.0.1V_vnfctype1.xml\",\r\n"
+                + "\t\t\t\"artifact-type\": \"config_template\"\r\n\t\t},\r\n\t\t{\r\n"
+                + "\t\t\t\"artifact-name\": \"pd_ConfigScaleOut_newtypeofvnf_0.0.1V_vnfctype1.yaml\",\r\n"
+                + "\t\t\t\"artifact-type\": \"parameter_definitions\"\r\n\t\t},\r\n"
+                + "\t\t{\r\n\t\t\t\"artifact-name\": \"template_ConfigScaleOut_newtypeofvnf_0.0.1V_vnfctype2.xml\",\r\n"
+                + "\t\t\t\"artifact-type\": \"config_template\"\r\n\t\t},\r\n"
+                + "\t\t{\r\n\t\t\t\"artifact-name\": \"pd_ConfigScaleOut_newtypeofvnf_0.0.1V_vnfctype2.yaml\",\r\n"
+                + "\t\t\t\"artifact-type\": \"parameter_definitions\"\r\n\t\t}\r\n\t],\r\n"
+                + "\t\"scopeType\": \"vnf-type\"\r\n}";
         JSONObject content = new JSONObject(contentStr);
         MockDBService dbService = MockDBService.initialise();
         SvcLogicContext context = new SvcLogicContext();
@@ -256,9 +292,9 @@ public class ArtifactHandlerNodeTest {
         JSONObject scope = (JSONObject)content.get("scope");
         JSONArray vnfcTypeList = artifactHandlerNode.setVnfcTypeInformation(scope, context);
         artifactHandlerNode.processArtifactList(content, dbService, context, vnfcTypeList);
-        JSONArray vnfcLists = scope.getJSONArray("vnfc-type-list");        
+        JSONArray vnfcLists = scope.getJSONArray("vnfc-type-list");
         assertEquals(vnfcLists.toString(), "[\"vnfctype1\",\"vnfctype2\"]");
-        assertEquals(context.getAttribute("vnfc-type"),"vnfctype2");
+        assertEquals(context.getAttribute("vnfc-type"), "vnfctype2");
         assertNotNull (vnfcTypeList);
     }
 
@@ -274,7 +310,7 @@ public class ArtifactHandlerNodeTest {
         JSONObject documentInfo = getDocumentInfo("templates/pd_template");
         documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, "pd_Junit.json");
         requestInfo.put("RequestInfo", "testValue");
-        requestInfo.put("request-id","testREQUEST_ID");
+        requestInfo.put("request-id", "testREQUEST_ID");
         input.put(SdcArtifactHandlerConstants.DOCUMENT_PARAMETERS, documentInfo);
         input.put(SdcArtifactHandlerConstants.REQUEST_INFORMATION, requestInfo);
         postData.put("input", input);
@@ -285,15 +321,17 @@ public class ArtifactHandlerNodeTest {
 
     private JSONObject getDocumentInfo(String filename) throws IOException {
         JSONObject documentInfo = new JSONObject();
-        String artifactContent = IOUtils.toString(ArtifactHandlerProviderUtilTest.class.getClassLoader()
-                .getResourceAsStream(filename), Charset.defaultCharset());
+        String artifactContent = IOUtils.toString(
+                ArtifactHandlerProviderUtilTest.class.getClassLoader().getResourceAsStream(filename),
+                Charset.defaultCharset());
         documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS, artifactContent);
         documentInfo.put(SdcArtifactHandlerConstants.SERVICE_UUID, "12345");
         documentInfo.put(SdcArtifactHandlerConstants.DISTRIBUTION_ID, "12345");
         documentInfo.put(SdcArtifactHandlerConstants.SERVICE_NAME, "12345");
         documentInfo.put(SdcArtifactHandlerConstants.SERVICE_DESCRIPTION, "12345");
-        documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_UUID, "12345");        
+        documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_UUID, "12345");
         documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME, "12345");
+        documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_NAME, "12345");
         documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_VERSION, "12345");
         documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_TYPE, "12345");
         documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_UUID, "12345");
@@ -302,70 +340,81 @@ public class ArtifactHandlerNodeTest {
         documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_DESRIPTION, "12345");
         return documentInfo;
     }
-    
-    
+
+
     @Test
     public void testValidateAnsibleAdminArtifact() throws Exception {
-        String contentStr = "{\"fqdn-list\":[{\"vnf-management-server-fqdn\":\"fqdn-value1 url:port\",\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\","
-          + "\"region-id-list\":[{\"region-id\":\"san4a\",\"tenant-id-list\":[\"tenantuuid1\",\"tenantuuid2\"]},{\"region-id\":\"san4b\","
-          + "\"tenant-id-list\":[\"tenantuuid1\",\"tenantuuid2\"]}]},{\"cloud-owner\":\"nc1.0\",\"region-id-list\":[{\"region-id\":\"san4a\","
-          + "\"tenant-id-list\":[\"tenantuuid3\",\"tenantuuid4\"]}]}],\"description\":\"fqdn for east zone Production\",\"username\":\"attuid\","
-          + "\"create-date\":\"\",\"modify-username\":\"\",\"modify-date\":\"\"},{\"vnf-management-server-fqdn\":\"fqdn-value2 url:port\","
-          + "\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\",\"region-id-list\":[{\"region-id\":\"san4a\",\"tenant-id-list\":[\"tenantuuid5\","
-          + "\"tenantuuid6\"]},{\"region-id\":\"san4b\",\"tenant-id-list\":[\"tenantuuid5\",\"tenantuuid6\"]}]},{\"cloud-owner\":\"nc1.0\","
-          + "\"region-id-list\":[{\"region-id\":\"san4a\",\"tenant-id-list\":[\"tenantuuid7\",\"tenantuuid8\"]}]}],"
-          + "\"description\":\"fqdn for east zone Test\",\"username\":\"attuid\",\"create-date\":\"\","
-          + "\"modify-username\":\"\",\"modify-date\":\"\"}]}";
-
-        JSONObject documentInfo = new JSONObject();       
+        String contentStr = "{\"fqdn-list\":[{\"vnf-management-server-fqdn\":\"fqdn-value1 url:port\","
+                + "\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\",\"region-id-list\":[{\"region-id\":\"san4a\","
+                + "\"tenant-id-list\":[\"tenantuuid1\",\"tenantuuid2\"]},{\"region-id\":\"san4b\","
+                + "\"tenant-id-list\":[\"tenantuuid1\",\"tenantuuid2\"]}]},{\"cloud-owner\":\"nc1.0\","
+                + "\"region-id-list\":[{\"region-id\":\"san4a\",\"tenant-id-list\":[\"tenantuuid3\","
+                + "\"tenantuuid4\"]}]}],\"description\":\"fqdn for east zone Production\",\"username\":\"attuid\","
+                + "\"create-date\":\"\",\"modify-username\":\"\",\"modify-date\":\"\"},"
+                + "{\"vnf-management-server-fqdn\":\"fqdn-value2 url:port\","
+                + "\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\",\"region-id-list\":[{\"region-id\":\"san4a\","
+                + "\"tenant-id-list\":[\"tenantuuid5\",\"tenantuuid6\"]},{\"region-id\":\"san4b\","
+                + "\"tenant-id-list\":[\"tenantuuid5\",\"tenantuuid6\"]}]},{\"cloud-owner\":\"nc1.0\","
+                + "\"region-id-list\":[{\"region-id\":\"san4a\","
+                + "\"tenant-id-list\":[\"tenantuuid7\",\"tenantuuid8\"]}]}],"
+                + "\"description\":\"fqdn for east zone Test\",\"username\":\"attuid\",\"create-date\":\"\","
+                + "\"modify-username\":\"\",\"modify-date\":\"\"}]}";
+
+        JSONObject documentInfo = new JSONObject();
         documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS, contentStr);
         documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, "ansible_admin_FQDN_Artifact_0.0.1V.json");
         artifactHandlerNode.validateAnsibleAdminArtifact(documentInfo);
     }
-    
+
     @Test
     public void testValidateAnsibleAdminArtifactWithException() throws Exception {
-       String contentStrOne = "{\"fqdn-list\":[{\"vnf-management-server-fqdn\":\"fqdn-value1 url:port\",\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\","
-         + "\"region-id-list\":[{\"region-id\":\"san4a\",\"tenant-id-list\":[\"tenantuuid1\",\"tenantuuid2\"]},{\"region-id\":\"san4b\","
-         + "\"tenant-id-list\":[\"tenantuuid1\",\"tenantuuid2\"]}]},{\"cloud-owner\":\"nc1.0\",\"region-id-list\":[{\"region-id\":\"san4a\","
-         + "\"tenant-id-list\":[\"tenantuuid3\",\"tenantuuid4\"]}]}],\"description\":\"fqdn for east zone Production\",\"username\":\"attuid\","
-         + "\"create-date\":\"\",\"modify-username\":\"\",\"modify-date\":\"\"},{\"vnf-management-server-fqdn\":\"fqdn-value2 url:port\","
-         + "\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\",\"region-id-list\":[{\"region-id\":\"san4a\",\"tenant-id-list\":[\"tenantuuid1\","
-         + "\"tenantuuid6\"]},{\"region-id\":\"san4b\",\"tenant-id-list\":[\"tenantuuid5\",\"tenantuuid6\"]}]},{\"cloud-owner\":\"nc1.0\","
-         + "\"region-id-list\":[{\"region-id\":\"san4a\",\"tenant-id-list\":[\"tenantuuid7\",\"tenantuuid8\"]}]}],"
-         + "\"description\":\"fqdn for east zone Test\",\"username\":\"attuid\",\"create-date\":\"\","
-         + "\"modify-username\":\"\",\"modify-date\":\"\"}]}";
-       JSONObject documentInfoOne = new JSONObject();       
-       documentInfoOne.put(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS, contentStrOne);
-       documentInfoOne.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, "ansible_admin_FQDN_Artifact_0.0.1V.json");
-       
-       try {
-           artifactHandlerNode.validateAnsibleAdminArtifact(documentInfoOne);
-           fail("Missing exception");
-           }catch(ArtifactHandlerInternalException e) {
+        String contentStrOne = "{\"fqdn-list\":[{\"vnf-management-server-fqdn\":\"fqdn-value1 url:port\","
+                + "\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\",\"region-id-list\":[{\"region-id\":\"san4a\","
+                + "\"tenant-id-list\":[\"tenantuuid1\",\"tenantuuid2\"]},{\"region-id\":\"san4b\","
+                + "\"tenant-id-list\":[\"tenantuuid1\",\"tenantuuid2\"]}]},{\"cloud-owner\":\"nc1.0\","
+                + "\"region-id-list\":[{\"region-id\":\"san4a\","
+                + "\"tenant-id-list\":[\"tenantuuid3\",\"tenantuuid4\"]}]}],"
+                + "\"description\":\"fqdn for east zone Production\",\"username\":\"attuid\",\"create-date\":\"\","
+                + "\"modify-username\":\"\",\"modify-date\":\"\"},"
+                + "{\"vnf-management-server-fqdn\":\"fqdn-value2 url:port\","
+                + "\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\",\"region-id-list\":[{\"region-id\":\"san4a\","
+                + "\"tenant-id-list\":[\"tenantuuid1\",\"tenantuuid6\"]},{\"region-id\":\"san4b\","
+                + "\"tenant-id-list\":[\"tenantuuid5\",\"tenantuuid6\"]}]},{\"cloud-owner\":\"nc1.0\","
+                + "\"region-id-list\":[{\"region-id\":\"san4a\","
+                + "\"tenant-id-list\":[\"tenantuuid7\",\"tenantuuid8\"]}]}],"
+                + "\"description\":\"fqdn for east zone Test\",\"username\":\"attuid\",\"create-date\":\"\","
+                + "\"modify-username\":\"\",\"modify-date\":\"\"}]}";
+        JSONObject documentInfoOne = new JSONObject();
+        documentInfoOne.put(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS, contentStrOne);
+        documentInfoOne.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, "ansible_admin_FQDN_Artifact_0.0.1V.json");
+
+        try {
+            artifactHandlerNode.validateAnsibleAdminArtifact(documentInfoOne);
+            fail("Missing exception");
+        } catch (ArtifactHandlerInternalException e) {
             assertTrue(e.getMessage().contains("Validation Failure"));
-            }
-       
+        }
+
     }
-    
+
     @Test
     public void testValidateAnsibleAdminArtifactWithJSONException() throws Exception {
-        String contentStrOne = "{\"fqdn-list\":[{\"vnf-management-server-fqdn\":\"fqdn-value1 url:port\",\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\"}";          
-       
-        JSONObject documentInfoOne = new JSONObject();       
+        String contentStrOne =
+                "{\"fqdn-list\":[{\"vnf-management-server-fqdn\":\"fqdn-value1 url:port\",\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\"}";
+
+        JSONObject documentInfoOne = new JSONObject();
         documentInfoOne.put(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS, contentStrOne);
         documentInfoOne.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, "ansible_admin_FQDN_Artifact_0.0.1V.json");
-               
+
         try {
             artifactHandlerNode.validateAnsibleAdminArtifact(documentInfoOne);
             fail("Missing exception");
-        }catch(ArtifactHandlerInternalException je) {
-          assertTrue(je.getMessage().contains("JSON Exception"));
-          
-        }           
-       
-     }
-    
+        } catch (ArtifactHandlerInternalException je) {
+            assertTrue(je.getMessage().contains("JSON Exception"));
+        }
+
+    }
+
     @Test
     public void testProcessArtifactWithException() throws Exception {
         SvcLogicContext ctx = new SvcLogicContext();
@@ -376,12 +425,13 @@ public class ArtifactHandlerNodeTest {
         inParams.put("response_prefix", "prefix");
         JSONObject requestInfo = new JSONObject();
         JSONObject documentInfo = new JSONObject();
-        String artifactContent = IOUtils.toString(ArtifactHandlerProviderUtilTest.class.getClassLoader()
-                .getResourceAsStream("templates/reference_template"), Charset.defaultCharset());
+        String artifactContent = IOUtils.toString(
+                ArtifactHandlerProviderUtilTest.class.getClassLoader().getResourceAsStream("templates/reference_template"),
+                Charset.defaultCharset());
         documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS, artifactContent);
         documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, "");
         requestInfo.put("RequestInfo", "testValue");
-        requestInfo.put("request-id","testREQUEST_ID");
+        requestInfo.put("request-id", "testREQUEST_ID");
         input.put(SdcArtifactHandlerConstants.DOCUMENT_PARAMETERS, documentInfo);
         input.put(SdcArtifactHandlerConstants.REQUEST_INFORMATION, requestInfo);
         postData.put("input", input);
@@ -389,11 +439,12 @@ public class ArtifactHandlerNodeTest {
         try {
             artifactHandlerNode.processArtifact(inParams, ctx);
             fail("Missing exception");
-        }catch(Exception e) {
-          assertTrue(e.getMessage().contains("Missing Artifact Name"));
+        } catch (Exception e) {
+            assertTrue(e.getMessage().contains("Missing Artifact Name"));
         }
-       
+
     }
+
     @Test
     public void testProcessArtifactWithExceptionforAnsible() throws Exception {
         SvcLogicContext ctx = new SvcLogicContext();
@@ -404,25 +455,26 @@ public class ArtifactHandlerNodeTest {
         inParams.put("response_prefix", "prefix");
         JSONObject requestInfo = new JSONObject();
         JSONObject documentInfo = new JSONObject();
-        String artifactContent = IOUtils.toString(ArtifactHandlerProviderUtilTest.class.getClassLoader()
-                .getResourceAsStream("templates/reference_template"), Charset.defaultCharset());
+        String artifactContent = IOUtils.toString(
+                ArtifactHandlerProviderUtilTest.class.getClassLoader().getResourceAsStream("templates/reference_template"),
+                Charset.defaultCharset());
         documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS, artifactContent);
         documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, "ansible_admin_FQDN_Artifact_0.0.2V.json");
         requestInfo.put("RequestInfo", "testValue");
-        requestInfo.put("request-id","testREQUEST_ID");
+        requestInfo.put("request-id", "testREQUEST_ID");
         input.put(SdcArtifactHandlerConstants.DOCUMENT_PARAMETERS, documentInfo);
         input.put(SdcArtifactHandlerConstants.REQUEST_INFORMATION, requestInfo);
         postData.put("input", input);
         inParams.put("postData", postData.toString());
-        
+
         try {
-             artifactHandlerNode.processArtifact(inParams, ctx);
-             fail("Missing exception");
-        }catch(Exception e) {
-           assertTrue(e.getMessage().contains("JSON Exception:ansible admin"));
+            artifactHandlerNode.processArtifact(inParams, ctx);
+            fail("Missing exception");
+        } catch (Exception e) {
+            assertTrue(e.getMessage().contains("JSON Exception:ansible admin"));
         }
-     }
-    
+    }
+
     @Test
     public void testProcessAndStoreCapablitiesArtifact() throws Exception {
         ArtifactHandlerNode ah = new ArtifactHandlerNode();
@@ -435,6 +487,7 @@ public class ArtifactHandlerNodeTest {
         documentInfo.put(SdcArtifactHandlerConstants.SERVICE_DESCRIPTION, "testDesc");
         documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_UUID, "testRes");
         documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME, "testResIns");
+        documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_NAME, "testResName");
         documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_VERSION, "testVers");
         documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_TYPE, "testResType");
         documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_UUID, "testArtifactUuid");
@@ -443,6 +496,6 @@ public class ArtifactHandlerNodeTest {
         Whitebox.invokeMethod(ah, "processAndStoreCapabilitiesArtifact", dbService, documentInfo, capabilities,
                 "artifactName", "someVnf");
     }
-    
+
 
 }