From b6e786662a95e03a93cf3cfe2c9e0e43be1accb9 Mon Sep 17 00:00:00 2001 From: "Kalkere Ramesh, Sharan" Date: Mon, 12 Oct 2020 14:50:17 -0400 Subject: 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) Change-Id: I991960740b3d495c0613b5176019499a3500b5b2 --- .../workflow/tasks/WorkflowAction.java | 29 ++++++++++++++++++++-- .../workflow/tasks/WorkflowActionBBTasks.java | 5 +++- 2 files changed, 31 insertions(+), 3 deletions(-) (limited to 'bpmn') 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 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); } } -- cgit 1.2.3-korg