update version of lcm
[vfc/nfvo/lcm.git] / lcm / v2 / serializers.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,
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,
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", "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
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,
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     _links = GrantLinksSerializer(
668         help_text="Links to resources related to this resource.",
669         required=False
670     )
671
672
673 class AffectedVnfcSerializer(serializers.Serializer):
674     id = serializers.CharField(
675         help_text="Identifier of the Vnfc instance.",
676         required=True
677     )
678     vduId = serializers.CharField(
679         help_text="Identifier of the related VDU in the VNFD.",
680         required=True
681     )
682     changeType = serializers.ChoiceField(
683         help_text="Signals the type of change.",
684         choices=["ADDED", "REMOVED", "MODIFIED", "TEMPORARY"],
685         required=True
686     )
687     computeResource = ResourceHandleSerializer(
688         help_text="Reference to the VirtualCompute resource.",
689         required=True
690     )
691     metadata = serializers.DictField(
692         help_text="Metadata about this resource.",
693         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
694         required=False,
695         allow_null=True
696     )
697     affectedVnfcCpIds = serializers.ListSerializer(
698         help_text="Identifiers of CP(s) of the VNFC instance that were affected by the change.",
699         child=serializers.CharField(help_text="Identifier In Vnf", allow_blank=True),
700         required=False,
701         allow_null=True
702     )
703     addedStorageResourceIds = serializers.ListSerializer(
704         help_text="References to VirtualStorage resources that have been added.",
705         child=serializers.CharField(help_text="Identifier In Vnf", allow_blank=True),
706         required=False,
707         allow_null=True
708     )
709     removedStorageResourceIds = serializers.ListSerializer(
710         help_text="References to VirtualStorage resources that have been removed.",
711         child=serializers.CharField(help_text="Identifier In Vnf", allow_blank=True),
712         required=False,
713         allow_null=True
714     )
715
716
717 class AffectedVirtualLinkSerializer(serializers.Serializer):
718     id = serializers.CharField(
719         help_text="Identifier of the virtual link instance.",
720         required=True
721     )
722     virtualLinkDescId = serializers.CharField(
723         help_text="Identifier of the related VLD in the VNFD.",
724         required=True
725     )
726     changeType = serializers.ChoiceField(
727         help_text="Signals the type of change.",
728         choices=["ADDED", "REMOVED", "MODIFIED", "TEMPORARY", "LINK_PORT_ADDED", "LINK_PORT_REMOVED"],
729         required=True
730     )
731     networkResource = ResourceHandleSerializer(
732         help_text="Reference to the VirtualNetwork resource.",
733         required=False,
734         allow_null=True
735     )
736     metadata = serializers.DictField(
737         help_text="Metadata about this resource.",
738         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
739         required=False,
740         allow_null=True
741     )
742
743
744 class AffectedVirtualStorageSerializer(serializers.Serializer):
745     id = serializers.CharField(
746         help_text="Identifier of the storage instance.",
747         required=True
748     )
749     virtualStorageDescId = serializers.CharField(
750         help_text="Identifier of the related VirtualStorage descriptor in the VNFD.",
751         required=True
752     )
753     changeType = serializers.ChoiceField(
754         help_text="Signals the type of change.",
755         choices=["ADDED", "REMOVED", "MODIFIED", "TEMPORARY"],
756         required=True
757     )
758     storageResource = ResourceHandleSerializer(
759         help_text="Reference to the VirtualStorage resource.",
760         required=False,
761         allow_null=True
762     )
763     metadata = serializers.DictField(
764         help_text="Metadata about this resource.",
765         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
766         required=False,
767         allow_null=True
768     )
769
770
771 class VnfInfoModificationsSerializer(serializers.Serializer):
772     vnfInstanceName = serializers.CharField(
773         help_text="If present, this attribute signals modifications of the vnfInstanceName attribute in VnfInstance.",
774         required=False,
775         allow_null=True,
776         allow_blank=True
777     )
778     vnfInstanceDescription = serializers.CharField(
779         help_text="If present, this attribute signals modifications of the vnfInstanceDescription attribute in VnfInstance.",
780         required=False,
781         allow_null=True,
782         allow_blank=True
783     )
784     vnfConfigurableProperties = serializers.DictField(
785         help_text="If present, this attribute signals modifications of the vnfConfigurableProperties attribute in VnfInstance.",
786         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
787         required=False,
788         allow_null=True
789     )
790     metadata = serializers.DictField(
791         help_text="If present, this attribute signals modifications of the metadata attribute in VnfInstance.",
792         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
793         required=False,
794         allow_null=True
795     )
796     extensions = serializers.DictField(
797         help_text="If present, this attribute signals modifications of the extensions attribute in VnfInstance.",
798         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
799         required=False,
800         allow_null=True
801     )
802     vimConnectionInfo = VimConnectionInfoSerializer(
803         help_text="If present, this attribute signals modifications of the vimConnectionInfo attribute in VnfInstance.",
804         many=True,
805         required=False
806     )
807     vnfPkgId = serializers.CharField(
808         help_text="If present, this attribute signals modifications of the vnfPkgId attribute in VnfInstance.",
809         required=False,
810         allow_null=True,
811         allow_blank=True
812     )
813     vnfdId = serializers.CharField(
814         help_text="If present, this attribute signals modifications of the vnfdId attribute in VnfInstance.",
815         required=False,
816         allow_null=True,
817         allow_blank=True
818     )
819     vnfProvider = serializers.CharField(
820         help_text="If present, this attribute signals modifications of the vnfProvider attribute in VnfInstance.",
821         required=False,
822         allow_null=True,
823         allow_blank=True
824     )
825     vnfProductName = serializers.CharField(
826         help_text="If present, this attribute signals modifications of the vnfProductName attribute in VnfInstance.",
827         required=False,
828         allow_null=True,
829         allow_blank=True
830     )
831     vnfSoftwareVersion = serializers.CharField(
832         help_text="If present, this attribute signals modifications of the vnfSoftwareVersion attribute in VnfInstance.",
833         required=False,
834         allow_null=True,
835         allow_blank=True
836     )
837     vnfdVersion = serializers.CharField(
838         help_text="If present, this attribute signals modifications of the vnfdVersion attribute in VnfInstance.",
839         required=False,
840         allow_null=True,
841         allow_blank=True
842     )
843
844
845 class ExtLinkPortInfoSerializer(serializers.Serializer):
846     id = serializers.CharField(
847         help_text="Identifier of this link port as provided by the entity that has created the link port.",
848         required=True
849     )
850     resourceHandle = ResourceHandleSerializer(
851         help_text="Reference to the virtualised resource realizing this link port.",
852         required=True
853     )
854     cpInstanceId = serializers.CharField(
855         help_text="Identifier of the external CP of the VNF connected to this link port.",
856         required=False,
857         allow_null=True,
858         allow_blank=True
859     )
860
861
862 class ExtVirtualLinkInfoSerializer(serializers.Serializer):
863     id = serializers.CharField(
864         help_text="Identifier of the external VL and the related external VL information instance.",
865         required=True
866     )
867     resourceHandle = ResourceHandleSerializer(
868         help_text="Reference to the resource realizing this VL.",
869         required=True
870     )
871     extLinkPorts = ExtLinkPortInfoSerializer(
872         help_text="Link ports of this VL.",
873         many=True,
874         required=False
875     )
876
877
878 class ProblemDetailsSerializer(serializers.Serializer):
879     type = serializers.CharField(
880         help_text="A URI reference according to IETF RFC 3986 [5] that identifies the problem type.",
881         required=False,
882         allow_null=True,
883         allow_blank=True
884     )
885     title = serializers.CharField(
886         help_text="A short, human-readable summary of the problem type.",
887         required=False,
888         allow_null=True,
889         allow_blank=True
890     )
891     status = serializers.IntegerField(
892         help_text="The HTTP status code for this occurrence of the problem.",
893         required=True
894     )
895     detail = serializers.CharField(
896         help_text="A human-readable explanation specific to this occurrence of the problem.",
897         required=True
898     )
899     instance = serializers.CharField(
900         help_text="A URI reference that identifies the specific occurrence of the problem.",
901         required=False,
902         allow_null=True,
903         allow_blank=True
904     )
905
906
907 class LccnLinksSerializer(serializers.Serializer):
908     vnfInstance = LinkSerializer(
909         help_text="Link to the resource representing the VNF instance to which the notified change applies.",
910         required=True
911     )
912     subscription = LinkSerializer(
913         help_text="Link to the related subscription.",
914         required=True
915     )
916     vnfLcmOpOcc = LinkSerializer(
917         help_text="Link to the VNF lifecycle management operation occurrence that this notification is related to.",
918         required=False,
919         allow_null=True
920     )
921
922
923 class VnfLcmOperationOccurrenceNotificationSerializer(serializers.Serializer):
924     id = serializers.CharField(
925         help_text="Identifier of this notification.",
926         required=True
927     )
928     notificationType = serializers.CharField(
929         help_text="Discriminator for the different notification types.",
930         required=True
931     )
932     subscriptionId = serializers.CharField(
933         help_text="Identifier of the subscription that this notification relates to.",
934         required=True
935     )
936     timeStamp = serializers.CharField(
937         help_text="Date-time of the generation of the notification.",
938         required=True
939     )
940     notificationStatus = serializers.ChoiceField(
941         help_text="Indicates whether this notification reports about the start of a lifecycle operation or the result of a lifecycle operation.",
942         choices=["START", "RESULT"],
943         required=True
944     )
945     operationState = serializers.ChoiceField(
946         help_text="The state of the VNF LCM operation occurrence.",
947         choices=["STARTING", "PROCESSING", "COMPLETED", "FAILED_TEMP", "FAILED", "ROLLING_BACK", "ROLLED_BACK"],
948         required=True
949     )
950     vnfInstanceId = serializers.CharField(
951         help_text="The identifier of the VNF instance affected.",
952         required=True
953     )
954     operation = serializers.ChoiceField(
955         help_text="The lifecycle management operation.",
956         choices=["INSTANTIATE", "SCALE", "SCALE_TO_LEVEL", "CHANGE_FLAVOUR", "TERMINATE", "HEAL", "OPERATE", "CHANGE_EXT_CONN", "MODIFY_INFO"],
957         required=True
958     )
959     isAutomaticInvocation = serializers.BooleanField(
960         help_text="Set to true if this VNF LCM operation occurrence has been triggered by an automated procedure inside the VNFM.",
961         required=True
962     )
963     vnfLcmOpOccId = serializers.CharField(
964         help_text="The identifier of the VNF lifecycle management operation occurrence associated to the notification.",
965         required=True
966     )
967     affectedVnfcs = AffectedVnfcSerializer(
968         help_text="Information about VNFC instances that were affected during the lifecycle operation.",
969         many=True,
970         required=False
971     )
972     affectedVirtualLinks = AffectedVirtualLinkSerializer(
973         help_text="Information about VL instances that were affected during the lifecycle operation.",
974         many=True,
975         required=False
976     )
977     affectedVirtualStorages = AffectedVirtualStorageSerializer(
978         help_text="Information about virtualised storage instances that were affected during the lifecycle operation.",
979         many=True,
980         required=False
981     )
982     changedInfo = VnfInfoModificationsSerializer(
983         help_text="Information about the changed VNF instance information, including changed VNF configurable properties.",
984         required=False,
985         allow_null=True
986     )
987     changedExtConnectivity = ExtVirtualLinkInfoSerializer(
988         help_text="Information about changed external connectivity.",
989         many=True,
990         required=False
991     )
992     error = ProblemDetailsSerializer(
993         help_text="Details of the latest error, if one has occurred during executing the LCM operation",
994         required=False,
995         allow_null=True
996     )
997     _links = LccnLinksSerializer(
998         help_text="Links to resources related to this notification.",
999         required=False,
1000         allow_null=True
1001     )