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