WaitForPnfReadyBB - set orchestration status to Register and then Registered 59/101159/1
authorLukasz Muszkieta <lukasz.muszkieta@nokia.com>
Tue, 4 Feb 2020 18:24:45 +0000 (19:24 +0100)
committerLukasz Muszkieta <lukasz.muszkieta@nokia.com>
Wed, 5 Feb 2020 09:55:18 +0000 (10:55 +0100)
Issue-ID: SO-2644
Signed-off-by: Lukasz Muszkieta <lukasz.muszkieta@nokia.com>
Change-Id: I2796baf4afabd47536ffa0d4deb5096608fc5cce

bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WaitForPnfReadyBB.bpmn
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java

index b38ec69..29e2f2b 100644 (file)
@@ -8,20 +8,26 @@
     <bpmn:messageFlow id="MessageFlow_1py54jr" sourceRef="UnregisterfromPnfReadyEvent" targetRef="WorkflowMessageServiceForDmaap" />
   </bpmn:collaboration>
   <bpmn:process id="WaitForPnfReadyBB" name="WaitForPnfReadyBB" isExecutable="true">
-    <bpmn:startEvent id="WaitForPnfReady_StartEvent">
-      <bpmn:outgoing>SequenceFlow_1jzs6dp</bpmn:outgoing>
-    </bpmn:startEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_17q5zqe" sourceRef="UpdatePnfOrchestrationStatusToRegistered" targetRef="AaiEntryUpdated" />
+    <bpmn:sequenceFlow id="SequenceFlow_0m2r6ye" sourceRef="UpdatePnfOrchestrationStatusToRegister" targetRef="WaitForDmaapPnfReadyNotification" />
+    <bpmn:sequenceFlow id="SequenceFlow_1miyzfe" sourceRef="UnregisterfromPnfReadyEvent" targetRef="ThrowTimeoutException" />
+    <bpmn:sequenceFlow id="SequenceFlow_0p09qgm" sourceRef="WaitForDmaapPnfReadyNotification" targetRef="UpdatePnfOrchestrationStatusToRegistered" />
+    <bpmn:sequenceFlow id="SequenceFlow_1o8od8e" sourceRef="RegisterForPnfReadyEvent" targetRef="UpdatePnfOrchestrationStatusToRegister" />
+    <bpmn:sequenceFlow id="SequenceFlow_1kc34bc" sourceRef="WaitForDmaapTimeout" targetRef="UnregisterfromPnfReadyEvent" />
+    <bpmn:sequenceFlow id="SequenceFlow_1jzs6dp" sourceRef="WaitForPnfReady_StartEvent" targetRef="RegisterForPnfReadyEvent" />
     <bpmn:serviceTask id="RegisterForPnfReadyEvent" name="Register for Pnf Ready Event" camunda:delegateExpression="${RegisterForPnfReadyEvent}">
       <bpmn:incoming>SequenceFlow_1jzs6dp</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1o8od8e</bpmn:outgoing>
     </bpmn:serviceTask>
-    <bpmn:sequenceFlow id="SequenceFlow_1miyzfe" sourceRef="UnregisterfromPnfReadyEvent" targetRef="ThrowTimeoutException" />
-    <bpmn:sequenceFlow id="SequenceFlow_0p09qgm" sourceRef="WaitForDmaapPnfReadyNotification" targetRef="AaiEntryUpdated" />
-    <bpmn:sequenceFlow id="SequenceFlow_1o8od8e" sourceRef="RegisterForPnfReadyEvent" targetRef="WaitForDmaapPnfReadyNotification" />
-    <bpmn:sequenceFlow id="SequenceFlow_1kc34bc" sourceRef="WaitForDmaapTimeout" targetRef="UnregisterfromPnfReadyEvent" />
-    <bpmn:sequenceFlow id="SequenceFlow_1jzs6dp" sourceRef="WaitForPnfReady_StartEvent" targetRef="RegisterForPnfReadyEvent" />
-    <bpmn:receiveTask id="WaitForDmaapPnfReadyNotification" name="Wait for DMAAP pnf-ready notification" messageRef="Message_13h1tlo">
+    <bpmn:startEvent id="WaitForPnfReady_StartEvent">
+      <bpmn:outgoing>SequenceFlow_1jzs6dp</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:serviceTask id="UpdatePnfOrchestrationStatusToRegister" name="Update Pnf Orchestration Status to Register" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusRegisterPnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
       <bpmn:incoming>SequenceFlow_1o8od8e</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0m2r6ye</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:receiveTask id="WaitForDmaapPnfReadyNotification" name="Wait for DMAAP pnf-ready notification" messageRef="Message_13h1tlo">
+      <bpmn:incoming>SequenceFlow_0m2r6ye</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0p09qgm</bpmn:outgoing>
     </bpmn:receiveTask>
     <bpmn:boundaryEvent id="WaitForDmaapTimeout" name="Timeout" attachedToRef="WaitForDmaapPnfReadyNotification">
         <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">#{timeoutForPnfEntryNotification}</bpmn:timeDuration>
       </bpmn:timerEventDefinition>
     </bpmn:boundaryEvent>
+    <bpmn:serviceTask id="UpdatePnfOrchestrationStatusToRegistered" name="Update Pnf Orchestration Status to Registered" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusRegisteredPnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+      <bpmn:incoming>SequenceFlow_0p09qgm</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_17q5zqe</bpmn:outgoing>
+    </bpmn:serviceTask>
     <bpmn:serviceTask id="UnregisterfromPnfReadyEvent" name="Unregister from Pnf Ready Event" camunda:delegateExpression="${CancelDmaapSubscription}">
       <bpmn:incoming>SequenceFlow_1kc34bc</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1miyzfe</bpmn:outgoing>
     </bpmn:serviceTask>
+    <bpmn:endEvent id="AaiEntryUpdated" name="AAI entry updated">
+      <bpmn:incoming>SequenceFlow_17q5zqe</bpmn:incoming>
+    </bpmn:endEvent>
     <bpmn:endEvent id="ThrowTimeoutException" name="Throw timeout exception">
       <bpmn:incoming>SequenceFlow_1miyzfe</bpmn:incoming>
       <bpmn:errorEventDefinition errorRef="Error_1" />
     </bpmn:endEvent>
-    <bpmn:endEvent id="AaiEntryUpdated" name="AAI entry updated">
-      <bpmn:incoming>SequenceFlow_0p09qgm</bpmn:incoming>
-    </bpmn:endEvent>
     <bpmn:textAnnotation id="TextAnnotation_1eyzes8">
       <bpmn:text>Inputs:
  - pnf name - String</bpmn:text>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1d0w8lf">
       <bpmndi:BPMNShape id="Participant_1egg397_di" bpmnElement="WaitForPnfReadyBB_ID" isHorizontal="true">
-        <dc:Bounds x="160" y="50" width="810" height="400" />
+        <dc:Bounds x="160" y="50" width="1040" height="400" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_0k52gr7_di" bpmnElement="AaiEntryUpdated">
-        <dc:Bounds x="882" y="189" width="36" height="36" />
+        <dc:Bounds x="1112" y="189" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="858" y="230" width="88" height="14" />
+          <dc:Bounds x="1088" y="230" width="88" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="StartEvent_0j5ok9h_di" bpmnElement="WaitForPnfReady_StartEvent">
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Participant_0vmrrhf_di" bpmnElement="WorkflowMessageServiceForDmaap" isHorizontal="true">
-        <dc:Bounds x="340" y="490" width="463" height="60" />
+        <dc:Bounds x="340" y="490" width="690" height="60" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_0wbx6tt_di" bpmnElement="ThrowTimeoutException">
-        <dc:Bounds x="882" y="322" width="36" height="36" />
+        <dc:Bounds x="1112" y="322" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="875" y="359" width="70" height="27" />
+          <dc:Bounds x="1105" y="359" width="70" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="TextAnnotation_1eyzes8_di" bpmnElement="TextAnnotation_1eyzes8">
         <di:waypoint x="237" y="109" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="MessageFlow_1vrcp2d_di" bpmnElement="MessageFlow_1vrcp2d">
-        <di:waypoint x="582" y="490" />
-        <di:waypoint x="582" y="247" />
+        <di:waypoint x="772" y="490" />
+        <di:waypoint x="772" y="247" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="996" y="380" width="90" height="10" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="BoundaryEvent_15eo1k9_di" bpmnElement="WaitForDmaapTimeout">
-        <dc:Bounds x="596" y="229" width="36" height="36" />
+        <dc:Bounds x="786" y="229" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="639" y="240" width="40" height="14" />
+          <dc:Bounds x="829" y="240" width="40" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1kc34bc_di" bpmnElement="SequenceFlow_1kc34bc">
-        <di:waypoint x="614" y="265" />
-        <di:waypoint x="614" y="340" />
-        <di:waypoint x="710" y="340" />
+        <di:waypoint x="804" y="265" />
+        <di:waypoint x="804" y="340" />
+        <di:waypoint x="910" y="340" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="1028" y="309" width="90" height="10" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ReceiveTask_1sfysua_di" bpmnElement="WaitForDmaapPnfReadyNotification">
-        <dc:Bounds x="530" y="167" width="100" height="80" />
+        <dc:Bounds x="720" y="167" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0p09qgm_di" bpmnElement="SequenceFlow_0p09qgm">
-        <di:waypoint x="630" y="207" />
-        <di:waypoint x="882" y="207" />
+        <di:waypoint x="820" y="207" />
+        <di:waypoint x="910" y="207" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="1106.5" y="187" width="90" height="10" />
         </bpmndi:BPMNLabel>
         <dc:Bounds x="340" y="167" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1miyzfe_di" bpmnElement="SequenceFlow_1miyzfe">
-        <di:waypoint x="810" y="340" />
-        <di:waypoint x="882" y="340" />
+        <di:waypoint x="1010" y="340" />
+        <di:waypoint x="1112" y="340" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="1233.5" y="343" width="90" height="10" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="MessageFlow_1py54jr_di" bpmnElement="MessageFlow_1py54jr">
-        <di:waypoint x="760" y="380" />
-        <di:waypoint x="760" y="490" />
+        <di:waypoint x="960" y="380" />
+        <di:waypoint x="960" y="490" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="1165" y="458" width="90" height="10" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_12j7hox_di" bpmnElement="UnregisterfromPnfReadyEvent">
-        <dc:Bounds x="710" y="300" width="100" height="80" />
+        <dc:Bounds x="910" y="300" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1jzs6dp_di" bpmnElement="SequenceFlow_1jzs6dp">
         <di:waypoint x="255" y="207" />
         <di:waypoint x="340" y="207" />
       </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ServiceTask_1kiymc9_di" bpmnElement="UpdatePnfOrchestrationStatusToRegister">
+        <dc:Bounds x="530" y="167" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0m2r6ye_di" bpmnElement="SequenceFlow_0m2r6ye">
+        <di:waypoint x="630" y="207" />
+        <di:waypoint x="720" y="207" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_17q5zqe_di" bpmnElement="SequenceFlow_17q5zqe">
+        <di:waypoint x="1010" y="207" />
+        <di:waypoint x="1112" y="207" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ServiceTask_1e3i8pf_di" bpmnElement="UpdatePnfOrchestrationStatusToRegistered">
+        <dc:Bounds x="910" y="167" width="100" height="80" />
+      </bpmndi:BPMNShape>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>
index f1fbe54..dab3593 100644 (file)
@@ -118,18 +118,35 @@ public class AAIUpdateTasks {
         }
     }
 
-
     /**
      * BPMN access method to update status of Pnf to Active in AAI
      *
      * @param execution
      */
     public void updateOrchestrationStatusActivePnf(BuildingBlockExecution execution) {
+        updateOrchestrationStatusForPnf(execution, OrchestrationStatus.ACTIVE);
+    }
+
+    /**
+     * BPMN access method to update status of Pnf to Register in AAI
+     */
+    public void updateOrchestrationStatusRegisterPnf(BuildingBlockExecution execution) {
+        updateOrchestrationStatusForPnf(execution, OrchestrationStatus.REGISTER);
+    }
+
+    /**
+     * BPMN access method to update status of Pnf to Registered in AAI
+     */
+    public void updateOrchestrationStatusRegisteredPnf(BuildingBlockExecution execution) {
+        updateOrchestrationStatusForPnf(execution, OrchestrationStatus.REGISTERED);
+    }
+
+    private void updateOrchestrationStatusForPnf(BuildingBlockExecution execution, OrchestrationStatus status) {
         try {
             Pnf pnf = extractPojosForBB.extractByKey(execution, ResourceKey.PNF);
-            aaiPnfResources.updateOrchestrationStatusPnf(pnf, OrchestrationStatus.ACTIVE);
+            aaiPnfResources.updateOrchestrationStatusPnf(pnf, status);
         } catch (Exception ex) {
-            logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActivePnf", ex);
+            logger.error("Exception occurred in AAIUpdateTasks during update Orchestration Status to {}", status, ex);
             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
         }
     }
index ae6dde6..19877aa 100644 (file)
@@ -160,6 +160,26 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
         aaiUpdateTasks.updateOrchestrationStatusActivePnf(execution);
     }
 
+    @Test
+    public void updateOrchestrationStatusRegisterPnfTest() throws Exception {
+        Pnf pnf = preparePnfAndExtractForPnf();
+        doNothing().when(aaiPnfResources).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.REGISTER);
+
+        aaiUpdateTasks.updateOrchestrationStatusRegisterPnf(execution);
+
+        verify(aaiPnfResources, times(1)).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.REGISTER);
+    }
+
+    @Test
+    public void updateOrchestrationStatusRegisteredPnfTest() throws Exception {
+        Pnf pnf = preparePnfAndExtractForPnf();
+        doNothing().when(aaiPnfResources).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.REGISTERED);
+
+        aaiUpdateTasks.updateOrchestrationStatusRegisteredPnf(execution);
+
+        verify(aaiPnfResources, times(1)).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.REGISTERED);
+    }
+
     @Test
     public void updateOrchestrationStatusAssignedVnfTest() throws Exception {
         doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ASSIGNED);
index 9691eff..435c3a7 100644 (file)
@@ -33,7 +33,9 @@ public enum OrchestrationStatus {
     PRECREATED("PreCreated", "pre.?created"),
     CONFIGASSIGNED("ConfigAssigned", "config.?assigned"),
     CONFIGURE("Configure", "configure"),
-    CONFIGURED("Configured", "configured");
+    CONFIGURED("Configured", "configured"),
+    REGISTER("Register", "register"),
+    REGISTERED("Registered", "registered");
 
     private final String name;
     private final String fuzzyMatcher;