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