blob: a31a521074b02b8cd6ca4c6093f8ed8fd07b773e [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 Keishingd6273802018-09-07 07:06:53 -05009Resource ../../lib/logging_utils.robot
George Keishing78ce8dc2018-03-30 11:49:06 -050010Library ../../lib/ipmi_utils.py
George Keishing0825a112018-03-30 10:48:07 -050011Variables ../../data/ipmi_raw_cmd_table.py
Rahul Maheshwaridf6f05d2018-09-04 03:48:37 -050012Library ../../lib/gen_misc.py
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050013
Michael Walshc9eb34e2019-01-23 11:08:43 -060014Test Setup Log to Console ${EMPTY}
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050015Test Teardown FFDC On Test Case Fail
16
17*** Variables ***
18
Rahul Maheshwari901dcde2018-02-06 03:14:31 -060019${allowed_temp_diff}= ${1}
Rahul Maheshwari615da152018-02-13 23:53:36 -060020${allowed_power_diff}= ${10}
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060021
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050022*** Test Cases ***
23
Sweta Potthuri0cc60502018-01-24 00:36:17 -060024Verify Chassis Identify via IPMI
25 [Documentation] Verify "chassis identify" using IPMI command.
26 [Tags] Verify_Chassis_Identify_via_IPMI
27
28 # Set to default "chassis identify" and verify that LED blinks for 15s.
29 Run IPMI Standard Command chassis identify
Alvin Wang32f7b3d2019-07-25 02:05:39 -050030 Verify Identify LED State ${1}
Sweta Potthuri0cc60502018-01-24 00:36:17 -060031
32 Sleep 15s
Alvin Wang32f7b3d2019-07-25 02:05:39 -050033 Verify Identify LED State ${0}
Sweta Potthuri0cc60502018-01-24 00:36:17 -060034
35 # Set "chassis identify" to 10s and verify that the LED blinks for 10s.
36 Run IPMI Standard Command chassis identify 10
Alvin Wang32f7b3d2019-07-25 02:05:39 -050037 Verify Identify LED State ${1}
Sweta Potthuri0cc60502018-01-24 00:36:17 -060038
39 Sleep 10s
Alvin Wang32f7b3d2019-07-25 02:05:39 -050040 Verify Identify LED State ${0}
Sweta Potthuri0cc60502018-01-24 00:36:17 -060041
Sweta Potthurif39022d2018-02-06 03:40:07 -060042
Sweta Potthuri0cc60502018-01-24 00:36:17 -060043Verify Chassis Identify Off And Force Identify On via IPMI
44 [Documentation] Verify "chassis identify" off
45 ... and "force identify on" via IPMI.
46 [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI
47
48 # Set the LED to "Force Identify On".
49 Run IPMI Standard Command chassis identify force
Alvin Wang32f7b3d2019-07-25 02:05:39 -050050 Verify Identify LED State ${1}
Sweta Potthuri0cc60502018-01-24 00:36:17 -060051
52 # Set "chassis identify" to 0 and verify that the LED turns off.
53 Run IPMI Standard Command chassis identify 0
Alvin Wang32f7b3d2019-07-25 02:05:39 -050054 Verify Identify LED State ${0}
Sweta Potthuri0cc60502018-01-24 00:36:17 -060055
Sweta Potthurif39022d2018-02-06 03:40:07 -060056
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -060057Test Watchdog Reset Via IPMI And Verify Using REST
58 [Documentation] Test watchdog reset via IPMI and verify using REST.
59 [Tags] Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST
60
61 Initiate Host Boot
62
63 Set Watchdog Enabled Using REST ${1}
64
65 Watchdog Object Should Exist
66
67 # Resetting the watchdog via IPMI.
68 Run IPMI Standard Command mc watchdog reset
69
70 # Verify the watchdog is reset using REST after an interval of 1000ms.
71 Sleep 1000ms
72 ${watchdog_time_left}=
73 ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining
74 Should Be True
75 ... ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000}
76 ... msg=Watchdog timer didn't reset.
77
Sweta Potthurif39022d2018-02-06 03:40:07 -060078
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -060079Test Watchdog Off Via IPMI And Verify Using REST
80 [Documentation] Test watchdog off via IPMI and verify using REST.
81 [Tags] Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST
82
83 Initiate Host Boot
84
85 Set Watchdog Enabled Using REST ${1}
86
87 Watchdog Object Should Exist
88
89 # Turn off the watchdog via IPMI.
90 Run IPMI Standard Command mc watchdog off
91
92 # Verify the watchdog is off using REST
93 ${watchdog_state}= Read Attribute ${HOST_WATCHDOG_URI} Enabled
94 Should Be Equal ${watchdog_state} ${0}
95 ... msg=msg=Verification failed for watchdog off check.
Rahul Maheshwari901dcde2018-02-06 03:14:31 -060096
97
98Test Ambient Temperature Via IPMI
99 [Documentation] Test ambient temperature via IPMI and verify using REST.
100 [Tags] Test_Ambient_Temperature_Via_IPMI
101
102 # Entity ID Entity Instance Temp. Readings
103 # Inlet air temperature(40h) 1 +19 C
104 # CPU temperature sensors(41h) 5 +51 C
105 # CPU temperature sensors(41h) 6 +50 C
106 # CPU temperature sensors(41h) 7 +50 C
107 # CPU temperature sensors(41h) 8 +50 C
108 # CPU temperature sensors(41h) 9 +50 C
109 # CPU temperature sensors(41h) 10 +48 C
110 # CPU temperature sensors(41h) 11 +49 C
111 # CPU temperature sensors(41h) 12 +47 C
112 # CPU temperature sensors(41h) 8 +50 C
113 # CPU temperature sensors(41h) 16 +51 C
114 # CPU temperature sensors(41h) 24 +50 C
115 # CPU temperature sensors(41h) 32 +43 C
116 # CPU temperature sensors(41h) 40 +43 C
117 # Baseboard temperature sensors(42h) 1 +35 C
118
119 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
George Keishing77f1ad22018-07-23 12:39:28 -0500120 Should Contain ${temp_reading} Inlet air temperature
121 ... msg="Unable to get inlet temperature via DCMI".
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600122 ${ambient_temp_line}=
123 ... Get Lines Containing String ${temp_reading}
124 ... Inlet air temperature case-insensitive
125
126 ${ambient_temp_ipmi}= Fetch From Right ${ambient_temp_line} +
127 ${ambient_temp_ipmi}= Remove String ${ambient_temp_ipmi} ${SPACE}C
128
129 ${ambient_temp_rest}= Read Attribute
130 ... ${SENSORS_URI}temperature/ambient Value
131
132 # Example of ambient temperature via REST
133 # "CriticalAlarmHigh": 0,
134 # "CriticalAlarmLow": 0,
135 # "CriticalHigh": 35000,
136 # "CriticalLow": 0,
137 # "Scale": -3,
138 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
139 # "Value": 21775,
140 # "WarningAlarmHigh": 0,
141 # "WarningAlarmLow": 0,
142 # "WarningHigh": 25000,
143 # "WarningLow": 0
144
145 # Get temperature value based on scale i.e. Value * (10 power Scale Value)
146 # e.g. from above case 21775 * (10 power -3) = 21775/1000
147
148 ${ambient_temp_rest}= Evaluate ${ambient_temp_rest}/1000
149 ${ipmi_rest_temp_diff}=
150 ... Evaluate abs(${ambient_temp_rest} - ${ambient_temp_ipmi})
151
152 Should Be True ${ipmi_rest_temp_diff} <= ${allowed_temp_diff}
153 ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}.
154
155
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600156Test Power Reading Via IPMI With Host Off
157 [Documentation] Test power reading via IPMI with host off state and
158 ... verify using REST.
159 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Off
Rahul Maheshwari615da152018-02-13 23:53:36 -0600160
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600161 REST Power Off stack_mode=skip quiet=1
Rahul Maheshwari615da152018-02-13 23:53:36 -0600162
George Keishing04bf06c2018-10-05 08:28:50 -0500163 Wait Until Keyword Succeeds 1 min 30 sec Verify Power Reading
George Keishinge78f1fd2018-09-04 13:34:59 -0500164
165
166Test Power Reading Via IPMI With Host Booted
167 [Documentation] Test power reading via IPMI with host booted state and
168 ... verify using REST.
169 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted
170
171 REST Power On stack_mode=skip quiet=1
172
173 # For a good power reading take a 3 samples for 15 seconds interval and
174 # average it out.
175
George Keishing04bf06c2018-10-05 08:28:50 -0500176 Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading
Rahul Maheshwari615da152018-02-13 23:53:36 -0600177
178
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600179Test Power Reading Via IPMI Raw Command
180 [Documentation] Test power reading via IPMI raw command and verify
181 ... using REST.
182 [Tags] Test_Power_Reading_Via_IPMI_Raw_Command
183
184 # Response data structure of power reading command output via IPMI.
185 # 1 Completion Code. Refer to section 8, DCMI Completion Codes.
186 # 2 Group Extension Identification = DCh
187 # 3:4 Current Power in watts
188
George Keishinge78f1fd2018-09-04 13:34:59 -0500189 REST Power On stack_mode=skip quiet=1
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600190
George Keishing04bf06c2018-10-05 08:28:50 -0500191 Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading Via Raw Command
Rahul Maheshwariabe13af2018-02-15 22:42:08 -0600192
193
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600194Test Baseboard Temperature Via IPMI
195 [Documentation] Test baseboard temperature via IPMI and verify using REST.
196 [Tags] Test_Baseboard_Temperature_Via_IPMI
197
198 # Example of IPMI dcmi get_temp_reading output:
199 # Entity ID Entity Instance Temp. Readings
200 # Inlet air temperature(40h) 1 +19 C
201 # CPU temperature sensors(41h) 5 +51 C
202 # CPU temperature sensors(41h) 6 +50 C
203 # CPU temperature sensors(41h) 7 +50 C
204 # CPU temperature sensors(41h) 8 +50 C
205 # CPU temperature sensors(41h) 9 +50 C
206 # CPU temperature sensors(41h) 10 +48 C
207 # CPU temperature sensors(41h) 11 +49 C
208 # CPU temperature sensors(41h) 12 +47 C
209 # CPU temperature sensors(41h) 8 +50 C
210 # CPU temperature sensors(41h) 16 +51 C
211 # CPU temperature sensors(41h) 24 +50 C
212 # CPU temperature sensors(41h) 32 +43 C
213 # CPU temperature sensors(41h) 40 +43 C
214 # Baseboard temperature sensors(42h) 1 +35 C
215
216 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
George Keishing77f1ad22018-07-23 12:39:28 -0500217 Should Contain ${temp_reading} Baseboard temperature sensors
218 ... msg="Unable to get baseboard temperature via DCMI".
Rahul Maheshwari91a18ef2018-02-15 04:54:59 -0600219 ${baseboard_temp_line}=
220 ... Get Lines Containing String ${temp_reading}
221 ... Baseboard temperature case-insensitive=True
222
223 ${baseboard_temp_ipmi}= Fetch From Right ${baseboard_temp_line} +
224 ${baseboard_temp_ipmi}= Remove String ${baseboard_temp_ipmi} ${SPACE}C
225
226 ${baseboard_temp_rest}= Read Attribute
227 ... /xyz/openbmc_project/sensors/temperature/pcie Value
228 ${baseboard_temp_rest}= Evaluate ${baseboard_temp_rest}/1000
229
230 Should Be True
231 ... ${baseboard_temp_rest} - ${baseboard_temp_ipmi} <= ${allowed_temp_diff}
232 ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}.
233
234
Sweta Potthurif39022d2018-02-06 03:40:07 -0600235Retrieve Network Mode Via IPMI And Verify Using REST
236 [Documentation] Retrieve network mode from LAN print using IPMI.
237 [Tags] Retrieve_Network_Mode_Via_IPMI_And_Verify_Using_REST
238
239 # Fetch "Mode" from IPMI LAN print.
240 ${network_mode_ipmi}= Fetch Details From LAN Print Source
241
242 # Verify "Mode" using REST.
243 ${network_mode_rest}= Read Attribute
Steven Sombara8800da2018-12-18 16:19:05 -0600244 ... ${NETWORK_MANAGER}eth0 DHCPEnabled
Sweta Potthurif39022d2018-02-06 03:40:07 -0600245 Run Keyword If '${network_mode_ipmi}' == 'Static Address'
246 ... Should Be Equal ${network_mode_rest} ${0}
247 ... msg=Verification of network setting failed.
248 ... ELSE IF '${network_mode_ipmi}' == 'DHCP'
249 ... Should Be Equal ${network_mode_rest} ${1}
250 ... msg=Verification of network setting failed.
251
252
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600253Verify Get Device ID
254 [Documentation] Verify get device ID command output.
255 [Tags] Verify_Get_Device_ID
256
257 # Example of get device ID command output:
258 # Device ID : 0
259 # Device Revision : 0
260 # Firmware Revision : 2.01
261 # IPMI Version : 2.0
262 # Manufacturer ID : 42817
263 # Manufacturer Name : Unknown (0xA741)
264 # Product ID : 16975 (0x424f)
265 # Product Name : Unknown (0x424F)
266 # Device Available : yes
267 # Provides Device SDRs : yes
268 # Additional Device Support :
269 # Sensor Device
270 # SEL Device
271 # FRU Inventory Device
272 # Chassis Device
273 # Aux Firmware Rev Info :
George Keishing3511a3f2018-04-19 10:38:30 -0500274 # 0x04
275 # 0x38
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600276 # 0x00
George Keishing3511a3f2018-04-19 10:38:30 -0500277 # 0x03
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600278
279 ${mc_info}= Get MC Info
280
281 Should Be Equal ${mc_info['device_id']} 0
282 Should Be Equal ${mc_info['device_revision']} 0
283
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500284 # Get firmware revision from mc info command output i.e. 2.01
285 ${ipmi_fw_major_version} ${ipmi_fw_minor_version}=
286 ... Split String ${mc_info['firmware_revision']} .
287 # Convert minor firmware version from BCD format to integer. i.e. 01 to 1
288 ${ipmi_fw_minor_version}= Convert To Integer ${ipmi_fw_minor_version}
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600289
George Keishinge0a81282018-06-08 10:02:30 -0500290 # Get BMC version from BMC CLI i.e. 2.2 from "v2.2-253-g00050f1"
George Keishing3511a3f2018-04-19 10:38:30 -0500291 ${bmc_version_full}= Get BMC Version
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500292 ${bmc_version}=
George Keishing3511a3f2018-04-19 10:38:30 -0500293 ... Remove String Using Regexp ${bmc_version_full} ^[^0-9]+ [^0-9\.].*
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500294
295 # Get major and minor version from BMC version i.e. 2 and 1 from 2.1
George Keishingc95e9982019-01-14 09:27:45 -0600296 @{major_minor_version}= Split String ${bmc_version} .
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500297
George Keishingc95e9982019-01-14 09:27:45 -0600298 Should Be Equal As Strings ${ipmi_fw_major_version} ${major_minor_version[0]}
George Keishing2ee2f002019-02-16 09:36:02 -0600299 ... msg=Major version mismatch.
George Keishingc95e9982019-01-14 09:27:45 -0600300 Should Be Equal As Strings ${ipmi_fw_minor_version} ${major_minor_version[1]}
George Keishing2ee2f002019-02-16 09:36:02 -0600301 ... msg=Minor version mismatch.
Rahul Maheshwaribb9e2572018-04-02 05:24:37 -0500302
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600303 Should Be Equal ${mc_info['ipmi_version']} 2.0
304
Gunnar Mills917ba1a2018-04-08 16:42:12 -0500305 # TODO: Verify Manufacturer and Product IDs directly from json file.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600306 # Reference : openbmc/openbmc-test-automation#1244
307 Should Be Equal ${mc_info['manufacturer_id']} 42817
308 Should Be Equal ${mc_info['product_id']} 16975 (0x424f)
309
310 Should Be Equal ${mc_info['device_available']} yes
311 Should Be Equal ${mc_info['provides_device_sdrs']} yes
312 Should Contain ${mc_info['additional_device_support']} Sensor Device
313 Should Contain ${mc_info['additional_device_support']} SEL Device
314 Should Contain
315 ... ${mc_info['additional_device_support']} FRU Inventory Device
316 Should Contain ${mc_info['additional_device_support']} Chassis Device
George Keishingb746d3f2018-04-19 10:53:10 -0500317
George Keishing3511a3f2018-04-19 10:38:30 -0500318 # Auxiliary revision data verification.
319 ${aux_version}= Get Aux Version ${bmc_version_full}
320
321 # From aux_firmware_rev_info field ['0x04', '0x38', '0x00', '0x03']
322 ${bmc_aux_version}= Catenate
323 ... SEPARATOR=
324 ... ${mc_info['aux_firmware_rev_info'][0][2:]}
325 ... ${mc_info['aux_firmware_rev_info'][1][2:]}
326 ... ${mc_info['aux_firmware_rev_info'][2][2:]}
327 ... ${mc_info['aux_firmware_rev_info'][3][2:]}
328
329 Should Be Equal As Integers
330 ... ${bmc_aux_version} ${aux_version}
331 ... msg=BMC aux version ${bmc_aux_version} does not match expected value of ${aux_version}.
Rahul Maheshwarife8639b2018-02-05 22:42:24 -0600332
333
George Keishinge85113a2019-06-07 08:21:51 -0500334Test IPMI Restriction Mode
335 [Documentation] Set restricition mode via REST and verify IPMI operation.
336 [Tags] Test_IPMI_Restriction_Mode
337 # Forego normal test setup:
338 [Setup] No Operation
339 [Teardown] Run Keywords FFDC On Test Case Fail AND
340 ... Set IPMI Restriction Mode xyz.openbmc_project.Control.Security.RestrictionMode.Modes.None
341
342 # By default no IPMI operations are restricted.
343 # /xyz/openbmc_project/control/host0/restriction_mode/attr/RestrictionMode
344 # {
345 # "data": "xyz.openbmc_project.Control.Security.RestrictionMode.Modes.None",
346 # "message": "200 OK",
347 # "status": "ok"
348 # }
349
350 # Refer to: #openbmc/phosphor-host-ipmid/blob/master/host-ipmid-whitelist.conf
351 # Set the restriction mode to Whitelist IPMI commands only:
352 # /xyz/openbmc_project/control/host0/restriction_mode/attr/RestrictionMode
353 # {
354 # "data": "xyz.openbmc_project.Control.Security.RestrictionMode.Modes.Whitelist",
355 # "message": "200 OK",
356 # "status": "ok"
357 # }
358
359 Set IPMI Restriction Mode xyz.openbmc_project.Control.Security.RestrictionMode.Modes.Whitelist
360
361 # Attempt white-listed operation expecting success.
362 IPMI Power On
363
364 # Attempt non white-listed operation expecting failure.
365 Run Keyword And Expect Error *Insufficient privilege level*
Rahul Maheshwari40193982019-10-11 00:55:08 -0500366 ... Run Inband IPMI Standard Command lan set 1 access on
George Keishinge85113a2019-06-07 08:21:51 -0500367
368
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500369*** Keywords ***
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600370
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600371Set Watchdog Enabled Using REST
372 [Documentation] Set watchdog Enabled field using REST.
373 [Arguments] ${value}
374
375 # Description of argument(s):
376 # value Integer value (eg. "0-Disabled", "1-Enabled").
377
378 ${value_dict}= Create Dictionary data=${value}
Steven Sombaraaaab222018-12-19 13:16:23 -0600379 ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}attr/Enabled
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600380 ... data=${value_dict}
Sweta Potthurif39022d2018-02-06 03:40:07 -0600381
382
Sweta Potthurif39022d2018-02-06 03:40:07 -0600383Fetch Details From LAN Print
384 [Documentation] Fetch details from LAN print.
385 [Arguments] ${field_name}
386
387 # Description of argument(s):
388 # ${field_name} Field name to be fetched from LAN print
389 # (e.g. "MAC Address", "Source").
390
Rahul Maheshwarid8037d32018-12-17 00:59:57 -0600391 ${stdout}= Run IPMI Standard Command lan print
Sweta Potthurif39022d2018-02-06 03:40:07 -0600392 ${fetch_value}= Get Lines Containing String ${stdout} ${field_name}
393 ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE}
394 [Return] ${value_fetch}
395
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600396
397Verify Power Reading
398 [Documentation] Get dcmi power reading via IPMI.
399
400 # Example of power reading command output via IPMI.
401 # Instantaneous power reading: 235 Watts
402 # Minimum during sampling period: 235 Watts
403 # Maximum during sampling period: 235 Watts
404 # Average power reading over sample period: 235 Watts
405 # IPMI timestamp: Thu Jan 1 00:00:00 1970
406 # Sampling period: 00000000 Seconds.
407 # Power reading state is: deactivated
408
409 ${power_reading}= Get IPMI Power Reading
410
411 ${host_state}= Get Host State
412 Run Keyword If '${host_state}' == 'Off'
George Keishing51314872018-03-31 13:24:35 -0500413 ... Should Be Equal ${power_reading['instantaneous_power_reading']} 0
414 ... msg=Power reading not zero when power is off.
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600415
George Keishing51314872018-03-31 13:24:35 -0500416 Run Keyword If '${power_reading['instantaneous_power_reading']}' != '0'
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600417 ... Verify Power Reading Using REST ${power_reading['instantaneous_power_reading']}
418
419
George Keishinge78f1fd2018-09-04 13:34:59 -0500420Verify Power Reading Via Raw Command
421 [Documentation] Get dcmi power reading via IPMI raw command.
422
423 ${ipmi_raw_output}= Run IPMI Standard Command
424 ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]}
425
426 @{raw_output_list}= Split String ${ipmi_raw_output} ${SPACE}
427
428 # On successful execution of raw IPMI power reading command, completion
429 # code does not come in output. So current power value will start from 2
430 # byte instead of 3.
431
432 ${power_reading_ipmi_raw_3_item}= Get From List ${raw_output_list} 2
433 ${power_reading_ipmi_raw_3_item}=
434 ... Convert To Integer 0x${power_reading_ipmi_raw_3_item}
435
436 ${power_reading_rest}= Read Attribute
437 ... ${SENSORS_URI}power/total_power Value
438
439 # Example of power reading via REST
440 # "CriticalAlarmHigh": 0,
441 # "CriticalAlarmLow": 0,
442 # "CriticalHigh": 3100000000,
443 # "CriticalLow": 0,
444 # "Scale": -6,
445 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
446 # "Value": 228000000,
447 # "WarningAlarmHigh": 0,
448 # "WarningAlarmLow": 0,
449 # "WarningHigh": 3050000000,
450 # "WarningLow": 0
451
452 # Get power value based on scale i.e. Value * (10 power Scale Value)
453 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
454
455 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
456 ${ipmi_rest_power_diff}=
457 ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi_raw_3_item})
458
459 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
460 ... msg=Power Reading above allowed threshold ${allowed_power_diff}.
461
462
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600463Verify Power Reading Using REST
464 [Documentation] Verify power reading using REST.
465 [Arguments] ${power_reading}
466
Gunnar Mills948e2e22018-03-23 12:54:27 -0500467 # Description of argument(s):
Sweta Potthuri78dd1e12018-02-21 00:03:33 -0600468 # power_reading IPMI Power reading
469
470 ${power_reading_rest}= Read Attribute
471 ... ${SENSORS_URI}power/total_power Value
472
473 # Example of power reading via REST
474 # "CriticalAlarmHigh": 0,
475 # "CriticalAlarmLow": 0,
476 # "CriticalHigh": 3100000000,
477 # "CriticalLow": 0,
478 # "Scale": -6,
479 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
480 # "Value": 228000000,
481 # "WarningAlarmHigh": 0,
482 # "WarningAlarmLow": 0,
483 # "WarningHigh": 3050000000,
484 # "WarningLow": 0
485
486 # Get power value based on scale i.e. Value * (10 power Scale Value)
487 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
488 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
489 ${ipmi_rest_power_diff}=
490 ... Evaluate abs(${power_reading_rest} - ${power_reading})
491
492 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
493 ... msg=Power reading above allowed threshold ${allowed_power_diff}.
George Keishing02651f02018-04-11 02:07:16 -0500494
495
George Keishinge85113a2019-06-07 08:21:51 -0500496Set IPMI Restriction Mode
497 [Documentation] Set the IPMI restriction mode.
498 [Arguments] ${restriction_mode}
499
500 # Description of argument(s):
501 # restriction_mode IPMI valid restriction modes.
502
503 ${valueDict}= Create Dictionary data=${restriction_mode}
504
505 Write Attribute ${CONTROL_HOST_URI}restriction_mode/
506 ... RestrictionMode data=${valueDict}