Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation This suite is for testing general IPMI functions. |
| 3 | |
| 4 | Resource ../../lib/ipmi_client.robot |
| 5 | Resource ../../lib/openbmc_ffdc.robot |
George Keishing | 0825a11 | 2018-03-30 10:48:07 -0500 | [diff] [blame] | 6 | Resource ../../lib/boot_utils.robot |
George Keishing | 78ce8dc | 2018-03-30 11:49:06 -0500 | [diff] [blame] | 7 | Resource ../../lib/utils.robot |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 8 | Resource ../../lib/bmc_network_utils.robot |
George Keishing | d627380 | 2018-09-07 07:06:53 -0500 | [diff] [blame] | 9 | Resource ../../lib/logging_utils.robot |
George Keishing | 78ce8dc | 2018-03-30 11:49:06 -0500 | [diff] [blame] | 10 | Library ../../lib/ipmi_utils.py |
George Keishing | 0825a11 | 2018-03-30 10:48:07 -0500 | [diff] [blame] | 11 | Variables ../../data/ipmi_raw_cmd_table.py |
Rahul Maheshwari | df6f05d | 2018-09-04 03:48:37 -0500 | [diff] [blame] | 12 | Library ../../lib/gen_misc.py |
Tony Lee | 9bca44b | 2019-12-13 09:34:26 +0800 | [diff] [blame] | 13 | Library ../../lib/gen_robot_valid.py |
Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 14 | |
Michael Walsh | c9eb34e | 2019-01-23 11:08:43 -0600 | [diff] [blame] | 15 | Test Setup Log to Console ${EMPTY} |
Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 16 | Test Teardown FFDC On Test Case Fail |
| 17 | |
| 18 | *** Variables *** |
| 19 | |
Rahul Maheshwari | 901dcde | 2018-02-06 03:14:31 -0600 | [diff] [blame] | 20 | ${allowed_temp_diff}= ${1} |
Rahul Maheshwari | 615da15 | 2018-02-13 23:53:36 -0600 | [diff] [blame] | 21 | ${allowed_power_diff}= ${10} |
Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 22 | |
Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 23 | *** Test Cases *** |
| 24 | |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 25 | Verify Chassis Identify via IPMI |
| 26 | [Documentation] Verify "chassis identify" using IPMI command. |
| 27 | [Tags] Verify_Chassis_Identify_via_IPMI |
| 28 | |
| 29 | # Set to default "chassis identify" and verify that LED blinks for 15s. |
| 30 | Run IPMI Standard Command chassis identify |
Alvin Wang | 32f7b3d | 2019-07-25 02:05:39 -0500 | [diff] [blame] | 31 | Verify Identify LED State ${1} |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 32 | |
Tony Lee | 2afe998 | 2020-02-11 17:31:14 +0800 | [diff] [blame] | 33 | Sleep 18s |
Alvin Wang | 32f7b3d | 2019-07-25 02:05:39 -0500 | [diff] [blame] | 34 | Verify Identify LED State ${0} |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 35 | |
| 36 | # Set "chassis identify" to 10s and verify that the LED blinks for 10s. |
| 37 | Run IPMI Standard Command chassis identify 10 |
Alvin Wang | 32f7b3d | 2019-07-25 02:05:39 -0500 | [diff] [blame] | 38 | Verify Identify LED State ${1} |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 39 | |
Tony Lee | 2afe998 | 2020-02-11 17:31:14 +0800 | [diff] [blame] | 40 | Sleep 12s |
Alvin Wang | 32f7b3d | 2019-07-25 02:05:39 -0500 | [diff] [blame] | 41 | Verify Identify LED State ${0} |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 42 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 43 | |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 44 | Verify Chassis Identify Off And Force Identify On via IPMI |
| 45 | [Documentation] Verify "chassis identify" off |
| 46 | ... and "force identify on" via IPMI. |
| 47 | [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI |
| 48 | |
| 49 | # Set the LED to "Force Identify On". |
| 50 | Run IPMI Standard Command chassis identify force |
Alvin Wang | 32f7b3d | 2019-07-25 02:05:39 -0500 | [diff] [blame] | 51 | Verify Identify LED State ${1} |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 52 | |
| 53 | # Set "chassis identify" to 0 and verify that the LED turns off. |
| 54 | Run IPMI Standard Command chassis identify 0 |
Alvin Wang | 32f7b3d | 2019-07-25 02:05:39 -0500 | [diff] [blame] | 55 | Verify Identify LED State ${0} |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 56 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 57 | |
Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 58 | Test Watchdog Reset Via IPMI And Verify Using REST |
| 59 | [Documentation] Test watchdog reset via IPMI and verify using REST. |
| 60 | [Tags] Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST |
| 61 | |
| 62 | Initiate Host Boot |
| 63 | |
| 64 | Set Watchdog Enabled Using REST ${1} |
| 65 | |
| 66 | Watchdog Object Should Exist |
| 67 | |
| 68 | # Resetting the watchdog via IPMI. |
| 69 | Run IPMI Standard Command mc watchdog reset |
| 70 | |
| 71 | # Verify the watchdog is reset using REST after an interval of 1000ms. |
| 72 | Sleep 1000ms |
| 73 | ${watchdog_time_left}= |
| 74 | ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining |
| 75 | Should Be True |
| 76 | ... ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000} |
| 77 | ... msg=Watchdog timer didn't reset. |
| 78 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 79 | |
Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 80 | Test Watchdog Off Via IPMI And Verify Using REST |
| 81 | [Documentation] Test watchdog off via IPMI and verify using REST. |
| 82 | [Tags] Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST |
| 83 | |
| 84 | Initiate Host Boot |
| 85 | |
| 86 | Set Watchdog Enabled Using REST ${1} |
| 87 | |
| 88 | Watchdog Object Should Exist |
| 89 | |
| 90 | # Turn off the watchdog via IPMI. |
| 91 | Run IPMI Standard Command mc watchdog off |
| 92 | |
| 93 | # Verify the watchdog is off using REST |
| 94 | ${watchdog_state}= Read Attribute ${HOST_WATCHDOG_URI} Enabled |
| 95 | Should Be Equal ${watchdog_state} ${0} |
| 96 | ... msg=msg=Verification failed for watchdog off check. |
Rahul Maheshwari | 901dcde | 2018-02-06 03:14:31 -0600 | [diff] [blame] | 97 | |
| 98 | |
Rahul Maheshwari | abe13af | 2018-02-15 22:42:08 -0600 | [diff] [blame] | 99 | Test Power Reading Via IPMI Raw Command |
| 100 | [Documentation] Test power reading via IPMI raw command and verify |
| 101 | ... using REST. |
| 102 | [Tags] Test_Power_Reading_Via_IPMI_Raw_Command |
| 103 | |
| 104 | # Response data structure of power reading command output via IPMI. |
| 105 | # 1 Completion Code. Refer to section 8, DCMI Completion Codes. |
| 106 | # 2 Group Extension Identification = DCh |
| 107 | # 3:4 Current Power in watts |
| 108 | |
George Keishing | e78f1fd | 2018-09-04 13:34:59 -0500 | [diff] [blame] | 109 | REST Power On stack_mode=skip quiet=1 |
Rahul Maheshwari | abe13af | 2018-02-15 22:42:08 -0600 | [diff] [blame] | 110 | |
George Keishing | 04bf06c | 2018-10-05 08:28:50 -0500 | [diff] [blame] | 111 | Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading Via Raw Command |
Rahul Maheshwari | abe13af | 2018-02-15 22:42:08 -0600 | [diff] [blame] | 112 | |
| 113 | |
Rahul Maheshwari | 91a18ef | 2018-02-15 04:54:59 -0600 | [diff] [blame] | 114 | Test Baseboard Temperature Via IPMI |
| 115 | [Documentation] Test baseboard temperature via IPMI and verify using REST. |
| 116 | [Tags] Test_Baseboard_Temperature_Via_IPMI |
| 117 | |
| 118 | # Example of IPMI dcmi get_temp_reading output: |
| 119 | # Entity ID Entity Instance Temp. Readings |
| 120 | # Inlet air temperature(40h) 1 +19 C |
| 121 | # CPU temperature sensors(41h) 5 +51 C |
| 122 | # CPU temperature sensors(41h) 6 +50 C |
| 123 | # CPU temperature sensors(41h) 7 +50 C |
| 124 | # CPU temperature sensors(41h) 8 +50 C |
| 125 | # CPU temperature sensors(41h) 9 +50 C |
| 126 | # CPU temperature sensors(41h) 10 +48 C |
| 127 | # CPU temperature sensors(41h) 11 +49 C |
| 128 | # CPU temperature sensors(41h) 12 +47 C |
| 129 | # CPU temperature sensors(41h) 8 +50 C |
| 130 | # CPU temperature sensors(41h) 16 +51 C |
| 131 | # CPU temperature sensors(41h) 24 +50 C |
| 132 | # CPU temperature sensors(41h) 32 +43 C |
| 133 | # CPU temperature sensors(41h) 40 +43 C |
| 134 | # Baseboard temperature sensors(42h) 1 +35 C |
| 135 | |
| 136 | ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10 |
George Keishing | 77f1ad2 | 2018-07-23 12:39:28 -0500 | [diff] [blame] | 137 | Should Contain ${temp_reading} Baseboard temperature sensors |
| 138 | ... msg="Unable to get baseboard temperature via DCMI". |
Rahul Maheshwari | 91a18ef | 2018-02-15 04:54:59 -0600 | [diff] [blame] | 139 | ${baseboard_temp_line}= |
| 140 | ... Get Lines Containing String ${temp_reading} |
| 141 | ... Baseboard temperature case-insensitive=True |
| 142 | |
| 143 | ${baseboard_temp_ipmi}= Fetch From Right ${baseboard_temp_line} + |
| 144 | ${baseboard_temp_ipmi}= Remove String ${baseboard_temp_ipmi} ${SPACE}C |
| 145 | |
| 146 | ${baseboard_temp_rest}= Read Attribute |
| 147 | ... /xyz/openbmc_project/sensors/temperature/pcie Value |
| 148 | ${baseboard_temp_rest}= Evaluate ${baseboard_temp_rest}/1000 |
| 149 | |
| 150 | Should Be True |
| 151 | ... ${baseboard_temp_rest} - ${baseboard_temp_ipmi} <= ${allowed_temp_diff} |
| 152 | ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}. |
| 153 | |
| 154 | |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 155 | Verify Get Device ID |
| 156 | [Documentation] Verify get device ID command output. |
| 157 | [Tags] Verify_Get_Device_ID |
| 158 | |
| 159 | # Example of get device ID command output: |
| 160 | # Device ID : 0 |
| 161 | # Device Revision : 0 |
| 162 | # Firmware Revision : 2.01 |
| 163 | # IPMI Version : 2.0 |
| 164 | # Manufacturer ID : 42817 |
| 165 | # Manufacturer Name : Unknown (0xA741) |
| 166 | # Product ID : 16975 (0x424f) |
| 167 | # Product Name : Unknown (0x424F) |
| 168 | # Device Available : yes |
| 169 | # Provides Device SDRs : yes |
| 170 | # Additional Device Support : |
| 171 | # Sensor Device |
| 172 | # SEL Device |
| 173 | # FRU Inventory Device |
| 174 | # Chassis Device |
| 175 | # Aux Firmware Rev Info : |
George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 176 | # 0x04 |
| 177 | # 0x38 |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 178 | # 0x00 |
George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 179 | # 0x03 |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 180 | |
Tony Lee | 9bca44b | 2019-12-13 09:34:26 +0800 | [diff] [blame] | 181 | # Verify Manufacturer and Product IDs, etc. directly from json file. |
| 182 | ${device_id_config}= Get Device Id Config |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 183 | ${mc_info}= Get MC Info |
| 184 | |
Tony Lee | 9bca44b | 2019-12-13 09:34:26 +0800 | [diff] [blame] | 185 | Rprint Vars device_id_config mc_info |
| 186 | Valid Value ${mc_info['device_id']} [${device_id_config['id']}] |
| 187 | Valid Value ${mc_info['device_revision']} [${device_id_config['device_revision']}] |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 188 | |
Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 189 | # Get firmware revision from mc info command output i.e. 2.01 |
| 190 | ${ipmi_fw_major_version} ${ipmi_fw_minor_version}= |
| 191 | ... Split String ${mc_info['firmware_revision']} . |
| 192 | # Convert minor firmware version from BCD format to integer. i.e. 01 to 1 |
| 193 | ${ipmi_fw_minor_version}= Convert To Integer ${ipmi_fw_minor_version} |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 194 | |
George Keishing | e0a8128 | 2018-06-08 10:02:30 -0500 | [diff] [blame] | 195 | # Get BMC version from BMC CLI i.e. 2.2 from "v2.2-253-g00050f1" |
George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 196 | ${bmc_version_full}= Get BMC Version |
Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 197 | ${bmc_version}= |
George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 198 | ... Remove String Using Regexp ${bmc_version_full} ^[^0-9]+ [^0-9\.].* |
Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 199 | |
| 200 | # Get major and minor version from BMC version i.e. 2 and 1 from 2.1 |
George Keishing | c95e998 | 2019-01-14 09:27:45 -0600 | [diff] [blame] | 201 | @{major_minor_version}= Split String ${bmc_version} . |
Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 202 | |
George Keishing | c95e998 | 2019-01-14 09:27:45 -0600 | [diff] [blame] | 203 | Should Be Equal As Strings ${ipmi_fw_major_version} ${major_minor_version[0]} |
George Keishing | 2ee2f00 | 2019-02-16 09:36:02 -0600 | [diff] [blame] | 204 | ... msg=Major version mismatch. |
George Keishing | c95e998 | 2019-01-14 09:27:45 -0600 | [diff] [blame] | 205 | Should Be Equal As Strings ${ipmi_fw_minor_version} ${major_minor_version[1]} |
George Keishing | 2ee2f00 | 2019-02-16 09:36:02 -0600 | [diff] [blame] | 206 | ... msg=Minor version mismatch. |
Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 207 | |
Tony Lee | 9bca44b | 2019-12-13 09:34:26 +0800 | [diff] [blame] | 208 | Valid Value mc_info['ipmi_version'] ['2.0'] |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 209 | |
Tony Lee | 9bca44b | 2019-12-13 09:34:26 +0800 | [diff] [blame] | 210 | Valid Value ${mc_info['manufacturer_id']} [${device_id_config['manuf_id']}] |
| 211 | ${product_id_hex} = Convert To Hex ${device_id_config['prod_id']} lowercase=True |
| 212 | Valid Value mc_info['product_id'] ['${device_id_config['prod_id']} (0x${product_id_hex})'] |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 213 | |
Tony Lee | 9bca44b | 2019-12-13 09:34:26 +0800 | [diff] [blame] | 214 | Valid Value mc_info['device_available'] ['yes'] |
| 215 | Valid Value mc_info['provides_device_sdrs'] ['yes'] |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 216 | Should Contain ${mc_info['additional_device_support']} Sensor Device |
| 217 | Should Contain ${mc_info['additional_device_support']} SEL Device |
| 218 | Should Contain |
| 219 | ... ${mc_info['additional_device_support']} FRU Inventory Device |
| 220 | Should Contain ${mc_info['additional_device_support']} Chassis Device |
George Keishing | b746d3f | 2018-04-19 10:53:10 -0500 | [diff] [blame] | 221 | |
George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 222 | # Auxiliary revision data verification. |
| 223 | ${aux_version}= Get Aux Version ${bmc_version_full} |
| 224 | |
| 225 | # From aux_firmware_rev_info field ['0x04', '0x38', '0x00', '0x03'] |
| 226 | ${bmc_aux_version}= Catenate |
| 227 | ... SEPARATOR= |
| 228 | ... ${mc_info['aux_firmware_rev_info'][0][2:]} |
| 229 | ... ${mc_info['aux_firmware_rev_info'][1][2:]} |
| 230 | ... ${mc_info['aux_firmware_rev_info'][2][2:]} |
| 231 | ... ${mc_info['aux_firmware_rev_info'][3][2:]} |
| 232 | |
| 233 | Should Be Equal As Integers |
| 234 | ... ${bmc_aux_version} ${aux_version} |
| 235 | ... msg=BMC aux version ${bmc_aux_version} does not match expected value of ${aux_version}. |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 236 | |
| 237 | |
George Keishing | e85113a | 2019-06-07 08:21:51 -0500 | [diff] [blame] | 238 | Test IPMI Restriction Mode |
| 239 | [Documentation] Set restricition mode via REST and verify IPMI operation. |
| 240 | [Tags] Test_IPMI_Restriction_Mode |
| 241 | # Forego normal test setup: |
| 242 | [Setup] No Operation |
| 243 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 244 | ... Set IPMI Restriction Mode xyz.openbmc_project.Control.Security.RestrictionMode.Modes.None |
| 245 | |
| 246 | # By default no IPMI operations are restricted. |
| 247 | # /xyz/openbmc_project/control/host0/restriction_mode/attr/RestrictionMode |
| 248 | # { |
| 249 | # "data": "xyz.openbmc_project.Control.Security.RestrictionMode.Modes.None", |
| 250 | # "message": "200 OK", |
| 251 | # "status": "ok" |
| 252 | # } |
| 253 | |
| 254 | # Refer to: #openbmc/phosphor-host-ipmid/blob/master/host-ipmid-whitelist.conf |
| 255 | # Set the restriction mode to Whitelist IPMI commands only: |
| 256 | # /xyz/openbmc_project/control/host0/restriction_mode/attr/RestrictionMode |
| 257 | # { |
| 258 | # "data": "xyz.openbmc_project.Control.Security.RestrictionMode.Modes.Whitelist", |
| 259 | # "message": "200 OK", |
| 260 | # "status": "ok" |
| 261 | # } |
| 262 | |
| 263 | Set IPMI Restriction Mode xyz.openbmc_project.Control.Security.RestrictionMode.Modes.Whitelist |
| 264 | |
| 265 | # Attempt white-listed operation expecting success. |
| 266 | IPMI Power On |
| 267 | |
| 268 | # Attempt non white-listed operation expecting failure. |
| 269 | Run Keyword And Expect Error *Insufficient privilege level* |
Rahul Maheshwari | 4019398 | 2019-10-11 00:55:08 -0500 | [diff] [blame] | 270 | ... Run Inband IPMI Standard Command lan set 1 access on |
George Keishing | e85113a | 2019-06-07 08:21:51 -0500 | [diff] [blame] | 271 | |
| 272 | |
Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 273 | *** Keywords *** |
Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 274 | |
Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 275 | Set Watchdog Enabled Using REST |
| 276 | [Documentation] Set watchdog Enabled field using REST. |
| 277 | [Arguments] ${value} |
| 278 | |
| 279 | # Description of argument(s): |
| 280 | # value Integer value (eg. "0-Disabled", "1-Enabled"). |
| 281 | |
| 282 | ${value_dict}= Create Dictionary data=${value} |
Steven Sombar | aaaab22 | 2018-12-19 13:16:23 -0600 | [diff] [blame] | 283 | ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}attr/Enabled |
Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 284 | ... data=${value_dict} |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 285 | |
| 286 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 287 | Fetch Details From LAN Print |
| 288 | [Documentation] Fetch details from LAN print. |
| 289 | [Arguments] ${field_name} |
| 290 | |
| 291 | # Description of argument(s): |
| 292 | # ${field_name} Field name to be fetched from LAN print |
| 293 | # (e.g. "MAC Address", "Source"). |
| 294 | |
Rahul Maheshwari | d8037d3 | 2018-12-17 00:59:57 -0600 | [diff] [blame] | 295 | ${stdout}= Run IPMI Standard Command lan print |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 296 | ${fetch_value}= Get Lines Containing String ${stdout} ${field_name} |
| 297 | ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE} |
| 298 | [Return] ${value_fetch} |
| 299 | |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 300 | |
George Keishing | e78f1fd | 2018-09-04 13:34:59 -0500 | [diff] [blame] | 301 | Verify Power Reading Via Raw Command |
| 302 | [Documentation] Get dcmi power reading via IPMI raw command. |
| 303 | |
| 304 | ${ipmi_raw_output}= Run IPMI Standard Command |
| 305 | ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]} |
| 306 | |
| 307 | @{raw_output_list}= Split String ${ipmi_raw_output} ${SPACE} |
| 308 | |
| 309 | # On successful execution of raw IPMI power reading command, completion |
| 310 | # code does not come in output. So current power value will start from 2 |
| 311 | # byte instead of 3. |
| 312 | |
| 313 | ${power_reading_ipmi_raw_3_item}= Get From List ${raw_output_list} 2 |
| 314 | ${power_reading_ipmi_raw_3_item}= |
| 315 | ... Convert To Integer 0x${power_reading_ipmi_raw_3_item} |
| 316 | |
| 317 | ${power_reading_rest}= Read Attribute |
| 318 | ... ${SENSORS_URI}power/total_power Value |
| 319 | |
| 320 | # Example of power reading via REST |
| 321 | # "CriticalAlarmHigh": 0, |
| 322 | # "CriticalAlarmLow": 0, |
| 323 | # "CriticalHigh": 3100000000, |
| 324 | # "CriticalLow": 0, |
| 325 | # "Scale": -6, |
| 326 | # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts", |
| 327 | # "Value": 228000000, |
| 328 | # "WarningAlarmHigh": 0, |
| 329 | # "WarningAlarmLow": 0, |
| 330 | # "WarningHigh": 3050000000, |
| 331 | # "WarningLow": 0 |
| 332 | |
| 333 | # Get power value based on scale i.e. Value * (10 power Scale Value) |
| 334 | # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000 |
| 335 | |
| 336 | ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000 |
| 337 | ${ipmi_rest_power_diff}= |
| 338 | ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi_raw_3_item}) |
| 339 | |
| 340 | Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff} |
| 341 | ... msg=Power Reading above allowed threshold ${allowed_power_diff}. |
| 342 | |
| 343 | |
George Keishing | e85113a | 2019-06-07 08:21:51 -0500 | [diff] [blame] | 344 | Set IPMI Restriction Mode |
| 345 | [Documentation] Set the IPMI restriction mode. |
| 346 | [Arguments] ${restriction_mode} |
| 347 | |
| 348 | # Description of argument(s): |
| 349 | # restriction_mode IPMI valid restriction modes. |
| 350 | |
| 351 | ${valueDict}= Create Dictionary data=${restriction_mode} |
| 352 | |
| 353 | Write Attribute ${CONTROL_HOST_URI}restriction_mode/ |
| 354 | ... RestrictionMode data=${valueDict} |