Added 'Smart Power Off' boot test.
Change-Id: I16431a1fad808aa0925a30279b1635e8faa13712
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/boot_utils.robot b/lib/boot_utils.robot
index 8caa1c8..a7ed612 100644
--- a/lib/boot_utils.robot
+++ b/lib/boot_utils.robot
@@ -529,3 +529,36 @@
###############################################################################
+# Additional boot test keywords.
+###############################################################################
+Smart Power Off
+ [Documentation] Do a smart power off.
+ [Arguments] ${quiet}=${QUIET}
+
+ # A 'Smart Power Off' consists of a 'REST Power Off' with recovery.
+ # Namely, if the 'REST Power Off' fails, a 'REST Hard Power Off' will
+ # be attempted.
+
+ # Description of argument(s):
+ # quiet If this parameter is set to ${1}, this
+ # keyword will print only essential
+ # information. The default value is the
+ # global value of "${quiet}"
+
+
+ # OBMC Boot Test will restore global quiet to initial global value.
+ # Unfortunately, that restore affects our local quiet so we must
+ # preserve it.
+ ${loc_quiet}= Set Variable ${quiet}
+ ${cmd_buf}= Catenate REST Power Off \ stack_mode=skip
+ ... \ \ quiet=${loc_quiet}
+ ${status} ${ret_values}= Run Key U ${cmd_buf} ignore=${1}
+ ... quiet=${loc_quiet}
+
+ Run Keyword If '${status}' == 'PASS' Return From Keyword
+
+ ${cmd_buf}= Catenate REST Hard Power Off \ stack_mode=skip
+ ... \ \ quiet=${loc_quiet}
+ Run Key U ${cmd_buf} quiet=${loc_quiet}
+
+###############################################################################