diff options
author | Lukasz Muszkieta <lukasz.muszkieta@nokia.com> | 2020-02-04 19:24:45 +0100 |
---|---|---|
committer | Lukasz Muszkieta <lukasz.muszkieta@nokia.com> | 2020-02-05 10:55:18 +0100 |
commit | f0b7c139d0638b6f53c40be6a58b08831d558e97 (patch) | |
tree | b6d4695a7b581df79a8266104aa12599052c3b87 /bpmn/so-bpmn-tasks | |
parent | 6706ff14fca4a1f66eb739e45654db5f42fd3c3f (diff) |
WaitForPnfReadyBB - set orchestration status to Register and then Registered
Issue-ID: SO-2644
Signed-off-by: Lukasz Muszkieta <lukasz.muszkieta@nokia.com>
Change-Id: I2796baf4afabd47536ffa0d4deb5096608fc5cce
Diffstat (limited to 'bpmn/so-bpmn-tasks')
2 files changed, 40 insertions, 3 deletions
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); |