blob: d21208314221bc3579d3ccc8cbe54a40f0d68ff4 [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
Michael Walshc9eb34e2019-01-23 11:08:43 -060014Test Setup Log to Console ${EMPTY}
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050015Test Teardown FFDC On Test Case Fail
16
17*** Variables ***
18
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060019${new_mc_id}= HOST
Rahul Maheshwari901dcde2018-02-06 03:14:31 -060020${allowed_temp_diff}= ${1}
Rahul Maheshwari615da152018-02-13 23:53:36 -060021${allowed_power_diff}= ${10}
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060022
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050023*** Test Cases ***
24
George Keishingd6273802018-09-07 07:06:53 -050025Verify IPMI SEL Version
26 [Documentation] Verify IPMI SEL's version info.
27 [Tags] Verify_IPMI_SEL_Version
28
29 ${version_info}= Get IPMI SEL Setting Version
30 ${setting_status}= Fetch From Left ${version_info} (
31 ${setting_status}= Evaluate $setting_status.replace(' ','')
32
33 Should Be True ${setting_status} >= 1.5
34 Should Contain ${version_info} v2 compliant case_insensitive=True
35
36
George Keishing9acd2282018-09-07 07:21:41 -050037Verify Empty SEL
38 [Documentation] Verify empty SEL list.
39 [Tags] Verify_Empty_SEL
40
Rahul Maheshwari9ef85072018-12-06 05:10:44 -060041 Run IPMI Standard Command sel clear
George Keishing9acd2282018-09-07 07:21:41 -050042
43 ${resp}= Run IPMI Standard Command sel list
44 Should Contain ${resp} SEL has no entries case_insensitive=True
45
46
George Keishing39967eb2018-04-30 11:36:23 -050047Verify Supported Cipher List
48 [Documentation] Execute all supported cipher levels and verify.
49 [Tags] Verify_Supported_Cipher_List
50
51 :FOR ${cipher_level} IN @{valid_cipher_list}
Michael Walshc9eb34e2019-01-23 11:08:43 -060052 \ ${status} ${output}= Run Keyword And Ignore Error
53 ... Run External IPMI Standard Command power status C=${cipher_level}
54 \ Should Be Equal ${status} PASS msg=${output} values=False
Rahul Maheshwari19faedf2018-08-29 00:42:09 -050055
56
57Verify Unsupported Cipher List
58 [Documentation] Execute all unsupported cipher levels and verify error.
59 [Tags] Verify_Unsupported_Cipher_List
60
61 :FOR ${cipher_level} IN @{unsupported_cipher_list}
Michael Walshc9eb34e2019-01-23 11:08:43 -060062 \ ${status} ${output}= Run Keyword And Ignore Error
63 ... Run External IPMI Standard Command power status C=${cipher_level}
64 \ Should Be Equal ${status} FAIL values=False
65 ... msg=ipmitool execution with cipher suite value of ${cipher_level} should have failed.
Rahul Maheshwari19faedf2018-08-29 00:42:09 -050066
George Keishing39967eb2018-04-30 11:36:23 -050067
Rahul Maheshwari2837a812018-09-03 01:00:33 -050068Verify Supported Cipher List Via Lan Print
69 [Documentation] Verify supported cipher list via IPMI lan print command.
70 [Tags] Verify_Supported_Cipher_List_Via_Lan_Print
71
Rahul Maheshwari2837a812018-09-03 01:00:33 -050072 ${network_info_dict}= Get Lan Print Dict
73 # Example 'RMCP+ Cipher Suites' entry: 3,17
74 ${cipher_list}= Evaluate
Michael Walshc19cf142019-02-05 11:34:03 -060075 ... list(map(int, $network_info_dict['RMCP+ Cipher Suites'].split(',')))
Rahul Maheshwari2837a812018-09-03 01:00:33 -050076 Lists Should Be Equal ${cipher_list} ${valid_cipher_list}
77
78
Rahul Maheshwari98cfd262018-09-05 05:38:30 -050079Verify Supported Cipher Via Getciphers
80 [Documentation] Verify supported chiper list via IPMI getciphers command.
81 [Tags] Verify_Supported_Cipher_Via_Getciphers
82
83 ${output}= Run IPMI Standard Command channel getciphers ipmi
84 # Example of getciphers command output:
85 # ID IANA Auth Alg Integrity Alg Confidentiality Alg
86 # 3 N/A hmac_sha1 hmac_sha1_96 aes_cbc_128
87 # 17 N/A hmac_sha256 sha256_128 aes_cbc_128
88
89 ${report}= Outbuf To Report ${output}
90 # Make list from the 'id' column in the report.
91 ${cipher_list}= Evaluate [int(x['id']) for x in $report]
92 Lists Should Be Equal ${cipher_list} ${valid_cipher_list}
93
94
Rahul Maheshwaridf6f05d2018-09-04 03:48:37 -050095Verify Disabling And Enabling IPMI Via Host
96 [Documentation] Verify disabling and enabling IPMI via host.
97 [Tags] Verify_Disabling_And_Enabling_IPMI_Via_Host
Rahul Maheshwaric2157152018-10-03 07:31:06 -050098 [Teardown] Run Keywords FFDC On Test Case Fail
99 ... AND Run Inband IPMI Standard Command lan set 1 access on
Rahul Maheshwaridf6f05d2018-09-04 03:48:37 -0500100
101 # Disable IPMI and verify
102 Run Inband IPMI Standard Command lan set 1 access off
103 Run Keyword and Expect Error *Unable to establish IPMI*
104 ... Run External IPMI Standard Command lan print
105
106 # Enable IPMI and verify
107 Run Inband IPMI Standard Command lan set 1 access on
108 ${lan_print_output}= Run External IPMI Standard Command lan print
109
110 ${openbmc_host_name} ${openbmc_ip} ${openbmc_short_name}=
111 ... Get Host Name IP host=${OPENBMC_HOST} short_name=1
112 Should Contain ${lan_print_output} ${openbmc_ip}
113
114
Rahul Maheshwari7e7d0882018-10-08 06:21:34 -0500115Verify Disabling IPMI Via OOB IPMI
116 [Documentation] Verify disabling IPMI via out of band IPMI.
117 [Tags] Verify_Disabling_IPMI_Via_OOB_IPMI
118 [Teardown] Run Inband IPMI Standard Command lan set 1 access on
119
120 # Disable IPMI via OOB IPMI and verify
121 Run Keyword and Expect Error *IPMI response is NULL*
122 ... Run IPMI Standard Command lan set 1 access off
123 Run Keyword and Expect Error *Unable to establish IPMI*
124 ... Run External IPMI Standard Command lan print
125
126 # Enable IPMI via Host and verify
127 Run Inband IPMI Standard Command lan set 1 access on
128 ${lan_print_output}= Run External IPMI Standard Command lan print
129
130 ${openbmc_host_name} ${openbmc_ip} ${openbmc_short_name}=
131 ... Get Host Name IP host=${OPENBMC_HOST} short_name=1
132 Should Contain ${lan_print_output} ${openbmc_ip}
133
134
Rahul Maheshwaric2157152018-10-03 07:31:06 -0500135Verify IPMI Disable Persistency After BMC Reboot
136 [Documentation] Verify IPMI disable persistency after BMC reboot.
137 [Tags] Verify_IPMI_Disable_Persistency_After_BMC_Reboot
138 [Teardown] Run Keywords FFDC On Test Case Fail
139 ... AND Run Inband IPMI Standard Command lan set 1 access on
140
141 # Disable IPMI and reboot BMC.
142 Run Inband IPMI Standard Command lan set 1 access off
143 OBMC Reboot (run)
144
145 # Verify that IPMI remains disabled after reboot.
146 Run Keyword and Expect Error *Unable to establish IPMI*
147 ... Run External IPMI Standard Command lan print
148
149
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500150Set Asset Tag With Valid String Length
151 [Documentation] Set asset tag with valid string length and verify.
152 [Tags] Set_Asset_Tag_With_Valid_String_Length
153
154 # Allowed MAX characters length for asset tag name is 63.
155 ${random_string}= Generate Random String 63
156 Run Keyword Run IPMI Standard Command dcmi set_asset_tag ${random_string}
157
158 ${asset_tag}= Run Keyword Run IPMI Standard Command dcmi asset_tag
159 Should Contain ${asset_tag} ${random_string}
160
161
162Set Asset Tag With Invalid String Length
163 [Documentation] Verify error while setting invalid asset tag via IPMI.
164 [Tags] Set_Asset_Tag_With_Invalid_String_Length
165
166 # Any string more than 63 character is invalid for asset tag.
167 ${random_string}= Generate Random String 64
168
169 ${resp}= Run Keyword And Expect Error * Run IPMI Standard Command
170 ... dcmi set_asset_tag ${random_string}
171 Should Contain ${resp} Parameter out of range ignore_case=True
172
173
174Set Asset Tag With Valid String Length Via REST
175 [Documentation] Set valid asset tag via REST and verify.
176 [Tags] Set_Asset_Tag_With_Valid_String_Length_Via_REST
177
178 ${random_string}= Generate Random String 63
179 ${args}= Create Dictionary data=${random_string}
180 Write Attribute /xyz/openbmc_project/inventory/system AssetTag
181 ... data=${args}
182
183 ${asset_tag}= Read Attribute /xyz/openbmc_project/inventory/system
184 ... AssetTag
185 Should Be Equal As Strings ${asset_tag} ${random_string}
186
Sweta Potthurif39022d2018-02-06 03:40:07 -0600187
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600188Verify Get And Set Management Controller ID String
189 [Documentation] Verify get and set management controller ID string.
190 [Tags] Verify_Get_And_Set_Management_Controller_ID_String
191
192 # Get the value of the managemment controller ID string.
193 # Example:
194 # Get Management Controller Identifier String: witherspoon
195
196 ${cmd_output}= Run IPMI Standard Command dcmi get_mc_id_string
197
198 # Extract management controller ID from cmd_output.
199 ${initial_mc_id}= Fetch From Right ${cmd_output} :${SPACE}
200
201 # Set the management controller ID string to other value.
202 # Example:
203 # Set Management Controller Identifier String Command: HOST
204
205 Set Management Controller ID String ${new_mc_id}
206
207 # Get the management controller ID and verify.
208 Get Management Controller ID String And Verify ${new_mc_id}
209
210 # Set the value back to the initial value and verify.
211 Set Management Controller ID String ${initial_mc_id}
212
213 # Get the management controller ID and verify.
214 Get Management Controller ID String And Verify ${initial_mc_id}
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500215
Sweta Potthurif39022d2018-02-06 03:40:07 -0600216
Rahul Maheshwari0eb33f02018-04-10 02:31:54 -0500217Test Management Controller ID String Status via IPMI
218 [Documentation] Test management controller ID string status via IPMI.
219 [Tags] Test_Management_Controller_ID_String_Status_via_IPMI
220
221 # Disable management controller ID string status via IPMI and verify.
222 Run IPMI Standard Command dcmi set_conf_param dhcp_config 0x00
223 Verify Management Controller ID String Status disable
224
225 # Enable management controller ID string status via IPMI and verify.
226 Run IPMI Standard Command dcmi set_conf_param dhcp_config 0x01
227 Verify Management Controller ID String Status enable
228
229
230Test Management Controller ID String Status via Raw IPMI
231 [Documentation] Test management controller ID string status via IPMI.
232 [Tags] Test_Management_Controller_ID_String_Status_via_Raw_IPMI
233
234 # Disable management controller ID string status via raw IPMI and verify.
235 Run IPMI Standard Command raw ${IPMI_RAW_CMD['conf_param']['Disabled'][0]}
236 Verify Management Controller ID String Status disable
237
238 # Enable management controller ID string status via raw IPMI and verify.
239 Run IPMI Standard Command raw ${IPMI_RAW_CMD['conf_param']['Enabled'][0]}
240 Verify Management Controller ID String Status enable
241
242
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600243Verify Chassis Identify via IPMI
244 [Documentation] Verify "chassis identify" using IPMI command.
245 [Tags] Verify_Chassis_Identify_via_IPMI
246
247 # Set to default "chassis identify" and verify that LED blinks for 15s.
248 Run IPMI Standard Command chassis identify
249 Verify Identify LED State Blink
250
251 Sleep 15s
252 Verify Identify LED State Off
253
254 # Set "chassis identify" to 10s and verify that the LED blinks for 10s.
255 Run IPMI Standard Command chassis identify 10
256 Verify Identify LED State Blink
257
258 Sleep 10s
259 Verify Identify LED State Off
260
Sweta Potthurif39022d2018-02-06 03:40:07 -0600261
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600262Verify Chassis Identify Off And Force Identify On via IPMI
263 [Documentation] Verify "chassis identify" off
264 ... and "force identify on" via IPMI.
265 [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI
266
267 # Set the LED to "Force Identify On".
268 Run IPMI Standard Command chassis identify force
269 Verify Identify LED State Blink
270
271 # Set "chassis identify" to 0 and verify that the LED turns off.
272 Run IPMI Standard Command chassis identify 0
273 Verify Identify LED State Off
274
Sweta Potthurif39022d2018-02-06 03:40:07 -0600275
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600276Test Watchdog Reset Via IPMI And Verify Using REST
277 [Documentation] Test watchdog reset via IPMI and verify using REST.
278 [Tags] Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST
279
280 Initiate Host Boot
281
282 Set Watchdog Enabled Using REST ${1}
283
284 Watchdog Object Should Exist
285
286 # Resetting the watchdog via IPMI.
287 Run IPMI Standard Command mc watchdog reset
288
289 # Verify the watchdog is reset using REST after an interval of 1000ms.
290 Sleep 1000ms
291 ${watchdog_time_left}=
292 ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining
293 Should Be True
294 ... ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000}
295 ... msg=Watchdog timer didn't reset.
296
Sweta Potthurif39022d2018-02-06 03:40:07 -0600297
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600298Test Watchdog Off Via IPMI And Verify Using REST
299 [Documentation] Test watchdog off via IPMI and verify using REST.
300 [Tags] Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST
301
302 Initiate Host Boot
303
304 Set Watchdog Enabled Using REST ${1}
305
306 Watchdog Object Should Exist
307
308 # Turn off the watchdog via IPMI.
309 Run IPMI Standard Command mc watchdog off
310
311 # Verify the watchdog is off using REST
312 ${watchdog_state}= Read Attribute ${HOST_WATCHDOG_URI} Enabled
313 Should Be Equal ${watchdog_state} ${0}
314 ... msg=msg=Verification failed for watchdog off check.
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600315
316
317Test Ambient Temperature Via IPMI
318 [Documentation] Test ambient temperature via IPMI and verify using REST.
319 [Tags] Test_Ambient_Temperature_Via_IPMI
320
321 # Entity ID Entity Instance Temp. Readings
322 # Inlet air temperature(40h) 1 +19 C
323 # CPU temperature sensors(41h) 5 +51 C
324 # CPU temperature sensors(41h) 6 +50 C
325 # CPU temperature sensors(41h) 7 +50 C
326 # CPU temperature sensors(41h) 8 +50 C
327 # CPU temperature sensors(41h) 9 +50 C
328 # CPU temperature sensors(41h) 10 +48 C
329 # CPU temperature sensors(41h) 11 +49 C
330 # CPU temperature sensors(41h) 12 +47 C
331 # CPU temperature sensors(41h) 8 +50 C
332 # CPU temperature sensors(41h) 16 +51 C
333 # CPU temperature sensors(41h) 24 +50 C
334 # CPU temperature sensors(41h) 32 +43 C
335 # CPU temperature sensors(41h) 40 +43 C
336 # Baseboard temperature sensors(42h) 1 +35 C
337
338 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
George Keishing77f1ad22018-07-23 12:39:28 -0500339 Should Contain ${temp_reading} Inlet air temperature
340 ... msg="Unable to get inlet temperature via DCMI".
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600341 ${ambient_temp_line}=
342 ... Get Lines Containing String ${temp_reading}
343 ... Inlet air temperature case-insensitive
344
345 ${ambient_temp_ipmi}= Fetch From Right ${ambient_temp_line} +
346 ${ambient_temp_ipmi}= Remove String ${ambient_temp_ipmi} ${SPACE}C
347
348 ${ambient_temp_rest}= Read Attribute
349 ... ${SENSORS_URI}temperature/ambient Value
350
351 # Example of ambient temperature via REST
352 # "CriticalAlarmHigh": 0,
353 # "CriticalAlarmLow": 0,
354 # "CriticalHigh": 35000,
355 # "CriticalLow": 0,
356 # "Scale": -3,
357 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
358 # "Value": 21775,
359 # "WarningAlarmHigh": 0,
360 # "WarningAlarmLow": 0,
361 # "WarningHigh": 25000,
362 # "WarningLow": 0
363
364 # Get temperature value based on scale i.e. Value * (10 power Scale Value)
365 # e.g. from above case 21775 * (10 power -3) = 21775/1000
366
367 ${ambient_temp_rest}= Evaluate ${ambient_temp_rest}/1000
368 ${ipmi_rest_temp_diff}=
369 ... Evaluate abs(${ambient_temp_rest} - ${ambient_temp_ipmi})
370
371 Should Be True ${ipmi_rest_temp_diff} <= ${allowed_temp_diff}
372 ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}.
373
374
Rahul Maheshwari43556632018-02-05 23:42:52 -0600375Verify Get DCMI Capabilities
376 [Documentation] Verify get DCMI capabilities command output.
377 [Tags] Verify_Get_DCMI_Capabilities
378
379 ${cmd_output}= Run IPMI Standard Command dcmi discover
380
381 @{supported_capabilities}= Create List
382 # Supported DCMI capabilities:
383 ... Mandatory platform capabilties
384 ... Optional platform capabilties
385 ... Power management available
386 ... Managebility access capabilties
387 ... In-band KCS channel available
388 # Mandatory platform attributes:
389 ... 200 SEL entries
390 ... SEL automatic rollover is enabled
391 # Optional Platform Attributes:
392 ... Slave address of device: 0h (8bits)(Satellite/External controller)
393 ... Channel number is 0h (Primary BMC)
394 ... Device revision is 0
395 # Manageability Access Attributes:
396 ... Primary LAN channel number: 1 is available
397 ... Secondary LAN channel is not available for OOB
398 ... No serial channel is available
399
400 :FOR ${capability} IN @{supported_capabilities}
401 \ Should Contain ${cmd_output} ${capability} ignore_case=True
402 ... msg=Supported DCMI capabilities not present.
403
404
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600405Test Power Reading Via IPMI With Host Off
406 [Documentation] Test power reading via IPMI with host off state and
407 ... verify using REST.
408 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Off
Rahul Maheshwari615da152018-02-13 23:53:36 -0600409
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600410 REST Power Off stack_mode=skip quiet=1
Rahul Maheshwari615da152018-02-13 23:53:36 -0600411
George Keishing04bf06c2018-10-05 08:28:50 -0500412 Wait Until Keyword Succeeds 1 min 30 sec Verify Power Reading
George Keishinge78f1fd2018-09-04 13:34:59 -0500413
414
415Test Power Reading Via IPMI With Host Booted
416 [Documentation] Test power reading via IPMI with host booted state and
417 ... verify using REST.
418 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted
419
420 REST Power On stack_mode=skip quiet=1
421
422 # For a good power reading take a 3 samples for 15 seconds interval and
423 # average it out.
424
George Keishing04bf06c2018-10-05 08:28:50 -0500425 Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading
Rahul Maheshwari615da152018-02-13 23:53:36 -0600426
427
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600428Test Power Reading Via IPMI Raw Command
429 [Documentation] Test power reading via IPMI raw command and verify
430 ... using REST.
431 [Tags] Test_Power_Reading_Via_IPMI_Raw_Command
432
433 # Response data structure of power reading command output via IPMI.
434 # 1 Completion Code. Refer to section 8, DCMI Completion Codes.
435 # 2 Group Extension Identification = DCh
436 # 3:4 Current Power in watts
437
George Keishinge78f1fd2018-09-04 13:34:59 -0500438 REST Power On stack_mode=skip quiet=1
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600439
George Keishing04bf06c2018-10-05 08:28:50 -0500440 Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading Via Raw Command
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600441
442
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600443Test Baseboard Temperature Via IPMI
444 [Documentation] Test baseboard temperature via IPMI and verify using REST.
445 [Tags] Test_Baseboard_Temperature_Via_IPMI
446
447 # Example of IPMI dcmi get_temp_reading output:
448 # Entity ID Entity Instance Temp. Readings
449 # Inlet air temperature(40h) 1 +19 C
450 # CPU temperature sensors(41h) 5 +51 C
451 # CPU temperature sensors(41h) 6 +50 C
452 # CPU temperature sensors(41h) 7 +50 C
453 # CPU temperature sensors(41h) 8 +50 C
454 # CPU temperature sensors(41h) 9 +50 C
455 # CPU temperature sensors(41h) 10 +48 C
456 # CPU temperature sensors(41h) 11 +49 C
457 # CPU temperature sensors(41h) 12 +47 C
458 # CPU temperature sensors(41h) 8 +50 C
459 # CPU temperature sensors(41h) 16 +51 C
460 # CPU temperature sensors(41h) 24 +50 C
461 # CPU temperature sensors(41h) 32 +43 C
462 # CPU temperature sensors(41h) 40 +43 C
463 # Baseboard temperature sensors(42h) 1 +35 C
464
465 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
George Keishing77f1ad22018-07-23 12:39:28 -0500466 Should Contain ${temp_reading} Baseboard temperature sensors
467 ... msg="Unable to get baseboard temperature via DCMI".
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600468 ${baseboard_temp_line}=
469 ... Get Lines Containing String ${temp_reading}
470 ... Baseboard temperature case-insensitive=True
471
472 ${baseboard_temp_ipmi}= Fetch From Right ${baseboard_temp_line} +
473 ${baseboard_temp_ipmi}= Remove String ${baseboard_temp_ipmi} ${SPACE}C
474
475 ${baseboard_temp_rest}= Read Attribute
476 ... /xyz/openbmc_project/sensors/temperature/pcie Value
477 ${baseboard_temp_rest}= Evaluate ${baseboard_temp_rest}/1000
478
479 Should Be True
480 ... ${baseboard_temp_rest} - ${baseboard_temp_ipmi} <= ${allowed_temp_diff}
481 ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}.
482
483
Sweta Potthurif39022d2018-02-06 03:40:07 -0600484Retrieve Default Gateway Via IPMI And Verify Using REST
485 [Documentation] Retrieve default gateway from LAN print using IPMI.
486 [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify_Using_REST
487
488 # Fetch "Default Gateway" from IPMI LAN print.
489 ${default_gateway_ipmi}= Fetch Details From LAN Print Default Gateway IP
490
491 # Verify "Default Gateway" using REST.
Steven Sombara8800da2018-12-18 16:19:05 -0600492 Read Attribute ${NETWORK_MANAGER}config DefaultGateway
Sweta Potthurif39022d2018-02-06 03:40:07 -0600493 ... expected_value=${default_gateway_ipmi}
494
495
496Retrieve MAC Address Via IPMI And Verify Using REST
497 [Documentation] Retrieve MAC Address from LAN print using IPMI.
498 [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_REST
499
500 # Fetch "MAC Address" from IPMI LAN print.
501 ${mac_address_ipmi}= Fetch Details From LAN Print MAC Address
502
503 # Verify "MAC Address" using REST.
504 ${mac_address_rest}= Get BMC MAC Address
505 Should Be Equal ${mac_address_ipmi} ${mac_address_rest}
506 ... msg=Verification of MAC address from lan print using IPMI failed.
507
508
509Retrieve Network Mode Via IPMI And Verify Using REST
510 [Documentation] Retrieve network mode from LAN print using IPMI.
511 [Tags] Retrieve_Network_Mode_Via_IPMI_And_Verify_Using_REST
512
513 # Fetch "Mode" from IPMI LAN print.
514 ${network_mode_ipmi}= Fetch Details From LAN Print Source
515
516 # Verify "Mode" using REST.
517 ${network_mode_rest}= Read Attribute
Steven Sombara8800da2018-12-18 16:19:05 -0600518 ... ${NETWORK_MANAGER}eth0 DHCPEnabled
Sweta Potthurif39022d2018-02-06 03:40:07 -0600519 Run Keyword If '${network_mode_ipmi}' == 'Static Address'
520 ... Should Be Equal ${network_mode_rest} ${0}
521 ... msg=Verification of network setting failed.
522 ... ELSE IF '${network_mode_ipmi}' == 'DHCP'
523 ... Should Be Equal ${network_mode_rest} ${1}
524 ... msg=Verification of network setting failed.
525
526
527Retrieve IP Address Via IPMI And Verify With BMC Details
528 [Documentation] Retrieve IP address from LAN print using IPMI.
529 [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_With_BMC_Details
530
531 # Fetch "IP Address" from IPMI LAN print.
532 ${ip_addr_ipmi}= Fetch Details From LAN Print IP Address
533
534 # Verify the IP address retrieved via IPMI with BMC IPs.
535 ${ip_address_rest}= Get BMC IP Info
536 Validate IP On BMC ${ip_addr_ipmi} ${ip_address_rest}
537
538
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600539Verify Get Device ID
540 [Documentation] Verify get device ID command output.
541 [Tags] Verify_Get_Device_ID
542
543 # Example of get device ID command output:
544 # Device ID : 0
545 # Device Revision : 0
546 # Firmware Revision : 2.01
547 # IPMI Version : 2.0
548 # Manufacturer ID : 42817
549 # Manufacturer Name : Unknown (0xA741)
550 # Product ID : 16975 (0x424f)
551 # Product Name : Unknown (0x424F)
552 # Device Available : yes
553 # Provides Device SDRs : yes
554 # Additional Device Support :
555 # Sensor Device
556 # SEL Device
557 # FRU Inventory Device
558 # Chassis Device
559 # Aux Firmware Rev Info :
George Keishing3511a3f2018-04-19 10:38:30 -0500560 # 0x04
561 # 0x38
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600562 # 0x00
George Keishing3511a3f2018-04-19 10:38:30 -0500563 # 0x03
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600564
565 ${mc_info}= Get MC Info
566
567 Should Be Equal ${mc_info['device_id']} 0
568 Should Be Equal ${mc_info['device_revision']} 0
569
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500570 # Get firmware revision from mc info command output i.e. 2.01
571 ${ipmi_fw_major_version} ${ipmi_fw_minor_version}=
572 ... Split String ${mc_info['firmware_revision']} .
573 # Convert minor firmware version from BCD format to integer. i.e. 01 to 1
574 ${ipmi_fw_minor_version}= Convert To Integer ${ipmi_fw_minor_version}
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600575
George Keishinge0a81282018-06-08 10:02:30 -0500576 # Get BMC version from BMC CLI i.e. 2.2 from "v2.2-253-g00050f1"
George Keishing3511a3f2018-04-19 10:38:30 -0500577 ${bmc_version_full}= Get BMC Version
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500578 ${bmc_version}=
George Keishing3511a3f2018-04-19 10:38:30 -0500579 ... Remove String Using Regexp ${bmc_version_full} ^[^0-9]+ [^0-9\.].*
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500580
581 # Get major and minor version from BMC version i.e. 2 and 1 from 2.1
George Keishingc95e9982019-01-14 09:27:45 -0600582 @{major_minor_version}= Split String ${bmc_version} .
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500583
George Keishingc95e9982019-01-14 09:27:45 -0600584 Should Be Equal As Strings ${ipmi_fw_major_version} ${major_minor_version[0]}
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500585 ... msg=Major version mis-match.
George Keishingc95e9982019-01-14 09:27:45 -0600586 Should Be Equal As Strings ${ipmi_fw_minor_version} ${major_minor_version[1]}
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500587 ... msg=Minor version mis-match.
588
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600589 Should Be Equal ${mc_info['ipmi_version']} 2.0
590
Gunnar Mills917ba1a2018-04-08 16:42:12 -0500591 # TODO: Verify Manufacturer and Product IDs directly from json file.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600592 # Reference : openbmc/openbmc-test-automation#1244
593 Should Be Equal ${mc_info['manufacturer_id']} 42817
594 Should Be Equal ${mc_info['product_id']} 16975 (0x424f)
595
596 Should Be Equal ${mc_info['device_available']} yes
597 Should Be Equal ${mc_info['provides_device_sdrs']} yes
598 Should Contain ${mc_info['additional_device_support']} Sensor Device
599 Should Contain ${mc_info['additional_device_support']} SEL Device
600 Should Contain
601 ... ${mc_info['additional_device_support']} FRU Inventory Device
602 Should Contain ${mc_info['additional_device_support']} Chassis Device
George Keishingb746d3f2018-04-19 10:53:10 -0500603
George Keishing3511a3f2018-04-19 10:38:30 -0500604 # Auxiliary revision data verification.
605 ${aux_version}= Get Aux Version ${bmc_version_full}
606
607 # From aux_firmware_rev_info field ['0x04', '0x38', '0x00', '0x03']
608 ${bmc_aux_version}= Catenate
609 ... SEPARATOR=
610 ... ${mc_info['aux_firmware_rev_info'][0][2:]}
611 ... ${mc_info['aux_firmware_rev_info'][1][2:]}
612 ... ${mc_info['aux_firmware_rev_info'][2][2:]}
613 ... ${mc_info['aux_firmware_rev_info'][3][2:]}
614
615 Should Be Equal As Integers
616 ... ${bmc_aux_version} ${aux_version}
617 ... msg=BMC aux version ${bmc_aux_version} does not match expected value of ${aux_version}.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600618
619
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500620Verify SDR Info
621 [Documentation] Verify sdr info command output.
622 [Tags] Verify_SDR_Info
623
624 # Example of SDR info command output:
625 # SDR Version : 0x51
626 # Record Count : 216
627 # Free Space : unspecified
628 # Most recent Addition :
629 # Most recent Erase :
630 # SDR overflow : no
631 # SDR Repository Update Support : unspecified
632 # Delete SDR supported : no
633 # Partial Add SDR supported : no
634 # Reserve SDR repository supported : no
635 # SDR Repository Alloc info supported : no
636
637 ${sdr_info}= Get SDR Info
638 Should Be Equal ${sdr_info['sdr_version']} 0x51
639
640 # Get sensor count from "sdr elist all" command output.
641 ${sensor_count}= Get Sensor Count
642 Should Be Equal As Strings
643 ... ${sdr_info['record_count']} ${sensor_count}
644
645 Should Be Equal ${sdr_info['free_space']} unspecified
646 Should Be Equal ${sdr_info['most_recent_addition']} ${EMPTY}
647 Should Be Equal ${sdr_info['most_recent_erase']} ${EMPTY}
648 Should Be Equal ${sdr_info['sdr_overflow']} no
649 Should Be Equal ${sdr_info['sdr_repository_update_support']} unspecified
650 Should Be Equal ${sdr_info['delete_sdr_supported']} no
651 Should Be Equal ${sdr_info['partial_add_sdr_supported']} no
652 Should Be Equal ${sdr_info['reserve_sdr_repository_supported']} no
653 Should Be Equal ${sdr_info['sdr_repository_alloc_info_supported']} no
654
655
George Keishing02651f02018-04-11 02:07:16 -0500656Test Valid IPMI Channels Supported
657 [Documentation] Verify IPMI channels supported on a given system.
658 [Tags] Test_Valid_IPMI_Channels_Supported
659
660 ${channel_count}= Get Physical Network Interface Count
661
662 # Note: IPMI network channel logically starts from 1.
663 :FOR ${channel_number} IN RANGE 1 ${channel_count}
Rahul Maheshwari20f3bf72018-12-18 04:24:20 -0600664 \ Run IPMI Standard Command lan print ${channel_number}
George Keishing02651f02018-04-11 02:07:16 -0500665
666
667Test Invalid IPMI Channel Response
668 [Documentation] Verify invalid IPMI channels supported response.
669 [Tags] Test_Invalid_IPMI_Channel_Response
670
671 ${channel_count}= Get Physical Network Interface Count
672
673 # To target invalid channel, increment count.
674 ${channel_number}= Evaluate ${channel_count} + 1
675
676 # Example of invalid channel:
George Keishing72d0ac82018-09-20 09:33:01 -0500677 # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3
George Keishing02651f02018-04-11 02:07:16 -0500678 # Get Channel Info command failed: Parameter out of range
679 # Invalid channel: 3
680
681 ${stdout}= Run External IPMI Standard Command
682 ... lan print ${channel_number} fail_on_err=${0}
683 Should Contain ${stdout} Invalid channel
684 ... msg=IPMI channel ${channel_number} is invalid but seen working.
685
686
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500687*** Keywords ***
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600688
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500689Get Sensor Count
690 [Documentation] Get sensors count using "sdr elist all" command.
691
692 # Example of "sdr elist all" command output:
693 # BootProgress | 03h | ok | 34.2 |
694 # OperatingSystemS | 05h | ok | 35.1 |
695 # AttemptsLeft | 07h | ok | 34.1 |
696 # occ0 | 08h | ok | 210.1 | Device Disabled
697 # occ1 | 09h | ok | 210.2 | Device Disabled
698 # p0_core0_temp | 11h | ns | 3.1 | Disabled
699 # cpu0_core0 | 12h | ok | 208.1 | Presence detected
700 # p0_core1_temp | 14h | ns | 3.2 | Disabled
701 # cpu0_core1 | 15h | ok | 208.2 | Presence detected
702 # p0_core2_temp | 17h | ns | 3.3 | Disabled
703 # ..
704 # ..
705 # ..
706 # ..
707 # ..
708 # ..
709 # fan3 | 00h | ns | 29.4 | Logical FRU @35h
710 # bmc | 00h | ns | 6.1 | Logical FRU @3Ch
711 # ethernet | 00h | ns | 1.1 | Logical FRU @46h
712
713 ${output}= Run IPMI Standard Command sdr elist all
714 ${sensor_list}= Split String ${output} \n
715 ${sensor_count}= Get Length ${sensor_list}
716 [Return] ${sensor_count}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600717
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600718Set Management Controller ID String
719 [Documentation] Set the management controller ID string.
720 [Arguments] ${string}
721
722 # Description of argument(s):
723 # string Management Controller ID String to be set
724
725 ${set_mc_id_string}= Run IPMI Standard Command
726 ... dcmi set_mc_id_string ${string}
727
Sweta Potthurif39022d2018-02-06 03:40:07 -0600728
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600729Get Management Controller ID String And Verify
George Keishingcb3b9b62018-09-14 12:11:19 -0500730 [Documentation] Get the management controller ID string.
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600731 [Arguments] ${string}
732
733 # Description of argument(s):
734 # string Management Controller ID string
735
736 ${get_mc_id}= Run IPMI Standard Command dcmi get_mc_id_string
737 Should Contain ${get_mc_id} ${string}
738 ... msg=Command failed: get_mc_id.
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600739
Sweta Potthurif39022d2018-02-06 03:40:07 -0600740
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600741Set Watchdog Enabled Using REST
742 [Documentation] Set watchdog Enabled field using REST.
743 [Arguments] ${value}
744
745 # Description of argument(s):
746 # value Integer value (eg. "0-Disabled", "1-Enabled").
747
748 ${value_dict}= Create Dictionary data=${value}
Steven Sombaraaaab222018-12-19 13:16:23 -0600749 ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}attr/Enabled
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600750 ... data=${value_dict}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600751
752
Sweta Potthurif39022d2018-02-06 03:40:07 -0600753Fetch Details From LAN Print
754 [Documentation] Fetch details from LAN print.
755 [Arguments] ${field_name}
756
757 # Description of argument(s):
758 # ${field_name} Field name to be fetched from LAN print
759 # (e.g. "MAC Address", "Source").
760
Rahul Maheshwarid8037d32018-12-17 00:59:57 -0600761 ${stdout}= Run IPMI Standard Command lan print
Sweta Potthurif39022d2018-02-06 03:40:07 -0600762 ${fetch_value}= Get Lines Containing String ${stdout} ${field_name}
763 ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE}
764 [Return] ${value_fetch}
765
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600766
767Verify Power Reading
768 [Documentation] Get dcmi power reading via IPMI.
769
770 # Example of power reading command output via IPMI.
771 # Instantaneous power reading: 235 Watts
772 # Minimum during sampling period: 235 Watts
773 # Maximum during sampling period: 235 Watts
774 # Average power reading over sample period: 235 Watts
775 # IPMI timestamp: Thu Jan 1 00:00:00 1970
776 # Sampling period: 00000000 Seconds.
777 # Power reading state is: deactivated
778
779 ${power_reading}= Get IPMI Power Reading
780
781 ${host_state}= Get Host State
782 Run Keyword If '${host_state}' == 'Off'
George Keishing51314872018-03-31 13:24:35 -0500783 ... Should Be Equal ${power_reading['instantaneous_power_reading']} 0
784 ... msg=Power reading not zero when power is off.
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600785
George Keishing51314872018-03-31 13:24:35 -0500786 Run Keyword If '${power_reading['instantaneous_power_reading']}' != '0'
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600787 ... Verify Power Reading Using REST ${power_reading['instantaneous_power_reading']}
788
789
George Keishinge78f1fd2018-09-04 13:34:59 -0500790Verify Power Reading Via Raw Command
791 [Documentation] Get dcmi power reading via IPMI raw command.
792
793 ${ipmi_raw_output}= Run IPMI Standard Command
794 ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]}
795
796 @{raw_output_list}= Split String ${ipmi_raw_output} ${SPACE}
797
798 # On successful execution of raw IPMI power reading command, completion
799 # code does not come in output. So current power value will start from 2
800 # byte instead of 3.
801
802 ${power_reading_ipmi_raw_3_item}= Get From List ${raw_output_list} 2
803 ${power_reading_ipmi_raw_3_item}=
804 ... Convert To Integer 0x${power_reading_ipmi_raw_3_item}
805
806 ${power_reading_rest}= Read Attribute
807 ... ${SENSORS_URI}power/total_power Value
808
809 # Example of power reading via REST
810 # "CriticalAlarmHigh": 0,
811 # "CriticalAlarmLow": 0,
812 # "CriticalHigh": 3100000000,
813 # "CriticalLow": 0,
814 # "Scale": -6,
815 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
816 # "Value": 228000000,
817 # "WarningAlarmHigh": 0,
818 # "WarningAlarmLow": 0,
819 # "WarningHigh": 3050000000,
820 # "WarningLow": 0
821
822 # Get power value based on scale i.e. Value * (10 power Scale Value)
823 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
824
825 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
826 ${ipmi_rest_power_diff}=
827 ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi_raw_3_item})
828
829 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
830 ... msg=Power Reading above allowed threshold ${allowed_power_diff}.
831
832
Rahul Maheshwari0eb33f02018-04-10 02:31:54 -0500833Verify Management Controller ID String Status
834 [Documentation] Verify management controller ID string status via IPMI.
835 [Arguments] ${status}
836
837 # Example of dcmi get_conf_param command output:
838 # DHCP Discovery method :
839 # Management Controller ID String is disabled
840 # Vendor class identifier DCMI IANA and Vendor class-specific Informationa are disabled
841 # Initial timeout interval : 4 seconds
842 # Server contact timeout interval : 120 seconds
843 # Server contact retry interval : 64 seconds
844
845 ${resp}= Run IPMI Standard Command dcmi get_conf_param
846 ${resp}= Get Lines Containing String ${resp}
847 ... Management Controller ID String case_insensitive=True
848 Should Contain ${resp} ${status}
849 ... msg=Management controller ID string is not ${status}
850
851
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600852Verify Power Reading Using REST
853 [Documentation] Verify power reading using REST.
854 [Arguments] ${power_reading}
855
Gunnar Mills948e2e22018-03-23 12:54:27 -0500856 # Description of argument(s):
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600857 # power_reading IPMI Power reading
858
859 ${power_reading_rest}= Read Attribute
860 ... ${SENSORS_URI}power/total_power Value
861
862 # Example of power reading via REST
863 # "CriticalAlarmHigh": 0,
864 # "CriticalAlarmLow": 0,
865 # "CriticalHigh": 3100000000,
866 # "CriticalLow": 0,
867 # "Scale": -6,
868 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
869 # "Value": 228000000,
870 # "WarningAlarmHigh": 0,
871 # "WarningAlarmLow": 0,
872 # "WarningHigh": 3050000000,
873 # "WarningLow": 0
874
875 # Get power value based on scale i.e. Value * (10 power Scale Value)
876 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
877 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
878 ${ipmi_rest_power_diff}=
879 ... Evaluate abs(${power_reading_rest} - ${power_reading})
880
881 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
882 ... msg=Power reading above allowed threshold ${allowed_power_diff}.
George Keishing02651f02018-04-11 02:07:16 -0500883
884
885Get Physical Network Interface Count
886 [Documentation] Return valid physical network interfaces count.
887
888 # Example:
889 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
890 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
891
892 ${mac_entry_list}= Get BMC MAC Address List
893 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
894 ${physical_interface_count}= Get Length ${mac_unique_list}
895
896 [Return] ${physical_interface_count}
George Keishing39967eb2018-04-30 11:36:23 -0500897