1 #######################################################################################
2 # Copyright ETSI Contributors and Others.
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #######################################################################################
18 from dataclasses
import dataclass
20 from osm_common
.dbbase
import DbBase
21 from osm_common
.temporal
.activities
.base
import BaseActivity
22 from osm_common
.temporal
.states
import VimOperationState
, VimState
25 class UpdateVimState(BaseActivity
):
27 Changes the state of the VIM itself. Should be either
28 ENABLED or ERROR, however this activity does not validate
29 the state as no validation was done in OSM previously.
32 DB Write: vim_accounts
35 DbException If the target DB record does not exist or DB is not reachable.
38 This activity will not report a heartbeat due to its
41 As this is a direct DB update, it is not recommended to have
42 any specific retry policy
48 Input dataclass for updating VIM state in the DB
53 The UUID of the VIM account as stored in the OSM vim
56 operational_state : VimState
57 A representation of the operational state (ENABLED or ERROR)
61 Human readable message providing additional details to the
62 operational state, such as the error message associated
63 with the ERROR operational_state.
67 operational_state
: VimState
70 def __init__(self
, db
: DbBase
):
74 async def __call__(self
, activity_input
: Input
) -> None:
75 raise NotImplementedError()
78 class UpdateVimOperationState(BaseActivity
):
80 Changes the state of a VIM operation task. Should be done to
81 indicate progress, or completion of the task itself.
84 DB Write: vim_accounts
87 DbException If the target DB record does not exist or DB is not reachable.
90 This activity will not report a heartbeat due to its
93 As this is a direct DB update, it is not recommended to have
94 any specific retry policy
100 Input dataclass for updating VIM Operations in the Mongo VIM
106 The UUID of the VIM account as stored in the OSM vim
110 The operation (task) id for this workflow. This is used
111 to update the status of the operation in Mongo vim collection.
113 op_state : VimOperationState
114 A representation of the state of the specified operation id,
115 such as COMPLETED, or FAILED.
118 Human readable message providing additional details to the
119 operation state, such as the error message explaining why
120 the operation failed.
125 op_state
: VimOperationState
128 def __init__(self
, db
: DbBase
):
132 async def __call__(self
, activity_input
: Input
) -> None:
133 raise NotImplementedError()
136 class DeleteVimRecord(BaseActivity
):
138 Deletes the VIM record from the database.
141 DB Delete: vim_accounts
144 DbException If the target DB record does not exist or DB is not reachable.
147 This activity will not report a heartbeat due to its
148 short-running nature.
150 As this is a direct DB update, it is not recommended to have
151 any specific retry policy
157 Input dataclass for deleting vim record from the database
162 The UUID of the VIM account as stored in the OSM vim
169 def __init__(self
, db
: DbBase
):
173 async def __call__(self
, activity_input
: Input
) -> None:
174 raise NotImplementedError()