diff options
13 files changed, 490 insertions, 128 deletions
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmCreateNodeStatus.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmCreateNodeStatus.bpmn index e7d40e84b5..9712ca8ab7 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmCreateNodeStatus.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmCreateNodeStatus.bpmn @@ -24,7 +24,7 @@ <bpmn:endEvent id="EndEvent_0tei3i9"> <bpmn:incoming>SequenceFlow_1rxbeqi</bpmn:incoming> </bpmn:endEvent> - <bpmn:serviceTask id="ServiceTask_0y71su8" name=" Get node status " camunda:asyncAfter="true" camunda:expression="${MonitorVnfmNodeTask.getNodeStatus(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="ServiceTask_0y71su8" name=" Get node status " camunda:asyncAfter="true" camunda:expression="${MonitorInstantiateVnfmNodeTask.getNodeStatus(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1moaz0q</bpmn:incoming> <bpmn:incoming>SequenceFlow_09t51ao</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0qvy3sn</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteNodeStatus.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteNodeStatus.bpmn index 8fababaffe..668cfaa44a 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteNodeStatus.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteNodeStatus.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_15jp7td" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4"> +<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_15jp7td" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.3"> <bpmn:process id="MonitorVnfmDeleteNodeStatus" name="MonitorVnfmDeleteNodeStatus" isExecutable="true"> <bpmn:startEvent id="StartEvent_0f7nbs2"> <bpmn:outgoing>SequenceFlow_0spr34x</bpmn:outgoing> @@ -28,7 +28,7 @@ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("deleteVnfNodeStatus")}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_0zlblru" sourceRef="ExclusiveGateway_1j9jbtk" targetRef="IntermediateCatchEvent_15yl23y" /> - <bpmn:serviceTask id="ServiceTask_1ksqjjf" name=" Get node status " camunda:asyncAfter="true" camunda:expression="${MonitorVnfmNodeTask.getNodeStatus(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="ServiceTask_1ksqjjf" name=" Get node status " camunda:asyncAfter="true" camunda:expression="${MonitorTerminateVnfmNodeTask.getNodeStatus(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_17vvpzi</bpmn:incoming> <bpmn:incoming>SequenceFlow_11rfobu</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1unicf9</bpmn:outgoing> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy index bd465eb9a8..a771741e18 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy @@ -23,6 +23,13 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.ErrorCode; import static org.apache.commons.lang3.StringUtils.* @@ -332,5 +339,41 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor } logger.trace("finished prepareInitServiceOperationStatus") } + + public void updateAAIOrchStatus (DelegateExecution execution){ + logger.debug(" ***** start updateAAIOrchStatus ***** ") + String msg = "" + String serviceInstanceId = execution.getVariable("serviceInstanceId") + logger.debug("serviceInstanceId: "+serviceInstanceId) + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + try { + ServiceInstance si = execution.getVariable("serviceInstanceData") + boolean allActive = true + for (VnfResource resource : serviceDecomposition.vnfResources) { + logger.debug("resource.modelInfo.getModelName: " + resource.modelInfo.getModelName() +" | resource.getOrchestrationStatus: "+resource.getOrchestrationStatus()) + if (resource.getOrchestrationStatus() != "Active") { + allActive = false + } + } + + if (allActive){ + si.setOrchestrationStatus("Active") + }else { + si.setOrchestrationStatus("Pending") + } + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + client.update(uri, si) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in org.onap.so.bpmn.common.scripts.CompleteMsoProcess.updateAAIOrchStatus " + ex.getMessage() + logger.info( msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + logger.debug(" ***** end updateAAIOrchStatus ***** ") + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index b0749ded86..b70797c63b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -243,12 +243,11 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String ontsn = jsonUtil.getJsonValue(serInput, "service.parameters.requestInputs.ont_ont_serial_num") - String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.c_vlan", cvlan) - uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.s_vlan", svlan) + String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.CVLAN", cvlan) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.SVLAN", svlan) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.remote_id", remoteId) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.manufacturer", manufacturer) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ONTSN", ontsn) - logger.debug("old resource input:" + resourceInputObj.toString()) resourceInputObj.setResourceParameters(uResourceInput) execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy index 98def612de..b49f00a247 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy @@ -280,5 +280,10 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ public void postConfigRequest(DelegateExecution execution){ //now do noting + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + for (VnfResource resource : serviceDecomposition.vnfResources) { + resource.setOrchestrationStatus("Active") + } + execution.setVariable("serviceDecomposition", serviceDecomposition) } } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn index 04ff48d4ed..c1b5ef82de 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.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.16.2"> +<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="2.2.4"> <bpmn:process id="CreateCustomE2EServiceInstance" name="CreateCustomE2EServiceInstance" isExecutable="true"> <bpmn:startEvent id="StartEvent_00qj6ro" name="Create SI Start Flow"> <bpmn:outgoing>SequenceFlow_0s2spoq</bpmn:outgoing> @@ -44,6 +44,8 @@ ex.processJavaException(execution)</bpmn:script> <camunda:in source="uuiRequest" target="uuiRequest" /> <camunda:in source="requestAction" target="operationType" /> <camunda:in source="operationId" target="operationId" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="serviceInstanceData" target="serviceInstanceData" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_19eilro</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0klbpxx</bpmn:outgoing> @@ -74,7 +76,7 @@ csi.prepareCompletionRequest(execution)</bpmn:script> <camunda:out source="CompleteMsoProcessResponse" target="CompleteMsoProcessResponse" /> <camunda:out source="CMSO_ErrorResponse" target="CMSO_ErrorResponse" /> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0je30si</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0kaz8ac</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0yayvrf</bpmn:outgoing> </bpmn:callActivity> <bpmn:subProcess id="SubProcess_0vaws86" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true"> @@ -140,7 +142,7 @@ csi.sendSyncResponse(execution)</bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_14zu6wr" name="yes" sourceRef="ExclusiveGateway_0aqn64l" targetRef="ScriptTask_0ttvn8r"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") == null}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0je30si" sourceRef="ScriptTask_0ttvn8r" targetRef="CallActivity_02fyxz0" /> + <bpmn:sequenceFlow id="SequenceFlow_0je30si" sourceRef="ScriptTask_0ttvn8r" targetRef="Task_1bgdtc9" /> <bpmn:sequenceFlow id="SequenceFlow_1fueo69" name="no" sourceRef="ExclusiveGateway_0aqn64l" targetRef="EndEvent_07uk5iy"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") != null}</bpmn:conditionExpression> </bpmn:sequenceFlow> @@ -175,6 +177,14 @@ csi.prepareInitServiceOperationStatus(execution)</bpmn:script> <bpmn:outgoing>SequenceFlow_081z8l2</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_081z8l2" sourceRef="Task_19mxcw3" targetRef="ScriptTask_0xupxj9" /> + <bpmn:sequenceFlow id="SequenceFlow_0kaz8ac" sourceRef="Task_1bgdtc9" targetRef="CallActivity_02fyxz0" /> + <bpmn:scriptTask id="Task_1bgdtc9" name="Update AAI Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0je30si</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0kaz8ac</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new CreateCustomE2EServiceInstance() +csi.updateAAIOrchStatus(execution)</bpmn:script> + </bpmn:scriptTask> </bpmn:process> <bpmn:error id="Error_0nbdy47" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -192,9 +202,9 @@ csi.prepareInitServiceOperationStatus(execution)</bpmn:script> <dc:Bounds x="751" y="158" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0bpd6c0_di" bpmnElement="EndEvent_0bpd6c0"> - <dc:Bounds x="1258" y="286" width="36" height="36" /> + <dc:Bounds x="1387" y="286" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1268" y="322" width="22" height="12" /> + <dc:Bounds x="1398" y="322" width="20" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1s09c7d_di" bpmnElement="ScriptTask_1s09c7d"> @@ -204,7 +214,7 @@ csi.prepareInitServiceOperationStatus(execution)</bpmn:script> <dc:Bounds x="1038" y="158" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_02fyxz0_di" bpmnElement="CallActivity_02fyxz0"> - <dc:Bounds x="1226" y="158" width="100" height="80" /> + <dc:Bounds x="1355" y="158" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_0vaws86_di" bpmnElement="SubProcess_0vaws86" isExpanded="true"> <dc:Bounds x="348" y="370" width="679" height="194" /> @@ -246,8 +256,8 @@ csi.prepareInitServiceOperationStatus(execution)</bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0yayvrf_di" bpmnElement="SequenceFlow_0yayvrf"> - <di:waypoint x="1276" y="238" /> - <di:waypoint x="1276" y="286" /> + <di:waypoint x="1405" y="238" /> + <di:waypoint x="1405" y="286" /> <bpmndi:BPMNLabel> <dc:Bounds x="1246" y="262" width="0" height="12" /> </bpmndi:BPMNLabel> @@ -270,7 +280,7 @@ csi.prepareInitServiceOperationStatus(execution)</bpmn:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0je30si_di" bpmnElement="SequenceFlow_0je30si"> <di:waypoint x="1138" y="198" /> - <di:waypoint x="1226" y="198" /> + <di:waypoint x="1189" y="198" /> <bpmndi:BPMNLabel> <dc:Bounds x="1137" y="183" width="0" height="12" /> </bpmndi:BPMNLabel> @@ -386,6 +396,13 @@ csi.prepareInitServiceOperationStatus(execution)</bpmn:script> <dc:Bounds x="533" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0kaz8ac_di" bpmnElement="SequenceFlow_0kaz8ac"> + <di:waypoint x="1289" y="198" /> + <di:waypoint x="1355" y="198" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0novdpr_di" bpmnElement="Task_1bgdtc9"> + <dc:Bounds x="1189" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn index eccb9486dd..76dd6facd6 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.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="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.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="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DoCreateE2EServiceInstanceV3" name="DoCreateE2EServiceInstanceV3" isExecutable="true"> <bpmn2:startEvent id="createSI_startEvent" name="Start Flow"> <bpmn2:outgoing>SequenceFlow_1qiiycn</bpmn2:outgoing> @@ -7,10 +7,10 @@ <bpmn2:scriptTask id="preProcessRequest_ScriptTask" name="PreProcess Incoming Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1qiiycn</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0w9t6tc</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DoCreateE2EServiceInstance() dcsi.preProcessRequest(execution) -]]></bpmn2:script> +</bpmn2:script> </bpmn2:scriptTask> <bpmn2:subProcess id="SubProcess_06d8lk8" name="Sub-process for Application Errors" triggeredByEvent="true"> <bpmn2:startEvent id="StartEvent_0yljq9y"> @@ -36,28 +36,28 @@ dcsi.preProcessRequest(execution) <bpmn2:scriptTask id="ScriptTask_0ocetux" name="Pre Process Rollback" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0tgrn11</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1lqktwf</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DoCreateE2EServiceInstance() dcsi.preProcessRollback(execution) -]]></bpmn2:script> +</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1lqktwf" sourceRef="ScriptTask_0ocetux" targetRef="CallActivity_1srx6p6" /> <bpmn2:scriptTask id="ScriptTask_1p0vyip" name="Post Process Rollback" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0eumzpf</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1xzgv5k</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DoCreateE2EServiceInstance() dcsi.postProcessRollback(execution) -]]></bpmn2:script> +</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1xzgv5k" sourceRef="ScriptTask_1p0vyip" targetRef="EndEvent_117lkk3" /> </bpmn2:subProcess> <bpmn2:scriptTask id="ScriptTask_0q37vn9" name=" AAI Create (srv instance) " scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_012h7yx</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1tkgqu3</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoCreateE2EServiceInstance() -ddsi.createServiceInstance(execution)]]></bpmn2:script> +ddsi.createServiceInstance(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0bq4fxs" name="Go to Decompose_Service"> <bpmn2:incoming>SequenceFlow_0w9t6tc</bpmn2:incoming> @@ -66,9 +66,9 @@ ddsi.createServiceInstance(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_1o01d7d" name="PostProcess Decompose Service " scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0xjwb45</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_012h7yx</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi= new DoCreateE2EServiceInstance() -dcsi.processDecomposition(execution)]]></bpmn2:script> +dcsi.processDecomposition(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:callActivity id="CallActivity_0biblpc" name="Call Decompose Service" calledElement="DecomposeService"> <bpmn2:extensionElements> @@ -85,9 +85,9 @@ dcsi.processDecomposition(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_1cllqk3" name="Prepare Decompose Service " scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_166w91p</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0qxzgvq</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi= new DoCreateE2EServiceInstance() -dcsi.prepareDecomposeService(execution)]]></bpmn2:script> +dcsi.prepareDecomposeService(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_0tv85pg" name="Decompose_Service"> <bpmn2:outgoing>SequenceFlow_166w91p</bpmn2:outgoing> @@ -111,9 +111,9 @@ dcsi.prepareDecomposeService(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_1rzf8a1" name="Prepare Resource Oper Status" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1y9rkfr</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0n7nbx3</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoCreateE2EServiceInstance() -ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script> +ddsi.preInitResourcesOperStatus(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:serviceTask id="ServiceTask_1asgesv" name="Init Resource Oper Status"> <bpmn2:extensionElements> @@ -154,6 +154,7 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script> <camunda:in source="serviceDecomposition" target="serviceDecomposition" /> <camunda:in source="uuiRequest" target="uuiRequest" /> <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_0b1dsaj</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0sphcy5</bpmn2:outgoing> @@ -161,16 +162,16 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_0ns08tn" name="PreProcess for Add Resources" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_022onug</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0b1dsaj</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi = new DoCreateE2EServiceInstance() -csi.preProcessForAddResource(execution)]]></bpmn2:script> +csi.preProcessForAddResource(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_19t13rd" name="PostProcess for Add Resource" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0sphcy5</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_18gnns6</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi = new DoCreateE2EServiceInstance() -csi.postProcessForAddResource(execution)]]></bpmn2:script> +csi.postProcessForAddResource(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:endEvent id="EndEvent_1x4kvfh"> <bpmn2:incoming>SequenceFlow_18gnns6</bpmn2:incoming> @@ -178,16 +179,16 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_0jxdler" name="Process Site Location" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0yuzaen</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1y9rkfr</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi= new DoCreateE2EServiceInstance() -dcsi.doProcessSiteLocation(execution)]]></bpmn2:script> +dcsi.doProcessSiteLocation(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_0ts3c3b" name="Process Link TP Resource Allocation" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0ckto7v</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_022onug</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi= new DoCreateE2EServiceInstance() -dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script> +dcsi.doTPResourcesAllocation(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1y9rkfr" sourceRef="ScriptTask_0jxdler" targetRef="ScriptTask_1rzf8a1" /> <bpmn2:sequenceFlow id="SequenceFlow_0n7nbx3" sourceRef="ScriptTask_1rzf8a1" targetRef="ServiceTask_1asgesv" /> @@ -230,15 +231,15 @@ dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script> <dc:Bounds x="409" y="920" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0eumzpf_di" bpmnElement="SequenceFlow_0eumzpf"> - <di:waypoint xsi:type="dc:Point" x="509" y="960" /> - <di:waypoint xsi:type="dc:Point" x="577" y="960" /> + <di:waypoint x="509" y="960" /> + <di:waypoint x="577" y="960" /> <bpmndi:BPMNLabel> <dc:Bounds x="498" y="945" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0tgrn11_di" bpmnElement="SequenceFlow_0tgrn11"> - <di:waypoint xsi:type="dc:Point" x="147" y="960" /> - <di:waypoint xsi:type="dc:Point" x="246" y="960" /> + <di:waypoint x="147" y="960" /> + <di:waypoint x="246" y="960" /> <bpmndi:BPMNLabel> <dc:Bounds x="152" y="945" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -250,8 +251,8 @@ dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script> <dc:Bounds x="246" y="920" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1lqktwf_di" bpmnElement="SequenceFlow_1lqktwf"> - <di:waypoint xsi:type="dc:Point" x="346" y="960" /> - <di:waypoint xsi:type="dc:Point" x="409" y="960" /> + <di:waypoint x="346" y="960" /> + <di:waypoint x="409" y="960" /> <bpmndi:BPMNLabel> <dc:Bounds x="333" y="945" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -260,10 +261,10 @@ dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script> <dc:Bounds x="577" y="920" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1xzgv5k_di" bpmnElement="SequenceFlow_1xzgv5k"> - <di:waypoint xsi:type="dc:Point" x="677" y="960" /> - <di:waypoint xsi:type="dc:Point" x="709" y="960" /> - <di:waypoint xsi:type="dc:Point" x="709" y="960" /> - <di:waypoint xsi:type="dc:Point" x="744" y="960" /> + <di:waypoint x="677" y="960" /> + <di:waypoint x="709" y="960" /> + <di:waypoint x="709" y="960" /> + <di:waypoint x="744" y="960" /> <bpmndi:BPMNLabel> <dc:Bounds x="679" y="960" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -290,29 +291,29 @@ dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0xjwb45_di" bpmnElement="SequenceFlow_0xjwb45"> - <di:waypoint xsi:type="dc:Point" x="569" y="146" /> - <di:waypoint xsi:type="dc:Point" x="704" y="146" /> + <di:waypoint x="569" y="146" /> + <di:waypoint x="704" y="146" /> <bpmndi:BPMNLabel> <dc:Bounds x="592" y="125" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0qxzgvq_di" bpmnElement="SequenceFlow_0qxzgvq"> - <di:waypoint xsi:type="dc:Point" x="287" y="146" /> - <di:waypoint xsi:type="dc:Point" x="469" y="146" /> + <di:waypoint x="287" y="146" /> + <di:waypoint x="469" y="146" /> <bpmndi:BPMNLabel> <dc:Bounds x="333" y="125" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1qiiycn_di" bpmnElement="SequenceFlow_1qiiycn"> - <di:waypoint xsi:type="dc:Point" x="45" y="-4" /> - <di:waypoint xsi:type="dc:Point" x="117" y="-4" /> + <di:waypoint x="45" y="-4" /> + <di:waypoint x="117" y="-4" /> <bpmndi:BPMNLabel> <dc:Bounds x="36" y="-25" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_166w91p_di" bpmnElement="SequenceFlow_166w91p"> - <di:waypoint xsi:type="dc:Point" x="53" y="146" /> - <di:waypoint xsi:type="dc:Point" x="187" y="146" /> + <di:waypoint x="53" y="146" /> + <di:waypoint x="187" y="146" /> <bpmndi:BPMNLabel> <dc:Bounds x="75" y="125" width="90" height="12" /> </bpmndi:BPMNLabel> @@ -324,19 +325,19 @@ dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1tkgqu3_di" bpmnElement="SequenceFlow_1tkgqu3"> - <di:waypoint xsi:type="dc:Point" x="1112" y="146" /> - <di:waypoint xsi:type="dc:Point" x="1222" y="146" /> - <di:waypoint xsi:type="dc:Point" x="1222" y="146" /> - <di:waypoint xsi:type="dc:Point" x="1306" y="146" /> + <di:waypoint x="1112" y="146" /> + <di:waypoint x="1222" y="146" /> + <di:waypoint x="1222" y="146" /> + <di:waypoint x="1306" y="146" /> <bpmndi:BPMNLabel> <dc:Bounds x="1192" y="140" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0w9t6tc_di" bpmnElement="SequenceFlow_0w9t6tc"> - <di:waypoint xsi:type="dc:Point" x="217" y="-4" /> - <di:waypoint xsi:type="dc:Point" x="762" y="-4" /> - <di:waypoint xsi:type="dc:Point" x="762" y="-4" /> - <di:waypoint xsi:type="dc:Point" x="1306" y="-4" /> + <di:waypoint x="217" y="-4" /> + <di:waypoint x="762" y="-4" /> + <di:waypoint x="762" y="-4" /> + <di:waypoint x="1306" y="-4" /> <bpmndi:BPMNLabel> <dc:Bounds x="732" y="-10" width="90" height="12" /> </bpmndi:BPMNLabel> @@ -348,10 +349,10 @@ dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_012h7yx_di" bpmnElement="SequenceFlow_012h7yx"> - <di:waypoint xsi:type="dc:Point" x="804" y="146" /> - <di:waypoint xsi:type="dc:Point" x="917" y="146" /> - <di:waypoint xsi:type="dc:Point" x="917" y="146" /> - <di:waypoint xsi:type="dc:Point" x="1012" y="146" /> + <di:waypoint x="804" y="146" /> + <di:waypoint x="917" y="146" /> + <di:waypoint x="917" y="146" /> + <di:waypoint x="1012" y="146" /> <bpmndi:BPMNLabel> <dc:Bounds x="887" y="139" width="90" height="14" /> </bpmndi:BPMNLabel> @@ -384,61 +385,61 @@ dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script> <dc:Bounds x="599" y="260" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1y9rkfr_di" bpmnElement="SequenceFlow_1y9rkfr"> - <di:waypoint xsi:type="dc:Point" x="188" y="300" /> - <di:waypoint xsi:type="dc:Point" x="262" y="300" /> + <di:waypoint x="188" y="300" /> + <di:waypoint x="262" y="300" /> <bpmndi:BPMNLabel> <dc:Bounds x="180" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0n7nbx3_di" bpmnElement="SequenceFlow_0n7nbx3"> - <di:waypoint xsi:type="dc:Point" x="362" y="300" /> - <di:waypoint xsi:type="dc:Point" x="433" y="300" /> + <di:waypoint x="362" y="300" /> + <di:waypoint x="433" y="300" /> <bpmndi:BPMNLabel> <dc:Bounds x="353.5" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ckto7v_di" bpmnElement="SequenceFlow_0ckto7v"> - <di:waypoint xsi:type="dc:Point" x="533" y="300" /> - <di:waypoint xsi:type="dc:Point" x="599" y="300" /> + <di:waypoint x="533" y="300" /> + <di:waypoint x="599" y="300" /> <bpmndi:BPMNLabel> <dc:Bounds x="521" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0b1dsaj_di" bpmnElement="SequenceFlow_0b1dsaj"> - <di:waypoint xsi:type="dc:Point" x="885" y="300" /> - <di:waypoint xsi:type="dc:Point" x="957" y="300" /> + <di:waypoint x="885" y="300" /> + <di:waypoint x="957" y="300" /> <bpmndi:BPMNLabel> <dc:Bounds x="876" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0sphcy5_di" bpmnElement="SequenceFlow_0sphcy5"> - <di:waypoint xsi:type="dc:Point" x="1057" y="300" /> - <di:waypoint xsi:type="dc:Point" x="1131" y="300" /> + <di:waypoint x="1057" y="300" /> + <di:waypoint x="1131" y="300" /> <bpmndi:BPMNLabel> <dc:Bounds x="1049" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_022onug_di" bpmnElement="SequenceFlow_022onug"> - <di:waypoint xsi:type="dc:Point" x="699" y="300" /> - <di:waypoint xsi:type="dc:Point" x="785" y="300" /> + <di:waypoint x="699" y="300" /> + <di:waypoint x="785" y="300" /> <bpmndi:BPMNLabel> <dc:Bounds x="697" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_18gnns6_di" bpmnElement="SequenceFlow_18gnns6"> - <di:waypoint xsi:type="dc:Point" x="1231" y="300" /> - <di:waypoint xsi:type="dc:Point" x="1301" y="300" /> + <di:waypoint x="1231" y="300" /> + <di:waypoint x="1301" y="300" /> <bpmndi:BPMNLabel> <dc:Bounds x="1221" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0yuzaen_di" bpmnElement="SequenceFlow_0yuzaen"> - <di:waypoint xsi:type="dc:Point" x="54" y="300" /> - <di:waypoint xsi:type="dc:Point" x="88" y="300" /> + <di:waypoint x="54" y="300" /> + <di:waypoint x="88" y="300" /> <bpmndi:BPMNLabel> <dc:Bounds x="71" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn2:definitions>
\ No newline at end of file +</bpmn2:definitions> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTask.java new file mode 100644 index 0000000000..b885cc2ee5 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTask.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Ericsson. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; + +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_NODE_STATUS; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_CREATED; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIVnfResources; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @author waqas.ikram@est.tech + * + */ +@Component +public class MonitorInstantiateVnfmNodeTask extends MonitorVnfmNodeTask { + + @Autowired + public MonitorInstantiateVnfmNodeTask(final ExtractPojosForBB extractPojosForBB, + final ExceptionBuilder exceptionUtil, final AAIVnfResources aaiVnfResources) { + super(extractPojosForBB, exceptionUtil, aaiVnfResources); + } + + @Override + public String getNodeStatusVariableName() { + return CREATE_VNF_NODE_STATUS; + } + + @Override + public boolean isOrchestrationStatusValid(final String orchestrationStatus) { + return VNF_CREATED.equalsIgnoreCase(orchestrationStatus); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTask.java new file mode 100644 index 0000000000..34296c20d6 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTask.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Ericsson. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; + +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.DELETE_VNF_NODE_STATUS; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_ASSIGNED; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIVnfResources; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @author waqas.ikram@est.tech + * + */ +@Component +public class MonitorTerminateVnfmNodeTask extends MonitorVnfmNodeTask { + + @Autowired + public MonitorTerminateVnfmNodeTask(final ExtractPojosForBB extractPojosForBB, final ExceptionBuilder exceptionUtil, + final AAIVnfResources aaiVnfResources) { + super(extractPojosForBB, exceptionUtil, aaiVnfResources); + } + + @Override + public String getNodeStatusVariableName() { + return DELETE_VNF_NODE_STATUS; + } + + @Override + public boolean isOrchestrationStatusValid(final String orchestrationStatus) { + return VNF_ASSIGNED.equalsIgnoreCase(orchestrationStatus); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java index 65b05e21f5..a7a4eadb33 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java @@ -19,38 +19,39 @@ */ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; -import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_NODE_STATUS; -import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.DELETE_VNF_NODE_STATUS; -import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_ASSIGNED; -import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_CREATED; import static org.onap.so.bpmn.servicedecomposition.entities.ResourceKey.GENERIC_VNF_ID; +import java.util.Optional; import org.onap.aai.domain.yang.GenericVnf; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.exception.GenericVnfNotFoundException; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIVnfResources; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; /** * * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech) + * @author Waqas Ikram (waqas.ikram@est.tech) * */ -@Component -public class MonitorVnfmNodeTask { +public abstract class MonitorVnfmNodeTask { private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmNodeTask.class); private final ExtractPojosForBB extractPojosForBB; private final ExceptionBuilder exceptionUtil; + private final AAIVnfResources aaiVnfResources; @Autowired - public MonitorVnfmNodeTask(final ExtractPojosForBB extractPojosForBB, final ExceptionBuilder exceptionUtil) { + public MonitorVnfmNodeTask(final ExtractPojosForBB extractPojosForBB, final ExceptionBuilder exceptionUtil, + final AAIVnfResources aaiVnfResources) { this.exceptionUtil = exceptionUtil; this.extractPojosForBB = extractPojosForBB; + this.aaiVnfResources = aaiVnfResources; } /** @@ -61,11 +62,23 @@ public class MonitorVnfmNodeTask { public void getNodeStatus(final BuildingBlockExecution execution) { try { LOGGER.debug("Executing getNodeStatus ..."); - final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID); - String orchestrationStatus = vnf.getOrchestrationStatus(); - LOGGER.debug("Orchestration Status in AAI {}", orchestrationStatus); - execution.setVariable(CREATE_VNF_NODE_STATUS, VNF_CREATED.equalsIgnoreCase(orchestrationStatus)); - execution.setVariable(DELETE_VNF_NODE_STATUS, VNF_ASSIGNED.equalsIgnoreCase(orchestrationStatus)); + + final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = + extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID); + + final String vnfId = vnf.getVnfId(); + LOGGER.debug("Query A&AI for generic VNF using vnfID: {}", vnfId); + final Optional<GenericVnf> aaiGenericVnfOptional = aaiVnfResources.getGenericVnf(vnfId); + + if (!aaiGenericVnfOptional.isPresent()) { + throw new GenericVnfNotFoundException("Unable to find generic vnf in A&AI using vnfID: " + vnfId); + } + final GenericVnf genericVnf = aaiGenericVnfOptional.get(); + final String orchestrationStatus = genericVnf.getOrchestrationStatus(); + LOGGER.debug("Found generic vnf with orchestration status : {}", orchestrationStatus); + + execution.setVariable(getNodeStatusVariableName(), isOrchestrationStatusValid(orchestrationStatus)); + } catch (final Exception exception) { LOGGER.error("Unable to get vnf from AAI", exception); exceptionUtil.buildAndThrowWorkflowException(execution, 1220, exception); @@ -73,6 +86,20 @@ public class MonitorVnfmNodeTask { } /** + * Get variable to store in execution context + * + * @return the variable name + */ + public abstract String getNodeStatusVariableName(); + + /** + * @param orchestrationStatus the orchestration status from A&AI + * @return true if valid + */ + public abstract boolean isOrchestrationStatusValid(final String orchestrationStatus); + + + /** * Log and throw exception on timeout for job status * * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/exception/GenericVnfNotFoundException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/exception/GenericVnfNotFoundException.java new file mode 100644 index 0000000000..d33d0bc895 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/exception/GenericVnfNotFoundException.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Ericsson. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.exception; + +/** + * @author waqas.ikram@est.tech + * + */ +public class GenericVnfNotFoundException extends Exception { + private static final long serialVersionUID = -2049370314818025597L; + + public GenericVnfNotFoundException(final String message) { + super(message); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTaskTest.java new file mode 100644 index 0000000000..effcf24a8d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTaskTest.java @@ -0,0 +1,129 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; + +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_NODE_STATUS; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_CREATED; +import java.util.Optional; +import java.util.UUID; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.client.orchestration.AAIVnfResources; + +/** + * + * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech) + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public class MonitorInstantiateVnfmNodeTaskTest extends BaseTaskTest { + + private static final String VNF_ID = UUID.randomUUID().toString(); + + private static final String VNF_NAME = "VNF_NAME"; + + private MonitorVnfmNodeTask objUnderTest; + + @Mock + private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider; + + @Mock + private AAIVnfResources mockedAaiVnfResources; + + private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution(); + + @Before + public void setUp() { + objUnderTest = getEtsiVnfMonitorNodeJobTask(); + } + + @Test + public void testGetNodeStatus_genericVnfWithOrchStatusCreated_executionVariableSetToCreate() throws Exception { + final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = getGenericVnf(); + final GenericVnf aaiGenericVnf = getAAIGenericVnf(); + aaiGenericVnf.setOrchestrationStatus(VNF_CREATED); + + when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf); + when(mockedAaiVnfResources.getGenericVnf(eq(VNF_ID))).thenReturn(Optional.of(aaiGenericVnf)); + objUnderTest.getNodeStatus(stubbedxecution); + assertTrue(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS)); + } + + @Test + public void testGetNodeStatus_noGenericVnfFoundInAAI_throwException() throws Exception { + final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = getGenericVnf(); + + when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf); + when(mockedAaiVnfResources.getGenericVnf(eq(VNF_ID))).thenReturn(Optional.empty()); + objUnderTest.getNodeStatus(stubbedxecution); + verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1220), + any(Exception.class)); + assertNull(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS)); + + } + + @Test + public void testGetNodeStatusException() throws Exception { + when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenThrow(RuntimeException.class); + objUnderTest.getNodeStatus(stubbedxecution); + assertNull(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS)); + verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1220), + any(Exception.class)); + } + + @Test + public void testTimeOutLogFailue() throws Exception { + objUnderTest.timeOutLogFailue(stubbedxecution); + verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1221), + eq("Node operation time out")); + } + + private GenericVnf getAAIGenericVnf() { + final GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId(VNF_ID); + genericVnf.setVnfName(VNF_NAME); + return genericVnf; + } + + private org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf getGenericVnf() { + final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = + new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf(); + genericVnf.setVnfId(VNF_ID); + return genericVnf; + + } + + private MonitorInstantiateVnfmNodeTask getEtsiVnfMonitorNodeJobTask() { + return new MonitorInstantiateVnfmNodeTask(extractPojosForBB, exceptionUtil, mockedAaiVnfResources); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeJobTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTaskTest.java index 6b84f6a918..04831733e1 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeJobTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTaskTest.java @@ -20,16 +20,15 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; -import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_NODE_STATUS; -import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.DELETE_VNF_NODE_STATUS; -import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_CREATED; -import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_ASSIGNED; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.DELETE_VNF_NODE_STATUS; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_ASSIGNED; +import java.util.Optional; import java.util.UUID; import org.junit.Before; import org.junit.Test; @@ -38,13 +37,14 @@ import org.onap.aai.domain.yang.GenericVnf; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.client.orchestration.AAIVnfResources; /** * - * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech) + * @author Waqas Ikram (waqas.ikram@est.tech) * */ -public class MonitorVnfmNodeJobTest extends BaseTaskTest { +public class MonitorTerminateVnfmNodeTaskTest extends BaseTaskTest { private static final String VNF_ID = UUID.randomUUID().toString(); @@ -55,6 +55,9 @@ public class MonitorVnfmNodeJobTest extends BaseTaskTest { @Mock private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider; + @Mock + private AAIVnfResources mockedAaiVnfResources; + private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution(); @Before @@ -63,49 +66,48 @@ public class MonitorVnfmNodeJobTest extends BaseTaskTest { } @Test - public void testGetNodeStatusCreate() throws Exception { - GenericVnf vnf = getGenericVnf(); - vnf.setOrchestrationStatus(VNF_CREATED); - when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf); - objUnderTest.getNodeStatus(stubbedxecution); - assertTrue(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS)); - } - - @Test public void testGetNodeStatusDelete() throws Exception { - GenericVnf vnf = getGenericVnf(); - vnf.setOrchestrationStatus(VNF_ASSIGNED); + final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = getGenericVnf(); + final GenericVnf aaiGenericVnf = getAAIGenericVnf(); + aaiGenericVnf.setOrchestrationStatus(VNF_ASSIGNED); + when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf); + when(mockedAaiVnfResources.getGenericVnf(eq(VNF_ID))).thenReturn(Optional.of(aaiGenericVnf)); + objUnderTest.getNodeStatus(stubbedxecution); assertTrue(stubbedxecution.getVariable(DELETE_VNF_NODE_STATUS)); } @Test - public void testGetNodeStatusException() throws Exception { - when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenThrow(RuntimeException.class); + public void testGetNodeStatus_noGenericVnfFoundInAAI_throwException() throws Exception { + final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = getGenericVnf(); + + when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf); + when(mockedAaiVnfResources.getGenericVnf(eq(VNF_ID))).thenReturn(Optional.empty()); objUnderTest.getNodeStatus(stubbedxecution); - assertNull(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS)); - assertNull(stubbedxecution.getVariable(DELETE_VNF_NODE_STATUS)); verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1220), any(Exception.class)); - } + assertNull(stubbedxecution.getVariable(DELETE_VNF_NODE_STATUS)); - @Test - public void testTimeOutLogFailue() throws Exception { - objUnderTest.timeOutLogFailue(stubbedxecution); - verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1221), - eq("Node operation time out")); } - private GenericVnf getGenericVnf() { + private GenericVnf getAAIGenericVnf() { final GenericVnf genericVnf = new GenericVnf(); genericVnf.setVnfId(VNF_ID); genericVnf.setVnfName(VNF_NAME); return genericVnf; } - private MonitorVnfmNodeTask getEtsiVnfMonitorNodeJobTask() { - return new MonitorVnfmNodeTask(extractPojosForBB, exceptionUtil); + private org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf getGenericVnf() { + final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = + new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf(); + genericVnf.setVnfId(VNF_ID); + return genericVnf; + + } + + private MonitorTerminateVnfmNodeTask getEtsiVnfMonitorNodeJobTask() { + return new MonitorTerminateVnfmNodeTask(extractPojosForBB, exceptionUtil, mockedAaiVnfResources); } } |