Fix serialization bug of nslcm 67/82567/1
authortianxing <15210838572@139.com>
Mon, 18 Mar 2019 09:21:15 +0000 (17:21 +0800)
committertianxing <15210838572@139.com>
Mon, 18 Mar 2019 09:21:35 +0000 (17:21 +0800)
Change-Id: I09c096839f9be5ae5fa2fd75434b66b487ffa716
Issue-ID: VFC-1270
Signed-off-by: tianxing <15210838572@139.com>
lcm/ns/serializers/response.py
lcm/ns_vnfs/serializers/grant_vnf_serializer.py

index 95551ef..b6f269c 100644 (file)
 from rest_framework import serializers
 
 
+# class ProblemDetailsSerializer(serializers.Serializer):
+#     type = serializers.CharField(help_text="Type", required=False, allow_null=True)
+#     title = serializers.CharField(help_text="Title", required=False, allow_null=True)
+#     status = serializers.IntegerField(help_text="Status", required=True)
+#     detail = serializers.CharField(help_text="Detail", required=True, allow_null=True)
+#     instance = serializers.CharField(help_text="Instance", required=False, allow_null=True)
+#     additional_details = serializers.ListField(
+#         help_text="Any number of additional attributes, as defined in a specification or by an"
+#                   " implementation.", required=False, allow_null=True)
+
+
 class ProblemDetailsSerializer(serializers.Serializer):
-    type = serializers.CharField(help_text="Type", required=False, allow_null=True)
-    title = serializers.CharField(help_text="Title", required=False, allow_null=True)
-    status = serializers.IntegerField(help_text="Status", required=True)
-    detail = serializers.CharField(help_text="Detail", required=True, allow_null=True)
-    instance = serializers.CharField(help_text="Instance", required=False, allow_null=True)
+    type = serializers.CharField(
+        help_text="A URI reference according to IETF RFC 3986 [5] that identifies the problem type.",
+        required=False,
+        allow_null=True,
+        allow_blank=True
+    )
+    title = serializers.CharField(
+        help_text="A short, human-readable summary of the problem type.",
+        required=False,
+        allow_null=True,
+        allow_blank=True
+    )
+    status = serializers.IntegerField(
+        help_text="The HTTP status code for this occurrence of the problem.",
+        required=True
+    )
+    detail = serializers.CharField(
+        help_text="A human-readable explanation specific to this occurrence of the problem.",
+        required=True
+    )
+    instance = serializers.CharField(
+        help_text="A URI reference that identifies the specific occurrence of the problem.",
+        required=False,
+        allow_null=True,
+        allow_blank=True
+    )
     additional_details = serializers.ListField(
         help_text="Any number of additional attributes, as defined in a specification or by an"
-                  " implementation.", required=False, allow_null=True)
+                  " implementation.",
+        required=False,
+        allow_null=True
+    )
index 64087e3..fd98ee7 100644 (file)
@@ -16,6 +16,8 @@ from rest_framework import serializers
 from lcm.ns.serializers.resource_handle import ResourceHandleSerializer
 from lcm.ns.serializers.link import linkSerializer
 from lcm.ns.serializers.pub_serializers import AddressRangeSerializer
+from lcm.ns.serializers.ext_virtual_link_info import ExtVirtualLinkInfoSerializer
+from lcm.ns.serializers.response import ProblemDetailsSerializer
 
 # class ResourceHandleSerializer(serializers.Serializer):
 #     vimConnectionId = serializers.CharField(
@@ -868,49 +870,49 @@ class ExtLinkPortInfoSerializer(serializers.Serializer):
     )
 
 
-class ExtVirtualLinkInfoSerializer(serializers.Serializer):
-    id = serializers.CharField(
-        help_text="Identifier of the external VL and the related external VL information instance.",
-        required=True
-    )
-    resourceHandle = ResourceHandleSerializer(
-        help_text="Reference to the resource realizing this VL.",
-        required=True
-    )
-    extLinkPorts = ExtLinkPortInfoSerializer(
-        help_text="Link ports of this VL.",
-        many=True,
-        required=False
-    )
+class ExtVirtualLinkInfoSerializer(serializers.Serializer):
+    id = serializers.CharField(
+        help_text="Identifier of the external VL and the related external VL information instance.",
+        required=True
+    )
+    resourceHandle = ResourceHandleSerializer(
+        help_text="Reference to the resource realizing this VL.",
+        required=True
+    )
+    extLinkPorts = ExtLinkPortInfoSerializer(
+        help_text="Link ports of this VL.",
+        many=True,
+        required=False
+    )
 
 
-class ProblemDetailsSerializer(serializers.Serializer):
-    type = serializers.CharField(
-        help_text="A URI reference according to IETF RFC 3986 [5] that identifies the problem type.",
-        required=False,
-        allow_null=True,
-        allow_blank=True
-    )
-    title = serializers.CharField(
-        help_text="A short, human-readable summary of the problem type.",
-        required=False,
-        allow_null=True,
-        allow_blank=True
-    )
-    status = serializers.IntegerField(
-        help_text="The HTTP status code for this occurrence of the problem.",
-        required=True
-    )
-    detail = serializers.CharField(
-        help_text="A human-readable explanation specific to this occurrence of the problem.",
-        required=True
-    )
-    instance = serializers.CharField(
-        help_text="A URI reference that identifies the specific occurrence of the problem.",
-        required=False,
-        allow_null=True,
-        allow_blank=True
-    )
+class ProblemDetailsSerializer(serializers.Serializer):
+    type = serializers.CharField(
+        help_text="A URI reference according to IETF RFC 3986 [5] that identifies the problem type.",
+        required=False,
+        allow_null=True,
+        allow_blank=True
+    )
+    title = serializers.CharField(
+        help_text="A short, human-readable summary of the problem type.",
+        required=False,
+        allow_null=True,
+        allow_blank=True
+    )
+    status = serializers.IntegerField(
+        help_text="The HTTP status code for this occurrence of the problem.",
+        required=True
+    )
+    detail = serializers.CharField(
+        help_text="A human-readable explanation specific to this occurrence of the problem.",
+        required=True
+    )
+    instance = serializers.CharField(
+        help_text="A URI reference that identifies the specific occurrence of the problem.",
+        required=False,
+        allow_null=True,
+        allow_blank=True
+    )
 
 
 class LccnLinksSerializer(serializers.Serializer):