diff options
author | Steve Smokowski <ss835w@att.com> | 2020-02-06 14:51:02 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-02-06 14:51:02 +0000 |
commit | 526148c73d077343c083484aedb5745f7a759f0c (patch) | |
tree | ec28b4457b095c470092d9d002fae276ce05002e | |
parent | 9b496eb93f2056656f9ab182de37beb88a9f75cd (diff) | |
parent | f0b7c139d0638b6f53c40be6a58b08831d558e97 (diff) |
Merge "WaitForPnfReadyBB - set orchestration status to Register and then Registered"
4 files changed, 100 insertions, 37 deletions
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WaitForPnfReadyBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WaitForPnfReadyBB.bpmn index b38ec69ba5..29e2f2bf11 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WaitForPnfReadyBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WaitForPnfReadyBB.bpmn @@ -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("gBuildingBlockExecution")))}"> <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"> @@ -30,17 +36,21 @@ <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("gBuildingBlockExecution")))}"> + <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> @@ -52,12 +62,12 @@ <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"> @@ -67,12 +77,12 @@ </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"> @@ -83,32 +93,32 @@ <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> @@ -131,26 +141,40 @@ <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> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index f1fbe545ce..dab35931f2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -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); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java index ae6dde6521..19877aae16 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java @@ -161,6 +161,26 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @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); diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java index 9691eff5f5..435c3a71ab 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java @@ -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; |