Update nf_type for PNF in AAI
[so.git] / bpmn / MSOCommonBPMN / src / test / java / org / onap / so / bpmn / servicedecomposition / tasks / BBInputSetupTest.java
index 61a920e..bc751c3 100644 (file)
@@ -97,6 +97,7 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf;
 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy;
 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
 import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException;
@@ -113,6 +114,7 @@ import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
 import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
 import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
 import org.onap.so.db.catalog.beans.VfModuleCustomization;
 import org.onap.so.db.catalog.beans.VnfResourceCustomization;
@@ -1734,6 +1736,28 @@ public class BBInputSetupTest {
         assertEquals(modelInfoGenericVnf, genericVnf.getModelInfoGenericVnf());
     }
 
+    @Test
+    public void testMapCatalogPnf() {
+        ModelInfoPnf modelInfoPnf = new ModelInfoPnf();
+        Pnf pnf = new Pnf();
+        RequestDetails requestDetails = new RequestDetails();
+        ModelInfo modelInfo = new ModelInfo();
+        modelInfo.setModelCustomizationUuid("modelCustomizationUUID");
+        requestDetails.setModelInfo(modelInfo);
+        Service service = new Service();
+
+        PnfResourceCustomization resourceCust = new PnfResourceCustomization();
+        resourceCust.setModelCustomizationUUID("pnfModelCustomizationUUID");
+        service.getPnfCustomizations().add(resourceCust);
+        resourceCust.setModelCustomizationUUID("modelCustomizationUUID");
+
+        doReturn(modelInfoPnf).when(bbInputSetupMapperLayer).mapCatalogPnfToPnf(resourceCust);
+
+        SPY_bbInputSetup.mapCatalogPnf(pnf, modelInfo, service);
+
+        assertEquals(modelInfoPnf, pnf.getModelInfoPnf());
+    }
+
     @Test
     public void testMapCatalogCollectionAndInstanceGroup() {
         ModelInfoCollection modelInfoCollection = new ModelInfoCollection();
@@ -2123,6 +2147,7 @@ public class BBInputSetupTest {
         String vfModuleInstanceName = "vfModuleInstanceName";
         String childServiceInstanceId = "childServiceInstanceId";
         String childServiceInstanceName = "childServiceInstanceName";
+        String pnfInstanceName = "pnfInstanceName";
 
         expected.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId);
         expected.put(ResourceKey.NETWORK_ID, networkId);
@@ -2136,6 +2161,7 @@ public class BBInputSetupTest {
         expected.put(ResourceKey.VF_MODULE_INSTANCE_NAME, vfModuleInstanceName);
         expected.put(ResourceKey.CHILD_SERVICE_INSTANCE_ID, childServiceInstanceId);
         expected.put(ResourceKey.CHILD_SERVICE_INSTANCE_NAME, childServiceInstanceName);
+        expected.put(ResourceKey.PNF_INSTANCE_NAME, pnfInstanceName);
 
         WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
         workflowResourceIds.setServiceInstanceId(serviceInstanceId);
@@ -2150,6 +2176,7 @@ public class BBInputSetupTest {
         workflowResourceIds.setVfModuleInstanceName(vfModuleInstanceName);
         workflowResourceIds.setChildServiceInstanceId(childServiceInstanceId);
         workflowResourceIds.setChildServiceInstanceName(childServiceInstanceName);
+        workflowResourceIds.setPnfInstanceName(pnfInstanceName);
 
         SPY_bbInputSetup.populateLookupKeyMapWithIds(workflowResourceIds, actual);
 
@@ -2287,45 +2314,6 @@ public class BBInputSetupTest {
         assertThat(actual, sameBeanAs(expected));
     }
 
-    @Test
-    public void testgetGBBMacroCloudConfiguration() throws Exception {
-        org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue(
-                new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class);
-        CloudConfiguration cloudConfig = null;
-        org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = new org.onap.aai.domain.yang.CloudRegion();
-        aaiCloudRegion.setCloudOwner("test-owner-name");
-        Resources resources = serviceMacro.getResources();
-        doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(any(CloudConfiguration.class));
-        CloudRegion expected = new CloudRegion();
-        expected.setLcpCloudRegionId("mdt1");
-        expected.setCloudOwner("test-owner-name");
-        expected.setTenantId("88a6ca3ee0394ade9403f075db23167e");
-
-        CloudRegion actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources);
-        assertThat(actual, sameBeanAs(expected));
-
-        serviceMacro = mapper.readValue(new File(RESOURCE_PATH + "ServiceMacroVnfs.json"),
-                org.onap.so.serviceinstancebeans.Service.class);
-        resources = serviceMacro.getResources();
-
-        actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources);
-        assertThat(actual, sameBeanAs(expected));
-
-        serviceMacro = mapper.readValue(new File(RESOURCE_PATH + "ServiceMacroNetworks.json"),
-                org.onap.so.serviceinstancebeans.Service.class);
-        resources = serviceMacro.getResources();
-
-        actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources);
-        assertThat(actual, sameBeanAs(expected));
-
-        serviceMacro = mapper.readValue(new File(RESOURCE_PATH + "ServiceMacroNoCloudConfig.json"),
-                org.onap.so.serviceinstancebeans.Service.class);
-        resources = serviceMacro.getResources();
-
-        actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources);
-        assertNull(actual);
-    }
-
     @Test
     public void testgetGBBMacroWithEmptyUserParams() throws Exception {
         String resourceId = "123";