Inband IPMI via Host OS

This change addresses:
   1. Opening connection to Host OS
   2. Running inband IPMI commands from Host OS

Resolves openbmc/openbmc-test-automation/issues/389

Change-Id: I8035135066b4a2b769fa6273817c9a61ad09ab49
Signed-off-by: Prashanth Katti <prkatti1@in.ibm.com>
diff --git a/lib/utils.robot b/lib/utils.robot
index 21a073e..74c8d99 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -774,3 +774,21 @@
     Execute Command On BMC
     ...  /usr/sbin/mapper call /org/openbmc/watchdog/host0 org.openbmc.Watchdog start
     Sleep  ${sleep_time}
+
+Login To OS Host
+    [Documentation]  Login to OS Host.
+    [Arguments]  ${os_host}=${OS_HOST}  ${os_username}=${OS_USERNAME}
+    ...          ${os_password}=${OS_PASSWORD}
+    # Desription of arguments:
+    # ${os_host} IP address of the OS Host.
+    # ${os_username}  OS Host Login user name.
+    # ${os_password}  OS Host Login passwrd.
+
+    ${os_state}=  Run Keyword And Return Status  Ping Host  ${os_host}
+    Run Keyword If  '${os_state}' == 'False'
+    ...  Run Keywords  Initiate Host Reboot  AND
+    ...  Is Host Running  AND
+    ...  Wait for OS  ${os_host}  ${os_username}  ${os_password}
+
+    Open Connection  ${os_host}
+    Login  ${os_username}  ${os_password}