diff options
author | fujinhua <fu.jinhua@zte.com.cn> | 2019-04-22 14:43:32 +0800 |
---|---|---|
committer | fujinhua <fu.jinhua@zte.com.cn> | 2019-04-22 14:43:32 +0800 |
commit | bc82e6770245e30a8f2396975a3f52c1ca12e451 (patch) | |
tree | 0f7e0cdf1e40d87ff0d14bf21b3ae9f4cec39d65 | |
parent | 24cad95bbc51ac648d1cd48c7261da581669fd88 (diff) |
Refactor codes for vnf get
Change-Id: Iba01e1fb2331d840158a5ffcef80d295bb57424e
Issue-ID: VFC-1306
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r-- | lcm/lcm/nf/views/curd_vnf_views.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lcm/lcm/nf/views/curd_vnf_views.py b/lcm/lcm/nf/views/curd_vnf_views.py index 6c646f1f..29ca82b8 100644 --- a/lcm/lcm/nf/views/curd_vnf_views.py +++ b/lcm/lcm/nf/views/curd_vnf_views.py @@ -32,6 +32,7 @@ from lcm.nf.const import VNF_STATUS from lcm.nf.const import OPERATION_TYPE from .common import view_safe_call_with_log from .common import deal_vnf_action +from .common import deal_indivdual_query logger = logging.getLogger(__name__) @@ -91,13 +92,11 @@ class DeleteVnfAndQueryVnf(APIView): @view_safe_call_with_log(logger=logger) def get(self, request, instanceid): logger.debug("QuerySingleVnf--get::> %s" % request.data) - resp_data = QueryVnf(request.data, instanceid).query_single_vnf() - vnfs_instance_serializer = VnfInstanceSerializer(data=resp_data) - if not vnfs_instance_serializer.is_valid(): - raise NFLCMException(vnfs_instance_serializer.errors) - - return Response(data=vnfs_instance_serializer.data, status=status.HTTP_200_OK) + return deal_indivdual_query(res_serializer=VnfInstanceSerializer, + query_fun=QueryVnf( + request.data, + instanceid).query_single_vnf) @swagger_auto_schema( responses={ |