summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn103
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfDeleteBB.bpmn36
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteJob.bpmn160
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java59
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java101
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmJobTask.java104
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTaskTest.java173
8 files changed, 629 insertions, 108 deletions
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn
index c841da3e3a..289ab6e155 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn
@@ -10,7 +10,8 @@
</bpmn:endEvent>
<bpmn:serviceTask id="ActivateVfModule" name="&#10;SDNC&#10;Activate&#10;(vf module)&#10;" camunda:expression="${SDNCActivateTasks.activateVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_07ybdik</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_0ee42yq</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_109oxx2</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0arwo1o</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1a495wm</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="UpdateVfModuleActiveStatus" name="&#10;AAI&#10;Update&#10;(vf module)&#10;" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActivateVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
@@ -39,14 +40,6 @@
<bpmn:incoming>SequenceFlow_0xndboi</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0ee42yq</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:boundaryEvent id="BoundaryEvent_1nb1hw4" attachedToRef="Audit_AAI_Inventory">
- <bpmn:outgoing>SequenceFlow_1t99ceh</bpmn:outgoing>
- <bpmn:errorEventDefinition />
- </bpmn:boundaryEvent>
- <bpmn:sequenceFlow id="SequenceFlow_1t99ceh" sourceRef="BoundaryEvent_1nb1hw4" targetRef="Task_0swpw3v" />
- <bpmn:serviceTask id="Task_0swpw3v" name="Throw Exception" camunda:expression="${ExceptionBuilder.buildAndThrowWorkflowException(execution, &#34;AuditAAIInventoryFailure&#34;, &#34;Error Auditing Cloud Inventory in A&#38;AI&#34;)}" camunda:resultVariable="ExceptionBuilder">
- <bpmn:incoming>SequenceFlow_1t99ceh</bpmn:incoming>
- </bpmn:serviceTask>
<bpmn:exclusiveGateway id="ExclusiveGateway_1v8bmbu" default="SequenceFlow_07ybdik">
<bpmn:incoming>SequenceFlow_1xqyur9</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_07ybdik</bpmn:outgoing>
@@ -56,12 +49,26 @@
<bpmn:sequenceFlow id="SequenceFlow_0ghzwlo" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="Setup_AAI_Inventory_Audit">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditInventoryNeeded") == true}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
- <bpmn:sequenceFlow id="SequenceFlow_0ee42yq" sourceRef="Audit_AAI_Inventory" targetRef="ActivateVfModule" />
+ <bpmn:sequenceFlow id="SequenceFlow_0ee42yq" sourceRef="Audit_AAI_Inventory" targetRef="ExclusiveGateway_1h8avxn" />
<bpmn:serviceTask id="CheckAuditVariable" name="Check Audit Variable" camunda:expression="${AuditTasks.isAuditNeeded(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_0ieafii</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1xqyur9</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_1xqyur9" sourceRef="CheckAuditVariable" targetRef="ExclusiveGateway_1v8bmbu" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1h8avxn" default="SequenceFlow_1bo83qk">
+ <bpmn:incoming>SequenceFlow_0ee42yq</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_109oxx2</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1bo83qk</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_109oxx2" sourceRef="ExclusiveGateway_1h8avxn" targetRef="ActivateVfModule">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditIsSuccessful")== true }]]></bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1bo83qk" name="If Audit Fails" sourceRef="ExclusiveGateway_1h8avxn" targetRef="Create_AAI_Inventory" />
+ <bpmn:sequenceFlow id="SequenceFlow_0arwo1o" sourceRef="Create_AAI_Inventory" targetRef="ActivateVfModule" />
+ <bpmn:serviceTask id="Create_AAI_Inventory" name="Create A&#38;AI Inventory" camunda:type="external" camunda:topic="InventoryCreate">
+ <bpmn:incoming>SequenceFlow_1bo83qk</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0arwo1o</bpmn:outgoing>
+ </bpmn:serviceTask>
</bpmn:process>
<bpmn:error id="Error_0q258vt" errorCode="7000" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
@@ -86,7 +93,7 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0hawa84_di" bpmnElement="ActivateVfModule">
- <dc:Bounds x="539" y="80" width="100" height="80" />
+ <dc:Bounds x="647" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_175e9ul_di" bpmnElement="UpdateVfModuleActiveStatus">
<dc:Bounds x="952" y="80" width="100" height="80" />
@@ -102,10 +109,10 @@
<dc:Bounds x="794" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1a495wm_di" bpmnElement="SequenceFlow_1a495wm">
- <di:waypoint xsi:type="dc:Point" x="639" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="747" y="120" />
<di:waypoint xsi:type="dc:Point" x="794" y="120" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="671.5" y="99" width="90" height="12" />
+ <dc:Bounds x="725.5" y="99" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1j4x1ej_di" bpmnElement="SequenceFlow_1j4x1ej">
@@ -117,36 +124,16 @@
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0xndboi_di" bpmnElement="SequenceFlow_0xndboi">
<di:waypoint xsi:type="dc:Point" x="365" y="256" />
- <di:waypoint xsi:type="dc:Point" x="452" y="256" />
- <di:waypoint xsi:type="dc:Point" x="452" y="256" />
- <di:waypoint xsi:type="dc:Point" x="539" y="256" />
+ <di:waypoint xsi:type="dc:Point" x="408" y="256" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="422" y="249.5" width="90" height="13" />
+ <dc:Bounds x="341.5" y="234.5" width="90" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0krf1ur_di" bpmnElement="Setup_AAI_Inventory_Audit">
<dc:Bounds x="265" y="216" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_08rxjeb_di" bpmnElement="Audit_AAI_Inventory">
- <dc:Bounds x="539" y="216" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="BoundaryEvent_0s7rszu_di" bpmnElement="BoundaryEvent_1nb1hw4">
- <dc:Bounds x="575" y="278" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="548" y="317" width="90" height="13" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1t99ceh_di" bpmnElement="SequenceFlow_1t99ceh">
- <di:waypoint xsi:type="dc:Point" x="593" y="314" />
- <di:waypoint xsi:type="dc:Point" x="593" y="348" />
- <di:waypoint xsi:type="dc:Point" x="593" y="348" />
- <di:waypoint xsi:type="dc:Point" x="593" y="371" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="563" y="341.5" width="90" height="13" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_0eujimg_di" bpmnElement="Task_0swpw3v">
- <dc:Bounds x="543" y="371" width="100" height="80" />
+ <dc:Bounds x="408" y="216" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_1v8bmbu_di" bpmnElement="ExclusiveGateway_1v8bmbu" isMarkerVisible="true">
<dc:Bounds x="290" y="95" width="50" height="50" />
@@ -156,9 +143,9 @@
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_07ybdik_di" bpmnElement="SequenceFlow_07ybdik">
<di:waypoint xsi:type="dc:Point" x="340" y="120" />
- <di:waypoint xsi:type="dc:Point" x="539" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="647" y="120" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="439.5" y="98.5" width="0" height="13" />
+ <dc:Bounds x="448.5" y="98.5" width="90" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0ghzwlo_di" bpmnElement="SequenceFlow_0ghzwlo">
@@ -169,12 +156,10 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0ee42yq_di" bpmnElement="SequenceFlow_0ee42yq">
- <di:waypoint xsi:type="dc:Point" x="589" y="216" />
- <di:waypoint xsi:type="dc:Point" x="589" y="193" />
- <di:waypoint xsi:type="dc:Point" x="589" y="193" />
- <di:waypoint xsi:type="dc:Point" x="589" y="160" />
+ <di:waypoint xsi:type="dc:Point" x="508" y="256" />
+ <di:waypoint xsi:type="dc:Point" x="566" y="256" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="604" y="186.5" width="0" height="13" />
+ <dc:Bounds x="492" y="234.5" width="90" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1eg5ryx_di" bpmnElement="CheckAuditVariable">
@@ -187,6 +172,38 @@
<dc:Bounds x="275.5" y="98.5" width="0" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1h8avxn_di" bpmnElement="ExclusiveGateway_1h8avxn" isMarkerVisible="true">
+ <dc:Bounds x="566" y="231" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="591" y="284" width="0" height="13" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_109oxx2_di" bpmnElement="SequenceFlow_109oxx2">
+ <di:waypoint xsi:type="dc:Point" x="616" y="256" />
+ <di:waypoint xsi:type="dc:Point" x="670" y="256" />
+ <di:waypoint xsi:type="dc:Point" x="670" y="160" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="643" y="234.5" width="0" height="13" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1bo83qk_di" bpmnElement="SequenceFlow_1bo83qk">
+ <di:waypoint xsi:type="dc:Point" x="591" y="281" />
+ <di:waypoint xsi:type="dc:Point" x="591" y="345" />
+ <di:waypoint xsi:type="dc:Point" x="656" y="345" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="560" y="358" width="61" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0arwo1o_di" bpmnElement="SequenceFlow_0arwo1o">
+ <di:waypoint xsi:type="dc:Point" x="706" y="305" />
+ <di:waypoint xsi:type="dc:Point" x="706" y="160" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="721" y="226" width="0" height="13" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_1eb09gr_di" bpmnElement="Create_AAI_Inventory">
+ <dc:Bounds x="656" y="305" 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/EtsiVnfDeleteBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfDeleteBB.bpmn
index 7f70cc5756..cfb376c961 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfDeleteBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfDeleteBB.bpmn
@@ -1,38 +1,56 @@
<?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_1as67q3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4">
- <bpmn:process id="vnfmFoundCheck" name="vnfmFoundCheck" isExecutable="true">
+ <bpmn:process id="EtsiVnfDeleteBB" name="&#10;EtsiVnfDeleteBB" isExecutable="true">
<bpmn:startEvent id="StartEvent_0i3wi1x">
<bpmn:outgoing>SequenceFlow_01pwrcr</bpmn:outgoing>
</bpmn:startEvent>
- <bpmn:serviceTask id="ServiceTask_1d5jbsa" name="&#10;Invoke VNFM Adaptor&#10;" camunda:asyncAfter="true" camunda:expression="${EtsiVnfDeleteTask.invokeVnfmAdapter(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:serviceTask id="ServiceTask_1d5jbsb" name="&#10;Invoke VNFM Adaptor&#10;" camunda:asyncAfter="true" camunda:expression="${EtsiVnfDeleteTask.invokeVnfmAdapter(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_01pwrcr</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1064iul</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:endEvent id="EndEvent_1khf4qw">
- <bpmn:incoming>SequenceFlow_1064iul</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0qt5cvg</bpmn:incoming>
</bpmn:endEvent>
- <bpmn:sequenceFlow id="SequenceFlow_1064iul" sourceRef="ServiceTask_1d5jbsa" targetRef="EndEvent_1khf4qw" />
- <bpmn:sequenceFlow id="SequenceFlow_01pwrcr" sourceRef="StartEvent_0i3wi1x" targetRef="ServiceTask_1d5jbsa" />
+ <bpmn:sequenceFlow id="SequenceFlow_1064iul" sourceRef="ServiceTask_1d5jbsb" targetRef="CallActivity_1f7uwws" />
+ <bpmn:sequenceFlow id="SequenceFlow_01pwrcr" sourceRef="StartEvent_0i3wi1x" targetRef="ServiceTask_1d5jbsb" />
+ <bpmn:callActivity id="CallActivity_1f7uwws" name="Monitor Delete Job" calledElement="MonitorVnfmDeleteJob">
+ <bpmn:extensionElements>
+ <camunda:in source="SDNCRequest" target="SDNCRequest" />
+ <camunda:out source="SDNCResponse" target="SDNCResponse" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1064iul</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0qt5cvg</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_0qt5cvg" sourceRef="CallActivity_1f7uwws" targetRef="EndEvent_1khf4qw" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="vnfmFoundCheck">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="EtsiVnfDeleteBB">
<bpmndi:BPMNShape id="StartEvent_0i3wi1x_di" bpmnElement="StartEvent_0i3wi1x">
<dc:Bounds x="325" y="183" width="36" height="36" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ServiceTask_1d5jbsa_di" bpmnElement="ServiceTask_1d5jbsa">
+ <bpmndi:BPMNShape id="ServiceTask_1d5jbsa_di" bpmnElement="ServiceTask_1d5jbsb">
<dc:Bounds x="503" y="161" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1khf4qw_di" bpmnElement="EndEvent_1khf4qw">
- <dc:Bounds x="742" y="183" width="36" height="36" />
+ <dc:Bounds x="820" y="183" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1064iul_di" bpmnElement="SequenceFlow_1064iul">
<di:waypoint x="603" y="201" />
- <di:waypoint x="742" y="201" />
+ <di:waypoint x="659" y="201" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_01pwrcr_di" bpmnElement="SequenceFlow_01pwrcr">
<di:waypoint x="361" y="201" />
<di:waypoint x="503" y="201" />
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_1f7uwws_di" bpmnElement="CallActivity_1f7uwws">
+ <dc:Bounds x="659" y="161" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0qt5cvg_di" bpmnElement="SequenceFlow_0qt5cvg">
+ <di:waypoint x="759" y="201" />
+ <di:waypoint x="820" y="201" />
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteJob.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteJob.bpmn
new file mode 100644
index 0000000000..acd55e4fc2
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteJob.bpmn
@@ -0,0 +1,160 @@
+<?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_12gnsyw" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4">
+ <bpmn:process id="MonitorVnfmDeleteJob" name="MonitorVnfmDeleteJob" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>SequenceFlow_1x3tbl0</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_0rf1gde">
+ <bpmn:incoming>SequenceFlow_1543qy7</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:subProcess id="SubProcess_19j0v63">
+ <bpmn:incoming>SequenceFlow_1x3tbl0</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1v4yr3f</bpmn:outgoing>
+ <bpmn:startEvent id="StartEvent_01r97z2">
+ <bpmn:outgoing>SequenceFlow_0s1plu9</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1hkl6yy" default="SequenceFlow_1vmxw9g">
+ <bpmn:incoming>SequenceFlow_153a3kp</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1vmxw9g</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0is7myf</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_1besn3n" name="Wait between checks" camunda:asyncAfter="true">
+ <bpmn:incoming>SequenceFlow_1vmxw9g</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0etw572</bpmn:outgoing>
+ <bpmn:timerEventDefinition id="TimerEventDefinition_0qgh11t">
+ <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT15S</bpmn:timeDuration>
+ </bpmn:timerEventDefinition>
+ </bpmn:intermediateCatchEvent>
+ <bpmn:endEvent id="EndEvent_1ohsce9">
+ <bpmn:incoming>SequenceFlow_0is7myf</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0s1plu9" sourceRef="StartEvent_01r97z2" targetRef="ServiceTask_17jlnng" />
+ <bpmn:sequenceFlow id="SequenceFlow_0etw572" sourceRef="IntermediateCatchEvent_1besn3n" targetRef="ServiceTask_17jlnng" />
+ <bpmn:serviceTask id="ServiceTask_17jlnng" name="&#10;Get Current Operation Status&#10;" camunda:asyncAfter="true" camunda:expression="${MonitorVnfmDeleteJobTask.getCurrentOperationStatus(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0etw572</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0s1plu9</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_153a3kp</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1vmxw9g" sourceRef="ExclusiveGateway_1hkl6yy" targetRef="IntermediateCatchEvent_1besn3n" />
+ <bpmn:sequenceFlow id="SequenceFlow_0is7myf" sourceRef="ExclusiveGateway_1hkl6yy" targetRef="EndEvent_1ohsce9">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${MonitorVnfmCreateJobTask.hasOperationFinished(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_153a3kp" sourceRef="ServiceTask_17jlnng" targetRef="ExclusiveGateway_1hkl6yy" />
+ </bpmn:subProcess>
+ <bpmn:endEvent id="EndEvent_1w3t3t0" name="Timeout Exception">
+ <bpmn:incoming>SequenceFlow_0bcgtzj</bpmn:incoming>
+ <bpmn:terminateEventDefinition id="TerminateEventDefinition_0fjecl3" />
+ </bpmn:endEvent>
+ <bpmn:boundaryEvent id="BoundaryEvent_0xiabzp" name="Overall Wait" attachedToRef="SubProcess_19j0v63">
+ <bpmn:outgoing>SequenceFlow_1i1o9sh</bpmn:outgoing>
+ <bpmn:timerEventDefinition id="TimerEventDefinition_10kqw61">
+ <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT3H</bpmn:timeDuration>
+ </bpmn:timerEventDefinition>
+ </bpmn:boundaryEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1v4yr3f" sourceRef="SubProcess_19j0v63" targetRef="ServiceTask_1gms129" />
+ <bpmn:sequenceFlow id="SequenceFlow_1i1o9sh" sourceRef="BoundaryEvent_0xiabzp" targetRef="ServiceTask_1s87b92" />
+ <bpmn:sequenceFlow id="SequenceFlow_1x3tbl0" sourceRef="StartEvent_1" targetRef="SubProcess_19j0v63" />
+ <bpmn:serviceTask id="ServiceTask_1s87b92" name="&#10;Time Out Log Failure&#10;" camunda:asyncAfter="true" camunda:expression="${MonitorVnfmDeleteJobTask.timeOutLogFailue(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_1i1o9sh</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0bcgtzj</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0bcgtzj" sourceRef="ServiceTask_1s87b92" targetRef="EndEvent_1w3t3t0" />
+ <bpmn:serviceTask id="ServiceTask_1gms129" name="&#10;Check if operation was successful&#10;" camunda:asyncAfter="true" camunda:expression="${MonitorVnfmDeleteJobTask.checkIfOperationWasSuccessful(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_1v4yr3f</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1543qy7</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1543qy7" sourceRef="ServiceTask_1gms129" targetRef="EndEvent_0rf1gde" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="MonitorVnfmDeleteJob">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="211" y="430" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0rf1gde_di" bpmnElement="EndEvent_0rf1gde">
+ <dc:Bounds x="1152" y="200" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_19j0v63_di" bpmnElement="SubProcess_19j0v63" isExpanded="true">
+ <dc:Bounds x="351" y="348" width="523" height="200" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1w3t3t0_di" bpmnElement="EndEvent_1w3t3t0">
+ <dc:Bounds x="1152" y="422" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1145" y="382" width="49" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="BoundaryEvent_0xiabzp_di" bpmnElement="BoundaryEvent_0xiabzp">
+ <dc:Bounds x="856" y="422" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="844" y="461" width="60" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1v4yr3f_di" bpmnElement="SequenceFlow_1v4yr3f">
+ <di:waypoint x="613" y="348" />
+ <di:waypoint x="613" y="218" />
+ <di:waypoint x="973" y="218" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1i1o9sh_di" bpmnElement="SequenceFlow_1i1o9sh">
+ <di:waypoint x="892" y="440" />
+ <di:waypoint x="973" y="440" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_01r97z2_di" bpmnElement="StartEvent_01r97z2">
+ <dc:Bounds x="380" y="406" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1hkl6yy_di" bpmnElement="ExclusiveGateway_1hkl6yy" isMarkerVisible="true">
+ <dc:Bounds x="659" y="399" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="IntermediateCatchEvent_1besn3n_di" bpmnElement="IntermediateCatchEvent_1besn3n">
+ <dc:Bounds x="600" y="478" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="587" y="521" width="66" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1ohsce9_di" bpmnElement="EndEvent_1ohsce9">
+ <dc:Bounds x="772" y="406" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1x3tbl0_di" bpmnElement="SequenceFlow_1x3tbl0">
+ <di:waypoint x="247" y="448" />
+ <di:waypoint x="351" y="448" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_17jlnng_di" bpmnElement="ServiceTask_17jlnng">
+ <dc:Bounds x="475" y="384" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0s1plu9_di" bpmnElement="SequenceFlow_0s1plu9">
+ <di:waypoint x="416" y="424" />
+ <di:waypoint x="475" y="424" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0etw572_di" bpmnElement="SequenceFlow_0etw572">
+ <di:waypoint x="600" y="496" />
+ <di:waypoint x="536" y="496" />
+ <di:waypoint x="536" y="467" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1vmxw9g_di" bpmnElement="SequenceFlow_1vmxw9g">
+ <di:waypoint x="684" y="449" />
+ <di:waypoint x="684" y="496" />
+ <di:waypoint x="636" y="496" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0is7myf_di" bpmnElement="SequenceFlow_0is7myf">
+ <di:waypoint x="709" y="424" />
+ <di:waypoint x="772" y="424" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_153a3kp_di" bpmnElement="SequenceFlow_153a3kp">
+ <di:waypoint x="575" y="424" />
+ <di:waypoint x="659" y="424" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_1s87b92_di" bpmnElement="ServiceTask_1s87b92">
+ <dc:Bounds x="973" y="400" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0bcgtzj_di" bpmnElement="SequenceFlow_0bcgtzj">
+ <di:waypoint x="1073" y="440" />
+ <di:waypoint x="1152" y="440" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_1gms128_di" bpmnElement="ServiceTask_1gms129">
+ <dc:Bounds x="973" y="178" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1543qy7_di" bpmnElement="SequenceFlow_1543qy7">
+ <di:waypoint x="1073" y="218" />
+ <di:waypoint x="1152" y="218" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java
index 2dae1173d6..deac50ca30 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java
@@ -40,6 +40,7 @@ public class ActivateVfModuleBBTest extends BaseBPMNTest{
public void before() {
variables.put("vfModuleActivateTimerDuration", "PT2S");
variables.put("auditInventoryNeeded", "true");
+ variables.put("auditIsSuccessful", "true");
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
index f89931063c..59ff71ab0c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
@@ -20,14 +20,11 @@
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_RESPONSE_PARAM_NAME;
-import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.OPERATION_FINISHED_STATES;
-import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.OPERATION_RETRIEVAL_STATES;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.OPERATION_STATUS_PARAM_NAME;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
import org.onap.vnfmadapter.v1.model.OperationStateEnum;
-import org.onap.vnfmadapter.v1.model.QueryJobResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -40,17 +37,14 @@ import com.google.common.base.Optional;
*
*/
@Component
-public class MonitorVnfmCreateJobTask {
+public class MonitorVnfmCreateJobTask extends MonitorVnfmJobTask{
private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmCreateJobTask.class);
- private final ExceptionBuilder exceptionUtil;
- private final VnfmAdapterServiceProvider vnfmAdapterServiceProvider;
@Autowired
public MonitorVnfmCreateJobTask(final VnfmAdapterServiceProvider vnfmAdapterServiceProvider,
final ExceptionBuilder exceptionUtil) {
- this.vnfmAdapterServiceProvider = vnfmAdapterServiceProvider;
- this.exceptionUtil = exceptionUtil;
+ super(vnfmAdapterServiceProvider, exceptionUtil);
}
/**
@@ -61,28 +55,11 @@ public class MonitorVnfmCreateJobTask {
public void getCurrentOperationStatus(final BuildingBlockExecution execution) {
LOGGER.debug("Executing getCurrentOperationStatus ...");
final CreateVnfResponse vnfInstantiateResponse = execution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME);
- execution.setVariable(OPERATION_STATUS_PARAM_NAME, getOperationStatus(execution, vnfInstantiateResponse));
+ execution.setVariable(OPERATION_STATUS_PARAM_NAME, getOperationStatus(execution, vnfInstantiateResponse.getJobId()));
LOGGER.debug("Finished executing getCurrentOperationStatus ...");
}
/**
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- * @return boolean to indicate whether job has competed or not
- */
- public boolean hasOperationFinished(final BuildingBlockExecution execution) {
- LOGGER.debug("Executing hasOperationFinished ...");
-
- final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
- if (operationStatusOption != null && operationStatusOption.isPresent()) {
- return OPERATION_FINISHED_STATES.contains(operationStatusOption.get());
- }
- LOGGER.debug("OperationStatus is not present yet... ");
- LOGGER.debug("Finished executing hasOperationFinished ...");
- return false;
-
- }
-
- /**
* Log and throw exception on timeout for job status
*
* @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
@@ -121,34 +98,4 @@ public class MonitorVnfmCreateJobTask {
LOGGER.debug("Successfully completed instatiation of job {}", vnfInstantiateResponse);
}
}
-
- private Optional<OperationStateEnum> getOperationStatus(final BuildingBlockExecution execution,
- final CreateVnfResponse vnfInstantiateResponse) {
-
- final Optional<QueryJobResponse> instantiateOperationJobStatus =
- vnfmAdapterServiceProvider.getInstantiateOperationJobStatus(vnfInstantiateResponse.getJobId());
-
- if (instantiateOperationJobStatus.isPresent()) {
- final QueryJobResponse queryJobResponse = instantiateOperationJobStatus.get();
-
- if (!OPERATION_RETRIEVAL_STATES.contains(queryJobResponse.getOperationStatusRetrievalStatus())) {
- final String message =
- "Recevied invalid operation reterivel state: " + queryJobResponse.getOperationStatusRetrievalStatus();
- LOGGER.error(message);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1203, message);
- }
-
- if (queryJobResponse.getOperationState() != null) {
- final OperationStateEnum operationStatus = queryJobResponse.getOperationState();
- LOGGER.debug("Operation {} with {} and operation retrieval status : {}", queryJobResponse.getId(),
- operationStatus, queryJobResponse.getOperationStatusRetrievalStatus());
- return Optional.of(queryJobResponse.getOperationState());
- }
-
- LOGGER.debug("Operation {} without operationStatus and operation retrieval status :{}", queryJobResponse.getId(),
- queryJobResponse.getOperationStatusRetrievalStatus());
-
- }
- return Optional.absent();
- }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java
new file mode 100644
index 0000000000..c4804c05c2
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java
@@ -0,0 +1,101 @@
+/*-
+ * ============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_RESPONSE_PARAM_NAME;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.OPERATION_STATUS_PARAM_NAME;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.vnfmadapter.v1.model.DeleteVnfResponse;
+import org.onap.vnfmadapter.v1.model.OperationStateEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import com.google.common.base.Optional;
+
+
+/**
+ *
+ * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech)
+ *
+ */
+@Component
+public class MonitorVnfmDeleteJobTask extends MonitorVnfmJobTask {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmDeleteJobTask.class);
+
+ @Autowired
+ public MonitorVnfmDeleteJobTask(final VnfmAdapterServiceProvider vnfmAdapterServiceProvider,
+ final ExceptionBuilder exceptionUtil) {
+ super(vnfmAdapterServiceProvider, exceptionUtil);
+ }
+
+ /**
+ * Get the current operation status of Delete job
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void getCurrentOperationStatus(final BuildingBlockExecution execution) {
+ LOGGER.debug("Executing getCurrentOperationStatus ...");
+ final DeleteVnfResponse deleteVnfResponse = execution.getVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME);
+ execution.setVariable(OPERATION_STATUS_PARAM_NAME, getOperationStatus(execution, deleteVnfResponse.getJobId()));
+ LOGGER.debug("Finished executing getCurrentOperationStatus ...");
+ }
+
+ /**
+ * Log and throw exception on timeout for job status
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void timeOutLogFailue(final BuildingBlockExecution execution) {
+ final String message = "Delete operation time out";
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1213, message);
+ }
+
+ /**
+ * Check the final status of delete throw exception if not completed successfully
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void checkIfOperationWasSuccessful(final BuildingBlockExecution execution) {
+ LOGGER.debug("Executing checkIfOperationWasSuccessful ...");
+ final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
+ final DeleteVnfResponse deleteVnfResponse = execution.getVariable(DELETE_VNF_RESPONSE_PARAM_NAME);
+ if (operationStatusOption == null || !operationStatusOption.isPresent()) {
+ final String message = "Unable to delete jobId: "
+ + (deleteVnfResponse != null ? deleteVnfResponse.getJobId() : "null") + "Unable to retrieve OperationStatus";
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1214, message);
+ }
+ if (operationStatusOption.isPresent()) {
+ final OperationStateEnum operationStatus = operationStatusOption.get();
+ if (operationStatus != OperationStateEnum.COMPLETED) {
+ final String message =
+ "Unable to Delete jobId: " + (deleteVnfResponse != null ? deleteVnfResponse.getJobId() : "null")
+ + " OperationStatus: " + operationStatus;
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1215, message);
+ }
+ LOGGER.debug("Successfully completed Deletion of job {}", deleteVnfResponse);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmJobTask.java
new file mode 100644
index 0000000000..e3992428cb
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmJobTask.java
@@ -0,0 +1,104 @@
+/*-
+ * ============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.OPERATION_FINISHED_STATES;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.OPERATION_RETRIEVAL_STATES;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.OPERATION_STATUS_PARAM_NAME;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.vnfmadapter.v1.model.OperationStateEnum;
+import org.onap.vnfmadapter.v1.model.QueryJobResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import com.google.common.base.Optional;
+
+
+/**
+ *
+ * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech)
+ *
+ */
+@Component
+public class MonitorVnfmJobTask {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmJobTask.class);
+ protected final ExceptionBuilder exceptionUtil;
+ protected final VnfmAdapterServiceProvider vnfmAdapterServiceProvider;
+
+ @Autowired
+ public MonitorVnfmJobTask(final VnfmAdapterServiceProvider vnfmAdapterServiceProvider,
+ final ExceptionBuilder exceptionUtil) {
+ this.vnfmAdapterServiceProvider = vnfmAdapterServiceProvider;
+ this.exceptionUtil = exceptionUtil;
+ }
+
+ /**
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ * @return boolean to indicate whether job has competed or not
+ */
+ public boolean hasOperationFinished(final BuildingBlockExecution execution) {
+ LOGGER.debug("Executing hasOperationFinished ...");
+
+ final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
+ if (operationStatusOption != null && operationStatusOption.isPresent()) {
+ return OPERATION_FINISHED_STATES.contains(operationStatusOption.get());
+ }
+ LOGGER.debug("OperationStatus is not present yet... ");
+ LOGGER.debug("Finished executing hasOperationFinished ...");
+ return false;
+ }
+
+ /**
+ * This method calls the Vnfm adapter and gets the Operation status of the job
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ * @param jobId unique job id
+ * @return Operation State
+ */
+ protected Optional<OperationStateEnum> getOperationStatus(final BuildingBlockExecution execution,
+ final String jobId) {
+
+ final Optional<QueryJobResponse> instantiateOperationJobStatus =
+ vnfmAdapterServiceProvider.getInstantiateOperationJobStatus(jobId);
+
+ if (instantiateOperationJobStatus.isPresent()) {
+ final QueryJobResponse queryJobResponse = instantiateOperationJobStatus.get();
+
+ if (!OPERATION_RETRIEVAL_STATES.contains(queryJobResponse.getOperationStatusRetrievalStatus())) {
+ final String message =
+ "Recevied invalid operation reterivel state: " + queryJobResponse.getOperationStatusRetrievalStatus();
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1203, message);
+ }
+ if (queryJobResponse.getOperationState() != null) {
+ final OperationStateEnum operationStatus = queryJobResponse.getOperationState();
+ LOGGER.debug("Operation {} with {} and operation retrieval status : {}", queryJobResponse.getId(),
+ operationStatus, queryJobResponse.getOperationStatusRetrievalStatus());
+ return Optional.of(queryJobResponse.getOperationState());
+ }
+
+ LOGGER.debug("Operation {} without operationStatus and operation retrieval status :{}", queryJobResponse.getId(),
+ queryJobResponse.getOperationStatusRetrievalStatus());
+ }
+ return Optional.absent();
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTaskTest.java
new file mode 100644
index 0000000000..e41c571765
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTaskTest.java
@@ -0,0 +1,173 @@
+/*-
+ * ============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.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import java.util.UUID;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.vnfmadapter.v1.model.DeleteVnfResponse;
+import org.onap.vnfmadapter.v1.model.OperationStateEnum;
+import org.onap.vnfmadapter.v1.model.OperationStatusRetrievalStatusEnum;
+import org.onap.vnfmadapter.v1.model.QueryJobResponse;
+import com.google.common.base.Optional;
+
+/**
+ *
+ * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech)
+ *
+ */
+public class MonitorVnfmDeleteJobTaskTest extends BaseTaskTest {
+
+ private static final String JOB_ID = UUID.randomUUID().toString();
+
+ private MonitorVnfmDeleteJobTask objUnderTest;
+
+ @Mock
+ private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider;
+
+ private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
+
+ @Before
+ public void setUp() {
+ objUnderTest = getEtsiVnfMonitorJobTask();
+ stubbedxecution.setVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME, getDeleteVnfResponse());
+ }
+
+ @Test
+ public void testGetCurrentOperationStatus() throws Exception {
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
+ queryJobResponse.get().setOperationState(OperationStateEnum.COMPLETED);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertNotNull(operationState);
+ assertEquals(OperationStateEnum.COMPLETED, operationState.get());
+ }
+
+ @Test
+ public void testGetCurrentOperationStatusFailed() throws Exception {
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.CANNOT_RETRIEVE_STATUS);
+ queryJobResponse.get().setOperationState(OperationStateEnum.FAILED);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertNotNull(operationState);
+ assertEquals(OperationStateEnum.FAILED, operationState.get());
+ }
+
+ @Test
+ public void testGetCurrentOperationStatusEmpty() throws Exception {
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertFalse(operationState.isPresent());
+ }
+
+ @Test
+ public void testGetCurrentOperationStatusException() throws Exception {
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertFalse(operationState.isPresent());
+ }
+
+ @Test
+ public void testHasOperationFinished() throws Exception {
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.COMPLETED));
+ assertTrue(objUnderTest.hasOperationFinished(stubbedxecution));
+ }
+
+ @Test
+ public void testHasOperationPending() throws Exception {
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.absent());
+ assertFalse(objUnderTest.hasOperationFinished(stubbedxecution));
+ }
+
+ @Test
+ public void testTimeOutLogFailue() throws Exception {
+ objUnderTest.timeOutLogFailue(stubbedxecution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1213),
+ eq("Delete operation time out"));
+ }
+
+ @Test
+ public void testCheckIfOperationWasSuccessful() throws Exception {
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.COMPLETED));
+ MonitorVnfmDeleteJobTask spyObject = Mockito.spy(objUnderTest);
+ spyObject.checkIfOperationWasSuccessful(stubbedxecution);
+ verify(spyObject, times(1)).checkIfOperationWasSuccessful(stubbedxecution);
+ }
+
+ @Test
+ public void testCheckIfOperationWasSuccessfulWithPending() throws Exception {
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.PROCESSING));
+ objUnderTest.checkIfOperationWasSuccessful(stubbedxecution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1215), anyString());
+ }
+
+ @Test
+ public void testCheckIfOperationWasSuccessfulEmpty() throws Exception {
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.absent());
+ objUnderTest.checkIfOperationWasSuccessful(stubbedxecution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1214), anyString());
+ }
+
+ private DeleteVnfResponse getDeleteVnfResponse() {
+ final DeleteVnfResponse response = new DeleteVnfResponse();
+ response.setJobId(JOB_ID);
+ return response;
+ }
+
+ private Optional<QueryJobResponse> getQueryJobResponse() {
+ final QueryJobResponse queryJobResponse = new QueryJobResponse();
+ queryJobResponse.setId(JOB_ID);
+ return Optional.of(queryJobResponse);
+ }
+
+ private MonitorVnfmDeleteJobTask getEtsiVnfMonitorJobTask() {
+ return new MonitorVnfmDeleteJobTask(mockedVnfmAdapterServiceProvider, exceptionUtil);
+ }
+
+}