OSMENG-1048 Implement day1 configuration for VDU
[osm/common.git] / osm_common / dataclasses / temporal_dataclasses.py
index c472ca6..de541f2 100644 (file)
 
 from dataclasses import dataclass
 from enum import auto, IntEnum
+from typing import List
+
+
+#######################################################################################
+# 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 +103,149 @@ class NsLcmOperationInput:
     nslcmop: dict
 
 
-#######################################################################################
-# Activity Dataclasses
+@dataclass
+class CharmInfo:
+    """
+    Input dataclass for
 
+    Attributes:
+    -----------
+    app_name : str
 
-class LcmOperationState(IntEnum):
-    PROCESSING = auto()
-    COMPLETED = auto()
-    FAILED = auto()
+    channel: str
+
+    entity_url: str
+    """
+
+    app_name: str
+    channel: str
+    entity_url: str
+
+
+@dataclass
+class GetVimCloudInput:
+    """
+    Input dataclass for get vim cloud activity.
+
+    Attributes:
+    -----------
+    vnfr_uuid : str
+        The UUID of the VNF which is stored in the OSM vnfrs
+        collection in Mongo.
+
+    """
+
+    vnfr_uuid: str
+
+
+@dataclass
+class GetVimCloudOutput:
+    """
+    Output dataclass for get vim cloud activity.
+
+    Attributes:
+    -----------
+    cloud : str
+        Type of the cloud which is used to Deploy VNF.
+    """
+
+    cloud: str
+
+
+@dataclass
+class VduComputeConstraints:
+    """
+    Input dataclass for VDU constraints
+
+    Attributes:
+    -----------
+    cores : int (Number of virtual CPUs)
+
+    mem: int (GB)
+    """
+
+    cores: int
+    mem: int
+
+
+@dataclass
+class VduInstantiateInput:
+    """
+    Input dataclass for workflow that instantiates a VDU.
+
+    vim_uuid: str
+
+    model_name: str
+
+    charm_info : CharmInfo
+
+    constraints: VduComputeConstraints
+
+    cloud: VIM cloud type
+
+    config: Config details of application
+    """
+
+    vim_uuid: str
+    model_name: str
+    charm_info: CharmInfo
+    constraints: VduComputeConstraints
+    cloud: str
+    config: dict
+
+
+@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.
+
+    model_name: str
+
+    """
+
+    vnfr_uuid: str
+    model_name: str
+
+
+@dataclass
+class GetNsRecordInput:
+    """
+    Input dataclass for getting NS record activity.
+
+    Attributes:
+    -----------
+    nsr_uuid :
+        The UUID of the NS record which is stored in the OSM nsrs
+        collection in Mongo.
+
+    """
+
+    nsr_uuid: str
+
+
+@dataclass
+class GetNsRecordOutput:
+    """
+    Output dataclass for getting NS record activity.
+
+    Attributes:
+    -----------
+    nsr : dict
+        NS record retrieved from Database..
+
+    """
+
+    nsr: dict
+
+
+#######################################################################################
+# Activity Dataclasses
 
 
 @dataclass
@@ -123,12 +301,6 @@ class TestVimConnectivityInput:
     vim_uuid: str
 
 
-class VimState(IntEnum):
-    PROCESSING = auto()
-    ENABLED = auto()
-    ERROR = auto()
-
-
 @dataclass
 class UpdateVimStateInput:
     """
@@ -155,11 +327,6 @@ class UpdateVimStateInput:
     message: str
 
 
-class VimOperationState(IntEnum):
-    COMPLETED = auto()
-    FAILED = auto()
-
-
 @dataclass
 class UpdateVimOperationStateInput:
     """
@@ -206,3 +373,218 @@ 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 CheckCharmStatusInput:
+    """
+    Input dataclass for checking on a specific charm's deployment
+    status
+
+    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 model to create in Juju.
+
+    application_name : str
+        Name of the application that the state is going to be
+        awaited.
+
+    poll_interval : int (optional)
+        Time, in seconds, to wait between status checks.
+    """
+
+    vim_uuid: str
+    model_name: str
+    application_name: str
+    poll_interval: int = 1
+
+
+@dataclass
+class ChangeVnfStateInput:
+    """
+    Input dataclass for changing VNF State.
+
+    Attributes:
+    -----------
+    vnfr_uuid : str
+        The UUID of the VNF which is stored in the OSM vnfrs
+        collection in Mongo.
+
+    state : VnfState
+        A representation of the VNF state (STOPPED or STARTED).
+    """
+
+    vnfr_uuid: str
+    state: VnfState
+
+
+@dataclass
+class ChangeVnfInstantiationStateInput:
+    """
+    Input dataclass for changing VNF Instantiation State.
+
+    Attributes:
+    -----------
+    vnfr_uuid : str
+        The UUID of the VNF which is stored in the OSM vnfrs
+        collection in Mongo.
+
+    state : VnfInstantiationState
+        A representation of the VNF instantiation state (NOT_INSTANTIATED or INSTANTIATED).
+
+    """
+
+    vnfr_uuid: str
+    state: VnfInstantiationState
+
+
+@dataclass
+class GetTaskQueueInput:
+    """
+    Input dataclass for get task queue activity.
+
+    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
+
+
+@dataclass
+class GetVnfDetailsInput:
+    """
+    Input dataclass for get vnf details activity.
+
+    Attributes:
+    -----------
+    vnfr_uuid : str
+        The UUID of the VNF which is stored in the OSM vnfrs
+        collection in Mongo.
+    """
+
+    vnfr_uuid: str
+
+
+@dataclass
+class GetVnfDetailsOutput:
+    """
+    Output dataclass for get vnf details activity.
+
+    Attributes:
+    -----------
+    vnfr : dict
+        VNF record retrieved from Database.
+
+    vnfd : dict
+        VNF descriptor retrieved from Database.
+    """
+
+    vnfr: dict
+    vnfd: dict
+
+
+@dataclass
+class GetVnfRecordIdsInput:
+    """
+    Attributes:
+    -----------
+    ns_uuid : str
+        The UUID of the NS from which to retrieve the VNF records.
+    """
+
+    ns_uuid: str
+
+
+@dataclass
+class GetVnfRecordIdsOutput:
+    """
+    Attributes:
+    -----------
+    vnfr_ids : list[str]
+        List of the VNF record IDs associated with the NS.
+    """
+
+    vnfr_ids: List[str]