DMTF tool power on operation
Change-Id: I871dba155609a029ce659fa12881e9facc8ac632
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/state.py b/lib/state.py
index a0cd4a9..08b0c18 100755
--- a/lib/state.py
+++ b/lib/state.py
@@ -145,9 +145,9 @@
standby_match_state = DotDict([('rest', '^1$'),
('chassis', '^Off$'),
('bmc', '^Ready$'),
- ('boot_progress', '^$'),
- ('operating_system', '^$'),
- ('host', '^$')])
+ ('boot_progress', '^Off|Unspecified$'),
+ ('operating_system', '^Inactive$'),
+ ('host', '^Off$')])
# A match state for checking that the system is at "os running".
os_running_match_state = DotDict([('chassis', '^On$'),
diff --git a/redfish/dmtf_tools/Redfish_Usecase_Checkers.robot b/redfish/dmtf_tools/Redfish_Usecase_Checkers.robot
index 42c1b0e..09620a6 100644
--- a/redfish/dmtf_tools/Redfish_Usecase_Checkers.robot
+++ b/redfish/dmtf_tools/Redfish_Usecase_Checkers.robot
@@ -1,24 +1,33 @@
*** Settings ***
-Documentation Test BMC using https://github.com/DMTF/Redfish-Usecase-Checkers
-... DMTF tool.
+Documentation Test BMC using https://github.com/DMTF/Redfish-Usecase-Checkers
+... DMTF tool.
-Library OperatingSystem
-Resource ../../lib/dmtf_tools_utils.robot
-Resource ../../lib/openbmc_ffdc.robot
+Library OperatingSystem
+Library ../../lib/state.py
+Resource ../../lib/dmtf_tools_utils.robot
+Resource ../../lib/openbmc_ffdc.robot
-Test Setup Test Setup Execution
-Test Teardown Test Teardown Execution
+Test Setup Test Setup Execution
+Test Teardown Test Teardown Execution
*** Variables ***
-${DEFAULT_PYTHON} python3
+${DEFAULT_PYTHON} python3
-${rsv_github_url} https://github.com/DMTF/Redfish-Usecase-Checkers.git
-${rsv_dir_path} Redfish-Usecase-Checkers
+${rsv_github_url} https://github.com/DMTF/Redfish-Usecase-Checkers.git
+${rsv_dir_path} Redfish-Usecase-Checkers
-${command_account} ${DEFAULT_PYTHON} ${rsv_dir_path}${/}account_management/account_management.py
-... -r ${OPENBMC_HOST} -u ${OPENBMC_USERNAME}
-... -p ${OPENBMC_PASSWORD} -S Always -d ${EXECDIR}${/}logs${/} -v
+${command_account} ${DEFAULT_PYTHON} ${rsv_dir_path}${/}account_management/account_management.py
+... -r ${OPENBMC_HOST} -u ${OPENBMC_USERNAME}
+... -p ${OPENBMC_PASSWORD} -S Always -d ${EXECDIR}${/}logs${/} -v
+
+${command_power_control} ${DEFAULT_PYTHON} ${rsv_dir_path}${/}power_control/power_control.py
+... -r ${OPENBMC_HOST} -u ${OPENBMC_USERNAME}
+... -p ${OPENBMC_PASSWORD} -S Always --F
+
+${power_on_timeout} 15 mins
+${power_off_timeout} 15 mins
+${state_change_timeout} 3 mins
*** Test Case ***
@@ -31,14 +40,81 @@
${output}= Shell Cmd cat ${EXECDIR}${/}logs${/}results.json
Log ${output}
+
+Test BMC Redfish Boot Host And ForceOff
+ [Documentation] Boot host and ForceOff.
+ [Tags] Test_BMC_Redfish_Boot_Host_And_ForceOff
+
+ DMTF Power On
+ DMTF Hard Power Off
+
+
+Test BMC Redfish Boot Host And GracefulShutdown
+ [Documentation] Boot host and issue GracefulShutdown.
+ [Tags] Test_BMC_Redfish_Boot_Host_And_GracefulShutdown
+
+ DMTF Power On
+ DMTF Power Off
+
+
*** Keywords ***
Test Setup Execution
[Documentation] Do test case setup tasks.
+ Printn
Download DMTF Tool ${rsv_dir_path} ${rsv_github_url}
+ ${status} ${state}= Run Keyword And Ignore Error
+ ... Check State standby_match_state
+ Return From Keyword If '${status}' == 'PASS'
+ DMTF Power Off
+
+
Test Teardown Execution
[Documentation] Do the post-test teardown.
+ Printn
FFDC On Test Case Fail
+
+
+DMTF Power On
+ [Documentation] Power the BMC machine on via DMTF tools.
+
+ Print Timen Doing "DMTF Power On".
+
+ ${state}= Get State
+ ${match_state}= Anchor State ${state}
+ Run DMTF Tool ${rsv_dir_path} ${command_power_control} On
+ ${state}= Wait State ${match_state} wait_time=${state_change_timeout} interval=10 seconds invert=1
+ ${state}= Wait State os_running_match_state wait_time=${power_on_timeout} interval=10 seconds
+
+ [Return] ${state}
+
+
+DMTF Power Off
+ [Documentation] Power the BMC machine off via DMTF tools.
+
+ Print Timen Doing "DMTF Hard Power Off".
+
+ ${state}= Get State
+ ${match_state}= Anchor State ${state}
+ Run DMTF Tool ${rsv_dir_path} ${command_power_control} GracefulShutdown
+ ${state}= Wait State ${match_state} wait_time=${state_change_timeout} interval=10 seconds invert=1
+ ${state}= Wait State standby_match_state wait_time=${power_off_timeout} interval=10 seconds
+
+ [Return] ${state}
+
+
+DMTF Hard Power Off
+ [Documentation] Power the BMC machine off via DMTF tools.
+
+ Print Timen Doing "DMTF Hard Power Off".
+
+ ${state}= Get State
+ ${match_state}= Anchor State ${state}
+ Run DMTF Tool ${rsv_dir_path} ${command_power_control} ForceOff
+ ${state}= Wait State ${match_state} wait_time=${state_change_timeout} interval=10 seconds invert=1
+ ${state}= Wait State standby_match_state wait_time=${power_off_timeout} interval=10 seconds
+
+ [Return] ${state}