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 | |
George Keishing | 87dc442 | 2023-10-20 12:56:30 +0530 | [diff] [blame] | 24 | Variables ../gui/data/gui_variables.py |
| 25 | |
| 26 | Force Tags BMC_Connections |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 27 | |
| 28 | *** Variables *** |
| 29 | |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 30 | ${iterations} 10000 |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 31 | ${loop_iteration} ${1000} |
George Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 32 | ${hostname} testhostname |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 33 | ${MAX_UNAUTH_PER_IP} ${5} |
Matt Fischer | 46bd8c2 | 2023-09-01 11:00:26 -0600 | [diff] [blame] | 34 | ${bmc_url} https://${OPENBMC_HOST}:${HTTPS_PORT} |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 35 | |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 36 | |
| 37 | *** Test Cases *** |
| 38 | |
| 39 | Test Patch Without Auth Token Fails |
| 40 | [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] | 41 | [Tags] Test_Patch_Without_Auth_Token_Fails |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 42 | |
Anves Kumar rayankula | 816d3ce | 2021-06-13 23:55:41 -0500 | [diff] [blame] | 43 | ${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 Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 47 | ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}] |
| 48 | |
| 49 | |
| 50 | Flood 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 Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 53 | |
| 54 | @{fail_list}= Create List |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 55 | |
Anves Kumar rayankula | 816d3ce | 2021-06-13 23:55:41 -0500 | [diff] [blame] | 56 | ${active_channel_config}= Get Active Channel Config |
| 57 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 58 | |
George Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 59 | 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 Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 64 | |
| 65 | # Every 100th iteration, check BMC allows patch with auth token. |
George Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 66 | ${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 Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 69 | END |
| 70 | ${verify_count}= Evaluate ${iterations}/100 |
George Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 71 | ${fail_count}= Get Length ${fail_list} |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 72 | |
George Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 73 | 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 Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 75 | |
| 76 | |
George Keishing | 4fb89c1 | 2022-01-06 22:29:33 -0600 | [diff] [blame] | 77 | Verify User Cannot Login After 5 Non-Logged In Sessions |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 78 | [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 Ratzlaff | 05a29c8 | 2022-05-13 11:43:25 -0400 | [diff] [blame] | 81 | [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 Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 84 | |
George Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 85 | FOR ${iter} IN RANGE ${0} ${MAX_UNAUTH_PER_IP} |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 86 | 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 Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 92 | |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 93 | Should Be Equal ${status} ${False} |
| 94 | |
| 95 | |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 96 | Test 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 Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 100 | ${user_info}= Create Dictionary |
| 101 | ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True} |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 102 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info} |
| 103 | ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}] |
| 104 | |
| 105 | |
| 106 | Flood 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 Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 110 | @{fail_list}= Create List |
| 111 | |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 112 | ${user_info}= Create Dictionary |
| 113 | ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True} |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 114 | |
George Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 115 | 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 Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 120 | |
| 121 | # Every 100th iteration, check BMC allows post with auth token. |
George Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 122 | ${status}= Run Keyword If ${iter} % 100 == 0 Run Keyword And Return Status |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 123 | ... Login And Create User |
George Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 124 | Run Keyword If ${status} == False Append To List ${fail_list} ${iter} |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 125 | END |
| 126 | ${verify_count}= Evaluate ${iterations}/100 |
George Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 127 | ${fail_count}= Get Length ${fail_list} |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 128 | |
George Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 129 | 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 Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 131 | |
| 132 | |
| 133 | Make 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 Ratzlaff | fde32cf | 2022-05-06 15:21:31 -0400 | [diff] [blame] | 141 | FOR ${iter} IN RANGE ${1} ${loop_iteration} + 1 |
George Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 142 | Log To Console ${iter}th iteration |
| 143 | ${invalid_password}= Catenate ${OPENBMC_PASSWORD}${iter} |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 144 | 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 Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 148 | ${status}= Run keyword If ${iter} % ${100} == ${0} Run Keyword And Return Status |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 149 | ... 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 Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 158 | |
| 159 | |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 160 | Test 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 Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 173 | FOR ${iter} IN RANGE ${1} ${iterations} + 1 |
| 174 | Log To Console ${iter}th login |
George Keishing | fef9aa9 | 2022-04-08 08:45:42 -0500 | [diff] [blame] | 175 | Run Keyword And Ignore Error Login to GUI With Incorrect Credentials |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 176 | |
| 177 | # Every 100th iteration, check BMC GUI is responsive. |
George Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 178 | ${status}= Run Keyword If ${iter} % 100 == 0 Run Keyword And Return Status |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 179 | ... Open Browser ${bmc_url} |
| 180 | Append To List ${status_list} ${status} |
George Keishing | 47d1e8e | 2022-02-17 10:38:49 -0600 | [diff] [blame] | 181 | Run Keyword If '${status}' == 'True' |
| 182 | ... Run Keywords Close Browser AND Switch Browser browser1 |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 183 | 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 N | ae743b8 | 2023-02-17 04:58:55 -0600 | [diff] [blame] | 188 | |
shrsuman123 | b844a87 | 2021-12-21 05:49:41 -0600 | [diff] [blame] | 189 | Test 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 Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 219 | |
Megha G N | ae743b8 | 2023-02-17 04:58:55 -0600 | [diff] [blame] | 220 | |
shrsuman123 | 2b8bfca | 2021-11-18 05:14:23 -0600 | [diff] [blame] | 221 | Test 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 N | ae743b8 | 2023-02-17 04:58:55 -0600 | [diff] [blame] | 228 | |
shrsuman123 | 2b8bfca | 2021-11-18 05:14:23 -0600 | [diff] [blame] | 229 | Test 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 | |
| 239 | Test 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 N | ae743b8 | 2023-02-17 04:58:55 -0600 | [diff] [blame] | 262 | |
| 263 | Verify 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 Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 290 | *** Keywords *** |
| 291 | |
| 292 | Login And Configure Hostname |
| 293 | [Documentation] Login and configure hostname |
George Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 294 | [Arguments] ${ethernet_interface_uri} |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 295 | [Teardown] Redfish.Logout |
| 296 | |
George Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 297 | # Description of argument(s): |
| 298 | # ethernet_interface_uri Network interface URI path. |
| 299 | |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 300 | Redfish.Login |
| 301 | |
George Keishing | 23afcc5 | 2022-04-07 03:18:08 -0500 | [diff] [blame] | 302 | Redfish.Patch ${ethernet_interface_uri} body={'HostName': '${hostname}'} |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 303 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
| 304 | |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 305 | |
| 306 | Login And Create User |
| 307 | [Documentation] Login and create user |
shrsuman123 | 2b8bfca | 2021-11-18 05:14:23 -0600 | [diff] [blame] | 308 | [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 N | ae743b8 | 2023-02-17 04:58:55 -0600 | [diff] [blame] | 314 | ... UserName=test_user Password=TestPwd123 RoleId=ReadOnly Enabled=${True} |
shrsuman123 | 2b8bfca | 2021-11-18 05:14:23 -0600 | [diff] [blame] | 315 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info} |
| 316 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_CREATED}] |
| 317 | |
Megha G N | ae743b8 | 2023-02-17 04:58:55 -0600 | [diff] [blame] | 318 | |
shrsuman123 | 2b8bfca | 2021-11-18 05:14:23 -0600 | [diff] [blame] | 319 | Login And Delete User |
| 320 | [Documentation] Login create and delete user |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 321 | [Teardown] Redfish.Logout |
| 322 | |
| 323 | Redfish.Login |
| 324 | |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 325 | ${user_info}= Create Dictionary |
Megha G N | ae743b8 | 2023-02-17 04:58:55 -0600 | [diff] [blame] | 326 | ... UserName=test_user Password=TestPwd123 RoleId=ReadOnly Enabled=${True} |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 327 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info} |
shrsuman123 | 2b8bfca | 2021-11-18 05:14:23 -0600 | [diff] [blame] | 328 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_CREATED}] |
| 329 | Redfish.Delete /redfish/v1/AccountService/Accounts/test_user |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 330 | |
Megha G N | ae743b8 | 2023-02-17 04:58:55 -0600 | [diff] [blame] | 331 | |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 332 | Set Account Lockout Threshold |
| 333 | [Documentation] Set user account lockout threshold. |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 334 | [Teardown] Redfish.Logout |
| 335 | |
| 336 | Redfish.Login |
| 337 | Redfish.Patch /redfish/v1/AccountService body=[('AccountLockoutThreshold', 0)] |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 338 | |
| 339 | |
| 340 | Login to GUI With Incorrect Credentials |
George Keishing | 0aeb54f | 2022-04-11 10:26:34 -0500 | [diff] [blame] | 341 | [Documentation] Attempt to login to GUI as root, providing incorrect password argument. |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 342 | |
rramyasr-in | d1ae7fa | 2023-02-20 11:00:41 -0600 | [diff] [blame] | 343 | Input Text ${xpath_login_username_input} root |
| 344 | Input Password ${xpath_login_password_input} incorrect_password |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 345 | Click Button ${xpath_login_button} |
shrsuman123 | 2b8bfca | 2021-11-18 05:14:23 -0600 | [diff] [blame] | 346 | |
Megha G N | ae743b8 | 2023-02-17 04:58:55 -0600 | [diff] [blame] | 347 | |
shrsuman123 | 2b8bfca | 2021-11-18 05:14:23 -0600 | [diff] [blame] | 348 | Invalid 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 Ratzlaff | 05a29c8 | 2022-05-13 11:43:25 -0400 | [diff] [blame] | 373 | |
| 374 | |
| 375 | Confirm 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 N | ae743b8 | 2023-02-17 04:58:55 -0600 | [diff] [blame] | 385 | |
| 386 | |
| 387 | Login 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 N | 0af9eb0 | 2023-03-02 00:35:09 -0600 | [diff] [blame] | 399 | ${resp}= PUT On Session openbmc ${OEM_HOST_CONFIG_URI}/100-file &{kwargs} timeout=10 |
Megha G N | ae743b8 | 2023-02-17 04:58:55 -0600 | [diff] [blame] | 400 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 401 | Delete Local Partition File |
| 402 | |
| 403 | |
| 404 | Delete 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 | |
| 411 | Create 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 | |
| 421 | Delete 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 N | 0af9eb0 | 2023-03-02 00:35:09 -0600 | [diff] [blame] | 429 | ${resp}= POST On Session openbmc ${OEM_HOST_CONFIG_ACTIONS_URI}.DeleteAll &{data} |
Megha G N | ae743b8 | 2023-02-17 04:58:55 -0600 | [diff] [blame] | 430 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 431 | |
| 432 | Delete All Sessions |