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