1*** 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 7Resource ../lib/resource.robot 8Resource ../lib/utils.robot 9Resource ../lib/connection_client.robot 10Resource ../gui/lib/gui_resource.robot 11Library ../lib/bmc_network_utils.py 12 13Library SSHLibrary 14Library Collections 15Library XvfbRobot 16Library OperatingSystem 17Library Selenium2Library 120 120 18Library Telnet 30 Seconds 19Library Screenshot 20 21 22Suite Setup Redfish.Logout 23 24Variables ../gui/data/gui_variables.py 25 26*** Variables *** 27 28${iterations} 10000 29${loop_iteration} ${1000} 30${hostname} test_hostname 31${MAX_UNAUTH_PER_IP} ${5} 32${bmc_url} https://${OPENBMC_HOST} 33 34 35*** Test Cases *** 36 37Test Patch Without Auth Token Fails 38 [Documentation] Send patch method without auth token and verify it throws an error. 39 [Tags] Test_Patch_Without_Auth_Token_Fails 40 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}'} 45 ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}] 46 47 48Flood 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 53 ${active_channel_config}= Get Active Channel Config 54 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 55 56 FOR ${i} IN RANGE ${1} ${iterations} 57 Log To Console ${i}th iteration 58 Run Keyword And Ignore Error 59 ... Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body={'HostName': '${hostname}'} 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 69 Should Be Equal ${fail_count} 0 70 ... msg=Patch operation failed ${fail_count} times in ${verify_count} attempts 71 72 73Verify User Cannot Login After 5 Non-Logged In Sessions 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} 85 86 Should Be Equal ${status} ${False} 87 88 89Test 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 93 ${user_info}= Create Dictionary 94 ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True} 95 Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info} 96 ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}] 97 98 99Flood 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 104 ${user_info}= Create Dictionary 105 ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True} 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 120 Should Be Equal ${fail_count} 0 121 ... msg=Post operation failed ${fail_count} times in ${verify_count} attempts 122 123 124Make 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. 149 150 151Test 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} 172 Run Keyword If '${status}' == 'True' Run Keywords Close Browser AND Switch Browser browser1 173 END 174 175 ${fail_count}= Count Values In List ${status_list} False 176 Run Keyword If ${fail_count} > ${0} FAIL Could not open BMC GUI ${fail_count} times 177 178Test BMC GUI Stability On Continuous Refresh Of GUI Home Page 179 [Documentation] Login to BMC GUI and keep refreshing home page and verify stability 180 ... by login at times in another browser. 181 [Tags] Test_BMC_GUI_Stability_On_Continuous_Refresh_Of_GUI_Home_Page 182 [Teardown] Close All Browsers 183 184 @{failed_list}= Create List 185 186 # Open headless browser. 187 Start Virtual Display 188 ${browser_ID}= Open Browser ${bmc_url} alias=browser1 189 Set Window Size 1920 1080 190 Login GUI 191 192 FOR ${iter} IN RANGE ${iterations} 193 Log To Console ${iter}th Refresh of home page 194 195 Refresh GUI 196 Continue For Loop If ${iter}%100 != 0 197 198 # Every 100th iteration, check BMC GUI is responsive. 199 ${status}= Run Keyword And Return Status 200 ... Run Keywords Launch Browser And Login GUI AND Logout GUI 201 Run Keyword If '${status}' == 'False' Append To List ${failed_list} ${iter} 202 ... ELSE IF '${status}' == 'True' 203 ... Run Keywords Close Browser AND Switch Browser browser1 204 END 205 Log ${failed_list} 206 ${fail_count}= Get Length ${failed_list} 207 Run Keyword If ${fail_count} > ${0} FAIL Could not open BMC GUI ${fail_count} times 208 209*** Keywords *** 210 211Login And Configure Hostname 212 [Documentation] Login and configure hostname 213 214 [Teardown] Redfish.Logout 215 216 Redfish.Login 217 218 Redfish.patch ${REDFISH_NW_PROTOCOL_URI} body={'HostName': '${hostname}'} 219 ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 220 221 222Login And Create User 223 [Documentation] Login and create user 224 225 [Teardown] Redfish.Logout 226 227 Redfish.Login 228 229 ${user_info}= Create Dictionary 230 ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True} 231 Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info} 232 ... valid_status_codes=[${HTTP_OK}] 233 234 235Set Account Lockout Threshold 236 [Documentation] Set user account lockout threshold. 237 238 [Teardown] Redfish.Logout 239 240 Redfish.Login 241 Redfish.Patch /redfish/v1/AccountService body=[('AccountLockoutThreshold', 0)] 242 243 244Login to GUI With Incorrect Credentials 245 [Documentation] Login to GUI With Wrong Credentials. 246 247 Input Text ${xpath_textbox_username} root 248 Input Password ${xpath_textbox_password} incorrect_password 249 Click Button ${xpath_login_button} 250