From 59ed95e6ffe50af4d554de6ac916c30f89c84f14 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Tue, 5 Feb 2019 17:21:11 -0500 Subject: populate modelinfovfmodule from catalog db add in a junit test to check if all vfModules model info get populated populate all vf modules for the vnf not just the orchestrated Change-Id: Icaed88f217f61861157313a0c7e09a28fff74fdb Issue-ID: SO-1467 Signed-off-by: Benjamin, Max (mb388a) --- .../onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java | 9 ++++----- .../so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java | 10 ++++++++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index ca0a78a3f2..fbff0620a3 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -406,17 +406,16 @@ public class BBInputSetup implements JavaDelegate { if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null && vfModuleTemp.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) { vfModule = vfModuleTemp; - String vfModuleCustId = bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()).getModelCustomizationId(); - modelInfo.setModelCustomizationId(vfModuleCustId); - break; } + String vfModuleCustId = bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModuleTemp.getVfModuleId()).getModelCustomizationId(); + ModelInfo modelInfoVfModule = new ModelInfo(); + modelInfoVfModule.setModelCustomizationId(vfModuleCustId); + mapCatalogVfModule(vfModuleTemp, modelInfoVfModule, service, vnfModelCustomizationUUID); } if (vfModule == null && bbName.equalsIgnoreCase(AssignFlows.VF_MODULE.toString())) { vfModule = createVfModule(lookupKeyMap, resourceId, instanceName, instanceParams); vnf.getVfModules().add(vfModule); - } - if(vfModule != null) { mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); } } else { diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index 35a7005751..56875d315b 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -2551,6 +2551,12 @@ public class BBInputSetupTest { volumeGroup.setVolumeGroupId(volumeGroupId); vnf.getVolumeGroups().add(volumeGroup); serviceInstance.getVnfs().add(vnf); + VfModule vfModule1 = new VfModule(); + vfModule1.setVfModuleId("vfModuleId1"); + VfModule vfModule2 = new VfModule(); + vfModule2.setVfModuleId("vfModuleId2"); + vnf.getVfModules().add(vfModule1); + vnf.getVfModules().add(vfModule2); Map lookupKeyMap = new HashMap<>(); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId); String resourceId = vfModuleId; @@ -2563,16 +2569,20 @@ public class BBInputSetupTest { vnfAAI.setModelCustomizationId("vnfModelCustId"); org.onap.aai.domain.yang.VolumeGroup volumeGroupAAI = new org.onap.aai.domain.yang.VolumeGroup(); volumeGroupAAI.setModelCustomizationId(vfModuleCustomizationId); + org.onap.aai.domain.yang.VfModule vfModuleAAI = new org.onap.aai.domain.yang.VfModule(); + vfModuleAAI.setModelCustomizationId(vfModuleCustomizationId); doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); doReturn(volumeGroupAAI).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(CLOUD_OWNER, cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + doReturn(vfModuleAAI).when(SPY_bbInputSetupUtils).getAAIVfModule(isA(String.class), isA(String.class)); doNothing().when(SPY_bbInputSetup).mapCatalogVnf(isA(GenericVnf.class), isA(ModelInfo.class), isA(Service.class)); doNothing().when(SPY_bbInputSetup).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), isA(Service.class), isA(String.class)); SPY_bbInputSetup.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, instanceParams, cloudConfiguration); + verify(SPY_bbInputSetup, times(3)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), isA(Service.class), isA(String.class)); assertEquals("Lookup Key Map populated with VfModule Id", vfModuleId, lookupKeyMap.get(ResourceKey.VF_MODULE_ID)); assertEquals("Lookup Key Map populated with VolumeGroup Id", volumeGroupId, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID)); } -- cgit 1.2.3-korg