Wait for Standby post reboot for REST operation

The failure seen are intermittent and only showing up on barreleye.
We can't determine for sure safe check if the REST is not Busy when
the test action request are made. Even with this check we are not
fully gauranteed that REST server would not be busy, however it gives
a confidence that REST would have already completed initialization
and setup needed to reach a well define state post reboot to accept
new request.

Resolves openbmc/openbmc-test-automation#211

Change-Id: Idba43d2e9d0993a656583877a7c853bf1d5a7b58
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/tests/test_association.robot b/tests/test_association.robot
index c30db87..fc42aa8 100755
--- a/tests/test_association.robot
+++ b/tests/test_association.robot
@@ -217,6 +217,10 @@
     ${output}=      Execute Command    /sbin/reboot
     Check If BMC is Up   5 min    10 sec
 
+    @{states}=   Create List   BMC_READY   HOST_POWERED_OFF
+    Wait Until Keyword Succeeds
+    ...    10 min   10 sec   Verify BMC State   ${states}
+
     ${post_reboot_association_content} =
     ...   Read Attribute    ${association_uri}    endpoints
     Should Be Equal
diff --git a/tests/test_eventlog.robot b/tests/test_eventlog.robot
index 44cf8f5..dee0799 100644
--- a/tests/test_eventlog.robot
+++ b/tests/test_eventlog.robot
@@ -154,6 +154,7 @@
     ...                 Steps:
     ...                     Create event,
     ...                     Reboot openbmc,
+    ...                     Wait for BMC to READY or Powered OFF state
     ...                     Events should exist post reboot,
     ...                     Create two more events,
     ...                     Delete old and new event
@@ -163,10 +164,13 @@
     ${output}=      Execute Command    /sbin/reboot
     Check If BMC is Up   5 min    10 sec
 
+    @{states}=   Create List   BMC_READY   HOST_POWERED_OFF
+    Wait Until Keyword Succeeds
+    ...    10 min   10 sec   Verify BMC State   ${states}
+
     ${resp} =    openbmc get request     ${pre_reboot_event}
     should be equal as strings      ${resp.status_code}     ${HTTP_OK}
     ${post_reboot_event1}=         create a test log
-    ${post_reboot_event2}=         create a test log
 
     ${del_prereboot_uri} =  catenate    SEPARATOR=   ${pre_reboot_event}   /action/delete
     ${resp} =    openbmc post request     ${del_prereboot_uri}    data=${NIL}