From: Mark Beierl Date: Wed, 29 Mar 2023 17:28:49 +0000 (+0000) Subject: Change to use Enum X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F16%2F13116%2F2;p=osm%2Fcommon.git Change to use Enum Changes operation and operational status types to IntEnums Change-Id: If204c3a7d3cf0f3407792a5ae54b4c1077898e67 Signed-off-by: Mark Beierl --- diff --git a/osm_common/dataclasses/temporal_dataclasses.py b/osm_common/dataclasses/temporal_dataclasses.py index 3b8a857..37736c7 100644 --- a/osm_common/dataclasses/temporal_dataclasses.py +++ b/osm_common/dataclasses/temporal_dataclasses.py @@ -16,7 +16,9 @@ ####################################################################################### from dataclasses import dataclass +from enum import auto, IntEnum +####################################################################################### # Workflow Dataclasses @@ -42,6 +44,7 @@ class VimOperationInput: op_id: str +####################################################################################### # Activity Dataclasses @@ -60,6 +63,12 @@ class TestVimConnectivityInput: vim_uuid: str +class VimState(IntEnum): + PROCESSING = auto() + ENABLED = auto() + ERROR = auto() + + @dataclass class UpdateVimStateInput: """ @@ -71,7 +80,7 @@ class UpdateVimStateInput: The UUID of the VIM account as stored in the OSM vim collection in Mongo - operational_state : str + operational_state : VimState A representation of the operational state (ENABLED or ERROR) of the VIM. @@ -82,10 +91,15 @@ class UpdateVimStateInput: """ vim_uuid: str - operational_state: str + operational_state: VimState message: str +class VimOperationState(IntEnum): + COMPLETED = auto() + FAILED = auto() + + @dataclass class UpdateVimOperationStateInput: """ @@ -102,7 +116,7 @@ class UpdateVimOperationStateInput: The operation (task) id for this workflow. This is used to update the status of the operation in Mongo vim collection. - op_state : str + op_state : VimOperationState A representation of the state of the specified operation id, such as COMPLETED, or FAILED. @@ -114,7 +128,7 @@ class UpdateVimOperationStateInput: vim_uuid: str op_id: str - op_state: str + op_state: VimOperationState message: str