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 | |
Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 19 | ${new_mc_id}= HOST |
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 | |
George Keishing | d627380 | 2018-09-07 07:06:53 -0500 | [diff] [blame] | 25 | Verify IPMI SEL Version |
| 26 | [Documentation] Verify IPMI SEL's version info. |
| 27 | [Tags] Verify_IPMI_SEL_Version |
| 28 | |
| 29 | ${version_info}= Get IPMI SEL Setting Version |
| 30 | ${setting_status}= Fetch From Left ${version_info} ( |
| 31 | ${setting_status}= Evaluate $setting_status.replace(' ','') |
| 32 | |
| 33 | Should Be True ${setting_status} >= 1.5 |
| 34 | Should Contain ${version_info} v2 compliant case_insensitive=True |
| 35 | |
| 36 | |
George Keishing | 9acd228 | 2018-09-07 07:21:41 -0500 | [diff] [blame] | 37 | Verify Empty SEL |
| 38 | [Documentation] Verify empty SEL list. |
| 39 | [Tags] Verify_Empty_SEL |
| 40 | |
Rahul Maheshwari | 9ef8507 | 2018-12-06 05:10:44 -0600 | [diff] [blame] | 41 | Run IPMI Standard Command sel clear |
George Keishing | 9acd228 | 2018-09-07 07:21:41 -0500 | [diff] [blame] | 42 | |
| 43 | ${resp}= Run IPMI Standard Command sel list |
| 44 | Should Contain ${resp} SEL has no entries case_insensitive=True |
| 45 | |
| 46 | |
Rahul Maheshwari | df6f05d | 2018-09-04 03:48:37 -0500 | [diff] [blame] | 47 | Verify Disabling And Enabling IPMI Via Host |
| 48 | [Documentation] Verify disabling and enabling IPMI via host. |
| 49 | [Tags] Verify_Disabling_And_Enabling_IPMI_Via_Host |
Rahul Maheshwari | c215715 | 2018-10-03 07:31:06 -0500 | [diff] [blame] | 50 | [Teardown] Run Keywords FFDC On Test Case Fail |
| 51 | ... AND Run Inband IPMI Standard Command lan set 1 access on |
Rahul Maheshwari | df6f05d | 2018-09-04 03:48:37 -0500 | [diff] [blame] | 52 | |
| 53 | # Disable IPMI and verify |
| 54 | Run Inband IPMI Standard Command lan set 1 access off |
| 55 | Run Keyword and Expect Error *Unable to establish IPMI* |
| 56 | ... Run External IPMI Standard Command lan print |
| 57 | |
| 58 | # Enable IPMI and verify |
| 59 | Run Inband IPMI Standard Command lan set 1 access on |
| 60 | ${lan_print_output}= Run External IPMI Standard Command lan print |
| 61 | |
| 62 | ${openbmc_host_name} ${openbmc_ip} ${openbmc_short_name}= |
| 63 | ... Get Host Name IP host=${OPENBMC_HOST} short_name=1 |
| 64 | Should Contain ${lan_print_output} ${openbmc_ip} |
| 65 | |
| 66 | |
Rahul Maheshwari | 7e7d088 | 2018-10-08 06:21:34 -0500 | [diff] [blame] | 67 | Verify Disabling IPMI Via OOB IPMI |
| 68 | [Documentation] Verify disabling IPMI via out of band IPMI. |
| 69 | [Tags] Verify_Disabling_IPMI_Via_OOB_IPMI |
| 70 | [Teardown] Run Inband IPMI Standard Command lan set 1 access on |
| 71 | |
| 72 | # Disable IPMI via OOB IPMI and verify |
| 73 | Run Keyword and Expect Error *IPMI response is NULL* |
| 74 | ... Run IPMI Standard Command lan set 1 access off |
| 75 | Run Keyword and Expect Error *Unable to establish IPMI* |
| 76 | ... Run External IPMI Standard Command lan print |
| 77 | |
| 78 | # Enable IPMI via Host and verify |
| 79 | Run Inband IPMI Standard Command lan set 1 access on |
| 80 | ${lan_print_output}= Run External IPMI Standard Command lan print |
| 81 | |
| 82 | ${openbmc_host_name} ${openbmc_ip} ${openbmc_short_name}= |
| 83 | ... Get Host Name IP host=${OPENBMC_HOST} short_name=1 |
| 84 | Should Contain ${lan_print_output} ${openbmc_ip} |
| 85 | |
| 86 | |
Rahul Maheshwari | c215715 | 2018-10-03 07:31:06 -0500 | [diff] [blame] | 87 | Verify IPMI Disable Persistency After BMC Reboot |
| 88 | [Documentation] Verify IPMI disable persistency after BMC reboot. |
| 89 | [Tags] Verify_IPMI_Disable_Persistency_After_BMC_Reboot |
| 90 | [Teardown] Run Keywords FFDC On Test Case Fail |
| 91 | ... AND Run Inband IPMI Standard Command lan set 1 access on |
| 92 | |
| 93 | # Disable IPMI and reboot BMC. |
| 94 | Run Inband IPMI Standard Command lan set 1 access off |
| 95 | OBMC Reboot (run) |
| 96 | |
| 97 | # Verify that IPMI remains disabled after reboot. |
| 98 | Run Keyword and Expect Error *Unable to establish IPMI* |
| 99 | ... Run External IPMI Standard Command lan print |
| 100 | |
| 101 | |
Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 102 | Set Asset Tag With Valid String Length |
| 103 | [Documentation] Set asset tag with valid string length and verify. |
| 104 | [Tags] Set_Asset_Tag_With_Valid_String_Length |
| 105 | |
| 106 | # Allowed MAX characters length for asset tag name is 63. |
| 107 | ${random_string}= Generate Random String 63 |
| 108 | Run Keyword Run IPMI Standard Command dcmi set_asset_tag ${random_string} |
| 109 | |
| 110 | ${asset_tag}= Run Keyword Run IPMI Standard Command dcmi asset_tag |
| 111 | Should Contain ${asset_tag} ${random_string} |
| 112 | |
| 113 | |
| 114 | Set Asset Tag With Invalid String Length |
| 115 | [Documentation] Verify error while setting invalid asset tag via IPMI. |
| 116 | [Tags] Set_Asset_Tag_With_Invalid_String_Length |
| 117 | |
| 118 | # Any string more than 63 character is invalid for asset tag. |
| 119 | ${random_string}= Generate Random String 64 |
| 120 | |
| 121 | ${resp}= Run Keyword And Expect Error * Run IPMI Standard Command |
| 122 | ... dcmi set_asset_tag ${random_string} |
| 123 | Should Contain ${resp} Parameter out of range ignore_case=True |
| 124 | |
| 125 | |
| 126 | Set Asset Tag With Valid String Length Via REST |
| 127 | [Documentation] Set valid asset tag via REST and verify. |
| 128 | [Tags] Set_Asset_Tag_With_Valid_String_Length_Via_REST |
| 129 | |
| 130 | ${random_string}= Generate Random String 63 |
| 131 | ${args}= Create Dictionary data=${random_string} |
| 132 | Write Attribute /xyz/openbmc_project/inventory/system AssetTag |
| 133 | ... data=${args} |
| 134 | |
| 135 | ${asset_tag}= Read Attribute /xyz/openbmc_project/inventory/system |
| 136 | ... AssetTag |
| 137 | Should Be Equal As Strings ${asset_tag} ${random_string} |
| 138 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 139 | |
Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 140 | Verify Get And Set Management Controller ID String |
| 141 | [Documentation] Verify get and set management controller ID string. |
| 142 | [Tags] Verify_Get_And_Set_Management_Controller_ID_String |
| 143 | |
| 144 | # Get the value of the managemment controller ID string. |
| 145 | # Example: |
| 146 | # Get Management Controller Identifier String: witherspoon |
| 147 | |
| 148 | ${cmd_output}= Run IPMI Standard Command dcmi get_mc_id_string |
| 149 | |
| 150 | # Extract management controller ID from cmd_output. |
| 151 | ${initial_mc_id}= Fetch From Right ${cmd_output} :${SPACE} |
| 152 | |
| 153 | # Set the management controller ID string to other value. |
| 154 | # Example: |
| 155 | # Set Management Controller Identifier String Command: HOST |
| 156 | |
| 157 | Set Management Controller ID String ${new_mc_id} |
| 158 | |
| 159 | # Get the management controller ID and verify. |
| 160 | Get Management Controller ID String And Verify ${new_mc_id} |
| 161 | |
| 162 | # Set the value back to the initial value and verify. |
| 163 | Set Management Controller ID String ${initial_mc_id} |
| 164 | |
| 165 | # Get the management controller ID and verify. |
| 166 | Get Management Controller ID String And Verify ${initial_mc_id} |
Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 167 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 168 | |
Rahul Maheshwari | 0eb33f0 | 2018-04-10 02:31:54 -0500 | [diff] [blame] | 169 | Test Management Controller ID String Status via IPMI |
| 170 | [Documentation] Test management controller ID string status via IPMI. |
| 171 | [Tags] Test_Management_Controller_ID_String_Status_via_IPMI |
| 172 | |
| 173 | # Disable management controller ID string status via IPMI and verify. |
| 174 | Run IPMI Standard Command dcmi set_conf_param dhcp_config 0x00 |
| 175 | Verify Management Controller ID String Status disable |
| 176 | |
| 177 | # Enable management controller ID string status via IPMI and verify. |
| 178 | Run IPMI Standard Command dcmi set_conf_param dhcp_config 0x01 |
| 179 | Verify Management Controller ID String Status enable |
| 180 | |
| 181 | |
| 182 | Test Management Controller ID String Status via Raw IPMI |
| 183 | [Documentation] Test management controller ID string status via IPMI. |
| 184 | [Tags] Test_Management_Controller_ID_String_Status_via_Raw_IPMI |
| 185 | |
| 186 | # Disable management controller ID string status via raw IPMI and verify. |
| 187 | Run IPMI Standard Command raw ${IPMI_RAW_CMD['conf_param']['Disabled'][0]} |
| 188 | Verify Management Controller ID String Status disable |
| 189 | |
| 190 | # Enable management controller ID string status via raw IPMI and verify. |
| 191 | Run IPMI Standard Command raw ${IPMI_RAW_CMD['conf_param']['Enabled'][0]} |
| 192 | Verify Management Controller ID String Status enable |
| 193 | |
| 194 | |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 195 | Verify Chassis Identify via IPMI |
| 196 | [Documentation] Verify "chassis identify" using IPMI command. |
| 197 | [Tags] Verify_Chassis_Identify_via_IPMI |
| 198 | |
| 199 | # Set to default "chassis identify" and verify that LED blinks for 15s. |
| 200 | Run IPMI Standard Command chassis identify |
| 201 | Verify Identify LED State Blink |
| 202 | |
| 203 | Sleep 15s |
| 204 | Verify Identify LED State Off |
| 205 | |
| 206 | # Set "chassis identify" to 10s and verify that the LED blinks for 10s. |
| 207 | Run IPMI Standard Command chassis identify 10 |
| 208 | Verify Identify LED State Blink |
| 209 | |
| 210 | Sleep 10s |
| 211 | Verify Identify LED State Off |
| 212 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 213 | |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 214 | Verify Chassis Identify Off And Force Identify On via IPMI |
| 215 | [Documentation] Verify "chassis identify" off |
| 216 | ... and "force identify on" via IPMI. |
| 217 | [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI |
| 218 | |
| 219 | # Set the LED to "Force Identify On". |
| 220 | Run IPMI Standard Command chassis identify force |
| 221 | Verify Identify LED State Blink |
| 222 | |
| 223 | # Set "chassis identify" to 0 and verify that the LED turns off. |
| 224 | Run IPMI Standard Command chassis identify 0 |
| 225 | Verify Identify LED State Off |
| 226 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 227 | |
Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 228 | Test Watchdog Reset Via IPMI And Verify Using REST |
| 229 | [Documentation] Test watchdog reset via IPMI and verify using REST. |
| 230 | [Tags] Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST |
| 231 | |
| 232 | Initiate Host Boot |
| 233 | |
| 234 | Set Watchdog Enabled Using REST ${1} |
| 235 | |
| 236 | Watchdog Object Should Exist |
| 237 | |
| 238 | # Resetting the watchdog via IPMI. |
| 239 | Run IPMI Standard Command mc watchdog reset |
| 240 | |
| 241 | # Verify the watchdog is reset using REST after an interval of 1000ms. |
| 242 | Sleep 1000ms |
| 243 | ${watchdog_time_left}= |
| 244 | ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining |
| 245 | Should Be True |
| 246 | ... ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000} |
| 247 | ... msg=Watchdog timer didn't reset. |
| 248 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 249 | |
Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 250 | Test Watchdog Off Via IPMI And Verify Using REST |
| 251 | [Documentation] Test watchdog off via IPMI and verify using REST. |
| 252 | [Tags] Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST |
| 253 | |
| 254 | Initiate Host Boot |
| 255 | |
| 256 | Set Watchdog Enabled Using REST ${1} |
| 257 | |
| 258 | Watchdog Object Should Exist |
| 259 | |
| 260 | # Turn off the watchdog via IPMI. |
| 261 | Run IPMI Standard Command mc watchdog off |
| 262 | |
| 263 | # Verify the watchdog is off using REST |
| 264 | ${watchdog_state}= Read Attribute ${HOST_WATCHDOG_URI} Enabled |
| 265 | Should Be Equal ${watchdog_state} ${0} |
| 266 | ... msg=msg=Verification failed for watchdog off check. |
Rahul Maheshwari | 901dcde | 2018-02-06 03:14:31 -0600 | [diff] [blame] | 267 | |
| 268 | |
| 269 | Test Ambient Temperature Via IPMI |
| 270 | [Documentation] Test ambient temperature via IPMI and verify using REST. |
| 271 | [Tags] Test_Ambient_Temperature_Via_IPMI |
| 272 | |
| 273 | # Entity ID Entity Instance Temp. Readings |
| 274 | # Inlet air temperature(40h) 1 +19 C |
| 275 | # CPU temperature sensors(41h) 5 +51 C |
| 276 | # CPU temperature sensors(41h) 6 +50 C |
| 277 | # CPU temperature sensors(41h) 7 +50 C |
| 278 | # CPU temperature sensors(41h) 8 +50 C |
| 279 | # CPU temperature sensors(41h) 9 +50 C |
| 280 | # CPU temperature sensors(41h) 10 +48 C |
| 281 | # CPU temperature sensors(41h) 11 +49 C |
| 282 | # CPU temperature sensors(41h) 12 +47 C |
| 283 | # CPU temperature sensors(41h) 8 +50 C |
| 284 | # CPU temperature sensors(41h) 16 +51 C |
| 285 | # CPU temperature sensors(41h) 24 +50 C |
| 286 | # CPU temperature sensors(41h) 32 +43 C |
| 287 | # CPU temperature sensors(41h) 40 +43 C |
| 288 | # Baseboard temperature sensors(42h) 1 +35 C |
| 289 | |
| 290 | ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10 |
George Keishing | 77f1ad2 | 2018-07-23 12:39:28 -0500 | [diff] [blame] | 291 | Should Contain ${temp_reading} Inlet air temperature |
| 292 | ... msg="Unable to get inlet temperature via DCMI". |
Rahul Maheshwari | 901dcde | 2018-02-06 03:14:31 -0600 | [diff] [blame] | 293 | ${ambient_temp_line}= |
| 294 | ... Get Lines Containing String ${temp_reading} |
| 295 | ... Inlet air temperature case-insensitive |
| 296 | |
| 297 | ${ambient_temp_ipmi}= Fetch From Right ${ambient_temp_line} + |
| 298 | ${ambient_temp_ipmi}= Remove String ${ambient_temp_ipmi} ${SPACE}C |
| 299 | |
| 300 | ${ambient_temp_rest}= Read Attribute |
| 301 | ... ${SENSORS_URI}temperature/ambient Value |
| 302 | |
| 303 | # Example of ambient temperature via REST |
| 304 | # "CriticalAlarmHigh": 0, |
| 305 | # "CriticalAlarmLow": 0, |
| 306 | # "CriticalHigh": 35000, |
| 307 | # "CriticalLow": 0, |
| 308 | # "Scale": -3, |
| 309 | # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC", |
| 310 | # "Value": 21775, |
| 311 | # "WarningAlarmHigh": 0, |
| 312 | # "WarningAlarmLow": 0, |
| 313 | # "WarningHigh": 25000, |
| 314 | # "WarningLow": 0 |
| 315 | |
| 316 | # Get temperature value based on scale i.e. Value * (10 power Scale Value) |
| 317 | # e.g. from above case 21775 * (10 power -3) = 21775/1000 |
| 318 | |
| 319 | ${ambient_temp_rest}= Evaluate ${ambient_temp_rest}/1000 |
| 320 | ${ipmi_rest_temp_diff}= |
| 321 | ... Evaluate abs(${ambient_temp_rest} - ${ambient_temp_ipmi}) |
| 322 | |
| 323 | Should Be True ${ipmi_rest_temp_diff} <= ${allowed_temp_diff} |
| 324 | ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}. |
| 325 | |
| 326 | |
Rahul Maheshwari | 4355663 | 2018-02-05 23:42:52 -0600 | [diff] [blame] | 327 | Verify Get DCMI Capabilities |
| 328 | [Documentation] Verify get DCMI capabilities command output. |
| 329 | [Tags] Verify_Get_DCMI_Capabilities |
| 330 | |
| 331 | ${cmd_output}= Run IPMI Standard Command dcmi discover |
| 332 | |
| 333 | @{supported_capabilities}= Create List |
| 334 | # Supported DCMI capabilities: |
George Keishing | 2ee2f00 | 2019-02-16 09:36:02 -0600 | [diff] [blame] | 335 | ... Mandatory platform capabilities |
| 336 | ... Optional platform capabilities |
Rahul Maheshwari | 4355663 | 2018-02-05 23:42:52 -0600 | [diff] [blame] | 337 | ... Power management available |
George Keishing | 2ee2f00 | 2019-02-16 09:36:02 -0600 | [diff] [blame] | 338 | ... Managebility access capabilities |
Rahul Maheshwari | 4355663 | 2018-02-05 23:42:52 -0600 | [diff] [blame] | 339 | ... In-band KCS channel available |
| 340 | # Mandatory platform attributes: |
| 341 | ... 200 SEL entries |
| 342 | ... SEL automatic rollover is enabled |
| 343 | # Optional Platform Attributes: |
| 344 | ... Slave address of device: 0h (8bits)(Satellite/External controller) |
| 345 | ... Channel number is 0h (Primary BMC) |
| 346 | ... Device revision is 0 |
| 347 | # Manageability Access Attributes: |
| 348 | ... Primary LAN channel number: 1 is available |
| 349 | ... Secondary LAN channel is not available for OOB |
| 350 | ... No serial channel is available |
| 351 | |
| 352 | :FOR ${capability} IN @{supported_capabilities} |
| 353 | \ Should Contain ${cmd_output} ${capability} ignore_case=True |
| 354 | ... msg=Supported DCMI capabilities not present. |
| 355 | |
| 356 | |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 357 | Test Power Reading Via IPMI With Host Off |
| 358 | [Documentation] Test power reading via IPMI with host off state and |
| 359 | ... verify using REST. |
| 360 | [Tags] Test_Power_Reading_Via_IPMI_With_Host_Off |
Rahul Maheshwari | 615da15 | 2018-02-13 23:53:36 -0600 | [diff] [blame] | 361 | |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 362 | REST Power Off stack_mode=skip quiet=1 |
Rahul Maheshwari | 615da15 | 2018-02-13 23:53:36 -0600 | [diff] [blame] | 363 | |
George Keishing | 04bf06c | 2018-10-05 08:28:50 -0500 | [diff] [blame] | 364 | Wait Until Keyword Succeeds 1 min 30 sec Verify Power Reading |
George Keishing | e78f1fd | 2018-09-04 13:34:59 -0500 | [diff] [blame] | 365 | |
| 366 | |
| 367 | Test Power Reading Via IPMI With Host Booted |
| 368 | [Documentation] Test power reading via IPMI with host booted state and |
| 369 | ... verify using REST. |
| 370 | [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted |
| 371 | |
| 372 | REST Power On stack_mode=skip quiet=1 |
| 373 | |
| 374 | # For a good power reading take a 3 samples for 15 seconds interval and |
| 375 | # average it out. |
| 376 | |
George Keishing | 04bf06c | 2018-10-05 08:28:50 -0500 | [diff] [blame] | 377 | Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading |
Rahul Maheshwari | 615da15 | 2018-02-13 23:53:36 -0600 | [diff] [blame] | 378 | |
| 379 | |
Rahul Maheshwari | abe13af | 2018-02-15 22:42:08 -0600 | [diff] [blame] | 380 | Test Power Reading Via IPMI Raw Command |
| 381 | [Documentation] Test power reading via IPMI raw command and verify |
| 382 | ... using REST. |
| 383 | [Tags] Test_Power_Reading_Via_IPMI_Raw_Command |
| 384 | |
| 385 | # Response data structure of power reading command output via IPMI. |
| 386 | # 1 Completion Code. Refer to section 8, DCMI Completion Codes. |
| 387 | # 2 Group Extension Identification = DCh |
| 388 | # 3:4 Current Power in watts |
| 389 | |
George Keishing | e78f1fd | 2018-09-04 13:34:59 -0500 | [diff] [blame] | 390 | REST Power On stack_mode=skip quiet=1 |
Rahul Maheshwari | abe13af | 2018-02-15 22:42:08 -0600 | [diff] [blame] | 391 | |
George Keishing | 04bf06c | 2018-10-05 08:28:50 -0500 | [diff] [blame] | 392 | 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] | 393 | |
| 394 | |
Rahul Maheshwari | 91a18ef | 2018-02-15 04:54:59 -0600 | [diff] [blame] | 395 | Test Baseboard Temperature Via IPMI |
| 396 | [Documentation] Test baseboard temperature via IPMI and verify using REST. |
| 397 | [Tags] Test_Baseboard_Temperature_Via_IPMI |
| 398 | |
| 399 | # Example of IPMI dcmi get_temp_reading output: |
| 400 | # Entity ID Entity Instance Temp. Readings |
| 401 | # Inlet air temperature(40h) 1 +19 C |
| 402 | # CPU temperature sensors(41h) 5 +51 C |
| 403 | # CPU temperature sensors(41h) 6 +50 C |
| 404 | # CPU temperature sensors(41h) 7 +50 C |
| 405 | # CPU temperature sensors(41h) 8 +50 C |
| 406 | # CPU temperature sensors(41h) 9 +50 C |
| 407 | # CPU temperature sensors(41h) 10 +48 C |
| 408 | # CPU temperature sensors(41h) 11 +49 C |
| 409 | # CPU temperature sensors(41h) 12 +47 C |
| 410 | # CPU temperature sensors(41h) 8 +50 C |
| 411 | # CPU temperature sensors(41h) 16 +51 C |
| 412 | # CPU temperature sensors(41h) 24 +50 C |
| 413 | # CPU temperature sensors(41h) 32 +43 C |
| 414 | # CPU temperature sensors(41h) 40 +43 C |
| 415 | # Baseboard temperature sensors(42h) 1 +35 C |
| 416 | |
| 417 | ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10 |
George Keishing | 77f1ad2 | 2018-07-23 12:39:28 -0500 | [diff] [blame] | 418 | Should Contain ${temp_reading} Baseboard temperature sensors |
| 419 | ... msg="Unable to get baseboard temperature via DCMI". |
Rahul Maheshwari | 91a18ef | 2018-02-15 04:54:59 -0600 | [diff] [blame] | 420 | ${baseboard_temp_line}= |
| 421 | ... Get Lines Containing String ${temp_reading} |
| 422 | ... Baseboard temperature case-insensitive=True |
| 423 | |
| 424 | ${baseboard_temp_ipmi}= Fetch From Right ${baseboard_temp_line} + |
| 425 | ${baseboard_temp_ipmi}= Remove String ${baseboard_temp_ipmi} ${SPACE}C |
| 426 | |
| 427 | ${baseboard_temp_rest}= Read Attribute |
| 428 | ... /xyz/openbmc_project/sensors/temperature/pcie Value |
| 429 | ${baseboard_temp_rest}= Evaluate ${baseboard_temp_rest}/1000 |
| 430 | |
| 431 | Should Be True |
| 432 | ... ${baseboard_temp_rest} - ${baseboard_temp_ipmi} <= ${allowed_temp_diff} |
| 433 | ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}. |
| 434 | |
| 435 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 436 | Retrieve Default Gateway Via IPMI And Verify Using REST |
| 437 | [Documentation] Retrieve default gateway from LAN print using IPMI. |
| 438 | [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify_Using_REST |
| 439 | |
| 440 | # Fetch "Default Gateway" from IPMI LAN print. |
| 441 | ${default_gateway_ipmi}= Fetch Details From LAN Print Default Gateway IP |
| 442 | |
| 443 | # Verify "Default Gateway" using REST. |
Steven Sombar | a8800da | 2018-12-18 16:19:05 -0600 | [diff] [blame] | 444 | Read Attribute ${NETWORK_MANAGER}config DefaultGateway |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 445 | ... expected_value=${default_gateway_ipmi} |
| 446 | |
| 447 | |
| 448 | Retrieve MAC Address Via IPMI And Verify Using REST |
| 449 | [Documentation] Retrieve MAC Address from LAN print using IPMI. |
| 450 | [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_REST |
| 451 | |
| 452 | # Fetch "MAC Address" from IPMI LAN print. |
| 453 | ${mac_address_ipmi}= Fetch Details From LAN Print MAC Address |
| 454 | |
| 455 | # Verify "MAC Address" using REST. |
| 456 | ${mac_address_rest}= Get BMC MAC Address |
| 457 | Should Be Equal ${mac_address_ipmi} ${mac_address_rest} |
| 458 | ... msg=Verification of MAC address from lan print using IPMI failed. |
| 459 | |
| 460 | |
| 461 | Retrieve Network Mode Via IPMI And Verify Using REST |
| 462 | [Documentation] Retrieve network mode from LAN print using IPMI. |
| 463 | [Tags] Retrieve_Network_Mode_Via_IPMI_And_Verify_Using_REST |
| 464 | |
| 465 | # Fetch "Mode" from IPMI LAN print. |
| 466 | ${network_mode_ipmi}= Fetch Details From LAN Print Source |
| 467 | |
| 468 | # Verify "Mode" using REST. |
| 469 | ${network_mode_rest}= Read Attribute |
Steven Sombar | a8800da | 2018-12-18 16:19:05 -0600 | [diff] [blame] | 470 | ... ${NETWORK_MANAGER}eth0 DHCPEnabled |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 471 | Run Keyword If '${network_mode_ipmi}' == 'Static Address' |
| 472 | ... Should Be Equal ${network_mode_rest} ${0} |
| 473 | ... msg=Verification of network setting failed. |
| 474 | ... ELSE IF '${network_mode_ipmi}' == 'DHCP' |
| 475 | ... Should Be Equal ${network_mode_rest} ${1} |
| 476 | ... msg=Verification of network setting failed. |
| 477 | |
| 478 | |
| 479 | Retrieve IP Address Via IPMI And Verify With BMC Details |
| 480 | [Documentation] Retrieve IP address from LAN print using IPMI. |
| 481 | [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_With_BMC_Details |
| 482 | |
| 483 | # Fetch "IP Address" from IPMI LAN print. |
| 484 | ${ip_addr_ipmi}= Fetch Details From LAN Print IP Address |
| 485 | |
| 486 | # Verify the IP address retrieved via IPMI with BMC IPs. |
| 487 | ${ip_address_rest}= Get BMC IP Info |
| 488 | Validate IP On BMC ${ip_addr_ipmi} ${ip_address_rest} |
| 489 | |
| 490 | |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 491 | Verify Get Device ID |
| 492 | [Documentation] Verify get device ID command output. |
| 493 | [Tags] Verify_Get_Device_ID |
| 494 | |
| 495 | # Example of get device ID command output: |
| 496 | # Device ID : 0 |
| 497 | # Device Revision : 0 |
| 498 | # Firmware Revision : 2.01 |
| 499 | # IPMI Version : 2.0 |
| 500 | # Manufacturer ID : 42817 |
| 501 | # Manufacturer Name : Unknown (0xA741) |
| 502 | # Product ID : 16975 (0x424f) |
| 503 | # Product Name : Unknown (0x424F) |
| 504 | # Device Available : yes |
| 505 | # Provides Device SDRs : yes |
| 506 | # Additional Device Support : |
| 507 | # Sensor Device |
| 508 | # SEL Device |
| 509 | # FRU Inventory Device |
| 510 | # Chassis Device |
| 511 | # Aux Firmware Rev Info : |
George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 512 | # 0x04 |
| 513 | # 0x38 |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 514 | # 0x00 |
George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 515 | # 0x03 |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 516 | |
| 517 | ${mc_info}= Get MC Info |
| 518 | |
| 519 | Should Be Equal ${mc_info['device_id']} 0 |
| 520 | Should Be Equal ${mc_info['device_revision']} 0 |
| 521 | |
Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 522 | # Get firmware revision from mc info command output i.e. 2.01 |
| 523 | ${ipmi_fw_major_version} ${ipmi_fw_minor_version}= |
| 524 | ... Split String ${mc_info['firmware_revision']} . |
| 525 | # Convert minor firmware version from BCD format to integer. i.e. 01 to 1 |
| 526 | ${ipmi_fw_minor_version}= Convert To Integer ${ipmi_fw_minor_version} |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 527 | |
George Keishing | e0a8128 | 2018-06-08 10:02:30 -0500 | [diff] [blame] | 528 | # 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] | 529 | ${bmc_version_full}= Get BMC Version |
Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 530 | ${bmc_version}= |
George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 531 | ... Remove String Using Regexp ${bmc_version_full} ^[^0-9]+ [^0-9\.].* |
Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 532 | |
| 533 | # 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] | 534 | @{major_minor_version}= Split String ${bmc_version} . |
Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 535 | |
George Keishing | c95e998 | 2019-01-14 09:27:45 -0600 | [diff] [blame] | 536 | 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] | 537 | ... msg=Major version mismatch. |
George Keishing | c95e998 | 2019-01-14 09:27:45 -0600 | [diff] [blame] | 538 | 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] | 539 | ... msg=Minor version mismatch. |
Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 540 | |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 541 | Should Be Equal ${mc_info['ipmi_version']} 2.0 |
| 542 | |
Gunnar Mills | 917ba1a | 2018-04-08 16:42:12 -0500 | [diff] [blame] | 543 | # TODO: Verify Manufacturer and Product IDs directly from json file. |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 544 | # Reference : openbmc/openbmc-test-automation#1244 |
| 545 | Should Be Equal ${mc_info['manufacturer_id']} 42817 |
| 546 | Should Be Equal ${mc_info['product_id']} 16975 (0x424f) |
| 547 | |
| 548 | Should Be Equal ${mc_info['device_available']} yes |
| 549 | Should Be Equal ${mc_info['provides_device_sdrs']} yes |
| 550 | Should Contain ${mc_info['additional_device_support']} Sensor Device |
| 551 | Should Contain ${mc_info['additional_device_support']} SEL Device |
| 552 | Should Contain |
| 553 | ... ${mc_info['additional_device_support']} FRU Inventory Device |
| 554 | Should Contain ${mc_info['additional_device_support']} Chassis Device |
George Keishing | b746d3f | 2018-04-19 10:53:10 -0500 | [diff] [blame] | 555 | |
George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 556 | # Auxiliary revision data verification. |
| 557 | ${aux_version}= Get Aux Version ${bmc_version_full} |
| 558 | |
| 559 | # From aux_firmware_rev_info field ['0x04', '0x38', '0x00', '0x03'] |
| 560 | ${bmc_aux_version}= Catenate |
| 561 | ... SEPARATOR= |
| 562 | ... ${mc_info['aux_firmware_rev_info'][0][2:]} |
| 563 | ... ${mc_info['aux_firmware_rev_info'][1][2:]} |
| 564 | ... ${mc_info['aux_firmware_rev_info'][2][2:]} |
| 565 | ... ${mc_info['aux_firmware_rev_info'][3][2:]} |
| 566 | |
| 567 | Should Be Equal As Integers |
| 568 | ... ${bmc_aux_version} ${aux_version} |
| 569 | ... 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] | 570 | |
| 571 | |
Rahul Maheshwari | dc6a32c | 2018-03-15 05:21:55 -0500 | [diff] [blame] | 572 | Verify SDR Info |
| 573 | [Documentation] Verify sdr info command output. |
| 574 | [Tags] Verify_SDR_Info |
| 575 | |
| 576 | # Example of SDR info command output: |
| 577 | # SDR Version : 0x51 |
| 578 | # Record Count : 216 |
| 579 | # Free Space : unspecified |
| 580 | # Most recent Addition : |
| 581 | # Most recent Erase : |
| 582 | # SDR overflow : no |
| 583 | # SDR Repository Update Support : unspecified |
| 584 | # Delete SDR supported : no |
| 585 | # Partial Add SDR supported : no |
| 586 | # Reserve SDR repository supported : no |
| 587 | # SDR Repository Alloc info supported : no |
| 588 | |
| 589 | ${sdr_info}= Get SDR Info |
| 590 | Should Be Equal ${sdr_info['sdr_version']} 0x51 |
| 591 | |
| 592 | # Get sensor count from "sdr elist all" command output. |
| 593 | ${sensor_count}= Get Sensor Count |
| 594 | Should Be Equal As Strings |
| 595 | ... ${sdr_info['record_count']} ${sensor_count} |
| 596 | |
| 597 | Should Be Equal ${sdr_info['free_space']} unspecified |
| 598 | Should Be Equal ${sdr_info['most_recent_addition']} ${EMPTY} |
| 599 | Should Be Equal ${sdr_info['most_recent_erase']} ${EMPTY} |
| 600 | Should Be Equal ${sdr_info['sdr_overflow']} no |
| 601 | Should Be Equal ${sdr_info['sdr_repository_update_support']} unspecified |
| 602 | Should Be Equal ${sdr_info['delete_sdr_supported']} no |
| 603 | Should Be Equal ${sdr_info['partial_add_sdr_supported']} no |
| 604 | Should Be Equal ${sdr_info['reserve_sdr_repository_supported']} no |
| 605 | Should Be Equal ${sdr_info['sdr_repository_alloc_info_supported']} no |
| 606 | |
| 607 | |
George Keishing | 02651f0 | 2018-04-11 02:07:16 -0500 | [diff] [blame] | 608 | Test Valid IPMI Channels Supported |
| 609 | [Documentation] Verify IPMI channels supported on a given system. |
| 610 | [Tags] Test_Valid_IPMI_Channels_Supported |
| 611 | |
| 612 | ${channel_count}= Get Physical Network Interface Count |
| 613 | |
| 614 | # Note: IPMI network channel logically starts from 1. |
| 615 | :FOR ${channel_number} IN RANGE 1 ${channel_count} |
Rahul Maheshwari | 20f3bf7 | 2018-12-18 04:24:20 -0600 | [diff] [blame] | 616 | \ Run IPMI Standard Command lan print ${channel_number} |
George Keishing | 02651f0 | 2018-04-11 02:07:16 -0500 | [diff] [blame] | 617 | |
| 618 | |
| 619 | Test Invalid IPMI Channel Response |
| 620 | [Documentation] Verify invalid IPMI channels supported response. |
| 621 | [Tags] Test_Invalid_IPMI_Channel_Response |
| 622 | |
| 623 | ${channel_count}= Get Physical Network Interface Count |
| 624 | |
| 625 | # To target invalid channel, increment count. |
| 626 | ${channel_number}= Evaluate ${channel_count} + 1 |
| 627 | |
| 628 | # Example of invalid channel: |
George Keishing | 72d0ac8 | 2018-09-20 09:33:01 -0500 | [diff] [blame] | 629 | # $ 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] | 630 | # Get Channel Info command failed: Parameter out of range |
| 631 | # Invalid channel: 3 |
| 632 | |
| 633 | ${stdout}= Run External IPMI Standard Command |
| 634 | ... lan print ${channel_number} fail_on_err=${0} |
| 635 | Should Contain ${stdout} Invalid channel |
| 636 | ... msg=IPMI channel ${channel_number} is invalid but seen working. |
| 637 | |
| 638 | |
George Keishing | e85113a | 2019-06-07 08:21:51 -0500 | [diff] [blame] | 639 | Test IPMI Restriction Mode |
| 640 | [Documentation] Set restricition mode via REST and verify IPMI operation. |
| 641 | [Tags] Test_IPMI_Restriction_Mode |
| 642 | # Forego normal test setup: |
| 643 | [Setup] No Operation |
| 644 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 645 | ... Set IPMI Restriction Mode xyz.openbmc_project.Control.Security.RestrictionMode.Modes.None |
| 646 | |
| 647 | # By default no IPMI operations are restricted. |
| 648 | # /xyz/openbmc_project/control/host0/restriction_mode/attr/RestrictionMode |
| 649 | # { |
| 650 | # "data": "xyz.openbmc_project.Control.Security.RestrictionMode.Modes.None", |
| 651 | # "message": "200 OK", |
| 652 | # "status": "ok" |
| 653 | # } |
| 654 | |
| 655 | # Refer to: #openbmc/phosphor-host-ipmid/blob/master/host-ipmid-whitelist.conf |
| 656 | # Set the restriction mode to Whitelist IPMI commands only: |
| 657 | # /xyz/openbmc_project/control/host0/restriction_mode/attr/RestrictionMode |
| 658 | # { |
| 659 | # "data": "xyz.openbmc_project.Control.Security.RestrictionMode.Modes.Whitelist", |
| 660 | # "message": "200 OK", |
| 661 | # "status": "ok" |
| 662 | # } |
| 663 | |
| 664 | Set IPMI Restriction Mode xyz.openbmc_project.Control.Security.RestrictionMode.Modes.Whitelist |
| 665 | |
| 666 | # Attempt white-listed operation expecting success. |
| 667 | IPMI Power On |
| 668 | |
| 669 | # Attempt non white-listed operation expecting failure. |
| 670 | Run Keyword And Expect Error *Insufficient privilege level* |
| 671 | ... Run Inband IPMI Standard Command mc reset cold |
| 672 | |
| 673 | |
Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 674 | *** Keywords *** |
Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 675 | |
Rahul Maheshwari | dc6a32c | 2018-03-15 05:21:55 -0500 | [diff] [blame] | 676 | Get Sensor Count |
| 677 | [Documentation] Get sensors count using "sdr elist all" command. |
| 678 | |
| 679 | # Example of "sdr elist all" command output: |
| 680 | # BootProgress | 03h | ok | 34.2 | |
| 681 | # OperatingSystemS | 05h | ok | 35.1 | |
| 682 | # AttemptsLeft | 07h | ok | 34.1 | |
| 683 | # occ0 | 08h | ok | 210.1 | Device Disabled |
| 684 | # occ1 | 09h | ok | 210.2 | Device Disabled |
| 685 | # p0_core0_temp | 11h | ns | 3.1 | Disabled |
| 686 | # cpu0_core0 | 12h | ok | 208.1 | Presence detected |
| 687 | # p0_core1_temp | 14h | ns | 3.2 | Disabled |
| 688 | # cpu0_core1 | 15h | ok | 208.2 | Presence detected |
| 689 | # p0_core2_temp | 17h | ns | 3.3 | Disabled |
| 690 | # .. |
| 691 | # .. |
| 692 | # .. |
| 693 | # .. |
| 694 | # .. |
| 695 | # .. |
| 696 | # fan3 | 00h | ns | 29.4 | Logical FRU @35h |
| 697 | # bmc | 00h | ns | 6.1 | Logical FRU @3Ch |
| 698 | # ethernet | 00h | ns | 1.1 | Logical FRU @46h |
| 699 | |
| 700 | ${output}= Run IPMI Standard Command sdr elist all |
| 701 | ${sensor_list}= Split String ${output} \n |
| 702 | ${sensor_count}= Get Length ${sensor_list} |
| 703 | [Return] ${sensor_count} |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 704 | |
Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 705 | Set Management Controller ID String |
| 706 | [Documentation] Set the management controller ID string. |
| 707 | [Arguments] ${string} |
| 708 | |
| 709 | # Description of argument(s): |
| 710 | # string Management Controller ID String to be set |
| 711 | |
| 712 | ${set_mc_id_string}= Run IPMI Standard Command |
| 713 | ... dcmi set_mc_id_string ${string} |
| 714 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 715 | |
Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 716 | Get Management Controller ID String And Verify |
George Keishing | cb3b9b6 | 2018-09-14 12:11:19 -0500 | [diff] [blame] | 717 | [Documentation] Get the management controller ID string. |
Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 718 | [Arguments] ${string} |
| 719 | |
| 720 | # Description of argument(s): |
| 721 | # string Management Controller ID string |
| 722 | |
| 723 | ${get_mc_id}= Run IPMI Standard Command dcmi get_mc_id_string |
| 724 | Should Contain ${get_mc_id} ${string} |
| 725 | ... msg=Command failed: get_mc_id. |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 726 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 727 | |
Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 728 | Set Watchdog Enabled Using REST |
| 729 | [Documentation] Set watchdog Enabled field using REST. |
| 730 | [Arguments] ${value} |
| 731 | |
| 732 | # Description of argument(s): |
| 733 | # value Integer value (eg. "0-Disabled", "1-Enabled"). |
| 734 | |
| 735 | ${value_dict}= Create Dictionary data=${value} |
Steven Sombar | aaaab22 | 2018-12-19 13:16:23 -0600 | [diff] [blame] | 736 | ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}attr/Enabled |
Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 737 | ... data=${value_dict} |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 738 | |
| 739 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 740 | Fetch Details From LAN Print |
| 741 | [Documentation] Fetch details from LAN print. |
| 742 | [Arguments] ${field_name} |
| 743 | |
| 744 | # Description of argument(s): |
| 745 | # ${field_name} Field name to be fetched from LAN print |
| 746 | # (e.g. "MAC Address", "Source"). |
| 747 | |
Rahul Maheshwari | d8037d3 | 2018-12-17 00:59:57 -0600 | [diff] [blame] | 748 | ${stdout}= Run IPMI Standard Command lan print |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 749 | ${fetch_value}= Get Lines Containing String ${stdout} ${field_name} |
| 750 | ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE} |
| 751 | [Return] ${value_fetch} |
| 752 | |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 753 | |
| 754 | Verify Power Reading |
| 755 | [Documentation] Get dcmi power reading via IPMI. |
| 756 | |
| 757 | # Example of power reading command output via IPMI. |
| 758 | # Instantaneous power reading: 235 Watts |
| 759 | # Minimum during sampling period: 235 Watts |
| 760 | # Maximum during sampling period: 235 Watts |
| 761 | # Average power reading over sample period: 235 Watts |
| 762 | # IPMI timestamp: Thu Jan 1 00:00:00 1970 |
| 763 | # Sampling period: 00000000 Seconds. |
| 764 | # Power reading state is: deactivated |
| 765 | |
| 766 | ${power_reading}= Get IPMI Power Reading |
| 767 | |
| 768 | ${host_state}= Get Host State |
| 769 | Run Keyword If '${host_state}' == 'Off' |
George Keishing | 5131487 | 2018-03-31 13:24:35 -0500 | [diff] [blame] | 770 | ... Should Be Equal ${power_reading['instantaneous_power_reading']} 0 |
| 771 | ... msg=Power reading not zero when power is off. |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 772 | |
George Keishing | 5131487 | 2018-03-31 13:24:35 -0500 | [diff] [blame] | 773 | Run Keyword If '${power_reading['instantaneous_power_reading']}' != '0' |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 774 | ... Verify Power Reading Using REST ${power_reading['instantaneous_power_reading']} |
| 775 | |
| 776 | |
George Keishing | e78f1fd | 2018-09-04 13:34:59 -0500 | [diff] [blame] | 777 | Verify Power Reading Via Raw Command |
| 778 | [Documentation] Get dcmi power reading via IPMI raw command. |
| 779 | |
| 780 | ${ipmi_raw_output}= Run IPMI Standard Command |
| 781 | ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]} |
| 782 | |
| 783 | @{raw_output_list}= Split String ${ipmi_raw_output} ${SPACE} |
| 784 | |
| 785 | # On successful execution of raw IPMI power reading command, completion |
| 786 | # code does not come in output. So current power value will start from 2 |
| 787 | # byte instead of 3. |
| 788 | |
| 789 | ${power_reading_ipmi_raw_3_item}= Get From List ${raw_output_list} 2 |
| 790 | ${power_reading_ipmi_raw_3_item}= |
| 791 | ... Convert To Integer 0x${power_reading_ipmi_raw_3_item} |
| 792 | |
| 793 | ${power_reading_rest}= Read Attribute |
| 794 | ... ${SENSORS_URI}power/total_power Value |
| 795 | |
| 796 | # Example of power reading via REST |
| 797 | # "CriticalAlarmHigh": 0, |
| 798 | # "CriticalAlarmLow": 0, |
| 799 | # "CriticalHigh": 3100000000, |
| 800 | # "CriticalLow": 0, |
| 801 | # "Scale": -6, |
| 802 | # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts", |
| 803 | # "Value": 228000000, |
| 804 | # "WarningAlarmHigh": 0, |
| 805 | # "WarningAlarmLow": 0, |
| 806 | # "WarningHigh": 3050000000, |
| 807 | # "WarningLow": 0 |
| 808 | |
| 809 | # Get power value based on scale i.e. Value * (10 power Scale Value) |
| 810 | # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000 |
| 811 | |
| 812 | ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000 |
| 813 | ${ipmi_rest_power_diff}= |
| 814 | ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi_raw_3_item}) |
| 815 | |
| 816 | Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff} |
| 817 | ... msg=Power Reading above allowed threshold ${allowed_power_diff}. |
| 818 | |
| 819 | |
Rahul Maheshwari | 0eb33f0 | 2018-04-10 02:31:54 -0500 | [diff] [blame] | 820 | Verify Management Controller ID String Status |
| 821 | [Documentation] Verify management controller ID string status via IPMI. |
| 822 | [Arguments] ${status} |
| 823 | |
| 824 | # Example of dcmi get_conf_param command output: |
| 825 | # DHCP Discovery method : |
| 826 | # Management Controller ID String is disabled |
| 827 | # Vendor class identifier DCMI IANA and Vendor class-specific Informationa are disabled |
| 828 | # Initial timeout interval : 4 seconds |
| 829 | # Server contact timeout interval : 120 seconds |
| 830 | # Server contact retry interval : 64 seconds |
| 831 | |
| 832 | ${resp}= Run IPMI Standard Command dcmi get_conf_param |
| 833 | ${resp}= Get Lines Containing String ${resp} |
| 834 | ... Management Controller ID String case_insensitive=True |
| 835 | Should Contain ${resp} ${status} |
| 836 | ... msg=Management controller ID string is not ${status} |
| 837 | |
| 838 | |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 839 | Verify Power Reading Using REST |
| 840 | [Documentation] Verify power reading using REST. |
| 841 | [Arguments] ${power_reading} |
| 842 | |
Gunnar Mills | 948e2e2 | 2018-03-23 12:54:27 -0500 | [diff] [blame] | 843 | # Description of argument(s): |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 844 | # power_reading IPMI Power reading |
| 845 | |
| 846 | ${power_reading_rest}= Read Attribute |
| 847 | ... ${SENSORS_URI}power/total_power Value |
| 848 | |
| 849 | # Example of power reading via REST |
| 850 | # "CriticalAlarmHigh": 0, |
| 851 | # "CriticalAlarmLow": 0, |
| 852 | # "CriticalHigh": 3100000000, |
| 853 | # "CriticalLow": 0, |
| 854 | # "Scale": -6, |
| 855 | # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts", |
| 856 | # "Value": 228000000, |
| 857 | # "WarningAlarmHigh": 0, |
| 858 | # "WarningAlarmLow": 0, |
| 859 | # "WarningHigh": 3050000000, |
| 860 | # "WarningLow": 0 |
| 861 | |
| 862 | # Get power value based on scale i.e. Value * (10 power Scale Value) |
| 863 | # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000 |
| 864 | ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000 |
| 865 | ${ipmi_rest_power_diff}= |
| 866 | ... Evaluate abs(${power_reading_rest} - ${power_reading}) |
| 867 | |
| 868 | Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff} |
| 869 | ... msg=Power reading above allowed threshold ${allowed_power_diff}. |
George Keishing | 02651f0 | 2018-04-11 02:07:16 -0500 | [diff] [blame] | 870 | |
| 871 | |
| 872 | Get Physical Network Interface Count |
| 873 | [Documentation] Return valid physical network interfaces count. |
| 874 | |
| 875 | # Example: |
| 876 | # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff |
| 877 | # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff |
| 878 | |
| 879 | ${mac_entry_list}= Get BMC MAC Address List |
| 880 | ${mac_unique_list}= Remove Duplicates ${mac_entry_list} |
| 881 | ${physical_interface_count}= Get Length ${mac_unique_list} |
| 882 | |
| 883 | [Return] ${physical_interface_count} |
George Keishing | 39967eb | 2018-04-30 11:36:23 -0500 | [diff] [blame] | 884 | |
George Keishing | e85113a | 2019-06-07 08:21:51 -0500 | [diff] [blame] | 885 | |
| 886 | Set IPMI Restriction Mode |
| 887 | [Documentation] Set the IPMI restriction mode. |
| 888 | [Arguments] ${restriction_mode} |
| 889 | |
| 890 | # Description of argument(s): |
| 891 | # restriction_mode IPMI valid restriction modes. |
| 892 | |
| 893 | ${valueDict}= Create Dictionary data=${restriction_mode} |
| 894 | |
| 895 | Write Attribute ${CONTROL_HOST_URI}restriction_mode/ |
| 896 | ... RestrictionMode data=${valueDict} |