blob: 75879ad6e55f079310896fa0232165e48d97253d [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
109 # Check for "average" aggregation.
110 :FOR ${power_path} IN @{power_paths[0]}
111 \ ${averages}= Get Sensors Aggregation Data ${power_path}
112 \ ${max} ${min}= Evaluate (max(@{averages}), min(@{averages}))
113 \ Should Be True ${max} < ${upper_power_limit}
114 ... msg=Wattage ${max} crossed ${upper_power_limit}.
115 \ Should Be True ${min} >= ${lower_power_limit}
116 ... msg=Wattage ${min} below ${lower_power_limit}.
117
118 # Check for "maximum" aggregation.
119 :FOR ${power_path} IN @{power_paths[1]}
120 \ ${maximums}= Get Sensors Aggregation Data ${power_path}
121 \ ${max} ${min}= Evaluate (max(@{maximums}), min(@{maximums}))
122 \ Should Be True ${max} < ${upper_power_limit}
123 ... msg=Wattage ${max} crossed ${upper_power_limit}.
124 \ Should Be True ${min} >= ${lower_power_limit}
125 ... msg=Wattage ${min} below ${lower_power_limit}.
126
127 # Every 30 seconds the power wattage data is updated.
128 Sleep ${power_data_collection_interval}s
129
130
131Check Power Telemetry When Host Off
132 [Documentation] Check that power consumption is within limits when host
133 ... is off.
134 [Arguments] ${power_paths}
135
136 # Description of argument(s):
137 # power_paths A list of power paths (example list element
138 # "/org/open_power/sensors/aggregation/per_30s/ps0_input_power/average").
139
140 # Every 30 seconds the power wattage data is updated.
141 Sleep ${power_data_collection_interval}s
142
143 # Check for "average" aggregation.
144 :FOR ${power_path} IN @{power_paths[0]}
145 \ ${averages}= Get Sensors Aggregation Data ${power_path}
George Keishingcdda1e52018-04-06 12:51:12 -0500146 \ Should Be True ${averages[0]} < ${lower_power_limit}
George Keishingdc4a4232018-02-19 12:13:36 -0600147 ... msg=Wattage ${averages[0]} more than ${lower_power_limit}.
148
149 # Check for "maximum" aggregation.
150 :FOR ${power_path} IN @{power_paths[1]}
151 \ ${maximums}= Get Sensors Aggregation Data ${power_path}
George Keishingcdda1e52018-04-06 12:51:12 -0500152 \ Should Be True ${maximums[0]} < ${lower_power_limit}
George Keishingdc4a4232018-02-19 12:13:36 -0600153 ... msg=Wattage ${maximums[0]} more than ${lower_power_limit}.
154
George Keishing5ac6e172018-04-09 12:44:15 -0500155
156Set Power Supply Present
157 [Documentation] Clear error log and set power present field.
158 [Arguments] ${power_present_setting}
159
160 # Description of argument(s):
161 # power_present_setting Enable or disable power present field (e.g."0/1").
162
George Keishing5ac6e172018-04-09 12:44:15 -0500163 ${data}= Create Dictionary data=${power_present_setting}
164 Write Attribute
165 ... ${HOST_INVENTORY_URI}system/chassis/motherboard/powersupply0
166 ... Present data=${data}