blob: 32d4846418265d86f35e9ae45b443efd524ef9f6 [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 Maheshwaridf6f05d2018-09-04 03:48:37 -050012Library ../../lib/gen_misc.py
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050013
Michael Walshc9eb34e2019-01-23 11:08:43 -060014Test Setup Log to Console ${EMPTY}
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050015Test Teardown FFDC On Test Case Fail
16
17*** Variables ***
18
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060019${new_mc_id}= HOST
Rahul Maheshwari901dcde2018-02-06 03:14:31 -060020${allowed_temp_diff}= ${1}
Rahul Maheshwari615da152018-02-13 23:53:36 -060021${allowed_power_diff}= ${10}
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060022
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050023*** Test Cases ***
24
25Set Asset Tag With Valid String Length
26 [Documentation] Set asset tag with valid string length and verify.
27 [Tags] Set_Asset_Tag_With_Valid_String_Length
28
29 # Allowed MAX characters length for asset tag name is 63.
30 ${random_string}= Generate Random String 63
31 Run Keyword Run IPMI Standard Command dcmi set_asset_tag ${random_string}
32
33 ${asset_tag}= Run Keyword Run IPMI Standard Command dcmi asset_tag
34 Should Contain ${asset_tag} ${random_string}
35
36
37Set Asset Tag With Invalid String Length
38 [Documentation] Verify error while setting invalid asset tag via IPMI.
39 [Tags] Set_Asset_Tag_With_Invalid_String_Length
40
41 # Any string more than 63 character is invalid for asset tag.
42 ${random_string}= Generate Random String 64
43
44 ${resp}= Run Keyword And Expect Error * Run IPMI Standard Command
45 ... dcmi set_asset_tag ${random_string}
46 Should Contain ${resp} Parameter out of range ignore_case=True
47
48
49Set Asset Tag With Valid String Length Via REST
50 [Documentation] Set valid asset tag via REST and verify.
51 [Tags] Set_Asset_Tag_With_Valid_String_Length_Via_REST
52
53 ${random_string}= Generate Random String 63
54 ${args}= Create Dictionary data=${random_string}
55 Write Attribute /xyz/openbmc_project/inventory/system AssetTag
56 ... data=${args}
57
58 ${asset_tag}= Read Attribute /xyz/openbmc_project/inventory/system
59 ... AssetTag
60 Should Be Equal As Strings ${asset_tag} ${random_string}
61
Sweta Potthurif39022d2018-02-06 03:40:07 -060062
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060063Verify Get And Set Management Controller ID String
64 [Documentation] Verify get and set management controller ID string.
65 [Tags] Verify_Get_And_Set_Management_Controller_ID_String
66
67 # Get the value of the managemment controller ID string.
68 # Example:
69 # Get Management Controller Identifier String: witherspoon
70
71 ${cmd_output}= Run IPMI Standard Command dcmi get_mc_id_string
72
73 # Extract management controller ID from cmd_output.
74 ${initial_mc_id}= Fetch From Right ${cmd_output} :${SPACE}
75
76 # Set the management controller ID string to other value.
77 # Example:
78 # Set Management Controller Identifier String Command: HOST
79
80 Set Management Controller ID String ${new_mc_id}
81
82 # Get the management controller ID and verify.
83 Get Management Controller ID String And Verify ${new_mc_id}
84
85 # Set the value back to the initial value and verify.
86 Set Management Controller ID String ${initial_mc_id}
87
88 # Get the management controller ID and verify.
89 Get Management Controller ID String And Verify ${initial_mc_id}
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050090
Sweta Potthurif39022d2018-02-06 03:40:07 -060091
Rahul Maheshwari0eb33f02018-04-10 02:31:54 -050092Test Management Controller ID String Status via IPMI
93 [Documentation] Test management controller ID string status via IPMI.
94 [Tags] Test_Management_Controller_ID_String_Status_via_IPMI
95
96 # Disable management controller ID string status via IPMI and verify.
97 Run IPMI Standard Command dcmi set_conf_param dhcp_config 0x00
98 Verify Management Controller ID String Status disable
99
100 # Enable management controller ID string status via IPMI and verify.
101 Run IPMI Standard Command dcmi set_conf_param dhcp_config 0x01
102 Verify Management Controller ID String Status enable
103
104
105Test Management Controller ID String Status via Raw IPMI
106 [Documentation] Test management controller ID string status via IPMI.
107 [Tags] Test_Management_Controller_ID_String_Status_via_Raw_IPMI
108
109 # Disable management controller ID string status via raw IPMI and verify.
110 Run IPMI Standard Command raw ${IPMI_RAW_CMD['conf_param']['Disabled'][0]}
111 Verify Management Controller ID String Status disable
112
113 # Enable management controller ID string status via raw IPMI and verify.
114 Run IPMI Standard Command raw ${IPMI_RAW_CMD['conf_param']['Enabled'][0]}
115 Verify Management Controller ID String Status enable
116
117
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600118Verify Chassis Identify via IPMI
119 [Documentation] Verify "chassis identify" using IPMI command.
120 [Tags] Verify_Chassis_Identify_via_IPMI
121
122 # Set to default "chassis identify" and verify that LED blinks for 15s.
123 Run IPMI Standard Command chassis identify
124 Verify Identify LED State Blink
125
126 Sleep 15s
127 Verify Identify LED State Off
128
129 # Set "chassis identify" to 10s and verify that the LED blinks for 10s.
130 Run IPMI Standard Command chassis identify 10
131 Verify Identify LED State Blink
132
133 Sleep 10s
134 Verify Identify LED State Off
135
Sweta Potthurif39022d2018-02-06 03:40:07 -0600136
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600137Verify Chassis Identify Off And Force Identify On via IPMI
138 [Documentation] Verify "chassis identify" off
139 ... and "force identify on" via IPMI.
140 [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI
141
142 # Set the LED to "Force Identify On".
143 Run IPMI Standard Command chassis identify force
144 Verify Identify LED State Blink
145
146 # Set "chassis identify" to 0 and verify that the LED turns off.
147 Run IPMI Standard Command chassis identify 0
148 Verify Identify LED State Off
149
Sweta Potthurif39022d2018-02-06 03:40:07 -0600150
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600151Test Watchdog Reset Via IPMI And Verify Using REST
152 [Documentation] Test watchdog reset via IPMI and verify using REST.
153 [Tags] Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST
154
155 Initiate Host Boot
156
157 Set Watchdog Enabled Using REST ${1}
158
159 Watchdog Object Should Exist
160
161 # Resetting the watchdog via IPMI.
162 Run IPMI Standard Command mc watchdog reset
163
164 # Verify the watchdog is reset using REST after an interval of 1000ms.
165 Sleep 1000ms
166 ${watchdog_time_left}=
167 ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining
168 Should Be True
169 ... ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000}
170 ... msg=Watchdog timer didn't reset.
171
Sweta Potthurif39022d2018-02-06 03:40:07 -0600172
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600173Test Watchdog Off Via IPMI And Verify Using REST
174 [Documentation] Test watchdog off via IPMI and verify using REST.
175 [Tags] Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST
176
177 Initiate Host Boot
178
179 Set Watchdog Enabled Using REST ${1}
180
181 Watchdog Object Should Exist
182
183 # Turn off the watchdog via IPMI.
184 Run IPMI Standard Command mc watchdog off
185
186 # Verify the watchdog is off using REST
187 ${watchdog_state}= Read Attribute ${HOST_WATCHDOG_URI} Enabled
188 Should Be Equal ${watchdog_state} ${0}
189 ... msg=msg=Verification failed for watchdog off check.
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600190
191
192Test Ambient Temperature Via IPMI
193 [Documentation] Test ambient temperature via IPMI and verify using REST.
194 [Tags] Test_Ambient_Temperature_Via_IPMI
195
196 # Entity ID Entity Instance Temp. Readings
197 # Inlet air temperature(40h) 1 +19 C
198 # CPU temperature sensors(41h) 5 +51 C
199 # CPU temperature sensors(41h) 6 +50 C
200 # CPU temperature sensors(41h) 7 +50 C
201 # CPU temperature sensors(41h) 8 +50 C
202 # CPU temperature sensors(41h) 9 +50 C
203 # CPU temperature sensors(41h) 10 +48 C
204 # CPU temperature sensors(41h) 11 +49 C
205 # CPU temperature sensors(41h) 12 +47 C
206 # CPU temperature sensors(41h) 8 +50 C
207 # CPU temperature sensors(41h) 16 +51 C
208 # CPU temperature sensors(41h) 24 +50 C
209 # CPU temperature sensors(41h) 32 +43 C
210 # CPU temperature sensors(41h) 40 +43 C
211 # Baseboard temperature sensors(42h) 1 +35 C
212
213 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
George Keishing77f1ad22018-07-23 12:39:28 -0500214 Should Contain ${temp_reading} Inlet air temperature
215 ... msg="Unable to get inlet temperature via DCMI".
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600216 ${ambient_temp_line}=
217 ... Get Lines Containing String ${temp_reading}
218 ... Inlet air temperature case-insensitive
219
220 ${ambient_temp_ipmi}= Fetch From Right ${ambient_temp_line} +
221 ${ambient_temp_ipmi}= Remove String ${ambient_temp_ipmi} ${SPACE}C
222
223 ${ambient_temp_rest}= Read Attribute
224 ... ${SENSORS_URI}temperature/ambient Value
225
226 # Example of ambient temperature via REST
227 # "CriticalAlarmHigh": 0,
228 # "CriticalAlarmLow": 0,
229 # "CriticalHigh": 35000,
230 # "CriticalLow": 0,
231 # "Scale": -3,
232 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
233 # "Value": 21775,
234 # "WarningAlarmHigh": 0,
235 # "WarningAlarmLow": 0,
236 # "WarningHigh": 25000,
237 # "WarningLow": 0
238
239 # Get temperature value based on scale i.e. Value * (10 power Scale Value)
240 # e.g. from above case 21775 * (10 power -3) = 21775/1000
241
242 ${ambient_temp_rest}= Evaluate ${ambient_temp_rest}/1000
243 ${ipmi_rest_temp_diff}=
244 ... Evaluate abs(${ambient_temp_rest} - ${ambient_temp_ipmi})
245
246 Should Be True ${ipmi_rest_temp_diff} <= ${allowed_temp_diff}
247 ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}.
248
249
Rahul Maheshwari43556632018-02-05 23:42:52 -0600250Verify Get DCMI Capabilities
251 [Documentation] Verify get DCMI capabilities command output.
252 [Tags] Verify_Get_DCMI_Capabilities
253
254 ${cmd_output}= Run IPMI Standard Command dcmi discover
255
256 @{supported_capabilities}= Create List
257 # Supported DCMI capabilities:
George Keishing2ee2f002019-02-16 09:36:02 -0600258 ... Mandatory platform capabilities
259 ... Optional platform capabilities
Rahul Maheshwari43556632018-02-05 23:42:52 -0600260 ... Power management available
George Keishing2ee2f002019-02-16 09:36:02 -0600261 ... Managebility access capabilities
Rahul Maheshwari43556632018-02-05 23:42:52 -0600262 ... In-band KCS channel available
263 # Mandatory platform attributes:
264 ... 200 SEL entries
265 ... SEL automatic rollover is enabled
266 # Optional Platform Attributes:
267 ... Slave address of device: 0h (8bits)(Satellite/External controller)
268 ... Channel number is 0h (Primary BMC)
269 ... Device revision is 0
270 # Manageability Access Attributes:
271 ... Primary LAN channel number: 1 is available
272 ... Secondary LAN channel is not available for OOB
273 ... No serial channel is available
274
275 :FOR ${capability} IN @{supported_capabilities}
276 \ Should Contain ${cmd_output} ${capability} ignore_case=True
277 ... msg=Supported DCMI capabilities not present.
278
279
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600280Test Power Reading Via IPMI With Host Off
281 [Documentation] Test power reading via IPMI with host off state and
282 ... verify using REST.
283 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Off
Rahul Maheshwari615da152018-02-13 23:53:36 -0600284
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600285 REST Power Off stack_mode=skip quiet=1
Rahul Maheshwari615da152018-02-13 23:53:36 -0600286
George Keishing04bf06c2018-10-05 08:28:50 -0500287 Wait Until Keyword Succeeds 1 min 30 sec Verify Power Reading
George Keishinge78f1fd2018-09-04 13:34:59 -0500288
289
290Test Power Reading Via IPMI With Host Booted
291 [Documentation] Test power reading via IPMI with host booted state and
292 ... verify using REST.
293 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted
294
295 REST Power On stack_mode=skip quiet=1
296
297 # For a good power reading take a 3 samples for 15 seconds interval and
298 # average it out.
299
George Keishing04bf06c2018-10-05 08:28:50 -0500300 Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading
Rahul Maheshwari615da152018-02-13 23:53:36 -0600301
302
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600303Test Power Reading Via IPMI Raw Command
304 [Documentation] Test power reading via IPMI raw command and verify
305 ... using REST.
306 [Tags] Test_Power_Reading_Via_IPMI_Raw_Command
307
308 # Response data structure of power reading command output via IPMI.
309 # 1 Completion Code. Refer to section 8, DCMI Completion Codes.
310 # 2 Group Extension Identification = DCh
311 # 3:4 Current Power in watts
312
George Keishinge78f1fd2018-09-04 13:34:59 -0500313 REST Power On stack_mode=skip quiet=1
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600314
George Keishing04bf06c2018-10-05 08:28:50 -0500315 Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading Via Raw Command
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600316
317
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600318Test Baseboard Temperature Via IPMI
319 [Documentation] Test baseboard temperature via IPMI and verify using REST.
320 [Tags] Test_Baseboard_Temperature_Via_IPMI
321
322 # Example of IPMI dcmi get_temp_reading output:
323 # Entity ID Entity Instance Temp. Readings
324 # Inlet air temperature(40h) 1 +19 C
325 # CPU temperature sensors(41h) 5 +51 C
326 # CPU temperature sensors(41h) 6 +50 C
327 # CPU temperature sensors(41h) 7 +50 C
328 # CPU temperature sensors(41h) 8 +50 C
329 # CPU temperature sensors(41h) 9 +50 C
330 # CPU temperature sensors(41h) 10 +48 C
331 # CPU temperature sensors(41h) 11 +49 C
332 # CPU temperature sensors(41h) 12 +47 C
333 # CPU temperature sensors(41h) 8 +50 C
334 # CPU temperature sensors(41h) 16 +51 C
335 # CPU temperature sensors(41h) 24 +50 C
336 # CPU temperature sensors(41h) 32 +43 C
337 # CPU temperature sensors(41h) 40 +43 C
338 # Baseboard temperature sensors(42h) 1 +35 C
339
340 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
George Keishing77f1ad22018-07-23 12:39:28 -0500341 Should Contain ${temp_reading} Baseboard temperature sensors
342 ... msg="Unable to get baseboard temperature via DCMI".
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600343 ${baseboard_temp_line}=
344 ... Get Lines Containing String ${temp_reading}
345 ... Baseboard temperature case-insensitive=True
346
347 ${baseboard_temp_ipmi}= Fetch From Right ${baseboard_temp_line} +
348 ${baseboard_temp_ipmi}= Remove String ${baseboard_temp_ipmi} ${SPACE}C
349
350 ${baseboard_temp_rest}= Read Attribute
351 ... /xyz/openbmc_project/sensors/temperature/pcie Value
352 ${baseboard_temp_rest}= Evaluate ${baseboard_temp_rest}/1000
353
354 Should Be True
355 ... ${baseboard_temp_rest} - ${baseboard_temp_ipmi} <= ${allowed_temp_diff}
356 ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}.
357
358
Sweta Potthurif39022d2018-02-06 03:40:07 -0600359Retrieve Default Gateway Via IPMI And Verify Using REST
360 [Documentation] Retrieve default gateway from LAN print using IPMI.
361 [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify_Using_REST
362
363 # Fetch "Default Gateway" from IPMI LAN print.
364 ${default_gateway_ipmi}= Fetch Details From LAN Print Default Gateway IP
365
366 # Verify "Default Gateway" using REST.
Steven Sombara8800da2018-12-18 16:19:05 -0600367 Read Attribute ${NETWORK_MANAGER}config DefaultGateway
Sweta Potthurif39022d2018-02-06 03:40:07 -0600368 ... expected_value=${default_gateway_ipmi}
369
370
371Retrieve MAC Address Via IPMI And Verify Using REST
372 [Documentation] Retrieve MAC Address from LAN print using IPMI.
373 [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_REST
374
375 # Fetch "MAC Address" from IPMI LAN print.
376 ${mac_address_ipmi}= Fetch Details From LAN Print MAC Address
377
378 # Verify "MAC Address" using REST.
379 ${mac_address_rest}= Get BMC MAC Address
380 Should Be Equal ${mac_address_ipmi} ${mac_address_rest}
381 ... msg=Verification of MAC address from lan print using IPMI failed.
382
383
384Retrieve Network Mode Via IPMI And Verify Using REST
385 [Documentation] Retrieve network mode from LAN print using IPMI.
386 [Tags] Retrieve_Network_Mode_Via_IPMI_And_Verify_Using_REST
387
388 # Fetch "Mode" from IPMI LAN print.
389 ${network_mode_ipmi}= Fetch Details From LAN Print Source
390
391 # Verify "Mode" using REST.
392 ${network_mode_rest}= Read Attribute
Steven Sombara8800da2018-12-18 16:19:05 -0600393 ... ${NETWORK_MANAGER}eth0 DHCPEnabled
Sweta Potthurif39022d2018-02-06 03:40:07 -0600394 Run Keyword If '${network_mode_ipmi}' == 'Static Address'
395 ... Should Be Equal ${network_mode_rest} ${0}
396 ... msg=Verification of network setting failed.
397 ... ELSE IF '${network_mode_ipmi}' == 'DHCP'
398 ... Should Be Equal ${network_mode_rest} ${1}
399 ... msg=Verification of network setting failed.
400
401
402Retrieve IP Address Via IPMI And Verify With BMC Details
403 [Documentation] Retrieve IP address from LAN print using IPMI.
404 [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_With_BMC_Details
405
406 # Fetch "IP Address" from IPMI LAN print.
407 ${ip_addr_ipmi}= Fetch Details From LAN Print IP Address
408
409 # Verify the IP address retrieved via IPMI with BMC IPs.
410 ${ip_address_rest}= Get BMC IP Info
411 Validate IP On BMC ${ip_addr_ipmi} ${ip_address_rest}
412
413
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600414Verify Get Device ID
415 [Documentation] Verify get device ID command output.
416 [Tags] Verify_Get_Device_ID
417
418 # Example of get device ID command output:
419 # Device ID : 0
420 # Device Revision : 0
421 # Firmware Revision : 2.01
422 # IPMI Version : 2.0
423 # Manufacturer ID : 42817
424 # Manufacturer Name : Unknown (0xA741)
425 # Product ID : 16975 (0x424f)
426 # Product Name : Unknown (0x424F)
427 # Device Available : yes
428 # Provides Device SDRs : yes
429 # Additional Device Support :
430 # Sensor Device
431 # SEL Device
432 # FRU Inventory Device
433 # Chassis Device
434 # Aux Firmware Rev Info :
George Keishing3511a3f2018-04-19 10:38:30 -0500435 # 0x04
436 # 0x38
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600437 # 0x00
George Keishing3511a3f2018-04-19 10:38:30 -0500438 # 0x03
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600439
440 ${mc_info}= Get MC Info
441
442 Should Be Equal ${mc_info['device_id']} 0
443 Should Be Equal ${mc_info['device_revision']} 0
444
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500445 # Get firmware revision from mc info command output i.e. 2.01
446 ${ipmi_fw_major_version} ${ipmi_fw_minor_version}=
447 ... Split String ${mc_info['firmware_revision']} .
448 # Convert minor firmware version from BCD format to integer. i.e. 01 to 1
449 ${ipmi_fw_minor_version}= Convert To Integer ${ipmi_fw_minor_version}
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600450
George Keishinge0a81282018-06-08 10:02:30 -0500451 # Get BMC version from BMC CLI i.e. 2.2 from "v2.2-253-g00050f1"
George Keishing3511a3f2018-04-19 10:38:30 -0500452 ${bmc_version_full}= Get BMC Version
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500453 ${bmc_version}=
George Keishing3511a3f2018-04-19 10:38:30 -0500454 ... Remove String Using Regexp ${bmc_version_full} ^[^0-9]+ [^0-9\.].*
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500455
456 # Get major and minor version from BMC version i.e. 2 and 1 from 2.1
George Keishingc95e9982019-01-14 09:27:45 -0600457 @{major_minor_version}= Split String ${bmc_version} .
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500458
George Keishingc95e9982019-01-14 09:27:45 -0600459 Should Be Equal As Strings ${ipmi_fw_major_version} ${major_minor_version[0]}
George Keishing2ee2f002019-02-16 09:36:02 -0600460 ... msg=Major version mismatch.
George Keishingc95e9982019-01-14 09:27:45 -0600461 Should Be Equal As Strings ${ipmi_fw_minor_version} ${major_minor_version[1]}
George Keishing2ee2f002019-02-16 09:36:02 -0600462 ... msg=Minor version mismatch.
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500463
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600464 Should Be Equal ${mc_info['ipmi_version']} 2.0
465
Gunnar Mills917ba1a2018-04-08 16:42:12 -0500466 # TODO: Verify Manufacturer and Product IDs directly from json file.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600467 # Reference : openbmc/openbmc-test-automation#1244
468 Should Be Equal ${mc_info['manufacturer_id']} 42817
469 Should Be Equal ${mc_info['product_id']} 16975 (0x424f)
470
471 Should Be Equal ${mc_info['device_available']} yes
472 Should Be Equal ${mc_info['provides_device_sdrs']} yes
473 Should Contain ${mc_info['additional_device_support']} Sensor Device
474 Should Contain ${mc_info['additional_device_support']} SEL Device
475 Should Contain
476 ... ${mc_info['additional_device_support']} FRU Inventory Device
477 Should Contain ${mc_info['additional_device_support']} Chassis Device
George Keishingb746d3f2018-04-19 10:53:10 -0500478
George Keishing3511a3f2018-04-19 10:38:30 -0500479 # Auxiliary revision data verification.
480 ${aux_version}= Get Aux Version ${bmc_version_full}
481
482 # From aux_firmware_rev_info field ['0x04', '0x38', '0x00', '0x03']
483 ${bmc_aux_version}= Catenate
484 ... SEPARATOR=
485 ... ${mc_info['aux_firmware_rev_info'][0][2:]}
486 ... ${mc_info['aux_firmware_rev_info'][1][2:]}
487 ... ${mc_info['aux_firmware_rev_info'][2][2:]}
488 ... ${mc_info['aux_firmware_rev_info'][3][2:]}
489
490 Should Be Equal As Integers
491 ... ${bmc_aux_version} ${aux_version}
492 ... msg=BMC aux version ${bmc_aux_version} does not match expected value of ${aux_version}.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600493
494
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500495Verify SDR Info
496 [Documentation] Verify sdr info command output.
497 [Tags] Verify_SDR_Info
498
499 # Example of SDR info command output:
500 # SDR Version : 0x51
501 # Record Count : 216
502 # Free Space : unspecified
503 # Most recent Addition :
504 # Most recent Erase :
505 # SDR overflow : no
506 # SDR Repository Update Support : unspecified
507 # Delete SDR supported : no
508 # Partial Add SDR supported : no
509 # Reserve SDR repository supported : no
510 # SDR Repository Alloc info supported : no
511
512 ${sdr_info}= Get SDR Info
513 Should Be Equal ${sdr_info['sdr_version']} 0x51
514
515 # Get sensor count from "sdr elist all" command output.
516 ${sensor_count}= Get Sensor Count
517 Should Be Equal As Strings
518 ... ${sdr_info['record_count']} ${sensor_count}
519
520 Should Be Equal ${sdr_info['free_space']} unspecified
521 Should Be Equal ${sdr_info['most_recent_addition']} ${EMPTY}
522 Should Be Equal ${sdr_info['most_recent_erase']} ${EMPTY}
523 Should Be Equal ${sdr_info['sdr_overflow']} no
524 Should Be Equal ${sdr_info['sdr_repository_update_support']} unspecified
525 Should Be Equal ${sdr_info['delete_sdr_supported']} no
526 Should Be Equal ${sdr_info['partial_add_sdr_supported']} no
527 Should Be Equal ${sdr_info['reserve_sdr_repository_supported']} no
528 Should Be Equal ${sdr_info['sdr_repository_alloc_info_supported']} no
529
530
George Keishing02651f02018-04-11 02:07:16 -0500531Test Valid IPMI Channels Supported
532 [Documentation] Verify IPMI channels supported on a given system.
533 [Tags] Test_Valid_IPMI_Channels_Supported
534
535 ${channel_count}= Get Physical Network Interface Count
536
537 # Note: IPMI network channel logically starts from 1.
538 :FOR ${channel_number} IN RANGE 1 ${channel_count}
Rahul Maheshwari20f3bf72018-12-18 04:24:20 -0600539 \ Run IPMI Standard Command lan print ${channel_number}
George Keishing02651f02018-04-11 02:07:16 -0500540
541
542Test Invalid IPMI Channel Response
543 [Documentation] Verify invalid IPMI channels supported response.
544 [Tags] Test_Invalid_IPMI_Channel_Response
545
546 ${channel_count}= Get Physical Network Interface Count
547
548 # To target invalid channel, increment count.
549 ${channel_number}= Evaluate ${channel_count} + 1
550
551 # Example of invalid channel:
George Keishing72d0ac82018-09-20 09:33:01 -0500552 # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3
George Keishing02651f02018-04-11 02:07:16 -0500553 # Get Channel Info command failed: Parameter out of range
554 # Invalid channel: 3
555
556 ${stdout}= Run External IPMI Standard Command
557 ... lan print ${channel_number} fail_on_err=${0}
558 Should Contain ${stdout} Invalid channel
559 ... msg=IPMI channel ${channel_number} is invalid but seen working.
560
561
George Keishinge85113a2019-06-07 08:21:51 -0500562Test IPMI Restriction Mode
563 [Documentation] Set restricition mode via REST and verify IPMI operation.
564 [Tags] Test_IPMI_Restriction_Mode
565 # Forego normal test setup:
566 [Setup] No Operation
567 [Teardown] Run Keywords FFDC On Test Case Fail AND
568 ... Set IPMI Restriction Mode xyz.openbmc_project.Control.Security.RestrictionMode.Modes.None
569
570 # By default no IPMI operations are restricted.
571 # /xyz/openbmc_project/control/host0/restriction_mode/attr/RestrictionMode
572 # {
573 # "data": "xyz.openbmc_project.Control.Security.RestrictionMode.Modes.None",
574 # "message": "200 OK",
575 # "status": "ok"
576 # }
577
578 # Refer to: #openbmc/phosphor-host-ipmid/blob/master/host-ipmid-whitelist.conf
579 # Set the restriction mode to Whitelist IPMI commands only:
580 # /xyz/openbmc_project/control/host0/restriction_mode/attr/RestrictionMode
581 # {
582 # "data": "xyz.openbmc_project.Control.Security.RestrictionMode.Modes.Whitelist",
583 # "message": "200 OK",
584 # "status": "ok"
585 # }
586
587 Set IPMI Restriction Mode xyz.openbmc_project.Control.Security.RestrictionMode.Modes.Whitelist
588
589 # Attempt white-listed operation expecting success.
590 IPMI Power On
591
592 # Attempt non white-listed operation expecting failure.
593 Run Keyword And Expect Error *Insufficient privilege level*
594 ... Run Inband IPMI Standard Command mc reset cold
595
596
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500597*** Keywords ***
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600598
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500599Get Sensor Count
600 [Documentation] Get sensors count using "sdr elist all" command.
601
602 # Example of "sdr elist all" command output:
603 # BootProgress | 03h | ok | 34.2 |
604 # OperatingSystemS | 05h | ok | 35.1 |
605 # AttemptsLeft | 07h | ok | 34.1 |
606 # occ0 | 08h | ok | 210.1 | Device Disabled
607 # occ1 | 09h | ok | 210.2 | Device Disabled
608 # p0_core0_temp | 11h | ns | 3.1 | Disabled
609 # cpu0_core0 | 12h | ok | 208.1 | Presence detected
610 # p0_core1_temp | 14h | ns | 3.2 | Disabled
611 # cpu0_core1 | 15h | ok | 208.2 | Presence detected
612 # p0_core2_temp | 17h | ns | 3.3 | Disabled
613 # ..
614 # ..
615 # ..
616 # ..
617 # ..
618 # ..
619 # fan3 | 00h | ns | 29.4 | Logical FRU @35h
620 # bmc | 00h | ns | 6.1 | Logical FRU @3Ch
621 # ethernet | 00h | ns | 1.1 | Logical FRU @46h
622
623 ${output}= Run IPMI Standard Command sdr elist all
624 ${sensor_list}= Split String ${output} \n
625 ${sensor_count}= Get Length ${sensor_list}
626 [Return] ${sensor_count}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600627
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600628Set Management Controller ID String
629 [Documentation] Set the management controller ID string.
630 [Arguments] ${string}
631
632 # Description of argument(s):
633 # string Management Controller ID String to be set
634
635 ${set_mc_id_string}= Run IPMI Standard Command
636 ... dcmi set_mc_id_string ${string}
637
Sweta Potthurif39022d2018-02-06 03:40:07 -0600638
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600639Get Management Controller ID String And Verify
George Keishingcb3b9b62018-09-14 12:11:19 -0500640 [Documentation] Get the management controller ID string.
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600641 [Arguments] ${string}
642
643 # Description of argument(s):
644 # string Management Controller ID string
645
646 ${get_mc_id}= Run IPMI Standard Command dcmi get_mc_id_string
647 Should Contain ${get_mc_id} ${string}
648 ... msg=Command failed: get_mc_id.
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600649
Sweta Potthurif39022d2018-02-06 03:40:07 -0600650
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600651Set Watchdog Enabled Using REST
652 [Documentation] Set watchdog Enabled field using REST.
653 [Arguments] ${value}
654
655 # Description of argument(s):
656 # value Integer value (eg. "0-Disabled", "1-Enabled").
657
658 ${value_dict}= Create Dictionary data=${value}
Steven Sombaraaaab222018-12-19 13:16:23 -0600659 ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}attr/Enabled
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600660 ... data=${value_dict}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600661
662
Sweta Potthurif39022d2018-02-06 03:40:07 -0600663Fetch Details From LAN Print
664 [Documentation] Fetch details from LAN print.
665 [Arguments] ${field_name}
666
667 # Description of argument(s):
668 # ${field_name} Field name to be fetched from LAN print
669 # (e.g. "MAC Address", "Source").
670
Rahul Maheshwarid8037d32018-12-17 00:59:57 -0600671 ${stdout}= Run IPMI Standard Command lan print
Sweta Potthurif39022d2018-02-06 03:40:07 -0600672 ${fetch_value}= Get Lines Containing String ${stdout} ${field_name}
673 ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE}
674 [Return] ${value_fetch}
675
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600676
677Verify Power Reading
678 [Documentation] Get dcmi power reading via IPMI.
679
680 # Example of power reading command output via IPMI.
681 # Instantaneous power reading: 235 Watts
682 # Minimum during sampling period: 235 Watts
683 # Maximum during sampling period: 235 Watts
684 # Average power reading over sample period: 235 Watts
685 # IPMI timestamp: Thu Jan 1 00:00:00 1970
686 # Sampling period: 00000000 Seconds.
687 # Power reading state is: deactivated
688
689 ${power_reading}= Get IPMI Power Reading
690
691 ${host_state}= Get Host State
692 Run Keyword If '${host_state}' == 'Off'
George Keishing51314872018-03-31 13:24:35 -0500693 ... Should Be Equal ${power_reading['instantaneous_power_reading']} 0
694 ... msg=Power reading not zero when power is off.
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600695
George Keishing51314872018-03-31 13:24:35 -0500696 Run Keyword If '${power_reading['instantaneous_power_reading']}' != '0'
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600697 ... Verify Power Reading Using REST ${power_reading['instantaneous_power_reading']}
698
699
George Keishinge78f1fd2018-09-04 13:34:59 -0500700Verify Power Reading Via Raw Command
701 [Documentation] Get dcmi power reading via IPMI raw command.
702
703 ${ipmi_raw_output}= Run IPMI Standard Command
704 ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]}
705
706 @{raw_output_list}= Split String ${ipmi_raw_output} ${SPACE}
707
708 # On successful execution of raw IPMI power reading command, completion
709 # code does not come in output. So current power value will start from 2
710 # byte instead of 3.
711
712 ${power_reading_ipmi_raw_3_item}= Get From List ${raw_output_list} 2
713 ${power_reading_ipmi_raw_3_item}=
714 ... Convert To Integer 0x${power_reading_ipmi_raw_3_item}
715
716 ${power_reading_rest}= Read Attribute
717 ... ${SENSORS_URI}power/total_power Value
718
719 # Example of power reading via REST
720 # "CriticalAlarmHigh": 0,
721 # "CriticalAlarmLow": 0,
722 # "CriticalHigh": 3100000000,
723 # "CriticalLow": 0,
724 # "Scale": -6,
725 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
726 # "Value": 228000000,
727 # "WarningAlarmHigh": 0,
728 # "WarningAlarmLow": 0,
729 # "WarningHigh": 3050000000,
730 # "WarningLow": 0
731
732 # Get power value based on scale i.e. Value * (10 power Scale Value)
733 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
734
735 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
736 ${ipmi_rest_power_diff}=
737 ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi_raw_3_item})
738
739 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
740 ... msg=Power Reading above allowed threshold ${allowed_power_diff}.
741
742
Rahul Maheshwari0eb33f02018-04-10 02:31:54 -0500743Verify Management Controller ID String Status
744 [Documentation] Verify management controller ID string status via IPMI.
745 [Arguments] ${status}
746
747 # Example of dcmi get_conf_param command output:
748 # DHCP Discovery method :
749 # Management Controller ID String is disabled
750 # Vendor class identifier DCMI IANA and Vendor class-specific Informationa are disabled
751 # Initial timeout interval : 4 seconds
752 # Server contact timeout interval : 120 seconds
753 # Server contact retry interval : 64 seconds
754
755 ${resp}= Run IPMI Standard Command dcmi get_conf_param
756 ${resp}= Get Lines Containing String ${resp}
757 ... Management Controller ID String case_insensitive=True
758 Should Contain ${resp} ${status}
759 ... msg=Management controller ID string is not ${status}
760
761
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600762Verify Power Reading Using REST
763 [Documentation] Verify power reading using REST.
764 [Arguments] ${power_reading}
765
Gunnar Mills948e2e22018-03-23 12:54:27 -0500766 # Description of argument(s):
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600767 # power_reading IPMI Power reading
768
769 ${power_reading_rest}= Read Attribute
770 ... ${SENSORS_URI}power/total_power Value
771
772 # Example of power reading via REST
773 # "CriticalAlarmHigh": 0,
774 # "CriticalAlarmLow": 0,
775 # "CriticalHigh": 3100000000,
776 # "CriticalLow": 0,
777 # "Scale": -6,
778 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
779 # "Value": 228000000,
780 # "WarningAlarmHigh": 0,
781 # "WarningAlarmLow": 0,
782 # "WarningHigh": 3050000000,
783 # "WarningLow": 0
784
785 # Get power value based on scale i.e. Value * (10 power Scale Value)
786 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
787 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
788 ${ipmi_rest_power_diff}=
789 ... Evaluate abs(${power_reading_rest} - ${power_reading})
790
791 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
792 ... msg=Power reading above allowed threshold ${allowed_power_diff}.
George Keishing02651f02018-04-11 02:07:16 -0500793
794
795Get Physical Network Interface Count
796 [Documentation] Return valid physical network interfaces count.
797
798 # Example:
799 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
800 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
801
802 ${mac_entry_list}= Get BMC MAC Address List
803 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
804 ${physical_interface_count}= Get Length ${mac_unique_list}
805
806 [Return] ${physical_interface_count}
George Keishing39967eb2018-04-30 11:36:23 -0500807
George Keishinge85113a2019-06-07 08:21:51 -0500808
809Set IPMI Restriction Mode
810 [Documentation] Set the IPMI restriction mode.
811 [Arguments] ${restriction_mode}
812
813 # Description of argument(s):
814 # restriction_mode IPMI valid restriction modes.
815
816 ${valueDict}= Create Dictionary data=${restriction_mode}
817
818 Write Attribute ${CONTROL_HOST_URI}restriction_mode/
819 ... RestrictionMode data=${valueDict}