summaryrefslogtreecommitdiffstats
path: root/dovetail
diff options
context:
space:
mode:
Diffstat (limited to 'dovetail')
-rw-r--r--dovetail/api/app/routes.py2
-rwxr-xr-xdovetail/api/boot.sh12
-rw-r--r--dovetail/api/swagger.yaml54
3 files changed, 68 insertions, 0 deletions
diff --git a/dovetail/api/app/routes.py b/dovetail/api/app/routes.py
index c235cb48..6c327323 100644
--- a/dovetail/api/app/routes.py
+++ b/dovetail/api/app/routes.py
@@ -1,10 +1,12 @@
#!flask/bin/python
from flask import Flask, jsonify
+from flask_cors import CORS
import server
app = Flask(__name__)
+CORS(app)
@app.route('/api/v1/scenario/nfvi/testsuites', methods=['GET'])
diff --git a/dovetail/api/boot.sh b/dovetail/api/boot.sh
index dc49876a..9fbb5484 100755
--- a/dovetail/api/boot.sh
+++ b/dovetail/api/boot.sh
@@ -1,4 +1,16 @@
#!/bin/sh
+mkdir -p /var/www/html/dovetail-api
+cp -r /home/opnfv/swagger-ui/dist/* /var/www/html/dovetail-api
+cp /home/opnfv/dovetail/dovetail/api/swagger.yaml /var/www/html/dovetail-api
+sed -i 's#url: "https://petstore.swagger.io/v2/swagger.json"#url: "swagger.yaml"#g' /var/www/html/dovetail-api/index.html
+sed -i '/deepLinking: true,/a\ validatorUrl: null,' /var/www/html/dovetail-api/index.html
+
+if [[ -n ${SWAGGER_HOST} ]]; then
+ sed -i "s/host: localhost:8888/host: ${SWAGGER_HOST}/g" /var/www/html/dovetail-api/swagger.yaml
+fi
+
+/etc/init.d/apache2 start
+
cd $(dirname $(readlink -f $0))
exec gunicorn -b :5000 --access-logfile - --error-logfile - app.routes:app
diff --git a/dovetail/api/swagger.yaml b/dovetail/api/swagger.yaml
new file mode 100644
index 00000000..5df0dcc2
--- /dev/null
+++ b/dovetail/api/swagger.yaml
@@ -0,0 +1,54 @@
+swagger: "2.0"
+info:
+ description: "This is the dovetail API."
+ version: "1.0.0"
+ title: "Dovetail API"
+ contact:
+ email: "xudan16@huawei.com"
+ license:
+ name: "Apache 2.0"
+ url: "http://www.apache.org/licenses/LICENSE-2.0.html"
+host: localhost:8888
+basePath: "/api/v1/scenario/nfvi"
+tags:
+- name: "testsuites"
+ description: "Operations about testsuites"
+- name: "testcases"
+ description: "Operations about test cases"
+schemes:
+- "http"
+paths:
+ /testsuites:
+ get:
+ tags:
+ - "testsuites"
+ summary: "Get all testsuites"
+ description: ""
+ operationId: "getTestsuites"
+ consumes:
+ - "application/json"
+ produces:
+ - "application/json"
+ parameters: []
+ responses:
+ 200:
+ description: "successful operation"
+ default:
+ description: Unexpected error
+ /testcases:
+ get:
+ tags:
+ - "testcases"
+ summary: "Get all test cases"
+ description: ""
+ operationId: "getTestcases"
+ consumes:
+ - "application/json"
+ produces:
+ - "application/json"
+ parameters: []
+ responses:
+ 200:
+ description: "successful operation"
+ default:
+ description: Unexpected error