Fix serialization bug of nslcm 61/82561/1
authortianxing <15210838572@139.com>
Mon, 18 Mar 2019 07:17:00 +0000 (15:17 +0800)
committertianxing <15210838572@139.com>
Mon, 18 Mar 2019 07:17:11 +0000 (15:17 +0800)
Change-Id: I156f698a398f9c3ca0dfe907a3c3b0cd9df0d1d9
Issue-ID: VFC-1270
Signed-off-by: tianxing <15210838572@139.com>
lcm/ns_vnfs/serializers/grant_vnf_serializer.py

index 43ff5f0..e77a091 100644 (file)
 # limitations under the License.
 
 from rest_framework import serializers
-
-
-class ResourceHandleSerializer(serializers.Serializer):
-    vimConnectionId = serializers.CharField(
-        help_text="Identifier of the VIM connection to manage the resource.",
-        required=False,
-        allow_null=True,
-        allow_blank=True
-    )
-    resourceProviderId = serializers.CharField(
-        help_text="Identifier of the entity responsible for the management of the resource.",
-        required=False,
-        allow_null=True,
-        allow_blank=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,
-        allow_blank=True
-    )
+from lcm.ns.serializers.resource_handle import ResourceHandleSerializer
+from lcm.ns.serializers.link import linkSerializer
+
+# class ResourceHandleSerializer(serializers.Serializer):
+#     vimConnectionId = serializers.CharField(
+#         help_text="Identifier of the VIM connection to manage the resource.",
+#         required=False,
+#         allow_null=True,
+#         allow_blank=True
+#     )
+#     resourceProviderId = serializers.CharField(
+#         help_text="Identifier of the entity responsible for the management of the resource.",
+#         required=False,
+#         allow_null=True,
+#         allow_blank=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,
+#         allow_blank=True
+#     )
 
 
 class ResourceDefinitionSerializer(serializers.Serializer):
@@ -123,19 +124,19 @@ class VimConstraintSerializer(serializers.Serializer):
     )
 
 
-class LinkSerializer(serializers.Serializer):
-    href = serializers.CharField(
-        help_text="URI of the referenced resource.",
-        required=True
-    )
+class LinkSerializer(serializers.Serializer):
+    href = serializers.CharField(
+        help_text="URI of the referenced resource.",
+        required=True
+    )
 
 
 class GrantRequestLinksSerializer(serializers.Serializer):
-    vnfLcmOpOcc = LinkSerializer(
+    vnfLcmOpOcc = linkSerializer(
         help_text="Related VNF lifecycle management operation occurrence.",
         required=True
     )
-    vnfInstance = LinkSerializer(
+    vnfInstance = linkSerializer(
         help_text="Related VNF instance.",
         required=True
     )
@@ -567,15 +568,15 @@ class ExtManagedVirtualLinkSerializer(serializers.Serializer):
 
 
 class GrantLinksSerializer(serializers.Serializer):
-    self = LinkSerializer(
+    self = linkSerializer(
         help_text="URI of this resource.",
         required=True
     )
-    vnfLcmOpOcc = LinkSerializer(
+    vnfLcmOpOcc = linkSerializer(
         help_text="Related VNF lifecycle management operation occurrence.",
         required=True
     )
-    vnfInstance = LinkSerializer(
+    vnfInstance = linkSerializer(
         help_text="Related VNF instance.",
         required=True
     )
@@ -912,15 +913,15 @@ class ProblemDetailsSerializer(serializers.Serializer):
 
 
 class LccnLinksSerializer(serializers.Serializer):
-    vnfInstance = LinkSerializer(
+    vnfInstance = linkSerializer(
         help_text="Link to the resource representing the VNF instance to which the notified change applies.",
         required=True
     )
-    subscription = LinkSerializer(
+    subscription = linkSerializer(
         help_text="Link to the related subscription.",
         required=True
     )
-    vnfLcmOpOcc = LinkSerializer(
+    vnfLcmOpOcc = linkSerializer(
         help_text="Link to the VNF lifecycle management operation occurrence that this notification is related to.",
         required=False,
         allow_null=True