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