Add logic for wait time required with password changes

Changes:
     - Added new keyword.
     - Call the keyword needed for wait time on password change.

Resolves  openbmc/openbmc-test-automation#2188

Change-Id: I38ad3ef103e0bb11040d5e06dc1eae39da40e151
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/ipmi/test_ipmi_user.robot b/ipmi/test_ipmi_user.robot
index ba6301f..20633af 100644
--- a/ipmi/test_ipmi_user.robot
+++ b/ipmi/test_ipmi_user.robot
@@ -305,6 +305,7 @@
     Sleep  5s
 
     Enable IPMI User And Verify  ${random_userid}
+    Wait and Confirm New Username And Password  ${random_username}  ${valid_password}
 
     # Verify that enabled IPMI  user is able to run IPMI command.
     Verify IPMI Username And Password  ${random_username}  ${valid_password}
@@ -503,6 +504,7 @@
     # Set different username for same IPMI user.
     Run IPMI Standard Command
     ...  user set name ${random_userid} ${new_username}
+    Wait and Confirm New Username And Password  ${new_username}  ${valid_password}
 
     # Verify that user is able to run administrator level IPMI command.
     Verify IPMI Command  ${new_username}  ${valid_password}  Administrator  ${CHANNEL_NUMBER}
@@ -679,3 +681,15 @@
 
     Should not contain  ${enabled_user_count}  15
     ...  msg=IPMI have reached maximum user count
+
+
+Wait and Confirm New Username And Password
+    [Documentation]  Wait in loop trying to to confirm Username And Password.
+    [Arguments]  ${username}  ${password}
+
+    # Give time for previous command to complete.
+    Sleep  5s
+
+    # Looping verify that root user is able to run IPMI command using new password.
+    Wait Until Keyword Succeeds  15 sec  5 sec  Verify IPMI Username And Password
+    ...  ${username}  ${password}