Added Node status monitoring 34/84334/1
authorLathish <lathishbabu.ganesan@est.tech>
Fri, 5 Apr 2019 12:21:52 +0000 (12:21 +0000)
committerLathish <lathishbabu.ganesan@est.tech>
Fri, 5 Apr 2019 12:21:52 +0000 (12:21 +0000)
Issue-ID: SO-1626
Change-Id: I0447549ca1024cd768b2bead2fe351895e314567
Signed-off-by: Lathish <lathishbabu.ganesan@est.tech>
bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfDeleteBB.bpmn
bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn
bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmCreateNodeStatus.bpmn [new file with mode: 0644]
bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteJob.bpmn
bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteNodeStatus.bpmn [new file with mode: 0644]
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java [new file with mode: 0644]
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeJobTest.java [new file with mode: 0644]

index cfb376c..2d24736 100644 (file)
@@ -9,21 +9,20 @@
       <bpmn:outgoing>SequenceFlow_1064iul</bpmn:outgoing>
     </bpmn:serviceTask>
     <bpmn:endEvent id="EndEvent_1khf4qw">
-      <bpmn:incoming>SequenceFlow_0qt5cvg</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_0503le2</bpmn:incoming>
     </bpmn:endEvent>
     <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:sequenceFlow id="SequenceFlow_0qt5cvg" sourceRef="CallActivity_1f7uwws" targetRef="CallActivity_0udkzom" />
+    <bpmn:callActivity id="CallActivity_0udkzom" name="Monitor Delete Node Status" calledElement="MonitorVnfmDeleteNodeStatus">
+      <bpmn:incoming>SequenceFlow_0qt5cvg</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0503le2</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_0503le2" sourceRef="CallActivity_0udkzom" targetRef="EndEvent_1khf4qw" />
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="EtsiVnfDeleteBB">
@@ -34,7 +33,7 @@
         <dc:Bounds x="503" y="161" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_1khf4qw_di" bpmnElement="EndEvent_1khf4qw">
-        <dc:Bounds x="820" y="183" width="36" height="36" />
+        <dc:Bounds x="1001" y="183" width="36" height="36" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1064iul_di" bpmnElement="SequenceFlow_1064iul">
         <di:waypoint x="603" y="201" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0qt5cvg_di" bpmnElement="SequenceFlow_0qt5cvg">
         <di:waypoint x="759" y="201" />
-        <di:waypoint x="820" y="201" />
+        <di:waypoint x="812" y="201" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="CallActivity_0udkzom_di" bpmnElement="CallActivity_0udkzom">
+        <dc:Bounds x="812" y="161" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0503le2_di" bpmnElement="SequenceFlow_0503le2">
+        <di:waypoint x="912" y="201" />
+        <di:waypoint x="1001" y="201" />
       </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
index b248ea1..13bd107 100644 (file)
@@ -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" id="Definitions_0x13ohc" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.3">
+<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" id="Definitions_0x13ohc" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4">
   <bpmn:process id="EtsiVnfInstantiateBB" name="&#10;EtsiVnfInstantiateBB" isExecutable="true">
     <bpmn:serviceTask id="ServiceTask_02e82t2" name="Create &#10;CreateVnfRequest&#10;" camunda:expression="${VnfmAdapterCreateVnfTask.buildCreateVnfRequest(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
       <bpmn:incoming>SequenceFlow_18fsqzd</bpmn:incoming>
@@ -10,7 +10,7 @@
     </bpmn:startEvent>
     <bpmn:sequenceFlow id="SequenceFlow_016sgof" sourceRef="StartEvent_0ru3x55" targetRef="ServiceTask_1jf7hlc" />
     <bpmn:endEvent id="EndEvent_001k15i">
-      <bpmn:incoming>SequenceFlow_1owx4yu</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_0n57z81</bpmn:incoming>
     </bpmn:endEvent>
     <bpmn:sequenceFlow id="SequenceFlow_0f0vsnv" sourceRef="ServiceTask_02e82t2" targetRef="ServiceTask_06ao4xu" />
     <bpmn:serviceTask id="ServiceTask_06ao4xu" name="&#10;Invoke VNFM Adaptor&#10;" camunda:asyncAfter="true" camunda:expression="${VnfmAdapterCreateVnfTask.invokeVnfmAdapter(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
       <bpmn:incoming>SequenceFlow_0hp0ka1</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1owx4yu</bpmn:outgoing>
     </bpmn:callActivity>
-    <bpmn:sequenceFlow id="SequenceFlow_1owx4yu" sourceRef="CallActivity_0fuqfru" targetRef="EndEvent_001k15i" />
+    <bpmn:sequenceFlow id="SequenceFlow_1owx4yu" sourceRef="CallActivity_0fuqfru" targetRef="CallActivity_0agszsb" />
+    <bpmn:callActivity id="CallActivity_0agszsb" name="Monitor Create Node Status" calledElement="MonitorVnfmCreateNodeStatus">
+      <bpmn:incoming>SequenceFlow_1owx4yu</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0n57z81</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_0n57z81" sourceRef="CallActivity_0agszsb" targetRef="EndEvent_001k15i" />
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="EtsiVnfInstantiateBB">
@@ -48,7 +53,7 @@
         <di:waypoint x="332" y="267" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="EndEvent_001k15i_di" bpmnElement="EndEvent_001k15i">
-        <dc:Bounds x="913" y="249" width="36" height="36" />
+        <dc:Bounds x="1097" y="249" width="36" height="36" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0f0vsnv_di" bpmnElement="SequenceFlow_0f0vsnv">
         <di:waypoint x="580" y="267" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1owx4yu_di" bpmnElement="SequenceFlow_1owx4yu">
         <di:waypoint x="870" y="267" />
-        <di:waypoint x="913" y="267" />
+        <di:waypoint x="928" y="267" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="CallActivity_0agszsb_di" bpmnElement="CallActivity_0agszsb">
+        <dc:Bounds x="928" y="227" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0n57z81_di" bpmnElement="SequenceFlow_0n57z81">
+        <di:waypoint x="1028" y="267" />
+        <di:waypoint x="1097" y="267" />
       </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
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
new file mode 100644 (file)
index 0000000..6d54262
--- /dev/null
@@ -0,0 +1,138 @@
+<?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_1ko0frn" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4">
+  <bpmn:process id="Process_1" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_0k0qfjb">
+      <bpmn:outgoing>SequenceFlow_1miob62</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:subProcess id="SubProcess_10wotbc">
+      <bpmn:incoming>SequenceFlow_1miob62</bpmn:incoming>
+      <bpmn:startEvent id="StartEvent_0r9qf43">
+        <bpmn:outgoing>SequenceFlow_1moaz0q</bpmn:outgoing>
+      </bpmn:startEvent>
+      <bpmn:exclusiveGateway id="ExclusiveGateway_00xtlfj" default="SequenceFlow_1luu31f">
+        <bpmn:incoming>SequenceFlow_0qvy3sn</bpmn:incoming>
+        <bpmn:outgoing>SequenceFlow_1rxbeqi</bpmn:outgoing>
+        <bpmn:outgoing>SequenceFlow_1luu31f</bpmn:outgoing>
+      </bpmn:exclusiveGateway>
+      <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0xuznv9" name="Wait between checks" camunda:asyncAfter="true">
+        <bpmn:incoming>SequenceFlow_1luu31f</bpmn:incoming>
+        <bpmn:outgoing>SequenceFlow_09t51ao</bpmn:outgoing>
+        <bpmn:timerEventDefinition id="TimerEventDefinition_0vrbrge">
+          <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT15S</bpmn:timeDuration>
+        </bpmn:timerEventDefinition>
+      </bpmn:intermediateCatchEvent>
+      <bpmn:endEvent id="EndEvent_0tei3i9">
+        <bpmn:incoming>SequenceFlow_1rxbeqi</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:serviceTask id="ServiceTask_0y71su8" name="&#10;Get node status &#10;" camunda:asyncAfter="true" camunda:expression="${MonitorVnfmNodeTask.getNodeStatus(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+        <bpmn:incoming>SequenceFlow_1moaz0q</bpmn:incoming>
+        <bpmn:incoming>SequenceFlow_09t51ao</bpmn:incoming>
+        <bpmn:outgoing>SequenceFlow_0qvy3sn</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:sequenceFlow id="SequenceFlow_1rxbeqi" name="&#10;&#10;create vnf success&#10;&#10;" sourceRef="ExclusiveGateway_00xtlfj" targetRef="EndEvent_0tei3i9">
+        <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("createVnfNodeStatus")}</bpmn:conditionExpression>
+      </bpmn:sequenceFlow>
+      <bpmn:sequenceFlow id="SequenceFlow_1luu31f" sourceRef="ExclusiveGateway_00xtlfj" targetRef="IntermediateCatchEvent_0xuznv9" />
+      <bpmn:sequenceFlow id="SequenceFlow_1moaz0q" sourceRef="StartEvent_0r9qf43" targetRef="ServiceTask_0y71su8" />
+      <bpmn:sequenceFlow id="SequenceFlow_0qvy3sn" sourceRef="ServiceTask_0y71su8" targetRef="ExclusiveGateway_00xtlfj" />
+      <bpmn:sequenceFlow id="SequenceFlow_09t51ao" sourceRef="IntermediateCatchEvent_0xuznv9" targetRef="ServiceTask_0y71su8" />
+    </bpmn:subProcess>
+    <bpmn:endEvent id="EndEvent_1b83rci" name="Timeout Exception">
+      <bpmn:incoming>SequenceFlow_0uiqnl8</bpmn:incoming>
+      <bpmn:terminateEventDefinition id="TerminateEventDefinition_12rjfva" />
+    </bpmn:endEvent>
+    <bpmn:serviceTask id="ServiceTask_12qp0ty" name="&#10;Time Out Log Failure&#10;" camunda:asyncAfter="true" camunda:expression="${MonitorVnfmNodeTask.timeOutLogFailue(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+      <bpmn:incoming>SequenceFlow_0qcc5x4</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0uiqnl8</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:boundaryEvent id="BoundaryEvent_1f5o5i9" name="Overall Wait" attachedToRef="SubProcess_10wotbc">
+      <bpmn:outgoing>SequenceFlow_0qcc5x4</bpmn:outgoing>
+      <bpmn:timerEventDefinition id="TimerEventDefinition_1t3ya63">
+        <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT3H</bpmn:timeDuration>
+      </bpmn:timerEventDefinition>
+    </bpmn:boundaryEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_1miob62" sourceRef="StartEvent_0k0qfjb" targetRef="SubProcess_10wotbc" />
+    <bpmn:sequenceFlow id="SequenceFlow_0uiqnl8" sourceRef="ServiceTask_12qp0ty" targetRef="EndEvent_1b83rci" />
+    <bpmn:sequenceFlow id="SequenceFlow_0qcc5x4" sourceRef="BoundaryEvent_1f5o5i9" targetRef="ServiceTask_12qp0ty" />
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
+      <bpmndi:BPMNShape id="StartEvent_0k0qfjb_di" bpmnElement="StartEvent_0k0qfjb">
+        <dc:Bounds x="155" y="219" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="SubProcess_10wotbc_di" bpmnElement="SubProcess_10wotbc" isExpanded="true">
+        <dc:Bounds x="293" y="137" width="523" height="200" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1b83rci_di" bpmnElement="EndEvent_1b83rci">
+        <dc:Bounds x="1096" y="211" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1089" y="171" width="49" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ServiceTask_12qp0ty_di" bpmnElement="ServiceTask_12qp0ty">
+        <dc:Bounds x="917" y="189" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="BoundaryEvent_1f5o5i9_di" bpmnElement="BoundaryEvent_1f5o5i9">
+        <dc:Bounds x="800" y="211" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="788" y="250" width="60" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1miob62_di" bpmnElement="SequenceFlow_1miob62">
+        <di:waypoint x="191" y="237" />
+        <di:waypoint x="293" y="237" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0uiqnl8_di" bpmnElement="SequenceFlow_0uiqnl8">
+        <di:waypoint x="1017" y="229" />
+        <di:waypoint x="1096" y="229" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0qcc5x4_di" bpmnElement="SequenceFlow_0qcc5x4">
+        <di:waypoint x="836" y="229" />
+        <di:waypoint x="917" y="229" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_0r9qf43_di" bpmnElement="StartEvent_0r9qf43">
+        <dc:Bounds x="324" y="195" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_00xtlfj_di" bpmnElement="ExclusiveGateway_00xtlfj" isMarkerVisible="true">
+        <dc:Bounds x="603" y="188" width="50" height="50" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateCatchEvent_0xuznv9_di" bpmnElement="IntermediateCatchEvent_0xuznv9">
+        <dc:Bounds x="544" y="267" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="531" y="310" width="67" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_0tei3i9_di" bpmnElement="EndEvent_0tei3i9">
+        <dc:Bounds x="716" y="195" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ServiceTask_0y71su8_di" bpmnElement="ServiceTask_0y71su8">
+        <dc:Bounds x="412" y="173" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1rxbeqi_di" bpmnElement="SequenceFlow_1rxbeqi">
+        <di:waypoint x="653" y="213" />
+        <di:waypoint x="716" y="213" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="660" y="195" width="50" height="80" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1luu31f_di" bpmnElement="SequenceFlow_1luu31f">
+        <di:waypoint x="628" y="238" />
+        <di:waypoint x="628" y="285" />
+        <di:waypoint x="580" y="285" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1moaz0q_di" bpmnElement="SequenceFlow_1moaz0q">
+        <di:waypoint x="360" y="213" />
+        <di:waypoint x="412" y="213" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0qvy3sn_di" bpmnElement="SequenceFlow_0qvy3sn">
+        <di:waypoint x="512" y="213" />
+        <di:waypoint x="603" y="213" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_09t51ao_di" bpmnElement="SequenceFlow_09t51ao">
+        <di:waypoint x="544" y="285" />
+        <di:waypoint x="451" y="285" />
+        <di:waypoint x="452" y="253" />
+      </bpmndi:BPMNEdge>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
index acd55e4..a35ff47 100644 (file)
@@ -37,7 +37,7 @@
       </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:conditionExpression xsi:type="bpmn:tFormalExpression">${MonitorVnfmDeleteJobTask.hasOperationFinished(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}</bpmn:conditionExpression>
       </bpmn:sequenceFlow>
       <bpmn:sequenceFlow id="SequenceFlow_153a3kp" sourceRef="ServiceTask_17jlnng" targetRef="ExclusiveGateway_1hkl6yy" />
     </bpmn:subProcess>
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
new file mode 100644 (file)
index 0000000..8fababa
--- /dev/null
@@ -0,0 +1,138 @@
+<?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:process id="MonitorVnfmDeleteNodeStatus" name="MonitorVnfmDeleteNodeStatus" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_0f7nbs2">
+      <bpmn:outgoing>SequenceFlow_0spr34x</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:subProcess id="SubProcess_1q8fnjx">
+      <bpmn:incoming>SequenceFlow_0spr34x</bpmn:incoming>
+      <bpmn:startEvent id="StartEvent_06pbazr">
+        <bpmn:outgoing>SequenceFlow_17vvpzi</bpmn:outgoing>
+      </bpmn:startEvent>
+      <bpmn:exclusiveGateway id="ExclusiveGateway_1j9jbtk" default="SequenceFlow_0zlblru">
+        <bpmn:incoming>SequenceFlow_1unicf9</bpmn:incoming>
+        <bpmn:outgoing>SequenceFlow_03pp1ee</bpmn:outgoing>
+        <bpmn:outgoing>SequenceFlow_0zlblru</bpmn:outgoing>
+      </bpmn:exclusiveGateway>
+      <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_15yl23y" name="Wait between checks" camunda:asyncAfter="true">
+        <bpmn:incoming>SequenceFlow_0zlblru</bpmn:incoming>
+        <bpmn:outgoing>SequenceFlow_11rfobu</bpmn:outgoing>
+        <bpmn:timerEventDefinition id="TimerEventDefinition_0o69kn7">
+          <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT15S</bpmn:timeDuration>
+        </bpmn:timerEventDefinition>
+      </bpmn:intermediateCatchEvent>
+      <bpmn:endEvent id="EndEvent_1hukjy3">
+        <bpmn:incoming>SequenceFlow_03pp1ee</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:sequenceFlow id="SequenceFlow_03pp1ee" name="&#10;&#10;&#10;delete vnf success&#10;&#10;" sourceRef="ExclusiveGateway_1j9jbtk" targetRef="EndEvent_1hukjy3">
+        <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="&#10;Get node status &#10;" camunda:asyncAfter="true" camunda:expression="${MonitorVnfmNodeTask.getNodeStatus(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+        <bpmn:incoming>SequenceFlow_17vvpzi</bpmn:incoming>
+        <bpmn:incoming>SequenceFlow_11rfobu</bpmn:incoming>
+        <bpmn:outgoing>SequenceFlow_1unicf9</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:sequenceFlow id="SequenceFlow_17vvpzi" sourceRef="StartEvent_06pbazr" targetRef="ServiceTask_1ksqjjf" />
+      <bpmn:sequenceFlow id="SequenceFlow_1unicf9" sourceRef="ServiceTask_1ksqjjf" targetRef="ExclusiveGateway_1j9jbtk" />
+      <bpmn:sequenceFlow id="SequenceFlow_11rfobu" sourceRef="IntermediateCatchEvent_15yl23y" targetRef="ServiceTask_1ksqjjf" />
+    </bpmn:subProcess>
+    <bpmn:endEvent id="EndEvent_1bhjbb4" name="Timeout Exception">
+      <bpmn:incoming>SequenceFlow_1o7p21a</bpmn:incoming>
+      <bpmn:terminateEventDefinition id="TerminateEventDefinition_1bme4ej" />
+    </bpmn:endEvent>
+    <bpmn:serviceTask id="ServiceTask_1wmy8ge" name="&#10;Time Out Log Failure&#10;" camunda:asyncAfter="true" camunda:expression="${MonitorVnfmNodeTask.timeOutLogFailue(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+      <bpmn:incoming>SequenceFlow_1suioy7</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1o7p21a</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:boundaryEvent id="BoundaryEvent_1frhcyq" name="Overall Wait" attachedToRef="SubProcess_1q8fnjx">
+      <bpmn:outgoing>SequenceFlow_1suioy7</bpmn:outgoing>
+      <bpmn:timerEventDefinition id="TimerEventDefinition_1ish98h">
+        <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT3H</bpmn:timeDuration>
+      </bpmn:timerEventDefinition>
+    </bpmn:boundaryEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_0spr34x" sourceRef="StartEvent_0f7nbs2" targetRef="SubProcess_1q8fnjx" />
+    <bpmn:sequenceFlow id="SequenceFlow_1o7p21a" sourceRef="ServiceTask_1wmy8ge" targetRef="EndEvent_1bhjbb4" />
+    <bpmn:sequenceFlow id="SequenceFlow_1suioy7" sourceRef="BoundaryEvent_1frhcyq" targetRef="ServiceTask_1wmy8ge" />
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="MonitorVnfmDeleteNodeStatus">
+      <bpmndi:BPMNShape id="StartEvent_0f7nbs2_di" bpmnElement="StartEvent_0f7nbs2">
+        <dc:Bounds x="154" y="313" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="SubProcess_1q8fnjx_di" bpmnElement="SubProcess_1q8fnjx" isExpanded="true">
+        <dc:Bounds x="293" y="231" width="523" height="200" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1bhjbb4_di" bpmnElement="EndEvent_1bhjbb4">
+        <dc:Bounds x="1095" y="305" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1088" y="265" width="49" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ServiceTask_1wmy8ge_di" bpmnElement="ServiceTask_1wmy8ge">
+        <dc:Bounds x="916" y="283" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ServiceTask_1ksqjjf_di" bpmnElement="ServiceTask_1ksqjjf">
+        <dc:Bounds x="411" y="267" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="BoundaryEvent_1frhcyq_di" bpmnElement="BoundaryEvent_1frhcyq">
+        <dc:Bounds x="799" y="305" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="787" y="344" width="60" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0spr34x_di" bpmnElement="SequenceFlow_0spr34x">
+        <di:waypoint x="190" y="331" />
+        <di:waypoint x="293" y="331" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1o7p21a_di" bpmnElement="SequenceFlow_1o7p21a">
+        <di:waypoint x="1016" y="323" />
+        <di:waypoint x="1095" y="323" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1suioy7_di" bpmnElement="SequenceFlow_1suioy7">
+        <di:waypoint x="835" y="323" />
+        <di:waypoint x="916" y="323" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_06pbazr_di" bpmnElement="StartEvent_06pbazr">
+        <dc:Bounds x="323" y="289" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_1j9jbtk_di" bpmnElement="ExclusiveGateway_1j9jbtk" isMarkerVisible="true">
+        <dc:Bounds x="602" y="282" width="50" height="50" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateCatchEvent_15yl23y_di" bpmnElement="IntermediateCatchEvent_15yl23y">
+        <dc:Bounds x="543" y="361" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="530" y="404" width="67" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1hukjy3_di" bpmnElement="EndEvent_1hukjy3">
+        <dc:Bounds x="715" y="289" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_03pp1ee_di" bpmnElement="SequenceFlow_03pp1ee">
+        <di:waypoint x="652" y="307" />
+        <di:waypoint x="715" y="307" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="660" y="289" width="49" height="93" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0zlblru_di" bpmnElement="SequenceFlow_0zlblru">
+        <di:waypoint x="627" y="332" />
+        <di:waypoint x="627" y="379" />
+        <di:waypoint x="579" y="379" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_17vvpzi_di" bpmnElement="SequenceFlow_17vvpzi">
+        <di:waypoint x="359" y="307" />
+        <di:waypoint x="411" y="307" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1unicf9_di" bpmnElement="SequenceFlow_1unicf9">
+        <di:waypoint x="511" y="307" />
+        <di:waypoint x="602" y="307" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_11rfobu_di" bpmnElement="SequenceFlow_11rfobu">
+        <di:waypoint x="543" y="379" />
+        <di:waypoint x="450" y="379" />
+        <di:waypoint x="451" y="347" />
+      </bpmndi:BPMNEdge>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
index 59f8be5..976b1bc 100644 (file)
@@ -34,6 +34,10 @@ public class Constants {
   public static final String CREATE_VNF_RESPONSE_PARAM_NAME = "createVnfResponse";
   public static final String INPUT_PARAMETER = "inputParameter";
   public static final String DELETE_VNF_RESPONSE_PARAM_NAME = "deleteVnfResponse";
+  public static final String DELETE_VNF_NODE_STATUS = "deleteVnfNodeStatus";
+  public static final String CREATE_VNF_NODE_STATUS = "createVnfNodeStatus";
+  public static final String VNF_ASSIGNED = "Assigned";
+  public static final String VNF_CREATED = "Created";
 
 
   public static final String DOT = ".";
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
new file mode 100644 (file)
index 0000000..22a5d28
--- /dev/null
@@ -0,0 +1,85 @@
+/*-
+ * ============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.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 org.onap.aai.domain.yang.GenericVnf;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+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)
+ *
+ */
+@Component
+public class MonitorVnfmNodeTask {
+
+  private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmNodeTask.class);
+
+  private final ExtractPojosForBB extractPojosForBB;
+  private final ExceptionBuilder exceptionUtil;
+
+  @Autowired
+  public MonitorVnfmNodeTask(final ExtractPojosForBB extractPojosForBB, final ExceptionBuilder exceptionUtil) {
+    this.exceptionUtil = exceptionUtil;
+    this.extractPojosForBB = extractPojosForBB;
+  }
+
+  /**
+   * Check the final status of vnf in A&AI
+   * 
+   * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+   */
+  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));
+    } catch (final Exception exception) {
+      LOGGER.error("Unable to get vnf from AAI", exception);
+      exceptionUtil.buildAndThrowWorkflowException(execution, 1220, exception);
+    }
+  }
+
+  /**
+   * 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 = "Node operation time out";
+    LOGGER.error(message);
+    exceptionUtil.buildAndThrowWorkflowException(execution, 1221, message);
+  }
+}
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/MonitorVnfmNodeJobTest.java
new file mode 100644 (file)
index 0000000..aa3ab11
--- /dev/null
@@ -0,0 +1,111 @@
+/*-
+ * ============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.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 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;
+
+/**
+ * 
+ * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech)
+ *
+ */
+public class MonitorVnfmNodeJobTest 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;
+
+  private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
+
+  @Before
+  public void setUp() {
+    objUnderTest = getEtsiVnfMonitorNodeJobTask();
+  }
+
+  @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);
+    when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf);
+    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);
+    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));
+  }
+
+  @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() {
+    final GenericVnf genericVnf = new GenericVnf();
+    genericVnf.setVnfId(VNF_ID);
+    genericVnf.setVnfName(VNF_NAME);
+    return genericVnf;
+  }
+
+  private MonitorVnfmNodeTask getEtsiVnfMonitorNodeJobTask() {
+    return new MonitorVnfmNodeTask(extractPojosForBB, exceptionUtil);
+  }
+
+}