summaryrefslogtreecommitdiffstats
path: root/lcm
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2019-04-22 14:07:25 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2019-04-22 14:17:33 +0800
commite47257b82be1034ad205c676332071f6842e3702 (patch)
tree2c5fdd71cebdcb131ee405f6ae4d7ca7b47ca304 /lcm
parentaea0adb96a3adaf59041dbb83ed5b5851c67395d (diff)
Add Indivdual query common fun
Change-Id: I3070c2a8e0f5074a32899334cdc0fcd3aac8a62a Issue-ID: VFC-1306 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
Diffstat (limited to 'lcm')
-rw-r--r--lcm/lcm/nf/views/common.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/lcm/lcm/nf/views/common.py b/lcm/lcm/nf/views/common.py
index 9e039a97..0d3222db 100644
--- a/lcm/lcm/nf/views/common.py
+++ b/lcm/lcm/nf/views/common.py
@@ -118,3 +118,12 @@ def deal_vnf_action(logger, opt_type, opt_status, instid, req, req_serializer, a
act_task(req.data, instid, job_id).start()
return Response(data={"jobId": job_id}, status=status.HTTP_202_ACCEPTED)
+
+
+def deal_indivdual_query(res_serializer, query_fun, *args):
+ res = query_fun(*args)
+ resp_serializer = res_serializer(data=res)
+ if not resp_serializer.is_valid():
+ raise NFLCMException(resp_serializer.errors)
+
+ return Response(data=resp_serializer.data, status=status.HTTP_200_OK)