From cbc83a8137bd9c9b48594ee353aa57400a66f9dd Mon Sep 17 00:00:00 2001 From: "ying.yunlong" Date: Wed, 7 Feb 2018 14:45:56 +0800 Subject: Add vfc-ztevnfmdriver grant schema Change-Id: I61d72ce27345fc3e59f5e6024609a6366d862f37 Issue-ID: VFC-736 Signed-off-by: ying.yunlong --- zte/vmanager/driver/interfaces/serializers.py | 68 ++++++++++++++++++++++++++- zte/vmanager/driver/interfaces/tests.py | 15 +++--- 2 files changed, 75 insertions(+), 8 deletions(-) (limited to 'zte') 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": "" } ] } -- cgit 1.2.3-korg