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 | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 15 | |
| 16 | Suite Setup Suite Setup Execution |
| 17 | Test Teardown Test Teardown Execution |
| 18 | |
| 19 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 20 | |
| 21 | *** Variables **** |
| 22 | |
| 23 | ${max_power} 3050 |
| 24 | ${near_max_power_50} 3000 |
| 25 | ${near_max_power_100} 2950 |
| 26 | |
| 27 | |
| 28 | |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 29 | *** Test Cases *** |
| 30 | |
| 31 | |
| 32 | Escale System On And PL Enabled |
Steven Sombar | 433b526 | 2017-09-28 11:44:34 -0500 | [diff] [blame] | 33 | [Documentation] Change active power limit with system power on and |
| 34 | ... Power limit active. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 35 | [Tags] Escale_System_On_And_PL_Enabled |
| 36 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 37 | Set DCMI Power Limit And Verify ${max_power} |
| 38 | |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 39 | 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 Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 54 | Should Be True ${power} == ${max_power} |
| 55 | ... msg=DCMI power limit should be ${max_power}. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 56 | |
| 57 | Activate DCMI Power And Verify |
| 58 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 59 | Set DCMI Power Limit And Verify ${near_max_power_50} |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 60 | |
| 61 | |
| 62 | Escale System On And PL Disabled |
George Keishing | 56f3350 | 2017-10-16 02:12:46 -0500 | [diff] [blame] | 63 | [Documentation] Change active power limit with system power on and |
Steven Sombar | 433b526 | 2017-09-28 11:44:34 -0500 | [diff] [blame] | 64 | ... deactivate power limit prior to change. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 65 | [Tags] Escale_System_On_And_PL_Disabled |
| 66 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 67 | ${power_setting}= Set Variable ${near_max_power_100} |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 68 | |
| 69 | REST Power On stack_mode=skip |
| 70 | |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 71 | Set DCMI Power Limit And Verify ${power_setting} |
| 72 | |
| 73 | # Deactivate and check limit |
| 74 | Deactivate DCMI Power And Verify |
| 75 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 76 | ${cmd}= Catenate dcmi power set_limit limit ${near_max_power_50} |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 77 | Run External IPMI Standard Command ${cmd} |
| 78 | ${power}= Get DCMI Power Limit |
| 79 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 80 | Should Be True ${power} == ${near_max_power_50} |
Steven Sombar | 6f72d88 | 2017-10-16 07:55:58 -0500 | [diff] [blame] | 81 | ... msg=Could not set power limit when power limiting deactivated. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 82 | |
| 83 | |
| 84 | Escale Check Settings System On Then Off |
Steven Sombar | 433b526 | 2017-09-28 11:44:34 -0500 | [diff] [blame] | 85 | [Documentation] Set power limit and activate power limit before |
| 86 | ... BMC state is power on. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 87 | [Tags] Escale_Check_Settings_System_On_Then_Off |
| 88 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 89 | ${power_setting}= Set Variable ${near_max_power_100} |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 90 | |
| 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 Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 110 | Deactivate DCMI Power And Verify |
| 111 | |
| 112 | |
| 113 | Escale Check Settings System Off Then On |
Steven Sombar | 433b526 | 2017-09-28 11:44:34 -0500 | [diff] [blame] | 114 | [Documentation] Set and activate power limit with system power off. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 115 | [Tags] Escale_Check_Settings_System_Off_Then_On |
| 116 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 117 | ${power_setting}= Set Variable ${near_max_power_50} |
| 118 | |
| 119 | Set DCMI Power Limit And Verify ${power_setting} |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 120 | |
| 121 | Smart Power Off |
| 122 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 123 | # Check deactivated and the power limit. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 124 | Fail If DCMI Power Is Not Deactivated |
| 125 | ${power}= Get DCMI Power Limit |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 126 | Should Be True ${power} == ${power_setting} |
| 127 | ... msg=DCMI power not set at ${power_setting} as expected |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 128 | |
| 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 | |
| 141 | Escale Change Limit At Runtime |
Steven Sombar | 433b526 | 2017-09-28 11:44:34 -0500 | [diff] [blame] | 142 | [Documentation] Change power limit at runtime. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 143 | [Tags] Escale_Change_Limit_At_Runtime |
| 144 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 145 | ${power_setting}= Set Variable ${near_max_power_100} |
| 146 | |
| 147 | Set DCMI Power Limit And Verify ${near_max_power_50} |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 148 | |
| 149 | Smart Power Off |
| 150 | |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 151 | REST Power On stack_mode=skip |
| 152 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 153 | Set DCMI Power Limit And Verify ${power_setting} |
| 154 | |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 155 | # 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 Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 160 | Set DCMI Power Limit And Verify ${max_power} |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 161 | |
| 162 | |
| 163 | Escale Disable And Enable At Runtime |
Steven Sombar | 433b526 | 2017-09-28 11:44:34 -0500 | [diff] [blame] | 164 | [Documentation] Disable/enable power limit at runtime. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 165 | [Tags] Escale_Disable_And_Enable_At_Runtime |
| 166 | |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 167 | ${power_setting}= Set Variable ${near_max_power_50} |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 168 | |
| 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 | |
| 194 | Suite Setup Execution |
| 195 | [Documentation] Do test setup initialization. |
| 196 | # Power Off if system if not already off. |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 197 | # Save initial settings. |
| 198 | # Deactivate power and set limit. |
| 199 | |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 200 | Smart Power Off |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 201 | |
| 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 Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 215 | Deactivate DCMI Power And Verify |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 216 | |
| 217 | # Set initial power setting value. |
| 218 | Set DCMI Power Limit And Verify ${max_power} |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 219 | |
| 220 | |
| 221 | Test 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 Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 225 | # Return the system's intial deactivation/activation setting. |
| 226 | # Return the system's intial power limit setting. |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 227 | |
| 228 | FFDC On Test Case Fail |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 229 | |
Steven Sombar | 43fae66 | 2017-09-22 09:05:58 -0500 | [diff] [blame] | 230 | Smart Power Off |
Steven Sombar | e7b0bb0 | 2017-11-10 10:07:55 -0600 | [diff] [blame] | 231 | |
| 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 |