summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java6
-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
7 files changed, 76 insertions, 26 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
index e867b670b7..e45811117c 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
@@ -28,6 +28,7 @@ public class ExecuteBuildingBlock extends BuildingBlockBase<ExecuteBuildingBlock
private BuildingBlock buildingBlock;
private ConfigurationResourceKeys configurationResourceKeys;
private Boolean homing = false;
+ private String oldVolumeGroupName;
private static final long serialVersionUID = 3L;
public BuildingBlock getBuildingBlock() {
@@ -56,4 +57,13 @@ public class ExecuteBuildingBlock extends BuildingBlockBase<ExecuteBuildingBlock
this.configurationResourceKeys = configurationResourceKeys;
return this;
}
+
+ public String getOldVolumeGroupName() {
+ return oldVolumeGroupName;
+ }
+
+ public ExecuteBuildingBlock setOldVolumeGroupName(String oldVolumeGroupName) {
+ this.oldVolumeGroupName = oldVolumeGroupName;
+ return this;
+ }
}
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 fcc8484385..0cdf8a6e5d 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
@@ -750,6 +750,10 @@ public class BBInputSetup implements JavaDelegate {
parameter.getInstanceName(), generatedVnfType, parameter.getInstanceParams());
vnf.getVolumeGroups().add(volumeGroup);
if (parameter.getIsReplace()) {
+ if (parameter.getExecuteBB().getOldVolumeGroupName() != null
+ && !parameter.getExecuteBB().getOldVolumeGroupName().isEmpty()) {
+ volumeGroup.setVolumeGroupName(parameter.getExecuteBB().getOldVolumeGroupName());
+ }
mapCatalogVolumeGroup(volumeGroup, parameter.getModelInfo(),
parameter.getServiceModel().getNewService(), replaceVnfModelCustomizationUUID);
} else {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
index 5a52e3a49d..4206596c94 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
@@ -104,7 +104,7 @@ public class ExecuteBuildingBlockRainyDay {
handlingCode = "Abort";
} else {
try {
- if (gBBInput.getCustomer().getServiceSubscription() != null) {
+ if (gBBInput.getCustomer() != null && gBBInput.getCustomer().getServiceSubscription() != null) {
serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0)
.getModelInfoServiceInstance().getServiceType();
}
@@ -119,7 +119,7 @@ public class ExecuteBuildingBlockRainyDay {
String vnfType = ASTERISK;
String vnfName = ASTERISK;
try {
- if (gBBInput.getCustomer().getServiceSubscription() != null) {
+ if (gBBInput.getCustomer() != null && gBBInput.getCustomer().getServiceSubscription() != null) {
for (GenericVnf vnf : gBBInput.getCustomer().getServiceSubscription().getServiceInstances()
.get(0).getVnfs()) {
if (vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) {
@@ -173,7 +173,7 @@ public class ExecuteBuildingBlockRainyDay {
String serviceRole = ASTERISK;
try {
- if (gBBInput.getCustomer().getServiceSubscription() != null) {
+ if (gBBInput.getCustomer() != null && gBBInput.getCustomer().getServiceSubscription() != null) {
serviceRole = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0)
.getModelInfoServiceInstance().getServiceRole();
}
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");
}