blob: d16a01824be8a5d187339de47fd34d6fd1cd5907 [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
467 # TODO: Verify Manufacturer and Product IDs directy from json file.
468 # 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
479 Should Contain X Times ${mc_info['aux_firmware_rev_info']} 0x00 4
480
481
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500482Verify SDR Info
483 [Documentation] Verify sdr info command output.
484 [Tags] Verify_SDR_Info
485
486 # Example of SDR info command output:
487 # SDR Version : 0x51
488 # Record Count : 216
489 # Free Space : unspecified
490 # Most recent Addition :
491 # Most recent Erase :
492 # SDR overflow : no
493 # SDR Repository Update Support : unspecified
494 # Delete SDR supported : no
495 # Partial Add SDR supported : no
496 # Reserve SDR repository supported : no
497 # SDR Repository Alloc info supported : no
498
499 ${sdr_info}= Get SDR Info
500 Should Be Equal ${sdr_info['sdr_version']} 0x51
501
502 # Get sensor count from "sdr elist all" command output.
503 ${sensor_count}= Get Sensor Count
504 Should Be Equal As Strings
505 ... ${sdr_info['record_count']} ${sensor_count}
506
507 Should Be Equal ${sdr_info['free_space']} unspecified
508 Should Be Equal ${sdr_info['most_recent_addition']} ${EMPTY}
509 Should Be Equal ${sdr_info['most_recent_erase']} ${EMPTY}
510 Should Be Equal ${sdr_info['sdr_overflow']} no
511 Should Be Equal ${sdr_info['sdr_repository_update_support']} unspecified
512 Should Be Equal ${sdr_info['delete_sdr_supported']} no
513 Should Be Equal ${sdr_info['partial_add_sdr_supported']} no
514 Should Be Equal ${sdr_info['reserve_sdr_repository_supported']} no
515 Should Be Equal ${sdr_info['sdr_repository_alloc_info_supported']} no
516
517
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500518*** Keywords ***
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600519
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500520Get Sensor Count
521 [Documentation] Get sensors count using "sdr elist all" command.
522
523 # Example of "sdr elist all" command output:
524 # BootProgress | 03h | ok | 34.2 |
525 # OperatingSystemS | 05h | ok | 35.1 |
526 # AttemptsLeft | 07h | ok | 34.1 |
527 # occ0 | 08h | ok | 210.1 | Device Disabled
528 # occ1 | 09h | ok | 210.2 | Device Disabled
529 # p0_core0_temp | 11h | ns | 3.1 | Disabled
530 # cpu0_core0 | 12h | ok | 208.1 | Presence detected
531 # p0_core1_temp | 14h | ns | 3.2 | Disabled
532 # cpu0_core1 | 15h | ok | 208.2 | Presence detected
533 # p0_core2_temp | 17h | ns | 3.3 | Disabled
534 # ..
535 # ..
536 # ..
537 # ..
538 # ..
539 # ..
540 # fan3 | 00h | ns | 29.4 | Logical FRU @35h
541 # bmc | 00h | ns | 6.1 | Logical FRU @3Ch
542 # ethernet | 00h | ns | 1.1 | Logical FRU @46h
543
544 ${output}= Run IPMI Standard Command sdr elist all
545 ${sensor_list}= Split String ${output} \n
546 ${sensor_count}= Get Length ${sensor_list}
547 [Return] ${sensor_count}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600548
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600549Set Management Controller ID String
550 [Documentation] Set the management controller ID string.
551 [Arguments] ${string}
552
553 # Description of argument(s):
554 # string Management Controller ID String to be set
555
556 ${set_mc_id_string}= Run IPMI Standard Command
557 ... dcmi set_mc_id_string ${string}
558
Sweta Potthurif39022d2018-02-06 03:40:07 -0600559
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600560Get Management Controller ID String And Verify
561 [Documentation] Get the management controller ID sting.
562 [Arguments] ${string}
563
564 # Description of argument(s):
565 # string Management Controller ID string
566
567 ${get_mc_id}= Run IPMI Standard Command dcmi get_mc_id_string
568 Should Contain ${get_mc_id} ${string}
569 ... msg=Command failed: get_mc_id.
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600570
Sweta Potthurif39022d2018-02-06 03:40:07 -0600571
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600572Set Watchdog Enabled Using REST
573 [Documentation] Set watchdog Enabled field using REST.
574 [Arguments] ${value}
575
576 # Description of argument(s):
577 # value Integer value (eg. "0-Disabled", "1-Enabled").
578
579 ${value_dict}= Create Dictionary data=${value}
580 ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}/attr/Enabled
581 ... data=${value_dict}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600582
583
Sweta Potthurif39022d2018-02-06 03:40:07 -0600584Fetch Details From LAN Print
585 [Documentation] Fetch details from LAN print.
586 [Arguments] ${field_name}
587
588 # Description of argument(s):
589 # ${field_name} Field name to be fetched from LAN print
590 # (e.g. "MAC Address", "Source").
591
Sweta Potthuric64322a2018-02-22 05:30:30 -0600592 ${stdout}= Run External IPMI Standard Command lan print
Sweta Potthurif39022d2018-02-06 03:40:07 -0600593 ${fetch_value}= Get Lines Containing String ${stdout} ${field_name}
594 ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE}
595 [Return] ${value_fetch}
596
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600597
598Verify Power Reading
599 [Documentation] Get dcmi power reading via IPMI.
600
601 # Example of power reading command output via IPMI.
602 # Instantaneous power reading: 235 Watts
603 # Minimum during sampling period: 235 Watts
604 # Maximum during sampling period: 235 Watts
605 # Average power reading over sample period: 235 Watts
606 # IPMI timestamp: Thu Jan 1 00:00:00 1970
607 # Sampling period: 00000000 Seconds.
608 # Power reading state is: deactivated
609
610 ${power_reading}= Get IPMI Power Reading
611
612 ${host_state}= Get Host State
613 Run Keyword If '${host_state}' == 'Off'
George Keishing51314872018-03-31 13:24:35 -0500614 ... Should Be Equal ${power_reading['instantaneous_power_reading']} 0
615 ... msg=Power reading not zero when power is off.
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600616
George Keishing51314872018-03-31 13:24:35 -0500617 Run Keyword If '${power_reading['instantaneous_power_reading']}' != '0'
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600618 ... Verify Power Reading Using REST ${power_reading['instantaneous_power_reading']}
619
620
621Verify Power Reading Using REST
622 [Documentation] Verify power reading using REST.
623 [Arguments] ${power_reading}
624
Gunnar Mills948e2e22018-03-23 12:54:27 -0500625 # Description of argument(s):
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600626 # power_reading IPMI Power reading
627
628 ${power_reading_rest}= Read Attribute
629 ... ${SENSORS_URI}power/total_power Value
630
631 # Example of power reading via REST
632 # "CriticalAlarmHigh": 0,
633 # "CriticalAlarmLow": 0,
634 # "CriticalHigh": 3100000000,
635 # "CriticalLow": 0,
636 # "Scale": -6,
637 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
638 # "Value": 228000000,
639 # "WarningAlarmHigh": 0,
640 # "WarningAlarmLow": 0,
641 # "WarningHigh": 3050000000,
642 # "WarningLow": 0
643
644 # Get power value based on scale i.e. Value * (10 power Scale Value)
645 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
646 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
647 ${ipmi_rest_power_diff}=
648 ... Evaluate abs(${power_reading_rest} - ${power_reading})
649
650 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
651 ... msg=Power reading above allowed threshold ${allowed_power_diff}.