blob: 4f01bc7d8dfa36193e93d48f5ecdfbf6bfe47f54 [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
87 [Teardown] Set Power Supply Present ${1}
88
89 REST Power On stack_mode=skip
90
91 Set Power Supply Present ${0}
92 Sleep 5s
93 Logging Entry Should Exist
94 ... xyz.openbmc_project.Inventory.Error.NotPresent
95
George Keishingdc4a4232018-02-19 12:13:36 -060096*** Keywords ***
97
98Check Power Telemetry When Host On
99 [Documentation] Check that power consumption is within limits when host
100 ... is on.
101 [Arguments] ${power_paths}
102
103 # Description of argument(s):
104 # power_paths A list of power paths (example list element
105 # "/org/open_power/sensors/aggregation/per_30s/ps0_input_power/average").
106
107 # Check for "average" aggregation.
108 :FOR ${power_path} IN @{power_paths[0]}
109 \ ${averages}= Get Sensors Aggregation Data ${power_path}
110 \ ${max} ${min}= Evaluate (max(@{averages}), min(@{averages}))
111 \ Should Be True ${max} < ${upper_power_limit}
112 ... msg=Wattage ${max} crossed ${upper_power_limit}.
113 \ Should Be True ${min} >= ${lower_power_limit}
114 ... msg=Wattage ${min} below ${lower_power_limit}.
115
116 # Check for "maximum" aggregation.
117 :FOR ${power_path} IN @{power_paths[1]}
118 \ ${maximums}= Get Sensors Aggregation Data ${power_path}
119 \ ${max} ${min}= Evaluate (max(@{maximums}), min(@{maximums}))
120 \ Should Be True ${max} < ${upper_power_limit}
121 ... msg=Wattage ${max} crossed ${upper_power_limit}.
122 \ Should Be True ${min} >= ${lower_power_limit}
123 ... msg=Wattage ${min} below ${lower_power_limit}.
124
125 # Every 30 seconds the power wattage data is updated.
126 Sleep ${power_data_collection_interval}s
127
128
129Check Power Telemetry When Host Off
130 [Documentation] Check that power consumption is within limits when host
131 ... is off.
132 [Arguments] ${power_paths}
133
134 # Description of argument(s):
135 # power_paths A list of power paths (example list element
136 # "/org/open_power/sensors/aggregation/per_30s/ps0_input_power/average").
137
138 # Every 30 seconds the power wattage data is updated.
139 Sleep ${power_data_collection_interval}s
140
141 # Check for "average" aggregation.
142 :FOR ${power_path} IN @{power_paths[0]}
143 \ ${averages}= Get Sensors Aggregation Data ${power_path}
George Keishingcdda1e52018-04-06 12:51:12 -0500144 \ Should Be True ${averages[0]} < ${lower_power_limit}
George Keishingdc4a4232018-02-19 12:13:36 -0600145 ... msg=Wattage ${averages[0]} more than ${lower_power_limit}.
146
147 # Check for "maximum" aggregation.
148 :FOR ${power_path} IN @{power_paths[1]}
149 \ ${maximums}= Get Sensors Aggregation Data ${power_path}
George Keishingcdda1e52018-04-06 12:51:12 -0500150 \ Should Be True ${maximums[0]} < ${lower_power_limit}
George Keishingdc4a4232018-02-19 12:13:36 -0600151 ... msg=Wattage ${maximums[0]} more than ${lower_power_limit}.
152
George Keishing5ac6e172018-04-09 12:44:15 -0500153
154Set Power Supply Present
155 [Documentation] Clear error log and set power present field.
156 [Arguments] ${power_present_setting}
157
158 # Description of argument(s):
159 # power_present_setting Enable or disable power present field (e.g."0/1").
160
161 FFDC On Test Case Fail
162
163 ${data}= Create Dictionary data=${power_present_setting}
164 Write Attribute
165 ... ${HOST_INVENTORY_URI}system/chassis/motherboard/powersupply0
166 ... Present data=${data}