summaryrefslogtreecommitdiffstats
path: root/zte/vmanager
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2019-03-25 11:33:56 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2019-03-25 11:33:56 +0800
commit4d6d05f9f9040090c8b22e55073c39a0d91f8078 (patch)
tree3d4aa3bcd5df841a2c6592829a85b02301edf040 /zte/vmanager
parent85b4171dc5d5e846e5904e815def7729bf60b022 (diff)
Add serializer for update nfvo info
Change-Id: Ic43c4d625a5821245ec057d1b869d2769884c8d1 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.py18
-rw-r--r--zte/vmanager/driver/interfaces/views.py14
2 files changed, 29 insertions, 3 deletions
diff --git a/zte/vmanager/driver/interfaces/serializers.py b/zte/vmanager/driver/interfaces/serializers.py
index 9384b21f..1d518df1 100644
--- a/zte/vmanager/driver/interfaces/serializers.py
+++ b/zte/vmanager/driver/interfaces/serializers.py
@@ -545,3 +545,21 @@ class VnfPkgsSerializer(serializers.Serializer):
many=True,
required=False,
allow_null=True)
+
+
+class NfvoInfoReqSerializer(serializers.Serializer):
+ nfvoid = serializers.CharField(
+ help_text="nfvoid",
+ max_length=255,
+ required=False,
+ allow_null=True)
+ vnfmid = serializers.CharField(
+ help_text="nfvoid",
+ max_length=255,
+ required=False,
+ allow_null=True)
+ nfvourl = serializers.CharField(
+ help_text="nfvoid",
+ max_length=255,
+ required=False,
+ allow_null=True)
diff --git a/zte/vmanager/driver/interfaces/views.py b/zte/vmanager/driver/interfaces/views.py
index cd184e8b..d3c5a831 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, VnfPkgsSerializer
+ SubscribeReqSerializer, SubscribeRespSerializer, VnfPkgsSerializer, NfvoInfoReqSerializer
from driver.pub.config.config import VNF_FTP
from driver.pub.utils import restcall
from driver.pub.utils.restcall import req_by_msb
@@ -716,6 +716,13 @@ class VnfPkg(APIView):
class NfvoInfo(APIView):
+ @swagger_auto_schema(
+ request_body=NfvoInfoReqSerializer(),
+ responses={
+ status.HTTP_200_OK: "Update successfully",
+ status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
+ }
+ )
def put(self, request, vnfmid):
logger.debug("====NfvoInfo put====%s", vnfmid)
req_data = {
@@ -725,7 +732,7 @@ class NfvoInfo(APIView):
}
ret = get_vnfminfo_from_nslcm(vnfmid)
if ret[0] != 0:
- raise Exception(ret[1])
+ return Response(data={'error': ret[1]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
vnfm_info = json.JSONDecoder().decode(ret[1])
logger.debug("[%s] vnfm_info=%s", fun_name(), vnfm_info)
@@ -738,5 +745,6 @@ class NfvoInfo(APIView):
method='put',
content=json.dumps(req_data))
if ret[0] != 0:
- raise Exception(ret[1])
+ return Response(data={'error': ret[1]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
logger.debug("update nfvo info successfully.")
+ return Response(data={}, status=status.HTTP_200_OK)