summaryrefslogtreecommitdiffstats
path: root/zte/vmanager
diff options
context:
space:
mode:
Diffstat (limited to 'zte/vmanager')
-rw-r--r--zte/vmanager/driver/interfaces/serializers.py68
-rw-r--r--zte/vmanager/driver/interfaces/tests.py15
2 files changed, 75 insertions, 8 deletions
diff --git a/zte/vmanager/driver/interfaces/serializers.py b/zte/vmanager/driver/interfaces/serializers.py
index bb7fc238..6e9456ce 100644
--- a/zte/vmanager/driver/interfaces/serializers.py
+++ b/zte/vmanager/driver/interfaces/serializers.py
@@ -15,6 +15,70 @@
from rest_framework import serializers
+class GrantVmlistSerializer(serializers.Serializer):
+ VMNumber = serializers.CharField(
+ help_text="VMNumber",
+ max_length=255,
+ required=False,
+ allow_null=True)
+ VMFlavor = serializers.CharField(
+ help_text="VMFlavor",
+ max_length=255,
+ required=False,
+ allow_null=True)
+ vimid = serializers.CharField(
+ help_text="vimid",
+ max_length=255,
+ required=True,
+ allow_null=True)
+ tenant = serializers.CharField(
+ help_text="tenant",
+ max_length=255,
+ required=False,
+ allow_blank=True)
+
+
+class GrantReqSerializer(serializers.Serializer):
+ nfvoid = serializers.CharField(
+ help_text="nfvoid",
+ max_length=255,
+ required=True,
+ allow_null=True)
+ vnfmid = serializers.CharField(
+ help_text="vnfmid",
+ max_length=255,
+ required=True,
+ allow_null=True)
+ vimid = serializers.CharField(
+ help_text="vimid",
+ max_length=255,
+ required=True,
+ allow_null=True)
+ tenant = serializers.CharField(
+ help_text="tenant",
+ max_length=255,
+ required=False,
+ allow_blank=True)
+ vnfinstanceid = serializers.CharField(
+ help_text="vnfinstanceid",
+ max_length=255,
+ required=False,
+ allow_null=True)
+ operationright = serializers.CharField(
+ help_text="operationright",
+ max_length=255,
+ required=False,
+ allow_null=True)
+ vmlist = GrantVmlistSerializer(
+ help_text='vmlist',
+ required=False,
+ many=True)
+ exvimidlist = serializers.ListSerializer(
+ help_text='exvimidlist',
+ child=serializers.CharField(allow_null=True),
+ required=False)
+
+
class VMIDlistSerializer(serializers.Serializer):
VMID = serializers.CharField(
help_text="VMID",
@@ -38,7 +102,7 @@ class VMIDlistSerializer(serializers.Serializer):
allow_null=True)
-class VmlistSerializer(serializers.Serializer):
+class NotifyVmlistSerializer(serializers.Serializer):
VMNumber = serializers.CharField(
help_text="VMNumber",
max_length=255,
@@ -91,7 +155,7 @@ class NotifyReqSerializer(serializers.Serializer):
max_length=255,
required=False,
allow_null=True)
- vmlist = VmlistSerializer(
+ vmlist = NotifyVmlistSerializer(
help_text='vmlist',
required=False,
many=True)
diff --git a/zte/vmanager/driver/interfaces/tests.py b/zte/vmanager/driver/interfaces/tests.py
index fb0f7679..13f181c7 100644
--- a/zte/vmanager/driver/interfaces/tests.py
+++ b/zte/vmanager/driver/interfaces/tests.py
@@ -281,12 +281,15 @@ class InterfacesTest(TestCase):
"operationright": "0",
"vmlist": [
{
- "vmflavor": "SMP",
- "vmnumber": "3"
- },
- {
- "vmflavor": "CMP",
- "vmnumber": "3"
+ "VMNumber": 1,
+ "VMFlavor": "VDU_S_CDB_51",
+ "vimid": "",
+ "tenant": ""
+ }, {
+ "VMNumber": 1,
+ "VMFlavor": "VDU_M_SLB_42",
+ "vimid": "",
+ "tenant": ""
}
]
}