Test stability on large number of wrong login attempts to BMC GUI
Signed-off-by: Prashanth Katti <prkatti1@in.ibm.com>
Change-Id: Ic246e7c54db094de073ff596aec02d739375a501
diff --git a/security/test_bmc_connections.robot b/security/test_bmc_connections.robot
index a87e69a..54ccd0e 100644
--- a/security/test_bmc_connections.robot
+++ b/security/test_bmc_connections.robot
@@ -10,8 +10,14 @@
Library ../lib/bmc_network_utils.py
Library SSHLibrary
-Library OperatingSystem
Library Collections
+Library XvfbRobot
+Library OperatingSystem
+Library Selenium2Library 120 120
+Library Telnet 30 Seconds
+Library Screenshot
+
+Variables ../gui/data/gui_variables.py
*** Variables ***
@@ -19,6 +25,8 @@
${loop_iteration} ${1000}
${hostname} test_hostname
${MAX_UNAUTH_PER_IP} ${5}
+${bmc_url} https://${OPENBMC_HOST}
+
*** Test Cases ***
@@ -130,6 +138,34 @@
... msg= Login Failed ${fail_count} times in ${valid_login_count} attempts.
+Test Stability On Large Number Of Wrong Login Attempts To GUI
+ [Documentation] Test stability on large number of wrong login attempts to GUI.
+ [Tags] Test_Stability_On_Large_Number_Of_Wrong_Login_Attempts_To_GUI
+
+ @{status_list}= Create List
+
+ # Open headless browser.
+ Start Virtual Display
+ ${browser_ID}= Open Browser ${bmc_url} alias=browser1
+ Set Window Size 1920 1080
+
+ Go To ${bmc_url}
+
+ FOR ${i} IN RANGE ${1} ${iterations}
+ Log To Console ${i}th login
+ Run Keyword And Ignore Error Login to GUI With Wrong Credentials
+
+ # Every 100th iteration, check BMC GUI is responsive.
+ ${status}= Run Keyword If ${i} % 100 == 0 Run Keyword And Return Status
+ ... Open Browser ${bmc_url}
+ Append To List ${status_list} ${status}
+ Run Keyword If '${status}' == 'True' Run Keywords Close Browser AND Switch Browser browser1
+ END
+
+ ${fail_count}= Count Values In List ${status_list} False
+ Run Keyword If ${fail_count} > ${0} FAIL Could not open BMC GUI ${fail_count} times
+
+
*** Keywords ***
Login And Configure Hostname
@@ -163,3 +199,11 @@
Redfish.Login
Redfish.Patch /redfish/v1/AccountService body=[('AccountLockoutThreshold', 0)]
+
+
+Login to GUI With Incorrect Credentials
+ [Documentation] Login to GUI With Wrong Credentials.
+
+ Input Text ${xpath_textbox_username} root
+ Input Password ${xpath_textbox_password} incorrect_password
+ Click Button ${xpath_login_button}