blob: 781cbaf6382b8c5c5bfbbbd9cd6af93f210da81e [file] [log] [blame]
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -05001*** Settings ***
2Documentation This suite is for testing general IPMI functions.
3
4Resource ../../lib/ipmi_client.robot
5Resource ../../lib/openbmc_ffdc.robot
George Keishing0825a112018-03-30 10:48:07 -05006Resource ../../lib/boot_utils.robot
George Keishing78ce8dc2018-03-30 11:49:06 -05007Resource ../../lib/utils.robot
Sweta Potthurif39022d2018-02-06 03:40:07 -06008Resource ../../lib/bmc_network_utils.robot
George Keishingd6273802018-09-07 07:06:53 -05009Resource ../../lib/logging_utils.robot
George Keishing78ce8dc2018-03-30 11:49:06 -050010Library ../../lib/ipmi_utils.py
George Keishing0825a112018-03-30 10:48:07 -050011Variables ../../data/ipmi_raw_cmd_table.py
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050012
13Test Teardown FFDC On Test Case Fail
14
15*** Variables ***
16
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060017${new_mc_id}= HOST
Rahul Maheshwari901dcde2018-02-06 03:14:31 -060018${allowed_temp_diff}= ${1}
Rahul Maheshwari615da152018-02-13 23:53:36 -060019${allowed_power_diff}= ${10}
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060020
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050021*** Test Cases ***
22
George Keishingd6273802018-09-07 07:06:53 -050023Verify IPMI SEL Version
24 [Documentation] Verify IPMI SEL's version info.
25 [Tags] Verify_IPMI_SEL_Version
26
27 ${version_info}= Get IPMI SEL Setting Version
28 ${setting_status}= Fetch From Left ${version_info} (
29 ${setting_status}= Evaluate $setting_status.replace(' ','')
30
31 Should Be True ${setting_status} >= 1.5
32 Should Contain ${version_info} v2 compliant case_insensitive=True
33
34
George Keishing9acd2282018-09-07 07:21:41 -050035Verify Empty SEL
36 [Documentation] Verify empty SEL list.
37 [Tags] Verify_Empty_SEL
38
39 Delete Error Logs And Verify
40
41 ${resp}= Run IPMI Standard Command sel list
42 Should Contain ${resp} SEL has no entries case_insensitive=True
43
44
George Keishing39967eb2018-04-30 11:36:23 -050045Verify Supported Cipher List
46 [Documentation] Execute all supported cipher levels and verify.
47 [Tags] Verify_Supported_Cipher_List
48
49 :FOR ${cipher_level} IN @{valid_cipher_list}
Rahul Maheshwari19faedf2018-08-29 00:42:09 -050050 \ ${status}= Execute IPMI Command With Cipher ${cipher_level}
51 \ Should Be Equal ${status} ${0}
52
53
54Verify Unsupported Cipher List
55 [Documentation] Execute all unsupported cipher levels and verify error.
56 [Tags] Verify_Unsupported_Cipher_List
57
58 :FOR ${cipher_level} IN @{unsupported_cipher_list}
59 \ ${status}= Execute IPMI Command With Cipher ${cipher_level}
60 \ Should Be Equal ${status} ${1}
61
George Keishing39967eb2018-04-30 11:36:23 -050062
Rahul Maheshwari2837a812018-09-03 01:00:33 -050063Verify Supported Cipher List Via Lan Print
64 [Documentation] Verify supported cipher list via IPMI lan print command.
65 [Tags] Verify_Supported_Cipher_List_Via_Lan_Print
66
67
68 ${network_info_dict}= Get Lan Print Dict
69 # Example 'RMCP+ Cipher Suites' entry: 3,17
70 ${cipher_list}= Evaluate
71 ... map(int, $network_info_dict['RMCP+ Cipher Suites'].split(','))
72 Lists Should Be Equal ${cipher_list} ${valid_cipher_list}
73
74
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050075Set Asset Tag With Valid String Length
76 [Documentation] Set asset tag with valid string length and verify.
77 [Tags] Set_Asset_Tag_With_Valid_String_Length
78
79 # Allowed MAX characters length for asset tag name is 63.
80 ${random_string}= Generate Random String 63
81 Run Keyword Run IPMI Standard Command dcmi set_asset_tag ${random_string}
82
83 ${asset_tag}= Run Keyword Run IPMI Standard Command dcmi asset_tag
84 Should Contain ${asset_tag} ${random_string}
85
86
87Set Asset Tag With Invalid String Length
88 [Documentation] Verify error while setting invalid asset tag via IPMI.
89 [Tags] Set_Asset_Tag_With_Invalid_String_Length
90
91 # Any string more than 63 character is invalid for asset tag.
92 ${random_string}= Generate Random String 64
93
94 ${resp}= Run Keyword And Expect Error * Run IPMI Standard Command
95 ... dcmi set_asset_tag ${random_string}
96 Should Contain ${resp} Parameter out of range ignore_case=True
97
98
99Set Asset Tag With Valid String Length Via REST
100 [Documentation] Set valid asset tag via REST and verify.
101 [Tags] Set_Asset_Tag_With_Valid_String_Length_Via_REST
102
103 ${random_string}= Generate Random String 63
104 ${args}= Create Dictionary data=${random_string}
105 Write Attribute /xyz/openbmc_project/inventory/system AssetTag
106 ... data=${args}
107
108 ${asset_tag}= Read Attribute /xyz/openbmc_project/inventory/system
109 ... AssetTag
110 Should Be Equal As Strings ${asset_tag} ${random_string}
111
Sweta Potthurif39022d2018-02-06 03:40:07 -0600112
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600113Verify Get And Set Management Controller ID String
114 [Documentation] Verify get and set management controller ID string.
115 [Tags] Verify_Get_And_Set_Management_Controller_ID_String
116
117 # Get the value of the managemment controller ID string.
118 # Example:
119 # Get Management Controller Identifier String: witherspoon
120
121 ${cmd_output}= Run IPMI Standard Command dcmi get_mc_id_string
122
123 # Extract management controller ID from cmd_output.
124 ${initial_mc_id}= Fetch From Right ${cmd_output} :${SPACE}
125
126 # Set the management controller ID string to other value.
127 # Example:
128 # Set Management Controller Identifier String Command: HOST
129
130 Set Management Controller ID String ${new_mc_id}
131
132 # Get the management controller ID and verify.
133 Get Management Controller ID String And Verify ${new_mc_id}
134
135 # Set the value back to the initial value and verify.
136 Set Management Controller ID String ${initial_mc_id}
137
138 # Get the management controller ID and verify.
139 Get Management Controller ID String And Verify ${initial_mc_id}
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500140
Sweta Potthurif39022d2018-02-06 03:40:07 -0600141
Rahul Maheshwari0eb33f02018-04-10 02:31:54 -0500142Test Management Controller ID String Status via IPMI
143 [Documentation] Test management controller ID string status via IPMI.
144 [Tags] Test_Management_Controller_ID_String_Status_via_IPMI
145
146 # Disable management controller ID string status via IPMI and verify.
147 Run IPMI Standard Command dcmi set_conf_param dhcp_config 0x00
148 Verify Management Controller ID String Status disable
149
150 # Enable management controller ID string status via IPMI and verify.
151 Run IPMI Standard Command dcmi set_conf_param dhcp_config 0x01
152 Verify Management Controller ID String Status enable
153
154
155Test Management Controller ID String Status via Raw IPMI
156 [Documentation] Test management controller ID string status via IPMI.
157 [Tags] Test_Management_Controller_ID_String_Status_via_Raw_IPMI
158
159 # Disable management controller ID string status via raw IPMI and verify.
160 Run IPMI Standard Command raw ${IPMI_RAW_CMD['conf_param']['Disabled'][0]}
161 Verify Management Controller ID String Status disable
162
163 # Enable management controller ID string status via raw IPMI and verify.
164 Run IPMI Standard Command raw ${IPMI_RAW_CMD['conf_param']['Enabled'][0]}
165 Verify Management Controller ID String Status enable
166
167
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600168Verify Chassis Identify via IPMI
169 [Documentation] Verify "chassis identify" using IPMI command.
170 [Tags] Verify_Chassis_Identify_via_IPMI
171
172 # Set to default "chassis identify" and verify that LED blinks for 15s.
173 Run IPMI Standard Command chassis identify
174 Verify Identify LED State Blink
175
176 Sleep 15s
177 Verify Identify LED State Off
178
179 # Set "chassis identify" to 10s and verify that the LED blinks for 10s.
180 Run IPMI Standard Command chassis identify 10
181 Verify Identify LED State Blink
182
183 Sleep 10s
184 Verify Identify LED State Off
185
Sweta Potthurif39022d2018-02-06 03:40:07 -0600186
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600187Verify Chassis Identify Off And Force Identify On via IPMI
188 [Documentation] Verify "chassis identify" off
189 ... and "force identify on" via IPMI.
190 [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI
191
192 # Set the LED to "Force Identify On".
193 Run IPMI Standard Command chassis identify force
194 Verify Identify LED State Blink
195
196 # Set "chassis identify" to 0 and verify that the LED turns off.
197 Run IPMI Standard Command chassis identify 0
198 Verify Identify LED State Off
199
Sweta Potthurif39022d2018-02-06 03:40:07 -0600200
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600201Test Watchdog Reset Via IPMI And Verify Using REST
202 [Documentation] Test watchdog reset via IPMI and verify using REST.
203 [Tags] Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST
204
205 Initiate Host Boot
206
207 Set Watchdog Enabled Using REST ${1}
208
209 Watchdog Object Should Exist
210
211 # Resetting the watchdog via IPMI.
212 Run IPMI Standard Command mc watchdog reset
213
214 # Verify the watchdog is reset using REST after an interval of 1000ms.
215 Sleep 1000ms
216 ${watchdog_time_left}=
217 ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining
218 Should Be True
219 ... ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000}
220 ... msg=Watchdog timer didn't reset.
221
Sweta Potthurif39022d2018-02-06 03:40:07 -0600222
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600223Test Watchdog Off Via IPMI And Verify Using REST
224 [Documentation] Test watchdog off via IPMI and verify using REST.
225 [Tags] Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST
226
227 Initiate Host Boot
228
229 Set Watchdog Enabled Using REST ${1}
230
231 Watchdog Object Should Exist
232
233 # Turn off the watchdog via IPMI.
234 Run IPMI Standard Command mc watchdog off
235
236 # Verify the watchdog is off using REST
237 ${watchdog_state}= Read Attribute ${HOST_WATCHDOG_URI} Enabled
238 Should Be Equal ${watchdog_state} ${0}
239 ... msg=msg=Verification failed for watchdog off check.
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600240
241
242Test Ambient Temperature Via IPMI
243 [Documentation] Test ambient temperature via IPMI and verify using REST.
244 [Tags] Test_Ambient_Temperature_Via_IPMI
245
246 # Entity ID Entity Instance Temp. Readings
247 # Inlet air temperature(40h) 1 +19 C
248 # CPU temperature sensors(41h) 5 +51 C
249 # CPU temperature sensors(41h) 6 +50 C
250 # CPU temperature sensors(41h) 7 +50 C
251 # CPU temperature sensors(41h) 8 +50 C
252 # CPU temperature sensors(41h) 9 +50 C
253 # CPU temperature sensors(41h) 10 +48 C
254 # CPU temperature sensors(41h) 11 +49 C
255 # CPU temperature sensors(41h) 12 +47 C
256 # CPU temperature sensors(41h) 8 +50 C
257 # CPU temperature sensors(41h) 16 +51 C
258 # CPU temperature sensors(41h) 24 +50 C
259 # CPU temperature sensors(41h) 32 +43 C
260 # CPU temperature sensors(41h) 40 +43 C
261 # Baseboard temperature sensors(42h) 1 +35 C
262
263 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
George Keishing77f1ad22018-07-23 12:39:28 -0500264 Should Contain ${temp_reading} Inlet air temperature
265 ... msg="Unable to get inlet temperature via DCMI".
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600266 ${ambient_temp_line}=
267 ... Get Lines Containing String ${temp_reading}
268 ... Inlet air temperature case-insensitive
269
270 ${ambient_temp_ipmi}= Fetch From Right ${ambient_temp_line} +
271 ${ambient_temp_ipmi}= Remove String ${ambient_temp_ipmi} ${SPACE}C
272
273 ${ambient_temp_rest}= Read Attribute
274 ... ${SENSORS_URI}temperature/ambient Value
275
276 # Example of ambient temperature via REST
277 # "CriticalAlarmHigh": 0,
278 # "CriticalAlarmLow": 0,
279 # "CriticalHigh": 35000,
280 # "CriticalLow": 0,
281 # "Scale": -3,
282 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
283 # "Value": 21775,
284 # "WarningAlarmHigh": 0,
285 # "WarningAlarmLow": 0,
286 # "WarningHigh": 25000,
287 # "WarningLow": 0
288
289 # Get temperature value based on scale i.e. Value * (10 power Scale Value)
290 # e.g. from above case 21775 * (10 power -3) = 21775/1000
291
292 ${ambient_temp_rest}= Evaluate ${ambient_temp_rest}/1000
293 ${ipmi_rest_temp_diff}=
294 ... Evaluate abs(${ambient_temp_rest} - ${ambient_temp_ipmi})
295
296 Should Be True ${ipmi_rest_temp_diff} <= ${allowed_temp_diff}
297 ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}.
298
299
Rahul Maheshwari43556632018-02-05 23:42:52 -0600300Verify Get DCMI Capabilities
301 [Documentation] Verify get DCMI capabilities command output.
302 [Tags] Verify_Get_DCMI_Capabilities
303
304 ${cmd_output}= Run IPMI Standard Command dcmi discover
305
306 @{supported_capabilities}= Create List
307 # Supported DCMI capabilities:
308 ... Mandatory platform capabilties
309 ... Optional platform capabilties
310 ... Power management available
311 ... Managebility access capabilties
312 ... In-band KCS channel available
313 # Mandatory platform attributes:
314 ... 200 SEL entries
315 ... SEL automatic rollover is enabled
316 # Optional Platform Attributes:
317 ... Slave address of device: 0h (8bits)(Satellite/External controller)
318 ... Channel number is 0h (Primary BMC)
319 ... Device revision is 0
320 # Manageability Access Attributes:
321 ... Primary LAN channel number: 1 is available
322 ... Secondary LAN channel is not available for OOB
323 ... No serial channel is available
324
325 :FOR ${capability} IN @{supported_capabilities}
326 \ Should Contain ${cmd_output} ${capability} ignore_case=True
327 ... msg=Supported DCMI capabilities not present.
328
329
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600330Test Power Reading Via IPMI With Host Off
331 [Documentation] Test power reading via IPMI with host off state and
332 ... verify using REST.
333 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Off
Rahul Maheshwari615da152018-02-13 23:53:36 -0600334
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600335 REST Power Off stack_mode=skip quiet=1
Rahul Maheshwari615da152018-02-13 23:53:36 -0600336
George Keishinge78f1fd2018-09-04 13:34:59 -0500337 Wait Until Keyword Succeeds 1 min 20 sec Verify Power Reading
338
339
340Test Power Reading Via IPMI With Host Booted
341 [Documentation] Test power reading via IPMI with host booted state and
342 ... verify using REST.
343 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted
344
345 REST Power On stack_mode=skip quiet=1
346
347 # For a good power reading take a 3 samples for 15 seconds interval and
348 # average it out.
349
350 Wait Until Keyword Succeeds 1 min 20 sec Verify Power Reading
Rahul Maheshwari615da152018-02-13 23:53:36 -0600351
352
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600353Test Power Reading Via IPMI Raw Command
354 [Documentation] Test power reading via IPMI raw command and verify
355 ... using REST.
356 [Tags] Test_Power_Reading_Via_IPMI_Raw_Command
357
358 # Response data structure of power reading command output via IPMI.
359 # 1 Completion Code. Refer to section 8, DCMI Completion Codes.
360 # 2 Group Extension Identification = DCh
361 # 3:4 Current Power in watts
362
George Keishinge78f1fd2018-09-04 13:34:59 -0500363 REST Power On stack_mode=skip quiet=1
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600364
George Keishinge78f1fd2018-09-04 13:34:59 -0500365 Wait Until Keyword Succeeds 1 min 20 sec Verify Power Reading Via Raw Command
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600366
367
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600368Test Baseboard Temperature Via IPMI
369 [Documentation] Test baseboard temperature via IPMI and verify using REST.
370 [Tags] Test_Baseboard_Temperature_Via_IPMI
371
372 # Example of IPMI dcmi get_temp_reading output:
373 # Entity ID Entity Instance Temp. Readings
374 # Inlet air temperature(40h) 1 +19 C
375 # CPU temperature sensors(41h) 5 +51 C
376 # CPU temperature sensors(41h) 6 +50 C
377 # CPU temperature sensors(41h) 7 +50 C
378 # CPU temperature sensors(41h) 8 +50 C
379 # CPU temperature sensors(41h) 9 +50 C
380 # CPU temperature sensors(41h) 10 +48 C
381 # CPU temperature sensors(41h) 11 +49 C
382 # CPU temperature sensors(41h) 12 +47 C
383 # CPU temperature sensors(41h) 8 +50 C
384 # CPU temperature sensors(41h) 16 +51 C
385 # CPU temperature sensors(41h) 24 +50 C
386 # CPU temperature sensors(41h) 32 +43 C
387 # CPU temperature sensors(41h) 40 +43 C
388 # Baseboard temperature sensors(42h) 1 +35 C
389
390 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
George Keishing77f1ad22018-07-23 12:39:28 -0500391 Should Contain ${temp_reading} Baseboard temperature sensors
392 ... msg="Unable to get baseboard temperature via DCMI".
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600393 ${baseboard_temp_line}=
394 ... Get Lines Containing String ${temp_reading}
395 ... Baseboard temperature case-insensitive=True
396
397 ${baseboard_temp_ipmi}= Fetch From Right ${baseboard_temp_line} +
398 ${baseboard_temp_ipmi}= Remove String ${baseboard_temp_ipmi} ${SPACE}C
399
400 ${baseboard_temp_rest}= Read Attribute
401 ... /xyz/openbmc_project/sensors/temperature/pcie Value
402 ${baseboard_temp_rest}= Evaluate ${baseboard_temp_rest}/1000
403
404 Should Be True
405 ... ${baseboard_temp_rest} - ${baseboard_temp_ipmi} <= ${allowed_temp_diff}
406 ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}.
407
408
Sweta Potthurif39022d2018-02-06 03:40:07 -0600409Retrieve Default Gateway Via IPMI And Verify Using REST
410 [Documentation] Retrieve default gateway from LAN print using IPMI.
411 [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify_Using_REST
412
413 # Fetch "Default Gateway" from IPMI LAN print.
414 ${default_gateway_ipmi}= Fetch Details From LAN Print Default Gateway IP
415
416 # Verify "Default Gateway" using REST.
417 Read Attribute ${NETWORK_MANAGER}/config DefaultGateway
418 ... expected_value=${default_gateway_ipmi}
419
420
421Retrieve MAC Address Via IPMI And Verify Using REST
422 [Documentation] Retrieve MAC Address from LAN print using IPMI.
423 [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_REST
424
425 # Fetch "MAC Address" from IPMI LAN print.
426 ${mac_address_ipmi}= Fetch Details From LAN Print MAC Address
427
428 # Verify "MAC Address" using REST.
429 ${mac_address_rest}= Get BMC MAC Address
430 Should Be Equal ${mac_address_ipmi} ${mac_address_rest}
431 ... msg=Verification of MAC address from lan print using IPMI failed.
432
433
434Retrieve Network Mode Via IPMI And Verify Using REST
435 [Documentation] Retrieve network mode from LAN print using IPMI.
436 [Tags] Retrieve_Network_Mode_Via_IPMI_And_Verify_Using_REST
437
438 # Fetch "Mode" from IPMI LAN print.
439 ${network_mode_ipmi}= Fetch Details From LAN Print Source
440
441 # Verify "Mode" using REST.
442 ${network_mode_rest}= Read Attribute
443 ... ${NETWORK_MANAGER}/eth0 DHCPEnabled
444 Run Keyword If '${network_mode_ipmi}' == 'Static Address'
445 ... Should Be Equal ${network_mode_rest} ${0}
446 ... msg=Verification of network setting failed.
447 ... ELSE IF '${network_mode_ipmi}' == 'DHCP'
448 ... Should Be Equal ${network_mode_rest} ${1}
449 ... msg=Verification of network setting failed.
450
451
452Retrieve IP Address Via IPMI And Verify With BMC Details
453 [Documentation] Retrieve IP address from LAN print using IPMI.
454 [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_With_BMC_Details
455
456 # Fetch "IP Address" from IPMI LAN print.
457 ${ip_addr_ipmi}= Fetch Details From LAN Print IP Address
458
459 # Verify the IP address retrieved via IPMI with BMC IPs.
460 ${ip_address_rest}= Get BMC IP Info
461 Validate IP On BMC ${ip_addr_ipmi} ${ip_address_rest}
462
463
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600464Verify Get Device ID
465 [Documentation] Verify get device ID command output.
466 [Tags] Verify_Get_Device_ID
467
468 # Example of get device ID command output:
469 # Device ID : 0
470 # Device Revision : 0
471 # Firmware Revision : 2.01
472 # IPMI Version : 2.0
473 # Manufacturer ID : 42817
474 # Manufacturer Name : Unknown (0xA741)
475 # Product ID : 16975 (0x424f)
476 # Product Name : Unknown (0x424F)
477 # Device Available : yes
478 # Provides Device SDRs : yes
479 # Additional Device Support :
480 # Sensor Device
481 # SEL Device
482 # FRU Inventory Device
483 # Chassis Device
484 # Aux Firmware Rev Info :
George Keishing3511a3f2018-04-19 10:38:30 -0500485 # 0x04
486 # 0x38
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600487 # 0x00
George Keishing3511a3f2018-04-19 10:38:30 -0500488 # 0x03
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600489
490 ${mc_info}= Get MC Info
491
492 Should Be Equal ${mc_info['device_id']} 0
493 Should Be Equal ${mc_info['device_revision']} 0
494
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500495 # Get firmware revision from mc info command output i.e. 2.01
496 ${ipmi_fw_major_version} ${ipmi_fw_minor_version}=
497 ... Split String ${mc_info['firmware_revision']} .
498 # Convert minor firmware version from BCD format to integer. i.e. 01 to 1
499 ${ipmi_fw_minor_version}= Convert To Integer ${ipmi_fw_minor_version}
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600500
George Keishinge0a81282018-06-08 10:02:30 -0500501 # Get BMC version from BMC CLI i.e. 2.2 from "v2.2-253-g00050f1"
George Keishing3511a3f2018-04-19 10:38:30 -0500502 ${bmc_version_full}= Get BMC Version
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500503 ${bmc_version}=
George Keishing3511a3f2018-04-19 10:38:30 -0500504 ... Remove String Using Regexp ${bmc_version_full} ^[^0-9]+ [^0-9\.].*
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500505
506 # Get major and minor version from BMC version i.e. 2 and 1 from 2.1
507 ${bmc_major_version} ${bmc_minor_version}=
508 ... Split String ${bmc_version} .
509
510 Should Be Equal As Strings ${ipmi_fw_major_version} ${bmc_major_version}
511 ... msg=Major version mis-match.
512 Should Be Equal As Strings ${ipmi_fw_minor_version} ${bmc_minor_version}
513 ... msg=Minor version mis-match.
514
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600515 Should Be Equal ${mc_info['ipmi_version']} 2.0
516
Gunnar Mills917ba1a2018-04-08 16:42:12 -0500517 # TODO: Verify Manufacturer and Product IDs directly from json file.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600518 # Reference : openbmc/openbmc-test-automation#1244
519 Should Be Equal ${mc_info['manufacturer_id']} 42817
520 Should Be Equal ${mc_info['product_id']} 16975 (0x424f)
521
522 Should Be Equal ${mc_info['device_available']} yes
523 Should Be Equal ${mc_info['provides_device_sdrs']} yes
524 Should Contain ${mc_info['additional_device_support']} Sensor Device
525 Should Contain ${mc_info['additional_device_support']} SEL Device
526 Should Contain
527 ... ${mc_info['additional_device_support']} FRU Inventory Device
528 Should Contain ${mc_info['additional_device_support']} Chassis Device
George Keishingb746d3f2018-04-19 10:53:10 -0500529
George Keishing3511a3f2018-04-19 10:38:30 -0500530 # Auxiliary revision data verification.
531 ${aux_version}= Get Aux Version ${bmc_version_full}
532
533 # From aux_firmware_rev_info field ['0x04', '0x38', '0x00', '0x03']
534 ${bmc_aux_version}= Catenate
535 ... SEPARATOR=
536 ... ${mc_info['aux_firmware_rev_info'][0][2:]}
537 ... ${mc_info['aux_firmware_rev_info'][1][2:]}
538 ... ${mc_info['aux_firmware_rev_info'][2][2:]}
539 ... ${mc_info['aux_firmware_rev_info'][3][2:]}
540
541 Should Be Equal As Integers
542 ... ${bmc_aux_version} ${aux_version}
543 ... msg=BMC aux version ${bmc_aux_version} does not match expected value of ${aux_version}.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600544
545
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500546Verify SDR Info
547 [Documentation] Verify sdr info command output.
548 [Tags] Verify_SDR_Info
549
550 # Example of SDR info command output:
551 # SDR Version : 0x51
552 # Record Count : 216
553 # Free Space : unspecified
554 # Most recent Addition :
555 # Most recent Erase :
556 # SDR overflow : no
557 # SDR Repository Update Support : unspecified
558 # Delete SDR supported : no
559 # Partial Add SDR supported : no
560 # Reserve SDR repository supported : no
561 # SDR Repository Alloc info supported : no
562
563 ${sdr_info}= Get SDR Info
564 Should Be Equal ${sdr_info['sdr_version']} 0x51
565
566 # Get sensor count from "sdr elist all" command output.
567 ${sensor_count}= Get Sensor Count
568 Should Be Equal As Strings
569 ... ${sdr_info['record_count']} ${sensor_count}
570
571 Should Be Equal ${sdr_info['free_space']} unspecified
572 Should Be Equal ${sdr_info['most_recent_addition']} ${EMPTY}
573 Should Be Equal ${sdr_info['most_recent_erase']} ${EMPTY}
574 Should Be Equal ${sdr_info['sdr_overflow']} no
575 Should Be Equal ${sdr_info['sdr_repository_update_support']} unspecified
576 Should Be Equal ${sdr_info['delete_sdr_supported']} no
577 Should Be Equal ${sdr_info['partial_add_sdr_supported']} no
578 Should Be Equal ${sdr_info['reserve_sdr_repository_supported']} no
579 Should Be Equal ${sdr_info['sdr_repository_alloc_info_supported']} no
580
581
George Keishing02651f02018-04-11 02:07:16 -0500582Test Valid IPMI Channels Supported
583 [Documentation] Verify IPMI channels supported on a given system.
584 [Tags] Test_Valid_IPMI_Channels_Supported
585
586 ${channel_count}= Get Physical Network Interface Count
587
588 # Note: IPMI network channel logically starts from 1.
589 :FOR ${channel_number} IN RANGE 1 ${channel_count}
590 \ Run External IPMI Standard Command lan print ${channel_number}
591
592
593Test Invalid IPMI Channel Response
594 [Documentation] Verify invalid IPMI channels supported response.
595 [Tags] Test_Invalid_IPMI_Channel_Response
596
597 ${channel_count}= Get Physical Network Interface Count
598
599 # To target invalid channel, increment count.
600 ${channel_number}= Evaluate ${channel_count} + 1
601
602 # Example of invalid channel:
George Keishing72d0ac82018-09-20 09:33:01 -0500603 # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3
George Keishing02651f02018-04-11 02:07:16 -0500604 # Get Channel Info command failed: Parameter out of range
605 # Invalid channel: 3
606
607 ${stdout}= Run External IPMI Standard Command
608 ... lan print ${channel_number} fail_on_err=${0}
609 Should Contain ${stdout} Invalid channel
610 ... msg=IPMI channel ${channel_number} is invalid but seen working.
611
612
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500613*** Keywords ***
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600614
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500615Get Sensor Count
616 [Documentation] Get sensors count using "sdr elist all" command.
617
618 # Example of "sdr elist all" command output:
619 # BootProgress | 03h | ok | 34.2 |
620 # OperatingSystemS | 05h | ok | 35.1 |
621 # AttemptsLeft | 07h | ok | 34.1 |
622 # occ0 | 08h | ok | 210.1 | Device Disabled
623 # occ1 | 09h | ok | 210.2 | Device Disabled
624 # p0_core0_temp | 11h | ns | 3.1 | Disabled
625 # cpu0_core0 | 12h | ok | 208.1 | Presence detected
626 # p0_core1_temp | 14h | ns | 3.2 | Disabled
627 # cpu0_core1 | 15h | ok | 208.2 | Presence detected
628 # p0_core2_temp | 17h | ns | 3.3 | Disabled
629 # ..
630 # ..
631 # ..
632 # ..
633 # ..
634 # ..
635 # fan3 | 00h | ns | 29.4 | Logical FRU @35h
636 # bmc | 00h | ns | 6.1 | Logical FRU @3Ch
637 # ethernet | 00h | ns | 1.1 | Logical FRU @46h
638
639 ${output}= Run IPMI Standard Command sdr elist all
640 ${sensor_list}= Split String ${output} \n
641 ${sensor_count}= Get Length ${sensor_list}
642 [Return] ${sensor_count}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600643
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600644Set Management Controller ID String
645 [Documentation] Set the management controller ID string.
646 [Arguments] ${string}
647
648 # Description of argument(s):
649 # string Management Controller ID String to be set
650
651 ${set_mc_id_string}= Run IPMI Standard Command
652 ... dcmi set_mc_id_string ${string}
653
Sweta Potthurif39022d2018-02-06 03:40:07 -0600654
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600655Get Management Controller ID String And Verify
George Keishingcb3b9b62018-09-14 12:11:19 -0500656 [Documentation] Get the management controller ID string.
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600657 [Arguments] ${string}
658
659 # Description of argument(s):
660 # string Management Controller ID string
661
662 ${get_mc_id}= Run IPMI Standard Command dcmi get_mc_id_string
663 Should Contain ${get_mc_id} ${string}
664 ... msg=Command failed: get_mc_id.
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600665
Sweta Potthurif39022d2018-02-06 03:40:07 -0600666
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600667Set Watchdog Enabled Using REST
668 [Documentation] Set watchdog Enabled field using REST.
669 [Arguments] ${value}
670
671 # Description of argument(s):
672 # value Integer value (eg. "0-Disabled", "1-Enabled").
673
674 ${value_dict}= Create Dictionary data=${value}
675 ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}/attr/Enabled
676 ... data=${value_dict}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600677
678
Sweta Potthurif39022d2018-02-06 03:40:07 -0600679Fetch Details From LAN Print
680 [Documentation] Fetch details from LAN print.
681 [Arguments] ${field_name}
682
683 # Description of argument(s):
684 # ${field_name} Field name to be fetched from LAN print
685 # (e.g. "MAC Address", "Source").
686
Sweta Potthuric64322a2018-02-22 05:30:30 -0600687 ${stdout}= Run External IPMI Standard Command lan print
Sweta Potthurif39022d2018-02-06 03:40:07 -0600688 ${fetch_value}= Get Lines Containing String ${stdout} ${field_name}
689 ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE}
690 [Return] ${value_fetch}
691
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600692
693Verify Power Reading
694 [Documentation] Get dcmi power reading via IPMI.
695
696 # Example of power reading command output via IPMI.
697 # Instantaneous power reading: 235 Watts
698 # Minimum during sampling period: 235 Watts
699 # Maximum during sampling period: 235 Watts
700 # Average power reading over sample period: 235 Watts
701 # IPMI timestamp: Thu Jan 1 00:00:00 1970
702 # Sampling period: 00000000 Seconds.
703 # Power reading state is: deactivated
704
705 ${power_reading}= Get IPMI Power Reading
706
707 ${host_state}= Get Host State
708 Run Keyword If '${host_state}' == 'Off'
George Keishing51314872018-03-31 13:24:35 -0500709 ... Should Be Equal ${power_reading['instantaneous_power_reading']} 0
710 ... msg=Power reading not zero when power is off.
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600711
George Keishing51314872018-03-31 13:24:35 -0500712 Run Keyword If '${power_reading['instantaneous_power_reading']}' != '0'
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600713 ... Verify Power Reading Using REST ${power_reading['instantaneous_power_reading']}
714
715
George Keishinge78f1fd2018-09-04 13:34:59 -0500716Verify Power Reading Via Raw Command
717 [Documentation] Get dcmi power reading via IPMI raw command.
718
719 ${ipmi_raw_output}= Run IPMI Standard Command
720 ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]}
721
722 @{raw_output_list}= Split String ${ipmi_raw_output} ${SPACE}
723
724 # On successful execution of raw IPMI power reading command, completion
725 # code does not come in output. So current power value will start from 2
726 # byte instead of 3.
727
728 ${power_reading_ipmi_raw_3_item}= Get From List ${raw_output_list} 2
729 ${power_reading_ipmi_raw_3_item}=
730 ... Convert To Integer 0x${power_reading_ipmi_raw_3_item}
731
732 ${power_reading_rest}= Read Attribute
733 ... ${SENSORS_URI}power/total_power Value
734
735 # Example of power reading via REST
736 # "CriticalAlarmHigh": 0,
737 # "CriticalAlarmLow": 0,
738 # "CriticalHigh": 3100000000,
739 # "CriticalLow": 0,
740 # "Scale": -6,
741 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
742 # "Value": 228000000,
743 # "WarningAlarmHigh": 0,
744 # "WarningAlarmLow": 0,
745 # "WarningHigh": 3050000000,
746 # "WarningLow": 0
747
748 # Get power value based on scale i.e. Value * (10 power Scale Value)
749 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
750
751 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
752 ${ipmi_rest_power_diff}=
753 ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi_raw_3_item})
754
755 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
756 ... msg=Power Reading above allowed threshold ${allowed_power_diff}.
757
758
Rahul Maheshwari0eb33f02018-04-10 02:31:54 -0500759Verify Management Controller ID String Status
760 [Documentation] Verify management controller ID string status via IPMI.
761 [Arguments] ${status}
762
763 # Example of dcmi get_conf_param command output:
764 # DHCP Discovery method :
765 # Management Controller ID String is disabled
766 # Vendor class identifier DCMI IANA and Vendor class-specific Informationa are disabled
767 # Initial timeout interval : 4 seconds
768 # Server contact timeout interval : 120 seconds
769 # Server contact retry interval : 64 seconds
770
771 ${resp}= Run IPMI Standard Command dcmi get_conf_param
772 ${resp}= Get Lines Containing String ${resp}
773 ... Management Controller ID String case_insensitive=True
774 Should Contain ${resp} ${status}
775 ... msg=Management controller ID string is not ${status}
776
777
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600778Verify Power Reading Using REST
779 [Documentation] Verify power reading using REST.
780 [Arguments] ${power_reading}
781
Gunnar Mills948e2e22018-03-23 12:54:27 -0500782 # Description of argument(s):
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600783 # power_reading IPMI Power reading
784
785 ${power_reading_rest}= Read Attribute
786 ... ${SENSORS_URI}power/total_power Value
787
788 # Example of power reading via REST
789 # "CriticalAlarmHigh": 0,
790 # "CriticalAlarmLow": 0,
791 # "CriticalHigh": 3100000000,
792 # "CriticalLow": 0,
793 # "Scale": -6,
794 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
795 # "Value": 228000000,
796 # "WarningAlarmHigh": 0,
797 # "WarningAlarmLow": 0,
798 # "WarningHigh": 3050000000,
799 # "WarningLow": 0
800
801 # Get power value based on scale i.e. Value * (10 power Scale Value)
802 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
803 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
804 ${ipmi_rest_power_diff}=
805 ... Evaluate abs(${power_reading_rest} - ${power_reading})
806
807 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
808 ... msg=Power reading above allowed threshold ${allowed_power_diff}.
George Keishing02651f02018-04-11 02:07:16 -0500809
810
811Get Physical Network Interface Count
812 [Documentation] Return valid physical network interfaces count.
813
814 # Example:
815 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
816 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
817
818 ${mac_entry_list}= Get BMC MAC Address List
819 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
820 ${physical_interface_count}= Get Length ${mac_unique_list}
821
822 [Return] ${physical_interface_count}
George Keishing39967eb2018-04-30 11:36:23 -0500823
824
825Execute IPMI Command With Cipher
826 [Documentation] Execute IPMI command with a given cipher level value.
827 [Arguments] ${cipher_level}
828
829 # Description of argument(s):
830 # cipher_level IPMI chipher level value
831 # (e.g. "1", "2", "3", "15", "16", "17").
832
833 ${ipmi_cmd}= Catenate SEPARATOR=
834 ... ipmitool -I lanplus -C ${cipher_level} -P${SPACE}${IPMI_PASSWORD}
835 ... ${SPACE}${HOST}${SPACE}${OPENBMC_HOST}${SPACE}mc info
836
837 ${rc} ${output}= Run And Return RC and Output ${ipmi_cmd}
Rahul Maheshwari19faedf2018-08-29 00:42:09 -0500838 [Return] ${rc}