blob: 6fd246a2f4b93a41200d2947073db0b69f241c69 [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
2Documentation 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
5
George Keishingd55a4be2016-08-26 03:28:17 -05006Resource ../lib/rest_client.robot
7Resource ../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
Chris Austen859be602016-07-07 16:46:31 -050016 [Tags] CI
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 /
Chris Austen859be602016-07-07 16:46:31 -050036 [Tags] CI
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 /
206 ${resp} = openbmc get request /enumerate
207 should be equal as strings ${resp.status_code} ${HTTP_OK}
208 ${json} = to json ${resp.content}
209 list should contain value ${json['data']} /org/openbmc/inventory
210 should be equal as strings ${json['status']} ok
211
212get names /org/
213 ${resp} = openbmc get request /org/enumerate
214 should be equal as strings ${resp.status_code} ${HTTP_OK}
215 ${json} = to json ${resp.content}
216 list should contain value ${json['data']} /org/openbmc/inventory
217 should be equal as strings ${json['status']} ok
218
219get invalid names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500220 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500221 ${resp} = openbmc get request /i/dont/exist/enumerate
222 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
223 ${json} = to json ${resp.content}
224 should be equal as strings ${json['status']} error
225
226put names /
Chris Austen859be602016-07-07 16:46:31 -0500227 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500228 ${resp} = openbmc put request /enumerate
229 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
230 ${json} = to json ${resp.content}
231 should be equal as strings ${json['status']} error
232
233put names /org/
Chris Austen859be602016-07-07 16:46:31 -0500234 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500235 ${resp} = openbmc put request /org/enumerate
236 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
237 ${json} = to json ${resp.content}
238 should be equal as strings ${json['status']} error
239
240put invalid names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500241 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500242 ${resp} = openbmc put request /i/dont/exist/enumerate
243 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
244 ${json} = to json ${resp.content}
245 should be equal as strings ${json['status']} error
246
247post names /
Chris Austen859be602016-07-07 16:46:31 -0500248 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500249 ${resp} = openbmc post request /enumerate
250 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
251 ${json} = to json ${resp.content}
252 should be equal as strings ${json['status']} error
253
254post names /org/
Chris Austen859be602016-07-07 16:46:31 -0500255 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500256 ${resp} = openbmc post request /org/enumerate
257 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
258 ${json} = to json ${resp.content}
259 should be equal as strings ${json['status']} error
260
261post invalid names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500262 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500263 ${resp} = openbmc post request /i/dont/exist/enumerate
264 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
265 ${json} = to json ${resp.content}
266 should be equal as strings ${json['status']} error
267
268delete names /
Chris Austen859be602016-07-07 16:46:31 -0500269 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500270 ${resp} = openbmc delete request /enumerate
271 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
272 ${json} = to json ${resp.content}
273 should be equal as strings ${json['status']} error
274
275delete names /org/
Chris Austen859be602016-07-07 16:46:31 -0500276 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500277 ${resp} = openbmc delete request /enumerate
278 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
279 ${json} = to json ${resp.content}
280 should be equal as strings ${json['status']} error
281
282delete invalid names /org/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500283 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500284 ${resp} = openbmc delete request /org/nothere/enumerate
285 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
286 ${json} = to json ${resp.content}
287 should be equal as strings ${json['status']} error
288
289get method org/openbmc/records/events/action/acceptTestMessage
Chris Austen859be602016-07-07 16:46:31 -0500290 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500291 ${resp} = openbmc get request org/openbmc/records/events/action/acceptTestMessage
292 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
293 ${json} = to json ${resp.content}
294 should be equal as strings ${json['status']} error
295
296get invalid method /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500297 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500298 ${resp} = openbmc get request /i/dont/exist/action/foo
299 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
300 ${json} = to json ${resp.content}
301 should be equal as strings ${json['status']} error
302
303put method org/openbmc/records/events/action/acceptTestMessage
Chris Austen859be602016-07-07 16:46:31 -0500304 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500305 ${resp} = openbmc put request org/openbmc/records/events/action/acceptTestMessage
306 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
307 ${json} = to json ${resp.content}
308 should be equal as strings ${json['status']} error
309
310put invalid method /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500311 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500312 ${resp} = openbmc put request /i/dont/exist/action/foo
313 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
314 ${json} = to json ${resp.content}
315 should be equal as strings ${json['status']} error
316
317post method power/getPowerState no args
318 ${fan_uri}= Get Power Control Interface
319 ${data} = create dictionary data=@{EMPTY}
320 ${resp} = openbmc post request ${fan_uri}/action/getPowerState data=${data}
321 should be equal as strings ${resp.status_code} ${HTTP_OK}
322 ${json} = to json ${resp.content}
323 should be equal as strings ${json['status']} ok
324
325post method org/openbmc/records/events/action/acceptTestMessage invalid args
Chris Austen859be602016-07-07 16:46:31 -0500326 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500327 ${data} = create dictionary foo=bar
328 ${resp} = openbmc post request org/openbmc/records/events/action/acceptTestMessage data=${data}
329 should be equal as strings ${resp.status_code} ${HTTP_BAD_REQUEST}
330 ${json} = to json ${resp.content}
331 should be equal as strings ${json['status']} error
332
333post method org/openbmc/sensors/host/BootCount with args
334 ${uri} = Set Variable /org/openbmc/sensors/host/BootCount
335 ${COUNT}= Set Variable ${3}
336 @{count_list} = Create List ${COUNT}
337 ${data} = create dictionary data=@{count_list}
338 ${resp} = openbmc post request ${uri}/action/setValue data=${data}
339 should be equal as strings ${resp.status_code} ${HTTP_OK}
340 ${json} = to json ${resp.content}
341 should be equal as strings ${json['status']} ok
342 ${content}= Read Attribute ${uri} value
343 Should Be Equal ${content} ${COUNT}
344
345delete method org/openbmc/records/events/action/acceptTestMessage
Chris Austen859be602016-07-07 16:46:31 -0500346 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500347 ${resp} = openbmc delete request org/openbmc/records/events/action/acceptTestMessage
348 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
349 ${json} = to json ${resp.content}
350 should be equal as strings ${json['status']} error
351
352delete invalid method /org/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500353 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500354 ${resp} = openbmc delete request /org/nothere/action/foomethod
355 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
356 ${json} = to json ${resp.content}
357 should be equal as strings ${json['status']} error
358
359post method org/openbmc/records/events/action/acceptTestMessage no args
Chris Austen859be602016-07-07 16:46:31 -0500360 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500361 ${data} = create dictionary data=@{EMPTY}
362 ${resp} = openbmc post request org/openbmc/records/events/action/acceptTestMessage data=${data}
363 should be equal as strings ${resp.status_code} ${HTTP_OK}
364 ${json} = to json ${resp.content}
365 should be equal as strings ${json['status']} ok
366
367***keywords***
368Get Power Control Interface
369 ${resp}= OpenBMC Get Request /org/openbmc/control/
370 should be equal as strings ${resp.status_code} ${HTTP_OK} msg=Unable to get any controls - /org/openbmc/control/
371 ${jsondata}= To Json ${resp.content}
372 log ${jsondata}
373 : FOR ${ELEMENT} IN @{jsondata["data"]}
374 \ log ${ELEMENT}
375 \ ${found}= Get Lines Matching Pattern ${ELEMENT} *control/power*
George Keishingd55a4be2016-08-26 03:28:17 -0500376 \ Return From Keyword If '${found}' != '' ${found}