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 |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 10 | Library ../lib/bmc_network_utils.py |
| 11 | |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 12 | Library SSHLibrary |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 13 | Library Collections |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 14 | Library XvfbRobot |
| 15 | Library OperatingSystem |
| 16 | Library Selenium2Library 120 120 |
| 17 | Library Telnet 30 Seconds |
| 18 | Library Screenshot |
| 19 | |
shrsuman123 | a8ca296 | 2022-01-07 03:30:08 -0600 | [diff] [blame] | 20 | |
| 21 | Suite Setup Redfish.Logout |
| 22 | |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 23 | Variables ../gui/data/gui_variables.py |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 24 | |
| 25 | *** Variables *** |
| 26 | |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 27 | ${iterations} 10000 |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 28 | ${loop_iteration} ${1000} |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 29 | ${hostname} test_hostname |
| 30 | ${MAX_UNAUTH_PER_IP} ${5} |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 31 | ${bmc_url} https://${OPENBMC_HOST} |
| 32 | |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 33 | |
| 34 | *** Test Cases *** |
| 35 | |
| 36 | Test Patch Without Auth Token Fails |
| 37 | [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] | 38 | [Tags] Test_Patch_Without_Auth_Token_Fails |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 39 | |
Anves Kumar rayankula | 816d3ce | 2021-06-13 23:55:41 -0500 | [diff] [blame] | 40 | ${active_channel_config}= Get Active Channel Config |
| 41 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 42 | |
| 43 | Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body={'HostName': '${hostname}'} |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 44 | ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}] |
| 45 | |
| 46 | |
| 47 | Flood Patch Without Auth Token And Check Stability Of BMC |
| 48 | [Documentation] Flood patch method without auth token and check BMC stability. |
| 49 | [Tags] Flood_Patch_Without_Auth_Token_And_Check_Stability_Of_BMC |
| 50 | @{status_list}= Create List |
| 51 | |
Anves Kumar rayankula | 816d3ce | 2021-06-13 23:55:41 -0500 | [diff] [blame] | 52 | ${active_channel_config}= Get Active Channel Config |
| 53 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 54 | |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 55 | FOR ${i} IN RANGE ${1} ${iterations} |
| 56 | Log To Console ${i}th iteration |
| 57 | Run Keyword And Ignore Error |
Anves Kumar rayankula | 816d3ce | 2021-06-13 23:55:41 -0500 | [diff] [blame] | 58 | ... Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body={'HostName': '${hostname}'} |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 59 | |
| 60 | # Every 100th iteration, check BMC allows patch with auth token. |
| 61 | ${status}= Run Keyword If ${i} % 100 == 0 Run Keyword And Return Status |
| 62 | ... Login And Configure Hostname |
| 63 | Run Keyword If ${status} == False Append To List ${status_list} ${status} |
| 64 | END |
| 65 | ${verify_count}= Evaluate ${iterations}/100 |
| 66 | ${fail_count}= Get Length ${status_list} |
| 67 | |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 68 | Should Be Equal ${fail_count} 0 |
| 69 | ... msg=Patch operation failed ${fail_count} times in ${verify_count} attempts |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 70 | |
| 71 | |
George Keishing | 4fb89c1 | 2022-01-06 22:29:33 -0600 | [diff] [blame] | 72 | Verify User Cannot Login After 5 Non-Logged In Sessions |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 73 | [Documentation] User should not be able to login when there |
| 74 | ... are 5 non-logged in sessions. |
| 75 | [Tags] Verify_User_Cannot_Login_After_5_Non-Logged_In_Sessions |
| 76 | |
| 77 | FOR ${i} IN RANGE ${0} ${MAX_UNAUTH_PER_IP} |
| 78 | SSHLibrary.Open Connection ${OPENBMC_HOST} |
| 79 | Start Process ssh ${OPENBMC_USERNAME}@${OPENBMC_HOST} shell=True |
| 80 | END |
| 81 | |
| 82 | SSHLibrary.Open Connection ${OPENBMC_HOST} |
| 83 | ${status}= Run Keyword And Return Status SSHLibrary.Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 84 | |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 85 | Should Be Equal ${status} ${False} |
| 86 | |
| 87 | |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 88 | Test Post Without Auth Token Fails |
| 89 | [Documentation] Send post method without auth token and verify it throws an error. |
| 90 | [Tags] Test_Post_Without_Auth_Token_Fails |
| 91 | |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 92 | ${user_info}= Create Dictionary |
| 93 | ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True} |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 94 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info} |
| 95 | ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}] |
| 96 | |
| 97 | |
| 98 | Flood Post Without Auth Token And Check Stability Of BMC |
| 99 | [Documentation] Flood post method without auth token and check BMC stability. |
| 100 | [Tags] Flood_Post_Without_Auth_Token_And_Check_Stability_Of_BMC |
| 101 | |
| 102 | @{status_list}= Create List |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 103 | ${user_info}= Create Dictionary |
| 104 | ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True} |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 105 | |
| 106 | FOR ${i} IN RANGE ${1} ${iterations} |
| 107 | Log To Console ${i}th iteration |
| 108 | Run Keyword And Ignore Error |
| 109 | ... Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info} |
| 110 | |
| 111 | # Every 100th iteration, check BMC allows post with auth token. |
| 112 | ${status}= Run Keyword If ${i} % 100 == 0 Run Keyword And Return Status |
| 113 | ... Login And Create User |
| 114 | Run Keyword If ${status} == False Append To List ${status_list} ${status} |
| 115 | END |
| 116 | ${verify_count}= Evaluate ${iterations}/100 |
| 117 | ${fail_count}= Get Length ${status_list} |
| 118 | |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 119 | Should Be Equal ${fail_count} 0 |
| 120 | ... msg=Post operation failed ${fail_count} times in ${verify_count} attempts |
| 121 | |
| 122 | |
| 123 | Make Large Number Of Wrong SSH Login Attempts And Check Stability |
| 124 | [Documentation] Check BMC stability with large number of SSH wrong login requests. |
| 125 | [Tags] Make_Large_Number_Of_Wrong_SSH_Login_Attempts_And_Check_Stability |
| 126 | [Setup] Set Account Lockout Threshold |
| 127 | [Teardown] FFDC On Test Case Fail |
| 128 | |
| 129 | SSHLibrary.Open Connection ${OPENBMC_HOST} |
| 130 | @{ssh_status_list}= Create List |
| 131 | FOR ${i} IN RANGE ${loop_iteration} |
| 132 | Log To Console ${i}th iteration |
| 133 | ${invalid_password}= Catenate ${OPENBMC_PASSWORD}${i} |
| 134 | Run Keyword and Ignore Error |
| 135 | ... Open Connection And Log In ${OPENBMC_USERNAME} ${invalid_password} |
| 136 | |
| 137 | # Every 100th iteration Login with correct credentials |
| 138 | ${status}= Run keyword If ${i} % ${100} == ${0} Run Keyword And Return Status |
| 139 | ... Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 140 | Run Keyword If ${status} == ${False} Append To List ${ssh_status_list} ${status} |
| 141 | SSHLibrary.Close Connection |
| 142 | END |
| 143 | |
| 144 | ${valid_login_count}= Evaluate ${iterations}/100 |
| 145 | ${fail_count}= Get Length ${ssh_status_list} |
| 146 | Should Be Equal ${fail_count} ${0} |
| 147 | ... msg= Login Failed ${fail_count} times in ${valid_login_count} attempts. |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 148 | |
| 149 | |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 150 | Test Stability On Large Number Of Wrong Login Attempts To GUI |
| 151 | [Documentation] Test stability on large number of wrong login attempts to GUI. |
| 152 | [Tags] Test_Stability_On_Large_Number_Of_Wrong_Login_Attempts_To_GUI |
| 153 | |
| 154 | @{status_list}= Create List |
| 155 | |
| 156 | # Open headless browser. |
| 157 | Start Virtual Display |
| 158 | ${browser_ID}= Open Browser ${bmc_url} alias=browser1 |
| 159 | Set Window Size 1920 1080 |
| 160 | |
| 161 | Go To ${bmc_url} |
| 162 | |
| 163 | FOR ${i} IN RANGE ${1} ${iterations} |
| 164 | Log To Console ${i}th login |
| 165 | Run Keyword And Ignore Error Login to GUI With Wrong Credentials |
| 166 | |
| 167 | # Every 100th iteration, check BMC GUI is responsive. |
| 168 | ${status}= Run Keyword If ${i} % 100 == 0 Run Keyword And Return Status |
| 169 | ... Open Browser ${bmc_url} |
| 170 | Append To List ${status_list} ${status} |
| 171 | Run Keyword If '${status}' == 'True' Run Keywords Close Browser AND Switch Browser browser1 |
| 172 | END |
| 173 | |
| 174 | ${fail_count}= Count Values In List ${status_list} False |
| 175 | Run Keyword If ${fail_count} > ${0} FAIL Could not open BMC GUI ${fail_count} times |
| 176 | |
| 177 | |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 178 | *** Keywords *** |
| 179 | |
| 180 | Login And Configure Hostname |
| 181 | [Documentation] Login and configure hostname |
| 182 | |
| 183 | [Teardown] Redfish.Logout |
| 184 | |
| 185 | Redfish.Login |
| 186 | |
| 187 | Redfish.patch ${REDFISH_NW_PROTOCOL_URI} body={'HostName': '${hostname}'} |
| 188 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
| 189 | |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 190 | |
| 191 | Login And Create User |
| 192 | [Documentation] Login and create user |
| 193 | |
| 194 | [Teardown] Redfish.Logout |
| 195 | |
| 196 | Redfish.Login |
| 197 | |
Anvesh Kumar Rayankula | 3cddd03 | 2020-03-26 04:16:13 -0500 | [diff] [blame] | 198 | ${user_info}= Create Dictionary |
| 199 | ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True} |
| 200 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info} |
| 201 | ... valid_status_codes=[${HTTP_OK}] |
| 202 | |
| 203 | |
| 204 | Set Account Lockout Threshold |
| 205 | [Documentation] Set user account lockout threshold. |
| 206 | |
| 207 | [Teardown] Redfish.Logout |
| 208 | |
| 209 | Redfish.Login |
| 210 | Redfish.Patch /redfish/v1/AccountService body=[('AccountLockoutThreshold', 0)] |
Prashanth Katti | ee26d5e | 2021-05-21 00:38:31 -0500 | [diff] [blame] | 211 | |
| 212 | |
| 213 | Login to GUI With Incorrect Credentials |
| 214 | [Documentation] Login to GUI With Wrong Credentials. |
| 215 | |
| 216 | Input Text ${xpath_textbox_username} root |
| 217 | Input Password ${xpath_textbox_password} incorrect_password |
| 218 | Click Button ${xpath_login_button} |