Trigger host watchdog error when host actually starts to boot.

Resolves openbmc/openbmc-test-automation#731

Change-Id: I20ef948b875e37368ae9091914920d910de3ee85
Signed-off-by: Rahul Maheshwari <rahulmaheshwari@in.ibm.com>
diff --git a/lib/utils.robot b/lib/utils.robot
index 2453e1a..bf84dac 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -342,6 +342,17 @@
     ${boot_progress}=  Get Boot Progress
     Should Be Equal  ${boot_progress}  Off
 
+Get Boot Progress To OS Starting State
+    [Documentation]  Get the system to a boot progress state of 'FW Progress,
+    ...  Starting OS'.
+
+    ${boot_progress}=  Get Boot Progress
+    Run Keyword If  '${boot_progress}' == 'FW Progress, Starting OS'
+    ...  Log  Host is already in OS starting state
+    ...  ELSE
+    ...  Run Keywords  Initiate Host PowerOff  AND  Initiate Host Boot
+    ...  AND  Wait Until Keyword Succeeds  10 min  10 sec  Is OS Starting
+
 Verify Ping and REST Authentication
     ${l_ping}=   Run Keyword And Return Status
     ...    Ping Host  ${OPENBMC_HOST}
diff --git a/tests/test_host_auto_reboot.robot b/tests/test_host_auto_reboot.robot
index 9e469cc..f93c4f9 100644
--- a/tests/test_host_auto_reboot.robot
+++ b/tests/test_host_auto_reboot.robot
@@ -16,8 +16,8 @@
 
 Verify Host Quiesce State Without Auto Reboot During Boot
     # Description of template fields:
-    # Auto Reboot   Host State     Expected Host Action
-    no              Booting        No Reboot
+    # Auto Reboot   Initial Host State     Expected Host Action
+    no              Booting                No Reboot
     [Documentation]  Validate "Quiesce" state during IPL.
     [Tags]  Verify_Host_Quiesce_State_Without_Auto_Reboot_During_Boot
     [Template]  Verify Host Quiesce State
@@ -25,8 +25,8 @@
 
 Verify Host Quiesce State With Auto Reboot During Boot
     # Description of template fields:
-    # Auto Reboot   Host State     Expected Host Action
-    yes             Booting        Reboot
+    # Auto Reboot   Initial Host State     Expected Host Action
+    yes             Booting                Reboot
     [Documentation]  Validate "Quiesce" state during IPL.
     [Tags]  Verify_Host_Quiesce_State_With_Auto_Reboot_During_Boot
     [Template]  Verify Host Quiesce State
@@ -37,17 +37,18 @@
 Verify Host Quiesce State
     [Documentation]  Inject watchdog error on host to reach "Quiesce" state.
     ...  Later recover host from this state.
-    [Arguments]  ${auto_reboot}  ${host_state}  ${action}
-    # Description of Arguments:
-    # auto_reboot  Auto reboot setting ("yes" or "no").
-    # host_state   State of host before injecting error.
-    # action       Action of host due to error ("No Reboot" or "Reboot").
+    [Arguments]  ${auto_reboot}  ${initial_host_state}  ${action}
+    # Description of argument(s):
+    # auto_reboot          Auto reboot setting ("yes" or "no").
+    # initial_host_state   State of host before injecting error.
+    # action               Action of host due to error ("No Reboot" or
+                           "Reboot").
 
     Set Auto Reboot  ${auto_reboot}
 
-    Run Keyword If  '${host_state}' == 'Off'  Initiate Host PowerOn
-    ...  ELSE IF  '${host_state}' == 'Booting'
-    ...  Run Keywords  Initiate Host PowerOff  AND  Initiate Host Boot
+    Run Keyword If  '${initial_host_state}' == 'Booting'
+    # Booting refers to host OS starting in progress.
+    ...  Run Keywords  Get Boot Progress To OS Starting State
 
     Trigger Host Watchdog Error
     ${resp}=  Run Keyword And Return Status  Is Host Rebooted