blob: efc0ac68c982bdd7c106b205335f3b4a3e924c3a [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
Rahul Maheshwariabe13af2018-02-15 22:42:08 -060014
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050015*** Variables ***
16
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060017${new_mc_id}= HOST
Rahul Maheshwari901dcde2018-02-06 03:14:31 -060018${allowed_temp_diff}= ${1}
Rahul Maheshwari615da152018-02-13 23:53:36 -060019${allowed_power_diff}= ${10}
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060020
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050021*** Test Cases ***
22
23Set Asset Tag With Valid String Length
24 [Documentation] Set asset tag with valid string length and verify.
25 [Tags] Set_Asset_Tag_With_Valid_String_Length
26
27 # Allowed MAX characters length for asset tag name is 63.
28 ${random_string}= Generate Random String 63
29 Run Keyword Run IPMI Standard Command dcmi set_asset_tag ${random_string}
30
31 ${asset_tag}= Run Keyword Run IPMI Standard Command dcmi asset_tag
32 Should Contain ${asset_tag} ${random_string}
33
34
35Set Asset Tag With Invalid String Length
36 [Documentation] Verify error while setting invalid asset tag via IPMI.
37 [Tags] Set_Asset_Tag_With_Invalid_String_Length
38
39 # Any string more than 63 character is invalid for asset tag.
40 ${random_string}= Generate Random String 64
41
42 ${resp}= Run Keyword And Expect Error * Run IPMI Standard Command
43 ... dcmi set_asset_tag ${random_string}
44 Should Contain ${resp} Parameter out of range ignore_case=True
45
46
47Set Asset Tag With Valid String Length Via REST
48 [Documentation] Set valid asset tag via REST and verify.
49 [Tags] Set_Asset_Tag_With_Valid_String_Length_Via_REST
50
51 ${random_string}= Generate Random String 63
52 ${args}= Create Dictionary data=${random_string}
53 Write Attribute /xyz/openbmc_project/inventory/system AssetTag
54 ... data=${args}
55
56 ${asset_tag}= Read Attribute /xyz/openbmc_project/inventory/system
57 ... AssetTag
58 Should Be Equal As Strings ${asset_tag} ${random_string}
59
Sweta Potthurif39022d2018-02-06 03:40:07 -060060
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060061Verify Get And Set Management Controller ID String
62 [Documentation] Verify get and set management controller ID string.
63 [Tags] Verify_Get_And_Set_Management_Controller_ID_String
64
65 # Get the value of the managemment controller ID string.
66 # Example:
67 # Get Management Controller Identifier String: witherspoon
68
69 ${cmd_output}= Run IPMI Standard Command dcmi get_mc_id_string
70
71 # Extract management controller ID from cmd_output.
72 ${initial_mc_id}= Fetch From Right ${cmd_output} :${SPACE}
73
74 # Set the management controller ID string to other value.
75 # Example:
76 # Set Management Controller Identifier String Command: HOST
77
78 Set Management Controller ID String ${new_mc_id}
79
80 # Get the management controller ID and verify.
81 Get Management Controller ID String And Verify ${new_mc_id}
82
83 # Set the value back to the initial value and verify.
84 Set Management Controller ID String ${initial_mc_id}
85
86 # Get the management controller ID and verify.
87 Get Management Controller ID String And Verify ${initial_mc_id}
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050088
Sweta Potthurif39022d2018-02-06 03:40:07 -060089
Sweta Potthuri0cc60502018-01-24 00:36:17 -060090Verify Chassis Identify via IPMI
91 [Documentation] Verify "chassis identify" using IPMI command.
92 [Tags] Verify_Chassis_Identify_via_IPMI
93
94 # Set to default "chassis identify" and verify that LED blinks for 15s.
95 Run IPMI Standard Command chassis identify
96 Verify Identify LED State Blink
97
98 Sleep 15s
99 Verify Identify LED State Off
100
101 # Set "chassis identify" to 10s and verify that the LED blinks for 10s.
102 Run IPMI Standard Command chassis identify 10
103 Verify Identify LED State Blink
104
105 Sleep 10s
106 Verify Identify LED State Off
107
Sweta Potthurif39022d2018-02-06 03:40:07 -0600108
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600109Verify Chassis Identify Off And Force Identify On via IPMI
110 [Documentation] Verify "chassis identify" off
111 ... and "force identify on" via IPMI.
112 [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI
113
114 # Set the LED to "Force Identify On".
115 Run IPMI Standard Command chassis identify force
116 Verify Identify LED State Blink
117
118 # Set "chassis identify" to 0 and verify that the LED turns off.
119 Run IPMI Standard Command chassis identify 0
120 Verify Identify LED State Off
121
Sweta Potthurif39022d2018-02-06 03:40:07 -0600122
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600123Test Watchdog Reset Via IPMI And Verify Using REST
124 [Documentation] Test watchdog reset via IPMI and verify using REST.
125 [Tags] Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST
126
127 Initiate Host Boot
128
129 Set Watchdog Enabled Using REST ${1}
130
131 Watchdog Object Should Exist
132
133 # Resetting the watchdog via IPMI.
134 Run IPMI Standard Command mc watchdog reset
135
136 # Verify the watchdog is reset using REST after an interval of 1000ms.
137 Sleep 1000ms
138 ${watchdog_time_left}=
139 ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining
140 Should Be True
141 ... ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000}
142 ... msg=Watchdog timer didn't reset.
143
Sweta Potthurif39022d2018-02-06 03:40:07 -0600144
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600145Test Watchdog Off Via IPMI And Verify Using REST
146 [Documentation] Test watchdog off via IPMI and verify using REST.
147 [Tags] Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST
148
149 Initiate Host Boot
150
151 Set Watchdog Enabled Using REST ${1}
152
153 Watchdog Object Should Exist
154
155 # Turn off the watchdog via IPMI.
156 Run IPMI Standard Command mc watchdog off
157
158 # Verify the watchdog is off using REST
159 ${watchdog_state}= Read Attribute ${HOST_WATCHDOG_URI} Enabled
160 Should Be Equal ${watchdog_state} ${0}
161 ... msg=msg=Verification failed for watchdog off check.
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600162
163
164Test Ambient Temperature Via IPMI
165 [Documentation] Test ambient temperature via IPMI and verify using REST.
166 [Tags] Test_Ambient_Temperature_Via_IPMI
167
168 # Entity ID Entity Instance Temp. Readings
169 # Inlet air temperature(40h) 1 +19 C
170 # CPU temperature sensors(41h) 5 +51 C
171 # CPU temperature sensors(41h) 6 +50 C
172 # CPU temperature sensors(41h) 7 +50 C
173 # CPU temperature sensors(41h) 8 +50 C
174 # CPU temperature sensors(41h) 9 +50 C
175 # CPU temperature sensors(41h) 10 +48 C
176 # CPU temperature sensors(41h) 11 +49 C
177 # CPU temperature sensors(41h) 12 +47 C
178 # CPU temperature sensors(41h) 8 +50 C
179 # CPU temperature sensors(41h) 16 +51 C
180 # CPU temperature sensors(41h) 24 +50 C
181 # CPU temperature sensors(41h) 32 +43 C
182 # CPU temperature sensors(41h) 40 +43 C
183 # Baseboard temperature sensors(42h) 1 +35 C
184
185 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
186 ${ambient_temp_line}=
187 ... Get Lines Containing String ${temp_reading}
188 ... Inlet air temperature case-insensitive
189
190 ${ambient_temp_ipmi}= Fetch From Right ${ambient_temp_line} +
191 ${ambient_temp_ipmi}= Remove String ${ambient_temp_ipmi} ${SPACE}C
192
193 ${ambient_temp_rest}= Read Attribute
194 ... ${SENSORS_URI}temperature/ambient Value
195
196 # Example of ambient temperature via REST
197 # "CriticalAlarmHigh": 0,
198 # "CriticalAlarmLow": 0,
199 # "CriticalHigh": 35000,
200 # "CriticalLow": 0,
201 # "Scale": -3,
202 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
203 # "Value": 21775,
204 # "WarningAlarmHigh": 0,
205 # "WarningAlarmLow": 0,
206 # "WarningHigh": 25000,
207 # "WarningLow": 0
208
209 # Get temperature value based on scale i.e. Value * (10 power Scale Value)
210 # e.g. from above case 21775 * (10 power -3) = 21775/1000
211
212 ${ambient_temp_rest}= Evaluate ${ambient_temp_rest}/1000
213 ${ipmi_rest_temp_diff}=
214 ... Evaluate abs(${ambient_temp_rest} - ${ambient_temp_ipmi})
215
216 Should Be True ${ipmi_rest_temp_diff} <= ${allowed_temp_diff}
217 ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}.
218
219
Rahul Maheshwari43556632018-02-05 23:42:52 -0600220Verify Get DCMI Capabilities
221 [Documentation] Verify get DCMI capabilities command output.
222 [Tags] Verify_Get_DCMI_Capabilities
223
224 ${cmd_output}= Run IPMI Standard Command dcmi discover
225
226 @{supported_capabilities}= Create List
227 # Supported DCMI capabilities:
228 ... Mandatory platform capabilties
229 ... Optional platform capabilties
230 ... Power management available
231 ... Managebility access capabilties
232 ... In-band KCS channel available
233 # Mandatory platform attributes:
234 ... 200 SEL entries
235 ... SEL automatic rollover is enabled
236 # Optional Platform Attributes:
237 ... Slave address of device: 0h (8bits)(Satellite/External controller)
238 ... Channel number is 0h (Primary BMC)
239 ... Device revision is 0
240 # Manageability Access Attributes:
241 ... Primary LAN channel number: 1 is available
242 ... Secondary LAN channel is not available for OOB
243 ... No serial channel is available
244
245 :FOR ${capability} IN @{supported_capabilities}
246 \ Should Contain ${cmd_output} ${capability} ignore_case=True
247 ... msg=Supported DCMI capabilities not present.
248
249
Rahul Maheshwari615da152018-02-13 23:53:36 -0600250Test Power Reading Via IPMI With Host Booted
251 [Documentation] Test power reading via IPMI with host booted state and
252 ... verify using REST.
253 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted
254
255 REST Power On stack_mode=skip quiet=1
256
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600257 Verify Power Reading
Rahul Maheshwari615da152018-02-13 23:53:36 -0600258
Rahul Maheshwari615da152018-02-13 23:53:36 -0600259
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600260Test Power Reading Via IPMI With Host Off
261 [Documentation] Test power reading via IPMI with host off state and
262 ... verify using REST.
263 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Off
Rahul Maheshwari615da152018-02-13 23:53:36 -0600264
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600265 REST Power Off stack_mode=skip quiet=1
Rahul Maheshwari615da152018-02-13 23:53:36 -0600266
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600267 Verify Power Reading
Rahul Maheshwari615da152018-02-13 23:53:36 -0600268
269
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600270Test Power Reading Via IPMI Raw Command
271 [Documentation] Test power reading via IPMI raw command and verify
272 ... using REST.
273 [Tags] Test_Power_Reading_Via_IPMI_Raw_Command
274
275 # Response data structure of power reading command output via IPMI.
276 # 1 Completion Code. Refer to section 8, DCMI Completion Codes.
277 # 2 Group Extension Identification = DCh
278 # 3:4 Current Power in watts
279
280 ${ipmi_raw_output}= Run IPMI Standard Command
281 ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]}
282
283 @{raw_output_list}= Split String ${ipmi_raw_output} ${SPACE}
284
285 # On successful execution of raw IPMI power reading command, completion
286 # code does not come in output. So current power value will start from 2
287 # byte instead of 3.
288
289 ${power_reading_ipmi_raw_3_item}= Get From List ${raw_output_list} 2
290 ${power_reading_ipmi_raw_3_item}=
291 ... Convert To Integer 0x${power_reading_ipmi_raw_3_item}
292
293 ${power_reading_rest}= Read Attribute
294 ... ${SENSORS_URI}power/total_power Value
295
296 # Example of power reading via REST
297 # "CriticalAlarmHigh": 0,
298 # "CriticalAlarmLow": 0,
299 # "CriticalHigh": 3100000000,
300 # "CriticalLow": 0,
301 # "Scale": -6,
302 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
303 # "Value": 228000000,
304 # "WarningAlarmHigh": 0,
305 # "WarningAlarmLow": 0,
306 # "WarningHigh": 3050000000,
307 # "WarningLow": 0
308
309 # Get power value based on scale i.e. Value * (10 power Scale Value)
310 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
311
312 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
313 ${ipmi_rest_power_diff}=
314 ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi_raw_3_item})
315
316 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
317 ... msg=Power Reading above allowed threshold ${allowed_power_diff}.
318
319
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600320Test Baseboard Temperature Via IPMI
321 [Documentation] Test baseboard temperature via IPMI and verify using REST.
322 [Tags] Test_Baseboard_Temperature_Via_IPMI
323
324 # Example of IPMI dcmi get_temp_reading output:
325 # Entity ID Entity Instance Temp. Readings
326 # Inlet air temperature(40h) 1 +19 C
327 # CPU temperature sensors(41h) 5 +51 C
328 # CPU temperature sensors(41h) 6 +50 C
329 # CPU temperature sensors(41h) 7 +50 C
330 # CPU temperature sensors(41h) 8 +50 C
331 # CPU temperature sensors(41h) 9 +50 C
332 # CPU temperature sensors(41h) 10 +48 C
333 # CPU temperature sensors(41h) 11 +49 C
334 # CPU temperature sensors(41h) 12 +47 C
335 # CPU temperature sensors(41h) 8 +50 C
336 # CPU temperature sensors(41h) 16 +51 C
337 # CPU temperature sensors(41h) 24 +50 C
338 # CPU temperature sensors(41h) 32 +43 C
339 # CPU temperature sensors(41h) 40 +43 C
340 # Baseboard temperature sensors(42h) 1 +35 C
341
342 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
343 ${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.
367 Read Attribute ${NETWORK_MANAGER}/config DefaultGateway
368 ... 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
393 ... ${NETWORK_MANAGER}/eth0 DHCPEnabled
394 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 :
435 # 0x00
436 # 0x00
437 # 0x00
438 # 0x00
439
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
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500451 # Get BMC version from BMC CLI i.e. 2.1 from "ibm-v2.1-338-r1-0-gbcd7765"
452 ${bmc_version}= Get BMC Version
453 ${bmc_version}=
454 ... Remove String Using Regexp ${bmc_version} ^[^0-9]+ [^0-9\.].*
455
456 # Get major and minor version from BMC version i.e. 2 and 1 from 2.1
457 ${bmc_major_version} ${bmc_minor_version}=
458 ... Split String ${bmc_version} .
459
460 Should Be Equal As Strings ${ipmi_fw_major_version} ${bmc_major_version}
461 ... msg=Major version mis-match.
462 Should Be Equal As Strings ${ipmi_fw_minor_version} ${bmc_minor_version}
463 ... msg=Minor version mis-match.
464
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600465 Should Be Equal ${mc_info['ipmi_version']} 2.0
466
Gunnar Mills917ba1a2018-04-08 16:42:12 -0500467 # TODO: Verify Manufacturer and Product IDs directly from json file.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600468 # Reference : openbmc/openbmc-test-automation#1244
469 Should Be Equal ${mc_info['manufacturer_id']} 42817
470 Should Be Equal ${mc_info['product_id']} 16975 (0x424f)
471
472 Should Be Equal ${mc_info['device_available']} yes
473 Should Be Equal ${mc_info['provides_device_sdrs']} yes
474 Should Contain ${mc_info['additional_device_support']} Sensor Device
475 Should Contain ${mc_info['additional_device_support']} SEL Device
476 Should Contain
477 ... ${mc_info['additional_device_support']} FRU Inventory Device
478 Should Contain ${mc_info['additional_device_support']} Chassis Device
George Keishingb746d3f2018-04-19 10:53:10 -0500479
480 # TODO: openbmc/openbmc-test-automation#1297
481 # Aux firmware revision verification.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600482
483
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500484Verify SDR Info
485 [Documentation] Verify sdr info command output.
486 [Tags] Verify_SDR_Info
487
488 # Example of SDR info command output:
489 # SDR Version : 0x51
490 # Record Count : 216
491 # Free Space : unspecified
492 # Most recent Addition :
493 # Most recent Erase :
494 # SDR overflow : no
495 # SDR Repository Update Support : unspecified
496 # Delete SDR supported : no
497 # Partial Add SDR supported : no
498 # Reserve SDR repository supported : no
499 # SDR Repository Alloc info supported : no
500
501 ${sdr_info}= Get SDR Info
502 Should Be Equal ${sdr_info['sdr_version']} 0x51
503
504 # Get sensor count from "sdr elist all" command output.
505 ${sensor_count}= Get Sensor Count
506 Should Be Equal As Strings
507 ... ${sdr_info['record_count']} ${sensor_count}
508
509 Should Be Equal ${sdr_info['free_space']} unspecified
510 Should Be Equal ${sdr_info['most_recent_addition']} ${EMPTY}
511 Should Be Equal ${sdr_info['most_recent_erase']} ${EMPTY}
512 Should Be Equal ${sdr_info['sdr_overflow']} no
513 Should Be Equal ${sdr_info['sdr_repository_update_support']} unspecified
514 Should Be Equal ${sdr_info['delete_sdr_supported']} no
515 Should Be Equal ${sdr_info['partial_add_sdr_supported']} no
516 Should Be Equal ${sdr_info['reserve_sdr_repository_supported']} no
517 Should Be Equal ${sdr_info['sdr_repository_alloc_info_supported']} no
518
519
George Keishing02651f02018-04-11 02:07:16 -0500520Test Valid IPMI Channels Supported
521 [Documentation] Verify IPMI channels supported on a given system.
522 [Tags] Test_Valid_IPMI_Channels_Supported
523
524 ${channel_count}= Get Physical Network Interface Count
525
526 # Note: IPMI network channel logically starts from 1.
527 :FOR ${channel_number} IN RANGE 1 ${channel_count}
528 \ Run External IPMI Standard Command lan print ${channel_number}
529
530
531Test Invalid IPMI Channel Response
532 [Documentation] Verify invalid IPMI channels supported response.
533 [Tags] Test_Invalid_IPMI_Channel_Response
534
535 ${channel_count}= Get Physical Network Interface Count
536
537 # To target invalid channel, increment count.
538 ${channel_number}= Evaluate ${channel_count} + 1
539
540 # Example of invalid channel:
541 # $ ipmitool -I lanplus -H xx.xx.xx.xx -P 0penBmc lan print 3
542 # Get Channel Info command failed: Parameter out of range
543 # Invalid channel: 3
544
545 ${stdout}= Run External IPMI Standard Command
546 ... lan print ${channel_number} fail_on_err=${0}
547 Should Contain ${stdout} Invalid channel
548 ... msg=IPMI channel ${channel_number} is invalid but seen working.
549
550
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500551*** Keywords ***
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600552
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500553Get Sensor Count
554 [Documentation] Get sensors count using "sdr elist all" command.
555
556 # Example of "sdr elist all" command output:
557 # BootProgress | 03h | ok | 34.2 |
558 # OperatingSystemS | 05h | ok | 35.1 |
559 # AttemptsLeft | 07h | ok | 34.1 |
560 # occ0 | 08h | ok | 210.1 | Device Disabled
561 # occ1 | 09h | ok | 210.2 | Device Disabled
562 # p0_core0_temp | 11h | ns | 3.1 | Disabled
563 # cpu0_core0 | 12h | ok | 208.1 | Presence detected
564 # p0_core1_temp | 14h | ns | 3.2 | Disabled
565 # cpu0_core1 | 15h | ok | 208.2 | Presence detected
566 # p0_core2_temp | 17h | ns | 3.3 | Disabled
567 # ..
568 # ..
569 # ..
570 # ..
571 # ..
572 # ..
573 # fan3 | 00h | ns | 29.4 | Logical FRU @35h
574 # bmc | 00h | ns | 6.1 | Logical FRU @3Ch
575 # ethernet | 00h | ns | 1.1 | Logical FRU @46h
576
577 ${output}= Run IPMI Standard Command sdr elist all
578 ${sensor_list}= Split String ${output} \n
579 ${sensor_count}= Get Length ${sensor_list}
580 [Return] ${sensor_count}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600581
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600582Set Management Controller ID String
583 [Documentation] Set the management controller ID string.
584 [Arguments] ${string}
585
586 # Description of argument(s):
587 # string Management Controller ID String to be set
588
589 ${set_mc_id_string}= Run IPMI Standard Command
590 ... dcmi set_mc_id_string ${string}
591
Sweta Potthurif39022d2018-02-06 03:40:07 -0600592
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600593Get Management Controller ID String And Verify
594 [Documentation] Get the management controller ID sting.
595 [Arguments] ${string}
596
597 # Description of argument(s):
598 # string Management Controller ID string
599
600 ${get_mc_id}= Run IPMI Standard Command dcmi get_mc_id_string
601 Should Contain ${get_mc_id} ${string}
602 ... msg=Command failed: get_mc_id.
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600603
Sweta Potthurif39022d2018-02-06 03:40:07 -0600604
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600605Set Watchdog Enabled Using REST
606 [Documentation] Set watchdog Enabled field using REST.
607 [Arguments] ${value}
608
609 # Description of argument(s):
610 # value Integer value (eg. "0-Disabled", "1-Enabled").
611
612 ${value_dict}= Create Dictionary data=${value}
613 ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}/attr/Enabled
614 ... data=${value_dict}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600615
616
Sweta Potthurif39022d2018-02-06 03:40:07 -0600617Fetch Details From LAN Print
618 [Documentation] Fetch details from LAN print.
619 [Arguments] ${field_name}
620
621 # Description of argument(s):
622 # ${field_name} Field name to be fetched from LAN print
623 # (e.g. "MAC Address", "Source").
624
Sweta Potthuric64322a2018-02-22 05:30:30 -0600625 ${stdout}= Run External IPMI Standard Command lan print
Sweta Potthurif39022d2018-02-06 03:40:07 -0600626 ${fetch_value}= Get Lines Containing String ${stdout} ${field_name}
627 ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE}
628 [Return] ${value_fetch}
629
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600630
631Verify Power Reading
632 [Documentation] Get dcmi power reading via IPMI.
633
634 # Example of power reading command output via IPMI.
635 # Instantaneous power reading: 235 Watts
636 # Minimum during sampling period: 235 Watts
637 # Maximum during sampling period: 235 Watts
638 # Average power reading over sample period: 235 Watts
639 # IPMI timestamp: Thu Jan 1 00:00:00 1970
640 # Sampling period: 00000000 Seconds.
641 # Power reading state is: deactivated
642
643 ${power_reading}= Get IPMI Power Reading
644
645 ${host_state}= Get Host State
646 Run Keyword If '${host_state}' == 'Off'
George Keishing51314872018-03-31 13:24:35 -0500647 ... Should Be Equal ${power_reading['instantaneous_power_reading']} 0
648 ... msg=Power reading not zero when power is off.
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600649
George Keishing51314872018-03-31 13:24:35 -0500650 Run Keyword If '${power_reading['instantaneous_power_reading']}' != '0'
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600651 ... Verify Power Reading Using REST ${power_reading['instantaneous_power_reading']}
652
653
654Verify Power Reading Using REST
655 [Documentation] Verify power reading using REST.
656 [Arguments] ${power_reading}
657
Gunnar Mills948e2e22018-03-23 12:54:27 -0500658 # Description of argument(s):
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600659 # power_reading IPMI Power reading
660
661 ${power_reading_rest}= Read Attribute
662 ... ${SENSORS_URI}power/total_power Value
663
664 # Example of power reading via REST
665 # "CriticalAlarmHigh": 0,
666 # "CriticalAlarmLow": 0,
667 # "CriticalHigh": 3100000000,
668 # "CriticalLow": 0,
669 # "Scale": -6,
670 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
671 # "Value": 228000000,
672 # "WarningAlarmHigh": 0,
673 # "WarningAlarmLow": 0,
674 # "WarningHigh": 3050000000,
675 # "WarningLow": 0
676
677 # Get power value based on scale i.e. Value * (10 power Scale Value)
678 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
679 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
680 ${ipmi_rest_power_diff}=
681 ... Evaluate abs(${power_reading_rest} - ${power_reading})
682
683 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
684 ... msg=Power reading above allowed threshold ${allowed_power_diff}.
George Keishing02651f02018-04-11 02:07:16 -0500685
686
687Get Physical Network Interface Count
688 [Documentation] Return valid physical network interfaces count.
689
690 # Example:
691 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
692 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
693
694 ${mac_entry_list}= Get BMC MAC Address List
695 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
696 ${physical_interface_count}= Get Length ${mac_unique_list}
697
698 [Return] ${physical_interface_count}