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