diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
-rw-r--r-- | bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java | 56 |
1 files changed, 49 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 c36aaac5e1..f192024007 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 @@ -1272,7 +1272,8 @@ public class BBInputSetup implements JavaDelegate { || requestAction.equalsIgnoreCase("activateFabricConfiguration") || requestAction.equalsIgnoreCase("recreateInstance") || requestAction.equalsIgnoreCase("replaceInstance") - || requestAction.equalsIgnoreCase("upgradeInstance") || requestAction.equalsIgnoreCase("healthCheck")) { + || requestAction.equalsIgnoreCase("upgradeInstance") || requestAction.equalsIgnoreCase("healthCheck") + || requestAction.equalsIgnoreCase("upgradeCnf")) { return getGBBMacroExistingService(executeBB, lookupKeyMap, bbName, requestAction, requestDetails.getCloudConfiguration()); } @@ -1489,6 +1490,27 @@ public class BBInputSetup implements JavaDelegate { cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion); } gBB.setCloudRegion(cloudRegion); + String upgradeCnfModelCustomizationUUID = ""; + String upgradeCnfVfModuleModelCustomizationUUID = ""; + String upgradeCnfModelVersionId = ""; + String upgradeCnfVfModuleModelVersionId = ""; + if (requestDetails.getRelatedInstanceList() != null) { + for (RelatedInstanceList relatedInstList : requestDetails.getRelatedInstanceList()) { + RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); + // condition -1 + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf) + && requestAction.equalsIgnoreCase("upgradeCnf")) { + upgradeCnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId(); + upgradeCnfModelVersionId = relatedInstance.getModelInfo().getModelVersionId(); + } + // condition -2 + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vfModule) + && parameter.getRequestAction().equals("upgradeCnf")) { + upgradeCnfVfModuleModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId(); + upgradeCnfVfModuleModelVersionId = relatedInstance.getModelInfo().getModelVersionId(); + } + } + } if (bbName.contains(VNF) || (bbName.contains(CONTROLLER) && (VNF).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) { for (GenericVnf genericVnf : serviceInstance.getVnfs()) { @@ -1496,12 +1518,18 @@ public class BBInputSetup implements JavaDelegate { && genericVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(genericVnf.getVnfId()); ModelInfo modelInfo = new ModelInfo(); - if (vnf != null) { + if ("upgradeCnf".equalsIgnoreCase(requestAction) && upgradeCnfModelCustomizationUUID != null) { + modelInfo.setModelCustomizationUuid(upgradeCnfModelCustomizationUUID); + modelInfo.setModelVersionId(upgradeCnfModelVersionId); + this.mapCatalogVnf(genericVnf, modelInfo, service); + } else if (vnf != null) { modelInfo.setModelCustomizationUuid(vnf.getModelCustomizationId()); + this.mapCatalogVnf(genericVnf, modelInfo, service); } - this.mapCatalogVnf(genericVnf, modelInfo, service); + } } + } else if (bbName.contains(VF_MODULE) || (bbName.contains(CONTROLLER) && (VF_MODULE).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) { for (GenericVnf vnf : serviceInstance.getVnfs()) { @@ -1511,14 +1539,28 @@ public class BBInputSetup implements JavaDelegate { String vnfModelCustomizationUUID = this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId(); ModelInfo vnfModelInfo = new ModelInfo(); - vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); - this.mapCatalogVnf(vnf, vnfModelInfo, service); + if ("upgradeCnf".equalsIgnoreCase(requestAction) && upgradeCnfModelCustomizationUUID != null) { + vnfModelInfo.setModelCustomizationUuid(upgradeCnfModelCustomizationUUID); + vnfModelInfo.setModelVersionId(upgradeCnfModelVersionId); + this.mapCatalogVnf(vnf, vnfModelInfo, service); + } else { + vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); + this.mapCatalogVnf(vnf, vnfModelInfo, service); + } lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnf.getVnfId()); String vfModuleCustomizationUUID = this.bbInputSetupUtils .getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()).getModelCustomizationId(); ModelInfo vfModuleModelInfo = new ModelInfo(); - vfModuleModelInfo.setModelCustomizationId(vfModuleCustomizationUUID); - this.mapCatalogVfModule(vfModule, vfModuleModelInfo, service, vnfModelCustomizationUUID); + if ("upgradeCnf".equalsIgnoreCase(requestAction) + && upgradeCnfVfModuleModelCustomizationUUID != null) { + vfModuleModelInfo.setModelCustomizationUuid(upgradeCnfVfModuleModelCustomizationUUID); + vfModuleModelInfo.setModelVersionId(upgradeCnfVfModuleModelVersionId); + this.mapCatalogVfModule(vfModule, vfModuleModelInfo, service, + upgradeCnfVfModuleModelCustomizationUUID); + } else { + vfModuleModelInfo.setModelCustomizationId(vfModuleCustomizationUUID); + this.mapCatalogVfModule(vfModule, vfModuleModelInfo, service, vnfModelCustomizationUUID); + } if (cloudRegion != null) { Optional<String> volumeGroupIdOp = getVolumeGroupIdRelatedToVfModule(vnf, vfModuleModelInfo, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), lookupKeyMap); |