Optimize ns instant.
[vfc/nfvo/lcm.git] / lcm / ns / serializers / sol / affected_vnfs.py
1 # Copyright (c) 2019, CMCC Technologies Co., Ltd.
2 # Copyright (c) 2019, ZTE Corporation.
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 implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16
17 from rest_framework import serializers
18
19 from lcm.ns.enum import CHANGE_TYPE, CHANGE_RESULT
20 from lcm.pub.utils.enumutil import enum_to_list
21 from lcm.ns.serializers.sol.ext_virtual_link_info import ExtVirtualLinkInfoSerializer
22 from lcm.ns.serializers.sol.update_serializers import ModifyVnfInfoDataSerializer
23
24
25 class ChangedInfoSerializer(serializers.Serializer):
26     changedVnfInfo = ModifyVnfInfoDataSerializer(
27         help_text="Information about the changed VNF instance information, including configurable properties",
28         required=False)
29     changedExtConnectivity = serializers.ListField(
30         child=ExtVirtualLinkInfoSerializer(),
31         help_text="Link to the task resource that represents the 'fail' Information about changed external "
32                   "connectivity, if applicable.",
33         required=False)
34
35
36 class AffectedVnfsSerializer(serializers.Serializer):
37     vnfInstanceId = serializers.UUIDField(
38         help_text="Identifier of the VNF instance.",
39         required=True
40     )
41     vnfdId = serializers.UUIDField(
42         help_text="Identifier of the VNFD of the VNF Instance.",
43         required=True
44     )
45     vnfProfileId = serializers.UUIDField(
46         help_text="Identifier of the VNF profile of the NSD.",
47         required=True
48     )
49     vnfName = serializers.CharField(
50         help_text="Name of the VNF Instance.",
51         required=True)
52     changeType = serializers.ChoiceField(
53         help_text="Signals the type of change",
54         required=True,
55         choices=enum_to_list(CHANGE_TYPE)
56     )
57     changeResult = serializers.ChoiceField(
58         help_text="Signals the result of change identified by the 'changeType' attribute.",
59         required=True,
60         choices=enum_to_list(CHANGE_RESULT)
61     )
62     changedInfo = ChangedInfoSerializer(
63         help_text="Information about the changed VNF instance information, including VNF configurable properties, if applicable.",
64         required=False)