Modified IPMI watchdog script for timer action validation

Added code to validate the watchdog timer action whether the
host/Chassis is performed the expected action.

Changed the power_state_change variable value to 3 sec.

Changed keyword from "Check If BMC Is Up" to "Is BMC Operational"
since old keyword using Rest to verfiy BMC is up or not so changed
it to redfish.

Tested: Ran ipmi/test_ipmi_watchdog.robot

Change-Id: I6ec66721fa7fba397789f1b9ed531dac97399955
Signed-off-by: Nagarjun B  <nagarjunb@ami.com>
diff --git a/ipmi/test_ipmi_watchdog.robot b/ipmi/test_ipmi_watchdog.robot
index 54834a2..bb776ba 100644
--- a/ipmi/test_ipmi_watchdog.robot
+++ b/ipmi/test_ipmi_watchdog.robot
@@ -12,7 +12,7 @@
 *** Variables ***
 
 ${TIMER_DELAY}          3
-${POWER_STATE_CHANGE}   20
+${POWER_STATE_CHANGE}   3
 
 *** Test Cases ***
 
@@ -193,7 +193,8 @@
 
     # Reset BMC.
     Run External IPMI Standard Command  mc reset cold -N 10 -R 1
-    Check If BMC is Up
+    Wait Until Keyword Succeeds  ${OPENBMC_REBOOT_TIMEOUT} min  10 sec
+    ...  Is BMC Operational
 
     # Reset Watchdog Timer without initialized watchdog.
     Run Keyword and Expect Error  *Unknown*
@@ -267,7 +268,19 @@
     # Delay for power state.
     Sleep  ${POWER_STATE_CHANGE}
 
-    Verify Host Power State  ${power_state}
+    IF  '${sel_event}' == 'Hard reset' or '${sel_event}' == 'Power cycle'
+        # If timer expire action is 'Hard Reset' then the host/chassis immediately powering on after
+        # timer expires. So, verify host is rebooting by expecting that host is unpingable.
+        Run Keyword If  '${sel_event}' == 'Power cycle'
+        ...  Wait Until Keyword Succeeds  1 min  10 sec  Verify Host Power State  ['off']
+        ...  ELSE
+        ...  Wait Until Keyword Succeeds  20 sec  5 sec  Is Host Unpingable  ${OS_HOST}
+        Wait Until Keyword Succeeds  5 min  30 sec  Verify Host Power State  ['on']
+        Wait Until Keyword Succeeds  7 min  30 sec  OS Execute Command  uptime
+    ELSE
+        Wait Until Keyword Succeeds  1 min  20 sec  Verify Host Power State  ${power_state}
+    END
+
     Verify Watchdog Timer Action SEL Event  ${sel_event}