blob: e76ca0167a2f08e13431e170550a5286698bc90a [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 Wait Until Keyword Succeeds 6 min 10 sec Is Host Off
Rahul Maheshwari615da152018-02-13 23:53:36 -0600268
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600269 Verify Power Reading
Rahul Maheshwari615da152018-02-13 23:53:36 -0600270
271
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600272Test Power Reading Via IPMI Raw Command
273 [Documentation] Test power reading via IPMI raw command and verify
274 ... using REST.
275 [Tags] Test_Power_Reading_Via_IPMI_Raw_Command
276
277 # Response data structure of power reading command output via IPMI.
278 # 1 Completion Code. Refer to section 8, DCMI Completion Codes.
279 # 2 Group Extension Identification = DCh
280 # 3:4 Current Power in watts
281
282 ${ipmi_raw_output}= Run IPMI Standard Command
283 ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]}
284
285 @{raw_output_list}= Split String ${ipmi_raw_output} ${SPACE}
286
287 # On successful execution of raw IPMI power reading command, completion
288 # code does not come in output. So current power value will start from 2
289 # byte instead of 3.
290
291 ${power_reading_ipmi_raw_3_item}= Get From List ${raw_output_list} 2
292 ${power_reading_ipmi_raw_3_item}=
293 ... Convert To Integer 0x${power_reading_ipmi_raw_3_item}
294
295 ${power_reading_rest}= Read Attribute
296 ... ${SENSORS_URI}power/total_power Value
297
298 # Example of power reading via REST
299 # "CriticalAlarmHigh": 0,
300 # "CriticalAlarmLow": 0,
301 # "CriticalHigh": 3100000000,
302 # "CriticalLow": 0,
303 # "Scale": -6,
304 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
305 # "Value": 228000000,
306 # "WarningAlarmHigh": 0,
307 # "WarningAlarmLow": 0,
308 # "WarningHigh": 3050000000,
309 # "WarningLow": 0
310
311 # Get power value based on scale i.e. Value * (10 power Scale Value)
312 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
313
314 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
315 ${ipmi_rest_power_diff}=
316 ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi_raw_3_item})
317
318 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
319 ... msg=Power Reading above allowed threshold ${allowed_power_diff}.
320
321
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600322Test Baseboard Temperature Via IPMI
323 [Documentation] Test baseboard temperature via IPMI and verify using REST.
324 [Tags] Test_Baseboard_Temperature_Via_IPMI
325
326 # Example of IPMI dcmi get_temp_reading output:
327 # Entity ID Entity Instance Temp. Readings
328 # Inlet air temperature(40h) 1 +19 C
329 # CPU temperature sensors(41h) 5 +51 C
330 # CPU temperature sensors(41h) 6 +50 C
331 # CPU temperature sensors(41h) 7 +50 C
332 # CPU temperature sensors(41h) 8 +50 C
333 # CPU temperature sensors(41h) 9 +50 C
334 # CPU temperature sensors(41h) 10 +48 C
335 # CPU temperature sensors(41h) 11 +49 C
336 # CPU temperature sensors(41h) 12 +47 C
337 # CPU temperature sensors(41h) 8 +50 C
338 # CPU temperature sensors(41h) 16 +51 C
339 # CPU temperature sensors(41h) 24 +50 C
340 # CPU temperature sensors(41h) 32 +43 C
341 # CPU temperature sensors(41h) 40 +43 C
342 # Baseboard temperature sensors(42h) 1 +35 C
343
344 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
345 ${baseboard_temp_line}=
346 ... Get Lines Containing String ${temp_reading}
347 ... Baseboard temperature case-insensitive=True
348
349 ${baseboard_temp_ipmi}= Fetch From Right ${baseboard_temp_line} +
350 ${baseboard_temp_ipmi}= Remove String ${baseboard_temp_ipmi} ${SPACE}C
351
352 ${baseboard_temp_rest}= Read Attribute
353 ... /xyz/openbmc_project/sensors/temperature/pcie Value
354 ${baseboard_temp_rest}= Evaluate ${baseboard_temp_rest}/1000
355
356 Should Be True
357 ... ${baseboard_temp_rest} - ${baseboard_temp_ipmi} <= ${allowed_temp_diff}
358 ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}.
359
360
Sweta Potthurif39022d2018-02-06 03:40:07 -0600361Retrieve Default Gateway Via IPMI And Verify Using REST
362 [Documentation] Retrieve default gateway from LAN print using IPMI.
363 [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify_Using_REST
364
365 # Fetch "Default Gateway" from IPMI LAN print.
366 ${default_gateway_ipmi}= Fetch Details From LAN Print Default Gateway IP
367
368 # Verify "Default Gateway" using REST.
369 Read Attribute ${NETWORK_MANAGER}/config DefaultGateway
370 ... expected_value=${default_gateway_ipmi}
371
372
373Retrieve MAC Address Via IPMI And Verify Using REST
374 [Documentation] Retrieve MAC Address from LAN print using IPMI.
375 [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_REST
376
377 # Fetch "MAC Address" from IPMI LAN print.
378 ${mac_address_ipmi}= Fetch Details From LAN Print MAC Address
379
380 # Verify "MAC Address" using REST.
381 ${mac_address_rest}= Get BMC MAC Address
382 Should Be Equal ${mac_address_ipmi} ${mac_address_rest}
383 ... msg=Verification of MAC address from lan print using IPMI failed.
384
385
386Retrieve Network Mode Via IPMI And Verify Using REST
387 [Documentation] Retrieve network mode from LAN print using IPMI.
388 [Tags] Retrieve_Network_Mode_Via_IPMI_And_Verify_Using_REST
389
390 # Fetch "Mode" from IPMI LAN print.
391 ${network_mode_ipmi}= Fetch Details From LAN Print Source
392
393 # Verify "Mode" using REST.
394 ${network_mode_rest}= Read Attribute
395 ... ${NETWORK_MANAGER}/eth0 DHCPEnabled
396 Run Keyword If '${network_mode_ipmi}' == 'Static Address'
397 ... Should Be Equal ${network_mode_rest} ${0}
398 ... msg=Verification of network setting failed.
399 ... ELSE IF '${network_mode_ipmi}' == 'DHCP'
400 ... Should Be Equal ${network_mode_rest} ${1}
401 ... msg=Verification of network setting failed.
402
403
404Retrieve IP Address Via IPMI And Verify With BMC Details
405 [Documentation] Retrieve IP address from LAN print using IPMI.
406 [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_With_BMC_Details
407
408 # Fetch "IP Address" from IPMI LAN print.
409 ${ip_addr_ipmi}= Fetch Details From LAN Print IP Address
410
411 # Verify the IP address retrieved via IPMI with BMC IPs.
412 ${ip_address_rest}= Get BMC IP Info
413 Validate IP On BMC ${ip_addr_ipmi} ${ip_address_rest}
414
415
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600416Verify Get Device ID
417 [Documentation] Verify get device ID command output.
418 [Tags] Verify_Get_Device_ID
419
420 # Example of get device ID command output:
421 # Device ID : 0
422 # Device Revision : 0
423 # Firmware Revision : 2.01
424 # IPMI Version : 2.0
425 # Manufacturer ID : 42817
426 # Manufacturer Name : Unknown (0xA741)
427 # Product ID : 16975 (0x424f)
428 # Product Name : Unknown (0x424F)
429 # Device Available : yes
430 # Provides Device SDRs : yes
431 # Additional Device Support :
432 # Sensor Device
433 # SEL Device
434 # FRU Inventory Device
435 # Chassis Device
436 # Aux Firmware Rev Info :
437 # 0x00
438 # 0x00
439 # 0x00
440 # 0x00
441
442 ${mc_info}= Get MC Info
443
444 Should Be Equal ${mc_info['device_id']} 0
445 Should Be Equal ${mc_info['device_revision']} 0
446
447 # Get major BMC version from BMC cli i.e. 2.1 from "v2.1-51-g04ff12c"
448 ${bmc_version}= Get BMC Version
449 ${bmc_version}= Fetch From Left ${bmc_version} -
450 ${bmc_version}= Remove String ${bmc_version} "v
451
452 Should Be Equal ${mc_info['firmware_revision']} ${bmc_version}
453 Should Be Equal ${mc_info['ipmi_version']} 2.0
454
455 # TODO: Verify Manufacturer and Product IDs directy from json file.
456 # Reference : openbmc/openbmc-test-automation#1244
457 Should Be Equal ${mc_info['manufacturer_id']} 42817
458 Should Be Equal ${mc_info['product_id']} 16975 (0x424f)
459
460 Should Be Equal ${mc_info['device_available']} yes
461 Should Be Equal ${mc_info['provides_device_sdrs']} yes
462 Should Contain ${mc_info['additional_device_support']} Sensor Device
463 Should Contain ${mc_info['additional_device_support']} SEL Device
464 Should Contain
465 ... ${mc_info['additional_device_support']} FRU Inventory Device
466 Should Contain ${mc_info['additional_device_support']} Chassis Device
467 Should Contain X Times ${mc_info['aux_firmware_rev_info']} 0x00 4
468
469
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500470Verify SDR Info
471 [Documentation] Verify sdr info command output.
472 [Tags] Verify_SDR_Info
473
474 # Example of SDR info command output:
475 # SDR Version : 0x51
476 # Record Count : 216
477 # Free Space : unspecified
478 # Most recent Addition :
479 # Most recent Erase :
480 # SDR overflow : no
481 # SDR Repository Update Support : unspecified
482 # Delete SDR supported : no
483 # Partial Add SDR supported : no
484 # Reserve SDR repository supported : no
485 # SDR Repository Alloc info supported : no
486
487 ${sdr_info}= Get SDR Info
488 Should Be Equal ${sdr_info['sdr_version']} 0x51
489
490 # Get sensor count from "sdr elist all" command output.
491 ${sensor_count}= Get Sensor Count
492 Should Be Equal As Strings
493 ... ${sdr_info['record_count']} ${sensor_count}
494
495 Should Be Equal ${sdr_info['free_space']} unspecified
496 Should Be Equal ${sdr_info['most_recent_addition']} ${EMPTY}
497 Should Be Equal ${sdr_info['most_recent_erase']} ${EMPTY}
498 Should Be Equal ${sdr_info['sdr_overflow']} no
499 Should Be Equal ${sdr_info['sdr_repository_update_support']} unspecified
500 Should Be Equal ${sdr_info['delete_sdr_supported']} no
501 Should Be Equal ${sdr_info['partial_add_sdr_supported']} no
502 Should Be Equal ${sdr_info['reserve_sdr_repository_supported']} no
503 Should Be Equal ${sdr_info['sdr_repository_alloc_info_supported']} no
504
505
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500506*** Keywords ***
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600507
Rahul Maheshwaridc6a32c2018-03-15 05:21:55 -0500508Get Sensor Count
509 [Documentation] Get sensors count using "sdr elist all" command.
510
511 # Example of "sdr elist all" command output:
512 # BootProgress | 03h | ok | 34.2 |
513 # OperatingSystemS | 05h | ok | 35.1 |
514 # AttemptsLeft | 07h | ok | 34.1 |
515 # occ0 | 08h | ok | 210.1 | Device Disabled
516 # occ1 | 09h | ok | 210.2 | Device Disabled
517 # p0_core0_temp | 11h | ns | 3.1 | Disabled
518 # cpu0_core0 | 12h | ok | 208.1 | Presence detected
519 # p0_core1_temp | 14h | ns | 3.2 | Disabled
520 # cpu0_core1 | 15h | ok | 208.2 | Presence detected
521 # p0_core2_temp | 17h | ns | 3.3 | Disabled
522 # ..
523 # ..
524 # ..
525 # ..
526 # ..
527 # ..
528 # fan3 | 00h | ns | 29.4 | Logical FRU @35h
529 # bmc | 00h | ns | 6.1 | Logical FRU @3Ch
530 # ethernet | 00h | ns | 1.1 | Logical FRU @46h
531
532 ${output}= Run IPMI Standard Command sdr elist all
533 ${sensor_list}= Split String ${output} \n
534 ${sensor_count}= Get Length ${sensor_list}
535 [Return] ${sensor_count}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600536
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600537Set Management Controller ID String
538 [Documentation] Set the management controller ID string.
539 [Arguments] ${string}
540
541 # Description of argument(s):
542 # string Management Controller ID String to be set
543
544 ${set_mc_id_string}= Run IPMI Standard Command
545 ... dcmi set_mc_id_string ${string}
546
Sweta Potthurif39022d2018-02-06 03:40:07 -0600547
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600548Get Management Controller ID String And Verify
549 [Documentation] Get the management controller ID sting.
550 [Arguments] ${string}
551
552 # Description of argument(s):
553 # string Management Controller ID string
554
555 ${get_mc_id}= Run IPMI Standard Command dcmi get_mc_id_string
556 Should Contain ${get_mc_id} ${string}
557 ... msg=Command failed: get_mc_id.
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600558
Sweta Potthurif39022d2018-02-06 03:40:07 -0600559
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600560Set Watchdog Enabled Using REST
561 [Documentation] Set watchdog Enabled field using REST.
562 [Arguments] ${value}
563
564 # Description of argument(s):
565 # value Integer value (eg. "0-Disabled", "1-Enabled").
566
567 ${value_dict}= Create Dictionary data=${value}
568 ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}/attr/Enabled
569 ... data=${value_dict}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600570
571
Sweta Potthurif39022d2018-02-06 03:40:07 -0600572Fetch Details From LAN Print
573 [Documentation] Fetch details from LAN print.
574 [Arguments] ${field_name}
575
576 # Description of argument(s):
577 # ${field_name} Field name to be fetched from LAN print
578 # (e.g. "MAC Address", "Source").
579
Sweta Potthuric64322a2018-02-22 05:30:30 -0600580 ${stdout}= Run External IPMI Standard Command lan print
Sweta Potthurif39022d2018-02-06 03:40:07 -0600581 ${fetch_value}= Get Lines Containing String ${stdout} ${field_name}
582 ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE}
583 [Return] ${value_fetch}
584
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600585
586Verify Power Reading
587 [Documentation] Get dcmi power reading via IPMI.
588
589 # Example of power reading command output via IPMI.
590 # Instantaneous power reading: 235 Watts
591 # Minimum during sampling period: 235 Watts
592 # Maximum during sampling period: 235 Watts
593 # Average power reading over sample period: 235 Watts
594 # IPMI timestamp: Thu Jan 1 00:00:00 1970
595 # Sampling period: 00000000 Seconds.
596 # Power reading state is: deactivated
597
598 ${power_reading}= Get IPMI Power Reading
599
600 ${host_state}= Get Host State
601 Run Keyword If '${host_state}' == 'Off'
602 ... Should Be Equal ${power_reading['instantaneous_power_reading']} 0 Watts
603
604 Run Keyword If '${power_reading['instantaneous_power_reading']}' != '0 Watts'
605 ... Verify Power Reading Using REST ${power_reading['instantaneous_power_reading']}
606
607
608Verify Power Reading Using REST
609 [Documentation] Verify power reading using REST.
610 [Arguments] ${power_reading}
611
Gunnar Mills948e2e22018-03-23 12:54:27 -0500612 # Description of argument(s):
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600613 # power_reading IPMI Power reading
614
615 ${power_reading_rest}= Read Attribute
616 ... ${SENSORS_URI}power/total_power Value
617
618 # Example of power reading via REST
619 # "CriticalAlarmHigh": 0,
620 # "CriticalAlarmLow": 0,
621 # "CriticalHigh": 3100000000,
622 # "CriticalLow": 0,
623 # "Scale": -6,
624 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
625 # "Value": 228000000,
626 # "WarningAlarmHigh": 0,
627 # "WarningAlarmLow": 0,
628 # "WarningHigh": 3050000000,
629 # "WarningLow": 0
630
631 # Get power value based on scale i.e. Value * (10 power Scale Value)
632 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
633 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
634 ${ipmi_rest_power_diff}=
635 ... Evaluate abs(${power_reading_rest} - ${power_reading})
636
637 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
638 ... msg=Power reading above allowed threshold ${allowed_power_diff}.