blob: 63599e1c1bdbaef072727edc9541d8322ea93772 [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}
George Keishingf4027652019-01-10 23:58:29 -060052 \ Should Be Equal ${status} ${True}
Rahul Maheshwari19faedf2018-08-29 00:42:09 -050053
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}
George Keishingf4027652019-01-10 23:58:29 -060061 \ Should Be Equal ${status} ${False}
Rahul Maheshwari19faedf2018-08-29 00:42:09 -050062
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.
Steven Sombara8800da2018-12-18 16:19:05 -0600488 Read Attribute ${NETWORK_MANAGER}config DefaultGateway
Sweta Potthurif39022d2018-02-06 03:40:07 -0600489 ... 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
Steven Sombara8800da2018-12-18 16:19:05 -0600514 ... ${NETWORK_MANAGER}eth0 DHCPEnabled
Sweta Potthurif39022d2018-02-06 03:40:07 -0600515 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
George Keishingc95e9982019-01-14 09:27:45 -0600578 @{major_minor_version}= Split String ${bmc_version} .
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500579
George Keishingc95e9982019-01-14 09:27:45 -0600580 Should Be Equal As Strings ${ipmi_fw_major_version} ${major_minor_version[0]}
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500581 ... msg=Major version mis-match.
George Keishingc95e9982019-01-14 09:27:45 -0600582 Should Be Equal As Strings ${ipmi_fw_minor_version} ${major_minor_version[1]}
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500583 ... msg=Minor version mis-match.
584
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600585 Should Be Equal ${mc_info['ipmi_version']} 2.0
586
Gunnar Mills917ba1a2018-04-08 16:42:12 -0500587 # TODO: Verify Manufacturer and Product IDs directly from json file.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600588 # Reference : openbmc/openbmc-test-automation#1244
589 Should Be Equal ${mc_info['manufacturer_id']} 42817
590 Should Be Equal ${mc_info['product_id']} 16975 (0x424f)
591
592 Should Be Equal ${mc_info['device_available']} yes
593 Should Be Equal ${mc_info['provides_device_sdrs']} yes
594 Should Contain ${mc_info['additional_device_support']} Sensor Device
595 Should Contain ${mc_info['additional_device_support']} SEL Device
596 Should Contain
597 ... ${mc_info['additional_device_support']} FRU Inventory Device
598 Should Contain ${mc_info['additional_device_support']} Chassis Device
George Keishingb746d3f2018-04-19 10:53:10 -0500599
George Keishing3511a3f2018-04-19 10:38:30 -0500600 # Auxiliary revision data verification.
601 ${aux_version}= Get Aux Version ${bmc_version_full}
602
603 # From aux_firmware_rev_info field ['0x04', '0x38', '0x00', '0x03']
604 ${bmc_aux_version}= Catenate
605 ... SEPARATOR=
606 ... ${mc_info['aux_firmware_rev_info'][0][2:]}
607 ... ${mc_info['aux_firmware_rev_info'][1][2:]}
608 ... ${mc_info['aux_firmware_rev_info'][2][2:]}
609 ... ${mc_info['aux_firmware_rev_info'][3][2:]}
610
611 Should Be Equal As Integers
612 ... ${bmc_aux_version} ${aux_version}
613 ... msg=BMC aux version ${bmc_aux_version} does not match expected value of ${aux_version}.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600614
615
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500616Verify SDR Info
617 [Documentation] Verify sdr info command output.
618 [Tags] Verify_SDR_Info
619
620 # Example of SDR info command output:
621 # SDR Version : 0x51
622 # Record Count : 216
623 # Free Space : unspecified
624 # Most recent Addition :
625 # Most recent Erase :
626 # SDR overflow : no
627 # SDR Repository Update Support : unspecified
628 # Delete SDR supported : no
629 # Partial Add SDR supported : no
630 # Reserve SDR repository supported : no
631 # SDR Repository Alloc info supported : no
632
633 ${sdr_info}= Get SDR Info
634 Should Be Equal ${sdr_info['sdr_version']} 0x51
635
636 # Get sensor count from "sdr elist all" command output.
637 ${sensor_count}= Get Sensor Count
638 Should Be Equal As Strings
639 ... ${sdr_info['record_count']} ${sensor_count}
640
641 Should Be Equal ${sdr_info['free_space']} unspecified
642 Should Be Equal ${sdr_info['most_recent_addition']} ${EMPTY}
643 Should Be Equal ${sdr_info['most_recent_erase']} ${EMPTY}
644 Should Be Equal ${sdr_info['sdr_overflow']} no
645 Should Be Equal ${sdr_info['sdr_repository_update_support']} unspecified
646 Should Be Equal ${sdr_info['delete_sdr_supported']} no
647 Should Be Equal ${sdr_info['partial_add_sdr_supported']} no
648 Should Be Equal ${sdr_info['reserve_sdr_repository_supported']} no
649 Should Be Equal ${sdr_info['sdr_repository_alloc_info_supported']} no
650
651
George Keishing02651f02018-04-11 02:07:16 -0500652Test Valid IPMI Channels Supported
653 [Documentation] Verify IPMI channels supported on a given system.
654 [Tags] Test_Valid_IPMI_Channels_Supported
655
656 ${channel_count}= Get Physical Network Interface Count
657
658 # Note: IPMI network channel logically starts from 1.
659 :FOR ${channel_number} IN RANGE 1 ${channel_count}
Rahul Maheshwari20f3bf72018-12-18 04:24:20 -0600660 \ Run IPMI Standard Command lan print ${channel_number}
George Keishing02651f02018-04-11 02:07:16 -0500661
662
663Test Invalid IPMI Channel Response
664 [Documentation] Verify invalid IPMI channels supported response.
665 [Tags] Test_Invalid_IPMI_Channel_Response
666
667 ${channel_count}= Get Physical Network Interface Count
668
669 # To target invalid channel, increment count.
670 ${channel_number}= Evaluate ${channel_count} + 1
671
672 # Example of invalid channel:
George Keishing72d0ac82018-09-20 09:33:01 -0500673 # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3
George Keishing02651f02018-04-11 02:07:16 -0500674 # Get Channel Info command failed: Parameter out of range
675 # Invalid channel: 3
676
677 ${stdout}= Run External IPMI Standard Command
678 ... lan print ${channel_number} fail_on_err=${0}
679 Should Contain ${stdout} Invalid channel
680 ... msg=IPMI channel ${channel_number} is invalid but seen working.
681
682
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500683*** Keywords ***
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600684
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500685Get Sensor Count
686 [Documentation] Get sensors count using "sdr elist all" command.
687
688 # Example of "sdr elist all" command output:
689 # BootProgress | 03h | ok | 34.2 |
690 # OperatingSystemS | 05h | ok | 35.1 |
691 # AttemptsLeft | 07h | ok | 34.1 |
692 # occ0 | 08h | ok | 210.1 | Device Disabled
693 # occ1 | 09h | ok | 210.2 | Device Disabled
694 # p0_core0_temp | 11h | ns | 3.1 | Disabled
695 # cpu0_core0 | 12h | ok | 208.1 | Presence detected
696 # p0_core1_temp | 14h | ns | 3.2 | Disabled
697 # cpu0_core1 | 15h | ok | 208.2 | Presence detected
698 # p0_core2_temp | 17h | ns | 3.3 | Disabled
699 # ..
700 # ..
701 # ..
702 # ..
703 # ..
704 # ..
705 # fan3 | 00h | ns | 29.4 | Logical FRU @35h
706 # bmc | 00h | ns | 6.1 | Logical FRU @3Ch
707 # ethernet | 00h | ns | 1.1 | Logical FRU @46h
708
709 ${output}= Run IPMI Standard Command sdr elist all
710 ${sensor_list}= Split String ${output} \n
711 ${sensor_count}= Get Length ${sensor_list}
712 [Return] ${sensor_count}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600713
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600714Set Management Controller ID String
715 [Documentation] Set the management controller ID string.
716 [Arguments] ${string}
717
718 # Description of argument(s):
719 # string Management Controller ID String to be set
720
721 ${set_mc_id_string}= Run IPMI Standard Command
722 ... dcmi set_mc_id_string ${string}
723
Sweta Potthurif39022d2018-02-06 03:40:07 -0600724
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600725Get Management Controller ID String And Verify
George Keishingcb3b9b62018-09-14 12:11:19 -0500726 [Documentation] Get the management controller ID string.
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600727 [Arguments] ${string}
728
729 # Description of argument(s):
730 # string Management Controller ID string
731
732 ${get_mc_id}= Run IPMI Standard Command dcmi get_mc_id_string
733 Should Contain ${get_mc_id} ${string}
734 ... msg=Command failed: get_mc_id.
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600735
Sweta Potthurif39022d2018-02-06 03:40:07 -0600736
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600737Set Watchdog Enabled Using REST
738 [Documentation] Set watchdog Enabled field using REST.
739 [Arguments] ${value}
740
741 # Description of argument(s):
742 # value Integer value (eg. "0-Disabled", "1-Enabled").
743
744 ${value_dict}= Create Dictionary data=${value}
Steven Sombaraaaab222018-12-19 13:16:23 -0600745 ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}attr/Enabled
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600746 ... data=${value_dict}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600747
748
Sweta Potthurif39022d2018-02-06 03:40:07 -0600749Fetch Details From LAN Print
750 [Documentation] Fetch details from LAN print.
751 [Arguments] ${field_name}
752
753 # Description of argument(s):
754 # ${field_name} Field name to be fetched from LAN print
755 # (e.g. "MAC Address", "Source").
756
Rahul Maheshwarid8037d32018-12-17 00:59:57 -0600757 ${stdout}= Run IPMI Standard Command lan print
Sweta Potthurif39022d2018-02-06 03:40:07 -0600758 ${fetch_value}= Get Lines Containing String ${stdout} ${field_name}
759 ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE}
760 [Return] ${value_fetch}
761
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600762
763Verify Power Reading
764 [Documentation] Get dcmi power reading via IPMI.
765
766 # Example of power reading command output via IPMI.
767 # Instantaneous power reading: 235 Watts
768 # Minimum during sampling period: 235 Watts
769 # Maximum during sampling period: 235 Watts
770 # Average power reading over sample period: 235 Watts
771 # IPMI timestamp: Thu Jan 1 00:00:00 1970
772 # Sampling period: 00000000 Seconds.
773 # Power reading state is: deactivated
774
775 ${power_reading}= Get IPMI Power Reading
776
777 ${host_state}= Get Host State
778 Run Keyword If '${host_state}' == 'Off'
George Keishing51314872018-03-31 13:24:35 -0500779 ... Should Be Equal ${power_reading['instantaneous_power_reading']} 0
780 ... msg=Power reading not zero when power is off.
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600781
George Keishing51314872018-03-31 13:24:35 -0500782 Run Keyword If '${power_reading['instantaneous_power_reading']}' != '0'
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600783 ... Verify Power Reading Using REST ${power_reading['instantaneous_power_reading']}
784
785
George Keishinge78f1fd2018-09-04 13:34:59 -0500786Verify Power Reading Via Raw Command
787 [Documentation] Get dcmi power reading via IPMI raw command.
788
789 ${ipmi_raw_output}= Run IPMI Standard Command
790 ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]}
791
792 @{raw_output_list}= Split String ${ipmi_raw_output} ${SPACE}
793
794 # On successful execution of raw IPMI power reading command, completion
795 # code does not come in output. So current power value will start from 2
796 # byte instead of 3.
797
798 ${power_reading_ipmi_raw_3_item}= Get From List ${raw_output_list} 2
799 ${power_reading_ipmi_raw_3_item}=
800 ... Convert To Integer 0x${power_reading_ipmi_raw_3_item}
801
802 ${power_reading_rest}= Read Attribute
803 ... ${SENSORS_URI}power/total_power Value
804
805 # Example of power reading via REST
806 # "CriticalAlarmHigh": 0,
807 # "CriticalAlarmLow": 0,
808 # "CriticalHigh": 3100000000,
809 # "CriticalLow": 0,
810 # "Scale": -6,
811 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
812 # "Value": 228000000,
813 # "WarningAlarmHigh": 0,
814 # "WarningAlarmLow": 0,
815 # "WarningHigh": 3050000000,
816 # "WarningLow": 0
817
818 # Get power value based on scale i.e. Value * (10 power Scale Value)
819 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
820
821 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
822 ${ipmi_rest_power_diff}=
823 ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi_raw_3_item})
824
825 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
826 ... msg=Power Reading above allowed threshold ${allowed_power_diff}.
827
828
Rahul Maheshwari0eb33f02018-04-10 02:31:54 -0500829Verify Management Controller ID String Status
830 [Documentation] Verify management controller ID string status via IPMI.
831 [Arguments] ${status}
832
833 # Example of dcmi get_conf_param command output:
834 # DHCP Discovery method :
835 # Management Controller ID String is disabled
836 # Vendor class identifier DCMI IANA and Vendor class-specific Informationa are disabled
837 # Initial timeout interval : 4 seconds
838 # Server contact timeout interval : 120 seconds
839 # Server contact retry interval : 64 seconds
840
841 ${resp}= Run IPMI Standard Command dcmi get_conf_param
842 ${resp}= Get Lines Containing String ${resp}
843 ... Management Controller ID String case_insensitive=True
844 Should Contain ${resp} ${status}
845 ... msg=Management controller ID string is not ${status}
846
847
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600848Verify Power Reading Using REST
849 [Documentation] Verify power reading using REST.
850 [Arguments] ${power_reading}
851
Gunnar Mills948e2e22018-03-23 12:54:27 -0500852 # Description of argument(s):
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600853 # power_reading IPMI Power reading
854
855 ${power_reading_rest}= Read Attribute
856 ... ${SENSORS_URI}power/total_power Value
857
858 # Example of power reading via REST
859 # "CriticalAlarmHigh": 0,
860 # "CriticalAlarmLow": 0,
861 # "CriticalHigh": 3100000000,
862 # "CriticalLow": 0,
863 # "Scale": -6,
864 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
865 # "Value": 228000000,
866 # "WarningAlarmHigh": 0,
867 # "WarningAlarmLow": 0,
868 # "WarningHigh": 3050000000,
869 # "WarningLow": 0
870
871 # Get power value based on scale i.e. Value * (10 power Scale Value)
872 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
873 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
874 ${ipmi_rest_power_diff}=
875 ... Evaluate abs(${power_reading_rest} - ${power_reading})
876
877 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
878 ... msg=Power reading above allowed threshold ${allowed_power_diff}.
George Keishing02651f02018-04-11 02:07:16 -0500879
880
881Get Physical Network Interface Count
882 [Documentation] Return valid physical network interfaces count.
883
884 # Example:
885 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
886 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
887
888 ${mac_entry_list}= Get BMC MAC Address List
889 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
890 ${physical_interface_count}= Get Length ${mac_unique_list}
891
892 [Return] ${physical_interface_count}
George Keishing39967eb2018-04-30 11:36:23 -0500893
894
895Execute IPMI Command With Cipher
896 [Documentation] Execute IPMI command with a given cipher level value.
897 [Arguments] ${cipher_level}
898
899 # Description of argument(s):
900 # cipher_level IPMI chipher level value
901 # (e.g. "1", "2", "3", "15", "16", "17").
902
George Keishingf4027652019-01-10 23:58:29 -0600903 ${status}= Run Keyword And Return Status Build IPMI Ext Cmd ${cipher_level}
George Keishing39967eb2018-04-30 11:36:23 -0500904
George Keishingf4027652019-01-10 23:58:29 -0600905 [Return] ${status}