Update nf_pm serializer in vnflcm
[vfc/gvnfm/vnflcm.git] / lcm / lcm / nf_pm / serializers / threshold_crossed_notification.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 lcm.nf_pm.counst import CrossingDirectionType
18 from lcm.nf_pm.serializers.Link import LinkSerializer
19
20
21 class ThresholdCrossedNotificationSerializer(serializers.Serializer):
22     id = serializers.CharField(help_text="Identifier of this notification.", required=True, allow_null=False)
23     notificationType = serializers.CharField(help_text="Discriminator for the different notification types.",
24                                              required=True, allow_null=False)
25     subscriptionId = serializers.CharField(help_text="Identifier of the subscription that this notification "
26                                                      "relates to", required=True, allow_null=False)
27     timeStamp = serializers.DateField(help_text="Date and time of the generation of the notification",
28                                       required=True, allow_null=False)
29     thresholdId = serializers.CharField(help_text="Identifier of the threshold which has been crossed.",
30                                         required=True, allow_null=False)
31     crossingDirection = serializers.ChoiceField(help_text="An indication of whether the threshold was "
32                                                           "crossed in upward or downward direction.",
33                                                 required=True, allow_null=False,
34                                                 choices=CrossingDirectionType)
35     objectInstanceId = serializers.CharField(help_text="Identifier that identifies a VNF instance.",
36                                              required=True, allow_null=False)
37     performanceMetric = serializers.CharField(help_text="Performance metric associated with the threshold.",
38                                               required=True, allow_null=False)
39     performanceValue = serializers.CharField(help_text="Value of the metric that resulted in threshold "
40                                                        "crossing.", required=True, allow_null=False)
41     _links = LinkSerializer(help_text="Links to resources related to this notification",
42                             required=True, allow_null=False)