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