fix NS Subscription serializer error 63/83963/1
authormaopengzhang <zhang.maopeng1@zte.com.cn>
Tue, 2 Apr 2019 12:09:43 +0000 (20:09 +0800)
committermaopengzhang <zhang.maopeng1@zte.com.cn>
Tue, 2 Apr 2019 12:09:43 +0000 (20:09 +0800)
fix NS Subscription serializer error

Change-Id: Id876742f6a2981544ee495811b6f8fc68bc09975
Issue-ID: VFC-1214
Signed-off-by: maopengzhang <zhang.maopeng1@zte.com.cn>
lcm/ns/serializers/sol/lccn_filter_data.py
lcm/ns/serializers/sol/lccn_subscription.py
lcm/ns/serializers/sol/lccn_subscription_request.py
lcm/ns/serializers/sol/ns_instance_subscription_filter.py

index fe4c830..dd25905 100644 (file)
@@ -1,4 +1,5 @@
 # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+# Copyright 2019 ZTE Corporation.
 
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -22,27 +23,35 @@ from lcm.ns.const import NOTIFICATION_TYPES, NS_LCM_OP_TYPES, LCM_OPERATION_STAT
 class LifeCycleChangeNotificationsFilter(serializers.Serializer):
     nsInstanceSubscriptionFilter = NsInstanceSubscriptionFilter(
         help_text="Filter criteria to select NS instances about which to notify.",
-        required=False, allow_null=False)
+        required=False,
+        allow_null=False)
     notificationTypes = serializers.ListField(
+        help_text="Match particular notification types.",
         child=serializers.ChoiceField(required=True, choices=NOTIFICATION_TYPES),
-        help_text="Match particular notification types", allow_null=False, required=False)
+        required=False,
+        allow_null=False)
     operationTypes = serializers.ListField(
+        help_text="Match particular NS lifecycle operation types for the notification of type NsLcmOperationOccurrenceNotification.",
         child=serializers.ChoiceField(required=True, choices=NS_LCM_OP_TYPES),
-        help_text="Match particular NS lifecycle operation types for the notification of type "
-                  "NsLcmOperationOccurrenceNotification.", allow_null=False, required=False)
+        required=False,
+        allow_null=False)
     operationStates = serializers.ListField(
+        help_text="Match particular LCM operation state values as reported in notifications of type NsLcmOperationOccurrenceNotification.",
         child=serializers.ChoiceField(required=True, choices=LCM_OPERATION_STATE_TYPES),
-        help_text="Match particular LCM operation state values as reported in notifications of type "
-                  "NsLcmOperationOccurrenceNotification.", allow_null=False, required=False)
+        required=False,
+        allow_null=False)
     nsComponentTypes = serializers.ListField(
-        child=serializers.ChoiceField(required=True, choices=NS_COMPOMENT_TYPE),
         help_text="Match particular NS component types for the notification of type NsChangeNotification. ",
-        required=False, allow_null=False)
+        child=serializers.ChoiceField(required=True, choices=NS_COMPOMENT_TYPE),
+        required=False,
+        allow_null=False)
     lcmOpNameImpactingNsComponent = serializers.ListField(
+        help_text="Match particular LCM operation names for the notification of type NsChangeNotification.",
         child=serializers.ChoiceField(required=True, choices=LCM_OPName_For_Change_Notification_Type),
-        help_text="Match particular LCM operation names for the notification of type NsChangeNotification. ",
-        required=False, allow_null=False)
+        required=False,
+        allow_null=False)
     lcmOpOccStatusImpactingNsComponent = serializers.ListField(
+        help_text="Match particular LCM operation status values as reported in notifications of type NsChangeNotification.",
         child=serializers.ChoiceField(required=True, choices=LCM_OpOcc_Status_For_ChangeNotification_Type),
-        help_text="Match particular LCM operation status values as reported in notifications of type "
-                  "NsChangeNotification.", required=False, allow_null=False)
+        required=False,
+        allow_null=False)
index 42a9eb1..d25de47 100644 (file)
@@ -1,4 +1,5 @@
 # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+# Copyright 2019 ZTE Corporation.
 
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -28,20 +29,18 @@ class LccnSubscriptionLinkSerializer(serializers.Serializer):
 class LccnSubscriptionSerializer(serializers.Serializer):
     id = serializers.CharField(
         help_text="Identifier of this subscription resource.",
-        max_length=255,
         required=True,
         allow_null=False)
+    filter = LifeCycleChangeNotificationsFilter(
+        help_text="Filter settings for this subscription, to define the of all notifications this subscription relates to.",
+        required=False)
     callbackUri = serializers.CharField(
         help_text="The URI of the endpoint to send the notification to.",
-        max_length=255,
         required=True,
         allow_null=False)
-    filter = LifeCycleChangeNotificationsFilter(
-        help_text="Filter settings for this subscription, to define the of all notifications this "
-                  "subscription relates to A particular notification is sent to the subscriber if the filter"
-                  " matches, or if there is no filter.", required=False)
     _links = LccnSubscriptionLinkSerializer(
-        help_text="Links to resources related to this resource.", required=True)
+        help_text="Links to resources related to this resource.",
+        required=True)
 
 
 class LccnSubscriptionsSerializer(serializers.ListSerializer):
index 9c11929..d821a2f 100644 (file)
@@ -1,4 +1,5 @@
 # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+# Copyright 2019 ZTE Corporation.
 
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -19,16 +20,12 @@ from lcm.ns.serializers.sol.subscription_auth_data import SubscriptionAuthentica
 
 
 class LccnSubscriptionRequestSerializer(serializers.Serializer):
+    filter = LifeCycleChangeNotificationsFilter(
+        help_text="Filter settings for this subscription, to define the subset of all notifications this subscription relates to.",
+        required=False)
     callbackUri = serializers.CharField(
         help_text="The URI of the endpoint to send the notification to.",
-        required=True,
-        allow_null=False)
-    filter = LifeCycleChangeNotificationsFilter(
-        help_text="Filter settings for this subscription, to define the subset of all notifications this"
-                  " subscription relates to A particular notification is sent to the subscriber if the "
-                  "filter matches, or if there is no filter.", required=False, allow_null=True)
+        required=True)
     authentication = SubscriptionAuthenticationSerializer(
-        help_text="Authentication parameters to conFigure the use of Authorization when sending "
-                  "notifications corresponding to this subscription, as defined in clause 4.5.3 This"
-                  " attribute shall only be present if the subscriber requires authorization of"
-                  " notifications.", required=False, allow_null=True)
+        help_text="Authentication parameters to conFigure the use of Authorization when sending notifications corresponding to this subscription.",
+        required=False)
index eb1d040..2072fc1 100644 (file)
@@ -1,4 +1,5 @@
 # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+# Copyright 2019 ZTE Corporation.
 
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -17,26 +18,29 @@ from rest_framework import serializers
 
 class NsInstanceSubscriptionFilter(serializers.Serializer):
     nsdIds = serializers.ListField(
-        child=serializers.UUIDField(),
-        help_text="If present, match NS instances that were created based on a NSD identified by one of the"
-                  " nsdId values listed in this attribute.", required=False, allow_null=False)
+        help_text="Match NS instances that were created based on a NSD identified by one of the nsdId values listed in this attribute.",
+        child=serializers.CharField(),
+        required=False,
+        allow_null=False)
     vnfdIds = serializers.ListField(
-        child=serializers.UUIDField(),
-        help_text="If present, match NS instances that contain VNF instances that were created based on"
+        help_text="Match NS instances that contain VNF instances that were created based on"
                   " identified by one of the vnfdId values listed in this attribute.",
-        required=False, allow_null=False)
+        child=serializers.CharField(),
+        required=False,
+        allow_null=False)
     pnfdIds = serializers.ListField(
-        child=serializers.UUIDField(),
-        help_text="If present, match NS instances that contain PNFs that are represented by a PNFD"
+        help_text="Match NS instances that contain PNFs that are represented by a PNFD"
                   " identified by one of the pnfdId values listed in this attribute",
-        required=False, allow_null=False)
+        child=serializers.CharField(),
+        required=False,
+        allow_null=False)
     nsInstanceIds = serializers.ListField(
-        child=serializers.UUIDField(),
-        help_text="If present, match NS instances with an instance identifier listed in this attribute",
+        help_text="Match NS instances with an instance identifier listed in this attribute",
+        child=serializers.CharField(),
         required=False,
         allow_null=False)
     nsInstanceNames = serializers.ListField(
-        child=serializers.CharField(max_length=255, required=True),
-        help_text="If present, match NS instances with a NS Instance Name listed in this attribute.",
+        help_text="Match NS instances with a NS Instance Name listed in this attribute.",
+        child=serializers.CharField(),
         required=False,
         allow_null=False)