X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_common%2Fdataclasses%2Ftemporal_dataclasses.py;h=a0e3d19bd066a750f2349937fcf47280e02ae183;hb=4ddf2c7055362b6f06ffc5b341f0cd0b54661fe6;hp=c472ca687b20c84fac6da3a5428ff7d652f4e213;hpb=248cb40e1a786e1cd4a084ce0aecb89419a672b1;p=osm%2Fcommon.git diff --git a/osm_common/dataclasses/temporal_dataclasses.py b/osm_common/dataclasses/temporal_dataclasses.py index c472ca6..a0e3d19 100644 --- a/osm_common/dataclasses/temporal_dataclasses.py +++ b/osm_common/dataclasses/temporal_dataclasses.py @@ -18,6 +18,48 @@ from dataclasses import dataclass from enum import auto, IntEnum + +####################################################################################### +# Defining States +class VimState(IntEnum): + PROCESSING = auto() + ENABLED = auto() + ERROR = auto() + + +class VimOperationState(IntEnum): + COMPLETED = auto() + FAILED = auto() + + +class NsState(IntEnum): + PROCESSING = auto() + INSTANTIATED = auto() + ERROR = auto() + + +class VnfLcmOperationState(IntEnum): + PROCESSING = auto() + COMPLETED = auto() + FAILED = auto() + + +class VnfInstantiationState(IntEnum): + NOT_INSTANTIATED = auto() + INSTANTIATED = auto() + + +class VnfState(IntEnum): + STOPPED = auto() + STARTED = auto() + + +class LcmOperationState(IntEnum): + PROCESSING = auto() + COMPLETED = auto() + FAILED = auto() + + ####################################################################################### # Workflow Dataclasses @@ -60,14 +102,98 @@ class NsLcmOperationInput: nslcmop: dict -####################################################################################### -# Activity Dataclasses +@dataclass +class NsInstantiateInput: + """ + Input dataclass for workflow that instantiate NS. + Attributes: + ----------- + ns_uuid : str + The UUID of the NS as stored in the OSM nsr + 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. + """ + + ns_uuid: str + op_id: str + + +@dataclass +class CharmInfo: + """ + Input dataclass for + + Attributes: + ----------- + app_name : str + + channel: str + + entity_url: str + """ + + app_name: str + channel: str + entity_url: str + + +@dataclass +class VduInstantiateInput: + """ + Input dataclass for workflow that instantiates a VDU. + + vim_uuid: str + + model_name: str + + charm_info : CharmInfo + + """ + + vim_uuid: str + model_name: str + charm_info: CharmInfo + + +@dataclass +class VnfInstantiateInput: + """ + Input dataclass for workflow that instantiates a VNF. + + Attributes: + ----------- + vnfr_uuid : str + The UUID of the VNF which is stored in the OSM vnfrs + collection in Mongo. + + """ + + vnfr_uuid: str + + +@dataclass +class PrepareVnfInput: + """ + Input dataclass for workflow that instantiates a VNF. + + Attributes: + ----------- + vnfr_uuid : str + The UUID of the VNF which is stored in the OSM vnfrs + collection in Mongo. + + """ + + vnfr_uuid: str -class LcmOperationState(IntEnum): - PROCESSING = auto() - COMPLETED = auto() - FAILED = auto() + +####################################################################################### +# Activity Dataclasses @dataclass @@ -123,12 +249,6 @@ class TestVimConnectivityInput: vim_uuid: str -class VimState(IntEnum): - PROCESSING = auto() - ENABLED = auto() - ERROR = auto() - - @dataclass class UpdateVimStateInput: """ @@ -155,11 +275,6 @@ class UpdateVimStateInput: message: str -class VimOperationState(IntEnum): - COMPLETED = auto() - FAILED = auto() - - @dataclass class UpdateVimOperationStateInput: """ @@ -206,3 +321,132 @@ class DeleteVimInput: """ vim_uuid: str + + +@dataclass +class DeployNsInput: + """ + Input dataclass for + + Attributes: + ----------- + ns_uuid : str + The UUID of the NS as stored in the OSM nsr + collection in Mongo + """ + + ns_uuid: str + + +@dataclass +class UpdateNsStateInput: + """ + Input dataclass for updating NS state in the DB + + Attributes: + ----------- + ns_uuid : str + The UUID of the NS as stored in the OSM ns + collection in Mongo + + operational_state : NsState + A representation of the operational state (ENABLED or ERROR) + of the NS. + + message : str + Human readable message providing additional details to the + operational state, such as the error message associated + with the ERROR operational_state. + """ + + ns_uuid: str + state: NsState + message: str + + +@dataclass +class ModelInfo: + """ + Contains the information related to a model. + + Attributes: + ----------- + vim_uuid : str + The UUID of the VIM as stored in the OSM vim_accounts + collection in Mongo. + + model_name : str + Name of the Juju model used to deploy charms. + """ + + vim_uuid: str + model_name: str + + +@dataclass +class ChangeNFStateInput: + """ + Input dataclass for creating a Juju Model. + + Attributes: + ----------- + vnfr_uuid : str + The UUID of the VNF which is stored in the OSM vnfrs + collection in Mongo. + + nf_state : VnfState + A representation of the VNF state (STOPPED or STARTED). + """ + + vnfr_uuid: str + state: VnfState + + +@dataclass +class ChangeNFInstantiationStateInput: + """ + Input dataclass for creating a Juju Model. + + Attributes: + ----------- + vnfr_uuid : str + The UUID of the VNF which is stored in the OSM vnfrs + collection in Mongo. + + nf_instantiation_state : VnfInstantiationState + A representation of the VNF instantiation state (NOT_INSTANTIATED or INSTANTIATED). + + """ + + vnfr_uuid: str + state: VnfInstantiationState + + +@dataclass +class GetTaskQueueInput: + """ + Input dataclass for creating a Juju Model. + + Attributes: + ----------- + vnfr_uuid : str + The UUID of the VNF which is stored in the OSM vnfrs + collection in Mongo. + + """ + + vnfr_uuid: str + + +@dataclass +class GetTaskQueueOutput: + """ + Output dataclass for get task queue activity. + + Attributes: + ----------- + task_queue : str + Name of the queue which is used to Deploy VNF. + """ + + task_queue: str