1 # Copyright 2016-2017 ZTE Corporation.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
20 from drf_yasg import openapi
21 from drf_yasg.utils import swagger_auto_schema
22 from rest_framework import status
23 from rest_framework.response import Response
24 from rest_framework.views import APIView
25 from django.http import StreamingHttpResponse
27 from driver.interfaces.serializers import HealReqSerializer, InstScaleHealRespSerializer, ScaleReqSerializer, \
28 NotifyReqSerializer, GrantRespSerializer, GrantReqSerializer, JobQueryRespSerializer, TerminateVnfRequestSerializer, \
29 InstantiateVnfRequestSerializer, QueryVnfResponseSerializer, SubscribesRespSerializer, \
30 SubscribeReqSerializer, SubscribeRespSerializer, VnfPkgsSerializer, NfvoInfoReqSerializer
31 from driver.pub.utils import restcall
32 from driver.pub.utils.restcall import req_by_msb
36 logger = logging.getLogger(__name__)
39 def load_json_file(file_name):
40 json_file = os.path.join(os.path.dirname(__file__), "data/" + file_name)
42 json_data = json.JSONDecoder().decode(f.read())
47 def read(file_path, start, end):
48 fp = open(file_path, 'rb')
51 while pos + CHUNK_SIZE < end:
52 yield fp.read(CHUNK_SIZE)
54 yield fp.read(end - pos)
57 def parse_file_range(file_path, file_range):
58 start, end = 0, os.path.getsize(file_path)
60 [start, end] = file_range.split('-')
61 start, end = start.strip(), end.strip()
62 start, end = int(start), int(end)
66 def ignorcase_get(args, key):
74 if old_key.upper() == key.upper():
79 # Query vnfm_info from nslcm
80 def get_vnfminfo_from_nslcm(vnfmid):
81 ret = req_by_msb("api/nslcm/v1/vnfms/%s" % vnfmid, "GET")
85 class InstantiateVnf(APIView):
87 request_body=InstantiateVnfRequestSerializer(),
89 status.HTTP_200_OK: InstScaleHealRespSerializer(),
90 status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
93 def post(self, request, vnfmid):
95 funname = "InstantiateVnf post"
96 logger.debug("[%s] request.data=%s", funname, request.data)
98 ret = get_vnfminfo_from_nslcm(vnfmid)
100 raise Exception(ret[1])
102 vnfm_info = json.JSONDecoder().decode(ret[1])
103 logger.debug("[%s] vnfm_info=%s", funname, vnfm_info)
105 "vnfinstancename": "V6000_VROUTER",
108 "vnfd_id": "888552dbb6d502d8dd1e68a0fad212d8",
109 "deployflavorid": "default",
114 inputs_json = load_json_file("inputs.json")
115 [data["inputs"].append(item) for item in inputs_json["inputs"]]
117 logger.debug("[%s] call_req data=%s", funname, data)
119 ret = restcall.call_req(
120 base_url=ignorcase_get(vnfm_info, "url"),
121 user=ignorcase_get(vnfm_info, "userName"),
122 passwd=ignorcase_get(vnfm_info, "password"),
123 auth_type=restcall.rest_no_auth,
126 content=json.JSONEncoder().encode(data)
129 logger.debug("[%s] call_req ret=%s", funname, ret)
131 raise Exception(ret[1])
133 resp = json.JSONDecoder().decode(ret[1])
135 "vnfInstanceId": ignorcase_get(resp, "VNFInstanceID"),
136 "jobId": ignorcase_get(resp, "JobId")
138 logger.debug("[%s]resp_data=%s", funname, resp_data)
140 return Response(data=resp_data, status=status.HTTP_200_OK)
141 except Exception as e:
142 logger.error("Error occurred when instantiating VNF,error:%s", e.args[0])
143 logger.error(traceback.format_exc())
146 'error': 'InstantiateVnf expection'
148 status=status.HTTP_500_INTERNAL_SERVER_ERROR
152 class TerminateVnf(APIView):
153 @swagger_auto_schema(
154 request_body=TerminateVnfRequestSerializer(),
156 status.HTTP_200_OK: InstScaleHealRespSerializer(),
157 status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
160 def post(self, request, vnfmid, vnfInstanceId):
162 funname = "terminate_vnf_post"
163 logger.debug("[%s] request.data=%s", funname, request.data)
164 logger.debug("vnfmid=%s, vnfInstanceId=%s", vnfmid, vnfInstanceId)
166 ret = get_vnfminfo_from_nslcm(vnfmid)
168 raise Exception(ret[1])
170 vnfm_info = json.JSONDecoder().decode(ret[1])
171 logger.debug("[%s] vnfm_info=%s", funname, vnfm_info)
172 ret = restcall.call_req(
173 base_url=ignorcase_get(vnfm_info, "url"),
174 user=ignorcase_get(vnfm_info, "userName"),
175 passwd=ignorcase_get(vnfm_info, "password"),
176 auth_type=restcall.rest_no_auth,
177 resource="v1/vnfs/%s?NFVOID=1&VNFMID=%s" % (vnfInstanceId, vnfmid),
181 raise Exception(ret[1])
183 resp = json.JSONDecoder().decode(ret[1])
185 "vnfInstanceId": vnfInstanceId,
186 "jobId": ignorcase_get(resp, "JobId")
188 logger.debug("[%s]resp_data=%s", funname, resp_data)
189 return Response(data=resp_data, status=status.HTTP_200_OK)
190 except Exception as e:
191 logger.error("Error occurred when terminating VNF,error: %s", e.args[0])
192 logger.error(traceback.format_exc())
195 'error': 'TerminateVnf expection'
197 status=status.HTTP_500_INTERNAL_SERVER_ERROR
201 class QueryVnf(APIView):
202 @swagger_auto_schema(
204 status.HTTP_200_OK: QueryVnfResponseSerializer(),
205 status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
208 def get(self, request, vnfmid, vnfInstanceId):
210 funname = "query_vnf_get"
211 logger.debug("[%s] request.data=%s", funname, request.data)
212 ret = get_vnfminfo_from_nslcm(vnfmid)
214 raise Exception(ret[1])
216 vnfm_info = json.JSONDecoder().decode(ret[1])
217 logger.debug("[%s] vnfm_info=%s", funname, vnfm_info)
218 ret = restcall.call_req(
219 base_url=ignorcase_get(vnfm_info, "url"),
220 user=ignorcase_get(vnfm_info, "userName"),
221 passwd=ignorcase_get(vnfm_info, "password"),
222 auth_type=restcall.rest_no_auth,
223 resource="v1/vnfs/%s" % vnfInstanceId,
225 content=json.JSONEncoder().encode({}))
227 raise Exception(ret[1])
229 resp = json.JSONDecoder().decode(ret[1])
230 vnf_status = ignorcase_get(resp, "vnfinstancestatus")
233 "vnfStatus": vnf_status
236 logger.debug("[%s]resp_data=%s", funname, resp_data)
237 return Response(data=resp_data, status=status.HTTP_200_OK)
238 except Exception as e:
239 logger.error("Error occurred when querying VNF information,error:%s", e.args[0])
240 logger.error(traceback.format_exc())
243 'error': 'QueryVnf expection'
245 status=status.HTTP_500_INTERNAL_SERVER_ERROR
249 class JobView(APIView):
250 @swagger_auto_schema(
252 openapi.Parameter('responseId',
255 type=openapi.TYPE_INTEGER
259 status.HTTP_200_OK: JobQueryRespSerializer(),
260 status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
263 def get(self, request, vnfmid, jobid):
266 logger.debug("[%s] request.data=%s", funname, request.data)
267 ret = get_vnfminfo_from_nslcm(vnfmid)
269 raise Exception(ret[1])
271 vnfm_info = json.JSONDecoder().decode(ret[1])
272 logger.debug("[%s] vnfm_info=%s", funname, vnfm_info)
273 operation_status_url = '/v1/jobs/{jobId}?NFVOID={nfvoId}&VNFMID={vnfmId}&ResponseID={responseId}'
274 responseId = ignorcase_get(request.GET, 'responseId')
275 query_url = operation_status_url.format(
279 responseId=responseId
281 ret = restcall.call_req(
282 base_url=ignorcase_get(vnfm_info, 'url'),
283 user=ignorcase_get(vnfm_info, 'userName'),
284 passwd=ignorcase_get(vnfm_info, 'password'),
285 auth_type=restcall.rest_no_auth,
291 raise Exception(ret[1])
293 resp_data = json.JSONDecoder().decode(ret[1])
294 logger.debug("[%s]resp_data=%s", funname, resp_data)
296 return Response(data=resp_data, status=status.HTTP_200_OK)
297 except Exception as e:
298 logger.error("Error occurred when getting operation status information,error:%s", e.args[0])
299 logger.error(traceback.format_exc())
302 'error': 'QueryJob expection'
304 status=status.HTTP_500_INTERNAL_SERVER_ERROR
308 class GrantVnf(APIView):
309 @swagger_auto_schema(
310 request_body=GrantReqSerializer(),
312 status.HTTP_201_CREATED: GrantRespSerializer(),
313 status.HTTP_500_INTERNAL_SERVER_ERROR: 'Internal error'
316 def put(self, request):
317 logger.debug("=====GrantVnf post=====")
319 logger.debug("request.data = %s", request.data)
322 "vnfInstanceId": ignorcase_get(request.data, "vnfistanceid"),
323 "vnfDescriptorId": "",
326 "vnfmid": ignorcase_get(request.data, "vnfmid"),
327 "vimid": ignorcase_get(request.data, "vimid"),
328 "tenant": ignorcase_get(request.data, "tenant")
331 if ignorcase_get(request.data, "operationright") == 0:
332 req_data["lifecycleOperation"] = "Instantiate"
333 for vm in ignorcase_get(request.data, "vmlist"):
334 for i in range(int(ignorcase_get(vm, "VMNumber"))):
335 req_data["addresource"].append(
338 "resourceDefinitionId": i,
339 "vdu": ignorcase_get(vm, "VMFlavor"),
340 "vimid": ignorcase_get(vm, "vimid"),
341 "tenant": ignorcase_get(vm, "tenant")
345 logger.debug("req_data=%s", req_data)
347 'api/nslcm/v1/ns/grantvnf',
349 content=json.JSONEncoder().encode(req_data)
351 logger.info("ret = %s", ret)
353 logger.error("grant to nfvo failed: %s", ret[1])
355 # resp = json.JSONDecoder().decode(ret[1])
357 # 'vimid': ignorcase_get(resp['vim'], 'vimid'),
358 # 'tenant': ignorcase_get(ignorcase_get(resp['vim'], 'accessinfo'), 'tenant')
364 logger.debug("[grant_vnf_put]resp_data=%s", resp_data)
366 return Response(data=resp_data, status=status.HTTP_201_CREATED)
367 except Exception as e:
368 logger.error("Error occurred in Grant VNF, error: %s", e.args[0])
369 logger.error(traceback.format_exc())
372 'error': 'Grant expection'
374 status=status.HTTP_500_INTERNAL_SERVER_ERROR
378 class Notify(APIView):
379 @swagger_auto_schema(
380 request_body=NotifyReqSerializer(),
382 status.HTTP_200_OK: 'Successfully',
383 status.HTTP_500_INTERNAL_SERVER_ERROR: 'Internal error'
386 def post(self, request):
388 funname = "notify_post"
389 logger.debug("[%s]request.data = %s", funname, request.data)
393 "vnfInstanceId": ignorcase_get(request.data, "vnfinstanceid"),
394 "vnfmId": ignorcase_get(request.data, "vnfmid"),
395 "vimId": ignorcase_get(request.data, "vimid"),
396 "operation": ignorcase_get(request.data, "EventType"),
400 "affectedVirtualStorage": [],
404 extension = ignorcase_get(request.data, "extension")
405 openo_notification = ignorcase_get(extension, "openo_notification")
406 if openo_notification:
407 affectedvnfcs = ignorcase_get(openo_notification, "affectedVnfc")
408 affectedvls = ignorcase_get(openo_notification, "affectedvirtuallink")
409 affectedcps = ignorcase_get(openo_notification, "affectedCp")
410 vnfdmodule = ignorcase_get(openo_notification, "vnfdmodule")
412 affectedvnfcs = ignorcase_get(ignorcase_get(request.data, "extension"), "affectedvnfc")
413 affectedvls = ignorcase_get(ignorcase_get(request.data, "extension"), "affectedvl")
414 affectedcps = ignorcase_get(ignorcase_get(request.data, "extension"), "affectedcp")
415 vnfdmodule = ignorcase_get(ignorcase_get(request.data, "extension"), "vnfdmodule")
417 req_data["vnfdmodule"] = vnfdmodule
419 for affectedvnfc in affectedvnfcs:
420 req_data["affectedVnfc"].append({
421 "vnfcInstanceId": ignorcase_get(affectedvnfc, "vnfcInstanceId"),
422 "vduId": ignorcase_get(affectedvnfc, "vduId"),
423 "changeType": ignorcase_get(affectedvnfc, "changeType"),
424 "vimId": ignorcase_get(ignorcase_get(affectedvnfc, "computeResource"), "vimId"),
425 "vmId": ignorcase_get(ignorcase_get(affectedvnfc, "computeResource"), "resourceId"),
426 "vmName": ignorcase_get(ignorcase_get(affectedvnfc, "computeResource"), "resourceName")
429 for affectedvl in affectedvls:
430 req_data["affectedVl"].append({
431 "vlInstanceId": ignorcase_get(affectedvl, "virtualLinkInstanceId"),
432 "changeType": ignorcase_get(affectedvl, "changeType"),
433 "vimId": ignorcase_get(ignorcase_get(affectedvl, "networkResource"), "vimId"),
434 "vldId": ignorcase_get(affectedvl, "virtuallinkdescid"),
436 "resourceType": "network",
437 "resourceId": ignorcase_get(ignorcase_get(affectedvl, "networkresource"), "resourceid"),
438 "resourceName": ignorcase_get(ignorcase_get(affectedvl, "networkresource"), "resourcename")
442 for affectedcp in affectedcps:
443 req_data["affectedCp"].append(affectedcp)
445 vnfmid = ignorcase_get(req_data, 'vnfmId')
446 vnfInstanceId = ignorcase_get(req_data, 'vnfinstanceid')
447 notify_url = 'api/nslcm/v1/ns/%s/vnfs/%s/Notify' % (vnfmid, vnfInstanceId)
448 logger.debug("notify_url = %s", notify_url)
449 logger.debug("req_data = %s", req_data)
450 ret = req_by_msb(notify_url, "POST", content=json.JSONEncoder().encode(req_data))
452 logger.debug("[%s]data = %s", funname, ret)
454 logger.error("notify to nfvo failed: %s", ret[1])
456 return Response(data=None, status=status.HTTP_200_OK)
457 except Exception as e:
458 logger.error("Error occurred in LCM notification,error: %s", e.args[0])
459 logger.error(traceback.format_exc())
462 'error': 'Notify expection'
464 status=status.HTTP_500_INTERNAL_SERVER_ERROR
468 class Scale(APIView):
469 @swagger_auto_schema(
470 request_body=ScaleReqSerializer(),
472 status.HTTP_202_ACCEPTED: InstScaleHealRespSerializer(),
473 status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
476 def post(self, request, vnfmid, vnfInstanceId):
477 logger.debug("====scale_vnf===")
479 logger.debug("request.data = %s", request.data)
480 logger.debug("requested_url = %s", request.get_full_path())
482 ret = get_vnfminfo_from_nslcm(vnfmid)
484 raise Exception(ret[1])
486 vnfm_info = json.JSONDecoder().decode(ret[1])
487 scale_type = ignorcase_get(request.data, "type")
488 aspect_id = ignorcase_get(request.data, "aspectId")
489 number_of_steps = ignorcase_get(request.data, "numberOfSteps")
493 'scaletype': '0' if scale_type == 'SCALE_OUT' else '1',
495 'VMNumber': number_of_steps,
496 'VMFlavor': aspect_id
501 logger.debug("data = %s", data)
502 ret = restcall.call_req(
503 base_url=ignorcase_get(vnfm_info, "url"),
504 user=ignorcase_get(vnfm_info, "userName"),
505 passwd=ignorcase_get(vnfm_info, "password"),
506 auth_type=restcall.rest_no_auth,
507 resource='/v1/vnfs/{vnfInstanceID}/scale'.format(vnfInstanceID=vnfInstanceId),
509 content=json.JSONEncoder().encode(data))
510 logger.debug("ret=%s", ret)
512 raise Exception('scale error')
514 resp_data = json.JSONDecoder().decode(ret[1])
516 return Response(data=resp_data, status=status.HTTP_202_ACCEPTED)
517 except Exception as e:
518 logger.error("Error occurred when scaling VNF,error:%s", e.args[0])
519 logger.error(traceback.format_exc())
522 'error': 'Scale expection'
524 status=status.HTTP_500_INTERNAL_SERVER_ERROR
529 @swagger_auto_schema(
530 request_body=HealReqSerializer(),
532 status.HTTP_202_ACCEPTED: InstScaleHealRespSerializer(),
533 status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
536 def post(self, request, vnfmid, vnfInstanceId):
537 logger.debug("====heal_vnf===")
539 logger.debug("request.data = %s", request.data)
540 logger.debug("requested_url = %s", request.get_full_path())
542 logger.debug("vnfmid = %s", vnfmid)
543 ret = get_vnfminfo_from_nslcm(vnfmid)
545 raise Exception(ret[1])
547 vnfm_info = json.JSONDecoder().decode(ret[1])
549 "action": ignorcase_get(request.data, 'action'),
550 "lifecycleoperation": "operate",
554 affectedvm = ignorcase_get(request.data, 'affectedvm')
555 if isinstance(affectedvm, list):
556 req_data['affectedvm'] = affectedvm
558 req_data['affectedvm'].append(affectedvm)
560 logger.debug("req_data = %s", req_data)
561 ret = restcall.call_req(
562 base_url=ignorcase_get(vnfm_info, "url"),
563 user=ignorcase_get(vnfm_info, "userName"),
564 passwd=ignorcase_get(vnfm_info, "password"),
565 auth_type=restcall.rest_no_auth,
566 resource='/api/v1/nf_m_i/nfs/{vnfInstanceID}/vms/operation'.format(
567 vnfInstanceID=vnfInstanceId
570 content=json.JSONEncoder().encode(req_data))
571 logger.debug("ret=%s", ret)
573 raise Exception('heal error')
575 resp_data = json.JSONDecoder().decode(ret[1])
577 return Response(data=resp_data, status=status.HTTP_202_ACCEPTED)
578 except Exception as e:
579 logger.error("Error occurred when healing VNF,error:%s", e.args[0])
580 logger.error(traceback.format_exc())
583 'error': 'Heal expection'
585 status=status.HTTP_500_INTERNAL_SERVER_ERROR
589 def get_vdus(nf_model, aspect_id):
590 associated_group = ''
592 vnf_flavours = nf_model['vnf_flavours']
593 for vnf_flaour in vnf_flavours:
594 scaling_aspects = vnf_flaour['scaling_aspects']
595 for aspect in scaling_aspects:
596 if aspect_id == aspect['id']:
597 associated_group = aspect['associated_group']
599 if not associated_group:
600 logger.error('Cannot find the corresponding element group')
601 raise Exception('Cannot find the corresponding element group')
602 for element_group in nf_model['element_groups']:
603 if element_group['group_id'] == associated_group:
604 members = element_group['members']
606 logger.error('Cannot find the corresponding members')
607 raise Exception('Cannot find the corresponding members')
611 class SampleList(APIView):
612 @swagger_auto_schema(
614 status.HTTP_200_OK: 'Successfully'})
615 def get(self, request):
617 return Response({"status": "active"})
620 class Subscribe(APIView):
621 @swagger_auto_schema(
623 status.HTTP_200_OK: SubscribesRespSerializer(),
624 status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
627 def get(self, request):
628 logger.debug("====Subscribe get====")
631 "subscribeid": "cdbddb00-452c-11e9-91e8-acc860114657",
636 "notificationuri": " https://127.0.0.1:80/v2/vnfm/vnfds/notification",
639 return Response(data=resp_data, status=status.HTTP_200_OK)
641 @swagger_auto_schema(
642 request_body=SubscribeReqSerializer(),
644 status.HTTP_201_CREATED: SubscribeRespSerializer(),
645 status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
648 def post(self, request):
649 logger.debug("====Subscribe post====")
650 resp_data = {"subscribeid": "cdbddb00-452c-11e9-91e8-acc860114657"}
651 return Response(data=resp_data, status=status.HTTP_201_CREATED)
654 class SubscribeDetail(APIView):
655 @swagger_auto_schema(
657 status.HTTP_204_NO_CONTENT: "None",
658 status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
661 def delete(self, request, subscribeId):
662 logger.debug("====SubscribeDetail delete %s====", subscribeId)
663 return Response(status=status.HTTP_204_NO_CONTENT)
666 class VnfPkgs(APIView):
667 @swagger_auto_schema(
669 status.HTTP_200_OK: VnfPkgsSerializer(),
670 status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
673 def get(self, request):
674 logger.debug("====VnfPkgs get====")
677 "packageid": "924fc980-4530-11e9-ae68-acc860114657",
680 "vnfdfile": "MRP6600_FS_SRIOV_4NIC_200W.zip",
681 "imagefiles": ["MRP6600_FS_SRIOV_MRPISU_IMGV500R008C20SPC030T.tar"],
682 "swfiles": ["MRP6600_SRV_V500R008C20SPC030T.tar"],
683 "description": "This is a service for vCPE.",
686 return Response(data=resp_data, status=status.HTTP_200_OK)
689 class VnfPkg(APIView):
690 @swagger_auto_schema(
692 status.HTTP_200_OK: "File stream for vnf pkg file",
693 status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
696 def get(self, request, packageId, fileName):
697 logger.debug("====VnfPkg get====%s, %s", packageId, fileName)
698 file_range = request.META.get('RANGE')
699 logger.debug('file_range: %s' % file_range)
701 local_file_path = fileName
702 start, end = parse_file_range(local_file_path, file_range)
703 file_iterator = read(local_file_path, start, end)
704 return StreamingHttpResponse(file_iterator, status=status.HTTP_200_OK)
707 class NfvoInfo(APIView):
708 @swagger_auto_schema(
709 request_body=NfvoInfoReqSerializer(),
711 status.HTTP_200_OK: "Update successfully",
712 status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
715 def put(self, request, vnfmid):
716 logger.debug("====NfvoInfo put====%s", vnfmid)
718 "nfvoid": request.data.get("nfvoid", "1"),
720 "nfvourl": request.data.get("nfvourl", "http://127.0.0.1:80")
722 ret = get_vnfminfo_from_nslcm(vnfmid)
725 data={'error': ret[1]},
726 status=status.HTTP_500_INTERNAL_SERVER_ERROR
729 vnfm_info = json.JSONDecoder().decode(ret[1])
730 logger.debug("[nfvo_info_put] vnfm_info=%s", vnfm_info)
731 ret = restcall.call_req(
732 base_url=ignorcase_get(vnfm_info, "url"),
733 user=ignorcase_get(vnfm_info, "userName"),
734 passwd=ignorcase_get(vnfm_info, "password"),
735 auth_type=restcall.rest_no_auth,
736 resource="v1/nfvo/info",
738 content=json.dumps(req_data))
741 data={'error': ret[1]},
742 status=status.HTTP_500_INTERNAL_SERVER_ERROR
744 logger.debug("update nfvo info successfully.")
745 return Response(data={}, status=status.HTTP_200_OK)
748 class HealthCheckView(APIView):
749 @swagger_auto_schema(
751 status.HTTP_200_OK: 'Active'})
752 def get(self, request, format=None):
753 logger.debug("HealthCheck")
754 return Response({"status": "active"})
757 class TokenView(APIView):
758 @swagger_auto_schema(
760 status.HTTP_201_CREATED: 'OK'})
761 def post(self, request):
762 logger.debug("====Token post====")
763 resp = Response(data={}, status=status.HTTP_201_CREATED)
764 resp["X-Subject-Token"] = "7512eb3feb5249eca5ddd742fedddd39"