| ####################################################################################### |
| # 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. |
| ####################################################################################### |
| |
| from dataclasses import dataclass |
| from enum import auto, IntEnum |
| |
| ####################################################################################### |
| # Workflow Dataclasses |
| |
| |
| @dataclass |
| 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 |
| |
| |
| @dataclass |
| class NsLcmOperationInput: |
| """ |
| Input dataclass for workflows that run as LCM operations. |
| |
| Attributes: |
| ----------- |
| |
| nslcmop: dict |
| A dictionary representing the nslcmop record from the |
| database. |
| """ |
| |
| nslcmop: dict |
| |
| |
| ####################################################################################### |
| # Activity Dataclasses |
| |
| |
| class LcmOperationState(IntEnum): |
| PROCESSING = auto() |
| COMPLETED = auto() |
| FAILED = auto() |
| |
| |
| @dataclass |
| class UpdateLcmOperationStateInput: |
| """ |
| Input dataclass for updating LCM Operations in the Mongo nslcmops |
| collection. The following attributes will be updated automatically |
| - statusEnteredTime |
| - _admin.modified |
| |
| Attributes: |
| ----------- |
| op_id: str |
| The operation (task) id for this activity. This is the key |
| to the record in nslcmops collection that will be updated. |
| |
| op_state : LcmOperationState |
| A representation of the state of the specified operation id, |
| such as PROCESSING, COMPLETED, or FAILED. |
| |
| stage: str |
| Human readable checkpoint message, intended only to give the |
| user feedback. |
| |
| error_message: str |
| Human readable error message if any failure occurred. |
| |
| detailed_status : str |
| Human readable message providing additional details to the |
| operation state, such as the error message explaining why |
| the operation failed. |
| """ |
| |
| op_id: str |
| op_state: LcmOperationState |
| stage: str |
| error_message: str |
| detailed_status: str |
| |
| |
| @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. |
| |
| 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 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 |