Fix  BMC Power On keyword

With this change, poweron will now work with or without
setting the OS paramters during poweron for CI test.

Changes addresses:
   - Ignore ping test if hostname/IP paramater is not set
   - Wait for BMC HOST_BOOTED state

Resolves openbmc/openbmc-test-automation#82

Change-Id: Icb7e90f2deebd23b59fee938aaa90ae83ef3d104
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/boot/powerons.robot b/lib/boot/powerons.robot
index b3e402f..db35f67 100644
--- a/lib/boot/powerons.robot
+++ b/lib/boot/powerons.robot
@@ -14,7 +14,7 @@
 
     Open Connection and Log In  &{bmc_connection_args}
     Initiate Power On
-    Wait For OS
+    Run Keyword If   '${OS_HOST}' != '${EMPTY}'   Wait For OS
     Switch Connection  bmc_connection
     Check Power On States
     Close Connection
@@ -23,9 +23,7 @@
     [Documentation]  Checks that the BMC state, power state, and boot progress
     ...  are correctly powered on.
 
-    ${bmc_state}=  Get BMC State
-    Should Contain  ${bmc_state}  HOST_BOOTED
-    Log to Console  BMC State: ${bmc_state}
+    Wait Until Keyword Succeeds   ${OS_WAIT_TIMEOUT}  10sec  Is Host Booted
 
     ${boot_progress}=  Get Boot Progress
     Should Be Equal  ${boot_progress}  FW Progress, Starting OS
@@ -34,3 +32,9 @@
     ${power_state}=  Get Power State
     Should Be Equal  ${power_state}  ${1}
     Log to Console  Power State: ${power_state}
+
+Is Host Booted
+    ${bmc_state}=  Get BMC State
+    Should Contain  ${bmc_state}  HOST_BOOTED
+    Log to Console  BMC State: ${bmc_state}
+
diff --git a/lib/utils.robot b/lib/utils.robot
index f7bae9c..ebe7980 100644
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -20,6 +20,7 @@
 
 Ping Host
     [Arguments]     ${host}
+    Should Not Be Empty    ${host}   msg=No host provided
     ${RC}   ${output} =     Run and return RC and Output    ping -c 4 ${host}
     Log     RC: ${RC}\nOutput:\n${output}
     Should be equal     ${RC}   ${0}