aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-01-12 13:13:34 +0000
committerGerrit Code Review <gerrit@onap.org>2019-01-12 13:13:34 +0000
commit0d0590405f93472866a910a8f4164781844e9101 (patch)
tree92f0ca87b7df7d35ce4bdb62f06e7fdaa2ce32a0 /bpmn
parent6d374cb95381eeba807689f09abeca5ccd79fc9a (diff)
parentcd85fa3ff3322c0990430efe55dedc2f7577ee6b (diff)
Merge "Miscellaneous fixes"
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy10
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVnfInfra.bpmn4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java18
4 files changed, 45 insertions, 7 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
index ab260e48f3..9fd16340b6 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
@@ -183,7 +183,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
}
// Construct payload
- personaModelVersionEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'model-version-id')
+ personaModelVersionEntry = updateGenericVnfNode(origRequest, 'model-version-id')
}
// Handle ipv4-oam-address
@@ -191,7 +191,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
String ipv4OamAddressEntry = ""
if (ipv4OamAddress != null) {
// Construct payload
- ipv4OamAddressEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'ipv4-oam-address')
+ ipv4OamAddressEntry = updateGenericVnfNode(origRequest, 'ipv4-oam-address')
}
// Handle management-v6-address
@@ -199,7 +199,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
String managementV6AddressEntry = ""
if (managementV6Address != null) {
// Construct payload
- managementV6AddressEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'management-v6-address')
+ managementV6AddressEntry = updateGenericVnfNode(origRequest, 'management-v6-address')
}
// Handle orchestration-status
@@ -207,7 +207,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
String orchestrationStatusEntry = ""
if (orchestrationStatus != null) {
// Construct payload
- orchestrationStatusEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'orchestration-status')
+ orchestrationStatusEntry = updateGenericVnfNode(origRequest, 'orchestration-status')
}
String payload = """
@@ -243,7 +243,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
* @param genericVnf Current Generic VNF retrieved from AAI.
* @param element Name of element to be inserted.
*/
- public String updateGenericVnfNode(String origRequest, Node genericVnfNode, String elementName) {
+ public String updateGenericVnfNode(String origRequest, String elementName) {
if (!utils.nodeExists(origRequest, elementName)) {
return ""
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVnfInfra.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVnfInfra.bpmn
index 6092de6c79..3cb879ac3f 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVnfInfra.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVnfInfra.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_9MhrcHqVEea26OhQB97uCQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_9MhrcHqVEea26OhQB97uCQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="DeleteVnfInfra" name="DeleteVnfInfra" isExecutable="true">
<bpmn2:startEvent id="StartEvent_1">
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
@@ -107,6 +107,7 @@ deleteVnf.prepareCompletionHandlerRequest(execution)]]></bpmn2:script>
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
<camunda:in source="DELVI_vnfId" target="vnfId" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_00bhxtl</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_1f56g06</bpmn2:outgoing>
@@ -134,6 +135,7 @@ deleteVnf.prepareCompletionHandlerRequest(execution)]]></bpmn2:script>
<camunda:in source="DELVI_serviceInstanceId" target="serviceInstanceId" />
<camunda:in source="DELVI_cloudConfiguration" target="cloudConfiguration" />
<camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_00o02cv</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0dy2xw0</bpmn2:outgoing>
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 10ee13ebed..50f2091ae2 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
@@ -344,6 +344,18 @@ public class WorkflowAction {
}
return vfModuleResources;
}
+
+ protected List<Resource> sortVfModulesByBaseLast(List<Resource> vfModuleResources) {
+ int count = 0;
+ for(Resource resource : vfModuleResources){
+ if(resource.isBaseVfModule()){
+ Collections.swap(vfModuleResources, vfModuleResources.size()-1, count);
+ break;
+ }
+ count++;
+ }
+ return vfModuleResources;
+ }
private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute,
List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds, String serviceInstanceId) {
@@ -969,8 +981,14 @@ public class WorkflowAction {
requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true, resource.getVirtualLinkKey(), false));
}
} else if (orchFlow.getFlowName().contains(VFMODULE)) {
- List<Resource> vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType())
+ List<Resource> vfModuleResourcesSorted = null;
+ if(requestAction.equals("createInstance")||requestAction.equals("assignInstance")||requestAction.equals("activateInstance")){
+ vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType())
.collect(Collectors.toList()));
+ }else{
+ vfModuleResourcesSorted = sortVfModulesByBaseLast(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType())
+ .collect(Collectors.toList()));
+ }
for (int i = 0; i < vfModuleResourcesSorted.size(); i++) {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, vfModuleResourcesSorted.get(i), apiVersion, resourceId,
requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
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 5699c94137..72f0ce4e6d 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
@@ -1200,6 +1200,24 @@ public class WorkflowActionTest extends BaseTaskTest {
assertEquals("111",result.get(2).getResourceId());
}
+ @Test
+ public void sortVfModulesByBaseLastTest(){
+ List<Resource> resources = new ArrayList<>();
+ Resource resource1 = new Resource(WorkflowType.VFMODULE,"111",false);
+ resource1.setBaseVfModule(true);
+ resources.add(resource1);
+ Resource resource2 = new Resource(WorkflowType.VFMODULE,"222",false);
+ resource2.setBaseVfModule(false);
+ resources.add(resource2);
+ Resource resource3 = new Resource(WorkflowType.VFMODULE,"333",false);
+ resource3.setBaseVfModule(false);
+ resources.add(resource3);
+ List<Resource> result = workflowAction.sortVfModulesByBaseLast(resources);
+ assertEquals("333",result.get(0).getResourceId());
+ assertEquals("222",result.get(1).getResourceId());
+ assertEquals("111",result.get(2).getResourceId());
+ }
+
private List<OrchestrationFlow> createFlowList (String... flowNames){
List<OrchestrationFlow> result = new ArrayList<>();
for(String flowName : flowNames){