diff options
author | 2018-07-30 18:17:39 +0530 | |
---|---|---|
committer | 2018-07-30 19:06:25 +0530 | |
commit | 88d6c096bbd733652fcaebdacc435546cdd6dee5 (patch) | |
tree | af9dacafd33220c38a176263e6f0f5b15c968152 | |
parent | 1ec476db8795ff868065a2e9d8e080afb15ab59b (diff) |
Enabling back Serializer Validation for POSTapi
Change-Id: I5ca732894d81ea06f2f96996364a2c929960eac4
Issue-ID: VFC-965
signed-off-by: Shobana Jothi<shobana.jothi@verizon.com>
-rw-r--r-- | lcm/ns/views.py | 8 | ||||
-rw-r--r-- | lcm/ns/vnfs/views.py | 13 |
2 files changed, 11 insertions, 10 deletions
diff --git a/lcm/ns/views.py b/lcm/ns/views.py index 11e37181..413a89a6 100644 --- a/lcm/ns/views.py +++ b/lcm/ns/views.py @@ -114,10 +114,10 @@ class NSInstView(APIView): ) def post(self, request, ns_instance_id): logger.debug("Enter NSInstView::post::ns_instance_id=%s", ns_instance_id) - # req_serializer = InstantNsReqSerializer(data=request.data) - # if not req_serializer.is_valid(): - # return Response({'error': req_serializer.errors}, - # status=status.HTTP_500_INTERNAL_SERVER_ERROR) + req_serializer = InstantNsReqSerializer(data=request.data) + if not req_serializer.is_valid(): + return Response({'error': req_serializer.errors}, + status=status.HTTP_500_INTERNAL_SERVER_ERROR) ack = InstantNSService(ns_instance_id, request.data).do_biz() resp_serializer = NsOperateJobSerializer(data=ack['data']) if not resp_serializer.is_valid(): diff --git a/lcm/ns/vnfs/views.py b/lcm/ns/vnfs/views.py index 6a35eb63..810793fe 100644 --- a/lcm/ns/vnfs/views.py +++ b/lcm/ns/vnfs/views.py @@ -60,9 +60,9 @@ class NfView(APIView): def post(self, request): logger.debug("VnfCreateView--post::> %s" % request.data) - # req_serializer = InstVnfReqSerializer(data=request.data) - # if not req_serializer.is_valid(): - # logger.error(req_serializer.errors) + req_serializer = InstVnfReqSerializer(data=request.data) + if not req_serializer.is_valid(): + logger.error(req_serializer.errors) data = {'ns_instance_id': ignore_case_get(request.data, 'nsInstanceId'), 'additional_param_for_ns': ignore_case_get(request.data, 'additionalParamForVnf'), @@ -190,9 +190,10 @@ class LcmNotify(APIView): def post(self, request, vnfmid, vnfInstanceId): logger.debug("LcmNotify--post::> %s" % request.data) try: - # req_serializer = NotifyLcmReqSerializer(data=request.data) - # if not req_serializer.is_valid(): - # raise Exception(req_serializer.errors) + req_serializer = NotifyLcmReqSerializer(data=request.data) + if not req_serializer.is_valid(): + raise Exception(req_serializer.errors) + NotifyLcm(vnfmid, vnfInstanceId, request.data).do_biz() return Response(data={}, status=status.HTTP_201_CREATED) except Exception as e: |