fix NS heal serializer error 54/83954/1
authormaopengzhang <zhang.maopeng1@zte.com.cn>
Tue, 2 Apr 2019 10:37:47 +0000 (18:37 +0800)
committermaopengzhang <zhang.maopeng1@zte.com.cn>
Tue, 2 Apr 2019 10:37:47 +0000 (18:37 +0800)
fix NS heal serializer error

Change-Id: Ie23c10663b265a9416c8a39a15e25eed205d58db
Issue-ID: VFC-1185
Signed-off-by: maopengzhang <zhang.maopeng1@zte.com.cn>
lcm/ns/serializers/sol/heal_serializers.py

index a935fde..a699056 100644 (file)
@@ -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.
 from rest_framework import serializers
 
 
-class ActionVmSerializer(serializers.Serializer):
-    vmid = serializers.CharField(help_text="ID of VM", required=False, allow_null=True, allow_blank=True)
-    vduid = serializers.CharField(help_text="ID of vdu", required=False, allow_null=True, allow_blank=True)
-    vmname = serializers.CharField(help_text="Name of VM", required=False, allow_null=True, allow_blank=True)
+class ActionVmSerializer(serializers.Serializer):
+#    vmid = serializers.CharField(help_text="ID of VM", required=False, allow_null=True, allow_blank=True)
+#    vduid = serializers.CharField(help_text="ID of vdu", required=False, allow_null=True, allow_blank=True)
+#    vmname = serializers.CharField(help_text="Name of VM", required=False, allow_null=True, allow_blank=True)
 
 
-class HealNsAdditionalParamsSerializer(serializers.Serializer):
-    action = serializers.CharField(help_text="Action of NS heal", required=False, allow_null=True, allow_blank=True)
-    actionvminfo = ActionVmSerializer(help_text="VM info of action", required=False, allow_null=True)
+class HealNsAdditionalParamsSerializer(serializers.Serializer):
+#    action = serializers.CharField(help_text="Action of NS heal", required=False, allow_null=True, allow_blank=True)
+#    actionvminfo = ActionVmSerializer(help_text="VM info of action", required=False, allow_null=True)
 
 
 class HealVnfDataSerializer(serializers.Serializer):
-    vnfInstanceId = serializers.CharField(help_text="Identifies the VNF instance,", required=True)
-    cause = serializers.CharField(help_text="Indicates the reason why a healing procedure is required",
-                                  required=False, allow_null=True, allow_blank=True)
-    additionalParams = serializers.DictField(help_text="Additional parameters passed by the NFVO as input to "
-                                                       "the healing process",
-                                             child=HealNsAdditionalParamsSerializer(
-                                                 help_text="KeyValue Pairs"), required=False, allow_null=True)
+    vnfInstanceId = serializers.CharField(
+        help_text="Identifies the VNF instance, part of the NS, requiring a healing action.",
+        required=True)
+    cause = serializers.CharField(
+        help_text="Indicates the reason why a healing procedure is required.",
+        required=False,
+        allow_null=True,
+        allow_blank=True)
+    additionalParams = serializers.DictField(
+        help_text="Additional parameters passed by the NFVO as input to the healing process, specific to the VNF being healed.",
+        required=False,
+        allow_null=True)
 
 
 class HealNsDataSerializer(serializers.Serializer):
-    degreeHealing = serializers.ChoiceField(help_text="degree of healing", choices=["HEAL_RESTORE", "HEAL_QOS", "HEAL_RESET", "PARTIAL_HEALING"], required=True)
+    degreeHealing = serializers.ChoiceField(
+        help_text="Indicates the degree of healing.",
+        choices=["HEAL_RESTORE", "HEAL_QOS", "HEAL_RESET", "PARTIAL_HEALING"],
+        required=True)
     actionsHealing = serializers.ListField(
-        help_text="A list of actions",
-        child=serializers.CharField(help_text="One action", required=True),
+        help_text="Used to specify dedicated healing actions in a particular order",
+        child=serializers.CharField(
+            help_text="one dedicated healing action",
+            required=True),
+        required=False)
+    healScript = serializers.CharField(
+        help_text="Reference to a script from the NSD that shall be used to execute dedicated healing actions in a particular order.",
+        required=False,
+        allow_null=True,
+        allow_blank=True)
+    additionalParamsforNs = serializers.DictField(
+        help_text="Allows the OSS/BSS to provide additional parameter(s) to the healing process at the NS level.",
         required=False)
-    healScript = serializers.CharField(help_text="script of NS heal", required=False, allow_null=True, allow_blank=True)
-    additionalParamsforNs = serializers.CharField(help_text="Addition params of NS heal", required=False, allow_null=True, allow_blank=True)
 
 
 class HealNsReqSerializer(serializers.Serializer):
-    healVnfData = HealVnfDataSerializer(help_text="Data of heal VNF", required=False, allow_null=True,
-                                        many=True)
-    healNsData = HealNsDataSerializer(help_text="Provides the information needed to heal an NS",
-                                      required=False, allow_null=True)
+    healVnfData = HealVnfDataSerializer(
+        help_text="Provides the information needed to heal a VNF.",
+        required=False,
+        allow_null=True,
+        many=True)
+    healNsData = HealNsDataSerializer(
+        help_text="Provides the information needed to heal an NS.",
+        required=False,
+        allow_null=True)