summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2018-01-30 14:54:24 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2018-01-30 14:54:24 +0800
commit00aba92f331c198e9d73ce0ceb64feb1cbad6135 (patch)
treefa1d4e766540c75b84c0de36eff79075da0f5798
parent3ec6326547d6b5f6f8d8a97d138eecf51eaa8ead (diff)
Add vfc-vnfres vnfinfo schema
Change-Id: I3431f14ac7afd4b3c13fb0faf71f9727dbcf414e Issue-ID: VFC-682 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--res/res/resources/serializers.py116
-rw-r--r--res/res/resources/tests.py2
-rw-r--r--res/res/resources/views.py2
3 files changed, 118 insertions, 2 deletions
diff --git a/res/res/resources/serializers.py b/res/res/resources/serializers.py
index bcfdc7e..0f2a1e2 100644
--- a/res/res/resources/serializers.py
+++ b/res/res/resources/serializers.py
@@ -15,6 +15,37 @@
from rest_framework import serializers
+class StorageResourceSerializer(serializers.Serializer):
+ resourceId = serializers.CharField(help_text="resourceId", required=True)
+ vimId = serializers.CharField(help_text="vimId", required=True)
+
+
+class virtualStorageResourceInfoSerializer(serializers.Serializer):
+ virtualStorageInstanceId = serializers.CharField(help_text="virtualStorageInstanceId", required=True)
+ virtualStorageDescId = serializers.CharField(help_text="virtualStorageDescId", required=True, allow_null=True)
+ storageResource = StorageResourceSerializer(help_text="storageResource", required=True)
+
+
+class virtualLinkResourceInfoSerializer(serializers.Serializer):
+ pass
+
+
+class vnfcResourceInfoSerializer(serializers.Serializer):
+ pass
+
+
+class accessInfoSerializer(serializers.Serializer):
+ tenant = serializers.CharField(help_text="tenant", required=True)
+ username = serializers.CharField(help_text="username", required=True)
+ password = serializers.CharField(help_text="password", required=True)
+
+
+class InterfaceInfoSerializer(serializers.Serializer):
+ vimType = serializers.CharField(help_text="vimType", required=True)
+ apiVersion = serializers.CharField(help_text="apiVersion", required=True)
+ protocolType = serializers.ChoiceField(help_text="protocolType", choices=['http', 'https'], required=True)
+
+
class VmResponseSerializer(serializers.Serializer):
vmid = serializers.CharField(help_text="vmid", required=True)
vimid = serializers.CharField(help_text="the vim id", required=True)
@@ -34,6 +65,91 @@ class VmResponseSerializer(serializers.Serializer):
nic_array = serializers.CharField(help_text="nic_array", required=True)
+class vimInfoSerializer(serializers.Serializer):
+ vimInfoId = serializers.CharField(help_text="vimInfoId", required=False, allow_null=True)
+ vimId = serializers.CharField(help_text="vimId", required=False, allow_null=True)
+ interfaceEndpoint = serializers.CharField(help_text="interfaceEndpoint", required=False, allow_null=True)
+ interfaceInfo = InterfaceInfoSerializer(help_text="vimInfoId", required=False, allow_null=True)
+ accessInfo = accessInfoSerializer(help_text="accessInfo", required=False, allow_null=True)
+
+
+class monitoringParametersSerializer(serializers.Serializer):
+ pass
+
+
+class linkPortsSerializer(serializers.Serializer):
+ resourceId = serializers.CharField(help_text="resourceId", required=True)
+ vimId = serializers.CharField(help_text="vimId", required=False)
+
+
+class resourceHandleSerializer(serializers.Serializer):
+ resourceId = serializers.CharField(help_text="resourceId", required=True)
+ vimId = serializers.CharField(help_text="vimId", required=False)
+ resourceProviderId = serializers.CharField(help_text="resourceProviderId", required=False)
+
+
+class ExtVirtualLinkInfoSerializer(serializers.Serializer):
+ extVirtualLinkId = serializers.CharField(help_text="extVirtualLinkId", required=True)
+ resourceHandle = resourceHandleSerializer(help_text="iPAddress", required=True)
+ linkPorts = linkPortsSerializer(help_text="iPAddress", many=True, allow_null=True)
+
+
+class l3AddressDataSerializer(serializers.Serializer):
+ iPAddressType = serializers.ChoiceField(help_text="iPAddressType", choices=['IPv4', 'IPv6'], required=True)
+ iPAddress = serializers.CharField(help_text="iPAddress", required=True)
+
+
+class NetworkAddressSerializer(serializers.Serializer):
+ addressType = serializers.ChoiceField(help_text="addressType", choices=['MAC', 'IP'], required=True)
+ l2AddressData = serializers.CharField(help_text="l2AddressData", required=False)
+ l3AddressData = l3AddressDataSerializer(help_text="addresses", required=False)
+
+
+class extCpInfoSerializer(serializers.Serializer):
+ cpInstanceId = serializers.CharField(help_text="cpInstanceId", required=False, allow_null=True)
+ cpdId = serializers.IntegerField(help_text="cpdId", required=True)
+ numDynamicAddresses = serializers.IntegerField(help_text="numDynamicAddresses", required=False, allow_null=True)
+ addresses = NetworkAddressSerializer(help_text="addresses", many=True, allow_null=True)
+
+
+class ScaleInfoSerializer(serializers.Serializer):
+ aspectId = serializers.CharField(help_text="aspectId", required=True, allow_null=True)
+ scaleLevel = serializers.IntegerField(help_text="scaleLevel", required=True, allow_null=True)
+
+
+class instantiatedVnfInfoSerializer(serializers.Serializer):
+ flavourId = serializers.CharField(help_text="flavour Id", required=True, allow_null=True)
+ vnfState = serializers.ChoiceField(help_text="vnf State", choices=['STARTED', 'STOPPED'], required=True, allow_null=True)
+ localizationLanguage = serializers.CharField(help_text="localizationLanguage", required=True, allow_null=True)
+ metadata = serializers.CharField(help_text="metadata", required=True, allow_null=True)
+ extensions = serializers.CharField(help_text="extensions", required=True, allow_null=True)
+ scaleStatus = ScaleInfoSerializer(help_text="scaleStatus", many=True)
+ extCpInfo = extCpInfoSerializer(help_text="extCpInfo", many=True)
+ extVirtualLink = ExtVirtualLinkInfoSerializer(help_text="extVirtualLink", many=True)
+ monitoringParameters = monitoringParametersSerializer(help_text="monitoringParameters", allow_null=True)
+ vmInfo = VmResponseSerializer(help_text="vmInfo", many=True, allow_null=True)
+ vimInfo = vimInfoSerializer(help_text="vimInfo", many=True, allow_null=True)
+ vnfcResourceInfo = vnfcResourceInfoSerializer(help_text="vnfcResourceInfo", many=True)
+ virtualLinkResourceInfo = virtualLinkResourceInfoSerializer(help_text="virtualLinkResourceInfo", many=True)
+ virtualStorageResourceInfo = virtualStorageResourceInfoSerializer(help_text="virtualStorageResourceInfo", many=True)
+
+
+class VnfInfoSerializer(serializers.Serializer):
+ vnfInstanceId = serializers.CharField(help_text="vnf Instance Id", required=True)
+ vnfInstanceName = serializers.CharField(help_text="vnf Instance Name", required=True)
+ vnfInstanceDescription = serializers.CharField(help_text="vnfInstanceDescription", required=True, allow_null=True)
+ onboardedVnfPkgInfoId = serializers.CharField(help_text="onboarded Vnf Pkg Info Id", required=False,
+ allow_null=True)
+ vnfdId = serializers.CharField(help_text="vnfdId", required=True, allow_null=True)
+ vnfdVersion = serializers.CharField(help_text="vnfd Version", required=False, allow_null=True)
+ vnfSoftwareVersion = serializers.CharField(help_text="vnfSoftwareVersion", required=True, allow_null=True)
+ vnfProvider = serializers.CharField(help_text="vnf Provider", required=False, allow_null=True)
+ vnfProductName = serializers.CharField(help_text="vnfProductName", required=False, allow_null=True)
+ vnfConfigurableProperties = serializers.CharField(help_text="vnfConfigurableProperties", required=False, allow_null=True)
+ instantiationState = serializers.CharField(help_text="instantiationState", required=False, allow_null=True)
+ instantiatedVnfInfo = instantiatedVnfInfoSerializer(help_text="instantiatedVnfInfo", required=True)
+
+
class VmInfoSerializer(serializers.Serializer):
resp_data = VmResponseSerializer(help_text="the response data", many=True)
diff --git a/res/res/resources/tests.py b/res/res/resources/tests.py
index 7f5026e..d78e166 100644
--- a/res/res/resources/tests.py
+++ b/res/res/resources/tests.py
@@ -34,7 +34,7 @@ class ResourceTest(TestCase):
"vnfSoftwareVersion": None,
"vnfProvider": None,
"vnfProductName": None,
- "vnfConfigurableProperties": {None},
+ "vnfConfigurableProperties": None,
"instantiationState": None,
"instantiatedVnfInfo": {
"flavourId": None,
diff --git a/res/res/resources/views.py b/res/res/resources/views.py
index d7275dd..6cfac2e 100644
--- a/res/res/resources/views.py
+++ b/res/res/resources/views.py
@@ -135,7 +135,7 @@ def fill_resp_data(vnf):
"vnfSoftwareVersion": vnf.vnfSoftwareVersion,
"vnfProvider": vnf.vendor,
"vnfProductName": vnf.netype,
- "vnfConfigurableProperties": {vnf.vnfConfigurableProperties},
+ "vnfConfigurableProperties": vnf.vnfConfigurableProperties,
"instantiationState": vnf.status,
"instantiatedVnfInfo": {
"flavourId": vnf.flavour_id,