From b0b12b71503f017e814c6aef6a0ab85f267e250c Mon Sep 17 00:00:00 2001 From: "Kalkere Ramesh, Sharan (sk720x)" Date: Fri, 7 Dec 2018 12:05:06 -0500 Subject: add in volume group model info lookup added in the lookup of volume group for vf on macro as well Change-Id: Ie3582724b78e88a0b2dd90c37dff086b5e2c3bf9 Issue-ID: SO-1298 Signed-off-by: Kalkere Ramesh, Sharan (sk720x) --- .../servicedecomposition/tasks/BBInputSetup.java | 36 ++++++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'bpmn/MSOCommonBPMN/src/main') 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 c0f1c48b76..433a1f4516 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 @@ -386,16 +386,10 @@ public class BBInputSetup implements JavaDelegate { ModelInfo vnfModelInfo = new ModelInfo(); vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); this.mapCatalogVnf(tempVnf, vnfModelInfo, service); - if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) == null) { - for(VolumeGroup volumeGroup : tempVnf.getVolumeGroups()) { - String volumeGroupCustId = - this.bbInputSetupUtils.getAAIVolumeGroup(cloudConfiguration.getCloudOwner(), - cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()).getModelCustomizationId(); - if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) { - lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); - break; - } - } + Optional volumeGroupIdOp = getVolumeGroupIdRelatedToVfModule(tempVnf, modelInfo, cloudConfiguration.getCloudOwner(), + cloudConfiguration.getLcpCloudRegionId(), lookupKeyMap); + if(volumeGroupIdOp.isPresent()) { + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupIdOp.get()); } break; } @@ -424,6 +418,21 @@ public class BBInputSetup implements JavaDelegate { throw new Exception("Could not find relevant information for related VNF"); } } + + protected Optional getVolumeGroupIdRelatedToVfModule(GenericVnf vnf, ModelInfo modelInfo, + String cloudOwner, String cloudRegionId, Map lookupKeyMap) { + if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) == null) { + for(VolumeGroup volumeGroup : vnf.getVolumeGroups()) { + String volumeGroupCustId = + bbInputSetupUtils.getAAIVolumeGroup(cloudOwner, + cloudRegionId, volumeGroup.getVolumeGroupId()).getModelCustomizationId(); + if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) { + return Optional.of(volumeGroup.getVolumeGroupId()); + } + } + } + return Optional.empty(); + } protected void mapCatalogVfModule(VfModule vfModule, ModelInfo modelInfo, Service service, String vnfModelCustomizationUUID) { @@ -1025,6 +1034,13 @@ public class BBInputSetup implements JavaDelegate { ModelInfo vfModuleModelInfo = new ModelInfo(); vfModuleModelInfo.setModelCustomizationId(vfModuleCustomizationUUID); this.mapCatalogVfModule(vfModule, vfModuleModelInfo, service, vnfModelCustomizationUUID); + if(cloudRegion != null) { + Optional volumeGroupIdOp = getVolumeGroupIdRelatedToVfModule(vnf, vfModuleModelInfo, cloudRegion.getCloudOwner(), + cloudRegion.getLcpCloudRegionId(), lookupKeyMap); + if(volumeGroupIdOp.isPresent()) { + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupIdOp.get()); + } + } break; } } -- cgit 1.2.3-korg