Enable test cases for testing host auto reboot.

What test cases are added
  - Validate host quiesce state with auto reboot.
  - Validate host quiesce state without auto reboot.
  - Validate host quiesce state with auto reboot.
    during boot.
  - Validate host quiesce state without auto reboot
    during boot.

Resolves openbmc/openbmc-test-automation#322

Change-Id: I098aff9344dffc036e32192bcdb80a8750be5ce6
Signed-off-by: Rahul Maheshwari <rahulmaheshwari@in.ibm.com>
diff --git a/tests/test_host_auto_reboot.robot b/tests/test_host_auto_reboot.robot
new file mode 100644
index 0000000..e19b5e1
--- /dev/null
+++ b/tests/test_host_auto_reboot.robot
@@ -0,0 +1,86 @@
+*** Settings ***
+
+Documentation       Test auto reboot functionality of host.
+
+Resource            ../lib/openbmc_ffdc.robot
+Resource            ../lib/rest_client.robot
+Resource            ../lib/state_manager.robot
+
+Test Setup          Open Connection And Log In
+Test Teardown       Post Testcase Execution
+
+*** Variables ***
+
+
+*** Test Cases ***
+
+Verify Host Quiesce State Without Auto Reboot
+    # Description of template fields:
+    # Auto Reboot   Host State     Expected Host Action
+    no              Off            No Reboot
+    [Documentation]  Validate "Quiesce" state without auto reboot.
+    [Tags]  Verify_Host_Quiesce_State_Without_Auto_Reboot
+    [Template]  Verify Host Quiesce State
+
+Verify Host Quiesce State With Auto Reboot
+    # Description of template fields:
+    # Auto Reboot   Host State     Expected Host Action
+    yes             Off            Reboot
+    [Documentation]  Validate "Quiesce" state with auto reboot.
+    [Tags]  Verify_Host_Quiesce_State_With_Auto_Reboot
+    [Template]  Verify Host Quiesce State
+
+Verify Host Quiesce State Without Auto Reboot During Boot
+    # Description of template fields:
+    # Auto Reboot   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
+
+Verify Host Quiesce State With Auto Reboot During Boot
+    # Description of template fields:
+    # Auto Reboot   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
+
+
+*** Keywords ***
+
+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").
+
+    Set Auto Reboot  ${auto_reboot}
+
+    Run Keyword If  '${host_state}' == 'Off'  Initiate Host PowerOff
+    ...  ELSE IF  '${host_state}' == 'Booting'
+    ...  Run Keywords  Initiate Host PowerOff  AND  Initiate Host Boot
+
+    Trigger Host Watchdog Error
+    ${resp}=  Run Keyword And Return Status  Is Host Rebooted
+
+    Run Keyword If  '${action}' == 'No Reboot'
+    ...  Run Keywords  Should Be Equal  ${resp}  ${False}  AND
+    ...  Wait Until Keyword Succeeds  3 min  5 sec  Is Host Quiesced  AND
+    ...  Recover Quiesced Host
+    ...  ELSE IF  '${action}' == 'Reboot'
+    ...  Wait Until Keyword Succeeds  3 min  5 sec  Is Host Rebooted
+
+
+Post Testcase Execution
+    [Documentation]  Do the post test teardown.
+    ...  1. Capture FFDC on test failure.
+    ...  2. Set default value for auto reboot.
+    ...  3. Close all open SSH connections.
+
+    FFDC On Test Case Fail
+    Set Auto Reboot  yes
+    Close All Connections