summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2020-07-09 14:54:32 +0000
committerGerrit Code Review <gerrit@onap.org>2020-07-09 14:54:32 +0000
commit0ad02bb6286656e9e0eba8760e1666de65a7fcfd (patch)
treed731ee50b713b5e3b73e9e5d4810e2bcda345084 /bpmn/so-bpmn-tasks/src
parente30913eef75a9bc6fdae268c9e75027ef29bf934 (diff)
parent7f8a96f92c76deeddb46726093c687d9f77a09eb (diff)
Merge "added in fix to use old volume group name for"
Diffstat (limited to 'bpmn/so-bpmn-tasks/src')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ReplaceInstanceRelatedInformation.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java53
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java2
4 files changed, 59 insertions, 23 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);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index cf8d98e86e..8f104566a4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -3122,7 +3122,7 @@ public class WorkflowActionTest extends BaseTaskTest {
ExecuteBuildingBlock result = null;
try {
result = workflowAction.buildExecuteBuildingBlock(new OrchestrationFlow(), null, null, null, null, null,
- false, null, null, null, false, null, null, true);
+ false, null, null, null, false, null, null, true, null);
} catch (NullPointerException e) {
fail("NullPointerException should not be thrown when 'resource' is null");
}