1 # Copyright (c) 2019, CMCC Technologies Co., Ltd.
2 # Copyright 2019 ZTE Corporation.
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 from rest_framework import serializers
19 # class ActionVmSerializer(serializers.Serializer):
20 # vmid = serializers.CharField(help_text="ID of VM", required=False, allow_null=True, allow_blank=True)
21 # vduid = serializers.CharField(help_text="ID of vdu", required=False, allow_null=True, allow_blank=True)
22 # vmname = serializers.CharField(help_text="Name of VM", required=False, allow_null=True, allow_blank=True)
25 # class HealNsAdditionalParamsSerializer(serializers.Serializer):
26 # action = serializers.CharField(help_text="Action of NS heal", required=False, allow_null=True, allow_blank=True)
27 # actionvminfo = ActionVmSerializer(help_text="VM info of action", required=False, allow_null=True)
30 class HealVnfDataSerializer(serializers.Serializer):
31 vnfInstanceId = serializers.CharField(
32 help_text="Identifies the VNF instance, part of the NS, requiring a healing action.",
34 cause = serializers.CharField(
35 help_text="Indicates the reason why a healing procedure is required.",
39 additionalParams = serializers.DictField(
40 help_text="Additional parameters passed by the NFVO as input to the healing process, specific to the VNF being healed.",
45 class HealNsDataSerializer(serializers.Serializer):
46 degreeHealing = serializers.ChoiceField(
47 help_text="Indicates the degree of healing.",
48 choices=["HEAL_RESTORE", "HEAL_QOS", "HEAL_RESET", "PARTIAL_HEALING"],
50 actionsHealing = serializers.ListField(
51 help_text="Used to specify dedicated healing actions in a particular order",
52 child=serializers.CharField(
53 help_text="one dedicated healing action",
56 healScript = serializers.CharField(
57 help_text="Reference to a script from the NSD that shall be used to execute dedicated healing actions in a particular order.",
61 additionalParamsforNs = serializers.DictField(
62 help_text="Allows the OSS/BSS to provide additional parameter(s) to the healing process at the NS level.",
66 class HealNsReqSerializer(serializers.Serializer):
67 healVnfData = HealVnfDataSerializer(
68 help_text="Provides the information needed to heal a VNF.",
72 healNsData = HealNsDataSerializer(
73 help_text="Provides the information needed to heal an NS.",