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 |
Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 13 | |
Michael Walsh | c9eb34e | 2019-01-23 11:08:43 -0600 | [diff] [blame] | 14 | Test Setup Log to Console ${EMPTY} |
Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 15 | Test Teardown FFDC On Test Case Fail |
| 16 | |
| 17 | *** Variables *** |
| 18 | |
Rahul Maheshwari | 901dcde | 2018-02-06 03:14:31 -0600 | [diff] [blame] | 19 | ${allowed_temp_diff}= ${1} |
Rahul Maheshwari | 615da15 | 2018-02-13 23:53:36 -0600 | [diff] [blame] | 20 | ${allowed_power_diff}= ${10} |
Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 21 | |
Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 22 | *** Test Cases *** |
| 23 | |
Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 24 | Set Asset Tag With Valid String Length Via REST |
| 25 | [Documentation] Set valid asset tag via REST and verify. |
| 26 | [Tags] Set_Asset_Tag_With_Valid_String_Length_Via_REST |
| 27 | |
| 28 | ${random_string}= Generate Random String 63 |
| 29 | ${args}= Create Dictionary data=${random_string} |
| 30 | Write Attribute /xyz/openbmc_project/inventory/system AssetTag |
| 31 | ... data=${args} |
| 32 | |
| 33 | ${asset_tag}= Read Attribute /xyz/openbmc_project/inventory/system |
| 34 | ... AssetTag |
| 35 | Should Be Equal As Strings ${asset_tag} ${random_string} |
| 36 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 37 | |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 38 | Verify Chassis Identify via IPMI |
| 39 | [Documentation] Verify "chassis identify" using IPMI command. |
| 40 | [Tags] Verify_Chassis_Identify_via_IPMI |
| 41 | |
| 42 | # Set to default "chassis identify" and verify that LED blinks for 15s. |
| 43 | Run IPMI Standard Command chassis identify |
Alvin Wang | 32f7b3d | 2019-07-25 02:05:39 -0500 | [diff] [blame] | 44 | Verify Identify LED State ${1} |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 45 | |
| 46 | Sleep 15s |
Alvin Wang | 32f7b3d | 2019-07-25 02:05:39 -0500 | [diff] [blame] | 47 | Verify Identify LED State ${0} |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 48 | |
| 49 | # Set "chassis identify" to 10s and verify that the LED blinks for 10s. |
| 50 | Run IPMI Standard Command chassis identify 10 |
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 | Sleep 10s |
Alvin Wang | 32f7b3d | 2019-07-25 02:05:39 -0500 | [diff] [blame] | 54 | Verify Identify LED State ${0} |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 55 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 56 | |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 57 | Verify Chassis Identify Off And Force Identify On via IPMI |
| 58 | [Documentation] Verify "chassis identify" off |
| 59 | ... and "force identify on" via IPMI. |
| 60 | [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI |
| 61 | |
| 62 | # Set the LED to "Force Identify On". |
| 63 | Run IPMI Standard Command chassis identify force |
Alvin Wang | 32f7b3d | 2019-07-25 02:05:39 -0500 | [diff] [blame] | 64 | Verify Identify LED State ${1} |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 65 | |
| 66 | # Set "chassis identify" to 0 and verify that the LED turns off. |
| 67 | Run IPMI Standard Command chassis identify 0 |
Alvin Wang | 32f7b3d | 2019-07-25 02:05:39 -0500 | [diff] [blame] | 68 | Verify Identify LED State ${0} |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 69 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 70 | |
Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 71 | Test Watchdog Reset Via IPMI And Verify Using REST |
| 72 | [Documentation] Test watchdog reset via IPMI and verify using REST. |
| 73 | [Tags] Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST |
| 74 | |
| 75 | Initiate Host Boot |
| 76 | |
| 77 | Set Watchdog Enabled Using REST ${1} |
| 78 | |
| 79 | Watchdog Object Should Exist |
| 80 | |
| 81 | # Resetting the watchdog via IPMI. |
| 82 | Run IPMI Standard Command mc watchdog reset |
| 83 | |
| 84 | # Verify the watchdog is reset using REST after an interval of 1000ms. |
| 85 | Sleep 1000ms |
| 86 | ${watchdog_time_left}= |
| 87 | ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining |
| 88 | Should Be True |
| 89 | ... ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000} |
| 90 | ... msg=Watchdog timer didn't reset. |
| 91 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 92 | |
Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 93 | Test Watchdog Off Via IPMI And Verify Using REST |
| 94 | [Documentation] Test watchdog off via IPMI and verify using REST. |
| 95 | [Tags] Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST |
| 96 | |
| 97 | Initiate Host Boot |
| 98 | |
| 99 | Set Watchdog Enabled Using REST ${1} |
| 100 | |
| 101 | Watchdog Object Should Exist |
| 102 | |
| 103 | # Turn off the watchdog via IPMI. |
| 104 | Run IPMI Standard Command mc watchdog off |
| 105 | |
| 106 | # Verify the watchdog is off using REST |
| 107 | ${watchdog_state}= Read Attribute ${HOST_WATCHDOG_URI} Enabled |
| 108 | Should Be Equal ${watchdog_state} ${0} |
| 109 | ... msg=msg=Verification failed for watchdog off check. |
Rahul Maheshwari | 901dcde | 2018-02-06 03:14:31 -0600 | [diff] [blame] | 110 | |
| 111 | |
| 112 | Test Ambient Temperature Via IPMI |
| 113 | [Documentation] Test ambient temperature via IPMI and verify using REST. |
| 114 | [Tags] Test_Ambient_Temperature_Via_IPMI |
| 115 | |
| 116 | # Entity ID Entity Instance Temp. Readings |
| 117 | # Inlet air temperature(40h) 1 +19 C |
| 118 | # CPU temperature sensors(41h) 5 +51 C |
| 119 | # CPU temperature sensors(41h) 6 +50 C |
| 120 | # CPU temperature sensors(41h) 7 +50 C |
| 121 | # CPU temperature sensors(41h) 8 +50 C |
| 122 | # CPU temperature sensors(41h) 9 +50 C |
| 123 | # CPU temperature sensors(41h) 10 +48 C |
| 124 | # CPU temperature sensors(41h) 11 +49 C |
| 125 | # CPU temperature sensors(41h) 12 +47 C |
| 126 | # CPU temperature sensors(41h) 8 +50 C |
| 127 | # CPU temperature sensors(41h) 16 +51 C |
| 128 | # CPU temperature sensors(41h) 24 +50 C |
| 129 | # CPU temperature sensors(41h) 32 +43 C |
| 130 | # CPU temperature sensors(41h) 40 +43 C |
| 131 | # Baseboard temperature sensors(42h) 1 +35 C |
| 132 | |
| 133 | ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10 |
George Keishing | 77f1ad2 | 2018-07-23 12:39:28 -0500 | [diff] [blame] | 134 | Should Contain ${temp_reading} Inlet air temperature |
| 135 | ... msg="Unable to get inlet temperature via DCMI". |
Rahul Maheshwari | 901dcde | 2018-02-06 03:14:31 -0600 | [diff] [blame] | 136 | ${ambient_temp_line}= |
| 137 | ... Get Lines Containing String ${temp_reading} |
| 138 | ... Inlet air temperature case-insensitive |
| 139 | |
| 140 | ${ambient_temp_ipmi}= Fetch From Right ${ambient_temp_line} + |
| 141 | ${ambient_temp_ipmi}= Remove String ${ambient_temp_ipmi} ${SPACE}C |
| 142 | |
| 143 | ${ambient_temp_rest}= Read Attribute |
| 144 | ... ${SENSORS_URI}temperature/ambient Value |
| 145 | |
| 146 | # Example of ambient temperature via REST |
| 147 | # "CriticalAlarmHigh": 0, |
| 148 | # "CriticalAlarmLow": 0, |
| 149 | # "CriticalHigh": 35000, |
| 150 | # "CriticalLow": 0, |
| 151 | # "Scale": -3, |
| 152 | # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC", |
| 153 | # "Value": 21775, |
| 154 | # "WarningAlarmHigh": 0, |
| 155 | # "WarningAlarmLow": 0, |
| 156 | # "WarningHigh": 25000, |
| 157 | # "WarningLow": 0 |
| 158 | |
| 159 | # Get temperature value based on scale i.e. Value * (10 power Scale Value) |
| 160 | # e.g. from above case 21775 * (10 power -3) = 21775/1000 |
| 161 | |
| 162 | ${ambient_temp_rest}= Evaluate ${ambient_temp_rest}/1000 |
| 163 | ${ipmi_rest_temp_diff}= |
| 164 | ... Evaluate abs(${ambient_temp_rest} - ${ambient_temp_ipmi}) |
| 165 | |
| 166 | Should Be True ${ipmi_rest_temp_diff} <= ${allowed_temp_diff} |
| 167 | ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}. |
| 168 | |
| 169 | |
Rahul Maheshwari | 4355663 | 2018-02-05 23:42:52 -0600 | [diff] [blame] | 170 | Verify Get DCMI Capabilities |
| 171 | [Documentation] Verify get DCMI capabilities command output. |
| 172 | [Tags] Verify_Get_DCMI_Capabilities |
| 173 | |
| 174 | ${cmd_output}= Run IPMI Standard Command dcmi discover |
| 175 | |
| 176 | @{supported_capabilities}= Create List |
| 177 | # Supported DCMI capabilities: |
George Keishing | 2ee2f00 | 2019-02-16 09:36:02 -0600 | [diff] [blame] | 178 | ... Mandatory platform capabilities |
| 179 | ... Optional platform capabilities |
Rahul Maheshwari | 4355663 | 2018-02-05 23:42:52 -0600 | [diff] [blame] | 180 | ... Power management available |
George Keishing | 2ee2f00 | 2019-02-16 09:36:02 -0600 | [diff] [blame] | 181 | ... Managebility access capabilities |
Rahul Maheshwari | 4355663 | 2018-02-05 23:42:52 -0600 | [diff] [blame] | 182 | ... In-band KCS channel available |
| 183 | # Mandatory platform attributes: |
| 184 | ... 200 SEL entries |
| 185 | ... SEL automatic rollover is enabled |
| 186 | # Optional Platform Attributes: |
| 187 | ... Slave address of device: 0h (8bits)(Satellite/External controller) |
| 188 | ... Channel number is 0h (Primary BMC) |
| 189 | ... Device revision is 0 |
| 190 | # Manageability Access Attributes: |
| 191 | ... Primary LAN channel number: 1 is available |
| 192 | ... Secondary LAN channel is not available for OOB |
| 193 | ... No serial channel is available |
| 194 | |
| 195 | :FOR ${capability} IN @{supported_capabilities} |
| 196 | \ Should Contain ${cmd_output} ${capability} ignore_case=True |
| 197 | ... msg=Supported DCMI capabilities not present. |
| 198 | |
| 199 | |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 200 | Test Power Reading Via IPMI With Host Off |
| 201 | [Documentation] Test power reading via IPMI with host off state and |
| 202 | ... verify using REST. |
| 203 | [Tags] Test_Power_Reading_Via_IPMI_With_Host_Off |
Rahul Maheshwari | 615da15 | 2018-02-13 23:53:36 -0600 | [diff] [blame] | 204 | |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 205 | REST Power Off stack_mode=skip quiet=1 |
Rahul Maheshwari | 615da15 | 2018-02-13 23:53:36 -0600 | [diff] [blame] | 206 | |
George Keishing | 04bf06c | 2018-10-05 08:28:50 -0500 | [diff] [blame] | 207 | Wait Until Keyword Succeeds 1 min 30 sec Verify Power Reading |
George Keishing | e78f1fd | 2018-09-04 13:34:59 -0500 | [diff] [blame] | 208 | |
| 209 | |
| 210 | Test Power Reading Via IPMI With Host Booted |
| 211 | [Documentation] Test power reading via IPMI with host booted state and |
| 212 | ... verify using REST. |
| 213 | [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted |
| 214 | |
| 215 | REST Power On stack_mode=skip quiet=1 |
| 216 | |
| 217 | # For a good power reading take a 3 samples for 15 seconds interval and |
| 218 | # average it out. |
| 219 | |
George Keishing | 04bf06c | 2018-10-05 08:28:50 -0500 | [diff] [blame] | 220 | Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading |
Rahul Maheshwari | 615da15 | 2018-02-13 23:53:36 -0600 | [diff] [blame] | 221 | |
| 222 | |
Rahul Maheshwari | abe13af | 2018-02-15 22:42:08 -0600 | [diff] [blame] | 223 | Test Power Reading Via IPMI Raw Command |
| 224 | [Documentation] Test power reading via IPMI raw command and verify |
| 225 | ... using REST. |
| 226 | [Tags] Test_Power_Reading_Via_IPMI_Raw_Command |
| 227 | |
| 228 | # Response data structure of power reading command output via IPMI. |
| 229 | # 1 Completion Code. Refer to section 8, DCMI Completion Codes. |
| 230 | # 2 Group Extension Identification = DCh |
| 231 | # 3:4 Current Power in watts |
| 232 | |
George Keishing | e78f1fd | 2018-09-04 13:34:59 -0500 | [diff] [blame] | 233 | REST Power On stack_mode=skip quiet=1 |
Rahul Maheshwari | abe13af | 2018-02-15 22:42:08 -0600 | [diff] [blame] | 234 | |
George Keishing | 04bf06c | 2018-10-05 08:28:50 -0500 | [diff] [blame] | 235 | 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] | 236 | |
| 237 | |
Rahul Maheshwari | 91a18ef | 2018-02-15 04:54:59 -0600 | [diff] [blame] | 238 | Test Baseboard Temperature Via IPMI |
| 239 | [Documentation] Test baseboard temperature via IPMI and verify using REST. |
| 240 | [Tags] Test_Baseboard_Temperature_Via_IPMI |
| 241 | |
| 242 | # Example of IPMI dcmi get_temp_reading output: |
| 243 | # Entity ID Entity Instance Temp. Readings |
| 244 | # Inlet air temperature(40h) 1 +19 C |
| 245 | # CPU temperature sensors(41h) 5 +51 C |
| 246 | # CPU temperature sensors(41h) 6 +50 C |
| 247 | # CPU temperature sensors(41h) 7 +50 C |
| 248 | # CPU temperature sensors(41h) 8 +50 C |
| 249 | # CPU temperature sensors(41h) 9 +50 C |
| 250 | # CPU temperature sensors(41h) 10 +48 C |
| 251 | # CPU temperature sensors(41h) 11 +49 C |
| 252 | # CPU temperature sensors(41h) 12 +47 C |
| 253 | # CPU temperature sensors(41h) 8 +50 C |
| 254 | # CPU temperature sensors(41h) 16 +51 C |
| 255 | # CPU temperature sensors(41h) 24 +50 C |
| 256 | # CPU temperature sensors(41h) 32 +43 C |
| 257 | # CPU temperature sensors(41h) 40 +43 C |
| 258 | # Baseboard temperature sensors(42h) 1 +35 C |
| 259 | |
| 260 | ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10 |
George Keishing | 77f1ad2 | 2018-07-23 12:39:28 -0500 | [diff] [blame] | 261 | Should Contain ${temp_reading} Baseboard temperature sensors |
| 262 | ... msg="Unable to get baseboard temperature via DCMI". |
Rahul Maheshwari | 91a18ef | 2018-02-15 04:54:59 -0600 | [diff] [blame] | 263 | ${baseboard_temp_line}= |
| 264 | ... Get Lines Containing String ${temp_reading} |
| 265 | ... Baseboard temperature case-insensitive=True |
| 266 | |
| 267 | ${baseboard_temp_ipmi}= Fetch From Right ${baseboard_temp_line} + |
| 268 | ${baseboard_temp_ipmi}= Remove String ${baseboard_temp_ipmi} ${SPACE}C |
| 269 | |
| 270 | ${baseboard_temp_rest}= Read Attribute |
| 271 | ... /xyz/openbmc_project/sensors/temperature/pcie Value |
| 272 | ${baseboard_temp_rest}= Evaluate ${baseboard_temp_rest}/1000 |
| 273 | |
| 274 | Should Be True |
| 275 | ... ${baseboard_temp_rest} - ${baseboard_temp_ipmi} <= ${allowed_temp_diff} |
| 276 | ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}. |
| 277 | |
| 278 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 279 | Retrieve Default Gateway Via IPMI And Verify Using REST |
| 280 | [Documentation] Retrieve default gateway from LAN print using IPMI. |
| 281 | [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify_Using_REST |
| 282 | |
| 283 | # Fetch "Default Gateway" from IPMI LAN print. |
| 284 | ${default_gateway_ipmi}= Fetch Details From LAN Print Default Gateway IP |
| 285 | |
| 286 | # Verify "Default Gateway" using REST. |
Steven Sombar | a8800da | 2018-12-18 16:19:05 -0600 | [diff] [blame] | 287 | Read Attribute ${NETWORK_MANAGER}config DefaultGateway |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 288 | ... expected_value=${default_gateway_ipmi} |
| 289 | |
| 290 | |
| 291 | Retrieve MAC Address Via IPMI And Verify Using REST |
| 292 | [Documentation] Retrieve MAC Address from LAN print using IPMI. |
| 293 | [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_REST |
| 294 | |
| 295 | # Fetch "MAC Address" from IPMI LAN print. |
| 296 | ${mac_address_ipmi}= Fetch Details From LAN Print MAC Address |
| 297 | |
| 298 | # Verify "MAC Address" using REST. |
| 299 | ${mac_address_rest}= Get BMC MAC Address |
| 300 | Should Be Equal ${mac_address_ipmi} ${mac_address_rest} |
| 301 | ... msg=Verification of MAC address from lan print using IPMI failed. |
| 302 | |
| 303 | |
| 304 | Retrieve Network Mode Via IPMI And Verify Using REST |
| 305 | [Documentation] Retrieve network mode from LAN print using IPMI. |
| 306 | [Tags] Retrieve_Network_Mode_Via_IPMI_And_Verify_Using_REST |
| 307 | |
| 308 | # Fetch "Mode" from IPMI LAN print. |
| 309 | ${network_mode_ipmi}= Fetch Details From LAN Print Source |
| 310 | |
| 311 | # Verify "Mode" using REST. |
| 312 | ${network_mode_rest}= Read Attribute |
Steven Sombar | a8800da | 2018-12-18 16:19:05 -0600 | [diff] [blame] | 313 | ... ${NETWORK_MANAGER}eth0 DHCPEnabled |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 314 | Run Keyword If '${network_mode_ipmi}' == 'Static Address' |
| 315 | ... Should Be Equal ${network_mode_rest} ${0} |
| 316 | ... msg=Verification of network setting failed. |
| 317 | ... ELSE IF '${network_mode_ipmi}' == 'DHCP' |
| 318 | ... Should Be Equal ${network_mode_rest} ${1} |
| 319 | ... msg=Verification of network setting failed. |
| 320 | |
| 321 | |
| 322 | Retrieve IP Address Via IPMI And Verify With BMC Details |
| 323 | [Documentation] Retrieve IP address from LAN print using IPMI. |
| 324 | [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_With_BMC_Details |
| 325 | |
| 326 | # Fetch "IP Address" from IPMI LAN print. |
| 327 | ${ip_addr_ipmi}= Fetch Details From LAN Print IP Address |
| 328 | |
| 329 | # Verify the IP address retrieved via IPMI with BMC IPs. |
| 330 | ${ip_address_rest}= Get BMC IP Info |
| 331 | Validate IP On BMC ${ip_addr_ipmi} ${ip_address_rest} |
| 332 | |
| 333 | |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 334 | Verify Get Device ID |
| 335 | [Documentation] Verify get device ID command output. |
| 336 | [Tags] Verify_Get_Device_ID |
| 337 | |
| 338 | # Example of get device ID command output: |
| 339 | # Device ID : 0 |
| 340 | # Device Revision : 0 |
| 341 | # Firmware Revision : 2.01 |
| 342 | # IPMI Version : 2.0 |
| 343 | # Manufacturer ID : 42817 |
| 344 | # Manufacturer Name : Unknown (0xA741) |
| 345 | # Product ID : 16975 (0x424f) |
| 346 | # Product Name : Unknown (0x424F) |
| 347 | # Device Available : yes |
| 348 | # Provides Device SDRs : yes |
| 349 | # Additional Device Support : |
| 350 | # Sensor Device |
| 351 | # SEL Device |
| 352 | # FRU Inventory Device |
| 353 | # Chassis Device |
| 354 | # Aux Firmware Rev Info : |
George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 355 | # 0x04 |
| 356 | # 0x38 |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 357 | # 0x00 |
George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 358 | # 0x03 |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 359 | |
| 360 | ${mc_info}= Get MC Info |
| 361 | |
| 362 | Should Be Equal ${mc_info['device_id']} 0 |
| 363 | Should Be Equal ${mc_info['device_revision']} 0 |
| 364 | |
Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 365 | # Get firmware revision from mc info command output i.e. 2.01 |
| 366 | ${ipmi_fw_major_version} ${ipmi_fw_minor_version}= |
| 367 | ... Split String ${mc_info['firmware_revision']} . |
| 368 | # Convert minor firmware version from BCD format to integer. i.e. 01 to 1 |
| 369 | ${ipmi_fw_minor_version}= Convert To Integer ${ipmi_fw_minor_version} |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 370 | |
George Keishing | e0a8128 | 2018-06-08 10:02:30 -0500 | [diff] [blame] | 371 | # 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] | 372 | ${bmc_version_full}= Get BMC Version |
Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 373 | ${bmc_version}= |
George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 374 | ... Remove String Using Regexp ${bmc_version_full} ^[^0-9]+ [^0-9\.].* |
Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 375 | |
| 376 | # 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] | 377 | @{major_minor_version}= Split String ${bmc_version} . |
Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 378 | |
George Keishing | c95e998 | 2019-01-14 09:27:45 -0600 | [diff] [blame] | 379 | 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] | 380 | ... msg=Major version mismatch. |
George Keishing | c95e998 | 2019-01-14 09:27:45 -0600 | [diff] [blame] | 381 | 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] | 382 | ... msg=Minor version mismatch. |
Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 383 | |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 384 | Should Be Equal ${mc_info['ipmi_version']} 2.0 |
| 385 | |
Gunnar Mills | 917ba1a | 2018-04-08 16:42:12 -0500 | [diff] [blame] | 386 | # TODO: Verify Manufacturer and Product IDs directly from json file. |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 387 | # Reference : openbmc/openbmc-test-automation#1244 |
| 388 | Should Be Equal ${mc_info['manufacturer_id']} 42817 |
| 389 | Should Be Equal ${mc_info['product_id']} 16975 (0x424f) |
| 390 | |
| 391 | Should Be Equal ${mc_info['device_available']} yes |
| 392 | Should Be Equal ${mc_info['provides_device_sdrs']} yes |
| 393 | Should Contain ${mc_info['additional_device_support']} Sensor Device |
| 394 | Should Contain ${mc_info['additional_device_support']} SEL Device |
| 395 | Should Contain |
| 396 | ... ${mc_info['additional_device_support']} FRU Inventory Device |
| 397 | Should Contain ${mc_info['additional_device_support']} Chassis Device |
George Keishing | b746d3f | 2018-04-19 10:53:10 -0500 | [diff] [blame] | 398 | |
George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 399 | # Auxiliary revision data verification. |
| 400 | ${aux_version}= Get Aux Version ${bmc_version_full} |
| 401 | |
| 402 | # From aux_firmware_rev_info field ['0x04', '0x38', '0x00', '0x03'] |
| 403 | ${bmc_aux_version}= Catenate |
| 404 | ... SEPARATOR= |
| 405 | ... ${mc_info['aux_firmware_rev_info'][0][2:]} |
| 406 | ... ${mc_info['aux_firmware_rev_info'][1][2:]} |
| 407 | ... ${mc_info['aux_firmware_rev_info'][2][2:]} |
| 408 | ... ${mc_info['aux_firmware_rev_info'][3][2:]} |
| 409 | |
| 410 | Should Be Equal As Integers |
| 411 | ... ${bmc_aux_version} ${aux_version} |
| 412 | ... 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] | 413 | |
| 414 | |
George Keishing | 02651f0 | 2018-04-11 02:07:16 -0500 | [diff] [blame] | 415 | Test Valid IPMI Channels Supported |
| 416 | [Documentation] Verify IPMI channels supported on a given system. |
| 417 | [Tags] Test_Valid_IPMI_Channels_Supported |
| 418 | |
| 419 | ${channel_count}= Get Physical Network Interface Count |
| 420 | |
| 421 | # Note: IPMI network channel logically starts from 1. |
| 422 | :FOR ${channel_number} IN RANGE 1 ${channel_count} |
Rahul Maheshwari | 20f3bf7 | 2018-12-18 04:24:20 -0600 | [diff] [blame] | 423 | \ Run IPMI Standard Command lan print ${channel_number} |
George Keishing | 02651f0 | 2018-04-11 02:07:16 -0500 | [diff] [blame] | 424 | |
| 425 | |
| 426 | Test Invalid IPMI Channel Response |
| 427 | [Documentation] Verify invalid IPMI channels supported response. |
| 428 | [Tags] Test_Invalid_IPMI_Channel_Response |
| 429 | |
| 430 | ${channel_count}= Get Physical Network Interface Count |
| 431 | |
| 432 | # To target invalid channel, increment count. |
| 433 | ${channel_number}= Evaluate ${channel_count} + 1 |
| 434 | |
| 435 | # Example of invalid channel: |
George Keishing | 72d0ac8 | 2018-09-20 09:33:01 -0500 | [diff] [blame] | 436 | # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3 |
George Keishing | 02651f0 | 2018-04-11 02:07:16 -0500 | [diff] [blame] | 437 | # Get Channel Info command failed: Parameter out of range |
| 438 | # Invalid channel: 3 |
| 439 | |
| 440 | ${stdout}= Run External IPMI Standard Command |
| 441 | ... lan print ${channel_number} fail_on_err=${0} |
| 442 | Should Contain ${stdout} Invalid channel |
| 443 | ... msg=IPMI channel ${channel_number} is invalid but seen working. |
| 444 | |
| 445 | |
George Keishing | e85113a | 2019-06-07 08:21:51 -0500 | [diff] [blame] | 446 | Test IPMI Restriction Mode |
| 447 | [Documentation] Set restricition mode via REST and verify IPMI operation. |
| 448 | [Tags] Test_IPMI_Restriction_Mode |
| 449 | # Forego normal test setup: |
| 450 | [Setup] No Operation |
| 451 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 452 | ... Set IPMI Restriction Mode xyz.openbmc_project.Control.Security.RestrictionMode.Modes.None |
| 453 | |
| 454 | # By default no IPMI operations are restricted. |
| 455 | # /xyz/openbmc_project/control/host0/restriction_mode/attr/RestrictionMode |
| 456 | # { |
| 457 | # "data": "xyz.openbmc_project.Control.Security.RestrictionMode.Modes.None", |
| 458 | # "message": "200 OK", |
| 459 | # "status": "ok" |
| 460 | # } |
| 461 | |
| 462 | # Refer to: #openbmc/phosphor-host-ipmid/blob/master/host-ipmid-whitelist.conf |
| 463 | # Set the restriction mode to Whitelist IPMI commands only: |
| 464 | # /xyz/openbmc_project/control/host0/restriction_mode/attr/RestrictionMode |
| 465 | # { |
| 466 | # "data": "xyz.openbmc_project.Control.Security.RestrictionMode.Modes.Whitelist", |
| 467 | # "message": "200 OK", |
| 468 | # "status": "ok" |
| 469 | # } |
| 470 | |
| 471 | Set IPMI Restriction Mode xyz.openbmc_project.Control.Security.RestrictionMode.Modes.Whitelist |
| 472 | |
| 473 | # Attempt white-listed operation expecting success. |
| 474 | IPMI Power On |
| 475 | |
| 476 | # Attempt non white-listed operation expecting failure. |
| 477 | Run Keyword And Expect Error *Insufficient privilege level* |
| 478 | ... Run Inband IPMI Standard Command mc reset cold |
| 479 | |
| 480 | |
Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 481 | *** Keywords *** |
Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 482 | |
Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 483 | Set Watchdog Enabled Using REST |
| 484 | [Documentation] Set watchdog Enabled field using REST. |
| 485 | [Arguments] ${value} |
| 486 | |
| 487 | # Description of argument(s): |
| 488 | # value Integer value (eg. "0-Disabled", "1-Enabled"). |
| 489 | |
| 490 | ${value_dict}= Create Dictionary data=${value} |
Steven Sombar | aaaab22 | 2018-12-19 13:16:23 -0600 | [diff] [blame] | 491 | ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}attr/Enabled |
Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 492 | ... data=${value_dict} |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 493 | |
| 494 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 495 | Fetch Details From LAN Print |
| 496 | [Documentation] Fetch details from LAN print. |
| 497 | [Arguments] ${field_name} |
| 498 | |
| 499 | # Description of argument(s): |
| 500 | # ${field_name} Field name to be fetched from LAN print |
| 501 | # (e.g. "MAC Address", "Source"). |
| 502 | |
Rahul Maheshwari | d8037d3 | 2018-12-17 00:59:57 -0600 | [diff] [blame] | 503 | ${stdout}= Run IPMI Standard Command lan print |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 504 | ${fetch_value}= Get Lines Containing String ${stdout} ${field_name} |
| 505 | ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE} |
| 506 | [Return] ${value_fetch} |
| 507 | |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 508 | |
| 509 | Verify Power Reading |
| 510 | [Documentation] Get dcmi power reading via IPMI. |
| 511 | |
| 512 | # Example of power reading command output via IPMI. |
| 513 | # Instantaneous power reading: 235 Watts |
| 514 | # Minimum during sampling period: 235 Watts |
| 515 | # Maximum during sampling period: 235 Watts |
| 516 | # Average power reading over sample period: 235 Watts |
| 517 | # IPMI timestamp: Thu Jan 1 00:00:00 1970 |
| 518 | # Sampling period: 00000000 Seconds. |
| 519 | # Power reading state is: deactivated |
| 520 | |
| 521 | ${power_reading}= Get IPMI Power Reading |
| 522 | |
| 523 | ${host_state}= Get Host State |
| 524 | Run Keyword If '${host_state}' == 'Off' |
George Keishing | 5131487 | 2018-03-31 13:24:35 -0500 | [diff] [blame] | 525 | ... Should Be Equal ${power_reading['instantaneous_power_reading']} 0 |
| 526 | ... msg=Power reading not zero when power is off. |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 527 | |
George Keishing | 5131487 | 2018-03-31 13:24:35 -0500 | [diff] [blame] | 528 | Run Keyword If '${power_reading['instantaneous_power_reading']}' != '0' |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 529 | ... Verify Power Reading Using REST ${power_reading['instantaneous_power_reading']} |
| 530 | |
| 531 | |
George Keishing | e78f1fd | 2018-09-04 13:34:59 -0500 | [diff] [blame] | 532 | Verify Power Reading Via Raw Command |
| 533 | [Documentation] Get dcmi power reading via IPMI raw command. |
| 534 | |
| 535 | ${ipmi_raw_output}= Run IPMI Standard Command |
| 536 | ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]} |
| 537 | |
| 538 | @{raw_output_list}= Split String ${ipmi_raw_output} ${SPACE} |
| 539 | |
| 540 | # On successful execution of raw IPMI power reading command, completion |
| 541 | # code does not come in output. So current power value will start from 2 |
| 542 | # byte instead of 3. |
| 543 | |
| 544 | ${power_reading_ipmi_raw_3_item}= Get From List ${raw_output_list} 2 |
| 545 | ${power_reading_ipmi_raw_3_item}= |
| 546 | ... Convert To Integer 0x${power_reading_ipmi_raw_3_item} |
| 547 | |
| 548 | ${power_reading_rest}= Read Attribute |
| 549 | ... ${SENSORS_URI}power/total_power Value |
| 550 | |
| 551 | # Example of power reading via REST |
| 552 | # "CriticalAlarmHigh": 0, |
| 553 | # "CriticalAlarmLow": 0, |
| 554 | # "CriticalHigh": 3100000000, |
| 555 | # "CriticalLow": 0, |
| 556 | # "Scale": -6, |
| 557 | # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts", |
| 558 | # "Value": 228000000, |
| 559 | # "WarningAlarmHigh": 0, |
| 560 | # "WarningAlarmLow": 0, |
| 561 | # "WarningHigh": 3050000000, |
| 562 | # "WarningLow": 0 |
| 563 | |
| 564 | # Get power value based on scale i.e. Value * (10 power Scale Value) |
| 565 | # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000 |
| 566 | |
| 567 | ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000 |
| 568 | ${ipmi_rest_power_diff}= |
| 569 | ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi_raw_3_item}) |
| 570 | |
| 571 | Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff} |
| 572 | ... msg=Power Reading above allowed threshold ${allowed_power_diff}. |
| 573 | |
| 574 | |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 575 | Verify Power Reading Using REST |
| 576 | [Documentation] Verify power reading using REST. |
| 577 | [Arguments] ${power_reading} |
| 578 | |
Gunnar Mills | 948e2e2 | 2018-03-23 12:54:27 -0500 | [diff] [blame] | 579 | # Description of argument(s): |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 580 | # power_reading IPMI Power reading |
| 581 | |
| 582 | ${power_reading_rest}= Read Attribute |
| 583 | ... ${SENSORS_URI}power/total_power Value |
| 584 | |
| 585 | # Example of power reading via REST |
| 586 | # "CriticalAlarmHigh": 0, |
| 587 | # "CriticalAlarmLow": 0, |
| 588 | # "CriticalHigh": 3100000000, |
| 589 | # "CriticalLow": 0, |
| 590 | # "Scale": -6, |
| 591 | # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts", |
| 592 | # "Value": 228000000, |
| 593 | # "WarningAlarmHigh": 0, |
| 594 | # "WarningAlarmLow": 0, |
| 595 | # "WarningHigh": 3050000000, |
| 596 | # "WarningLow": 0 |
| 597 | |
| 598 | # Get power value based on scale i.e. Value * (10 power Scale Value) |
| 599 | # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000 |
| 600 | ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000 |
| 601 | ${ipmi_rest_power_diff}= |
| 602 | ... Evaluate abs(${power_reading_rest} - ${power_reading}) |
| 603 | |
| 604 | Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff} |
| 605 | ... msg=Power reading above allowed threshold ${allowed_power_diff}. |
George Keishing | 02651f0 | 2018-04-11 02:07:16 -0500 | [diff] [blame] | 606 | |
| 607 | |
| 608 | Get Physical Network Interface Count |
| 609 | [Documentation] Return valid physical network interfaces count. |
| 610 | |
| 611 | # Example: |
| 612 | # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff |
| 613 | # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff |
| 614 | |
| 615 | ${mac_entry_list}= Get BMC MAC Address List |
| 616 | ${mac_unique_list}= Remove Duplicates ${mac_entry_list} |
| 617 | ${physical_interface_count}= Get Length ${mac_unique_list} |
| 618 | |
| 619 | [Return] ${physical_interface_count} |
George Keishing | 39967eb | 2018-04-30 11:36:23 -0500 | [diff] [blame] | 620 | |
George Keishing | e85113a | 2019-06-07 08:21:51 -0500 | [diff] [blame] | 621 | |
| 622 | Set IPMI Restriction Mode |
| 623 | [Documentation] Set the IPMI restriction mode. |
| 624 | [Arguments] ${restriction_mode} |
| 625 | |
| 626 | # Description of argument(s): |
| 627 | # restriction_mode IPMI valid restriction modes. |
| 628 | |
| 629 | ${valueDict}= Create Dictionary data=${restriction_mode} |
| 630 | |
| 631 | Write Attribute ${CONTROL_HOST_URI}restriction_mode/ |
| 632 | ... RestrictionMode data=${valueDict} |