blob: c472ca687b20c84fac6da3a5428ff7d652f4e213 [file] [log] [blame]
Mark Beierlb808fea2023-03-22 10:32:45 -04001#######################################################################################
2# Copyright ETSI Contributors and Others.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#######################################################################################
17
18from dataclasses import dataclass
Mark Beierlfd2324b2023-03-29 17:28:49 +000019from enum import auto, IntEnum
Mark Beierlb808fea2023-03-22 10:32:45 -040020
Mark Beierlfd2324b2023-03-29 17:28:49 +000021#######################################################################################
Mark Beierla8d016d2023-03-23 10:24:59 +000022# Workflow Dataclasses
23
24
25@dataclass
Gulsum Atici654c3772023-03-23 15:59:56 +030026class VimOperationInput:
27 """
28 Input dataclass for workflows that perform operations
29 (create, update, delete) on VIMs.
30
31 Attributes:
32 -----------
33 vim_uuid : str
34 The UUID of the VIM account as stored in the OSM vim
35 collection in Mongo
36
37 op_id: str
38 The operation (task) id for this workflow. This is used
39 by the workflow at the end to update the status of the
40 operation in Mongo vim collection.
41 """
Mark Beierl30e05072023-03-28 18:04:47 +000042
Mark Beierla8d016d2023-03-23 10:24:59 +000043 vim_uuid: str
Gulsum Atici654c3772023-03-23 15:59:56 +030044 op_id: str
Mark Beierla8d016d2023-03-23 10:24:59 +000045
46
Mark Beierl248cb402023-04-05 20:01:05 +000047@dataclass
48class NsLcmOperationInput:
49 """
50 Input dataclass for workflows that run as LCM operations.
51
52 Attributes:
53 -----------
54
55 nslcmop: dict
56 A dictionary representing the nslcmop record from the
57 database.
58 """
59
60 nslcmop: dict
61
62
Mark Beierlfd2324b2023-03-29 17:28:49 +000063#######################################################################################
Mark Beierla8d016d2023-03-23 10:24:59 +000064# Activity Dataclasses
65
Mark Beierlb808fea2023-03-22 10:32:45 -040066
Mark Beierl248cb402023-04-05 20:01:05 +000067class LcmOperationState(IntEnum):
68 PROCESSING = auto()
69 COMPLETED = auto()
70 FAILED = auto()
71
72
73@dataclass
74class UpdateLcmOperationStateInput:
75 """
76 Input dataclass for updating LCM Operations in the Mongo nslcmops
77 collection. The following attributes will be updated automatically
78 - statusEnteredTime
79 - _admin.modified
80
81 Attributes:
82 -----------
83 op_id: str
84 The operation (task) id for this activity. This is the key
85 to the record in nslcmops collection that will be updated.
86
87 op_state : LcmOperationState
88 A representation of the state of the specified operation id,
89 such as PROCESSING, COMPLETED, or FAILED.
90
91 stage: str
92 Human readable checkpoint message, intended only to give the
93 user feedback.
94
95 error_message: str
96 Human readable error message if any failure occurred.
97
98 detailed_status : str
99 Human readable message providing additional details to the
100 operation state, such as the error message explaining why
101 the operation failed.
102 """
103
104 op_id: str
105 op_state: LcmOperationState
106 stage: str
107 error_message: str
108 detailed_status: str
109
110
Mark Beierlb808fea2023-03-22 10:32:45 -0400111@dataclass
112class TestVimConnectivityInput:
Gulsum Atici654c3772023-03-23 15:59:56 +0300113 """
114 Input dataclass for the Test Vim Connectivity Ativity
Mark Beierlb808fea2023-03-22 10:32:45 -0400115
Gulsum Atici654c3772023-03-23 15:59:56 +0300116 Attributes:
117 -----------
118 vim_uuid : str
119 The UUID of the VIM account as stored in the OSM vim
120 collection in Mongo
121 """
Mark Beierl30e05072023-03-28 18:04:47 +0000122
Mark Beierlb808fea2023-03-22 10:32:45 -0400123 vim_uuid: str
124
Mark Beierla8d016d2023-03-23 10:24:59 +0000125
Mark Beierlfd2324b2023-03-29 17:28:49 +0000126class VimState(IntEnum):
127 PROCESSING = auto()
128 ENABLED = auto()
129 ERROR = auto()
130
131
Mark Beierla8d016d2023-03-23 10:24:59 +0000132@dataclass
Gulsum Atici654c3772023-03-23 15:59:56 +0300133class UpdateVimStateInput:
134 """
135 Input dataclass for updating VIM state in the DB
136
137 Attributes:
138 -----------
139 vim_uuid : str
140 The UUID of the VIM account as stored in the OSM vim
141 collection in Mongo
142
Mark Beierlfd2324b2023-03-29 17:28:49 +0000143 operational_state : VimState
Gulsum Atici654c3772023-03-23 15:59:56 +0300144 A representation of the operational state (ENABLED or ERROR)
145 of the VIM.
146
147 message : str
148 Human readable message providing additional details to the
149 operational state, such as the error message associated
150 with the ERROR operational_state.
151 """
Mark Beierl30e05072023-03-28 18:04:47 +0000152
Gulsum Atici654c3772023-03-23 15:59:56 +0300153 vim_uuid: str
Mark Beierlfd2324b2023-03-29 17:28:49 +0000154 operational_state: VimState
Gulsum Atici654c3772023-03-23 15:59:56 +0300155 message: str
156
157
Mark Beierlfd2324b2023-03-29 17:28:49 +0000158class VimOperationState(IntEnum):
159 COMPLETED = auto()
160 FAILED = auto()
161
162
Gulsum Atici654c3772023-03-23 15:59:56 +0300163@dataclass
164class UpdateVimOperationStateInput:
165 """
166 Input dataclass for updating VIM Operations in the Mongo VIM
167 collection.
168
169 Attributes:
170 -----------
171 vim_uuid : str
172 The UUID of the VIM account as stored in the OSM vim
173 collection in Mongo
174
175 op_id: str
176 The operation (task) id for this workflow. This is used
177 to update the status of the operation in Mongo vim collection.
178
Mark Beierlfd2324b2023-03-29 17:28:49 +0000179 op_state : VimOperationState
Gulsum Atici654c3772023-03-23 15:59:56 +0300180 A representation of the state of the specified operation id,
181 such as COMPLETED, or FAILED.
182
183 message : str
184 Human readable message providing additional details to the
185 operation state, such as the error message explaining why
186 the operation failed.
187 """
Mark Beierl30e05072023-03-28 18:04:47 +0000188
Gulsum Atici654c3772023-03-23 15:59:56 +0300189 vim_uuid: str
190 op_id: str
Mark Beierlfd2324b2023-03-29 17:28:49 +0000191 op_state: VimOperationState
Gulsum Atici654c3772023-03-23 15:59:56 +0300192 message: str
Mark Beierl30e05072023-03-28 18:04:47 +0000193
194
195@dataclass
196class DeleteVimInput:
197 """
198 Input dataclass for deleting vim record from the database
199
200 Attributes:
201 -----------
202 vim_uuid : str
203 The UUID of the VIM account as stored in the OSM vim
204 collection in Mongo
205
206 """
207
208 vim_uuid: str