blob: a0e3d19bd066a750f2349937fcf47280e02ae183 [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
Gulsum Atici2f081e42023-04-06 13:41:36 +030021
22#######################################################################################
23# Defining States
24class VimState(IntEnum):
25 PROCESSING = auto()
26 ENABLED = auto()
27 ERROR = auto()
28
29
30class VimOperationState(IntEnum):
31 COMPLETED = auto()
32 FAILED = auto()
33
34
35class NsState(IntEnum):
36 PROCESSING = auto()
37 INSTANTIATED = auto()
38 ERROR = auto()
39
40
41class VnfLcmOperationState(IntEnum):
42 PROCESSING = auto()
43 COMPLETED = auto()
44 FAILED = auto()
45
46
47class VnfInstantiationState(IntEnum):
48 NOT_INSTANTIATED = auto()
49 INSTANTIATED = auto()
50
51
52class VnfState(IntEnum):
53 STOPPED = auto()
54 STARTED = auto()
55
56
57class LcmOperationState(IntEnum):
58 PROCESSING = auto()
59 COMPLETED = auto()
60 FAILED = auto()
61
62
Mark Beierlfd2324b2023-03-29 17:28:49 +000063#######################################################################################
Mark Beierla8d016d2023-03-23 10:24:59 +000064# Workflow Dataclasses
65
66
67@dataclass
Gulsum Atici654c3772023-03-23 15:59:56 +030068class VimOperationInput:
69 """
70 Input dataclass for workflows that perform operations
71 (create, update, delete) on VIMs.
72
73 Attributes:
74 -----------
75 vim_uuid : str
76 The UUID of the VIM account as stored in the OSM vim
77 collection in Mongo
78
79 op_id: str
80 The operation (task) id for this workflow. This is used
81 by the workflow at the end to update the status of the
82 operation in Mongo vim collection.
83 """
Mark Beierl30e05072023-03-28 18:04:47 +000084
Mark Beierla8d016d2023-03-23 10:24:59 +000085 vim_uuid: str
Gulsum Atici654c3772023-03-23 15:59:56 +030086 op_id: str
Mark Beierla8d016d2023-03-23 10:24:59 +000087
88
Mark Beierl248cb402023-04-05 20:01:05 +000089@dataclass
90class NsLcmOperationInput:
91 """
92 Input dataclass for workflows that run as LCM operations.
93
94 Attributes:
95 -----------
96
97 nslcmop: dict
98 A dictionary representing the nslcmop record from the
99 database.
100 """
101
102 nslcmop: dict
103
104
Patricia Reinoso36a62b82023-03-31 11:22:42 +0000105@dataclass
106class NsInstantiateInput:
107 """
108 Input dataclass for workflow that instantiate NS.
109
110 Attributes:
111 -----------
112 ns_uuid : str
113 The UUID of the NS as stored in the OSM nsr
114 collection in Mongo
115
116 op_id: str
117 The operation (task) id for this workflow. This is used
118 by the workflow at the end to update the status of the
119 operation in Mongo vim collection.
120 """
121
122 ns_uuid: str
123 op_id: str
124
125
126@dataclass
127class CharmInfo:
128 """
129 Input dataclass for
130
131 Attributes:
132 -----------
133 app_name : str
134
135 channel: str
136
137 entity_url: str
138 """
139
140 app_name: str
141 channel: str
142 entity_url: str
143
144
145@dataclass
146class VduInstantiateInput:
147 """
148 Input dataclass for workflow that instantiates a VDU.
149
150 vim_uuid: str
151
152 model_name: str
153
154 charm_info : CharmInfo
155
156 """
157
158 vim_uuid: str
159 model_name: str
160 charm_info: CharmInfo
161
162
Gulsum Atici2f081e42023-04-06 13:41:36 +0300163@dataclass
164class VnfInstantiateInput:
165 """
166 Input dataclass for workflow that instantiates a VNF.
167
168 Attributes:
169 -----------
170 vnfr_uuid : str
171 The UUID of the VNF which is stored in the OSM vnfrs
172 collection in Mongo.
173
174 """
175
176 vnfr_uuid: str
177
178
179@dataclass
180class PrepareVnfInput:
181 """
182 Input dataclass for workflow that instantiates a VNF.
183
184 Attributes:
185 -----------
186 vnfr_uuid : str
187 The UUID of the VNF which is stored in the OSM vnfrs
188 collection in Mongo.
189
190 """
191
192 vnfr_uuid: str
193
194
Mark Beierlfd2324b2023-03-29 17:28:49 +0000195#######################################################################################
Mark Beierla8d016d2023-03-23 10:24:59 +0000196# Activity Dataclasses
197
Mark Beierlb808fea2023-03-22 10:32:45 -0400198
Mark Beierl248cb402023-04-05 20:01:05 +0000199@dataclass
200class UpdateLcmOperationStateInput:
201 """
202 Input dataclass for updating LCM Operations in the Mongo nslcmops
203 collection. The following attributes will be updated automatically
204 - statusEnteredTime
205 - _admin.modified
206
207 Attributes:
208 -----------
209 op_id: str
210 The operation (task) id for this activity. This is the key
211 to the record in nslcmops collection that will be updated.
212
213 op_state : LcmOperationState
214 A representation of the state of the specified operation id,
215 such as PROCESSING, COMPLETED, or FAILED.
216
217 stage: str
218 Human readable checkpoint message, intended only to give the
219 user feedback.
220
221 error_message: str
222 Human readable error message if any failure occurred.
223
224 detailed_status : str
225 Human readable message providing additional details to the
226 operation state, such as the error message explaining why
227 the operation failed.
228 """
229
230 op_id: str
231 op_state: LcmOperationState
232 stage: str
233 error_message: str
234 detailed_status: str
235
236
Mark Beierlb808fea2023-03-22 10:32:45 -0400237@dataclass
238class TestVimConnectivityInput:
Gulsum Atici654c3772023-03-23 15:59:56 +0300239 """
240 Input dataclass for the Test Vim Connectivity Ativity
Mark Beierlb808fea2023-03-22 10:32:45 -0400241
Gulsum Atici654c3772023-03-23 15:59:56 +0300242 Attributes:
243 -----------
244 vim_uuid : str
245 The UUID of the VIM account as stored in the OSM vim
246 collection in Mongo
247 """
Mark Beierl30e05072023-03-28 18:04:47 +0000248
Mark Beierlb808fea2023-03-22 10:32:45 -0400249 vim_uuid: str
250
Mark Beierla8d016d2023-03-23 10:24:59 +0000251
252@dataclass
Gulsum Atici654c3772023-03-23 15:59:56 +0300253class UpdateVimStateInput:
254 """
255 Input dataclass for updating VIM state in the DB
256
257 Attributes:
258 -----------
259 vim_uuid : str
260 The UUID of the VIM account as stored in the OSM vim
261 collection in Mongo
262
Mark Beierlfd2324b2023-03-29 17:28:49 +0000263 operational_state : VimState
Gulsum Atici654c3772023-03-23 15:59:56 +0300264 A representation of the operational state (ENABLED or ERROR)
265 of the VIM.
266
267 message : str
268 Human readable message providing additional details to the
269 operational state, such as the error message associated
270 with the ERROR operational_state.
271 """
Mark Beierl30e05072023-03-28 18:04:47 +0000272
Gulsum Atici654c3772023-03-23 15:59:56 +0300273 vim_uuid: str
Mark Beierlfd2324b2023-03-29 17:28:49 +0000274 operational_state: VimState
Gulsum Atici654c3772023-03-23 15:59:56 +0300275 message: str
276
277
278@dataclass
279class UpdateVimOperationStateInput:
280 """
281 Input dataclass for updating VIM Operations in the Mongo VIM
282 collection.
283
284 Attributes:
285 -----------
286 vim_uuid : str
287 The UUID of the VIM account as stored in the OSM vim
288 collection in Mongo
289
290 op_id: str
291 The operation (task) id for this workflow. This is used
292 to update the status of the operation in Mongo vim collection.
293
Mark Beierlfd2324b2023-03-29 17:28:49 +0000294 op_state : VimOperationState
Gulsum Atici654c3772023-03-23 15:59:56 +0300295 A representation of the state of the specified operation id,
296 such as COMPLETED, or FAILED.
297
298 message : str
299 Human readable message providing additional details to the
300 operation state, such as the error message explaining why
301 the operation failed.
302 """
Mark Beierl30e05072023-03-28 18:04:47 +0000303
Gulsum Atici654c3772023-03-23 15:59:56 +0300304 vim_uuid: str
305 op_id: str
Mark Beierlfd2324b2023-03-29 17:28:49 +0000306 op_state: VimOperationState
Gulsum Atici654c3772023-03-23 15:59:56 +0300307 message: str
Mark Beierl30e05072023-03-28 18:04:47 +0000308
309
310@dataclass
311class DeleteVimInput:
312 """
313 Input dataclass for deleting vim record from the database
314
315 Attributes:
316 -----------
317 vim_uuid : str
318 The UUID of the VIM account as stored in the OSM vim
319 collection in Mongo
320
321 """
322
323 vim_uuid: str
Patricia Reinoso36a62b82023-03-31 11:22:42 +0000324
325
326@dataclass
327class DeployNsInput:
328 """
329 Input dataclass for
330
331 Attributes:
332 -----------
333 ns_uuid : str
334 The UUID of the NS as stored in the OSM nsr
335 collection in Mongo
336 """
337
338 ns_uuid: str
339
340
Patricia Reinoso36a62b82023-03-31 11:22:42 +0000341@dataclass
342class UpdateNsStateInput:
343 """
344 Input dataclass for updating NS state in the DB
345
346 Attributes:
347 -----------
348 ns_uuid : str
349 The UUID of the NS as stored in the OSM ns
350 collection in Mongo
351
352 operational_state : NsState
353 A representation of the operational state (ENABLED or ERROR)
354 of the NS.
355
356 message : str
357 Human readable message providing additional details to the
358 operational state, such as the error message associated
359 with the ERROR operational_state.
360 """
361
362 ns_uuid: str
363 state: NsState
364 message: str
365
366
367@dataclass
Patricia Reinoso4ddf2c72023-04-12 15:57:25 +0000368class ModelInfo:
Patricia Reinoso36a62b82023-03-31 11:22:42 +0000369 """
Patricia Reinoso4ddf2c72023-04-12 15:57:25 +0000370 Contains the information related to a model.
Patricia Reinoso36a62b82023-03-31 11:22:42 +0000371
372 Attributes:
373 -----------
374 vim_uuid : str
375 The UUID of the VIM as stored in the OSM vim_accounts
376 collection in Mongo.
377
378 model_name : str
Patricia Reinoso4ddf2c72023-04-12 15:57:25 +0000379 Name of the Juju model used to deploy charms.
Patricia Reinoso36a62b82023-03-31 11:22:42 +0000380 """
381
382 vim_uuid: str
383 model_name: str
Gulsum Atici2f081e42023-04-06 13:41:36 +0300384
385
386@dataclass
387class ChangeNFStateInput:
388 """
389 Input dataclass for creating a Juju Model.
390
391 Attributes:
392 -----------
393 vnfr_uuid : str
394 The UUID of the VNF which is stored in the OSM vnfrs
395 collection in Mongo.
396
397 nf_state : VnfState
398 A representation of the VNF state (STOPPED or STARTED).
399 """
400
401 vnfr_uuid: str
402 state: VnfState
403
404
405@dataclass
406class ChangeNFInstantiationStateInput:
407 """
408 Input dataclass for creating a Juju Model.
409
410 Attributes:
411 -----------
412 vnfr_uuid : str
413 The UUID of the VNF which is stored in the OSM vnfrs
414 collection in Mongo.
415
416 nf_instantiation_state : VnfInstantiationState
417 A representation of the VNF instantiation state (NOT_INSTANTIATED or INSTANTIATED).
418
419 """
420
421 vnfr_uuid: str
422 state: VnfInstantiationState
423
424
425@dataclass
426class GetTaskQueueInput:
427 """
428 Input dataclass for creating a Juju Model.
429
430 Attributes:
431 -----------
432 vnfr_uuid : str
433 The UUID of the VNF which is stored in the OSM vnfrs
434 collection in Mongo.
435
436 """
437
438 vnfr_uuid: str
439
440
441@dataclass
442class GetTaskQueueOutput:
443 """
444 Output dataclass for get task queue activity.
445
446 Attributes:
447 -----------
448 task_queue : str
449 Name of the queue which is used to Deploy VNF.
450 """
451
452 task_queue: str