VNF Terminate workflow base class
[osm/common.git] / osm_common / temporal / workflows / vnf.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 abc import abstractmethod
19 from dataclasses import dataclass
20
21 from osm_common.temporal.workflows.base import BaseWorkflow
22
23
24 class VnfInstantiateWorkflow(BaseWorkflow):
25 """Instantiate a VNF.
26
27 Workflow Identifier:
28 It is recommended that the ID for the VNF is referred as a workflow
29 ID when invoking this workflow.
30 """
31
32 @dataclass
33 class Input:
34 """
35 Input dataclass for workflow that instantiates a VNF.
36
37 Attributes:
38 -----------
39 vnfr_uuid : str
40 The UUID of the VNF which is stored in the OSM vnfrs
41 collection in Mongo.
42
43 model_name: str
44
45 instantiation_config: dict
46 The instantiation configuration of the VNF
47
48 """
49
50 vnfr_uuid: str
51 model_name: str
52 instantiation_config: dict
53
54 @abstractmethod
55 async def run(self, workflow_input: Input) -> None:
56 pass
57
58
59 class VnfPrepareWorkflow(BaseWorkflow):
60 """Prepare a VNF.
61
62 Workflow Identifier:
63 It is recommended that the ID for the VNF is referred as a workflow
64 ID when invoking this workflow.
65 """
66
67 @dataclass
68 class Input:
69 """
70 Input dataclass for workflow that instantiates a VNF.
71
72 Attributes:
73 -----------
74 vnfr_uuid : str
75 The UUID of the VNF which is stored in the OSM vnfrs
76 collection in Mongo.
77
78 model_name: str
79
80 """
81
82 vnfr_uuid: str
83 model_name: str
84
85 @abstractmethod
86 async def run(self, workflow_input: Input) -> None:
87 pass
88
89
90 class VnfTerminateWorkflow(BaseWorkflow):
91 @dataclass
92 class Input:
93 """
94
95 Attributes:
96 -----------
97 vnfr_uuid : str
98 The UUID of the VNF which is stored in the OSM vnfrs
99 collection in Mongo.
100 """
101
102 vnfr_uuid: str
103
104 @abstractmethod
105 async def run(self, workflow_input: Input) -> None:
106 pass