diff options
Diffstat (limited to 'lcm/ns/views/sol/scale_ns_views.py')
-rw-r--r-- | lcm/ns/views/sol/scale_ns_views.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lcm/ns/views/sol/scale_ns_views.py b/lcm/ns/views/sol/scale_ns_views.py index a86805ce..570195d7 100644 --- a/lcm/ns/views/sol/scale_ns_views.py +++ b/lcm/ns/views/sol/scale_ns_views.py @@ -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_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) |