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
19 from typing
import List
22 from osm_common
.dbbase
import DbBase
23 from osm_common
.temporal
.activities
.base
import BaseActivity
24 from osm_common
.temporal
.states
import NsState
27 class GetVnfDetails(BaseActivity
):
29 Gets the list of VNF record IDs, VNF member-index-refs for a given NS record ID.
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 short-running nature.
40 Since this activity only reads from the DB, it is safe to retry, although
41 you may wish to have some back-off policy.
50 The UUID of the NS from which to retrieve the VNF records.
60 vnf_details: list[(vnfr_ids: str, vnf_member_index_ref: str), .. ]
61 List of tuples including VNF details associated with the NS.
62 Tuple(VNF record IDs, vnf_member_index_ref)
65 vnf_details
: List
[tuple]
67 def __init__(self
, db
: DbBase
):
71 async def __call__(self
, activity_input
: Input
) -> Output
:
72 raise NotImplementedError()
75 class GetNsRecord(BaseActivity
):
76 """Gets the NS record from Database.
82 DbException: If DB read operations fail, the collection or DB record ID does not exist.
85 This activity should complete relatively quickly (less than 10
88 This activity will not report a heartbeat due to its
91 This is an idempotent activity.
98 Input dataclass for getting NS record activity.
103 The UUID of the NS record which is stored in the OSM nsrs
113 Output dataclass for getting NS record activity.
118 NS record retrieved from Database..
124 def __init__(self
, db
: DbBase
):
128 async def __call__(self
, activity_input
: Input
) -> Output
:
129 raise NotImplementedError()
132 class UpdateNsState(BaseActivity
):
134 Changes the state of the NS itself.
140 DbException If the target DB record does not exist or DB is not reachable.
143 This activity will not report a heartbeat due to its
144 short-running nature.
146 As this is a direct DB update, it is not recommended to have
147 any specific retry policy
153 Input dataclass for updating NS state in the DB
158 The UUID of the NS as stored in the OSM ns
161 operational_state : NsState
162 A representation of the operational state (ENABLED or ERROR)
166 Human readable message providing additional details to the
167 operational state, such as the error message associated
168 with the ERROR operational_state.
175 def __init__(self
, db
: DbBase
):
179 async def __call__(self
, activity_input
: Input
) -> None:
180 raise NotImplementedError()