Add vfc-vnflcm deleteVnf auto-swagger 21/29721/1
authorying.yunlong <ying.yunlong@zte.com.cn>
Wed, 31 Jan 2018 02:56:48 +0000 (10:56 +0800)
committerying.yunlong <ying.yunlong@zte.com.cn>
Wed, 31 Jan 2018 02:56:48 +0000 (10:56 +0800)
Change-Id: Ie1f5a61973479b105313e2bd556dd2902c9e0454
Issue-ID: VFC-682
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
lcm/lcm/nf/vnfs/views.py

index b114ee5..9f385a0 100644 (file)
@@ -152,10 +152,18 @@ class DeleteVnfAndQueryVnf(APIView):
             return Response(data={'error': 'Failed to get Vnf(%s)' % instanceid},
                             status=status.HTTP_500_INTERNAL_SERVER_ERROR)
 
+    @swagger_auto_schema(
+        responses={
+            status.HTTP_204_NO_CONTENT: "Successfully",
+            status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
+        }
+    )
     def delete(self, request, instanceid):
         logger.debug("DeleteVnfIdentifier--delete::> %s" % request.data)
         try:
             DeleteVnf(request.data, instanceid).do_biz()
+
+            return Response(data=None, status=status.HTTP_204_NO_CONTENT)
         except NFLCMException as e:
             logger.error(e.message)
             return Response(data={'error': '%s' % e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
@@ -163,7 +171,6 @@ class DeleteVnfAndQueryVnf(APIView):
             logger.error(e.message)
             logger.error(traceback.format_exc())
             return Response(data={'error': 'unexpected exception'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
-        return Response(data=None, status=status.HTTP_204_NO_CONTENT)
 
 
 class TerminateVnf(APIView):