blob: 5a7784a7af999590cc520c2e8593fc8f38d2e1ea [file] [log] [blame]
Steven Sombar43fae662017-09-22 09:05:58 -05001*** Settings ***
2Documentation Energy scale power capping tests.
3
Steven Sombar433b5262017-09-28 11:44:34 -05004
5# Acronyms
6# PL Power Limit
7# OCC On Chip Controller
8
9
10Resource ../lib/energy_scale_utils.robot
11Resource ../lib/rest_client.robot
12Resource ../lib/openbmc_ffdc.robot
13Resource ../lib/boot_utils.robot
14Resource ../lib/ipmi_client.robot
Steven Sombar43fae662017-09-22 09:05:58 -050015
16Suite Setup Suite Setup Execution
17Test Teardown Test Teardown Execution
18
19
Steven Sombare7b0bb02017-11-10 10:07:55 -060020
21*** Variables ****
22
23${max_power} 3050
24${near_max_power_50} 3000
25${near_max_power_100} 2950
26
27
28
Steven Sombar43fae662017-09-22 09:05:58 -050029*** Test Cases ***
30
31
32Escale System On And PL Enabled
Steven Sombar433b5262017-09-28 11:44:34 -050033 [Documentation] Change active power limit with system power on and
34 ... Power limit active.
Steven Sombar43fae662017-09-22 09:05:58 -050035 [Tags] Escale_System_On_And_PL_Enabled
36
Steven Sombare7b0bb02017-11-10 10:07:55 -060037 Set DCMI Power Limit And Verify ${max_power}
38
Steven Sombar43fae662017-09-22 09:05:58 -050039 REST Power On stack_mode=skip
40
41 OCC Tool Upload Setup
42
43 # Get OCC data from OS.
44 ${cmd}= Set Variable /tmp/occtoolp9 -p | grep -e State: -e Sensor:
45 ${output} ${stderr} ${rc}= OS Execute Command ${cmd}
46
47 # Check for expected responses.
48 Should Contain ${output} ACTIVE
49 Should Contain ${output} Sensor: TEMP
50 Should Contain ${output} Sensor: FREQ
51 Should Contain ${output} Sensor: POWR
52
53 ${power}= Get DCMI Power Limit
Steven Sombare7b0bb02017-11-10 10:07:55 -060054 Should Be True ${power} == ${max_power}
55 ... msg=DCMI power limit should be ${max_power}.
Steven Sombar43fae662017-09-22 09:05:58 -050056
57 Activate DCMI Power And Verify
58
Steven Sombare7b0bb02017-11-10 10:07:55 -060059 Set DCMI Power Limit And Verify ${near_max_power_50}
Steven Sombar43fae662017-09-22 09:05:58 -050060
61
62Escale System On And PL Disabled
George Keishing56f33502017-10-16 02:12:46 -050063 [Documentation] Change active power limit with system power on and
Steven Sombar433b5262017-09-28 11:44:34 -050064 ... deactivate power limit prior to change.
Steven Sombar43fae662017-09-22 09:05:58 -050065 [Tags] Escale_System_On_And_PL_Disabled
66
Steven Sombare7b0bb02017-11-10 10:07:55 -060067 ${power_setting}= Set Variable ${near_max_power_100}
Steven Sombar43fae662017-09-22 09:05:58 -050068
69 REST Power On stack_mode=skip
70
Steven Sombar43fae662017-09-22 09:05:58 -050071 Set DCMI Power Limit And Verify ${power_setting}
72
73 # Deactivate and check limit
74 Deactivate DCMI Power And Verify
75
Steven Sombare7b0bb02017-11-10 10:07:55 -060076 ${cmd}= Catenate dcmi power set_limit limit ${near_max_power_50}
Steven Sombar43fae662017-09-22 09:05:58 -050077 Run External IPMI Standard Command ${cmd}
78 ${power}= Get DCMI Power Limit
79
Steven Sombare7b0bb02017-11-10 10:07:55 -060080 Should Be True ${power} == ${near_max_power_50}
Steven Sombar6f72d882017-10-16 07:55:58 -050081 ... msg=Could not set power limit when power limiting deactivated.
Steven Sombar43fae662017-09-22 09:05:58 -050082
83
84Escale Check Settings System On Then Off
Steven Sombar433b5262017-09-28 11:44:34 -050085 [Documentation] Set power limit and activate power limit before
86 ... BMC state is power on.
Steven Sombar43fae662017-09-22 09:05:58 -050087 [Tags] Escale_Check_Settings_System_On_Then_Off
88
Steven Sombare7b0bb02017-11-10 10:07:55 -060089 ${power_setting}= Set Variable ${near_max_power_100}
Steven Sombar43fae662017-09-22 09:05:58 -050090
91 REST Power On stack_mode=skip
92
93 Set DCMI Power Limit And Verify ${power_setting}
94 Deactivate DCMI Power And Verify
95
96 ${power}= Get DCMI Power Limit
97 Should Be True ${power} == ${power_setting}
98 ... msg=dcmi power limit not set to ${power_setting} as expected.
99
100 Smart Power Off
101
102 Activate DCMI Power And Verify
103
104 REST Power On
105
106 ${power}= Get DCMI Power Limit
107 Should Be True ${power} == ${power_setting}
108 ... msg=Power limit setting of watts not retained at Runtime.
109
Steven Sombar43fae662017-09-22 09:05:58 -0500110 Deactivate DCMI Power And Verify
111
112
113Escale Check Settings System Off Then On
Steven Sombar433b5262017-09-28 11:44:34 -0500114 [Documentation] Set and activate power limit with system power off.
Steven Sombar43fae662017-09-22 09:05:58 -0500115 [Tags] Escale_Check_Settings_System_Off_Then_On
116
Steven Sombare7b0bb02017-11-10 10:07:55 -0600117 ${power_setting}= Set Variable ${near_max_power_50}
118
119 Set DCMI Power Limit And Verify ${power_setting}
Steven Sombar2560f502017-11-27 12:47:18 -0600120 Deactivate DCMI Power and Verify
Steven Sombar43fae662017-09-22 09:05:58 -0500121
122 Smart Power Off
123
Steven Sombare7b0bb02017-11-10 10:07:55 -0600124 # Check deactivated and the power limit.
Steven Sombar43fae662017-09-22 09:05:58 -0500125 Fail If DCMI Power Is Not Deactivated
126 ${power}= Get DCMI Power Limit
Steven Sombare7b0bb02017-11-10 10:07:55 -0600127 Should Be True ${power} == ${power_setting}
128 ... msg=DCMI power not set at ${power_setting} as expected
Steven Sombar43fae662017-09-22 09:05:58 -0500129
130 Activate DCMI Power And Verify
131 Set DCMI Power Limit And Verify ${power_setting}
132
133 REST Power On
134
135 Fail If DCMI Power Is Not Activated
136
137 ${power}= Get DCMI Power Limit
138 Should Be True ${power} == ${power_setting}
139 ... msg=Power limit setting not retained at Runtime.
140
141
142Escale Change Limit At Runtime
Steven Sombar433b5262017-09-28 11:44:34 -0500143 [Documentation] Change power limit at runtime.
Steven Sombar43fae662017-09-22 09:05:58 -0500144 [Tags] Escale_Change_Limit_At_Runtime
145
Steven Sombare7b0bb02017-11-10 10:07:55 -0600146 ${power_setting}= Set Variable ${near_max_power_100}
147
148 Set DCMI Power Limit And Verify ${near_max_power_50}
Steven Sombar43fae662017-09-22 09:05:58 -0500149
150 Smart Power Off
151
Steven Sombar43fae662017-09-22 09:05:58 -0500152 REST Power On stack_mode=skip
153
Steven Sombare7b0bb02017-11-10 10:07:55 -0600154 Set DCMI Power Limit And Verify ${power_setting}
155
Steven Sombar43fae662017-09-22 09:05:58 -0500156 # Check that DCMI power limit setting = ${power_setting}.
157 ${power}= Get DCMI Power Limit
158 Should Be True ${power} == ${power_setting}
159 ... msg=DCMI power limit not set to ${power_setting} watts as expected.
160
Steven Sombare7b0bb02017-11-10 10:07:55 -0600161 Set DCMI Power Limit And Verify ${max_power}
Steven Sombar43fae662017-09-22 09:05:58 -0500162
163
164Escale Disable And Enable At Runtime
Steven Sombar433b5262017-09-28 11:44:34 -0500165 [Documentation] Disable/enable power limit at runtime.
Steven Sombar43fae662017-09-22 09:05:58 -0500166 [Tags] Escale_Disable_And_Enable_At_Runtime
167
Steven Sombare7b0bb02017-11-10 10:07:55 -0600168 ${power_setting}= Set Variable ${near_max_power_50}
Steven Sombar43fae662017-09-22 09:05:58 -0500169
170 Smart Power Off
171
172 Set DCMI Power Limit And Verify ${power_setting}
173 Activate DCMI Power And Verify
174
175 # Power on the system.
176 REST Power On
177
178 # Check that DCMI power limit setting = ${power_setting}.
179 ${power}= Get DCMI Power Limit
180 Should Be True ${power} == ${power_setting}
181 ... msg=DCMI power limit not set to ${power_setting} watts as expected.
182
183 Deactivate DCMI Power And Verify
184
185 Activate DCMI Power And Verify
186
187 ${power}= Get DCMI Power Limit
188 Should Be True ${power} == ${power_setting}
189 ... msg=DCMI power limit not set to ${power_setting} watts as expected.
190
191
192*** Keywords ***
193
194
195Suite Setup Execution
196 [Documentation] Do test setup initialization.
197 # Power Off if system if not already off.
Steven Sombare7b0bb02017-11-10 10:07:55 -0600198 # Save initial settings.
199 # Deactivate power and set limit.
200
Steven Sombar43fae662017-09-22 09:05:58 -0500201 Smart Power Off
Steven Sombare7b0bb02017-11-10 10:07:55 -0600202
203 # Save the deactivation/activation setting.
204 ${cmd}= Catenate dcmi power get_limit | grep State
205 ${resp}= Run External IPMI Standard Command ${cmd}
206 # Response is either "Power Limit Active" or "No Active Power Limit".
207 ${initial_deactivation}= Get Count ${resp} No
208 # If deactivated: initial_deactivation = 1, 0 otherwise.
209 Set Suite Variable ${initial_deactivation} children=true
210
211 # Save the power limit setting.
212 ${initial_power_setting}= Get DCMI Power Limit
213 Set Suite Variable ${initial_power_setting} children=true
214
215 # Set power limiting deactivated.
Steven Sombar43fae662017-09-22 09:05:58 -0500216 Deactivate DCMI Power And Verify
Steven Sombare7b0bb02017-11-10 10:07:55 -0600217
218 # Set initial power setting value.
219 Set DCMI Power Limit And Verify ${max_power}
Steven Sombar43fae662017-09-22 09:05:58 -0500220
221
222Test Teardown Execution
223 [Documentation] Do the post test teardown.
224 # FFDC on test case fail.
225 # Power off the OS and wait for power off state.
Steven Sombare7b0bb02017-11-10 10:07:55 -0600226 # Return the system's intial deactivation/activation setting.
227 # Return the system's intial power limit setting.
Steven Sombar43fae662017-09-22 09:05:58 -0500228
229 FFDC On Test Case Fail
Steven Sombare7b0bb02017-11-10 10:07:55 -0600230
Steven Sombar43fae662017-09-22 09:05:58 -0500231 Smart Power Off
Steven Sombare7b0bb02017-11-10 10:07:55 -0600232
233 Run Keyword If '${initial_power_setting}' != '${0}'
234 ... Set DCMI Power Limit And Verify ${initial_power_setting}
235
236 Run Keyword If '${initial_deactivation}' == '${1}'
237 ... Deactivate DCMI Power And Verify ELSE Activate DCMI Power And Verify