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