blob: cfbc33d6b1e807320ea69388972241345e28f59e [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
218 ${ambient_temp_line}=
219 ... Get Lines Containing String ${temp_reading}
220 ... Inlet air temperature case-insensitive
221
222 ${ambient_temp_ipmi}= Fetch From Right ${ambient_temp_line} +
223 ${ambient_temp_ipmi}= Remove String ${ambient_temp_ipmi} ${SPACE}C
224
225 ${ambient_temp_rest}= Read Attribute
226 ... ${SENSORS_URI}temperature/ambient Value
227
228 # Example of ambient temperature via REST
229 # "CriticalAlarmHigh": 0,
230 # "CriticalAlarmLow": 0,
231 # "CriticalHigh": 35000,
232 # "CriticalLow": 0,
233 # "Scale": -3,
234 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
235 # "Value": 21775,
236 # "WarningAlarmHigh": 0,
237 # "WarningAlarmLow": 0,
238 # "WarningHigh": 25000,
239 # "WarningLow": 0
240
241 # Get temperature value based on scale i.e. Value * (10 power Scale Value)
242 # e.g. from above case 21775 * (10 power -3) = 21775/1000
243
244 ${ambient_temp_rest}= Evaluate ${ambient_temp_rest}/1000
245 ${ipmi_rest_temp_diff}=
246 ... Evaluate abs(${ambient_temp_rest} - ${ambient_temp_ipmi})
247
248 Should Be True ${ipmi_rest_temp_diff} <= ${allowed_temp_diff}
249 ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}.
250
251
Rahul Maheshwari43556632018-02-05 23:42:52 -0600252Verify Get DCMI Capabilities
253 [Documentation] Verify get DCMI capabilities command output.
254 [Tags] Verify_Get_DCMI_Capabilities
255
256 ${cmd_output}= Run IPMI Standard Command dcmi discover
257
258 @{supported_capabilities}= Create List
259 # Supported DCMI capabilities:
260 ... Mandatory platform capabilties
261 ... Optional platform capabilties
262 ... Power management available
263 ... Managebility access capabilties
264 ... In-band KCS channel available
265 # Mandatory platform attributes:
266 ... 200 SEL entries
267 ... SEL automatic rollover is enabled
268 # Optional Platform Attributes:
269 ... Slave address of device: 0h (8bits)(Satellite/External controller)
270 ... Channel number is 0h (Primary BMC)
271 ... Device revision is 0
272 # Manageability Access Attributes:
273 ... Primary LAN channel number: 1 is available
274 ... Secondary LAN channel is not available for OOB
275 ... No serial channel is available
276
277 :FOR ${capability} IN @{supported_capabilities}
278 \ Should Contain ${cmd_output} ${capability} ignore_case=True
279 ... msg=Supported DCMI capabilities not present.
280
281
Rahul Maheshwari615da152018-02-13 23:53:36 -0600282Test Power Reading Via IPMI With Host Booted
283 [Documentation] Test power reading via IPMI with host booted state and
284 ... verify using REST.
285 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted
286
287 REST Power On stack_mode=skip quiet=1
288
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600289 Verify Power Reading
Rahul Maheshwari615da152018-02-13 23:53:36 -0600290
Rahul Maheshwari615da152018-02-13 23:53:36 -0600291
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600292Test Power Reading Via IPMI With Host Off
293 [Documentation] Test power reading via IPMI with host off state and
294 ... verify using REST.
295 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Off
Rahul Maheshwari615da152018-02-13 23:53:36 -0600296
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600297 REST Power Off stack_mode=skip quiet=1
Rahul Maheshwari615da152018-02-13 23:53:36 -0600298
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600299 Verify Power Reading
Rahul Maheshwari615da152018-02-13 23:53:36 -0600300
301
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600302Test Power Reading Via IPMI Raw Command
303 [Documentation] Test power reading via IPMI raw command and verify
304 ... using REST.
305 [Tags] Test_Power_Reading_Via_IPMI_Raw_Command
306
307 # Response data structure of power reading command output via IPMI.
308 # 1 Completion Code. Refer to section 8, DCMI Completion Codes.
309 # 2 Group Extension Identification = DCh
310 # 3:4 Current Power in watts
311
312 ${ipmi_raw_output}= Run IPMI Standard Command
313 ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]}
314
315 @{raw_output_list}= Split String ${ipmi_raw_output} ${SPACE}
316
317 # On successful execution of raw IPMI power reading command, completion
318 # code does not come in output. So current power value will start from 2
319 # byte instead of 3.
320
321 ${power_reading_ipmi_raw_3_item}= Get From List ${raw_output_list} 2
322 ${power_reading_ipmi_raw_3_item}=
323 ... Convert To Integer 0x${power_reading_ipmi_raw_3_item}
324
325 ${power_reading_rest}= Read Attribute
326 ... ${SENSORS_URI}power/total_power Value
327
328 # Example of power reading via REST
329 # "CriticalAlarmHigh": 0,
330 # "CriticalAlarmLow": 0,
331 # "CriticalHigh": 3100000000,
332 # "CriticalLow": 0,
333 # "Scale": -6,
334 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
335 # "Value": 228000000,
336 # "WarningAlarmHigh": 0,
337 # "WarningAlarmLow": 0,
338 # "WarningHigh": 3050000000,
339 # "WarningLow": 0
340
341 # Get power value based on scale i.e. Value * (10 power Scale Value)
342 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
343
344 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
345 ${ipmi_rest_power_diff}=
346 ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi_raw_3_item})
347
348 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
349 ... msg=Power Reading above allowed threshold ${allowed_power_diff}.
350
351
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600352Test Baseboard Temperature Via IPMI
353 [Documentation] Test baseboard temperature via IPMI and verify using REST.
354 [Tags] Test_Baseboard_Temperature_Via_IPMI
355
356 # Example of IPMI dcmi get_temp_reading output:
357 # Entity ID Entity Instance Temp. Readings
358 # Inlet air temperature(40h) 1 +19 C
359 # CPU temperature sensors(41h) 5 +51 C
360 # CPU temperature sensors(41h) 6 +50 C
361 # CPU temperature sensors(41h) 7 +50 C
362 # CPU temperature sensors(41h) 8 +50 C
363 # CPU temperature sensors(41h) 9 +50 C
364 # CPU temperature sensors(41h) 10 +48 C
365 # CPU temperature sensors(41h) 11 +49 C
366 # CPU temperature sensors(41h) 12 +47 C
367 # CPU temperature sensors(41h) 8 +50 C
368 # CPU temperature sensors(41h) 16 +51 C
369 # CPU temperature sensors(41h) 24 +50 C
370 # CPU temperature sensors(41h) 32 +43 C
371 # CPU temperature sensors(41h) 40 +43 C
372 # Baseboard temperature sensors(42h) 1 +35 C
373
374 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
375 ${baseboard_temp_line}=
376 ... Get Lines Containing String ${temp_reading}
377 ... Baseboard temperature case-insensitive=True
378
379 ${baseboard_temp_ipmi}= Fetch From Right ${baseboard_temp_line} +
380 ${baseboard_temp_ipmi}= Remove String ${baseboard_temp_ipmi} ${SPACE}C
381
382 ${baseboard_temp_rest}= Read Attribute
383 ... /xyz/openbmc_project/sensors/temperature/pcie Value
384 ${baseboard_temp_rest}= Evaluate ${baseboard_temp_rest}/1000
385
386 Should Be True
387 ... ${baseboard_temp_rest} - ${baseboard_temp_ipmi} <= ${allowed_temp_diff}
388 ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}.
389
390
Sweta Potthurif39022d2018-02-06 03:40:07 -0600391Retrieve Default Gateway Via IPMI And Verify Using REST
392 [Documentation] Retrieve default gateway from LAN print using IPMI.
393 [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify_Using_REST
394
395 # Fetch "Default Gateway" from IPMI LAN print.
396 ${default_gateway_ipmi}= Fetch Details From LAN Print Default Gateway IP
397
398 # Verify "Default Gateway" using REST.
399 Read Attribute ${NETWORK_MANAGER}/config DefaultGateway
400 ... expected_value=${default_gateway_ipmi}
401
402
403Retrieve MAC Address Via IPMI And Verify Using REST
404 [Documentation] Retrieve MAC Address from LAN print using IPMI.
405 [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_REST
406
407 # Fetch "MAC Address" from IPMI LAN print.
408 ${mac_address_ipmi}= Fetch Details From LAN Print MAC Address
409
410 # Verify "MAC Address" using REST.
411 ${mac_address_rest}= Get BMC MAC Address
412 Should Be Equal ${mac_address_ipmi} ${mac_address_rest}
413 ... msg=Verification of MAC address from lan print using IPMI failed.
414
415
416Retrieve Network Mode Via IPMI And Verify Using REST
417 [Documentation] Retrieve network mode from LAN print using IPMI.
418 [Tags] Retrieve_Network_Mode_Via_IPMI_And_Verify_Using_REST
419
420 # Fetch "Mode" from IPMI LAN print.
421 ${network_mode_ipmi}= Fetch Details From LAN Print Source
422
423 # Verify "Mode" using REST.
424 ${network_mode_rest}= Read Attribute
425 ... ${NETWORK_MANAGER}/eth0 DHCPEnabled
426 Run Keyword If '${network_mode_ipmi}' == 'Static Address'
427 ... Should Be Equal ${network_mode_rest} ${0}
428 ... msg=Verification of network setting failed.
429 ... ELSE IF '${network_mode_ipmi}' == 'DHCP'
430 ... Should Be Equal ${network_mode_rest} ${1}
431 ... msg=Verification of network setting failed.
432
433
434Retrieve IP Address Via IPMI And Verify With BMC Details
435 [Documentation] Retrieve IP address from LAN print using IPMI.
436 [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_With_BMC_Details
437
438 # Fetch "IP Address" from IPMI LAN print.
439 ${ip_addr_ipmi}= Fetch Details From LAN Print IP Address
440
441 # Verify the IP address retrieved via IPMI with BMC IPs.
442 ${ip_address_rest}= Get BMC IP Info
443 Validate IP On BMC ${ip_addr_ipmi} ${ip_address_rest}
444
445
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600446Verify Get Device ID
447 [Documentation] Verify get device ID command output.
448 [Tags] Verify_Get_Device_ID
449
450 # Example of get device ID command output:
451 # Device ID : 0
452 # Device Revision : 0
453 # Firmware Revision : 2.01
454 # IPMI Version : 2.0
455 # Manufacturer ID : 42817
456 # Manufacturer Name : Unknown (0xA741)
457 # Product ID : 16975 (0x424f)
458 # Product Name : Unknown (0x424F)
459 # Device Available : yes
460 # Provides Device SDRs : yes
461 # Additional Device Support :
462 # Sensor Device
463 # SEL Device
464 # FRU Inventory Device
465 # Chassis Device
466 # Aux Firmware Rev Info :
George Keishing3511a3f2018-04-19 10:38:30 -0500467 # 0x04
468 # 0x38
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600469 # 0x00
George Keishing3511a3f2018-04-19 10:38:30 -0500470 # 0x03
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600471
472 ${mc_info}= Get MC Info
473
474 Should Be Equal ${mc_info['device_id']} 0
475 Should Be Equal ${mc_info['device_revision']} 0
476
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500477 # Get firmware revision from mc info command output i.e. 2.01
478 ${ipmi_fw_major_version} ${ipmi_fw_minor_version}=
479 ... Split String ${mc_info['firmware_revision']} .
480 # Convert minor firmware version from BCD format to integer. i.e. 01 to 1
481 ${ipmi_fw_minor_version}= Convert To Integer ${ipmi_fw_minor_version}
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600482
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500483 # Get BMC version from BMC CLI i.e. 2.1 from "ibm-v2.1-338-r1-0-gbcd7765"
George Keishing3511a3f2018-04-19 10:38:30 -0500484 ${bmc_version_full}= Get BMC Version
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500485 ${bmc_version}=
George Keishing3511a3f2018-04-19 10:38:30 -0500486 ... Remove String Using Regexp ${bmc_version_full} ^[^0-9]+ [^0-9\.].*
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500487
488 # Get major and minor version from BMC version i.e. 2 and 1 from 2.1
489 ${bmc_major_version} ${bmc_minor_version}=
490 ... Split String ${bmc_version} .
491
492 Should Be Equal As Strings ${ipmi_fw_major_version} ${bmc_major_version}
493 ... msg=Major version mis-match.
494 Should Be Equal As Strings ${ipmi_fw_minor_version} ${bmc_minor_version}
495 ... msg=Minor version mis-match.
496
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600497 Should Be Equal ${mc_info['ipmi_version']} 2.0
498
Gunnar Mills917ba1a2018-04-08 16:42:12 -0500499 # TODO: Verify Manufacturer and Product IDs directly from json file.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600500 # Reference : openbmc/openbmc-test-automation#1244
501 Should Be Equal ${mc_info['manufacturer_id']} 42817
502 Should Be Equal ${mc_info['product_id']} 16975 (0x424f)
503
504 Should Be Equal ${mc_info['device_available']} yes
505 Should Be Equal ${mc_info['provides_device_sdrs']} yes
506 Should Contain ${mc_info['additional_device_support']} Sensor Device
507 Should Contain ${mc_info['additional_device_support']} SEL Device
508 Should Contain
509 ... ${mc_info['additional_device_support']} FRU Inventory Device
510 Should Contain ${mc_info['additional_device_support']} Chassis Device
George Keishingb746d3f2018-04-19 10:53:10 -0500511
George Keishing3511a3f2018-04-19 10:38:30 -0500512 # Auxiliary revision data verification.
513 ${aux_version}= Get Aux Version ${bmc_version_full}
514
515 # From aux_firmware_rev_info field ['0x04', '0x38', '0x00', '0x03']
516 ${bmc_aux_version}= Catenate
517 ... SEPARATOR=
518 ... ${mc_info['aux_firmware_rev_info'][0][2:]}
519 ... ${mc_info['aux_firmware_rev_info'][1][2:]}
520 ... ${mc_info['aux_firmware_rev_info'][2][2:]}
521 ... ${mc_info['aux_firmware_rev_info'][3][2:]}
522
523 Should Be Equal As Integers
524 ... ${bmc_aux_version} ${aux_version}
525 ... msg=BMC aux version ${bmc_aux_version} does not match expected value of ${aux_version}.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600526
527
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500528Verify SDR Info
529 [Documentation] Verify sdr info command output.
530 [Tags] Verify_SDR_Info
531
532 # Example of SDR info command output:
533 # SDR Version : 0x51
534 # Record Count : 216
535 # Free Space : unspecified
536 # Most recent Addition :
537 # Most recent Erase :
538 # SDR overflow : no
539 # SDR Repository Update Support : unspecified
540 # Delete SDR supported : no
541 # Partial Add SDR supported : no
542 # Reserve SDR repository supported : no
543 # SDR Repository Alloc info supported : no
544
545 ${sdr_info}= Get SDR Info
546 Should Be Equal ${sdr_info['sdr_version']} 0x51
547
548 # Get sensor count from "sdr elist all" command output.
549 ${sensor_count}= Get Sensor Count
550 Should Be Equal As Strings
551 ... ${sdr_info['record_count']} ${sensor_count}
552
553 Should Be Equal ${sdr_info['free_space']} unspecified
554 Should Be Equal ${sdr_info['most_recent_addition']} ${EMPTY}
555 Should Be Equal ${sdr_info['most_recent_erase']} ${EMPTY}
556 Should Be Equal ${sdr_info['sdr_overflow']} no
557 Should Be Equal ${sdr_info['sdr_repository_update_support']} unspecified
558 Should Be Equal ${sdr_info['delete_sdr_supported']} no
559 Should Be Equal ${sdr_info['partial_add_sdr_supported']} no
560 Should Be Equal ${sdr_info['reserve_sdr_repository_supported']} no
561 Should Be Equal ${sdr_info['sdr_repository_alloc_info_supported']} no
562
563
George Keishing02651f02018-04-11 02:07:16 -0500564Test Valid IPMI Channels Supported
565 [Documentation] Verify IPMI channels supported on a given system.
566 [Tags] Test_Valid_IPMI_Channels_Supported
567
568 ${channel_count}= Get Physical Network Interface Count
569
570 # Note: IPMI network channel logically starts from 1.
571 :FOR ${channel_number} IN RANGE 1 ${channel_count}
572 \ Run External IPMI Standard Command lan print ${channel_number}
573
574
575Test Invalid IPMI Channel Response
576 [Documentation] Verify invalid IPMI channels supported response.
577 [Tags] Test_Invalid_IPMI_Channel_Response
578
579 ${channel_count}= Get Physical Network Interface Count
580
581 # To target invalid channel, increment count.
582 ${channel_number}= Evaluate ${channel_count} + 1
583
584 # Example of invalid channel:
585 # $ ipmitool -I lanplus -H xx.xx.xx.xx -P 0penBmc lan print 3
586 # Get Channel Info command failed: Parameter out of range
587 # Invalid channel: 3
588
589 ${stdout}= Run External IPMI Standard Command
590 ... lan print ${channel_number} fail_on_err=${0}
591 Should Contain ${stdout} Invalid channel
592 ... msg=IPMI channel ${channel_number} is invalid but seen working.
593
594
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500595*** Keywords ***
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600596
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500597Get Sensor Count
598 [Documentation] Get sensors count using "sdr elist all" command.
599
600 # Example of "sdr elist all" command output:
601 # BootProgress | 03h | ok | 34.2 |
602 # OperatingSystemS | 05h | ok | 35.1 |
603 # AttemptsLeft | 07h | ok | 34.1 |
604 # occ0 | 08h | ok | 210.1 | Device Disabled
605 # occ1 | 09h | ok | 210.2 | Device Disabled
606 # p0_core0_temp | 11h | ns | 3.1 | Disabled
607 # cpu0_core0 | 12h | ok | 208.1 | Presence detected
608 # p0_core1_temp | 14h | ns | 3.2 | Disabled
609 # cpu0_core1 | 15h | ok | 208.2 | Presence detected
610 # p0_core2_temp | 17h | ns | 3.3 | Disabled
611 # ..
612 # ..
613 # ..
614 # ..
615 # ..
616 # ..
617 # fan3 | 00h | ns | 29.4 | Logical FRU @35h
618 # bmc | 00h | ns | 6.1 | Logical FRU @3Ch
619 # ethernet | 00h | ns | 1.1 | Logical FRU @46h
620
621 ${output}= Run IPMI Standard Command sdr elist all
622 ${sensor_list}= Split String ${output} \n
623 ${sensor_count}= Get Length ${sensor_list}
624 [Return] ${sensor_count}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600625
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600626Set Management Controller ID String
627 [Documentation] Set the management controller ID string.
628 [Arguments] ${string}
629
630 # Description of argument(s):
631 # string Management Controller ID String to be set
632
633 ${set_mc_id_string}= Run IPMI Standard Command
634 ... dcmi set_mc_id_string ${string}
635
Sweta Potthurif39022d2018-02-06 03:40:07 -0600636
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600637Get Management Controller ID String And Verify
638 [Documentation] Get the management controller ID sting.
639 [Arguments] ${string}
640
641 # Description of argument(s):
642 # string Management Controller ID string
643
644 ${get_mc_id}= Run IPMI Standard Command dcmi get_mc_id_string
645 Should Contain ${get_mc_id} ${string}
646 ... msg=Command failed: get_mc_id.
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600647
Sweta Potthurif39022d2018-02-06 03:40:07 -0600648
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600649Set Watchdog Enabled Using REST
650 [Documentation] Set watchdog Enabled field using REST.
651 [Arguments] ${value}
652
653 # Description of argument(s):
654 # value Integer value (eg. "0-Disabled", "1-Enabled").
655
656 ${value_dict}= Create Dictionary data=${value}
657 ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}/attr/Enabled
658 ... data=${value_dict}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600659
660
Sweta Potthurif39022d2018-02-06 03:40:07 -0600661Fetch Details From LAN Print
662 [Documentation] Fetch details from LAN print.
663 [Arguments] ${field_name}
664
665 # Description of argument(s):
666 # ${field_name} Field name to be fetched from LAN print
667 # (e.g. "MAC Address", "Source").
668
Sweta Potthuric64322a2018-02-22 05:30:30 -0600669 ${stdout}= Run External IPMI Standard Command lan print
Sweta Potthurif39022d2018-02-06 03:40:07 -0600670 ${fetch_value}= Get Lines Containing String ${stdout} ${field_name}
671 ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE}
672 [Return] ${value_fetch}
673
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600674
675Verify Power Reading
676 [Documentation] Get dcmi power reading via IPMI.
677
678 # Example of power reading command output via IPMI.
679 # Instantaneous power reading: 235 Watts
680 # Minimum during sampling period: 235 Watts
681 # Maximum during sampling period: 235 Watts
682 # Average power reading over sample period: 235 Watts
683 # IPMI timestamp: Thu Jan 1 00:00:00 1970
684 # Sampling period: 00000000 Seconds.
685 # Power reading state is: deactivated
686
687 ${power_reading}= Get IPMI Power Reading
688
689 ${host_state}= Get Host State
690 Run Keyword If '${host_state}' == 'Off'
George Keishing51314872018-03-31 13:24:35 -0500691 ... Should Be Equal ${power_reading['instantaneous_power_reading']} 0
692 ... msg=Power reading not zero when power is off.
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600693
George Keishing51314872018-03-31 13:24:35 -0500694 Run Keyword If '${power_reading['instantaneous_power_reading']}' != '0'
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600695 ... Verify Power Reading Using REST ${power_reading['instantaneous_power_reading']}
696
697
Rahul Maheshwari0eb33f02018-04-10 02:31:54 -0500698Verify Management Controller ID String Status
699 [Documentation] Verify management controller ID string status via IPMI.
700 [Arguments] ${status}
701
702 # Example of dcmi get_conf_param command output:
703 # DHCP Discovery method :
704 # Management Controller ID String is disabled
705 # Vendor class identifier DCMI IANA and Vendor class-specific Informationa are disabled
706 # Initial timeout interval : 4 seconds
707 # Server contact timeout interval : 120 seconds
708 # Server contact retry interval : 64 seconds
709
710 ${resp}= Run IPMI Standard Command dcmi get_conf_param
711 ${resp}= Get Lines Containing String ${resp}
712 ... Management Controller ID String case_insensitive=True
713 Should Contain ${resp} ${status}
714 ... msg=Management controller ID string is not ${status}
715
716
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600717Verify Power Reading Using REST
718 [Documentation] Verify power reading using REST.
719 [Arguments] ${power_reading}
720
Gunnar Mills948e2e22018-03-23 12:54:27 -0500721 # Description of argument(s):
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600722 # power_reading IPMI Power reading
723
724 ${power_reading_rest}= Read Attribute
725 ... ${SENSORS_URI}power/total_power Value
726
727 # Example of power reading via REST
728 # "CriticalAlarmHigh": 0,
729 # "CriticalAlarmLow": 0,
730 # "CriticalHigh": 3100000000,
731 # "CriticalLow": 0,
732 # "Scale": -6,
733 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
734 # "Value": 228000000,
735 # "WarningAlarmHigh": 0,
736 # "WarningAlarmLow": 0,
737 # "WarningHigh": 3050000000,
738 # "WarningLow": 0
739
740 # Get power value based on scale i.e. Value * (10 power Scale Value)
741 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
742 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
743 ${ipmi_rest_power_diff}=
744 ... Evaluate abs(${power_reading_rest} - ${power_reading})
745
746 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
747 ... msg=Power reading above allowed threshold ${allowed_power_diff}.
George Keishing02651f02018-04-11 02:07:16 -0500748
749
750Get Physical Network Interface Count
751 [Documentation] Return valid physical network interfaces count.
752
753 # Example:
754 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
755 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
756
757 ${mac_entry_list}= Get BMC MAC Address List
758 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
759 ${physical_interface_count}= Get Length ${mac_unique_list}
760
761 [Return] ${physical_interface_count}
George Keishing39967eb2018-04-30 11:36:23 -0500762
763
764Execute IPMI Command With Cipher
765 [Documentation] Execute IPMI command with a given cipher level value.
766 [Arguments] ${cipher_level}
767
768 # Description of argument(s):
769 # cipher_level IPMI chipher level value
770 # (e.g. "1", "2", "3", "15", "16", "17").
771
772 ${ipmi_cmd}= Catenate SEPARATOR=
773 ... ipmitool -I lanplus -C ${cipher_level} -P${SPACE}${IPMI_PASSWORD}
774 ... ${SPACE}${HOST}${SPACE}${OPENBMC_HOST}${SPACE}mc info
775
776 ${rc} ${output}= Run And Return RC and Output ${ipmi_cmd}
777 Should Be Equal ${rc} ${0} msg=${output}