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