George Keishing | dc4a423 | 2018-02-19 12:13:36 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test power supply telemetry. |
| 3 | |
| 4 | Resource ../lib/openbmc_ffdc.robot |
| 5 | Resource ../lib/open_power_utils.robot |
| 6 | Resource ../lib/boot_utils.robot |
George Keishing | 5ac6e17 | 2018-04-09 12:44:15 -0500 | [diff] [blame] | 7 | Resource ../lib/logging_utils.robot |
George Keishing | dc4a423 | 2018-02-19 12:13:36 -0600 | [diff] [blame] | 8 | |
| 9 | Test Teardown FFDC On Test Case Fail |
| 10 | |
| 11 | *** Variables *** |
| 12 | |
| 13 | # ----------------------------------- |
| 14 | # Output Current and Wattage Limits |
| 15 | # ----------------------------------- |
| 16 | # * 200 VAC (200 - 208 VAC) ... 2104W |
| 17 | # * 230 VAC (207 - 253 VAC) ... 2226W |
| 18 | # * 277 VAC (249 - 305 VAC) ... 2226W |
| 19 | # ----------------------------------- |
| 20 | |
| 21 | # With a loaded HTX work-load the wattage is typically within half of the upper |
| 22 | # limit. If the power drawn goes beyond the upper power limit, this test will |
| 23 | # fail. |
| 24 | ${upper_power_limit} ${2104} |
George Keishing | cdda1e5 | 2018-04-06 12:51:12 -0500 | [diff] [blame] | 25 | ${lower_power_limit} ${100} |
George Keishing | dc4a423 | 2018-02-19 12:13:36 -0600 | [diff] [blame] | 26 | ${power_data_collection_interval} ${30} |
| 27 | |
| 28 | # Every n seconds, the system collects the following for each power supply |
| 29 | # (e.g. ps0, ps1, etc): |
| 30 | # - The average power being drawn over the interval. |
| 31 | # - The maximum power drawn over the interval. |
| 32 | # At any given time, such readings can be obtained from the system. |
| 33 | # The lists shown below are examples of such data |
| 34 | # --------------------------------------------------------------------- |
| 35 | # /org/open_power/sensors/aggregation/per_30s/ps0_input_power/average |
| 36 | # [20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 225, 290, 255, 207, 124, 20] |
| 37 | # (max, min) (290, 20) |
| 38 | |
| 39 | # /org/open_power/sensors/aggregation/per_30s/ps1_input_power/average |
| 40 | # [19, 19, 20, 20, 19, 20, 20, 20, 20, 20, 69, 321, 286, 265, 228, 104] |
| 41 | # (max, min) (321, 19) |
| 42 | |
| 43 | # /org/open_power/sensors/aggregation/per_30s/ps0_input_power/maximum |
| 44 | # [20, 20, 20, 22, 22, 22, 22, 20, 22, 22, 338, 346, 308, 258, 172, 20] |
| 45 | # (max, min) (346, 20) |
| 46 | |
| 47 | # /org/open_power/sensors/aggregation/per_30s/ps1_input_power/maximum |
| 48 | # [24, 26, 26, 26, 26, 26, 26, 26, 26, 26, 322, 364, 338, 308, 258, 240] |
| 49 | # (max, min) (364, 24) |
| 50 | # --------------------------------------------------------------------- |
| 51 | |
| 52 | # To collect 3 iteration of sampling data. |
| 53 | ${LOOP_COUNT} ${3} |
| 54 | |
| 55 | |
| 56 | *** Test Cases *** |
| 57 | |
| 58 | Power Supply Test When Host Off |
| 59 | [Documentation] Check that power consumption is within limits when host |
| 60 | ... is off. |
| 61 | [Tags] Power_Supply_Test_When_Host_Off |
| 62 | |
| 63 | REST Power Off stack_mode=skip |
| 64 | ${power_sensor_path}= Get Sensors Aggregation URL List |
| 65 | ... /org/open_power/sensors/ |
| 66 | |
| 67 | Check Power Telemetry When Host Off ${power_sensor_path} |
| 68 | |
| 69 | |
| 70 | Power Supply Test When Host On |
| 71 | [Documentation] Check that power consumption is within limits when host |
| 72 | ... is on. |
| 73 | [Tags] Power_Supply_Test_When_Host_On |
| 74 | |
| 75 | REST Power On |
| 76 | ${power_sensor_path}= Get Sensors Aggregation URL List |
| 77 | ... /org/open_power/sensors/ |
| 78 | |
| 79 | Repeat Keyword ${LOOP_COUNT} times |
| 80 | ... Check Power Telemetry When Host On ${power_sensor_path} |
| 81 | |
| 82 | |
George Keishing | 5ac6e17 | 2018-04-09 12:44:15 -0500 | [diff] [blame] | 83 | Power Supply Error Logging Test At Runtime |
| 84 | [Documentation] Check that power supply error is logged when one of the |
| 85 | ... power supply inputs is unplugged. |
| 86 | [Tags] Power_Supply_Error_Logging_Test_At_Runtime |
George Keishing | 3457556 | 2018-04-14 10:39:07 -0500 | [diff] [blame] | 87 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 88 | ... Set Power Supply Present ${1} |
George Keishing | 5ac6e17 | 2018-04-09 12:44:15 -0500 | [diff] [blame] | 89 | |
| 90 | REST Power On stack_mode=skip |
| 91 | |
| 92 | Set Power Supply Present ${0} |
George Keishing | 423cc46 | 2018-07-13 03:42:48 -0500 | [diff] [blame] | 93 | |
| 94 | Wait Until Keyword Succeeds 30 sec 10 sec |
| 95 | ... Logging Entry Should Exist |
George Keishing | 5ac6e17 | 2018-04-09 12:44:15 -0500 | [diff] [blame] | 96 | ... xyz.openbmc_project.Inventory.Error.NotPresent |
| 97 | |
George Keishing | dc4a423 | 2018-02-19 12:13:36 -0600 | [diff] [blame] | 98 | *** Keywords *** |
| 99 | |
| 100 | Check Power Telemetry When Host On |
| 101 | [Documentation] Check that power consumption is within limits when host |
| 102 | ... is on. |
| 103 | [Arguments] ${power_paths} |
| 104 | |
| 105 | # Description of argument(s): |
| 106 | # power_paths A list of power paths (example list element |
| 107 | # "/org/open_power/sensors/aggregation/per_30s/ps0_input_power/average"). |
| 108 | |
Marissa Garza | 522a0c2 | 2020-02-05 12:49:29 -0600 | [diff] [blame] | 109 | Reset 30s Aggregation Power Readings |
| 110 | # sleep for 3 minutes to get 6-7 readings. |
| 111 | Sleep 3m |
| 112 | |
George Keishing | dc4a423 | 2018-02-19 12:13:36 -0600 | [diff] [blame] | 113 | # Check for "average" aggregation. |
Marissa Garza | 522a0c2 | 2020-02-05 12:49:29 -0600 | [diff] [blame] | 114 | FOR ${power_path} IN @{power_paths[0]} |
| 115 | ${averages}= Get Sensors Aggregation Data ${power_path} |
| 116 | ${max} ${min}= Evaluate (max(@{averages}), min(@{averages})) |
| 117 | Should Be True ${max} < ${upper_power_limit} |
| 118 | ... msg=Wattage ${max} crossed ${upper_power_limit}. |
| 119 | Should Be True ${min} >= ${lower_power_limit} |
| 120 | ... msg=Wattage ${min} below ${lower_power_limit}. |
| 121 | END |
George Keishing | dc4a423 | 2018-02-19 12:13:36 -0600 | [diff] [blame] | 122 | |
| 123 | # Check for "maximum" aggregation. |
Marissa Garza | 522a0c2 | 2020-02-05 12:49:29 -0600 | [diff] [blame] | 124 | FOR ${power_path} IN @{power_paths[1]} |
| 125 | ${maximums}= Get Sensors Aggregation Data ${power_path} |
| 126 | ${max} ${min}= Evaluate (max(@{maximums}), min(@{maximums})) |
| 127 | Should Be True ${max} < ${upper_power_limit} |
| 128 | ... msg=Wattage ${max} crossed ${upper_power_limit}. |
| 129 | Should Be True ${min} >= ${lower_power_limit} |
| 130 | ... msg=Wattage ${min} below ${lower_power_limit}. |
| 131 | END |
George Keishing | dc4a423 | 2018-02-19 12:13:36 -0600 | [diff] [blame] | 132 | |
| 133 | # Every 30 seconds the power wattage data is updated. |
| 134 | Sleep ${power_data_collection_interval}s |
| 135 | |
| 136 | |
| 137 | Check Power Telemetry When Host Off |
| 138 | [Documentation] Check that power consumption is within limits when host |
| 139 | ... is off. |
| 140 | [Arguments] ${power_paths} |
| 141 | |
| 142 | # Description of argument(s): |
| 143 | # power_paths A list of power paths (example list element |
| 144 | # "/org/open_power/sensors/aggregation/per_30s/ps0_input_power/average"). |
| 145 | |
| 146 | # Every 30 seconds the power wattage data is updated. |
| 147 | Sleep ${power_data_collection_interval}s |
| 148 | |
| 149 | # Check for "average" aggregation. |
Marissa Garza | 522a0c2 | 2020-02-05 12:49:29 -0600 | [diff] [blame] | 150 | FOR ${power_path} IN @{power_paths[0]} |
| 151 | ${averages}= Get Sensors Aggregation Data ${power_path} |
| 152 | Should Be True ${averages[0]} < ${lower_power_limit} |
| 153 | ... msg=Wattage ${averages[0]} more than ${lower_power_limit}. |
| 154 | END |
George Keishing | dc4a423 | 2018-02-19 12:13:36 -0600 | [diff] [blame] | 155 | |
| 156 | # Check for "maximum" aggregation. |
Marissa Garza | 522a0c2 | 2020-02-05 12:49:29 -0600 | [diff] [blame] | 157 | FOR ${power_path} IN @{power_paths[1]} |
| 158 | ${maximums}= Get Sensors Aggregation Data ${power_path} |
| 159 | Should Be True ${maximums[0]} < ${lower_power_limit} |
| 160 | ... msg=Wattage ${maximums[0]} more than ${lower_power_limit}. |
| 161 | END |
| 162 | |
| 163 | |
| 164 | Reset 30s Aggregation Power Readings |
| 165 | [Documentation] Reset 30s Aggregation Power Readings to ensure readings |
| 166 | ... are collected after Power Supplies are done powering up. |
| 167 | |
| 168 | BMC Execute Command /bin/systemctl restart power-supply-monitor@0.service |
| 169 | BMC Execute Command /bin/systemctl restart power-supply-monitor@1.service |
| 170 | # wait for services to restart. |
| 171 | Sleep 10s |
George Keishing | dc4a423 | 2018-02-19 12:13:36 -0600 | [diff] [blame] | 172 | |
George Keishing | 5ac6e17 | 2018-04-09 12:44:15 -0500 | [diff] [blame] | 173 | |
| 174 | Set Power Supply Present |
| 175 | [Documentation] Clear error log and set power present field. |
| 176 | [Arguments] ${power_present_setting} |
| 177 | |
| 178 | # Description of argument(s): |
| 179 | # power_present_setting Enable or disable power present field (e.g."0/1"). |
| 180 | |
George Keishing | 5ac6e17 | 2018-04-09 12:44:15 -0500 | [diff] [blame] | 181 | ${data}= Create Dictionary data=${power_present_setting} |
| 182 | Write Attribute |
| 183 | ... ${HOST_INVENTORY_URI}system/chassis/motherboard/powersupply0 |
| 184 | ... Present data=${data} |