From cd85fa3ff3322c0990430efe55dedc2f7577ee6b Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Fri, 11 Jan 2019 21:54:58 -0500 Subject: Miscellaneous fixes updated common pom to use aai schema version 1.4.1 removed handle sync error from SDNCHandler bpmn flow added mso-request-id to in mapping of delete vnf flows moved temporary test file to temporary folder Removed obsolete genericVnfNode parameter from updateGenericVnfNode sorted vfmodules by base last for negative action reqs Change-Id: I7a5018d67292cfaac8d923ac3bd9b27ed037be57 Issue-ID: SO-1382 Signed-off-by: Benjamin, Max (mb388a) --- .../bpmn/common/scripts/UpdateAAIGenericVnf.groovy | 10 +++++----- .../src/main/resources/process/DeleteVnfInfra.bpmn | 4 +++- .../workflow/tasks/WorkflowAction.java | 20 +++++++++++++++++++- .../workflow/tasks/WorkflowActionTest.java | 18 ++++++++++++++++++ 4 files changed, 45 insertions(+), 7 deletions(-) (limited to 'bpmn') 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 5eb72bb2f2..0cabcf638f 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') } def 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 @@ - + SequenceFlow_1 @@ -107,6 +107,7 @@ deleteVnf.prepareCompletionHandlerRequest(execution)]]> + SequenceFlow_00bhxtl SequenceFlow_1f56g06 @@ -134,6 +135,7 @@ deleteVnf.prepareCompletionHandlerRequest(execution)]]> + SequenceFlow_00o02cv SequenceFlow_0dy2xw0 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 sortVfModulesByBaseLast(List 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 flowsToExecute, List resourceCounter, List> 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 vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType()) + List 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 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 result = workflowAction.sortVfModulesByBaseLast(resources); + assertEquals("333",result.get(0).getResourceId()); + assertEquals("222",result.get(1).getResourceId()); + assertEquals("111",result.get(2).getResourceId()); + } + private List createFlowList (String... flowNames){ List result = new ArrayList<>(); for(String flowName : flowNames){ -- cgit 1.2.3-korg