blob: 9b5830b3f3866f52c02f3995d6d07f59b11d3b79 [file] [log] [blame]
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -05001*** Settings ***
2Documentation This suite is for testing general IPMI functions.
3
4Resource ../../lib/ipmi_client.robot
5Resource ../../lib/openbmc_ffdc.robot
George Keishing0825a112018-03-30 10:48:07 -05006Resource ../../lib/boot_utils.robot
George Keishing78ce8dc2018-03-30 11:49:06 -05007Resource ../../lib/utils.robot
Sweta Potthurif39022d2018-02-06 03:40:07 -06008Resource ../../lib/bmc_network_utils.robot
George Keishing78ce8dc2018-03-30 11:49:06 -05009Library ../../lib/ipmi_utils.py
George Keishing0825a112018-03-30 10:48:07 -050010Variables ../../data/ipmi_raw_cmd_table.py
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050011
12Test Teardown FFDC On Test Case Fail
13
Rahul Maheshwariabe13af2018-02-15 22:42:08 -060014
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050015*** Variables ***
16
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060017${new_mc_id}= HOST
Rahul Maheshwari901dcde2018-02-06 03:14:31 -060018${allowed_temp_diff}= ${1}
Rahul Maheshwari615da152018-02-13 23:53:36 -060019${allowed_power_diff}= ${10}
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060020
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050021*** Test Cases ***
22
23Set Asset Tag With Valid String Length
24 [Documentation] Set asset tag with valid string length and verify.
25 [Tags] Set_Asset_Tag_With_Valid_String_Length
26
27 # Allowed MAX characters length for asset tag name is 63.
28 ${random_string}= Generate Random String 63
29 Run Keyword Run IPMI Standard Command dcmi set_asset_tag ${random_string}
30
31 ${asset_tag}= Run Keyword Run IPMI Standard Command dcmi asset_tag
32 Should Contain ${asset_tag} ${random_string}
33
34
35Set Asset Tag With Invalid String Length
36 [Documentation] Verify error while setting invalid asset tag via IPMI.
37 [Tags] Set_Asset_Tag_With_Invalid_String_Length
38
39 # Any string more than 63 character is invalid for asset tag.
40 ${random_string}= Generate Random String 64
41
42 ${resp}= Run Keyword And Expect Error * Run IPMI Standard Command
43 ... dcmi set_asset_tag ${random_string}
44 Should Contain ${resp} Parameter out of range ignore_case=True
45
46
47Set Asset Tag With Valid String Length Via REST
48 [Documentation] Set valid asset tag via REST and verify.
49 [Tags] Set_Asset_Tag_With_Valid_String_Length_Via_REST
50
51 ${random_string}= Generate Random String 63
52 ${args}= Create Dictionary data=${random_string}
53 Write Attribute /xyz/openbmc_project/inventory/system AssetTag
54 ... data=${args}
55
56 ${asset_tag}= Read Attribute /xyz/openbmc_project/inventory/system
57 ... AssetTag
58 Should Be Equal As Strings ${asset_tag} ${random_string}
59
Sweta Potthurif39022d2018-02-06 03:40:07 -060060
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060061Verify Get And Set Management Controller ID String
62 [Documentation] Verify get and set management controller ID string.
63 [Tags] Verify_Get_And_Set_Management_Controller_ID_String
64
65 # Get the value of the managemment controller ID string.
66 # Example:
67 # Get Management Controller Identifier String: witherspoon
68
69 ${cmd_output}= Run IPMI Standard Command dcmi get_mc_id_string
70
71 # Extract management controller ID from cmd_output.
72 ${initial_mc_id}= Fetch From Right ${cmd_output} :${SPACE}
73
74 # Set the management controller ID string to other value.
75 # Example:
76 # Set Management Controller Identifier String Command: HOST
77
78 Set Management Controller ID String ${new_mc_id}
79
80 # Get the management controller ID and verify.
81 Get Management Controller ID String And Verify ${new_mc_id}
82
83 # Set the value back to the initial value and verify.
84 Set Management Controller ID String ${initial_mc_id}
85
86 # Get the management controller ID and verify.
87 Get Management Controller ID String And Verify ${initial_mc_id}
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050088
Sweta Potthurif39022d2018-02-06 03:40:07 -060089
Sweta Potthuri0cc60502018-01-24 00:36:17 -060090Verify Chassis Identify via IPMI
91 [Documentation] Verify "chassis identify" using IPMI command.
92 [Tags] Verify_Chassis_Identify_via_IPMI
93
94 # Set to default "chassis identify" and verify that LED blinks for 15s.
95 Run IPMI Standard Command chassis identify
96 Verify Identify LED State Blink
97
98 Sleep 15s
99 Verify Identify LED State Off
100
101 # Set "chassis identify" to 10s and verify that the LED blinks for 10s.
102 Run IPMI Standard Command chassis identify 10
103 Verify Identify LED State Blink
104
105 Sleep 10s
106 Verify Identify LED State Off
107
Sweta Potthurif39022d2018-02-06 03:40:07 -0600108
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600109Verify Chassis Identify Off And Force Identify On via IPMI
110 [Documentation] Verify "chassis identify" off
111 ... and "force identify on" via IPMI.
112 [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI
113
114 # Set the LED to "Force Identify On".
115 Run IPMI Standard Command chassis identify force
116 Verify Identify LED State Blink
117
118 # Set "chassis identify" to 0 and verify that the LED turns off.
119 Run IPMI Standard Command chassis identify 0
120 Verify Identify LED State Off
121
Sweta Potthurif39022d2018-02-06 03:40:07 -0600122
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600123Test Watchdog Reset Via IPMI And Verify Using REST
124 [Documentation] Test watchdog reset via IPMI and verify using REST.
125 [Tags] Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST
126
127 Initiate Host Boot
128
129 Set Watchdog Enabled Using REST ${1}
130
131 Watchdog Object Should Exist
132
133 # Resetting the watchdog via IPMI.
134 Run IPMI Standard Command mc watchdog reset
135
136 # Verify the watchdog is reset using REST after an interval of 1000ms.
137 Sleep 1000ms
138 ${watchdog_time_left}=
139 ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining
140 Should Be True
141 ... ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000}
142 ... msg=Watchdog timer didn't reset.
143
Sweta Potthurif39022d2018-02-06 03:40:07 -0600144
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600145Test Watchdog Off Via IPMI And Verify Using REST
146 [Documentation] Test watchdog off via IPMI and verify using REST.
147 [Tags] Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST
148
149 Initiate Host Boot
150
151 Set Watchdog Enabled Using REST ${1}
152
153 Watchdog Object Should Exist
154
155 # Turn off the watchdog via IPMI.
156 Run IPMI Standard Command mc watchdog off
157
158 # Verify the watchdog is off using REST
159 ${watchdog_state}= Read Attribute ${HOST_WATCHDOG_URI} Enabled
160 Should Be Equal ${watchdog_state} ${0}
161 ... msg=msg=Verification failed for watchdog off check.
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600162
163
164Test Ambient Temperature Via IPMI
165 [Documentation] Test ambient temperature via IPMI and verify using REST.
166 [Tags] Test_Ambient_Temperature_Via_IPMI
167
168 # Entity ID Entity Instance Temp. Readings
169 # Inlet air temperature(40h) 1 +19 C
170 # CPU temperature sensors(41h) 5 +51 C
171 # CPU temperature sensors(41h) 6 +50 C
172 # CPU temperature sensors(41h) 7 +50 C
173 # CPU temperature sensors(41h) 8 +50 C
174 # CPU temperature sensors(41h) 9 +50 C
175 # CPU temperature sensors(41h) 10 +48 C
176 # CPU temperature sensors(41h) 11 +49 C
177 # CPU temperature sensors(41h) 12 +47 C
178 # CPU temperature sensors(41h) 8 +50 C
179 # CPU temperature sensors(41h) 16 +51 C
180 # CPU temperature sensors(41h) 24 +50 C
181 # CPU temperature sensors(41h) 32 +43 C
182 # CPU temperature sensors(41h) 40 +43 C
183 # Baseboard temperature sensors(42h) 1 +35 C
184
185 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
186 ${ambient_temp_line}=
187 ... Get Lines Containing String ${temp_reading}
188 ... Inlet air temperature case-insensitive
189
190 ${ambient_temp_ipmi}= Fetch From Right ${ambient_temp_line} +
191 ${ambient_temp_ipmi}= Remove String ${ambient_temp_ipmi} ${SPACE}C
192
193 ${ambient_temp_rest}= Read Attribute
194 ... ${SENSORS_URI}temperature/ambient Value
195
196 # Example of ambient temperature via REST
197 # "CriticalAlarmHigh": 0,
198 # "CriticalAlarmLow": 0,
199 # "CriticalHigh": 35000,
200 # "CriticalLow": 0,
201 # "Scale": -3,
202 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
203 # "Value": 21775,
204 # "WarningAlarmHigh": 0,
205 # "WarningAlarmLow": 0,
206 # "WarningHigh": 25000,
207 # "WarningLow": 0
208
209 # Get temperature value based on scale i.e. Value * (10 power Scale Value)
210 # e.g. from above case 21775 * (10 power -3) = 21775/1000
211
212 ${ambient_temp_rest}= Evaluate ${ambient_temp_rest}/1000
213 ${ipmi_rest_temp_diff}=
214 ... Evaluate abs(${ambient_temp_rest} - ${ambient_temp_ipmi})
215
216 Should Be True ${ipmi_rest_temp_diff} <= ${allowed_temp_diff}
217 ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}.
218
219
Rahul Maheshwari43556632018-02-05 23:42:52 -0600220Verify Get DCMI Capabilities
221 [Documentation] Verify get DCMI capabilities command output.
222 [Tags] Verify_Get_DCMI_Capabilities
223
224 ${cmd_output}= Run IPMI Standard Command dcmi discover
225
226 @{supported_capabilities}= Create List
227 # Supported DCMI capabilities:
228 ... Mandatory platform capabilties
229 ... Optional platform capabilties
230 ... Power management available
231 ... Managebility access capabilties
232 ... In-band KCS channel available
233 # Mandatory platform attributes:
234 ... 200 SEL entries
235 ... SEL automatic rollover is enabled
236 # Optional Platform Attributes:
237 ... Slave address of device: 0h (8bits)(Satellite/External controller)
238 ... Channel number is 0h (Primary BMC)
239 ... Device revision is 0
240 # Manageability Access Attributes:
241 ... Primary LAN channel number: 1 is available
242 ... Secondary LAN channel is not available for OOB
243 ... No serial channel is available
244
245 :FOR ${capability} IN @{supported_capabilities}
246 \ Should Contain ${cmd_output} ${capability} ignore_case=True
247 ... msg=Supported DCMI capabilities not present.
248
249
Rahul Maheshwari615da152018-02-13 23:53:36 -0600250Test Power Reading Via IPMI With Host Booted
251 [Documentation] Test power reading via IPMI with host booted state and
252 ... verify using REST.
253 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted
254
255 REST Power On stack_mode=skip quiet=1
256
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600257 Verify Power Reading
Rahul Maheshwari615da152018-02-13 23:53:36 -0600258
Rahul Maheshwari615da152018-02-13 23:53:36 -0600259
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600260Test Power Reading Via IPMI With Host Off
261 [Documentation] Test power reading via IPMI with host off state and
262 ... verify using REST.
263 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Off
Rahul Maheshwari615da152018-02-13 23:53:36 -0600264
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600265 REST Power Off stack_mode=skip quiet=1
Rahul Maheshwari615da152018-02-13 23:53:36 -0600266
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600267 Wait Until Keyword Succeeds 6 min 10 sec Is Host Off
Rahul Maheshwari615da152018-02-13 23:53:36 -0600268
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600269 Verify Power Reading
Rahul Maheshwari615da152018-02-13 23:53:36 -0600270
271
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600272Test Power Reading Via IPMI Raw Command
273 [Documentation] Test power reading via IPMI raw command and verify
274 ... using REST.
275 [Tags] Test_Power_Reading_Via_IPMI_Raw_Command
276
277 # Response data structure of power reading command output via IPMI.
278 # 1 Completion Code. Refer to section 8, DCMI Completion Codes.
279 # 2 Group Extension Identification = DCh
280 # 3:4 Current Power in watts
281
282 ${ipmi_raw_output}= Run IPMI Standard Command
283 ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]}
284
285 @{raw_output_list}= Split String ${ipmi_raw_output} ${SPACE}
286
287 # On successful execution of raw IPMI power reading command, completion
288 # code does not come in output. So current power value will start from 2
289 # byte instead of 3.
290
291 ${power_reading_ipmi_raw_3_item}= Get From List ${raw_output_list} 2
292 ${power_reading_ipmi_raw_3_item}=
293 ... Convert To Integer 0x${power_reading_ipmi_raw_3_item}
294
295 ${power_reading_rest}= Read Attribute
296 ... ${SENSORS_URI}power/total_power Value
297
298 # Example of power reading via REST
299 # "CriticalAlarmHigh": 0,
300 # "CriticalAlarmLow": 0,
301 # "CriticalHigh": 3100000000,
302 # "CriticalLow": 0,
303 # "Scale": -6,
304 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
305 # "Value": 228000000,
306 # "WarningAlarmHigh": 0,
307 # "WarningAlarmLow": 0,
308 # "WarningHigh": 3050000000,
309 # "WarningLow": 0
310
311 # Get power value based on scale i.e. Value * (10 power Scale Value)
312 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
313
314 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
315 ${ipmi_rest_power_diff}=
316 ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi_raw_3_item})
317
318 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
319 ... msg=Power Reading above allowed threshold ${allowed_power_diff}.
320
321
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600322Test Baseboard Temperature Via IPMI
323 [Documentation] Test baseboard temperature via IPMI and verify using REST.
324 [Tags] Test_Baseboard_Temperature_Via_IPMI
325
326 # Example of IPMI dcmi get_temp_reading output:
327 # Entity ID Entity Instance Temp. Readings
328 # Inlet air temperature(40h) 1 +19 C
329 # CPU temperature sensors(41h) 5 +51 C
330 # CPU temperature sensors(41h) 6 +50 C
331 # CPU temperature sensors(41h) 7 +50 C
332 # CPU temperature sensors(41h) 8 +50 C
333 # CPU temperature sensors(41h) 9 +50 C
334 # CPU temperature sensors(41h) 10 +48 C
335 # CPU temperature sensors(41h) 11 +49 C
336 # CPU temperature sensors(41h) 12 +47 C
337 # CPU temperature sensors(41h) 8 +50 C
338 # CPU temperature sensors(41h) 16 +51 C
339 # CPU temperature sensors(41h) 24 +50 C
340 # CPU temperature sensors(41h) 32 +43 C
341 # CPU temperature sensors(41h) 40 +43 C
342 # Baseboard temperature sensors(42h) 1 +35 C
343
344 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
345 ${baseboard_temp_line}=
346 ... Get Lines Containing String ${temp_reading}
347 ... Baseboard temperature case-insensitive=True
348
349 ${baseboard_temp_ipmi}= Fetch From Right ${baseboard_temp_line} +
350 ${baseboard_temp_ipmi}= Remove String ${baseboard_temp_ipmi} ${SPACE}C
351
352 ${baseboard_temp_rest}= Read Attribute
353 ... /xyz/openbmc_project/sensors/temperature/pcie Value
354 ${baseboard_temp_rest}= Evaluate ${baseboard_temp_rest}/1000
355
356 Should Be True
357 ... ${baseboard_temp_rest} - ${baseboard_temp_ipmi} <= ${allowed_temp_diff}
358 ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}.
359
360
Sweta Potthurif39022d2018-02-06 03:40:07 -0600361Retrieve Default Gateway Via IPMI And Verify Using REST
362 [Documentation] Retrieve default gateway from LAN print using IPMI.
363 [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify_Using_REST
364
365 # Fetch "Default Gateway" from IPMI LAN print.
366 ${default_gateway_ipmi}= Fetch Details From LAN Print Default Gateway IP
367
368 # Verify "Default Gateway" using REST.
369 Read Attribute ${NETWORK_MANAGER}/config DefaultGateway
370 ... expected_value=${default_gateway_ipmi}
371
372
373Retrieve MAC Address Via IPMI And Verify Using REST
374 [Documentation] Retrieve MAC Address from LAN print using IPMI.
375 [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_REST
376
377 # Fetch "MAC Address" from IPMI LAN print.
378 ${mac_address_ipmi}= Fetch Details From LAN Print MAC Address
379
380 # Verify "MAC Address" using REST.
381 ${mac_address_rest}= Get BMC MAC Address
382 Should Be Equal ${mac_address_ipmi} ${mac_address_rest}
383 ... msg=Verification of MAC address from lan print using IPMI failed.
384
385
386Retrieve Network Mode Via IPMI And Verify Using REST
387 [Documentation] Retrieve network mode from LAN print using IPMI.
388 [Tags] Retrieve_Network_Mode_Via_IPMI_And_Verify_Using_REST
389
390 # Fetch "Mode" from IPMI LAN print.
391 ${network_mode_ipmi}= Fetch Details From LAN Print Source
392
393 # Verify "Mode" using REST.
394 ${network_mode_rest}= Read Attribute
395 ... ${NETWORK_MANAGER}/eth0 DHCPEnabled
396 Run Keyword If '${network_mode_ipmi}' == 'Static Address'
397 ... Should Be Equal ${network_mode_rest} ${0}
398 ... msg=Verification of network setting failed.
399 ... ELSE IF '${network_mode_ipmi}' == 'DHCP'
400 ... Should Be Equal ${network_mode_rest} ${1}
401 ... msg=Verification of network setting failed.
402
403
404Retrieve IP Address Via IPMI And Verify With BMC Details
405 [Documentation] Retrieve IP address from LAN print using IPMI.
406 [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_With_BMC_Details
407
408 # Fetch "IP Address" from IPMI LAN print.
409 ${ip_addr_ipmi}= Fetch Details From LAN Print IP Address
410
411 # Verify the IP address retrieved via IPMI with BMC IPs.
412 ${ip_address_rest}= Get BMC IP Info
413 Validate IP On BMC ${ip_addr_ipmi} ${ip_address_rest}
414
415
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600416Verify Get Device ID
417 [Documentation] Verify get device ID command output.
418 [Tags] Verify_Get_Device_ID
419
420 # Example of get device ID command output:
421 # Device ID : 0
422 # Device Revision : 0
423 # Firmware Revision : 2.01
424 # IPMI Version : 2.0
425 # Manufacturer ID : 42817
426 # Manufacturer Name : Unknown (0xA741)
427 # Product ID : 16975 (0x424f)
428 # Product Name : Unknown (0x424F)
429 # Device Available : yes
430 # Provides Device SDRs : yes
431 # Additional Device Support :
432 # Sensor Device
433 # SEL Device
434 # FRU Inventory Device
435 # Chassis Device
436 # Aux Firmware Rev Info :
437 # 0x00
438 # 0x00
439 # 0x00
440 # 0x00
441
442 ${mc_info}= Get MC Info
443
444 Should Be Equal ${mc_info['device_id']} 0
445 Should Be Equal ${mc_info['device_revision']} 0
446
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500447 # Get firmware revision from mc info command output i.e. 2.01
448 ${ipmi_fw_major_version} ${ipmi_fw_minor_version}=
449 ... Split String ${mc_info['firmware_revision']} .
450 # Convert minor firmware version from BCD format to integer. i.e. 01 to 1
451 ${ipmi_fw_minor_version}= Convert To Integer ${ipmi_fw_minor_version}
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600452
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500453 # Get BMC version from BMC CLI i.e. 2.1 from "ibm-v2.1-338-r1-0-gbcd7765"
454 ${bmc_version}= Get BMC Version
455 ${bmc_version}=
456 ... Remove String Using Regexp ${bmc_version} ^[^0-9]+ [^0-9\.].*
457
458 # Get major and minor version from BMC version i.e. 2 and 1 from 2.1
459 ${bmc_major_version} ${bmc_minor_version}=
460 ... Split String ${bmc_version} .
461
462 Should Be Equal As Strings ${ipmi_fw_major_version} ${bmc_major_version}
463 ... msg=Major version mis-match.
464 Should Be Equal As Strings ${ipmi_fw_minor_version} ${bmc_minor_version}
465 ... msg=Minor version mis-match.
466
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600467 Should Be Equal ${mc_info['ipmi_version']} 2.0
468
469 # TODO: Verify Manufacturer and Product IDs directy from json file.
470 # Reference : openbmc/openbmc-test-automation#1244
471 Should Be Equal ${mc_info['manufacturer_id']} 42817
472 Should Be Equal ${mc_info['product_id']} 16975 (0x424f)
473
474 Should Be Equal ${mc_info['device_available']} yes
475 Should Be Equal ${mc_info['provides_device_sdrs']} yes
476 Should Contain ${mc_info['additional_device_support']} Sensor Device
477 Should Contain ${mc_info['additional_device_support']} SEL Device
478 Should Contain
479 ... ${mc_info['additional_device_support']} FRU Inventory Device
480 Should Contain ${mc_info['additional_device_support']} Chassis Device
481 Should Contain X Times ${mc_info['aux_firmware_rev_info']} 0x00 4
482
483
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500484Verify SDR Info
485 [Documentation] Verify sdr info command output.
486 [Tags] Verify_SDR_Info
487
488 # Example of SDR info command output:
489 # SDR Version : 0x51
490 # Record Count : 216
491 # Free Space : unspecified
492 # Most recent Addition :
493 # Most recent Erase :
494 # SDR overflow : no
495 # SDR Repository Update Support : unspecified
496 # Delete SDR supported : no
497 # Partial Add SDR supported : no
498 # Reserve SDR repository supported : no
499 # SDR Repository Alloc info supported : no
500
501 ${sdr_info}= Get SDR Info
502 Should Be Equal ${sdr_info['sdr_version']} 0x51
503
504 # Get sensor count from "sdr elist all" command output.
505 ${sensor_count}= Get Sensor Count
506 Should Be Equal As Strings
507 ... ${sdr_info['record_count']} ${sensor_count}
508
509 Should Be Equal ${sdr_info['free_space']} unspecified
510 Should Be Equal ${sdr_info['most_recent_addition']} ${EMPTY}
511 Should Be Equal ${sdr_info['most_recent_erase']} ${EMPTY}
512 Should Be Equal ${sdr_info['sdr_overflow']} no
513 Should Be Equal ${sdr_info['sdr_repository_update_support']} unspecified
514 Should Be Equal ${sdr_info['delete_sdr_supported']} no
515 Should Be Equal ${sdr_info['partial_add_sdr_supported']} no
516 Should Be Equal ${sdr_info['reserve_sdr_repository_supported']} no
517 Should Be Equal ${sdr_info['sdr_repository_alloc_info_supported']} no
518
519
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500520*** Keywords ***
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600521
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500522Get Sensor Count
523 [Documentation] Get sensors count using "sdr elist all" command.
524
525 # Example of "sdr elist all" command output:
526 # BootProgress | 03h | ok | 34.2 |
527 # OperatingSystemS | 05h | ok | 35.1 |
528 # AttemptsLeft | 07h | ok | 34.1 |
529 # occ0 | 08h | ok | 210.1 | Device Disabled
530 # occ1 | 09h | ok | 210.2 | Device Disabled
531 # p0_core0_temp | 11h | ns | 3.1 | Disabled
532 # cpu0_core0 | 12h | ok | 208.1 | Presence detected
533 # p0_core1_temp | 14h | ns | 3.2 | Disabled
534 # cpu0_core1 | 15h | ok | 208.2 | Presence detected
535 # p0_core2_temp | 17h | ns | 3.3 | Disabled
536 # ..
537 # ..
538 # ..
539 # ..
540 # ..
541 # ..
542 # fan3 | 00h | ns | 29.4 | Logical FRU @35h
543 # bmc | 00h | ns | 6.1 | Logical FRU @3Ch
544 # ethernet | 00h | ns | 1.1 | Logical FRU @46h
545
546 ${output}= Run IPMI Standard Command sdr elist all
547 ${sensor_list}= Split String ${output} \n
548 ${sensor_count}= Get Length ${sensor_list}
549 [Return] ${sensor_count}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600550
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600551Set Management Controller ID String
552 [Documentation] Set the management controller ID string.
553 [Arguments] ${string}
554
555 # Description of argument(s):
556 # string Management Controller ID String to be set
557
558 ${set_mc_id_string}= Run IPMI Standard Command
559 ... dcmi set_mc_id_string ${string}
560
Sweta Potthurif39022d2018-02-06 03:40:07 -0600561
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600562Get Management Controller ID String And Verify
563 [Documentation] Get the management controller ID sting.
564 [Arguments] ${string}
565
566 # Description of argument(s):
567 # string Management Controller ID string
568
569 ${get_mc_id}= Run IPMI Standard Command dcmi get_mc_id_string
570 Should Contain ${get_mc_id} ${string}
571 ... msg=Command failed: get_mc_id.
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600572
Sweta Potthurif39022d2018-02-06 03:40:07 -0600573
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600574Set Watchdog Enabled Using REST
575 [Documentation] Set watchdog Enabled field using REST.
576 [Arguments] ${value}
577
578 # Description of argument(s):
579 # value Integer value (eg. "0-Disabled", "1-Enabled").
580
581 ${value_dict}= Create Dictionary data=${value}
582 ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}/attr/Enabled
583 ... data=${value_dict}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600584
585
Sweta Potthurif39022d2018-02-06 03:40:07 -0600586Fetch Details From LAN Print
587 [Documentation] Fetch details from LAN print.
588 [Arguments] ${field_name}
589
590 # Description of argument(s):
591 # ${field_name} Field name to be fetched from LAN print
592 # (e.g. "MAC Address", "Source").
593
Sweta Potthuric64322a2018-02-22 05:30:30 -0600594 ${stdout}= Run External IPMI Standard Command lan print
Sweta Potthurif39022d2018-02-06 03:40:07 -0600595 ${fetch_value}= Get Lines Containing String ${stdout} ${field_name}
596 ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE}
597 [Return] ${value_fetch}
598
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600599
600Verify Power Reading
601 [Documentation] Get dcmi power reading via IPMI.
602
603 # Example of power reading command output via IPMI.
604 # Instantaneous power reading: 235 Watts
605 # Minimum during sampling period: 235 Watts
606 # Maximum during sampling period: 235 Watts
607 # Average power reading over sample period: 235 Watts
608 # IPMI timestamp: Thu Jan 1 00:00:00 1970
609 # Sampling period: 00000000 Seconds.
610 # Power reading state is: deactivated
611
612 ${power_reading}= Get IPMI Power Reading
613
614 ${host_state}= Get Host State
615 Run Keyword If '${host_state}' == 'Off'
George Keishing51314872018-03-31 13:24:35 -0500616 ... Should Be Equal ${power_reading['instantaneous_power_reading']} 0
617 ... msg=Power reading not zero when power is off.
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600618
George Keishing51314872018-03-31 13:24:35 -0500619 Run Keyword If '${power_reading['instantaneous_power_reading']}' != '0'
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600620 ... Verify Power Reading Using REST ${power_reading['instantaneous_power_reading']}
621
622
623Verify Power Reading Using REST
624 [Documentation] Verify power reading using REST.
625 [Arguments] ${power_reading}
626
Gunnar Mills948e2e22018-03-23 12:54:27 -0500627 # Description of argument(s):
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600628 # power_reading IPMI Power reading
629
630 ${power_reading_rest}= Read Attribute
631 ... ${SENSORS_URI}power/total_power Value
632
633 # Example of power reading via REST
634 # "CriticalAlarmHigh": 0,
635 # "CriticalAlarmLow": 0,
636 # "CriticalHigh": 3100000000,
637 # "CriticalLow": 0,
638 # "Scale": -6,
639 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
640 # "Value": 228000000,
641 # "WarningAlarmHigh": 0,
642 # "WarningAlarmLow": 0,
643 # "WarningHigh": 3050000000,
644 # "WarningLow": 0
645
646 # Get power value based on scale i.e. Value * (10 power Scale Value)
647 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
648 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
649 ${ipmi_rest_power_diff}=
650 ... Evaluate abs(${power_reading_rest} - ${power_reading})
651
652 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
653 ... msg=Power reading above allowed threshold ${allowed_power_diff}.