fix swagger error
[vfc/nfvo/lcm.git] / lcm / ns / views / sol / scale_ns_views.py
index a86805c..8a5c19d 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2016-2017 ZTE Corporation.
+# Copyright 2016 ZTE Corporation.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -23,20 +23,21 @@ from lcm.pub.exceptions import NSLCMException
 from lcm.pub.utils.jobutil import JobUtil, JOB_TYPE
 from lcm.ns.const import NS_OCC_BASE_URI
 from lcm.pub.exceptions import BadRequestException
+from lcm.ns.serializers.sol.pub_serializers import ProblemDetailsSerializer
 
 logger = logging.getLogger(__name__)
 
 
 class ScaleNSView(APIView):
     @swagger_auto_schema(
-        request_body=ManualScaleNsReqSerializer(help_text="NS manual scale"),
+        request_body=ManualScaleNsReqSerializer(help_text="NS Scale"),
         responses={
-            status.HTTP_202_ACCEPTED: None,
-            status.HTTP_500_INTERNAL_SERVER_ERROR: "Inner error"
+            status.HTTP_202_ACCEPTED: "HTTP_202_ACCEPTED",
+            status.HTTP_500_INTERNAL_SERVER_ERROR: ProblemDetailsSerializer()
         }
     )
     def post(self, request, ns_instance_id):
-        logger.debug("Enter NSManualScaleView::post %s, %s", request.data, ns_instance_id)
+        logger.debug("Enter ScaleNSView::post %s, %s", request.data, ns_instance_id)
         job_id = JobUtil.create_job("NS", JOB_TYPE.MANUAL_SCALE_VNF, ns_instance_id)
         try:
             req_serializer = ManualScaleNsReqSerializer(data=request.data)
@@ -47,15 +48,15 @@ class ScaleNSView(APIView):
             response = Response(data={}, status=status.HTTP_202_ACCEPTED)
             logger.debug("Location: %s" % nsManualScaleService.occ_id)
             response["Location"] = NS_OCC_BASE_URI % nsManualScaleService.occ_id
-            logger.debug("Leave NSHealView")
+            logger.debug("Leave ScaleNSView")
             return response
         except BadRequestException as e:
-            logger.error("Exception in HealNS: %s", e.message)
+            logger.error("Exception in ScaleNSView: %s", e.message)
             JobUtil.add_job_status(job_id, 255, 'NS scale failed: %s' % e.message)
             data = {'status': status.HTTP_400_BAD_REQUEST, 'detail': e.message}
             return Response(data=data, status=status.HTTP_400_BAD_REQUEST)
         except Exception as e:
-            logger.error("Exception in HealNSView: %s", e.message)
+            logger.error("Exception in ScaleNSView: %s", e.message)
             JobUtil.add_job_status(job_id, 255, 'NS scale failed: %s' % e.message)
             data = {'status': status.HTTP_500_INTERNAL_SERVER_ERROR, 'detail': e.message}
             return Response(data=data, status=status.HTTP_500_INTERNAL_SERVER_ERROR)