diff options
Diffstat (limited to 'bpmn')
27 files changed, 457 insertions, 269 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NetworkUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NetworkUtils.groovy index c1199aefd7..23231df6be 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NetworkUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NetworkUtils.groovy @@ -477,7 +477,7 @@ class NetworkUtils { networkStartAddress = subnet.getNetworkStartAddress() } if (element == "cidr-mask") { - xmlBuild += "<cidr>"+networkStartAddress+"/"+var+"</cidr>" + xmlBuild += "<cidr>"+networkStartAddress+"/"+ subnet.getCidrMask() +"</cidr>" } } if (element == "dhcp-enabled") { diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy index 8aff0f715d..78af8768f9 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy @@ -365,16 +365,15 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead. execution.setVariable("WorkflowResponse", callback) + callback = utils.removeXmlPreamble(callback) + Node root = new XmlParser().parseText(callback) if (root.name().endsWith('Exception')) { vnfAdapterWorkflowException(execution, callback) } } catch (Exception e) { - e.printStackTrace() - callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback - String msg = "Received error from VnfAdapter: " + callback - msoLogger.debug(getProcessKey(execution) + ': ' + msg) - exceptionUtil.buildWorkflowException(execution, 7020, msg) + msoLogger.debug("Error encountered within VnfAdapterRest ProcessCallback method", e) + exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method") } } 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 ba9426d88a..6c2df13c61 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 @@ -76,43 +76,54 @@ public class ExecuteBuildingBlockRainyDay { Map<ResourceKey, String> lookupKeyMap = (Map<ResourceKey, String>) execution.getVariable("lookupKeyMap"); String serviceType = ASTERISK; boolean aLaCarte = (boolean) execution.getVariable("aLaCarte"); - try { - serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0).getModelInfoServiceInstance().getServiceType(); - } catch (Exception ex) { - // keep default serviceType value - } - String vnfType = ASTERISK; - try { - for(GenericVnf vnf : gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0).getVnfs()) { - if(vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { - vnfType = vnf.getVnfType(); + boolean suppressRollback = (boolean) execution.getVariable("suppressRollback"); + String handlingCode = ""; + if(suppressRollback){ + handlingCode = "Abort"; + }else{ + try { + serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0).getModelInfoServiceInstance().getServiceType(); + } catch (Exception ex) { + // keep default serviceType value + } + String vnfType = ASTERISK; + try { + for(GenericVnf vnf : gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0).getVnfs()) { + if(vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + vnfType = vnf.getVnfType(); + } } + } catch (Exception ex) { + // keep default vnfType value } - } catch (Exception ex) { - // keep default vnfType value - } - WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException"); - String errorCode = ASTERISK; - try { - errorCode = "" + workflowException.getErrorCode(); - } catch (Exception ex) { - // keep default errorCode value - } - String workStep = ASTERISK; - try { - workStep = workflowException.getWorkStep(); - } catch (Exception ex) { - // keep default workStep value - } - //Extract error data to be returned to WorkflowAction - execution.setVariable("WorkflowExceptionErrorMessage", workflowException.getErrorMessage()); - RainyDayHandlerStatus rainyDayHandlerStatus; - String handlingCode = ""; - rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,serviceType,vnfType,errorCode,workStep); - if(rainyDayHandlerStatus==null){ - rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,ASTERISK,ASTERISK,ASTERISK,ASTERISK); + WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException"); + String errorCode = ASTERISK; + try { + errorCode = "" + workflowException.getErrorCode(); + } catch (Exception ex) { + // keep default errorCode value + } + String workStep = ASTERISK; + try { + workStep = workflowException.getWorkStep(); + } catch (Exception ex) { + // keep default workStep value + } + //Extract error data to be returned to WorkflowAction + execution.setVariable("WorkflowExceptionErrorMessage", workflowException.getErrorMessage()); + RainyDayHandlerStatus rainyDayHandlerStatus; + rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,serviceType,vnfType,errorCode,workStep); if(rainyDayHandlerStatus==null){ - handlingCode = "Abort"; + rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,ASTERISK,ASTERISK,ASTERISK,ASTERISK); + if(rainyDayHandlerStatus==null){ + handlingCode = "Abort"; + }else{ + if(primaryPolicy){ + handlingCode = rainyDayHandlerStatus.getPolicy(); + }else{ + handlingCode = rainyDayHandlerStatus.getSecondaryPolicy(); + } + } }else{ if(primaryPolicy){ handlingCode = rainyDayHandlerStatus.getPolicy(); @@ -120,26 +131,20 @@ public class ExecuteBuildingBlockRainyDay { handlingCode = rainyDayHandlerStatus.getSecondaryPolicy(); } } - }else{ - if(primaryPolicy){ - handlingCode = rainyDayHandlerStatus.getPolicy(); - }else{ - handlingCode = rainyDayHandlerStatus.getSecondaryPolicy(); + if(!primaryPolicy){ + try{ + InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); + request.setRetryStatusMessage("Retries have been exhausted."); + requestDbclient.updateInfraActiveRequests(request); + } catch(Exception ex){ + msoLogger.debug(ex.toString()); + msoLogger.error("Failed to update Request Db Infra Active Requests with Retry Status"); + } } - } - if(!primaryPolicy){ - try{ - InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); - request.setRetryStatusMessage("Retries have been exhausted."); - requestDbclient.updateInfraActiveRequests(request); - } catch(Exception ex){ - msoLogger.debug(ex.toString()); - msoLogger.error("Failed to update Request Db Infra Active Requests with Retry Status"); + if(handlingCode.equals("RollbackToAssigned")&&!aLaCarte){ + handlingCode = "Rollback"; } } - if(handlingCode.equals("RollbackToAssigned")&&!aLaCarte){ - handlingCode = "Rollback"; - } msoLogger.debug("RainyDayHandler Status Code is: " + handlingCode); execution.setVariable(HANDLING_CODE, handlingCode); } catch (Exception e) { diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy index 77edd2dc6d..72cde00877 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,14 +34,14 @@ import static org.junit.Assert.*; @RunWith(MockitoJUnitRunner.class) public class VnfAdapterRestV1Test { - + @Before public void init() { MockitoAnnotations.initMocks(this) } - + @Test public void testPreProcessRequest() { @@ -59,11 +59,11 @@ public class VnfAdapterRestV1Test { when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") - + VnfAdapterRestV1 vnfAdapterRestV1 = new VnfAdapterRestV1() vnfAdapterRestV1.preProcessRequest(mockExecution) - + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() //debugger.printInvocations(mockExecution) @@ -78,7 +78,7 @@ public class VnfAdapterRestV1Test { verify(mockExecution).setVariable("VNFREST_vnfAdapterUrl","http://localhost:18080/vnfs/rest/v1/vnfs/6d2e2469-8708-47c3-a0d4-73fa28a8a50b/vf-modules") } - + def rollbackReq = """ <rollbackVolumeGroupRequest> <volumeGroupRollback> @@ -97,7 +97,7 @@ public class VnfAdapterRestV1Test { <notificationUrl>http://localhost:8080/mso/WorkflowMessage/VNFAResponse/683ca1ac-2145-4a00-9484-20d48bd701aa</notificationUrl> </rollbackVolumeGroupRequest> """ - + @Test public void testGetVolumeGroupId() { Node root = new XmlParser().parseText(rollbackReq) @@ -106,13 +106,29 @@ public class VnfAdapterRestV1Test { assertEquals('8a07b246-155e-4b08-b56e-76e98a3c2d66', volGrpId) } - + @Test public void testGetMessageId() { Node root = new XmlParser().parseText(rollbackReq) - + VnfAdapterRestV1 p = new VnfAdapterRestV1() def messageId = p.getMessageIdForVolumeGroupRollback(root) assertEquals('683ca1ac-2145-4a00-9484-20d48bd701aa', messageId) } + + @Test + public void testProcessCallback() { + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfAdapterCallback.xml"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("VNFAResponse_MESSAGE")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") + + VnfAdapterRestV1 vnfAdapterRestV1 = new VnfAdapterRestV1() + vnfAdapterRestV1.processCallback(mockExecution) + + verify(mockExecution).setVariable("testProcessKeyResponse" ,sdncAdapterWorkflowRequest) + + } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java index fc2de4307b..9af9b2f2c9 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java @@ -91,7 +91,9 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { customer.getServiceSubscription().getServiceInstances().add(serviceInstance); serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); vnf.setVnfType("vnft1"); - delegateExecution.setVariable("aLaCarte", true); + delegateExecution.setVariable("aLaCarte", true); + delegateExecution.setVariable("suppressRollback", false); + RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); rainyDayHandlerStatus.setErrorCode("7000"); rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB"); @@ -113,6 +115,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); vnf.setVnfType("vnft1"); delegateExecution.setVariable("aLaCarte", true); + delegateExecution.setVariable("suppressRollback", false); + RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); rainyDayHandlerStatus.setErrorCode(ASTERISK); rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB"); @@ -136,7 +140,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { vnf.setVnfType("vnft1"); delegateExecution.setVariable("aLaCarte", true); doReturn(null).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class)); - + delegateExecution.setVariable("suppressRollback", false); + executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution,true); assertEquals("Abort", delegateExecution.getVariable("handlingCode")); @@ -147,6 +152,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { doThrow(RuntimeException.class).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class)); delegateExecution.setVariable("aLaCarte", true); executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution,true); + delegateExecution.setVariable("suppressRollback", false); assertEquals("Abort", delegateExecution.getVariable("handlingCode")); } @@ -157,6 +163,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); vnf.setVnfType("vnft1"); delegateExecution.setVariable("aLaCarte", true); + delegateExecution.setVariable("suppressRollback", false); RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); rainyDayHandlerStatus.setErrorCode("7000"); @@ -180,6 +187,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); vnf.setVnfType("vnft1"); delegateExecution.setVariable("aLaCarte", false); + delegateExecution.setVariable("suppressRollback", false); RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); rainyDayHandlerStatus.setErrorCode("7000"); @@ -203,6 +211,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); vnf.setVnfType("vnft1"); delegateExecution.setVariable("aLaCarte", true); + delegateExecution.setVariable("suppressRollback", false); RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); rainyDayHandlerStatus.setErrorCode("7000"); @@ -220,4 +229,12 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { assertEquals("RollbackToAssigned", delegateExecution.getVariable("handlingCode")); } + @Test + public void suppressRollbackTest() throws Exception { + delegateExecution.setVariable("suppressRollback", true); + delegateExecution.setVariable("aLaCarte", true); + executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution,true); + assertEquals("Abort", delegateExecution.getVariable("handlingCode")); + } + } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfAdapterCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfAdapterCallback.xml new file mode 100644 index 0000000000..d63a5ecbaf --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfAdapterCallback.xml @@ -0,0 +1,21 @@ + + +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<createVfModuleResponse> + <messageId>255ca199-7f53-4800-8ab0-c55954b3ff0f</messageId> + <rollback> + <cloudSiteId>mtwnj1a</cloudSiteId> + <messageId>255ca199-7f53-4800-8ab0-c55954b3ff0f</messageId> + <msoRequest/> + <tenantId>c2141e3fcae940fcb4797ec9115e5a7a</tenantId> + <vfModuleCreated>true</vfModuleCreated> + <vfModuleId>b70a3ba5-d172-4e9e-98f6-39516446b25b</vfModuleId> + <vfModuleStackId>USISTDMTWNJVVHP529_migrated.base.module-0/hnportal-1902-1214-1217-144843702565</vfModuleStackId> + <vnfId>USISTDMTWNJVVHP529_migrated.base.module-0/hnportal-1902-1214-1217-144843702565</vnfId> + </rollback> + <vfModuleCreated>true</vfModuleCreated> + <vfModuleId>b70a3ba5-d172-4e9e-98f6-39516446b25b</vfModuleId> + <vfModuleOutputs/> + <vfModuleStackId>USISTDMTWNJVVHP529_migrated.base.module-0/hnportal-1902-1214-1217-144843702565</vfModuleStackId> + <vnfId>e64e62e1-7c02-4148-ad9c-e51406da508a</vnfId> +</createVfModuleResponse>
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn index bb7abf7d7d..5cf41b655b 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn @@ -10,14 +10,13 @@ </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1537yw5" sourceRef="DeleteVfModuleBB_Start" targetRef="DeleteVfModuleVnfAdapter" /> <bpmn:serviceTask id="UpdateVfModuleDeleteStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusDeleteVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_02lpx87</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1mxrfqv</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_01vfwtp</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_09l7pcg</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_08tvhtf" sourceRef="DeleteVfModuleVnfAdapter" targetRef="VnfAdapter" /> <bpmn:endEvent id="DeleteVfModuleBB_End"> - <bpmn:incoming>SequenceFlow_1mxrfqv</bpmn:incoming> + <bpmn:incoming>SequenceFlow_09l7pcg</bpmn:incoming> </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_1mxrfqv" sourceRef="UpdateVfModuleDeleteStatus" targetRef="DeleteVfModuleBB_End" /> <bpmn:callActivity id="VnfAdapter" name="Vnf Adapter" calledElement="VnfAdapter"> <bpmn:extensionElements> <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> @@ -29,7 +28,7 @@ <bpmn:incoming>SequenceFlow_08tvhtf</bpmn:incoming> <bpmn:outgoing>SequenceFlow_02lpx87</bpmn:outgoing> </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_02lpx87" sourceRef="VnfAdapter" targetRef="UpdateVfModuleDeleteStatus" /> + <bpmn:sequenceFlow id="SequenceFlow_02lpx87" sourceRef="VnfAdapter" targetRef="UpdateVfModuleHeatStackId" /> <bpmn:subProcess id="SubProcess_11p7mrh" name="Error Handling " triggeredByEvent="true"> <bpmn:startEvent id="StartEvent_1xp6ewt"> <bpmn:outgoing>SequenceFlow_0h607z0</bpmn:outgoing> @@ -41,6 +40,12 @@ </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_0h607z0" sourceRef="StartEvent_1xp6ewt" targetRef="EndEvent_0guhjau" /> </bpmn:subProcess> + <bpmn:serviceTask id="UpdateVfModuleHeatStackId" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateHeatStackIdVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_02lpx87</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01vfwtp</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_01vfwtp" sourceRef="UpdateVfModuleHeatStackId" targetRef="UpdateVfModuleDeleteStatus" /> + <bpmn:sequenceFlow id="SequenceFlow_09l7pcg" sourceRef="UpdateVfModuleDeleteStatus" targetRef="DeleteVfModuleBB_End" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteVfModuleBB"> @@ -61,7 +66,7 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0pbhsub_di" bpmnElement="UpdateVfModuleDeleteStatus"> - <dc:Bounds x="593" y="80" width="100" height="80" /> + <dc:Bounds x="762" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_08tvhtf_di" bpmnElement="SequenceFlow_08tvhtf"> <di:waypoint xsi:type="dc:Point" x="361" y="120" /> @@ -71,26 +76,19 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1rn6yvh_di" bpmnElement="DeleteVfModuleBB_End"> - <dc:Bounds x="746" y="102" width="36" height="36" /> + <dc:Bounds x="922" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="754" y="142" width="19" height="12" /> + <dc:Bounds x="940" y="142" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1mxrfqv_di" bpmnElement="SequenceFlow_1mxrfqv"> - <di:waypoint xsi:type="dc:Point" x="693" y="120" /> - <di:waypoint xsi:type="dc:Point" x="746" y="120" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="674.5" y="99" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_0whogn3_di" bpmnElement="VnfAdapter"> <dc:Bounds x="427" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_02lpx87_di" bpmnElement="SequenceFlow_02lpx87"> <di:waypoint xsi:type="dc:Point" x="527" y="120" /> - <di:waypoint xsi:type="dc:Point" x="593" y="120" /> + <di:waypoint xsi:type="dc:Point" x="604" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="560" y="99" width="0" height="12" /> + <dc:Bounds x="566" y="105" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_11p7mrh_di" bpmnElement="SubProcess_11p7mrh" isExpanded="true"> @@ -115,6 +113,23 @@ <dc:Bounds x="386.5" y="335" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0vlgqod_di" bpmnElement="UpdateVfModuleHeatStackId"> + <dc:Bounds x="604" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_01vfwtp_di" bpmnElement="SequenceFlow_01vfwtp"> + <di:waypoint xsi:type="dc:Point" x="704" y="120" /> + <di:waypoint xsi:type="dc:Point" x="762" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="733" y="95" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_09l7pcg_di" bpmnElement="SequenceFlow_09l7pcg"> + <di:waypoint xsi:type="dc:Point" x="862" y="120" /> + <di:waypoint xsi:type="dc:Point" x="922" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="892" y="95" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn index f2bd2246e4..746d1f2c5f 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> <bpmn:process id="DeleteVolumeGroupBB" name="DeleteVolumeGroupBB" isExecutable="true"> <bpmn:startEvent id="DeleteVolumeGroupBB_Start" name="Start"> <bpmn:outgoing>SequenceFlow_1wz1rfg</bpmn:outgoing> @@ -9,7 +9,7 @@ <bpmn:incoming>SequenceFlow_0mh0v9h</bpmn:incoming> </bpmn:endEvent> <bpmn:serviceTask id="UpdateVolumeGroupAAI" name=" AAI Update (volume grp) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_0fkan8t</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0hml0t6</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0mh0v9h</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0mh0v9h" sourceRef="UpdateVolumeGroupAAI" targetRef="DeleteVolumeGroupBB_End" /> @@ -18,7 +18,7 @@ <bpmn:incoming>SequenceFlow_1wz1rfg</bpmn:incoming> <bpmn:outgoing>SequenceFlow_13ngwev</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_0fkan8t" sourceRef="VnfAdapter" targetRef="UpdateVolumeGroupAAI" /> + <bpmn:sequenceFlow id="SequenceFlow_0fkan8t" sourceRef="VnfAdapter" targetRef="UpdateVolumeGroupHeatStackId" /> <bpmn:callActivity id="VnfAdapter" name="Vnf Adapter" calledElement="VnfAdapter"> <bpmn:extensionElements> <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> @@ -43,6 +43,11 @@ </bpmn:startEvent> <bpmn:sequenceFlow id="SequenceFlow_07rsz9o" sourceRef="StartEvent_1gun94q" targetRef="EndEvent_18lpeyi" /> </bpmn:subProcess> + <bpmn:sequenceFlow id="SequenceFlow_0hml0t6" sourceRef="UpdateVolumeGroupHeatStackId" targetRef="UpdateVolumeGroupAAI" /> + <bpmn:serviceTask id="UpdateVolumeGroupHeatStackId" name=" AAI Update (volume grp) " camunda:expression="${AAIUpdateTasks.updateHeatStackIdVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0fkan8t</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0hml0t6</bpmn:outgoing> + </bpmn:serviceTask> </bpmn:process> <bpmn:error id="Error_0pz4sdi" name="gDelegateError" errorCode="7000" /> <bpmn:escalation id="Escalation_1hjulni" name="Escalation_2cgup2p" /> @@ -62,19 +67,19 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1k6463v_di" bpmnElement="DeleteVolumeGroupBB_End"> - <dc:Bounds x="824" y="102" width="36" height="36" /> + <dc:Bounds x="978" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="842" y="142" width="0" height="0" /> + <dc:Bounds x="996" y="142" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0rytcj0_di" bpmnElement="UpdateVolumeGroupAAI"> - <dc:Bounds x="665" y="80" width="100" height="80" /> + <dc:Bounds x="822" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0mh0v9h_di" bpmnElement="SequenceFlow_0mh0v9h"> - <di:waypoint xsi:type="dc:Point" x="765" y="120" /> - <di:waypoint xsi:type="dc:Point" x="824" y="120" /> + <di:waypoint xsi:type="dc:Point" x="922" y="120" /> + <di:waypoint xsi:type="dc:Point" x="978" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="795" y="99" width="0" height="0" /> + <dc:Bounds x="950" y="105" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_13ngwev_di" bpmnElement="SequenceFlow_13ngwev"> @@ -89,9 +94,9 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0fkan8t_di" bpmnElement="SequenceFlow_0fkan8t"> <di:waypoint xsi:type="dc:Point" x="626" y="120" /> - <di:waypoint xsi:type="dc:Point" x="665" y="120" /> + <di:waypoint xsi:type="dc:Point" x="678" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="646" y="105" width="0" height="0" /> + <dc:Bounds x="652" y="105" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_0li7q97_di" bpmnElement="VnfAdapter"> @@ -121,6 +126,16 @@ <dc:Bounds x="543" y="305" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0hml0t6_di" bpmnElement="SequenceFlow_0hml0t6"> + <di:waypoint xsi:type="dc:Point" x="778" y="120" /> + <di:waypoint xsi:type="dc:Point" x="822" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="800" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1eatpiw_di" bpmnElement="UpdateVolumeGroupHeatStackId"> + <dc:Bounds x="678" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/SDNCHandler.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/SDNCHandler.bpmn index d123153932..0be7c55596 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/SDNCHandler.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/SDNCHandler.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> <bpmn:process id="SDNCHandler" name="SDNC" isExecutable="true"> <bpmn:startEvent id="SDNC_Start"> <bpmn:outgoing>SequenceFlow_1n0j3hz</bpmn:outgoing> @@ -12,11 +12,6 @@ <bpmn:incoming>SequenceFlow_0flbj8a</bpmn:incoming> <bpmn:outgoing>SequenceFlow_07vnhri</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:boundaryEvent id="BoundaryEvent_1lv4854" attachedToRef="Call_SDNC"> - <bpmn:outgoing>SequenceFlow_0valp88</bpmn:outgoing> - <bpmn:errorEventDefinition camunda:errorCodeVariable="SDNCSyncError" /> - </bpmn:boundaryEvent> - <bpmn:sequenceFlow id="SequenceFlow_0valp88" sourceRef="BoundaryEvent_1lv4854" targetRef="Task_1o29lpk" /> <bpmn:subProcess id="SubProcess_0y8yozw" name="Wait for Callback" camunda:asyncAfter="true" camunda:exclusive="false"> <bpmn:incoming>SequenceFlow_0rh24pq</bpmn:incoming> <bpmn:incoming>SequenceFlow_0yve6l6</bpmn:incoming> @@ -76,9 +71,6 @@ <bpmn:serviceTask id="Task_1un0flc" name="Handle Timeout" camunda:expression="${SDNCRequestTasks.handleTimeOutException(execution)}"> <bpmn:incoming>SequenceFlow_1yifu46</bpmn:incoming> </bpmn:serviceTask> - <bpmn:serviceTask id="Task_1o29lpk" name="Handle Error" camunda:expression="${SDNCRequestTasks.handleSyncError(execution)}"> - <bpmn:incoming>SequenceFlow_0valp88</bpmn:incoming> - </bpmn:serviceTask> </bpmn:process> <bpmn:message id="Message_06oc4iz" name="SDNCCallbackMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -98,21 +90,6 @@ <bpmndi:BPMNShape id="ServiceTask_1i5x1m6_di" bpmnElement="Call_SDNC"> <dc:Bounds x="15" y="112" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BoundaryEvent_1wxlsn8_di" bpmnElement="BoundaryEvent_1lv4854"> - <dc:Bounds x="97" y="174" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="452" y="520" width="90" height="13" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0valp88_di" bpmnElement="SequenceFlow_0valp88"> - <di:waypoint xsi:type="dc:Point" x="115" y="210" /> - <di:waypoint xsi:type="dc:Point" x="115" y="278" /> - <di:waypoint xsi:type="dc:Point" x="115" y="278" /> - <di:waypoint xsi:type="dc:Point" x="115" y="312" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="85" y="271.5" width="90" height="13" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_0y8yozw_di" bpmnElement="SubProcess_0y8yozw" isExpanded="true"> <dc:Bounds x="278" y="-144" width="340" height="153" /> </bpmndi:BPMNShape> @@ -251,9 +228,6 @@ <bpmndi:BPMNShape id="ServiceTask_08b89dm_di" bpmnElement="Task_1un0flc"> <dc:Bounds x="748" y="-185" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1cyot3r_di" bpmnElement="Task_1o29lpk"> - <dc:Bounds x="65" y="312" width="100" height="80" /> - </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn index 2ca9437e9b..bbb2a8a23d 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn @@ -5,8 +5,8 @@ <bpmn:outgoing>SequenceFlow_15s0okp</bpmn:outgoing> </bpmn:startEvent> <bpmn:endEvent id="End_WorkflowActionBB" name="end"> - <bpmn:incoming>SequenceFlow_1rscv7d</bpmn:incoming> <bpmn:incoming>SequenceFlow_0x4urgp</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1pz6edz</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_15s0okp" sourceRef="Start_WorkflowActionBB" targetRef="Task_RetrieveBBExectuionList" /> <bpmn:callActivity id="Call_ExecuteBB" name="Execute BB" camunda:asyncBefore="true" calledElement="ExecuteBuildingBlock"> @@ -21,6 +21,7 @@ <camunda:in source="orchestrationStatusValidationResult" target="orchestrationStatusValidationResult" /> <camunda:out source="orchestrationStatusValidationResult" target="orchestrationStatusValidationResult" /> <camunda:out source="RetryDuration" target="RetryDuration" /> + <camunda:in source="suppressRollback" target="suppressRollback" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0mew9im</bpmn:incoming> <bpmn:outgoing>SequenceFlow_07h9d4y</bpmn:outgoing> @@ -53,24 +54,11 @@ <bpmn:incoming>SequenceFlow_0sckerv</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1wb59ic</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Task_SetupCompleteMsoProcess" name="Setup Complete MSO Process" camunda:expression="${WorkflowActionBBTasks.setupCompleteMsoProcess(execution)}"> + <bpmn:serviceTask id="Task_UpdateRequestComplete" name="Update Request To Complete" camunda:expression="${WorkflowActionBBTasks.updateRequestStatusToComplete(execution)}"> <bpmn:incoming>SequenceFlow_0kf5sen</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1pz6edz</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:callActivity id="Call_CompleteMsoProcess" name="Call CompleteMsoProcess" calledElement="CompleteMsoProcess"> - <bpmn:extensionElements> - <camunda:in source="CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" /> - <camunda:in source="mso-request-id" target="mso-request-id" /> - <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> - <camunda:out source="CMSO_ResponseCode" target="CMSO_ResponseCode" /> - <camunda:out source="CompleteMsoProcessResponse" target="CompleteMsoProcessResponse" /> - <camunda:out source="CMSO_ErrorResponse" target="CMSO_ErrorResponse" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1pz6edz</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1rscv7d</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_1pz6edz" sourceRef="Task_SetupCompleteMsoProcess" targetRef="Call_CompleteMsoProcess" /> - <bpmn:sequenceFlow id="SequenceFlow_1rscv7d" sourceRef="Call_CompleteMsoProcess" targetRef="End_WorkflowActionBB" /> + <bpmn:sequenceFlow id="SequenceFlow_1pz6edz" sourceRef="Task_UpdateRequestComplete" targetRef="End_WorkflowActionBB" /> <bpmn:subProcess id="SubProcess_18226x4" name="Error Handling" triggeredByEvent="true"> <bpmn:startEvent id="ErrorStart" name="error"> <bpmn:outgoing>SequenceFlow_1edjl5x</bpmn:outgoing> @@ -193,7 +181,7 @@ <bpmn:outgoing>SequenceFlow_0mew9im</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0mew9im" sourceRef="ServiceTask_0e2p0xs" targetRef="Call_ExecuteBB" /> - <bpmn:sequenceFlow id="SequenceFlow_0kf5sen" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlowC" targetRef="Task_SetupCompleteMsoProcess" /> + <bpmn:sequenceFlow id="SequenceFlow_0kf5sen" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlowC" targetRef="Task_UpdateRequestComplete" /> </bpmn:process> <bpmn:error id="Error_0kd2o2a" name="java.lang.Exception" errorCode="java.lang.Exception" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -205,9 +193,9 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1uv6erv_di" bpmnElement="End_WorkflowActionBB"> - <dc:Bounds x="1281" y="147" width="36" height="36" /> + <dc:Bounds x="1085" y="147" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1291" y="186" width="18" height="12" /> + <dc:Bounds x="1094" y="127" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_15s0okp_di" bpmnElement="SequenceFlow_15s0okp"> @@ -257,26 +245,15 @@ <bpmndi:BPMNShape id="ServiceTask_0654g3m_di" bpmnElement="Task_SendSync"> <dc:Bounds x="46" y="-7" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0wzh11j_di" bpmnElement="Task_SetupCompleteMsoProcess"> - <dc:Bounds x="900" y="210" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_1jxi5jq_di" bpmnElement="Call_CompleteMsoProcess"> - <dc:Bounds x="1027" y="210" width="100" height="80" /> + <bpmndi:BPMNShape id="ServiceTask_0wzh11j_di" bpmnElement="Task_UpdateRequestComplete"> + <dc:Bounds x="942" y="206" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1pz6edz_di" bpmnElement="SequenceFlow_1pz6edz"> - <di:waypoint xsi:type="dc:Point" x="1000" y="250" /> - <di:waypoint xsi:type="dc:Point" x="1027" y="250" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="969" y="229" width="90" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1rscv7d_di" bpmnElement="SequenceFlow_1rscv7d"> - <di:waypoint xsi:type="dc:Point" x="1127" y="250" /> - <di:waypoint xsi:type="dc:Point" x="1147" y="250" /> - <di:waypoint xsi:type="dc:Point" x="1147" y="165" /> - <di:waypoint xsi:type="dc:Point" x="1281" y="165" /> + <di:waypoint xsi:type="dc:Point" x="1042" y="246" /> + <di:waypoint xsi:type="dc:Point" x="1103" y="246" /> + <di:waypoint xsi:type="dc:Point" x="1103" y="183" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1117" y="208" width="90" height="0" /> + <dc:Bounds x="1027.5" y="231" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_18226x4_di" bpmnElement="SubProcess_18226x4" isExpanded="true"> @@ -424,9 +401,11 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0x4urgp_di" bpmnElement="SequenceFlow_0x4urgp"> <di:waypoint xsi:type="dc:Point" x="891" y="165" /> - <di:waypoint xsi:type="dc:Point" x="1281" y="165" /> + <di:waypoint xsi:type="dc:Point" x="1001" y="165" /> + <di:waypoint xsi:type="dc:Point" x="1001" y="165" /> + <di:waypoint xsi:type="dc:Point" x="1085" y="165" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1081" y="140" width="12" height="12" /> + <dc:Bounds x="1037.2153846153847" y="140" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1q8eh5e_di" bpmnElement="End_RollbackFailed"> @@ -558,10 +537,10 @@ </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0kf5sen_di" bpmnElement="SequenceFlow_0kf5sen"> <di:waypoint xsi:type="dc:Point" x="866" y="190" /> - <di:waypoint xsi:type="dc:Point" x="866" y="250" /> - <di:waypoint xsi:type="dc:Point" x="900" y="250" /> + <di:waypoint xsi:type="dc:Point" x="866" y="246" /> + <di:waypoint xsi:type="dc:Point" x="942" y="246" /> <bpmndi:BPMNLabel> - <dc:Bounds x="872" y="220" width="18" height="12" /> + <dc:Bounds x="872" y="217.6" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java index 45dafbe606..3ab1c76ee6 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java @@ -46,11 +46,10 @@ public class WorkflowActionBBTest extends BaseBPMNTest { Map<String, String> map = new HashMap<>(); map.put("handlingCode", "Success"); mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map); - mockSubprocess("CompleteMsoProcess", "Mocked CompleteMsoProcess", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", "Task_SendSync", - "Task_SelectBB", "Call_ExecuteBB", "ExclusiveGateway_Finished", "ExclusiveGateway_isTopLevelFlowCompleted", "Task_SetupCompleteMsoProcess", "Call_CompleteMsoProcess", + "Task_SelectBB", "Call_ExecuteBB", "ExclusiveGateway_Finished", "ExclusiveGateway_isTopLevelFlowCompleted", "Task_UpdateRequestComplete", "End_WorkflowActionBB"); } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java index e7e8ac0631..d9190b5e12 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java @@ -38,7 +38,7 @@ public class DeleteVfModuleBBTest extends BaseBPMNTest{ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVfModuleBB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted().hasPassedInOrder("DeleteVfModuleBB_Start", "DeleteVfModuleVnfAdapter", "VnfAdapter", - "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End"); + "UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End"); assertThat(pi).isEnded(); } @@ -49,7 +49,7 @@ public class DeleteVfModuleBBTest extends BaseBPMNTest{ assertThat(pi).isNotNull(); assertThat(pi).isStarted() .hasPassedInOrder("DeleteVfModuleBB_Start", "DeleteVfModuleVnfAdapter") - .hasNotPassed("VnfAdapter", "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End"); + .hasNotPassed("VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End"); assertThat(pi).isEnded(); } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java index cd6c266ba4..2336bb54ca 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java @@ -35,7 +35,7 @@ public class DeleteVolumeGroupBBTest extends BaseBPMNTest { mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVolumeGroupBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter", "VnfAdapter", "UpdateVolumeGroupAAI", "DeleteVolumeGroupBB_End"); + assertThat(pi).isStarted().hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter", "VnfAdapter", "UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI", "DeleteVolumeGroupBB_End"); assertThat(pi).isEnded(); } @@ -46,7 +46,7 @@ public class DeleteVolumeGroupBBTest extends BaseBPMNTest { ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVolumeGroupBB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted() - .hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter", "VnfAdapter", "UpdateVolumeGroupAAI") + .hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter", "VnfAdapter", "UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI") .hasNotPassed("DeleteVolumeGroupBB_End"); assertThat(pi).isEnded(); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy index 91b6c2af06..1b64671163 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy @@ -527,6 +527,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { L3Network network = client.get(uri, NotFoundException.class).asBean(L3Network.class).get() execution.setVariable(Prefix + "aaiRequeryIdReturnCode", "200") + execution.setVariable(Prefix + "requeryIdAAIResponse", network) String netName = network.getNetworkName() String networkOutputs = @@ -764,29 +765,26 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.debug(" ***** Inside callRESTUpdateContrailAAINetwork() of DoCreateNetworkInstance ***** " ) + msoLogger.trace(" ***** Inside callRESTUpdateContrailAAINetwork() of DoCreateNetworkInstance ***** " ) try { // get variables String networkId = execution.getVariable(Prefix + "networkId") - String requeryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") + L3Network requeryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") String createNetworkResponse = execution.getVariable(Prefix + "createNetworkResponse") L3Network l3Network = new L3Network() - if (utils.nodeExists(requeryIdAAIResponse, 'heat-stack-id')) { - } else { + if (StringUtils.isBlank(requeryIdAAIResponse.getHeatStackId())) { if (utils.nodeExists(createNetworkResponse, 'networkStackId')) { l3Network.setHeatStackId(utils.getNodeText(createNetworkResponse, 'networkStackId')) } } - if (utils.nodeExists(requeryIdAAIResponse, 'neutron-network-id')) { - } else { + if (StringUtils.isBlank(requeryIdAAIResponse.getNeutronNetworkId())) { if (utils.nodeExists(createNetworkResponse, 'neutronNetworkId')) { l3Network.setNeutronNetworkId(utils.getNodeText(createNetworkResponse, 'neutronNetworkId')) } } - if (utils.nodeExists(requeryIdAAIResponse, 'contrail-network-fqdn')) { - } else { + if (StringUtils.isBlank(requeryIdAAIResponse.getContrailNetworkFqdn())) { if (utils.nodeExists(createNetworkResponse, 'networkFqdn')) { l3Network.setContrailNetworkFqdn(utils.getNodeText(createNetworkResponse, 'networkFqdn')) } @@ -794,39 +792,33 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String status = utils.getNodeText(createNetworkResponse, 'orchestration-status') if(status.equals("pending-create") || status.equals("PendingCreate")){ - l3Network.setOperationalStatus("Created") + l3Network.setOrchestrationStatus("Created") }else{ - l3Network.setOperationalStatus("Active") + l3Network.setOrchestrationStatus("Active") } + msoLogger.debug("Updating l3-network in AAI" ) + AAIResourcesClient client = new AAIResourcesClient() AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId) client.update(uri, l3Network) - String subnetsXml = utils.getNodeXml(requeryIdAAIResponse, "subnets") - InputSource source = new InputSource(new StringReader(subnetsXml)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - docFactory.setNamespaceAware(true) - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document xml = docBuilder.parse(source) - NodeList nodeList = xml.getElementsByTagNameNS("*", "subnet") - for (int x = 0; x < nodeList.getLength(); x++) { - Node node = nodeList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - String subnetOrchStatus = eElement.getElementsByTagNameNS("*", "orchestration-status").item(0).getTextContent() - String subnetId = eElement.getElementsByTagNameNS("*", "subnet-id").item(0).getTextContent() + if(requeryIdAAIResponse.getSubnets() != null){ + for(Subnet s:requeryIdAAIResponse.getSubnets().getSubnet()){ + String subnetOrchStatus = s.getOrchestrationStatus() + String subnetId = s.getSubnetId() Subnet subnet = new Subnet() - String neutronSubnetId = networkUtils.extractNeutSubId(createNetworkResponse, subnetId) - subnet.setNeutronSubnetId(neutronSubnetId) + subnet.setNeutronSubnetId(networkUtils.extractNeutSubId(createNetworkResponse, subnetId)) if(subnetOrchStatus.equals("pending-create") || subnetOrchStatus.equals("PendingCreate") ){ subnet.setOrchestrationStatus("Created") }else{ subnet.setOrchestrationStatus("Active") } + msoLogger.debug("Updating subnet in AAI" ) AAIResourceUri subUri = AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, networkId, subnetId) client.update(subUri, subnet) + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy index cc301db4cd..6dd8085bae 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy @@ -721,9 +721,9 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String status = utils.getNodeText(updateNetworkResponse, 'orchestration-status') if(status.equals("pending-create") || status.equals("PendingCreate")){ - l3Network.setOperationalStatus("Created") + l3Network.setOrchestrationStatus("Created") }else{ - l3Network.setOperationalStatus("Active") + l3Network.setOrchestrationStatus("Active") } AAIResourcesClient client = new AAIResourcesClient() diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy index 11dbf7d2ee..7523427c84 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -43,9 +43,11 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.MockitoAnnotations import org.mockito.runners.MockitoJUnitRunner +import org.onap.aai.domain.yang.L3Network import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException - +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri import com.github.tomakehurst.wiremock.client.WireMock import com.github.tomakehurst.wiremock.junit.WireMockRule import org.apache.commons.lang3.* @@ -480,7 +482,7 @@ class DoCreateNetworkInstanceTest { <host-route-id>string</host-route-id> <route-prefix>192.10.16.0/24</route-prefix> <next-hop>192.10.16.100/24</next-hop> - <next-hop-type>ip-address</next-hop-type> + <next-hop-type>ip-address</next-hop-type> <resource-version>1505857301954</resource-version> </host-route> <host-route> @@ -508,7 +510,7 @@ class DoCreateNetworkInstanceTest { <host-route-id>string</host-route-id> <route-prefix>192.10.16.0/24</route-prefix> <next-hop>192.10.16.100/24</next-hop> - <next-hop-type>ip-address</next-hop-type> + <next-hop-type>ip-address</next-hop-type> <resource-version>1505857301954</resource-version> </host-route> </host-routes> @@ -1669,7 +1671,7 @@ String createNetworkRequest_Ipv4 = <notificationUrl/> </createNetworkRequest>""" -String createNetworkRequestAlaCarte = +String createNetworkRequestAlaCarte = """<createNetworkRequest> <cloudSiteId>RDM2WAGPLCP</cloudSiteId> <tenantId>7dd5365547234ee8937416c65507d266</tenantId> @@ -1874,8 +1876,8 @@ String createNetworkRequest_SRIOV = <serviceInstanceId/> </msoRequest> </networkRollback> -</rollbackNetworkRequest>""" - +</rollbackNetworkRequest>""" + String createNetworkResponse = """<ns2:createNetworkResponse xmlns:ns2="http://org.onap.so/network" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> @@ -3053,7 +3055,7 @@ String sdncAdapterWorkflowAssignResponse = when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) // JSON format when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") // 1610 default when(mockExecution.getVariable("disableRollback")).thenReturn(true) - + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") @@ -3182,8 +3184,8 @@ String sdncAdapterWorkflowAssignResponse = verify(mockExecution).setVariable(Prefix + "createNetworkRequest", createNetworkRequest) } - - + + @Test //@Ignore public void prepareCreateNetworkRequest_Ipv4() { @@ -3220,7 +3222,7 @@ String sdncAdapterWorkflowAssignResponse = verify(mockExecution).setVariable(Prefix + "createNetworkRequest", createNetworkRequest_Ipv4) } - + @Test //@Ignore public void prepareCreateNetworkRequest_AlaCarte() { @@ -3712,7 +3714,7 @@ String sdncAdapterWorkflowAssignResponse = //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() //preDebugger.printInvocations(mockExecution) - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) verify(mockExecution, atLeast(1)).setVariable(Prefix + "queryCloudRegionReturnCode", "404") verify(mockExecution).setVariable(Prefix + "cloudRegionPo", "MDTWNJ21") verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc", "AAIAIC25") @@ -3791,7 +3793,7 @@ String sdncAdapterWorkflowAssignResponse = verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") } - + @Test //@Ignore public void callRESTQueryAAINetworkVpnBinding_TestScenario01_200() { @@ -4025,26 +4027,25 @@ String sdncAdapterWorkflowAssignResponse = @Test //@Ignore public void callRESTUpdateContrailAAINetworkREST_200() { - - println "************ callRESTUpdateContrailAAINetwork ************* " - + AAIResourcesClient mockClient = mock(AAIResourcesClient.class) WireMock.reset(); - MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all"); + L3Network network = new L3Network() + //TODO need to inject mock ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(network) when(mockExecution.getVariable(Prefix + "createNetworkResponse")).thenReturn(createNetworkResponseREST) when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + // old: when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.network.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("false") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + doNothing().when(mockClient).update(isA(AAIResourceUri.class), isA(L3Network.class)) // preProcessRequest(DelegateExecution execution) DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() DoCreateNetworkInstance.callRESTUpdateContrailAAINetwork(mockExecution) @@ -4102,7 +4103,7 @@ String sdncAdapterWorkflowAssignResponse = } - + @Test //@Ignore diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index 38261c0f1a..ed6379a6a4 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -156,7 +156,9 @@ public class AAIUpdateTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); String heatStackId = execution.getVariable("heatStackId"); - + if (heatStackId == null) { + heatStackId = ""; + } VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); CloudRegion cloudRegion = gBBInput.getCloudRegion(); volumeGroup.setHeatStackId(heatStackId); @@ -320,6 +322,9 @@ public class AAIUpdateTasks { public void updateHeatStackIdVfModule(BuildingBlockExecution execution) { try { String heatStackId = execution.getVariable("heatStackId"); + if (heatStackId == null) { + heatStackId = ""; + } VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); vfModule.setHeatStackId(heatStackId); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java index 4506699ce8..81ebfb1f41 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java @@ -75,7 +75,9 @@ public class SDNCQueryTasks { + genericVnf.getVnfId() + "/vnf-data/vf-modules/vf-module/" + vfModule.getVfModuleId() + "/vf-module-data/vf-module-topology/"; try { - vfModule.setSelflink(selfLink); + if(vfModule.getSelflink() == null || (vfModule.getSelflink() != null && vfModule.getSelflink().isEmpty())) { + vfModule.setSelflink(selfLink); + } if(vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) { String response = sdncVfModuleResources.queryVfModule(vfModule); execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java index 58c6db109c..173d5f7e73 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.exception.MapperException; @@ -90,11 +91,6 @@ public class SDNCRequestTasks { public void handleTimeOutException (DelegateExecution execution) { exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error timed out waiting on SDNC Async-Response"); } - - public void handleSyncError (DelegateExecution execution) { - String msg = (String) execution.getVariable("SDNCSyncError"); - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); - } protected boolean convertIndicatorToBoolean(String finalMessageIndicator) { return "Y".equals(finalMessageIndicator); 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 e04043a352..10ee13ebed 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 @@ -166,6 +166,13 @@ public class WorkflowAction { } catch (Exception ex) { cloudOwner = environment.getProperty(defaultCloudOwner); } + boolean suppressRollback = false; + try{ + suppressRollback = requestDetails.getRequestInfo().getSuppressRollback(); + } catch (Exception ex) { + suppressRollback = false; + } + execution.setVariable("suppressRollback", suppressRollback); Resource resource = extractResourceIdAndTypeFromUri(uri); WorkflowType resourceType = resource.getResourceType(); execution.setVariable("resourceName", resourceType.toString()); @@ -401,6 +408,7 @@ public class WorkflowAction { if(virtualLinkKey != null && ebb.getBuildingBlock().getIsVirtualLink() && virtualLinkKey.equalsIgnoreCase(ebb.getBuildingBlock().getVirtualLinkKey())) { WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId(serviceInstanceId); workflowResourceIds.setNetworkId(resourceId); ebb.setWorkflowResourceIds(workflowResourceIds); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java index 7e6eb2a23d..ac06818e66 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java @@ -100,7 +100,7 @@ public class WorkflowActionBBFailure { } catch (Exception ex) { logger.error("Failed to extract workflow exception from execution.",ex); } - return Optional.of(errorMsg); + return Optional.empty(); } public void updateRequestStatusToFailedWithRollback(DelegateExecution execution) { 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 d9125e4104..917039b17b 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 @@ -20,7 +20,9 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; +import java.sql.Timestamp; import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.Optional; @@ -181,27 +183,30 @@ public class WorkflowActionBBTasks { } } - public void setupCompleteMsoProcess(DelegateExecution execution) { - final String requestId = (String) execution.getVariable(G_REQUEST_ID); - final String action = (String) execution.getVariable(G_ACTION); - final String resourceId = (String) execution.getVariable("resourceId"); - final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE); - final String resourceName = (String) execution.getVariable("resourceName"); - final String source = (String) execution.getVariable("source"); - String macroAction = ""; - if (aLaCarte) { - macroAction = "ALaCarte-" + resourceName + "-" + action; - } else { - macroAction = "Macro-" + resourceName + "-" + action; + public void updateRequestStatusToComplete(DelegateExecution execution) { + try{ + final String requestId = (String) execution.getVariable(G_REQUEST_ID); + InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); + final String action = (String) execution.getVariable(G_ACTION); + final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE); + final String resourceName = (String) execution.getVariable("resourceName"); + String macroAction = ""; + if (aLaCarte) { + macroAction = "ALaCarte-" + resourceName + "-" + action + " request was executed correctly."; + } else { + macroAction = "Macro-" + resourceName + "-" + action + " request was executed correctly."; + } + execution.setVariable("finalStatusMessage", macroAction); + Timestamp endTime = new Timestamp(System.currentTimeMillis()); + request.setEndTime(endTime); + request.setStatusMessage(macroAction); + request.setProgress(Long.valueOf(100)); + request.setRequestStatus("COMPLETE"); + request.setLastModifiedBy("CamundaBPMN"); + requestDbclient.updateInfraActiveRequests(request); + }catch (Exception ex) { + workflowAction.buildAndThrowException(execution, "Error Updating Request Database", ex); } - String msoCompletionRequest = "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns=\"http://org.onap/so/request/types/v1\"><request-info xmlns=\"http://org.onap/so/infra/vnf-request/v1\"><request-id>" - + requestId + "</request-id><action>" + action + "</action><source>" + source - + "</source></request-info><status-message>" + macroAction - + " request was executed correctly.</status-message><serviceInstanceId>" + resourceId - + "</serviceInstanceId><mso-bpel-name>WorkflowActionBB</mso-bpel-name></aetgt:MsoCompletionRequest>"; - execution.setVariable("CompleteMsoProcessRequest", msoCompletionRequest); - execution.setVariable("mso-request-id", requestId); - execution.setVariable("mso-service-instance-id", resourceId); } public void checkRetryStatus(DelegateExecution execution) { @@ -209,11 +214,12 @@ public class WorkflowActionBBTasks { String requestId = (String) execution.getVariable(G_REQUEST_ID); String retryDuration = (String) execution.getVariable("RetryDuration"); int retryCount = (int) execution.getVariable(RETRY_COUNT); + int nextCount = retryCount +1; if (handlingCode.equals("Retry")){ workflowActionBBFailure.updateRequestErrorStatusMessage(execution); try{ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); - request.setRetryStatusMessage("Retry " + retryCount+1 + "/5 will be started in " + retryDuration); + request.setRetryStatusMessage("Retry " + nextCount + "/5 will be started in " + retryDuration); requestDbclient.updateInfraActiveRequests(request); } catch(Exception ex){ logger.warn("Failed to update Request Db Infra Active Requests with Retry Status",ex); @@ -221,7 +227,7 @@ public class WorkflowActionBBTasks { if(retryCount<5){ int currSequence = (int) execution.getVariable("gCurrentSequence"); execution.setVariable("gCurrentSequence", currSequence-1); - execution.setVariable(RETRY_COUNT, retryCount + 1); + execution.setVariable(RETRY_COUNT, nextCount); }else{ workflowAction.buildAndThrowException(execution, "Exceeded maximum retries. Ending flow with status Abort"); } @@ -285,4 +291,100 @@ public class WorkflowActionBBTasks { workflowAction.buildAndThrowException(execution, "Rollback has already been called. Cannot rollback a request that is currently in the rollback state."); } } + + protected void updateRequestErrorStatusMessage(DelegateExecution execution) { + try { + String requestId = (String) execution.getVariable(G_REQUEST_ID); + InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); + String errorMsg = retrieveErrorMessage(execution); + if(errorMsg == null || errorMsg.equals("")){ + errorMsg = "Failed to determine error message"; + } + request.setStatusMessage(errorMsg); + logger.debug("Updating RequestDB to failed: errorMsg = " + errorMsg); + requestDbclient.updateInfraActiveRequests(request); + } catch (Exception e) { + logger.error("Failed to update Request db with the status message after retry or rollback has been initialized.",e); + } + } + + public void abortCallErrorHandling(DelegateExecution execution) { + String msg = "Flow has failed. Rainy day handler has decided to abort the process."; + logger.error(msg); + throw new BpmnError(msg); + } + + public void updateRequestStatusToFailed(DelegateExecution execution) { + try { + String requestId = (String) execution.getVariable(G_REQUEST_ID); + InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); + String errorMsg = null; + String rollbackErrorMsg = null; + boolean rollbackCompleted = (boolean) execution.getVariable("isRollbackComplete"); + boolean isRollbackFailure = (boolean) execution.getVariable("isRollback"); + ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock"); + + if(rollbackCompleted){ + rollbackErrorMsg = "Rollback has been completed successfully."; + request.setRollbackStatusMessage(rollbackErrorMsg); + logger.debug("Updating RequestDB to failed: Rollback has been completed successfully"); + }else{ + if(isRollbackFailure){ + rollbackErrorMsg = retrieveErrorMessage(execution); + if(rollbackErrorMsg == null || rollbackErrorMsg.equals("")){ + rollbackErrorMsg = "Failed to determine rollback error message."; + } + request.setRollbackStatusMessage(rollbackErrorMsg); + logger.debug("Updating RequestDB to failed: rollbackErrorMsg = " + rollbackErrorMsg); + }else{ + errorMsg = retrieveErrorMessage(execution); + if(errorMsg == null || errorMsg.equals("")){ + errorMsg = "Failed to determine error message"; + } + request.setStatusMessage(errorMsg); + logger.debug("Updating RequestDB to failed: errorMsg = " + errorMsg); + } + } + if(ebb!=null && ebb.getBuildingBlock()!=null){ + String flowStatus = ebb.getBuildingBlock().getBpmnFlowName() + " has failed."; + request.setFlowStatus(flowStatus); + execution.setVariable("flowStatus", flowStatus); + } + + request.setProgress(Long.valueOf(100)); + request.setRequestStatus("FAILED"); + request.setLastModifiedBy("CamundaBPMN"); + requestDbclient.updateInfraActiveRequests(request); + } catch (Exception e) { + workflowAction.buildAndThrowException(execution, "Error Updating Request Database", e); + } + } + + private String retrieveErrorMessage (DelegateExecution execution){ + String errorMsg = ""; + try { + WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException"); + if(exception != null && (exception.getErrorMessage()!=null || !exception.getErrorMessage().equals(""))){ + errorMsg = exception.getErrorMessage(); + } + } catch (Exception ex) { + //log error and attempt to extact WorkflowExceptionMessage + logger.error("Failed to extract workflow exception from execution.",ex); + } + + if (errorMsg == null || errorMsg.equals("")){ + try { + errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage"); + } catch (Exception ex) { + logger.error("Failed to extract workflow exception message from WorkflowException",ex); + errorMsg = "Unexpected Error in BPMN."; + } + } + return errorMsg; + } + + public void updateRequestStatusToFailedWithRollback(DelegateExecution execution) { + execution.setVariable("isRollbackComplete", true); + updateRequestStatusToFailed(execution); + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java index 57c760b01f..4abb0a1b2c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java @@ -49,9 +49,12 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; import org.onap.so.entity.MsoRequest; +import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.NetworkRollback; import org.onap.so.openstack.beans.RouteTarget; import org.onap.so.openstack.beans.Subnet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import org.springframework.web.util.UriUtils; @@ -59,6 +62,7 @@ import org.springframework.web.util.UriUtils; public class NetworkAdapterObjectMapper { private static final ModelMapper modelMapper = new ModelMapper(); private static String FORWARD_SLASH = "/"; + private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterObjectMapper.class); public CreateNetworkRequest createNetworkRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map<String, String> userInput, String cloudRegionPo, Customer customer) throws UnsupportedEncodingException { CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest(); @@ -82,8 +86,12 @@ public class NetworkAdapterObjectMapper { //build and set provider Vlan Network ProviderVlanNetwork providerVlanNetwork = buildProviderVlanNetwork(l3Network); createNetworkRequest.setProviderVlanNetwork(providerVlanNetwork); - - createNetworkRequest.setNetworkTechnology(setNetworkTechnology(l3Network.getModelInfoNetwork().getNetworkTechnology())); + String networkTechnology = l3Network.getModelInfoNetwork().getNetworkTechnology(); + if(networkTechnology == null) { + networkTechnology = l3Network.getNetworkTechnology(); + logger.warn("NetworkTechnology was null in CatalogDB. Using field from AAI: " + networkTechnology); + } + createNetworkRequest.setNetworkTechnology(setNetworkTechnology(networkTechnology)); //build and set Contrail Network ContrailNetwork contrailNetwork = buildContrailNetwork(l3Network, customer); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java index 6c20938780..f97b137fb3 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.aai.tasks; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doNothing; @@ -292,6 +293,17 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ } @Test + public void updateHeatStackIdVfModuleToNullTest() throws Exception { + execution.setVariable("heatStackId", null); + doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf); + + aaiUpdateTasks.updateHeatStackIdVfModule(execution); + + verify(aaiVfModuleResources, times(1)).updateHeatStackIdVfModule(vfModule, genericVnf); + assertEquals(vfModule.getHeatStackId(), ""); + } + + @Test public void updateHeatStackIdVfModuleExceptionTest() throws Exception { doThrow(RuntimeException.class).when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf); @@ -358,6 +370,16 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); assertEquals("newHeatStackId", volumeGroup.getHeatStackId()); } + @Test + public void updateHeatStackIdVolumeGroupToNullTest() throws Exception { + execution.setVariable("heatStackId", null); + doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); + + aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution); + + verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); + assertEquals(volumeGroup.getHeatStackId(), ""); + } @Test public void updateHeatStackIdVolumeGroupExceptionTest() throws Exception { diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java index a6efbd5989..f1779cf119 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java @@ -129,15 +129,6 @@ public class SDNCRequestTasksTest extends SDNCRequestTasks{ sndcRequestTasks.handleTimeOutException(delegateExecution); } - - @Test - public void HandleSyncError_Test() throws MapperException, BadResponseException{ - delegateExecution.setVariable("SDNCSyncError", "Error in SDNC Request"); - doReturn("processKey").when(exceptionBuilder).getProcessKey(delegateExecution); - expectedException.expect(BpmnError.class); - sndcRequestTasks.handleSyncError(delegateExecution); - } - @Test public void processCallBack_Final_Test() throws MapperException, BadResponseException, IOException{ final String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNC_ASYNC_Request.json"))); 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 189ecb96c7..5c1485979e 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 @@ -114,16 +114,37 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { } @Test - public void msoCompleteProcessTest() throws Exception{ - execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + public void updateRequestStatusToCompleteTest() throws Exception{ + String reqId = "reqId123"; + execution.setVariable("mso-request-id", reqId); execution.setVariable("requestAction", "createInstance"); - execution.setVariable("resourceId", "123"); - execution.setVariable("source","MSO"); execution.setVariable("resourceName", "Service"); execution.setVariable("aLaCarte", true); - workflowActionBBTasks.setupCompleteMsoProcess(execution); - String response = (String) execution.getVariable("CompleteMsoProcessRequest"); - assertEquals(response,"<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns=\"http://org.onap/so/request/types/v1\"><request-info xmlns=\"http://org.onap/so/infra/vnf-request/v1\"><request-id>00f704ca-c5e5-4f95-a72c-6889db7b0688</request-id><action>createInstance</action><source>MSO</source></request-info><status-message>ALaCarte-Service-createInstance request was executed correctly.</status-message><serviceInstanceId>123</serviceInstanceId><mso-bpel-name>WorkflowActionBB</mso-bpel-name></aetgt:MsoCompletionRequest>"); + InfraActiveRequests req = new InfraActiveRequests(); + doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId); + doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class)); + workflowActionBBTasks.updateRequestStatusToComplete(execution); + assertEquals("ALaCarte-Service-createInstance request was executed correctly.",execution.getVariable("finalStatusMessage")); + } + + @Test + public void updateRequestStatusToFailedFlowStatusTest() { + String reqId = "reqId123"; + execution.setVariable("mso-request-id", reqId); + execution.setVariable("isRollbackComplete", false); + execution.setVariable("isRollback", false); + ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); + BuildingBlock buildingBlock = new BuildingBlock(); + buildingBlock.setBpmnFlowName("CreateNetworkBB"); + ebb.setBuildingBlock(buildingBlock); + execution.setVariable("buildingBlock", ebb); + WorkflowException wfe = new WorkflowException("failure", 1, "failure"); + execution.setVariable("WorkflowException", wfe); + InfraActiveRequests req = new InfraActiveRequests(); + doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId); + doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class)); + workflowActionBBTasks.updateRequestStatusToFailed(execution); + assertEquals("CreateNetworkBB has failed.",execution.getVariable("flowStatus")); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java index 8f0d00ff86..6f353fa622 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java @@ -144,7 +144,7 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ List<Subnet> subnetList = new ArrayList<Subnet>(); subnetList.add(openstackSubnet); l3Network.getSubnets().add(openstackSubnet); - l3Network.getModelInfoNetwork().setNetworkTechnology("Contrail"); + l3Network.setNetworkTechnology("Contrail"); CreateNetworkRequest createNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer); |