| Mark Beierl | b808fea | 2023-03-22 10:32:45 -0400 | [diff] [blame] | 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 |
| Mark Beierl | fd2324b | 2023-03-29 17:28:49 +0000 | [diff] [blame] | 19 | from enum import auto, IntEnum |
| Mark Beierl | b808fea | 2023-03-22 10:32:45 -0400 | [diff] [blame] | 20 | |
| Mark Beierl | fd2324b | 2023-03-29 17:28:49 +0000 | [diff] [blame] | 21 | ####################################################################################### |
| Mark Beierl | a8d016d | 2023-03-23 10:24:59 +0000 | [diff] [blame] | 22 | # Workflow Dataclasses |
| 23 | |
| 24 | |
| 25 | @dataclass |
| Gulsum Atici | 654c377 | 2023-03-23 15:59:56 +0300 | [diff] [blame] | 26 | class 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 Beierl | 30e0507 | 2023-03-28 18:04:47 +0000 | [diff] [blame] | 42 | |
| Mark Beierl | a8d016d | 2023-03-23 10:24:59 +0000 | [diff] [blame] | 43 | vim_uuid: str |
| Gulsum Atici | 654c377 | 2023-03-23 15:59:56 +0300 | [diff] [blame] | 44 | op_id: str |
| Mark Beierl | a8d016d | 2023-03-23 10:24:59 +0000 | [diff] [blame] | 45 | |
| 46 | |
| Mark Beierl | 248cb40 | 2023-04-05 20:01:05 +0000 | [diff] [blame^] | 47 | @dataclass |
| 48 | class 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 Beierl | fd2324b | 2023-03-29 17:28:49 +0000 | [diff] [blame] | 63 | ####################################################################################### |
| Mark Beierl | a8d016d | 2023-03-23 10:24:59 +0000 | [diff] [blame] | 64 | # Activity Dataclasses |
| 65 | |
| Mark Beierl | b808fea | 2023-03-22 10:32:45 -0400 | [diff] [blame] | 66 | |
| Mark Beierl | 248cb40 | 2023-04-05 20:01:05 +0000 | [diff] [blame^] | 67 | class LcmOperationState(IntEnum): |
| 68 | PROCESSING = auto() |
| 69 | COMPLETED = auto() |
| 70 | FAILED = auto() |
| 71 | |
| 72 | |
| 73 | @dataclass |
| 74 | class 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 Beierl | b808fea | 2023-03-22 10:32:45 -0400 | [diff] [blame] | 111 | @dataclass |
| 112 | class TestVimConnectivityInput: |
| Gulsum Atici | 654c377 | 2023-03-23 15:59:56 +0300 | [diff] [blame] | 113 | """ |
| 114 | Input dataclass for the Test Vim Connectivity Ativity |
| Mark Beierl | b808fea | 2023-03-22 10:32:45 -0400 | [diff] [blame] | 115 | |
| Gulsum Atici | 654c377 | 2023-03-23 15:59:56 +0300 | [diff] [blame] | 116 | 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 Beierl | 30e0507 | 2023-03-28 18:04:47 +0000 | [diff] [blame] | 122 | |
| Mark Beierl | b808fea | 2023-03-22 10:32:45 -0400 | [diff] [blame] | 123 | vim_uuid: str |
| 124 | |
| Mark Beierl | a8d016d | 2023-03-23 10:24:59 +0000 | [diff] [blame] | 125 | |
| Mark Beierl | fd2324b | 2023-03-29 17:28:49 +0000 | [diff] [blame] | 126 | class VimState(IntEnum): |
| 127 | PROCESSING = auto() |
| 128 | ENABLED = auto() |
| 129 | ERROR = auto() |
| 130 | |
| 131 | |
| Mark Beierl | a8d016d | 2023-03-23 10:24:59 +0000 | [diff] [blame] | 132 | @dataclass |
| Gulsum Atici | 654c377 | 2023-03-23 15:59:56 +0300 | [diff] [blame] | 133 | class 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 Beierl | fd2324b | 2023-03-29 17:28:49 +0000 | [diff] [blame] | 143 | operational_state : VimState |
| Gulsum Atici | 654c377 | 2023-03-23 15:59:56 +0300 | [diff] [blame] | 144 | 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 Beierl | 30e0507 | 2023-03-28 18:04:47 +0000 | [diff] [blame] | 152 | |
| Gulsum Atici | 654c377 | 2023-03-23 15:59:56 +0300 | [diff] [blame] | 153 | vim_uuid: str |
| Mark Beierl | fd2324b | 2023-03-29 17:28:49 +0000 | [diff] [blame] | 154 | operational_state: VimState |
| Gulsum Atici | 654c377 | 2023-03-23 15:59:56 +0300 | [diff] [blame] | 155 | message: str |
| 156 | |
| 157 | |
| Mark Beierl | fd2324b | 2023-03-29 17:28:49 +0000 | [diff] [blame] | 158 | class VimOperationState(IntEnum): |
| 159 | COMPLETED = auto() |
| 160 | FAILED = auto() |
| 161 | |
| 162 | |
| Gulsum Atici | 654c377 | 2023-03-23 15:59:56 +0300 | [diff] [blame] | 163 | @dataclass |
| 164 | class 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 Beierl | fd2324b | 2023-03-29 17:28:49 +0000 | [diff] [blame] | 179 | op_state : VimOperationState |
| Gulsum Atici | 654c377 | 2023-03-23 15:59:56 +0300 | [diff] [blame] | 180 | 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 Beierl | 30e0507 | 2023-03-28 18:04:47 +0000 | [diff] [blame] | 188 | |
| Gulsum Atici | 654c377 | 2023-03-23 15:59:56 +0300 | [diff] [blame] | 189 | vim_uuid: str |
| 190 | op_id: str |
| Mark Beierl | fd2324b | 2023-03-29 17:28:49 +0000 | [diff] [blame] | 191 | op_state: VimOperationState |
| Gulsum Atici | 654c377 | 2023-03-23 15:59:56 +0300 | [diff] [blame] | 192 | message: str |
| Mark Beierl | 30e0507 | 2023-03-28 18:04:47 +0000 | [diff] [blame] | 193 | |
| 194 | |
| 195 | @dataclass |
| 196 | class 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 |