Fix bug when serial console is left logged in

When running commands through the serial console, Robot expects its
telnet session to begin with the user logged out and the login prompt
showing. However, after using a BMC, users often leave the serial console
logged in and cause Robot to error out. This changes logs the serial
console out before attempting to log in and run commands.

Change-Id: I9a23a84758a9acc54c796cbed6fce007639a9f24
Signed-off-by: Charles Paul Hofer <Charles.Hofer@ibm.com>
diff --git a/lib/oem/ibm/serial_console_client.robot b/lib/oem/ibm/serial_console_client.robot
index 9989322..293ff4f 100644
--- a/lib/oem/ibm/serial_console_client.robot
+++ b/lib/oem/ibm/serial_console_client.robot
@@ -25,11 +25,21 @@
     ${prompt_string}=  Convert To Lowercase  ${OPENBMC_MODEL} login:
     Telnet.Open Connection
     ...  ${i_host}  port=${i_port}  prompt=#
+    Telnet.Set Timeout  30 seconds
     Telnet.Set Newline  \n
     Telnet.Set Newline  CRLF
     Telnet.Write  \n
-    Telnet.Login  ${OPENBMC_USERNAME}  ${OPENBMC_PASSWORD}
-    ...  login_prompt=${prompt_string}  password_prompt=Password:
+    Telnet.Write  exit
+    Telnet.Write  \n
+    Telnet.Read Until Regexp  (Password:|logout)
+    Telnet.Write  \n
+    Telnet.Read Until  ${prompt_string}
+    Telnet.Write  ${OPENBMC_USERNAME}
+    Telnet.Write  \n
+    Telnet.Read Until  Password:
+    Telnet.Write  ${OPENBMC_PASSWORD}
+    Telnet.Write  \n
+    Telnet.Read Until Prompt
     Telnet.Set Timeout  30 minute 30 seconds