fe4c8304a80a3ac984ebec576bf6d52758509449
[vfc/nfvo/lcm.git] / lcm / ns / serializers / sol / lccn_filter_data.py
1 # Copyright (c) 2019, CMCC Technologies Co., Ltd.
2
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6
7 # http://www.apache.org/licenses/LICENSE-2.0
8
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 from rest_framework import serializers
16
17 from ns_instance_subscription_filter import NsInstanceSubscriptionFilter
18 from lcm.ns.const import NOTIFICATION_TYPES, NS_LCM_OP_TYPES, LCM_OPERATION_STATE_TYPES, NS_COMPOMENT_TYPE,\
19     LCM_OPName_For_Change_Notification_Type, LCM_OpOcc_Status_For_ChangeNotification_Type
20
21
22 class LifeCycleChangeNotificationsFilter(serializers.Serializer):
23     nsInstanceSubscriptionFilter = NsInstanceSubscriptionFilter(
24         help_text="Filter criteria to select NS instances about which to notify.",
25         required=False, allow_null=False)
26     notificationTypes = serializers.ListField(
27         child=serializers.ChoiceField(required=True, choices=NOTIFICATION_TYPES),
28         help_text="Match particular notification types", allow_null=False, required=False)
29     operationTypes = serializers.ListField(
30         child=serializers.ChoiceField(required=True, choices=NS_LCM_OP_TYPES),
31         help_text="Match particular NS lifecycle operation types for the notification of type "
32                   "NsLcmOperationOccurrenceNotification.", allow_null=False, required=False)
33     operationStates = serializers.ListField(
34         child=serializers.ChoiceField(required=True, choices=LCM_OPERATION_STATE_TYPES),
35         help_text="Match particular LCM operation state values as reported in notifications of type "
36                   "NsLcmOperationOccurrenceNotification.", allow_null=False, required=False)
37     nsComponentTypes = serializers.ListField(
38         child=serializers.ChoiceField(required=True, choices=NS_COMPOMENT_TYPE),
39         help_text="Match particular NS component types for the notification of type NsChangeNotification. ",
40         required=False, allow_null=False)
41     lcmOpNameImpactingNsComponent = serializers.ListField(
42         child=serializers.ChoiceField(required=True, choices=LCM_OPName_For_Change_Notification_Type),
43         help_text="Match particular LCM operation names for the notification of type NsChangeNotification. ",
44         required=False, allow_null=False)
45     lcmOpOccStatusImpactingNsComponent = serializers.ListField(
46         child=serializers.ChoiceField(required=True, choices=LCM_OpOcc_Status_For_ChangeNotification_Type),
47         help_text="Match particular LCM operation status values as reported in notifications of type "
48                   "NsChangeNotification.", required=False, allow_null=False)