blob: 385861f79439541d62af87ede62fef7914ebde54 [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 Maheshwarifdd5ff62017-08-01 04:15:03 -050012
13Test Teardown FFDC On Test Case Fail
14
15*** Variables ***
16
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060017${new_mc_id}= HOST
Rahul Maheshwari901dcde2018-02-06 03:14:31 -060018${allowed_temp_diff}= ${1}
Rahul Maheshwari615da152018-02-13 23:53:36 -060019${allowed_power_diff}= ${10}
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060020
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050021*** Test Cases ***
22
George Keishingd6273802018-09-07 07:06:53 -050023Verify IPMI SEL Version
24 [Documentation] Verify IPMI SEL's version info.
25 [Tags] Verify_IPMI_SEL_Version
26
27 ${version_info}= Get IPMI SEL Setting Version
28 ${setting_status}= Fetch From Left ${version_info} (
29 ${setting_status}= Evaluate $setting_status.replace(' ','')
30
31 Should Be True ${setting_status} >= 1.5
32 Should Contain ${version_info} v2 compliant case_insensitive=True
33
34
George Keishing9acd2282018-09-07 07:21:41 -050035Verify Empty SEL
36 [Documentation] Verify empty SEL list.
37 [Tags] Verify_Empty_SEL
38
39 Delete Error Logs And Verify
40
41 ${resp}= Run IPMI Standard Command sel list
42 Should Contain ${resp} SEL has no entries case_insensitive=True
43
44
George Keishing39967eb2018-04-30 11:36:23 -050045Verify Supported Cipher List
46 [Documentation] Execute all supported cipher levels and verify.
47 [Tags] Verify_Supported_Cipher_List
48
49 :FOR ${cipher_level} IN @{valid_cipher_list}
Rahul Maheshwari19faedf2018-08-29 00:42:09 -050050 \ ${status}= Execute IPMI Command With Cipher ${cipher_level}
51 \ Should Be Equal ${status} ${0}
52
53
54Verify Unsupported Cipher List
55 [Documentation] Execute all unsupported cipher levels and verify error.
56 [Tags] Verify_Unsupported_Cipher_List
57
58 :FOR ${cipher_level} IN @{unsupported_cipher_list}
59 \ ${status}= Execute IPMI Command With Cipher ${cipher_level}
60 \ Should Be Equal ${status} ${1}
61
George Keishing39967eb2018-04-30 11:36:23 -050062
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050063Set Asset Tag With Valid String Length
64 [Documentation] Set asset tag with valid string length and verify.
65 [Tags] Set_Asset_Tag_With_Valid_String_Length
66
67 # Allowed MAX characters length for asset tag name is 63.
68 ${random_string}= Generate Random String 63
69 Run Keyword Run IPMI Standard Command dcmi set_asset_tag ${random_string}
70
71 ${asset_tag}= Run Keyword Run IPMI Standard Command dcmi asset_tag
72 Should Contain ${asset_tag} ${random_string}
73
74
75Set Asset Tag With Invalid String Length
76 [Documentation] Verify error while setting invalid asset tag via IPMI.
77 [Tags] Set_Asset_Tag_With_Invalid_String_Length
78
79 # Any string more than 63 character is invalid for asset tag.
80 ${random_string}= Generate Random String 64
81
82 ${resp}= Run Keyword And Expect Error * Run IPMI Standard Command
83 ... dcmi set_asset_tag ${random_string}
84 Should Contain ${resp} Parameter out of range ignore_case=True
85
86
87Set Asset Tag With Valid String Length Via REST
88 [Documentation] Set valid asset tag via REST and verify.
89 [Tags] Set_Asset_Tag_With_Valid_String_Length_Via_REST
90
91 ${random_string}= Generate Random String 63
92 ${args}= Create Dictionary data=${random_string}
93 Write Attribute /xyz/openbmc_project/inventory/system AssetTag
94 ... data=${args}
95
96 ${asset_tag}= Read Attribute /xyz/openbmc_project/inventory/system
97 ... AssetTag
98 Should Be Equal As Strings ${asset_tag} ${random_string}
99
Sweta Potthurif39022d2018-02-06 03:40:07 -0600100
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600101Verify Get And Set Management Controller ID String
102 [Documentation] Verify get and set management controller ID string.
103 [Tags] Verify_Get_And_Set_Management_Controller_ID_String
104
105 # Get the value of the managemment controller ID string.
106 # Example:
107 # Get Management Controller Identifier String: witherspoon
108
109 ${cmd_output}= Run IPMI Standard Command dcmi get_mc_id_string
110
111 # Extract management controller ID from cmd_output.
112 ${initial_mc_id}= Fetch From Right ${cmd_output} :${SPACE}
113
114 # Set the management controller ID string to other value.
115 # Example:
116 # Set Management Controller Identifier String Command: HOST
117
118 Set Management Controller ID String ${new_mc_id}
119
120 # Get the management controller ID and verify.
121 Get Management Controller ID String And Verify ${new_mc_id}
122
123 # Set the value back to the initial value and verify.
124 Set Management Controller ID String ${initial_mc_id}
125
126 # Get the management controller ID and verify.
127 Get Management Controller ID String And Verify ${initial_mc_id}
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500128
Sweta Potthurif39022d2018-02-06 03:40:07 -0600129
Rahul Maheshwari0eb33f02018-04-10 02:31:54 -0500130Test Management Controller ID String Status via IPMI
131 [Documentation] Test management controller ID string status via IPMI.
132 [Tags] Test_Management_Controller_ID_String_Status_via_IPMI
133
134 # Disable management controller ID string status via IPMI and verify.
135 Run IPMI Standard Command dcmi set_conf_param dhcp_config 0x00
136 Verify Management Controller ID String Status disable
137
138 # Enable management controller ID string status via IPMI and verify.
139 Run IPMI Standard Command dcmi set_conf_param dhcp_config 0x01
140 Verify Management Controller ID String Status enable
141
142
143Test Management Controller ID String Status via Raw IPMI
144 [Documentation] Test management controller ID string status via IPMI.
145 [Tags] Test_Management_Controller_ID_String_Status_via_Raw_IPMI
146
147 # Disable management controller ID string status via raw IPMI and verify.
148 Run IPMI Standard Command raw ${IPMI_RAW_CMD['conf_param']['Disabled'][0]}
149 Verify Management Controller ID String Status disable
150
151 # Enable management controller ID string status via raw IPMI and verify.
152 Run IPMI Standard Command raw ${IPMI_RAW_CMD['conf_param']['Enabled'][0]}
153 Verify Management Controller ID String Status enable
154
155
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600156Verify Chassis Identify via IPMI
157 [Documentation] Verify "chassis identify" using IPMI command.
158 [Tags] Verify_Chassis_Identify_via_IPMI
159
160 # Set to default "chassis identify" and verify that LED blinks for 15s.
161 Run IPMI Standard Command chassis identify
162 Verify Identify LED State Blink
163
164 Sleep 15s
165 Verify Identify LED State Off
166
167 # Set "chassis identify" to 10s and verify that the LED blinks for 10s.
168 Run IPMI Standard Command chassis identify 10
169 Verify Identify LED State Blink
170
171 Sleep 10s
172 Verify Identify LED State Off
173
Sweta Potthurif39022d2018-02-06 03:40:07 -0600174
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600175Verify Chassis Identify Off And Force Identify On via IPMI
176 [Documentation] Verify "chassis identify" off
177 ... and "force identify on" via IPMI.
178 [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI
179
180 # Set the LED to "Force Identify On".
181 Run IPMI Standard Command chassis identify force
182 Verify Identify LED State Blink
183
184 # Set "chassis identify" to 0 and verify that the LED turns off.
185 Run IPMI Standard Command chassis identify 0
186 Verify Identify LED State Off
187
Sweta Potthurif39022d2018-02-06 03:40:07 -0600188
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600189Test Watchdog Reset Via IPMI And Verify Using REST
190 [Documentation] Test watchdog reset via IPMI and verify using REST.
191 [Tags] Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST
192
193 Initiate Host Boot
194
195 Set Watchdog Enabled Using REST ${1}
196
197 Watchdog Object Should Exist
198
199 # Resetting the watchdog via IPMI.
200 Run IPMI Standard Command mc watchdog reset
201
202 # Verify the watchdog is reset using REST after an interval of 1000ms.
203 Sleep 1000ms
204 ${watchdog_time_left}=
205 ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining
206 Should Be True
207 ... ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000}
208 ... msg=Watchdog timer didn't reset.
209
Sweta Potthurif39022d2018-02-06 03:40:07 -0600210
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600211Test Watchdog Off Via IPMI And Verify Using REST
212 [Documentation] Test watchdog off via IPMI and verify using REST.
213 [Tags] Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST
214
215 Initiate Host Boot
216
217 Set Watchdog Enabled Using REST ${1}
218
219 Watchdog Object Should Exist
220
221 # Turn off the watchdog via IPMI.
222 Run IPMI Standard Command mc watchdog off
223
224 # Verify the watchdog is off using REST
225 ${watchdog_state}= Read Attribute ${HOST_WATCHDOG_URI} Enabled
226 Should Be Equal ${watchdog_state} ${0}
227 ... msg=msg=Verification failed for watchdog off check.
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600228
229
230Test Ambient Temperature Via IPMI
231 [Documentation] Test ambient temperature via IPMI and verify using REST.
232 [Tags] Test_Ambient_Temperature_Via_IPMI
233
234 # Entity ID Entity Instance Temp. Readings
235 # Inlet air temperature(40h) 1 +19 C
236 # CPU temperature sensors(41h) 5 +51 C
237 # CPU temperature sensors(41h) 6 +50 C
238 # CPU temperature sensors(41h) 7 +50 C
239 # CPU temperature sensors(41h) 8 +50 C
240 # CPU temperature sensors(41h) 9 +50 C
241 # CPU temperature sensors(41h) 10 +48 C
242 # CPU temperature sensors(41h) 11 +49 C
243 # CPU temperature sensors(41h) 12 +47 C
244 # CPU temperature sensors(41h) 8 +50 C
245 # CPU temperature sensors(41h) 16 +51 C
246 # CPU temperature sensors(41h) 24 +50 C
247 # CPU temperature sensors(41h) 32 +43 C
248 # CPU temperature sensors(41h) 40 +43 C
249 # Baseboard temperature sensors(42h) 1 +35 C
250
251 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
George Keishing77f1ad22018-07-23 12:39:28 -0500252 Should Contain ${temp_reading} Inlet air temperature
253 ... msg="Unable to get inlet temperature via DCMI".
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600254 ${ambient_temp_line}=
255 ... Get Lines Containing String ${temp_reading}
256 ... Inlet air temperature case-insensitive
257
258 ${ambient_temp_ipmi}= Fetch From Right ${ambient_temp_line} +
259 ${ambient_temp_ipmi}= Remove String ${ambient_temp_ipmi} ${SPACE}C
260
261 ${ambient_temp_rest}= Read Attribute
262 ... ${SENSORS_URI}temperature/ambient Value
263
264 # Example of ambient temperature via REST
265 # "CriticalAlarmHigh": 0,
266 # "CriticalAlarmLow": 0,
267 # "CriticalHigh": 35000,
268 # "CriticalLow": 0,
269 # "Scale": -3,
270 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
271 # "Value": 21775,
272 # "WarningAlarmHigh": 0,
273 # "WarningAlarmLow": 0,
274 # "WarningHigh": 25000,
275 # "WarningLow": 0
276
277 # Get temperature value based on scale i.e. Value * (10 power Scale Value)
278 # e.g. from above case 21775 * (10 power -3) = 21775/1000
279
280 ${ambient_temp_rest}= Evaluate ${ambient_temp_rest}/1000
281 ${ipmi_rest_temp_diff}=
282 ... Evaluate abs(${ambient_temp_rest} - ${ambient_temp_ipmi})
283
284 Should Be True ${ipmi_rest_temp_diff} <= ${allowed_temp_diff}
285 ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}.
286
287
Rahul Maheshwari43556632018-02-05 23:42:52 -0600288Verify Get DCMI Capabilities
289 [Documentation] Verify get DCMI capabilities command output.
290 [Tags] Verify_Get_DCMI_Capabilities
291
292 ${cmd_output}= Run IPMI Standard Command dcmi discover
293
294 @{supported_capabilities}= Create List
295 # Supported DCMI capabilities:
296 ... Mandatory platform capabilties
297 ... Optional platform capabilties
298 ... Power management available
299 ... Managebility access capabilties
300 ... In-band KCS channel available
301 # Mandatory platform attributes:
302 ... 200 SEL entries
303 ... SEL automatic rollover is enabled
304 # Optional Platform Attributes:
305 ... Slave address of device: 0h (8bits)(Satellite/External controller)
306 ... Channel number is 0h (Primary BMC)
307 ... Device revision is 0
308 # Manageability Access Attributes:
309 ... Primary LAN channel number: 1 is available
310 ... Secondary LAN channel is not available for OOB
311 ... No serial channel is available
312
313 :FOR ${capability} IN @{supported_capabilities}
314 \ Should Contain ${cmd_output} ${capability} ignore_case=True
315 ... msg=Supported DCMI capabilities not present.
316
317
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600318Test Power Reading Via IPMI With Host Off
319 [Documentation] Test power reading via IPMI with host off state and
320 ... verify using REST.
321 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Off
Rahul Maheshwari615da152018-02-13 23:53:36 -0600322
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600323 REST Power Off stack_mode=skip quiet=1
Rahul Maheshwari615da152018-02-13 23:53:36 -0600324
George Keishinge78f1fd2018-09-04 13:34:59 -0500325 Wait Until Keyword Succeeds 1 min 20 sec Verify Power Reading
326
327
328Test Power Reading Via IPMI With Host Booted
329 [Documentation] Test power reading via IPMI with host booted state and
330 ... verify using REST.
331 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted
332
333 REST Power On stack_mode=skip quiet=1
334
335 # For a good power reading take a 3 samples for 15 seconds interval and
336 # average it out.
337
338 Wait Until Keyword Succeeds 1 min 20 sec Verify Power Reading
Rahul Maheshwari615da152018-02-13 23:53:36 -0600339
340
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600341Test Power Reading Via IPMI Raw Command
342 [Documentation] Test power reading via IPMI raw command and verify
343 ... using REST.
344 [Tags] Test_Power_Reading_Via_IPMI_Raw_Command
345
346 # Response data structure of power reading command output via IPMI.
347 # 1 Completion Code. Refer to section 8, DCMI Completion Codes.
348 # 2 Group Extension Identification = DCh
349 # 3:4 Current Power in watts
350
George Keishinge78f1fd2018-09-04 13:34:59 -0500351 REST Power On stack_mode=skip quiet=1
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600352
George Keishinge78f1fd2018-09-04 13:34:59 -0500353 Wait Until Keyword Succeeds 1 min 20 sec Verify Power Reading Via Raw Command
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600354
355
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600356Test Baseboard Temperature Via IPMI
357 [Documentation] Test baseboard temperature via IPMI and verify using REST.
358 [Tags] Test_Baseboard_Temperature_Via_IPMI
359
360 # Example of IPMI dcmi get_temp_reading output:
361 # Entity ID Entity Instance Temp. Readings
362 # Inlet air temperature(40h) 1 +19 C
363 # CPU temperature sensors(41h) 5 +51 C
364 # CPU temperature sensors(41h) 6 +50 C
365 # CPU temperature sensors(41h) 7 +50 C
366 # CPU temperature sensors(41h) 8 +50 C
367 # CPU temperature sensors(41h) 9 +50 C
368 # CPU temperature sensors(41h) 10 +48 C
369 # CPU temperature sensors(41h) 11 +49 C
370 # CPU temperature sensors(41h) 12 +47 C
371 # CPU temperature sensors(41h) 8 +50 C
372 # CPU temperature sensors(41h) 16 +51 C
373 # CPU temperature sensors(41h) 24 +50 C
374 # CPU temperature sensors(41h) 32 +43 C
375 # CPU temperature sensors(41h) 40 +43 C
376 # Baseboard temperature sensors(42h) 1 +35 C
377
378 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
George Keishing77f1ad22018-07-23 12:39:28 -0500379 Should Contain ${temp_reading} Baseboard temperature sensors
380 ... msg="Unable to get baseboard temperature via DCMI".
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600381 ${baseboard_temp_line}=
382 ... Get Lines Containing String ${temp_reading}
383 ... Baseboard temperature case-insensitive=True
384
385 ${baseboard_temp_ipmi}= Fetch From Right ${baseboard_temp_line} +
386 ${baseboard_temp_ipmi}= Remove String ${baseboard_temp_ipmi} ${SPACE}C
387
388 ${baseboard_temp_rest}= Read Attribute
389 ... /xyz/openbmc_project/sensors/temperature/pcie Value
390 ${baseboard_temp_rest}= Evaluate ${baseboard_temp_rest}/1000
391
392 Should Be True
393 ... ${baseboard_temp_rest} - ${baseboard_temp_ipmi} <= ${allowed_temp_diff}
394 ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}.
395
396
Sweta Potthurif39022d2018-02-06 03:40:07 -0600397Retrieve Default Gateway Via IPMI And Verify Using REST
398 [Documentation] Retrieve default gateway from LAN print using IPMI.
399 [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify_Using_REST
400
401 # Fetch "Default Gateway" from IPMI LAN print.
402 ${default_gateway_ipmi}= Fetch Details From LAN Print Default Gateway IP
403
404 # Verify "Default Gateway" using REST.
405 Read Attribute ${NETWORK_MANAGER}/config DefaultGateway
406 ... expected_value=${default_gateway_ipmi}
407
408
409Retrieve MAC Address Via IPMI And Verify Using REST
410 [Documentation] Retrieve MAC Address from LAN print using IPMI.
411 [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_REST
412
413 # Fetch "MAC Address" from IPMI LAN print.
414 ${mac_address_ipmi}= Fetch Details From LAN Print MAC Address
415
416 # Verify "MAC Address" using REST.
417 ${mac_address_rest}= Get BMC MAC Address
418 Should Be Equal ${mac_address_ipmi} ${mac_address_rest}
419 ... msg=Verification of MAC address from lan print using IPMI failed.
420
421
422Retrieve Network Mode Via IPMI And Verify Using REST
423 [Documentation] Retrieve network mode from LAN print using IPMI.
424 [Tags] Retrieve_Network_Mode_Via_IPMI_And_Verify_Using_REST
425
426 # Fetch "Mode" from IPMI LAN print.
427 ${network_mode_ipmi}= Fetch Details From LAN Print Source
428
429 # Verify "Mode" using REST.
430 ${network_mode_rest}= Read Attribute
431 ... ${NETWORK_MANAGER}/eth0 DHCPEnabled
432 Run Keyword If '${network_mode_ipmi}' == 'Static Address'
433 ... Should Be Equal ${network_mode_rest} ${0}
434 ... msg=Verification of network setting failed.
435 ... ELSE IF '${network_mode_ipmi}' == 'DHCP'
436 ... Should Be Equal ${network_mode_rest} ${1}
437 ... msg=Verification of network setting failed.
438
439
440Retrieve IP Address Via IPMI And Verify With BMC Details
441 [Documentation] Retrieve IP address from LAN print using IPMI.
442 [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_With_BMC_Details
443
444 # Fetch "IP Address" from IPMI LAN print.
445 ${ip_addr_ipmi}= Fetch Details From LAN Print IP Address
446
447 # Verify the IP address retrieved via IPMI with BMC IPs.
448 ${ip_address_rest}= Get BMC IP Info
449 Validate IP On BMC ${ip_addr_ipmi} ${ip_address_rest}
450
451
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600452Verify Get Device ID
453 [Documentation] Verify get device ID command output.
454 [Tags] Verify_Get_Device_ID
455
456 # Example of get device ID command output:
457 # Device ID : 0
458 # Device Revision : 0
459 # Firmware Revision : 2.01
460 # IPMI Version : 2.0
461 # Manufacturer ID : 42817
462 # Manufacturer Name : Unknown (0xA741)
463 # Product ID : 16975 (0x424f)
464 # Product Name : Unknown (0x424F)
465 # Device Available : yes
466 # Provides Device SDRs : yes
467 # Additional Device Support :
468 # Sensor Device
469 # SEL Device
470 # FRU Inventory Device
471 # Chassis Device
472 # Aux Firmware Rev Info :
George Keishing3511a3f2018-04-19 10:38:30 -0500473 # 0x04
474 # 0x38
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600475 # 0x00
George Keishing3511a3f2018-04-19 10:38:30 -0500476 # 0x03
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600477
478 ${mc_info}= Get MC Info
479
480 Should Be Equal ${mc_info['device_id']} 0
481 Should Be Equal ${mc_info['device_revision']} 0
482
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500483 # Get firmware revision from mc info command output i.e. 2.01
484 ${ipmi_fw_major_version} ${ipmi_fw_minor_version}=
485 ... Split String ${mc_info['firmware_revision']} .
486 # Convert minor firmware version from BCD format to integer. i.e. 01 to 1
487 ${ipmi_fw_minor_version}= Convert To Integer ${ipmi_fw_minor_version}
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600488
George Keishinge0a81282018-06-08 10:02:30 -0500489 # Get BMC version from BMC CLI i.e. 2.2 from "v2.2-253-g00050f1"
George Keishing3511a3f2018-04-19 10:38:30 -0500490 ${bmc_version_full}= Get BMC Version
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500491 ${bmc_version}=
George Keishing3511a3f2018-04-19 10:38:30 -0500492 ... Remove String Using Regexp ${bmc_version_full} ^[^0-9]+ [^0-9\.].*
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500493
494 # Get major and minor version from BMC version i.e. 2 and 1 from 2.1
495 ${bmc_major_version} ${bmc_minor_version}=
496 ... Split String ${bmc_version} .
497
498 Should Be Equal As Strings ${ipmi_fw_major_version} ${bmc_major_version}
499 ... msg=Major version mis-match.
500 Should Be Equal As Strings ${ipmi_fw_minor_version} ${bmc_minor_version}
501 ... msg=Minor version mis-match.
502
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600503 Should Be Equal ${mc_info['ipmi_version']} 2.0
504
Gunnar Mills917ba1a2018-04-08 16:42:12 -0500505 # TODO: Verify Manufacturer and Product IDs directly from json file.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600506 # Reference : openbmc/openbmc-test-automation#1244
507 Should Be Equal ${mc_info['manufacturer_id']} 42817
508 Should Be Equal ${mc_info['product_id']} 16975 (0x424f)
509
510 Should Be Equal ${mc_info['device_available']} yes
511 Should Be Equal ${mc_info['provides_device_sdrs']} yes
512 Should Contain ${mc_info['additional_device_support']} Sensor Device
513 Should Contain ${mc_info['additional_device_support']} SEL Device
514 Should Contain
515 ... ${mc_info['additional_device_support']} FRU Inventory Device
516 Should Contain ${mc_info['additional_device_support']} Chassis Device
George Keishingb746d3f2018-04-19 10:53:10 -0500517
George Keishing3511a3f2018-04-19 10:38:30 -0500518 # Auxiliary revision data verification.
519 ${aux_version}= Get Aux Version ${bmc_version_full}
520
521 # From aux_firmware_rev_info field ['0x04', '0x38', '0x00', '0x03']
522 ${bmc_aux_version}= Catenate
523 ... SEPARATOR=
524 ... ${mc_info['aux_firmware_rev_info'][0][2:]}
525 ... ${mc_info['aux_firmware_rev_info'][1][2:]}
526 ... ${mc_info['aux_firmware_rev_info'][2][2:]}
527 ... ${mc_info['aux_firmware_rev_info'][3][2:]}
528
529 Should Be Equal As Integers
530 ... ${bmc_aux_version} ${aux_version}
531 ... msg=BMC aux version ${bmc_aux_version} does not match expected value of ${aux_version}.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600532
533
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500534Verify SDR Info
535 [Documentation] Verify sdr info command output.
536 [Tags] Verify_SDR_Info
537
538 # Example of SDR info command output:
539 # SDR Version : 0x51
540 # Record Count : 216
541 # Free Space : unspecified
542 # Most recent Addition :
543 # Most recent Erase :
544 # SDR overflow : no
545 # SDR Repository Update Support : unspecified
546 # Delete SDR supported : no
547 # Partial Add SDR supported : no
548 # Reserve SDR repository supported : no
549 # SDR Repository Alloc info supported : no
550
551 ${sdr_info}= Get SDR Info
552 Should Be Equal ${sdr_info['sdr_version']} 0x51
553
554 # Get sensor count from "sdr elist all" command output.
555 ${sensor_count}= Get Sensor Count
556 Should Be Equal As Strings
557 ... ${sdr_info['record_count']} ${sensor_count}
558
559 Should Be Equal ${sdr_info['free_space']} unspecified
560 Should Be Equal ${sdr_info['most_recent_addition']} ${EMPTY}
561 Should Be Equal ${sdr_info['most_recent_erase']} ${EMPTY}
562 Should Be Equal ${sdr_info['sdr_overflow']} no
563 Should Be Equal ${sdr_info['sdr_repository_update_support']} unspecified
564 Should Be Equal ${sdr_info['delete_sdr_supported']} no
565 Should Be Equal ${sdr_info['partial_add_sdr_supported']} no
566 Should Be Equal ${sdr_info['reserve_sdr_repository_supported']} no
567 Should Be Equal ${sdr_info['sdr_repository_alloc_info_supported']} no
568
569
George Keishing02651f02018-04-11 02:07:16 -0500570Test Valid IPMI Channels Supported
571 [Documentation] Verify IPMI channels supported on a given system.
572 [Tags] Test_Valid_IPMI_Channels_Supported
573
574 ${channel_count}= Get Physical Network Interface Count
575
576 # Note: IPMI network channel logically starts from 1.
577 :FOR ${channel_number} IN RANGE 1 ${channel_count}
578 \ Run External IPMI Standard Command lan print ${channel_number}
579
580
581Test Invalid IPMI Channel Response
582 [Documentation] Verify invalid IPMI channels supported response.
583 [Tags] Test_Invalid_IPMI_Channel_Response
584
585 ${channel_count}= Get Physical Network Interface Count
586
587 # To target invalid channel, increment count.
588 ${channel_number}= Evaluate ${channel_count} + 1
589
590 # Example of invalid channel:
George Keishing72d0ac82018-09-20 09:33:01 -0500591 # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3
George Keishing02651f02018-04-11 02:07:16 -0500592 # Get Channel Info command failed: Parameter out of range
593 # Invalid channel: 3
594
595 ${stdout}= Run External IPMI Standard Command
596 ... lan print ${channel_number} fail_on_err=${0}
597 Should Contain ${stdout} Invalid channel
598 ... msg=IPMI channel ${channel_number} is invalid but seen working.
599
600
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500601*** Keywords ***
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600602
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500603Get Sensor Count
604 [Documentation] Get sensors count using "sdr elist all" command.
605
606 # Example of "sdr elist all" command output:
607 # BootProgress | 03h | ok | 34.2 |
608 # OperatingSystemS | 05h | ok | 35.1 |
609 # AttemptsLeft | 07h | ok | 34.1 |
610 # occ0 | 08h | ok | 210.1 | Device Disabled
611 # occ1 | 09h | ok | 210.2 | Device Disabled
612 # p0_core0_temp | 11h | ns | 3.1 | Disabled
613 # cpu0_core0 | 12h | ok | 208.1 | Presence detected
614 # p0_core1_temp | 14h | ns | 3.2 | Disabled
615 # cpu0_core1 | 15h | ok | 208.2 | Presence detected
616 # p0_core2_temp | 17h | ns | 3.3 | Disabled
617 # ..
618 # ..
619 # ..
620 # ..
621 # ..
622 # ..
623 # fan3 | 00h | ns | 29.4 | Logical FRU @35h
624 # bmc | 00h | ns | 6.1 | Logical FRU @3Ch
625 # ethernet | 00h | ns | 1.1 | Logical FRU @46h
626
627 ${output}= Run IPMI Standard Command sdr elist all
628 ${sensor_list}= Split String ${output} \n
629 ${sensor_count}= Get Length ${sensor_list}
630 [Return] ${sensor_count}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600631
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600632Set Management Controller ID String
633 [Documentation] Set the management controller ID string.
634 [Arguments] ${string}
635
636 # Description of argument(s):
637 # string Management Controller ID String to be set
638
639 ${set_mc_id_string}= Run IPMI Standard Command
640 ... dcmi set_mc_id_string ${string}
641
Sweta Potthurif39022d2018-02-06 03:40:07 -0600642
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600643Get Management Controller ID String And Verify
George Keishingcb3b9b62018-09-14 12:11:19 -0500644 [Documentation] Get the management controller ID string.
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600645 [Arguments] ${string}
646
647 # Description of argument(s):
648 # string Management Controller ID string
649
650 ${get_mc_id}= Run IPMI Standard Command dcmi get_mc_id_string
651 Should Contain ${get_mc_id} ${string}
652 ... msg=Command failed: get_mc_id.
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600653
Sweta Potthurif39022d2018-02-06 03:40:07 -0600654
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600655Set Watchdog Enabled Using REST
656 [Documentation] Set watchdog Enabled field using REST.
657 [Arguments] ${value}
658
659 # Description of argument(s):
660 # value Integer value (eg. "0-Disabled", "1-Enabled").
661
662 ${value_dict}= Create Dictionary data=${value}
663 ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}/attr/Enabled
664 ... data=${value_dict}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600665
666
Sweta Potthurif39022d2018-02-06 03:40:07 -0600667Fetch Details From LAN Print
668 [Documentation] Fetch details from LAN print.
669 [Arguments] ${field_name}
670
671 # Description of argument(s):
672 # ${field_name} Field name to be fetched from LAN print
673 # (e.g. "MAC Address", "Source").
674
Sweta Potthuric64322a2018-02-22 05:30:30 -0600675 ${stdout}= Run External IPMI Standard Command lan print
Sweta Potthurif39022d2018-02-06 03:40:07 -0600676 ${fetch_value}= Get Lines Containing String ${stdout} ${field_name}
677 ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE}
678 [Return] ${value_fetch}
679
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600680
681Verify Power Reading
682 [Documentation] Get dcmi power reading via IPMI.
683
684 # Example of power reading command output via IPMI.
685 # Instantaneous power reading: 235 Watts
686 # Minimum during sampling period: 235 Watts
687 # Maximum during sampling period: 235 Watts
688 # Average power reading over sample period: 235 Watts
689 # IPMI timestamp: Thu Jan 1 00:00:00 1970
690 # Sampling period: 00000000 Seconds.
691 # Power reading state is: deactivated
692
693 ${power_reading}= Get IPMI Power Reading
694
695 ${host_state}= Get Host State
696 Run Keyword If '${host_state}' == 'Off'
George Keishing51314872018-03-31 13:24:35 -0500697 ... Should Be Equal ${power_reading['instantaneous_power_reading']} 0
698 ... msg=Power reading not zero when power is off.
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600699
George Keishing51314872018-03-31 13:24:35 -0500700 Run Keyword If '${power_reading['instantaneous_power_reading']}' != '0'
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600701 ... Verify Power Reading Using REST ${power_reading['instantaneous_power_reading']}
702
703
George Keishinge78f1fd2018-09-04 13:34:59 -0500704Verify Power Reading Via Raw Command
705 [Documentation] Get dcmi power reading via IPMI raw command.
706
707 ${ipmi_raw_output}= Run IPMI Standard Command
708 ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]}
709
710 @{raw_output_list}= Split String ${ipmi_raw_output} ${SPACE}
711
712 # On successful execution of raw IPMI power reading command, completion
713 # code does not come in output. So current power value will start from 2
714 # byte instead of 3.
715
716 ${power_reading_ipmi_raw_3_item}= Get From List ${raw_output_list} 2
717 ${power_reading_ipmi_raw_3_item}=
718 ... Convert To Integer 0x${power_reading_ipmi_raw_3_item}
719
720 ${power_reading_rest}= Read Attribute
721 ... ${SENSORS_URI}power/total_power Value
722
723 # Example of power reading via REST
724 # "CriticalAlarmHigh": 0,
725 # "CriticalAlarmLow": 0,
726 # "CriticalHigh": 3100000000,
727 # "CriticalLow": 0,
728 # "Scale": -6,
729 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
730 # "Value": 228000000,
731 # "WarningAlarmHigh": 0,
732 # "WarningAlarmLow": 0,
733 # "WarningHigh": 3050000000,
734 # "WarningLow": 0
735
736 # Get power value based on scale i.e. Value * (10 power Scale Value)
737 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
738
739 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
740 ${ipmi_rest_power_diff}=
741 ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi_raw_3_item})
742
743 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
744 ... msg=Power Reading above allowed threshold ${allowed_power_diff}.
745
746
Rahul Maheshwari0eb33f02018-04-10 02:31:54 -0500747Verify Management Controller ID String Status
748 [Documentation] Verify management controller ID string status via IPMI.
749 [Arguments] ${status}
750
751 # Example of dcmi get_conf_param command output:
752 # DHCP Discovery method :
753 # Management Controller ID String is disabled
754 # Vendor class identifier DCMI IANA and Vendor class-specific Informationa are disabled
755 # Initial timeout interval : 4 seconds
756 # Server contact timeout interval : 120 seconds
757 # Server contact retry interval : 64 seconds
758
759 ${resp}= Run IPMI Standard Command dcmi get_conf_param
760 ${resp}= Get Lines Containing String ${resp}
761 ... Management Controller ID String case_insensitive=True
762 Should Contain ${resp} ${status}
763 ... msg=Management controller ID string is not ${status}
764
765
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600766Verify Power Reading Using REST
767 [Documentation] Verify power reading using REST.
768 [Arguments] ${power_reading}
769
Gunnar Mills948e2e22018-03-23 12:54:27 -0500770 # Description of argument(s):
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600771 # power_reading IPMI Power reading
772
773 ${power_reading_rest}= Read Attribute
774 ... ${SENSORS_URI}power/total_power Value
775
776 # Example of power reading via REST
777 # "CriticalAlarmHigh": 0,
778 # "CriticalAlarmLow": 0,
779 # "CriticalHigh": 3100000000,
780 # "CriticalLow": 0,
781 # "Scale": -6,
782 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
783 # "Value": 228000000,
784 # "WarningAlarmHigh": 0,
785 # "WarningAlarmLow": 0,
786 # "WarningHigh": 3050000000,
787 # "WarningLow": 0
788
789 # Get power value based on scale i.e. Value * (10 power Scale Value)
790 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
791 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
792 ${ipmi_rest_power_diff}=
793 ... Evaluate abs(${power_reading_rest} - ${power_reading})
794
795 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
796 ... msg=Power reading above allowed threshold ${allowed_power_diff}.
George Keishing02651f02018-04-11 02:07:16 -0500797
798
799Get Physical Network Interface Count
800 [Documentation] Return valid physical network interfaces count.
801
802 # Example:
803 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
804 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
805
806 ${mac_entry_list}= Get BMC MAC Address List
807 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
808 ${physical_interface_count}= Get Length ${mac_unique_list}
809
810 [Return] ${physical_interface_count}
George Keishing39967eb2018-04-30 11:36:23 -0500811
812
813Execute IPMI Command With Cipher
814 [Documentation] Execute IPMI command with a given cipher level value.
815 [Arguments] ${cipher_level}
816
817 # Description of argument(s):
818 # cipher_level IPMI chipher level value
819 # (e.g. "1", "2", "3", "15", "16", "17").
820
821 ${ipmi_cmd}= Catenate SEPARATOR=
822 ... ipmitool -I lanplus -C ${cipher_level} -P${SPACE}${IPMI_PASSWORD}
823 ... ${SPACE}${HOST}${SPACE}${OPENBMC_HOST}${SPACE}mc info
824
825 ${rc} ${output}= Run And Return RC and Output ${ipmi_cmd}
Rahul Maheshwari19faedf2018-08-29 00:42:09 -0500826 [Return] ${rc}