add occurrence api in lcm
[vfc/nfvo/lcm.git] / lcm / ns / biz / affected_vnfs.py
1 # Copyright (c) 2019, CMCC Technologies Co., Ltd.
2
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6
7 # http://www.apache.org/licenses/LICENSE-2.0
8
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15
16 from rest_framework import serializers
17 from modify_vnf_info_data import ModifyVnfInfoDataSerializer
18 from ext_virtual_link_info import ExtVirtualLinkInfoSerializer
19
20 from lcm.ns.const import CHANGE_TYPES, CHANGE_RESULT
21
22
23 CHANGE_TYPE = [
24     CHANGE_TYPES.ADD,
25     CHANGE_TYPES.REMOVE,
26     CHANGE_TYPES.INSTANTIATE,
27     CHANGE_TYPES.TERMINATE,
28     CHANGE_TYPES.SCALE,
29     CHANGE_TYPES.CHANGE_FLAVOUR,
30     CHANGE_TYPES.HEAL,
31     CHANGE_TYPES.OPERATE,
32     CHANGE_TYPES.MODIFY_INFORMATION,
33     CHANGE_TYPES.CHANGE_EXTERNAL_VNF_CONNECTIVITY
34 ]
35
36
37 class ChangedInfoSerializer(serializers.Serializer):
38     changedVnfInfo = ModifyVnfInfoDataSerializer(
39         help_text="Information about the changed VNF instance information, including configurable properties",
40         required=False)
41     changedExtConnectivity = ExtVirtualLinkInfoSerializer(
42         help_text="Link to the task resource that represents the 'fail' Information about changed external "
43                   "connectivity, if applicable.",
44         required=False)
45
46
47 class AffectedVnfsSerializer(serializers.Serializer):
48     vnfInstanceId = serializers.UUIDField(
49         help_text="Identifier of the VNF instance.",
50         required=True
51     )
52     vnfdId = serializers.UUIDField(
53         help_text="Identifier of the VNFD of the VNF Instance..",
54         required=True
55     )
56     vnfProfileId = serializers.UUIDField(
57         help_text="Identifier of the VNF profile of the NSD.",
58         required=True
59     )
60     vnfName = serializers.CharField(
61         help_text="Name of the VNF Instance.",
62         required=True)
63     changeType = serializers.ChoiceField(
64         help_text="Signals the type of change",
65         required=True,
66         choices=CHANGE_TYPE
67     )
68     changeResult = serializers.ChoiceField(
69         help_text="Signals the type of change",
70         required=True,
71         choices=CHANGE_RESULT
72     )
73     changedInfo = ChangedInfoSerializer(
74         help_text="Links to resources related to this resource.",
75         required=False)