diff options
author | maopengzhang <zhang.maopeng1@zte.com.cn> | 2019-04-02 20:09:43 +0800 |
---|---|---|
committer | maopengzhang <zhang.maopeng1@zte.com.cn> | 2019-04-02 20:09:43 +0800 |
commit | c8db32beb32d5d6552d0cc2fa136951716885487 (patch) | |
tree | 4bc7c4c66c583e078ab274c90c8af3e0f038b532 | |
parent | 5c90e87e9e3a9c9dd95a9f08c813974e387fe55c (diff) |
fix NS Subscription serializer error
fix NS Subscription serializer error
Change-Id: Id876742f6a2981544ee495811b6f8fc68bc09975
Issue-ID: VFC-1214
Signed-off-by: maopengzhang <zhang.maopeng1@zte.com.cn>
-rw-r--r-- | lcm/ns/serializers/sol/lccn_filter_data.py | 33 | ||||
-rw-r--r-- | lcm/ns/serializers/sol/lccn_subscription.py | 13 | ||||
-rw-r--r-- | lcm/ns/serializers/sol/lccn_subscription_request.py | 17 | ||||
-rw-r--r-- | lcm/ns/serializers/sol/ns_instance_subscription_filter.py | 30 |
4 files changed, 51 insertions, 42 deletions
diff --git a/lcm/ns/serializers/sol/lccn_filter_data.py b/lcm/ns/serializers/sol/lccn_filter_data.py index fe4c8304..dd259051 100644 --- a/lcm/ns/serializers/sol/lccn_filter_data.py +++ b/lcm/ns/serializers/sol/lccn_filter_data.py @@ -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) diff --git a/lcm/ns/serializers/sol/lccn_subscription.py b/lcm/ns/serializers/sol/lccn_subscription.py index 42a9eb1c..d25de474 100644 --- a/lcm/ns/serializers/sol/lccn_subscription.py +++ b/lcm/ns/serializers/sol/lccn_subscription.py @@ -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): diff --git a/lcm/ns/serializers/sol/lccn_subscription_request.py b/lcm/ns/serializers/sol/lccn_subscription_request.py index 9c119295..d821a2f9 100644 --- a/lcm/ns/serializers/sol/lccn_subscription_request.py +++ b/lcm/ns/serializers/sol/lccn_subscription_request.py @@ -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) diff --git a/lcm/ns/serializers/sol/ns_instance_subscription_filter.py b/lcm/ns/serializers/sol/ns_instance_subscription_filter.py index eb1d040e..2072fc11 100644 --- a/lcm/ns/serializers/sol/ns_instance_subscription_filter.py +++ b/lcm/ns/serializers/sol/ns_instance_subscription_filter.py @@ -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) |