summaryrefslogtreecommitdiffstats
path: root/zte/vmanager
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2019-03-25 10:58:56 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2019-03-25 11:04:55 +0800
commit91371241b309f0bc39cf195fc46b2c4f2ac49752 (patch)
tree6555d8c053989a3e95decf7beb6322bde68edb9b /zte/vmanager
parent4ea3a430697414352dd709d1108246c9e489d0f4 (diff)
Add serializer for get vnf pkgs
Change-Id: I8fc30949fc0a8df873c28169f3aa6602c89e0e51 Issue-ID: VFC-1307 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
Diffstat (limited to 'zte/vmanager')
-rw-r--r--zte/vmanager/driver/interfaces/serializers.py46
-rw-r--r--zte/vmanager/driver/interfaces/views.py8
2 files changed, 53 insertions, 1 deletions
diff --git a/zte/vmanager/driver/interfaces/serializers.py b/zte/vmanager/driver/interfaces/serializers.py
index b549b364..9384b21f 100644
--- a/zte/vmanager/driver/interfaces/serializers.py
+++ b/zte/vmanager/driver/interfaces/serializers.py
@@ -499,3 +499,49 @@ class SubscribeRespSerializer(serializers.Serializer):
max_length=255,
required=True,
allow_null=True)
+
+
+class VnfPkgSerializer(serializers.Serializer):
+ packageid = serializers.CharField(
+ help_text="packageid",
+ max_length=255,
+ required=False,
+ allow_null=True)
+ vendor = serializers.CharField(
+ help_text="vendor",
+ max_length=255,
+ required=False,
+ allow_null=True)
+ type = serializers.CharField(
+ help_text="type",
+ max_length=255,
+ required=False,
+ allow_null=True)
+ vnfdfile = serializers.CharField(
+ help_text="vnfdfile",
+ max_length=255,
+ required=False,
+ allow_null=True)
+ imagefiles = serializers.ListSerializer(
+ help_text='imagefiles',
+ child=serializers.CharField(help_text='imagefile', required=True),
+ required=False,
+ allow_null=True)
+ swfiles = serializers.ListSerializer(
+ help_text='swfiles',
+ child=serializers.CharField(help_text='swfile', required=True),
+ required=False,
+ allow_null=True)
+ description = serializers.CharField(
+ help_text="description",
+ max_length=255,
+ required=False,
+ allow_null=True)
+
+
+class VnfPkgsSerializer(serializers.Serializer):
+ data = VnfPkgSerializer(
+ help_text="Vnf package",
+ many=True,
+ required=False,
+ allow_null=True)
diff --git a/zte/vmanager/driver/interfaces/views.py b/zte/vmanager/driver/interfaces/views.py
index 1c4625d5..292e7488 100644
--- a/zte/vmanager/driver/interfaces/views.py
+++ b/zte/vmanager/driver/interfaces/views.py
@@ -28,7 +28,7 @@ from django.http import StreamingHttpResponse
from driver.interfaces.serializers import HealReqSerializer, InstScaleHealRespSerializer, ScaleReqSerializer, \
NotifyReqSerializer, GrantRespSerializer, GrantReqSerializer, JobQueryRespSerializer, TerminateVnfRequestSerializer, \
InstantiateVnfRequestSerializer, QueryVnfResponseSerializer, SubscribesRespSerializer, \
- SubscribeReqSerializer, SubscribeRespSerializer
+ SubscribeReqSerializer, SubscribeRespSerializer, VnfPkgsSerializer
from driver.pub.config.config import VNF_FTP
from driver.pub.utils import restcall
from driver.pub.utils.restcall import req_by_msb
@@ -675,6 +675,12 @@ class SubscribeDetail(APIView):
class VnfPkgs(APIView):
+ @swagger_auto_schema(
+ responses={
+ status.HTTP_200_OK: VnfPkgsSerializer(),
+ status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
+ }
+ )
def get(self, request):
logger.debug("====VnfPkgs get====")
resp_data = {