Adding VNF workflow constants and data_classes 65/13165/2
authorGulsum Atici <gulsum.atici@canonical.com>
Thu, 6 Apr 2023 10:41:36 +0000 (13:41 +0300)
committerGulsum Atici <gulsum.atici@canonical.com>
Thu, 6 Apr 2023 12:11:34 +0000 (15:11 +0300)
Change-Id: Ia32d3c996dafe238bb2cd6d825f28213bc0a2ef1
Signed-off-by: Gulsum Atici <gulsum.atici@canonical.com>
osm_common/dataclasses/temporal_dataclasses.py
osm_common/temporal_constants.py
releasenotes/notes/add_vnf_workflow_contansts-9c4eab2e29aa0be5.yaml [new file with mode: 0644]

index 9bd6378..953c95f 100644 (file)
 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
 
@@ -118,14 +160,40 @@ class VduInstantiateInput:
     charm_info: CharmInfo
 
 
-#######################################################################################
-# Activity Dataclasses
+@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.
 
+    """
 
-class LcmOperationState(IntEnum):
-    PROCESSING = auto()
-    COMPLETED = auto()
-    FAILED = auto()
+    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
+
+
+#######################################################################################
+# Activity Dataclasses
 
 
 @dataclass
@@ -181,12 +249,6 @@ class TestVimConnectivityInput:
     vim_uuid: str
 
 
-class VimState(IntEnum):
-    PROCESSING = auto()
-    ENABLED = auto()
-    ERROR = auto()
-
-
 @dataclass
 class UpdateVimStateInput:
     """
@@ -213,11 +275,6 @@ class UpdateVimStateInput:
     message: str
 
 
-class VimOperationState(IntEnum):
-    COMPLETED = auto()
-    FAILED = auto()
-
-
 @dataclass
 class UpdateVimOperationStateInput:
     """
@@ -281,12 +338,6 @@ class DeployNsInput:
     ns_uuid: str
 
 
-class NsState(IntEnum):
-    PROCESSING = auto()
-    INSTANTIATED = auto()
-    ERROR = auto()
-
-
 @dataclass
 class UpdateNsStateInput:
     """
@@ -330,3 +381,72 @@ class CreateModelInput:
 
     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
index 38a032f..063860f 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #######################################################################################
-
+# Task Queues
 LCM_TASK_QUEUE = "lcm-task-queue"
 
+# Vim Type-Task Queue Mappings
+vim_type_task_queue_mappings = {
+    "paas": LCM_TASK_QUEUE,
+}
+
 # Activities
 ACTIVITY_NSLCM_NO_OP = "nslcm-no-op"
 ACTIVITY_EXECUTE_NS_LCM_WORKFLOW = "execute-ns-lcm-workflow"
@@ -25,7 +30,6 @@ ACTIVITY_DELETE_VIM = "delete-vim"
 ACTIVITY_TEST_VIM_CONNECTIVITY = "test-vim-connectivity"
 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"
 ACTIVITY_PREPARE_VNF_RECORDS = "prepare-vnf-records"
 ACTIVITY_DEPLOY_NS = "deploy-ns"
 ACTIVITY_UPDATE_NS_STATE = "update-ns-state"
@@ -33,6 +37,10 @@ ACTIVITY_CHECK_NS_INSTANTIATION_FINISHED = "check-ns-instantiation-finish"
 ACTIVITY_CREATE_MODEL_IF_DOESNT_EXIST = "create-model-if-doesnt-exist"
 ACTIVITY_DEPLOY_CHARM = "deploy-charm"
 ACTIVITY_CHECK_CHARM_STATUS = "check-charm-status"
+ACTIVITY_CHANGE_NF_STATE = "change_nf_state"
+ACTIVITY_CHANGE_NF_INSTANTIATION_STATE = "change_nf_instantiation_state"
+ACTIVITY_CHANGE_NF_NOTIFICATION_STATE = "change_nf_notification_state"
+ACTIVITY_GET_TASK_QUEUE = "get_task_queue"
 
 # Workflows
 WORKFLOW_NSLCM_NO_OP = "nslcm-no-op"
@@ -41,3 +49,5 @@ WORKFLOW_VIM_UPDATE = "vim-update"
 WORKFLOW_VIM_DELETE = "vim-delete"
 WORKFLOW_NS_INSTANTIATE = "ns-instantiate"
 WORKFLOW_VDU_INSTANTIATE = "vdu-instantiate"
+WORKFLOW_VNF_INSTANTIATE = "vnf-instantiate"
+WORKFLOW_VNF_PREPARE = "vnf-prepare"
diff --git a/releasenotes/notes/add_vnf_workflow_contansts-9c4eab2e29aa0be5.yaml b/releasenotes/notes/add_vnf_workflow_contansts-9c4eab2e29aa0be5.yaml
new file mode 100644 (file)
index 0000000..2a0df53
--- /dev/null
@@ -0,0 +1,21 @@
+#######################################################################################
+# Copyright ETSI Contributors and Others.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#######################################################################################
+---
+other:
+  - |
+    Adding VNF workflow constants and data_classes.
+