summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPlummer, Brittany <brittany.plummer@att.com>2019-12-05 14:58:40 -0500
committerBenjamin, Max (mb388a) <mb388a@att.com>2019-12-05 14:58:40 -0500
commit9eab6407fe2982fe0d38feb7fa7637d8917aea90 (patch)
tree60b08418f06773b72000a3bfe874120648f31249
parentb9765b97e0fd8a99c5b27263638eb05483f14e29 (diff)
serviceinstanceid being overwritten by vnfid in
Added check for vnfReplace before setting serviceInstanceId Added test to make sure serviceInstanceId is not overwritten Removed unused action import from WorkflowAction Formatted WorkflowActionTest to fix build failure Issue-ID: SO-2553 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I04cc668d4afbecd67b169f4e9d357ffc68cab02a
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java3
2 files changed, 15 insertions, 4 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 b5b1f5db2f..58bf17f08b 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
@@ -335,8 +335,14 @@ public class WorkflowAction {
orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte,
cloudOwner, serviceType);
}
- flowsToExecute = buildExecuteBuildingBlockList(orchFlows, resourceCounter, requestId, apiVersion,
- resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails);
+ boolean vnfReplace = false;
+ if (resourceType.equals(WorkflowType.VNF) && ("replaceInstance".equalsIgnoreCase(requestAction)
+ || "replaceInstanceRetainAssignments".equalsIgnoreCase(requestAction))) {
+ vnfReplace = true;
+ }
+ flowsToExecute =
+ buildExecuteBuildingBlockList(orchFlows, resourceCounter, requestId, apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, vnfReplace);
if (!resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
.collect(Collectors.toList()).isEmpty()) {
logger.info("Sorting for Vlan Tagging");
@@ -1402,13 +1408,15 @@ public class WorkflowAction {
protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows,
List<Resource> resourceCounter, String requestId, String apiVersion, String resourceId,
String requestAction, boolean aLaCarte, String vnfType, WorkflowResourceIds workflowResourceIds,
- RequestDetails requestDetails) {
+ RequestDetails requestDetails, boolean replaceVnf) {
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
for (OrchestrationFlow orchFlow : orchFlows) {
if (orchFlow.getFlowName().contains(SERVICE)) {
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.SERVICE == x.getResourceType())
.collect(Collectors.toList()).size(); i++) {
- workflowResourceIds.setServiceInstanceId(resourceId);
+ if (!replaceVnf) {
+ workflowResourceIds.setServiceInstanceId(resourceId);
+ }
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId,
resourceCounter.stream().filter(x -> WorkflowType.SERVICE == x.getResourceType())
.collect(Collectors.toList()).get(i),
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 cb5ffd6fa7..6c959703e4 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
@@ -927,6 +927,9 @@ public class WorkflowActionTest extends BaseTaskTest {
"CreateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVfModuleBB",
"AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "ChangeModelVnfBB", "ActivateVnfBB",
"ChangeModelServiceInstanceBB", "SDNOVnfHealthCheckBB", "AAIUnsetVnfInMaintBB");
+ for (ExecuteBuildingBlock executeBuildingBlock : ebbs) {
+ assertEquals("123", executeBuildingBlock.getWorkflowResourceIds().getServiceInstanceId());
+ }
}
@Ignore