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