aboutsummaryrefslogtreecommitdiffstats
path: root/api/swagger
diff options
context:
space:
mode:
Diffstat (limited to 'api/swagger')
-rw-r--r--api/swagger/__init__.py0
-rw-r--r--api/swagger/docs/results.yaml41
-rw-r--r--api/swagger/docs/testcases.yaml50
-rw-r--r--api/swagger/models.py51
4 files changed, 142 insertions, 0 deletions
diff --git a/api/swagger/__init__.py b/api/swagger/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/api/swagger/__init__.py
diff --git a/api/swagger/docs/results.yaml b/api/swagger/docs/results.yaml
new file mode 100644
index 000000000..7bdab3eb6
--- /dev/null
+++ b/api/swagger/docs/results.yaml
@@ -0,0 +1,41 @@
+Query task result data
+
+This api offer the interface to get the result data via task_id
+We will return a result json dict
+---
+tags:
+ - Results
+parameters:
+ -
+ in: query
+ name: action
+ type: string
+ default: getResult
+ required: true
+ -
+ in: query
+ name: measurement
+ type: string
+ description: test case name
+ required: true
+ -
+ in: query
+ name: task_id
+ type: string
+ description: the task_id you get before
+ required: true
+responses:
+ 200:
+ description: a result json dict
+ schema:
+ id: ResultModel
+ properties:
+ status:
+ type: string
+ description: the status of the certain task
+ default: success
+ result:
+ schema:
+ type: array
+ items:
+ type: object
diff --git a/api/swagger/docs/testcases.yaml b/api/swagger/docs/testcases.yaml
new file mode 100644
index 000000000..7bfe5e647
--- /dev/null
+++ b/api/swagger/docs/testcases.yaml
@@ -0,0 +1,50 @@
+TestCases Actions
+
+This API may offer many actions, including runTestCase
+
+action: runTestCase
+This api offer the interface to run a test case in yardstick
+we will return a task_id for querying
+you can use the returned task_id to get the result data
+---
+tags:
+ - Release Action
+parameters:
+ - in: body
+ name: body
+ description: this is the input json dict
+ schema:
+ id: TestCaseActionModel
+ required:
+ - action
+ - args
+ properties:
+ action:
+ type: string
+ description: this is action for testcases
+ default: runTestCase
+ args:
+ schema:
+ id: TestCaseActionArgsModel
+ required:
+ - testcase
+ properties:
+ testcase:
+ type: string
+ description: this is the test case name
+ default: tc002
+ opts:
+ schema:
+ id: TestCaseActionArgsOptsModel
+responses:
+ 200:
+ description: A result json dict
+ schema:
+ id: result
+ properties:
+ status:
+ type: string
+ default: success
+ result:
+ type: string
+ description: task_id of this task
diff --git a/api/swagger/models.py b/api/swagger/models.py
new file mode 100644
index 000000000..7c65fbbf5
--- /dev/null
+++ b/api/swagger/models.py
@@ -0,0 +1,51 @@
+##############################################################################
+# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+from flask_restful import fields
+from flask_restful_swagger import swagger
+
+
+# for testcases/action runTestCase action
+@swagger.model
+class TestCaseActionArgsOptsTaskArgModel:
+ resource_fields = {
+ }
+
+
+@swagger.model
+class TestCaseActionArgsOptsModel:
+ resource_fields = {
+ 'task-args': TestCaseActionArgsOptsTaskArgModel,
+ 'keep-deploy': fields.String,
+ 'suite': fields.String
+ }
+
+
+@swagger.model
+class TestCaseActionArgsModel:
+ resource_fields = {
+ 'testcase': fields.String,
+ 'opts': TestCaseActionArgsOptsModel
+ }
+
+
+@swagger.model
+class TestCaseActionModel:
+ resource_fields = {
+ 'action': fields.String,
+ 'args': TestCaseActionArgsModel
+ }
+
+
+# for results
+@swagger.model
+class ResultModel:
+ resource_fields = {
+ 'status': fields.String,
+ 'result': fields.List
+ }