blob: d6f849f04e50867eaca70caa7be295c55bdc4278 [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
Rahul Maheshwari9ef85072018-12-06 05:10:44 -060040 Run IPMI Standard Command sel clear
George Keishing9acd2282018-09-07 07:21:41 -050041
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
Rahul Maheshwaric2157152018-10-03 07:31:06 -050094 [Teardown] Run Keywords FFDC On Test Case Fail
95 ... AND Run Inband IPMI Standard Command lan set 1 access on
Rahul Maheshwaridf6f05d2018-09-04 03:48:37 -050096
97 # Disable IPMI and verify
98 Run Inband IPMI Standard Command lan set 1 access off
99 Run Keyword and Expect Error *Unable to establish IPMI*
100 ... Run External IPMI Standard Command lan print
101
102 # Enable IPMI and verify
103 Run Inband IPMI Standard Command lan set 1 access on
104 ${lan_print_output}= Run External IPMI Standard Command lan print
105
106 ${openbmc_host_name} ${openbmc_ip} ${openbmc_short_name}=
107 ... Get Host Name IP host=${OPENBMC_HOST} short_name=1
108 Should Contain ${lan_print_output} ${openbmc_ip}
109
110
Rahul Maheshwari7e7d0882018-10-08 06:21:34 -0500111Verify Disabling IPMI Via OOB IPMI
112 [Documentation] Verify disabling IPMI via out of band IPMI.
113 [Tags] Verify_Disabling_IPMI_Via_OOB_IPMI
114 [Teardown] Run Inband IPMI Standard Command lan set 1 access on
115
116 # Disable IPMI via OOB IPMI and verify
117 Run Keyword and Expect Error *IPMI response is NULL*
118 ... Run IPMI Standard Command lan set 1 access off
119 Run Keyword and Expect Error *Unable to establish IPMI*
120 ... Run External IPMI Standard Command lan print
121
122 # Enable IPMI via Host and verify
123 Run Inband IPMI Standard Command lan set 1 access on
124 ${lan_print_output}= Run External IPMI Standard Command lan print
125
126 ${openbmc_host_name} ${openbmc_ip} ${openbmc_short_name}=
127 ... Get Host Name IP host=${OPENBMC_HOST} short_name=1
128 Should Contain ${lan_print_output} ${openbmc_ip}
129
130
Rahul Maheshwaric2157152018-10-03 07:31:06 -0500131Verify IPMI Disable Persistency After BMC Reboot
132 [Documentation] Verify IPMI disable persistency after BMC reboot.
133 [Tags] Verify_IPMI_Disable_Persistency_After_BMC_Reboot
134 [Teardown] Run Keywords FFDC On Test Case Fail
135 ... AND Run Inband IPMI Standard Command lan set 1 access on
136
137 # Disable IPMI and reboot BMC.
138 Run Inband IPMI Standard Command lan set 1 access off
139 OBMC Reboot (run)
140
141 # Verify that IPMI remains disabled after reboot.
142 Run Keyword and Expect Error *Unable to establish IPMI*
143 ... Run External IPMI Standard Command lan print
144
145
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500146Set Asset Tag With Valid String Length
147 [Documentation] Set asset tag with valid string length and verify.
148 [Tags] Set_Asset_Tag_With_Valid_String_Length
149
150 # Allowed MAX characters length for asset tag name is 63.
151 ${random_string}= Generate Random String 63
152 Run Keyword Run IPMI Standard Command dcmi set_asset_tag ${random_string}
153
154 ${asset_tag}= Run Keyword Run IPMI Standard Command dcmi asset_tag
155 Should Contain ${asset_tag} ${random_string}
156
157
158Set Asset Tag With Invalid String Length
159 [Documentation] Verify error while setting invalid asset tag via IPMI.
160 [Tags] Set_Asset_Tag_With_Invalid_String_Length
161
162 # Any string more than 63 character is invalid for asset tag.
163 ${random_string}= Generate Random String 64
164
165 ${resp}= Run Keyword And Expect Error * Run IPMI Standard Command
166 ... dcmi set_asset_tag ${random_string}
167 Should Contain ${resp} Parameter out of range ignore_case=True
168
169
170Set Asset Tag With Valid String Length Via REST
171 [Documentation] Set valid asset tag via REST and verify.
172 [Tags] Set_Asset_Tag_With_Valid_String_Length_Via_REST
173
174 ${random_string}= Generate Random String 63
175 ${args}= Create Dictionary data=${random_string}
176 Write Attribute /xyz/openbmc_project/inventory/system AssetTag
177 ... data=${args}
178
179 ${asset_tag}= Read Attribute /xyz/openbmc_project/inventory/system
180 ... AssetTag
181 Should Be Equal As Strings ${asset_tag} ${random_string}
182
Sweta Potthurif39022d2018-02-06 03:40:07 -0600183
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600184Verify Get And Set Management Controller ID String
185 [Documentation] Verify get and set management controller ID string.
186 [Tags] Verify_Get_And_Set_Management_Controller_ID_String
187
188 # Get the value of the managemment controller ID string.
189 # Example:
190 # Get Management Controller Identifier String: witherspoon
191
192 ${cmd_output}= Run IPMI Standard Command dcmi get_mc_id_string
193
194 # Extract management controller ID from cmd_output.
195 ${initial_mc_id}= Fetch From Right ${cmd_output} :${SPACE}
196
197 # Set the management controller ID string to other value.
198 # Example:
199 # Set Management Controller Identifier String Command: HOST
200
201 Set Management Controller ID String ${new_mc_id}
202
203 # Get the management controller ID and verify.
204 Get Management Controller ID String And Verify ${new_mc_id}
205
206 # Set the value back to the initial value and verify.
207 Set Management Controller ID String ${initial_mc_id}
208
209 # Get the management controller ID and verify.
210 Get Management Controller ID String And Verify ${initial_mc_id}
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500211
Sweta Potthurif39022d2018-02-06 03:40:07 -0600212
Rahul Maheshwari0eb33f02018-04-10 02:31:54 -0500213Test Management Controller ID String Status via IPMI
214 [Documentation] Test management controller ID string status via IPMI.
215 [Tags] Test_Management_Controller_ID_String_Status_via_IPMI
216
217 # Disable management controller ID string status via IPMI and verify.
218 Run IPMI Standard Command dcmi set_conf_param dhcp_config 0x00
219 Verify Management Controller ID String Status disable
220
221 # Enable management controller ID string status via IPMI and verify.
222 Run IPMI Standard Command dcmi set_conf_param dhcp_config 0x01
223 Verify Management Controller ID String Status enable
224
225
226Test Management Controller ID String Status via Raw IPMI
227 [Documentation] Test management controller ID string status via IPMI.
228 [Tags] Test_Management_Controller_ID_String_Status_via_Raw_IPMI
229
230 # Disable management controller ID string status via raw IPMI and verify.
231 Run IPMI Standard Command raw ${IPMI_RAW_CMD['conf_param']['Disabled'][0]}
232 Verify Management Controller ID String Status disable
233
234 # Enable management controller ID string status via raw IPMI and verify.
235 Run IPMI Standard Command raw ${IPMI_RAW_CMD['conf_param']['Enabled'][0]}
236 Verify Management Controller ID String Status enable
237
238
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600239Verify Chassis Identify via IPMI
240 [Documentation] Verify "chassis identify" using IPMI command.
241 [Tags] Verify_Chassis_Identify_via_IPMI
242
243 # Set to default "chassis identify" and verify that LED blinks for 15s.
244 Run IPMI Standard Command chassis identify
245 Verify Identify LED State Blink
246
247 Sleep 15s
248 Verify Identify LED State Off
249
250 # Set "chassis identify" to 10s and verify that the LED blinks for 10s.
251 Run IPMI Standard Command chassis identify 10
252 Verify Identify LED State Blink
253
254 Sleep 10s
255 Verify Identify LED State Off
256
Sweta Potthurif39022d2018-02-06 03:40:07 -0600257
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600258Verify Chassis Identify Off And Force Identify On via IPMI
259 [Documentation] Verify "chassis identify" off
260 ... and "force identify on" via IPMI.
261 [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI
262
263 # Set the LED to "Force Identify On".
264 Run IPMI Standard Command chassis identify force
265 Verify Identify LED State Blink
266
267 # Set "chassis identify" to 0 and verify that the LED turns off.
268 Run IPMI Standard Command chassis identify 0
269 Verify Identify LED State Off
270
Sweta Potthurif39022d2018-02-06 03:40:07 -0600271
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600272Test Watchdog Reset Via IPMI And Verify Using REST
273 [Documentation] Test watchdog reset via IPMI and verify using REST.
274 [Tags] Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST
275
276 Initiate Host Boot
277
278 Set Watchdog Enabled Using REST ${1}
279
280 Watchdog Object Should Exist
281
282 # Resetting the watchdog via IPMI.
283 Run IPMI Standard Command mc watchdog reset
284
285 # Verify the watchdog is reset using REST after an interval of 1000ms.
286 Sleep 1000ms
287 ${watchdog_time_left}=
288 ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining
289 Should Be True
290 ... ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000}
291 ... msg=Watchdog timer didn't reset.
292
Sweta Potthurif39022d2018-02-06 03:40:07 -0600293
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600294Test Watchdog Off Via IPMI And Verify Using REST
295 [Documentation] Test watchdog off via IPMI and verify using REST.
296 [Tags] Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST
297
298 Initiate Host Boot
299
300 Set Watchdog Enabled Using REST ${1}
301
302 Watchdog Object Should Exist
303
304 # Turn off the watchdog via IPMI.
305 Run IPMI Standard Command mc watchdog off
306
307 # Verify the watchdog is off using REST
308 ${watchdog_state}= Read Attribute ${HOST_WATCHDOG_URI} Enabled
309 Should Be Equal ${watchdog_state} ${0}
310 ... msg=msg=Verification failed for watchdog off check.
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600311
312
313Test Ambient Temperature Via IPMI
314 [Documentation] Test ambient temperature via IPMI and verify using REST.
315 [Tags] Test_Ambient_Temperature_Via_IPMI
316
317 # Entity ID Entity Instance Temp. Readings
318 # Inlet air temperature(40h) 1 +19 C
319 # CPU temperature sensors(41h) 5 +51 C
320 # CPU temperature sensors(41h) 6 +50 C
321 # CPU temperature sensors(41h) 7 +50 C
322 # CPU temperature sensors(41h) 8 +50 C
323 # CPU temperature sensors(41h) 9 +50 C
324 # CPU temperature sensors(41h) 10 +48 C
325 # CPU temperature sensors(41h) 11 +49 C
326 # CPU temperature sensors(41h) 12 +47 C
327 # CPU temperature sensors(41h) 8 +50 C
328 # CPU temperature sensors(41h) 16 +51 C
329 # CPU temperature sensors(41h) 24 +50 C
330 # CPU temperature sensors(41h) 32 +43 C
331 # CPU temperature sensors(41h) 40 +43 C
332 # Baseboard temperature sensors(42h) 1 +35 C
333
334 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
George Keishing77f1ad22018-07-23 12:39:28 -0500335 Should Contain ${temp_reading} Inlet air temperature
336 ... msg="Unable to get inlet temperature via DCMI".
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600337 ${ambient_temp_line}=
338 ... Get Lines Containing String ${temp_reading}
339 ... Inlet air temperature case-insensitive
340
341 ${ambient_temp_ipmi}= Fetch From Right ${ambient_temp_line} +
342 ${ambient_temp_ipmi}= Remove String ${ambient_temp_ipmi} ${SPACE}C
343
344 ${ambient_temp_rest}= Read Attribute
345 ... ${SENSORS_URI}temperature/ambient Value
346
347 # Example of ambient temperature via REST
348 # "CriticalAlarmHigh": 0,
349 # "CriticalAlarmLow": 0,
350 # "CriticalHigh": 35000,
351 # "CriticalLow": 0,
352 # "Scale": -3,
353 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
354 # "Value": 21775,
355 # "WarningAlarmHigh": 0,
356 # "WarningAlarmLow": 0,
357 # "WarningHigh": 25000,
358 # "WarningLow": 0
359
360 # Get temperature value based on scale i.e. Value * (10 power Scale Value)
361 # e.g. from above case 21775 * (10 power -3) = 21775/1000
362
363 ${ambient_temp_rest}= Evaluate ${ambient_temp_rest}/1000
364 ${ipmi_rest_temp_diff}=
365 ... Evaluate abs(${ambient_temp_rest} - ${ambient_temp_ipmi})
366
367 Should Be True ${ipmi_rest_temp_diff} <= ${allowed_temp_diff}
368 ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}.
369
370
Rahul Maheshwari43556632018-02-05 23:42:52 -0600371Verify Get DCMI Capabilities
372 [Documentation] Verify get DCMI capabilities command output.
373 [Tags] Verify_Get_DCMI_Capabilities
374
375 ${cmd_output}= Run IPMI Standard Command dcmi discover
376
377 @{supported_capabilities}= Create List
378 # Supported DCMI capabilities:
379 ... Mandatory platform capabilties
380 ... Optional platform capabilties
381 ... Power management available
382 ... Managebility access capabilties
383 ... In-band KCS channel available
384 # Mandatory platform attributes:
385 ... 200 SEL entries
386 ... SEL automatic rollover is enabled
387 # Optional Platform Attributes:
388 ... Slave address of device: 0h (8bits)(Satellite/External controller)
389 ... Channel number is 0h (Primary BMC)
390 ... Device revision is 0
391 # Manageability Access Attributes:
392 ... Primary LAN channel number: 1 is available
393 ... Secondary LAN channel is not available for OOB
394 ... No serial channel is available
395
396 :FOR ${capability} IN @{supported_capabilities}
397 \ Should Contain ${cmd_output} ${capability} ignore_case=True
398 ... msg=Supported DCMI capabilities not present.
399
400
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600401Test Power Reading Via IPMI With Host Off
402 [Documentation] Test power reading via IPMI with host off state and
403 ... verify using REST.
404 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Off
Rahul Maheshwari615da152018-02-13 23:53:36 -0600405
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600406 REST Power Off stack_mode=skip quiet=1
Rahul Maheshwari615da152018-02-13 23:53:36 -0600407
George Keishing04bf06c2018-10-05 08:28:50 -0500408 Wait Until Keyword Succeeds 1 min 30 sec Verify Power Reading
George Keishinge78f1fd2018-09-04 13:34:59 -0500409
410
411Test Power Reading Via IPMI With Host Booted
412 [Documentation] Test power reading via IPMI with host booted state and
413 ... verify using REST.
414 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted
415
416 REST Power On stack_mode=skip quiet=1
417
418 # For a good power reading take a 3 samples for 15 seconds interval and
419 # average it out.
420
George Keishing04bf06c2018-10-05 08:28:50 -0500421 Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading
Rahul Maheshwari615da152018-02-13 23:53:36 -0600422
423
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600424Test Power Reading Via IPMI Raw Command
425 [Documentation] Test power reading via IPMI raw command and verify
426 ... using REST.
427 [Tags] Test_Power_Reading_Via_IPMI_Raw_Command
428
429 # Response data structure of power reading command output via IPMI.
430 # 1 Completion Code. Refer to section 8, DCMI Completion Codes.
431 # 2 Group Extension Identification = DCh
432 # 3:4 Current Power in watts
433
George Keishinge78f1fd2018-09-04 13:34:59 -0500434 REST Power On stack_mode=skip quiet=1
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600435
George Keishing04bf06c2018-10-05 08:28:50 -0500436 Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading Via Raw Command
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600437
438
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600439Test Baseboard Temperature Via IPMI
440 [Documentation] Test baseboard temperature via IPMI and verify using REST.
441 [Tags] Test_Baseboard_Temperature_Via_IPMI
442
443 # Example of IPMI dcmi get_temp_reading output:
444 # Entity ID Entity Instance Temp. Readings
445 # Inlet air temperature(40h) 1 +19 C
446 # CPU temperature sensors(41h) 5 +51 C
447 # CPU temperature sensors(41h) 6 +50 C
448 # CPU temperature sensors(41h) 7 +50 C
449 # CPU temperature sensors(41h) 8 +50 C
450 # CPU temperature sensors(41h) 9 +50 C
451 # CPU temperature sensors(41h) 10 +48 C
452 # CPU temperature sensors(41h) 11 +49 C
453 # CPU temperature sensors(41h) 12 +47 C
454 # CPU temperature sensors(41h) 8 +50 C
455 # CPU temperature sensors(41h) 16 +51 C
456 # CPU temperature sensors(41h) 24 +50 C
457 # CPU temperature sensors(41h) 32 +43 C
458 # CPU temperature sensors(41h) 40 +43 C
459 # Baseboard temperature sensors(42h) 1 +35 C
460
461 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
George Keishing77f1ad22018-07-23 12:39:28 -0500462 Should Contain ${temp_reading} Baseboard temperature sensors
463 ... msg="Unable to get baseboard temperature via DCMI".
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600464 ${baseboard_temp_line}=
465 ... Get Lines Containing String ${temp_reading}
466 ... Baseboard temperature case-insensitive=True
467
468 ${baseboard_temp_ipmi}= Fetch From Right ${baseboard_temp_line} +
469 ${baseboard_temp_ipmi}= Remove String ${baseboard_temp_ipmi} ${SPACE}C
470
471 ${baseboard_temp_rest}= Read Attribute
472 ... /xyz/openbmc_project/sensors/temperature/pcie Value
473 ${baseboard_temp_rest}= Evaluate ${baseboard_temp_rest}/1000
474
475 Should Be True
476 ... ${baseboard_temp_rest} - ${baseboard_temp_ipmi} <= ${allowed_temp_diff}
477 ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}.
478
479
Sweta Potthurif39022d2018-02-06 03:40:07 -0600480Retrieve Default Gateway Via IPMI And Verify Using REST
481 [Documentation] Retrieve default gateway from LAN print using IPMI.
482 [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify_Using_REST
483
484 # Fetch "Default Gateway" from IPMI LAN print.
485 ${default_gateway_ipmi}= Fetch Details From LAN Print Default Gateway IP
486
487 # Verify "Default Gateway" using REST.
488 Read Attribute ${NETWORK_MANAGER}/config DefaultGateway
489 ... expected_value=${default_gateway_ipmi}
490
491
492Retrieve MAC Address Via IPMI And Verify Using REST
493 [Documentation] Retrieve MAC Address from LAN print using IPMI.
494 [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_REST
495
496 # Fetch "MAC Address" from IPMI LAN print.
497 ${mac_address_ipmi}= Fetch Details From LAN Print MAC Address
498
499 # Verify "MAC Address" using REST.
500 ${mac_address_rest}= Get BMC MAC Address
501 Should Be Equal ${mac_address_ipmi} ${mac_address_rest}
502 ... msg=Verification of MAC address from lan print using IPMI failed.
503
504
505Retrieve Network Mode Via IPMI And Verify Using REST
506 [Documentation] Retrieve network mode from LAN print using IPMI.
507 [Tags] Retrieve_Network_Mode_Via_IPMI_And_Verify_Using_REST
508
509 # Fetch "Mode" from IPMI LAN print.
510 ${network_mode_ipmi}= Fetch Details From LAN Print Source
511
512 # Verify "Mode" using REST.
513 ${network_mode_rest}= Read Attribute
514 ... ${NETWORK_MANAGER}/eth0 DHCPEnabled
515 Run Keyword If '${network_mode_ipmi}' == 'Static Address'
516 ... Should Be Equal ${network_mode_rest} ${0}
517 ... msg=Verification of network setting failed.
518 ... ELSE IF '${network_mode_ipmi}' == 'DHCP'
519 ... Should Be Equal ${network_mode_rest} ${1}
520 ... msg=Verification of network setting failed.
521
522
523Retrieve IP Address Via IPMI And Verify With BMC Details
524 [Documentation] Retrieve IP address from LAN print using IPMI.
525 [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_With_BMC_Details
526
527 # Fetch "IP Address" from IPMI LAN print.
528 ${ip_addr_ipmi}= Fetch Details From LAN Print IP Address
529
530 # Verify the IP address retrieved via IPMI with BMC IPs.
531 ${ip_address_rest}= Get BMC IP Info
532 Validate IP On BMC ${ip_addr_ipmi} ${ip_address_rest}
533
534
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600535Verify Get Device ID
536 [Documentation] Verify get device ID command output.
537 [Tags] Verify_Get_Device_ID
538
539 # Example of get device ID command output:
540 # Device ID : 0
541 # Device Revision : 0
542 # Firmware Revision : 2.01
543 # IPMI Version : 2.0
544 # Manufacturer ID : 42817
545 # Manufacturer Name : Unknown (0xA741)
546 # Product ID : 16975 (0x424f)
547 # Product Name : Unknown (0x424F)
548 # Device Available : yes
549 # Provides Device SDRs : yes
550 # Additional Device Support :
551 # Sensor Device
552 # SEL Device
553 # FRU Inventory Device
554 # Chassis Device
555 # Aux Firmware Rev Info :
George Keishing3511a3f2018-04-19 10:38:30 -0500556 # 0x04
557 # 0x38
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600558 # 0x00
George Keishing3511a3f2018-04-19 10:38:30 -0500559 # 0x03
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600560
561 ${mc_info}= Get MC Info
562
563 Should Be Equal ${mc_info['device_id']} 0
564 Should Be Equal ${mc_info['device_revision']} 0
565
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500566 # Get firmware revision from mc info command output i.e. 2.01
567 ${ipmi_fw_major_version} ${ipmi_fw_minor_version}=
568 ... Split String ${mc_info['firmware_revision']} .
569 # Convert minor firmware version from BCD format to integer. i.e. 01 to 1
570 ${ipmi_fw_minor_version}= Convert To Integer ${ipmi_fw_minor_version}
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600571
George Keishinge0a81282018-06-08 10:02:30 -0500572 # Get BMC version from BMC CLI i.e. 2.2 from "v2.2-253-g00050f1"
George Keishing3511a3f2018-04-19 10:38:30 -0500573 ${bmc_version_full}= Get BMC Version
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500574 ${bmc_version}=
George Keishing3511a3f2018-04-19 10:38:30 -0500575 ... Remove String Using Regexp ${bmc_version_full} ^[^0-9]+ [^0-9\.].*
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500576
577 # Get major and minor version from BMC version i.e. 2 and 1 from 2.1
578 ${bmc_major_version} ${bmc_minor_version}=
579 ... Split String ${bmc_version} .
580
581 Should Be Equal As Strings ${ipmi_fw_major_version} ${bmc_major_version}
582 ... msg=Major version mis-match.
583 Should Be Equal As Strings ${ipmi_fw_minor_version} ${bmc_minor_version}
584 ... msg=Minor version mis-match.
585
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600586 Should Be Equal ${mc_info['ipmi_version']} 2.0
587
Gunnar Mills917ba1a2018-04-08 16:42:12 -0500588 # TODO: Verify Manufacturer and Product IDs directly from json file.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600589 # Reference : openbmc/openbmc-test-automation#1244
590 Should Be Equal ${mc_info['manufacturer_id']} 42817
591 Should Be Equal ${mc_info['product_id']} 16975 (0x424f)
592
593 Should Be Equal ${mc_info['device_available']} yes
594 Should Be Equal ${mc_info['provides_device_sdrs']} yes
595 Should Contain ${mc_info['additional_device_support']} Sensor Device
596 Should Contain ${mc_info['additional_device_support']} SEL Device
597 Should Contain
598 ... ${mc_info['additional_device_support']} FRU Inventory Device
599 Should Contain ${mc_info['additional_device_support']} Chassis Device
George Keishingb746d3f2018-04-19 10:53:10 -0500600
George Keishing3511a3f2018-04-19 10:38:30 -0500601 # Auxiliary revision data verification.
602 ${aux_version}= Get Aux Version ${bmc_version_full}
603
604 # From aux_firmware_rev_info field ['0x04', '0x38', '0x00', '0x03']
605 ${bmc_aux_version}= Catenate
606 ... SEPARATOR=
607 ... ${mc_info['aux_firmware_rev_info'][0][2:]}
608 ... ${mc_info['aux_firmware_rev_info'][1][2:]}
609 ... ${mc_info['aux_firmware_rev_info'][2][2:]}
610 ... ${mc_info['aux_firmware_rev_info'][3][2:]}
611
612 Should Be Equal As Integers
613 ... ${bmc_aux_version} ${aux_version}
614 ... msg=BMC aux version ${bmc_aux_version} does not match expected value of ${aux_version}.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600615
616
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500617Verify SDR Info
618 [Documentation] Verify sdr info command output.
619 [Tags] Verify_SDR_Info
620
621 # Example of SDR info command output:
622 # SDR Version : 0x51
623 # Record Count : 216
624 # Free Space : unspecified
625 # Most recent Addition :
626 # Most recent Erase :
627 # SDR overflow : no
628 # SDR Repository Update Support : unspecified
629 # Delete SDR supported : no
630 # Partial Add SDR supported : no
631 # Reserve SDR repository supported : no
632 # SDR Repository Alloc info supported : no
633
634 ${sdr_info}= Get SDR Info
635 Should Be Equal ${sdr_info['sdr_version']} 0x51
636
637 # Get sensor count from "sdr elist all" command output.
638 ${sensor_count}= Get Sensor Count
639 Should Be Equal As Strings
640 ... ${sdr_info['record_count']} ${sensor_count}
641
642 Should Be Equal ${sdr_info['free_space']} unspecified
643 Should Be Equal ${sdr_info['most_recent_addition']} ${EMPTY}
644 Should Be Equal ${sdr_info['most_recent_erase']} ${EMPTY}
645 Should Be Equal ${sdr_info['sdr_overflow']} no
646 Should Be Equal ${sdr_info['sdr_repository_update_support']} unspecified
647 Should Be Equal ${sdr_info['delete_sdr_supported']} no
648 Should Be Equal ${sdr_info['partial_add_sdr_supported']} no
649 Should Be Equal ${sdr_info['reserve_sdr_repository_supported']} no
650 Should Be Equal ${sdr_info['sdr_repository_alloc_info_supported']} no
651
652
George Keishing02651f02018-04-11 02:07:16 -0500653Test Valid IPMI Channels Supported
654 [Documentation] Verify IPMI channels supported on a given system.
655 [Tags] Test_Valid_IPMI_Channels_Supported
656
657 ${channel_count}= Get Physical Network Interface Count
658
659 # Note: IPMI network channel logically starts from 1.
660 :FOR ${channel_number} IN RANGE 1 ${channel_count}
661 \ Run External IPMI Standard Command lan print ${channel_number}
662
663
664Test Invalid IPMI Channel Response
665 [Documentation] Verify invalid IPMI channels supported response.
666 [Tags] Test_Invalid_IPMI_Channel_Response
667
668 ${channel_count}= Get Physical Network Interface Count
669
670 # To target invalid channel, increment count.
671 ${channel_number}= Evaluate ${channel_count} + 1
672
673 # Example of invalid channel:
George Keishing72d0ac82018-09-20 09:33:01 -0500674 # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3
George Keishing02651f02018-04-11 02:07:16 -0500675 # Get Channel Info command failed: Parameter out of range
676 # Invalid channel: 3
677
678 ${stdout}= Run External IPMI Standard Command
679 ... lan print ${channel_number} fail_on_err=${0}
680 Should Contain ${stdout} Invalid channel
681 ... msg=IPMI channel ${channel_number} is invalid but seen working.
682
683
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500684*** Keywords ***
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600685
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500686Get Sensor Count
687 [Documentation] Get sensors count using "sdr elist all" command.
688
689 # Example of "sdr elist all" command output:
690 # BootProgress | 03h | ok | 34.2 |
691 # OperatingSystemS | 05h | ok | 35.1 |
692 # AttemptsLeft | 07h | ok | 34.1 |
693 # occ0 | 08h | ok | 210.1 | Device Disabled
694 # occ1 | 09h | ok | 210.2 | Device Disabled
695 # p0_core0_temp | 11h | ns | 3.1 | Disabled
696 # cpu0_core0 | 12h | ok | 208.1 | Presence detected
697 # p0_core1_temp | 14h | ns | 3.2 | Disabled
698 # cpu0_core1 | 15h | ok | 208.2 | Presence detected
699 # p0_core2_temp | 17h | ns | 3.3 | Disabled
700 # ..
701 # ..
702 # ..
703 # ..
704 # ..
705 # ..
706 # fan3 | 00h | ns | 29.4 | Logical FRU @35h
707 # bmc | 00h | ns | 6.1 | Logical FRU @3Ch
708 # ethernet | 00h | ns | 1.1 | Logical FRU @46h
709
710 ${output}= Run IPMI Standard Command sdr elist all
711 ${sensor_list}= Split String ${output} \n
712 ${sensor_count}= Get Length ${sensor_list}
713 [Return] ${sensor_count}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600714
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600715Set Management Controller ID String
716 [Documentation] Set the management controller ID string.
717 [Arguments] ${string}
718
719 # Description of argument(s):
720 # string Management Controller ID String to be set
721
722 ${set_mc_id_string}= Run IPMI Standard Command
723 ... dcmi set_mc_id_string ${string}
724
Sweta Potthurif39022d2018-02-06 03:40:07 -0600725
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600726Get Management Controller ID String And Verify
George Keishingcb3b9b62018-09-14 12:11:19 -0500727 [Documentation] Get the management controller ID string.
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600728 [Arguments] ${string}
729
730 # Description of argument(s):
731 # string Management Controller ID string
732
733 ${get_mc_id}= Run IPMI Standard Command dcmi get_mc_id_string
734 Should Contain ${get_mc_id} ${string}
735 ... msg=Command failed: get_mc_id.
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600736
Sweta Potthurif39022d2018-02-06 03:40:07 -0600737
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600738Set Watchdog Enabled Using REST
739 [Documentation] Set watchdog Enabled field using REST.
740 [Arguments] ${value}
741
742 # Description of argument(s):
743 # value Integer value (eg. "0-Disabled", "1-Enabled").
744
745 ${value_dict}= Create Dictionary data=${value}
746 ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}/attr/Enabled
747 ... data=${value_dict}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600748
749
Sweta Potthurif39022d2018-02-06 03:40:07 -0600750Fetch Details From LAN Print
751 [Documentation] Fetch details from LAN print.
752 [Arguments] ${field_name}
753
754 # Description of argument(s):
755 # ${field_name} Field name to be fetched from LAN print
756 # (e.g. "MAC Address", "Source").
757
Sweta Potthuric64322a2018-02-22 05:30:30 -0600758 ${stdout}= Run External IPMI Standard Command lan print
Sweta Potthurif39022d2018-02-06 03:40:07 -0600759 ${fetch_value}= Get Lines Containing String ${stdout} ${field_name}
760 ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE}
761 [Return] ${value_fetch}
762
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600763
764Verify Power Reading
765 [Documentation] Get dcmi power reading via IPMI.
766
767 # Example of power reading command output via IPMI.
768 # Instantaneous power reading: 235 Watts
769 # Minimum during sampling period: 235 Watts
770 # Maximum during sampling period: 235 Watts
771 # Average power reading over sample period: 235 Watts
772 # IPMI timestamp: Thu Jan 1 00:00:00 1970
773 # Sampling period: 00000000 Seconds.
774 # Power reading state is: deactivated
775
776 ${power_reading}= Get IPMI Power Reading
777
778 ${host_state}= Get Host State
779 Run Keyword If '${host_state}' == 'Off'
George Keishing51314872018-03-31 13:24:35 -0500780 ... Should Be Equal ${power_reading['instantaneous_power_reading']} 0
781 ... msg=Power reading not zero when power is off.
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600782
George Keishing51314872018-03-31 13:24:35 -0500783 Run Keyword If '${power_reading['instantaneous_power_reading']}' != '0'
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600784 ... Verify Power Reading Using REST ${power_reading['instantaneous_power_reading']}
785
786
George Keishinge78f1fd2018-09-04 13:34:59 -0500787Verify Power Reading Via Raw Command
788 [Documentation] Get dcmi power reading via IPMI raw command.
789
790 ${ipmi_raw_output}= Run IPMI Standard Command
791 ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]}
792
793 @{raw_output_list}= Split String ${ipmi_raw_output} ${SPACE}
794
795 # On successful execution of raw IPMI power reading command, completion
796 # code does not come in output. So current power value will start from 2
797 # byte instead of 3.
798
799 ${power_reading_ipmi_raw_3_item}= Get From List ${raw_output_list} 2
800 ${power_reading_ipmi_raw_3_item}=
801 ... Convert To Integer 0x${power_reading_ipmi_raw_3_item}
802
803 ${power_reading_rest}= Read Attribute
804 ... ${SENSORS_URI}power/total_power Value
805
806 # Example of power reading via REST
807 # "CriticalAlarmHigh": 0,
808 # "CriticalAlarmLow": 0,
809 # "CriticalHigh": 3100000000,
810 # "CriticalLow": 0,
811 # "Scale": -6,
812 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
813 # "Value": 228000000,
814 # "WarningAlarmHigh": 0,
815 # "WarningAlarmLow": 0,
816 # "WarningHigh": 3050000000,
817 # "WarningLow": 0
818
819 # Get power value based on scale i.e. Value * (10 power Scale Value)
820 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
821
822 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
823 ${ipmi_rest_power_diff}=
824 ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi_raw_3_item})
825
826 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
827 ... msg=Power Reading above allowed threshold ${allowed_power_diff}.
828
829
Rahul Maheshwari0eb33f02018-04-10 02:31:54 -0500830Verify Management Controller ID String Status
831 [Documentation] Verify management controller ID string status via IPMI.
832 [Arguments] ${status}
833
834 # Example of dcmi get_conf_param command output:
835 # DHCP Discovery method :
836 # Management Controller ID String is disabled
837 # Vendor class identifier DCMI IANA and Vendor class-specific Informationa are disabled
838 # Initial timeout interval : 4 seconds
839 # Server contact timeout interval : 120 seconds
840 # Server contact retry interval : 64 seconds
841
842 ${resp}= Run IPMI Standard Command dcmi get_conf_param
843 ${resp}= Get Lines Containing String ${resp}
844 ... Management Controller ID String case_insensitive=True
845 Should Contain ${resp} ${status}
846 ... msg=Management controller ID string is not ${status}
847
848
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600849Verify Power Reading Using REST
850 [Documentation] Verify power reading using REST.
851 [Arguments] ${power_reading}
852
Gunnar Mills948e2e22018-03-23 12:54:27 -0500853 # Description of argument(s):
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600854 # power_reading IPMI Power reading
855
856 ${power_reading_rest}= Read Attribute
857 ... ${SENSORS_URI}power/total_power Value
858
859 # Example of power reading via REST
860 # "CriticalAlarmHigh": 0,
861 # "CriticalAlarmLow": 0,
862 # "CriticalHigh": 3100000000,
863 # "CriticalLow": 0,
864 # "Scale": -6,
865 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
866 # "Value": 228000000,
867 # "WarningAlarmHigh": 0,
868 # "WarningAlarmLow": 0,
869 # "WarningHigh": 3050000000,
870 # "WarningLow": 0
871
872 # Get power value based on scale i.e. Value * (10 power Scale Value)
873 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
874 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
875 ${ipmi_rest_power_diff}=
876 ... Evaluate abs(${power_reading_rest} - ${power_reading})
877
878 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
879 ... msg=Power reading above allowed threshold ${allowed_power_diff}.
George Keishing02651f02018-04-11 02:07:16 -0500880
881
882Get Physical Network Interface Count
883 [Documentation] Return valid physical network interfaces count.
884
885 # Example:
886 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
887 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
888
889 ${mac_entry_list}= Get BMC MAC Address List
890 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
891 ${physical_interface_count}= Get Length ${mac_unique_list}
892
893 [Return] ${physical_interface_count}
George Keishing39967eb2018-04-30 11:36:23 -0500894
895
896Execute IPMI Command With Cipher
897 [Documentation] Execute IPMI command with a given cipher level value.
898 [Arguments] ${cipher_level}
899
900 # Description of argument(s):
901 # cipher_level IPMI chipher level value
902 # (e.g. "1", "2", "3", "15", "16", "17").
903
904 ${ipmi_cmd}= Catenate SEPARATOR=
905 ... ipmitool -I lanplus -C ${cipher_level} -P${SPACE}${IPMI_PASSWORD}
906 ... ${SPACE}${HOST}${SPACE}${OPENBMC_HOST}${SPACE}mc info
907
908 ${rc} ${output}= Run And Return RC and Output ${ipmi_cmd}
Rahul Maheshwari19faedf2018-08-29 00:42:09 -0500909 [Return] ${rc}