blob: e1f7dc91809c0aa1bf0c4730b8df0ed8894dcf73 [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
George Keishing7230bbc2016-12-14 07:02:48 -06008Resource ../lib/resource.txt
Gunnar Millseac1af22016-11-14 15:30:09 -06009Test Teardown FFDC On Test Case Fail
Chris Austenb29d2e82016-06-07 12:25:35 -050010
Chris Austenb29d2e82016-06-07 12:25:35 -050011*** Variables ***
12
Chris Austenb29d2e82016-06-07 12:25:35 -050013*** Test Cases ***
14Good connection for testing
George Keishing1ae1cb62016-12-16 11:30:41 -060015 [Tags] Good_connection_for_testing
Chris Austenb29d2e82016-06-07 12:25:35 -050016 ${content}= Read Properties /
17 ${c}= get from List ${content} 0
18 Should Be Equal ${c} /org
19
Gunnar Mills56b32892016-11-14 13:56:17 -060020Get an object with no properties
George Keishing7230bbc2016-12-14 07:02:48 -060021 ${content}= Read Properties ${INVENTORY_URI.rstrip("/")}
Chris Austenb29d2e82016-06-07 12:25:35 -050022 Should Be Empty ${content}
23
24Get a Property
Rahul Maheshwaribb20f732016-10-24 06:27:14 -050025 [Tags] Get_a_Property
George Keishing7230bbc2016-12-14 07:02:48 -060026 ${url_list}=
27 ... Get Endpoint Paths ${INVENTORY_URI.rstrip("/")} cpu
Rahul Maheshwari9a8d3b12016-12-05 04:06:16 -060028 ${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
George Keishing7230bbc2016-12-14 07:02:48 -060033 ${resp}= OpenBMC Get Request ${INVENTORY_URI}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}
George Keishing7230bbc2016-12-14 07:02:48 -060036 Should Be Equal
37 ... ${jsondata['data']['description']}
38 ... The specified property cannot be found: ''is_fru''
Chris Austenb29d2e82016-06-07 12:25:35 -050039
40get directory listing /
George Keishing1ae1cb62016-12-16 11:30:41 -060041 [Tags] get_directory_listing
Gunnar Mills1cd544d2016-12-06 11:19:22 -060042 ${resp}= openbmc get request /
George Keishing7230bbc2016-12-14 07:02:48 -060043 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060044 ${json}= to json ${resp.content}
George Keishing7230bbc2016-12-14 07:02:48 -060045 list should contain value ${json['data']} /org
46 should be equal as strings ${json['status']} ok
Chris Austenb29d2e82016-06-07 12:25:35 -050047
48get directory listing /org/
Chris Austen859be602016-07-07 16:46:31 -050049 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060050 ${resp}= openbmc get request /org/
Chris Austenb29d2e82016-06-07 12:25:35 -050051 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060052 ${json}= to json ${resp.content}
George Keishing7230bbc2016-12-14 07:02:48 -060053 list should contain value
54 ... ${json['data']} ${OPENBMC_BASE_URI.rstrip("/")}
55 should be equal as strings ${json['status']} ok
Chris Austenb29d2e82016-06-07 12:25:35 -050056
57get invalid directory listing /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -050058 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060059 ${resp}= openbmc get request /i/dont/exist/
Chris Austenb29d2e82016-06-07 12:25:35 -050060 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060061 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -050062 should be equal as strings ${json['status']} error
63
64put directory listing /
Chris Austen859be602016-07-07 16:46:31 -050065 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060066 ${resp}= openbmc put request /
George Keishing7230bbc2016-12-14 07:02:48 -060067 should be equal as strings
68 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060069 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -050070 should be equal as strings ${json['status']} error
71
72put directory listing /org/
Chris Austen859be602016-07-07 16:46:31 -050073 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060074 ${resp}= openbmc put request /org/
George Keishing7230bbc2016-12-14 07:02:48 -060075 should be equal as strings
76 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060077 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -050078 should be equal as strings ${json['status']} error
79
80put invalid directory listing /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -050081 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060082 ${resp}= openbmc put request /i/dont/exist/
Chris Austenb29d2e82016-06-07 12:25:35 -050083 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060084 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -050085 should be equal as strings ${json['status']} error
86
87post directory listing /
Chris Austen859be602016-07-07 16:46:31 -050088 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060089 ${resp}= openbmc post request /
George Keishing7230bbc2016-12-14 07:02:48 -060090 should be equal as strings
91 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060092 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -050093 should be equal as strings ${json['status']} error
94
95post directory listing /org/
Chris Austen859be602016-07-07 16:46:31 -050096 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060097 ${resp}= openbmc post request /org/
George Keishing7230bbc2016-12-14 07:02:48 -060098 should be equal as strings
99 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
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
103post invalid directory listing /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500104 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600105 ${resp}= openbmc post request /i/dont/exist/
Chris Austenb29d2e82016-06-07 12:25:35 -0500106 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
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 /
Chris Austen859be602016-07-07 16:46:31 -0500111 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600112 ${resp}= openbmc delete request /
George Keishing7230bbc2016-12-14 07:02:48 -0600113 should be equal as strings
114 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600115 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500116 should be equal as strings ${json['status']} error
117
118delete directory listing /org/
Chris Austen859be602016-07-07 16:46:31 -0500119 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600120 ${resp}= openbmc delete request /
George Keishing7230bbc2016-12-14 07:02:48 -0600121 should be equal as strings
122 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600123 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500124 should be equal as strings ${json['status']} error
125
126delete invalid directory listing /org/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500127 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600128 ${resp}= openbmc delete request /org/nothere/
Chris Austenb29d2e82016-06-07 12:25:35 -0500129 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600130 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500131 should be equal as strings ${json['status']} error
132
133get list names /
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600134 ${resp}= openbmc get request /list
Chris Austenb29d2e82016-06-07 12:25:35 -0500135 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600136 ${json}= to json ${resp.content}
George Keishing7230bbc2016-12-14 07:02:48 -0600137 list should contain value
138 ... ${json['data']} ${INVENTORY_URI.rstrip("/")}
Chris Austenb29d2e82016-06-07 12:25:35 -0500139 should be equal as strings ${json['status']} ok
140
141get list names /org/
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600142 ${resp}= openbmc get request /org/list
Chris Austenb29d2e82016-06-07 12:25:35 -0500143 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600144 ${json}= to json ${resp.content}
George Keishing7230bbc2016-12-14 07:02:48 -0600145 list should contain value
146 ... ${json['data']} ${INVENTORY_URI.rstrip("/")}
Chris Austenb29d2e82016-06-07 12:25:35 -0500147 should be equal as strings ${json['status']} ok
148
149get invalid list names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500150 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600151 ${resp}= openbmc get request /i/dont/exist/list
Chris Austenb29d2e82016-06-07 12:25:35 -0500152 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600153 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500154 should be equal as strings ${json['status']} error
155
156put list names /
Chris Austen859be602016-07-07 16:46:31 -0500157 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600158 ${resp}= openbmc put request /list
George Keishing7230bbc2016-12-14 07:02:48 -0600159 should be equal as strings
160 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600161 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500162 should be equal as strings ${json['status']} error
163
164put list names /org/
Chris Austen859be602016-07-07 16:46:31 -0500165 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600166 ${resp}= openbmc put request /org/list
George Keishing7230bbc2016-12-14 07:02:48 -0600167 should be equal as strings
168 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600169 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500170 should be equal as strings ${json['status']} error
171
172put invalid list names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500173 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600174 ${resp}= openbmc put request /i/dont/exist/list
Chris Austenb29d2e82016-06-07 12:25:35 -0500175 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600176 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500177 should be equal as strings ${json['status']} error
178
179post list names /
Chris Austen859be602016-07-07 16:46:31 -0500180 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600181 ${resp}= openbmc post request /list
George Keishing7230bbc2016-12-14 07:02:48 -0600182 should be equal as strings
183 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
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
187post list names /org/
Chris Austen859be602016-07-07 16:46:31 -0500188 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600189 ${resp}= openbmc post request /org/list
George Keishing7230bbc2016-12-14 07:02:48 -0600190 should be equal as strings
191 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600192 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500193 should be equal as strings ${json['status']} error
194
195post invalid list names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500196 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600197 ${resp}= openbmc post request /i/dont/exist/list
Chris Austenb29d2e82016-06-07 12:25:35 -0500198 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600199 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500200 should be equal as strings ${json['status']} error
201
202delete list names /
Chris Austen859be602016-07-07 16:46:31 -0500203 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600204 ${resp}= openbmc delete request /list
George Keishing7230bbc2016-12-14 07:02:48 -0600205 should be equal as strings
206 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600207 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500208 should be equal as strings ${json['status']} error
209
210delete list names /org/
Chris Austen859be602016-07-07 16:46:31 -0500211 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600212 ${resp}= openbmc delete request /list
George Keishing7230bbc2016-12-14 07:02:48 -0600213 should be equal as strings
214 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600215 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500216 should be equal as strings ${json['status']} error
217
218delete invalid list names /org/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500219 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600220 ${resp}= openbmc delete request /org/nothere/list
Chris Austenb29d2e82016-06-07 12:25:35 -0500221 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600222 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500223 should be equal as strings ${json['status']} error
224
225get names /
George Keishing9e7796f2016-09-23 10:15:57 -0500226 [Tags] get_names
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600227 ${resp}= openbmc get request /enumerate
Chris Austenb29d2e82016-06-07 12:25:35 -0500228 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600229 ${json}= to json ${resp.content}
George Keishing7230bbc2016-12-14 07:02:48 -0600230 list should contain value
231 ... ${json['data']} ${INVENTORY_URI.rstrip("/")}
Chris Austenb29d2e82016-06-07 12:25:35 -0500232 should be equal as strings ${json['status']} ok
233
234get names /org/
George Keishing9e7796f2016-09-23 10:15:57 -0500235 [Tags] get_names_org
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600236 ${resp}= openbmc get request /org/enumerate
Chris Austenb29d2e82016-06-07 12:25:35 -0500237 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600238 ${json}= to json ${resp.content}
George Keishing7230bbc2016-12-14 07:02:48 -0600239 list should contain value
240 ... ${json['data']} ${INVENTORY_URI.rstrip("/")}
Chris Austenb29d2e82016-06-07 12:25:35 -0500241 should be equal as strings ${json['status']} ok
242
243get invalid names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500244 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600245 ${resp}= openbmc get request /i/dont/exist/enumerate
Chris Austenb29d2e82016-06-07 12:25:35 -0500246 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600247 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500248 should be equal as strings ${json['status']} error
249
250put names /
Chris Austen859be602016-07-07 16:46:31 -0500251 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600252 ${resp}= openbmc put request /enumerate
George Keishing7230bbc2016-12-14 07:02:48 -0600253 should be equal as strings
254 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600255 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500256 should be equal as strings ${json['status']} error
257
258put names /org/
Chris Austen859be602016-07-07 16:46:31 -0500259 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600260 ${resp}= openbmc put request /org/enumerate
George Keishing7230bbc2016-12-14 07:02:48 -0600261 should be equal as strings
262 ... ${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
266put 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 put 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
273post names /
Chris Austen859be602016-07-07 16:46:31 -0500274 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600275 ${resp}= openbmc post request /enumerate
George Keishing7230bbc2016-12-14 07:02:48 -0600276 should be equal as strings
277 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600278 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500279 should be equal as strings ${json['status']} error
280
281post names /org/
Chris Austen859be602016-07-07 16:46:31 -0500282 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600283 ${resp}= openbmc post request /org/enumerate
George Keishing7230bbc2016-12-14 07:02:48 -0600284 should be equal as strings
285 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600286 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500287 should be equal as strings ${json['status']} error
288
289post invalid names /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500290 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600291 ${resp}= openbmc post request /i/dont/exist/enumerate
Chris Austenb29d2e82016-06-07 12:25:35 -0500292 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600293 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500294 should be equal as strings ${json['status']} error
295
296delete names /
Chris Austen859be602016-07-07 16:46:31 -0500297 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600298 ${resp}= openbmc delete request /enumerate
George Keishing7230bbc2016-12-14 07:02:48 -0600299 should be equal as strings
300 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600301 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500302 should be equal as strings ${json['status']} error
303
304delete names /org/
Chris Austen859be602016-07-07 16:46:31 -0500305 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600306 ${resp}= openbmc delete request /enumerate
George Keishing7230bbc2016-12-14 07:02:48 -0600307 should be equal as strings
308 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600309 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500310 should be equal as strings ${json['status']} error
311
312delete invalid names /org/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500313 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600314 ${resp}= openbmc delete request /org/nothere/enumerate
Chris Austenb29d2e82016-06-07 12:25:35 -0500315 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600316 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500317 should be equal as strings ${json['status']} error
318
319get method org/openbmc/records/events/action/acceptTestMessage
Chris Austen859be602016-07-07 16:46:31 -0500320 [Tags] CI
George Keishing7230bbc2016-12-14 07:02:48 -0600321 ${resp}= openbmc get request
322 ... org/openbmc/records/events/action/acceptTestMessage
323 should be equal as strings
324 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600325 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500326 should be equal as strings ${json['status']} error
327
328get invalid method /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500329 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600330 ${resp}= openbmc get request /i/dont/exist/action/foo
Chris Austenb29d2e82016-06-07 12:25:35 -0500331 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600332 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500333 should be equal as strings ${json['status']} error
334
335put method org/openbmc/records/events/action/acceptTestMessage
Chris Austen859be602016-07-07 16:46:31 -0500336 [Tags] CI
George Keishing7230bbc2016-12-14 07:02:48 -0600337 ${resp}= openbmc put request
338 ... org/openbmc/records/events/action/acceptTestMessage
339 should be equal as strings
340 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600341 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500342 should be equal as strings ${json['status']} error
343
344put invalid method /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500345 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600346 ${resp}= openbmc put request /i/dont/exist/action/foo
Chris Austenb29d2e82016-06-07 12:25:35 -0500347 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600348 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500349 should be equal as strings ${json['status']} error
350
351post method power/getPowerState no args
352 ${fan_uri}= Get Power Control Interface
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600353 ${data}= create dictionary data=@{EMPTY}
George Keishing7230bbc2016-12-14 07:02:48 -0600354 ${resp}= openbmc post request
355 ... ${fan_uri}/action/getPowerState data=${data}
Chris Austenb29d2e82016-06-07 12:25:35 -0500356 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600357 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500358 should be equal as strings ${json['status']} ok
359
360post method org/openbmc/records/events/action/acceptTestMessage invalid args
Chris Austen859be602016-07-07 16:46:31 -0500361 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600362 ${data}= create dictionary foo=bar
George Keishing7230bbc2016-12-14 07:02:48 -0600363 ${resp}= openbmc post request
364 ... org/openbmc/records/events/action/acceptTestMessage data=${data}
Chris Austenb29d2e82016-06-07 12:25:35 -0500365 should be equal as strings ${resp.status_code} ${HTTP_BAD_REQUEST}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600366 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500367 should be equal as strings ${json['status']} error
368
369post method org/openbmc/sensors/host/BootCount with args
George Keishing7230bbc2016-12-14 07:02:48 -0600370 ${uri}= Set Variable ${SENSORS_URI}host/BootCount
Chris Austenb29d2e82016-06-07 12:25:35 -0500371 ${COUNT}= Set Variable ${3}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600372 @{count_list}= Create List ${COUNT}
373 ${data}= create dictionary data=@{count_list}
374 ${resp}= openbmc post request ${uri}/action/setValue data=${data}
Chris Austenb29d2e82016-06-07 12:25:35 -0500375 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600376 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500377 should be equal as strings ${json['status']} ok
378 ${content}= Read Attribute ${uri} value
379 Should Be Equal ${content} ${COUNT}
380
381delete method org/openbmc/records/events/action/acceptTestMessage
Chris Austen859be602016-07-07 16:46:31 -0500382 [Tags] CI
George Keishing7230bbc2016-12-14 07:02:48 -0600383 ${resp}= openbmc delete request
384 ... org/openbmc/records/events/action/acceptTestMessage
385 should be equal as strings
386 ... ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600387 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500388 should be equal as strings ${json['status']} error
389
390delete invalid method /org/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500391 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600392 ${resp}= openbmc delete request /org/nothere/action/foomethod
Chris Austenb29d2e82016-06-07 12:25:35 -0500393 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600394 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500395 should be equal as strings ${json['status']} error
Gunnar Mills56b32892016-11-14 13:56:17 -0600396
397post method org/openbmc/records/events/action/acceptTestMessage no args
Chris Austen859be602016-07-07 16:46:31 -0500398 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600399 ${data}= create dictionary data=@{EMPTY}
George Keishing7230bbc2016-12-14 07:02:48 -0600400 ${resp}= openbmc post request
401 ... org/openbmc/records/events/action/acceptTestMessage data=${data}
Chris Austenb29d2e82016-06-07 12:25:35 -0500402 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600403 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500404 should be equal as strings ${json['status']} ok
405
Gunnar Mills7c8923f2016-12-12 21:19:52 -0600406*** Keywords ***
Chris Austenb29d2e82016-06-07 12:25:35 -0500407Get Power Control Interface
George Keishing7230bbc2016-12-14 07:02:48 -0600408 ${resp}= OpenBMC Get Request ${CONTROL_URI}
409 should be equal as strings
410 ... ${resp.status_code} ${HTTP_OK}
411 ... msg=Unable to get any controls - ${CONTROL_URI}
Chris Austenb29d2e82016-06-07 12:25:35 -0500412 ${jsondata}= To Json ${resp.content}
413 log ${jsondata}
414 : FOR ${ELEMENT} IN @{jsondata["data"]}
415 \ log ${ELEMENT}
George Keishing7230bbc2016-12-14 07:02:48 -0600416 \ ${found}= Get Lines Matching Pattern ${ELEMENT} *control/power*
George Keishingd55a4be2016-08-26 03:28:17 -0500417 \ Return From Keyword If '${found}' != '' ${found}