blob: f2c0e94979abbece5f3430feb914c3f9a1275076 [file] [log] [blame]
George Keishingdc4a4232018-02-19 12:13:36 -06001*** Settings ***
2Documentation Test power supply telemetry.
3
4Resource ../lib/openbmc_ffdc.robot
5Resource ../lib/open_power_utils.robot
6Resource ../lib/boot_utils.robot
George Keishing5ac6e172018-04-09 12:44:15 -05007Resource ../lib/logging_utils.robot
George Keishingdc4a4232018-02-19 12:13:36 -06008
9Test 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 Keishingcdda1e52018-04-06 12:51:12 -050025${lower_power_limit} ${100}
George Keishingdc4a4232018-02-19 12:13:36 -060026${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
58Power 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
70Power 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 Keishing5ac6e172018-04-09 12:44:15 -050083Power 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 Keishing34575562018-04-14 10:39:07 -050087 [Teardown] Run Keywords FFDC On Test Case Fail AND
88 ... Set Power Supply Present ${1}
George Keishing5ac6e172018-04-09 12:44:15 -050089
90 REST Power On stack_mode=skip
91
92 Set Power Supply Present ${0}
George Keishing423cc462018-07-13 03:42:48 -050093
94 Wait Until Keyword Succeeds 30 sec 10 sec
95 ... Logging Entry Should Exist
George Keishing5ac6e172018-04-09 12:44:15 -050096 ... xyz.openbmc_project.Inventory.Error.NotPresent
97
George Keishingdc4a4232018-02-19 12:13:36 -060098*** Keywords ***
99
100Check 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 Garza522a0c22020-02-05 12:49:29 -0600109 Reset 30s Aggregation Power Readings
110 # sleep for 3 minutes to get 6-7 readings.
111 Sleep 3m
112
George Keishingdc4a4232018-02-19 12:13:36 -0600113 # Check for "average" aggregation.
Marissa Garza522a0c22020-02-05 12:49:29 -0600114 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 Keishingdc4a4232018-02-19 12:13:36 -0600122
123 # Check for "maximum" aggregation.
Marissa Garza522a0c22020-02-05 12:49:29 -0600124 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 Keishingdc4a4232018-02-19 12:13:36 -0600132
133 # Every 30 seconds the power wattage data is updated.
134 Sleep ${power_data_collection_interval}s
135
136
137Check 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 Garza522a0c22020-02-05 12:49:29 -0600150 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 Keishingdc4a4232018-02-19 12:13:36 -0600155
156 # Check for "maximum" aggregation.
Marissa Garza522a0c22020-02-05 12:49:29 -0600157 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
164Reset 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 Keishingdc4a4232018-02-19 12:13:36 -0600172
George Keishing5ac6e172018-04-09 12:44:15 -0500173
174Set 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 Keishing5ac6e172018-04-09 12:44:15 -0500181 ${data}= Create Dictionary data=${power_present_setting}
182 Write Attribute
183 ... ${HOST_INVENTORY_URI}system/chassis/motherboard/powersupply0
184 ... Present data=${data}