diff options
author | fujinhua <fu.jinhua@zte.com.cn> | 2017-09-19 18:44:09 +0800 |
---|---|---|
committer | fujinhua <fu.jinhua@zte.com.cn> | 2017-09-19 18:44:09 +0800 |
commit | 803ee8f7f8f779cab598300ed8484989c0edb964 (patch) | |
tree | 6be60c42c3ef9f049dced07f15cd812c259188b6 | |
parent | a63a20c42f5bf743bfd5992f661a3e2951fc6baa (diff) |
Refactor nsd/vnfd parser api
Remove unreachable codes.
Change-Id: I1f3961084d25c31d288ec244df003d508e90c5ca
Issue-Id: VFC-387
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r-- | catalog/packages/views.py | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/catalog/packages/views.py b/catalog/packages/views.py index 2e001380..d2875510 100644 --- a/catalog/packages/views.py +++ b/catalog/packages/views.py @@ -114,31 +114,21 @@ def nf_rd_csar(request, *args, **kwargs): def ns_model_parser(request, *args, **kwargs): csar_id = ignore_case_get(request.data, "csarId") inputs = ignore_case_get(request.data, "inputs") - if request.method == 'POST': - ret = ns_package.parser_NSPackageModel(csar_id,inputs) - normal_status = status.HTTP_202_ACCEPTED - else: - ret = [1, "Request is not allowed"] - normal_status = "" - + logger.debug("Enter %s, csar_id=%s, inputs=%s", fun_name(), csar_id, inputs) + ret = ns_package.parser_NSPackageModel(csar_id, inputs) logger.info("Leave %s, Return value is %s", fun_name(), ret) if ret[0] != 0: return Response(data={'error': ret[1]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) - return Response(data=ret[1], status=normal_status) + return Response(data=ret[1], status=status.HTTP_202_ACCEPTED) @api_view(http_method_names=['POST']) def vnf_model_parser(request, *args, **kwargs): csar_id = ignore_case_get(request.data, "csarId") inputs = ignore_case_get(request.data, "inputs") - if request.method == 'POST': - ret = nf_package.parser_vnfdmodel(csar_id,inputs) - normal_status = status.HTTP_202_ACCEPTED - else: - ret = [1, "Request is not allowed"] - normal_status = "" - + logger.debug("Enter %s, csar_id=%s, inputs=%s", fun_name(), csar_id, inputs) + nf_package.parser_vnfdmodel(csar_id, inputs) logger.info("Leave %s, Return value is %s", fun_name(), ret) if ret[0] != 0: return Response(data={'error': ret[1]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) - return Response(data=ret[1], status=normal_status) + return Response(data=ret[1], status=status.HTTP_202_ACCEPTED) |