1 # Copyright (c) 2019, CMCC Technologies Co., Ltd.
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 from rest_framework import serializers
18 from lcm.ns.const import CHANGE_TYPES, CHANGE_RESULT
19 from lcm.ns.serializers.sol.ext_virtual_link_info import ExtVirtualLinkInfoSerializer
20 from lcm.ns.serializers.sol.update_serializers import ModifyVnfInfoDataSerializer
25 CHANGE_TYPES.INSTANTIATE,
26 CHANGE_TYPES.TERMINATE,
28 CHANGE_TYPES.CHANGE_FLAVOUR,
31 CHANGE_TYPES.MODIFY_INFORMATION,
32 CHANGE_TYPES.CHANGE_EXTERNAL_VNF_CONNECTIVITY
36 class ChangedInfoSerializer(serializers.Serializer):
37 changedVnfInfo = ModifyVnfInfoDataSerializer(
38 help_text="Information about the changed VNF instance information, including configurable properties",
40 changedExtConnectivity = ExtVirtualLinkInfoSerializer(
41 help_text="Link to the task resource that represents the 'fail' Information about changed external "
42 "connectivity, if applicable.",
46 class AffectedVnfsSerializer(serializers.Serializer):
47 vnfInstanceId = serializers.UUIDField(
48 help_text="Identifier of the VNF instance.",
51 vnfdId = serializers.UUIDField(
52 help_text="Identifier of the VNFD of the VNF Instance..",
55 vnfProfileId = serializers.UUIDField(
56 help_text="Identifier of the VNF profile of the NSD.",
59 vnfName = serializers.CharField(
60 help_text="Name of the VNF Instance.",
62 changeType = serializers.ChoiceField(
63 help_text="Signals the type of change",
67 changeResult = serializers.ChoiceField(
68 help_text="Signals the type of change",
72 changedInfo = ChangedInfoSerializer(
73 help_text="Links to resources related to this resource.",