blob: 99eec2d8507f41f7c0d5d72566808088099b410b [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
48 # Inlet air temperature(40h) 1 +19 C
49 # CPU temperature sensors(41h) 5 +51 C
50 # CPU temperature sensors(41h) 6 +50 C
51 # CPU temperature sensors(41h) 7 +50 C
52 # CPU temperature sensors(41h) 8 +50 C
53 # CPU temperature sensors(41h) 9 +50 C
54 # CPU temperature sensors(41h) 10 +48 C
55 # CPU temperature sensors(41h) 11 +49 C
56 # CPU temperature sensors(41h) 12 +47 C
57 # CPU temperature sensors(41h) 8 +50 C
58 # CPU temperature sensors(41h) 16 +51 C
59 # CPU temperature sensors(41h) 24 +50 C
60 # CPU temperature sensors(41h) 32 +43 C
61 # CPU temperature sensors(41h) 40 +43 C
62 # Baseboard temperature sensors(42h) 1 +35 C
63
64 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
65 Should Contain ${temp_reading} Inlet air temperature
66 ... msg="Unable to get inlet temperature via DCMI".
67
68 ${ambient_temp_line}=
69 ... Get Lines Containing String ${temp_reading}
70 ... Inlet air temperature case-insensitive
71
72 ${ambient_temp_ipmi}= Set Variable ${ambient_temp_line.split('+')[1].strip(' C')}
73
74 # Example of ambient temperature via Redfish
75
76 #"@odata.id": "/redfish/v1/Chassis/chassis/Thermal#/Temperatures/0",
77 #"@odata.type": "#Thermal.v1_3_0.Temperature",
78 #"LowerThresholdCritical": 0.0,
79 #"LowerThresholdNonCritical": 0.0,
80 #"MaxReadingRangeTemp": 0.0,
81 #"MemberId": "ambient",
82 #"MinReadingRangeTemp": 0.0,
83 #"Name": "ambient",
84 #"ReadingCelsius": 24.987000000000002,
85 #"Status": {
86 #"Health": "OK",
87 #"State": "Enabled"
88 #},
89 #"UpperThresholdCritical": 35.0,
90 #"UpperThresholdNonCritical": 25.0
91
92 ${ambient_temp_redfish}= Get Temperature Reading From Redfish ambient
93
94 ${ipmi_redfish_temp_diff}=
95 ... Evaluate abs(${ambient_temp_redfish} - ${ambient_temp_ipmi})
96
97 Should Be True ${ipmi_redfish_temp_diff} <= ${allowed_temp_diff}
98 ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}.
99
100
Sushma M Md4d13f02020-02-13 03:42:41 -0600101Test Power Reading Via IPMI With Host Off
102 [Documentation] Verify power reading via IPMI with host in off state
103 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Off
104
105 Redfish Power Off stack_mode=skip
106
107 ${ipmi_reading}= Get IPMI Power Reading
108
109 Should Be Equal ${ipmi_reading['instantaneous_power_reading']} 0
110 ... msg=Power reading not zero when power is off.
111
112
113Test Power Reading Via IPMI With Host Booted
114 [Documentation] Test power reading via IPMI with host in booted state and
115 ... verify using Redfish.
116 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted
117
118 IPMI Power On stack_mode=skip
119
120 Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading Using IPMI And Redfish
121
122
Sushma M M85dbd9c2020-03-20 15:58:28 -0500123Test Baseboard Temperature Via IPMI
124 [Documentation] Test baseboard temperature via IPMI and verify using Redfish.
125 [Tags] Test_Baseboard_Temperature_Via_IPMI
126
127 # Example of IPMI dcmi get_temp_reading output:
128 # Entity ID Entity Instance Temp. Readings
srichn28334438b2022-09-21 08:41:25 -0500129 # Inlet air temperature(40h) 1 +22 C
130 # Inlet air temperature(40h) 2 +23 C
131 # Inlet air temperature(40h) 3 +22 C
132 # CPU temperature sensors(41h) 0 +0 C
133 # Baseboard temperature sensors(42h) 1 +26 C
134 # Baseboard temperature sensors(42h) 2 +27 C
Sushma M M85dbd9c2020-03-20 15:58:28 -0500135
136 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
137 Should Contain ${temp_reading} Baseboard temperature sensors
138 ... msg="Unable to get baseboard temperature via DCMI".
srichn28334438b2022-09-21 08:41:25 -0500139 ${baseboard_temp_lines}=
Sushma M M85dbd9c2020-03-20 15:58:28 -0500140 ... Get Lines Containing String ${temp_reading}
141 ... Baseboard temperature case-insensitive=True
srichn28334438b2022-09-21 08:41:25 -0500142 ${lines}= Split To Lines ${baseboard_temp_lines}
Sushma M M85dbd9c2020-03-20 15:58:28 -0500143
srichn28334438b2022-09-21 08:41:25 -0500144 ${ipmi_temp_list}= Create List
145 FOR ${line} IN @{lines}
146 ${baseboard_temp_ipmi}= Set Variable ${line.split('+')[1].strip(' C')}
147 Append To List ${ipmi_temp_list} ${baseboard_temp_ipmi}
148 END
149 ${list_length}= Get Length ${ipmi_temp_list}
Sushma M M85dbd9c2020-03-20 15:58:28 -0500150
srichn28334438b2022-09-21 08:41:25 -0500151 # Getting temperature readings from Redfish.
152 ${baseboard_temp_redfish}= Get Temperature Reading From Redfish PCIE
153 ${baseboard_temp_redfish}= Get Dictionary Values ${baseboard_temp_redfish} sort_keys=True
Sushma M M85dbd9c2020-03-20 15:58:28 -0500154
srichn28334438b2022-09-21 08:41:25 -0500155 FOR ${index} IN RANGE ${list_length}
156 ${baseboard_temp_diff}= Evaluate abs(${baseboard_temp_redfish[${index}]} - ${ipmi_temp_list[${index}]})
157 Should Be True
158 ... ${baseboard_temp_diff} <= ${allowed_temp_diff}
159 ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}.
160 END
Sushma M M85dbd9c2020-03-20 15:58:28 -0500161
Sushma M Mfd2f4282020-03-18 04:12:47 -0500162Test Power Reading Via IPMI Raw Command
163 [Documentation] Test power reading via IPMI raw command and verify
164 ... using Redfish.
165 [Tags] Test_Power_Reading_Via_IPMI_Raw_Command
166
167 IPMI Power On stack_mode=skip
168
169 Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading Via Raw Command
170
171
Sushma M M89882ce2020-03-31 17:21:37 -0500172Verify CPU Present
173 [Documentation] Verify the IPMI sensor for CPU present using Redfish.
174 [Tags] Verify_CPU_Present
srichn284c7d4462022-08-22 03:40:49 -0500175 [Template] Set Present Bit Via IPMI and Verify Using Redfish
Sushma M M89882ce2020-03-31 17:21:37 -0500176
srichn284c7d4462022-08-22 03:40:49 -0500177 # component state
178 cpu Enabled
Sushma M M89882ce2020-03-31 17:21:37 -0500179
180
181Verify CPU Not Present
182 [Documentation] Verify the IPMI sensor for CPU not present using Redfish.
183 [Tags] Verify_CPU_Not_Present
srichn284c7d4462022-08-22 03:40:49 -0500184 [Template] Set Present Bit Via IPMI and Verify Using Redfish
Sushma M M89882ce2020-03-31 17:21:37 -0500185
srichn284c7d4462022-08-22 03:40:49 -0500186 # component state
187 cpu Absent
Sushma M M89882ce2020-03-31 17:21:37 -0500188
189
190Verify GPU Present
191 [Documentation] Verify the IPMI sensor for GPU present using Redfish.
192 [Tags] Verify_GPU_Present
193 [Template] Enable Present Bit Via IPMI and Verify Using Redfish
194
195 # sensor_id component
196 0xC5 gv100card0
197
198
199Verify GPU Not Present
200 [Documentation] Verify the IPMI sensor for GPU not present using Redfish.
201 [Tags] Verify_GPU_Not_Present
202 [Template] Disable Present Bit Via IPMI and Verify Using Redfish
203
204 # sensor_id component
205 0xC5 gv100card0
206
207
Sushma M Mc69a3d32020-06-10 18:13:08 -0500208Test Sensor Threshold Via IPMI
209 [Documentation] Test sensor threshold via IPMI and verify using Redfish.
210 [Tags] Test_Sensor_Threshold_Via_IPMI
211 [Template] Verify Power Supply Sensor Threshold
212
213 # threshold_id component
214 Upper Non-Critical UpperThresholdNonCritical
215 Upper Critical UpperThresholdCritical
216 Lower Non-Critical LowerThresholdNonCritical
217 Lower Critical LowerThresholdCritical
218
219
Anusha Dathatri88ccaff2020-02-07 05:17:53 -0600220*** Keywords ***
221
222Get Temperature Reading And Verify In Redfish
223 [Documentation] Get IPMI or DCMI sensor reading and verify in Redfish.
224 [Arguments] ${command_type} ${sensor_id} ${member_id}
225
226 # Description of argument(s):
227 # command_type Type of command used to get sensor data (eg. IPMI, DCMI).
228 # sensor_id Sensor id used to get reading in IPMI or DCMI.
229 # member_id Member id of sensor data in Redfish.
230
231 ${ipmi_value}= Run Keyword If '${command_type}' == 'IPMI' Get IPMI Sensor Reading ${sensor_id}
232 ... ELSE Get DCMI Sensor Reading ${sensor_id}
233
234 ${redfish_value}= Get Temperature Reading From Redfish ${member_id}
235
236 Valid Range ${ipmi_value} ${redfish_value-1.000} ${redfish_value+1.000}
237
238
239Get IPMI Sensor Reading
240 [Documentation] Get reading from IPMI sensor reading command.
241 [Arguments] ${sensor_id}
242
243 # Description of argument(s):
244 # sensor_id Sensor id used to get reading in IPMI.
245
246 ${data}= Run IPMI Standard Command sensor reading ${sensor_id}
247
248 # Example reading:
249 # pcie | 28.500
250
251 ${sensor_value}= Set Variable ${data.split('| ')[1].strip()}
252 [Return] ${sensor_value}
253
254
255Get DCMI Sensor Reading
256 [Documentation] Get reading from DCMI sensors command.
257 [Arguments] ${sensor_id}
258
259 # Description of argument(s):
260 # sensor_id Sensor id used to get reading in DCMI.
261
262 ${data}= Run IPMI Standard Command dcmi sensors
263 ${sensor_data}= Get Lines Containing String ${data} ${sensor_id}
264
265 # Example reading:
266 # Record ID 0x00fd: pcie | 28.50 degrees C | ok
267
268 ${sensor_value}= Set Variable ${sensor_data.split(' | ')[1].strip('degrees C').strip()}
269 [Return] ${sensor_value}
270
271
272Get Temperature Reading From Redfish
273 [Documentation] Get temperature reading from Redfish.
274 [Arguments] ${member_id}
275
276 # Description of argument(s):
277 # member_id Member id of temperature.
278
srichn28334438b2022-09-21 08:41:25 -0500279 @{thermal_uri}= redfish_utils.Get Member List /redfish/v1/Chassis/
280 @{redfish_readings}= redfish_utils.Get Attribute ${thermal_uri[0]}/${THERMAL_METRICS} TemperatureReadingsCelsius
281
282 # Example of Baseboard temperature via Redfish
283
284 # "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/ThermalMetrics",
285 # "@odata.type": "#ThermalMetrics.v1_0_0.ThermalMetrics",
286 # "Id": "ThermalMetrics",
287 # "Name": "Chassis Thermal Metrics",
288 # "TemperatureReadingsCelsius": [
289 # {
290 # "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/PCIE_0_Temp",
291 # "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/PCIE_0_Temp",
292 # "DeviceName": "PCIE_0_Temp",
293 # "Reading": 23.75
294 # },
295
296 ${redfish_value_dict}= Create Dictionary
Anusha Dathatri88ccaff2020-02-07 05:17:53 -0600297 FOR ${data} IN @{redfish_readings}
srichn28334438b2022-09-21 08:41:25 -0500298 ${contains}= Evaluate "${member_id}" in """${data}[DeviceName]"""
299 ${reading}= Set Variable ${data}[Reading]
300 Run Keyword IF "${contains}" == "True"
301 ... Set To Dictionary ${redfish_value_dict} ${data}[DeviceName] ${reading}
Anusha Dathatri88ccaff2020-02-07 05:17:53 -0600302 END
srichn28334438b2022-09-21 08:41:25 -0500303
304 [Return] ${redfish_value_dict}
Sushma M Md4d13f02020-02-13 03:42:41 -0600305
306
307Verify Power Reading Using IPMI And Redfish
308 [Documentation] Verify power reading using IPMI and Redfish.
309
310 # Example of power reading command output via IPMI.
311 # Instantaneous power reading: 235 Watts
312 # Minimum during sampling period: 235 Watts
313 # Maximum during sampling period: 235 Watts
314 # Average power reading over sample period: 235 Watts
315 # IPMI timestamp: Thu Jan 1 00:00:00 1970
316 # Sampling period: 00000000 Seconds.
317 # Power reading state is: deactivated
318
319 ${ipmi_reading}= Get IPMI Power Reading
320
George Keishingd5f179e2020-07-14 16:07:31 -0500321 ${power_uri_list}= redfish_utils.Get Members URI /redfish/v1/Chassis/ PowerControl
322 Log List ${power_uri_list}
Sushma M Md4d13f02020-02-13 03:42:41 -0600323
George Keishingd5f179e2020-07-14 16:07:31 -0500324 # Power entries could be seen across different redfish path, remove the URI
325 # where the attribute is non-existent.
326 # Example:
327 # ['/redfish/v1/Chassis/chassis/Power',
328 # '/redfish/v1/Chassis/motherboard/Power']
329 FOR ${idx} IN @{power_uri_list}
330 ${power}= redfish_utils.Get Attribute ${idx} PowerControl
331 Log Dictionary ${power[0]}
Sushma M Md4d13f02020-02-13 03:42:41 -0600332
George Keishingd5f179e2020-07-14 16:07:31 -0500333 # Ensure the path does have the attribute else set to EMPTY as default to skip.
334 ${value}= Get Variable Value ${power[0]['PowerConsumedWatts']} ${EMPTY}
335 Run Keyword If "${value}" == "${EMPTY}"
336 ... Remove Values From List ${power_uri_list} ${idx}
337
338 # Check the next available element in the list.
339 Continue For Loop If "${value}" == "${EMPTY}"
340
341 ${ipmi_redfish_power_diff}=
342 ... Evaluate abs(${${power[0]['PowerConsumedWatts']}} - ${ipmi_reading['instantaneous_power_reading']})
343 Should Be True ${ipmi_redfish_power_diff} <= ${allowed_power_diff}
344 ... msg=Power reading above allowed threshold ${allowed_power_diff}.
345 END
346
George Keishinge68cbfb2020-08-12 11:11:58 -0500347 # Double check, the validation has at least one valid path.
George Keishingd5f179e2020-07-14 16:07:31 -0500348 Should Not Be Empty ${power_uri_list}
George Keishinge68cbfb2020-08-12 11:11:58 -0500349 ... msg=Should contain at least one element in the list.
Sushma M Mfd2f4282020-03-18 04:12:47 -0500350
351
352Verify Power Reading Via Raw Command
353 [Documentation] Get dcmi power reading via IPMI raw command.
354
355 ${ipmi_raw_output}= Run IPMI Standard Command
356 ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]}
357
358 ${power_reading_ipmi}= Set Variable ${ipmi_raw_output.split()[1]}
359 ${power_reading_ipmi}=
360 ... Convert To Integer 0x${power_reading_ipmi}
361
362 # Example of power reading via Redfish
363 # "@odata.id": "/redfish/v1/Chassis/chassis/Power#/PowerControl/0",
364 # "@odata.type": "#Power.v1_0_0.PowerControl",
365 # "MemberId": "0",
366 # "Name": "Chassis Power Control",
367 # "PowerConsumedWatts": 145.0,
368
Jorge Cisneros187f1772022-08-22 14:03:08 +0000369 ${power}= Redfish.Get Properties /redfish/v1/Chassis/${CHASSIS_ID}/Power
Sushma M Mfd2f4282020-03-18 04:12:47 -0500370 ${redfish_reading}= Set Variable ${power['PowerControl'][0]['PowerConsumedWatts']}
371
372 ${ipmi_redfish_power_diff}=
373 ... Evaluate abs(${redfish_reading} - ${power_reading_ipmi})
374
375 Should Be True ${ipmi_redfish_power_diff} <= ${allowed_power_diff}
Sushma M M89882ce2020-03-31 17:21:37 -0500376 ... msg=Power reading above allowed threshold ${allowed_power_diff}.
377
378
srichn284c7d4462022-08-22 03:40:49 -0500379Set Present Bit Via IPMI and Verify Using Redfish
380 [Documentation] Set present bit of sensor via IPMI and verify using Redfish.
381 [Arguments] ${component} ${status}
Sushma M M89882ce2020-03-31 17:21:37 -0500382
383 # Description of argument(s):
Sushma M M89882ce2020-03-31 17:21:37 -0500384 # component The Redfish component of IPMI sensor.
srichn284c7d4462022-08-22 03:40:49 -0500385 # status Status of the bit to be set(e.g. Absent, Present).
Sushma M M89882ce2020-03-31 17:21:37 -0500386
srichn284c7d4462022-08-22 03:40:49 -0500387 ${sensor_list}= Get Available Sensors ${component}
388 ${sensor_name}= Set Variable ${sensor_list[0]}
389 ${sensor_id}= Get Sensor Id For Sensor ${sensor_name}
Sushma M M89882ce2020-03-31 17:21:37 -0500390
srichn284c7d4462022-08-22 03:40:49 -0500391 Run Keyword If '${status}' == 'Absent'
392 ... Run IPMI Command
393 ... 0x04 0x30 ${sensor_id} 0xa9 0x00 0x00 0x00 0x80 0x00 0x00 0x20 0x00
394 ... ELSE IF '${status}' == 'Enabled'
395 ... Run IPMI Command
396 ... 0x04 0x30 ${sensor_id} 0xa9 0x00 0x80 0x00 0x00 0x00 0x00 0x20 0x00
Sushma M Mc4cabd52020-04-08 09:32:37 -0500397
srichn284c7d4462022-08-22 03:40:49 -0500398 # Redfish cpu components have "-" instead of "_" (e.g.: dcm0-cpu0).
399 ${cpu_name}= Replace String ${sensor_name} _ -
400 ${sensor_properties}= Redfish.Get Properties /redfish/v1/Systems/system/Processors/${cpu_name}
Sushma M M89882ce2020-03-31 17:21:37 -0500401
srichn284c7d4462022-08-22 03:40:49 -0500402 # Example of CPU state via Redfish
George Keishing52eb7c22022-03-11 10:58:53 -0600403
srichn284c7d4462022-08-22 03:40:49 -0500404 # "ProcessorType": "CPU",
405 # "SerialNumber": "YA1936422499",
406 # "Socket": "",
407 # "SparePartNumber": "F210110",
408 # "Status": {
409 # "Health": "OK",
410 # "State": "Absent"
411 # }
Sushma M M89882ce2020-03-31 17:21:37 -0500412
srichn284c7d4462022-08-22 03:40:49 -0500413 Should Be True '${sensor_properties['Status']['State']}' == '${status}'
Sushma M Mc69a3d32020-06-10 18:13:08 -0500414
415
416Verify Power Supply Sensor Threshold
417 [Documentation] Get power supply sensor threshold value via IPMI and verify using Redfish.
418 [Arguments] ${ipmi_threshold_id} ${redfish_threshold_id}
419
420 # Description of argument(s):
421 # ipmi_threshold_id The sensor threshold component of IPMI sensor.
422 # redfish_threshold_id The sensor threshold component of Redfish sensor.
423
424
425 # Example of ipmi sensor output
426 # Locating sensor record...
427 # Sensor ID : ps0_input_voltag (0xf7)
428 # Entity ID : 10.19
429 # Sensor Type (Threshold) : Voltage
430 # Sensor Reading : 208 (+/- 0) Volts
431 # Status : ok
432 # Lower Non-Recoverable : na
433 # Lower Critical : 180.000
434 # Lower Non-Critical : 200.000
435 # Upper Non-Critical : 290.000
436 # Upper Critical : 300.000
437 # Upper Non-Recoverable : na
438 # Positive Hysteresis : Unspecified
439 # Negative Hysteresis : Unspecified
440
441
442 ${ipmi_sensor_output}= Run External IPMI Standard Command sensor get ps0_input_voltag
443 ${ipmi_threshold_output}= Get Lines Containing String ${ipmi_sensor_output} ${ipmi_threshold_id}
444 ${ipmi_threshold_reading}= Fetch From Right ${ipmi_threshold_output} :${SPACE}
445
446 ${ipmi_threshold_reading}= Set Variable If '${ipmi_threshold_reading}' == 'na'
447 ... ${0} ${ipmi_threshold_reading}
448
449 # Example of redfish sensor output
450 # "@odata.id": "/redfish/v1/Chassis/chassis/Power#/Voltages/0",
451 # "@odata.type": "#Power.v1_0_0.Voltage",
452 # "LowerThresholdCritical": 180.0,
453 # "LowerThresholdNonCritical": 200.0,
454 # "MaxReadingRange": 0.0,
455 # "MemberId": "ps0_input_voltage",
456 # "MinReadingRange": 0.0,
457 # "Name": "ps0 input voltage",
458 # "ReadingVolts": 209.5,
459 # "Status": {
460 # "Health": "OK",
461 # "State": "Enabled"
462 # },
463 # "UpperThresholdCritical": 300.0,
464 # "UpperThresholdNonCritical": 290.0
465
Jorge Cisneros187f1772022-08-22 14:03:08 +0000466 @{redfish_readings}= Redfish.Get Attribute /redfish/v1/Chassis/${CHASSIS_ID}/Power Voltages
Sushma M Mc69a3d32020-06-10 18:13:08 -0500467 FOR ${data} IN @{redfish_readings}
468 Run keyword if '${data}[MemberId]' == 'ps0_input_voltage'
469 ... Should Be Equal As Numbers ${data['${redfish_threshold_id}']} ${ipmi_threshold_reading}
470 END
srichn28a9df5402022-08-17 07:44:11 -0500471
472
473Get Available Sensors
474 [Documentation] Get all the available sensors for the required component.
475 ... Returns a list of available sensors.
476 [Arguments] ${sensor_component}
477
478 # Description of argument(s):
479 # sensor_component sensor component name.(e.g.:cpu)
480
481 ${resp}= Run IPMI Standard Command sdr elist
482 ${sensor_list}= Create List
483 ${sensors}= Get Lines Containing String ${resp} ${sensor_component}
484 ${sensors}= Split To Lines ${sensors}
485
486 # Example of IPMI sdr elist command.
487
488 # dcm0_cpu0 | 41h | ok | 3.1 | Presence detected
489 # dcm0_cpu1 | 42h | ok | 3.2 | Presence detected, Disabled
490 # dcm1_cpu0 | 43h | ok | 3.3 | Presence detected
491 # dcm1_cpu1 | 44h | ok | 3.4 | Presence detected, Disabled
492 # dcm2_cpu0 | 45h | ns | 3.5 | Disabled
493 # dcm2_cpu1 | 46h | ns | 3.6 | Disabled
494 # dcm3_cpu0 | 47h | ns | 3.7 | Disabled
495 # dcm3_cpu1 | 48h | ns | 3.8 | Disabled
496
497 FOR ${line} IN @{sensors}
498 ${sensor_name}= Set Variable ${line.split('|')[0].strip()}
499
500 # Adding sensors to the list whose presence is detected.
501 ${contains}= Evaluate "Presence detected" in "${line}"
502 Run Keyword IF "${contains}" == "True"
503 ... Append To List ${sensor_list} ${sensor_name}
504 END
505
506 # Example of output for ${sensor_list}
507 # ['dcm0_cpu0', 'dcm0_cpu1', 'dcm1_cpu0', 'dcm1_cpu1']
508
509 [RETURN] ${sensor_list}
510
511
512Get Sensor Id For Sensor
513 [Documentation] Returns the sensor ID value for the given sensor.
514 [Arguments] ${sensor_name}
515
516 # Description of argument(s):
517 # sensor_name Name of sensor whose ID is required(e.g.: dcm0_cpu0, dcm0_cpu1 etc).
518
519 ${get_resp}= Run IPMI Standard Command sensor get ${sensor_name}
520
521 # Example of sensor get command.
522
523 # Locating sensor record...
524 # Sensor ID : dcm0_cpu0 (0x41)
525 # Entity ID : 3.1
526 # Sensor Type (Discrete): Processor
527 # States Asserted : Processor
528 # [Presence detected]
529
530 ${line}= Get Lines Containing String ${get_resp} Sensor ID
531 ${sensor_id}= Set Variable ${line[-5:-1]}
532
533 # Example of output for ${sensor_id} is 0x41.
534
535 [RETURN] ${sensor_id}
536