modify field
[vfc/nfvo/lcm.git] / lcm / ns / serializers / sol / ns_instance.py
1 # Copyright 2019 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
16 from rest_framework import serializers
17
18 from lcm.ns.serializers.sol.pub_serializers import LinkSerializer
19 from lcm.ns.serializers.sol.cp_serializers import CpProtocolDataSerializer, CpProtocolInfoSerializer, VnfExtCpInfoSerializer
20 from lcm.ns.serializers.sol.resource_handle import ResourceHandleSerializer
21 from lcm.ns.serializers.sol.ext_virtual_link_info import ExtVirtualLinkInfoSerializer
22 from lcm.ns.serializers.sol.ext_managed_virtual_link_info import ExtManagedVirtualLinkInfo, VnfLinkPortInfo
23 from lcm.ns.serializers.sol.pub_serializers import AffinityOrAntiAffinityRuleSerializer
24 from lcm.ns.enum import IPADDRESSES_TYPE, INSTANTIATION_STATE, VNF_STATE, NFP_STATE, PROTOCOL
25 from lcm.pub.utils.enumutil import enum_to_list
26
27
28 class VnfScaleInfoSerializer(serializers.Serializer):
29     aspectlId = serializers.Serializer(
30         help_text="Identifier of the scaling aspect",
31         required=True)
32     scaleLevel = serializers.Serializer(
33         help_text="The scale level for that aspect.",
34         required=True)
35
36
37 class NsScaleInfoSerializer(serializers.Serializer):
38     nsScalingAspectId = serializers.CharField(
39         help_text="Identifier of the NS scaling aspect.",
40         required=True)
41     nsScaleLevelId = serializers.CharField(
42         help_text="Identifier of the NS scale level.",
43         required=True)
44
45
46 class VnfcCpInfo(serializers.Serializer):
47     id = serializers.CharField(
48         help_text="Identifier of the external CP instance and the related information instance.",
49         required=True)
50     cpdId = serializers.CharField(
51         help_text="Identifier of the external CPD, VnfExtCpd, in the VNFD.",
52         required=True)
53     vnfExtCpId = serializers.CharField(
54         help_text="When the VNFC CP is exposed as external CP of the VNF, the identifier of this external VNF CP.",
55         required=False)
56     cpProtocolInfo = CpProtocolInfoSerializer(
57         help_text="Network protocol information for this CP.",
58         many=True,
59         required=False)
60     vnfLinkPortId = serializers.CharField(
61         help_text="Identifier of the vnfLinkPorts structure in the vnfVirtualLinkResourceInfo structure.",
62         required=True)
63
64
65 class VnfcResourceInfoSerializer(serializers.Serializer):
66     id = serializers.CharField(
67         help_text="Identifier of this VnfcResourceInfo instance.",
68         max_length=255,
69         required=False,
70         allow_null=False)
71     vduId = serializers.CharField(
72         help_text="Reference to the applicable VDU in the VNFD.",
73         max_length=255,
74         required=False,
75         allow_null=False)
76     computeResource = ResourceHandleSerializer(
77         help_text="Reference to the VirtualCompute resource.",
78         required=True,
79         allow_null=False)
80     storageResourceIds = serializers.ListSerializer(
81         help_text="References to the VirtualStorage resources. The value refers to a VirtualStorageResourceInfo item in the VnfInstance.",
82         child=serializers.CharField(help_text="Identifier In Vnf", allow_blank=True),
83         required=False,
84         allow_null=True)
85     reservationId = serializers.CharField(
86         help_text="The reservation identifier applicable to the resource.",
87         max_length=255,
88         required=False,
89         allow_null=True,
90         allow_blank=True)
91     vnfcCpInfo = VnfcCpInfo(
92         help_text="CPs of the VNFC instance. Shall be present when that particular CP of the VNFC instance is associated to an external CP of the VNF instance.",
93         many=True,
94         required=False,
95         allow_null=True)
96     metadata = serializers.DictField(
97         help_text="Metadata about this resource.",
98         required=False)
99
100
101 # class VnfLinkPortInfo(serializers.Serializer):
102 #     id = serializers.CharField(
103 #         help_text="Identifier of this link port as provided by the entity that has created the link port.",
104 #         max_length=255,
105 #         required=True,
106 #         allow_null=False,
107 #         allow_blank=False)
108 #     resourceHandle = ResourceHandleSerializer(
109 #         help_text="Reference to the virtualised network resource realizing this link port.",
110 #         required=True,
111 #         allow_null=False)
112 #     cpInstanceId = serializers.CharField(
113 #         help_text="When the link port is used for external connectivity by the VNF, \
114 #         this attribute represents the identifier of the external CP of the VNF to be connected to this link port.",
115 #         max_length=255,
116 #         required=False,
117 #         allow_null=True,
118 #         allow_blank=True)
119
120
121 class VnfVirtualLinkResourceInfoSerializer(serializers.Serializer):
122     id = serializers.CharField(
123         help_text="Identifier of this VnfVirtualLinkResourceInfo instance.",
124         max_length=255,
125         required=True,
126         allow_null=False,
127         allow_blank=False)
128     virtualLinkDescId = serializers.CharField(
129         help_text="Identifier of the VNF Virtual Link Descriptor (VLD) in the VNFD.",
130         max_length=255,
131         required=True,
132         allow_null=False,
133         allow_blank=False)
134     networkResource = ResourceHandleSerializer(
135         help_text="Reference to the VirtualNetwork resource.",
136         required=True,
137         allow_null=False)
138     reservationId = serializers.CharField(
139         help_text="The reservation identifier applicable to the resource.",
140         max_length=255,
141         required=False,
142         allow_null=True,
143         allow_blank=True)
144     vnfLinkPorts = VnfLinkPortInfo(
145         help_text="Links ports of this VL. \
146         Shall be present when the linkPort is used for external connectivity by the VNF",
147         many=True,
148         required=False,
149         allow_null=True)
150     metadata = serializers.DictField(
151         help_text="Metadata about this resource.",
152         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
153         required=False,
154         allow_null=True)
155
156
157 class VirtualStorageResourceInfoSerializer(serializers.Serializer):
158     id = serializers.CharField(
159         help_text="Identifier of this VirtualStorageResourceInfo instance.",
160         max_length=255,
161         required=True,
162         allow_null=False,
163         allow_blank=False)
164     virtualStorageDescId = serializers.CharField(
165         help_text="Identifier of the VirtualStorageDesc in the VNFD.",
166         max_length=255,
167         required=False,
168         allow_null=True,
169         allow_blank=True)
170     storageResource = ResourceHandleSerializer(
171         help_text="Reference to the VirtualStorage resource.",
172         required=True,
173         allow_null=False)
174     reservationId = serializers.CharField(
175         help_text="The reservation identifier applicable to the resource.",
176         max_length=255,
177         required=False,
178         allow_null=True,
179         allow_blank=True)
180     metadata = serializers.DictField(
181         help_text="Metadata about this resource.",
182         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
183         required=False,
184         allow_null=True)
185
186
187 class InstantiatedVnfInfo(serializers.Serializer):
188     flavourId = serializers.CharField(
189         help_text="Identifier of the VNF deployment flavour applied to this VNF instance.",
190         max_length=255,
191         required=True,
192         allow_null=True,
193         allow_blank=False)
194     vnfState = serializers.ChoiceField(
195         help_text="State of the VNF instance.",
196         choices=enum_to_list(VNF_STATE),
197         required=True,
198         allow_null=True,
199         allow_blank=False)
200     scaleStatus = VnfScaleInfoSerializer(
201         help_text="Scale status of the VNF, one entry per aspect. \
202         Represents for every scaling aspect how big the VNF has been scaled w.r.t. that aspect.",
203         many=True,
204         required=False,
205         allow_null=True)
206     extCpInfo = VnfExtCpInfoSerializer(
207         help_text="Information about the external CPs exposed by the VNF instance.",
208         many=True,
209         required=True,
210         allow_null=False)
211     extVirtualLinkInfo = ExtVirtualLinkInfoSerializer(
212         help_text="Information about the external VLs the VNF instance is connected to.",
213         many=True,
214         required=False,
215         allow_null=True)
216     extManagedVirtualLinkInfo = ExtManagedVirtualLinkInfo(
217         help_text="Information about the externally-managed inner VLs of the VNF instance.",
218         many=True,
219         required=False,
220         allow_null=True)
221     monitoringParameters = serializers.DictField(
222         help_text="Active monitoring parameters.",
223         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
224         required=False,
225         allow_null=True)
226     localizationLanguage = serializers.CharField(
227         help_text="Information about localization language of the VNF.",
228         max_length=255,
229         required=False,
230         allow_null=True,
231         allow_blank=True)
232     vnfcResourceInfo = VnfcResourceInfoSerializer(
233         help_text="Information about the virtualised compute and storage resources used by the VNFCs of the VNF instance.",
234         many=True,
235         required=False,
236         allow_null=True)
237     vnfVirtualLinkResourceInfo = VnfVirtualLinkResourceInfoSerializer(
238         help_text="Information about the virtualised network resources used by the VLs of the VNF instance.",
239         many=True,
240         required=False,
241         allow_null=True)
242     virtualStorageResourceInfo = VirtualStorageResourceInfoSerializer(
243         help_text="Information about the virtualised storage resources used as storage for the VNF instance.",
244         many=True,
245         required=False,
246         allow_null=True)
247
248
249 class VnfInstanceLinks(serializers.Serializer):
250     href = LinkSerializer(
251         help_text="URI of this resource.",
252         required=True,
253         allow_null=False)
254     indicators = LinkSerializer(
255         help_text="Indicators related to this VNF instance.",
256         required=False,
257         allow_null=True)
258     instantiate = LinkSerializer(
259         help_text="Link to the instantiate task resource.",
260         required=False,
261         allow_null=True)
262     termiante = LinkSerializer(
263         help_text="Link to the terminate task resource.",
264         required=False,
265         allow_null=True)
266     scale = LinkSerializer(
267         help_text="Link to the scale task resource.",
268         required=False,
269         allow_null=True)
270     scaleToLevel = LinkSerializer(
271         help_text="Link to the scale_to_level task resource.",
272         required=False,
273         allow_null=True)
274     changeFlavour = LinkSerializer(
275         help_text="Link to the change_flavour task resource.",
276         required=False,
277         allow_null=True)
278     heal = LinkSerializer(
279         help_text="Link to the heal task resource.",
280         required=False,
281         allow_null=True)
282     operate = LinkSerializer(
283         help_text="Link to the operate task resource.",
284         required=False,
285         allow_null=True)
286     changeExtConn = LinkSerializer(
287         help_text="Link to the change_ext_conn task resource.",
288         required=False,
289         allow_null=True)
290
291
292 class VnfInstanceSerializer(serializers.Serializer):
293     id = serializers.CharField(
294         help_text="Identifier of the VNF instance.",
295         max_length=255,
296         required=True,
297         allow_null=False,
298         allow_blank=False)
299     vnfInstanceName = serializers.CharField(
300         help_text="Name of the VNF instance.",
301         max_length=255,
302         required=False,
303         allow_null=True,
304         allow_blank=True)
305     vnfInstanceDescription = serializers.CharField(
306         help_text="Human-readable description of the VNF instance.",
307         required=False,
308         allow_null=True,
309         allow_blank=True)
310     vnfdId = serializers.CharField(
311         help_text="Identifier of the VNFD on which the VNF instance is based.",
312         max_length=255,
313         required=False,
314         allow_null=True,
315         allow_blank=True)
316     vnfProvider = serializers.CharField(
317         help_text="Provider of the VNF and the VNFD.",
318         max_length=255,
319         required=True,
320         allow_null=True,
321         allow_blank=False)
322     vnfProductName = serializers.CharField(
323         help_text="Name to identify the VNF Product.",
324         max_length=255,
325         required=False,
326         allow_null=True,
327         allow_blank=True)
328     vnfSoftwareVersion = serializers.CharField(
329         help_text="Software version of the VNF.",
330         max_length=255,
331         required=False,
332         allow_null=True,
333         allow_blank=True)
334     vnfdVersion = serializers.CharField(
335         help_text="Identifies the version of the VNFD.",
336         max_length=255,
337         required=True,
338         allow_null=True,
339         allow_blank=False)
340     vnfPkgId = serializers.CharField(
341         help_text="Identifier of information held by the NFVO about the specific VNF package on which the VNF is based. \
342         This attribute can be modified with the PATCH method.",
343         max_length=255,
344         required=True,
345         allow_null=True,
346         allow_blank=False)
347     vnfConfigurableProperties = serializers.DictField(
348         help_text="Current values of the configurable properties of the VNF instance. \
349         Configurable properties referred in this attribute are declared in the VNFD",
350         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
351         required=False,
352         allow_null=True,)
353     vimId = serializers.ListField(
354         help_text="Identifier set of a VIM that manages resources for the VNF instance.",
355         child=serializers.CharField(help_text="Identifier of a VIM that manages resources for the VNF instance.", allow_null=False),
356         required=False)
357     instantiationState = serializers.ChoiceField(
358         help_text="The instantiation state of the VNF.",
359         choices=enum_to_list(INSTANTIATION_STATE),
360         required=True,
361         allow_null=False,
362         allow_blank=False)
363     instantiatedVnfInfo = InstantiatedVnfInfo(
364         help_text="Information specific to an instantiated VNF instance. \
365         This attribute shall be present if the instantiateState attribute value is INSTANTIATED",
366         required=False,
367         allow_null=True)
368     metadata = serializers.DictField(
369         help_text="Additional VNF-specific metadata describing the VNF instance.\
370         This attribute can be modified with the PATCH method.",
371         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
372         required=False,
373         allow_null=True)
374     extensions = serializers.DictField(
375         help_text="VNF-specific attributes that affect the lifecycle management of this VNF instance by the VNFM, or the lifecycle management scripts. \
376         This attribute can be modified with the PATCH method.",
377         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
378         required=False,
379         allow_null=True)
380     _links = VnfInstanceLinks(
381         help_text="Links to resources related to this resource.",
382         required=False,
383         allow_null=False)
384
385
386 class PnfExtCpInfoSerializer(serializers.Serializer):
387     cpInstanceId = serializers.CharField(
388         help_text="Identifier of the CP in the scope of the PNF.",
389         required=True)
390
391     cpdId = serializers.CharField(
392         help_text="Identifier of (reference to) the Connection Point Descriptor (CPD) for this CP.",
393         required=True)
394
395     cpProtocolData = CpProtocolDataSerializer(
396         help_text="Parameters for configuring the network protocols on the CP.",
397         required=True,
398         many=True)
399
400
401 class PnfInfoSerializer(serializers.Serializer):
402     pnfId = serializers.CharField(
403         help_text="Identifier of the PNF.",
404         required=True)
405     pnfName = serializers.CharField(
406         help_text="Name of the PNF.",
407         required=True)
408     pnfdId = serializers.CharField(
409         help_text="Identifier of the PNFD on which the PNF is based.",
410         required=True)
411     pnfdInfoId = serializers.CharField(
412         help_text="Identifier of the PNFD information onject related to this PNF.",
413         required=True)
414     pnfProfileId = serializers.CharField(
415         help_text="Identifier of the related PnfProfile in the NSD on which the PNF is based.",
416         required=True)
417     cpInfo = PnfExtCpInfoSerializer(
418         help_text="Information on the external CP of the PNF",
419         required=True,
420         many=True)
421
422
423 class NsLinkPortInfo(serializers.Serializer):
424     id = serializers.CharField(
425         help_text="Identifier of this link port as provided by the entity that has created the link port.",
426         max_length=255,
427         required=True,
428         allow_blank=False,
429         allow_null=False)
430     resourceHandle = ResourceHandleSerializer(
431         help_text="Reference to the virtualised resource realizing this link port.",
432         required=True,
433         allow_null=False)
434     cpInstanceId = serializers.CharField(
435         help_text="Identifier of the external CP of the VNF connected to this link port. \
436         There shall be at most one link port associated with any external connection point instance.",
437         max_length=255,
438         required=False,
439         allow_blank=True,
440         allow_null=True)
441
442
443 class NsVirtualLinkInfoSerializer(serializers.Serializer):
444     id = serializers.CharField(
445         help_text="Identifier of the VL instance.",
446         required=True)
447     nsVirtualLinkDescId = serializers.CharField(
448         help_text="Identifier of the VLD in the NSD.",
449         required=True)
450     nsVirtualLinkProfileId = serializers.CharField(
451         help_text="Identifier of the VL profile in the NSD.",
452         required=True)
453     resourceHandle = ResourceHandleSerializer(
454         help_text="Identifier(s) of the virtualised network resource(s) realizing the VL instance",
455         required=True,
456         many=True)
457     linkPort = NsLinkPortInfo(
458         help_text="Link ports of this VL.",
459         many=True,
460         required=False,
461         allow_null=True)
462
463
464 class NsCpHandleSerializer(serializers.Serializer):
465     vnfInstanceId = serializers.CharField(
466         help_text="Identifier of the VNF instance associated to the CP instance.",
467         required=False,
468         allow_null=True)
469     vnfExtCpInstanceId = serializers.CharField(
470         help_text="Identifier of the VNF external CP instance in the scope of the VNF instance.",
471         required=False,
472         allow_null=True)
473     pnfInfoId = serializers.CharField(
474         help_text="Identifier of the PNF instance associated to the CP instance.",
475         required=False,
476         allow_null=True)
477     pnfExtCpInstanceId = serializers.CharField(
478         help_text="Identifier of the PNF external CP instance in the scope of the PNF.",
479         required=False,
480         allow_null=True)
481     nsInstanceId = serializers.CharField(
482         help_text="Identifier of the NS instance associated to the SAP instance",
483         required=False,
484         allow_null=True)
485     nsSapInstanceId = serializers.CharField(
486         help_text="Identifier of the SAP instance in the scope of the NS instance.",
487         required=False,
488         allow_null=True)
489
490
491 class MaskSerializer(serializers.Serializer):
492     startingPoint = serializers.CharField(
493         help_text="Indicates the offset between the last bit of the source mac address and the first bit of the sequence of bits to be matched.",
494         required=True)
495     length = serializers.CharField(
496         help_text="Indicates the number of bits to be matched.",
497         required=True)
498     value = serializers.CharField(
499         help_text="Provide the sequence of bit values to be matched.",
500         required=True)
501
502
503 class NfpRuleSerializer(serializers.Serializer):
504     etherDestinationAddress = serializers.CharField(
505         help_text="Indicates a destination Mac address",
506         required=False,
507         allow_null=True)
508     etherSourceAddress = serializers.CharField(
509         help_text="Indicates a source Mac address",
510         required=False,
511         allow_null=True)
512     etherType = serializers.ChoiceField(
513         help_text="Indicates the protocol carried over the Ethernet layer",
514         choices=enum_to_list(IPADDRESSES_TYPE),
515         required=False,
516         allow_null=True)
517     vlanTag = serializers.ListField(
518         help_text="ndicates a VLAN identifier in an IEEE 802.1Q-2014 tag",
519         required=False,
520         allow_null=True)
521     protocol = serializers.ChoiceField(
522         help_text="Indicates the L4 protocol, For IPv4 [7] this corresponds to"
523                   "the field called Protocol to identifythe next level protocol",
524         choices=enum_to_list(PROTOCOL),
525         required=False,
526         allow_null=True)
527     dscp = serializers.CharField(
528         help_text="For IPv4 [7] a string of 0 and 1 digits that corresponds to the"
529                   "6-bit Differentiated Services Code Point (DSCP) field of the IP header.",
530         required=False,
531         allow_null=True)
532     sourcePortRange = serializers.CharField(
533         help_text="Indicates a range of source ports",
534         required=False,
535         allow_null=True)
536     destinationPortRange = serializers.CharField(
537         help_text="Indicates a range of destination ports",
538         required=False,
539         allow_null=True)
540     sourceIpAddressPrefix = serializers.CharField(
541         help_text="Indicates the source IP address range in CIDR format.",
542         required=False,
543         allow_null=True)
544     destinationIpAddressPrefix = serializers.CharField(
545         help_text="Indicates the destination IP address range in CIDR format.",
546         required=False,
547         allow_null=True)
548     extendedCriteria = MaskSerializer(
549         help_text="Indicates values of specific bits in a frame",
550         required=False,
551         allow_null=True,
552         many=True)
553
554
555 class NfpInfoSerializer(serializers.Serializer):
556     id = serializers.CharField(
557         help_text="Identifier of this NFP instance.",
558         required=True)
559     nfpdId = serializers.CharField(
560         help_text="Identifier of the NFPD used to instantiate this NFP instance.",
561         required=False,
562         allow_null=True)
563     nfpName = serializers.CharField(
564         help_text="Human readable name for the NFP instance.",
565         required=False,
566         allow_null=True)
567     description = serializers.CharField(
568         help_text="Human readable description for the NFP instance.",
569         required=True)
570     nscpHandle = NsCpHandleSerializer(
571         help_text="Identifier(s) of the CPs and/or SAPs which the NFP passes by",
572         required=True,
573         many=True)
574     totalCp = serializers.CharField(
575         help_text="Total number of CP and SAP instances in this NFP instance.",
576         required=False,
577         allow_null=True)
578     nfpRule = NfpRuleSerializer(
579         help_text="The NfpRule data type is an expression of the conditions that shall be met in order for the NFP to be applicable to the packet",
580         required=True)
581     nfpState = serializers.ChoiceField(
582         help_text="The state of the NFP instance.",
583         choices=enum_to_list(NFP_STATE),
584         required=True)
585
586
587 class VnffgInfoSerializer(serializers.Serializer):
588     id = serializers.CharField(
589         help_text="Identifier of this VNFFG instance.",
590         required=True)
591     vnffgdId = serializers.CharField(
592         help_text="Identifier of the VNFFGD in the NSD.",
593         required=True)
594     vnfInstanceId = serializers.ListField(
595         help_text="Identifier(s) of the constituent VNF instance(s) of this VNFFG instance.",
596         child=serializers.CharField(
597             help_text="ID of vnf instance"),
598         required=True)
599     pnfInfoId = serializers.ListField(
600         help_text="Identifier(s) of the constituent PNF instance(s) of this VNFFG instance",
601         child=serializers.CharField(help_text="ID of pnf info"),
602         required=False,
603         allow_null=True)
604     nsVirtualLinkInfoId = serializers.ListField(
605         help_text="Identifier(s) of the constituent VL instance(s) of thisVNFFG instance.",
606         child=serializers.CharField(help_text="ID of ns virtual link info"),
607         required=True)
608     nsCpHandle = NsCpHandleSerializer(
609         help_text="Identifiers of the CP instances attached to the "
610                   "constituent VNFs and PNFs or the SAP instances of the VNFFG.",
611         required=True,
612         allow_null=False,
613         many=True)
614     nfpInfo = NfpInfoSerializer(
615         help_text="Information on the NFP instances.",
616         required=True,
617         allow_null=False,
618         many=True)
619
620
621 class SapInfo(serializers.Serializer):
622     id = serializers.CharField(
623         help_text="Identifier of the SAP instance.",
624         required=True)
625     sapdId = serializers.CharField(
626         help_text="Reference to the SAPD for this SAP.",
627         required=True)
628     sapName = serializers.CharField(
629         help_text="Human readable name for the SAP.",
630         required=True)
631     description = serializers.CharField(
632         help_text="Human readable description for the SAP. ",
633         required=True)
634     sapProtocolInfo = CpProtocolInfoSerializer(
635         help_text="Parameters for configuring the network protocols on the SAP.",
636         many=True,
637         required=False,
638         allow_null=True)
639
640
641 class NsLinkSerializer(serializers.Serializer):
642     self = LinkSerializer(
643         help_text="URI of this resource.",
644         required=True)
645     nestedNsInstances = LinkSerializer(
646         help_text="Links to the nested NS instances of the present NS instance.",
647         required=False,
648         many=True)
649     instantiate = LinkSerializer(
650         help_text="Link to the instantiate task resource.",
651         required=False,
652         allow_null=False)
653     terminate = LinkSerializer(
654         help_text="Link to the terminate task resource.",
655         required=False,
656         allow_null=False)
657     update = LinkSerializer(
658         help_text="Link to the update task resource.",
659         required=False,
660         allow_null=False)
661     scale = LinkSerializer(
662         help_text="Link to the scale task resource.",
663         required=False,
664         allow_null=False)
665     heal = LinkSerializer(
666         help_text="Link to the heal task resource.",
667         required=False,
668         allow_null=False)
669
670
671 class NsInstanceSerializer(serializers.Serializer):
672     id = serializers.CharField(
673         help_text="Identifier of the NS instance.",
674         required=True)
675     nsInstanceName = serializers.CharField(
676         help_text="Human readable name of the NS instance.",
677         required=True)
678     nsInstanceDescription = serializers.CharField(
679         help_text="Human readable description of the NS instance.",
680         required=True,
681         allow_null=True,
682         allow_blank=True)
683     nsdId = serializers.CharField(
684         help_text="Identifier of the NSD on which the NS instance is based.",
685         required=True)
686     nsdInvariantId = serializers.CharField(
687         help_text="Identifier of the NSD in a version independent manner.",
688         required=False)
689     nsdInfoId = serializers.CharField(
690         help_text="Identifier of the NSD information object on which the NS instance is based.",
691         required=True)
692     flavourId = serializers.CharField(
693         help_text="Identifier of the NS deployment flavour applied to the NS instance.",
694         required=False)
695     vnfInstance = VnfInstanceSerializer(
696         help_text="Information on constituent VNF(s) of the NS instance.",
697         required=False,
698         many=True)
699     pnfInfo = PnfInfoSerializer(
700         help_text="Information on constituent PNF(s) of the NS instance.",
701         required=False,
702         many=True)
703     virtualLinkInfo = NsVirtualLinkInfoSerializer(
704         help_text="Information on the VL(s) of the NS instance.",
705         required=False,
706         many=True)
707     vnffgInfo = VnffgInfoSerializer(
708         many=True,
709         required=False,
710         help_text="VNF Forward Graph Information.")
711     sapInfo = SapInfo(
712         many=True,
713         required=False,
714         help_text="Create data concerning the SAPs.")
715     nestedNsInstanceId = serializers.ListField(
716         help_text="Identifier of the nested NS(s) of the NS instance.",
717         child=serializers.CharField(),
718         required=False,
719         allow_null=True)
720     nsState = serializers.ChoiceField(
721         help_text="The state of the NS instance.",
722         choices=enum_to_list(INSTANTIATION_STATE),
723         required=True,
724         allow_null=True)
725     nsScaleStatus = NsScaleInfoSerializer(
726         help_text="Status of each NS scaling aspect declared in the applicable DF.",
727         required=False,
728         allow_null=True,
729         many=True)
730     additionalAffinityOrAntiAffinityRule = AffinityOrAntiAffinityRuleSerializer(
731         help_text="Specifies additional affinity or anti-affinity constraint for the VNF instances to be instantiated as part of the NS instantiation.",
732         many=True,
733         required=False,
734         allow_null=True)
735     _links = NsLinkSerializer(
736         help_text="The links of the NS instance.",
737         required=True)