Remove unused constants
[osm/common.git] / osm_common / dataclasses / temporal_dataclasses.py
1 #######################################################################################
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
18 from dataclasses import dataclass
19 from enum import auto, IntEnum
20 from typing import List
21
22
23 #######################################################################################
24 # Defining States
25 class VimState(IntEnum):
26 PROCESSING = auto()
27 ENABLED = auto()
28 ERROR = auto()
29
30
31 class VimOperationState(IntEnum):
32 COMPLETED = auto()
33 FAILED = auto()
34
35
36 class NsState(IntEnum):
37 PROCESSING = auto()
38 INSTANTIATED = auto()
39 ERROR = auto()
40
41
42 class VnfLcmOperationState(IntEnum):
43 PROCESSING = auto()
44 COMPLETED = auto()
45 FAILED = auto()
46
47
48 class VnfInstantiationState(IntEnum):
49 NOT_INSTANTIATED = auto()
50 INSTANTIATED = auto()
51
52
53 class VnfState(IntEnum):
54 STOPPED = auto()
55 STARTED = auto()
56
57
58 class LcmOperationState(IntEnum):
59 PROCESSING = auto()
60 COMPLETED = auto()
61 FAILED = auto()
62
63
64 #######################################################################################
65 # Workflow Dataclasses
66
67
68 @dataclass
69 class VimOperationInput:
70 """
71 Input dataclass for workflows that perform operations
72 (create, update, delete) on VIMs.
73
74 Attributes:
75 -----------
76 vim_uuid : str
77 The UUID of the VIM account as stored in the OSM vim
78 collection in Mongo
79
80 op_id: str
81 The operation (task) id for this workflow. This is used
82 by the workflow at the end to update the status of the
83 operation in Mongo vim collection.
84 """
85
86 vim_uuid: str
87 op_id: str
88
89
90 @dataclass
91 class NsLcmOperationInput:
92 """
93 Input dataclass for workflows that run as LCM operations.
94
95 Attributes:
96 -----------
97
98 nslcmop: dict
99 A dictionary representing the nslcmop record from the
100 database.
101 """
102
103 nslcmop: dict
104
105
106 @dataclass
107 class CharmInfo:
108 """
109 Input dataclass for
110
111 Attributes:
112 -----------
113 app_name : str
114
115 channel: str
116
117 entity_url: str
118 """
119
120 app_name: str
121 channel: str
122 entity_url: str
123
124
125 @dataclass
126 class VduInstantiateInput:
127 """
128 Input dataclass for workflow that instantiates a VDU.
129
130 vim_uuid: str
131
132 model_name: str
133
134 charm_info : CharmInfo
135
136 """
137
138 vim_uuid: str
139 model_name: str
140 charm_info: CharmInfo
141
142
143 @dataclass
144 class VnfInstantiateInput:
145 """
146 Input dataclass for workflow that instantiates a VNF.
147
148 Attributes:
149 -----------
150 vnfr_uuid : str
151 The UUID of the VNF which is stored in the OSM vnfrs
152 collection in Mongo.
153
154 model_name: str
155
156 """
157
158 vnfr_uuid: str
159 model_name: str
160
161
162 #######################################################################################
163 # Activity Dataclasses
164
165
166 @dataclass
167 class UpdateLcmOperationStateInput:
168 """
169 Input dataclass for updating LCM Operations in the Mongo nslcmops
170 collection. The following attributes will be updated automatically
171 - statusEnteredTime
172 - _admin.modified
173
174 Attributes:
175 -----------
176 op_id: str
177 The operation (task) id for this activity. This is the key
178 to the record in nslcmops collection that will be updated.
179
180 op_state : LcmOperationState
181 A representation of the state of the specified operation id,
182 such as PROCESSING, COMPLETED, or FAILED.
183
184 stage: str
185 Human readable checkpoint message, intended only to give the
186 user feedback.
187
188 error_message: str
189 Human readable error message if any failure occurred.
190
191 detailed_status : str
192 Human readable message providing additional details to the
193 operation state, such as the error message explaining why
194 the operation failed.
195 """
196
197 op_id: str
198 op_state: LcmOperationState
199 stage: str
200 error_message: str
201 detailed_status: str
202
203
204 @dataclass
205 class TestVimConnectivityInput:
206 """
207 Input dataclass for the Test Vim Connectivity Ativity
208
209 Attributes:
210 -----------
211 vim_uuid : str
212 The UUID of the VIM account as stored in the OSM vim
213 collection in Mongo
214 """
215
216 vim_uuid: str
217
218
219 @dataclass
220 class UpdateVimStateInput:
221 """
222 Input dataclass for updating VIM state in the DB
223
224 Attributes:
225 -----------
226 vim_uuid : str
227 The UUID of the VIM account as stored in the OSM vim
228 collection in Mongo
229
230 operational_state : VimState
231 A representation of the operational state (ENABLED or ERROR)
232 of the VIM.
233
234 message : str
235 Human readable message providing additional details to the
236 operational state, such as the error message associated
237 with the ERROR operational_state.
238 """
239
240 vim_uuid: str
241 operational_state: VimState
242 message: str
243
244
245 @dataclass
246 class UpdateVimOperationStateInput:
247 """
248 Input dataclass for updating VIM Operations in the Mongo VIM
249 collection.
250
251 Attributes:
252 -----------
253 vim_uuid : str
254 The UUID of the VIM account as stored in the OSM vim
255 collection in Mongo
256
257 op_id: str
258 The operation (task) id for this workflow. This is used
259 to update the status of the operation in Mongo vim collection.
260
261 op_state : VimOperationState
262 A representation of the state of the specified operation id,
263 such as COMPLETED, or FAILED.
264
265 message : str
266 Human readable message providing additional details to the
267 operation state, such as the error message explaining why
268 the operation failed.
269 """
270
271 vim_uuid: str
272 op_id: str
273 op_state: VimOperationState
274 message: str
275
276
277 @dataclass
278 class DeleteVimInput:
279 """
280 Input dataclass for deleting vim record from the database
281
282 Attributes:
283 -----------
284 vim_uuid : str
285 The UUID of the VIM account as stored in the OSM vim
286 collection in Mongo
287
288 """
289
290 vim_uuid: str
291
292
293 @dataclass
294 class DeployNsInput:
295 """
296 Input dataclass for
297
298 Attributes:
299 -----------
300 ns_uuid : str
301 The UUID of the NS as stored in the OSM nsr
302 collection in Mongo
303 """
304
305 ns_uuid: str
306
307
308 @dataclass
309 class UpdateNsStateInput:
310 """
311 Input dataclass for updating NS state in the DB
312
313 Attributes:
314 -----------
315 ns_uuid : str
316 The UUID of the NS as stored in the OSM ns
317 collection in Mongo
318
319 operational_state : NsState
320 A representation of the operational state (ENABLED or ERROR)
321 of the NS.
322
323 message : str
324 Human readable message providing additional details to the
325 operational state, such as the error message associated
326 with the ERROR operational_state.
327 """
328
329 ns_uuid: str
330 state: NsState
331 message: str
332
333
334 @dataclass
335 class ModelInfo:
336 """
337 Contains the information related to a model.
338
339 Attributes:
340 -----------
341 vim_uuid : str
342 The UUID of the VIM as stored in the OSM vim_accounts
343 collection in Mongo.
344
345 model_name : str
346 Name of the Juju model used to deploy charms.
347 """
348
349 vim_uuid: str
350 model_name: str
351
352
353 @dataclass
354 class CheckCharmStatusInput:
355 """
356 Input dataclass for checking on a specific charm's deployment
357 status
358
359 Attributes:
360 -----------
361 vim_uuid : str
362 The UUID of the VIM as stored in the OSM vim_accounts
363 collection in Mongo.
364
365 model_name : str
366 Name of the model to create in Juju.
367
368 application_name : str
369 Name of the application that the state is going to be
370 awaited.
371
372 poll_interval : int (optional)
373 Time, in seconds, to wait between status checks.
374 """
375
376 vim_uuid: str
377 model_name: str
378 application_name: str
379 poll_interval: int = 1
380
381
382 @dataclass
383 class ChangeVnfStateInput:
384 """
385 Input dataclass for changing VNF State.
386
387 Attributes:
388 -----------
389 vnfr_uuid : str
390 The UUID of the VNF which is stored in the OSM vnfrs
391 collection in Mongo.
392
393 state : VnfState
394 A representation of the VNF state (STOPPED or STARTED).
395 """
396
397 vnfr_uuid: str
398 state: VnfState
399
400
401 @dataclass
402 class ChangeVnfInstantiationStateInput:
403 """
404 Input dataclass for changing VNF Instantiation State.
405
406 Attributes:
407 -----------
408 vnfr_uuid : str
409 The UUID of the VNF which is stored in the OSM vnfrs
410 collection in Mongo.
411
412 state : VnfInstantiationState
413 A representation of the VNF instantiation state (NOT_INSTANTIATED or INSTANTIATED).
414
415 """
416
417 vnfr_uuid: str
418 state: VnfInstantiationState
419
420
421 @dataclass
422 class GetTaskQueueInput:
423 """
424 Input dataclass for get task queue activity.
425
426 Attributes:
427 -----------
428 vnfr_uuid : str
429 The UUID of the VNF which is stored in the OSM vnfrs
430 collection in Mongo.
431
432 """
433
434 vnfr_uuid: str
435
436
437 @dataclass
438 class GetTaskQueueOutput:
439 """
440 Output dataclass for get task queue activity.
441
442 Attributes:
443 -----------
444 task_queue : str
445 Name of the queue which is used to Deploy VNF.
446 """
447
448 task_queue: str
449
450
451 @dataclass
452 class GetVnfDetailsInput:
453 """
454 Input dataclass for get vnf details activity.
455
456 Attributes:
457 -----------
458 vnfr_uuid : str
459 The UUID of the VNF which is stored in the OSM vnfrs
460 collection in Mongo.
461 """
462
463 vnfr_uuid: str
464
465
466 @dataclass
467 class GetVnfDetailsOutput:
468 """
469 Output dataclass for get vnf details activity.
470
471 Attributes:
472 -----------
473 vnfr : dict
474 VNF record retrieved from Database.
475
476 vnfd : dict
477 VNF descriptor retrieved from Database.
478 """
479
480 vnfr: dict
481 vnfd: dict
482
483
484 @dataclass
485 class GetVnfRecordIdsInput:
486 """
487 Attributes:
488 -----------
489 ns_uuid : str
490 The UUID of the NS from which to retrieve the VNF records.
491 """
492
493 ns_uuid: str
494
495
496 @dataclass
497 class GetVnfRecordIdsOutput:
498 """
499 Attributes:
500 -----------
501 vnfr_ids : list[str]
502 List of the VNF record IDs associated with the NS.
503 """
504
505 vnfr_ids: List[str]