blob: 0597306db4edf1f7c7b884b952f867e03a2d628c [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 Sombar5c17b012018-01-17 11:30:10 -060015Resource ../syslib/utils_os.robot
16
Steven Sombar43fae662017-09-22 09:05:58 -050017
18Suite Setup Suite Setup Execution
19Test Teardown Test Teardown Execution
20
21
Steven Sombare7b0bb02017-11-10 10:07:55 -060022
23*** Variables ****
24
25${max_power} 3050
26${near_max_power_50} 3000
27${near_max_power_100} 2950
28
29
30
Steven Sombar43fae662017-09-22 09:05:58 -050031*** Test Cases ***
32
33
34Escale System On And PL Enabled
Steven Sombar433b5262017-09-28 11:44:34 -050035 [Documentation] Change active power limit with system power on and
36 ... Power limit active.
Steven Sombar43fae662017-09-22 09:05:58 -050037 [Tags] Escale_System_On_And_PL_Enabled
38
Steven Sombare7b0bb02017-11-10 10:07:55 -060039 Set DCMI Power Limit And Verify ${max_power}
40
Steven Sombar43fae662017-09-22 09:05:58 -050041 REST Power On stack_mode=skip
42
Steven Sombar5c17b012018-01-17 11:30:10 -060043 Tool Exist opal-prd
Steven Sombar43fae662017-09-22 09:05:58 -050044 OCC Tool Upload Setup
45
46 # Get OCC data from OS.
47 ${cmd}= Set Variable /tmp/occtoolp9 -p | grep -e State: -e Sensor:
48 ${output} ${stderr} ${rc}= OS Execute Command ${cmd}
49
50 # Check for expected responses.
51 Should Contain ${output} ACTIVE
52 Should Contain ${output} Sensor: TEMP
53 Should Contain ${output} Sensor: FREQ
54 Should Contain ${output} Sensor: POWR
55
Steven Sombar5c17b012018-01-17 11:30:10 -060056 # Disable OCC.
57 ${output} ${stderr} ${rc}= OS Execute Command opal-prd occ disable
58 # With OCC disabled we should have OBSERVATION in output.
59 ${output} ${stderr} ${rc}= OS Execute Command ${cmd}
60 Should Contain ${output} OBSERVATION
61
62 # Re-enable OCC for remaining tests.
63 ${output} ${stderr} ${rc}= OS Execute Command opal-prd occ enable
64 ${output} ${stderr} ${rc}= OS Execute Command ${cmd}
65 Should Contain ${output} ACTIVE
66
Steven Sombar43fae662017-09-22 09:05:58 -050067 ${power}= Get DCMI Power Limit
Steven Sombare7b0bb02017-11-10 10:07:55 -060068 Should Be True ${power} == ${max_power}
69 ... msg=DCMI power limit should be ${max_power}.
Steven Sombar43fae662017-09-22 09:05:58 -050070
71 Activate DCMI Power And Verify
72
Steven Sombare7b0bb02017-11-10 10:07:55 -060073 Set DCMI Power Limit And Verify ${near_max_power_50}
Steven Sombar43fae662017-09-22 09:05:58 -050074
75
76Escale System On And PL Disabled
George Keishing56f33502017-10-16 02:12:46 -050077 [Documentation] Change active power limit with system power on and
Steven Sombar433b5262017-09-28 11:44:34 -050078 ... deactivate power limit prior to change.
Steven Sombar43fae662017-09-22 09:05:58 -050079 [Tags] Escale_System_On_And_PL_Disabled
80
Steven Sombare7b0bb02017-11-10 10:07:55 -060081 ${power_setting}= Set Variable ${near_max_power_100}
Steven Sombar43fae662017-09-22 09:05:58 -050082
83 REST Power On stack_mode=skip
84
Steven Sombar43fae662017-09-22 09:05:58 -050085 Set DCMI Power Limit And Verify ${power_setting}
86
87 # Deactivate and check limit
88 Deactivate DCMI Power And Verify
89
Steven Sombare7b0bb02017-11-10 10:07:55 -060090 ${cmd}= Catenate dcmi power set_limit limit ${near_max_power_50}
Steven Sombar43fae662017-09-22 09:05:58 -050091 Run External IPMI Standard Command ${cmd}
92 ${power}= Get DCMI Power Limit
93
Steven Sombare7b0bb02017-11-10 10:07:55 -060094 Should Be True ${power} == ${near_max_power_50}
Steven Sombar6f72d882017-10-16 07:55:58 -050095 ... msg=Could not set power limit when power limiting deactivated.
Steven Sombar43fae662017-09-22 09:05:58 -050096
97
98Escale Check Settings System On Then Off
Steven Sombar433b5262017-09-28 11:44:34 -050099 [Documentation] Set power limit and activate power limit before
100 ... BMC state is power on.
Steven Sombar43fae662017-09-22 09:05:58 -0500101 [Tags] Escale_Check_Settings_System_On_Then_Off
102
Steven Sombare7b0bb02017-11-10 10:07:55 -0600103 ${power_setting}= Set Variable ${near_max_power_100}
Steven Sombar43fae662017-09-22 09:05:58 -0500104
105 REST Power On stack_mode=skip
106
107 Set DCMI Power Limit And Verify ${power_setting}
108 Deactivate DCMI Power And Verify
109
110 ${power}= Get DCMI Power Limit
111 Should Be True ${power} == ${power_setting}
112 ... msg=dcmi power limit not set to ${power_setting} as expected.
113
114 Smart Power Off
115
116 Activate DCMI Power And Verify
117
118 REST Power On
119
120 ${power}= Get DCMI Power Limit
121 Should Be True ${power} == ${power_setting}
122 ... msg=Power limit setting of watts not retained at Runtime.
123
Steven Sombar43fae662017-09-22 09:05:58 -0500124 Deactivate DCMI Power And Verify
125
126
127Escale Check Settings System Off Then On
Steven Sombar433b5262017-09-28 11:44:34 -0500128 [Documentation] Set and activate power limit with system power off.
Steven Sombar43fae662017-09-22 09:05:58 -0500129 [Tags] Escale_Check_Settings_System_Off_Then_On
130
Steven Sombare7b0bb02017-11-10 10:07:55 -0600131 ${power_setting}= Set Variable ${near_max_power_50}
132
133 Set DCMI Power Limit And Verify ${power_setting}
Steven Sombar2560f502017-11-27 12:47:18 -0600134 Deactivate DCMI Power and Verify
Steven Sombar43fae662017-09-22 09:05:58 -0500135
136 Smart Power Off
137
Steven Sombare7b0bb02017-11-10 10:07:55 -0600138 # Check deactivated and the power limit.
Steven Sombar43fae662017-09-22 09:05:58 -0500139 Fail If DCMI Power Is Not Deactivated
140 ${power}= Get DCMI Power Limit
Steven Sombare7b0bb02017-11-10 10:07:55 -0600141 Should Be True ${power} == ${power_setting}
142 ... msg=DCMI power not set at ${power_setting} as expected
Steven Sombar43fae662017-09-22 09:05:58 -0500143
144 Activate DCMI Power And Verify
145 Set DCMI Power Limit And Verify ${power_setting}
146
147 REST Power On
148
149 Fail If DCMI Power Is Not Activated
150
151 ${power}= Get DCMI Power Limit
152 Should Be True ${power} == ${power_setting}
153 ... msg=Power limit setting not retained at Runtime.
154
155
156Escale Change Limit At Runtime
Steven Sombar433b5262017-09-28 11:44:34 -0500157 [Documentation] Change power limit at runtime.
Steven Sombar43fae662017-09-22 09:05:58 -0500158 [Tags] Escale_Change_Limit_At_Runtime
159
Steven Sombare7b0bb02017-11-10 10:07:55 -0600160 ${power_setting}= Set Variable ${near_max_power_100}
161
162 Set DCMI Power Limit And Verify ${near_max_power_50}
Steven Sombar43fae662017-09-22 09:05:58 -0500163
164 Smart Power Off
165
Steven Sombar43fae662017-09-22 09:05:58 -0500166 REST Power On stack_mode=skip
167
Steven Sombare7b0bb02017-11-10 10:07:55 -0600168 Set DCMI Power Limit And Verify ${power_setting}
169
Steven Sombar43fae662017-09-22 09:05:58 -0500170 # Check that DCMI power limit setting = ${power_setting}.
171 ${power}= Get DCMI Power Limit
172 Should Be True ${power} == ${power_setting}
173 ... msg=DCMI power limit not set to ${power_setting} watts as expected.
174
Steven Sombare7b0bb02017-11-10 10:07:55 -0600175 Set DCMI Power Limit And Verify ${max_power}
Steven Sombar43fae662017-09-22 09:05:58 -0500176
177
178Escale Disable And Enable At Runtime
Steven Sombar433b5262017-09-28 11:44:34 -0500179 [Documentation] Disable/enable power limit at runtime.
Steven Sombar43fae662017-09-22 09:05:58 -0500180 [Tags] Escale_Disable_And_Enable_At_Runtime
181
Steven Sombare7b0bb02017-11-10 10:07:55 -0600182 ${power_setting}= Set Variable ${near_max_power_50}
Steven Sombar43fae662017-09-22 09:05:58 -0500183
184 Smart Power Off
185
186 Set DCMI Power Limit And Verify ${power_setting}
187 Activate DCMI Power And Verify
188
189 # Power on the system.
190 REST Power On
191
192 # Check that DCMI power limit setting = ${power_setting}.
193 ${power}= Get DCMI Power Limit
194 Should Be True ${power} == ${power_setting}
195 ... msg=DCMI power limit not set to ${power_setting} watts as expected.
196
197 Deactivate DCMI Power And Verify
198
199 Activate DCMI Power And Verify
200
201 ${power}= Get DCMI Power Limit
202 Should Be True ${power} == ${power_setting}
203 ... msg=DCMI power limit not set to ${power_setting} watts as expected.
204
205
206*** Keywords ***
207
208
209Suite Setup Execution
210 [Documentation] Do test setup initialization.
211 # Power Off if system if not already off.
Steven Sombare7b0bb02017-11-10 10:07:55 -0600212 # Save initial settings.
213 # Deactivate power and set limit.
214
Steven Sombar43fae662017-09-22 09:05:58 -0500215 Smart Power Off
Steven Sombare7b0bb02017-11-10 10:07:55 -0600216
217 # Save the deactivation/activation setting.
218 ${cmd}= Catenate dcmi power get_limit | grep State
219 ${resp}= Run External IPMI Standard Command ${cmd}
220 # Response is either "Power Limit Active" or "No Active Power Limit".
221 ${initial_deactivation}= Get Count ${resp} No
222 # If deactivated: initial_deactivation = 1, 0 otherwise.
223 Set Suite Variable ${initial_deactivation} children=true
224
225 # Save the power limit setting.
226 ${initial_power_setting}= Get DCMI Power Limit
227 Set Suite Variable ${initial_power_setting} children=true
228
229 # Set power limiting deactivated.
Steven Sombar43fae662017-09-22 09:05:58 -0500230 Deactivate DCMI Power And Verify
Steven Sombare7b0bb02017-11-10 10:07:55 -0600231
232 # Set initial power setting value.
233 Set DCMI Power Limit And Verify ${max_power}
Steven Sombar43fae662017-09-22 09:05:58 -0500234
235
236Test Teardown Execution
237 [Documentation] Do the post test teardown.
238 # FFDC on test case fail.
239 # Power off the OS and wait for power off state.
Steven Sombare7b0bb02017-11-10 10:07:55 -0600240 # Return the system's intial deactivation/activation setting.
241 # Return the system's intial power limit setting.
Steven Sombar43fae662017-09-22 09:05:58 -0500242
243 FFDC On Test Case Fail
Steven Sombare7b0bb02017-11-10 10:07:55 -0600244
Steven Sombar43fae662017-09-22 09:05:58 -0500245 Smart Power Off
Steven Sombare7b0bb02017-11-10 10:07:55 -0600246
247 Run Keyword If '${initial_power_setting}' != '${0}'
248 ... Set DCMI Power Limit And Verify ${initial_power_setting}
249
250 Run Keyword If '${initial_deactivation}' == '${1}'
251 ... Deactivate DCMI Power And Verify ELSE Activate DCMI Power And Verify