blob: 91512aaff7ab667530b7fbbdce589f0adaea22d9 [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
26 ${resp}= Read Attribute /org/openbmc/inventory/system/chassis/motherboard/cpu0 is_fru
27 Should Be Equal ${resp} ${1}
28
29Get a null Property
30 ${resp} = OpenBMC Get Request /org/openbmc/inventory/attr/is_fru
31 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
32 ${jsondata}= To Json ${resp.content}
33 Should Be Equal ${jsondata['data']['description']} The specified property cannot be found: ''is_fru''
34
35get directory listing /
George Keishing97651c72016-10-04 00:44:15 -050036 [Tags] CI get_directory_listing
Chris Austenb29d2e82016-06-07 12:25:35 -050037 ${resp} = openbmc get request /
38 should be equal as strings ${resp.status_code} ${HTTP_OK}
39 ${json} = to json ${resp.content}
40 list should contain value ${json['data']} /org
41 should be equal as strings ${json['status']} ok
42
43get directory listing /org/
Chris Austen859be602016-07-07 16:46:31 -050044 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050045 ${resp} = openbmc get request /org/
46 should be equal as strings ${resp.status_code} ${HTTP_OK}
47 ${json} = to json ${resp.content}
48 list should contain value ${json['data']} /org/openbmc
49 should be equal as strings ${json['status']} ok
50
51get invalid directory listing /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -050052 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050053 ${resp} = openbmc get request /i/dont/exist/
54 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
55 ${json} = to json ${resp.content}
56 should be equal as strings ${json['status']} error
57
58put directory listing /
Chris Austen859be602016-07-07 16:46:31 -050059 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050060 ${resp} = openbmc put request /
61 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
62 ${json} = to json ${resp.content}
63 should be equal as strings ${json['status']} error
64
65put directory listing /org/
Chris Austen859be602016-07-07 16:46:31 -050066 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050067 ${resp} = openbmc put request /org/
68 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
69 ${json} = to json ${resp.content}
70 should be equal as strings ${json['status']} error
71
72put invalid directory listing /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -050073 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050074 ${resp} = openbmc put request /i/dont/exist/
75 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
76 ${json} = to json ${resp.content}
77 should be equal as strings ${json['status']} error
78
79post directory listing /
Chris Austen859be602016-07-07 16:46:31 -050080 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050081 ${resp} = openbmc post request /
82 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
83 ${json} = to json ${resp.content}
84 should be equal as strings ${json['status']} error
85
86post directory listing /org/
Chris Austen859be602016-07-07 16:46:31 -050087 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050088 ${resp} = openbmc post request /org/
89 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
90 ${json} = to json ${resp.content}
91 should be equal as strings ${json['status']} error
92
93post invalid directory listing /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -050094 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050095 ${resp} = openbmc post request /i/dont/exist/
96 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
97 ${json} = to json ${resp.content}
98 should be equal as strings ${json['status']} error
99
100delete directory listing /
Chris Austen859be602016-07-07 16:46:31 -0500101 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500102 ${resp} = openbmc delete request /
103 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
104 ${json} = to json ${resp.content}
105 should be equal as strings ${json['status']} error
106
107delete directory listing /org/
Chris Austen859be602016-07-07 16:46:31 -0500108 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500109 ${resp} = openbmc delete request /
110 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
111 ${json} = to json ${resp.content}
112 should be equal as strings ${json['status']} error
113
114delete invalid directory listing /org/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500115 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500116 ${resp} = openbmc delete request /org/nothere/
117 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
118 ${json} = to json ${resp.content}
119 should be equal as strings ${json['status']} error
120
121get list names /
122 ${resp} = openbmc get request /list
123 should be equal as strings ${resp.status_code} ${HTTP_OK}
124 ${json} = to json ${resp.content}
125 list should contain value ${json['data']} /org/openbmc/inventory
126 should be equal as strings ${json['status']} ok
127
128get list names /org/
129 ${resp} = openbmc get request /org/list
130 should be equal as strings ${resp.status_code} ${HTTP_OK}
131 ${json} = to json ${resp.content}
132 list should contain value ${json['data']} /org/openbmc/inventory
133 should be equal as strings ${json['status']} ok
134
135get invalid list names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500136 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500137 ${resp} = openbmc get request /i/dont/exist/list
138 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
139 ${json} = to json ${resp.content}
140 should be equal as strings ${json['status']} error
141
142put list names /
Chris Austen859be602016-07-07 16:46:31 -0500143 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500144 ${resp} = openbmc put request /list
145 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
146 ${json} = to json ${resp.content}
147 should be equal as strings ${json['status']} error
148
149put list names /org/
Chris Austen859be602016-07-07 16:46:31 -0500150 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500151 ${resp} = openbmc put request /org/list
152 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
153 ${json} = to json ${resp.content}
154 should be equal as strings ${json['status']} error
155
156put invalid list names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500157 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500158 ${resp} = openbmc put request /i/dont/exist/list
159 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
160 ${json} = to json ${resp.content}
161 should be equal as strings ${json['status']} error
162
163post list names /
Chris Austen859be602016-07-07 16:46:31 -0500164 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500165 ${resp} = openbmc post request /list
166 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
167 ${json} = to json ${resp.content}
168 should be equal as strings ${json['status']} error
169
170post list names /org/
Chris Austen859be602016-07-07 16:46:31 -0500171 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500172 ${resp} = openbmc post request /org/list
173 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
174 ${json} = to json ${resp.content}
175 should be equal as strings ${json['status']} error
176
177post invalid list names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500178 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500179 ${resp} = openbmc post request /i/dont/exist/list
180 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
181 ${json} = to json ${resp.content}
182 should be equal as strings ${json['status']} error
183
184delete list names /
Chris Austen859be602016-07-07 16:46:31 -0500185 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500186 ${resp} = openbmc delete request /list
187 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
188 ${json} = to json ${resp.content}
189 should be equal as strings ${json['status']} error
190
191delete list names /org/
Chris Austen859be602016-07-07 16:46:31 -0500192 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500193 ${resp} = openbmc delete request /list
194 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
195 ${json} = to json ${resp.content}
196 should be equal as strings ${json['status']} error
197
198delete invalid list names /org/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500199 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500200 ${resp} = openbmc delete request /org/nothere/list
201 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
202 ${json} = to json ${resp.content}
203 should be equal as strings ${json['status']} error
204
205get names /
George Keishing9e7796f2016-09-23 10:15:57 -0500206 [Tags] get_names
Chris Austenb29d2e82016-06-07 12:25:35 -0500207 ${resp} = openbmc get request /enumerate
208 should be equal as strings ${resp.status_code} ${HTTP_OK}
209 ${json} = to json ${resp.content}
210 list should contain value ${json['data']} /org/openbmc/inventory
211 should be equal as strings ${json['status']} ok
212
213get names /org/
George Keishing9e7796f2016-09-23 10:15:57 -0500214 [Tags] get_names_org
Chris Austenb29d2e82016-06-07 12:25:35 -0500215 ${resp} = openbmc get request /org/enumerate
216 should be equal as strings ${resp.status_code} ${HTTP_OK}
217 ${json} = to json ${resp.content}
218 list should contain value ${json['data']} /org/openbmc/inventory
219 should be equal as strings ${json['status']} ok
220
221get invalid names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500222 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500223 ${resp} = openbmc get request /i/dont/exist/enumerate
224 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
225 ${json} = to json ${resp.content}
226 should be equal as strings ${json['status']} error
227
228put names /
Chris Austen859be602016-07-07 16:46:31 -0500229 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500230 ${resp} = openbmc put request /enumerate
231 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
232 ${json} = to json ${resp.content}
233 should be equal as strings ${json['status']} error
234
235put names /org/
Chris Austen859be602016-07-07 16:46:31 -0500236 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500237 ${resp} = openbmc put request /org/enumerate
238 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
239 ${json} = to json ${resp.content}
240 should be equal as strings ${json['status']} error
241
242put invalid names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500243 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500244 ${resp} = openbmc put request /i/dont/exist/enumerate
245 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
246 ${json} = to json ${resp.content}
247 should be equal as strings ${json['status']} error
248
249post names /
Chris Austen859be602016-07-07 16:46:31 -0500250 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500251 ${resp} = openbmc post request /enumerate
252 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
253 ${json} = to json ${resp.content}
254 should be equal as strings ${json['status']} error
255
256post names /org/
Chris Austen859be602016-07-07 16:46:31 -0500257 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500258 ${resp} = openbmc post request /org/enumerate
259 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
260 ${json} = to json ${resp.content}
261 should be equal as strings ${json['status']} error
262
263post invalid names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500264 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500265 ${resp} = openbmc post request /i/dont/exist/enumerate
266 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
267 ${json} = to json ${resp.content}
268 should be equal as strings ${json['status']} error
269
270delete names /
Chris Austen859be602016-07-07 16:46:31 -0500271 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500272 ${resp} = openbmc delete request /enumerate
273 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
274 ${json} = to json ${resp.content}
275 should be equal as strings ${json['status']} error
276
277delete names /org/
Chris Austen859be602016-07-07 16:46:31 -0500278 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500279 ${resp} = openbmc delete request /enumerate
280 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
281 ${json} = to json ${resp.content}
282 should be equal as strings ${json['status']} error
283
284delete invalid names /org/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500285 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500286 ${resp} = openbmc delete request /org/nothere/enumerate
287 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
288 ${json} = to json ${resp.content}
289 should be equal as strings ${json['status']} error
290
291get method org/openbmc/records/events/action/acceptTestMessage
Chris Austen859be602016-07-07 16:46:31 -0500292 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500293 ${resp} = openbmc get request org/openbmc/records/events/action/acceptTestMessage
294 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
295 ${json} = to json ${resp.content}
296 should be equal as strings ${json['status']} error
297
298get invalid method /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500299 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500300 ${resp} = openbmc get request /i/dont/exist/action/foo
301 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
302 ${json} = to json ${resp.content}
303 should be equal as strings ${json['status']} error
304
305put method org/openbmc/records/events/action/acceptTestMessage
Chris Austen859be602016-07-07 16:46:31 -0500306 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500307 ${resp} = openbmc put request org/openbmc/records/events/action/acceptTestMessage
308 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
309 ${json} = to json ${resp.content}
310 should be equal as strings ${json['status']} error
311
312put invalid method /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500313 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500314 ${resp} = openbmc put request /i/dont/exist/action/foo
315 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
316 ${json} = to json ${resp.content}
317 should be equal as strings ${json['status']} error
318
319post method power/getPowerState no args
320 ${fan_uri}= Get Power Control Interface
321 ${data} = create dictionary data=@{EMPTY}
322 ${resp} = openbmc post request ${fan_uri}/action/getPowerState data=${data}
323 should be equal as strings ${resp.status_code} ${HTTP_OK}
324 ${json} = to json ${resp.content}
325 should be equal as strings ${json['status']} ok
326
327post method org/openbmc/records/events/action/acceptTestMessage invalid args
Chris Austen859be602016-07-07 16:46:31 -0500328 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500329 ${data} = create dictionary foo=bar
330 ${resp} = openbmc post request org/openbmc/records/events/action/acceptTestMessage data=${data}
331 should be equal as strings ${resp.status_code} ${HTTP_BAD_REQUEST}
332 ${json} = to json ${resp.content}
333 should be equal as strings ${json['status']} error
334
335post method org/openbmc/sensors/host/BootCount with args
336 ${uri} = Set Variable /org/openbmc/sensors/host/BootCount
337 ${COUNT}= Set Variable ${3}
338 @{count_list} = Create List ${COUNT}
339 ${data} = create dictionary data=@{count_list}
340 ${resp} = openbmc post request ${uri}/action/setValue data=${data}
341 should be equal as strings ${resp.status_code} ${HTTP_OK}
342 ${json} = to json ${resp.content}
343 should be equal as strings ${json['status']} ok
344 ${content}= Read Attribute ${uri} value
345 Should Be Equal ${content} ${COUNT}
346
347delete method org/openbmc/records/events/action/acceptTestMessage
Chris Austen859be602016-07-07 16:46:31 -0500348 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500349 ${resp} = openbmc delete request org/openbmc/records/events/action/acceptTestMessage
350 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
351 ${json} = to json ${resp.content}
352 should be equal as strings ${json['status']} error
353
354delete invalid method /org/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500355 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500356 ${resp} = openbmc delete request /org/nothere/action/foomethod
357 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
358 ${json} = to json ${resp.content}
359 should be equal as strings ${json['status']} error
360
361post method org/openbmc/records/events/action/acceptTestMessage no args
Chris Austen859be602016-07-07 16:46:31 -0500362 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500363 ${data} = create dictionary data=@{EMPTY}
364 ${resp} = openbmc post request org/openbmc/records/events/action/acceptTestMessage data=${data}
365 should be equal as strings ${resp.status_code} ${HTTP_OK}
366 ${json} = to json ${resp.content}
367 should be equal as strings ${json['status']} ok
368
369***keywords***
370Get Power Control Interface
371 ${resp}= OpenBMC Get Request /org/openbmc/control/
372 should be equal as strings ${resp.status_code} ${HTTP_OK} msg=Unable to get any controls - /org/openbmc/control/
373 ${jsondata}= To Json ${resp.content}
374 log ${jsondata}
375 : FOR ${ELEMENT} IN @{jsondata["data"]}
376 \ log ${ELEMENT}
377 \ ${found}= Get Lines Matching Pattern ${ELEMENT} *control/power*
George Keishingd55a4be2016-08-26 03:28:17 -0500378 \ Return From Keyword If '${found}' != '' ${found}