Added support for new 'REST Hard Power Off' test.

Change-Id: Ia1767cfad2b06d7b56bf19ef41c7103b6310ff5d
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/data/boot_lists/All b/data/boot_lists/All
index 567ca44..c75b10b 100755
--- a/data/boot_lists/All
+++ b/data/boot_lists/All
@@ -6,6 +6,8 @@
 IPMI Power On (mfg)
 REST Power Off
 REST Power Off (mfg)
+REST Hard Power Off
+REST Hard Power Off (mfg)
 IPMI Power Off
 IPMI Power Off (mfg)
 IPMI Power Soft
diff --git a/data/boot_lists/Manufacturing b/data/boot_lists/Manufacturing
index c3254c5..ea07c75 100755
--- a/data/boot_lists/Manufacturing
+++ b/data/boot_lists/Manufacturing
@@ -1,6 +1,7 @@
 REST Power On (mfg)
 IPMI Power On (mfg)
 REST Power Off (mfg)
+REST Hard Power Off (mfg)
 IPMI Power Off (mfg)
 IPMI Power Soft (mfg)
 Host Power Off (mfg)
diff --git a/data/boot_lists/Power_off b/data/boot_lists/Power_off
index 268b8da..4b0bb5a 100755
--- a/data/boot_lists/Power_off
+++ b/data/boot_lists/Power_off
@@ -1,5 +1,7 @@
 REST Power Off
 REST Power Off (mfg)
+REST Hard Power Off
+REST Hard Power Off (mfg)
 IPMI Power Off
 IPMI Power Off (mfg)
 IPMI Power Soft
diff --git a/data/boot_table.json b/data/boot_table.json
index 27f61fe..4c81f8a 100644
--- a/data/boot_table.json
+++ b/data/boot_table.json
@@ -68,6 +68,26 @@
         "method": "Initiate Host PowerOff  wait=${0}",
         "lib_file_path": "state_manager.robot"
     },
+    # Initiate a hard power off using the REST API interface.
+    "REST Hard Power Off": {
+        "start": {
+            "rest": "^1$",
+            "chassis": "^On$"
+        },
+        "end": {
+            "rest": "^1$",
+            "chassis": "^Off$",
+            "boot_progress": "^Off|Unspecified$",
+            "host": "^Off$",
+            "os_ping": "^0$",
+            "os_login": "^0$",
+            "os_run_cmd": "^0$"
+        },
+        "bmc_reboot": 0,
+        "method_type": "keyword",
+        "method": "Hard Power Off  wait=${0}",
+        "lib_file_path": "state_manager.robot"
+    },
     # Initiate a power off using the IPMI interface.
     "IPMI Power Off": {
         "start": {
diff --git a/lib/boot_utils.robot b/lib/boot_utils.robot
index f7ae504..8caa1c8 100644
--- a/lib/boot_utils.robot
+++ b/lib/boot_utils.robot
@@ -93,6 +93,35 @@
 
 
 ###############################################################################
+REST Hard Power Off
+    [Documentation]  Do "REST Hard Power Off" boot test.
+    [Arguments]  ${stack_mode}=${stack_mode}  ${quiet}=${quiet}
+
+    # Description of argument(s):
+    # stack_mode                    If stack_mode is set to "skip", each test
+    #                               specified in the boot_stack is only
+    #                               performed if the machine is not already in
+    #                               the state that would normally result from
+    #                               running the given boot test.  Otherwise,
+    #                               the test is skipped.  If stack_mode is set
+    #                               to "normal", all tests from the boot_stack
+    #                               are performed.  "skip" mode is useful when
+    #                               you simply want the machine in a desired
+    #                               state.  The default value is the global
+    #                               value of "${stack_mode}"
+    # quiet                         If this parameter is set to ${1}, this
+    #                               keyword will print only essential
+    #                               information.  The default value is the
+    #                               global value of "${quiet}"
+
+    ${cmd_buf}  Catenate  OBMC Boot Test \ loc_boot_stack=REST Hard Power Off
+    ...  \ loc_stack_mode=${stack_mode} \ loc_quiet=${quiet}
+    Run Key U  ${cmd_buf}
+
+###############################################################################
+
+
+###############################################################################
 IPMI Power Off
     [Documentation]  Do "IPMI Power Off" boot test.
     [Arguments]  ${stack_mode}=${stack_mode}  ${quiet}=${quiet}
diff --git a/lib/state_manager.robot b/lib/state_manager.robot
index a9082f8..5ea733f 100755
--- a/lib/state_manager.robot
+++ b/lib/state_manager.robot
@@ -62,11 +62,18 @@
 
 Hard Power Off
     [Documentation]  Do a hard power off.
+    [Arguments]  ${wait}=${1}
+
+    # Description of argument(s):
+    # wait  Indicates that this keyword should wait for host off state.
 
     ${args}=  Create Dictionary  data=${CHASSIS_POWEROFF_TRANS}
     Write Attribute
     ...  ${CHASSIS_STATE_URI}  RequestedPowerTransition  data=${args}
 
+    # Does caller want to wait for status?
+    Run Keyword If  '${wait}' == '${0}'  Return From Keyword
+
     Wait Until Keyword Succeeds
     ...  1 min  10 sec  Run Keywords  Is Chassis Off  AND  Is Host Off