1f7ac0237SMarissa Garza*** Settings *** 2f7ac0237SMarissa GarzaDocumentation Energy scale power capping tests. 3f7ac0237SMarissa Garza 4f7ac0237SMarissa Garza 5f7ac0237SMarissa Garza# Acronyms 6f7ac0237SMarissa Garza# PL Power Limit 7f7ac0237SMarissa Garza# OCC On Chip Controller 8f7ac0237SMarissa Garza 9f7ac0237SMarissa Garza 10f7ac0237SMarissa GarzaResource ../../lib/energy_scale_utils.robot 11f7ac0237SMarissa GarzaResource ../../lib/rest_client.robot 12f7ac0237SMarissa GarzaResource ../../lib/openbmc_ffdc.robot 13f7ac0237SMarissa GarzaResource ../../lib/boot_utils.robot 14f7ac0237SMarissa GarzaResource ../../lib/ipmi_client.robot 15*a28061a0SGeorge KeishingResource ../../lib/os_utilities.robot 16f7ac0237SMarissa Garza 17f7ac0237SMarissa Garza 18f7ac0237SMarissa GarzaSuite Setup Suite Setup Execution 19f7ac0237SMarissa GarzaTest Teardown Test Teardown Execution 20f7ac0237SMarissa Garza 21f7ac0237SMarissa Garza 22f7ac0237SMarissa Garza 23f7ac0237SMarissa Garza*** Variables **** 24f7ac0237SMarissa Garza 25f7ac0237SMarissa Garza${max_power} 3050 26f7ac0237SMarissa Garza${near_max_power_50} 3000 27f7ac0237SMarissa Garza${near_max_power_100} 2950 28f7ac0237SMarissa Garza 29f7ac0237SMarissa Garza 30f7ac0237SMarissa Garza 31f7ac0237SMarissa Garza*** Test Cases *** 32f7ac0237SMarissa Garza 33f7ac0237SMarissa Garza 34f7ac0237SMarissa GarzaEscale System On And PL Enabled 35f7ac0237SMarissa Garza [Documentation] Change active power limit with system power on and 36f7ac0237SMarissa Garza ... Power limit active. 37f7ac0237SMarissa Garza [Tags] Escale_System_On_And_PL_Enabled 38f7ac0237SMarissa Garza 39f7ac0237SMarissa Garza Set DCMI Power Limit And Verify ${max_power} 40f7ac0237SMarissa Garza 41f511bed3SWilliam Toth Redfish Power On stack_mode=skip 42f7ac0237SMarissa Garza 43f7ac0237SMarissa Garza Tool Exist opal-prd 44f7ac0237SMarissa Garza OCC Tool Upload Setup 45f7ac0237SMarissa Garza 46f7ac0237SMarissa Garza # Get OCC data from OS. 47f7ac0237SMarissa Garza ${cmd}= Set Variable /tmp/occtoolp9 -p | grep -e State: -e Sensor: 48f7ac0237SMarissa Garza ${output} ${stderr} ${rc}= OS Execute Command ${cmd} 49f7ac0237SMarissa Garza 50f7ac0237SMarissa Garza # Check for expected responses. 51f7ac0237SMarissa Garza Should Contain ${output} ACTIVE 52f7ac0237SMarissa Garza Should Contain ${output} Sensor: TEMP 53f7ac0237SMarissa Garza Should Contain ${output} Sensor: FREQ 54f7ac0237SMarissa Garza Should Contain ${output} Sensor: POWR 55f7ac0237SMarissa Garza 56f7ac0237SMarissa Garza # Disable OCC. 57f7ac0237SMarissa Garza ${output} ${stderr} ${rc}= OS Execute Command opal-prd occ disable 58f7ac0237SMarissa Garza # With OCC disabled we should have OBSERVATION in output. 59f7ac0237SMarissa Garza ${output} ${stderr} ${rc}= OS Execute Command ${cmd} 60f7ac0237SMarissa Garza Should Contain ${output} OBSERVATION 61f7ac0237SMarissa Garza 62f7ac0237SMarissa Garza # Re-enable OCC for remaining tests. 63f7ac0237SMarissa Garza ${output} ${stderr} ${rc}= OS Execute Command opal-prd occ enable 64f7ac0237SMarissa Garza ${output} ${stderr} ${rc}= OS Execute Command ${cmd} 65f7ac0237SMarissa Garza Should Contain ${output} ACTIVE 66f7ac0237SMarissa Garza 67f7ac0237SMarissa Garza ${power}= Get DCMI Power Limit 68f7ac0237SMarissa Garza Should Be True ${power} == ${max_power} 69f7ac0237SMarissa Garza ... msg=DCMI power limit should be ${max_power}. 70f7ac0237SMarissa Garza 71f7ac0237SMarissa Garza Activate DCMI Power And Verify 72f7ac0237SMarissa Garza 73f7ac0237SMarissa Garza Set DCMI Power Limit And Verify ${near_max_power_50} 74f7ac0237SMarissa Garza 75f7ac0237SMarissa Garza 76f7ac0237SMarissa GarzaEscale System On And PL Disabled 77f7ac0237SMarissa Garza [Documentation] Change active power limit with system power on and 78f7ac0237SMarissa Garza ... deactivate power limit prior to change. 79f7ac0237SMarissa Garza [Tags] Escale_System_On_And_PL_Disabled 80f7ac0237SMarissa Garza 81f7ac0237SMarissa Garza ${power_setting}= Set Variable ${near_max_power_100} 82f7ac0237SMarissa Garza 83f511bed3SWilliam Toth Redfish Power On stack_mode=skip 84f7ac0237SMarissa Garza 85f7ac0237SMarissa Garza Set DCMI Power Limit And Verify ${power_setting} 86f7ac0237SMarissa Garza 87f7ac0237SMarissa Garza # Deactivate and check limit 88f7ac0237SMarissa Garza Deactivate DCMI Power And Verify 89f7ac0237SMarissa Garza 90f7ac0237SMarissa Garza ${cmd}= Catenate dcmi power set_limit limit ${near_max_power_50} 91f7ac0237SMarissa Garza Run External IPMI Standard Command ${cmd} 92f7ac0237SMarissa Garza ${power}= Get DCMI Power Limit 93f7ac0237SMarissa Garza 94f7ac0237SMarissa Garza Should Be True ${power} == ${near_max_power_50} 95f7ac0237SMarissa Garza ... msg=Could not set power limit when power limiting deactivated. 96f7ac0237SMarissa Garza 97f7ac0237SMarissa Garza 98f7ac0237SMarissa GarzaEscale Check Settings System On Then Off 99f7ac0237SMarissa Garza [Documentation] Set power limit and activate power limit before 100f7ac0237SMarissa Garza ... BMC state is power on. 101f7ac0237SMarissa Garza [Tags] Escale_Check_Settings_System_On_Then_Off 102f7ac0237SMarissa Garza 103f7ac0237SMarissa Garza ${power_setting}= Set Variable ${near_max_power_100} 104f7ac0237SMarissa Garza 105f511bed3SWilliam Toth Redfish Power On stack_mode=skip 106f7ac0237SMarissa Garza 107f7ac0237SMarissa Garza Set DCMI Power Limit And Verify ${power_setting} 108f7ac0237SMarissa Garza Deactivate DCMI Power And Verify 109f7ac0237SMarissa Garza 110f7ac0237SMarissa Garza ${power}= Get DCMI Power Limit 111f7ac0237SMarissa Garza Should Be True ${power} == ${power_setting} 112f7ac0237SMarissa Garza ... msg=dcmi power limit not set to ${power_setting} as expected. 113f7ac0237SMarissa Garza 114f7ac0237SMarissa Garza Smart Power Off 115f7ac0237SMarissa Garza 116f7ac0237SMarissa Garza Activate DCMI Power And Verify 117f7ac0237SMarissa Garza 118f511bed3SWilliam Toth Redfish Power On 119f7ac0237SMarissa Garza 120f7ac0237SMarissa Garza ${power}= Get DCMI Power Limit 121f7ac0237SMarissa Garza Should Be True ${power} == ${power_setting} 122f7ac0237SMarissa Garza ... msg=Power limit setting of watts not retained at Runtime. 123f7ac0237SMarissa Garza 124f7ac0237SMarissa Garza Deactivate DCMI Power And Verify 125f7ac0237SMarissa Garza 126f7ac0237SMarissa Garza 127f7ac0237SMarissa GarzaEscale Check Settings System Off Then On 128f7ac0237SMarissa Garza [Documentation] Set and activate power limit with system power off. 129f7ac0237SMarissa Garza [Tags] Escale_Check_Settings_System_Off_Then_On 130f7ac0237SMarissa Garza 131f7ac0237SMarissa Garza ${power_setting}= Set Variable ${near_max_power_50} 132f7ac0237SMarissa Garza 133f7ac0237SMarissa Garza Set DCMI Power Limit And Verify ${power_setting} 134f7ac0237SMarissa Garza Deactivate DCMI Power and Verify 135f7ac0237SMarissa Garza 136f7ac0237SMarissa Garza Smart Power Off 137f7ac0237SMarissa Garza 138f7ac0237SMarissa Garza # Check deactivated and the power limit. 139f7ac0237SMarissa Garza Fail If DCMI Power Is Not Deactivated 140f7ac0237SMarissa Garza ${power}= Get DCMI Power Limit 141f7ac0237SMarissa Garza Should Be True ${power} == ${power_setting} 142f7ac0237SMarissa Garza ... msg=DCMI power not set at ${power_setting} as expected 143f7ac0237SMarissa Garza 144f7ac0237SMarissa Garza Activate DCMI Power And Verify 145f7ac0237SMarissa Garza Set DCMI Power Limit And Verify ${power_setting} 146f7ac0237SMarissa Garza 147f511bed3SWilliam Toth Redfish Power On 148f7ac0237SMarissa Garza 149f7ac0237SMarissa Garza Fail If DCMI Power Is Not Activated 150f7ac0237SMarissa Garza 151f7ac0237SMarissa Garza ${power}= Get DCMI Power Limit 152f7ac0237SMarissa Garza Should Be True ${power} == ${power_setting} 153f7ac0237SMarissa Garza ... msg=Power limit setting not retained at Runtime. 154f7ac0237SMarissa Garza 155f7ac0237SMarissa Garza 156f7ac0237SMarissa GarzaEscale Change Limit At Runtime 157f7ac0237SMarissa Garza [Documentation] Change power limit at runtime. 158f7ac0237SMarissa Garza [Tags] Escale_Change_Limit_At_Runtime 159f7ac0237SMarissa Garza 160f7ac0237SMarissa Garza ${power_setting}= Set Variable ${near_max_power_100} 161f7ac0237SMarissa Garza 162f7ac0237SMarissa Garza Set DCMI Power Limit And Verify ${near_max_power_50} 163f7ac0237SMarissa Garza 164f7ac0237SMarissa Garza Smart Power Off 165f7ac0237SMarissa Garza 166f511bed3SWilliam Toth Redfish Power On stack_mode=skip 167f7ac0237SMarissa Garza 168f7ac0237SMarissa Garza Set DCMI Power Limit And Verify ${power_setting} 169f7ac0237SMarissa Garza 170f7ac0237SMarissa Garza # Check that DCMI power limit setting = ${power_setting}. 171f7ac0237SMarissa Garza ${power}= Get DCMI Power Limit 172f7ac0237SMarissa Garza Should Be True ${power} == ${power_setting} 173f7ac0237SMarissa Garza ... msg=DCMI power limit not set to ${power_setting} watts as expected. 174f7ac0237SMarissa Garza 175f7ac0237SMarissa Garza Set DCMI Power Limit And Verify ${max_power} 176f7ac0237SMarissa Garza 177f7ac0237SMarissa Garza 178f7ac0237SMarissa GarzaEscale Disable And Enable At Runtime 179f7ac0237SMarissa Garza [Documentation] Disable/enable power limit at runtime. 180f7ac0237SMarissa Garza [Tags] Escale_Disable_And_Enable_At_Runtime 181f7ac0237SMarissa Garza 182f7ac0237SMarissa Garza ${power_setting}= Set Variable ${near_max_power_50} 183f7ac0237SMarissa Garza 184f7ac0237SMarissa Garza Smart Power Off 185f7ac0237SMarissa Garza 186f7ac0237SMarissa Garza Set DCMI Power Limit And Verify ${power_setting} 187f7ac0237SMarissa Garza Activate DCMI Power And Verify 188f7ac0237SMarissa Garza 189f7ac0237SMarissa Garza # Power on the system. 190f511bed3SWilliam Toth Redfish Power On 191f7ac0237SMarissa Garza 192f7ac0237SMarissa Garza # Check that DCMI power limit setting = ${power_setting}. 193f7ac0237SMarissa Garza ${power}= Get DCMI Power Limit 194f7ac0237SMarissa Garza Should Be True ${power} == ${power_setting} 195f7ac0237SMarissa Garza ... msg=DCMI power limit not set to ${power_setting} watts as expected. 196f7ac0237SMarissa Garza 197f7ac0237SMarissa Garza Deactivate DCMI Power And Verify 198f7ac0237SMarissa Garza 199f7ac0237SMarissa Garza Activate DCMI Power And Verify 200f7ac0237SMarissa Garza 201f7ac0237SMarissa Garza ${power}= Get DCMI Power Limit 202f7ac0237SMarissa Garza Should Be True ${power} == ${power_setting} 203f7ac0237SMarissa Garza ... msg=DCMI power limit not set to ${power_setting} watts as expected. 204f7ac0237SMarissa Garza 205f7ac0237SMarissa Garza 206f7ac0237SMarissa Garza*** Keywords *** 207f7ac0237SMarissa Garza 208f7ac0237SMarissa Garza 209f7ac0237SMarissa GarzaSuite Setup Execution 210f7ac0237SMarissa Garza [Documentation] Do test setup initialization. 211f7ac0237SMarissa Garza # Power Off if system if not already off. 212f7ac0237SMarissa Garza # Save initial settings. 213f7ac0237SMarissa Garza # Deactivate power and set limit. 214f7ac0237SMarissa Garza 215f7ac0237SMarissa Garza Smart Power Off 216f7ac0237SMarissa Garza 217f7ac0237SMarissa Garza # Save the deactivation/activation setting. 218f7ac0237SMarissa Garza ${cmd}= Catenate dcmi power get_limit | grep State 219f7ac0237SMarissa Garza ${resp}= Run External IPMI Standard Command ${cmd} 220f7ac0237SMarissa Garza # Response is either "Power Limit Active" or "No Active Power Limit". 221f7ac0237SMarissa Garza ${initial_deactivation}= Get Count ${resp} No 222f7ac0237SMarissa Garza # If deactivated: initial_deactivation = 1, 0 otherwise. 223f7ac0237SMarissa Garza Set Suite Variable ${initial_deactivation} children=true 224f7ac0237SMarissa Garza 225f7ac0237SMarissa Garza # Save the power limit setting. 226f7ac0237SMarissa Garza ${initial_power_setting}= Get DCMI Power Limit 227f7ac0237SMarissa Garza Set Suite Variable ${initial_power_setting} children=true 228f7ac0237SMarissa Garza 229f7ac0237SMarissa Garza # Set power limiting deactivated. 230f7ac0237SMarissa Garza Deactivate DCMI Power And Verify 231f7ac0237SMarissa Garza 232f7ac0237SMarissa Garza # Set initial power setting value. 233f7ac0237SMarissa Garza Set DCMI Power Limit And Verify ${max_power} 234f7ac0237SMarissa Garza 235f7ac0237SMarissa Garza 236f7ac0237SMarissa GarzaTest Teardown Execution 237f7ac0237SMarissa Garza [Documentation] Do the post test teardown. 238f7ac0237SMarissa Garza # FFDC on test case fail. 239f7ac0237SMarissa Garza # Power off the OS and wait for power off state. 240f7ac0237SMarissa Garza # Return the system's initial deactivation/activation setting. 241f7ac0237SMarissa Garza # Return the system's initial power limit setting. 242f7ac0237SMarissa Garza 243f7ac0237SMarissa Garza FFDC On Test Case Fail 244f7ac0237SMarissa Garza 245f7ac0237SMarissa Garza Smart Power Off 246f7ac0237SMarissa Garza 247f7ac0237SMarissa Garza Run Keyword If '${initial_power_setting}' != '${0}' 248f7ac0237SMarissa Garza ... Set DCMI Power Limit And Verify ${initial_power_setting} 249f7ac0237SMarissa Garza 250f7ac0237SMarissa Garza Run Keyword If '${initial_deactivation}' == '${1}' 251f7ac0237SMarissa Garza ... Deactivate DCMI Power And Verify ELSE Activate DCMI Power And Verify 252