Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Connections and authentication module stability tests. |
| 3 | |
| 4 | Resource ../lib/bmc_redfish_resource.robot |
| 5 | Resource ../lib/bmc_network_utils.robot |
| 6 | Resource ../lib/openbmc_ffdc.robot |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 7 | Resource ../lib/resource.robot |
| 8 | Resource ../lib/utils.robot |
| 9 | Resource ../lib/connection_client.robot |
shrsuman123 | b844a87 | 2021-12-21 05:49:41 -0600 | [diff] [blame] | 10 | Resource ../gui/lib/gui_resource.robot |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 11 | Library ../lib/bmc_network_utils.py |
| 12 | |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 13 | Library SSHLibrary |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 14 | Library Collections |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 15 | Library XvfbRobot |
| 16 | Library OperatingSystem |
George Keishing | 47d1e8e | 2022-02-17 10:38:49 -0600 | [diff] [blame] | 17 | Library SeleniumLibrary 120 120 |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 18 | Library Telnet 30 Seconds |
| 19 | Library Screenshot |
| 20 | |
shrsuman123 | a8ca296 | 2022-01-07 03:30:08 -0600 | [diff] [blame] | 21 | |
| 22 | Suite Setup Redfish.Logout |
| 23 | |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 24 | Variables ../gui/data/gui_variables.py |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 25 | |
| 26 | *** Variables *** |
| 27 | |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 28 | ${iterations} 10000 |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 29 | ${loop_iteration} ${1000} |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 30 | ${hostname} test_hostname |
| 31 | ${MAX_UNAUTH_PER_IP} ${5} |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 32 | ${bmc_url} https://${OPENBMC_HOST} |
| 33 | |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 34 | |
| 35 | *** Test Cases *** |
| 36 | |
| 37 | Test Patch Without Auth Token Fails |
| 38 | [Documentation] Send patch method without auth token and verify it throws an error. |
George Keishing | 966a4c5 | 2020-05-13 10:53:58 -0500 | [diff] [blame] | 39 | [Tags] Test_Patch_Without_Auth_Token_Fails |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 40 | |
Anves Kumar rayankula | 816d3ce | 2021-06-13 23:55:41 -0500 | [diff] [blame] | 41 | ${active_channel_config}= Get Active Channel Config |
| 42 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 43 | |
| 44 | Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body={'HostName': '${hostname}'} |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 45 | ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}] |
| 46 | |
| 47 | |
| 48 | Flood Patch Without Auth Token And Check Stability Of BMC |
| 49 | [Documentation] Flood patch method without auth token and check BMC stability. |
| 50 | [Tags] Flood_Patch_Without_Auth_Token_And_Check_Stability_Of_BMC |
| 51 | @{status_list}= Create List |
| 52 | |
Anves Kumar rayankula | 816d3ce | 2021-06-13 23:55:41 -0500 | [diff] [blame] | 53 | ${active_channel_config}= Get Active Channel Config |
| 54 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 55 | |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 56 | FOR ${i} IN RANGE ${1} ${iterations} |
| 57 | Log To Console ${i}th iteration |
| 58 | Run Keyword And Ignore Error |
Anves Kumar rayankula | 816d3ce | 2021-06-13 23:55:41 -0500 | [diff] [blame] | 59 | ... Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body={'HostName': '${hostname}'} |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 60 | |
| 61 | # Every 100th iteration, check BMC allows patch with auth token. |
| 62 | ${status}= Run Keyword If ${i} % 100 == 0 Run Keyword And Return Status |
| 63 | ... Login And Configure Hostname |
| 64 | Run Keyword If ${status} == False Append To List ${status_list} ${status} |
| 65 | END |
| 66 | ${verify_count}= Evaluate ${iterations}/100 |
| 67 | ${fail_count}= Get Length ${status_list} |
| 68 | |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 69 | Should Be Equal ${fail_count} 0 |
| 70 | ... msg=Patch operation failed ${fail_count} times in ${verify_count} attempts |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 71 | |
| 72 | |
George Keishing | 4fb89c1 | 2022-01-06 22:29:33 -0600 | [diff] [blame] | 73 | Verify User Cannot Login After 5 Non-Logged In Sessions |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 74 | [Documentation] User should not be able to login when there |
| 75 | ... are 5 non-logged in sessions. |
| 76 | [Tags] Verify_User_Cannot_Login_After_5_Non-Logged_In_Sessions |
| 77 | |
| 78 | FOR ${i} IN RANGE ${0} ${MAX_UNAUTH_PER_IP} |
| 79 | SSHLibrary.Open Connection ${OPENBMC_HOST} |
| 80 | Start Process ssh ${OPENBMC_USERNAME}@${OPENBMC_HOST} shell=True |
| 81 | END |
| 82 | |
| 83 | SSHLibrary.Open Connection ${OPENBMC_HOST} |
| 84 | ${status}= Run Keyword And Return Status SSHLibrary.Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 85 | |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 86 | Should Be Equal ${status} ${False} |
| 87 | |
| 88 | |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 89 | Test Post Without Auth Token Fails |
| 90 | [Documentation] Send post method without auth token and verify it throws an error. |
| 91 | [Tags] Test_Post_Without_Auth_Token_Fails |
| 92 | |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 93 | ${user_info}= Create Dictionary |
| 94 | ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True} |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 95 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info} |
| 96 | ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}] |
| 97 | |
| 98 | |
| 99 | Flood Post Without Auth Token And Check Stability Of BMC |
| 100 | [Documentation] Flood post method without auth token and check BMC stability. |
| 101 | [Tags] Flood_Post_Without_Auth_Token_And_Check_Stability_Of_BMC |
| 102 | |
| 103 | @{status_list}= Create List |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 104 | ${user_info}= Create Dictionary |
| 105 | ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True} |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 106 | |
| 107 | FOR ${i} IN RANGE ${1} ${iterations} |
| 108 | Log To Console ${i}th iteration |
| 109 | Run Keyword And Ignore Error |
| 110 | ... Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info} |
| 111 | |
| 112 | # Every 100th iteration, check BMC allows post with auth token. |
| 113 | ${status}= Run Keyword If ${i} % 100 == 0 Run Keyword And Return Status |
| 114 | ... Login And Create User |
| 115 | Run Keyword If ${status} == False Append To List ${status_list} ${status} |
| 116 | END |
| 117 | ${verify_count}= Evaluate ${iterations}/100 |
| 118 | ${fail_count}= Get Length ${status_list} |
| 119 | |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 120 | Should Be Equal ${fail_count} 0 |
| 121 | ... msg=Post operation failed ${fail_count} times in ${verify_count} attempts |
| 122 | |
| 123 | |
| 124 | Make Large Number Of Wrong SSH Login Attempts And Check Stability |
| 125 | [Documentation] Check BMC stability with large number of SSH wrong login requests. |
| 126 | [Tags] Make_Large_Number_Of_Wrong_SSH_Login_Attempts_And_Check_Stability |
| 127 | [Setup] Set Account Lockout Threshold |
| 128 | [Teardown] FFDC On Test Case Fail |
| 129 | |
| 130 | SSHLibrary.Open Connection ${OPENBMC_HOST} |
| 131 | @{ssh_status_list}= Create List |
| 132 | FOR ${i} IN RANGE ${loop_iteration} |
| 133 | Log To Console ${i}th iteration |
| 134 | ${invalid_password}= Catenate ${OPENBMC_PASSWORD}${i} |
| 135 | Run Keyword and Ignore Error |
| 136 | ... Open Connection And Log In ${OPENBMC_USERNAME} ${invalid_password} |
| 137 | |
| 138 | # Every 100th iteration Login with correct credentials |
| 139 | ${status}= Run keyword If ${i} % ${100} == ${0} Run Keyword And Return Status |
| 140 | ... Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 141 | Run Keyword If ${status} == ${False} Append To List ${ssh_status_list} ${status} |
| 142 | SSHLibrary.Close Connection |
| 143 | END |
| 144 | |
| 145 | ${valid_login_count}= Evaluate ${iterations}/100 |
| 146 | ${fail_count}= Get Length ${ssh_status_list} |
| 147 | Should Be Equal ${fail_count} ${0} |
| 148 | ... msg= Login Failed ${fail_count} times in ${valid_login_count} attempts. |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 149 | |
| 150 | |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 151 | Test Stability On Large Number Of Wrong Login Attempts To GUI |
| 152 | [Documentation] Test stability on large number of wrong login attempts to GUI. |
| 153 | [Tags] Test_Stability_On_Large_Number_Of_Wrong_Login_Attempts_To_GUI |
| 154 | |
| 155 | @{status_list}= Create List |
| 156 | |
| 157 | # Open headless browser. |
| 158 | Start Virtual Display |
| 159 | ${browser_ID}= Open Browser ${bmc_url} alias=browser1 |
| 160 | Set Window Size 1920 1080 |
| 161 | |
| 162 | Go To ${bmc_url} |
| 163 | |
| 164 | FOR ${i} IN RANGE ${1} ${iterations} |
| 165 | Log To Console ${i}th login |
| 166 | Run Keyword And Ignore Error Login to GUI With Wrong Credentials |
| 167 | |
| 168 | # Every 100th iteration, check BMC GUI is responsive. |
| 169 | ${status}= Run Keyword If ${i} % 100 == 0 Run Keyword And Return Status |
| 170 | ... Open Browser ${bmc_url} |
| 171 | Append To List ${status_list} ${status} |
George Keishing | 47d1e8e | 2022-02-17 10:38:49 -0600 | [diff] [blame] | 172 | Run Keyword If '${status}' == 'True' |
| 173 | ... Run Keywords Close Browser AND Switch Browser browser1 |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 174 | END |
| 175 | |
| 176 | ${fail_count}= Count Values In List ${status_list} False |
| 177 | Run Keyword If ${fail_count} > ${0} FAIL Could not open BMC GUI ${fail_count} times |
| 178 | |
shrsuman123 | b844a87 | 2021-12-21 05:49:41 -0600 | [diff] [blame] | 179 | Test BMC GUI Stability On Continuous Refresh Of GUI Home Page |
| 180 | [Documentation] Login to BMC GUI and keep refreshing home page and verify stability |
| 181 | ... by login at times in another browser. |
| 182 | [Tags] Test_BMC_GUI_Stability_On_Continuous_Refresh_Of_GUI_Home_Page |
| 183 | [Teardown] Close All Browsers |
| 184 | |
| 185 | @{failed_list}= Create List |
| 186 | |
| 187 | # Open headless browser. |
| 188 | Start Virtual Display |
| 189 | ${browser_ID}= Open Browser ${bmc_url} alias=browser1 |
| 190 | Set Window Size 1920 1080 |
| 191 | Login GUI |
| 192 | |
| 193 | FOR ${iter} IN RANGE ${iterations} |
| 194 | Log To Console ${iter}th Refresh of home page |
| 195 | |
| 196 | Refresh GUI |
| 197 | Continue For Loop If ${iter}%100 != 0 |
| 198 | |
| 199 | # Every 100th iteration, check BMC GUI is responsive. |
| 200 | ${status}= Run Keyword And Return Status |
| 201 | ... Run Keywords Launch Browser And Login GUI AND Logout GUI |
| 202 | Run Keyword If '${status}' == 'False' Append To List ${failed_list} ${iter} |
| 203 | ... ELSE IF '${status}' == 'True' |
| 204 | ... Run Keywords Close Browser AND Switch Browser browser1 |
| 205 | END |
| 206 | Log ${failed_list} |
| 207 | ${fail_count}= Get Length ${failed_list} |
| 208 | Run Keyword If ${fail_count} > ${0} FAIL Could not open BMC GUI ${fail_count} times |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 209 | |
shrsuman123 | 2b8bfca | 2021-11-18 05:14:23 -0600 | [diff] [blame^] | 210 | Test BMCweb Stability On Continuous Redfish Login Attempts With Invalid Credentials |
| 211 | [Documentation] Make invalid credentials Redfish login attempts continuously and |
| 212 | ... verify bmcweb stability by login to Redfish with valid credentials. |
| 213 | [Tags] Test_BMCweb_Stability_On_Continuous_Redfish_Login_Attempts_With_Invalid_Credentials |
| 214 | |
| 215 | Invalid Credentials Redfish Login Attempts |
| 216 | |
| 217 | Test User Delete Operation Without Session Token And Expect Failure |
| 218 | [Documentation] Try to delete an object without valid session token and verifies it throws |
| 219 | ... an unauthorised error. |
| 220 | [Tags] Test_User_Delete_Operation_Without_Session_Token_And_Expect_Failure |
| 221 | [Setup] Redfish.Logout |
| 222 | |
| 223 | Redfish.Delete /redfish/v1/AccountService/Accounts/test_user |
| 224 | ... valid_status_codes=[${HTTP_UNAUTHORIZED}] |
| 225 | |
| 226 | |
| 227 | Test Bmcweb Stability On Continuous Redfish Delete Operation Request Without Session Token |
| 228 | [Documentation] Send delete object request without valid session token continuously and |
| 229 | ... verify bmcweb stability by sending delete request with valid session token. |
| 230 | [Tags] Test_Bmcweb_Stability_On_Continuous_Redfish_Delete_Operation_Request_Without_Session_Token |
| 231 | |
| 232 | @{failed_iter_list}= Create List |
| 233 | |
| 234 | FOR ${iter} IN RANGE ${iterations} |
| 235 | Log To Console ${iter}th Redfish Delete Object Request without valid session token |
| 236 | |
| 237 | Run Keyword And Ignore Error |
| 238 | ... Redfish.Delete /redfish/v1/AccountService/Accounts/test_user |
| 239 | Continue For Loop If ${iter}%100 != 0 |
| 240 | |
| 241 | # Every 100th iteration, check delete operation with valid session token. |
| 242 | ${status}= Run Keyword And Return Status |
| 243 | ... Login And Delete User |
| 244 | Run Keyword If '${status}' == 'False' Append To List ${failed_iter_list} ${iter} |
| 245 | END |
| 246 | Log ${failed_iter_list} |
| 247 | ${fail_count}= Get Length ${failed_iter_list} |
| 248 | Run Keyword If ${fail_count} > ${0} FAIL Could not do Redfish delete operation ${fail_count} times |
| 249 | |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 250 | *** Keywords *** |
| 251 | |
| 252 | Login And Configure Hostname |
| 253 | [Documentation] Login and configure hostname |
| 254 | |
| 255 | [Teardown] Redfish.Logout |
| 256 | |
| 257 | Redfish.Login |
| 258 | |
| 259 | Redfish.patch ${REDFISH_NW_PROTOCOL_URI} body={'HostName': '${hostname}'} |
| 260 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
| 261 | |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 262 | |
| 263 | Login And Create User |
| 264 | [Documentation] Login and create user |
| 265 | |
shrsuman123 | 2b8bfca | 2021-11-18 05:14:23 -0600 | [diff] [blame^] | 266 | [Teardown] Run Keywords Redfish.Delete /redfish/v1/AccountService/Accounts/test_user |
| 267 | ... AND Redfish.Logout |
| 268 | |
| 269 | Redfish.Login |
| 270 | |
| 271 | ${user_info}= Create Dictionary |
| 272 | ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True} |
| 273 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info} |
| 274 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_CREATED}] |
| 275 | |
| 276 | Login And Delete User |
| 277 | [Documentation] Login create and delete user |
| 278 | |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 279 | [Teardown] Redfish.Logout |
| 280 | |
| 281 | Redfish.Login |
| 282 | |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 283 | ${user_info}= Create Dictionary |
| 284 | ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True} |
| 285 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info} |
shrsuman123 | 2b8bfca | 2021-11-18 05:14:23 -0600 | [diff] [blame^] | 286 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_CREATED}] |
| 287 | Redfish.Delete /redfish/v1/AccountService/Accounts/test_user |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 288 | |
| 289 | Set Account Lockout Threshold |
| 290 | [Documentation] Set user account lockout threshold. |
| 291 | |
| 292 | [Teardown] Redfish.Logout |
| 293 | |
| 294 | Redfish.Login |
| 295 | Redfish.Patch /redfish/v1/AccountService body=[('AccountLockoutThreshold', 0)] |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 296 | |
| 297 | |
| 298 | Login to GUI With Incorrect Credentials |
| 299 | [Documentation] Login to GUI With Wrong Credentials. |
| 300 | |
| 301 | Input Text ${xpath_textbox_username} root |
| 302 | Input Password ${xpath_textbox_password} incorrect_password |
| 303 | Click Button ${xpath_login_button} |
shrsuman123 | 2b8bfca | 2021-11-18 05:14:23 -0600 | [diff] [blame^] | 304 | |
| 305 | Invalid Credentials Redfish Login Attempts |
| 306 | [Documentation] Continuous invalid credentials login attempts to Redfish and |
| 307 | ... login to Redfish with valid credentials at times and get failed login attempts. |
| 308 | [Arguments] ${login_username}=${OPENBMC_USERNAME} ${login_password}=${OPENBMC_PASSWORD} |
| 309 | |
| 310 | # Description of argument(s): |
| 311 | # login_username username for login user. |
| 312 | # login_password password for login user. |
| 313 | |
| 314 | @{failed_iter_list}= Create List |
| 315 | |
| 316 | FOR ${iter} IN RANGE ${iterations} |
| 317 | Log To Console ${iter}th Redfish login with invalid credentials |
| 318 | Run Keyword And Ignore Error Redfish.Login ${login_username} incorrect_password |
| 319 | Continue For Loop If ${iter}%100 != 0 |
| 320 | |
| 321 | # Every 100th iteration, check Redfish is responsive. |
| 322 | ${status}= Run Keyword And Return Status |
| 323 | ... Redfish.Login ${login_username} ${login_password} |
| 324 | Run Keyword If '${status}' == 'False' Append To List ${failed_iter_list} ${iter} |
| 325 | Redfish.Logout |
| 326 | END |
| 327 | Log ${failed_iter_list} |
| 328 | ${fail_count}= Get Length ${failed_iter_list} |
| 329 | Run Keyword If ${fail_count} > ${0} FAIL Could not Login to Redfish ${fail_count} times |