diff --git a/webclient/views.py b/webclient/views.py index 0f8e61e..800bb45 100755 --- a/webclient/views.py +++ b/webclient/views.py @@ -2,6 +2,10 @@ import json import os.path from random import randint +import subprocess +import os +import ansible.runner + import re import sys @@ -393,6 +397,14 @@ def cleanUpAndFixImages(request): helper_ops.updateAllImageSizes(request.scheme, request.get_host()) return HttpResponse("All images rows cleaned up and fixed.") +@csrf_exempt +def simulate(request): + num_uavs = request.GET['num_uavs'] + port_prefix=request.GET['port_prefix'] + results = ansible.runner.Runner(pattern='172.19.0.1',module_name='command', module_args='sh /home/jdas/open-uav/Firmware/testScripts/ansible-openuav-launch.sh ' + num_uavs + ' ' + port_prefix,).run() + return JsonResponse(results) + + ''' Request: POST