Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Energy scale power capping tests. |
| 3 | |
Steven Sombar | 433b526 | 2017-09-28 11:44:34 -0500 | [diff] [blame] | 4 | |
| 5 | # Acronyms |
| 6 | # PL Power Limit |
| 7 | # OCC On Chip Controller |
| 8 | |
| 9 | |
| 10 | Resource ../lib/energy_scale_utils.robot |
| 11 | Resource ../lib/rest_client.robot |
| 12 | Resource ../lib/openbmc_ffdc.robot |
| 13 | Resource ../lib/boot_utils.robot |
| 14 | Resource ../lib/ipmi_client.robot |
Steven Sombar | 5c17b01 | 2018-01-17 11:30:10 -0600 | [diff] [blame] | 15 | Resource ../syslib/utils_os.robot |
| 16 | |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 17 | |
| 18 | Suite Setup Suite Setup Execution |
| 19 | Test Teardown Test Teardown Execution |
| 20 | |
| 21 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 22 | |
| 23 | *** Variables **** |
| 24 | |
| 25 | ${max_power} 3050 |
| 26 | ${near_max_power_50} 3000 |
| 27 | ${near_max_power_100} 2950 |
| 28 | |
| 29 | |
| 30 | |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 31 | *** Test Cases *** |
| 32 | |
| 33 | |
| 34 | Escale System On And PL Enabled |
Steven Sombar | 433b526 | 2017-09-28 11:44:34 -0500 | [diff] [blame] | 35 | [Documentation] Change active power limit with system power on and |
| 36 | ... Power limit active. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 37 | [Tags] Escale_System_On_And_PL_Enabled |
| 38 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 39 | Set DCMI Power Limit And Verify ${max_power} |
| 40 | |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 41 | REST Power On stack_mode=skip |
| 42 | |
Steven Sombar | 5c17b01 | 2018-01-17 11:30:10 -0600 | [diff] [blame] | 43 | Tool Exist opal-prd |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 44 | 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 Sombar | 5c17b01 | 2018-01-17 11:30:10 -0600 | [diff] [blame] | 56 | # 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 Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 67 | ${power}= Get DCMI Power Limit |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 68 | Should Be True ${power} == ${max_power} |
| 69 | ... msg=DCMI power limit should be ${max_power}. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 70 | |
| 71 | Activate DCMI Power And Verify |
| 72 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 73 | Set DCMI Power Limit And Verify ${near_max_power_50} |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 74 | |
| 75 | |
| 76 | Escale System On And PL Disabled |
George Keishing | 56f3350 | 2017-10-16 02:12:46 -0500 | [diff] [blame] | 77 | [Documentation] Change active power limit with system power on and |
Steven Sombar | 433b526 | 2017-09-28 11:44:34 -0500 | [diff] [blame] | 78 | ... deactivate power limit prior to change. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 79 | [Tags] Escale_System_On_And_PL_Disabled |
| 80 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 81 | ${power_setting}= Set Variable ${near_max_power_100} |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 82 | |
| 83 | REST Power On stack_mode=skip |
| 84 | |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 85 | Set DCMI Power Limit And Verify ${power_setting} |
| 86 | |
| 87 | # Deactivate and check limit |
| 88 | Deactivate DCMI Power And Verify |
| 89 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 90 | ${cmd}= Catenate dcmi power set_limit limit ${near_max_power_50} |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 91 | Run External IPMI Standard Command ${cmd} |
| 92 | ${power}= Get DCMI Power Limit |
| 93 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 94 | Should Be True ${power} == ${near_max_power_50} |
Steven Sombar | 6f72d88 | 2017-10-16 07:55:58 -0500 | [diff] [blame] | 95 | ... msg=Could not set power limit when power limiting deactivated. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 96 | |
| 97 | |
| 98 | Escale Check Settings System On Then Off |
Steven Sombar | 433b526 | 2017-09-28 11:44:34 -0500 | [diff] [blame] | 99 | [Documentation] Set power limit and activate power limit before |
| 100 | ... BMC state is power on. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 101 | [Tags] Escale_Check_Settings_System_On_Then_Off |
| 102 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 103 | ${power_setting}= Set Variable ${near_max_power_100} |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 104 | |
| 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 Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 124 | Deactivate DCMI Power And Verify |
| 125 | |
| 126 | |
| 127 | Escale Check Settings System Off Then On |
Steven Sombar | 433b526 | 2017-09-28 11:44:34 -0500 | [diff] [blame] | 128 | [Documentation] Set and activate power limit with system power off. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 129 | [Tags] Escale_Check_Settings_System_Off_Then_On |
| 130 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 131 | ${power_setting}= Set Variable ${near_max_power_50} |
| 132 | |
| 133 | Set DCMI Power Limit And Verify ${power_setting} |
Steven Sombar | 2560f50 | 2017-11-27 12:47:18 -0600 | [diff] [blame] | 134 | Deactivate DCMI Power and Verify |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 135 | |
| 136 | Smart Power Off |
| 137 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 138 | # Check deactivated and the power limit. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 139 | Fail If DCMI Power Is Not Deactivated |
| 140 | ${power}= Get DCMI Power Limit |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 141 | Should Be True ${power} == ${power_setting} |
| 142 | ... msg=DCMI power not set at ${power_setting} as expected |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 143 | |
| 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 | |
| 156 | Escale Change Limit At Runtime |
Steven Sombar | 433b526 | 2017-09-28 11:44:34 -0500 | [diff] [blame] | 157 | [Documentation] Change power limit at runtime. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 158 | [Tags] Escale_Change_Limit_At_Runtime |
| 159 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 160 | ${power_setting}= Set Variable ${near_max_power_100} |
| 161 | |
| 162 | Set DCMI Power Limit And Verify ${near_max_power_50} |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 163 | |
| 164 | Smart Power Off |
| 165 | |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 166 | REST Power On stack_mode=skip |
| 167 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 168 | Set DCMI Power Limit And Verify ${power_setting} |
| 169 | |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 170 | # 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 Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 175 | Set DCMI Power Limit And Verify ${max_power} |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 176 | |
| 177 | |
| 178 | Escale Disable And Enable At Runtime |
Steven Sombar | 433b526 | 2017-09-28 11:44:34 -0500 | [diff] [blame] | 179 | [Documentation] Disable/enable power limit at runtime. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 180 | [Tags] Escale_Disable_And_Enable_At_Runtime |
| 181 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 182 | ${power_setting}= Set Variable ${near_max_power_50} |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 183 | |
| 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 | |
| 209 | Suite Setup Execution |
| 210 | [Documentation] Do test setup initialization. |
| 211 | # Power Off if system if not already off. |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 212 | # Save initial settings. |
| 213 | # Deactivate power and set limit. |
| 214 | |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 215 | Smart Power Off |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 216 | |
| 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 Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 230 | Deactivate DCMI Power And Verify |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 231 | |
| 232 | # Set initial power setting value. |
| 233 | Set DCMI Power Limit And Verify ${max_power} |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 234 | |
| 235 | |
| 236 | Test 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 Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 240 | # Return the system's intial deactivation/activation setting. |
| 241 | # Return the system's intial power limit setting. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 242 | |
| 243 | FFDC On Test Case Fail |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 244 | |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 245 | Smart Power Off |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 246 | |
| 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 |