Anusha Dathatri | 88ccaff | 2020-02-07 05:17:53 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Validate IPMI sensor IDs using Redfish. |
| 3 | |
| 4 | Resource ../lib/ipmi_client.robot |
| 5 | Resource ../lib/openbmc_ffdc.robot |
Sushma M M | d4d13f0 | 2020-02-13 03:42:41 -0600 | [diff] [blame] | 6 | Library ../lib/ipmi_utils.py |
Sushma M M | fd2f428 | 2020-03-18 04:12:47 -0500 | [diff] [blame] | 7 | Variables ../data/ipmi_raw_cmd_table.py |
Anusha Dathatri | 88ccaff | 2020-02-07 05:17:53 -0600 | [diff] [blame] | 8 | |
Sushma M M | fd2f428 | 2020-03-18 04:12:47 -0500 | [diff] [blame] | 9 | Test Setup Redfish.Login |
| 10 | Test Teardown Run Keywords FFDC On Test Case Fail AND |
| 11 | ... Redfish.Logout |
Anusha Dathatri | 88ccaff | 2020-02-07 05:17:53 -0600 | [diff] [blame] | 12 | |
Sushma M M | be808b9 | 2020-02-03 23:12:14 -0600 | [diff] [blame] | 13 | |
| 14 | *** Variables *** |
Sushma M M | 84e98d9 | 2020-04-15 04:47:10 -0500 | [diff] [blame] | 15 | ${allowed_temp_diff} ${2} |
Sushma M M | d4d13f0 | 2020-02-13 03:42:41 -0600 | [diff] [blame] | 16 | ${allowed_power_diff} ${10} |
Sushma M M | be808b9 | 2020-02-03 23:12:14 -0600 | [diff] [blame] | 17 | |
| 18 | |
Anusha Dathatri | 88ccaff | 2020-02-07 05:17:53 -0600 | [diff] [blame] | 19 | *** Test Cases *** |
| 20 | |
| 21 | Verify IPMI Temperature Readings using Redfish |
| 22 | [Documentation] Verify temperatures from IPMI sensor reading command using Redfish. |
| 23 | [Tags] Verify_IPMI_Temperature_Readings_using_Redfish |
| 24 | [Template] Get Temperature Reading And Verify In Redfish |
| 25 | |
| 26 | # command_type sensor_id member_id |
| 27 | IPMI pcie pcie |
| 28 | IPMI ambient ambient |
| 29 | |
| 30 | |
| 31 | Verify DCMI Temperature Readings using Redfish |
| 32 | [Documentation] Verify temperatures from DCMI sensor reading command using Redfish. |
| 33 | [Tags] Verify_DCMI_Temperature_Readings_using_Redfish |
| 34 | [Template] Get Temperature Reading And Verify In Redfish |
| 35 | |
| 36 | # command_type sensor_id member_id |
| 37 | DCMI pcie pcie |
| 38 | DCMI ambient ambient |
| 39 | |
Sushma M M | be808b9 | 2020-02-03 23:12:14 -0600 | [diff] [blame] | 40 | |
| 41 | Test Ambient Temperature Via IPMI |
| 42 | [Documentation] Test ambient temperature via IPMI and verify using Redfish. |
| 43 | [Tags] Test_Ambient_Temperature_Via_IPMI |
| 44 | |
| 45 | # Example of IPMI dcmi get_temp_reading output: |
| 46 | # Entity ID Entity Instance Temp. Readings |
| 47 | # Inlet air temperature(40h) 1 +19 C |
| 48 | # CPU temperature sensors(41h) 5 +51 C |
| 49 | # CPU temperature sensors(41h) 6 +50 C |
| 50 | # CPU temperature sensors(41h) 7 +50 C |
| 51 | # CPU temperature sensors(41h) 8 +50 C |
| 52 | # CPU temperature sensors(41h) 9 +50 C |
| 53 | # CPU temperature sensors(41h) 10 +48 C |
| 54 | # CPU temperature sensors(41h) 11 +49 C |
| 55 | # CPU temperature sensors(41h) 12 +47 C |
| 56 | # CPU temperature sensors(41h) 8 +50 C |
| 57 | # CPU temperature sensors(41h) 16 +51 C |
| 58 | # CPU temperature sensors(41h) 24 +50 C |
| 59 | # CPU temperature sensors(41h) 32 +43 C |
| 60 | # CPU temperature sensors(41h) 40 +43 C |
| 61 | # Baseboard temperature sensors(42h) 1 +35 C |
| 62 | |
| 63 | ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10 |
| 64 | Should Contain ${temp_reading} Inlet air temperature |
| 65 | ... msg="Unable to get inlet temperature via DCMI". |
| 66 | |
| 67 | ${ambient_temp_line}= |
| 68 | ... Get Lines Containing String ${temp_reading} |
| 69 | ... Inlet air temperature case-insensitive |
| 70 | |
| 71 | ${ambient_temp_ipmi}= Set Variable ${ambient_temp_line.split('+')[1].strip(' C')} |
| 72 | |
| 73 | # Example of ambient temperature via Redfish |
| 74 | |
| 75 | #"@odata.id": "/redfish/v1/Chassis/chassis/Thermal#/Temperatures/0", |
| 76 | #"@odata.type": "#Thermal.v1_3_0.Temperature", |
| 77 | #"LowerThresholdCritical": 0.0, |
| 78 | #"LowerThresholdNonCritical": 0.0, |
| 79 | #"MaxReadingRangeTemp": 0.0, |
| 80 | #"MemberId": "ambient", |
| 81 | #"MinReadingRangeTemp": 0.0, |
| 82 | #"Name": "ambient", |
| 83 | #"ReadingCelsius": 24.987000000000002, |
| 84 | #"Status": { |
| 85 | #"Health": "OK", |
| 86 | #"State": "Enabled" |
| 87 | #}, |
| 88 | #"UpperThresholdCritical": 35.0, |
| 89 | #"UpperThresholdNonCritical": 25.0 |
| 90 | |
| 91 | ${ambient_temp_redfish}= Get Temperature Reading From Redfish ambient |
| 92 | |
| 93 | ${ipmi_redfish_temp_diff}= |
| 94 | ... Evaluate abs(${ambient_temp_redfish} - ${ambient_temp_ipmi}) |
| 95 | |
| 96 | Should Be True ${ipmi_redfish_temp_diff} <= ${allowed_temp_diff} |
| 97 | ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}. |
| 98 | |
| 99 | |
Sushma M M | d4d13f0 | 2020-02-13 03:42:41 -0600 | [diff] [blame] | 100 | Test Power Reading Via IPMI With Host Off |
| 101 | [Documentation] Verify power reading via IPMI with host in off state |
| 102 | [Tags] Test_Power_Reading_Via_IPMI_With_Host_Off |
| 103 | |
| 104 | Redfish Power Off stack_mode=skip |
| 105 | |
| 106 | ${ipmi_reading}= Get IPMI Power Reading |
| 107 | |
| 108 | Should Be Equal ${ipmi_reading['instantaneous_power_reading']} 0 |
| 109 | ... msg=Power reading not zero when power is off. |
| 110 | |
| 111 | |
| 112 | Test Power Reading Via IPMI With Host Booted |
| 113 | [Documentation] Test power reading via IPMI with host in booted state and |
| 114 | ... verify using Redfish. |
| 115 | [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted |
| 116 | |
| 117 | IPMI Power On stack_mode=skip |
| 118 | |
| 119 | Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading Using IPMI And Redfish |
| 120 | |
| 121 | |
Sushma M M | 85dbd9c | 2020-03-20 15:58:28 -0500 | [diff] [blame] | 122 | Test Baseboard Temperature Via IPMI |
| 123 | [Documentation] Test baseboard temperature via IPMI and verify using Redfish. |
| 124 | [Tags] Test_Baseboard_Temperature_Via_IPMI |
| 125 | |
| 126 | # Example of IPMI dcmi get_temp_reading output: |
| 127 | # Entity ID Entity Instance Temp. Readings |
| 128 | # Inlet air temperature(40h) 1 +19 C |
| 129 | # CPU temperature sensors(41h) 5 +51 C |
| 130 | # CPU temperature sensors(41h) 6 +50 C |
| 131 | # CPU temperature sensors(41h) 7 +50 C |
| 132 | # CPU temperature sensors(41h) 8 +50 C |
| 133 | # CPU temperature sensors(41h) 9 +50 C |
| 134 | # CPU temperature sensors(41h) 10 +48 C |
| 135 | # CPU temperature sensors(41h) 11 +49 C |
| 136 | # CPU temperature sensors(41h) 12 +47 C |
| 137 | # CPU temperature sensors(41h) 8 +50 C |
| 138 | # CPU temperature sensors(41h) 16 +51 C |
| 139 | # CPU temperature sensors(41h) 24 +50 C |
| 140 | # CPU temperature sensors(41h) 32 +43 C |
| 141 | # CPU temperature sensors(41h) 40 +43 C |
| 142 | # Baseboard temperature sensors(42h) 1 +35 C |
| 143 | |
| 144 | ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10 |
| 145 | Should Contain ${temp_reading} Baseboard temperature sensors |
| 146 | ... msg="Unable to get baseboard temperature via DCMI". |
| 147 | ${baseboard_temp_line}= |
| 148 | ... Get Lines Containing String ${temp_reading} |
| 149 | ... Baseboard temperature case-insensitive=True |
| 150 | |
| 151 | ${baseboard_temp_ipmi}= Set Variable ${baseboard_temp_line.split('+')[1].strip(' C')} |
| 152 | |
| 153 | # Example of Baseboard temperature via Redfish |
| 154 | |
| 155 | #"@odata.id": "/redfish/v1/Chassis/chassis/Thermal#/Temperatures/9", |
| 156 | #"@odata.type": "#Thermal.v1_3_0.Temperature", |
| 157 | #"LowerThresholdCritical": 0.0, |
| 158 | #"LowerThresholdNonCritical": 0.0, |
| 159 | #"MaxReadingRangeTemp": 0.0, |
| 160 | #"MemberId": "pcie", |
| 161 | #"MinReadingRangeTemp": 0.0, |
| 162 | #"Name": "pcie", |
| 163 | #"ReadingCelsius": 28.687, |
| 164 | #"Status": { |
| 165 | #"Health": "OK", |
| 166 | #"State": "Enabled" |
| 167 | #}, |
| 168 | #"UpperThresholdCritical": 70.0, |
| 169 | #"UpperThresholdNonCritical": 60.0 |
| 170 | |
| 171 | ${baseboard_temp_redfish}= Get Temperature Reading From Redfish pcie |
| 172 | |
| 173 | Should Be True |
| 174 | ... ${baseboard_temp_redfish} - ${baseboard_temp_ipmi} <= ${allowed_temp_diff} |
| 175 | ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}. |
| 176 | |
| 177 | |
Sushma M M | fd2f428 | 2020-03-18 04:12:47 -0500 | [diff] [blame] | 178 | Test Power Reading Via IPMI Raw Command |
| 179 | [Documentation] Test power reading via IPMI raw command and verify |
| 180 | ... using Redfish. |
| 181 | [Tags] Test_Power_Reading_Via_IPMI_Raw_Command |
| 182 | |
| 183 | IPMI Power On stack_mode=skip |
| 184 | |
| 185 | Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading Via Raw Command |
| 186 | |
| 187 | |
Sushma M M | 89882ce | 2020-03-31 17:21:37 -0500 | [diff] [blame] | 188 | Verify CPU Present |
| 189 | [Documentation] Verify the IPMI sensor for CPU present using Redfish. |
| 190 | [Tags] Verify_CPU_Present |
| 191 | [Template] Enable Present Bit Via IPMI and Verify Using Redfish |
| 192 | |
| 193 | # sensor_id component |
| 194 | 0x5a cpu0 |
| 195 | |
| 196 | |
| 197 | Verify CPU Not Present |
| 198 | [Documentation] Verify the IPMI sensor for CPU not present using Redfish. |
| 199 | [Tags] Verify_CPU_Not_Present |
| 200 | [Template] Disable Present Bit Via IPMI and Verify Using Redfish |
| 201 | |
| 202 | # sensor_id component |
| 203 | 0x5a cpu0 |
| 204 | |
| 205 | |
| 206 | Verify GPU Present |
| 207 | [Documentation] Verify the IPMI sensor for GPU present using Redfish. |
| 208 | [Tags] Verify_GPU_Present |
| 209 | [Template] Enable Present Bit Via IPMI and Verify Using Redfish |
| 210 | |
| 211 | # sensor_id component |
| 212 | 0xC5 gv100card0 |
| 213 | |
| 214 | |
| 215 | Verify GPU Not Present |
| 216 | [Documentation] Verify the IPMI sensor for GPU not present using Redfish. |
| 217 | [Tags] Verify_GPU_Not_Present |
| 218 | [Template] Disable Present Bit Via IPMI and Verify Using Redfish |
| 219 | |
| 220 | # sensor_id component |
| 221 | 0xC5 gv100card0 |
| 222 | |
| 223 | |
Anusha Dathatri | 88ccaff | 2020-02-07 05:17:53 -0600 | [diff] [blame] | 224 | *** Keywords *** |
| 225 | |
| 226 | Get Temperature Reading And Verify In Redfish |
| 227 | [Documentation] Get IPMI or DCMI sensor reading and verify in Redfish. |
| 228 | [Arguments] ${command_type} ${sensor_id} ${member_id} |
| 229 | |
| 230 | # Description of argument(s): |
| 231 | # command_type Type of command used to get sensor data (eg. IPMI, DCMI). |
| 232 | # sensor_id Sensor id used to get reading in IPMI or DCMI. |
| 233 | # member_id Member id of sensor data in Redfish. |
| 234 | |
| 235 | ${ipmi_value}= Run Keyword If '${command_type}' == 'IPMI' Get IPMI Sensor Reading ${sensor_id} |
| 236 | ... ELSE Get DCMI Sensor Reading ${sensor_id} |
| 237 | |
| 238 | ${redfish_value}= Get Temperature Reading From Redfish ${member_id} |
| 239 | |
| 240 | Valid Range ${ipmi_value} ${redfish_value-1.000} ${redfish_value+1.000} |
| 241 | |
| 242 | |
| 243 | Get IPMI Sensor Reading |
| 244 | [Documentation] Get reading from IPMI sensor reading command. |
| 245 | [Arguments] ${sensor_id} |
| 246 | |
| 247 | # Description of argument(s): |
| 248 | # sensor_id Sensor id used to get reading in IPMI. |
| 249 | |
| 250 | ${data}= Run IPMI Standard Command sensor reading ${sensor_id} |
| 251 | |
| 252 | # Example reading: |
| 253 | # pcie | 28.500 |
| 254 | |
| 255 | ${sensor_value}= Set Variable ${data.split('| ')[1].strip()} |
| 256 | [Return] ${sensor_value} |
| 257 | |
| 258 | |
| 259 | Get DCMI Sensor Reading |
| 260 | [Documentation] Get reading from DCMI sensors command. |
| 261 | [Arguments] ${sensor_id} |
| 262 | |
| 263 | # Description of argument(s): |
| 264 | # sensor_id Sensor id used to get reading in DCMI. |
| 265 | |
| 266 | ${data}= Run IPMI Standard Command dcmi sensors |
| 267 | ${sensor_data}= Get Lines Containing String ${data} ${sensor_id} |
| 268 | |
| 269 | # Example reading: |
| 270 | # Record ID 0x00fd: pcie | 28.50 degrees C | ok |
| 271 | |
| 272 | ${sensor_value}= Set Variable ${sensor_data.split(' | ')[1].strip('degrees C').strip()} |
| 273 | [Return] ${sensor_value} |
| 274 | |
| 275 | |
| 276 | Get Temperature Reading From Redfish |
| 277 | [Documentation] Get temperature reading from Redfish. |
| 278 | [Arguments] ${member_id} |
| 279 | |
| 280 | # Description of argument(s): |
| 281 | # member_id Member id of temperature. |
| 282 | |
| 283 | @{redfish_readings}= Redfish.Get Attribute /redfish/v1/Chassis/chassis/Thermal Temperatures |
| 284 | FOR ${data} IN @{redfish_readings} |
| 285 | ${redfish_value}= Set Variable If '&{data}[MemberId]' == '${member_id}' |
| 286 | ... &{data}[ReadingCelsius] |
| 287 | Exit For Loop If '&{data}[MemberId]' == '${member_id}' |
| 288 | END |
Sushma M M | d4d13f0 | 2020-02-13 03:42:41 -0600 | [diff] [blame] | 289 | [Return] ${redfish_value} |
| 290 | |
| 291 | |
| 292 | Verify Power Reading Using IPMI And Redfish |
| 293 | [Documentation] Verify power reading using IPMI and Redfish. |
| 294 | |
| 295 | # Example of power reading command output via IPMI. |
| 296 | # Instantaneous power reading: 235 Watts |
| 297 | # Minimum during sampling period: 235 Watts |
| 298 | # Maximum during sampling period: 235 Watts |
| 299 | # Average power reading over sample period: 235 Watts |
| 300 | # IPMI timestamp: Thu Jan 1 00:00:00 1970 |
| 301 | # Sampling period: 00000000 Seconds. |
| 302 | # Power reading state is: deactivated |
| 303 | |
| 304 | ${ipmi_reading}= Get IPMI Power Reading |
| 305 | |
| 306 | ${power}= Redfish.Get Properties /redfish/v1/Chassis/chassis/Power |
| 307 | ${redfish_reading}= Set Variable ${power['PowerControl'][0]['PowerConsumedWatts']} |
| 308 | |
| 309 | ${ipmi_redfish_power_diff}= |
| 310 | ... Evaluate abs(${redfish_reading} - ${ipmi_reading['instantaneous_power_reading']}) |
| 311 | |
| 312 | Should Be True ${ipmi_redfish_power_diff} <= ${allowed_power_diff} |
Sushma M M | fd2f428 | 2020-03-18 04:12:47 -0500 | [diff] [blame] | 313 | ... msg=Power reading above allowed threshold ${allowed_power_diff}. |
| 314 | |
| 315 | |
| 316 | Verify Power Reading Via Raw Command |
| 317 | [Documentation] Get dcmi power reading via IPMI raw command. |
| 318 | |
| 319 | ${ipmi_raw_output}= Run IPMI Standard Command |
| 320 | ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]} |
| 321 | |
| 322 | ${power_reading_ipmi}= Set Variable ${ipmi_raw_output.split()[1]} |
| 323 | ${power_reading_ipmi}= |
| 324 | ... Convert To Integer 0x${power_reading_ipmi} |
| 325 | |
| 326 | # Example of power reading via Redfish |
| 327 | # "@odata.id": "/redfish/v1/Chassis/chassis/Power#/PowerControl/0", |
| 328 | # "@odata.type": "#Power.v1_0_0.PowerControl", |
| 329 | # "MemberId": "0", |
| 330 | # "Name": "Chassis Power Control", |
| 331 | # "PowerConsumedWatts": 145.0, |
| 332 | |
| 333 | ${power}= Redfish.Get Properties /redfish/v1/Chassis/chassis/Power |
| 334 | ${redfish_reading}= Set Variable ${power['PowerControl'][0]['PowerConsumedWatts']} |
| 335 | |
| 336 | ${ipmi_redfish_power_diff}= |
| 337 | ... Evaluate abs(${redfish_reading} - ${power_reading_ipmi}) |
| 338 | |
| 339 | Should Be True ${ipmi_redfish_power_diff} <= ${allowed_power_diff} |
Sushma M M | 89882ce | 2020-03-31 17:21:37 -0500 | [diff] [blame] | 340 | ... msg=Power reading above allowed threshold ${allowed_power_diff}. |
| 341 | |
| 342 | |
| 343 | Enable Present Bit Via IPMI and Verify Using Redfish |
| 344 | [Documentation] Enable present bit of sensor via IPMI and verify using Redfish. |
| 345 | [Arguments] ${sensor_id} ${component} |
| 346 | |
| 347 | # Description of argument(s): |
| 348 | # sensor_id The sensor id of IPMI sensor. |
| 349 | # component The Redfish component of IPMI sensor. |
| 350 | |
| 351 | Run IPMI Command |
| 352 | ... 0x04 0x30 ${sensor_id} 0xa9 0x00 0x80 0x00 0x00 0x00 0x00 0x20 0x00 |
| 353 | |
| 354 | # Example of CPU state via Redfish |
Sushma M M | c4cabd5 | 2020-04-08 09:32:37 -0500 | [diff] [blame] | 355 | |
Sushma M M | 89882ce | 2020-03-31 17:21:37 -0500 | [diff] [blame] | 356 | #"Name": "Processor", |
Sushma M M | 89882ce | 2020-03-31 17:21:37 -0500 | [diff] [blame] | 357 | #"ProcessorArchitecture": "Power", |
| 358 | #"ProcessorType": "CPU", |
Sushma M M | 89882ce | 2020-03-31 17:21:37 -0500 | [diff] [blame] | 359 | #"Status": { |
| 360 | # "Health": "OK", |
| 361 | # "State": "Enabled" |
| 362 | #} |
| 363 | |
| 364 | ${redfish_value}= Redfish.Get Properties /redfish/v1/Systems/system/Processors/${component} |
| 365 | Should Be True '${redfish_value['Status']['State']}' == 'Enabled' |
| 366 | |
| 367 | |
| 368 | Disable Present Bit Via IPMI and Verify Using Redfish |
| 369 | [Documentation] Disable present bit of sensor via IPMI and verify using Redfish. |
| 370 | [Arguments] ${sensor_id} ${component} |
| 371 | |
| 372 | # Description of argument(s): |
| 373 | # sensor_id The sensor id of IPMI sensor. |
| 374 | # component The Redfish component of IPMI sensor. |
| 375 | |
| 376 | Run IPMI Command |
| 377 | ... 0x04 0x30 ${sensor_id} 0xa9 0x00 0x00 0x00 0x80 0x00 0x00 0x20 0x00 |
| 378 | |
| 379 | # Example of CPU state via Redfish |
Sushma M M | c4cabd5 | 2020-04-08 09:32:37 -0500 | [diff] [blame] | 380 | |
Sushma M M | 89882ce | 2020-03-31 17:21:37 -0500 | [diff] [blame] | 381 | #"Name": "Processor", |
| 382 | #"ProcessorArchitecture": "Power", |
| 383 | #"ProcessorType": "CPU", |
| 384 | #"Status": { |
| 385 | # "Health": "OK", |
| 386 | # "State": "Absent" |
| 387 | #} |
| 388 | |
| 389 | ${redfish_value}= Redfish.Get Properties /redfish/v1/Systems/system/Processors/${component} |
| 390 | Should Be True '${redfish_value['Status']['State']}' == 'Absent' |