blob: 612e0f4a4e26eb94b72b5759fe247df513a98aa8 [file] [log] [blame]
manashsarma8b5d6802020-03-09 04:09:15 -05001*** Settings ***
manashsarma91abf372020-03-17 20:34:02 -05002
3
manashsarma40b85d12020-04-04 21:18:59 -05004Documentation Verify Redfish tool functionality.
manashsarma8b5d6802020-03-09 04:09:15 -05005
manashsarma91abf372020-03-17 20:34:02 -05006Library OperatingSystem
7Library String
8Library Collections
manashsarma8b5d6802020-03-09 04:09:15 -05009
manashsarma91abf372020-03-17 20:34:02 -050010Resource ../../lib/resource.robot
11Resource ../../lib/bmc_redfish_resource.robot
12Resource ../../lib/openbmc_ffdc.robot
manashsarma40b85d12020-04-04 21:18:59 -050013Resource ../../lib/certificate_utils.robot
manashsarma8b5d6802020-03-09 04:09:15 -050014
manashsarma91abf372020-03-17 20:34:02 -050015
16Suite Setup Suite Setup Execution
17
manashsarma8b5d6802020-03-09 04:09:15 -050018
19*** Variables ***
20
manashsarma91abf372020-03-17 20:34:02 -050021
manashsarma40b85d12020-04-04 21:18:59 -050022${root_cmd_args} = SEPARATOR=
23... redfishtool raw -r ${OPENBMC_HOST} -u ${OPENBMC_USERNAME} -p ${OPENBMC_PASSWORD} -S Always
manashsarma91abf372020-03-17 20:34:02 -050024${min_number_sensors} ${15}
manashsarmaea14dae2020-03-26 11:00:27 -050025${min_number_roles} ${4}
26${min_number_users} ${1}
manashsarma8b5d6802020-03-09 04:09:15 -050027
28*** Test Cases ***
29
manashsarma91abf372020-03-17 20:34:02 -050030
manashsarma8b5d6802020-03-09 04:09:15 -050031Verify Redfishtool Sensor Commands
32 [Documentation] Verify redfishtool's sensor commands.
33 [Tags] Verify_Redfishtool_Sensor_Commands
34
35 ${sensor_status}= Redfishtool Get /redfish/v1/Chassis/chassis/Sensors
36 ${json_object}= Evaluate json.loads('''${sensor_status}''') json
37 Should Be True ${json_object["Members@odata.count"]} > ${min_number_sensors}
38 ... msg=There should be at least ${min_number_sensors} sensors.
39
manashsarma91abf372020-03-17 20:34:02 -050040
manashsarma8b5d6802020-03-09 04:09:15 -050041Verify Redfishtool Health Check Commands
42 [Documentation] Verify redfishtool's health check command.
43 [Tags] Verify_Redfishtool_Health_Check_Commands
44
45 ${chassis_data}= Redfishtool Get /redfish/v1/Chassis/chassis/
46 ${json_object}= Evaluate json.loads('''${chassis_data}''') json
47 ${status}= Set Variable ${json_object["Status"]}
48 Should Be Equal OK ${status["Health"]}
49 ... msg=Health status should be OK.
50
manashsarma91abf372020-03-17 20:34:02 -050051
52Verify Redfishtool Create Users
53 [Documentation] Create user via Redfishtool and verify.
54 [Tags] Verify_Redfishtool_Create_Users
55 [Teardown] Redfishtool Delete User "UserT100"
56
57 Redfishtool Create User "UserT100" "TestPwd123" "Operator" true
58 Redfishtool Verify User "UserT100" "Operator"
59
60
61Verify Redfishtool Modify Users
62 [Documentation] Modify user via Redfishtool and verify.
63 [Tags] Verify_Redfishtool_Modify_Users
64 [Teardown] Redfishtool Delete User "UserT100"
65
66 Redfishtool Create User "UserT100" "TestPwd123" "Operator" true
67 Redfishtool Update User Role "UserT100" "Administrator"
68 Redfishtool Verify User "UserT100" "Administrator"
69
70
71Verify Redfishtool Delete Users
72 [Documentation] Delete user via Redfishtool and verify.
73 [Tags] Verify_Redfishtool_Delete_Users
74
75 Redfishtool Create User "UserT100" "TestPwd123" "Operator" true
76 Redfishtool Delete User "UserT100"
77 ${status}= Redfishtool Verify User Name Exists "UserT100"
78 Should Be True ${status} == False
79
80
manashsarmaea14dae2020-03-26 11:00:27 -050081Verify Redfishtool Login With Deleted Redfish Users
82 [Documentation] Verify login with deleted user via Redfishtool.
83 [Tags] Verify_Redfishtool_Login_With_Deleted_Redfish_Users
84
85 Redfishtool Create User "UserT100" "TestPwd123" "Operator" true
86 Redfishtool Delete User "UserT100"
manashsarma40b85d12020-04-04 21:18:59 -050087 Redfishtool Access Resource /redfish/v1/AccountService/Accounts "UserT100" "TestPwd123"
88 ... ${HTTP_UNAUTHORIZED}
89
manashsarmaea14dae2020-03-26 11:00:27 -050090
91Verify Redfishtool Error Upon Creating Same Users With Different Privileges
George Keishinge20f82c2020-05-13 10:51:02 -050092 [Documentation] Verify error upon creating same users with different privileges.
manashsarmaea14dae2020-03-26 11:00:27 -050093 [Tags] Verify_Redfishtool_Error_Upon_Creating_Same_Users_With_Different_Privileges
94 [Teardown] Redfishtool Delete User "UserT100"
95
96 Redfishtool Create User "UserT100" "TestPwd123" "Operator" true
manashsarma40b85d12020-04-04 21:18:59 -050097 Redfishtool Create User "UserT100" "TestPwd123" "Administrator" true
98 ... expected_error=${HTTP_BAD_REQUEST}
manashsarmaea14dae2020-03-26 11:00:27 -050099
100
101Verify Redfishtool Admin User Privilege
George Keishinge20f82c2020-05-13 10:51:02 -0500102 [Documentation] Verify privilege of admin user.
manashsarmaea14dae2020-03-26 11:00:27 -0500103 [Tags] Verify_Redfishtool_Admin_User_Privilege
104 [Teardown] Run Keywords Redfishtool Delete User "UserT100" AND
105 ... Redfishtool Delete User "UserT101"
106
107 Redfishtool Create User "UserT100" "TestPwd123" "Administrator" true
108
109 # Verify if an user can be added by admin
110 Redfishtool Create User "UserT101" "TestPwd123" "Operator" true "UserT100" "TestPwd123"
111
112
113Verify Redfishtool ReadOnly User Privilege
114 [Documentation] Verify Redfishtool ReadOnly user privilege works.
115 [Tags] Verify_Redfishtool_ReadOnly_User_Privilege
116 [Teardown] Redfishtool Delete User "UserT100"
117
118 Redfishtool Create User "UserT100" "TestPwd123" "ReadOnly" true
119 Redfishtool Access Resource /redfish/v1/Systems/ "UserT100" "TestPwd123"
120
121 Redfishtool Create User
122 ... "UserT101" "TestPwd123" "Operator" true "UserT100" "TestPwd123" ${HTTP_FORBIDDEN}
123
124
manashsarma40b85d12020-04-04 21:18:59 -0500125Verify Redfishtool Replace Server Certificate Valid CertKey
126 [Documentation] Verify replace server certificate.
127 [Tags] Verify_Redfishtool_Replace_Server_Certificate_Valid_CertKey
128
129 Verify Redfishtool Replace Certificate Server Valid Certificate Valid Privatekey ok
130
131
132Verify Redfishtool Replace Client Certificate Valid CertKey
133 [Documentation] Verify replace client certificate.
134 [Tags] Verify_Redfishtool_Replace_Client_Certificate_Valid_CertKey
135
136 Verify Redfishtool Replace Certificate Client Valid Certificate Valid Privatekey ok
137
138
139Verify Redfishtool Replace CA Certificate Valid Cert
140 [Documentation] Verify replace CA certificate.
141 [Tags] Verify_Redfishtool_Replace_CA_Certificate_Valid_Cert
142
143 Verify Redfishtool Replace Certificate CA Valid Certificate ok
144
145
146Verify Redfishtool Client Certificate Install Valid CertKey
147 [Documentation] Verify client certificate installation.
148 [Tags] Verify_Redfishtool_Client_Certificate_Install_Valid_CertKey
149
150 Verify Redfishtool Install Certificate Client Valid Certificate Valid Privatekey ok
151
152
153Verify Redfishtool CA Certificate Install Valid Cert
154 [Documentation] Verify CA Certificate installation.
155 [Tags] Verify_Redfishtool_CA_Certificate_Install_Valid_Cert
156
157 Verify Redfishtool Install Certificate CA Valid Certificate ok
158
159
manashsarma8b5d6802020-03-09 04:09:15 -0500160*** Keywords ***
161
manashsarmaea14dae2020-03-26 11:00:27 -0500162Redfishtool Access Resource
163 [Documentation] Access resource.
164 [Arguments] ${uri} ${login_user} ${login_pasword} ${expected_error}=""
165
166 # Description of argument(s):
167 # uri URI for resource access.
168 # login_user The login user name used other than default root user.
169 # login_pasword The login password.
170 # expected_error Expected error optionally provided in testcase (e.g. 401 /
171 # authentication error, etc. )
172
173 ${user_cmd_args}= Set Variable
174 ... redfishtool raw -r ${OPENBMC_HOST} -u ${login_user} -p ${login_pasword} -S Always
175 Redfishtool Get ${uri} ${user_cmd_args} ${expected_error}
176
manashsarma91abf372020-03-17 20:34:02 -0500177
178Is HTTP error Expected
179 [Documentation] Check if the HTTP error is expected.
180 [Arguments] ${cmd_output} ${error_expected}
manashsarma8b5d6802020-03-09 04:09:15 -0500181
182 # Description of argument(s):
manashsarma91abf372020-03-17 20:34:02 -0500183 # cmd_output Output of an HTTP operation.
184 # error_expected Expected error.
manashsarma8b5d6802020-03-09 04:09:15 -0500185
manashsarma91abf372020-03-17 20:34:02 -0500186 ${error_expected}= Evaluate "${error_expected}" in """${cmd_output}"""
187 Should Be True ${error_expected} == True
188
189
190Redfishtool Create User
191 [Documentation] Create new user.
manashsarma40b85d12020-04-04 21:18:59 -0500192 [Arguments] ${user_name} ${password} ${roleID} ${enable} ${login_user}="" ${login_pasword}=""
193 ... ${expected_error}=""
manashsarma91abf372020-03-17 20:34:02 -0500194
195 # Description of argument(s):
196 # user_name The user name (e.g. "test", "robert", etc.).
197 # password The user password (e.g. "0penBmc", "0penBmc1", etc.).
198 # roleID The role of user (e.g. "Administrator", "Operator", etc.).
199 # enable Enabled attribute of (e.g. true or false).
200 # expected_error Expected error optionally provided in testcase (e.g. 401 /
201 # authentication error, etc. )
202
manashsarma40b85d12020-04-04 21:18:59 -0500203 ${user_cmd_args}= Set Variable
204 ... redfishtool raw -r ${OPENBMC_HOST} -u ${login_user} -p ${login_pasword} -S Always
205 ${data}= Set Variable
206 ... '{"UserName":${user_name},"Password":${password},"RoleId":${roleId},"Enabled":${enable}}'
manashsarmaea14dae2020-03-26 11:00:27 -0500207 Run Keyword If ${login_user} == ""
208 ... Redfishtool Post ${data} /redfish/v1/AccountService/Accounts ${root_cmd_args} ${expected_error}
209 ... ELSE
210 ... Redfishtool Post ${data} /redfish/v1/AccountService/Accounts ${user_cmd_args} ${expected_error}
211
manashsarma91abf372020-03-17 20:34:02 -0500212
213Redfishtool Update User Role
214 [Documentation] Update user role.
215 [Arguments] ${user_name} ${newRole} ${login_user}="" ${login_pasword}=""
216 ... ${expected_error}=""
217
218 # Description of argument(s):
219 # user_name The user name (e.g. "test", "robert", etc.).
220 # newRole The new role of user (e.g. "Administrator", "Operator", etc.).
221 # login_user The login user name used other than default root user.
222 # login_pasword The login password.
223 # expected_error Expected error optionally provided in testcase (e.g. 401 /
224 # authentication error, etc. )
225
manashsarma40b85d12020-04-04 21:18:59 -0500226 ${user_cmd_args}= Set Variable
227 ... redfishtool raw -r ${OPENBMC_HOST} -u ${login_user} -p ${login_pasword} -S Always
manashsarmaea14dae2020-03-26 11:00:27 -0500228 Run Keyword If ${login_user} == ""
manashsarma40b85d12020-04-04 21:18:59 -0500229 ... Redfishtool Patch '{"RoleId":${newRole}}'
230 ... /redfish/v1/AccountService/Accounts/${user_name} ${root_cmd_args} ${expected_error}
manashsarmaea14dae2020-03-26 11:00:27 -0500231 ... ELSE
manashsarma40b85d12020-04-04 21:18:59 -0500232 ... Redfishtool Patch '{"RoleId":${newRole}}'
233 ... /redfish/v1/AccountService/Accounts/${user_name} ${user_cmd_args} ${expected_error}
manashsarmaea14dae2020-03-26 11:00:27 -0500234
manashsarma91abf372020-03-17 20:34:02 -0500235
236Redfishtool Delete User
237 [Documentation] Delete an user.
238 [Arguments] ${user_name} ${expected_error}=""
239
240 # Description of argument(s):
241 # user_name The user name (e.g. "test", "robert", etc.).
242 # expected_error Expected error optionally provided in testcase (e.g. 401 /
243 # authentication error, etc. ).
244
245 Redfishtool Delete /redfish/v1/AccountService/Accounts/${user_name}
246 ... ${root_cmd_args} ${expected_error}
247
248
249Redfishtool Verify User
250 [Documentation] Verify role of the user.
251 [Arguments] ${user_name} ${role}
252
253 # Description of argument(s):
254 # user_name The user name (e.g. "test", "robert", etc.).
255 # role The new role of user (e.g. "Administrator", "Operator", etc.).
256
257 ${user_account}= Redfishtool Get /redfish/v1/AccountService/Accounts/${user_name}
258 ${json_obj}= Evaluate json.loads('''${user_account}''') json
259 Should Be equal "${json_obj["RoleId"]}" ${role}
260
261
262Redfishtool Verify User Name Exists
263 [Documentation] Verify user name exists.
264 [Arguments] ${user_name}
265
266 # Description of argument(s):
267 # user_name The user name (e.g. "test", "robert", etc.).
268
269 ${status}= Run Keyword And Return Status redfishtool Get
270 ... /redfish/v1/AccountService/Accounts/${user_name}
manashsarma40b85d12020-04-04 21:18:59 -0500271
manashsarma91abf372020-03-17 20:34:02 -0500272 [return] ${status}
273
274
275Redfishtool Get
276 [Documentation] Execute redfishtool for GET operation.
277 [Arguments] ${uri} ${cmd_args}=${root_cmd_args} ${expected_error}=""
278
279 # Description of argument(s):
280 # uri URI for GET operation (e.g. /redfish/v1/AccountService/Accounts/).
281 # cmd_args Commandline arguments.
282 # expected_error Expected error optionally provided in testcase (e.g. 401 /
283 # authentication error, etc. ).
284
285 ${rc} ${cmd_output}= Run and Return RC and Output ${cmd_args} GET ${uri}
286 Run Keyword If ${rc} != 0 Is HTTP error Expected ${cmd_output} ${expected_error}
manashsarma40b85d12020-04-04 21:18:59 -0500287
manashsarma8b5d6802020-03-09 04:09:15 -0500288 [Return] ${cmd_output}
289
manashsarma91abf372020-03-17 20:34:02 -0500290
manashsarma40b85d12020-04-04 21:18:59 -0500291Verify Redfishtool Install Certificate
292 [Documentation] Install and verify certificate using Redfishtool.
293 [Arguments] ${cert_type} ${cert_format} ${expected_status} ${delete_cert}=${True}
294
295 # Description of argument(s):
296 # cert_type Certificate type (e.g. "Client" or "CA").
297 # cert_format Certificate file format
298 # expected_status Expected status of certificate install Redfishtool
299 # request (i.e. "ok" or "error").
300 # delete_cert Certificate will be deleted before installing if this True.
301
302 Run Keyword If '${cert_type}' == 'CA' and '${delete_cert}' == '${True}'
303 ... Delete All CA Certificate Via Redfisthtool
304 ... ELSE IF '${cert_type}' == 'Client' and '${delete_cert}' == '${True}'
305 ... Redfishtool Delete Certificate Via BMC CLI ${cert_type}
306
307 ${cert_file_path}= Generate Certificate File Via Openssl ${cert_format}
308 ${bytes}= OperatingSystem.Get Binary File ${cert_file_path}
309 ${file_data}= Decode Bytes To String ${bytes} UTF-8
310
311 ${certificate_uri}= Set Variable If
312 ... '${cert_type}' == 'Client' ${REDFISH_LDAP_CERTIFICATE_URI}
313 ... '${cert_type}' == 'CA' ${REDFISH_CA_CERTIFICATE_URI}
314
315 ${cert_id}= Redfishtool Install Certificate File On BMC ${certificate_uri} data=${file_data}
316 Logging Installed certificate id: ${cert_id}
317
318 # Adding delay after certificate installation.
319 Sleep 30s
320
321 ${cert_file_content}= OperatingSystem.Get File ${cert_file_path}
322
323 ${bmc_cert_content}= Redfishtool GetAttribute ${certificate_uri}/${cert_id} CertificateString
324
325 Run Keyword If '${expected_status}' == 'ok' Should Contain ${cert_file_content} ${bmc_cert_content}
326
327 [Return] ${cert_id}
328
329
330Delete All CA Certificate Via Redfisthtool
331 [Documentation] Delete all CA certificate via Redfish.
332
333 ${cmd_output}= Redfishtool Get /redfish/v1/Managers/bmc/Truststore/Certificates
334 ${json_object}= To JSON ${cmd_output}
335 ${cert_list}= Set Variable ${json_object["Members"]}
336 FOR ${cert} IN @{cert_list}
337 Redfishtool Delete ${cert["@odata.id"]} ${root_cmd_args} ${HTTP_NO_CONTENT}
338 END
339
340
341Redfishtool Delete Certificate Via BMC CLI
342 [Documentation] Delete certificate via BMC CLI.
343 [Arguments] ${cert_type}
344
345 # Description of argument(s):
346 # cert_type Certificate type (e.g. "Client" or "CA").
347
348 ${certificate_file_path} ${certificate_service} ${certificate_uri}=
349 ... Run Keyword If '${cert_type}' == 'Client'
350 ... Set Variable /etc/nslcd/certs/cert.pem phosphor-certificate-manager@nslcd.service
351 ... ${REDFISH_LDAP_CERTIFICATE_URI}
352 ... ELSE IF '${cert_type}' == 'CA'
353 ... Set Variable ${ROOT_CA_FILE_PATH} phosphor-certificate-manager@authority.service
354 ... ${REDFISH_CA_CERTIFICATE_URI}
355
356 ${file_status} ${stderr} ${rc}= BMC Execute Command
357 ... [ -f ${certificate_file_path} ] && echo "Found" || echo "Not Found"
358
359 Return From Keyword If "${file_status}" != "Found"
360 BMC Execute Command rm ${certificate_file_path}
361 BMC Execute Command systemctl restart ${certificate_service}
362 BMC Execute Command systemctl daemon-reload
363
364
365Redfishtool Install Certificate File On BMC
366 [Documentation] Install certificate file in BMC using POST operation.
367 [Arguments] ${uri} ${status}=ok &{kwargs}
368
369 # Description of argument(s):
370 # uri URI for installing certificate file via Redfishtool.
371 # e.g. "/redfish/v1/AccountService/LDAP/Certificates".
372 # status Expected status of certificate installation via Redfishtool.
373 # e.g. error, ok.
374 # kwargs A dictionary of keys/values to be passed directly to
375 # POST Request.
376
377 Initialize OpenBMC 20 ${quiet}=${1} ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
378
379 ${headers}= Create Dictionary Content-Type=application/octet-stream
380 ... X-Auth-Token=${XAUTH_TOKEN}
381 Set To Dictionary ${kwargs} headers ${headers}
382
383 ${ret}= Post Request openbmc ${uri} &{kwargs}
384 ${content_json}= To JSON ${ret.content}
385 ${cert_id}= Set Variable If '${ret.status_code}' == '${HTTP_OK}' ${content_json["Id"]} -1
386
387 Run Keyword If '${status}' == 'ok'
388 ... Should Be Equal As Strings ${ret.status_code} ${HTTP_OK}
389 ... ELSE IF '${status}' == 'error'
390 ... Should Be Equal As Strings ${ret.status_code} ${HTTP_INTERNAL_SERVER_ERROR}
391
392 Delete All Sessions
393
394 [Return] ${cert_id}
395
396
397Verify Redfishtool Replace Certificate
398 [Documentation] Verify replace server certificate.
399 [Arguments] ${cert_type} ${cert_format} ${expected_status}
400
401 # Description of argument(s):
402 # cert_type Certificate type (e.g. "Client", "Server" or "CA").
403 # cert_format Certificate file format
404 # (e.g. "Valid_Certificate_Valid_Privatekey").
405 # expected_status Expected status of certificate replace Redfishtool
406 # request (i.e. "ok" or "error").
407
408 Create Directory certificate_dir
409 # Install certificate before replacing client or CA certificate.
410 ${cert_id}= Run Keyword If '${cert_type}' == 'Client'
411 ... Verify Redfishtool Install Certificate ${cert_type} Valid Certificate Valid Privatekey ok
412 ... ELSE IF '${cert_type}' == 'CA'
413 ... Verify Redfishtool Install Certificate ${cert_type} Valid Certificate ok
414
415 ${cert_file_path}= Generate Certificate File Via Openssl ${cert_format}
416 ${bytes}= OperatingSystem.Get Binary File ${cert_file_path}
417 ${file_data}= Decode Bytes To String ${bytes} UTF-8
418
419 ${certificate_uri}= Set Variable If
420 ... '${cert_type}' == 'Server' ${REDFISH_HTTPS_CERTIFICATE_URI}/1
421 ... '${cert_type}' == 'Client' ${REDFISH_LDAP_CERTIFICATE_URI}/1
422 ... '${cert_type}' == 'CA' ${REDFISH_CA_CERTIFICATE_URI}/${cert_id}
423
424 ${certificate_dict}= Create Dictionary @odata.id=${certificate_uri}
425 ${dict_objects}= Create Dictionary CertificateString=${file_data}
426 ... CertificateType=PEM CertificateUri=${certificate_dict}
427 ${string}= Convert To String ${dict_objects}
428 ${string}= Replace String ${string} ' "
429 ${payload}= Set Variable '${string}'
430 ${response}= Redfishtool Post
431 ... ${payload} /redfish/v1/CertificateService/Actions/CertificateService.ReplaceCertificate
432
433 ${cert_file_content}= OperatingSystem.Get File ${cert_file_path}
434 ${bmc_cert_content}= Redfishtool GetAttribute ${certificate_uri} CertificateString
435
436 Run Keyword If '${expected_status}' == 'ok'
437 ... Should Contain ${cert_file_content} ${bmc_cert_content}
438 ... ELSE
439 ... Should Not Contain ${cert_file_content} ${bmc_cert_content}
440
441
442Redfishtool GetAttribute
443 [Documentation] Execute redfishtool for GET operation.
444 [Arguments] ${uri} ${Attribute} ${cmd_args}=${root_cmd_args} ${expected_error}=""
445
446 # Description of argument(s):
447 # uri URI for GET operation (e.g. /redfish/v1/AccountService/Accounts/).
448 # Attribute The specific attribute to be retrieved with the URI.
449 # cmd_args Commandline arguments.
450 # expected_error Expected error optionally provided in testcase (e.g. 401 /
451 # authentication error, etc. ).
452
453 ${rc} ${cmd_output}= Run and Return RC and Output ${cmd_args} GET ${uri}
454 Run Keyword If ${rc} != 0 Is HTTP error Expected ${cmd_output} ${expected_error}
455 ${json_object}= To JSON ${cmd_output}
456
457 [Return] ${json_object["CertificateString"]}
458
459
manashsarma91abf372020-03-17 20:34:02 -0500460Redfishtool Post
461 [Documentation] Execute redfishtool for Post operation.
462 [Arguments] ${payload} ${uri} ${cmd_args}=${root_cmd_args} ${expected_error}=""
463
464 # Description of argument(s):
465 # payload Payload with POST operation (e.g. data for user name, password, role,
466 # enabled attribute)
467 # uri URI for POST operation (e.g. /redfish/v1/AccountService/Accounts/).
468 # cmd_args Commandline arguments.
469 # expected_error Expected error optionally provided in testcase (e.g. 401 /
470 # authentication error, etc. ).
471
472 ${rc} ${cmd_output}= Run and Return RC and Output ${cmd_args} POST ${uri} --data=${payload}
473 Run Keyword If ${rc} != 0 Is HTTP error Expected ${cmd_output} ${expected_error}
manashsarma40b85d12020-04-04 21:18:59 -0500474
manashsarma91abf372020-03-17 20:34:02 -0500475 [Return] ${cmd_output}
476
477
478Redfishtool Patch
479 [Documentation] Execute redfishtool for Patch operation.
480 [Arguments] ${payload} ${uri} ${cmd_args}=${root_cmd_args} ${expected_error}=""
481
482 # Description of argument(s):
483 # payload Payload with POST operation (e.g. data for user name, role, etc. ).
484 # uri URI for PATCH operation (e.g. /redfish/v1/AccountService/Accounts/ ).
485 # cmd_args Commandline arguments.
486 # expected_error Expected error optionally provided in testcase (e.g. 401 /
487 # authentication error, etc. ).
488
489 ${rc} ${cmd_output}= Run and Return RC and Output ${cmd_args} PATCH ${uri} --data=${payload}
490 Run Keyword If ${rc} != 0 Is HTTP error Expected ${cmd_output} ${expected_error}
manashsarma40b85d12020-04-04 21:18:59 -0500491
manashsarma91abf372020-03-17 20:34:02 -0500492 [Return] ${cmd_output}
493
494
495Redfishtool Delete
496 [Documentation] Execute redfishtool for Post operation.
497 [Arguments] ${uri} ${cmd_args}=${root_cmd_args} ${expected_error}=""
498
499 # Description of argument(s):
500 # uri URI for DELETE operation.
501 # cmd_args Commandline arguments.
502 # expected_error Expected error optionally provided in testcase (e.g. 401 /
503 # authentication error, etc. ).
504
505 ${rc} ${cmd_output}= Run and Return RC and Output ${cmd_args} DELETE ${uri}
506 Run Keyword If ${rc} != 0 Is HTTP error Expected ${cmd_output} ${expected_error}
manashsarma40b85d12020-04-04 21:18:59 -0500507
manashsarma91abf372020-03-17 20:34:02 -0500508 [Return] ${cmd_output}
509
510
manashsarma8b5d6802020-03-09 04:09:15 -0500511Suite Setup Execution
512 [Documentation] Do suite setup execution.
513
514 ${tool_exist}= Run which redfishtool
515 Should Not Be Empty ${tool_exist}