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