blob: 8edf35a70e949fc949546f6dbb9adb29177d0e49 [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
Gunnar Millseac1af22016-11-14 15:30:09 -06008Test Teardown FFDC On Test Case Fail
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
Gunnar Mills56b32892016-11-14 13:56:17 -060021Get an object with no properties
Chris Austenb29d2e82016-06-07 12:25:35 -050022 ${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
Rahul Maheshwari9a8d3b12016-12-05 04:06:16 -060027 ${url_list}= Get Endpoint Paths ${OPENBMC_BASE_URI}inventory cpu
28 ${url}= Get From List ${url_list} 0
29 ${resp}= Read Attribute ${url} is_fru
30 Should Be Equal ${resp} ${1}
Chris Austenb29d2e82016-06-07 12:25:35 -050031
32Get a null Property
Gunnar Mills1cd544d2016-12-06 11:19:22 -060033 ${resp}= OpenBMC Get Request /org/openbmc/inventory/attr/is_fru
Chris Austenb29d2e82016-06-07 12:25:35 -050034 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
35 ${jsondata}= To Json ${resp.content}
36 Should Be Equal ${jsondata['data']['description']} The specified property cannot be found: ''is_fru''
37
38get directory listing /
George Keishing97651c72016-10-04 00:44:15 -050039 [Tags] CI get_directory_listing
Gunnar Mills1cd544d2016-12-06 11:19:22 -060040 ${resp}= openbmc get request /
Chris Austenb29d2e82016-06-07 12:25:35 -050041 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060042 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -050043 list should contain value ${json['data']} /org
44 should be equal as strings ${json['status']} ok
45
46get directory listing /org/
Chris Austen859be602016-07-07 16:46:31 -050047 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060048 ${resp}= openbmc get request /org/
Chris Austenb29d2e82016-06-07 12:25:35 -050049 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060050 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -050051 list should contain value ${json['data']} /org/openbmc
52 should be equal as strings ${json['status']} ok
53
54get invalid directory listing /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -050055 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060056 ${resp}= openbmc get request /i/dont/exist/
Chris Austenb29d2e82016-06-07 12:25:35 -050057 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060058 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -050059 should be equal as strings ${json['status']} error
60
61put directory listing /
Chris Austen859be602016-07-07 16:46:31 -050062 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060063 ${resp}= openbmc put request /
Gunnar Mills56b32892016-11-14 13:56:17 -060064 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060065 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -050066 should be equal as strings ${json['status']} error
67
68put directory listing /org/
Chris Austen859be602016-07-07 16:46:31 -050069 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060070 ${resp}= openbmc put request /org/
Gunnar Mills56b32892016-11-14 13:56:17 -060071 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060072 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -050073 should be equal as strings ${json['status']} error
74
75put invalid directory listing /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -050076 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060077 ${resp}= openbmc put request /i/dont/exist/
Chris Austenb29d2e82016-06-07 12:25:35 -050078 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060079 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -050080 should be equal as strings ${json['status']} error
81
82post directory listing /
Chris Austen859be602016-07-07 16:46:31 -050083 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060084 ${resp}= openbmc post request /
Gunnar Mills56b32892016-11-14 13:56:17 -060085 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060086 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -050087 should be equal as strings ${json['status']} error
88
89post directory listing /org/
Chris Austen859be602016-07-07 16:46:31 -050090 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060091 ${resp}= openbmc post request /org/
Gunnar Mills56b32892016-11-14 13:56:17 -060092 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060093 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -050094 should be equal as strings ${json['status']} error
95
96post invalid directory listing /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -050097 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060098 ${resp}= openbmc post request /i/dont/exist/
Chris Austenb29d2e82016-06-07 12:25:35 -050099 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600100 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500101 should be equal as strings ${json['status']} error
102
103delete directory listing /
Chris Austen859be602016-07-07 16:46:31 -0500104 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600105 ${resp}= openbmc delete request /
Gunnar Mills56b32892016-11-14 13:56:17 -0600106 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600107 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500108 should be equal as strings ${json['status']} error
109
110delete directory listing /org/
Chris Austen859be602016-07-07 16:46:31 -0500111 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600112 ${resp}= openbmc delete request /
Gunnar Mills56b32892016-11-14 13:56:17 -0600113 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600114 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500115 should be equal as strings ${json['status']} error
116
117delete invalid directory listing /org/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500118 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600119 ${resp}= openbmc delete request /org/nothere/
Chris Austenb29d2e82016-06-07 12:25:35 -0500120 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600121 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500122 should be equal as strings ${json['status']} error
123
124get list names /
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600125 ${resp}= openbmc get request /list
Chris Austenb29d2e82016-06-07 12:25:35 -0500126 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600127 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500128 list should contain value ${json['data']} /org/openbmc/inventory
129 should be equal as strings ${json['status']} ok
130
131get list names /org/
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600132 ${resp}= openbmc get request /org/list
Chris Austenb29d2e82016-06-07 12:25:35 -0500133 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600134 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500135 list should contain value ${json['data']} /org/openbmc/inventory
136 should be equal as strings ${json['status']} ok
137
138get invalid list names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500139 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600140 ${resp}= openbmc get request /i/dont/exist/list
Chris Austenb29d2e82016-06-07 12:25:35 -0500141 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600142 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500143 should be equal as strings ${json['status']} error
144
145put list names /
Chris Austen859be602016-07-07 16:46:31 -0500146 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600147 ${resp}= openbmc put request /list
Gunnar Mills56b32892016-11-14 13:56:17 -0600148 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600149 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500150 should be equal as strings ${json['status']} error
151
152put list names /org/
Chris Austen859be602016-07-07 16:46:31 -0500153 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600154 ${resp}= openbmc put request /org/list
Gunnar Mills56b32892016-11-14 13:56:17 -0600155 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600156 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500157 should be equal as strings ${json['status']} error
158
159put invalid list names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500160 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600161 ${resp}= openbmc put request /i/dont/exist/list
Chris Austenb29d2e82016-06-07 12:25:35 -0500162 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600163 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500164 should be equal as strings ${json['status']} error
165
166post list names /
Chris Austen859be602016-07-07 16:46:31 -0500167 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600168 ${resp}= openbmc post request /list
Gunnar Mills56b32892016-11-14 13:56:17 -0600169 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600170 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500171 should be equal as strings ${json['status']} error
172
173post list names /org/
Chris Austen859be602016-07-07 16:46:31 -0500174 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600175 ${resp}= openbmc post request /org/list
Gunnar Mills56b32892016-11-14 13:56:17 -0600176 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600177 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500178 should be equal as strings ${json['status']} error
179
180post invalid list names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500181 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600182 ${resp}= openbmc post request /i/dont/exist/list
Chris Austenb29d2e82016-06-07 12:25:35 -0500183 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600184 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500185 should be equal as strings ${json['status']} error
186
187delete list names /
Chris Austen859be602016-07-07 16:46:31 -0500188 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600189 ${resp}= openbmc delete request /list
Gunnar Mills56b32892016-11-14 13:56:17 -0600190 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600191 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500192 should be equal as strings ${json['status']} error
193
194delete list names /org/
Chris Austen859be602016-07-07 16:46:31 -0500195 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600196 ${resp}= openbmc delete request /list
Gunnar Mills56b32892016-11-14 13:56:17 -0600197 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600198 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500199 should be equal as strings ${json['status']} error
200
201delete invalid list names /org/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500202 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600203 ${resp}= openbmc delete request /org/nothere/list
Chris Austenb29d2e82016-06-07 12:25:35 -0500204 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600205 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500206 should be equal as strings ${json['status']} error
207
208get names /
George Keishing9e7796f2016-09-23 10:15:57 -0500209 [Tags] get_names
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600210 ${resp}= openbmc get request /enumerate
Chris Austenb29d2e82016-06-07 12:25:35 -0500211 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600212 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500213 list should contain value ${json['data']} /org/openbmc/inventory
214 should be equal as strings ${json['status']} ok
215
216get names /org/
George Keishing9e7796f2016-09-23 10:15:57 -0500217 [Tags] get_names_org
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600218 ${resp}= openbmc get request /org/enumerate
Chris Austenb29d2e82016-06-07 12:25:35 -0500219 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600220 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500221 list should contain value ${json['data']} /org/openbmc/inventory
222 should be equal as strings ${json['status']} ok
223
224get invalid names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500225 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600226 ${resp}= openbmc get request /i/dont/exist/enumerate
Chris Austenb29d2e82016-06-07 12:25:35 -0500227 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600228 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500229 should be equal as strings ${json['status']} error
230
231put names /
Chris Austen859be602016-07-07 16:46:31 -0500232 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600233 ${resp}= openbmc put request /enumerate
Gunnar Mills56b32892016-11-14 13:56:17 -0600234 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600235 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500236 should be equal as strings ${json['status']} error
237
238put names /org/
Chris Austen859be602016-07-07 16:46:31 -0500239 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600240 ${resp}= openbmc put request /org/enumerate
Gunnar Mills56b32892016-11-14 13:56:17 -0600241 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600242 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500243 should be equal as strings ${json['status']} error
244
245put invalid names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500246 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600247 ${resp}= openbmc put request /i/dont/exist/enumerate
Chris Austenb29d2e82016-06-07 12:25:35 -0500248 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600249 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500250 should be equal as strings ${json['status']} error
251
252post names /
Chris Austen859be602016-07-07 16:46:31 -0500253 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600254 ${resp}= openbmc post request /enumerate
Gunnar Mills56b32892016-11-14 13:56:17 -0600255 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600256 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500257 should be equal as strings ${json['status']} error
258
259post names /org/
Chris Austen859be602016-07-07 16:46:31 -0500260 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600261 ${resp}= openbmc post request /org/enumerate
Gunnar Mills56b32892016-11-14 13:56:17 -0600262 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600263 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500264 should be equal as strings ${json['status']} error
265
266post invalid names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500267 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600268 ${resp}= openbmc post request /i/dont/exist/enumerate
Chris Austenb29d2e82016-06-07 12:25:35 -0500269 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600270 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500271 should be equal as strings ${json['status']} error
272
273delete names /
Chris Austen859be602016-07-07 16:46:31 -0500274 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600275 ${resp}= openbmc delete request /enumerate
Gunnar Mills56b32892016-11-14 13:56:17 -0600276 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600277 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500278 should be equal as strings ${json['status']} error
279
280delete names /org/
Chris Austen859be602016-07-07 16:46:31 -0500281 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600282 ${resp}= openbmc delete request /enumerate
Gunnar Mills56b32892016-11-14 13:56:17 -0600283 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600284 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500285 should be equal as strings ${json['status']} error
286
287delete invalid names /org/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500288 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600289 ${resp}= openbmc delete request /org/nothere/enumerate
Chris Austenb29d2e82016-06-07 12:25:35 -0500290 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600291 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500292 should be equal as strings ${json['status']} error
293
294get method org/openbmc/records/events/action/acceptTestMessage
Chris Austen859be602016-07-07 16:46:31 -0500295 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600296 ${resp}= openbmc get request org/openbmc/records/events/action/acceptTestMessage
Gunnar Mills56b32892016-11-14 13:56:17 -0600297 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600298 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500299 should be equal as strings ${json['status']} error
300
301get invalid method /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500302 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600303 ${resp}= openbmc get request /i/dont/exist/action/foo
Chris Austenb29d2e82016-06-07 12:25:35 -0500304 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600305 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500306 should be equal as strings ${json['status']} error
307
308put method org/openbmc/records/events/action/acceptTestMessage
Chris Austen859be602016-07-07 16:46:31 -0500309 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600310 ${resp}= openbmc put request org/openbmc/records/events/action/acceptTestMessage
Gunnar Mills56b32892016-11-14 13:56:17 -0600311 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600312 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500313 should be equal as strings ${json['status']} error
314
315put invalid method /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500316 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600317 ${resp}= openbmc put request /i/dont/exist/action/foo
Chris Austenb29d2e82016-06-07 12:25:35 -0500318 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600319 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500320 should be equal as strings ${json['status']} error
321
322post method power/getPowerState no args
323 ${fan_uri}= Get Power Control Interface
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600324 ${data}= create dictionary data=@{EMPTY}
325 ${resp}= openbmc post request ${fan_uri}/action/getPowerState data=${data}
Chris Austenb29d2e82016-06-07 12:25:35 -0500326 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600327 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500328 should be equal as strings ${json['status']} ok
329
330post method org/openbmc/records/events/action/acceptTestMessage invalid args
Chris Austen859be602016-07-07 16:46:31 -0500331 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600332 ${data}= create dictionary foo=bar
333 ${resp}= openbmc post request org/openbmc/records/events/action/acceptTestMessage data=${data}
Chris Austenb29d2e82016-06-07 12:25:35 -0500334 should be equal as strings ${resp.status_code} ${HTTP_BAD_REQUEST}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600335 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500336 should be equal as strings ${json['status']} error
337
338post method org/openbmc/sensors/host/BootCount with args
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600339 ${uri}= Set Variable /org/openbmc/sensors/host/BootCount
Chris Austenb29d2e82016-06-07 12:25:35 -0500340 ${COUNT}= Set Variable ${3}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600341 @{count_list}= Create List ${COUNT}
342 ${data}= create dictionary data=@{count_list}
343 ${resp}= openbmc post request ${uri}/action/setValue data=${data}
Chris Austenb29d2e82016-06-07 12:25:35 -0500344 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600345 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500346 should be equal as strings ${json['status']} ok
347 ${content}= Read Attribute ${uri} value
348 Should Be Equal ${content} ${COUNT}
349
350delete method org/openbmc/records/events/action/acceptTestMessage
Chris Austen859be602016-07-07 16:46:31 -0500351 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600352 ${resp}= openbmc delete request org/openbmc/records/events/action/acceptTestMessage
Gunnar Mills56b32892016-11-14 13:56:17 -0600353 should be equal as strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600354 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500355 should be equal as strings ${json['status']} error
356
357delete invalid method /org/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500358 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600359 ${resp}= openbmc delete request /org/nothere/action/foomethod
Chris Austenb29d2e82016-06-07 12:25:35 -0500360 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600361 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500362 should be equal as strings ${json['status']} error
Gunnar Mills56b32892016-11-14 13:56:17 -0600363
364post method org/openbmc/records/events/action/acceptTestMessage no args
Chris Austen859be602016-07-07 16:46:31 -0500365 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600366 ${data}= create dictionary data=@{EMPTY}
367 ${resp}= openbmc post request org/openbmc/records/events/action/acceptTestMessage data=${data}
Chris Austenb29d2e82016-06-07 12:25:35 -0500368 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600369 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500370 should be equal as strings ${json['status']} ok
371
Gunnar Mills7c8923f2016-12-12 21:19:52 -0600372*** Keywords ***
Chris Austenb29d2e82016-06-07 12:25:35 -0500373Get Power Control Interface
374 ${resp}= OpenBMC Get Request /org/openbmc/control/
375 should be equal as strings ${resp.status_code} ${HTTP_OK} msg=Unable to get any controls - /org/openbmc/control/
376 ${jsondata}= To Json ${resp.content}
377 log ${jsondata}
378 : FOR ${ELEMENT} IN @{jsondata["data"]}
379 \ log ${ELEMENT}
380 \ ${found}= Get Lines Matching Pattern ${ELEMENT} *control/power*
George Keishingd55a4be2016-08-26 03:28:17 -0500381 \ Return From Keyword If '${found}' != '' ${found}