diff options
author | ying.yunlong <ying.yunlong@zte.com.cn> | 2018-02-07 14:45:56 +0800 |
---|---|---|
committer | ying.yunlong <ying.yunlong@zte.com.cn> | 2018-02-07 14:45:56 +0800 |
commit | cbc83a8137bd9c9b48594ee353aa57400a66f9dd (patch) | |
tree | 025b0fd3f620c9d8b494e962c21a38cda4f243bd /zte | |
parent | 21b28e9ceb1202475ef52cdcfae75979be2c6f23 (diff) |
Add vfc-ztevnfmdriver grant schema
Change-Id: I61d72ce27345fc3e59f5e6024609a6366d862f37
Issue-ID: VFC-736
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
Diffstat (limited to 'zte')
-rw-r--r-- | zte/vmanager/driver/interfaces/serializers.py | 68 | ||||
-rw-r--r-- | zte/vmanager/driver/interfaces/tests.py | 15 |
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": "" } ] } |