blob: 137f9452212fcde971f14ce24984664b0de51bad [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
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050025Set Asset Tag With Valid String Length Via REST
26 [Documentation] Set valid asset tag via REST and verify.
27 [Tags] Set_Asset_Tag_With_Valid_String_Length_Via_REST
28
29 ${random_string}= Generate Random String 63
30 ${args}= Create Dictionary data=${random_string}
31 Write Attribute /xyz/openbmc_project/inventory/system AssetTag
32 ... data=${args}
33
34 ${asset_tag}= Read Attribute /xyz/openbmc_project/inventory/system
35 ... AssetTag
36 Should Be Equal As Strings ${asset_tag} ${random_string}
37
Sweta Potthurif39022d2018-02-06 03:40:07 -060038
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060039Verify Get And Set Management Controller ID String
40 [Documentation] Verify get and set management controller ID string.
41 [Tags] Verify_Get_And_Set_Management_Controller_ID_String
42
43 # Get the value of the managemment controller ID string.
44 # Example:
45 # Get Management Controller Identifier String: witherspoon
46
47 ${cmd_output}= Run IPMI Standard Command dcmi get_mc_id_string
48
49 # Extract management controller ID from cmd_output.
50 ${initial_mc_id}= Fetch From Right ${cmd_output} :${SPACE}
51
52 # Set the management controller ID string to other value.
53 # Example:
54 # Set Management Controller Identifier String Command: HOST
55
56 Set Management Controller ID String ${new_mc_id}
57
58 # Get the management controller ID and verify.
59 Get Management Controller ID String And Verify ${new_mc_id}
60
61 # Set the value back to the initial value and verify.
62 Set Management Controller ID String ${initial_mc_id}
63
64 # Get the management controller ID and verify.
65 Get Management Controller ID String And Verify ${initial_mc_id}
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050066
Sweta Potthurif39022d2018-02-06 03:40:07 -060067
Rahul Maheshwari0eb33f02018-04-10 02:31:54 -050068Test Management Controller ID String Status via IPMI
69 [Documentation] Test management controller ID string status via IPMI.
70 [Tags] Test_Management_Controller_ID_String_Status_via_IPMI
71
72 # Disable management controller ID string status via IPMI and verify.
73 Run IPMI Standard Command dcmi set_conf_param dhcp_config 0x00
74 Verify Management Controller ID String Status disable
75
76 # Enable management controller ID string status via IPMI and verify.
77 Run IPMI Standard Command dcmi set_conf_param dhcp_config 0x01
78 Verify Management Controller ID String Status enable
79
80
81Test Management Controller ID String Status via Raw IPMI
82 [Documentation] Test management controller ID string status via IPMI.
83 [Tags] Test_Management_Controller_ID_String_Status_via_Raw_IPMI
84
85 # Disable management controller ID string status via raw IPMI and verify.
86 Run IPMI Standard Command raw ${IPMI_RAW_CMD['conf_param']['Disabled'][0]}
87 Verify Management Controller ID String Status disable
88
89 # Enable management controller ID string status via raw IPMI and verify.
90 Run IPMI Standard Command raw ${IPMI_RAW_CMD['conf_param']['Enabled'][0]}
91 Verify Management Controller ID String Status enable
92
93
Sweta Potthuri0cc60502018-01-24 00:36:17 -060094Verify Chassis Identify via IPMI
95 [Documentation] Verify "chassis identify" using IPMI command.
96 [Tags] Verify_Chassis_Identify_via_IPMI
97
98 # Set to default "chassis identify" and verify that LED blinks for 15s.
99 Run IPMI Standard Command chassis identify
100 Verify Identify LED State Blink
101
102 Sleep 15s
103 Verify Identify LED State Off
104
105 # Set "chassis identify" to 10s and verify that the LED blinks for 10s.
106 Run IPMI Standard Command chassis identify 10
107 Verify Identify LED State Blink
108
109 Sleep 10s
110 Verify Identify LED State Off
111
Sweta Potthurif39022d2018-02-06 03:40:07 -0600112
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600113Verify Chassis Identify Off And Force Identify On via IPMI
114 [Documentation] Verify "chassis identify" off
115 ... and "force identify on" via IPMI.
116 [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI
117
118 # Set the LED to "Force Identify On".
119 Run IPMI Standard Command chassis identify force
120 Verify Identify LED State Blink
121
122 # Set "chassis identify" to 0 and verify that the LED turns off.
123 Run IPMI Standard Command chassis identify 0
124 Verify Identify LED State Off
125
Sweta Potthurif39022d2018-02-06 03:40:07 -0600126
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600127Test Watchdog Reset Via IPMI And Verify Using REST
128 [Documentation] Test watchdog reset via IPMI and verify using REST.
129 [Tags] Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST
130
131 Initiate Host Boot
132
133 Set Watchdog Enabled Using REST ${1}
134
135 Watchdog Object Should Exist
136
137 # Resetting the watchdog via IPMI.
138 Run IPMI Standard Command mc watchdog reset
139
140 # Verify the watchdog is reset using REST after an interval of 1000ms.
141 Sleep 1000ms
142 ${watchdog_time_left}=
143 ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining
144 Should Be True
145 ... ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000}
146 ... msg=Watchdog timer didn't reset.
147
Sweta Potthurif39022d2018-02-06 03:40:07 -0600148
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600149Test Watchdog Off Via IPMI And Verify Using REST
150 [Documentation] Test watchdog off via IPMI and verify using REST.
151 [Tags] Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST
152
153 Initiate Host Boot
154
155 Set Watchdog Enabled Using REST ${1}
156
157 Watchdog Object Should Exist
158
159 # Turn off the watchdog via IPMI.
160 Run IPMI Standard Command mc watchdog off
161
162 # Verify the watchdog is off using REST
163 ${watchdog_state}= Read Attribute ${HOST_WATCHDOG_URI} Enabled
164 Should Be Equal ${watchdog_state} ${0}
165 ... msg=msg=Verification failed for watchdog off check.
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600166
167
168Test Ambient Temperature Via IPMI
169 [Documentation] Test ambient temperature via IPMI and verify using REST.
170 [Tags] Test_Ambient_Temperature_Via_IPMI
171
172 # Entity ID Entity Instance Temp. Readings
173 # Inlet air temperature(40h) 1 +19 C
174 # CPU temperature sensors(41h) 5 +51 C
175 # CPU temperature sensors(41h) 6 +50 C
176 # CPU temperature sensors(41h) 7 +50 C
177 # CPU temperature sensors(41h) 8 +50 C
178 # CPU temperature sensors(41h) 9 +50 C
179 # CPU temperature sensors(41h) 10 +48 C
180 # CPU temperature sensors(41h) 11 +49 C
181 # CPU temperature sensors(41h) 12 +47 C
182 # CPU temperature sensors(41h) 8 +50 C
183 # CPU temperature sensors(41h) 16 +51 C
184 # CPU temperature sensors(41h) 24 +50 C
185 # CPU temperature sensors(41h) 32 +43 C
186 # CPU temperature sensors(41h) 40 +43 C
187 # Baseboard temperature sensors(42h) 1 +35 C
188
189 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
George Keishing77f1ad22018-07-23 12:39:28 -0500190 Should Contain ${temp_reading} Inlet air temperature
191 ... msg="Unable to get inlet temperature via DCMI".
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600192 ${ambient_temp_line}=
193 ... Get Lines Containing String ${temp_reading}
194 ... Inlet air temperature case-insensitive
195
196 ${ambient_temp_ipmi}= Fetch From Right ${ambient_temp_line} +
197 ${ambient_temp_ipmi}= Remove String ${ambient_temp_ipmi} ${SPACE}C
198
199 ${ambient_temp_rest}= Read Attribute
200 ... ${SENSORS_URI}temperature/ambient Value
201
202 # Example of ambient temperature via REST
203 # "CriticalAlarmHigh": 0,
204 # "CriticalAlarmLow": 0,
205 # "CriticalHigh": 35000,
206 # "CriticalLow": 0,
207 # "Scale": -3,
208 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
209 # "Value": 21775,
210 # "WarningAlarmHigh": 0,
211 # "WarningAlarmLow": 0,
212 # "WarningHigh": 25000,
213 # "WarningLow": 0
214
215 # Get temperature value based on scale i.e. Value * (10 power Scale Value)
216 # e.g. from above case 21775 * (10 power -3) = 21775/1000
217
218 ${ambient_temp_rest}= Evaluate ${ambient_temp_rest}/1000
219 ${ipmi_rest_temp_diff}=
220 ... Evaluate abs(${ambient_temp_rest} - ${ambient_temp_ipmi})
221
222 Should Be True ${ipmi_rest_temp_diff} <= ${allowed_temp_diff}
223 ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}.
224
225
Rahul Maheshwari43556632018-02-05 23:42:52 -0600226Verify Get DCMI Capabilities
227 [Documentation] Verify get DCMI capabilities command output.
228 [Tags] Verify_Get_DCMI_Capabilities
229
230 ${cmd_output}= Run IPMI Standard Command dcmi discover
231
232 @{supported_capabilities}= Create List
233 # Supported DCMI capabilities:
George Keishing2ee2f002019-02-16 09:36:02 -0600234 ... Mandatory platform capabilities
235 ... Optional platform capabilities
Rahul Maheshwari43556632018-02-05 23:42:52 -0600236 ... Power management available
George Keishing2ee2f002019-02-16 09:36:02 -0600237 ... Managebility access capabilities
Rahul Maheshwari43556632018-02-05 23:42:52 -0600238 ... In-band KCS channel available
239 # Mandatory platform attributes:
240 ... 200 SEL entries
241 ... SEL automatic rollover is enabled
242 # Optional Platform Attributes:
243 ... Slave address of device: 0h (8bits)(Satellite/External controller)
244 ... Channel number is 0h (Primary BMC)
245 ... Device revision is 0
246 # Manageability Access Attributes:
247 ... Primary LAN channel number: 1 is available
248 ... Secondary LAN channel is not available for OOB
249 ... No serial channel is available
250
251 :FOR ${capability} IN @{supported_capabilities}
252 \ Should Contain ${cmd_output} ${capability} ignore_case=True
253 ... msg=Supported DCMI capabilities not present.
254
255
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600256Test Power Reading Via IPMI With Host Off
257 [Documentation] Test power reading via IPMI with host off state and
258 ... verify using REST.
259 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Off
Rahul Maheshwari615da152018-02-13 23:53:36 -0600260
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600261 REST Power Off stack_mode=skip quiet=1
Rahul Maheshwari615da152018-02-13 23:53:36 -0600262
George Keishing04bf06c2018-10-05 08:28:50 -0500263 Wait Until Keyword Succeeds 1 min 30 sec Verify Power Reading
George Keishinge78f1fd2018-09-04 13:34:59 -0500264
265
266Test Power Reading Via IPMI With Host Booted
267 [Documentation] Test power reading via IPMI with host booted state and
268 ... verify using REST.
269 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted
270
271 REST Power On stack_mode=skip quiet=1
272
273 # For a good power reading take a 3 samples for 15 seconds interval and
274 # average it out.
275
George Keishing04bf06c2018-10-05 08:28:50 -0500276 Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading
Rahul Maheshwari615da152018-02-13 23:53:36 -0600277
278
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600279Test Power Reading Via IPMI Raw Command
280 [Documentation] Test power reading via IPMI raw command and verify
281 ... using REST.
282 [Tags] Test_Power_Reading_Via_IPMI_Raw_Command
283
284 # Response data structure of power reading command output via IPMI.
285 # 1 Completion Code. Refer to section 8, DCMI Completion Codes.
286 # 2 Group Extension Identification = DCh
287 # 3:4 Current Power in watts
288
George Keishinge78f1fd2018-09-04 13:34:59 -0500289 REST Power On stack_mode=skip quiet=1
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600290
George Keishing04bf06c2018-10-05 08:28:50 -0500291 Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading Via Raw Command
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600292
293
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600294Test Baseboard Temperature Via IPMI
295 [Documentation] Test baseboard temperature via IPMI and verify using REST.
296 [Tags] Test_Baseboard_Temperature_Via_IPMI
297
298 # Example of IPMI dcmi get_temp_reading output:
299 # Entity ID Entity Instance Temp. Readings
300 # Inlet air temperature(40h) 1 +19 C
301 # CPU temperature sensors(41h) 5 +51 C
302 # CPU temperature sensors(41h) 6 +50 C
303 # CPU temperature sensors(41h) 7 +50 C
304 # CPU temperature sensors(41h) 8 +50 C
305 # CPU temperature sensors(41h) 9 +50 C
306 # CPU temperature sensors(41h) 10 +48 C
307 # CPU temperature sensors(41h) 11 +49 C
308 # CPU temperature sensors(41h) 12 +47 C
309 # CPU temperature sensors(41h) 8 +50 C
310 # CPU temperature sensors(41h) 16 +51 C
311 # CPU temperature sensors(41h) 24 +50 C
312 # CPU temperature sensors(41h) 32 +43 C
313 # CPU temperature sensors(41h) 40 +43 C
314 # Baseboard temperature sensors(42h) 1 +35 C
315
316 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
George Keishing77f1ad22018-07-23 12:39:28 -0500317 Should Contain ${temp_reading} Baseboard temperature sensors
318 ... msg="Unable to get baseboard temperature via DCMI".
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600319 ${baseboard_temp_line}=
320 ... Get Lines Containing String ${temp_reading}
321 ... Baseboard temperature case-insensitive=True
322
323 ${baseboard_temp_ipmi}= Fetch From Right ${baseboard_temp_line} +
324 ${baseboard_temp_ipmi}= Remove String ${baseboard_temp_ipmi} ${SPACE}C
325
326 ${baseboard_temp_rest}= Read Attribute
327 ... /xyz/openbmc_project/sensors/temperature/pcie Value
328 ${baseboard_temp_rest}= Evaluate ${baseboard_temp_rest}/1000
329
330 Should Be True
331 ... ${baseboard_temp_rest} - ${baseboard_temp_ipmi} <= ${allowed_temp_diff}
332 ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}.
333
334
Sweta Potthurif39022d2018-02-06 03:40:07 -0600335Retrieve Default Gateway Via IPMI And Verify Using REST
336 [Documentation] Retrieve default gateway from LAN print using IPMI.
337 [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify_Using_REST
338
339 # Fetch "Default Gateway" from IPMI LAN print.
340 ${default_gateway_ipmi}= Fetch Details From LAN Print Default Gateway IP
341
342 # Verify "Default Gateway" using REST.
Steven Sombara8800da2018-12-18 16:19:05 -0600343 Read Attribute ${NETWORK_MANAGER}config DefaultGateway
Sweta Potthurif39022d2018-02-06 03:40:07 -0600344 ... expected_value=${default_gateway_ipmi}
345
346
347Retrieve MAC Address Via IPMI And Verify Using REST
348 [Documentation] Retrieve MAC Address from LAN print using IPMI.
349 [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_REST
350
351 # Fetch "MAC Address" from IPMI LAN print.
352 ${mac_address_ipmi}= Fetch Details From LAN Print MAC Address
353
354 # Verify "MAC Address" using REST.
355 ${mac_address_rest}= Get BMC MAC Address
356 Should Be Equal ${mac_address_ipmi} ${mac_address_rest}
357 ... msg=Verification of MAC address from lan print using IPMI failed.
358
359
360Retrieve Network Mode Via IPMI And Verify Using REST
361 [Documentation] Retrieve network mode from LAN print using IPMI.
362 [Tags] Retrieve_Network_Mode_Via_IPMI_And_Verify_Using_REST
363
364 # Fetch "Mode" from IPMI LAN print.
365 ${network_mode_ipmi}= Fetch Details From LAN Print Source
366
367 # Verify "Mode" using REST.
368 ${network_mode_rest}= Read Attribute
Steven Sombara8800da2018-12-18 16:19:05 -0600369 ... ${NETWORK_MANAGER}eth0 DHCPEnabled
Sweta Potthurif39022d2018-02-06 03:40:07 -0600370 Run Keyword If '${network_mode_ipmi}' == 'Static Address'
371 ... Should Be Equal ${network_mode_rest} ${0}
372 ... msg=Verification of network setting failed.
373 ... ELSE IF '${network_mode_ipmi}' == 'DHCP'
374 ... Should Be Equal ${network_mode_rest} ${1}
375 ... msg=Verification of network setting failed.
376
377
378Retrieve IP Address Via IPMI And Verify With BMC Details
379 [Documentation] Retrieve IP address from LAN print using IPMI.
380 [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_With_BMC_Details
381
382 # Fetch "IP Address" from IPMI LAN print.
383 ${ip_addr_ipmi}= Fetch Details From LAN Print IP Address
384
385 # Verify the IP address retrieved via IPMI with BMC IPs.
386 ${ip_address_rest}= Get BMC IP Info
387 Validate IP On BMC ${ip_addr_ipmi} ${ip_address_rest}
388
389
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600390Verify Get Device ID
391 [Documentation] Verify get device ID command output.
392 [Tags] Verify_Get_Device_ID
393
394 # Example of get device ID command output:
395 # Device ID : 0
396 # Device Revision : 0
397 # Firmware Revision : 2.01
398 # IPMI Version : 2.0
399 # Manufacturer ID : 42817
400 # Manufacturer Name : Unknown (0xA741)
401 # Product ID : 16975 (0x424f)
402 # Product Name : Unknown (0x424F)
403 # Device Available : yes
404 # Provides Device SDRs : yes
405 # Additional Device Support :
406 # Sensor Device
407 # SEL Device
408 # FRU Inventory Device
409 # Chassis Device
410 # Aux Firmware Rev Info :
George Keishing3511a3f2018-04-19 10:38:30 -0500411 # 0x04
412 # 0x38
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600413 # 0x00
George Keishing3511a3f2018-04-19 10:38:30 -0500414 # 0x03
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600415
416 ${mc_info}= Get MC Info
417
418 Should Be Equal ${mc_info['device_id']} 0
419 Should Be Equal ${mc_info['device_revision']} 0
420
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500421 # Get firmware revision from mc info command output i.e. 2.01
422 ${ipmi_fw_major_version} ${ipmi_fw_minor_version}=
423 ... Split String ${mc_info['firmware_revision']} .
424 # Convert minor firmware version from BCD format to integer. i.e. 01 to 1
425 ${ipmi_fw_minor_version}= Convert To Integer ${ipmi_fw_minor_version}
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600426
George Keishinge0a81282018-06-08 10:02:30 -0500427 # Get BMC version from BMC CLI i.e. 2.2 from "v2.2-253-g00050f1"
George Keishing3511a3f2018-04-19 10:38:30 -0500428 ${bmc_version_full}= Get BMC Version
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500429 ${bmc_version}=
George Keishing3511a3f2018-04-19 10:38:30 -0500430 ... Remove String Using Regexp ${bmc_version_full} ^[^0-9]+ [^0-9\.].*
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500431
432 # Get major and minor version from BMC version i.e. 2 and 1 from 2.1
George Keishingc95e9982019-01-14 09:27:45 -0600433 @{major_minor_version}= Split String ${bmc_version} .
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500434
George Keishingc95e9982019-01-14 09:27:45 -0600435 Should Be Equal As Strings ${ipmi_fw_major_version} ${major_minor_version[0]}
George Keishing2ee2f002019-02-16 09:36:02 -0600436 ... msg=Major version mismatch.
George Keishingc95e9982019-01-14 09:27:45 -0600437 Should Be Equal As Strings ${ipmi_fw_minor_version} ${major_minor_version[1]}
George Keishing2ee2f002019-02-16 09:36:02 -0600438 ... msg=Minor version mismatch.
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500439
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600440 Should Be Equal ${mc_info['ipmi_version']} 2.0
441
Gunnar Mills917ba1a2018-04-08 16:42:12 -0500442 # TODO: Verify Manufacturer and Product IDs directly from json file.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600443 # Reference : openbmc/openbmc-test-automation#1244
444 Should Be Equal ${mc_info['manufacturer_id']} 42817
445 Should Be Equal ${mc_info['product_id']} 16975 (0x424f)
446
447 Should Be Equal ${mc_info['device_available']} yes
448 Should Be Equal ${mc_info['provides_device_sdrs']} yes
449 Should Contain ${mc_info['additional_device_support']} Sensor Device
450 Should Contain ${mc_info['additional_device_support']} SEL Device
451 Should Contain
452 ... ${mc_info['additional_device_support']} FRU Inventory Device
453 Should Contain ${mc_info['additional_device_support']} Chassis Device
George Keishingb746d3f2018-04-19 10:53:10 -0500454
George Keishing3511a3f2018-04-19 10:38:30 -0500455 # Auxiliary revision data verification.
456 ${aux_version}= Get Aux Version ${bmc_version_full}
457
458 # From aux_firmware_rev_info field ['0x04', '0x38', '0x00', '0x03']
459 ${bmc_aux_version}= Catenate
460 ... SEPARATOR=
461 ... ${mc_info['aux_firmware_rev_info'][0][2:]}
462 ... ${mc_info['aux_firmware_rev_info'][1][2:]}
463 ... ${mc_info['aux_firmware_rev_info'][2][2:]}
464 ... ${mc_info['aux_firmware_rev_info'][3][2:]}
465
466 Should Be Equal As Integers
467 ... ${bmc_aux_version} ${aux_version}
468 ... msg=BMC aux version ${bmc_aux_version} does not match expected value of ${aux_version}.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600469
470
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500471Verify SDR Info
472 [Documentation] Verify sdr info command output.
473 [Tags] Verify_SDR_Info
474
475 # Example of SDR info command output:
476 # SDR Version : 0x51
477 # Record Count : 216
478 # Free Space : unspecified
479 # Most recent Addition :
480 # Most recent Erase :
481 # SDR overflow : no
482 # SDR Repository Update Support : unspecified
483 # Delete SDR supported : no
484 # Partial Add SDR supported : no
485 # Reserve SDR repository supported : no
486 # SDR Repository Alloc info supported : no
487
488 ${sdr_info}= Get SDR Info
489 Should Be Equal ${sdr_info['sdr_version']} 0x51
490
491 # Get sensor count from "sdr elist all" command output.
492 ${sensor_count}= Get Sensor Count
493 Should Be Equal As Strings
494 ... ${sdr_info['record_count']} ${sensor_count}
495
496 Should Be Equal ${sdr_info['free_space']} unspecified
497 Should Be Equal ${sdr_info['most_recent_addition']} ${EMPTY}
498 Should Be Equal ${sdr_info['most_recent_erase']} ${EMPTY}
499 Should Be Equal ${sdr_info['sdr_overflow']} no
500 Should Be Equal ${sdr_info['sdr_repository_update_support']} unspecified
501 Should Be Equal ${sdr_info['delete_sdr_supported']} no
502 Should Be Equal ${sdr_info['partial_add_sdr_supported']} no
503 Should Be Equal ${sdr_info['reserve_sdr_repository_supported']} no
504 Should Be Equal ${sdr_info['sdr_repository_alloc_info_supported']} no
505
506
George Keishing02651f02018-04-11 02:07:16 -0500507Test Valid IPMI Channels Supported
508 [Documentation] Verify IPMI channels supported on a given system.
509 [Tags] Test_Valid_IPMI_Channels_Supported
510
511 ${channel_count}= Get Physical Network Interface Count
512
513 # Note: IPMI network channel logically starts from 1.
514 :FOR ${channel_number} IN RANGE 1 ${channel_count}
Rahul Maheshwari20f3bf72018-12-18 04:24:20 -0600515 \ Run IPMI Standard Command lan print ${channel_number}
George Keishing02651f02018-04-11 02:07:16 -0500516
517
518Test Invalid IPMI Channel Response
519 [Documentation] Verify invalid IPMI channels supported response.
520 [Tags] Test_Invalid_IPMI_Channel_Response
521
522 ${channel_count}= Get Physical Network Interface Count
523
524 # To target invalid channel, increment count.
525 ${channel_number}= Evaluate ${channel_count} + 1
526
527 # Example of invalid channel:
George Keishing72d0ac82018-09-20 09:33:01 -0500528 # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3
George Keishing02651f02018-04-11 02:07:16 -0500529 # Get Channel Info command failed: Parameter out of range
530 # Invalid channel: 3
531
532 ${stdout}= Run External IPMI Standard Command
533 ... lan print ${channel_number} fail_on_err=${0}
534 Should Contain ${stdout} Invalid channel
535 ... msg=IPMI channel ${channel_number} is invalid but seen working.
536
537
George Keishinge85113a2019-06-07 08:21:51 -0500538Test IPMI Restriction Mode
539 [Documentation] Set restricition mode via REST and verify IPMI operation.
540 [Tags] Test_IPMI_Restriction_Mode
541 # Forego normal test setup:
542 [Setup] No Operation
543 [Teardown] Run Keywords FFDC On Test Case Fail AND
544 ... Set IPMI Restriction Mode xyz.openbmc_project.Control.Security.RestrictionMode.Modes.None
545
546 # By default no IPMI operations are restricted.
547 # /xyz/openbmc_project/control/host0/restriction_mode/attr/RestrictionMode
548 # {
549 # "data": "xyz.openbmc_project.Control.Security.RestrictionMode.Modes.None",
550 # "message": "200 OK",
551 # "status": "ok"
552 # }
553
554 # Refer to: #openbmc/phosphor-host-ipmid/blob/master/host-ipmid-whitelist.conf
555 # Set the restriction mode to Whitelist IPMI commands only:
556 # /xyz/openbmc_project/control/host0/restriction_mode/attr/RestrictionMode
557 # {
558 # "data": "xyz.openbmc_project.Control.Security.RestrictionMode.Modes.Whitelist",
559 # "message": "200 OK",
560 # "status": "ok"
561 # }
562
563 Set IPMI Restriction Mode xyz.openbmc_project.Control.Security.RestrictionMode.Modes.Whitelist
564
565 # Attempt white-listed operation expecting success.
566 IPMI Power On
567
568 # Attempt non white-listed operation expecting failure.
569 Run Keyword And Expect Error *Insufficient privilege level*
570 ... Run Inband IPMI Standard Command mc reset cold
571
572
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500573*** Keywords ***
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600574
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500575Get Sensor Count
576 [Documentation] Get sensors count using "sdr elist all" command.
577
578 # Example of "sdr elist all" command output:
579 # BootProgress | 03h | ok | 34.2 |
580 # OperatingSystemS | 05h | ok | 35.1 |
581 # AttemptsLeft | 07h | ok | 34.1 |
582 # occ0 | 08h | ok | 210.1 | Device Disabled
583 # occ1 | 09h | ok | 210.2 | Device Disabled
584 # p0_core0_temp | 11h | ns | 3.1 | Disabled
585 # cpu0_core0 | 12h | ok | 208.1 | Presence detected
586 # p0_core1_temp | 14h | ns | 3.2 | Disabled
587 # cpu0_core1 | 15h | ok | 208.2 | Presence detected
588 # p0_core2_temp | 17h | ns | 3.3 | Disabled
589 # ..
590 # ..
591 # ..
592 # ..
593 # ..
594 # ..
595 # fan3 | 00h | ns | 29.4 | Logical FRU @35h
596 # bmc | 00h | ns | 6.1 | Logical FRU @3Ch
597 # ethernet | 00h | ns | 1.1 | Logical FRU @46h
598
599 ${output}= Run IPMI Standard Command sdr elist all
600 ${sensor_list}= Split String ${output} \n
601 ${sensor_count}= Get Length ${sensor_list}
602 [Return] ${sensor_count}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600603
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600604Set Management Controller ID String
605 [Documentation] Set the management controller ID string.
606 [Arguments] ${string}
607
608 # Description of argument(s):
609 # string Management Controller ID String to be set
610
611 ${set_mc_id_string}= Run IPMI Standard Command
612 ... dcmi set_mc_id_string ${string}
613
Sweta Potthurif39022d2018-02-06 03:40:07 -0600614
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600615Get Management Controller ID String And Verify
George Keishingcb3b9b62018-09-14 12:11:19 -0500616 [Documentation] Get the management controller ID string.
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600617 [Arguments] ${string}
618
619 # Description of argument(s):
620 # string Management Controller ID string
621
622 ${get_mc_id}= Run IPMI Standard Command dcmi get_mc_id_string
623 Should Contain ${get_mc_id} ${string}
624 ... msg=Command failed: get_mc_id.
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600625
Sweta Potthurif39022d2018-02-06 03:40:07 -0600626
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600627Set Watchdog Enabled Using REST
628 [Documentation] Set watchdog Enabled field using REST.
629 [Arguments] ${value}
630
631 # Description of argument(s):
632 # value Integer value (eg. "0-Disabled", "1-Enabled").
633
634 ${value_dict}= Create Dictionary data=${value}
Steven Sombaraaaab222018-12-19 13:16:23 -0600635 ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}attr/Enabled
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600636 ... data=${value_dict}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600637
638
Sweta Potthurif39022d2018-02-06 03:40:07 -0600639Fetch Details From LAN Print
640 [Documentation] Fetch details from LAN print.
641 [Arguments] ${field_name}
642
643 # Description of argument(s):
644 # ${field_name} Field name to be fetched from LAN print
645 # (e.g. "MAC Address", "Source").
646
Rahul Maheshwarid8037d32018-12-17 00:59:57 -0600647 ${stdout}= Run IPMI Standard Command lan print
Sweta Potthurif39022d2018-02-06 03:40:07 -0600648 ${fetch_value}= Get Lines Containing String ${stdout} ${field_name}
649 ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE}
650 [Return] ${value_fetch}
651
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600652
653Verify Power Reading
654 [Documentation] Get dcmi power reading via IPMI.
655
656 # Example of power reading command output via IPMI.
657 # Instantaneous power reading: 235 Watts
658 # Minimum during sampling period: 235 Watts
659 # Maximum during sampling period: 235 Watts
660 # Average power reading over sample period: 235 Watts
661 # IPMI timestamp: Thu Jan 1 00:00:00 1970
662 # Sampling period: 00000000 Seconds.
663 # Power reading state is: deactivated
664
665 ${power_reading}= Get IPMI Power Reading
666
667 ${host_state}= Get Host State
668 Run Keyword If '${host_state}' == 'Off'
George Keishing51314872018-03-31 13:24:35 -0500669 ... Should Be Equal ${power_reading['instantaneous_power_reading']} 0
670 ... msg=Power reading not zero when power is off.
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600671
George Keishing51314872018-03-31 13:24:35 -0500672 Run Keyword If '${power_reading['instantaneous_power_reading']}' != '0'
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600673 ... Verify Power Reading Using REST ${power_reading['instantaneous_power_reading']}
674
675
George Keishinge78f1fd2018-09-04 13:34:59 -0500676Verify Power Reading Via Raw Command
677 [Documentation] Get dcmi power reading via IPMI raw command.
678
679 ${ipmi_raw_output}= Run IPMI Standard Command
680 ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]}
681
682 @{raw_output_list}= Split String ${ipmi_raw_output} ${SPACE}
683
684 # On successful execution of raw IPMI power reading command, completion
685 # code does not come in output. So current power value will start from 2
686 # byte instead of 3.
687
688 ${power_reading_ipmi_raw_3_item}= Get From List ${raw_output_list} 2
689 ${power_reading_ipmi_raw_3_item}=
690 ... Convert To Integer 0x${power_reading_ipmi_raw_3_item}
691
692 ${power_reading_rest}= Read Attribute
693 ... ${SENSORS_URI}power/total_power Value
694
695 # Example of power reading via REST
696 # "CriticalAlarmHigh": 0,
697 # "CriticalAlarmLow": 0,
698 # "CriticalHigh": 3100000000,
699 # "CriticalLow": 0,
700 # "Scale": -6,
701 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
702 # "Value": 228000000,
703 # "WarningAlarmHigh": 0,
704 # "WarningAlarmLow": 0,
705 # "WarningHigh": 3050000000,
706 # "WarningLow": 0
707
708 # Get power value based on scale i.e. Value * (10 power Scale Value)
709 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
710
711 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
712 ${ipmi_rest_power_diff}=
713 ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi_raw_3_item})
714
715 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
716 ... msg=Power Reading above allowed threshold ${allowed_power_diff}.
717
718
Rahul Maheshwari0eb33f02018-04-10 02:31:54 -0500719Verify Management Controller ID String Status
720 [Documentation] Verify management controller ID string status via IPMI.
721 [Arguments] ${status}
722
723 # Example of dcmi get_conf_param command output:
724 # DHCP Discovery method :
725 # Management Controller ID String is disabled
726 # Vendor class identifier DCMI IANA and Vendor class-specific Informationa are disabled
727 # Initial timeout interval : 4 seconds
728 # Server contact timeout interval : 120 seconds
729 # Server contact retry interval : 64 seconds
730
731 ${resp}= Run IPMI Standard Command dcmi get_conf_param
732 ${resp}= Get Lines Containing String ${resp}
733 ... Management Controller ID String case_insensitive=True
734 Should Contain ${resp} ${status}
735 ... msg=Management controller ID string is not ${status}
736
737
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600738Verify Power Reading Using REST
739 [Documentation] Verify power reading using REST.
740 [Arguments] ${power_reading}
741
Gunnar Mills948e2e22018-03-23 12:54:27 -0500742 # Description of argument(s):
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600743 # power_reading IPMI Power reading
744
745 ${power_reading_rest}= Read Attribute
746 ... ${SENSORS_URI}power/total_power Value
747
748 # Example of power reading via REST
749 # "CriticalAlarmHigh": 0,
750 # "CriticalAlarmLow": 0,
751 # "CriticalHigh": 3100000000,
752 # "CriticalLow": 0,
753 # "Scale": -6,
754 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
755 # "Value": 228000000,
756 # "WarningAlarmHigh": 0,
757 # "WarningAlarmLow": 0,
758 # "WarningHigh": 3050000000,
759 # "WarningLow": 0
760
761 # Get power value based on scale i.e. Value * (10 power Scale Value)
762 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
763 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
764 ${ipmi_rest_power_diff}=
765 ... Evaluate abs(${power_reading_rest} - ${power_reading})
766
767 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
768 ... msg=Power reading above allowed threshold ${allowed_power_diff}.
George Keishing02651f02018-04-11 02:07:16 -0500769
770
771Get Physical Network Interface Count
772 [Documentation] Return valid physical network interfaces count.
773
774 # Example:
775 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
776 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
777
778 ${mac_entry_list}= Get BMC MAC Address List
779 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
780 ${physical_interface_count}= Get Length ${mac_unique_list}
781
782 [Return] ${physical_interface_count}
George Keishing39967eb2018-04-30 11:36:23 -0500783
George Keishinge85113a2019-06-07 08:21:51 -0500784
785Set IPMI Restriction Mode
786 [Documentation] Set the IPMI restriction mode.
787 [Arguments] ${restriction_mode}
788
789 # Description of argument(s):
790 # restriction_mode IPMI valid restriction modes.
791
792 ${valueDict}= Create Dictionary data=${restriction_mode}
793
794 Write Attribute ${CONTROL_HOST_URI}restriction_mode/
795 ... RestrictionMode data=${valueDict}