summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lcm/lcm/nf/views/instantiate_vnf_view.py38
1 files changed, 15 insertions, 23 deletions
diff --git a/lcm/lcm/nf/views/instantiate_vnf_view.py b/lcm/lcm/nf/views/instantiate_vnf_view.py
index 3b4a3bee..1a7905aa 100644
--- a/lcm/lcm/nf/views/instantiate_vnf_view.py
+++ b/lcm/lcm/nf/views/instantiate_vnf_view.py
@@ -13,7 +13,6 @@
# limitations under the License.
import logging
-import traceback
from drf_yasg.utils import swagger_auto_schema
from lcm.nf.biz.instantiate_vnf import InstantiateVnf
@@ -39,25 +38,18 @@ class InstantiateVnfView(APIView):
)
def post(self, request, instanceid):
logger.debug("InstantiateVnf--post::> %s" % request.data)
- try:
- instantiate_vnf_request_serializer = InstantiateVnfRequestSerializer(data=request.data)
- if not instantiate_vnf_request_serializer.is_valid():
- raise NFLCMException(instantiate_vnf_request_serializer.errors)
-
- job_id = JobUtil.create_job('NF', 'INSTANTIATE', instanceid)
- JobUtil.add_job_status(job_id, 0, "INST_VNF_READY")
- InstantiateVnf(instantiate_vnf_request_serializer.data, instanceid, job_id).start()
-
- job_identifier_serializer = JobIdentifierSerializer(data={"jobId": job_id})
- resp_isvalid = job_identifier_serializer.is_valid()
- if not resp_isvalid:
- raise NFLCMException(job_identifier_serializer.errors)
-
- return Response(data=job_identifier_serializer.data, status=status.HTTP_202_ACCEPTED)
- except NFLCMException as e:
- logger.error(e.message)
- return Response(data={'error': '%s' % e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
- except Exception as e:
- logger.error(e.message)
- logger.error(traceback.format_exc())
- return Response(data={'error': 'unexpected exception'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+
+ instantiate_vnf_request_serializer = InstantiateVnfRequestSerializer(data=request.data)
+ if not instantiate_vnf_request_serializer.is_valid():
+ raise NFLCMException(instantiate_vnf_request_serializer.errors)
+
+ job_id = JobUtil.create_job('NF', 'INSTANTIATE', instanceid)
+ JobUtil.add_job_status(job_id, 0, "INST_VNF_READY")
+ InstantiateVnf(instantiate_vnf_request_serializer.data, instanceid, job_id).start()
+
+ job_identifier_serializer = JobIdentifierSerializer(data={"jobId": job_id})
+ resp_isvalid = job_identifier_serializer.is_valid()
+ if not resp_isvalid:
+ raise NFLCMException(job_identifier_serializer.errors)
+
+ return Response(data=job_identifier_serializer.data, status=status.HTTP_202_ACCEPTED)