Refine documentation
[yardstick.git] / docs / testing / user / userguide / 08-api.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International
2 .. License.
3 .. http://creativecommons.org/licenses/by/4.0
4 .. (c) OPNFV, Huawei Technologies Co.,Ltd and others.
5
6 Yardstick Restful API
7 ======================
8
9
10 Abstract
11 --------
12
13 Yardstick support restful API in danube.
14
15
16 Available API
17 -------------
18
19 /yardstick/env/action
20 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21
22 Description: This API is used to do some work related to environment. For now, we support:
23
24 1. Prepare yardstick environment(Including fetch openrc file, get external network and load images)
25 2. Start a InfluxDB docker container and config yardstick output to InfluxDB.
26 3. Start a Grafana docker container and config with the InfluxDB.
27
28 Which API to call will depend on the Parameters.
29
30
31 Method: POST
32
33
34 Prepare Yardstick Environment
35 Example::
36
37     {
38         'action': 'prepareYardstickEnv'
39     }
40
41 This is an asynchronous API. You need to call /yardstick/asynctask API to get the task result.
42
43
44 Start and Config InfluxDB docker container
45 Example::
46
47     {
48         'action': 'createInfluxDBContainer'
49     }
50
51 This is an asynchronous API. You need to call /yardstick/asynctask API to get the task result.
52
53
54 Start and Config Grafana docker container
55 Example::
56
57     {
58         'action': 'createGrafanaContainer'
59     }
60
61 This is an asynchronous API. You need to call /yardstick/asynctask API to get the task result.
62
63
64 /yardstick/asynctask
65 ^^^^^^^^^^^^^^^^^^^^
66
67 Description: This API is used to get the status of asynchronous task
68
69
70 Method: GET
71
72
73 Get the status of asynchronous task
74 Example::
75
76     http://localhost:8888/yardstick/asynctask?task_id=3f3f5e03-972a-4847-a5f8-154f1b31db8c
77
78 The returned status will be 0(running), 1(finished) and 2(failed).
79
80
81 /yardstick/testcases
82 ^^^^^^^^^^^^^^^^^^^^
83
84 Description: This API is used to list all release test cases now in yardstick.
85
86
87 Method: GET
88
89
90 Get a list of release test cases
91 Example::
92
93     http://localhost:8888/yardstick/testcases
94
95
96 /yardstick/testcases/release/action
97 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
98
99 Description: This API is used to run a yardstick release test case.
100
101
102 Method: POST
103
104
105 Run a release test case
106 Example::
107
108     {
109         'action': 'runTestCase',
110         'args': {
111             'opts': {},
112             'testcase': 'tc002'
113         }
114     }
115
116 This is an asynchronous API. You need to call /yardstick/results to get the result.
117
118
119 /yardstick/testcases/samples/action
120 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
121
122 Description: This API is used to run a yardstick sample test case.
123
124
125 Method: POST
126
127
128 Run a sample test case
129 Example::
130
131     {
132         'action': 'runTestCase',
133         'args': {
134             'opts': {},
135             'testcase': 'ping'
136         }
137     }
138
139 This is an asynchronous API. You need to call /yardstick/results to get the result.
140
141
142 /yardstick/testsuites/action
143 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
144
145 Description: This API is used to run a yardstick test suite.
146
147
148 Method: POST
149
150
151 Run a test suite
152 Example::
153
154     {
155         'action': 'runTestSuite',
156         'args': {
157             'opts': {},
158             'testcase': 'smoke'
159         }
160     }
161
162 This is an asynchronous API. You need to call /yardstick/results to get the result.
163
164
165 /yardstick/results
166 ^^^^^^^^^^^^^^^^^^
167
168
169 Description: This API is used to get the test results of certain task. If you call /yardstick/testcases/samples/action API, it will return a task id. You can use the returned task id to get the results by using this API.
170
171
172 Get test results of one task
173 Example::
174
175     http://localhost:8888/yardstick/results?task_id=3f3f5e03-972a-4847-a5f8-154f1b31db8c
176
177 This API will return a list of test case result