blob: ccd1d82508f9fbd683fdcbadcadff4cb33f093e0 [file] [log] [blame]
George Keishing06572472017-09-01 11:33:01 -05001*** Settings ***
2Documentation Suite to test harware sensors.
3
4Resource ../lib/utils.robot
5Resource ../lib/boot_utils.robot
6Resource ../lib/state_manager.robot
7Resource ../lib/openbmc_ffdc.robot
George Keishingdcf746b2018-02-06 12:43:44 -06008Resource ../lib/ipmi_client.robot
9Variables ../data/ipmi_raw_cmd_table.py
George Keishing06572472017-09-01 11:33:01 -050010
George Keishing8bf8ed72017-12-07 04:01:45 -060011Suite Setup Suite Setup Execution
12Test Teardown Test Teardown Execution
George Keishinga61e9dc2017-12-12 22:11:53 -060013Suite Teardown Run Keyword And Ignore Error
14... Power Redundancy Setting setValue Enabled
George Keishing06572472017-09-01 11:33:01 -050015
16*** Test Cases ***
17
18Verify System Ambient Temperature
19 [Documentation] Check the ambient sensor temperature.
20 [Tags] Verify_System_Ambient_Temperature
21
22 # Example:
23 # /xyz/openbmc_project/sensors/temperature/ambient
24 # {
25 # "Scale": -3,
26 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
27 # "Value": 25767
28 # }
29
30 ${temp_data}= Read Properties ${SENSORS_URI}temperature/ambient
31 Should Be True ${temp_data["Scale"]} == ${-3}
32 Should Be Equal As Strings
33 ... ${temp_data["Unit"]} xyz.openbmc_project.Sensor.Value.Unit.DegreesC
34 Should Be True ${temp_data["Value"]/1000} <= ${50}
35 ... msg=System working temperature crossed 50 degree celsius.
36
Sweta Potthuricca07de2017-09-26 06:14:23 -050037Verify Fan Sensors Attributes
38 [Documentation] Check fan attributes.
39 [Tags] Verify_Fan_Sensor_Attributes
40 # Example:
41 # /xyz/openbmc_project/sensors/fan_tach/fan0
42 # /xyz/openbmc_project/sensors/fan_tach/fan1
43 # /xyz/openbmc_project/sensors/fan_tach/fan2
44 # /xyz/openbmc_project/sensors/fan_tach/fan3
45 ${fans}= Get Endpoint Paths /xyz/openbmc_project/sensors/ fan*
46
47 # Access the properties of the fan and it should contain
48 # the following entries:
49 # /xyz/openbmc_project/sensors/fan_tach/fan0
50 # {
51 # "Scale": 0,
52 # "Target": 0,
53 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.RPMS",
54 # "Value": 0
55 # }
56
57 :FOR ${entry} IN @{fans}
58 \ ${resp}= OpenBMC Get Request ${entry}
59 \ ${json}= To JSON ${resp.content}
60 \ Should Be True ${json["data"]["Scale"]} >= 0
61 \ Run Keyword And Ignore Error
62 ... Should Be True ${json["data"]["Target"]} >= 0
63 \ Should Be Equal As Strings
64 ... ${json["data"]["Unit"]} xyz.openbmc_project.Sensor.Value.Unit.RPMS
65 \ Should Be True ${json["data"]["Value"]} >= 0
66
67
68Verify PCIE Sensors Attributes
69 [Documentation] Probe PCIE attributes.
70 [Tags] Verify_PCIE_Sensor_Attributes
71 # Example:
72 # /xyz/openbmc_project/sensors/temperature/pcie
73 ${temp_pcie}= Get Endpoint Paths /xyz/openbmc_project/sensors/ pcie
74
75 # Access the properties of the PCIE and it should contain
76 # the following entries:
77 # /xyz/openbmc_project/sensors/temperature/pcie
78 # {
79 # "Scale": -3,
80 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
81 # "Value": 29625
82 # }
83
84
85 :FOR ${entry} IN @{temp_pcie}
86 \ ${resp}= OpenBMC Get Request ${entry}
87 \ ${json}= To JSON ${resp.content}
88 \ Should Be True ${json["data"]["Scale"]} == -3
89 \ Should Be Equal As Strings
90 ... ${json["data"]["Unit"]} xyz.openbmc_project.Sensor.Value.Unit.DegreesC
91 \ ${temp_in_DegreeC}= Evaluate ${json["data"]["Value"]} / 1000
92 \ Should Be True ${temp_in_DegreeC} > 0
93
94
95Verify Rail Voltage Sensors Attributes
96 [Documentation] Check rail voltage attributes.
97 [Tags] Verify_Rail_Voltage_Sensor_Attributes
98 # Example of one of the entries returned by 'Get Endpoint Paths':
99 # /xyz/openbmc_project/sensors/voltage/rail_1_voltage
100 # /xyz/openbmc_project/sensors/voltage/rail_2_voltage
101 ${temp_rail}= Get Endpoint Paths /xyz/openbmc_project/sensors/ rail*
102
103 # Example:
104 # Access the properties of the rail voltage and it should contain
105 # the following entries:
106 # "/xyz/openbmc_project/sensors/voltage/rail_1_voltage":
107 # {
108 # "Scale": -3,
109 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Volts",
110 # "Value": 5097
111 # },
112
113 :FOR ${entry} IN @{temp_rail}
114 \ ${resp}= OpenBMC Get Request ${entry}
115 \ ${json}= To JSON ${resp.content}
116 \ Should Be True ${json["data"]["Scale"]} == -3
117 \ Should Be Equal As Strings
118 ... ${json["data"]["Unit"]} xyz.openbmc_project.Sensor.Value.Unit.Volts
119 \ ${volts}= Evaluate ${json["data"]["Value"]} / 1000
120 \ Should Be True ${volts} > 0
121
122
123Verify VDN Temperature Sensors Attributes
124 [Documentation] Check vdn temperature attributes.
125 [Tags] Verify_VDN_Temperature_Sensors_Attributes
126 # Example of one of the entries returned by 'Get Endpoint Paths':
127 # /xyz/openbmc_project/sensors/temperature/p0_vdn_temp
128 ${temp_vdn}= Get Endpoint Paths /xyz/openbmc_project/sensors/ *_vdn_temp
129
130 # Example:
131 # Access the properties of the rail voltage and it should contain
132 # the following entries:
133 # /xyz/openbmc_project/sensors/temperature/p0_vdn_temp
134 # {
135 # "Scale": -3,
136 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
137 # "Value": 3000
138 # }
139
140 :FOR ${entry} IN @{temp_vdn}
141 \ ${resp}= OpenBMC Get Request ${entry}
142 \ ${json}= To JSON ${resp.content}
143 \ Should Be True ${json["data"]["Scale"]} == -3
144 \ Should Be Equal As Strings
145 ... ${json["data"]["Unit"]} xyz.openbmc_project.Sensor.Value.Unit.DegreesC
146 \ ${vdn_temp}= Evaluate ${json["data"]["Value"]} / 1000
147 \ Should Be True ${vdn_temp} > 0
148
149
150Verify VCS Temperature Sensors Attributes
151 [Documentation] Check vcs temperature attributes.
152 [Tags] Verify_VCS_Temperature_Sensors_Attributes
153 # Example of one of the entries returned by 'Get Endpoint Paths':
154 # /xyz/openbmc_project/sensors/temperature/p0_vcs_temp
155 ${temp_vcs}= Get Endpoint Paths /xyz/openbmc_project/sensors/ *_vcs_temp
156
157 # Example:
158 # Access the properties of the rail voltage and it should contain
159 # the following entries:
160 # /xyz/openbmc_project/sensors/temperature/p0_vcs_temp
161 # {
162 # "Scale": -3,
163 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
164 # "Value": 31000
165 # },
166
167
168 :FOR ${entry} IN @{temp_vcs}
169 \ ${resp}= OpenBMC Get Request ${entry}
170 \ ${json}= To JSON ${resp.content}
171 \ Should Be True ${json["data"]["Scale"]} == -3
172 \ Should Be Equal As Strings
173 ... ${json["data"]["Unit"]} xyz.openbmc_project.Sensor.Value.Unit.DegreesC
174 \ ${vcs_temp}= Evaluate ${json["data"]["Value"]} / 1000
175 \ Should Be True ${vcs_temp} > 0
176
177
178Verify VDD Temperature Sensors Attributes
179 [Documentation] Check vdd temperature attributes.
180 [Tags] Verify_VDD_Temperature_Sensors_Attributes
181 # Example of one of the entries returned by 'Get Endpoint Paths':
182 # /xyz/openbmc_project/sensors/temperature/p0_vdd_temp
183 ${temp_vdd}= Get Endpoint Paths /xyz/openbmc_project/sensors/ *_vdd_temp
184
185 # Example:
186 # Access the properties of the rail voltage and it should contain
187 # the following entries:
188 # /xyz/openbmc_project/sensors/temperature/p0_vdd_temp
189 # {
190 # "Scale": -3,
191 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
192 # "Value": 4000
193 # }
194
195 :FOR ${entry} IN @{temp_vdd}
196 \ ${resp}= OpenBMC Get Request ${entry}
197 \ ${json}= To JSON ${resp.content}
198 \ Should Be True ${json["data"]["Scale"]} == -3
199 \ Should Be Equal As Strings
200 ... ${json["data"]["Unit"]} xyz.openbmc_project.Sensor.Value.Unit.DegreesC
201 \ ${vdd_temp}= Evaluate ${json["data"]["Value"]} / 1000
202 \ Should Be True ${vdd_temp} > 0
203
204
205Verify VDDR Temperature Sensors Attributes
206 [Documentation] Check vddr temperature attributes.
207 [Tags] Verify_VDDR_Temperature_Sensors_Attributes
208 # Example of one of the entries returned by 'Get Endpoint Paths':
209 # /xyz/openbmc_project/sensors/temperature/p0_vddr_temp
210 ${temp_vddr}=
211 ... Get Endpoint Paths /xyz/openbmc_project/sensors/ *_vddr_temp
212
213 # Example:
214 # Access the properties of the rail voltage and it should contain
215 # the following entries:
216 # /xyz/openbmc_project/sensors/temperature/p0_vddr_temp
217 # {
218 # "Scale": -3,
219 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
220 # "Value": 4000
221 # }
222
223 :FOR ${entry} IN @{temp_vddr}
224 \ ${resp}= OpenBMC Get Request ${entry}
225 \ ${json}= To JSON ${resp.content}
226 \ Should Be True ${json["data"]["Scale"]} == -3
227 \ Should Be Equal As Strings
228 ... ${json["data"]["Unit"]} xyz.openbmc_project.Sensor.Value.Unit.DegreesC
229 \ ${vddr_temp}= Evaluate ${json["data"]["Value"]} / 1000
230 \ Should Be True ${vddr_temp} > 0
George Keishing06572472017-09-01 11:33:01 -0500231
George Keishingdcf746b2018-02-06 12:43:44 -0600232Disable Power Redundancy And Verify Using REST
George Keishing8bf8ed72017-12-07 04:01:45 -0600233 [Documentation] Disable power redundancy and verify that it is disabled.
George Keishingdcf746b2018-02-06 12:43:44 -0600234 [Tags] Disable_Power_Redundancy_And_Verify_Using_REST
George Keishing8bf8ed72017-12-07 04:01:45 -0600235
236 # Example:
237 # /xyz/openbmc_project/sensors/chassis/PowerSupplyRedundancy
238 # {
239 # "error": 0,
240 # "units": "",
241 # "value": "Disabled"
242 # }
243
244 Power Redundancy Setting setValue Disabled
245
246 ${resp}= Power Redundancy Setting getValue
247 ${content}= To Json ${resp.content}
248 Should Be Equal As Strings ${content["data"]} Disabled
249
250
George Keishingdcf746b2018-02-06 12:43:44 -0600251Enable Power Redundancy And Verify Using REST
George Keishing8bf8ed72017-12-07 04:01:45 -0600252 [Documentation] Enable power redundancy and verify that it is enabled.
George Keishingdcf746b2018-02-06 12:43:44 -0600253 [Tags] Enable_Power_Redundancy_And_Verify_Using REST
George Keishing8bf8ed72017-12-07 04:01:45 -0600254
255 # Example:
256 # /xyz/openbmc_project/sensors/chassis/PowerSupplyRedundancy
257 # {
258 # "error": 0,
259 # "units": "",
260 # "value": "Enabled"
261 # }
262
263 Power Redundancy Setting setValue Enabled
264
265 ${resp}= Power Redundancy Setting getValue
266 ${content}= To Json ${resp.content}
267 Should Be Equal As Strings ${content["data"]} Enabled
268
269
George Keishingdcf746b2018-02-06 12:43:44 -0600270Disable Power Redundancy And Verify Using IPMI
271 [Documentation] Disable power redundancy and verify that it is disabled.
272 [Tags] Disable_Power_Redundancy_And_Verify_Using_IPMI
273
274 # Refer to data/ipmi_raw_cmd_table.py for command definition.
275
276 Run IPMI Standard Command
277 ... raw ${IPMI_RAW_CMD['power_supply_redundancy']['Disabled'][0]}
278
279 ${output}= Run IPMI Standard Command
280 ... raw ${IPMI_RAW_CMD['power_supply_redundancy']['Get'][0]}
281
282 Should Be Equal As Strings
283 ... ${output.lstrip()}
284 ... ${IPMI_RAW_CMD['power_supply_redundancy']['Get'][1]}
285 ... msg=${IPMI_RAW_CMD['power_supply_redundancy']['Get'][1]} = ${output}.
286
287
288Enable Power Redundancy And Verify Using IPMI
289 [Documentation] Enable power redundancy and verify that it is enabled.
290 [Tags] Enable_Power_Redundancy_And_Verify_Using_IPMI
291
292 # Refer to data/ipmi_raw_cmd_table.py for command definition.
293
294 Run IPMI Standard Command
295 ... raw ${IPMI_RAW_CMD['power_supply_redundancy']['Enabled'][0]}
296
297 ${output}= Run IPMI Standard Command
298 ... raw ${IPMI_RAW_CMD['power_supply_redundancy']['Get'][0]}
299
300 Should Be Equal As Strings
301 ... ${output.lstrip()}
302 ... ${IPMI_RAW_CMD['power_supply_redundancy']['Get'][3]}
303 ... msg=${IPMI_RAW_CMD['power_supply_redundancy']['Get'][3]} = ${output}.
304
305
George Keishing06572472017-09-01 11:33:01 -0500306*** Keywords ***
307
George Keishing8bf8ed72017-12-07 04:01:45 -0600308Suite Setup Execution
George Keishing06572472017-09-01 11:33:01 -0500309 [Documentation] Do the initial test suite setup.
310 # - Power off.
311 # - Boot Host.
312 REST Power Off stack_mode=skip
313 REST Power On
314
George Keishing8bf8ed72017-12-07 04:01:45 -0600315Test Teardown Execution
George Keishing06572472017-09-01 11:33:01 -0500316 [Documentation] Do the post test teardown.
317 # - Capture FFDC on test failure.
318 # - Delete error logs.
319 # - Close all open SSH connections.
320
George Keishing8bf8ed72017-12-07 04:01:45 -0600321 FFDC On Test Case Fail
322 Delete Error Logs
323 Close All Connections
324
325Power Redundancy Setting
326 [Documentation] "Set" or "Get" power redundancy setting.
327 [Arguments] ${action} ${value}=${EMPTY}
328
329 # Description of argument(s):
330 # action "setValue" or "getValue" API request string.
331 # value String argument for the API request (e.g. "Enabled"/"Disabled").
332
333 @{arglist}= Create List
334 Run Keyword If '${value}' != '${EMPTY}'
335 ... Append To List ${arglist} ${value}
336
337 ${args}= Create Dictionary data=@{arglist}
338 ${resp}= Call Method ${SENSORS_URI}chassis/PowerSupplyRedundancy
339 ... ${action} data=${args}
340 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
341
342 [Return] ${resp}
George Keishing06572472017-09-01 11:33:01 -0500343