blob: 7f90206897389165d9931f8450d0d8a27f69557b [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
George Keishing97651c72016-10-04 00:44:15 -05002Documentation This suite will verifiy all OpenBMC rest interfaces
3... Details of valid interfaces can be found here...
4... https://github.com/openbmc/docs/blob/master/rest-api.md
Chris Austenb29d2e82016-06-07 12:25:35 -05005
George Keishing97651c72016-10-04 00:44:15 -05006Resource ../lib/rest_client.robot
George Keishingd55a4be2016-08-26 03:28:17 -05007Resource ../lib/openbmc_ffdc.robot
8Test Teardown Log FFDC
Chris Austenb29d2e82016-06-07 12:25:35 -05009
10
11*** Variables ***
12
13
14*** Test Cases ***
15Good connection for testing
George Keishing97651c72016-10-04 00:44:15 -050016 [Tags] CI Good_connection_for_testing
Chris Austenb29d2e82016-06-07 12:25:35 -050017 ${content}= Read Properties /
18 ${c}= get from List ${content} 0
19 Should Be Equal ${c} /org
20
21Get an object with no properties
22 ${content}= Read Properties /org/openbmc/inventory
23 Should Be Empty ${content}
24
25Get a Property
Rahul Maheshwaribb20f732016-10-24 06:27:14 -050026 [Tags] Get_a_Property
Chris Austenb29d2e82016-06-07 12:25:35 -050027 ${resp}= Read Attribute /org/openbmc/inventory/system/chassis/motherboard/cpu0 is_fru
28 Should Be Equal ${resp} ${1}
29
30Get a null Property
31 ${resp} = OpenBMC Get Request /org/openbmc/inventory/attr/is_fru
32 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
33 ${jsondata}= To Json ${resp.content}
34 Should Be Equal ${jsondata['data']['description']} The specified property cannot be found: ''is_fru''
35
36get directory listing /
George Keishing97651c72016-10-04 00:44:15 -050037 [Tags] CI get_directory_listing
Chris Austenb29d2e82016-06-07 12:25:35 -050038 ${resp} = openbmc get request /
39 should be equal as strings ${resp.status_code} ${HTTP_OK}
40 ${json} = to json ${resp.content}
41 list should contain value ${json['data']} /org
42 should be equal as strings ${json['status']} ok
43
44get directory listing /org/
Chris Austen859be602016-07-07 16:46:31 -050045 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050046 ${resp} = openbmc get request /org/
47 should be equal as strings ${resp.status_code} ${HTTP_OK}
48 ${json} = to json ${resp.content}
49 list should contain value ${json['data']} /org/openbmc
50 should be equal as strings ${json['status']} ok
51
52get invalid directory listing /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -050053 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050054 ${resp} = openbmc get request /i/dont/exist/
55 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
56 ${json} = to json ${resp.content}
57 should be equal as strings ${json['status']} error
58
59put directory listing /
Chris Austen859be602016-07-07 16:46:31 -050060 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050061 ${resp} = openbmc put request /
62 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
63 ${json} = to json ${resp.content}
64 should be equal as strings ${json['status']} error
65
66put directory listing /org/
Chris Austen859be602016-07-07 16:46:31 -050067 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050068 ${resp} = openbmc put request /org/
69 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
70 ${json} = to json ${resp.content}
71 should be equal as strings ${json['status']} error
72
73put invalid directory listing /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -050074 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050075 ${resp} = openbmc put request /i/dont/exist/
76 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
77 ${json} = to json ${resp.content}
78 should be equal as strings ${json['status']} error
79
80post directory listing /
Chris Austen859be602016-07-07 16:46:31 -050081 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050082 ${resp} = openbmc post request /
83 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
84 ${json} = to json ${resp.content}
85 should be equal as strings ${json['status']} error
86
87post directory listing /org/
Chris Austen859be602016-07-07 16:46:31 -050088 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050089 ${resp} = openbmc post request /org/
90 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
91 ${json} = to json ${resp.content}
92 should be equal as strings ${json['status']} error
93
94post invalid directory listing /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -050095 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050096 ${resp} = openbmc post request /i/dont/exist/
97 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
98 ${json} = to json ${resp.content}
99 should be equal as strings ${json['status']} error
100
101delete directory listing /
Chris Austen859be602016-07-07 16:46:31 -0500102 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500103 ${resp} = openbmc delete request /
104 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
105 ${json} = to json ${resp.content}
106 should be equal as strings ${json['status']} error
107
108delete directory listing /org/
Chris Austen859be602016-07-07 16:46:31 -0500109 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500110 ${resp} = openbmc delete request /
111 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
112 ${json} = to json ${resp.content}
113 should be equal as strings ${json['status']} error
114
115delete invalid directory listing /org/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500116 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500117 ${resp} = openbmc delete request /org/nothere/
118 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
119 ${json} = to json ${resp.content}
120 should be equal as strings ${json['status']} error
121
122get list names /
123 ${resp} = openbmc get request /list
124 should be equal as strings ${resp.status_code} ${HTTP_OK}
125 ${json} = to json ${resp.content}
126 list should contain value ${json['data']} /org/openbmc/inventory
127 should be equal as strings ${json['status']} ok
128
129get list names /org/
130 ${resp} = openbmc get request /org/list
131 should be equal as strings ${resp.status_code} ${HTTP_OK}
132 ${json} = to json ${resp.content}
133 list should contain value ${json['data']} /org/openbmc/inventory
134 should be equal as strings ${json['status']} ok
135
136get invalid list names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500137 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500138 ${resp} = openbmc get request /i/dont/exist/list
139 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
140 ${json} = to json ${resp.content}
141 should be equal as strings ${json['status']} error
142
143put list names /
Chris Austen859be602016-07-07 16:46:31 -0500144 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500145 ${resp} = openbmc put request /list
146 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
147 ${json} = to json ${resp.content}
148 should be equal as strings ${json['status']} error
149
150put list names /org/
Chris Austen859be602016-07-07 16:46:31 -0500151 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500152 ${resp} = openbmc put request /org/list
153 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
154 ${json} = to json ${resp.content}
155 should be equal as strings ${json['status']} error
156
157put invalid list names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500158 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500159 ${resp} = openbmc put request /i/dont/exist/list
160 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
161 ${json} = to json ${resp.content}
162 should be equal as strings ${json['status']} error
163
164post list names /
Chris Austen859be602016-07-07 16:46:31 -0500165 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500166 ${resp} = openbmc post request /list
167 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
168 ${json} = to json ${resp.content}
169 should be equal as strings ${json['status']} error
170
171post list names /org/
Chris Austen859be602016-07-07 16:46:31 -0500172 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500173 ${resp} = openbmc post request /org/list
174 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
175 ${json} = to json ${resp.content}
176 should be equal as strings ${json['status']} error
177
178post invalid list names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500179 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500180 ${resp} = openbmc post request /i/dont/exist/list
181 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
182 ${json} = to json ${resp.content}
183 should be equal as strings ${json['status']} error
184
185delete list names /
Chris Austen859be602016-07-07 16:46:31 -0500186 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500187 ${resp} = openbmc delete request /list
188 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
189 ${json} = to json ${resp.content}
190 should be equal as strings ${json['status']} error
191
192delete list names /org/
Chris Austen859be602016-07-07 16:46:31 -0500193 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500194 ${resp} = openbmc delete request /list
195 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
196 ${json} = to json ${resp.content}
197 should be equal as strings ${json['status']} error
198
199delete invalid list names /org/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500200 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500201 ${resp} = openbmc delete request /org/nothere/list
202 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
203 ${json} = to json ${resp.content}
204 should be equal as strings ${json['status']} error
205
206get names /
George Keishing9e7796f2016-09-23 10:15:57 -0500207 [Tags] get_names
Chris Austenb29d2e82016-06-07 12:25:35 -0500208 ${resp} = openbmc get request /enumerate
209 should be equal as strings ${resp.status_code} ${HTTP_OK}
210 ${json} = to json ${resp.content}
211 list should contain value ${json['data']} /org/openbmc/inventory
212 should be equal as strings ${json['status']} ok
213
214get names /org/
George Keishing9e7796f2016-09-23 10:15:57 -0500215 [Tags] get_names_org
Chris Austenb29d2e82016-06-07 12:25:35 -0500216 ${resp} = openbmc get request /org/enumerate
217 should be equal as strings ${resp.status_code} ${HTTP_OK}
218 ${json} = to json ${resp.content}
219 list should contain value ${json['data']} /org/openbmc/inventory
220 should be equal as strings ${json['status']} ok
221
222get invalid names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500223 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500224 ${resp} = openbmc get request /i/dont/exist/enumerate
225 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
226 ${json} = to json ${resp.content}
227 should be equal as strings ${json['status']} error
228
229put names /
Chris Austen859be602016-07-07 16:46:31 -0500230 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500231 ${resp} = openbmc put request /enumerate
232 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
233 ${json} = to json ${resp.content}
234 should be equal as strings ${json['status']} error
235
236put names /org/
Chris Austen859be602016-07-07 16:46:31 -0500237 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500238 ${resp} = openbmc put request /org/enumerate
239 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
240 ${json} = to json ${resp.content}
241 should be equal as strings ${json['status']} error
242
243put invalid names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500244 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500245 ${resp} = openbmc put request /i/dont/exist/enumerate
246 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
247 ${json} = to json ${resp.content}
248 should be equal as strings ${json['status']} error
249
250post names /
Chris Austen859be602016-07-07 16:46:31 -0500251 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500252 ${resp} = openbmc post request /enumerate
253 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
254 ${json} = to json ${resp.content}
255 should be equal as strings ${json['status']} error
256
257post names /org/
Chris Austen859be602016-07-07 16:46:31 -0500258 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500259 ${resp} = openbmc post request /org/enumerate
260 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
261 ${json} = to json ${resp.content}
262 should be equal as strings ${json['status']} error
263
264post invalid names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500265 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500266 ${resp} = openbmc post request /i/dont/exist/enumerate
267 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
268 ${json} = to json ${resp.content}
269 should be equal as strings ${json['status']} error
270
271delete names /
Chris Austen859be602016-07-07 16:46:31 -0500272 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500273 ${resp} = openbmc delete request /enumerate
274 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
275 ${json} = to json ${resp.content}
276 should be equal as strings ${json['status']} error
277
278delete names /org/
Chris Austen859be602016-07-07 16:46:31 -0500279 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500280 ${resp} = openbmc delete request /enumerate
281 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
282 ${json} = to json ${resp.content}
283 should be equal as strings ${json['status']} error
284
285delete invalid names /org/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500286 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500287 ${resp} = openbmc delete request /org/nothere/enumerate
288 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
289 ${json} = to json ${resp.content}
290 should be equal as strings ${json['status']} error
291
292get method org/openbmc/records/events/action/acceptTestMessage
Chris Austen859be602016-07-07 16:46:31 -0500293 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500294 ${resp} = openbmc get request org/openbmc/records/events/action/acceptTestMessage
295 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
296 ${json} = to json ${resp.content}
297 should be equal as strings ${json['status']} error
298
299get invalid method /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500300 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500301 ${resp} = openbmc get request /i/dont/exist/action/foo
302 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
303 ${json} = to json ${resp.content}
304 should be equal as strings ${json['status']} error
305
306put method org/openbmc/records/events/action/acceptTestMessage
Chris Austen859be602016-07-07 16:46:31 -0500307 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500308 ${resp} = openbmc put request org/openbmc/records/events/action/acceptTestMessage
309 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
310 ${json} = to json ${resp.content}
311 should be equal as strings ${json['status']} error
312
313put invalid method /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500314 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500315 ${resp} = openbmc put request /i/dont/exist/action/foo
316 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
317 ${json} = to json ${resp.content}
318 should be equal as strings ${json['status']} error
319
320post method power/getPowerState no args
321 ${fan_uri}= Get Power Control Interface
322 ${data} = create dictionary data=@{EMPTY}
323 ${resp} = openbmc post request ${fan_uri}/action/getPowerState data=${data}
324 should be equal as strings ${resp.status_code} ${HTTP_OK}
325 ${json} = to json ${resp.content}
326 should be equal as strings ${json['status']} ok
327
328post method org/openbmc/records/events/action/acceptTestMessage invalid args
Chris Austen859be602016-07-07 16:46:31 -0500329 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500330 ${data} = create dictionary foo=bar
331 ${resp} = openbmc post request org/openbmc/records/events/action/acceptTestMessage data=${data}
332 should be equal as strings ${resp.status_code} ${HTTP_BAD_REQUEST}
333 ${json} = to json ${resp.content}
334 should be equal as strings ${json['status']} error
335
336post method org/openbmc/sensors/host/BootCount with args
337 ${uri} = Set Variable /org/openbmc/sensors/host/BootCount
338 ${COUNT}= Set Variable ${3}
339 @{count_list} = Create List ${COUNT}
340 ${data} = create dictionary data=@{count_list}
341 ${resp} = openbmc post request ${uri}/action/setValue data=${data}
342 should be equal as strings ${resp.status_code} ${HTTP_OK}
343 ${json} = to json ${resp.content}
344 should be equal as strings ${json['status']} ok
345 ${content}= Read Attribute ${uri} value
346 Should Be Equal ${content} ${COUNT}
347
348delete method org/openbmc/records/events/action/acceptTestMessage
Chris Austen859be602016-07-07 16:46:31 -0500349 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500350 ${resp} = openbmc delete request org/openbmc/records/events/action/acceptTestMessage
351 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
352 ${json} = to json ${resp.content}
353 should be equal as strings ${json['status']} error
354
355delete invalid method /org/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500356 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500357 ${resp} = openbmc delete request /org/nothere/action/foomethod
358 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
359 ${json} = to json ${resp.content}
360 should be equal as strings ${json['status']} error
361
362post method org/openbmc/records/events/action/acceptTestMessage no args
Chris Austen859be602016-07-07 16:46:31 -0500363 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500364 ${data} = create dictionary data=@{EMPTY}
365 ${resp} = openbmc post request org/openbmc/records/events/action/acceptTestMessage data=${data}
366 should be equal as strings ${resp.status_code} ${HTTP_OK}
367 ${json} = to json ${resp.content}
368 should be equal as strings ${json['status']} ok
369
370***keywords***
371Get Power Control Interface
372 ${resp}= OpenBMC Get Request /org/openbmc/control/
373 should be equal as strings ${resp.status_code} ${HTTP_OK} msg=Unable to get any controls - /org/openbmc/control/
374 ${jsondata}= To Json ${resp.content}
375 log ${jsondata}
376 : FOR ${ELEMENT} IN @{jsondata["data"]}
377 \ log ${ELEMENT}
378 \ ${found}= Get Lines Matching Pattern ${ELEMENT} *control/power*
George Keishingd55a4be2016-08-26 03:28:17 -0500379 \ Return From Keyword If '${found}' != '' ${found}