X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_common%2Fdataclasses%2Ftemporal_dataclasses.py;h=37736c7dd97fbd6eecdd7bbb586b8718b9eef439;hb=fd2324b13d70b4c6ab9c5e0155c57bddc039e94f;hp=b5718b323066ed6066c0a10149f1c4f0ef5e64af;hpb=a8d016d9d942775d15654a362a1dca97232e0b64;p=osm%2Fcommon.git diff --git a/osm_common/dataclasses/temporal_dataclasses.py b/osm_common/dataclasses/temporal_dataclasses.py index b5718b3..37736c7 100644 --- a/osm_common/dataclasses/temporal_dataclasses.py +++ b/osm_common/dataclasses/temporal_dataclasses.py @@ -16,26 +16,133 @@ ####################################################################################### from dataclasses import dataclass +from enum import auto, IntEnum +####################################################################################### # Workflow Dataclasses @dataclass -class VimCreateInput: +class VimOperationInput: + """ + Input dataclass for workflows that perform operations + (create, update, delete) on VIMs. + + Attributes: + ----------- + vim_uuid : str + The UUID of the VIM account as stored in the OSM vim + collection in Mongo + + op_id: str + The operation (task) id for this workflow. This is used + by the workflow at the end to update the status of the + operation in Mongo vim collection. + """ + vim_uuid: str + op_id: str +####################################################################################### # Activity Dataclasses @dataclass class TestVimConnectivityInput: + """ + Input dataclass for the Test Vim Connectivity Ativity + + Attributes: + ----------- + vim_uuid : str + The UUID of the VIM account as stored in the OSM vim + collection in Mongo + """ + + vim_uuid: str + + +class VimState(IntEnum): + PROCESSING = auto() + ENABLED = auto() + ERROR = auto() + + +@dataclass +class UpdateVimStateInput: + """ + Input dataclass for updating VIM state in the DB + + Attributes: + ----------- + vim_uuid : str + The UUID of the VIM account as stored in the OSM vim + collection in Mongo + + operational_state : VimState + A representation of the operational state (ENABLED or ERROR) + of the VIM. - """Docstring for why we use this""" + message : str + Human readable message providing additional details to the + operational state, such as the error message associated + with the ERROR operational_state. + """ vim_uuid: str + operational_state: VimState + message: str + + +class VimOperationState(IntEnum): + COMPLETED = auto() + FAILED = auto() @dataclass -class UpdateVimStatusInput: - db_update_info: dict +class UpdateVimOperationStateInput: + """ + Input dataclass for updating VIM Operations in the Mongo VIM + collection. + + Attributes: + ----------- + vim_uuid : str + The UUID of the VIM account as stored in the OSM vim + collection in Mongo + + op_id: str + The operation (task) id for this workflow. This is used + to update the status of the operation in Mongo vim collection. + + op_state : VimOperationState + A representation of the state of the specified operation id, + such as COMPLETED, or FAILED. + + message : str + Human readable message providing additional details to the + operation state, such as the error message explaining why + the operation failed. + """ + + vim_uuid: str + op_id: str + op_state: VimOperationState + message: str + + +@dataclass +class DeleteVimInput: + """ + Input dataclass for deleting vim record from the database + + Attributes: + ----------- + vim_uuid : str + The UUID of the VIM account as stored in the OSM vim + collection in Mongo + + """ + + vim_uuid: str