Steven Sombar | fc4d575 | 2017-11-28 11:56:35 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Energy scale base tests. |
| 3 | |
| 4 | |
| 5 | # Test Parameters: |
| 6 | # OPENBMC_HOST The BMC host name or IP address. |
| 7 | |
| 8 | |
Steven Sombar | 1593e8c | 2019-08-19 09:33:06 -0500 | [diff] [blame] | 9 | Resource ../../lib/energy_scale_utils.robot |
| 10 | Resource ../../lib/openbmc_ffdc.robot |
| 11 | Resource ../../lib/utils.robot |
| 12 | Resource ../../lib/logging_utils.robot |
| 13 | Library ../../lib/logging_utils.py |
Steven Sombar | fc4d575 | 2017-11-28 11:56:35 -0600 | [diff] [blame] | 14 | |
| 15 | |
| 16 | Suite Setup Suite Setup Execution |
| 17 | Test Teardown Test Teardown Execution |
| 18 | |
| 19 | |
Steven Sombar | fc4d575 | 2017-11-28 11:56:35 -0600 | [diff] [blame] | 20 | *** Variables **** |
| 21 | |
Steven Sombar | 90b7610 | 2019-01-11 11:04:38 -0600 | [diff] [blame] | 22 | ${over_max_power} 4001 |
Steven Sombar | fc4d575 | 2017-11-28 11:56:35 -0600 | [diff] [blame] | 23 | ${max_power} 3050 |
| 24 | ${mid_power} 1950 |
Steven Sombar | c9b3067 | 2018-03-26 14:25:27 -0500 | [diff] [blame] | 25 | ${min_power} 600 |
Steven Sombar | fc4d575 | 2017-11-28 11:56:35 -0600 | [diff] [blame] | 26 | ${below_min_power} 499 |
| 27 | ${zero_power} 0 |
Steven Sombar | c9b3067 | 2018-03-26 14:25:27 -0500 | [diff] [blame] | 28 | # The power limits are documented in |
Steven Sombar | fc4d575 | 2017-11-28 11:56:35 -0600 | [diff] [blame] | 29 | # open-power/witherspoon-xml/master/witherspoon.xml. |
| 30 | |
| 31 | |
Steven Sombar | fc4d575 | 2017-11-28 11:56:35 -0600 | [diff] [blame] | 32 | *** Test Cases *** |
| 33 | |
| 34 | |
| 35 | Escale Base Test Inactive Monitoring |
Benjamin Fair | 30ea8b1 | 2019-10-14 18:08:26 -0700 | [diff] [blame] | 36 | [Documentation] Run base power tests with DCMI power monitoring off. |
George Keishing | 5236ec5 | 2022-01-31 12:07:58 -0600 | [diff] [blame] | 37 | [Tags] Escale_Base_Test_Inactive_Monitoring |
Steven Sombar | fc4d575 | 2017-11-28 11:56:35 -0600 | [diff] [blame] | 38 | |
| 39 | Deactivate DCMI Power And Verify |
| 40 | Verify Power Limits |
| 41 | |
| 42 | |
| 43 | Escale Base Test Active Monitoring |
Steven Sombar | c435102 | 2018-01-15 13:47:38 -0600 | [diff] [blame] | 44 | [Documentation] Run base power tests with DCMI power monitoring on. |
Steven Sombar | fc4d575 | 2017-11-28 11:56:35 -0600 | [diff] [blame] | 45 | [Tags] Escale_Base_Test_Active_Monitoring |
| 46 | |
| 47 | Activate DCMI Power And Verify |
| 48 | Verify Power Limits |
| 49 | |
| 50 | |
Steven Sombar | c435102 | 2018-01-15 13:47:38 -0600 | [diff] [blame] | 51 | Escale Power Setting Via REST And Verify |
| 52 | [Documentation] Set power via REST and check using IPMI. |
| 53 | [Tags] Escale_Power_Setting_Via_REST_And_Verify |
| 54 | |
| 55 | # A convenient power level bewtwwn maximum and minimum. |
| 56 | ${test_power}= Set Variable 1700 |
| 57 | |
| 58 | # Set the power limit via REST. |
| 59 | Set DCMI Power Limit Via REST ${test_power} |
| 60 | |
| 61 | # Read the power limit using IPMI. |
| 62 | ${power_limit}= Get DCMI Power Limit |
| 63 | Should Be True ${power_limit} == ${test_power} |
| 64 | ... msg=Reading Power limit with IPMI failed after setting it with REST. |
| 65 | |
| 66 | |
| 67 | Escale Power Setting Via IPMI And Verify |
| 68 | [Documentation] Set power via IPMI then check via REST. |
| 69 | [Tags] Escale_Power_Setting_Via_IPMI_And_Verify |
| 70 | |
| 71 | # A convenient power level bewtwwn maximum and minimum. |
| 72 | ${test_power}= Set Variable 2200 |
| 73 | |
| 74 | # Set DCMI Power via IPMI. |
| 75 | Set DCMI Power Limit And Verify ${test_power} |
| 76 | |
| 77 | # Read the limit via REST. |
| 78 | ${power_limit}= Get DCMI Power Limit Via REST |
| 79 | Should Be True ${power_limit} == ${test_power} |
| 80 | ... msg=Reading power limit with REST failed after setting it with IPMI. |
| 81 | |
| 82 | |
| 83 | Escale Activation Test Via REST |
| 84 | [Documentation] Activate power monitoring via REST then check via IPMI. |
| 85 | [Tags] Escale_Activation_Test_Via_REST |
| 86 | |
| 87 | Activate DCMI Power Via REST |
| 88 | # Confirm activation state using IPMI. |
| 89 | Fail If DCMI Power Is Not Activated |
| 90 | |
| 91 | |
George Keishing | 5b9a0c3 | 2021-06-01 03:36:36 -0500 | [diff] [blame] | 92 | Escale Deactivation Test Via REST |
Steven Sombar | c435102 | 2018-01-15 13:47:38 -0600 | [diff] [blame] | 93 | [Documentation] Deactivate power monitoring via REST and check via IPMI. |
| 94 | [Tags] Escale_Deactivation_Test_Via_REST |
| 95 | |
| 96 | Deactivate DCMI Power Via REST |
| 97 | # Confirm activation state using IPMI. |
| 98 | Fail If DCMI Power Is Not Deactivated |
| 99 | |
Steven Sombar | fc4d575 | 2017-11-28 11:56:35 -0600 | [diff] [blame] | 100 | |
| 101 | *** Keywords *** |
| 102 | |
| 103 | |
| 104 | Verify Power Limits |
| 105 | [Documentation] Set power levels and verify limits. |
| 106 | |
| 107 | Set DCMI Power Limit And Verify ${mid_power} |
| 108 | Test Power Limit ${min_power} ${below_min_power} |
| 109 | Test Power Limit ${min_power} ${zero_power} |
| 110 | Test Power Limit ${max_power} ${over_max_power} |
| 111 | |
Steven Sombar | 90b7610 | 2019-01-11 11:04:38 -0600 | [diff] [blame] | 112 | ${power_limit}= Get DCMI Power Limit |
| 113 | Should Be True ${power_limit} == ${max_power} |
| 114 | ... msg=Power at ${power_limit}. Power should be at ${max_power}. |
Steven Sombar | c9b3067 | 2018-03-26 14:25:27 -0500 | [diff] [blame] | 115 | |
Steven Sombar | fc4d575 | 2017-11-28 11:56:35 -0600 | [diff] [blame] | 116 | |
| 117 | Test Power Limit |
| 118 | [Documentation] Set power and check limit. |
| 119 | [Arguments] ${good_power} ${outside_bounds_power} |
| 120 | |
| 121 | # Description of argument(s): |
| 122 | # good_power A valid power setting, usually at a limit. |
| 123 | # outside_bounds_power A power level that is beyond the limit. |
| 124 | |
| 125 | Set DCMI Power Limit And Verify ${good_power} |
| 126 | |
Steven Sombar | c9b3067 | 2018-03-26 14:25:27 -0500 | [diff] [blame] | 127 | # Attempt set power limit out of range. |
Steven Sombar | 792747a | 2019-01-25 12:04:42 -0600 | [diff] [blame] | 128 | ${int_power_limit}= Convert To Integer ${outside_bounds_power} |
| 129 | ${data}= Create Dictionary data=${int_power_limit} |
Steven Sombar | c9b3067 | 2018-03-26 14:25:27 -0500 | [diff] [blame] | 130 | Write Attribute ${CONTROL_HOST_URI}power_cap PowerCap data=${data} |
Steven Sombar | fc4d575 | 2017-11-28 11:56:35 -0600 | [diff] [blame] | 131 | |
| 132 | |
| 133 | Suite Setup Execution |
| 134 | [Documentation] Do test setup initialization. |
| 135 | |
Steven Sombar | 1593e8c | 2019-08-19 09:33:06 -0500 | [diff] [blame] | 136 | Redfish.Login |
| 137 | |
Steven Sombar | fc4d575 | 2017-11-28 11:56:35 -0600 | [diff] [blame] | 138 | # Save the deactivation/activation setting. |
| 139 | ${cmd}= Catenate dcmi power get_limit | grep State |
| 140 | ${resp}= Run External IPMI Standard Command ${cmd} |
| 141 | # Response is either "Power Limit Active" or "No Active Power Limit". |
| 142 | ${initial_deactivation}= Get Count ${resp} No |
| 143 | # If deactivated: initial_deactivation = 1, 0 otherwise. |
| 144 | Set Suite Variable ${initial_deactivation} children=true |
| 145 | |
| 146 | # Save the power limit setting. |
| 147 | ${initial_power_setting}= Get DCMI Power Limit |
| 148 | Set Suite Variable ${initial_power_setting} children=true |
| 149 | |
George Keishing | fd0c20a | 2018-06-18 12:23:51 -0500 | [diff] [blame] | 150 | Delete All Error Logs |
Steven Sombar | c9b3067 | 2018-03-26 14:25:27 -0500 | [diff] [blame] | 151 | |
Steven Sombar | fc4d575 | 2017-11-28 11:56:35 -0600 | [diff] [blame] | 152 | |
| 153 | Test Teardown Execution |
| 154 | [Documentation] Do the post test teardown. |
| 155 | |
| 156 | FFDC On Test Case Fail |
| 157 | |
Gunnar Mills | 948e2e2 | 2018-03-23 12:54:27 -0500 | [diff] [blame] | 158 | # Restore the system's initial power limit setting. |
Steven Sombar | fc4d575 | 2017-11-28 11:56:35 -0600 | [diff] [blame] | 159 | Run Keyword If '${initial_power_setting}' != '${0}' |
| 160 | ... Set DCMI Power Limit And Verify ${initial_power_setting} |
| 161 | |
Gunnar Mills | 948e2e2 | 2018-03-23 12:54:27 -0500 | [diff] [blame] | 162 | # Restore the system's initial deactivation/activation setting. |
Steven Sombar | fc4d575 | 2017-11-28 11:56:35 -0600 | [diff] [blame] | 163 | Run Keyword If '${initial_deactivation}' == '${1}' |
| 164 | ... Deactivate DCMI Power And Verify ELSE Activate DCMI Power And Verify |
Steven Sombar | 90b7610 | 2019-01-11 11:04:38 -0600 | [diff] [blame] | 165 | |
| 166 | # Clean up any error logs before exiting. |
| 167 | Delete All Error Logs |
Steven Sombar | 1593e8c | 2019-08-19 09:33:06 -0500 | [diff] [blame] | 168 | |
| 169 | Redfish.Logout |