Trigger subscription in nslcm.
[vfc/nfvo/lcm.git] / lcm / ns_vnfs / serializers / grant_vnf_serializer.py
1 # Copyright 2018 ZTE Corporation.
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 from rest_framework import serializers
16
17
18 class ResourceHandleSerializer(serializers.Serializer):
19     vimConnectionId = serializers.CharField(
20         help_text="Identifier of the VIM connection to manage the resource.",
21         required=False,
22         allow_null=True,
23         allow_blank=True
24     )
25     resourceProviderId = serializers.CharField(
26         help_text="Identifier of the entity responsible for the management of the resource.",
27         required=False,
28         allow_null=True,
29         allow_blank=True
30     )
31     resourceId = serializers.CharField(
32         help_text="Identifier of the resource in the scope of the VIM or the resource provider.",
33         required=True
34     )
35     vimLevelResourceType = serializers.CharField(
36         help_text="Type of the resource in the scope of the VIM or the resource provider.",
37         required=False,
38         allow_null=True,
39         allow_blank=True
40     )
41
42
43 class ResourceDefinitionSerializer(serializers.Serializer):
44     id = serializers.CharField(
45         help_text="Identifier of this ResourceDefinition, unique at least within the scope of the GrantRequest.",
46         required=True
47     )
48     type = serializers.ChoiceField(
49         help_text="Type of the resource definition referenced.",
50         choices=["COMPUTE", "VL", "STORAGE", "LINKPORT"],
51         required=True
52     )
53     vduId = serializers.CharField(
54         help_text="Reference to the related VDU in the VNFD applicable to this resource.",
55         required=False,
56         allow_null=True,
57         allow_blank=True
58     )
59     resourceTemplateId = serializers.CharField(
60         help_text="Reference to a resource template(such as VnfVirtualLinkDesc) in the VNFD.",
61         required=False,
62         allow_null=True,
63         allow_blank=True
64     )
65     resource = ResourceHandleSerializer(
66         help_text="Resource information for an existing resource.",
67         required=False,
68         allow_null=True
69     )
70
71
72 class ConstraintResourceRefSerializer(serializers.Serializer):
73     idType = serializers.ChoiceField(
74         help_text="The type of the identifier.",
75         choices=["RES_MGMT", "GRANT"],
76         required=True
77     )
78     resourceId = serializers.CharField(
79         help_text="An actual resource-management-level identifier(idType=RES_MGMT), or an identifier that references a ResourceDefinition(idType=GRANT).",
80         required=True
81     )
82     vimConnectionId = serializers.CharField(
83         help_text="",
84         required=False,
85         allow_null=True,
86         allow_blank=True
87     )
88     resourceProviderId = serializers.CharField(
89         help_text="Identifier of the resource provider. It shall only be present when idType = RES_MGMT.",
90         required=False,
91         allow_null=True,
92         allow_blank=True
93     )
94
95
96 class PlacementConstraintSerializer(serializers.Serializer):
97     affinityOrAntiAffinity = serializers.ChoiceField(
98         help_text="The type of the constraint.",
99         choices=["AFFINITY", "ANTI_AFFINITY"],
100         required=True
101     )
102     scope = serializers.ChoiceField(
103         help_text="The scope of the placement constraint indicating the category of the place where the constraint applies.",
104         choices=["NFVI_POP", "ZONE", "ZONE_GROUP", "NFVI_NODE"],
105         required=True
106     )
107     resource = ConstraintResourceRefSerializer(
108         help_text="References to resources in the constraint rule.",
109         many=True,
110         required=False
111     )
112
113
114 class VimConstraintSerializer(serializers.Serializer):
115     sameResourceGroup = serializers.BooleanField(
116         help_text="Set to true when the constraint applies not only to the same VIM connection, but also to the same infrastructure resource group.",
117         required=False
118     )
119     resource = ConstraintResourceRefSerializer(
120         help_text="References to resources in the constraint rule.",
121         many=True,
122         required=False
123     )
124
125
126 class LinkSerializer(serializers.Serializer):
127     href = serializers.CharField(
128         help_text="URI of the referenced resource.",
129         required=True
130     )
131
132
133 class GrantRequestLinksSerializer(serializers.Serializer):
134     vnfLcmOpOcc = LinkSerializer(
135         help_text="Related VNF lifecycle management operation occurrence.",
136         required=True
137     )
138     vnfInstance = LinkSerializer(
139         help_text="Related VNF instance.",
140         required=True
141     )
142
143
144 class GrantRequestSerializer(serializers.Serializer):
145     vnfInstanceId = serializers.CharField(
146         help_text="Identifier of the VNF instance which this grant request is related to.",
147         required=True
148     )
149     vnfLcmOpOccId = serializers.CharField(
150         help_text="The identifier of the VNF lifecycle management operation occurrence associated to the GrantRequest.",
151         required=False,  # TODO required
152         allow_null=True,
153         allow_blank=True
154     )
155     vnfdId = serializers.CharField(
156         help_text="Identifier of the VNFD that defines the VNF for which the LCM operation is to be granted.",
157         required=False,  # TODO required
158         allow_null=True,
159         allow_blank=True
160     )
161     flavourId = serializers.CharField(
162         help_text="Identifier of the VNF deployment flavour of the VNFD that defines the VNF for which the LCM operation is to be granted.",
163         required=False,
164         allow_null=True,
165         allow_blank=True
166     )
167     operation = serializers.ChoiceField(
168         help_text="The lifecycle management operation for which granting is requested.",
169         choices=["INSTANTIATE", "SCALE", "SCALE_TO_LEVEL", "CHANGE_FLAVOUR", "TERMINATE", "HEAL", "OPERATE", "CHANGE_EXT_CONN", "MODIFY_INFO"],
170         required=True
171     )
172     isAutomaticInvocation = serializers.BooleanField(
173         help_text="Set to true if this VNF LCM operation occurrence has been triggered by an automated procedure inside the VNFM, set to false otherwise.",
174         required=True
175     )
176     instantiationLevelId = serializers.CharField(
177         help_text="If operation=INSTANTIATE, the identifier of the instantiation level may be provided as an alternative way to define the resources to be added.",
178         required=False,
179         allow_null=True,
180         allow_blank=True
181     )
182     addResources = ResourceDefinitionSerializer(
183         help_text="List of resource definitions in the VNFD for resources to be added by the LCM operation.",
184         many=True,
185         required=False
186     )
187     tempResources = ResourceDefinitionSerializer(
188         help_text="List of resource definitions in the VNFD for resources to be temporarily instantiated during the runtime of the LCM operation.",
189         many=True,
190         required=False
191     )
192     removeResources = ResourceDefinitionSerializer(
193         help_text="Provides the definitions of resources to be removed by the LCM operation.",
194         many=True,
195         required=False
196     )
197     updateResources = ResourceDefinitionSerializer(
198         help_text="Provides the definitions of resources to be modified by the LCM operation.",
199         many=True,
200         required=False
201     )
202     placementConstraints = PlacementConstraintSerializer(
203         help_text="Placement constraints that the VNFM may send to the NFVO in order to influence the resource placement decision.",
204         many=True,
205         required=False
206     )
207     vimConstraints = VimConstraintSerializer(
208         help_text="Used by the VNFM to require that multiple resources are managed through the same VIM connection.",
209         many=True,
210         required=False
211     )
212     additionalParams = serializers.DictField(
213         help_text="Additional parameters passed by the VNFM.",
214         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
215         required=False,
216         allow_null=True
217     )
218     _links = GrantRequestLinksSerializer(
219         help_text="Links to resources related to this request.",
220         required=False  # TODO required
221     )
222
223
224 class VimConnectionInfoSerializer(serializers.Serializer):
225     id = serializers.CharField(
226         help_text="The identifier of the VIM Connection. This identifier is managed by the NFVO.",
227         required=True
228     )
229     vimId = serializers.CharField(
230         help_text="The identifier of the VIM instance. This identifier is managed by the NFVO.",
231         required=False,
232         allow_null=True,
233         allow_blank=True
234     )
235     vimType = serializers.CharField(
236         help_text="Discriminator for the different types of the VIM information.",
237         required=False,
238         allow_null=True,
239         allow_blank=True
240     )
241     interfaceInfo = serializers.DictField(
242         help_text="Information about the interface or interfaces to the VIM.",
243         child=serializers.CharField(help_text="Interface Info", allow_blank=True),
244         required=False,
245         allow_null=True
246     )
247     accessInfo = serializers.DictField(
248         help_text="Authentication credentials for accessing the VIM.",
249         child=serializers.CharField(help_text="Access Info", allow_blank=True),
250         required=False,
251         allow_null=True
252     )
253     extra = serializers.DictField(
254         help_text="VIM type specific additional information.",
255         child=serializers.CharField(help_text="Extra", allow_blank=True),
256         required=False,
257         allow_null=True
258     )
259
260
261 class ZoneInfoSerializer(serializers.Serializer):
262     id = serializers.CharField(
263         help_text="The identifier of this ZoneInfo instance, for the purpose of referencing it from other structures in the Grant structure.",
264         required=True
265     )
266     zoneId = serializers.CharField(
267         help_text="The identifier of the resource zone, as managed by the resource management layer(typically, the VIM).",
268         required=False,
269         allow_null=True,
270         allow_blank=True
271     )
272     vimConnectionId = serializers.CharField(
273         help_text="Identifier of the connection to the VIM that manages the resource zone.",
274         required=False,
275         allow_null=True,
276         allow_blank=True
277     )
278     resourceProviderId = serializers.CharField(
279         help_text="Identifies the entity responsible for the management the resource zone.",
280         required=False,
281         allow_null=True,
282         allow_blank=True
283     )
284
285
286 class ZoneGroupInfoSerializer(serializers.Serializer):
287     zoneId = serializers.ListSerializer(
288         help_text="References of identifiers of ZoneInfo structures.",
289         child=serializers.CharField(help_text="IdentifierLocal", allow_blank=True),
290         required=False,
291         allow_null=True
292     )
293
294
295 class GrantInfoSerializer(serializers.Serializer):
296     resourceDefinitionId = serializers.CharField(
297         help_text="Identifier of the related ResourceDefinition from the related GrantRequest.",
298         required=True
299     )
300     reservationId = serializers.CharField(
301         help_text="The reservation identifier applicable to the VNFC/VirtualLink/VirtualStorage.",
302         required=False,
303         allow_null=True,
304         allow_blank=True
305     )
306     vimConnectionId = serializers.CharField(
307         help_text="Identifier of the VIM connection to be used to manage this resource.",
308         required=False,
309         allow_null=True,
310         allow_blank=True
311     )
312     resourceProviderId = serializers.CharField(
313         help_text="Identifies the entity responsible for the management of the virtualised resource.",
314         required=False,
315         allow_null=True,
316         allow_blank=True
317     )
318     zoneId = serializers.CharField(
319         help_text="Reference to the identifier of the ZoneInfo in the Grant.",
320         required=False,
321         allow_null=True,
322         allow_blank=True
323     )
324     resourceGroupId = serializers.CharField(
325         help_text="Identifier of the infrastructure resource group.",
326         required=False,
327         allow_null=True,
328         allow_blank=True
329     )
330
331
332 class VimComputeResourceFlavourSerializer(serializers.Serializer):
333     vimConnectionId = serializers.CharField(
334         help_text="Identifier of the VIM connection to access the flavour referenced in this structure.",
335         required=False,
336         allow_null=True,
337         allow_blank=True
338     )
339     resourceProviderId = serializers.CharField(
340         help_text="Identifies the entity responsible for the management of the virtualised resource.",
341         required=False,
342         allow_null=True,
343         allow_blank=True
344     )
345     vnfdVirtualComputeDescId = serializers.CharField(
346         help_text="Identifier which references the virtual compute descriptor in the VNFD that maps to this flavour.",
347         required=False,
348         allow_null=True,
349         allow_blank=True
350     )
351     vimFlavourId = serializers.CharField(
352         help_text="Identifier of the compute resource flavour in the resource management layer (i.e. VIM).",
353         required=False,
354         allow_null=True,
355         allow_blank=True
356     )
357
358
359 class VimSoftwareImageSerializer(serializers.Serializer):
360     vimConnectionId = serializers.CharField(
361         help_text="Identifier of the VIM connection to access the flavour referenced in this structure.",
362         required=False,
363         allow_null=True,
364         allow_blank=True
365     )
366     resourceProviderId = serializers.CharField(
367         help_text="Identifies the entity responsible for the management of the virtualised resource.",
368         required=False,
369         allow_null=True,
370         allow_blank=True
371     )
372     vnfdSoftwareImageId = serializers.CharField(
373         help_text="Identifier which references the software image descriptor in the VNFD.",
374         required=False,
375         allow_null=True,
376         allow_blank=True
377     )
378     vimSoftwareImageId = serializers.CharField(
379         help_text="Identifier of the software image in the resource management layer (i.e. VIM).",
380         required=False,
381         allow_null=True,
382         allow_blank=True
383     )
384
385
386 class VimAssetsSerializer(serializers.Serializer):
387     computeResourceFlavours = VimComputeResourceFlavourSerializer(
388         help_text="Mappings between virtual compute descriptors defined in the VNFD and compute resource flavours managed in the VIM.",
389         many=True,
390         required=False
391     )
392     softwareImages = VimSoftwareImageSerializer(
393         help_text="Mappings between software images defined in the VNFD and software images managed in the VIM.",
394         many=True,
395         required=False
396     )
397
398
399 class AddressRangeSerializer(serializers.Serializer):
400     minAddress = serializers.CharField(
401         help_text="Lowest IP address belonging to the range.",
402         required=True
403     )
404     maxAddress = serializers.CharField(
405         help_text="Highest IP address belonging to the range.",
406         required=True
407     )
408
409
410 class IpAddresseSerializer(serializers.Serializer):
411     type = serializers.ChoiceField(
412         help_text="The type of the IP addresses.",
413         choices=["IPV4", "IPV6"],
414         required=True
415     )
416     fixedAddresses = serializers.ListSerializer(
417         help_text="Fixed addresses to assign.",
418         child=serializers.CharField(help_text="IpAddress"),
419         required=False,
420         allow_null=True
421     )
422     numDynamicAddresses = serializers.IntegerField(
423         help_text="Number of dynamic addresses to assign.",
424         required=True
425     )
426     addressRange = AddressRangeSerializer(
427         help_text="An IP address range to be used, e.g. in case of egress connections.",
428         required=False,
429         allow_null=True
430     )
431     subnetId = serializers.CharField(
432         help_text="Subnet defined by the identifier of the subnet resource in the VIM.",
433         required=False,
434         allow_null=True,
435         allow_blank=True
436     )
437
438
439 class IpOverEthernetAddressDataSerializer(serializers.Serializer):
440     macAddress = serializers.CharField(
441         help_text="MAC address.",
442         required=False,
443         allow_null=True,
444         allow_blank=True
445     )
446     ipAddresses = IpAddresseSerializer(
447         help_text="List of IP addresses to assign to the CP instance.",
448         many=True,
449         required=False
450     )
451
452
453 class CpProtocolDataSerializer(serializers.Serializer):
454     layerProtocol = serializers.ChoiceField(
455         help_text="Identifier of layer(s) and protocol(s).",
456         choices=["IP_OVER_ETHERNET"],
457         required=True
458     )
459     ipOverEthernet = IpOverEthernetAddressDataSerializer(
460         help_text="Network address data for IP over Ethernet to assign to the extCP instance.",
461         required=False,
462         allow_null=True,
463     )
464
465
466 class VnfExtCpConfigSerializer(serializers.Serializer):
467     cpInstanceId = serializers.CharField(
468         help_text="Identifier of the external CP instance to which this set of configuration parameters is requested to be applied.",
469         required=False,
470         allow_null=True,
471         allow_blank=True
472     )
473     linkPortId = serializers.CharField(
474         help_text="Identifier of a pre-configured link port to which the external CP will be associated.",
475         required=False,
476         allow_null=True,
477         allow_blank=True
478     )
479     cpProtocolData = CpProtocolDataSerializer(
480         help_text="Parameters for configuring the network protocols on the link port that connects the CP to a VL.",
481         many=True,
482         required=False
483     )
484
485
486 class VnfExtCpDataSerializer(serializers.Serializer):
487     cpdId = serializers.CharField(
488         help_text="The identifier of the CPD in the VNFD.",
489         required=True
490     )
491     cpConfig = VnfExtCpConfigSerializer(
492         help_text="List of instance data that need to be configured on the CP instances created from the respective CPD.",
493         many=True,
494         required=False
495     )
496
497
498 class ExtLinkPortDataSerializer(serializers.Serializer):
499     id = serializers.CharField(
500         help_text="Identifier of this link port as provided by the entity that has created the link port.",
501         required=True
502     )
503     resourceHandle = serializers.CharField(
504         help_text="Reference to the virtualised resource realizing this link port.",
505         required=True
506     )
507
508
509 class ExtVirtualLinkDataSerializer(serializers.Serializer):
510     id = serializers.CharField(
511         help_text="The identifier of the external VL instance.",
512         required=True
513     )
514     vimConnectionId = serializers.CharField(
515         help_text="Identifier of the VIM connection to manage this resource.",
516         required=False,
517         allow_null=True,
518         allow_blank=True
519     )
520     resourceProviderId = serializers.CharField(
521         help_text="Identifies the entity responsible for the management of this resource.",
522         required=False,
523         allow_null=True,
524         allow_blank=True
525     )
526     resourceId = serializers.CharField(
527         help_text="The identifier of the resource in the scope of the VIM or the resource provider.",
528         required=True
529     )
530     extCps = VnfExtCpDataSerializer(
531         help_text="External CPs of the VNF to be connected to this external VL.",
532         many=True,
533         required=False
534     )
535     extLinkPorts = ExtLinkPortDataSerializer(
536         help_text="Externally provided link ports to be used to connect external connection points to this external VL.",
537         many=True,
538         required=False
539     )
540
541
542 class ExtManagedVirtualLinkDataSerializer(serializers.Serializer):
543     id = serializers.CharField(
544         help_text="The identifier of the externally-managed internal VL instance.",
545         required=True
546     )
547     virtualLinkDescId = serializers.CharField(
548         help_text="The identifier of the VLD in the VNFD for this VL.",
549         required=True
550     )
551     vimConnectionId = serializers.CharField(
552         help_text="Identifier of the VIM connection to manage this resource.",
553         required=False,
554         allow_null=True,
555         allow_blank=True
556     )
557     resourceProviderId = serializers.CharField(
558         help_text="Identifies the entity responsible for the management of this resource.",
559         required=False,
560         allow_null=True,
561         allow_blank=True
562     )
563     resourceId = serializers.CharField(
564         help_text="The identifier of the resource in the scope of the VIM or the resource provider.",
565         required=True
566     )
567
568
569 class GrantLinksSerializer(serializers.Serializer):
570     self = LinkSerializer(
571         help_text="URI of this resource.",
572         required=True
573     )
574     vnfLcmOpOcc = LinkSerializer(
575         help_text="Related VNF lifecycle management operation occurrence.",
576         required=True
577     )
578     vnfInstance = LinkSerializer(
579         help_text="Related VNF instance.",
580         required=True
581     )
582
583
584 class GrantSerializer(serializers.Serializer):
585     id = serializers.CharField(
586         help_text="Identifier of the grant.",
587         required=True
588     )
589     vnfInstanceId = serializers.CharField(
590         help_text="Identifier of the related VNF instance.",
591         required=True
592     )
593     vnfLcmOpOccId = serializers.CharField(
594         help_text="Identifier of the related VNF lifecycle management operation occurrence.",
595         required=False,  # TODO required
596         allow_null=True,
597         allow_blank=True
598     )
599     vimConnections = VimConnectionInfoSerializer(
600         help_text="Provides information regarding VIM connections that are approved to be used by the VNFM to allocate resources.",
601         many=True,
602         required=False
603     )
604     zones = ZoneInfoSerializer(
605         help_text="Identifies resource zones where the resources are approved to be allocated by the VNFM.",
606         many=True,
607         required=False
608     )
609     zoneGroups = ZoneGroupInfoSerializer(
610         help_text="Information about groups of resource zones.",
611         many=True,
612         required=False
613     )
614     computeReservationId = serializers.CharField(
615         help_text="Information that identifies a reservation applicable to the compute resource requirements.",
616         required=False,
617         allow_null=True,
618         allow_blank=True
619     )
620     networkReservationId = serializers.CharField(
621         help_text="Information that identifies a reservation applicable to the network resource requirements.",
622         required=False,
623         allow_null=True,
624         allow_blank=True
625     )
626     storageReservationId = serializers.CharField(
627         help_text="Information that identifies a reservation applicable to the storage resource requirements.",
628         required=False,
629         allow_null=True,
630         allow_blank=True
631     )
632     addResources = GrantInfoSerializer(
633         help_text="List of resources that are approved to be added.",
634         many=True,
635         required=False
636     )
637     tempResources = GrantInfoSerializer(
638         help_text="List of resources that are approved to be temporarily instantiated during the runtime of the lifecycle operation.",
639         many=True,
640         required=False
641     )
642     removeResources = GrantInfoSerializer(
643         help_text="List of resources that are approved to be removed.",
644         many=True,
645         required=False
646     )
647     updateResources = GrantInfoSerializer(
648         help_text="List of resources that are approved to be modified.",
649         many=True,
650         required=False
651     )
652     vimAssets = VimAssetsSerializer(
653         help_text="Information about assets for the VNF that are managed by the NFVO in the VIM.",
654         required=False,
655         allow_null=True
656     )
657     extVirtualLinks = ExtVirtualLinkDataSerializer(
658         help_text="Information about external VLs to connect the VNF to.",
659         many=True,
660         required=False
661     )
662     extManagedVirtualLinks = ExtManagedVirtualLinkDataSerializer(
663         help_text="Information about internal VLs that are managed by other entities than the VNFM.",
664         many=True,
665         required=False
666     )
667     additionalParams = serializers.DictField(
668         help_text="Additional parameters passed by the NFVO, \
669         specific to the VNF and the LCM operation.",
670         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
671         required=False,
672         allow_null=True
673     )
674     _links = GrantLinksSerializer(
675         help_text="Links to resources related to this resource.",
676         required=False
677     )
678
679
680 class AffectedVnfcSerializer(serializers.Serializer):
681     id = serializers.CharField(
682         help_text="Identifier of the Vnfc instance.",
683         required=True
684     )
685     vduId = serializers.CharField(
686         help_text="Identifier of the related VDU in the VNFD.",
687         required=True
688     )
689     changeType = serializers.ChoiceField(
690         help_text="Signals the type of change.",
691         choices=["ADDED", "REMOVED", "MODIFIED", "TEMPORARY"],
692         required=True
693     )
694     computeResource = ResourceHandleSerializer(
695         help_text="Reference to the VirtualCompute resource.",
696         required=True
697     )
698     metadata = serializers.DictField(
699         help_text="Metadata about this resource.",
700         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
701         required=False,
702         allow_null=True
703     )
704     affectedVnfcCpIds = serializers.ListSerializer(
705         help_text="Identifiers of CP(s) of the VNFC instance that were affected by the change.",
706         child=serializers.CharField(help_text="Identifier In Vnf", allow_blank=True),
707         required=False,
708         allow_null=True
709     )
710     addedStorageResourceIds = serializers.ListSerializer(
711         help_text="References to VirtualStorage resources that have been added.",
712         child=serializers.CharField(help_text="Identifier In Vnf", allow_blank=True),
713         required=False,
714         allow_null=True
715     )
716     removedStorageResourceIds = serializers.ListSerializer(
717         help_text="References to VirtualStorage resources that have been removed.",
718         child=serializers.CharField(help_text="Identifier In Vnf", allow_blank=True),
719         required=False,
720         allow_null=True
721     )
722
723
724 class AffectedVirtualLinkSerializer(serializers.Serializer):
725     id = serializers.CharField(
726         help_text="Identifier of the virtual link instance.",
727         required=True
728     )
729     virtualLinkDescId = serializers.CharField(
730         help_text="Identifier of the related VLD in the VNFD.",
731         required=True
732     )
733     changeType = serializers.ChoiceField(
734         help_text="Signals the type of change.",
735         choices=["ADDED", "REMOVED", "MODIFIED", "TEMPORARY", "LINK_PORT_ADDED", "LINK_PORT_REMOVED"],
736         required=True
737     )
738     networkResource = ResourceHandleSerializer(
739         help_text="Reference to the VirtualNetwork resource.",
740         required=False,
741         allow_null=True
742     )
743     metadata = serializers.DictField(
744         help_text="Metadata about this resource.",
745         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
746         required=False,
747         allow_null=True
748     )
749
750
751 class AffectedVirtualStorageSerializer(serializers.Serializer):
752     id = serializers.CharField(
753         help_text="Identifier of the storage instance.",
754         required=True
755     )
756     virtualStorageDescId = serializers.CharField(
757         help_text="Identifier of the related VirtualStorage descriptor in the VNFD.",
758         required=True
759     )
760     changeType = serializers.ChoiceField(
761         help_text="Signals the type of change.",
762         choices=["ADDED", "REMOVED", "MODIFIED", "TEMPORARY"],
763         required=True
764     )
765     storageResource = ResourceHandleSerializer(
766         help_text="Reference to the VirtualStorage resource.",
767         required=False,
768         allow_null=True
769     )
770     metadata = serializers.DictField(
771         help_text="Metadata about this resource.",
772         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
773         required=False,
774         allow_null=True
775     )
776
777
778 class VnfInfoModificationsSerializer(serializers.Serializer):
779     vnfInstanceName = serializers.CharField(
780         help_text="If present, this attribute signals modifications of the vnfInstanceName attribute in VnfInstance.",
781         required=False,
782         allow_null=True,
783         allow_blank=True
784     )
785     vnfInstanceDescription = serializers.CharField(
786         help_text="If present, this attribute signals modifications of the vnfInstanceDescription attribute in VnfInstance.",
787         required=False,
788         allow_null=True,
789         allow_blank=True
790     )
791     vnfConfigurableProperties = serializers.DictField(
792         help_text="If present, this attribute signals modifications of the vnfConfigurableProperties attribute in VnfInstance.",
793         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
794         required=False,
795         allow_null=True
796     )
797     metadata = serializers.DictField(
798         help_text="If present, this attribute signals modifications of the metadata attribute in VnfInstance.",
799         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
800         required=False,
801         allow_null=True
802     )
803     extensions = serializers.DictField(
804         help_text="If present, this attribute signals modifications of the extensions attribute in VnfInstance.",
805         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
806         required=False,
807         allow_null=True
808     )
809     vimConnectionInfo = VimConnectionInfoSerializer(
810         help_text="If present, this attribute signals modifications of the vimConnectionInfo attribute in VnfInstance.",
811         many=True,
812         required=False
813     )
814     vnfPkgId = serializers.CharField(
815         help_text="If present, this attribute signals modifications of the vnfPkgId attribute in VnfInstance.",
816         required=False,
817         allow_null=True,
818         allow_blank=True
819     )
820     vnfdId = serializers.CharField(
821         help_text="If present, this attribute signals modifications of the vnfdId attribute in VnfInstance.",
822         required=False,
823         allow_null=True,
824         allow_blank=True
825     )
826     vnfProvider = serializers.CharField(
827         help_text="If present, this attribute signals modifications of the vnfProvider attribute in VnfInstance.",
828         required=False,
829         allow_null=True,
830         allow_blank=True
831     )
832     vnfProductName = serializers.CharField(
833         help_text="If present, this attribute signals modifications of the vnfProductName attribute in VnfInstance.",
834         required=False,
835         allow_null=True,
836         allow_blank=True
837     )
838     vnfSoftwareVersion = serializers.CharField(
839         help_text="If present, this attribute signals modifications of the vnfSoftwareVersion attribute in VnfInstance.",
840         required=False,
841         allow_null=True,
842         allow_blank=True
843     )
844     vnfdVersion = serializers.CharField(
845         help_text="If present, this attribute signals modifications of the vnfdVersion attribute in VnfInstance.",
846         required=False,
847         allow_null=True,
848         allow_blank=True
849     )
850
851
852 class ExtLinkPortInfoSerializer(serializers.Serializer):
853     id = serializers.CharField(
854         help_text="Identifier of this link port as provided by the entity that has created the link port.",
855         required=True
856     )
857     resourceHandle = ResourceHandleSerializer(
858         help_text="Reference to the virtualised resource realizing this link port.",
859         required=True
860     )
861     cpInstanceId = serializers.CharField(
862         help_text="Identifier of the external CP of the VNF connected to this link port.",
863         required=False,
864         allow_null=True,
865         allow_blank=True
866     )
867
868
869 class ExtVirtualLinkInfoSerializer(serializers.Serializer):
870     id = serializers.CharField(
871         help_text="Identifier of the external VL and the related external VL information instance.",
872         required=True
873     )
874     resourceHandle = ResourceHandleSerializer(
875         help_text="Reference to the resource realizing this VL.",
876         required=True
877     )
878     extLinkPorts = ExtLinkPortInfoSerializer(
879         help_text="Link ports of this VL.",
880         many=True,
881         required=False
882     )
883
884
885 class ProblemDetailsSerializer(serializers.Serializer):
886     type = serializers.CharField(
887         help_text="A URI reference according to IETF RFC 3986 [5] that identifies the problem type.",
888         required=False,
889         allow_null=True,
890         allow_blank=True
891     )
892     title = serializers.CharField(
893         help_text="A short, human-readable summary of the problem type.",
894         required=False,
895         allow_null=True,
896         allow_blank=True
897     )
898     status = serializers.IntegerField(
899         help_text="The HTTP status code for this occurrence of the problem.",
900         required=True
901     )
902     detail = serializers.CharField(
903         help_text="A human-readable explanation specific to this occurrence of the problem.",
904         required=True
905     )
906     instance = serializers.CharField(
907         help_text="A URI reference that identifies the specific occurrence of the problem.",
908         required=False,
909         allow_null=True,
910         allow_blank=True
911     )
912
913
914 class LccnLinksSerializer(serializers.Serializer):
915     vnfInstance = LinkSerializer(
916         help_text="Link to the resource representing the VNF instance to which the notified change applies.",
917         required=True
918     )
919     subscription = LinkSerializer(
920         help_text="Link to the related subscription.",
921         required=True
922     )
923     vnfLcmOpOcc = LinkSerializer(
924         help_text="Link to the VNF lifecycle management operation occurrence that this notification is related to.",
925         required=False,
926         allow_null=True
927     )
928
929
930 class VnfLcmOperationOccurrenceNotificationSerializer(serializers.Serializer):
931     id = serializers.CharField(
932         help_text="Identifier of this notification.",
933         required=True
934     )
935     notificationType = serializers.ChoiceField(
936         help_text="Discriminator for the different notification types.",
937         choices=[
938             'VnfLcmOperationOccurrenceNotification',
939             'VnfIdentifierCreationNotification',
940             'VnfIdentifierDeletionNotification'
941         ],
942         required=True
943     )
944     subscriptionId = serializers.CharField(
945         help_text="Identifier of the subscription that this notification relates to.",
946         required=True
947     )
948     timeStamp = serializers.CharField(
949         help_text="Date-time of the generation of the notification.",
950         required=True
951     )
952     notificationStatus = serializers.ChoiceField(
953         help_text="Indicates whether this notification reports about the start of a lifecycle operation or the result of a lifecycle operation.",
954         choices=["START", "RESULT"],
955         required=True
956     )
957     operationState = serializers.ChoiceField(
958         help_text="The state of the VNF LCM operation occurrence.",
959         choices=["STARTING", "PROCESSING", "COMPLETED", "FAILED_TEMP", "FAILED", "ROLLING_BACK", "ROLLED_BACK"],
960         required=True
961     )
962     vnfInstanceId = serializers.CharField(
963         help_text="The identifier of the VNF instance affected.",
964         required=True
965     )
966     operation = serializers.ChoiceField(
967         help_text="The lifecycle management operation.",
968         choices=["INSTANTIATE", "SCALE", "SCALE_TO_LEVEL", "CHANGE_FLAVOUR", "TERMINATE", "HEAL", "OPERATE", "CHANGE_EXT_CONN", "MODIFY_INFO"],
969         required=True
970     )
971     isAutomaticInvocation = serializers.BooleanField(
972         help_text="Set to true if this VNF LCM operation occurrence has been triggered by an automated procedure inside the VNFM.",
973         required=True
974     )
975     vnfLcmOpOccId = serializers.CharField(
976         help_text="The identifier of the VNF lifecycle management operation occurrence associated to the notification.",
977         required=True
978     )
979     affectedVnfcs = AffectedVnfcSerializer(
980         help_text="Information about VNFC instances that were affected during the lifecycle operation.",
981         many=True,
982         required=False
983     )
984     affectedVirtualLinks = AffectedVirtualLinkSerializer(
985         help_text="Information about VL instances that were affected during the lifecycle operation.",
986         many=True,
987         required=False
988     )
989     affectedVirtualStorages = AffectedVirtualStorageSerializer(
990         help_text="Information about virtualised storage instances that were affected during the lifecycle operation.",
991         many=True,
992         required=False
993     )
994     changedInfo = VnfInfoModificationsSerializer(
995         help_text="Information about the changed VNF instance information, including changed VNF configurable properties.",
996         required=False,
997         allow_null=True
998     )
999     changedExtConnectivity = ExtVirtualLinkInfoSerializer(
1000         help_text="Information about changed external connectivity.",
1001         many=True,
1002         required=False
1003     )
1004     error = ProblemDetailsSerializer(
1005         help_text="Details of the latest error, if one has occurred during executing the LCM operation",
1006         required=False,
1007         allow_null=True
1008     )
1009     _links = LccnLinksSerializer(
1010         help_text="Links to resources related to this notification.",
1011         required=False,
1012         allow_null=True
1013     )
1014
1015
1016 class VnfIdentifierCreationNotificationSerializer(serializers.Serializer):
1017     id = serializers.CharField(
1018         help_text="Identifier of this notification. \
1019         If a notification is sent multiple times due to multiple subscriptions, \
1020         the id attribute of all these notifications shall have the same value.",
1021         required=True,
1022         allow_null=False,
1023         allow_blank=False
1024     )
1025     notificationType = serializers.ChoiceField(
1026         help_text="Discriminator for the different notification types.",
1027         choices=[
1028             'VnfLcmOperationOccurrenceNotification',
1029             'VnfIdentifierCreationNotification',
1030             'VnfIdentifierDeletionNotification'
1031         ],
1032         required=True
1033     )
1034     subscriptionId = serializers.CharField(
1035         help_text="Identifier of the subscription that this notification relates to.",
1036         required=False,
1037         allow_null=True,
1038         allow_blank=True
1039     )
1040     timeStamp = serializers.DateTimeField(
1041         help_text="Date-time of the generation of the notification.",
1042         required=True,
1043         allow_null=False,
1044     )
1045     vnfInstanceId = serializers.CharField(
1046         help_text="The created VNF instance identifier.",
1047         required=True,
1048         allow_null=False,
1049         allow_blank=False
1050     )
1051     _links = LccnLinksSerializer(
1052         help_text="Links to resources related to this notification.",
1053         required=True,
1054         allow_null=False
1055     )
1056
1057
1058 class VnfIdentifierDeletionNotificationSerializer(serializers.Serializer):
1059     id = serializers.CharField(
1060         help_text="Identifier of this notification. \
1061         If a notification is sent multiple times due to multiple subscriptions, \
1062         the id attribute of all these notifications shall have the same value.",
1063         required=True,
1064         allow_null=False,
1065         allow_blank=False
1066     )
1067     notificationType = serializers.ChoiceField(
1068         help_text="Discriminator for the different notification types.",
1069         choices=[
1070             'VnfLcmOperationOccurrenceNotification',
1071             'VnfIdentifierCreationNotification',
1072             'VnfIdentifierDeletionNotification'
1073         ],
1074         required=True
1075     )
1076     subscriptionId = serializers.CharField(
1077         help_text="Identifier of the subscription that this notification relates to.",
1078         required=False,
1079         allow_null=True,
1080         allow_blank=True
1081     )
1082     timeStamp = serializers.DateTimeField(
1083         help_text="Date-time of the generation of the notification.",
1084         required=True,
1085         allow_null=False,
1086     )
1087     vnfInstanceId = serializers.CharField(
1088         help_text="The deleted VNF instance identifier.",
1089         required=True,
1090         allow_null=False,
1091         allow_blank=False
1092     )
1093     _links = LccnLinksSerializer(
1094         help_text="Links to resources related to this notification.",
1095         required=True,
1096         allow_null=False
1097     )