blob: 38724009123209578f88d7495164098fd66a6b78 [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
Rahul Maheshwari615da152018-02-13 23:53:36 -06006Resource ../lib/boot_utils.robot
7Library ../../lib/ipmi_utils.py
Sweta Potthurif39022d2018-02-06 03:40:07 -06008Resource ../../lib/bmc_network_utils.robot
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -05009
Sweta Potthurif39022d2018-02-06 03:40:07 -060010Suite Setup Suite Setup Execution
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050011Test Teardown FFDC On Test Case Fail
12
13*** Variables ***
14
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060015${new_mc_id}= HOST
Rahul Maheshwari901dcde2018-02-06 03:14:31 -060016${allowed_temp_diff}= ${1}
Rahul Maheshwari615da152018-02-13 23:53:36 -060017${allowed_power_diff}= ${10}
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060018
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050019*** Test Cases ***
20
21Set Asset Tag With Valid String Length
22 [Documentation] Set asset tag with valid string length and verify.
23 [Tags] Set_Asset_Tag_With_Valid_String_Length
24
25 # Allowed MAX characters length for asset tag name is 63.
26 ${random_string}= Generate Random String 63
27 Run Keyword Run IPMI Standard Command dcmi set_asset_tag ${random_string}
28
29 ${asset_tag}= Run Keyword Run IPMI Standard Command dcmi asset_tag
30 Should Contain ${asset_tag} ${random_string}
31
32
33Set Asset Tag With Invalid String Length
34 [Documentation] Verify error while setting invalid asset tag via IPMI.
35 [Tags] Set_Asset_Tag_With_Invalid_String_Length
36
37 # Any string more than 63 character is invalid for asset tag.
38 ${random_string}= Generate Random String 64
39
40 ${resp}= Run Keyword And Expect Error * Run IPMI Standard Command
41 ... dcmi set_asset_tag ${random_string}
42 Should Contain ${resp} Parameter out of range ignore_case=True
43
44
45Set Asset Tag With Valid String Length Via REST
46 [Documentation] Set valid asset tag via REST and verify.
47 [Tags] Set_Asset_Tag_With_Valid_String_Length_Via_REST
48
49 ${random_string}= Generate Random String 63
50 ${args}= Create Dictionary data=${random_string}
51 Write Attribute /xyz/openbmc_project/inventory/system AssetTag
52 ... data=${args}
53
54 ${asset_tag}= Read Attribute /xyz/openbmc_project/inventory/system
55 ... AssetTag
56 Should Be Equal As Strings ${asset_tag} ${random_string}
57
Sweta Potthurif39022d2018-02-06 03:40:07 -060058
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060059Verify Get And Set Management Controller ID String
60 [Documentation] Verify get and set management controller ID string.
61 [Tags] Verify_Get_And_Set_Management_Controller_ID_String
62
63 # Get the value of the managemment controller ID string.
64 # Example:
65 # Get Management Controller Identifier String: witherspoon
66
67 ${cmd_output}= Run IPMI Standard Command dcmi get_mc_id_string
68
69 # Extract management controller ID from cmd_output.
70 ${initial_mc_id}= Fetch From Right ${cmd_output} :${SPACE}
71
72 # Set the management controller ID string to other value.
73 # Example:
74 # Set Management Controller Identifier String Command: HOST
75
76 Set Management Controller ID String ${new_mc_id}
77
78 # Get the management controller ID and verify.
79 Get Management Controller ID String And Verify ${new_mc_id}
80
81 # Set the value back to the initial value and verify.
82 Set Management Controller ID String ${initial_mc_id}
83
84 # Get the management controller ID and verify.
85 Get Management Controller ID String And Verify ${initial_mc_id}
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050086
Sweta Potthurif39022d2018-02-06 03:40:07 -060087
Sweta Potthuri0cc60502018-01-24 00:36:17 -060088Verify Chassis Identify via IPMI
89 [Documentation] Verify "chassis identify" using IPMI command.
90 [Tags] Verify_Chassis_Identify_via_IPMI
91
92 # Set to default "chassis identify" and verify that LED blinks for 15s.
93 Run IPMI Standard Command chassis identify
94 Verify Identify LED State Blink
95
96 Sleep 15s
97 Verify Identify LED State Off
98
99 # Set "chassis identify" to 10s and verify that the LED blinks for 10s.
100 Run IPMI Standard Command chassis identify 10
101 Verify Identify LED State Blink
102
103 Sleep 10s
104 Verify Identify LED State Off
105
Sweta Potthurif39022d2018-02-06 03:40:07 -0600106
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600107Verify Chassis Identify Off And Force Identify On via IPMI
108 [Documentation] Verify "chassis identify" off
109 ... and "force identify on" via IPMI.
110 [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI
111
112 # Set the LED to "Force Identify On".
113 Run IPMI Standard Command chassis identify force
114 Verify Identify LED State Blink
115
116 # Set "chassis identify" to 0 and verify that the LED turns off.
117 Run IPMI Standard Command chassis identify 0
118 Verify Identify LED State Off
119
Sweta Potthurif39022d2018-02-06 03:40:07 -0600120
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600121Test Watchdog Reset Via IPMI And Verify Using REST
122 [Documentation] Test watchdog reset via IPMI and verify using REST.
123 [Tags] Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST
124
125 Initiate Host Boot
126
127 Set Watchdog Enabled Using REST ${1}
128
129 Watchdog Object Should Exist
130
131 # Resetting the watchdog via IPMI.
132 Run IPMI Standard Command mc watchdog reset
133
134 # Verify the watchdog is reset using REST after an interval of 1000ms.
135 Sleep 1000ms
136 ${watchdog_time_left}=
137 ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining
138 Should Be True
139 ... ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000}
140 ... msg=Watchdog timer didn't reset.
141
Sweta Potthurif39022d2018-02-06 03:40:07 -0600142
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600143Test Watchdog Off Via IPMI And Verify Using REST
144 [Documentation] Test watchdog off via IPMI and verify using REST.
145 [Tags] Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST
146
147 Initiate Host Boot
148
149 Set Watchdog Enabled Using REST ${1}
150
151 Watchdog Object Should Exist
152
153 # Turn off the watchdog via IPMI.
154 Run IPMI Standard Command mc watchdog off
155
156 # Verify the watchdog is off using REST
157 ${watchdog_state}= Read Attribute ${HOST_WATCHDOG_URI} Enabled
158 Should Be Equal ${watchdog_state} ${0}
159 ... msg=msg=Verification failed for watchdog off check.
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600160
161
162Test Ambient Temperature Via IPMI
163 [Documentation] Test ambient temperature via IPMI and verify using REST.
164 [Tags] Test_Ambient_Temperature_Via_IPMI
165
166 # Entity ID Entity Instance Temp. Readings
167 # Inlet air temperature(40h) 1 +19 C
168 # CPU temperature sensors(41h) 5 +51 C
169 # CPU temperature sensors(41h) 6 +50 C
170 # CPU temperature sensors(41h) 7 +50 C
171 # CPU temperature sensors(41h) 8 +50 C
172 # CPU temperature sensors(41h) 9 +50 C
173 # CPU temperature sensors(41h) 10 +48 C
174 # CPU temperature sensors(41h) 11 +49 C
175 # CPU temperature sensors(41h) 12 +47 C
176 # CPU temperature sensors(41h) 8 +50 C
177 # CPU temperature sensors(41h) 16 +51 C
178 # CPU temperature sensors(41h) 24 +50 C
179 # CPU temperature sensors(41h) 32 +43 C
180 # CPU temperature sensors(41h) 40 +43 C
181 # Baseboard temperature sensors(42h) 1 +35 C
182
183 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
184 ${ambient_temp_line}=
185 ... Get Lines Containing String ${temp_reading}
186 ... Inlet air temperature case-insensitive
187
188 ${ambient_temp_ipmi}= Fetch From Right ${ambient_temp_line} +
189 ${ambient_temp_ipmi}= Remove String ${ambient_temp_ipmi} ${SPACE}C
190
191 ${ambient_temp_rest}= Read Attribute
192 ... ${SENSORS_URI}temperature/ambient Value
193
194 # Example of ambient temperature via REST
195 # "CriticalAlarmHigh": 0,
196 # "CriticalAlarmLow": 0,
197 # "CriticalHigh": 35000,
198 # "CriticalLow": 0,
199 # "Scale": -3,
200 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
201 # "Value": 21775,
202 # "WarningAlarmHigh": 0,
203 # "WarningAlarmLow": 0,
204 # "WarningHigh": 25000,
205 # "WarningLow": 0
206
207 # Get temperature value based on scale i.e. Value * (10 power Scale Value)
208 # e.g. from above case 21775 * (10 power -3) = 21775/1000
209
210 ${ambient_temp_rest}= Evaluate ${ambient_temp_rest}/1000
211 ${ipmi_rest_temp_diff}=
212 ... Evaluate abs(${ambient_temp_rest} - ${ambient_temp_ipmi})
213
214 Should Be True ${ipmi_rest_temp_diff} <= ${allowed_temp_diff}
215 ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}.
216
217
Rahul Maheshwari43556632018-02-05 23:42:52 -0600218Verify Get DCMI Capabilities
219 [Documentation] Verify get DCMI capabilities command output.
220 [Tags] Verify_Get_DCMI_Capabilities
221
222 ${cmd_output}= Run IPMI Standard Command dcmi discover
223
224 @{supported_capabilities}= Create List
225 # Supported DCMI capabilities:
226 ... Mandatory platform capabilties
227 ... Optional platform capabilties
228 ... Power management available
229 ... Managebility access capabilties
230 ... In-band KCS channel available
231 # Mandatory platform attributes:
232 ... 200 SEL entries
233 ... SEL automatic rollover is enabled
234 # Optional Platform Attributes:
235 ... Slave address of device: 0h (8bits)(Satellite/External controller)
236 ... Channel number is 0h (Primary BMC)
237 ... Device revision is 0
238 # Manageability Access Attributes:
239 ... Primary LAN channel number: 1 is available
240 ... Secondary LAN channel is not available for OOB
241 ... No serial channel is available
242
243 :FOR ${capability} IN @{supported_capabilities}
244 \ Should Contain ${cmd_output} ${capability} ignore_case=True
245 ... msg=Supported DCMI capabilities not present.
246
247
Rahul Maheshwari615da152018-02-13 23:53:36 -0600248Test Power Reading Via IPMI With Host Booted
249 [Documentation] Test power reading via IPMI with host booted state and
250 ... verify using REST.
251 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted
252
253 REST Power On stack_mode=skip quiet=1
254
255 # Example of power reading command output via IPMI.
256 # Instantaneous power reading: 235 Watts
257 # Minimum during sampling period: 235 Watts
258 # Maximum during sampling period: 235 Watts
259 # Average power reading over sample period: 235 Watts
260 # IPMI timestamp: Thu Jan 1 00:00:00 1970
261 # Sampling period: 00000000 Seconds.
262 # Power reading state is: deactivated
263
264 ${power_reading}= Get IPMI Power Reading
265 ${power_reading_ipmi}= Set Variable
266 ... ${power_reading['instantaneous_power_reading']}
267 ${power_reading_ipmi}= Remove String ${power_reading_ipmi} ${SPACE}Watts
268
269 ${power_reading_rest}= Read Attribute
270 ... ${SENSORS_URI}power/total_power Value
271
272 # Example of power reading via REST
273 # "CriticalAlarmHigh": 0,
274 # "CriticalAlarmLow": 0,
275 # "CriticalHigh": 3100000000,
276 # "CriticalLow": 0,
277 # "Scale": -6,
278 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
279 # "Value": 228000000,
280 # "WarningAlarmHigh": 0,
281 # "WarningAlarmLow": 0,
282 # "WarningHigh": 3050000000,
283 # "WarningLow": 0
284
285 # Get power value based on scale i.e. Value * (10 power Scale Value)
286 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
287
288 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
289 ${ipmi_rest_power_diff}=
290 ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi})
291
292 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
293 ... msg=Power reading above allowed threshold ${allowed_power_diff}.
294
295
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600296Test Baseboard Temperature Via IPMI
297 [Documentation] Test baseboard temperature via IPMI and verify using REST.
298 [Tags] Test_Baseboard_Temperature_Via_IPMI
299
300 # Example of IPMI dcmi get_temp_reading output:
301 # Entity ID Entity Instance Temp. Readings
302 # Inlet air temperature(40h) 1 +19 C
303 # CPU temperature sensors(41h) 5 +51 C
304 # CPU temperature sensors(41h) 6 +50 C
305 # CPU temperature sensors(41h) 7 +50 C
306 # CPU temperature sensors(41h) 8 +50 C
307 # CPU temperature sensors(41h) 9 +50 C
308 # CPU temperature sensors(41h) 10 +48 C
309 # CPU temperature sensors(41h) 11 +49 C
310 # CPU temperature sensors(41h) 12 +47 C
311 # CPU temperature sensors(41h) 8 +50 C
312 # CPU temperature sensors(41h) 16 +51 C
313 # CPU temperature sensors(41h) 24 +50 C
314 # CPU temperature sensors(41h) 32 +43 C
315 # CPU temperature sensors(41h) 40 +43 C
316 # Baseboard temperature sensors(42h) 1 +35 C
317
318 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
319 ${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.
343 Read Attribute ${NETWORK_MANAGER}/config DefaultGateway
344 ... 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
369 ... ${NETWORK_MANAGER}/eth0 DHCPEnabled
370 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 Maheshwarifdd5ff62017-08-01 04:15:03 -0500390*** Keywords ***
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600391
Sweta Potthurif39022d2018-02-06 03:40:07 -0600392
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600393Set Management Controller ID String
394 [Documentation] Set the management controller ID string.
395 [Arguments] ${string}
396
397 # Description of argument(s):
398 # string Management Controller ID String to be set
399
400 ${set_mc_id_string}= Run IPMI Standard Command
401 ... dcmi set_mc_id_string ${string}
402
Sweta Potthurif39022d2018-02-06 03:40:07 -0600403
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600404Get Management Controller ID String And Verify
405 [Documentation] Get the management controller ID sting.
406 [Arguments] ${string}
407
408 # Description of argument(s):
409 # string Management Controller ID string
410
411 ${get_mc_id}= Run IPMI Standard Command dcmi get_mc_id_string
412 Should Contain ${get_mc_id} ${string}
413 ... msg=Command failed: get_mc_id.
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600414
Sweta Potthurif39022d2018-02-06 03:40:07 -0600415
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600416Verify Identify LED State
417 [Documentation] Verify the identify LED state
418 ... matches caller's expectations.
419 [Arguments] ${expected_state}
420
421 # Description of argument(s):
422 # expected_state The LED state expected by the caller ("Blink" or "Off").
423
424 ${resp}= Read Attribute ${LED_PHYSICAL_URI}/front_id State
425 Should Be Equal ${resp} xyz.openbmc_project.Led.Physical.Action.${expected_state}
426 ... msg=Unexpected LED state.
427
428 ${resp}= Read Attribute ${LED_PHYSICAL_URI}/rear_id State
429 Should Be Equal ${resp} xyz.openbmc_project.Led.Physical.Action.${expected_state}
430 ... msg=Unexpected LED state.
431
Sweta Potthurif39022d2018-02-06 03:40:07 -0600432
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600433Set Watchdog Enabled Using REST
434 [Documentation] Set watchdog Enabled field using REST.
435 [Arguments] ${value}
436
437 # Description of argument(s):
438 # value Integer value (eg. "0-Disabled", "1-Enabled").
439
440 ${value_dict}= Create Dictionary data=${value}
441 ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}/attr/Enabled
442 ... data=${value_dict}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600443
444
445Log LAN Print Details
446 [Documentation] Log IPMI LAN print details and return them as a string.
447
448 # Example:
449
450 # Set in Progress : Set Complete
451 # Auth Type Support : MD5
452 # Auth Type Enable : Callback : MD5
453 # : User : MD5
454 # : Operator : MD5
455 # : Admin : MD5
456 # : OEM : MD5
457 # IP Address Source : Static Address
458 # IP Address : xx.xx.xx.xx
459 # Subnet Mask : yy.yy.yy.yy
460 # MAC Address : xx.xx.xx.xx.xx.xx
461 # Default Gateway IP : xx.xx.xx.xx
462 # 802.1q VLAN ID : Disabled Cipher Suite
463 # Priv Max : Not Available
464 # Bad Password Threshold : Not Available
465
466 Login To OS Host
467 Check If IPMI Tool Exist
468
469 ${cmd_buf}= Catenate ${IPMI_INBAND_CMD} lan print
470
471 ${stdout} ${stderr} ${rc}= OS Execute Command ${cmd_buf}
472 Log ${stdout}
473 [Return] ${stdout}
474
475
476Fetch Details From LAN Print
477 [Documentation] Fetch details from LAN print.
478 [Arguments] ${field_name}
479
480 # Description of argument(s):
481 # ${field_name} Field name to be fetched from LAN print
482 # (e.g. "MAC Address", "Source").
483
484 ${stdout}= Log LAN Print Details
485 ${fetch_value}= Get Lines Containing String ${stdout} ${field_name}
486 ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE}
487 [Return] ${value_fetch}
488
489
490Suite Setup Execution
491 [Documentation] Do the suite setup execution tasks.
492
493 Should Not Be Empty
494 ... ${OS_HOST} msg=You must provide DNS name/IP of the OS host.
495 Should Not Be Empty
496 ... ${OS_USERNAME} msg=You must provide OS host user name.
497 Should Not Be Empty
498 ... ${OS_PASSWORD} msg=You must provide OS host user password.
499
500 # Boot To OS
501 REST Power On quiet=${1}
502