blob: 42c140128a679fdcc7899a83358c682889831a25 [file] [log] [blame]
Anusha Dathatri88ccaff2020-02-07 05:17:53 -06001*** Settings ***
2Documentation Validate IPMI sensor IDs using Redfish.
3
4Resource ../lib/ipmi_client.robot
5Resource ../lib/openbmc_ffdc.robot
George Keishing6f395fd2021-08-18 02:18:53 -05006Resource ../lib/boot_utils.robot
Sushma M Md4d13f02020-02-13 03:42:41 -06007Library ../lib/ipmi_utils.py
Sushma M Mfd2f4282020-03-18 04:12:47 -05008Variables ../data/ipmi_raw_cmd_table.py
Anusha Dathatri88ccaff2020-02-07 05:17:53 -06009
Sushma M Mfd2f4282020-03-18 04:12:47 -050010Test Setup Redfish.Login
11Test Teardown Run Keywords FFDC On Test Case Fail AND
12... Redfish.Logout
Anusha Dathatri88ccaff2020-02-07 05:17:53 -060013
Sushma M Mbe808b92020-02-03 23:12:14 -060014
15*** Variables ***
Sushma M M84e98d92020-04-15 04:47:10 -050016${allowed_temp_diff} ${2}
Sushma M Md4d13f02020-02-13 03:42:41 -060017${allowed_power_diff} ${10}
Sushma M Mbe808b92020-02-03 23:12:14 -060018
19
Anusha Dathatri88ccaff2020-02-07 05:17:53 -060020*** Test Cases ***
21
22Verify IPMI Temperature Readings using Redfish
23 [Documentation] Verify temperatures from IPMI sensor reading command using Redfish.
24 [Tags] Verify_IPMI_Temperature_Readings_using_Redfish
25 [Template] Get Temperature Reading And Verify In Redfish
26
27 # command_type sensor_id member_id
28 IPMI pcie pcie
29 IPMI ambient ambient
30
31
32Verify DCMI Temperature Readings using Redfish
33 [Documentation] Verify temperatures from DCMI sensor reading command using Redfish.
34 [Tags] Verify_DCMI_Temperature_Readings_using_Redfish
35 [Template] Get Temperature Reading And Verify In Redfish
36
37 # command_type sensor_id member_id
38 DCMI pcie pcie
39 DCMI ambient ambient
40
Sushma M Mbe808b92020-02-03 23:12:14 -060041
42Test Ambient Temperature Via IPMI
43 [Documentation] Test ambient temperature via IPMI and verify using Redfish.
44 [Tags] Test_Ambient_Temperature_Via_IPMI
45
46 # Example of IPMI dcmi get_temp_reading output:
47 # Entity ID Entity Instance Temp. Readings
srichn28b9121662022-09-27 08:01:42 -050048 # Inlet air temperature(40h) 1 +22 C
49 # Inlet air temperature(40h) 2 +23 C
50 # Inlet air temperature(40h) 3 +22 C
51 # CPU temperature sensors(41h) 0 +0 C
52 # Baseboard temperature sensors(42h) 1 +26 C
53 # Baseboard temperature sensors(42h) 2 +27 C
Sushma M Mbe808b92020-02-03 23:12:14 -060054
55 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
56 Should Contain ${temp_reading} Inlet air temperature
57 ... msg="Unable to get inlet temperature via DCMI".
58
59 ${ambient_temp_line}=
60 ... Get Lines Containing String ${temp_reading}
61 ... Inlet air temperature case-insensitive
62
srichn28b9121662022-09-27 08:01:42 -050063 ${ambient_temp_line}= Split To Lines ${ambient_temp_line}
64 ${ipmi_temp_list}= Create List
65 FOR ${line} IN @{ambient_temp_line}
66 ${ambient_temp_ipmi}= Set Variable ${line.split('+')[1].strip(' C')}
67 Append To List ${ipmi_temp_list} ${ambient_temp_ipmi}
68 END
69 ${list_length}= Get Length ${ipmi_temp_list}
Sushma M Mbe808b92020-02-03 23:12:14 -060070
srichn28b9121662022-09-27 08:01:42 -050071 # Getting temperature readings from Redfish.
72 ${ambient_temp_redfish}= Get Temperature Reading From Redfish Ambient
73 ${ambient_temp_redfish}= Get Dictionary Values ${ambient_temp_redfish} sort_keys=True
74 FOR ${index} IN RANGE ${list_length}
75 ${ipmi_redfish_temp_diff}=
76 ... Evaluate abs(${ambient_temp_redfish[${index}]} - ${ipmi_temp_list[${index}]})
Sushma M Mbe808b92020-02-03 23:12:14 -060077
srichn28b9121662022-09-27 08:01:42 -050078 Should Be True ${ipmi_redfish_temp_diff} <= ${allowed_temp_diff}
79 ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}.
80 END
Sushma M Mbe808b92020-02-03 23:12:14 -060081
82
Sushma M Md4d13f02020-02-13 03:42:41 -060083Test Power Reading Via IPMI With Host Off
84 [Documentation] Verify power reading via IPMI with host in off state
85 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Off
86
87 Redfish Power Off stack_mode=skip
88
89 ${ipmi_reading}= Get IPMI Power Reading
90
91 Should Be Equal ${ipmi_reading['instantaneous_power_reading']} 0
92 ... msg=Power reading not zero when power is off.
93
94
95Test Power Reading Via IPMI With Host Booted
96 [Documentation] Test power reading via IPMI with host in booted state and
97 ... verify using Redfish.
98 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted
99
100 IPMI Power On stack_mode=skip
101
102 Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading Using IPMI And Redfish
103
104
Sushma M M85dbd9c2020-03-20 15:58:28 -0500105Test Baseboard Temperature Via IPMI
106 [Documentation] Test baseboard temperature via IPMI and verify using Redfish.
107 [Tags] Test_Baseboard_Temperature_Via_IPMI
108
109 # Example of IPMI dcmi get_temp_reading output:
110 # Entity ID Entity Instance Temp. Readings
srichn28334438b2022-09-21 08:41:25 -0500111 # Inlet air temperature(40h) 1 +22 C
112 # Inlet air temperature(40h) 2 +23 C
113 # Inlet air temperature(40h) 3 +22 C
114 # CPU temperature sensors(41h) 0 +0 C
115 # Baseboard temperature sensors(42h) 1 +26 C
116 # Baseboard temperature sensors(42h) 2 +27 C
Sushma M M85dbd9c2020-03-20 15:58:28 -0500117
118 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
119 Should Contain ${temp_reading} Baseboard temperature sensors
120 ... msg="Unable to get baseboard temperature via DCMI".
srichn28334438b2022-09-21 08:41:25 -0500121 ${baseboard_temp_lines}=
Sushma M M85dbd9c2020-03-20 15:58:28 -0500122 ... Get Lines Containing String ${temp_reading}
123 ... Baseboard temperature case-insensitive=True
srichn28334438b2022-09-21 08:41:25 -0500124 ${lines}= Split To Lines ${baseboard_temp_lines}
Sushma M M85dbd9c2020-03-20 15:58:28 -0500125
srichn28334438b2022-09-21 08:41:25 -0500126 ${ipmi_temp_list}= Create List
127 FOR ${line} IN @{lines}
128 ${baseboard_temp_ipmi}= Set Variable ${line.split('+')[1].strip(' C')}
129 Append To List ${ipmi_temp_list} ${baseboard_temp_ipmi}
130 END
131 ${list_length}= Get Length ${ipmi_temp_list}
Sushma M M85dbd9c2020-03-20 15:58:28 -0500132
srichn28334438b2022-09-21 08:41:25 -0500133 # Getting temperature readings from Redfish.
134 ${baseboard_temp_redfish}= Get Temperature Reading From Redfish PCIE
135 ${baseboard_temp_redfish}= Get Dictionary Values ${baseboard_temp_redfish} sort_keys=True
Sushma M M85dbd9c2020-03-20 15:58:28 -0500136
srichn28334438b2022-09-21 08:41:25 -0500137 FOR ${index} IN RANGE ${list_length}
138 ${baseboard_temp_diff}= Evaluate abs(${baseboard_temp_redfish[${index}]} - ${ipmi_temp_list[${index}]})
139 Should Be True
140 ... ${baseboard_temp_diff} <= ${allowed_temp_diff}
141 ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}.
142 END
Sushma M M85dbd9c2020-03-20 15:58:28 -0500143
Sushma M Mfd2f4282020-03-18 04:12:47 -0500144Test Power Reading Via IPMI Raw Command
145 [Documentation] Test power reading via IPMI raw command and verify
146 ... using Redfish.
147 [Tags] Test_Power_Reading_Via_IPMI_Raw_Command
148
149 IPMI Power On stack_mode=skip
150
151 Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading Via Raw Command
152
153
Sushma M M89882ce2020-03-31 17:21:37 -0500154Verify CPU Present
155 [Documentation] Verify the IPMI sensor for CPU present using Redfish.
156 [Tags] Verify_CPU_Present
srichn284c7d4462022-08-22 03:40:49 -0500157 [Template] Set Present Bit Via IPMI and Verify Using Redfish
Sushma M M89882ce2020-03-31 17:21:37 -0500158
srichn284c7d4462022-08-22 03:40:49 -0500159 # component state
160 cpu Enabled
Sushma M M89882ce2020-03-31 17:21:37 -0500161
162
163Verify CPU Not Present
164 [Documentation] Verify the IPMI sensor for CPU not present using Redfish.
165 [Tags] Verify_CPU_Not_Present
srichn284c7d4462022-08-22 03:40:49 -0500166 [Template] Set Present Bit Via IPMI and Verify Using Redfish
Sushma M M89882ce2020-03-31 17:21:37 -0500167
srichn284c7d4462022-08-22 03:40:49 -0500168 # component state
169 cpu Absent
Sushma M M89882ce2020-03-31 17:21:37 -0500170
171
172Verify GPU Present
173 [Documentation] Verify the IPMI sensor for GPU present using Redfish.
174 [Tags] Verify_GPU_Present
George Keishinge24838e2022-09-26 22:46:45 -0500175 [Template] Set Present Bit Via IPMI and Verify Using Redfish
Sushma M M89882ce2020-03-31 17:21:37 -0500176
177 # sensor_id component
178 0xC5 gv100card0
179
180
181Verify GPU Not Present
182 [Documentation] Verify the IPMI sensor for GPU not present using Redfish.
183 [Tags] Verify_GPU_Not_Present
George Keishinge24838e2022-09-26 22:46:45 -0500184 [Template] Set Present Bit Via IPMI and Verify Using Redfish
Sushma M M89882ce2020-03-31 17:21:37 -0500185
186 # sensor_id component
187 0xC5 gv100card0
188
189
Sushma M Mc69a3d32020-06-10 18:13:08 -0500190Test Sensor Threshold Via IPMI
191 [Documentation] Test sensor threshold via IPMI and verify using Redfish.
192 [Tags] Test_Sensor_Threshold_Via_IPMI
193 [Template] Verify Power Supply Sensor Threshold
194
195 # threshold_id component
196 Upper Non-Critical UpperThresholdNonCritical
197 Upper Critical UpperThresholdCritical
198 Lower Non-Critical LowerThresholdNonCritical
199 Lower Critical LowerThresholdCritical
200
201
Anusha Dathatri88ccaff2020-02-07 05:17:53 -0600202*** Keywords ***
203
204Get Temperature Reading And Verify In Redfish
205 [Documentation] Get IPMI or DCMI sensor reading and verify in Redfish.
206 [Arguments] ${command_type} ${sensor_id} ${member_id}
207
208 # Description of argument(s):
209 # command_type Type of command used to get sensor data (eg. IPMI, DCMI).
210 # sensor_id Sensor id used to get reading in IPMI or DCMI.
211 # member_id Member id of sensor data in Redfish.
212
213 ${ipmi_value}= Run Keyword If '${command_type}' == 'IPMI' Get IPMI Sensor Reading ${sensor_id}
214 ... ELSE Get DCMI Sensor Reading ${sensor_id}
215
216 ${redfish_value}= Get Temperature Reading From Redfish ${member_id}
217
218 Valid Range ${ipmi_value} ${redfish_value-1.000} ${redfish_value+1.000}
219
220
221Get IPMI Sensor Reading
222 [Documentation] Get reading from IPMI sensor reading command.
223 [Arguments] ${sensor_id}
224
225 # Description of argument(s):
226 # sensor_id Sensor id used to get reading in IPMI.
227
228 ${data}= Run IPMI Standard Command sensor reading ${sensor_id}
229
230 # Example reading:
231 # pcie | 28.500
232
233 ${sensor_value}= Set Variable ${data.split('| ')[1].strip()}
234 [Return] ${sensor_value}
235
236
237Get DCMI Sensor Reading
238 [Documentation] Get reading from DCMI sensors command.
239 [Arguments] ${sensor_id}
240
241 # Description of argument(s):
242 # sensor_id Sensor id used to get reading in DCMI.
243
244 ${data}= Run IPMI Standard Command dcmi sensors
245 ${sensor_data}= Get Lines Containing String ${data} ${sensor_id}
246
247 # Example reading:
248 # Record ID 0x00fd: pcie | 28.50 degrees C | ok
249
250 ${sensor_value}= Set Variable ${sensor_data.split(' | ')[1].strip('degrees C').strip()}
251 [Return] ${sensor_value}
252
253
254Get Temperature Reading From Redfish
255 [Documentation] Get temperature reading from Redfish.
256 [Arguments] ${member_id}
257
258 # Description of argument(s):
259 # member_id Member id of temperature.
260
srichn28334438b2022-09-21 08:41:25 -0500261 @{thermal_uri}= redfish_utils.Get Member List /redfish/v1/Chassis/
262 @{redfish_readings}= redfish_utils.Get Attribute ${thermal_uri[0]}/${THERMAL_METRICS} TemperatureReadingsCelsius
263
264 # Example of Baseboard temperature via Redfish
265
266 # "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/ThermalMetrics",
267 # "@odata.type": "#ThermalMetrics.v1_0_0.ThermalMetrics",
268 # "Id": "ThermalMetrics",
269 # "Name": "Chassis Thermal Metrics",
270 # "TemperatureReadingsCelsius": [
271 # {
272 # "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/PCIE_0_Temp",
273 # "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/PCIE_0_Temp",
274 # "DeviceName": "PCIE_0_Temp",
275 # "Reading": 23.75
276 # },
277
278 ${redfish_value_dict}= Create Dictionary
Anusha Dathatri88ccaff2020-02-07 05:17:53 -0600279 FOR ${data} IN @{redfish_readings}
srichn28334438b2022-09-21 08:41:25 -0500280 ${contains}= Evaluate "${member_id}" in """${data}[DeviceName]"""
281 ${reading}= Set Variable ${data}[Reading]
282 Run Keyword IF "${contains}" == "True"
283 ... Set To Dictionary ${redfish_value_dict} ${data}[DeviceName] ${reading}
Anusha Dathatri88ccaff2020-02-07 05:17:53 -0600284 END
srichn28334438b2022-09-21 08:41:25 -0500285
286 [Return] ${redfish_value_dict}
Sushma M Md4d13f02020-02-13 03:42:41 -0600287
288
289Verify Power Reading Using IPMI And Redfish
290 [Documentation] Verify power reading using IPMI and Redfish.
291
292 # Example of power reading command output via IPMI.
293 # Instantaneous power reading: 235 Watts
294 # Minimum during sampling period: 235 Watts
295 # Maximum during sampling period: 235 Watts
296 # Average power reading over sample period: 235 Watts
297 # IPMI timestamp: Thu Jan 1 00:00:00 1970
298 # Sampling period: 00000000 Seconds.
299 # Power reading state is: deactivated
300
301 ${ipmi_reading}= Get IPMI Power Reading
302
George Keishingd5f179e2020-07-14 16:07:31 -0500303 ${power_uri_list}= redfish_utils.Get Members URI /redfish/v1/Chassis/ PowerControl
304 Log List ${power_uri_list}
Sushma M Md4d13f02020-02-13 03:42:41 -0600305
George Keishingd5f179e2020-07-14 16:07:31 -0500306 # Power entries could be seen across different redfish path, remove the URI
307 # where the attribute is non-existent.
308 # Example:
309 # ['/redfish/v1/Chassis/chassis/Power',
310 # '/redfish/v1/Chassis/motherboard/Power']
311 FOR ${idx} IN @{power_uri_list}
312 ${power}= redfish_utils.Get Attribute ${idx} PowerControl
313 Log Dictionary ${power[0]}
Sushma M Md4d13f02020-02-13 03:42:41 -0600314
George Keishingd5f179e2020-07-14 16:07:31 -0500315 # Ensure the path does have the attribute else set to EMPTY as default to skip.
316 ${value}= Get Variable Value ${power[0]['PowerConsumedWatts']} ${EMPTY}
317 Run Keyword If "${value}" == "${EMPTY}"
318 ... Remove Values From List ${power_uri_list} ${idx}
319
320 # Check the next available element in the list.
321 Continue For Loop If "${value}" == "${EMPTY}"
322
323 ${ipmi_redfish_power_diff}=
324 ... Evaluate abs(${${power[0]['PowerConsumedWatts']}} - ${ipmi_reading['instantaneous_power_reading']})
325 Should Be True ${ipmi_redfish_power_diff} <= ${allowed_power_diff}
326 ... msg=Power reading above allowed threshold ${allowed_power_diff}.
327 END
328
George Keishinge68cbfb2020-08-12 11:11:58 -0500329 # Double check, the validation has at least one valid path.
George Keishingd5f179e2020-07-14 16:07:31 -0500330 Should Not Be Empty ${power_uri_list}
George Keishinge68cbfb2020-08-12 11:11:58 -0500331 ... msg=Should contain at least one element in the list.
Sushma M Mfd2f4282020-03-18 04:12:47 -0500332
333
334Verify Power Reading Via Raw Command
335 [Documentation] Get dcmi power reading via IPMI raw command.
336
337 ${ipmi_raw_output}= Run IPMI Standard Command
338 ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]}
339
340 ${power_reading_ipmi}= Set Variable ${ipmi_raw_output.split()[1]}
341 ${power_reading_ipmi}=
342 ... Convert To Integer 0x${power_reading_ipmi}
343
344 # Example of power reading via Redfish
345 # "@odata.id": "/redfish/v1/Chassis/chassis/Power#/PowerControl/0",
346 # "@odata.type": "#Power.v1_0_0.PowerControl",
347 # "MemberId": "0",
348 # "Name": "Chassis Power Control",
349 # "PowerConsumedWatts": 145.0,
350
Jorge Cisneros187f1772022-08-22 14:03:08 +0000351 ${power}= Redfish.Get Properties /redfish/v1/Chassis/${CHASSIS_ID}/Power
Sushma M Mfd2f4282020-03-18 04:12:47 -0500352 ${redfish_reading}= Set Variable ${power['PowerControl'][0]['PowerConsumedWatts']}
353
354 ${ipmi_redfish_power_diff}=
355 ... Evaluate abs(${redfish_reading} - ${power_reading_ipmi})
356
357 Should Be True ${ipmi_redfish_power_diff} <= ${allowed_power_diff}
Sushma M M89882ce2020-03-31 17:21:37 -0500358 ... msg=Power reading above allowed threshold ${allowed_power_diff}.
359
360
srichn284c7d4462022-08-22 03:40:49 -0500361Set Present Bit Via IPMI and Verify Using Redfish
362 [Documentation] Set present bit of sensor via IPMI and verify using Redfish.
363 [Arguments] ${component} ${status}
Sushma M M89882ce2020-03-31 17:21:37 -0500364
365 # Description of argument(s):
Sushma M M89882ce2020-03-31 17:21:37 -0500366 # component The Redfish component of IPMI sensor.
srichn284c7d4462022-08-22 03:40:49 -0500367 # status Status of the bit to be set(e.g. Absent, Present).
Sushma M M89882ce2020-03-31 17:21:37 -0500368
srichn284c7d4462022-08-22 03:40:49 -0500369 ${sensor_list}= Get Available Sensors ${component}
370 ${sensor_name}= Set Variable ${sensor_list[0]}
371 ${sensor_id}= Get Sensor Id For Sensor ${sensor_name}
Sushma M M89882ce2020-03-31 17:21:37 -0500372
srichn284c7d4462022-08-22 03:40:49 -0500373 Run Keyword If '${status}' == 'Absent'
374 ... Run IPMI Command
375 ... 0x04 0x30 ${sensor_id} 0xa9 0x00 0x00 0x00 0x80 0x00 0x00 0x20 0x00
376 ... ELSE IF '${status}' == 'Enabled'
377 ... Run IPMI Command
378 ... 0x04 0x30 ${sensor_id} 0xa9 0x00 0x80 0x00 0x00 0x00 0x00 0x20 0x00
Sushma M Mc4cabd52020-04-08 09:32:37 -0500379
srichn284c7d4462022-08-22 03:40:49 -0500380 # Redfish cpu components have "-" instead of "_" (e.g.: dcm0-cpu0).
381 ${cpu_name}= Replace String ${sensor_name} _ -
382 ${sensor_properties}= Redfish.Get Properties /redfish/v1/Systems/system/Processors/${cpu_name}
Sushma M M89882ce2020-03-31 17:21:37 -0500383
srichn284c7d4462022-08-22 03:40:49 -0500384 # Example of CPU state via Redfish
George Keishing52eb7c22022-03-11 10:58:53 -0600385
srichn284c7d4462022-08-22 03:40:49 -0500386 # "ProcessorType": "CPU",
387 # "SerialNumber": "YA1936422499",
388 # "Socket": "",
389 # "SparePartNumber": "F210110",
390 # "Status": {
391 # "Health": "OK",
392 # "State": "Absent"
393 # }
Sushma M M89882ce2020-03-31 17:21:37 -0500394
srichn284c7d4462022-08-22 03:40:49 -0500395 Should Be True '${sensor_properties['Status']['State']}' == '${status}'
Sushma M Mc69a3d32020-06-10 18:13:08 -0500396
397
398Verify Power Supply Sensor Threshold
399 [Documentation] Get power supply sensor threshold value via IPMI and verify using Redfish.
400 [Arguments] ${ipmi_threshold_id} ${redfish_threshold_id}
401
402 # Description of argument(s):
403 # ipmi_threshold_id The sensor threshold component of IPMI sensor.
404 # redfish_threshold_id The sensor threshold component of Redfish sensor.
405
406
407 # Example of ipmi sensor output
408 # Locating sensor record...
409 # Sensor ID : ps0_input_voltag (0xf7)
410 # Entity ID : 10.19
411 # Sensor Type (Threshold) : Voltage
412 # Sensor Reading : 208 (+/- 0) Volts
413 # Status : ok
414 # Lower Non-Recoverable : na
415 # Lower Critical : 180.000
416 # Lower Non-Critical : 200.000
417 # Upper Non-Critical : 290.000
418 # Upper Critical : 300.000
419 # Upper Non-Recoverable : na
420 # Positive Hysteresis : Unspecified
421 # Negative Hysteresis : Unspecified
422
423
424 ${ipmi_sensor_output}= Run External IPMI Standard Command sensor get ps0_input_voltag
425 ${ipmi_threshold_output}= Get Lines Containing String ${ipmi_sensor_output} ${ipmi_threshold_id}
426 ${ipmi_threshold_reading}= Fetch From Right ${ipmi_threshold_output} :${SPACE}
427
428 ${ipmi_threshold_reading}= Set Variable If '${ipmi_threshold_reading}' == 'na'
429 ... ${0} ${ipmi_threshold_reading}
430
431 # Example of redfish sensor output
432 # "@odata.id": "/redfish/v1/Chassis/chassis/Power#/Voltages/0",
433 # "@odata.type": "#Power.v1_0_0.Voltage",
434 # "LowerThresholdCritical": 180.0,
435 # "LowerThresholdNonCritical": 200.0,
436 # "MaxReadingRange": 0.0,
437 # "MemberId": "ps0_input_voltage",
438 # "MinReadingRange": 0.0,
439 # "Name": "ps0 input voltage",
440 # "ReadingVolts": 209.5,
441 # "Status": {
442 # "Health": "OK",
443 # "State": "Enabled"
444 # },
445 # "UpperThresholdCritical": 300.0,
446 # "UpperThresholdNonCritical": 290.0
447
Jorge Cisneros187f1772022-08-22 14:03:08 +0000448 @{redfish_readings}= Redfish.Get Attribute /redfish/v1/Chassis/${CHASSIS_ID}/Power Voltages
Sushma M Mc69a3d32020-06-10 18:13:08 -0500449 FOR ${data} IN @{redfish_readings}
450 Run keyword if '${data}[MemberId]' == 'ps0_input_voltage'
451 ... Should Be Equal As Numbers ${data['${redfish_threshold_id}']} ${ipmi_threshold_reading}
452 END
srichn28a9df5402022-08-17 07:44:11 -0500453
454
455Get Available Sensors
456 [Documentation] Get all the available sensors for the required component.
457 ... Returns a list of available sensors.
458 [Arguments] ${sensor_component}
459
460 # Description of argument(s):
461 # sensor_component sensor component name.(e.g.:cpu)
462
463 ${resp}= Run IPMI Standard Command sdr elist
464 ${sensor_list}= Create List
465 ${sensors}= Get Lines Containing String ${resp} ${sensor_component}
466 ${sensors}= Split To Lines ${sensors}
467
468 # Example of IPMI sdr elist command.
469
470 # dcm0_cpu0 | 41h | ok | 3.1 | Presence detected
471 # dcm0_cpu1 | 42h | ok | 3.2 | Presence detected, Disabled
472 # dcm1_cpu0 | 43h | ok | 3.3 | Presence detected
473 # dcm1_cpu1 | 44h | ok | 3.4 | Presence detected, Disabled
474 # dcm2_cpu0 | 45h | ns | 3.5 | Disabled
475 # dcm2_cpu1 | 46h | ns | 3.6 | Disabled
476 # dcm3_cpu0 | 47h | ns | 3.7 | Disabled
477 # dcm3_cpu1 | 48h | ns | 3.8 | Disabled
478
479 FOR ${line} IN @{sensors}
480 ${sensor_name}= Set Variable ${line.split('|')[0].strip()}
481
482 # Adding sensors to the list whose presence is detected.
483 ${contains}= Evaluate "Presence detected" in "${line}"
484 Run Keyword IF "${contains}" == "True"
485 ... Append To List ${sensor_list} ${sensor_name}
486 END
487
488 # Example of output for ${sensor_list}
489 # ['dcm0_cpu0', 'dcm0_cpu1', 'dcm1_cpu0', 'dcm1_cpu1']
490
491 [RETURN] ${sensor_list}
492
493
494Get Sensor Id For Sensor
495 [Documentation] Returns the sensor ID value for the given sensor.
496 [Arguments] ${sensor_name}
497
498 # Description of argument(s):
499 # sensor_name Name of sensor whose ID is required(e.g.: dcm0_cpu0, dcm0_cpu1 etc).
500
501 ${get_resp}= Run IPMI Standard Command sensor get ${sensor_name}
502
503 # Example of sensor get command.
504
505 # Locating sensor record...
506 # Sensor ID : dcm0_cpu0 (0x41)
507 # Entity ID : 3.1
508 # Sensor Type (Discrete): Processor
509 # States Asserted : Processor
510 # [Presence detected]
511
512 ${line}= Get Lines Containing String ${get_resp} Sensor ID
513 ${sensor_id}= Set Variable ${line[-5:-1]}
514
515 # Example of output for ${sensor_id} is 0x41.
516
517 [RETURN] ${sensor_id}
518