blob: 5a939898a61eec77d06c9142958fd2dc30e567d3 [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 Sombar43fae662017-09-22 09:05:58 -0500120
121 Smart Power Off
122
Steven Sombare7b0bb02017-11-10 10:07:55 -0600123 # Check deactivated and the power limit.
Steven Sombar43fae662017-09-22 09:05:58 -0500124 Fail If DCMI Power Is Not Deactivated
125 ${power}= Get DCMI Power Limit
Steven Sombare7b0bb02017-11-10 10:07:55 -0600126 Should Be True ${power} == ${power_setting}
127 ... msg=DCMI power not set at ${power_setting} as expected
Steven Sombar43fae662017-09-22 09:05:58 -0500128
129 Activate DCMI Power And Verify
130 Set DCMI Power Limit And Verify ${power_setting}
131
132 REST Power On
133
134 Fail If DCMI Power Is Not Activated
135
136 ${power}= Get DCMI Power Limit
137 Should Be True ${power} == ${power_setting}
138 ... msg=Power limit setting not retained at Runtime.
139
140
141Escale Change Limit At Runtime
Steven Sombar433b5262017-09-28 11:44:34 -0500142 [Documentation] Change power limit at runtime.
Steven Sombar43fae662017-09-22 09:05:58 -0500143 [Tags] Escale_Change_Limit_At_Runtime
144
Steven Sombare7b0bb02017-11-10 10:07:55 -0600145 ${power_setting}= Set Variable ${near_max_power_100}
146
147 Set DCMI Power Limit And Verify ${near_max_power_50}
Steven Sombar43fae662017-09-22 09:05:58 -0500148
149 Smart Power Off
150
Steven Sombar43fae662017-09-22 09:05:58 -0500151 REST Power On stack_mode=skip
152
Steven Sombare7b0bb02017-11-10 10:07:55 -0600153 Set DCMI Power Limit And Verify ${power_setting}
154
Steven Sombar43fae662017-09-22 09:05:58 -0500155 # Check that DCMI power limit setting = ${power_setting}.
156 ${power}= Get DCMI Power Limit
157 Should Be True ${power} == ${power_setting}
158 ... msg=DCMI power limit not set to ${power_setting} watts as expected.
159
Steven Sombare7b0bb02017-11-10 10:07:55 -0600160 Set DCMI Power Limit And Verify ${max_power}
Steven Sombar43fae662017-09-22 09:05:58 -0500161
162
163Escale Disable And Enable At Runtime
Steven Sombar433b5262017-09-28 11:44:34 -0500164 [Documentation] Disable/enable power limit at runtime.
Steven Sombar43fae662017-09-22 09:05:58 -0500165 [Tags] Escale_Disable_And_Enable_At_Runtime
166
Steven Sombare7b0bb02017-11-10 10:07:55 -0600167 ${power_setting}= Set Variable ${near_max_power_50}
Steven Sombar43fae662017-09-22 09:05:58 -0500168
169 Smart Power Off
170
171 Set DCMI Power Limit And Verify ${power_setting}
172 Activate DCMI Power And Verify
173
174 # Power on the system.
175 REST Power On
176
177 # Check that DCMI power limit setting = ${power_setting}.
178 ${power}= Get DCMI Power Limit
179 Should Be True ${power} == ${power_setting}
180 ... msg=DCMI power limit not set to ${power_setting} watts as expected.
181
182 Deactivate DCMI Power And Verify
183
184 Activate DCMI Power And Verify
185
186 ${power}= Get DCMI Power Limit
187 Should Be True ${power} == ${power_setting}
188 ... msg=DCMI power limit not set to ${power_setting} watts as expected.
189
190
191*** Keywords ***
192
193
194Suite Setup Execution
195 [Documentation] Do test setup initialization.
196 # Power Off if system if not already off.
Steven Sombare7b0bb02017-11-10 10:07:55 -0600197 # Save initial settings.
198 # Deactivate power and set limit.
199
Steven Sombar43fae662017-09-22 09:05:58 -0500200 Smart Power Off
Steven Sombare7b0bb02017-11-10 10:07:55 -0600201
202 # Save the deactivation/activation setting.
203 ${cmd}= Catenate dcmi power get_limit | grep State
204 ${resp}= Run External IPMI Standard Command ${cmd}
205 # Response is either "Power Limit Active" or "No Active Power Limit".
206 ${initial_deactivation}= Get Count ${resp} No
207 # If deactivated: initial_deactivation = 1, 0 otherwise.
208 Set Suite Variable ${initial_deactivation} children=true
209
210 # Save the power limit setting.
211 ${initial_power_setting}= Get DCMI Power Limit
212 Set Suite Variable ${initial_power_setting} children=true
213
214 # Set power limiting deactivated.
Steven Sombar43fae662017-09-22 09:05:58 -0500215 Deactivate DCMI Power And Verify
Steven Sombare7b0bb02017-11-10 10:07:55 -0600216
217 # Set initial power setting value.
218 Set DCMI Power Limit And Verify ${max_power}
Steven Sombar43fae662017-09-22 09:05:58 -0500219
220
221Test Teardown Execution
222 [Documentation] Do the post test teardown.
223 # FFDC on test case fail.
224 # Power off the OS and wait for power off state.
Steven Sombare7b0bb02017-11-10 10:07:55 -0600225 # Return the system's intial deactivation/activation setting.
226 # Return the system's intial power limit setting.
Steven Sombar43fae662017-09-22 09:05:58 -0500227
228 FFDC On Test Case Fail
Steven Sombare7b0bb02017-11-10 10:07:55 -0600229
Steven Sombar43fae662017-09-22 09:05:58 -0500230 Smart Power Off
Steven Sombare7b0bb02017-11-10 10:07:55 -0600231
232 Run Keyword If '${initial_power_setting}' != '${0}'
233 ... Set DCMI Power Limit And Verify ${initial_power_setting}
234
235 Run Keyword If '${initial_deactivation}' == '${1}'
236 ... Deactivate DCMI Power And Verify ELSE Activate DCMI Power And Verify