blob: 9a0594df2ad84bbe37cc639593e792ff3330a38b [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 Maheshwariabe13af2018-02-15 22:42:08 -06009Variables ../data/ipmi_raw_cmd_table.py
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050010
11Test Teardown FFDC On Test Case Fail
12
Rahul Maheshwariabe13af2018-02-15 22:42:08 -060013
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050014*** Variables ***
15
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060016${new_mc_id}= HOST
Rahul Maheshwari901dcde2018-02-06 03:14:31 -060017${allowed_temp_diff}= ${1}
Rahul Maheshwari615da152018-02-13 23:53:36 -060018${allowed_power_diff}= ${10}
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060019
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050020*** Test Cases ***
21
22Set Asset Tag With Valid String Length
23 [Documentation] Set asset tag with valid string length and verify.
24 [Tags] Set_Asset_Tag_With_Valid_String_Length
25
26 # Allowed MAX characters length for asset tag name is 63.
27 ${random_string}= Generate Random String 63
28 Run Keyword Run IPMI Standard Command dcmi set_asset_tag ${random_string}
29
30 ${asset_tag}= Run Keyword Run IPMI Standard Command dcmi asset_tag
31 Should Contain ${asset_tag} ${random_string}
32
33
34Set Asset Tag With Invalid String Length
35 [Documentation] Verify error while setting invalid asset tag via IPMI.
36 [Tags] Set_Asset_Tag_With_Invalid_String_Length
37
38 # Any string more than 63 character is invalid for asset tag.
39 ${random_string}= Generate Random String 64
40
41 ${resp}= Run Keyword And Expect Error * Run IPMI Standard Command
42 ... dcmi set_asset_tag ${random_string}
43 Should Contain ${resp} Parameter out of range ignore_case=True
44
45
46Set Asset Tag With Valid String Length Via REST
47 [Documentation] Set valid asset tag via REST and verify.
48 [Tags] Set_Asset_Tag_With_Valid_String_Length_Via_REST
49
50 ${random_string}= Generate Random String 63
51 ${args}= Create Dictionary data=${random_string}
52 Write Attribute /xyz/openbmc_project/inventory/system AssetTag
53 ... data=${args}
54
55 ${asset_tag}= Read Attribute /xyz/openbmc_project/inventory/system
56 ... AssetTag
57 Should Be Equal As Strings ${asset_tag} ${random_string}
58
Sweta Potthurif39022d2018-02-06 03:40:07 -060059
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060060Verify Get And Set Management Controller ID String
61 [Documentation] Verify get and set management controller ID string.
62 [Tags] Verify_Get_And_Set_Management_Controller_ID_String
63
64 # Get the value of the managemment controller ID string.
65 # Example:
66 # Get Management Controller Identifier String: witherspoon
67
68 ${cmd_output}= Run IPMI Standard Command dcmi get_mc_id_string
69
70 # Extract management controller ID from cmd_output.
71 ${initial_mc_id}= Fetch From Right ${cmd_output} :${SPACE}
72
73 # Set the management controller ID string to other value.
74 # Example:
75 # Set Management Controller Identifier String Command: HOST
76
77 Set Management Controller ID String ${new_mc_id}
78
79 # Get the management controller ID and verify.
80 Get Management Controller ID String And Verify ${new_mc_id}
81
82 # Set the value back to the initial value and verify.
83 Set Management Controller ID String ${initial_mc_id}
84
85 # Get the management controller ID and verify.
86 Get Management Controller ID String And Verify ${initial_mc_id}
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050087
Sweta Potthurif39022d2018-02-06 03:40:07 -060088
Sweta Potthuri0cc60502018-01-24 00:36:17 -060089Verify Chassis Identify via IPMI
90 [Documentation] Verify "chassis identify" using IPMI command.
91 [Tags] Verify_Chassis_Identify_via_IPMI
92
93 # Set to default "chassis identify" and verify that LED blinks for 15s.
94 Run IPMI Standard Command chassis identify
95 Verify Identify LED State Blink
96
97 Sleep 15s
98 Verify Identify LED State Off
99
100 # Set "chassis identify" to 10s and verify that the LED blinks for 10s.
101 Run IPMI Standard Command chassis identify 10
102 Verify Identify LED State Blink
103
104 Sleep 10s
105 Verify Identify LED State Off
106
Sweta Potthurif39022d2018-02-06 03:40:07 -0600107
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600108Verify Chassis Identify Off And Force Identify On via IPMI
109 [Documentation] Verify "chassis identify" off
110 ... and "force identify on" via IPMI.
111 [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI
112
113 # Set the LED to "Force Identify On".
114 Run IPMI Standard Command chassis identify force
115 Verify Identify LED State Blink
116
117 # Set "chassis identify" to 0 and verify that the LED turns off.
118 Run IPMI Standard Command chassis identify 0
119 Verify Identify LED State Off
120
Sweta Potthurif39022d2018-02-06 03:40:07 -0600121
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600122Test Watchdog Reset Via IPMI And Verify Using REST
123 [Documentation] Test watchdog reset via IPMI and verify using REST.
124 [Tags] Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST
125
126 Initiate Host Boot
127
128 Set Watchdog Enabled Using REST ${1}
129
130 Watchdog Object Should Exist
131
132 # Resetting the watchdog via IPMI.
133 Run IPMI Standard Command mc watchdog reset
134
135 # Verify the watchdog is reset using REST after an interval of 1000ms.
136 Sleep 1000ms
137 ${watchdog_time_left}=
138 ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining
139 Should Be True
140 ... ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000}
141 ... msg=Watchdog timer didn't reset.
142
Sweta Potthurif39022d2018-02-06 03:40:07 -0600143
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600144Test Watchdog Off Via IPMI And Verify Using REST
145 [Documentation] Test watchdog off via IPMI and verify using REST.
146 [Tags] Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST
147
148 Initiate Host Boot
149
150 Set Watchdog Enabled Using REST ${1}
151
152 Watchdog Object Should Exist
153
154 # Turn off the watchdog via IPMI.
155 Run IPMI Standard Command mc watchdog off
156
157 # Verify the watchdog is off using REST
158 ${watchdog_state}= Read Attribute ${HOST_WATCHDOG_URI} Enabled
159 Should Be Equal ${watchdog_state} ${0}
160 ... msg=msg=Verification failed for watchdog off check.
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600161
162
163Test Ambient Temperature Via IPMI
164 [Documentation] Test ambient temperature via IPMI and verify using REST.
165 [Tags] Test_Ambient_Temperature_Via_IPMI
166
167 # Entity ID Entity Instance Temp. Readings
168 # Inlet air temperature(40h) 1 +19 C
169 # CPU temperature sensors(41h) 5 +51 C
170 # CPU temperature sensors(41h) 6 +50 C
171 # CPU temperature sensors(41h) 7 +50 C
172 # CPU temperature sensors(41h) 8 +50 C
173 # CPU temperature sensors(41h) 9 +50 C
174 # CPU temperature sensors(41h) 10 +48 C
175 # CPU temperature sensors(41h) 11 +49 C
176 # CPU temperature sensors(41h) 12 +47 C
177 # CPU temperature sensors(41h) 8 +50 C
178 # CPU temperature sensors(41h) 16 +51 C
179 # CPU temperature sensors(41h) 24 +50 C
180 # CPU temperature sensors(41h) 32 +43 C
181 # CPU temperature sensors(41h) 40 +43 C
182 # Baseboard temperature sensors(42h) 1 +35 C
183
184 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
185 ${ambient_temp_line}=
186 ... Get Lines Containing String ${temp_reading}
187 ... Inlet air temperature case-insensitive
188
189 ${ambient_temp_ipmi}= Fetch From Right ${ambient_temp_line} +
190 ${ambient_temp_ipmi}= Remove String ${ambient_temp_ipmi} ${SPACE}C
191
192 ${ambient_temp_rest}= Read Attribute
193 ... ${SENSORS_URI}temperature/ambient Value
194
195 # Example of ambient temperature via REST
196 # "CriticalAlarmHigh": 0,
197 # "CriticalAlarmLow": 0,
198 # "CriticalHigh": 35000,
199 # "CriticalLow": 0,
200 # "Scale": -3,
201 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
202 # "Value": 21775,
203 # "WarningAlarmHigh": 0,
204 # "WarningAlarmLow": 0,
205 # "WarningHigh": 25000,
206 # "WarningLow": 0
207
208 # Get temperature value based on scale i.e. Value * (10 power Scale Value)
209 # e.g. from above case 21775 * (10 power -3) = 21775/1000
210
211 ${ambient_temp_rest}= Evaluate ${ambient_temp_rest}/1000
212 ${ipmi_rest_temp_diff}=
213 ... Evaluate abs(${ambient_temp_rest} - ${ambient_temp_ipmi})
214
215 Should Be True ${ipmi_rest_temp_diff} <= ${allowed_temp_diff}
216 ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}.
217
218
Rahul Maheshwari43556632018-02-05 23:42:52 -0600219Verify Get DCMI Capabilities
220 [Documentation] Verify get DCMI capabilities command output.
221 [Tags] Verify_Get_DCMI_Capabilities
222
223 ${cmd_output}= Run IPMI Standard Command dcmi discover
224
225 @{supported_capabilities}= Create List
226 # Supported DCMI capabilities:
227 ... Mandatory platform capabilties
228 ... Optional platform capabilties
229 ... Power management available
230 ... Managebility access capabilties
231 ... In-band KCS channel available
232 # Mandatory platform attributes:
233 ... 200 SEL entries
234 ... SEL automatic rollover is enabled
235 # Optional Platform Attributes:
236 ... Slave address of device: 0h (8bits)(Satellite/External controller)
237 ... Channel number is 0h (Primary BMC)
238 ... Device revision is 0
239 # Manageability Access Attributes:
240 ... Primary LAN channel number: 1 is available
241 ... Secondary LAN channel is not available for OOB
242 ... No serial channel is available
243
244 :FOR ${capability} IN @{supported_capabilities}
245 \ Should Contain ${cmd_output} ${capability} ignore_case=True
246 ... msg=Supported DCMI capabilities not present.
247
248
Rahul Maheshwari615da152018-02-13 23:53:36 -0600249Test Power Reading Via IPMI With Host Booted
250 [Documentation] Test power reading via IPMI with host booted state and
251 ... verify using REST.
252 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted
253
254 REST Power On stack_mode=skip quiet=1
255
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600256 Verify Power Reading
Rahul Maheshwari615da152018-02-13 23:53:36 -0600257
Rahul Maheshwari615da152018-02-13 23:53:36 -0600258
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600259Test Power Reading Via IPMI With Host Off
260 [Documentation] Test power reading via IPMI with host off state and
261 ... verify using REST.
262 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Off
Rahul Maheshwari615da152018-02-13 23:53:36 -0600263
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600264 REST Power Off stack_mode=skip quiet=1
Rahul Maheshwari615da152018-02-13 23:53:36 -0600265
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600266 Wait Until Keyword Succeeds 6 min 10 sec Is Host Off
Rahul Maheshwari615da152018-02-13 23:53:36 -0600267
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600268 Verify Power Reading
Rahul Maheshwari615da152018-02-13 23:53:36 -0600269
270
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600271Test Power Reading Via IPMI Raw Command
272 [Documentation] Test power reading via IPMI raw command and verify
273 ... using REST.
274 [Tags] Test_Power_Reading_Via_IPMI_Raw_Command
275
276 # Response data structure of power reading command output via IPMI.
277 # 1 Completion Code. Refer to section 8, DCMI Completion Codes.
278 # 2 Group Extension Identification = DCh
279 # 3:4 Current Power in watts
280
281 ${ipmi_raw_output}= Run IPMI Standard Command
282 ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]}
283
284 @{raw_output_list}= Split String ${ipmi_raw_output} ${SPACE}
285
286 # On successful execution of raw IPMI power reading command, completion
287 # code does not come in output. So current power value will start from 2
288 # byte instead of 3.
289
290 ${power_reading_ipmi_raw_3_item}= Get From List ${raw_output_list} 2
291 ${power_reading_ipmi_raw_3_item}=
292 ... Convert To Integer 0x${power_reading_ipmi_raw_3_item}
293
294 ${power_reading_rest}= Read Attribute
295 ... ${SENSORS_URI}power/total_power Value
296
297 # Example of power reading via REST
298 # "CriticalAlarmHigh": 0,
299 # "CriticalAlarmLow": 0,
300 # "CriticalHigh": 3100000000,
301 # "CriticalLow": 0,
302 # "Scale": -6,
303 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
304 # "Value": 228000000,
305 # "WarningAlarmHigh": 0,
306 # "WarningAlarmLow": 0,
307 # "WarningHigh": 3050000000,
308 # "WarningLow": 0
309
310 # Get power value based on scale i.e. Value * (10 power Scale Value)
311 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
312
313 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
314 ${ipmi_rest_power_diff}=
315 ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi_raw_3_item})
316
317 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
318 ... msg=Power Reading above allowed threshold ${allowed_power_diff}.
319
320
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600321Test Baseboard Temperature Via IPMI
322 [Documentation] Test baseboard temperature via IPMI and verify using REST.
323 [Tags] Test_Baseboard_Temperature_Via_IPMI
324
325 # Example of IPMI dcmi get_temp_reading output:
326 # Entity ID Entity Instance Temp. Readings
327 # Inlet air temperature(40h) 1 +19 C
328 # CPU temperature sensors(41h) 5 +51 C
329 # CPU temperature sensors(41h) 6 +50 C
330 # CPU temperature sensors(41h) 7 +50 C
331 # CPU temperature sensors(41h) 8 +50 C
332 # CPU temperature sensors(41h) 9 +50 C
333 # CPU temperature sensors(41h) 10 +48 C
334 # CPU temperature sensors(41h) 11 +49 C
335 # CPU temperature sensors(41h) 12 +47 C
336 # CPU temperature sensors(41h) 8 +50 C
337 # CPU temperature sensors(41h) 16 +51 C
338 # CPU temperature sensors(41h) 24 +50 C
339 # CPU temperature sensors(41h) 32 +43 C
340 # CPU temperature sensors(41h) 40 +43 C
341 # Baseboard temperature sensors(42h) 1 +35 C
342
343 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
344 ${baseboard_temp_line}=
345 ... Get Lines Containing String ${temp_reading}
346 ... Baseboard temperature case-insensitive=True
347
348 ${baseboard_temp_ipmi}= Fetch From Right ${baseboard_temp_line} +
349 ${baseboard_temp_ipmi}= Remove String ${baseboard_temp_ipmi} ${SPACE}C
350
351 ${baseboard_temp_rest}= Read Attribute
352 ... /xyz/openbmc_project/sensors/temperature/pcie Value
353 ${baseboard_temp_rest}= Evaluate ${baseboard_temp_rest}/1000
354
355 Should Be True
356 ... ${baseboard_temp_rest} - ${baseboard_temp_ipmi} <= ${allowed_temp_diff}
357 ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}.
358
359
Sweta Potthurif39022d2018-02-06 03:40:07 -0600360Retrieve Default Gateway Via IPMI And Verify Using REST
361 [Documentation] Retrieve default gateway from LAN print using IPMI.
362 [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify_Using_REST
363
364 # Fetch "Default Gateway" from IPMI LAN print.
365 ${default_gateway_ipmi}= Fetch Details From LAN Print Default Gateway IP
366
367 # Verify "Default Gateway" using REST.
368 Read Attribute ${NETWORK_MANAGER}/config DefaultGateway
369 ... expected_value=${default_gateway_ipmi}
370
371
372Retrieve MAC Address Via IPMI And Verify Using REST
373 [Documentation] Retrieve MAC Address from LAN print using IPMI.
374 [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_REST
375
376 # Fetch "MAC Address" from IPMI LAN print.
377 ${mac_address_ipmi}= Fetch Details From LAN Print MAC Address
378
379 # Verify "MAC Address" using REST.
380 ${mac_address_rest}= Get BMC MAC Address
381 Should Be Equal ${mac_address_ipmi} ${mac_address_rest}
382 ... msg=Verification of MAC address from lan print using IPMI failed.
383
384
385Retrieve Network Mode Via IPMI And Verify Using REST
386 [Documentation] Retrieve network mode from LAN print using IPMI.
387 [Tags] Retrieve_Network_Mode_Via_IPMI_And_Verify_Using_REST
388
389 # Fetch "Mode" from IPMI LAN print.
390 ${network_mode_ipmi}= Fetch Details From LAN Print Source
391
392 # Verify "Mode" using REST.
393 ${network_mode_rest}= Read Attribute
394 ... ${NETWORK_MANAGER}/eth0 DHCPEnabled
395 Run Keyword If '${network_mode_ipmi}' == 'Static Address'
396 ... Should Be Equal ${network_mode_rest} ${0}
397 ... msg=Verification of network setting failed.
398 ... ELSE IF '${network_mode_ipmi}' == 'DHCP'
399 ... Should Be Equal ${network_mode_rest} ${1}
400 ... msg=Verification of network setting failed.
401
402
403Retrieve IP Address Via IPMI And Verify With BMC Details
404 [Documentation] Retrieve IP address from LAN print using IPMI.
405 [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_With_BMC_Details
406
407 # Fetch "IP Address" from IPMI LAN print.
408 ${ip_addr_ipmi}= Fetch Details From LAN Print IP Address
409
410 # Verify the IP address retrieved via IPMI with BMC IPs.
411 ${ip_address_rest}= Get BMC IP Info
412 Validate IP On BMC ${ip_addr_ipmi} ${ip_address_rest}
413
414
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600415Verify Get Device ID
416 [Documentation] Verify get device ID command output.
417 [Tags] Verify_Get_Device_ID
418
419 # Example of get device ID command output:
420 # Device ID : 0
421 # Device Revision : 0
422 # Firmware Revision : 2.01
423 # IPMI Version : 2.0
424 # Manufacturer ID : 42817
425 # Manufacturer Name : Unknown (0xA741)
426 # Product ID : 16975 (0x424f)
427 # Product Name : Unknown (0x424F)
428 # Device Available : yes
429 # Provides Device SDRs : yes
430 # Additional Device Support :
431 # Sensor Device
432 # SEL Device
433 # FRU Inventory Device
434 # Chassis Device
435 # Aux Firmware Rev Info :
436 # 0x00
437 # 0x00
438 # 0x00
439 # 0x00
440
441 ${mc_info}= Get MC Info
442
443 Should Be Equal ${mc_info['device_id']} 0
444 Should Be Equal ${mc_info['device_revision']} 0
445
446 # Get major BMC version from BMC cli i.e. 2.1 from "v2.1-51-g04ff12c"
447 ${bmc_version}= Get BMC Version
448 ${bmc_version}= Fetch From Left ${bmc_version} -
449 ${bmc_version}= Remove String ${bmc_version} "v
450
451 Should Be Equal ${mc_info['firmware_revision']} ${bmc_version}
452 Should Be Equal ${mc_info['ipmi_version']} 2.0
453
454 # TODO: Verify Manufacturer and Product IDs directy from json file.
455 # Reference : openbmc/openbmc-test-automation#1244
456 Should Be Equal ${mc_info['manufacturer_id']} 42817
457 Should Be Equal ${mc_info['product_id']} 16975 (0x424f)
458
459 Should Be Equal ${mc_info['device_available']} yes
460 Should Be Equal ${mc_info['provides_device_sdrs']} yes
461 Should Contain ${mc_info['additional_device_support']} Sensor Device
462 Should Contain ${mc_info['additional_device_support']} SEL Device
463 Should Contain
464 ... ${mc_info['additional_device_support']} FRU Inventory Device
465 Should Contain ${mc_info['additional_device_support']} Chassis Device
466 Should Contain X Times ${mc_info['aux_firmware_rev_info']} 0x00 4
467
468
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500469*** Keywords ***
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600470
Sweta Potthurif39022d2018-02-06 03:40:07 -0600471
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600472Set Management Controller ID String
473 [Documentation] Set the management controller ID string.
474 [Arguments] ${string}
475
476 # Description of argument(s):
477 # string Management Controller ID String to be set
478
479 ${set_mc_id_string}= Run IPMI Standard Command
480 ... dcmi set_mc_id_string ${string}
481
Sweta Potthurif39022d2018-02-06 03:40:07 -0600482
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600483Get Management Controller ID String And Verify
484 [Documentation] Get the management controller ID sting.
485 [Arguments] ${string}
486
487 # Description of argument(s):
488 # string Management Controller ID string
489
490 ${get_mc_id}= Run IPMI Standard Command dcmi get_mc_id_string
491 Should Contain ${get_mc_id} ${string}
492 ... msg=Command failed: get_mc_id.
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600493
Sweta Potthurif39022d2018-02-06 03:40:07 -0600494
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600495Verify Identify LED State
496 [Documentation] Verify the identify LED state
497 ... matches caller's expectations.
498 [Arguments] ${expected_state}
499
500 # Description of argument(s):
501 # expected_state The LED state expected by the caller ("Blink" or "Off").
502
503 ${resp}= Read Attribute ${LED_PHYSICAL_URI}/front_id State
504 Should Be Equal ${resp} xyz.openbmc_project.Led.Physical.Action.${expected_state}
505 ... msg=Unexpected LED state.
506
507 ${resp}= Read Attribute ${LED_PHYSICAL_URI}/rear_id State
508 Should Be Equal ${resp} xyz.openbmc_project.Led.Physical.Action.${expected_state}
509 ... msg=Unexpected LED state.
510
Sweta Potthurif39022d2018-02-06 03:40:07 -0600511
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600512Set Watchdog Enabled Using REST
513 [Documentation] Set watchdog Enabled field using REST.
514 [Arguments] ${value}
515
516 # Description of argument(s):
517 # value Integer value (eg. "0-Disabled", "1-Enabled").
518
519 ${value_dict}= Create Dictionary data=${value}
520 ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}/attr/Enabled
521 ... data=${value_dict}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600522
523
Sweta Potthurif39022d2018-02-06 03:40:07 -0600524Fetch Details From LAN Print
525 [Documentation] Fetch details from LAN print.
526 [Arguments] ${field_name}
527
528 # Description of argument(s):
529 # ${field_name} Field name to be fetched from LAN print
530 # (e.g. "MAC Address", "Source").
531
Sweta Potthuric64322a2018-02-22 05:30:30 -0600532 ${stdout}= Run External IPMI Standard Command lan print
Sweta Potthurif39022d2018-02-06 03:40:07 -0600533 ${fetch_value}= Get Lines Containing String ${stdout} ${field_name}
534 ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE}
535 [Return] ${value_fetch}
536
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600537
538Verify Power Reading
539 [Documentation] Get dcmi power reading via IPMI.
540
541 # Example of power reading command output via IPMI.
542 # Instantaneous power reading: 235 Watts
543 # Minimum during sampling period: 235 Watts
544 # Maximum during sampling period: 235 Watts
545 # Average power reading over sample period: 235 Watts
546 # IPMI timestamp: Thu Jan 1 00:00:00 1970
547 # Sampling period: 00000000 Seconds.
548 # Power reading state is: deactivated
549
550 ${power_reading}= Get IPMI Power Reading
551
552 ${host_state}= Get Host State
553 Run Keyword If '${host_state}' == 'Off'
554 ... Should Be Equal ${power_reading['instantaneous_power_reading']} 0 Watts
555
556 Run Keyword If '${power_reading['instantaneous_power_reading']}' != '0 Watts'
557 ... Verify Power Reading Using REST ${power_reading['instantaneous_power_reading']}
558
559
560Verify Power Reading Using REST
561 [Documentation] Verify power reading using REST.
562 [Arguments] ${power_reading}
563
564 # Desciption of argument(s):
565 # power_reading IPMI Power reading
566
567 ${power_reading_rest}= Read Attribute
568 ... ${SENSORS_URI}power/total_power Value
569
570 # Example of power reading via REST
571 # "CriticalAlarmHigh": 0,
572 # "CriticalAlarmLow": 0,
573 # "CriticalHigh": 3100000000,
574 # "CriticalLow": 0,
575 # "Scale": -6,
576 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
577 # "Value": 228000000,
578 # "WarningAlarmHigh": 0,
579 # "WarningAlarmLow": 0,
580 # "WarningHigh": 3050000000,
581 # "WarningLow": 0
582
583 # Get power value based on scale i.e. Value * (10 power Scale Value)
584 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
585 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
586 ${ipmi_rest_power_diff}=
587 ... Evaluate abs(${power_reading_rest} - ${power_reading})
588
589 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
590 ... msg=Power reading above allowed threshold ${allowed_power_diff}.