diff options
author | Steve Smokowski <ss835w@att.com> | 2020-03-10 14:54:01 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-03-10 14:54:01 +0000 |
commit | b6e82755d6b3454951d3627dd3f51a0e2a50f49b (patch) | |
tree | 2cd478466eacc3031f14adb1cc15cbf6b6cadd37 /bpmn/MSOCommonBPMN/src/main/java/org | |
parent | 09c30d079215950c28494de4a1c20791da509e97 (diff) | |
parent | 5611741592b4a12c411eb83054318f4da86a1ead (diff) |
Merge "update bbinputsetup to handle volume group replace"
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java/org')
2 files changed, 42 insertions, 7 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 e7e51bba77..f0954c3695 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 @@ -662,6 +662,7 @@ public class BBInputSetup implements JavaDelegate { } protected void populateVolumeGroup(BBInputSetupParameter parameter) throws Exception { + String replaceVnfModelCustomizationUUID = null; VolumeGroup volumeGroup = null; GenericVnf vnf = null; String vnfModelCustomizationUUID = null; @@ -674,7 +675,11 @@ public class BBInputSetup implements JavaDelegate { for (RelatedInstanceList relatedInstList : parameter.getRelatedInstanceList()) { RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { - vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationUuid(); + if (parameter.getIsReplace()) { + replaceVnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId(); + } else { + vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId(); + } break; } } @@ -685,8 +690,13 @@ public class BBInputSetup implements JavaDelegate { vnfModelCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId(); ModelInfo vnfModelInfo = new ModelInfo(); - vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); - mapCatalogVnf(tempVnf, vnfModelInfo, parameter.getService()); + if (parameter.getIsReplace()) { + vnfModelInfo.setModelCustomizationUuid(replaceVnfModelCustomizationUUID); + mapCatalogVnf(tempVnf, vnfModelInfo, parameter.getServiceModel().getNewService()); + } else { + vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); + mapCatalogVnf(tempVnf, vnfModelInfo, parameter.getServiceModel().getCurrentService()); + } break; } } @@ -696,6 +706,22 @@ public class BBInputSetup implements JavaDelegate { && volumeGroupTemp.getVolumeGroupId() .equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.VOLUME_GROUP_ID))) { volumeGroup = volumeGroupTemp; + if (volumeGroup.getModelInfoVfModule() == null) { + throw new Exception( + "ModelInfoVfModule is null for VolumeGroup: " + volumeGroup.getVolumeGroupId()); + } + String volumeGroupCustId = volumeGroup.getModelInfoVfModule().getModelCustomizationUUID(); + ModelInfo modelInfoVolumeGroup = new ModelInfo(); + modelInfoVolumeGroup.setModelCustomizationId(volumeGroupCustId); + if (parameter.getIsReplace() && parameter.getLookupKeyMap().get(ResourceKey.VOLUME_GROUP_ID) != null + && volumeGroupTemp.getVolumeGroupId() + .equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.VOLUME_GROUP_ID))) { + mapCatalogVolumeGroup(volumeGroupTemp, modelInfoVolumeGroup, + parameter.getServiceModel().getNewService(), replaceVnfModelCustomizationUUID); + } else { + mapCatalogVolumeGroup(volumeGroupTemp, modelInfoVolumeGroup, + parameter.getServiceModel().getCurrentService(), vnfModelCustomizationUUID); + } break; } } @@ -703,10 +729,13 @@ public class BBInputSetup implements JavaDelegate { volumeGroup = createVolumeGroup(parameter.getLookupKeyMap(), parameter.getResourceId(), parameter.getInstanceName(), generatedVnfType, parameter.getInstanceParams()); vnf.getVolumeGroups().add(volumeGroup); - } - if (volumeGroup != null) { - mapCatalogVolumeGroup(volumeGroup, parameter.getModelInfo(), parameter.getService(), - vnfModelCustomizationUUID); + if (parameter.getIsReplace()) { + mapCatalogVolumeGroup(volumeGroup, parameter.getModelInfo(), + parameter.getServiceModel().getNewService(), replaceVnfModelCustomizationUUID); + } else { + mapCatalogVolumeGroup(volumeGroup, parameter.getModelInfo(), + parameter.getServiceModel().getCurrentService(), vnfModelCustomizationUUID); + } } } else { logger.debug("Related VNF instance Id not found: {}", @@ -1514,6 +1543,9 @@ public class BBInputSetup implements JavaDelegate { parameter.setInstanceName(vfModules.getVolumeGroupInstanceName()); parameter.setVnfType(vnfType); parameter.setInstanceParams(vfModules.getInstanceParams()); + ServiceModel serviceModel = new ServiceModel(); + serviceModel.setCurrentService(service); + parameter.setServiceModel(serviceModel); this.populateVolumeGroup(parameter); } else { parameter.setResourceId(lookupKeyMap.get(ResourceKey.VF_MODULE_ID)); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index 28ec71b13f..67d073d7b6 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -186,6 +186,9 @@ public class BBInputSetupMapperLayer { protected VolumeGroup mapAAIVolumeGroup(org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup) { VolumeGroup volumeGroup = modelMapper.map(aaiVolumeGroup, VolumeGroup.class); + ModelInfoVfModule modelInfo = new ModelInfoVfModule(); + modelInfo.setModelCustomizationUUID(aaiVolumeGroup.getModelCustomizationId()); + volumeGroup.setModelInfoVfModule(modelInfo); volumeGroup.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiVolumeGroup.getOrchestrationStatus())); return volumeGroup; } |