diff options
author | Kalkere Ramesh, Sharan <sharan.kalkere.ramesh@att.com> | 2020-07-06 09:43:45 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-07-07 12:49:34 -0400 |
commit | 7f8a96f92c76deeddb46726093c687d9f77a09eb (patch) | |
tree | f762df35071b5441d74aadb662153328a01ccc00 /bpmn/so-bpmn-tasks/src/main/java | |
parent | af108bdcc19cdc2cf06dacdd0705ec408bfd4910 (diff) |
added in fix to use old volume group name for
added in fix to use old volume group name for volume group
Issue-ID: SO-3020
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: Iaab124e8420d7b0a09b1f709b03b37b8a97425cf
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java')
3 files changed, 58 insertions, 22 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java index e154375d3d..7f754e3f13 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java @@ -20,7 +20,6 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; -import java.util.List; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlockBase; import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; @@ -38,6 +37,7 @@ public class ConfigBuildingBlocksDataObject extends BuildingBlockBase<ConfigBuil private List<OrchestrationFlow> orchFlows; private Resource resourceKey; private ServiceInstancesRequest sIRequest; + private ReplaceInstanceRelatedInformation replaceInformation; public ServiceInstancesRequest getsIRequest() { return sIRequest; @@ -75,6 +75,15 @@ public class ConfigBuildingBlocksDataObject extends BuildingBlockBase<ConfigBuil return this; } + public ReplaceInstanceRelatedInformation getReplaceInformation() { + return replaceInformation; + } + + public ConfigBuildingBlocksDataObject setReplaceInformation(ReplaceInstanceRelatedInformation replaceInformation) { + this.replaceInformation = replaceInformation; + return this; + } + } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ReplaceInstanceRelatedInformation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ReplaceInstanceRelatedInformation.java new file mode 100644 index 0000000000..d9e8fa55fa --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ReplaceInstanceRelatedInformation.java @@ -0,0 +1,16 @@ +package org.onap.so.bpmn.infrastructure.workflow.tasks; + +public class ReplaceInstanceRelatedInformation { + + private String oldVolumeGroupName; + + public String getOldVolumeGroupName() { + return oldVolumeGroupName; + } + + public ReplaceInstanceRelatedInformation setOldVolumeGroupName(String oldVolumeGroupName) { + this.oldVolumeGroupName = oldVolumeGroupName; + return this; + } + +} 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 2921cada18..1a49e3af7f 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 @@ -222,16 +222,17 @@ public class WorkflowAction { } Resource resourceKey = getResourceKey(sIRequest, resourceType); + ReplaceInstanceRelatedInformation replaceInfo = new ReplaceInstanceRelatedInformation(); if ((requestAction.equalsIgnoreCase(REPLACEINSTANCE) || requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS)) && resourceType.equals(WorkflowType.VFMODULE)) { logger.debug("Build a BB list for replacing BB modules"); - orchFlows = getVfModuleReplaceBuildingBlocks( - new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows) - .setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion) - .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(true) - .setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds) - .setRequestDetails(requestDetails).setExecution(execution)); + orchFlows = getVfModuleReplaceBuildingBlocks(new ConfigBuildingBlocksDataObject() + .setsIRequest(sIRequest).setOrchFlows(orchFlows).setRequestId(requestId) + .setResourceKey(resourceKey).setApiVersion(apiVersion).setResourceId(resourceId) + .setRequestAction(requestAction).setaLaCarte(true).setVnfType(vnfType) + .setWorkflowResourceIds(workflowResourceIds).setRequestDetails(requestDetails) + .setExecution(execution).setReplaceInformation(replaceInfo)); for (OrchestrationFlow orchFlow : orchFlows) { if (orchFlow.getFlowName().contains(CONFIGURATION)) { List<OrchestrationFlow> configOrchFlows = new ArrayList<>(); @@ -243,12 +244,13 @@ public class WorkflowAction { .setApiVersion(apiVersion).setResourceId(resourceId) .setRequestAction(requestAction).setaLaCarte(true).setVnfType(vnfType) .setWorkflowResourceIds(workflowResourceIds) - .setRequestDetails(requestDetails).setExecution(execution)); + .setRequestDetails(requestDetails).setExecution(execution) + .setReplaceInformation(replaceInfo)); flowsToExecute.addAll(configBuildingBlocks); } else { ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds, - requestDetails, false, null, null, false); + requestDetails, false, null, null, false, replaceInfo); flowsToExecute.add(ebb); } } @@ -271,7 +273,7 @@ public class WorkflowAction { for (OrchestrationFlow orchFlow : orchFlows) { ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds, - requestDetails, false, null, null, false); + requestDetails, false, null, null, false, replaceInfo); flowsToExecute.add(ebb); } } @@ -537,10 +539,11 @@ public class WorkflowAction { + ": VnfcName does not exist or is null while there is a configuration for the vfModule", new Exception("Vnfc and Configuration do not match")); } - ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, dataObj.getRequestId(), - dataObj.getResourceKey(), dataObj.getApiVersion(), dataObj.getResourceId(), - dataObj.getRequestAction(), dataObj.isaLaCarte(), dataObj.getVnfType(), - dataObj.getWorkflowResourceIds(), dataObj.getRequestDetails(), false, null, vnfcName, true); + ExecuteBuildingBlock ebb = + buildExecuteBuildingBlock(orchFlow, dataObj.getRequestId(), dataObj.getResourceKey(), + dataObj.getApiVersion(), dataObj.getResourceId(), dataObj.getRequestAction(), + dataObj.isaLaCarte(), dataObj.getVnfType(), dataObj.getWorkflowResourceIds(), + dataObj.getRequestDetails(), false, null, vnfcName, true, null); flowsToExecuteConfigs.add(ebb); } } @@ -565,14 +568,16 @@ public class WorkflowAction { && dataObj.getRequestDetails().getRequestParameters().getRebuildVolumeGroups() != null) { rebuildVolumeGroups = dataObj.getRequestDetails().getRequestParameters().getRebuildVolumeGroups(); } - + String volumeGroupName = ""; Optional<VolumeGroup> volumeGroupFromVfModule = bbInputSetupUtils.getRelatedVolumeGroupFromVfModule(vnfId, vfModuleId); if (volumeGroupFromVfModule.isPresent()) { String volumeGroupId = volumeGroupFromVfModule.get().getVolumeGroupId(); + volumeGroupName = volumeGroupFromVfModule.get().getVolumeGroupName(); logger.debug("Volume group id of the existing volume group is: " + volumeGroupId); volumeGroupExisted = true; dataObj.getWorkflowResourceIds().setVolumeGroupId(volumeGroupId); + dataObj.getReplaceInformation().setOldVolumeGroupName(volumeGroupName); } List<OrchestrationFlow> orchFlows = dataObj.getOrchFlows(); @@ -585,6 +590,7 @@ public class WorkflowAction { if (!volumeGroupExisted) { String newVolumeGroupId = UUID.randomUUID().toString(); dataObj.getWorkflowResourceIds().setVolumeGroupId(newVolumeGroupId); + dataObj.getReplaceInformation().setOldVolumeGroupName(volumeGroupName); logger.debug("newVolumeGroupId: " + newVolumeGroupId); } } @@ -1386,7 +1392,7 @@ public class WorkflowAction { resourceList.stream().filter(resource -> resource.getResourceType().equals(workflowType)) .forEach(resource -> flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, apiVersion, resourceId, requestAction, false, vnfType, workflowResourceIds, requestDetails, - isVirtualLink, resource.getVirtualLinkKey(), null, isConfiguration))); + isVirtualLink, resource.getVirtualLinkKey(), null, isConfiguration, null))); } protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows, @@ -1433,7 +1439,7 @@ public class WorkflowAction { for (Resource resource : vfModuleResourcesSorted) { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, apiVersion, resourceId, requestAction, false, vnfType, workflowResourceIds, requestDetails, false, null, null, - false)); + false, null)); } } else if (orchFlow.getFlowName().contains(VOLUMEGROUP)) { if (requestAction.equalsIgnoreCase(REPLACEINSTANCE) @@ -1453,8 +1459,9 @@ public class WorkflowAction { requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, true); } else { - flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId, - requestAction, false, vnfType, workflowResourceIds, requestDetails, false, null, null, false)); + flowsToExecute + .add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId, requestAction, + false, vnfType, workflowResourceIds, requestDetails, false, null, null, false, null)); } } return flowsToExecute; @@ -1463,7 +1470,8 @@ public class WorkflowAction { protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId, Resource resource, String apiVersion, String resourceId, String requestAction, boolean aLaCarte, String vnfType, WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, - boolean isVirtualLink, String virtualLinkKey, String vnfcName, boolean isConfiguration) { + boolean isVirtualLink, String virtualLinkKey, String vnfcName, boolean isConfiguration, + ReplaceInstanceRelatedInformation replaceInfo) { BuildingBlock buildingBlock = new BuildingBlock().setBpmnFlowName(orchFlow.getFlowName()).setMsoId(UUID.randomUUID().toString()) @@ -1471,7 +1479,10 @@ public class WorkflowAction { .setKey(Optional.ofNullable(resource).map(Resource::getResourceId).orElse("")); Optional.ofNullable(orchFlow.getBpmnAction()).ifPresent(buildingBlock::setBpmnAction); Optional.ofNullable(orchFlow.getBpmnScope()).ifPresent(buildingBlock::setBpmnScope); - + String oldVolumeGroupName = ""; + if (replaceInfo != null) { + oldVolumeGroupName = replaceInfo.getOldVolumeGroupName(); + } if (resource != null && (orchFlow.getFlowName().contains(VOLUMEGROUP) && (requestAction.equalsIgnoreCase(REPLACEINSTANCE) || requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS)))) { @@ -1482,7 +1493,7 @@ public class WorkflowAction { ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setApiVersion(apiVersion) .setaLaCarte(aLaCarte).setRequestAction(requestAction).setResourceId(resourceId).setVnfType(vnfType) .setWorkflowResourceIds(workflowResourceIds).setRequestId(requestId).setBuildingBlock(buildingBlock) - .setRequestDetails(requestDetails); + .setRequestDetails(requestDetails).setOldVolumeGroupName(oldVolumeGroupName); if (resource != null && (isConfiguration || resource.getResourceType().equals(WorkflowType.CONFIGURATION))) { ConfigurationResourceKeys configurationResourceKeys = getConfigurationResourceKeys(resource, vnfcName); |