blob: f83de19aff75a41c26e7c3dbe4921e74e8478148 [file] [log] [blame]
Ashwini Chandrappa030ee002021-09-06 06:53:18 -05001*** Settings ***
2Documentation This suite tests Timed Power On(TPO) feature via busctl command
3... and verify the power status of the system.
4...
5... System can be scheduled to Power ON at a specified time by using this feature.
6
7
8Resource ../lib/boot_utils.robot
9Resource ../lib/openbmc_ffdc.robot
10Resource ../lib/bmc_redfish_resource.robot
11
12
13Suite Setup Redfish.Login
14Suite Teardown Redfish.Logout
15Test Setup Test Setup Execution
16Test Teardown Test Teardown Execution
17
18
19*** Variables ****
20
George Keishing5654fbe2022-07-13 06:48:55 -050021${CMD_ENABLE_TPO} busctl set-property xyz.openbmc_project.State.ScheduledHostTransition
22... /xyz/openbmc_project/state/host0 xyz.openbmc_project.State.ScheduledHostTransition
23... ScheduledTransition s "xyz.openbmc_project.State.Host.Transition.On"
24
Ashwini Chandrappa030ee002021-09-06 06:53:18 -050025${CMD_SET_TPO_TIME} busctl set-property xyz.openbmc_project.State.ScheduledHostTransition
26... /xyz/openbmc_project/state/host0 xyz.openbmc_project.State.ScheduledHostTransition ScheduledTime t
27
28${CMD_GET_TPO_TIME} busctl get-property xyz.openbmc_project.State.ScheduledHostTransition
29... /xyz/openbmc_project/state/host0 xyz.openbmc_project.State.ScheduledHostTransition ScheduledTime
30
George Keishing5654fbe2022-07-13 06:48:55 -050031# Time in seconds.
Ashwini Chandrappa030ee002021-09-06 06:53:18 -050032${TIMER_POWER_ON} 100
33
George Keishing096cc072022-07-13 11:57:15 -050034# All current versions of the following distributions:
35# - Red Hat Enterprise Linux
36# - SUSE Linux Enterprise Server
37# Tested on RHEL 8.4.
38
39# Shut down the system and schedule it to restart in 1 hour.
40# User can input -v HOST_TIMER_POWER_ON:h24 ( e.g. 24 hours )
41${HOST_TIMER_POWER_ON} h1
42${HOST_TIMED_POWER_ON_REQUEST} set_poweron_time -d ${HOST_TIMER_POWER_ON} -s
Ashwini Chandrappa030ee002021-09-06 06:53:18 -050043
44*** Test Cases ***
45
George Keishing5654fbe2022-07-13 06:48:55 -050046Test Timed Powered On Via BMC
47 [Documentation] Set time to power on host attribute ScheduledTime and expect
48 ... the system to boot on scheduled time.
49 [Tags] Test_Timed_Powered_On_Via_BMC
50
51 # Make sure the host is powered off.
52 Redfish Power Off stack_mode=skip
53
54 # Set Host transition to ON to enable TPO.
55 BMC Execute Command ${CMD_ENABLE_TPO}
Ashwini Chandrappa030ee002021-09-06 06:53:18 -050056
57 ${tpo_set_value}= Set Timer For Power ON
58 ${new_tpo_value}= Get Time Power ON Value
George Keishing5654fbe2022-07-13 06:48:55 -050059
Ashwini Chandrappa030ee002021-09-06 06:53:18 -050060 Should Be Equal ${new_tpo_value} ${tpo_set_value}
George Keishing5654fbe2022-07-13 06:48:55 -050061 ... msg=TPO time set mismatched.
62
63 # Check if the system BootProgress state changed. If changed, it implies the
64 # system is powering on. Though we have set system to power on in 100 seconds
65 # since, the system boot sometime to change.
66 Wait Until Keyword Succeeds 10 min 20 sec Is Boot Progress Changed
67
George Keishing096cc072022-07-13 11:57:15 -050068 Log To Console BMC Scheduled Time Power on success.
69
70
71Test Timed Powered On Via Host OS
72 [Documentation] Set time to power on host via service aids tool set_poweron_time
73 ... and expect the system to boot on scheduled time.
74 [Tags] Test_Timed_Powered_On_Via_Host_OS
75
76 # Make sure the host is powered on and booted to host OS partition.
77 Redfish Power On
78
79 ${stdout} ${stderr} ${rc}= OS Execute Command which set_poweron_time ignore_err=${0}
80 # Skip the test if the tool does not exist or error getting the tool.
81 Skip If ${rc} != ${0} INFO: ${stdout} Skip the test since the tool does not. Install and re-run.
82
83 # Set Host transition to ON to enable TPO.
84 ${stdout} ${stderr} ${rc}= OS Execute Command ${HOST_TIMED_POWER_ON_REQUEST} ignore_err=${0}
85
86 # Wait for host to Power off.
87 Wait Until Keyword Succeeds 45 min 30 sec Is BMC Standby
88
89 Log To Console Power Off completed.
90
91 # Note: The verification could more precise by checking date and set time.
92
93 # Check if the system BootProgress state changed. If changed, it implies the
94 # system is powering on after user timer set and delta time to update BootProgress
95 # state by the state manager.
96 # ${HOST_TIMER_POWER_ON} is in <m/h/d/><time> format
97 # Example: h1 , logic to convert x[1:] -> 1 and x[:1] ->h to robot format 1 h.
98
99 Log To Console Waiting for system to power on.
100 Wait Until Keyword Succeeds ${HOST_TIMER_POWER_ON[1:]} ${HOST_TIMER_POWER_ON[:1]} 30 sec
101 ... Is Boot Progress Changed
102
103 Log To Console Host Scheduled Time Power on success.
Ashwini Chandrappa030ee002021-09-06 06:53:18 -0500104
105
106*** Keywords ***
107
108Test Setup Execution
109 [Documentation] Do test case setup tasks.
110
George Keishing5654fbe2022-07-13 06:48:55 -0500111 Redfish.Login
Ashwini Chandrappa030ee002021-09-06 06:53:18 -0500112
113
114Test Teardown Execution
115 [Documentation] Do the test teardown
116
117 FFDC On Test Case Fail
Ashwini Chandrappa030ee002021-09-06 06:53:18 -0500118
119
120Set Timer For Power ON
121 [Documentation] Set the time for power ON with given value.
122
123 ${current_bmc_time}= BMC Execute Command date +%s
124 ${time_set}= Evaluate ${current_bmc_time[0]} + ${TIMER_POWER_ON}
125 BMC Execute Command ${CMD_SET_TPO_TIME} ${time_set}
126
127 [Return] ${time_set}
128
129
130Get Time Power ON Value
131 [Documentation] Returns time power ON value.
132
133 ${timer_value}= BMC Execute Command ${CMD_GET_TPO_TIME}
134 @{return_value}= Split String ${timer_value[0]}
135 ${return_value}= Evaluate ${return_value}[1]
136
137 # BMC command returns integer value.
138 [Return] ${return_value}