aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/views.py
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2019-04-17 12:44:04 -0400
committerParker Berberian <pberberian@iol.unh.edu>2019-05-08 10:12:58 -0400
commit3d078d2df3fac997c783435ba07e7710d087fd4b (patch)
treeb9c1cc9d4eb0c7691d2422d105a04e8f9be79ef6 /src/api/views.py
parentdc690ef43cc7af006c0900e8eaf1635141f0a2a1 (diff)
Adds pdf and idf into api
The Pod Descriptor File (pdf) and Installer descriptor file (idf) are now hosted in the api. The url endpoint where the lab can retrieve them are now part of a software task. An OPNFV task also contains a new dictionary that describes how bridges should be configured on the jumphost. This information is not contained in the pdf/idf but is needed by the lab. Change-Id: I6971279979ba180725926035bd9db481aafb1073 Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'src/api/views.py')
-rw-r--r--src/api/views.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/api/views.py b/src/api/views.py
index 2ae1ac5..fb28958 100644
--- a/src/api/views.py
+++ b/src/api/views.py
@@ -13,7 +13,7 @@ from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect
from django.utils.decorators import method_decorator
from django.views import View
-from django.http.response import JsonResponse
+from django.http.response import JsonResponse, HttpResponse
from rest_framework import viewsets
from rest_framework.authtoken.models import Token
from django.views.decorators.csrf import csrf_exempt
@@ -64,6 +64,18 @@ def lab_host(request, lab_name="", host_id=""):
return JsonResponse(lab_manager.update_host(host_id, request.POST), safe=False)
+def get_pdf(request, lab_name="", booking_id=""):
+ lab_token = request.META.get('HTTP_AUTH_TOKEN')
+ lab_manager = LabManagerTracker.get(lab_name, lab_token)
+ return HttpResponse(lab_manager.get_pdf(booking_id), content_type="text/plain")
+
+
+def get_idf(request, lab_name="", booking_id=""):
+ lab_token = request.META.get('HTTP_AUTH_TOKEN')
+ lab_manager = LabManagerTracker.get(lab_name, lab_token)
+ return HttpResponse(lab_manager.get_idf(booking_id), content_type="text/plain")
+
+
def lab_status(request, lab_name=""):
lab_token = request.META.get('HTTP_AUTH_TOKEN')
lab_manager = LabManagerTracker.get(lab_name, lab_token)