1 # Copyright (C) 2018 Verizon. All Rights Reserved
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.
15 from rest_framework import serializers
17 from affected_vnfcs import AffectedVnfcsSerializer
18 from affected_vls import AffectedVLsSerializer
19 from affected_storages import AffectedStoragesSerializer
20 from lcm.nf.const import LCM_OPERATION_TYPES, LCM_OPERATION_STATE_TYPES
21 from link import LinkSerializer
22 from response import ProblemDetailsSerializer
23 from ext_virtual_link_info import ExtVirtualLinkInfoSerializer
24 from vnf_info_modifications import VnfInfoModificationsSerializer
27 class LccnLinksSerializer(serializers.Serializer):
28 vnfInstance = LinkSerializer(
29 help_text="Link to the resource representing the VNF instance to "
30 "which the notified change applies.",
33 subscription = LinkSerializer(
34 help_text="Link to the related subscription.",
37 vnfLcmOpOcc = LinkSerializer(
38 help_text="Link to the VNF lifecycle management operation"
39 "occurrence that this notification is related to. Shall be"
40 "present if there is a related lifecycle operation occurance.",
45 class VnfLcmOperationOccurrenceNotification(serializers.Serializer):
46 id = serializers.CharField(
47 help_text="Identifier of this notification",
51 notificationType = serializers.CharField(
52 help_text="Type of the notification",
56 subscriptionId = serializers.CharField(
57 help_text="Identifier for the subscription",
59 timeStamp = serializers.CharField(
60 help_text="Date-time of the generation of the notification.",
62 notificationStatus = serializers.ChoiceField(
63 help_text="Indicates whether this notification reports about the start"
64 "of a lifecycle operation or the result of a lifecycle"
66 choices=["START", "RESULT"],
68 operationState = serializers.ChoiceField(
69 choices=LCM_OPERATION_STATE_TYPES,
70 help_text="The state of the VNF LCM operation occurrence. ",
72 vnfInstanceId = serializers.CharField(
73 help_text="The identifier of the VNF instance affected. ",
75 operation = serializers.ChoiceField(
76 help_text="The lifecycle management operation.",
78 choices=LCM_OPERATION_TYPES)
79 isAutomaticInvocation = serializers.BooleanField(
80 help_text="Set to true if this VNF LCM operation occurrence has"
81 "been triggered by an automated procedure inside the"
82 "VNFM. Otherwise False",
84 vnfLcmOpOccId = serializers.CharField(
85 help_text="The identifier of the VNF lifecycle management"
86 "operation occurrence associated to the notification.",
88 affectedVnfcs = AffectedVnfcsSerializer(
89 help_text="Information about VNFC instances that were affected " +
90 "during the lifecycle operation.",
94 affectedVirtualLinks = AffectedVLsSerializer(
95 help_text="Information about VL instances that were affected " +
96 "during the lifecycle operation. ",
100 affectedVirtualStorages = AffectedStoragesSerializer(
101 help_text="Information about virtualised storage instances that " +
102 "were affected during the lifecycle operation",
106 changedInfo = VnfInfoModificationsSerializer(
107 help_text="Information about the changed VNF instance information, " +
108 "including VNF configurable properties",
111 changedExtConnectivity = ExtVirtualLinkInfoSerializer(
112 help_text="Information about changed external connectivity, if this " +
113 "notification represents the result of a lifecycle operation occurrence. " +
114 "Shall be present if the 'notificationStatus' is set to 'RESULT' and the " +
115 "'operation' is set to 'CHANGE_EXT_CONN'. Shall be absent otherwise.",
119 error = ProblemDetailsSerializer(
120 help_text="If 'operationState' is 'FAILED_TEMP' or 'FAILED' or " +
121 "'PROCESSING' or 'ROLLING_BACK' and previous value of 'operationState' " +
122 "was 'FAILED_TEMP' this attribute shall be present ",
126 _links = LccnLinksSerializer(
127 help_text="Links to resources related to this resource.",