From 248cb40e1a786e1cd4a084ce0aecb89419a672b1 Mon Sep 17 00:00:00 2001 From: Mark Beierl Date: Wed, 5 Apr 2023 20:01:05 +0000 Subject: [PATCH] NS LCM OP Workflow wrapper Change-Id: If3784fef5e54f5f41e744cc0ae7ac0d6ee83f97f Signed-off-by: Mark Beierl --- .../dataclasses/temporal_dataclasses.py | 60 +++++++++++++++++++ osm_common/temporal_constants.py | 7 ++- 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/osm_common/dataclasses/temporal_dataclasses.py b/osm_common/dataclasses/temporal_dataclasses.py index 37736c7..c472ca6 100644 --- a/osm_common/dataclasses/temporal_dataclasses.py +++ b/osm_common/dataclasses/temporal_dataclasses.py @@ -44,10 +44,70 @@ class VimOperationInput: op_id: str +@dataclass +class NsLcmOperationInput: + """ + Input dataclass for workflows that run as LCM operations. + + Attributes: + ----------- + + nslcmop: dict + A dictionary representing the nslcmop record from the + database. + """ + + nslcmop: dict + + ####################################################################################### # Activity Dataclasses +class LcmOperationState(IntEnum): + PROCESSING = auto() + COMPLETED = auto() + FAILED = auto() + + +@dataclass +class UpdateLcmOperationStateInput: + """ + Input dataclass for updating LCM Operations in the Mongo nslcmops + collection. The following attributes will be updated automatically + - statusEnteredTime + - _admin.modified + + Attributes: + ----------- + op_id: str + The operation (task) id for this activity. This is the key + to the record in nslcmops collection that will be updated. + + op_state : LcmOperationState + A representation of the state of the specified operation id, + such as PROCESSING, COMPLETED, or FAILED. + + stage: str + Human readable checkpoint message, intended only to give the + user feedback. + + error_message: str + Human readable error message if any failure occurred. + + detailed_status : str + Human readable message providing additional details to the + operation state, such as the error message explaining why + the operation failed. + """ + + op_id: str + op_state: LcmOperationState + stage: str + error_message: str + detailed_status: str + + @dataclass class TestVimConnectivityInput: """ diff --git a/osm_common/temporal_constants.py b/osm_common/temporal_constants.py index 62a6119..e9a0383 100644 --- a/osm_common/temporal_constants.py +++ b/osm_common/temporal_constants.py @@ -18,12 +18,17 @@ LCM_TASK_QUEUE = "lcm-task-queue" # Activities +ACTIVITY_NSLCM_NO_OP = "nslcm-no-op" +ACTIVITY_EXECUTE_NS_LCM_WORKFLOW = "execute-ns-lcm-workflow" +ACTIVITY_UPDATE_LCM_OPERATION_STATE = "update-lcm-operation-state" ACTIVITY_DELETE_VIM = "delete-vim" ACTIVITY_TEST_VIM_CONNECTIVITY = "test-vim-connectivity" -ACTIVITY_UPDATE_VIM_OPERATION_STATE = "update-operation-state" +ACTIVITY_UPDATE_VIM_OPERATION_STATE = "update-vim-operation-state" ACTIVITY_UPDATE_VIM_STATE = "update-vim-state" +ACTIVITY_UPDATE_LCM_OPERATION_STATE = "update-lcm-operation-state" # Workflows +WORKFLOW_NSLCM_NO_OP = "nslcm-no-op" WORKFLOW_VIM_CREATE = "vim-create" WORKFLOW_VIM_UPDATE = "vim-update" WORKFLOW_VIM_DELETE = "vim-delete" -- 2.25.1