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