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