aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorMarcus Williams <marcus.williams@intel.com>2019-04-15 22:24:44 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-15 22:24:44 +0000
commit05d3535dd55d07bc30b2562e075f7da102e3d63b (patch)
treedf7278dfb5ac44dce17de114f91e5f75af91efbf /bpmn
parent57d0aa50ca07497fee884fd6e505695e24f046ac (diff)
parentc5d5e14f506a9be6e93003b88f0aed42e5030ebf (diff)
Merge "Conditional Macro Action Selection"
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java49
2 files changed, 69 insertions, 0 deletions
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 4514d24c54..f0a102dfeb 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
@@ -37,6 +37,7 @@ import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
@@ -83,6 +84,25 @@ public class WorkflowActionBBTasks {
execution.setVariable("MacroRollback", false);
int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence);
+
+ if (ebb.getBuildingBlock().getBpmnFlowName().equals("ConfigAssignVnfBB")
+ || ebb.getBuildingBlock().getBpmnFlowName().equals("ConfigDeployVnfBB")) {
+ String serviceInstanceId = ebb.getWorkflowResourceIds().getServiceInstanceId();
+ String vnfCustomizationUUID = ebb.getBuildingBlock().getKey();
+
+ List<VnfResourceCustomization> vnfResourceCustomizations =
+ catalogDbClient.getVnfResourceCustomizationByModelUuid(serviceInstanceId);
+ if (vnfResourceCustomizations != null && vnfResourceCustomizations.size() >= 1) {
+ VnfResourceCustomization vrc = catalogDbClient.findVnfResourceCustomizationInList(vnfCustomizationUUID,
+ vnfResourceCustomizations);
+ boolean skipConfigVNF = vrc.isSkipPostInstConf();
+ if (skipConfigVNF) {
+ currentSequence++;
+ ebb = flowsToExecute.get(currentSequence);
+ }
+ }
+ }
+
boolean homing = (boolean) execution.getVariable("homing");
boolean calledHoming = (boolean) execution.getVariable("calledHoming");
if (homing && !calledHoming) {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
index 029562a6e9..a60927d694 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -40,10 +40,13 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.Spy;
+import org.onap.aai.domain.yang.GenericVnf;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.springframework.core.env.Environment;
@@ -90,7 +93,30 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
execution.setVariable("calledHoming", false);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
+
+ String vnfCustomizationUUID = "1234567";
+ String serviceInstanceId = "1234567";
+ BuildingBlock buildingBlock = new BuildingBlock();
+ buildingBlock.setBpmnFlowName("ConfigAssignVnfBB");
+ buildingBlock.setKey(vnfCustomizationUUID);
+ ebb.setBuildingBlock(buildingBlock);
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId(serviceInstanceId);
+ ebb.setWorkflowResourceIds(workflowResourceIds);
flowsToExecute.add(ebb);
+
+ List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
+ VnfResourceCustomization vrc = new VnfResourceCustomization();
+ vrc.setSkipPostInstConf(false);
+ vrc.setModelCustomizationUUID(vnfCustomizationUUID);
+ vnfResourceCustomizations.add(vrc);
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setModelCustomizationId(vnfCustomizationUUID);
+ doReturn(vnfResourceCustomizations).when(catalogDbClient)
+ .getVnfResourceCustomizationByModelUuid(serviceInstanceId);
+ doReturn(vrc).when(catalogDbClient).findVnfResourceCustomizationInList(vnfCustomizationUUID,
+ vnfResourceCustomizations);
+
execution.setVariable("flowsToExecute", flowsToExecute);
workflowActionBBTasks.selectBB(execution);
boolean success = (boolean) execution.getVariable("completed");
@@ -110,7 +136,30 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
+
+ String vnfCustomizationUUID = "1234567";
+ String serviceInstanceId = "1234567";
+ BuildingBlock buildingBlock = new BuildingBlock();
+ buildingBlock.setBpmnFlowName("ConfigDeployVnfBB");
+ buildingBlock.setKey(vnfCustomizationUUID);
+ ebb.setBuildingBlock(buildingBlock);
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId(serviceInstanceId);
+ ebb.setWorkflowResourceIds(workflowResourceIds);
flowsToExecute.add(ebb);
+
+ List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
+ VnfResourceCustomization vrc = new VnfResourceCustomization();
+ vrc.setSkipPostInstConf(false);
+ vrc.setModelCustomizationUUID(vnfCustomizationUUID);
+ vnfResourceCustomizations.add(vrc);
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setModelCustomizationId(vnfCustomizationUUID);
+ doReturn(vnfResourceCustomizations).when(catalogDbClient)
+ .getVnfResourceCustomizationByModelUuid(serviceInstanceId);
+ doReturn(vrc).when(catalogDbClient).findVnfResourceCustomizationInList(vnfCustomizationUUID,
+ vnfResourceCustomizations);
+
flowsToExecute.add(ebb2);
execution.setVariable("flowsToExecute", flowsToExecute);
workflowActionBBTasks.selectBB(execution);