fix the serializer bug of nslcm 58/82358/1
authoryangyan <yangyanyj@chinamobile.com>
Fri, 15 Mar 2019 02:17:12 +0000 (10:17 +0800)
committeryangyan <yangyanyj@chinamobile.com>
Fri, 15 Mar 2019 02:18:30 +0000 (10:18 +0800)
Change-Id: I3722c138536e75d1d534565788614b29f5b13964
Issue-ID: VFC-1270
Signed-off-by: yangyan <yangyanyj@chinamobile.com>
lcm/ns/serializers/create_ns_serializers.py
lcm/ns/serializers/inst_ns_serializers.py
lcm/ns/serializers/update_serializers.py

index 823a3d9..8de7fe5 100644 (file)
@@ -14,8 +14,7 @@
 
 from rest_framework import serializers
 
-from lcm.ns.serializers.pub_serializers import IpOverEthernetAddressDataSerializer, Links, ipAddressesSerializer
-# from lcm.ns.serializers.pub_serializers import Links, IpAddressSerialzier, ipAddressesSerializer
+from lcm.ns.serializers.pub_serializers import Links, ipAddressesSerializer, CpProtocolDataSerializer
 
 
 class ContextSerializer(serializers.Serializer):
@@ -38,14 +37,6 @@ class VnfInstanceSerializer(serializers.Serializer):
                                             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, allow_null=False)
-    ipOverEthernet = IpOverEthernetAddressDataSerializer(help_text="Network address data for IP over Ethernet"
-                                                                   " to assign to the extCP instance.",
-                                                         required=False, allow_null=True)
-
-
 class PnfExtCpInfoSerializer(serializers.Serializer):
     cpInstanceId = serializers.CharField(help_text="Identifier of the CP in the scope of the PNF.",
                                          required=True)
@@ -53,7 +44,7 @@ class PnfExtCpInfoSerializer(serializers.Serializer):
     cpdId = serializers.CharField(help_text="Identifier of (reference to) the Connection Point Descriptor"
                                             "(CPD) for this CP.", required=True)
 
-    cpProtocolData = cpProtocolDataSerializer(help_text="Parameters for configuring the network protocols on"
+    cpProtocolData = CpProtocolDataSerializer(help_text="Parameters for configuring the network protocols on"
                                                         "the CP.", required=True, many=True)
 
 
index cf875b7..bd67a76 100644 (file)
 
 from rest_framework import serializers
 
-from lcm.ns.serializers.pub_serializers import CpProtocolDataSerializer
-from lcm.ns.serializers.update_serializers import AddPnfDataSerializer, VnfInstanceDataSerializer
+from lcm.ns.serializers.update_serializers import AddPnfDataSerializer, VnfInstanceDataSerializer, SapDataSerializer
 from lcm.ns.serializers.create_ns_serializers import AffinityOrAntiAffinityRuleSerializer
 
 
-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 = CpProtocolDataSerializer(help_text="Parameters for configuring the network protocols"
-                                                         " on the SAP.",
-                                               required=False, allow_null=True, many=True)
-
-
 class civicAddressElementSerializer(serializers.Serializer):
     caType = serializers.CharField(help_text="Describe the content type of caValue.", required=True)
     caValue = serializers.CharField(help_text="Content of civic address element corresponding to the"
index a677c43..cdf2bce 100644 (file)
@@ -16,7 +16,8 @@ from rest_framework import serializers
 
 from lcm.ns.serializers.pub_serializers import IpAddressSerialzier
 from lcm.ns.serializers.pub_serializers import CpProtocolDataSerializer
-from lcm.ns.serializers.create_ns_serializers import ResourceHandleSerializer
+from lcm.ns.serializers.create_ns_serializers import ResourceHandleSerializer, NsCpHandleSerializer, \
+    NfpRuleSerializer
 
 
 class VnfInstanceDataSerializer(serializers.Serializer):
@@ -65,17 +66,6 @@ class VnfExtCpData(serializers.Serializer):
                                      required=False, allow_null=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 ExtLinkPortDataSerializer(serializers.Serializer):
     id = serializers.CharField(help_text="Provided by the entity that has created the link port", required=True)
     resourceHandle = ResourceHandleSerializer(help_text="Identifier(s) of the virtualised network resource(s) "
@@ -199,61 +189,11 @@ class MoveVnfInstanceDataSerializer(serializers.Serializer):
                                           required=False, allow_null=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)
-
-
 class PortRangeSerializer(serializers.Serializer):
     lowerPort = serializers.CharField(help_text="Identifies the lower bound of the port range. ", required=True)
     upperPort = serializers.CharField(help_text="Identifies the upper bound of the port range ", required=True)
 
 
-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.CharField(help_text="Indicates a VLAN identifier in an IEEE 802.1Q-2014 tag [6] ",
-                                    required=False, allow_null=True)
-    protocol = serializers.ChoiceField(help_text="Indicates the L4 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 = PortRangeSerializer(help_text="Indicates a range of source ports. ",
-                                          required=False, allow_null=True)
-    destinationPortRange = PortRangeSerializer(help_text="Indicates a range of destination ports.",
-                                               required=False, allow_null=True)
-    sourceIpAddressPrefix = serializers.CharField(
-        help_text="Prefix of source ip address", required=False, allow_null=True)
-    destinationIpAddressPrefix = serializers.CharField(
-        help_text="Prefix of destination ip address", required=False, allow_null=True)
-    extendedCriteria = serializers.ListField(help_text="Indicates values of specific bits in a frame.",
-                                             child=(MaskSerializer(help_text="Mask serializer", required=True)),
-                                             required=False, allow_null=True)
-
-
 class NfpDataSerializer(serializers.Serializer):
     nfpInfoId = serializers.CharField(help_text="Identifier of the NFP to be modified.",
                                       required=False, allow_null=True)