diff options
author | Kalkere Ramesh, Sharan <sharan.kalkere.ramesh@att.com> | 2020-10-12 14:50:17 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-10-12 14:50:18 -0400 |
commit | b6e786662a95e03a93cf3cfe2c9e0e43be1accb9 (patch) | |
tree | b344a660c4e0ce844fb20b0c2af9d4ce6b78f8c2 /bpmn/so-bpmn-tasks/src/main/java | |
parent | 7c6b3b216ca8969b9b950950a3c938f250f18251 (diff) |
use correct vnf and vf cust for replace in
use correct vnf and vf cust for replace in workflowaction
Issue-ID: SO-3298
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I991960740b3d495c0613b5176019499a3500b5b2
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java')
2 files changed, 31 insertions, 3 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index 0f955e2851..d9ad245e76 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -88,6 +88,7 @@ import org.onap.so.serviceinstancebeans.ModelType; import org.onap.so.serviceinstancebeans.Networks; import org.onap.so.serviceinstancebeans.Pnfs; import org.onap.so.serviceinstancebeans.RelatedInstance; +import org.onap.so.serviceinstancebeans.RelatedInstanceList; import org.onap.so.serviceinstancebeans.RequestDetails; import org.onap.so.serviceinstancebeans.Service; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; @@ -566,6 +567,20 @@ public class WorkflowAction { } else { vfModuleCustomizationUUID = aaiVfModule.getModelCustomizationId(); } + String replaceVfModuleCustomizationUUID = ""; + String replaceVnfModuleCustomizationUUID = ""; + boolean isReplace = false; + if (dataObj.getRequestAction().equalsIgnoreCase("replaceInstance") + || dataObj.getRequestAction().equalsIgnoreCase("replaceInstanceRetainAssignments")) { + for (RelatedInstanceList relatedInstList : dataObj.getRequestDetails().getRelatedInstanceList()) { + RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { + replaceVnfModuleCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId(); + } + } + replaceVfModuleCustomizationUUID = dataObj.getRequestDetails().getModelInfo().getModelCustomizationId(); + isReplace = true; + } List<org.onap.aai.domain.yang.Vnfc> vnfcs = getRelatedResourcesInVfModule(vnfId, vfModuleId, org.onap.aai.domain.yang.Vnfc.class, Types.VNFC); @@ -579,9 +594,19 @@ public class WorkflowAction { } workflowIdsCopy.setConfigurationId(configuration.getConfigurationId()); for (OrchestrationFlow orchFlow : result) { - dataObj.getResourceKey().setVfModuleCustomizationId(vfModuleCustomizationUUID); + if (!isReplace) { + dataObj.getResourceKey().setVfModuleCustomizationId(vfModuleCustomizationUUID); + dataObj.getResourceKey().setVnfCustomizationId(vnfCustomizationUUID); + } else { + if (orchFlow.getFlowName().contains("Delete")) { + dataObj.getResourceKey().setVfModuleCustomizationId(vfModuleCustomizationUUID); + dataObj.getResourceKey().setVnfCustomizationId(vnfCustomizationUUID); + } else { + dataObj.getResourceKey().setVfModuleCustomizationId(replaceVfModuleCustomizationUUID); + dataObj.getResourceKey().setVnfCustomizationId(replaceVnfModuleCustomizationUUID); + } + } dataObj.getResourceKey().setCvnfModuleCustomizationId(vnfc.getModelCustomizationId()); - dataObj.getResourceKey().setVnfCustomizationId(vnfCustomizationUUID); String vnfcName = vnfc.getVnfcName(); if (vnfcName == null || vnfcName.isEmpty()) { buildAndThrowException(dataObj.getExecution(), "Exception in create execution list " diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index f0898ace81..43a85051be 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -414,9 +414,12 @@ public class WorkflowActionBBTasks { String handlingCode = (String) execution.getVariable(HANDLINGCODE); final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE); int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); + String requestAction = (String) execution.getVariable(G_ACTION); ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1); String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName(); - if ("ActivateVfModuleBB".equalsIgnoreCase(bbFlowName) && aLaCarte && "Success".equalsIgnoreCase(handlingCode)) { + if ("ActivateVfModuleBB".equalsIgnoreCase(bbFlowName) && aLaCarte && "Success".equalsIgnoreCase(handlingCode) + && !(requestAction.equalsIgnoreCase("replaceInstance") + || requestAction.equalsIgnoreCase("replaceInstanceRetainAssignments"))) { postProcessingExecuteBBActivateVfModule(execution, ebb, flowsToExecute); } } |