blob: a8f77fdce3f940e31ecdd940f7cb0a2cea5cb1e8 [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 Keishingd6273802018-09-07 07:06:53 -05009Resource ../../lib/logging_utils.robot
George Keishing78ce8dc2018-03-30 11:49:06 -050010Library ../../lib/ipmi_utils.py
George Keishing0825a112018-03-30 10:48:07 -050011Variables ../../data/ipmi_raw_cmd_table.py
Rahul Maheshwaridf6f05d2018-09-04 03:48:37 -050012Library ../../lib/gen_misc.py
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050013
14Test Teardown FFDC On Test Case Fail
15
16*** Variables ***
17
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060018${new_mc_id}= HOST
Rahul Maheshwari901dcde2018-02-06 03:14:31 -060019${allowed_temp_diff}= ${1}
Rahul Maheshwari615da152018-02-13 23:53:36 -060020${allowed_power_diff}= ${10}
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060021
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050022*** Test Cases ***
23
George Keishingd6273802018-09-07 07:06:53 -050024Verify IPMI SEL Version
25 [Documentation] Verify IPMI SEL's version info.
26 [Tags] Verify_IPMI_SEL_Version
27
28 ${version_info}= Get IPMI SEL Setting Version
29 ${setting_status}= Fetch From Left ${version_info} (
30 ${setting_status}= Evaluate $setting_status.replace(' ','')
31
32 Should Be True ${setting_status} >= 1.5
33 Should Contain ${version_info} v2 compliant case_insensitive=True
34
35
George Keishing9acd2282018-09-07 07:21:41 -050036Verify Empty SEL
37 [Documentation] Verify empty SEL list.
38 [Tags] Verify_Empty_SEL
39
40 Delete Error Logs And Verify
41
42 ${resp}= Run IPMI Standard Command sel list
43 Should Contain ${resp} SEL has no entries case_insensitive=True
44
45
George Keishing39967eb2018-04-30 11:36:23 -050046Verify Supported Cipher List
47 [Documentation] Execute all supported cipher levels and verify.
48 [Tags] Verify_Supported_Cipher_List
49
50 :FOR ${cipher_level} IN @{valid_cipher_list}
Rahul Maheshwari19faedf2018-08-29 00:42:09 -050051 \ ${status}= Execute IPMI Command With Cipher ${cipher_level}
52 \ Should Be Equal ${status} ${0}
53
54
55Verify Unsupported Cipher List
56 [Documentation] Execute all unsupported cipher levels and verify error.
57 [Tags] Verify_Unsupported_Cipher_List
58
59 :FOR ${cipher_level} IN @{unsupported_cipher_list}
60 \ ${status}= Execute IPMI Command With Cipher ${cipher_level}
61 \ Should Be Equal ${status} ${1}
62
George Keishing39967eb2018-04-30 11:36:23 -050063
Rahul Maheshwari2837a812018-09-03 01:00:33 -050064Verify Supported Cipher List Via Lan Print
65 [Documentation] Verify supported cipher list via IPMI lan print command.
66 [Tags] Verify_Supported_Cipher_List_Via_Lan_Print
67
Rahul Maheshwari2837a812018-09-03 01:00:33 -050068 ${network_info_dict}= Get Lan Print Dict
69 # Example 'RMCP+ Cipher Suites' entry: 3,17
70 ${cipher_list}= Evaluate
71 ... map(int, $network_info_dict['RMCP+ Cipher Suites'].split(','))
72 Lists Should Be Equal ${cipher_list} ${valid_cipher_list}
73
74
Rahul Maheshwari98cfd262018-09-05 05:38:30 -050075Verify Supported Cipher Via Getciphers
76 [Documentation] Verify supported chiper list via IPMI getciphers command.
77 [Tags] Verify_Supported_Cipher_Via_Getciphers
78
79 ${output}= Run IPMI Standard Command channel getciphers ipmi
80 # Example of getciphers command output:
81 # ID IANA Auth Alg Integrity Alg Confidentiality Alg
82 # 3 N/A hmac_sha1 hmac_sha1_96 aes_cbc_128
83 # 17 N/A hmac_sha256 sha256_128 aes_cbc_128
84
85 ${report}= Outbuf To Report ${output}
86 # Make list from the 'id' column in the report.
87 ${cipher_list}= Evaluate [int(x['id']) for x in $report]
88 Lists Should Be Equal ${cipher_list} ${valid_cipher_list}
89
90
Rahul Maheshwaridf6f05d2018-09-04 03:48:37 -050091Verify Disabling And Enabling IPMI Via Host
92 [Documentation] Verify disabling and enabling IPMI via host.
93 [Tags] Verify_Disabling_And_Enabling_IPMI_Via_Host
94 [Teardown] Run Inband IPMI Standard Command lan set 1 access on
95
96 # Disable IPMI and verify
97 Run Inband IPMI Standard Command lan set 1 access off
98 Run Keyword and Expect Error *Unable to establish IPMI*
99 ... Run External IPMI Standard Command lan print
100
101 # Enable IPMI and verify
102 Run Inband IPMI Standard Command lan set 1 access on
103 ${lan_print_output}= Run External IPMI Standard Command lan print
104
105 ${openbmc_host_name} ${openbmc_ip} ${openbmc_short_name}=
106 ... Get Host Name IP host=${OPENBMC_HOST} short_name=1
107 Should Contain ${lan_print_output} ${openbmc_ip}
108
109
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500110Set Asset Tag With Valid String Length
111 [Documentation] Set asset tag with valid string length and verify.
112 [Tags] Set_Asset_Tag_With_Valid_String_Length
113
114 # Allowed MAX characters length for asset tag name is 63.
115 ${random_string}= Generate Random String 63
116 Run Keyword Run IPMI Standard Command dcmi set_asset_tag ${random_string}
117
118 ${asset_tag}= Run Keyword Run IPMI Standard Command dcmi asset_tag
119 Should Contain ${asset_tag} ${random_string}
120
121
122Set Asset Tag With Invalid String Length
123 [Documentation] Verify error while setting invalid asset tag via IPMI.
124 [Tags] Set_Asset_Tag_With_Invalid_String_Length
125
126 # Any string more than 63 character is invalid for asset tag.
127 ${random_string}= Generate Random String 64
128
129 ${resp}= Run Keyword And Expect Error * Run IPMI Standard Command
130 ... dcmi set_asset_tag ${random_string}
131 Should Contain ${resp} Parameter out of range ignore_case=True
132
133
134Set Asset Tag With Valid String Length Via REST
135 [Documentation] Set valid asset tag via REST and verify.
136 [Tags] Set_Asset_Tag_With_Valid_String_Length_Via_REST
137
138 ${random_string}= Generate Random String 63
139 ${args}= Create Dictionary data=${random_string}
140 Write Attribute /xyz/openbmc_project/inventory/system AssetTag
141 ... data=${args}
142
143 ${asset_tag}= Read Attribute /xyz/openbmc_project/inventory/system
144 ... AssetTag
145 Should Be Equal As Strings ${asset_tag} ${random_string}
146
Sweta Potthurif39022d2018-02-06 03:40:07 -0600147
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600148Verify Get And Set Management Controller ID String
149 [Documentation] Verify get and set management controller ID string.
150 [Tags] Verify_Get_And_Set_Management_Controller_ID_String
151
152 # Get the value of the managemment controller ID string.
153 # Example:
154 # Get Management Controller Identifier String: witherspoon
155
156 ${cmd_output}= Run IPMI Standard Command dcmi get_mc_id_string
157
158 # Extract management controller ID from cmd_output.
159 ${initial_mc_id}= Fetch From Right ${cmd_output} :${SPACE}
160
161 # Set the management controller ID string to other value.
162 # Example:
163 # Set Management Controller Identifier String Command: HOST
164
165 Set Management Controller ID String ${new_mc_id}
166
167 # Get the management controller ID and verify.
168 Get Management Controller ID String And Verify ${new_mc_id}
169
170 # Set the value back to the initial value and verify.
171 Set Management Controller ID String ${initial_mc_id}
172
173 # Get the management controller ID and verify.
174 Get Management Controller ID String And Verify ${initial_mc_id}
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500175
Sweta Potthurif39022d2018-02-06 03:40:07 -0600176
Rahul Maheshwari0eb33f02018-04-10 02:31:54 -0500177Test Management Controller ID String Status via IPMI
178 [Documentation] Test management controller ID string status via IPMI.
179 [Tags] Test_Management_Controller_ID_String_Status_via_IPMI
180
181 # Disable management controller ID string status via IPMI and verify.
182 Run IPMI Standard Command dcmi set_conf_param dhcp_config 0x00
183 Verify Management Controller ID String Status disable
184
185 # Enable management controller ID string status via IPMI and verify.
186 Run IPMI Standard Command dcmi set_conf_param dhcp_config 0x01
187 Verify Management Controller ID String Status enable
188
189
190Test Management Controller ID String Status via Raw IPMI
191 [Documentation] Test management controller ID string status via IPMI.
192 [Tags] Test_Management_Controller_ID_String_Status_via_Raw_IPMI
193
194 # Disable management controller ID string status via raw IPMI and verify.
195 Run IPMI Standard Command raw ${IPMI_RAW_CMD['conf_param']['Disabled'][0]}
196 Verify Management Controller ID String Status disable
197
198 # Enable management controller ID string status via raw IPMI and verify.
199 Run IPMI Standard Command raw ${IPMI_RAW_CMD['conf_param']['Enabled'][0]}
200 Verify Management Controller ID String Status enable
201
202
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600203Verify Chassis Identify via IPMI
204 [Documentation] Verify "chassis identify" using IPMI command.
205 [Tags] Verify_Chassis_Identify_via_IPMI
206
207 # Set to default "chassis identify" and verify that LED blinks for 15s.
208 Run IPMI Standard Command chassis identify
209 Verify Identify LED State Blink
210
211 Sleep 15s
212 Verify Identify LED State Off
213
214 # Set "chassis identify" to 10s and verify that the LED blinks for 10s.
215 Run IPMI Standard Command chassis identify 10
216 Verify Identify LED State Blink
217
218 Sleep 10s
219 Verify Identify LED State Off
220
Sweta Potthurif39022d2018-02-06 03:40:07 -0600221
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600222Verify Chassis Identify Off And Force Identify On via IPMI
223 [Documentation] Verify "chassis identify" off
224 ... and "force identify on" via IPMI.
225 [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI
226
227 # Set the LED to "Force Identify On".
228 Run IPMI Standard Command chassis identify force
229 Verify Identify LED State Blink
230
231 # Set "chassis identify" to 0 and verify that the LED turns off.
232 Run IPMI Standard Command chassis identify 0
233 Verify Identify LED State Off
234
Sweta Potthurif39022d2018-02-06 03:40:07 -0600235
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600236Test Watchdog Reset Via IPMI And Verify Using REST
237 [Documentation] Test watchdog reset via IPMI and verify using REST.
238 [Tags] Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST
239
240 Initiate Host Boot
241
242 Set Watchdog Enabled Using REST ${1}
243
244 Watchdog Object Should Exist
245
246 # Resetting the watchdog via IPMI.
247 Run IPMI Standard Command mc watchdog reset
248
249 # Verify the watchdog is reset using REST after an interval of 1000ms.
250 Sleep 1000ms
251 ${watchdog_time_left}=
252 ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining
253 Should Be True
254 ... ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000}
255 ... msg=Watchdog timer didn't reset.
256
Sweta Potthurif39022d2018-02-06 03:40:07 -0600257
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600258Test Watchdog Off Via IPMI And Verify Using REST
259 [Documentation] Test watchdog off via IPMI and verify using REST.
260 [Tags] Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST
261
262 Initiate Host Boot
263
264 Set Watchdog Enabled Using REST ${1}
265
266 Watchdog Object Should Exist
267
268 # Turn off the watchdog via IPMI.
269 Run IPMI Standard Command mc watchdog off
270
271 # Verify the watchdog is off using REST
272 ${watchdog_state}= Read Attribute ${HOST_WATCHDOG_URI} Enabled
273 Should Be Equal ${watchdog_state} ${0}
274 ... msg=msg=Verification failed for watchdog off check.
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600275
276
277Test Ambient Temperature Via IPMI
278 [Documentation] Test ambient temperature via IPMI and verify using REST.
279 [Tags] Test_Ambient_Temperature_Via_IPMI
280
281 # Entity ID Entity Instance Temp. Readings
282 # Inlet air temperature(40h) 1 +19 C
283 # CPU temperature sensors(41h) 5 +51 C
284 # CPU temperature sensors(41h) 6 +50 C
285 # CPU temperature sensors(41h) 7 +50 C
286 # CPU temperature sensors(41h) 8 +50 C
287 # CPU temperature sensors(41h) 9 +50 C
288 # CPU temperature sensors(41h) 10 +48 C
289 # CPU temperature sensors(41h) 11 +49 C
290 # CPU temperature sensors(41h) 12 +47 C
291 # CPU temperature sensors(41h) 8 +50 C
292 # CPU temperature sensors(41h) 16 +51 C
293 # CPU temperature sensors(41h) 24 +50 C
294 # CPU temperature sensors(41h) 32 +43 C
295 # CPU temperature sensors(41h) 40 +43 C
296 # Baseboard temperature sensors(42h) 1 +35 C
297
298 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
George Keishing77f1ad22018-07-23 12:39:28 -0500299 Should Contain ${temp_reading} Inlet air temperature
300 ... msg="Unable to get inlet temperature via DCMI".
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600301 ${ambient_temp_line}=
302 ... Get Lines Containing String ${temp_reading}
303 ... Inlet air temperature case-insensitive
304
305 ${ambient_temp_ipmi}= Fetch From Right ${ambient_temp_line} +
306 ${ambient_temp_ipmi}= Remove String ${ambient_temp_ipmi} ${SPACE}C
307
308 ${ambient_temp_rest}= Read Attribute
309 ... ${SENSORS_URI}temperature/ambient Value
310
311 # Example of ambient temperature via REST
312 # "CriticalAlarmHigh": 0,
313 # "CriticalAlarmLow": 0,
314 # "CriticalHigh": 35000,
315 # "CriticalLow": 0,
316 # "Scale": -3,
317 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
318 # "Value": 21775,
319 # "WarningAlarmHigh": 0,
320 # "WarningAlarmLow": 0,
321 # "WarningHigh": 25000,
322 # "WarningLow": 0
323
324 # Get temperature value based on scale i.e. Value * (10 power Scale Value)
325 # e.g. from above case 21775 * (10 power -3) = 21775/1000
326
327 ${ambient_temp_rest}= Evaluate ${ambient_temp_rest}/1000
328 ${ipmi_rest_temp_diff}=
329 ... Evaluate abs(${ambient_temp_rest} - ${ambient_temp_ipmi})
330
331 Should Be True ${ipmi_rest_temp_diff} <= ${allowed_temp_diff}
332 ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}.
333
334
Rahul Maheshwari43556632018-02-05 23:42:52 -0600335Verify Get DCMI Capabilities
336 [Documentation] Verify get DCMI capabilities command output.
337 [Tags] Verify_Get_DCMI_Capabilities
338
339 ${cmd_output}= Run IPMI Standard Command dcmi discover
340
341 @{supported_capabilities}= Create List
342 # Supported DCMI capabilities:
343 ... Mandatory platform capabilties
344 ... Optional platform capabilties
345 ... Power management available
346 ... Managebility access capabilties
347 ... In-band KCS channel available
348 # Mandatory platform attributes:
349 ... 200 SEL entries
350 ... SEL automatic rollover is enabled
351 # Optional Platform Attributes:
352 ... Slave address of device: 0h (8bits)(Satellite/External controller)
353 ... Channel number is 0h (Primary BMC)
354 ... Device revision is 0
355 # Manageability Access Attributes:
356 ... Primary LAN channel number: 1 is available
357 ... Secondary LAN channel is not available for OOB
358 ... No serial channel is available
359
360 :FOR ${capability} IN @{supported_capabilities}
361 \ Should Contain ${cmd_output} ${capability} ignore_case=True
362 ... msg=Supported DCMI capabilities not present.
363
364
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600365Test Power Reading Via IPMI With Host Off
366 [Documentation] Test power reading via IPMI with host off state and
367 ... verify using REST.
368 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Off
Rahul Maheshwari615da152018-02-13 23:53:36 -0600369
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600370 REST Power Off stack_mode=skip quiet=1
Rahul Maheshwari615da152018-02-13 23:53:36 -0600371
George Keishinge78f1fd2018-09-04 13:34:59 -0500372 Wait Until Keyword Succeeds 1 min 20 sec Verify Power Reading
373
374
375Test Power Reading Via IPMI With Host Booted
376 [Documentation] Test power reading via IPMI with host booted state and
377 ... verify using REST.
378 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted
379
380 REST Power On stack_mode=skip quiet=1
381
382 # For a good power reading take a 3 samples for 15 seconds interval and
383 # average it out.
384
385 Wait Until Keyword Succeeds 1 min 20 sec Verify Power Reading
Rahul Maheshwari615da152018-02-13 23:53:36 -0600386
387
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600388Test Power Reading Via IPMI Raw Command
389 [Documentation] Test power reading via IPMI raw command and verify
390 ... using REST.
391 [Tags] Test_Power_Reading_Via_IPMI_Raw_Command
392
393 # Response data structure of power reading command output via IPMI.
394 # 1 Completion Code. Refer to section 8, DCMI Completion Codes.
395 # 2 Group Extension Identification = DCh
396 # 3:4 Current Power in watts
397
George Keishinge78f1fd2018-09-04 13:34:59 -0500398 REST Power On stack_mode=skip quiet=1
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600399
George Keishinge78f1fd2018-09-04 13:34:59 -0500400 Wait Until Keyword Succeeds 1 min 20 sec Verify Power Reading Via Raw Command
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600401
402
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600403Test Baseboard Temperature Via IPMI
404 [Documentation] Test baseboard temperature via IPMI and verify using REST.
405 [Tags] Test_Baseboard_Temperature_Via_IPMI
406
407 # Example of IPMI dcmi get_temp_reading output:
408 # Entity ID Entity Instance Temp. Readings
409 # Inlet air temperature(40h) 1 +19 C
410 # CPU temperature sensors(41h) 5 +51 C
411 # CPU temperature sensors(41h) 6 +50 C
412 # CPU temperature sensors(41h) 7 +50 C
413 # CPU temperature sensors(41h) 8 +50 C
414 # CPU temperature sensors(41h) 9 +50 C
415 # CPU temperature sensors(41h) 10 +48 C
416 # CPU temperature sensors(41h) 11 +49 C
417 # CPU temperature sensors(41h) 12 +47 C
418 # CPU temperature sensors(41h) 8 +50 C
419 # CPU temperature sensors(41h) 16 +51 C
420 # CPU temperature sensors(41h) 24 +50 C
421 # CPU temperature sensors(41h) 32 +43 C
422 # CPU temperature sensors(41h) 40 +43 C
423 # Baseboard temperature sensors(42h) 1 +35 C
424
425 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
George Keishing77f1ad22018-07-23 12:39:28 -0500426 Should Contain ${temp_reading} Baseboard temperature sensors
427 ... msg="Unable to get baseboard temperature via DCMI".
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600428 ${baseboard_temp_line}=
429 ... Get Lines Containing String ${temp_reading}
430 ... Baseboard temperature case-insensitive=True
431
432 ${baseboard_temp_ipmi}= Fetch From Right ${baseboard_temp_line} +
433 ${baseboard_temp_ipmi}= Remove String ${baseboard_temp_ipmi} ${SPACE}C
434
435 ${baseboard_temp_rest}= Read Attribute
436 ... /xyz/openbmc_project/sensors/temperature/pcie Value
437 ${baseboard_temp_rest}= Evaluate ${baseboard_temp_rest}/1000
438
439 Should Be True
440 ... ${baseboard_temp_rest} - ${baseboard_temp_ipmi} <= ${allowed_temp_diff}
441 ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}.
442
443
Sweta Potthurif39022d2018-02-06 03:40:07 -0600444Retrieve Default Gateway Via IPMI And Verify Using REST
445 [Documentation] Retrieve default gateway from LAN print using IPMI.
446 [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify_Using_REST
447
448 # Fetch "Default Gateway" from IPMI LAN print.
449 ${default_gateway_ipmi}= Fetch Details From LAN Print Default Gateway IP
450
451 # Verify "Default Gateway" using REST.
452 Read Attribute ${NETWORK_MANAGER}/config DefaultGateway
453 ... expected_value=${default_gateway_ipmi}
454
455
456Retrieve MAC Address Via IPMI And Verify Using REST
457 [Documentation] Retrieve MAC Address from LAN print using IPMI.
458 [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_REST
459
460 # Fetch "MAC Address" from IPMI LAN print.
461 ${mac_address_ipmi}= Fetch Details From LAN Print MAC Address
462
463 # Verify "MAC Address" using REST.
464 ${mac_address_rest}= Get BMC MAC Address
465 Should Be Equal ${mac_address_ipmi} ${mac_address_rest}
466 ... msg=Verification of MAC address from lan print using IPMI failed.
467
468
469Retrieve Network Mode Via IPMI And Verify Using REST
470 [Documentation] Retrieve network mode from LAN print using IPMI.
471 [Tags] Retrieve_Network_Mode_Via_IPMI_And_Verify_Using_REST
472
473 # Fetch "Mode" from IPMI LAN print.
474 ${network_mode_ipmi}= Fetch Details From LAN Print Source
475
476 # Verify "Mode" using REST.
477 ${network_mode_rest}= Read Attribute
478 ... ${NETWORK_MANAGER}/eth0 DHCPEnabled
479 Run Keyword If '${network_mode_ipmi}' == 'Static Address'
480 ... Should Be Equal ${network_mode_rest} ${0}
481 ... msg=Verification of network setting failed.
482 ... ELSE IF '${network_mode_ipmi}' == 'DHCP'
483 ... Should Be Equal ${network_mode_rest} ${1}
484 ... msg=Verification of network setting failed.
485
486
487Retrieve IP Address Via IPMI And Verify With BMC Details
488 [Documentation] Retrieve IP address from LAN print using IPMI.
489 [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_With_BMC_Details
490
491 # Fetch "IP Address" from IPMI LAN print.
492 ${ip_addr_ipmi}= Fetch Details From LAN Print IP Address
493
494 # Verify the IP address retrieved via IPMI with BMC IPs.
495 ${ip_address_rest}= Get BMC IP Info
496 Validate IP On BMC ${ip_addr_ipmi} ${ip_address_rest}
497
498
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600499Verify Get Device ID
500 [Documentation] Verify get device ID command output.
501 [Tags] Verify_Get_Device_ID
502
503 # Example of get device ID command output:
504 # Device ID : 0
505 # Device Revision : 0
506 # Firmware Revision : 2.01
507 # IPMI Version : 2.0
508 # Manufacturer ID : 42817
509 # Manufacturer Name : Unknown (0xA741)
510 # Product ID : 16975 (0x424f)
511 # Product Name : Unknown (0x424F)
512 # Device Available : yes
513 # Provides Device SDRs : yes
514 # Additional Device Support :
515 # Sensor Device
516 # SEL Device
517 # FRU Inventory Device
518 # Chassis Device
519 # Aux Firmware Rev Info :
George Keishing3511a3f2018-04-19 10:38:30 -0500520 # 0x04
521 # 0x38
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600522 # 0x00
George Keishing3511a3f2018-04-19 10:38:30 -0500523 # 0x03
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600524
525 ${mc_info}= Get MC Info
526
527 Should Be Equal ${mc_info['device_id']} 0
528 Should Be Equal ${mc_info['device_revision']} 0
529
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500530 # Get firmware revision from mc info command output i.e. 2.01
531 ${ipmi_fw_major_version} ${ipmi_fw_minor_version}=
532 ... Split String ${mc_info['firmware_revision']} .
533 # Convert minor firmware version from BCD format to integer. i.e. 01 to 1
534 ${ipmi_fw_minor_version}= Convert To Integer ${ipmi_fw_minor_version}
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600535
George Keishinge0a81282018-06-08 10:02:30 -0500536 # Get BMC version from BMC CLI i.e. 2.2 from "v2.2-253-g00050f1"
George Keishing3511a3f2018-04-19 10:38:30 -0500537 ${bmc_version_full}= Get BMC Version
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500538 ${bmc_version}=
George Keishing3511a3f2018-04-19 10:38:30 -0500539 ... Remove String Using Regexp ${bmc_version_full} ^[^0-9]+ [^0-9\.].*
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500540
541 # Get major and minor version from BMC version i.e. 2 and 1 from 2.1
542 ${bmc_major_version} ${bmc_minor_version}=
543 ... Split String ${bmc_version} .
544
545 Should Be Equal As Strings ${ipmi_fw_major_version} ${bmc_major_version}
546 ... msg=Major version mis-match.
547 Should Be Equal As Strings ${ipmi_fw_minor_version} ${bmc_minor_version}
548 ... msg=Minor version mis-match.
549
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600550 Should Be Equal ${mc_info['ipmi_version']} 2.0
551
Gunnar Mills917ba1a2018-04-08 16:42:12 -0500552 # TODO: Verify Manufacturer and Product IDs directly from json file.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600553 # Reference : openbmc/openbmc-test-automation#1244
554 Should Be Equal ${mc_info['manufacturer_id']} 42817
555 Should Be Equal ${mc_info['product_id']} 16975 (0x424f)
556
557 Should Be Equal ${mc_info['device_available']} yes
558 Should Be Equal ${mc_info['provides_device_sdrs']} yes
559 Should Contain ${mc_info['additional_device_support']} Sensor Device
560 Should Contain ${mc_info['additional_device_support']} SEL Device
561 Should Contain
562 ... ${mc_info['additional_device_support']} FRU Inventory Device
563 Should Contain ${mc_info['additional_device_support']} Chassis Device
George Keishingb746d3f2018-04-19 10:53:10 -0500564
George Keishing3511a3f2018-04-19 10:38:30 -0500565 # Auxiliary revision data verification.
566 ${aux_version}= Get Aux Version ${bmc_version_full}
567
568 # From aux_firmware_rev_info field ['0x04', '0x38', '0x00', '0x03']
569 ${bmc_aux_version}= Catenate
570 ... SEPARATOR=
571 ... ${mc_info['aux_firmware_rev_info'][0][2:]}
572 ... ${mc_info['aux_firmware_rev_info'][1][2:]}
573 ... ${mc_info['aux_firmware_rev_info'][2][2:]}
574 ... ${mc_info['aux_firmware_rev_info'][3][2:]}
575
576 Should Be Equal As Integers
577 ... ${bmc_aux_version} ${aux_version}
578 ... msg=BMC aux version ${bmc_aux_version} does not match expected value of ${aux_version}.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600579
580
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500581Verify SDR Info
582 [Documentation] Verify sdr info command output.
583 [Tags] Verify_SDR_Info
584
585 # Example of SDR info command output:
586 # SDR Version : 0x51
587 # Record Count : 216
588 # Free Space : unspecified
589 # Most recent Addition :
590 # Most recent Erase :
591 # SDR overflow : no
592 # SDR Repository Update Support : unspecified
593 # Delete SDR supported : no
594 # Partial Add SDR supported : no
595 # Reserve SDR repository supported : no
596 # SDR Repository Alloc info supported : no
597
598 ${sdr_info}= Get SDR Info
599 Should Be Equal ${sdr_info['sdr_version']} 0x51
600
601 # Get sensor count from "sdr elist all" command output.
602 ${sensor_count}= Get Sensor Count
603 Should Be Equal As Strings
604 ... ${sdr_info['record_count']} ${sensor_count}
605
606 Should Be Equal ${sdr_info['free_space']} unspecified
607 Should Be Equal ${sdr_info['most_recent_addition']} ${EMPTY}
608 Should Be Equal ${sdr_info['most_recent_erase']} ${EMPTY}
609 Should Be Equal ${sdr_info['sdr_overflow']} no
610 Should Be Equal ${sdr_info['sdr_repository_update_support']} unspecified
611 Should Be Equal ${sdr_info['delete_sdr_supported']} no
612 Should Be Equal ${sdr_info['partial_add_sdr_supported']} no
613 Should Be Equal ${sdr_info['reserve_sdr_repository_supported']} no
614 Should Be Equal ${sdr_info['sdr_repository_alloc_info_supported']} no
615
616
George Keishing02651f02018-04-11 02:07:16 -0500617Test Valid IPMI Channels Supported
618 [Documentation] Verify IPMI channels supported on a given system.
619 [Tags] Test_Valid_IPMI_Channels_Supported
620
621 ${channel_count}= Get Physical Network Interface Count
622
623 # Note: IPMI network channel logically starts from 1.
624 :FOR ${channel_number} IN RANGE 1 ${channel_count}
625 \ Run External IPMI Standard Command lan print ${channel_number}
626
627
628Test Invalid IPMI Channel Response
629 [Documentation] Verify invalid IPMI channels supported response.
630 [Tags] Test_Invalid_IPMI_Channel_Response
631
632 ${channel_count}= Get Physical Network Interface Count
633
634 # To target invalid channel, increment count.
635 ${channel_number}= Evaluate ${channel_count} + 1
636
637 # Example of invalid channel:
George Keishing72d0ac82018-09-20 09:33:01 -0500638 # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3
George Keishing02651f02018-04-11 02:07:16 -0500639 # Get Channel Info command failed: Parameter out of range
640 # Invalid channel: 3
641
642 ${stdout}= Run External IPMI Standard Command
643 ... lan print ${channel_number} fail_on_err=${0}
644 Should Contain ${stdout} Invalid channel
645 ... msg=IPMI channel ${channel_number} is invalid but seen working.
646
647
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500648*** Keywords ***
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600649
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500650Get Sensor Count
651 [Documentation] Get sensors count using "sdr elist all" command.
652
653 # Example of "sdr elist all" command output:
654 # BootProgress | 03h | ok | 34.2 |
655 # OperatingSystemS | 05h | ok | 35.1 |
656 # AttemptsLeft | 07h | ok | 34.1 |
657 # occ0 | 08h | ok | 210.1 | Device Disabled
658 # occ1 | 09h | ok | 210.2 | Device Disabled
659 # p0_core0_temp | 11h | ns | 3.1 | Disabled
660 # cpu0_core0 | 12h | ok | 208.1 | Presence detected
661 # p0_core1_temp | 14h | ns | 3.2 | Disabled
662 # cpu0_core1 | 15h | ok | 208.2 | Presence detected
663 # p0_core2_temp | 17h | ns | 3.3 | Disabled
664 # ..
665 # ..
666 # ..
667 # ..
668 # ..
669 # ..
670 # fan3 | 00h | ns | 29.4 | Logical FRU @35h
671 # bmc | 00h | ns | 6.1 | Logical FRU @3Ch
672 # ethernet | 00h | ns | 1.1 | Logical FRU @46h
673
674 ${output}= Run IPMI Standard Command sdr elist all
675 ${sensor_list}= Split String ${output} \n
676 ${sensor_count}= Get Length ${sensor_list}
677 [Return] ${sensor_count}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600678
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600679Set Management Controller ID String
680 [Documentation] Set the management controller ID string.
681 [Arguments] ${string}
682
683 # Description of argument(s):
684 # string Management Controller ID String to be set
685
686 ${set_mc_id_string}= Run IPMI Standard Command
687 ... dcmi set_mc_id_string ${string}
688
Sweta Potthurif39022d2018-02-06 03:40:07 -0600689
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600690Get Management Controller ID String And Verify
George Keishingcb3b9b62018-09-14 12:11:19 -0500691 [Documentation] Get the management controller ID string.
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600692 [Arguments] ${string}
693
694 # Description of argument(s):
695 # string Management Controller ID string
696
697 ${get_mc_id}= Run IPMI Standard Command dcmi get_mc_id_string
698 Should Contain ${get_mc_id} ${string}
699 ... msg=Command failed: get_mc_id.
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600700
Sweta Potthurif39022d2018-02-06 03:40:07 -0600701
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600702Set Watchdog Enabled Using REST
703 [Documentation] Set watchdog Enabled field using REST.
704 [Arguments] ${value}
705
706 # Description of argument(s):
707 # value Integer value (eg. "0-Disabled", "1-Enabled").
708
709 ${value_dict}= Create Dictionary data=${value}
710 ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}/attr/Enabled
711 ... data=${value_dict}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600712
713
Sweta Potthurif39022d2018-02-06 03:40:07 -0600714Fetch Details From LAN Print
715 [Documentation] Fetch details from LAN print.
716 [Arguments] ${field_name}
717
718 # Description of argument(s):
719 # ${field_name} Field name to be fetched from LAN print
720 # (e.g. "MAC Address", "Source").
721
Sweta Potthuric64322a2018-02-22 05:30:30 -0600722 ${stdout}= Run External IPMI Standard Command lan print
Sweta Potthurif39022d2018-02-06 03:40:07 -0600723 ${fetch_value}= Get Lines Containing String ${stdout} ${field_name}
724 ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE}
725 [Return] ${value_fetch}
726
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600727
728Verify Power Reading
729 [Documentation] Get dcmi power reading via IPMI.
730
731 # Example of power reading command output via IPMI.
732 # Instantaneous power reading: 235 Watts
733 # Minimum during sampling period: 235 Watts
734 # Maximum during sampling period: 235 Watts
735 # Average power reading over sample period: 235 Watts
736 # IPMI timestamp: Thu Jan 1 00:00:00 1970
737 # Sampling period: 00000000 Seconds.
738 # Power reading state is: deactivated
739
740 ${power_reading}= Get IPMI Power Reading
741
742 ${host_state}= Get Host State
743 Run Keyword If '${host_state}' == 'Off'
George Keishing51314872018-03-31 13:24:35 -0500744 ... Should Be Equal ${power_reading['instantaneous_power_reading']} 0
745 ... msg=Power reading not zero when power is off.
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600746
George Keishing51314872018-03-31 13:24:35 -0500747 Run Keyword If '${power_reading['instantaneous_power_reading']}' != '0'
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600748 ... Verify Power Reading Using REST ${power_reading['instantaneous_power_reading']}
749
750
George Keishinge78f1fd2018-09-04 13:34:59 -0500751Verify Power Reading Via Raw Command
752 [Documentation] Get dcmi power reading via IPMI raw command.
753
754 ${ipmi_raw_output}= Run IPMI Standard Command
755 ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]}
756
757 @{raw_output_list}= Split String ${ipmi_raw_output} ${SPACE}
758
759 # On successful execution of raw IPMI power reading command, completion
760 # code does not come in output. So current power value will start from 2
761 # byte instead of 3.
762
763 ${power_reading_ipmi_raw_3_item}= Get From List ${raw_output_list} 2
764 ${power_reading_ipmi_raw_3_item}=
765 ... Convert To Integer 0x${power_reading_ipmi_raw_3_item}
766
767 ${power_reading_rest}= Read Attribute
768 ... ${SENSORS_URI}power/total_power Value
769
770 # Example of power reading via REST
771 # "CriticalAlarmHigh": 0,
772 # "CriticalAlarmLow": 0,
773 # "CriticalHigh": 3100000000,
774 # "CriticalLow": 0,
775 # "Scale": -6,
776 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
777 # "Value": 228000000,
778 # "WarningAlarmHigh": 0,
779 # "WarningAlarmLow": 0,
780 # "WarningHigh": 3050000000,
781 # "WarningLow": 0
782
783 # Get power value based on scale i.e. Value * (10 power Scale Value)
784 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
785
786 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
787 ${ipmi_rest_power_diff}=
788 ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi_raw_3_item})
789
790 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
791 ... msg=Power Reading above allowed threshold ${allowed_power_diff}.
792
793
Rahul Maheshwari0eb33f02018-04-10 02:31:54 -0500794Verify Management Controller ID String Status
795 [Documentation] Verify management controller ID string status via IPMI.
796 [Arguments] ${status}
797
798 # Example of dcmi get_conf_param command output:
799 # DHCP Discovery method :
800 # Management Controller ID String is disabled
801 # Vendor class identifier DCMI IANA and Vendor class-specific Informationa are disabled
802 # Initial timeout interval : 4 seconds
803 # Server contact timeout interval : 120 seconds
804 # Server contact retry interval : 64 seconds
805
806 ${resp}= Run IPMI Standard Command dcmi get_conf_param
807 ${resp}= Get Lines Containing String ${resp}
808 ... Management Controller ID String case_insensitive=True
809 Should Contain ${resp} ${status}
810 ... msg=Management controller ID string is not ${status}
811
812
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600813Verify Power Reading Using REST
814 [Documentation] Verify power reading using REST.
815 [Arguments] ${power_reading}
816
Gunnar Mills948e2e22018-03-23 12:54:27 -0500817 # Description of argument(s):
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600818 # power_reading IPMI Power reading
819
820 ${power_reading_rest}= Read Attribute
821 ... ${SENSORS_URI}power/total_power Value
822
823 # Example of power reading via REST
824 # "CriticalAlarmHigh": 0,
825 # "CriticalAlarmLow": 0,
826 # "CriticalHigh": 3100000000,
827 # "CriticalLow": 0,
828 # "Scale": -6,
829 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
830 # "Value": 228000000,
831 # "WarningAlarmHigh": 0,
832 # "WarningAlarmLow": 0,
833 # "WarningHigh": 3050000000,
834 # "WarningLow": 0
835
836 # Get power value based on scale i.e. Value * (10 power Scale Value)
837 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
838 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
839 ${ipmi_rest_power_diff}=
840 ... Evaluate abs(${power_reading_rest} - ${power_reading})
841
842 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
843 ... msg=Power reading above allowed threshold ${allowed_power_diff}.
George Keishing02651f02018-04-11 02:07:16 -0500844
845
846Get Physical Network Interface Count
847 [Documentation] Return valid physical network interfaces count.
848
849 # Example:
850 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
851 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
852
853 ${mac_entry_list}= Get BMC MAC Address List
854 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
855 ${physical_interface_count}= Get Length ${mac_unique_list}
856
857 [Return] ${physical_interface_count}
George Keishing39967eb2018-04-30 11:36:23 -0500858
859
860Execute IPMI Command With Cipher
861 [Documentation] Execute IPMI command with a given cipher level value.
862 [Arguments] ${cipher_level}
863
864 # Description of argument(s):
865 # cipher_level IPMI chipher level value
866 # (e.g. "1", "2", "3", "15", "16", "17").
867
868 ${ipmi_cmd}= Catenate SEPARATOR=
869 ... ipmitool -I lanplus -C ${cipher_level} -P${SPACE}${IPMI_PASSWORD}
870 ... ${SPACE}${HOST}${SPACE}${OPENBMC_HOST}${SPACE}mc info
871
872 ${rc} ${output}= Run And Return RC and Output ${ipmi_cmd}
Rahul Maheshwari19faedf2018-08-29 00:42:09 -0500873 [Return] ${rc}