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 | 78ce8dc | 2018-03-30 11:49:06 -0500 | [diff] [blame] | 9 | Library ../../lib/ipmi_utils.py |
George Keishing | 0825a11 | 2018-03-30 10:48:07 -0500 | [diff] [blame] | 10 | Variables ../../data/ipmi_raw_cmd_table.py |
Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 11 | |
| 12 | Test Teardown FFDC On Test Case Fail |
| 13 | |
| 14 | *** Variables *** |
| 15 | |
Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 16 | ${new_mc_id}= HOST |
Rahul Maheshwari | 901dcde | 2018-02-06 03:14:31 -0600 | [diff] [blame] | 17 | ${allowed_temp_diff}= ${1} |
Rahul Maheshwari | 615da15 | 2018-02-13 23:53:36 -0600 | [diff] [blame] | 18 | ${allowed_power_diff}= ${10} |
Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 19 | |
Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 20 | *** Test Cases *** |
| 21 | |
George Keishing | ed89757 | 2018-04-30 11:36:23 -0500 | [diff] [blame^] | 22 | Verify Supported Cipher List |
| 23 | [Documentation] Execute all supported cipher levels and verify. |
| 24 | [Tags] Verify_Supported_Cipher_List |
| 25 | |
| 26 | :FOR ${cipher_level} IN @{valid_cipher_list} |
| 27 | \ Execute IPMI Command With Cipher ${cipher_level} |
| 28 | |
Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 29 | Set Asset Tag With Valid String Length |
| 30 | [Documentation] Set asset tag with valid string length and verify. |
| 31 | [Tags] Set_Asset_Tag_With_Valid_String_Length |
| 32 | |
| 33 | # Allowed MAX characters length for asset tag name is 63. |
| 34 | ${random_string}= Generate Random String 63 |
| 35 | Run Keyword Run IPMI Standard Command dcmi set_asset_tag ${random_string} |
| 36 | |
| 37 | ${asset_tag}= Run Keyword Run IPMI Standard Command dcmi asset_tag |
| 38 | Should Contain ${asset_tag} ${random_string} |
| 39 | |
| 40 | |
| 41 | Set Asset Tag With Invalid String Length |
| 42 | [Documentation] Verify error while setting invalid asset tag via IPMI. |
| 43 | [Tags] Set_Asset_Tag_With_Invalid_String_Length |
| 44 | |
| 45 | # Any string more than 63 character is invalid for asset tag. |
| 46 | ${random_string}= Generate Random String 64 |
| 47 | |
| 48 | ${resp}= Run Keyword And Expect Error * Run IPMI Standard Command |
| 49 | ... dcmi set_asset_tag ${random_string} |
| 50 | Should Contain ${resp} Parameter out of range ignore_case=True |
| 51 | |
| 52 | |
| 53 | Set Asset Tag With Valid String Length Via REST |
| 54 | [Documentation] Set valid asset tag via REST and verify. |
| 55 | [Tags] Set_Asset_Tag_With_Valid_String_Length_Via_REST |
| 56 | |
| 57 | ${random_string}= Generate Random String 63 |
| 58 | ${args}= Create Dictionary data=${random_string} |
| 59 | Write Attribute /xyz/openbmc_project/inventory/system AssetTag |
| 60 | ... data=${args} |
| 61 | |
| 62 | ${asset_tag}= Read Attribute /xyz/openbmc_project/inventory/system |
| 63 | ... AssetTag |
| 64 | Should Be Equal As Strings ${asset_tag} ${random_string} |
| 65 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 66 | |
Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 67 | Verify Get And Set Management Controller ID String |
| 68 | [Documentation] Verify get and set management controller ID string. |
| 69 | [Tags] Verify_Get_And_Set_Management_Controller_ID_String |
| 70 | |
| 71 | # Get the value of the managemment controller ID string. |
| 72 | # Example: |
| 73 | # Get Management Controller Identifier String: witherspoon |
| 74 | |
| 75 | ${cmd_output}= Run IPMI Standard Command dcmi get_mc_id_string |
| 76 | |
| 77 | # Extract management controller ID from cmd_output. |
| 78 | ${initial_mc_id}= Fetch From Right ${cmd_output} :${SPACE} |
| 79 | |
| 80 | # Set the management controller ID string to other value. |
| 81 | # Example: |
| 82 | # Set Management Controller Identifier String Command: HOST |
| 83 | |
| 84 | Set Management Controller ID String ${new_mc_id} |
| 85 | |
| 86 | # Get the management controller ID and verify. |
| 87 | Get Management Controller ID String And Verify ${new_mc_id} |
| 88 | |
| 89 | # Set the value back to the initial value and verify. |
| 90 | Set Management Controller ID String ${initial_mc_id} |
| 91 | |
| 92 | # Get the management controller ID and verify. |
| 93 | Get Management Controller ID String And Verify ${initial_mc_id} |
Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 94 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 95 | |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 96 | Verify Chassis Identify via IPMI |
| 97 | [Documentation] Verify "chassis identify" using IPMI command. |
| 98 | [Tags] Verify_Chassis_Identify_via_IPMI |
| 99 | |
| 100 | # Set to default "chassis identify" and verify that LED blinks for 15s. |
| 101 | Run IPMI Standard Command chassis identify |
| 102 | Verify Identify LED State Blink |
| 103 | |
| 104 | Sleep 15s |
| 105 | Verify Identify LED State Off |
| 106 | |
| 107 | # Set "chassis identify" to 10s and verify that the LED blinks for 10s. |
| 108 | Run IPMI Standard Command chassis identify 10 |
| 109 | Verify Identify LED State Blink |
| 110 | |
| 111 | Sleep 10s |
| 112 | Verify Identify LED State Off |
| 113 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 114 | |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 115 | Verify Chassis Identify Off And Force Identify On via IPMI |
| 116 | [Documentation] Verify "chassis identify" off |
| 117 | ... and "force identify on" via IPMI. |
| 118 | [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI |
| 119 | |
| 120 | # Set the LED to "Force Identify On". |
| 121 | Run IPMI Standard Command chassis identify force |
| 122 | Verify Identify LED State Blink |
| 123 | |
| 124 | # Set "chassis identify" to 0 and verify that the LED turns off. |
| 125 | Run IPMI Standard Command chassis identify 0 |
| 126 | Verify Identify LED State Off |
| 127 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 128 | |
Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 129 | Test Watchdog Reset Via IPMI And Verify Using REST |
| 130 | [Documentation] Test watchdog reset via IPMI and verify using REST. |
| 131 | [Tags] Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST |
| 132 | |
| 133 | Initiate Host Boot |
| 134 | |
| 135 | Set Watchdog Enabled Using REST ${1} |
| 136 | |
| 137 | Watchdog Object Should Exist |
| 138 | |
| 139 | # Resetting the watchdog via IPMI. |
| 140 | Run IPMI Standard Command mc watchdog reset |
| 141 | |
| 142 | # Verify the watchdog is reset using REST after an interval of 1000ms. |
| 143 | Sleep 1000ms |
| 144 | ${watchdog_time_left}= |
| 145 | ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining |
| 146 | Should Be True |
| 147 | ... ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000} |
| 148 | ... msg=Watchdog timer didn't reset. |
| 149 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 150 | |
Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 151 | Test Watchdog Off Via IPMI And Verify Using REST |
| 152 | [Documentation] Test watchdog off via IPMI and verify using REST. |
| 153 | [Tags] Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST |
| 154 | |
| 155 | Initiate Host Boot |
| 156 | |
| 157 | Set Watchdog Enabled Using REST ${1} |
| 158 | |
| 159 | Watchdog Object Should Exist |
| 160 | |
| 161 | # Turn off the watchdog via IPMI. |
| 162 | Run IPMI Standard Command mc watchdog off |
| 163 | |
| 164 | # Verify the watchdog is off using REST |
| 165 | ${watchdog_state}= Read Attribute ${HOST_WATCHDOG_URI} Enabled |
| 166 | Should Be Equal ${watchdog_state} ${0} |
| 167 | ... msg=msg=Verification failed for watchdog off check. |
Rahul Maheshwari | 901dcde | 2018-02-06 03:14:31 -0600 | [diff] [blame] | 168 | |
| 169 | |
| 170 | Test Ambient Temperature Via IPMI |
| 171 | [Documentation] Test ambient temperature via IPMI and verify using REST. |
| 172 | [Tags] Test_Ambient_Temperature_Via_IPMI |
| 173 | |
| 174 | # Entity ID Entity Instance Temp. Readings |
| 175 | # Inlet air temperature(40h) 1 +19 C |
| 176 | # CPU temperature sensors(41h) 5 +51 C |
| 177 | # CPU temperature sensors(41h) 6 +50 C |
| 178 | # CPU temperature sensors(41h) 7 +50 C |
| 179 | # CPU temperature sensors(41h) 8 +50 C |
| 180 | # CPU temperature sensors(41h) 9 +50 C |
| 181 | # CPU temperature sensors(41h) 10 +48 C |
| 182 | # CPU temperature sensors(41h) 11 +49 C |
| 183 | # CPU temperature sensors(41h) 12 +47 C |
| 184 | # CPU temperature sensors(41h) 8 +50 C |
| 185 | # CPU temperature sensors(41h) 16 +51 C |
| 186 | # CPU temperature sensors(41h) 24 +50 C |
| 187 | # CPU temperature sensors(41h) 32 +43 C |
| 188 | # CPU temperature sensors(41h) 40 +43 C |
| 189 | # Baseboard temperature sensors(42h) 1 +35 C |
| 190 | |
| 191 | ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10 |
| 192 | ${ambient_temp_line}= |
| 193 | ... Get Lines Containing String ${temp_reading} |
| 194 | ... Inlet air temperature case-insensitive |
| 195 | |
| 196 | ${ambient_temp_ipmi}= Fetch From Right ${ambient_temp_line} + |
| 197 | ${ambient_temp_ipmi}= Remove String ${ambient_temp_ipmi} ${SPACE}C |
| 198 | |
| 199 | ${ambient_temp_rest}= Read Attribute |
| 200 | ... ${SENSORS_URI}temperature/ambient Value |
| 201 | |
| 202 | # Example of ambient temperature via REST |
| 203 | # "CriticalAlarmHigh": 0, |
| 204 | # "CriticalAlarmLow": 0, |
| 205 | # "CriticalHigh": 35000, |
| 206 | # "CriticalLow": 0, |
| 207 | # "Scale": -3, |
| 208 | # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC", |
| 209 | # "Value": 21775, |
| 210 | # "WarningAlarmHigh": 0, |
| 211 | # "WarningAlarmLow": 0, |
| 212 | # "WarningHigh": 25000, |
| 213 | # "WarningLow": 0 |
| 214 | |
| 215 | # Get temperature value based on scale i.e. Value * (10 power Scale Value) |
| 216 | # e.g. from above case 21775 * (10 power -3) = 21775/1000 |
| 217 | |
| 218 | ${ambient_temp_rest}= Evaluate ${ambient_temp_rest}/1000 |
| 219 | ${ipmi_rest_temp_diff}= |
| 220 | ... Evaluate abs(${ambient_temp_rest} - ${ambient_temp_ipmi}) |
| 221 | |
| 222 | Should Be True ${ipmi_rest_temp_diff} <= ${allowed_temp_diff} |
| 223 | ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}. |
| 224 | |
| 225 | |
Rahul Maheshwari | 4355663 | 2018-02-05 23:42:52 -0600 | [diff] [blame] | 226 | Verify Get DCMI Capabilities |
| 227 | [Documentation] Verify get DCMI capabilities command output. |
| 228 | [Tags] Verify_Get_DCMI_Capabilities |
| 229 | |
| 230 | ${cmd_output}= Run IPMI Standard Command dcmi discover |
| 231 | |
| 232 | @{supported_capabilities}= Create List |
| 233 | # Supported DCMI capabilities: |
| 234 | ... Mandatory platform capabilties |
| 235 | ... Optional platform capabilties |
| 236 | ... Power management available |
| 237 | ... Managebility access capabilties |
| 238 | ... In-band KCS channel available |
| 239 | # Mandatory platform attributes: |
| 240 | ... 200 SEL entries |
| 241 | ... SEL automatic rollover is enabled |
| 242 | # Optional Platform Attributes: |
| 243 | ... Slave address of device: 0h (8bits)(Satellite/External controller) |
| 244 | ... Channel number is 0h (Primary BMC) |
| 245 | ... Device revision is 0 |
| 246 | # Manageability Access Attributes: |
| 247 | ... Primary LAN channel number: 1 is available |
| 248 | ... Secondary LAN channel is not available for OOB |
| 249 | ... No serial channel is available |
| 250 | |
| 251 | :FOR ${capability} IN @{supported_capabilities} |
| 252 | \ Should Contain ${cmd_output} ${capability} ignore_case=True |
| 253 | ... msg=Supported DCMI capabilities not present. |
| 254 | |
| 255 | |
Rahul Maheshwari | 615da15 | 2018-02-13 23:53:36 -0600 | [diff] [blame] | 256 | Test Power Reading Via IPMI With Host Booted |
| 257 | [Documentation] Test power reading via IPMI with host booted state and |
| 258 | ... verify using REST. |
| 259 | [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted |
| 260 | |
| 261 | REST Power On stack_mode=skip quiet=1 |
| 262 | |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 263 | Verify Power Reading |
Rahul Maheshwari | 615da15 | 2018-02-13 23:53:36 -0600 | [diff] [blame] | 264 | |
Rahul Maheshwari | 615da15 | 2018-02-13 23:53:36 -0600 | [diff] [blame] | 265 | |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 266 | Test Power Reading Via IPMI With Host Off |
| 267 | [Documentation] Test power reading via IPMI with host off state and |
| 268 | ... verify using REST. |
| 269 | [Tags] Test_Power_Reading_Via_IPMI_With_Host_Off |
Rahul Maheshwari | 615da15 | 2018-02-13 23:53:36 -0600 | [diff] [blame] | 270 | |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 271 | REST Power Off stack_mode=skip quiet=1 |
Rahul Maheshwari | 615da15 | 2018-02-13 23:53:36 -0600 | [diff] [blame] | 272 | |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 273 | Verify Power Reading |
Rahul Maheshwari | 615da15 | 2018-02-13 23:53:36 -0600 | [diff] [blame] | 274 | |
| 275 | |
Rahul Maheshwari | abe13af | 2018-02-15 22:42:08 -0600 | [diff] [blame] | 276 | Test Power Reading Via IPMI Raw Command |
| 277 | [Documentation] Test power reading via IPMI raw command and verify |
| 278 | ... using REST. |
| 279 | [Tags] Test_Power_Reading_Via_IPMI_Raw_Command |
| 280 | |
| 281 | # Response data structure of power reading command output via IPMI. |
| 282 | # 1 Completion Code. Refer to section 8, DCMI Completion Codes. |
| 283 | # 2 Group Extension Identification = DCh |
| 284 | # 3:4 Current Power in watts |
| 285 | |
| 286 | ${ipmi_raw_output}= Run IPMI Standard Command |
| 287 | ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]} |
| 288 | |
| 289 | @{raw_output_list}= Split String ${ipmi_raw_output} ${SPACE} |
| 290 | |
| 291 | # On successful execution of raw IPMI power reading command, completion |
| 292 | # code does not come in output. So current power value will start from 2 |
| 293 | # byte instead of 3. |
| 294 | |
| 295 | ${power_reading_ipmi_raw_3_item}= Get From List ${raw_output_list} 2 |
| 296 | ${power_reading_ipmi_raw_3_item}= |
| 297 | ... Convert To Integer 0x${power_reading_ipmi_raw_3_item} |
| 298 | |
| 299 | ${power_reading_rest}= Read Attribute |
| 300 | ... ${SENSORS_URI}power/total_power Value |
| 301 | |
| 302 | # Example of power reading via REST |
| 303 | # "CriticalAlarmHigh": 0, |
| 304 | # "CriticalAlarmLow": 0, |
| 305 | # "CriticalHigh": 3100000000, |
| 306 | # "CriticalLow": 0, |
| 307 | # "Scale": -6, |
| 308 | # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts", |
| 309 | # "Value": 228000000, |
| 310 | # "WarningAlarmHigh": 0, |
| 311 | # "WarningAlarmLow": 0, |
| 312 | # "WarningHigh": 3050000000, |
| 313 | # "WarningLow": 0 |
| 314 | |
| 315 | # Get power value based on scale i.e. Value * (10 power Scale Value) |
| 316 | # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000 |
| 317 | |
| 318 | ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000 |
| 319 | ${ipmi_rest_power_diff}= |
| 320 | ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi_raw_3_item}) |
| 321 | |
| 322 | Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff} |
| 323 | ... msg=Power Reading above allowed threshold ${allowed_power_diff}. |
| 324 | |
| 325 | |
Rahul Maheshwari | 91a18ef | 2018-02-15 04:54:59 -0600 | [diff] [blame] | 326 | Test Baseboard Temperature Via IPMI |
| 327 | [Documentation] Test baseboard temperature via IPMI and verify using REST. |
| 328 | [Tags] Test_Baseboard_Temperature_Via_IPMI |
| 329 | |
| 330 | # Example of IPMI dcmi get_temp_reading output: |
| 331 | # Entity ID Entity Instance Temp. Readings |
| 332 | # Inlet air temperature(40h) 1 +19 C |
| 333 | # CPU temperature sensors(41h) 5 +51 C |
| 334 | # CPU temperature sensors(41h) 6 +50 C |
| 335 | # CPU temperature sensors(41h) 7 +50 C |
| 336 | # CPU temperature sensors(41h) 8 +50 C |
| 337 | # CPU temperature sensors(41h) 9 +50 C |
| 338 | # CPU temperature sensors(41h) 10 +48 C |
| 339 | # CPU temperature sensors(41h) 11 +49 C |
| 340 | # CPU temperature sensors(41h) 12 +47 C |
| 341 | # CPU temperature sensors(41h) 8 +50 C |
| 342 | # CPU temperature sensors(41h) 16 +51 C |
| 343 | # CPU temperature sensors(41h) 24 +50 C |
| 344 | # CPU temperature sensors(41h) 32 +43 C |
| 345 | # CPU temperature sensors(41h) 40 +43 C |
| 346 | # Baseboard temperature sensors(42h) 1 +35 C |
| 347 | |
| 348 | ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10 |
| 349 | ${baseboard_temp_line}= |
| 350 | ... Get Lines Containing String ${temp_reading} |
| 351 | ... Baseboard temperature case-insensitive=True |
| 352 | |
| 353 | ${baseboard_temp_ipmi}= Fetch From Right ${baseboard_temp_line} + |
| 354 | ${baseboard_temp_ipmi}= Remove String ${baseboard_temp_ipmi} ${SPACE}C |
| 355 | |
| 356 | ${baseboard_temp_rest}= Read Attribute |
| 357 | ... /xyz/openbmc_project/sensors/temperature/pcie Value |
| 358 | ${baseboard_temp_rest}= Evaluate ${baseboard_temp_rest}/1000 |
| 359 | |
| 360 | Should Be True |
| 361 | ... ${baseboard_temp_rest} - ${baseboard_temp_ipmi} <= ${allowed_temp_diff} |
| 362 | ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}. |
| 363 | |
| 364 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 365 | Retrieve Default Gateway Via IPMI And Verify Using REST |
| 366 | [Documentation] Retrieve default gateway from LAN print using IPMI. |
| 367 | [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify_Using_REST |
| 368 | |
| 369 | # Fetch "Default Gateway" from IPMI LAN print. |
| 370 | ${default_gateway_ipmi}= Fetch Details From LAN Print Default Gateway IP |
| 371 | |
| 372 | # Verify "Default Gateway" using REST. |
| 373 | Read Attribute ${NETWORK_MANAGER}/config DefaultGateway |
| 374 | ... expected_value=${default_gateway_ipmi} |
| 375 | |
| 376 | |
| 377 | Retrieve MAC Address Via IPMI And Verify Using REST |
| 378 | [Documentation] Retrieve MAC Address from LAN print using IPMI. |
| 379 | [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_REST |
| 380 | |
| 381 | # Fetch "MAC Address" from IPMI LAN print. |
| 382 | ${mac_address_ipmi}= Fetch Details From LAN Print MAC Address |
| 383 | |
| 384 | # Verify "MAC Address" using REST. |
| 385 | ${mac_address_rest}= Get BMC MAC Address |
| 386 | Should Be Equal ${mac_address_ipmi} ${mac_address_rest} |
| 387 | ... msg=Verification of MAC address from lan print using IPMI failed. |
| 388 | |
| 389 | |
| 390 | Retrieve Network Mode Via IPMI And Verify Using REST |
| 391 | [Documentation] Retrieve network mode from LAN print using IPMI. |
| 392 | [Tags] Retrieve_Network_Mode_Via_IPMI_And_Verify_Using_REST |
| 393 | |
| 394 | # Fetch "Mode" from IPMI LAN print. |
| 395 | ${network_mode_ipmi}= Fetch Details From LAN Print Source |
| 396 | |
| 397 | # Verify "Mode" using REST. |
| 398 | ${network_mode_rest}= Read Attribute |
| 399 | ... ${NETWORK_MANAGER}/eth0 DHCPEnabled |
| 400 | Run Keyword If '${network_mode_ipmi}' == 'Static Address' |
| 401 | ... Should Be Equal ${network_mode_rest} ${0} |
| 402 | ... msg=Verification of network setting failed. |
| 403 | ... ELSE IF '${network_mode_ipmi}' == 'DHCP' |
| 404 | ... Should Be Equal ${network_mode_rest} ${1} |
| 405 | ... msg=Verification of network setting failed. |
| 406 | |
| 407 | |
| 408 | Retrieve IP Address Via IPMI And Verify With BMC Details |
| 409 | [Documentation] Retrieve IP address from LAN print using IPMI. |
| 410 | [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_With_BMC_Details |
| 411 | |
| 412 | # Fetch "IP Address" from IPMI LAN print. |
| 413 | ${ip_addr_ipmi}= Fetch Details From LAN Print IP Address |
| 414 | |
| 415 | # Verify the IP address retrieved via IPMI with BMC IPs. |
| 416 | ${ip_address_rest}= Get BMC IP Info |
| 417 | Validate IP On BMC ${ip_addr_ipmi} ${ip_address_rest} |
| 418 | |
| 419 | |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 420 | Verify Get Device ID |
| 421 | [Documentation] Verify get device ID command output. |
| 422 | [Tags] Verify_Get_Device_ID |
| 423 | |
| 424 | # Example of get device ID command output: |
| 425 | # Device ID : 0 |
| 426 | # Device Revision : 0 |
| 427 | # Firmware Revision : 2.01 |
| 428 | # IPMI Version : 2.0 |
| 429 | # Manufacturer ID : 42817 |
| 430 | # Manufacturer Name : Unknown (0xA741) |
| 431 | # Product ID : 16975 (0x424f) |
| 432 | # Product Name : Unknown (0x424F) |
| 433 | # Device Available : yes |
| 434 | # Provides Device SDRs : yes |
| 435 | # Additional Device Support : |
| 436 | # Sensor Device |
| 437 | # SEL Device |
| 438 | # FRU Inventory Device |
| 439 | # Chassis Device |
| 440 | # Aux Firmware Rev Info : |
George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 441 | # 0x04 |
| 442 | # 0x38 |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 443 | # 0x00 |
George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 444 | # 0x03 |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 445 | |
| 446 | ${mc_info}= Get MC Info |
| 447 | |
| 448 | Should Be Equal ${mc_info['device_id']} 0 |
| 449 | Should Be Equal ${mc_info['device_revision']} 0 |
| 450 | |
Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 451 | # Get firmware revision from mc info command output i.e. 2.01 |
| 452 | ${ipmi_fw_major_version} ${ipmi_fw_minor_version}= |
| 453 | ... Split String ${mc_info['firmware_revision']} . |
| 454 | # Convert minor firmware version from BCD format to integer. i.e. 01 to 1 |
| 455 | ${ipmi_fw_minor_version}= Convert To Integer ${ipmi_fw_minor_version} |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 456 | |
Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 457 | # Get BMC version from BMC CLI i.e. 2.1 from "ibm-v2.1-338-r1-0-gbcd7765" |
George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 458 | ${bmc_version_full}= Get BMC Version |
Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 459 | ${bmc_version}= |
George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 460 | ... Remove String Using Regexp ${bmc_version_full} ^[^0-9]+ [^0-9\.].* |
Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 461 | |
| 462 | # Get major and minor version from BMC version i.e. 2 and 1 from 2.1 |
| 463 | ${bmc_major_version} ${bmc_minor_version}= |
| 464 | ... Split String ${bmc_version} . |
| 465 | |
| 466 | Should Be Equal As Strings ${ipmi_fw_major_version} ${bmc_major_version} |
| 467 | ... msg=Major version mis-match. |
| 468 | Should Be Equal As Strings ${ipmi_fw_minor_version} ${bmc_minor_version} |
| 469 | ... msg=Minor version mis-match. |
| 470 | |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 471 | Should Be Equal ${mc_info['ipmi_version']} 2.0 |
| 472 | |
Gunnar Mills | 917ba1a | 2018-04-08 16:42:12 -0500 | [diff] [blame] | 473 | # TODO: Verify Manufacturer and Product IDs directly from json file. |
Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 474 | # Reference : openbmc/openbmc-test-automation#1244 |
| 475 | Should Be Equal ${mc_info['manufacturer_id']} 42817 |
| 476 | Should Be Equal ${mc_info['product_id']} 16975 (0x424f) |
| 477 | |
| 478 | Should Be Equal ${mc_info['device_available']} yes |
| 479 | Should Be Equal ${mc_info['provides_device_sdrs']} yes |
| 480 | Should Contain ${mc_info['additional_device_support']} Sensor Device |
| 481 | Should Contain ${mc_info['additional_device_support']} SEL Device |
| 482 | Should Contain |
| 483 | ... ${mc_info['additional_device_support']} FRU Inventory Device |
| 484 | Should Contain ${mc_info['additional_device_support']} Chassis Device |
George Keishing | b746d3f | 2018-04-19 10:53:10 -0500 | [diff] [blame] | 485 | |
George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 486 | # Auxiliary revision data verification. |
| 487 | ${aux_version}= Get Aux Version ${bmc_version_full} |
| 488 | |
| 489 | # From aux_firmware_rev_info field ['0x04', '0x38', '0x00', '0x03'] |
| 490 | ${bmc_aux_version}= Catenate |
| 491 | ... SEPARATOR= |
| 492 | ... ${mc_info['aux_firmware_rev_info'][0][2:]} |
| 493 | ... ${mc_info['aux_firmware_rev_info'][1][2:]} |
| 494 | ... ${mc_info['aux_firmware_rev_info'][2][2:]} |
| 495 | ... ${mc_info['aux_firmware_rev_info'][3][2:]} |
| 496 | |
| 497 | Should Be Equal As Integers |
| 498 | ... ${bmc_aux_version} ${aux_version} |
| 499 | ... 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] | 500 | |
| 501 | |
Rahul Maheshwari | dc6a32c | 2018-03-15 05:21:55 -0500 | [diff] [blame] | 502 | Verify SDR Info |
| 503 | [Documentation] Verify sdr info command output. |
| 504 | [Tags] Verify_SDR_Info |
| 505 | |
| 506 | # Example of SDR info command output: |
| 507 | # SDR Version : 0x51 |
| 508 | # Record Count : 216 |
| 509 | # Free Space : unspecified |
| 510 | # Most recent Addition : |
| 511 | # Most recent Erase : |
| 512 | # SDR overflow : no |
| 513 | # SDR Repository Update Support : unspecified |
| 514 | # Delete SDR supported : no |
| 515 | # Partial Add SDR supported : no |
| 516 | # Reserve SDR repository supported : no |
| 517 | # SDR Repository Alloc info supported : no |
| 518 | |
| 519 | ${sdr_info}= Get SDR Info |
| 520 | Should Be Equal ${sdr_info['sdr_version']} 0x51 |
| 521 | |
| 522 | # Get sensor count from "sdr elist all" command output. |
| 523 | ${sensor_count}= Get Sensor Count |
| 524 | Should Be Equal As Strings |
| 525 | ... ${sdr_info['record_count']} ${sensor_count} |
| 526 | |
| 527 | Should Be Equal ${sdr_info['free_space']} unspecified |
| 528 | Should Be Equal ${sdr_info['most_recent_addition']} ${EMPTY} |
| 529 | Should Be Equal ${sdr_info['most_recent_erase']} ${EMPTY} |
| 530 | Should Be Equal ${sdr_info['sdr_overflow']} no |
| 531 | Should Be Equal ${sdr_info['sdr_repository_update_support']} unspecified |
| 532 | Should Be Equal ${sdr_info['delete_sdr_supported']} no |
| 533 | Should Be Equal ${sdr_info['partial_add_sdr_supported']} no |
| 534 | Should Be Equal ${sdr_info['reserve_sdr_repository_supported']} no |
| 535 | Should Be Equal ${sdr_info['sdr_repository_alloc_info_supported']} no |
| 536 | |
| 537 | |
George Keishing | 02651f0 | 2018-04-11 02:07:16 -0500 | [diff] [blame] | 538 | Test Valid IPMI Channels Supported |
| 539 | [Documentation] Verify IPMI channels supported on a given system. |
| 540 | [Tags] Test_Valid_IPMI_Channels_Supported |
| 541 | |
| 542 | ${channel_count}= Get Physical Network Interface Count |
| 543 | |
| 544 | # Note: IPMI network channel logically starts from 1. |
| 545 | :FOR ${channel_number} IN RANGE 1 ${channel_count} |
| 546 | \ Run External IPMI Standard Command lan print ${channel_number} |
| 547 | |
| 548 | |
| 549 | Test Invalid IPMI Channel Response |
| 550 | [Documentation] Verify invalid IPMI channels supported response. |
| 551 | [Tags] Test_Invalid_IPMI_Channel_Response |
| 552 | |
| 553 | ${channel_count}= Get Physical Network Interface Count |
| 554 | |
| 555 | # To target invalid channel, increment count. |
| 556 | ${channel_number}= Evaluate ${channel_count} + 1 |
| 557 | |
| 558 | # Example of invalid channel: |
| 559 | # $ ipmitool -I lanplus -H xx.xx.xx.xx -P 0penBmc lan print 3 |
| 560 | # Get Channel Info command failed: Parameter out of range |
| 561 | # Invalid channel: 3 |
| 562 | |
| 563 | ${stdout}= Run External IPMI Standard Command |
| 564 | ... lan print ${channel_number} fail_on_err=${0} |
| 565 | Should Contain ${stdout} Invalid channel |
| 566 | ... msg=IPMI channel ${channel_number} is invalid but seen working. |
| 567 | |
| 568 | |
Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 569 | *** Keywords *** |
Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 570 | |
Rahul Maheshwari | dc6a32c | 2018-03-15 05:21:55 -0500 | [diff] [blame] | 571 | Get Sensor Count |
| 572 | [Documentation] Get sensors count using "sdr elist all" command. |
| 573 | |
| 574 | # Example of "sdr elist all" command output: |
| 575 | # BootProgress | 03h | ok | 34.2 | |
| 576 | # OperatingSystemS | 05h | ok | 35.1 | |
| 577 | # AttemptsLeft | 07h | ok | 34.1 | |
| 578 | # occ0 | 08h | ok | 210.1 | Device Disabled |
| 579 | # occ1 | 09h | ok | 210.2 | Device Disabled |
| 580 | # p0_core0_temp | 11h | ns | 3.1 | Disabled |
| 581 | # cpu0_core0 | 12h | ok | 208.1 | Presence detected |
| 582 | # p0_core1_temp | 14h | ns | 3.2 | Disabled |
| 583 | # cpu0_core1 | 15h | ok | 208.2 | Presence detected |
| 584 | # p0_core2_temp | 17h | ns | 3.3 | Disabled |
| 585 | # .. |
| 586 | # .. |
| 587 | # .. |
| 588 | # .. |
| 589 | # .. |
| 590 | # .. |
| 591 | # fan3 | 00h | ns | 29.4 | Logical FRU @35h |
| 592 | # bmc | 00h | ns | 6.1 | Logical FRU @3Ch |
| 593 | # ethernet | 00h | ns | 1.1 | Logical FRU @46h |
| 594 | |
| 595 | ${output}= Run IPMI Standard Command sdr elist all |
| 596 | ${sensor_list}= Split String ${output} \n |
| 597 | ${sensor_count}= Get Length ${sensor_list} |
| 598 | [Return] ${sensor_count} |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 599 | |
Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 600 | Set Management Controller ID String |
| 601 | [Documentation] Set the management controller ID string. |
| 602 | [Arguments] ${string} |
| 603 | |
| 604 | # Description of argument(s): |
| 605 | # string Management Controller ID String to be set |
| 606 | |
| 607 | ${set_mc_id_string}= Run IPMI Standard Command |
| 608 | ... dcmi set_mc_id_string ${string} |
| 609 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 610 | |
Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 611 | Get Management Controller ID String And Verify |
| 612 | [Documentation] Get the management controller ID sting. |
| 613 | [Arguments] ${string} |
| 614 | |
| 615 | # Description of argument(s): |
| 616 | # string Management Controller ID string |
| 617 | |
| 618 | ${get_mc_id}= Run IPMI Standard Command dcmi get_mc_id_string |
| 619 | Should Contain ${get_mc_id} ${string} |
| 620 | ... msg=Command failed: get_mc_id. |
Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 621 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 622 | |
Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 623 | Set Watchdog Enabled Using REST |
| 624 | [Documentation] Set watchdog Enabled field using REST. |
| 625 | [Arguments] ${value} |
| 626 | |
| 627 | # Description of argument(s): |
| 628 | # value Integer value (eg. "0-Disabled", "1-Enabled"). |
| 629 | |
| 630 | ${value_dict}= Create Dictionary data=${value} |
| 631 | ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}/attr/Enabled |
| 632 | ... data=${value_dict} |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 633 | |
| 634 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 635 | Fetch Details From LAN Print |
| 636 | [Documentation] Fetch details from LAN print. |
| 637 | [Arguments] ${field_name} |
| 638 | |
| 639 | # Description of argument(s): |
| 640 | # ${field_name} Field name to be fetched from LAN print |
| 641 | # (e.g. "MAC Address", "Source"). |
| 642 | |
Sweta Potthuri | c64322a | 2018-02-22 05:30:30 -0600 | [diff] [blame] | 643 | ${stdout}= Run External IPMI Standard Command lan print |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 644 | ${fetch_value}= Get Lines Containing String ${stdout} ${field_name} |
| 645 | ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE} |
| 646 | [Return] ${value_fetch} |
| 647 | |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 648 | |
| 649 | Verify Power Reading |
| 650 | [Documentation] Get dcmi power reading via IPMI. |
| 651 | |
| 652 | # Example of power reading command output via IPMI. |
| 653 | # Instantaneous power reading: 235 Watts |
| 654 | # Minimum during sampling period: 235 Watts |
| 655 | # Maximum during sampling period: 235 Watts |
| 656 | # Average power reading over sample period: 235 Watts |
| 657 | # IPMI timestamp: Thu Jan 1 00:00:00 1970 |
| 658 | # Sampling period: 00000000 Seconds. |
| 659 | # Power reading state is: deactivated |
| 660 | |
| 661 | ${power_reading}= Get IPMI Power Reading |
| 662 | |
| 663 | ${host_state}= Get Host State |
| 664 | Run Keyword If '${host_state}' == 'Off' |
George Keishing | 5131487 | 2018-03-31 13:24:35 -0500 | [diff] [blame] | 665 | ... Should Be Equal ${power_reading['instantaneous_power_reading']} 0 |
| 666 | ... msg=Power reading not zero when power is off. |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 667 | |
George Keishing | 5131487 | 2018-03-31 13:24:35 -0500 | [diff] [blame] | 668 | Run Keyword If '${power_reading['instantaneous_power_reading']}' != '0' |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 669 | ... Verify Power Reading Using REST ${power_reading['instantaneous_power_reading']} |
| 670 | |
| 671 | |
| 672 | Verify Power Reading Using REST |
| 673 | [Documentation] Verify power reading using REST. |
| 674 | [Arguments] ${power_reading} |
| 675 | |
Gunnar Mills | 948e2e2 | 2018-03-23 12:54:27 -0500 | [diff] [blame] | 676 | # Description of argument(s): |
Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 677 | # power_reading IPMI Power reading |
| 678 | |
| 679 | ${power_reading_rest}= Read Attribute |
| 680 | ... ${SENSORS_URI}power/total_power Value |
| 681 | |
| 682 | # Example of power reading via REST |
| 683 | # "CriticalAlarmHigh": 0, |
| 684 | # "CriticalAlarmLow": 0, |
| 685 | # "CriticalHigh": 3100000000, |
| 686 | # "CriticalLow": 0, |
| 687 | # "Scale": -6, |
| 688 | # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts", |
| 689 | # "Value": 228000000, |
| 690 | # "WarningAlarmHigh": 0, |
| 691 | # "WarningAlarmLow": 0, |
| 692 | # "WarningHigh": 3050000000, |
| 693 | # "WarningLow": 0 |
| 694 | |
| 695 | # Get power value based on scale i.e. Value * (10 power Scale Value) |
| 696 | # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000 |
| 697 | ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000 |
| 698 | ${ipmi_rest_power_diff}= |
| 699 | ... Evaluate abs(${power_reading_rest} - ${power_reading}) |
| 700 | |
| 701 | Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff} |
| 702 | ... msg=Power reading above allowed threshold ${allowed_power_diff}. |
George Keishing | 02651f0 | 2018-04-11 02:07:16 -0500 | [diff] [blame] | 703 | |
| 704 | |
| 705 | Get Physical Network Interface Count |
| 706 | [Documentation] Return valid physical network interfaces count. |
| 707 | |
| 708 | # Example: |
| 709 | # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff |
| 710 | # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff |
| 711 | |
| 712 | ${mac_entry_list}= Get BMC MAC Address List |
| 713 | ${mac_unique_list}= Remove Duplicates ${mac_entry_list} |
| 714 | ${physical_interface_count}= Get Length ${mac_unique_list} |
| 715 | |
| 716 | [Return] ${physical_interface_count} |
George Keishing | ed89757 | 2018-04-30 11:36:23 -0500 | [diff] [blame^] | 717 | |
| 718 | |
| 719 | Execute IPMI Command With Cipher |
| 720 | [Documentation] Execute IPMI command with a given cipher level value. |
| 721 | [Arguments] ${cipher_level} |
| 722 | |
| 723 | # Description of argument(s): |
| 724 | # cipher_level IPMI chipher level value |
| 725 | # (e.g. "1", "2", "3", "15", "16", "17"). |
| 726 | |
| 727 | ${ipmi_cmd}= Catenate SEPARATOR= |
| 728 | ... ipmitool -I lanplus -C ${cipher_level} -P${SPACE}${IPMI_PASSWORD} |
| 729 | ... ${SPACE}${HOST}${SPACE}${OPENBMC_HOST}${SPACE}mc info |
| 730 | |
| 731 | ${rc} ${output}= Run And Return RC and Output ${ipmi_cmd} |
| 732 | Should Be Equal ${rc} ${0} msg=${output} |