blob: e1080acc5fe3cc5cc3ed58772afdd0e89eef3810 [file] [log] [blame]
Prashanth Kattifa699cf2020-04-06 10:13:33 -05001*** Settings ***
2Documentation Connections and authentication module stability tests.
3
4Resource ../lib/bmc_redfish_resource.robot
5Resource ../lib/bmc_network_utils.robot
6Resource ../lib/openbmc_ffdc.robot
Anvesh Kumar Rayankula85df1372020-04-28 05:01:14 -05007Resource ../lib/resource.robot
8Resource ../lib/utils.robot
9Resource ../lib/connection_client.robot
shrsuman123b844a872021-12-21 05:49:41 -060010Resource ../gui/lib/gui_resource.robot
Prashanth Kattifa699cf2020-04-06 10:13:33 -050011Library ../lib/bmc_network_utils.py
12
Anvesh Kumar Rayankula85df1372020-04-28 05:01:14 -050013Library SSHLibrary
Prashanth Kattifa699cf2020-04-06 10:13:33 -050014Library Collections
Prashanth Kattiee26d5e2021-05-21 00:38:31 -050015Library XvfbRobot
16Library OperatingSystem
George Keishing47d1e8e2022-02-17 10:38:49 -060017Library SeleniumLibrary 120 120
Prashanth Kattiee26d5e2021-05-21 00:38:31 -050018Library Telnet 30 Seconds
19Library Screenshot
20
shrsuman123a8ca2962022-01-07 03:30:08 -060021
22Suite Setup Redfish.Logout
23
George Keishing87dc4422023-10-20 12:56:30 +053024Variables ../gui/data/gui_variables.py
25
26Force Tags BMC_Connections
Prashanth Kattifa699cf2020-04-06 10:13:33 -050027
28*** Variables ***
29
Anvesh Kumar Rayankula85df1372020-04-28 05:01:14 -050030${iterations} 10000
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -050031${loop_iteration} ${1000}
George Keishing23afcc52022-04-07 03:18:08 -050032${hostname} testhostname
Anvesh Kumar Rayankula85df1372020-04-28 05:01:14 -050033${MAX_UNAUTH_PER_IP} ${5}
Matt Fischer46bd8c22023-09-01 11:00:26 -060034${bmc_url} https://${OPENBMC_HOST}:${HTTPS_PORT}
Prashanth Kattiee26d5e2021-05-21 00:38:31 -050035
Prashanth Kattifa699cf2020-04-06 10:13:33 -050036
37*** Test Cases ***
38
39Test Patch Without Auth Token Fails
40 [Documentation] Send patch method without auth token and verify it throws an error.
George Keishing966a4c52020-05-13 10:53:58 -050041 [Tags] Test_Patch_Without_Auth_Token_Fails
Prashanth Kattifa699cf2020-04-06 10:13:33 -050042
Anves Kumar rayankula816d3ce2021-06-13 23:55:41 -050043 ${active_channel_config}= Get Active Channel Config
44 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
45
46 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body={'HostName': '${hostname}'}
Prashanth Kattifa699cf2020-04-06 10:13:33 -050047 ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}]
48
49
50Flood Patch Without Auth Token And Check Stability Of BMC
51 [Documentation] Flood patch method without auth token and check BMC stability.
52 [Tags] Flood_Patch_Without_Auth_Token_And_Check_Stability_Of_BMC
George Keishing23afcc52022-04-07 03:18:08 -050053
54 @{fail_list}= Create List
Prashanth Kattifa699cf2020-04-06 10:13:33 -050055
Anves Kumar rayankula816d3ce2021-06-13 23:55:41 -050056 ${active_channel_config}= Get Active Channel Config
57 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
58
George Keishing23afcc52022-04-07 03:18:08 -050059 FOR ${iter} IN RANGE ${1} ${iterations} + 1
60 Log To Console ${iter}th iteration Patch Request without valid session token
61 # Expected valid fail status response code.
62 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body={'HostName': '${hostname}'}
63 ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}]
Prashanth Kattifa699cf2020-04-06 10:13:33 -050064
65 # Every 100th iteration, check BMC allows patch with auth token.
George Keishing23afcc52022-04-07 03:18:08 -050066 ${status}= Run Keyword If ${iter} % 100 == 0 Run Keyword And Return Status
67 ... Login And Configure Hostname ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
68 Run Keyword If ${status} == False Append To List ${fail_list} ${iter}
Prashanth Kattifa699cf2020-04-06 10:13:33 -050069 END
70 ${verify_count}= Evaluate ${iterations}/100
George Keishing23afcc52022-04-07 03:18:08 -050071 ${fail_count}= Get Length ${fail_list}
Prashanth Kattifa699cf2020-04-06 10:13:33 -050072
George Keishing23afcc52022-04-07 03:18:08 -050073 Should Be Equal As Integers ${fail_count} ${0}
74 ... msg=Patch operation failed ${fail_count} times in ${verify_count} attempts; fails at iterations ${fail_list}
Prashanth Kattifa699cf2020-04-06 10:13:33 -050075
76
George Keishing4fb89c12022-01-06 22:29:33 -060077Verify User Cannot Login After 5 Non-Logged In Sessions
Anvesh Kumar Rayankula85df1372020-04-28 05:01:14 -050078 [Documentation] User should not be able to login when there
79 ... are 5 non-logged in sessions.
80 [Tags] Verify_User_Cannot_Login_After_5_Non-Logged_In_Sessions
Gene Ratzlaff05a29c82022-05-13 11:43:25 -040081 [Setup] Confirm Ability to Connect Then Close All Connections
82 [Teardown] Run Keywords Process.Terminate All Processes AND
83 ... SSHLibrary.Close All Connections AND FFDC On Test Case Fail
Anvesh Kumar Rayankula85df1372020-04-28 05:01:14 -050084
George Keishing23afcc52022-04-07 03:18:08 -050085 FOR ${iter} IN RANGE ${0} ${MAX_UNAUTH_PER_IP}
Anvesh Kumar Rayankula85df1372020-04-28 05:01:14 -050086 SSHLibrary.Open Connection ${OPENBMC_HOST}
87 Start Process ssh ${OPENBMC_USERNAME}@${OPENBMC_HOST} shell=True
88 END
89
90 SSHLibrary.Open Connection ${OPENBMC_HOST}
91 ${status}= Run Keyword And Return Status SSHLibrary.Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
Prashanth Katti91e59712020-04-14 08:12:09 -050092
Anvesh Kumar Rayankula85df1372020-04-28 05:01:14 -050093 Should Be Equal ${status} ${False}
94
95
Prashanth Katti91e59712020-04-14 08:12:09 -050096Test Post Without Auth Token Fails
97 [Documentation] Send post method without auth token and verify it throws an error.
98 [Tags] Test_Post_Without_Auth_Token_Fails
99
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500100 ${user_info}= Create Dictionary
101 ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True}
Prashanth Katti91e59712020-04-14 08:12:09 -0500102 Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info}
103 ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}]
104
105
106Flood Post Without Auth Token And Check Stability Of BMC
107 [Documentation] Flood post method without auth token and check BMC stability.
108 [Tags] Flood_Post_Without_Auth_Token_And_Check_Stability_Of_BMC
109
George Keishing23afcc52022-04-07 03:18:08 -0500110 @{fail_list}= Create List
111
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500112 ${user_info}= Create Dictionary
113 ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True}
Prashanth Katti91e59712020-04-14 08:12:09 -0500114
George Keishing23afcc52022-04-07 03:18:08 -0500115 FOR ${iter} IN RANGE ${1} ${iterations} + 1
116 Log To Console ${iter}th iteration Post Request without valid session token
117 # Expected valid fail status response code.
118 Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info}
119 ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}]
Prashanth Katti91e59712020-04-14 08:12:09 -0500120
121 # Every 100th iteration, check BMC allows post with auth token.
George Keishing23afcc52022-04-07 03:18:08 -0500122 ${status}= Run Keyword If ${iter} % 100 == 0 Run Keyword And Return Status
Prashanth Katti91e59712020-04-14 08:12:09 -0500123 ... Login And Create User
George Keishing23afcc52022-04-07 03:18:08 -0500124 Run Keyword If ${status} == False Append To List ${fail_list} ${iter}
Prashanth Katti91e59712020-04-14 08:12:09 -0500125 END
126 ${verify_count}= Evaluate ${iterations}/100
George Keishing23afcc52022-04-07 03:18:08 -0500127 ${fail_count}= Get Length ${fail_list}
Prashanth Katti91e59712020-04-14 08:12:09 -0500128
George Keishing23afcc52022-04-07 03:18:08 -0500129 Should Be Equal As Integers ${fail_count} ${0}
130 ... msg=Post operation failed ${fail_count} times in ${verify_count} attempts; fails at iterations ${fail_list}
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500131
132
133Make Large Number Of Wrong SSH Login Attempts And Check Stability
134 [Documentation] Check BMC stability with large number of SSH wrong login requests.
135 [Tags] Make_Large_Number_Of_Wrong_SSH_Login_Attempts_And_Check_Stability
136 [Setup] Set Account Lockout Threshold
137 [Teardown] FFDC On Test Case Fail
138
139 SSHLibrary.Open Connection ${OPENBMC_HOST}
140 @{ssh_status_list}= Create List
Gene Ratzlafffde32cf2022-05-06 15:21:31 -0400141 FOR ${iter} IN RANGE ${1} ${loop_iteration} + 1
George Keishing23afcc52022-04-07 03:18:08 -0500142 Log To Console ${iter}th iteration
143 ${invalid_password}= Catenate ${OPENBMC_PASSWORD}${iter}
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500144 Run Keyword and Ignore Error
145 ... Open Connection And Log In ${OPENBMC_USERNAME} ${invalid_password}
146
147 # Every 100th iteration Login with correct credentials
George Keishing23afcc52022-04-07 03:18:08 -0500148 ${status}= Run keyword If ${iter} % ${100} == ${0} Run Keyword And Return Status
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500149 ... Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
150 Run Keyword If ${status} == ${False} Append To List ${ssh_status_list} ${status}
151 SSHLibrary.Close Connection
152 END
153
154 ${valid_login_count}= Evaluate ${iterations}/100
155 ${fail_count}= Get Length ${ssh_status_list}
156 Should Be Equal ${fail_count} ${0}
157 ... msg= Login Failed ${fail_count} times in ${valid_login_count} attempts.
Prashanth Katti91e59712020-04-14 08:12:09 -0500158
159
Prashanth Kattiee26d5e2021-05-21 00:38:31 -0500160Test Stability On Large Number Of Wrong Login Attempts To GUI
161 [Documentation] Test stability on large number of wrong login attempts to GUI.
162 [Tags] Test_Stability_On_Large_Number_Of_Wrong_Login_Attempts_To_GUI
163
164 @{status_list}= Create List
165
166 # Open headless browser.
167 Start Virtual Display
168 ${browser_ID}= Open Browser ${bmc_url} alias=browser1
169 Set Window Size 1920 1080
170
171 Go To ${bmc_url}
172
George Keishing23afcc52022-04-07 03:18:08 -0500173 FOR ${iter} IN RANGE ${1} ${iterations} + 1
174 Log To Console ${iter}th login
George Keishingfef9aa92022-04-08 08:45:42 -0500175 Run Keyword And Ignore Error Login to GUI With Incorrect Credentials
Prashanth Kattiee26d5e2021-05-21 00:38:31 -0500176
177 # Every 100th iteration, check BMC GUI is responsive.
George Keishing23afcc52022-04-07 03:18:08 -0500178 ${status}= Run Keyword If ${iter} % 100 == 0 Run Keyword And Return Status
Prashanth Kattiee26d5e2021-05-21 00:38:31 -0500179 ... Open Browser ${bmc_url}
180 Append To List ${status_list} ${status}
George Keishing47d1e8e2022-02-17 10:38:49 -0600181 Run Keyword If '${status}' == 'True'
182 ... Run Keywords Close Browser AND Switch Browser browser1
Prashanth Kattiee26d5e2021-05-21 00:38:31 -0500183 END
184
185 ${fail_count}= Count Values In List ${status_list} False
186 Run Keyword If ${fail_count} > ${0} FAIL Could not open BMC GUI ${fail_count} times
187
Megha G Nae743b82023-02-17 04:58:55 -0600188
shrsuman123b844a872021-12-21 05:49:41 -0600189Test BMC GUI Stability On Continuous Refresh Of GUI Home Page
190 [Documentation] Login to BMC GUI and keep refreshing home page and verify stability
191 ... by login at times in another browser.
192 [Tags] Test_BMC_GUI_Stability_On_Continuous_Refresh_Of_GUI_Home_Page
193 [Teardown] Close All Browsers
194
195 @{failed_list}= Create List
196
197 # Open headless browser.
198 Start Virtual Display
199 ${browser_ID}= Open Browser ${bmc_url} alias=browser1
200 Set Window Size 1920 1080
201 Login GUI
202
203 FOR ${iter} IN RANGE ${iterations}
204 Log To Console ${iter}th Refresh of home page
205
206 Refresh GUI
207 Continue For Loop If ${iter}%100 != 0
208
209 # Every 100th iteration, check BMC GUI is responsive.
210 ${status}= Run Keyword And Return Status
211 ... Run Keywords Launch Browser And Login GUI AND Logout GUI
212 Run Keyword If '${status}' == 'False' Append To List ${failed_list} ${iter}
213 ... ELSE IF '${status}' == 'True'
214 ... Run Keywords Close Browser AND Switch Browser browser1
215 END
216 Log ${failed_list}
217 ${fail_count}= Get Length ${failed_list}
218 Run Keyword If ${fail_count} > ${0} FAIL Could not open BMC GUI ${fail_count} times
Prashanth Kattiee26d5e2021-05-21 00:38:31 -0500219
Megha G Nae743b82023-02-17 04:58:55 -0600220
shrsuman1232b8bfca2021-11-18 05:14:23 -0600221Test BMCweb Stability On Continuous Redfish Login Attempts With Invalid Credentials
222 [Documentation] Make invalid credentials Redfish login attempts continuously and
223 ... verify bmcweb stability by login to Redfish with valid credentials.
224 [Tags] Test_BMCweb_Stability_On_Continuous_Redfish_Login_Attempts_With_Invalid_Credentials
225
226 Invalid Credentials Redfish Login Attempts
227
Megha G Nae743b82023-02-17 04:58:55 -0600228
shrsuman1232b8bfca2021-11-18 05:14:23 -0600229Test User Delete Operation Without Session Token And Expect Failure
230 [Documentation] Try to delete an object without valid session token and verifies it throws
231 ... an unauthorised error.
232 [Tags] Test_User_Delete_Operation_Without_Session_Token_And_Expect_Failure
233 [Setup] Redfish.Logout
234
235 Redfish.Delete /redfish/v1/AccountService/Accounts/test_user
236 ... valid_status_codes=[${HTTP_UNAUTHORIZED}]
237
238
239Test Bmcweb Stability On Continuous Redfish Delete Operation Request Without Session Token
240 [Documentation] Send delete object request without valid session token continuously and
241 ... verify bmcweb stability by sending delete request with valid session token.
242 [Tags] Test_Bmcweb_Stability_On_Continuous_Redfish_Delete_Operation_Request_Without_Session_Token
243
244 @{failed_iter_list}= Create List
245
246 FOR ${iter} IN RANGE ${iterations}
247 Log To Console ${iter}th Redfish Delete Object Request without valid session token
248
249 Run Keyword And Ignore Error
250 ... Redfish.Delete /redfish/v1/AccountService/Accounts/test_user
251 Continue For Loop If ${iter}%100 != 0
252
253 # Every 100th iteration, check delete operation with valid session token.
254 ${status}= Run Keyword And Return Status
255 ... Login And Delete User
256 Run Keyword If '${status}' == 'False' Append To List ${failed_iter_list} ${iter}
257 END
258 Log ${failed_iter_list}
259 ${fail_count}= Get Length ${failed_iter_list}
260 Run Keyword If ${fail_count} > ${0} FAIL Could not do Redfish delete operation ${fail_count} times
261
Megha G Nae743b82023-02-17 04:58:55 -0600262
263Verify Flood Put Method Without Auth Token
264 [Documentation] Flood put method without auth token and check BMC stability.
265 [Tags] Verify_Flood_Put_Method_Without_Auth_Token
266 [Teardown] Delete All BMC Partition File
267
268 @{status_list}= Create List
269
270 FOR ${iter} IN RANGE ${1} ${iterations}
271 Log To Console ${iter}th iteration
272 Run Keyword And Ignore Error
273 ... Redfish.Put ${LED_LAMP_TEST_ASSERTED_URI}attr/Asserted body={"data":1}
274 # Every 100th iteration, check BMC allows put with auth token.
275 ${status}= Run Keyword If ${iter} % 100 == 0
276 ... Run Keyword And Return Status
277 ... Login And Upload Partition File To BMC
278 Run Keyword If ${status} == ${False}
279 ... Append To List ${status_list} ${status}
280 END
281
282 # Note the count for every 100 iterations.
283 ${verify_count}= Evaluate ${iterations}/100
284 ${fail_count}= Get Length ${status_list}
285
286 Should Be Equal ${fail_count} ${0}
287 ... msg=Put operation failed ${fail_count} times in ${verify_count} attempts.
288
289
Prashanth Kattifa699cf2020-04-06 10:13:33 -0500290*** Keywords ***
291
292Login And Configure Hostname
293 [Documentation] Login and configure hostname
George Keishing23afcc52022-04-07 03:18:08 -0500294 [Arguments] ${ethernet_interface_uri}
Prashanth Kattifa699cf2020-04-06 10:13:33 -0500295 [Teardown] Redfish.Logout
296
George Keishing23afcc52022-04-07 03:18:08 -0500297 # Description of argument(s):
298 # ethernet_interface_uri Network interface URI path.
299
Prashanth Kattifa699cf2020-04-06 10:13:33 -0500300 Redfish.Login
301
George Keishing23afcc52022-04-07 03:18:08 -0500302 Redfish.Patch ${ethernet_interface_uri} body={'HostName': '${hostname}'}
Prashanth Kattifa699cf2020-04-06 10:13:33 -0500303 ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
304
Prashanth Katti91e59712020-04-14 08:12:09 -0500305
306Login And Create User
307 [Documentation] Login and create user
shrsuman1232b8bfca2021-11-18 05:14:23 -0600308 [Teardown] Run Keywords Redfish.Delete /redfish/v1/AccountService/Accounts/test_user
309 ... AND Redfish.Logout
310
311 Redfish.Login
312
313 ${user_info}= Create Dictionary
Megha G Nae743b82023-02-17 04:58:55 -0600314 ... UserName=test_user Password=TestPwd123 RoleId=ReadOnly Enabled=${True}
shrsuman1232b8bfca2021-11-18 05:14:23 -0600315 Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info}
316 ... valid_status_codes=[${HTTP_OK}, ${HTTP_CREATED}]
317
Megha G Nae743b82023-02-17 04:58:55 -0600318
shrsuman1232b8bfca2021-11-18 05:14:23 -0600319Login And Delete User
320 [Documentation] Login create and delete user
Prashanth Katti91e59712020-04-14 08:12:09 -0500321 [Teardown] Redfish.Logout
322
323 Redfish.Login
324
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500325 ${user_info}= Create Dictionary
Megha G Nae743b82023-02-17 04:58:55 -0600326 ... UserName=test_user Password=TestPwd123 RoleId=ReadOnly Enabled=${True}
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500327 Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info}
shrsuman1232b8bfca2021-11-18 05:14:23 -0600328 ... valid_status_codes=[${HTTP_OK}, ${HTTP_CREATED}]
329 Redfish.Delete /redfish/v1/AccountService/Accounts/test_user
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500330
Megha G Nae743b82023-02-17 04:58:55 -0600331
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500332Set Account Lockout Threshold
333 [Documentation] Set user account lockout threshold.
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500334 [Teardown] Redfish.Logout
335
336 Redfish.Login
337 Redfish.Patch /redfish/v1/AccountService body=[('AccountLockoutThreshold', 0)]
Prashanth Kattiee26d5e2021-05-21 00:38:31 -0500338
339
340Login to GUI With Incorrect Credentials
George Keishing0aeb54f2022-04-11 10:26:34 -0500341 [Documentation] Attempt to login to GUI as root, providing incorrect password argument.
Prashanth Kattiee26d5e2021-05-21 00:38:31 -0500342
rramyasr-ind1ae7fa2023-02-20 11:00:41 -0600343 Input Text ${xpath_login_username_input} root
344 Input Password ${xpath_login_password_input} incorrect_password
Prashanth Kattiee26d5e2021-05-21 00:38:31 -0500345 Click Button ${xpath_login_button}
shrsuman1232b8bfca2021-11-18 05:14:23 -0600346
Megha G Nae743b82023-02-17 04:58:55 -0600347
shrsuman1232b8bfca2021-11-18 05:14:23 -0600348Invalid Credentials Redfish Login Attempts
349 [Documentation] Continuous invalid credentials login attempts to Redfish and
350 ... login to Redfish with valid credentials at times and get failed login attempts.
351 [Arguments] ${login_username}=${OPENBMC_USERNAME} ${login_password}=${OPENBMC_PASSWORD}
352
353 # Description of argument(s):
354 # login_username username for login user.
355 # login_password password for login user.
356
357 @{failed_iter_list}= Create List
358
359 FOR ${iter} IN RANGE ${iterations}
360 Log To Console ${iter}th Redfish login with invalid credentials
361 Run Keyword And Ignore Error Redfish.Login ${login_username} incorrect_password
362 Continue For Loop If ${iter}%100 != 0
363
364 # Every 100th iteration, check Redfish is responsive.
365 ${status}= Run Keyword And Return Status
366 ... Redfish.Login ${login_username} ${login_password}
367 Run Keyword If '${status}' == 'False' Append To List ${failed_iter_list} ${iter}
368 Redfish.Logout
369 END
370 Log ${failed_iter_list}
371 ${fail_count}= Get Length ${failed_iter_list}
372 Run Keyword If ${fail_count} > ${0} FAIL Could not Login to Redfish ${fail_count} times
Gene Ratzlaff05a29c82022-05-13 11:43:25 -0400373
374
375Confirm Ability to Connect Then Close All Connections
376 [Documentation] Confirm that SSH login works, otherwise, skip this test.
377 ... If login succeeds, close all SSH connections to BMC to prepare for test.
378
379 SSHLibrary.Close All Connections
380 SSHLibrary.Open Connection ${OPENBMC_HOST}
381 ${status}= Run Keyword And Return Status
382 ... SSHLibrary.Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
383 Skip If ${status} == ${False} msg= SSH Login failed: test will be skipped
384 SSHLibrary.Close All Connections
Megha G Nae743b82023-02-17 04:58:55 -0600385
386
387Login And Upload Partition File To BMC
388 [Documentation] Upload partition file to BMC.
389
390 Create Partition File
391 Initialize OpenBMC
392
393 # Get the content of the file and upload to BMC.
394 ${image_data}= OperatingSystem.Get Binary File 100-file
395 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN} Content-Type=application/octet-stream
396
397 ${kwargs}= Create Dictionary data=${image_data}
398 Set To Dictionary ${kwargs} headers ${headers}
Megha G N0af9eb02023-03-02 00:35:09 -0600399 ${resp}= PUT On Session openbmc ${OEM_HOST_CONFIG_URI}/100-file &{kwargs} timeout=10
Megha G Nae743b82023-02-17 04:58:55 -0600400 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
401 Delete Local Partition File
402
403
404Delete Local Partition File
405 [Documentation] Delete local partition file.
406
407 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist 100-file
408 Run Keyword If 'True' == '${file_exist}' Remove File 100-file
409
410
411Create Partition File
412 [Documentation] Create Partition file.
413
414 Delete Local Partition File
415
416 @{words}= Split String 100-file -
417 Run dd if=/dev/zero of=100-file bs=${words}[-0] count=1
418 OperatingSystem.File Should Exist 100-file
419
420
421Delete All BMC Partition File
422 [Documentation] Delete multiple partition file on BMC via Redfish.
423
424 Initialize OpenBMC
425 ${data}= Create Dictionary
426 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
427 Set To Dictionary ${data} headers ${headers}
428
Megha G N0af9eb02023-03-02 00:35:09 -0600429 ${resp}= POST On Session openbmc ${OEM_HOST_CONFIG_ACTIONS_URI}.DeleteAll &{data}
Megha G Nae743b82023-02-17 04:58:55 -0600430 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
431
432 Delete All Sessions