From 36a62b88b9ad60b2355fab6ab2868c5f10b192c7 Mon Sep 17 00:00:00 2001 From: Patricia Reinoso Date: Fri, 31 Mar 2023 11:22:42 +0000 Subject: [PATCH] Add Dataclasses and constant for NS instantiate Change-Id: Iac6b0782bbb8a69edb56b4d7df6203b2ac92bd92 Signed-off-by: Patricia Reinoso Signed-off-by: Mark Beierl --- .../dataclasses/temporal_dataclasses.py | 124 ++++++++++++++++++ osm_common/temporal_constants.py | 9 ++ .../dummy-releasenote-e933e2f5490198f1.yaml | 17 +++ 3 files changed, 150 insertions(+) create mode 100644 releasenotes/notes/dummy-releasenote-e933e2f5490198f1.yaml diff --git a/osm_common/dataclasses/temporal_dataclasses.py b/osm_common/dataclasses/temporal_dataclasses.py index c472ca6..9bd6378 100644 --- a/osm_common/dataclasses/temporal_dataclasses.py +++ b/osm_common/dataclasses/temporal_dataclasses.py @@ -60,6 +60,64 @@ class NsLcmOperationInput: nslcmop: dict +@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 + + ####################################################################################### # Activity Dataclasses @@ -206,3 +264,69 @@ 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 + + +class NsState(IntEnum): + PROCESSING = auto() + INSTANTIATED = auto() + ERROR = auto() + + +@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 CreateModelInput: + """ + Input dataclass for creating a Juju 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 model to create in Juju. + """ + + vim_uuid: str + model_name: str diff --git a/osm_common/temporal_constants.py b/osm_common/temporal_constants.py index e9a0383..38a032f 100644 --- a/osm_common/temporal_constants.py +++ b/osm_common/temporal_constants.py @@ -26,9 +26,18 @@ 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" +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" # Workflows WORKFLOW_NSLCM_NO_OP = "nslcm-no-op" WORKFLOW_VIM_CREATE = "vim-create" WORKFLOW_VIM_UPDATE = "vim-update" WORKFLOW_VIM_DELETE = "vim-delete" +WORKFLOW_NS_INSTANTIATE = "ns-instantiate" +WORKFLOW_VDU_INSTANTIATE = "vdu-instantiate" diff --git a/releasenotes/notes/dummy-releasenote-e933e2f5490198f1.yaml b/releasenotes/notes/dummy-releasenote-e933e2f5490198f1.yaml new file mode 100644 index 0000000..db22e50 --- /dev/null +++ b/releasenotes/notes/dummy-releasenote-e933e2f5490198f1.yaml @@ -0,0 +1,17 @@ +####################################################################################### +# 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. +####################################################################################### +--- -- 2.25.1