blob: 11242df8519757a95999d07499cbcdb729627787 [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
Sweta Potthuric959ece2017-02-27 04:52:30 -060018 Should Be Equal ${c} /xyz
Chris Austenb29d2e82016-06-07 12:25:35 -050019
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}
Sweta Potthuric959ece2017-02-27 04:52:30 -060045 list should contain value ${json['data']} /xyz
George Keishing7230bbc2016-12-14 07:02:48 -060046 should be equal as strings ${json['status']} ok
Chris Austenb29d2e82016-06-07 12:25:35 -050047
Sweta Potthuric959ece2017-02-27 04:52:30 -060048get directory listing /xyz/
49 [Tags] get_directory_listing_xyz
50 ${resp}= openbmc get request /xyz/
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
Sweta Potthuric959ece2017-02-27 04:52:30 -060054 ... ${json['data']} /xyz/openbmc_project
George Keishing7230bbc2016-12-14 07:02:48 -060055 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
Sweta Potthuric959ece2017-02-27 04:52:30 -060072put directory listing /xyz/
Chris Austen859be602016-07-07 16:46:31 -050073 [Tags] CI
Sweta Potthuric959ece2017-02-27 04:52:30 -060074 ${resp}= openbmc put request /xyz/
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
Sweta Potthuric959ece2017-02-27 04:52:30 -060095post directory listing /xyz/
Chris Austen859be602016-07-07 16:46:31 -050096 [Tags] CI
Sweta Potthuric959ece2017-02-27 04:52:30 -060097 ${resp}= openbmc post request /xyz/
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
Sweta Potthuric959ece2017-02-27 04:52:30 -0600118delete directory listing /xyz/
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
Sweta Potthuric959ece2017-02-27 04:52:30 -0600126delete invalid directory listing /xyz/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500127 [Tags] CI
Sweta Potthuric959ece2017-02-27 04:52:30 -0600128 ${resp}= openbmc delete request /xyz/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
Sweta Potthuric959ece2017-02-27 04:52:30 -0600138 ... ${json['data']} /xyz/openbmc_project/inventory
Chris Austenb29d2e82016-06-07 12:25:35 -0500139 should be equal as strings ${json['status']} ok
140
Sweta Potthuric959ece2017-02-27 04:52:30 -0600141get list names /xyz/
142 ${resp}= openbmc get request /xyz/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
Sweta Potthuric959ece2017-02-27 04:52:30 -0600146 ... ${json['data']} /xyz/openbmc_project/inventory
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
Sweta Potthuric959ece2017-02-27 04:52:30 -0600164put list names /xyz/
Chris Austen859be602016-07-07 16:46:31 -0500165 [Tags] CI
Sweta Potthuric959ece2017-02-27 04:52:30 -0600166 ${resp}= openbmc put request /xyz/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
Sweta Potthuric959ece2017-02-27 04:52:30 -0600187post list names /xyz/
Chris Austen859be602016-07-07 16:46:31 -0500188 [Tags] CI
Sweta Potthuric959ece2017-02-27 04:52:30 -0600189 ${resp}= openbmc post request /xyz/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
Sweta Potthuric959ece2017-02-27 04:52:30 -0600210delete list names /xyz/
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
Sweta Potthuric959ece2017-02-27 04:52:30 -0600218delete invalid list names /xyz/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500219 [Tags] CI
Sweta Potthuric959ece2017-02-27 04:52:30 -0600220 ${resp}= openbmc delete request /xyz/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
Sweta Potthuric959ece2017-02-27 04:52:30 -0600231 ... ${json['data']} /xyz/openbmc_project/inventory
Chris Austenb29d2e82016-06-07 12:25:35 -0500232 should be equal as strings ${json['status']} ok
233
Sweta Potthuric959ece2017-02-27 04:52:30 -0600234get names /xyz/
235 [Tags] get_names_xyz
236 ${resp}= openbmc get request /xyz/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
Sweta Potthuric959ece2017-02-27 04:52:30 -0600240 ... ${json['data']} /xyz/openbmc_project/inventory
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
Sweta Potthuric959ece2017-02-27 04:52:30 -0600258put names /xyz/
Chris Austen859be602016-07-07 16:46:31 -0500259 [Tags] CI
Sweta Potthuric959ece2017-02-27 04:52:30 -0600260 ${resp}= openbmc put request /xyz/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
Sweta Potthuric959ece2017-02-27 04:52:30 -0600281post names /xyz/
Chris Austen859be602016-07-07 16:46:31 -0500282 [Tags] CI
Sweta Potthuric959ece2017-02-27 04:52:30 -0600283 ${resp}= openbmc post request /xyz/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
Sweta Potthuric959ece2017-02-27 04:52:30 -0600304delete names /xyz/
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
Sweta Potthuric959ece2017-02-27 04:52:30 -0600312delete invalid names /xyz/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500313 [Tags] CI
Sweta Potthuric959ece2017-02-27 04:52:30 -0600314 ${resp}= openbmc delete request /xyz/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
Sweta Potthuric959ece2017-02-27 04:52:30 -0600319get method xyz/openbmc_project/logging/entry
Chris Austen859be602016-07-07 16:46:31 -0500320 [Tags] CI
George Keishing7230bbc2016-12-14 07:02:48 -0600321 ${resp}= openbmc get request
Sweta Potthuric959ece2017-02-27 04:52:30 -0600322 ... xyz/openbmc_project/logging/entry
George Keishing7230bbc2016-12-14 07:02:48 -0600323 should be equal as strings
Sweta Potthuric959ece2017-02-27 04:52:30 -0600324 ... ${resp.status_code} ${HTTP_NOT_FOUND}
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
Chris Austenb29d2e82016-06-07 12:25:35 -0500335
336put invalid method /i/dont/exist/
Chris Austen859be602016-07-07 16:46:31 -0500337 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600338 ${resp}= openbmc put request /i/dont/exist/action/foo
Chris Austenb29d2e82016-06-07 12:25:35 -0500339 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600340 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500341 should be equal as strings ${json['status']} error
342
343post method power/getPowerState no args
344 ${fan_uri}= Get Power Control Interface
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600345 ${data}= create dictionary data=@{EMPTY}
George Keishing7230bbc2016-12-14 07:02:48 -0600346 ${resp}= openbmc post request
347 ... ${fan_uri}/action/getPowerState data=${data}
Chris Austenb29d2e82016-06-07 12:25:35 -0500348 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600349 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500350 should be equal as strings ${json['status']} ok
351
Sweta Potthuric959ece2017-02-27 04:52:30 -0600352post method xyz/openbmc_project/sensors/host/BootCount with args
George Keishing7230bbc2016-12-14 07:02:48 -0600353 ${uri}= Set Variable ${SENSORS_URI}host/BootCount
Chris Austenb29d2e82016-06-07 12:25:35 -0500354 ${COUNT}= Set Variable ${3}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600355 @{count_list}= Create List ${COUNT}
356 ${data}= create dictionary data=@{count_list}
357 ${resp}= openbmc post request ${uri}/action/setValue data=${data}
Chris Austenb29d2e82016-06-07 12:25:35 -0500358 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600359 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500360 should be equal as strings ${json['status']} ok
361 ${content}= Read Attribute ${uri} value
362 Should Be Equal ${content} ${COUNT}
363
Sweta Potthuric959ece2017-02-27 04:52:30 -0600364delete invalid method /xyz/nothere/
Chris Austen859be602016-07-07 16:46:31 -0500365 [Tags] CI
Sweta Potthuric959ece2017-02-27 04:52:30 -0600366 ${resp}= openbmc delete request /xyz/nothere/action/foomethod
Chris Austenb29d2e82016-06-07 12:25:35 -0500367 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600368 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500369 should be equal as strings ${json['status']} error
Gunnar Mills56b32892016-11-14 13:56:17 -0600370
Gunnar Mills7c8923f2016-12-12 21:19:52 -0600371*** Keywords ***
Chris Austenb29d2e82016-06-07 12:25:35 -0500372Get Power Control Interface
George Keishing7230bbc2016-12-14 07:02:48 -0600373 ${resp}= OpenBMC Get Request ${CONTROL_URI}
374 should be equal as strings
375 ... ${resp.status_code} ${HTTP_OK}
376 ... msg=Unable to get any controls - ${CONTROL_URI}
Chris Austenb29d2e82016-06-07 12:25:35 -0500377 ${jsondata}= To Json ${resp.content}
378 log ${jsondata}
379 : FOR ${ELEMENT} IN @{jsondata["data"]}
380 \ log ${ELEMENT}
George Keishing7230bbc2016-12-14 07:02:48 -0600381 \ ${found}= Get Lines Matching Pattern ${ELEMENT} *control/power*
George Keishingd55a4be2016-08-26 03:28:17 -0500382 \ Return From Keyword If '${found}' != '' ${found}