Verify User Cannot Login After 5 Non-Logged In Sessions

Change-Id: I45b87781a562de90f461739e2f5df3b3a1013520
Signed-off-by: Anvesh kumar <anvesr77@in.ibm.com>
diff --git a/security/test_bmc_connections.robot b/security/test_bmc_connections.robot
index f8efe65..4534aa7 100644
--- a/security/test_bmc_connections.robot
+++ b/security/test_bmc_connections.robot
@@ -4,15 +4,20 @@
 Resource  ../lib/bmc_redfish_resource.robot
 Resource  ../lib/bmc_network_utils.robot
 Resource  ../lib/openbmc_ffdc.robot
+Resource  ../lib/resource.robot
+Resource  ../lib/utils.robot
+Resource  ../lib/connection_client.robot
 Library   ../lib/bmc_network_utils.py
 
+Library   SSHLibrary
 Library   OperatingSystem
 Library   Collections
 
 *** Variables ***
 
-${iterations}  10000
-${hostname}    test_hostname
+${iterations}         10000
+${hostname}           test_hostname
+${MAX_UNAUTH_PER_IP}  ${5}
 
 *** Test Cases ***
 
@@ -45,6 +50,21 @@
     Should Be Equal  ${fail_count}  0  msg=Patch operation failed ${fail_count} times in ${verify_count} attempts
 
 
+Verify Uer Cannot Login After 5 Non-Logged In Sessions
+    [Documentation]  User should not be able to login when there
+    ...  are 5 non-logged in sessions.
+    [Tags]  Verify_User_Cannot_Login_After_5_Non-Logged_In_Sessions
+
+    FOR  ${i}  IN RANGE  ${0}  ${MAX_UNAUTH_PER_IP}
+       SSHLibrary.Open Connection  ${OPENBMC_HOST}
+       Start Process  ssh ${OPENBMC_USERNAME}@${OPENBMC_HOST}  shell=True
+    END
+
+    SSHLibrary.Open Connection  ${OPENBMC_HOST}
+    ${status}=   Run Keyword And Return Status  SSHLibrary.Login  ${OPENBMC_USERNAME}  ${OPENBMC_PASSWORD}
+    Should Be Equal  ${status}  ${False}
+
+
 *** Keywords ***
 
 Login And Configure Hostname