blob: 50ff40f46ceca3b34dfb23be7e3711abdbafe96f [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
Matt Fischer6fb70d92023-10-24 19:06:33 -060026Test 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.
Sridevi Rameshdadf09f2025-10-13 05:32:28 -050066 IF ${iter} % 100 == 0
67 ${status}= Run Keyword And Return Status
68 ... Login And Configure Hostname ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
69 IF ${status} == False Append To List ${fail_list} ${iter}
70 END
Prashanth Kattifa699cf2020-04-06 10:13:33 -050071 END
72 ${verify_count}= Evaluate ${iterations}/100
George Keishing23afcc52022-04-07 03:18:08 -050073 ${fail_count}= Get Length ${fail_list}
Prashanth Kattifa699cf2020-04-06 10:13:33 -050074
George Keishing23afcc52022-04-07 03:18:08 -050075 Should Be Equal As Integers ${fail_count} ${0}
76 ... msg=Patch operation failed ${fail_count} times in ${verify_count} attempts; fails at iterations ${fail_list}
Prashanth Kattifa699cf2020-04-06 10:13:33 -050077
78
George Keishing4fb89c12022-01-06 22:29:33 -060079Verify User Cannot Login After 5 Non-Logged In Sessions
Anvesh Kumar Rayankula85df1372020-04-28 05:01:14 -050080 [Documentation] User should not be able to login when there
81 ... are 5 non-logged in sessions.
82 [Tags] Verify_User_Cannot_Login_After_5_Non-Logged_In_Sessions
Gene Ratzlaff05a29c82022-05-13 11:43:25 -040083 [Setup] Confirm Ability to Connect Then Close All Connections
84 [Teardown] Run Keywords Process.Terminate All Processes AND
85 ... SSHLibrary.Close All Connections AND FFDC On Test Case Fail
Anvesh Kumar Rayankula85df1372020-04-28 05:01:14 -050086
George Keishing23afcc52022-04-07 03:18:08 -050087 FOR ${iter} IN RANGE ${0} ${MAX_UNAUTH_PER_IP}
Anvesh Kumar Rayankula85df1372020-04-28 05:01:14 -050088 SSHLibrary.Open Connection ${OPENBMC_HOST}
89 Start Process ssh ${OPENBMC_USERNAME}@${OPENBMC_HOST} shell=True
90 END
91
92 SSHLibrary.Open Connection ${OPENBMC_HOST}
93 ${status}= Run Keyword And Return Status SSHLibrary.Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
Prashanth Katti91e59712020-04-14 08:12:09 -050094
Anvesh Kumar Rayankula85df1372020-04-28 05:01:14 -050095 Should Be Equal ${status} ${False}
96
97
Prashanth Katti91e59712020-04-14 08:12:09 -050098Test Post Without Auth Token Fails
99 [Documentation] Send post method without auth token and verify it throws an error.
100 [Tags] Test_Post_Without_Auth_Token_Fails
101
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500102 ${user_info}= Create Dictionary
103 ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True}
Prashanth Katti91e59712020-04-14 08:12:09 -0500104 Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info}
105 ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}]
106
107
108Flood Post Without Auth Token And Check Stability Of BMC
109 [Documentation] Flood post method without auth token and check BMC stability.
110 [Tags] Flood_Post_Without_Auth_Token_And_Check_Stability_Of_BMC
111
George Keishing23afcc52022-04-07 03:18:08 -0500112 @{fail_list}= Create List
113
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500114 ${user_info}= Create Dictionary
115 ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True}
Prashanth Katti91e59712020-04-14 08:12:09 -0500116
George Keishing23afcc52022-04-07 03:18:08 -0500117 FOR ${iter} IN RANGE ${1} ${iterations} + 1
118 Log To Console ${iter}th iteration Post Request without valid session token
119 # Expected valid fail status response code.
120 Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info}
121 ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}]
Prashanth Katti91e59712020-04-14 08:12:09 -0500122
123 # Every 100th iteration, check BMC allows post with auth token.
Sridevi Rameshdadf09f2025-10-13 05:32:28 -0500124 IF ${iter} % 100 == 0
125 ${status}= Run Keyword And Return Status Login And Create User
126 IF ${status} == False Append To List ${fail_list} ${iter}
127 END
Prashanth Katti91e59712020-04-14 08:12:09 -0500128 END
129 ${verify_count}= Evaluate ${iterations}/100
George Keishing23afcc52022-04-07 03:18:08 -0500130 ${fail_count}= Get Length ${fail_list}
Prashanth Katti91e59712020-04-14 08:12:09 -0500131
George Keishing23afcc52022-04-07 03:18:08 -0500132 Should Be Equal As Integers ${fail_count} ${0}
133 ... msg=Post operation failed ${fail_count} times in ${verify_count} attempts; fails at iterations ${fail_list}
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500134
135
136Make Large Number Of Wrong SSH Login Attempts And Check Stability
137 [Documentation] Check BMC stability with large number of SSH wrong login requests.
138 [Tags] Make_Large_Number_Of_Wrong_SSH_Login_Attempts_And_Check_Stability
139 [Setup] Set Account Lockout Threshold
140 [Teardown] FFDC On Test Case Fail
141
142 SSHLibrary.Open Connection ${OPENBMC_HOST}
143 @{ssh_status_list}= Create List
Gene Ratzlafffde32cf2022-05-06 15:21:31 -0400144 FOR ${iter} IN RANGE ${1} ${loop_iteration} + 1
George Keishing23afcc52022-04-07 03:18:08 -0500145 Log To Console ${iter}th iteration
146 ${invalid_password}= Catenate ${OPENBMC_PASSWORD}${iter}
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500147 Run Keyword and Ignore Error
148 ... Open Connection And Log In ${OPENBMC_USERNAME} ${invalid_password}
149
150 # Every 100th iteration Login with correct credentials
Sridevi Rameshdadf09f2025-10-13 05:32:28 -0500151 IF ${iter} % ${100} == ${0}
152 ${status}= Run Keyword And Return Status
153 ... Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
154 IF ${status} == ${False} Append To List ${ssh_status_list} ${status}
155 END
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500156 SSHLibrary.Close Connection
157 END
158
159 ${valid_login_count}= Evaluate ${iterations}/100
160 ${fail_count}= Get Length ${ssh_status_list}
161 Should Be Equal ${fail_count} ${0}
162 ... msg= Login Failed ${fail_count} times in ${valid_login_count} attempts.
Prashanth Katti91e59712020-04-14 08:12:09 -0500163
164
Prashanth Kattiee26d5e2021-05-21 00:38:31 -0500165Test Stability On Large Number Of Wrong Login Attempts To GUI
166 [Documentation] Test stability on large number of wrong login attempts to GUI.
167 [Tags] Test_Stability_On_Large_Number_Of_Wrong_Login_Attempts_To_GUI
168
169 @{status_list}= Create List
170
171 # Open headless browser.
172 Start Virtual Display
173 ${browser_ID}= Open Browser ${bmc_url} alias=browser1
174 Set Window Size 1920 1080
175
176 Go To ${bmc_url}
177
George Keishing23afcc52022-04-07 03:18:08 -0500178 FOR ${iter} IN RANGE ${1} ${iterations} + 1
179 Log To Console ${iter}th login
George Keishingfef9aa92022-04-08 08:45:42 -0500180 Run Keyword And Ignore Error Login to GUI With Incorrect Credentials
Prashanth Kattiee26d5e2021-05-21 00:38:31 -0500181
182 # Every 100th iteration, check BMC GUI is responsive.
Sridevi Rameshdadf09f2025-10-13 05:32:28 -0500183 IF ${iter} % 100 == 0
184 ${status}= Run Keyword And Return Status Open Browser ${bmc_url}
185 END
Prashanth Kattiee26d5e2021-05-21 00:38:31 -0500186 Append To List ${status_list} ${status}
Sridevi Rameshdadf09f2025-10-13 05:32:28 -0500187 IF '${status}' == 'True'
188 Run Keywords Close Browser AND Switch Browser browser1
189 END
Prashanth Kattiee26d5e2021-05-21 00:38:31 -0500190 END
191
192 ${fail_count}= Count Values In List ${status_list} False
Sridevi Rameshdadf09f2025-10-13 05:32:28 -0500193 IF ${fail_count} > ${0} FAIL Could not open BMC GUI ${fail_count} times
Prashanth Kattiee26d5e2021-05-21 00:38:31 -0500194
Megha G Nae743b82023-02-17 04:58:55 -0600195
shrsuman123b844a872021-12-21 05:49:41 -0600196Test BMC GUI Stability On Continuous Refresh Of GUI Home Page
197 [Documentation] Login to BMC GUI and keep refreshing home page and verify stability
198 ... by login at times in another browser.
199 [Tags] Test_BMC_GUI_Stability_On_Continuous_Refresh_Of_GUI_Home_Page
200 [Teardown] Close All Browsers
201
202 @{failed_list}= Create List
203
204 # Open headless browser.
205 Start Virtual Display
206 ${browser_ID}= Open Browser ${bmc_url} alias=browser1
207 Set Window Size 1920 1080
208 Login GUI
209
210 FOR ${iter} IN RANGE ${iterations}
211 Log To Console ${iter}th Refresh of home page
212
213 Refresh GUI
Sridevi Rameshac155722025-05-02 05:09:40 -0500214 IF ${iter}%100 != 0 CONTINUE
shrsuman123b844a872021-12-21 05:49:41 -0600215
216 # Every 100th iteration, check BMC GUI is responsive.
217 ${status}= Run Keyword And Return Status
218 ... Run Keywords Launch Browser And Login GUI AND Logout GUI
Sridevi Rameshdadf09f2025-10-13 05:32:28 -0500219 IF '${status}' == 'False'
220 Append To List ${failed_list} ${iter}
221 ELSE
222 Run Keywords Close Browser AND Switch Browser browser1
223 END
shrsuman123b844a872021-12-21 05:49:41 -0600224 END
225 Log ${failed_list}
226 ${fail_count}= Get Length ${failed_list}
Sridevi Rameshdadf09f2025-10-13 05:32:28 -0500227 IF ${fail_count} > ${0} FAIL Could not open BMC GUI ${fail_count} times
Prashanth Kattiee26d5e2021-05-21 00:38:31 -0500228
Megha G Nae743b82023-02-17 04:58:55 -0600229
shrsuman1232b8bfca2021-11-18 05:14:23 -0600230Test BMCweb Stability On Continuous Redfish Login Attempts With Invalid Credentials
231 [Documentation] Make invalid credentials Redfish login attempts continuously and
232 ... verify bmcweb stability by login to Redfish with valid credentials.
233 [Tags] Test_BMCweb_Stability_On_Continuous_Redfish_Login_Attempts_With_Invalid_Credentials
234
235 Invalid Credentials Redfish Login Attempts
236
Megha G Nae743b82023-02-17 04:58:55 -0600237
shrsuman1232b8bfca2021-11-18 05:14:23 -0600238Test User Delete Operation Without Session Token And Expect Failure
239 [Documentation] Try to delete an object without valid session token and verifies it throws
240 ... an unauthorised error.
241 [Tags] Test_User_Delete_Operation_Without_Session_Token_And_Expect_Failure
242 [Setup] Redfish.Logout
243
244 Redfish.Delete /redfish/v1/AccountService/Accounts/test_user
245 ... valid_status_codes=[${HTTP_UNAUTHORIZED}]
246
247
248Test Bmcweb Stability On Continuous Redfish Delete Operation Request Without Session Token
249 [Documentation] Send delete object request without valid session token continuously and
250 ... verify bmcweb stability by sending delete request with valid session token.
251 [Tags] Test_Bmcweb_Stability_On_Continuous_Redfish_Delete_Operation_Request_Without_Session_Token
252
253 @{failed_iter_list}= Create List
254
255 FOR ${iter} IN RANGE ${iterations}
256 Log To Console ${iter}th Redfish Delete Object Request without valid session token
257
258 Run Keyword And Ignore Error
259 ... Redfish.Delete /redfish/v1/AccountService/Accounts/test_user
Sridevi Rameshac155722025-05-02 05:09:40 -0500260 IF ${iter}%100 != 0 CONTINUE
shrsuman1232b8bfca2021-11-18 05:14:23 -0600261
262 # Every 100th iteration, check delete operation with valid session token.
263 ${status}= Run Keyword And Return Status
264 ... Login And Delete User
Sridevi Rameshdadf09f2025-10-13 05:32:28 -0500265 IF '${status}' == 'False' Append To List ${failed_iter_list} ${iter}
shrsuman1232b8bfca2021-11-18 05:14:23 -0600266 END
267 Log ${failed_iter_list}
268 ${fail_count}= Get Length ${failed_iter_list}
Sridevi Rameshdadf09f2025-10-13 05:32:28 -0500269 IF ${fail_count} > ${0} FAIL Could not do Redfish delete operation ${fail_count} times
shrsuman1232b8bfca2021-11-18 05:14:23 -0600270
Megha G Nae743b82023-02-17 04:58:55 -0600271
272Verify Flood Put Method Without Auth Token
273 [Documentation] Flood put method without auth token and check BMC stability.
274 [Tags] Verify_Flood_Put_Method_Without_Auth_Token
275 [Teardown] Delete All BMC Partition File
276
277 @{status_list}= Create List
278
279 FOR ${iter} IN RANGE ${1} ${iterations}
Sridevi Rameshdadf09f2025-10-13 05:32:28 -0500280
Megha G Nae743b82023-02-17 04:58:55 -0600281 Log To Console ${iter}th iteration
282 Run Keyword And Ignore Error
283 ... Redfish.Put ${LED_LAMP_TEST_ASSERTED_URI}attr/Asserted body={"data":1}
Sridevi Rameshdadf09f2025-10-13 05:32:28 -0500284
Megha G Nae743b82023-02-17 04:58:55 -0600285 # Every 100th iteration, check BMC allows put with auth token.
Sridevi Rameshdadf09f2025-10-13 05:32:28 -0500286 IF ${iter} % 100 == 0
287 ${status}= Run Keyword And Return Status Login And Upload Partition File To BMC
288 IF ${status} == ${False} Append To List ${status_list} ${status}
289 END
290
Megha G Nae743b82023-02-17 04:58:55 -0600291 END
292
293 # Note the count for every 100 iterations.
294 ${verify_count}= Evaluate ${iterations}/100
295 ${fail_count}= Get Length ${status_list}
296
297 Should Be Equal ${fail_count} ${0}
298 ... msg=Put operation failed ${fail_count} times in ${verify_count} attempts.
299
300
Prashanth Kattifa699cf2020-04-06 10:13:33 -0500301*** Keywords ***
302
303Login And Configure Hostname
304 [Documentation] Login and configure hostname
George Keishing23afcc52022-04-07 03:18:08 -0500305 [Arguments] ${ethernet_interface_uri}
Prashanth Kattifa699cf2020-04-06 10:13:33 -0500306 [Teardown] Redfish.Logout
307
George Keishing23afcc52022-04-07 03:18:08 -0500308 # Description of argument(s):
309 # ethernet_interface_uri Network interface URI path.
310
Prashanth Kattifa699cf2020-04-06 10:13:33 -0500311 Redfish.Login
312
George Keishing23afcc52022-04-07 03:18:08 -0500313 Redfish.Patch ${ethernet_interface_uri} body={'HostName': '${hostname}'}
Prashanth Kattifa699cf2020-04-06 10:13:33 -0500314 ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
315
Prashanth Katti91e59712020-04-14 08:12:09 -0500316
317Login And Create User
318 [Documentation] Login and create user
shrsuman1232b8bfca2021-11-18 05:14:23 -0600319 [Teardown] Run Keywords Redfish.Delete /redfish/v1/AccountService/Accounts/test_user
320 ... AND Redfish.Logout
321
322 Redfish.Login
323
324 ${user_info}= Create Dictionary
Megha G Nae743b82023-02-17 04:58:55 -0600325 ... UserName=test_user Password=TestPwd123 RoleId=ReadOnly Enabled=${True}
shrsuman1232b8bfca2021-11-18 05:14:23 -0600326 Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info}
327 ... valid_status_codes=[${HTTP_OK}, ${HTTP_CREATED}]
328
Megha G Nae743b82023-02-17 04:58:55 -0600329
shrsuman1232b8bfca2021-11-18 05:14:23 -0600330Login And Delete User
331 [Documentation] Login create and delete user
Prashanth Katti91e59712020-04-14 08:12:09 -0500332 [Teardown] Redfish.Logout
333
334 Redfish.Login
335
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500336 ${user_info}= Create Dictionary
Megha G Nae743b82023-02-17 04:58:55 -0600337 ... UserName=test_user Password=TestPwd123 RoleId=ReadOnly Enabled=${True}
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500338 Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info}
shrsuman1232b8bfca2021-11-18 05:14:23 -0600339 ... valid_status_codes=[${HTTP_OK}, ${HTTP_CREATED}]
340 Redfish.Delete /redfish/v1/AccountService/Accounts/test_user
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500341
Megha G Nae743b82023-02-17 04:58:55 -0600342
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500343Set Account Lockout Threshold
344 [Documentation] Set user account lockout threshold.
Anvesh Kumar Rayankula3cddd032020-03-26 04:16:13 -0500345 [Teardown] Redfish.Logout
346
347 Redfish.Login
348 Redfish.Patch /redfish/v1/AccountService body=[('AccountLockoutThreshold', 0)]
Prashanth Kattiee26d5e2021-05-21 00:38:31 -0500349
350
351Login to GUI With Incorrect Credentials
George Keishing0aeb54f2022-04-11 10:26:34 -0500352 [Documentation] Attempt to login to GUI as root, providing incorrect password argument.
Prashanth Kattiee26d5e2021-05-21 00:38:31 -0500353
rramyasr-ind1ae7fa2023-02-20 11:00:41 -0600354 Input Text ${xpath_login_username_input} root
355 Input Password ${xpath_login_password_input} incorrect_password
Prashanth Kattiee26d5e2021-05-21 00:38:31 -0500356 Click Button ${xpath_login_button}
shrsuman1232b8bfca2021-11-18 05:14:23 -0600357
Megha G Nae743b82023-02-17 04:58:55 -0600358
shrsuman1232b8bfca2021-11-18 05:14:23 -0600359Invalid Credentials Redfish Login Attempts
360 [Documentation] Continuous invalid credentials login attempts to Redfish and
361 ... login to Redfish with valid credentials at times and get failed login attempts.
362 [Arguments] ${login_username}=${OPENBMC_USERNAME} ${login_password}=${OPENBMC_PASSWORD}
363
364 # Description of argument(s):
365 # login_username username for login user.
366 # login_password password for login user.
367
368 @{failed_iter_list}= Create List
369
370 FOR ${iter} IN RANGE ${iterations}
371 Log To Console ${iter}th Redfish login with invalid credentials
372 Run Keyword And Ignore Error Redfish.Login ${login_username} incorrect_password
Sridevi Rameshac155722025-05-02 05:09:40 -0500373 IF ${iter}%100 != 0 CONTINUE
shrsuman1232b8bfca2021-11-18 05:14:23 -0600374
375 # Every 100th iteration, check Redfish is responsive.
376 ${status}= Run Keyword And Return Status
377 ... Redfish.Login ${login_username} ${login_password}
Sridevi Rameshdadf09f2025-10-13 05:32:28 -0500378 IF '${status}' == 'False' Append To List ${failed_iter_list} ${iter}
shrsuman1232b8bfca2021-11-18 05:14:23 -0600379 Redfish.Logout
380 END
381 Log ${failed_iter_list}
382 ${fail_count}= Get Length ${failed_iter_list}
Sridevi Rameshdadf09f2025-10-13 05:32:28 -0500383 IF ${fail_count} > ${0} FAIL Could not Login to Redfish ${fail_count} times
Gene Ratzlaff05a29c82022-05-13 11:43:25 -0400384
385
386Confirm Ability to Connect Then Close All Connections
387 [Documentation] Confirm that SSH login works, otherwise, skip this test.
388 ... If login succeeds, close all SSH connections to BMC to prepare for test.
389
390 SSHLibrary.Close All Connections
391 SSHLibrary.Open Connection ${OPENBMC_HOST}
392 ${status}= Run Keyword And Return Status
393 ... SSHLibrary.Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
394 Skip If ${status} == ${False} msg= SSH Login failed: test will be skipped
395 SSHLibrary.Close All Connections
Megha G Nae743b82023-02-17 04:58:55 -0600396
397
398Login And Upload Partition File To BMC
399 [Documentation] Upload partition file to BMC.
400
401 Create Partition File
402 Initialize OpenBMC
403
404 # Get the content of the file and upload to BMC.
405 ${image_data}= OperatingSystem.Get Binary File 100-file
406 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN} Content-Type=application/octet-stream
407
408 ${kwargs}= Create Dictionary data=${image_data}
409 Set To Dictionary ${kwargs} headers ${headers}
Megha G N0af9eb02023-03-02 00:35:09 -0600410 ${resp}= PUT On Session openbmc ${OEM_HOST_CONFIG_URI}/100-file &{kwargs} timeout=10
Megha G Nae743b82023-02-17 04:58:55 -0600411 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
412 Delete Local Partition File
413
414
415Delete Local Partition File
416 [Documentation] Delete local partition file.
417
418 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist 100-file
Sridevi Rameshdadf09f2025-10-13 05:32:28 -0500419 IF 'True' == '${file_exist}' Remove File 100-file
Megha G Nae743b82023-02-17 04:58:55 -0600420
421
422Create Partition File
423 [Documentation] Create Partition file.
424
425 Delete Local Partition File
426
427 @{words}= Split String 100-file -
428 Run dd if=/dev/zero of=100-file bs=${words}[-0] count=1
429 OperatingSystem.File Should Exist 100-file
430
431
432Delete All BMC Partition File
433 [Documentation] Delete multiple partition file on BMC via Redfish.
434
435 Initialize OpenBMC
436 ${data}= Create Dictionary
437 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
438 Set To Dictionary ${data} headers ${headers}
439
Megha G N0af9eb02023-03-02 00:35:09 -0600440 ${resp}= POST On Session openbmc ${OEM_HOST_CONFIG_ACTIONS_URI}.DeleteAll &{data}
Megha G Nae743b82023-02-17 04:58:55 -0600441 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
442
443 Delete All Sessions