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 VnfInstantiationState
, VnfState
25 class ChangeVnfState(BaseActivity
):
26 """Updates the VNF State in VNFR.
32 DbException: If DB access/update fails, the collection or DB record ID does not exist.
35 This activity should complete relatively quickly (less than a
36 second). However, it would be reasonable to wait up to 10
39 This activity will not report a heartbeat due to its
42 It is not necessary to implement a back-off strategy for this
43 activity, the operation is idempotent.
50 Input dataclass for changing VNF State.
55 The UUID of the VNF which is stored in the OSM vnfrs
59 A representation of the VNF state (STOPPED or STARTED).
65 def __init__(self
, db
: DbBase
):
69 async def __call__(self
, activity_input
: Input
) -> None:
70 raise NotImplementedError()
73 class ChangeVnfInstantiationState(BaseActivity
):
74 """Updates the VNF Instantiation State in VNFR.
80 DbException: If DB access or update fails, the collection or DB record ID does not exist.
83 This activity should complete relatively quickly (less than a
84 second). However, it would be reasonable to wait up to 10
87 This activity will not report a heartbeat due to its
90 It is not necessary to implement a back-off strategy for this
91 activity, the operation is idempotent.
98 Input dataclass for changing VNF Instantiation State.
103 The UUID of the VNF which is stored in the OSM vnfrs
106 state : VnfInstantiationState
107 A representation of the VNF instantiation state (NOT_INSTANTIATED or INSTANTIATED).
112 state
: VnfInstantiationState
114 def __init__(self
, db
: DbBase
):
118 async def __call__(self
, activity_input
: Input
) -> None:
119 raise NotImplementedError()
122 class GetVnfRecord(BaseActivity
):
123 """Gets the VNF record and VNF descriptor from Database.
126 DB read: vnfrs, vnfds
129 DbException: If DB read operations fail, the collection or DB record ID does not exist.
132 This activity should complete relatively quickly (less than 10
135 This activity will not report a heartbeat due to its
136 short-running nature.
138 This is an idempotent activity.
145 Input dataclass for get vnf details activity.
150 The UUID of the VNF which is stored in the OSM vnfrs
159 Output dataclass for get vnf details activity.
163 vnf_details: list[(vnfr_ids: str, vnf_member_index_ref: str), .. ]
164 List of tuples including VNF details associated with the NS.
165 Tuple(VNF record IDs, vnf_member_index_ref)
170 def __init__(self
, db
: DbBase
):
174 async def __call__(self
, activity_input
: Input
) -> Output
:
175 raise NotImplementedError()
178 class GetVnfDescriptor(BaseActivity
):
179 """Gets the VNF record and VNF descriptor from Database.
185 DbException: If DB read operations fail, the collection or DB record ID does not exist.
188 This activity should complete relatively quickly (less than 10
191 This activity will not report a heartbeat due to its
192 short-running nature.
194 This is an idempotent activity.
201 Input dataclass for get vnf descriptor activity.
206 The UUID of the VNF descriptor which is stored in the OSM vnfds
215 Output dataclass for get vnf details activity.
220 VNF descriptor retrieved from Database.
225 def __init__(self
, db
: DbBase
):
229 async def __call__(self
, activity_input
: Input
) -> Output
:
230 raise NotImplementedError()
233 class SendNotificationForVnf(BaseActivity
):
234 """Perform Notification operations."""
239 Input dataclass for sending notifications for change in VNF Instantiation State.
244 The UUID of the VNF which is stored in the OSM vnfrs
247 state : VnfInstantiationState
248 A representation of the VNF instantiation state (NOT_INSTANTIATED or INSTANTIATED).
255 async def __call__(self
, activity_input
: Input
):
256 raise NotImplementedError()
259 class GetTaskQueue(BaseActivity
):
260 """Finds the appropriate task queue according to VIM type of VNF.
263 DB read: vim_accounts, vnfrs
266 DbException: If DB read operations fail, the collection or DB record ID does not exist.
269 This activity should complete relatively quickly (less than a
270 second). However, it would be reasonable to wait up to 10
273 This activity will not report a heartbeat due to its
274 short-running nature.
276 It is not necessary to implement a back-off strategy for this
277 activity, the operation is idempotent.
284 Input dataclass for get task queue activity.
289 The UUID of the VNF which is stored in the OSM vnfrs
299 Output dataclass for get task queue activity.
304 Name of the queue which is used to Deploy VNF.
309 def __init__(self
, db
: DbBase
):
313 async def __call__(self
, activity_input
: Input
) -> Output
:
314 raise NotImplementedError()
317 class GetVimCloud(BaseActivity
):
318 """Finds the cloud by checking the VIM account of VNF.
321 DB Read: vnfrs, vim_accounts
324 DbException: If DB read operations fail, the collection or DB record ID does not exist.
327 This activity should complete relatively quickly (less than a
328 second). However, it would be reasonable to wait up to 10
331 This activity will not report a heartbeat due to its
332 short-running nature.
334 It is not necessary to implement a back-off strategy for this
335 activity, the operation is idempotent.
342 Input dataclass for get vim cloud activity.
347 The UUID of the VNF which is stored in the OSM vnfrs
357 Output dataclass for get vim cloud activity.
362 Type of the cloud which is used to Deploy VNF.
367 def __init__(self
, db
: DbBase
):
371 async def __call__(self
, activity_input
: Input
) -> Output
:
372 raise NotImplementedError()
375 class SetVnfModel(BaseActivity
):
376 """Updates the model name of VNF in VNFR.
382 DbException: If DB access or update fails, the collection or DB record ID does not exist.
385 This activity should complete relatively quickly (less than a
386 second). However, it would be reasonable to wait up to 10
389 This activity will not report a heartbeat due to its
390 short-running nature.
392 It is not necessary to implement a back-off strategy for this
393 activity, the operation is idempotent.
400 Input dataclass for workflow that instantiates a VNF.
405 The UUID of the VNF which is stored in the OSM vnfrs
415 def __init__(self
, db
: DbBase
):
419 async def __call__(self
, activity_input
: Input
) -> None:
420 raise NotImplementedError()