NS LCM OP Workflow wrapper 58/13158/1
authorMark Beierl <mark.beierl@canonical.com>
Wed, 5 Apr 2023 20:01:05 +0000 (20:01 +0000)
committerMark Beierl <mark.beierl@canonical.com>
Wed, 5 Apr 2023 20:01:05 +0000 (20:01 +0000)
Change-Id: If3784fef5e54f5f41e744cc0ae7ac0d6ee83f97f
Signed-off-by: Mark Beierl <mark.beierl@canonical.com>
osm_common/dataclasses/temporal_dataclasses.py
osm_common/temporal_constants.py

index 37736c7..c472ca6 100644 (file)
@@ -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:
     """
index 62a6119..e9a0383 100644 (file)
 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"