X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=lcm%2Fns%2Fviews%2Fsol%2Fns_instances_views.py;h=6fcae3ffb0ed880e55864b6f528b58521d832702;hb=0876c326a9f9809fbb35d512a4a95f9fad00e445;hp=324e6f7a1eb76137a6297f618ae8db91722744da;hpb=c1a85aa8898222ab09dc2be5109eca92c45b2a4f;p=vfc%2Fnfvo%2Flcm.git diff --git a/lcm/ns/views/sol/ns_instances_views.py b/lcm/ns/views/sol/ns_instances_views.py index 324e6f7a..6fcae3ff 100644 --- a/lcm/ns/views/sol/ns_instances_views.py +++ b/lcm/ns/views/sol/ns_instances_views.py @@ -69,30 +69,32 @@ class NSInstancesView(APIView): globalCustomerId = request.META.get("HTTP_GLOBALCUSTOMERID", None) if not globalCustomerId: raise BadRequestException("Not found globalCustomerId in header") + serviceType = request.META.get("HTTP_SERVICETYPE", None) + if not serviceType: + serviceType = "NetworkService" req_serializer = CreateNsRequestSerializer(data=request.data) if not req_serializer.is_valid(): raise BadRequestException(req_serializer.errors) - if ignore_case_get(request.data, 'test') == "test": return Response(data={'nsInstanceId': "test"}, status=status.HTTP_201_CREATED) csar_id = ignore_case_get(request.data, 'nsdId') ns_name = ignore_case_get(request.data, 'nsName') - description = ignore_case_get(request.data, 'description') + description = ignore_case_get(request.data, 'nsDescription') context = { "globalCustomerId": globalCustomerId, - "serviceType": "NetworkService" + "serviceType": serviceType } ns_inst_id = CreateNSService(csar_id, ns_name, description, context).do_biz() logger.debug("CreateNSView::post::ret={'nsInstanceId':%s}", ns_inst_id) ns_filter = {"ns_inst_id": ns_inst_id} nsInstance = GetNSInfoService(ns_filter).get_ns_info(is_sol=True)[0] + logger.debug("nsInstance: %s" % nsInstance) resp_serializer = NsInstanceSerializer(data=nsInstance) if not resp_serializer.is_valid(): raise NSLCMException(resp_serializer.errors) response = Response(data=resp_serializer.data, status=status.HTTP_201_CREATED) response["Location"] = NS_INSTANCE_BASE_URI % nsInstance['id'] return response - except BadRequestException as e: logger.error("Exception in CreateNS: %s", e.message) data = {'status': status.HTTP_400_BAD_REQUEST, 'detail': e.message} @@ -133,7 +135,7 @@ class IndividualNsInstanceView(APIView): @swagger_auto_schema( request_body=None, responses={ - status.HTTP_204_NO_CONTENT: None + status.HTTP_204_NO_CONTENT: "HTTP_204_NO_CONTENT" } ) def delete(self, request, ns_instance_id):