summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2019-04-22 14:27:32 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2019-04-22 14:27:32 +0800
commit24cad95bbc51ac648d1cd48c7261da581669fd88 (patch)
tree8758ad3eec3831c1f5064ad081f11f6763952389
parente47257b82be1034ad205c676332071f6842e3702 (diff)
Refactor codes for lcm op occs get
Change-Id: I0362e84cc7a70aa90b697cd594f490c769bcec4f Issue-ID: VFC-1306 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r--lcm/lcm/nf/views/lcm_op_occs_view.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/lcm/lcm/nf/views/lcm_op_occs_view.py b/lcm/lcm/nf/views/lcm_op_occs_view.py
index 96cdecb0..5235ee08 100644
--- a/lcm/lcm/nf/views/lcm_op_occs_view.py
+++ b/lcm/lcm/nf/views/lcm_op_occs_view.py
@@ -25,6 +25,7 @@ from lcm.nf.serializers.vnf_lcm_op_occ import VNFLCMOpOccSerializer
from lcm.nf.serializers.vnf_lcm_op_occs import VNFLCMOpOccsSerializer
from lcm.pub.exceptions import NFLCMException
from .common import view_safe_call_with_log
+from .common import deal_indivdual_query
logger = logging.getLogger(__name__)
EXCLUDE_DEFAULT = ['operationParams', 'error', 'resourceChanges', 'changedInfo', 'changedExtConnectivity']
@@ -84,11 +85,7 @@ class QuerySingleVnfLcmOpOcc(APIView):
def get(self, request, lcmopoccid):
logger.debug("QuerySingleVnfLcmOpOcc--get::> %s" % request.query_params)
- resp_data = QueryVnfLcmOpOcc(request.query_params,
- lcm_op_occ_id=lcmopoccid).query_single_vnf_lcm_op_occ()
-
- vnf_lcm_op_occ_serializer = VNFLCMOpOccSerializer(data=resp_data)
- if not vnf_lcm_op_occ_serializer.is_valid():
- raise NFLCMException(vnf_lcm_op_occ_serializer.errors)
-
- return Response(data=vnf_lcm_op_occ_serializer.data, status=status.HTTP_200_OK)
+ return deal_indivdual_query(res_serializer=VNFLCMOpOccSerializer,
+ query_fun=QueryVnfLcmOpOcc(
+ data=request.data,
+ lcm_op_occ_id=lcmopoccid).query_single_vnf_lcm_op_occ)