update ns_create and ns_inst serializer 12/75112/1
authortianxing <15210838572@139.com>
Thu, 27 Dec 2018 09:35:08 +0000 (17:35 +0800)
committertianxing <15210838572@139.com>
Thu, 27 Dec 2018 09:38:44 +0000 (17:38 +0800)
Change-Id: Iac37fdf32cefe74753077b019c6c11ec67a2d996
Signed-off-by: tianxing <15210838572@139.com>
Issue-ID: VFC-1228

lcm/ns/serializers/common_Link.py [new file with mode: 0644]
lcm/ns/serializers/create_ns_serializers.py [new file with mode: 0644]
lcm/ns/serializers/inst_ns_serializers.py [new file with mode: 0644]
lcm/ns/serializers/update_serializers.py

diff --git a/lcm/ns/serializers/common_Link.py b/lcm/ns/serializers/common_Link.py
new file mode 100644 (file)
index 0000000..a36cced
--- /dev/null
@@ -0,0 +1,19 @@
+# Copyright (c) 2018, CMCC Technologies Co., Ltd.
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+
+class LinkSerializer(serializers.Serializer):
+    href = serializers.CharField(help_text="URI of the referenced resource.", required=True)
diff --git a/lcm/ns/serializers/create_ns_serializers.py b/lcm/ns/serializers/create_ns_serializers.py
new file mode 100644 (file)
index 0000000..64f5e9d
--- /dev/null
@@ -0,0 +1,382 @@
+# Copyright (c) 2018, CMCC Technologies Co., Ltd.
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+from lcm.ns.serializers.ns_serializers import IpAddress
+from lcm.ns.serializers.common_Link import LinkSerializer
+
+
+class ContextSerializer(serializers.Serializer):
+    globalCustomerId = serializers.CharField(help_text="Global customer ID", required=False, allow_null=True)
+    serviceType = serializers.CharField(help_text="Service type", required=False, allow_null=True)
+
+
+class CreateNsReqSerializer(serializers.Serializer):
+    csarId = serializers.CharField(help_text="Package ID of NS", required=False, allow_null=True)
+    nsdId = serializers.CharField(help_text="Identifier of the NSD that defines the NS instance to be"
+                                            "created.", required=True, allow_null=False)
+    nsName = serializers.CharField(help_text="Name of NS", required=False, allow_null=True)
+    nsDescription = serializers.CharField(help_text="Description of NS", required=False, allow_null=True)
+    context = ContextSerializer(help_text="Context of NS", required=False)
+
+
+class VnfInstanceSerializer(serializers.Serializer):
+    id = serializers.CharField(help_text="Identifier of the VNF instance.", required=True)
+    vnfInstanceName = serializers.CharField(help_text="Name of the VNF instance.", required=False,
+                                            allow_null=True)
+
+
+class IpOverEthernetAddressDataSerializer(serializers.Serializer):
+    macAddress = serializers.CharField(help_text="Mac address", required=False, allow_null=True)
+    ipAddresses = serializers.ListField(help_text="List of IP addresses to assign to the extCP instance.",
+                                        child=IpAddress(
+                                            help_text="List of IP addresses to assign to the extCP instance.",
+                                            required=True), required=False, allow_null=True)
+
+
+class cpProtocolDataSerializer(serializers.Serializer):
+    layerProtocol = serializers.ChoiceField(help_text="Identifier of layer(s) and protocol(s).",
+                                            choices=["IP_OVER_ETHERNET"], required=True)
+    ipOverEthernet = serializers.ListField(help_text="Network address data for IP over Ethernet to assign to"
+                                                     "the extCP instance.",
+                                           child=(IpOverEthernetAddressDataSerializer(
+                                               help_text="This typerepresents network address data for IP"
+                                                         "over Ethernet.", required=True)), required=True)
+
+
+class PnfExtCpInfoSerializer(serializers.Serializer):
+    cpInstanceId = serializers.CharField(help_text="Identifier of the CP in the scope of the PNF.",
+                                         required=True)
+
+    cpdId = serializers.CharField(help_text="Identifier of (reference to) the Connection Point Descriptor"
+                                            "(CPD) for this CP.", required=True)
+
+    cpProtocolData = serializers.ListField(help_text="Parameters for configuring the network protocols on"
+                                                     "the CP.",
+                                           child=(cpProtocolDataSerializer(help_text="This type represents"
+                                                                                     "network protocol data",
+                                                                           required=True)), required=True)
+
+
+class PnfInfoSerializer(serializers.Serializer):
+    pnfId = serializers.CharField(help_text="Identifier of the PNF.", required=True)
+    pnfName = serializers.CharField(help_text="Name of the PNF.", required=True)
+    pnfdId = serializers.CharField(help_text="Identifier of the PNFD on which the PNF is based.",
+                                   required=True)
+
+    pnfdInfoId = serializers.CharField(help_text="Identifier of the PNFD information onject related to this "
+                                                 "PNF.", required=True)
+    pnfProfileId = serializers.CharField(help_text="Identifier of the related PnfProfile in the NSD on which "
+                                                   "the PNF is based.", required=True)
+
+    cpInfo = serializers.ListField(help_text="Information on the external CP of the PNF",
+                                   child=(PnfExtCpInfoSerializer(help_text="This type represents the"
+                                                                           "information about the external "
+                                                                           "CP of the PNF.", required=True)),
+                                   required=True)
+
+
+class ResourceHandleSerializer(serializers.Serializer):
+    vimId = serializers.CharField(help_text="Identifier of the VIM under whose control this resource is"
+                                            "placed.", required=False, allow_null=True)
+    resourceProviderId = serializers.CharField(help_text="Identifier of the entity responsible for the"
+                                                         "management of the resource", required=False,
+                                               allow_null=True)
+    resourceId = serializers.CharField(help_text="Identifier of the resource in the scope of the VIM or the "
+                                                 "resource provider.", required=True)
+    vimLevelResourceType = serializers.CharField(help_text="Type of the resource in the scope of the VIM or"
+                                                           "the resource provider",
+                                                 required=False, allow_null=True)
+
+
+class NsVirtualLinkInfoSerializer(serializers.Serializer):
+    id = serializers.CharField(help_text="Identifier of the VL instance.", required=True)
+    nsVirtualLinkDescId = serializers.CharField(help_text="Identifier of the VLD in the NSD.", required=True)
+    resourceHandle = serializers.ListField(help_text="Identifier(s) of the virtualised network resource(s) "
+                                                     "realizing the VL instance",
+                                           child=(ResourceHandleSerializer(
+                                               help_text="This type represents the information that allows"
+                                                         "addressing a virtualised resource that is used by a"
+                                                         "VNF instance or by an NS instance.",
+                                               required=True)), required=True)
+
+
+class NsCpHandleSerializer(serializers.Serializer):
+    vnfInstanceId = serializers.CharField(help_text="Identifier of the VNF instance associated to the CP"
+                                                    "instance.", required=False, allow_null=True)
+    vnfExtCpInstanceId = serializers.CharField(help_text="Identifier of the VNF external CP instance in the"
+                                                         "scope of the VNF instance.",
+                                               required=False, allow_null=True)
+    pnfInfoId = serializers.CharField(help_text="Identifier of the PNF instance associated to the CP"
+                                                "instance.", required=False, allow_null=True)
+    pnfExtCpInstanceId = serializers.CharField(help_text="Identifier of the PNF external CP instance in the"
+                                                         "scope of the PNF.", required=False, allow_null=True)
+    nsInstanceId = serializers.CharField(help_text="Identifier of the NS instance associated to the SAP"
+                                                   "instance", required=False, allow_null=True)
+    nsSapInstanceId = serializers.CharField(help_text="Identifier of the SAP instance in the scope of the NS"
+                                                      "instance.", required=False, allow_null=True)
+
+
+# end 167
+class MaskSerializer(serializers.Serializer):
+    startingPoint = serializers.CharField(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.", required=True)
+    length = serializers.CharField(help_text="Indicates the number of bits to be matched", required=True)
+    value = serializers.CharField(help_text="Provide the sequence of bit values to be matched.",
+                                  required=True)
+
+
+class NfpRuleSerializer(serializers.Serializer):
+    etherDestinationAddress = serializers.CharField(help_text="Indicates a destination Mac address",
+                                                    required=False, allow_null=True)
+    etherSourceAddress = serializers.CharField(help_text="Indicates a source Mac address",
+                                               required=False, allow_null=True)
+    etherType = serializers.ChoiceField(help_text="Indicates the protocol carried over the Ethernet layer",
+                                        choices=["IPV4", "IPV6"], required=False, allow_null=True)
+    vlanTag = serializers.ListField(help_text="ndicates a VLAN identifier in an IEEE 802.1Q-2014 tag",
+                                    required=False, allow_null=True)
+    protocol = serializers.ChoiceField(help_text="Indicates the L4 protocol, For IPv4 [7] this corresponds to"
+                                                 "the field called Protocol to identifythe next level "
+                                                 "protocol", choices=["TCP", "UDP", "ICMP"],
+                                       required=False, allow_null=True)
+    dscp = serializers.CharField(help_text="For IPv4 [7] a string of 0 and 1 digits that corresponds to the"
+                                           "6-bit Differentiated Services Code Point (DSCP) field of the"
+                                           "IP header.", required=False, allow_null=True)
+    sourcePortRange = serializers.CharField(help_text="Indicates a range of source ports",
+                                            required=False, allow_null=True)
+    destinationPortRange = serializers.CharField(help_text="Indicates a range of destination ports",
+                                                 required=False, allow_null=True)
+    sourceIpAddressPrefix = serializers.CharField(help_text="Indicates the source IP address range in CIDR"
+                                                            "format.", required=False, allow_null=True)
+    destinationIpAddressPrefix = serializers.CharField(help_text="Indicates the destination IP address range"
+                                                                 "in CIDRformat.",
+                                                       required=False, allow_null=True)
+    extendedCriteria = serializers.ListField(help_text="Indicates values of specific bits in a frame",
+                                             child=(MaskSerializer(help_text="The Mask data type identifies"
+                                                                             "the value to be matched for a"
+                                                                             "sequence of bits at a particular"
+                                                                             " location in a frame",
+                                                                   required=True)),
+                                             required=False, allow_null=True)
+
+
+class NfpInfoSerializer(serializers.Serializer):
+    id = serializers.CharField(help_text="Identifier of this NFP instance.", required=True)
+    nfpdId = serializers.CharField(help_text="Identifier of the NFPD used to instantiate this NFP"
+                                             "instance.", required=False, allow_null=True)
+    nfpName = serializers.CharField(help_text="Human readable name for the NFP instance.",
+                                    required=False, allow_null=True)
+    description = serializers.CharField(help_text="Human readable description for the NFP instance.",
+                                        required=False, allow_null=True)
+    nscpHandle = serializers.ListField(help_text="Identifier(s) of the CPs and/or SAPs which the NFP "
+                                                 "passes by",
+                                       child=NsCpHandleSerializer(
+                                           help_text="This type represents an identifier of the CP or SAP"
+                                                     "instance"), required=True)
+    totalCp = serializers.CharField(help_text="Total number of CP and SAP instances in this NFP"
+                                              "instance.", required=False, allow_null=True)
+    nfpRule = NfpRuleSerializer(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",
+                                required=True)
+    nfpState = serializers.ChoiceField(help_text="The state of the NFP instance.",
+                                       choices=["ENABLED", "DISABLED"], required=True)
+
+
+class VnffgInfoSerializer(serializers.Serializer):
+    id = serializers.CharField(help_text="Identifier of this VNFFG instance.", required=True)
+    vnffgdId = serializers.CharField(help_text="Identifier of the VNFFGD in the NSD.", required=True)
+    vnfInstanceId = serializers.ListField(help_text="Identifier(s) of the constituent VNF instance(s) of this"
+                                                    "VNFFG instance.",
+                                          child=serializers.CharField(help_text="ID of vnf instance"),
+                                          required=True)
+    pnfInfoId = serializers.ListField(help_text="Identifier(s) of the constituent PNF instance(s) of this"
+                                                "VNFFG instance",
+                                      child=serializers.CharField(help_text="ID of pnf info"),
+                                      required=False, allow_null=True)
+    nsVirtualLinkInfoId = serializers.ListField(help_text="Identifier(s) of the constituent VL instance(s) of"
+                                                          "thisVNFFG instance.",
+                                                child=serializers.CharField(
+                                                    help_text="ID of ns virtual link info"), required=True)
+    nsCpHandle = serializers.ListField(help_text="Identifiers of the CP instances attached to the constituent"
+                                                 "VNFs and PNFs or the SAP instances of the VNFFG.",
+                                       child=NsCpHandleSerializer(help_text="This type represents an"
+                                                                            "identifier of the CP or SAP"
+                                                                            "instance", required=False),
+                                       required=True, allow_null=False)
+    nfpInfo = serializers.ListField(help_text="Information on the NFP instances.",
+                                    child=(NfpInfoSerializer(help_text="This type represents an NFP instance",
+
+                                                             required=True)), required=True, allow_null=False)
+
+
+class AddressRange(serializers.Serializer):
+    minAddress = serializers.IPAddressField(help_text="Lowest IP address belonging to the range.",
+                                            required=True)
+    maxAddress = serializers.IPAddressField(help_text="Highest IP address belonging to the range.",
+                                            required=True)
+
+
+class ipAddressesSerializer(serializers.Serializer):
+    type = serializers.ChoiceField(help_text="The type of the IP addresses.",
+                                   choices=["IPV4", "IPV6"], required=True)
+    addresses = serializers.ListField(help_text="Fixed addresses assigned (from the subnet defined by "
+                                                "subnetId if provided)",
+                                      child=serializers.CharField(help_text="An IPV4 or IPV6 address."),
+                                      required=False, allow_null=True)
+# question
+    isDynamic = serializers.BooleanField(help_text="Indicates whether this set of addresses was assigned "
+                                                   "dynamically (true) or based on address information "
+                                                   "provided as input from the API consumer (false).",
+                                         required=False, default=True)
+    addressRange = AddressRange(help_text="An IP address range used", required=False, allow_null=True)
+    subnetId = serializers.CharField(help_text="Subnet defined by the identifier of the subnet"
+                                               "resource in the VIM", required=False, allow_null=True)
+
+
+class IpOverEthernetAddressInfoSerializer(serializers.Serializer):
+    macAddress = serializers.CharField(help_text="Assigned MAC address", required=True)
+    ipAddresses = serializers.ListField(help_text="Addresses assigned to the CP or SAP instance.",
+                                        child=(ipAddressesSerializer(help_text="Serializer of ip addresses",
+                                                                     required=True)),
+                                        required=False, allow_null=True)
+
+
+class CpProtocolInfoSerializer(serializers.Serializer):
+    layerProtocol = serializers.ChoiceField(help_text="The identifier of layer(s) and protocol(s) associated"
+                                                      "to the network address information.",
+                                            choices=["IP_OVER_ETHERNET"], required=True)
+    ipOverEthernet = IpOverEthernetAddressInfoSerializer(help_text="IP addresses over Ethernet to assign to"
+                                                                   "the CPor SAP instance.",
+                                                         required=False, allow_null=True)
+
+
+class SapInfoSerializer(serializers.Serializer):
+    id = serializers.CharField(help_text="Identifier of the SAP instance.", required=True)
+    sapdId = serializers.CharField(help_text="Identifier of the SAPD in the NSD.", required=True)
+    sapName = serializers.CharField(help_text="Human readable name for the SAP instance.", required=True)
+    description = serializers.CharField(help_text="Human readable description for the SAP instance.",
+                                        required=True)
+    sapProtocolInfo = serializers.ListField(help_text="Network protocol information for this SAP.",
+                                            child=(CpProtocolInfoSerializer(
+                                                help_text="This type describes the protocol layer(s) that a"
+                                                          "CP or SAP uses together with protocol-related"
+                                                          "information", required=True)), required=True)
+
+
+class NsScaleInfoSerializer(serializers.Serializer):
+    nsScalingAspectId = serializers.CharField(help_text="Identifier of the NS scaling aspect.", required=True)
+    nsScaleLevelId = serializers.CharField(help_text="Identifier of the NS scale level.", required=True)
+
+
+class AffinityOrAntiAffinityRuleSerializer(serializers.Serializer):
+    vnfdId = serializers.ListField(help_text="Reference to a VNFD.",
+                                   child=serializers.CharField(help_text="Identifier of the vnfd"),
+                                   required=False, allow_null=True)
+    vnfProfileId = serializers.ListField(help_text="Reference to a vnfProfile defined in the NSD.",
+                                         child=serializers.CharField(
+                                             help_text="Identifier of the vnfProfile"), required=True)
+    vnfInstanceId = serializers.ListField(help_text="Reference to the existing VNF instance as the subject of"
+                                                    "the affinity or anti-affinity rule",
+                                          child=serializers.CharField(help_text="identifier of the"
+                                                                                "vnfInstanceId"),
+                                          required=False, allow_null=True)
+    affinityOrAntiAffiinty = serializers.ChoiceField(help_text="The type of the constraint.",
+                                                     choices=["AFFINITY", "ANTI_AFFINITY"], required=True)
+    scope = serializers.ChoiceField(help_text="Specifies the scope of the rule where the placement"
+                                              "constraint applies.",
+                                    choices=["NFVI_POP", "ZONE", "ZONE_GROUP", "NFVI_NODE"], required=True)
+
+
+class Links(serializers.Serializer):
+    self = LinkSerializer(help_text="URI of this resource.", required=True)
+    nestedNsInstances = LinkSerializer(help_text="Links to the nested NS instances of the present NS"
+                                                 "instance.", required=False, allow_null=True)
+    instantiate = LinkSerializer(help_text="Link to the 'instantiate' task resource", required=False,
+                                 allow_null=True)
+    terminate = LinkSerializer(help_text="Link to the 'terminate' task resource", required=False, allow_null=True)
+    update = LinkSerializer(help_text="Link to the 'update' task resource", required=False, allow_null=True)
+    scale = LinkSerializer(help_text="Link to the 'scale' task resource", required=False, allow_null=True)
+    heal = LinkSerializer(help_text="Link to the 'heal' task resource", required=False, allow_null=True)
+
+
+class CreateNsRespSerializer(serializers.Serializer):
+    nsInstanceId = serializers.CharField(help_text="ID of NS instance", required=True)
+    nsInstanceName = serializers.CharField(help_text="Human readable name of the NS instance.", required=True)
+    nsInstanceDescription = serializers.CharField(help_text="Human readable description of the NS instance.",
+                                                  required=True)
+    nsdId = serializers.CharField(help_text="Identifier of the NSD on which the NS instance is based.",
+                                  required=True)
+    nsdInfoId = serializers.CharField(help_text="Identifier of the NSD information object on which the "
+                                                "NS instance is based.", required=True)
+
+    flavourId = serializers.CharField(help_text="Identifier of the NS deployment flavour applied to "
+                                                "the NS instance.", required=False, allow_null=True)
+    vnfInstance = serializers.ListField(help_text="Information on constituent VNF(s) of the NS instance.",
+                                        child=(VnfInstanceSerializer(help_text="This type represents a VNF"
+                                                                               "instance", required=True)),
+                                        required=False, allow_null=True)
+
+    pnfInfo = serializers.ListField(help_text="Information on the PNF(s) that are part of the NS instance.",
+                                    child=(PnfInfoSerializer(help_text="This type represents the information "
+                                           "about a PNF that is part of an NS instance.", required=True)),
+                                    required=False, allow_null=True)
+    virtualLinkInfo = serializers.ListField(help_text="Information on the VL(s) of the NS instance.",
+                                            child=(NsVirtualLinkInfoSerializer(help_text="This type specifies the"
+                                                                                         "information about an"
+                                                                                         "NS VL instance.",
+                                                                               required=True)), required=False,
+                                            allow_null=True)
+    vnffgInfo = serializers.ListField(help_text="Information on the VNFFG(s) of the NS instance",
+                                      child=(VnffgInfoSerializer(help_text="This type specifies the information"
+                                                                           "about a VNFFG instance.", required=True)),
+                                      required=False, allow_null=True)
+    sapInfo = serializers.ListField(help_text="Information on the SAP(s) of the NS instance",
+                                    child=(SapInfoSerializer(help_text="This type represents an SAP"
+                                                                       "instance.", required=True)),
+                                    required=False, allow_null=True)
+    nestedNsInstanceId = serializers.ListField(help_text="Identifier of the nested NS(s) of the NS instance.",
+                                               child=serializers.CharField(help_text="nested of the NS"
+                                                                                     "instance",),
+                                               required=False, allow_null=True)
+    nsState = serializers.ChoiceField(help_text="The state of the NS instance.", required=True,
+                                      choices=["NOT_INSTANTIATED", "INSTANTIATED"])
+    nsScaleStatus = serializers.ListField(help_text="Status of each NS scaling aspect declared in the"
+                                                    "applicable DF, how 'big' the NS instance has been"
+                                                    "scaled w.r.t. that aspect.",
+                                          child=(NsScaleInfoSerializer(help_text="This type represents the"
+                                                                                 "target NS Scale level for"
+                                                                                 "each NS scaling aspect of"
+                                                                                 "the current deployment"
+                                                                                 "flavour.")), required=False,
+                                          allow_null=True)
+    additionalAffinityOrAntiAffinityRule = serializers.ListField(help_text="Information on the additional"
+                                                                           "affinity or anti-affinity rule"
+                                                                           "from NS instantiation operation.",
+                                                                 child=(AffinityOrAntiAffinityRuleSerializer(
+                                                                     help_text="This type describes the "
+                                                                               "additional affinity or"
+                                                                               "anti-affinity rule applicable"
+                                                                               "between the VNF instances to"
+                                                                               "be instantiated in the NS"
+                                                                               "instantiation operation"
+                                                                               "request or between the VNF"
+                                                                               "instances to be instantiated"
+                                                                               "in the NS instantiation"
+                                                                               "operation request and the"
+                                                                               "existing VNF instances.",
+                                                                     required=True)), required=False,
+                                                                 allow_null=True)
+    _links = Links(help_text="Links to resources related to this resource.", required=True)
diff --git a/lcm/ns/serializers/inst_ns_serializers.py b/lcm/ns/serializers/inst_ns_serializers.py
new file mode 100644 (file)
index 0000000..0ba2ee1
--- /dev/null
@@ -0,0 +1,153 @@
+# Copyright (c) 2018, CMCC Technologies Co., Ltd.
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+from lcm.ns.serializers.create_ns_serializers import IpOverEthernetAddressDataSerializer
+from lcm.ns.serializers.update_ns_serializers import AddPnfDataSerializer, VnfInstanceDataSerializer
+
+
+class CpProtocolDataSerializer(serializers.Serializer):
+    layerProtocol = serializers.ChoiceField(help_text="Identifier of layer(s) and protocol(s)",
+                                            choices=["IP_OVER_ETHERNET"], required=True)
+    ipOverEthernet = IpOverEthernetAddressDataSerializer(help_text="Network address data for IP over Ethernet"
+                                                                   "to assign to the extCP instance.",
+                                                         required=False, allow_null=True)
+
+
+class SapDataSerializer(serializers.Serializer):
+    sapdId = serializers.CharField(help_text="Reference to the SAPD for this SAP.", required=True)
+    sapName = serializers.CharField(help_text="Human readable name for the SAP.", required=True)
+    description = serializers.CharField(help_text="Human readable description for the SAP.", required=True)
+    sapProtocolData = serializers.ListField(help_text="Parameters for configuring the network protocols on"
+                                                      "the SAP.",
+                                            child=(CpProtocolDataSerializer(help_text="This type represents "
+                                                                                      "network protocol "
+                                                                                      "data.")),
+                                            required=False, allow_null=True)
+
+
+class civicAddressElementSerializer(serializers.Serializer):
+    caType = serializers.CharField(help_text="Describe the content type of caValue.", required=True)
+    caValue = serializers.Serializer(help_text="Content of civic address element corresponding to the"
+                                               "caType.", required=True)
+
+
+class LocationConstraintsSerializer(serializers.Serializer):
+    countryCode = serializers.CharField(help_text="The two-letter ISO 3166 [29] country code in capital"
+                                                  "letters.", required=True)
+    civicAddressElement = serializers.ListField(help_text="Zero or more elements comprising the civic"
+                                                          "address.",
+                                                child=civicAddressElementSerializer(
+                                                    help_text="caType and caValue", required=True),
+                                                required=False, allow_null=True)
+
+
+class VnfLocationConstraintSerializer(serializers.Serializer):
+    vnfProfileId = serializers.CharField(help_text="ID of VNF profile", required=False, allow_null=True)
+    locationConstraints = LocationConstraintsSerializer(help_text="Defines the location constraints for the"
+                                                                  "VNF instance to be created based on the"
+                                                                  "VNF profile.",
+                                                        required=False, allow_null=True)
+
+
+class ParamsForVnfSerializer(serializers.Serializer):
+    vnfProfileId = serializers.CharField(help_text="Identifier of (reference to) a vnfProfile to which the"
+                                                   "additional parameters apply", required=True)
+    additionalParams = serializers.DictField(help_text="Content of civic address element corresponding to the"
+                                                       "caType",
+                                             child=serializers.CharField(help_text="KeyValue Pairs",
+                                                                         allow_blank=True),
+                                             required=False, allow_null=True)
+
+
+class AffinityOrAntiAffinityRuleSerializer(serializers.Serializer):
+    vnfdId = serializers.ListField(help_text="Reference to a VNFD.", required=False, allow_null=True)
+    vnfProfileId = serializers.ListField(help_text="Reference to a vnfProfile defined in the NSD.",
+                                         required=True)
+    vnfInstanceId = serializers.ListField(help_text="Reference to the existing VNF instance as the subject of"
+                                                    "the affinity or anti-affinity rule.",
+                                          required=False, allow_null=True)
+    affinityOrAntiAffiinty = serializers.ChoiceField(help_text="The type of the constraint.",
+                                                     choices=["AFFINITY", "ANTI_AFFINITY"], required=True)
+    scope = serializers.ChoiceField(help_text="Specifies the scope of the rule where the placement constraint"
+                                              "applies.", choices=["NFVI_POP", "ZONE", "ZONE_GROUP",
+                                                                   "NFVI_NODE"], required=True)
+
+
+class InstantNsReqSerializer(serializers.Serializer):
+    nsFlavourId = serializers.CharField(help_text="Identifier of the NS deployment flavour to be"
+                                                  "instantiated.", required=True)
+    sapData = serializers.ListField(help_text="Create data concerning the SAPs of this NS",
+                                    child=(SapDataSerializer(
+                                        help_text="This type represents the information related to a SAP"
+                                                  "of a NS.", required=True)),
+                                    required=False, allow_null=True)
+    addpnfData = serializers.ListField(help_text="Information on the PNF(s) that are part of this NS.",
+                                       child=(AddPnfDataSerializer(help_text="This type specifies an PNF to "
+                                                                             "be added to the NS instance and"
+                                                                             "the PNF Profile to use for"
+                                                                             "this PNF.", required=True)),
+                                       required=False, allow_null=True)
+    vnfInstanceData = serializers.ListField(help_text="Specify an existing VNF instance to be used in the"
+                                                      "NS.",
+                                            child=(VnfInstanceDataSerializer(help_text="This type specifies "
+                                                                                       "an existing VNF "
+                                                                                       "instance to be used "
+                                                                                       "in the NS instance "
+                                                                                       "and if needed",
+                                                                             required=True)),
+                                            required=False, allow_null=True)
+    nestedNsInstanceId = serializers.ListField(help_text="Specify an existing NS instance to be used as a "
+                                                         "nested NS within the NS",
+                                               required=False, allow_null=True)
+    localizationLanguage = serializers.ListField(help_text="Defines the location constraints for the VNF to"
+                                                           "be instantiated as part of the NS instantiation.",
+                                                 child=(VnfLocationConstraintSerializer(
+                                                     help_text="This type represents the association of"
+                                                               "location constraints to a VNF instance to be"
+                                                               "created according to a specific VNF profile",
+                                                     required=True)), required=False, allow_null=True)
+    additionalParamForNs = serializers.DictField(
+        help_text="Allows the OSS/BSS to provide additional parameters at the NS level ",
+        child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
+        required=False,
+        allow_null=True
+    )
+    additionalParamsForVnf = serializers.ListField(help_text="Allows the OSS/BSS to provide additional"
+                                                             "parameter(s)per VNF instance",
+                                                   child=(ParamsForVnfSerializer(
+                                                       help_text="This type defines the additional parameters"
+                                                                 "for the VNF instance to be created"
+                                                                 "associated with an NS instance",
+                                                       required=True)), required=False, allow_null=True)
+    startTime = serializers.DateTimeField(help_text="Timestamp indicating the earliest time to instantiate"
+                                                    "the NS.", required=False, allow_null=True)
+    nsInstantiationLevelId = serializers.CharField(help_text="Identifies one of the NS instantiation levels"
+                                                             "declared in the DF applicable to this NS "
+                                                             "instance", required=False, allow_null=True)
+    additionalAffinityOrAntiAffiniityRule = serializers.ListField(help_text="Specifies additional affinity or"
+                                                                            "anti-affinity constraint for the"
+                                                                            "VNF instances to be instantiated"
+                                                                            "as part of the NS "
+                                                                            "instantiation.",
+                                                                  child=(
+                                                                      AffinityOrAntiAffinityRuleSerializer(
+                                                                          help_text="This type describes the"
+                                                                                    "additional affinity or"
+                                                                                    "anti-affinity rule"
+                                                                                    "applicable between the"
+                                                                                    "VNF instances",
+                                                                          required=True)),
+                                                                  required=False, allow_null=True)
index e92432d..06217d8 100644 (file)
@@ -68,7 +68,7 @@ class VnfExtCpData(serializers.Serializer):
                                      required=False, allow_null=True)
 
 
-class ExtLinkPortResourceHandleSerializer(serializers.Serializer):
+class ResourceHandleSerializer(serializers.Serializer):
     vimId = serializers.CharField(help_text="Identifier of the VIM under whose control this resource is placed.",
                                   required=False, allow_null=True)
     resourceProviderId = serializers.CharField(help_text="Identifier of the entity responsible for the management of "
@@ -81,8 +81,8 @@ class ExtLinkPortResourceHandleSerializer(serializers.Serializer):
 
 class ExtLinkPortDataSerializer(serializers.Serializer):
     id = serializers.CharField(help_text="Provided by the entity that has created the link port", required=True)
-    resourceHandle = ExtLinkPortResourceHandleSerializer(help_text="Identifier(s) of the virtualised network resource(s) "
-                                                                   "realizing the VL instance", required=True)
+    resourceHandle = ResourceHandleSerializer(help_text="Identifier(s) of the virtualised network resource(s) "
+                                                        "realizing the VL instance", required=True)
 
 
 class ExtVirtualLinkDataSerializer(serializers.Serializer):
@@ -146,12 +146,16 @@ class OperationalStatesSerializer(serializers.Serializer):
                                                 choices=["STARTED", "STOPPED"])
 
 
+class StopTypeSerializer(serializers.Serializer):
+    StopType = serializers.ChoiceField(help_text="Type of stop", choices=["FORCEFUL", "GRACEFUL"])
+
+
 class OperateVnfDataSerializer(serializers.Serializer):
     vnfInstanceId = serializers.CharField(help_text="Identifier of the VNF instance.", required=True)
     changeStateTo = OperationalStatesSerializer(help_text="The desired operational state to change the VNF to.",
                                                 required=True)
-    stopType = serializers.ChoiceField(help_text="It signals whether forceful or graceful stop is requested.",
-                                       choices=["FORCEFUL", "GRACEFUL"], required=False, allow_null=True)
+    stopType = StopTypeSerializer(help_text="It signals whether forceful or graceful stop is requested.",
+                                  required=False, allow_null=True)
     gracefulStopTimeout = serializers.CharField(help_text="The time interval to wait for the VNF to be taken out of"
                                                           "service during graceful stop.",
                                                 required=False, allow_null=True)