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 |
George Keishing | 6f395fd | 2021-08-18 02:18:53 -0500 | [diff] [blame] | 6 | Resource ../lib/boot_utils.robot |
Sushma M M | d4d13f0 | 2020-02-13 03:42:41 -0600 | [diff] [blame] | 7 | Library ../lib/ipmi_utils.py |
Sushma M M | fd2f428 | 2020-03-18 04:12:47 -0500 | [diff] [blame] | 8 | Variables ../data/ipmi_raw_cmd_table.py |
Anusha Dathatri | 88ccaff | 2020-02-07 05:17:53 -0600 | [diff] [blame] | 9 | |
Sushma M M | fd2f428 | 2020-03-18 04:12:47 -0500 | [diff] [blame] | 10 | Test Setup Redfish.Login |
| 11 | Test Teardown Run Keywords FFDC On Test Case Fail AND |
| 12 | ... Redfish.Logout |
Anusha Dathatri | 88ccaff | 2020-02-07 05:17:53 -0600 | [diff] [blame] | 13 | |
Sushma M M | be808b9 | 2020-02-03 23:12:14 -0600 | [diff] [blame] | 14 | |
| 15 | *** Variables *** |
Sushma M M | 84e98d9 | 2020-04-15 04:47:10 -0500 | [diff] [blame] | 16 | ${allowed_temp_diff} ${2} |
Sushma M M | d4d13f0 | 2020-02-13 03:42:41 -0600 | [diff] [blame] | 17 | ${allowed_power_diff} ${10} |
Sushma M M | be808b9 | 2020-02-03 23:12:14 -0600 | [diff] [blame] | 18 | |
| 19 | |
Anusha Dathatri | 88ccaff | 2020-02-07 05:17:53 -0600 | [diff] [blame] | 20 | *** Test Cases *** |
| 21 | |
| 22 | Verify IPMI Temperature Readings using Redfish |
| 23 | [Documentation] Verify temperatures from IPMI sensor reading command using Redfish. |
| 24 | [Tags] Verify_IPMI_Temperature_Readings_using_Redfish |
| 25 | [Template] Get Temperature Reading And Verify In Redfish |
| 26 | |
| 27 | # command_type sensor_id member_id |
| 28 | IPMI pcie pcie |
| 29 | IPMI ambient ambient |
| 30 | |
| 31 | |
| 32 | Verify DCMI Temperature Readings using Redfish |
| 33 | [Documentation] Verify temperatures from DCMI sensor reading command using Redfish. |
| 34 | [Tags] Verify_DCMI_Temperature_Readings_using_Redfish |
| 35 | [Template] Get Temperature Reading And Verify In Redfish |
| 36 | |
| 37 | # command_type sensor_id member_id |
| 38 | DCMI pcie pcie |
| 39 | DCMI ambient ambient |
| 40 | |
Sushma M M | be808b9 | 2020-02-03 23:12:14 -0600 | [diff] [blame] | 41 | |
| 42 | Test Ambient Temperature Via IPMI |
| 43 | [Documentation] Test ambient temperature via IPMI and verify using Redfish. |
| 44 | [Tags] Test_Ambient_Temperature_Via_IPMI |
| 45 | |
| 46 | # Example of IPMI dcmi get_temp_reading output: |
| 47 | # Entity ID Entity Instance Temp. Readings |
| 48 | # Inlet air temperature(40h) 1 +19 C |
| 49 | # CPU temperature sensors(41h) 5 +51 C |
| 50 | # CPU temperature sensors(41h) 6 +50 C |
| 51 | # CPU temperature sensors(41h) 7 +50 C |
| 52 | # CPU temperature sensors(41h) 8 +50 C |
| 53 | # CPU temperature sensors(41h) 9 +50 C |
| 54 | # CPU temperature sensors(41h) 10 +48 C |
| 55 | # CPU temperature sensors(41h) 11 +49 C |
| 56 | # CPU temperature sensors(41h) 12 +47 C |
| 57 | # CPU temperature sensors(41h) 8 +50 C |
| 58 | # CPU temperature sensors(41h) 16 +51 C |
| 59 | # CPU temperature sensors(41h) 24 +50 C |
| 60 | # CPU temperature sensors(41h) 32 +43 C |
| 61 | # CPU temperature sensors(41h) 40 +43 C |
| 62 | # Baseboard temperature sensors(42h) 1 +35 C |
| 63 | |
| 64 | ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10 |
| 65 | Should Contain ${temp_reading} Inlet air temperature |
| 66 | ... msg="Unable to get inlet temperature via DCMI". |
| 67 | |
| 68 | ${ambient_temp_line}= |
| 69 | ... Get Lines Containing String ${temp_reading} |
| 70 | ... Inlet air temperature case-insensitive |
| 71 | |
| 72 | ${ambient_temp_ipmi}= Set Variable ${ambient_temp_line.split('+')[1].strip(' C')} |
| 73 | |
| 74 | # Example of ambient temperature via Redfish |
| 75 | |
| 76 | #"@odata.id": "/redfish/v1/Chassis/chassis/Thermal#/Temperatures/0", |
| 77 | #"@odata.type": "#Thermal.v1_3_0.Temperature", |
| 78 | #"LowerThresholdCritical": 0.0, |
| 79 | #"LowerThresholdNonCritical": 0.0, |
| 80 | #"MaxReadingRangeTemp": 0.0, |
| 81 | #"MemberId": "ambient", |
| 82 | #"MinReadingRangeTemp": 0.0, |
| 83 | #"Name": "ambient", |
| 84 | #"ReadingCelsius": 24.987000000000002, |
| 85 | #"Status": { |
| 86 | #"Health": "OK", |
| 87 | #"State": "Enabled" |
| 88 | #}, |
| 89 | #"UpperThresholdCritical": 35.0, |
| 90 | #"UpperThresholdNonCritical": 25.0 |
| 91 | |
| 92 | ${ambient_temp_redfish}= Get Temperature Reading From Redfish ambient |
| 93 | |
| 94 | ${ipmi_redfish_temp_diff}= |
| 95 | ... Evaluate abs(${ambient_temp_redfish} - ${ambient_temp_ipmi}) |
| 96 | |
| 97 | Should Be True ${ipmi_redfish_temp_diff} <= ${allowed_temp_diff} |
| 98 | ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}. |
| 99 | |
| 100 | |
Sushma M M | d4d13f0 | 2020-02-13 03:42:41 -0600 | [diff] [blame] | 101 | Test Power Reading Via IPMI With Host Off |
| 102 | [Documentation] Verify power reading via IPMI with host in off state |
| 103 | [Tags] Test_Power_Reading_Via_IPMI_With_Host_Off |
| 104 | |
| 105 | Redfish Power Off stack_mode=skip |
| 106 | |
| 107 | ${ipmi_reading}= Get IPMI Power Reading |
| 108 | |
| 109 | Should Be Equal ${ipmi_reading['instantaneous_power_reading']} 0 |
| 110 | ... msg=Power reading not zero when power is off. |
| 111 | |
| 112 | |
| 113 | Test Power Reading Via IPMI With Host Booted |
| 114 | [Documentation] Test power reading via IPMI with host in booted state and |
| 115 | ... verify using Redfish. |
| 116 | [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted |
| 117 | |
| 118 | IPMI Power On stack_mode=skip |
| 119 | |
| 120 | Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading Using IPMI And Redfish |
| 121 | |
| 122 | |
Sushma M M | 85dbd9c | 2020-03-20 15:58:28 -0500 | [diff] [blame] | 123 | Test Baseboard Temperature Via IPMI |
| 124 | [Documentation] Test baseboard temperature via IPMI and verify using Redfish. |
| 125 | [Tags] Test_Baseboard_Temperature_Via_IPMI |
| 126 | |
| 127 | # Example of IPMI dcmi get_temp_reading output: |
| 128 | # Entity ID Entity Instance Temp. Readings |
srichn28 | 334438b | 2022-09-21 08:41:25 -0500 | [diff] [blame^] | 129 | # Inlet air temperature(40h) 1 +22 C |
| 130 | # Inlet air temperature(40h) 2 +23 C |
| 131 | # Inlet air temperature(40h) 3 +22 C |
| 132 | # CPU temperature sensors(41h) 0 +0 C |
| 133 | # Baseboard temperature sensors(42h) 1 +26 C |
| 134 | # Baseboard temperature sensors(42h) 2 +27 C |
Sushma M M | 85dbd9c | 2020-03-20 15:58:28 -0500 | [diff] [blame] | 135 | |
| 136 | ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10 |
| 137 | Should Contain ${temp_reading} Baseboard temperature sensors |
| 138 | ... msg="Unable to get baseboard temperature via DCMI". |
srichn28 | 334438b | 2022-09-21 08:41:25 -0500 | [diff] [blame^] | 139 | ${baseboard_temp_lines}= |
Sushma M M | 85dbd9c | 2020-03-20 15:58:28 -0500 | [diff] [blame] | 140 | ... Get Lines Containing String ${temp_reading} |
| 141 | ... Baseboard temperature case-insensitive=True |
srichn28 | 334438b | 2022-09-21 08:41:25 -0500 | [diff] [blame^] | 142 | ${lines}= Split To Lines ${baseboard_temp_lines} |
Sushma M M | 85dbd9c | 2020-03-20 15:58:28 -0500 | [diff] [blame] | 143 | |
srichn28 | 334438b | 2022-09-21 08:41:25 -0500 | [diff] [blame^] | 144 | ${ipmi_temp_list}= Create List |
| 145 | FOR ${line} IN @{lines} |
| 146 | ${baseboard_temp_ipmi}= Set Variable ${line.split('+')[1].strip(' C')} |
| 147 | Append To List ${ipmi_temp_list} ${baseboard_temp_ipmi} |
| 148 | END |
| 149 | ${list_length}= Get Length ${ipmi_temp_list} |
Sushma M M | 85dbd9c | 2020-03-20 15:58:28 -0500 | [diff] [blame] | 150 | |
srichn28 | 334438b | 2022-09-21 08:41:25 -0500 | [diff] [blame^] | 151 | # Getting temperature readings from Redfish. |
| 152 | ${baseboard_temp_redfish}= Get Temperature Reading From Redfish PCIE |
| 153 | ${baseboard_temp_redfish}= Get Dictionary Values ${baseboard_temp_redfish} sort_keys=True |
Sushma M M | 85dbd9c | 2020-03-20 15:58:28 -0500 | [diff] [blame] | 154 | |
srichn28 | 334438b | 2022-09-21 08:41:25 -0500 | [diff] [blame^] | 155 | FOR ${index} IN RANGE ${list_length} |
| 156 | ${baseboard_temp_diff}= Evaluate abs(${baseboard_temp_redfish[${index}]} - ${ipmi_temp_list[${index}]}) |
| 157 | Should Be True |
| 158 | ... ${baseboard_temp_diff} <= ${allowed_temp_diff} |
| 159 | ... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}. |
| 160 | END |
Sushma M M | 85dbd9c | 2020-03-20 15:58:28 -0500 | [diff] [blame] | 161 | |
Sushma M M | fd2f428 | 2020-03-18 04:12:47 -0500 | [diff] [blame] | 162 | Test Power Reading Via IPMI Raw Command |
| 163 | [Documentation] Test power reading via IPMI raw command and verify |
| 164 | ... using Redfish. |
| 165 | [Tags] Test_Power_Reading_Via_IPMI_Raw_Command |
| 166 | |
| 167 | IPMI Power On stack_mode=skip |
| 168 | |
| 169 | Wait Until Keyword Succeeds 2 min 30 sec Verify Power Reading Via Raw Command |
| 170 | |
| 171 | |
Sushma M M | 89882ce | 2020-03-31 17:21:37 -0500 | [diff] [blame] | 172 | Verify CPU Present |
| 173 | [Documentation] Verify the IPMI sensor for CPU present using Redfish. |
| 174 | [Tags] Verify_CPU_Present |
srichn28 | 4c7d446 | 2022-08-22 03:40:49 -0500 | [diff] [blame] | 175 | [Template] Set Present Bit Via IPMI and Verify Using Redfish |
Sushma M M | 89882ce | 2020-03-31 17:21:37 -0500 | [diff] [blame] | 176 | |
srichn28 | 4c7d446 | 2022-08-22 03:40:49 -0500 | [diff] [blame] | 177 | # component state |
| 178 | cpu Enabled |
Sushma M M | 89882ce | 2020-03-31 17:21:37 -0500 | [diff] [blame] | 179 | |
| 180 | |
| 181 | Verify CPU Not Present |
| 182 | [Documentation] Verify the IPMI sensor for CPU not present using Redfish. |
| 183 | [Tags] Verify_CPU_Not_Present |
srichn28 | 4c7d446 | 2022-08-22 03:40:49 -0500 | [diff] [blame] | 184 | [Template] Set Present Bit Via IPMI and Verify Using Redfish |
Sushma M M | 89882ce | 2020-03-31 17:21:37 -0500 | [diff] [blame] | 185 | |
srichn28 | 4c7d446 | 2022-08-22 03:40:49 -0500 | [diff] [blame] | 186 | # component state |
| 187 | cpu Absent |
Sushma M M | 89882ce | 2020-03-31 17:21:37 -0500 | [diff] [blame] | 188 | |
| 189 | |
| 190 | Verify GPU Present |
| 191 | [Documentation] Verify the IPMI sensor for GPU present using Redfish. |
| 192 | [Tags] Verify_GPU_Present |
| 193 | [Template] Enable Present Bit Via IPMI and Verify Using Redfish |
| 194 | |
| 195 | # sensor_id component |
| 196 | 0xC5 gv100card0 |
| 197 | |
| 198 | |
| 199 | Verify GPU Not Present |
| 200 | [Documentation] Verify the IPMI sensor for GPU not present using Redfish. |
| 201 | [Tags] Verify_GPU_Not_Present |
| 202 | [Template] Disable Present Bit Via IPMI and Verify Using Redfish |
| 203 | |
| 204 | # sensor_id component |
| 205 | 0xC5 gv100card0 |
| 206 | |
| 207 | |
Sushma M M | c69a3d3 | 2020-06-10 18:13:08 -0500 | [diff] [blame] | 208 | Test Sensor Threshold Via IPMI |
| 209 | [Documentation] Test sensor threshold via IPMI and verify using Redfish. |
| 210 | [Tags] Test_Sensor_Threshold_Via_IPMI |
| 211 | [Template] Verify Power Supply Sensor Threshold |
| 212 | |
| 213 | # threshold_id component |
| 214 | Upper Non-Critical UpperThresholdNonCritical |
| 215 | Upper Critical UpperThresholdCritical |
| 216 | Lower Non-Critical LowerThresholdNonCritical |
| 217 | Lower Critical LowerThresholdCritical |
| 218 | |
| 219 | |
Anusha Dathatri | 88ccaff | 2020-02-07 05:17:53 -0600 | [diff] [blame] | 220 | *** Keywords *** |
| 221 | |
| 222 | Get Temperature Reading And Verify In Redfish |
| 223 | [Documentation] Get IPMI or DCMI sensor reading and verify in Redfish. |
| 224 | [Arguments] ${command_type} ${sensor_id} ${member_id} |
| 225 | |
| 226 | # Description of argument(s): |
| 227 | # command_type Type of command used to get sensor data (eg. IPMI, DCMI). |
| 228 | # sensor_id Sensor id used to get reading in IPMI or DCMI. |
| 229 | # member_id Member id of sensor data in Redfish. |
| 230 | |
| 231 | ${ipmi_value}= Run Keyword If '${command_type}' == 'IPMI' Get IPMI Sensor Reading ${sensor_id} |
| 232 | ... ELSE Get DCMI Sensor Reading ${sensor_id} |
| 233 | |
| 234 | ${redfish_value}= Get Temperature Reading From Redfish ${member_id} |
| 235 | |
| 236 | Valid Range ${ipmi_value} ${redfish_value-1.000} ${redfish_value+1.000} |
| 237 | |
| 238 | |
| 239 | Get IPMI Sensor Reading |
| 240 | [Documentation] Get reading from IPMI sensor reading command. |
| 241 | [Arguments] ${sensor_id} |
| 242 | |
| 243 | # Description of argument(s): |
| 244 | # sensor_id Sensor id used to get reading in IPMI. |
| 245 | |
| 246 | ${data}= Run IPMI Standard Command sensor reading ${sensor_id} |
| 247 | |
| 248 | # Example reading: |
| 249 | # pcie | 28.500 |
| 250 | |
| 251 | ${sensor_value}= Set Variable ${data.split('| ')[1].strip()} |
| 252 | [Return] ${sensor_value} |
| 253 | |
| 254 | |
| 255 | Get DCMI Sensor Reading |
| 256 | [Documentation] Get reading from DCMI sensors command. |
| 257 | [Arguments] ${sensor_id} |
| 258 | |
| 259 | # Description of argument(s): |
| 260 | # sensor_id Sensor id used to get reading in DCMI. |
| 261 | |
| 262 | ${data}= Run IPMI Standard Command dcmi sensors |
| 263 | ${sensor_data}= Get Lines Containing String ${data} ${sensor_id} |
| 264 | |
| 265 | # Example reading: |
| 266 | # Record ID 0x00fd: pcie | 28.50 degrees C | ok |
| 267 | |
| 268 | ${sensor_value}= Set Variable ${sensor_data.split(' | ')[1].strip('degrees C').strip()} |
| 269 | [Return] ${sensor_value} |
| 270 | |
| 271 | |
| 272 | Get Temperature Reading From Redfish |
| 273 | [Documentation] Get temperature reading from Redfish. |
| 274 | [Arguments] ${member_id} |
| 275 | |
| 276 | # Description of argument(s): |
| 277 | # member_id Member id of temperature. |
| 278 | |
srichn28 | 334438b | 2022-09-21 08:41:25 -0500 | [diff] [blame^] | 279 | @{thermal_uri}= redfish_utils.Get Member List /redfish/v1/Chassis/ |
| 280 | @{redfish_readings}= redfish_utils.Get Attribute ${thermal_uri[0]}/${THERMAL_METRICS} TemperatureReadingsCelsius |
| 281 | |
| 282 | # Example of Baseboard temperature via Redfish |
| 283 | |
| 284 | # "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/ThermalMetrics", |
| 285 | # "@odata.type": "#ThermalMetrics.v1_0_0.ThermalMetrics", |
| 286 | # "Id": "ThermalMetrics", |
| 287 | # "Name": "Chassis Thermal Metrics", |
| 288 | # "TemperatureReadingsCelsius": [ |
| 289 | # { |
| 290 | # "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/PCIE_0_Temp", |
| 291 | # "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/PCIE_0_Temp", |
| 292 | # "DeviceName": "PCIE_0_Temp", |
| 293 | # "Reading": 23.75 |
| 294 | # }, |
| 295 | |
| 296 | ${redfish_value_dict}= Create Dictionary |
Anusha Dathatri | 88ccaff | 2020-02-07 05:17:53 -0600 | [diff] [blame] | 297 | FOR ${data} IN @{redfish_readings} |
srichn28 | 334438b | 2022-09-21 08:41:25 -0500 | [diff] [blame^] | 298 | ${contains}= Evaluate "${member_id}" in """${data}[DeviceName]""" |
| 299 | ${reading}= Set Variable ${data}[Reading] |
| 300 | Run Keyword IF "${contains}" == "True" |
| 301 | ... Set To Dictionary ${redfish_value_dict} ${data}[DeviceName] ${reading} |
Anusha Dathatri | 88ccaff | 2020-02-07 05:17:53 -0600 | [diff] [blame] | 302 | END |
srichn28 | 334438b | 2022-09-21 08:41:25 -0500 | [diff] [blame^] | 303 | |
| 304 | [Return] ${redfish_value_dict} |
Sushma M M | d4d13f0 | 2020-02-13 03:42:41 -0600 | [diff] [blame] | 305 | |
| 306 | |
| 307 | Verify Power Reading Using IPMI And Redfish |
| 308 | [Documentation] Verify power reading using IPMI and Redfish. |
| 309 | |
| 310 | # Example of power reading command output via IPMI. |
| 311 | # Instantaneous power reading: 235 Watts |
| 312 | # Minimum during sampling period: 235 Watts |
| 313 | # Maximum during sampling period: 235 Watts |
| 314 | # Average power reading over sample period: 235 Watts |
| 315 | # IPMI timestamp: Thu Jan 1 00:00:00 1970 |
| 316 | # Sampling period: 00000000 Seconds. |
| 317 | # Power reading state is: deactivated |
| 318 | |
| 319 | ${ipmi_reading}= Get IPMI Power Reading |
| 320 | |
George Keishing | d5f179e | 2020-07-14 16:07:31 -0500 | [diff] [blame] | 321 | ${power_uri_list}= redfish_utils.Get Members URI /redfish/v1/Chassis/ PowerControl |
| 322 | Log List ${power_uri_list} |
Sushma M M | d4d13f0 | 2020-02-13 03:42:41 -0600 | [diff] [blame] | 323 | |
George Keishing | d5f179e | 2020-07-14 16:07:31 -0500 | [diff] [blame] | 324 | # Power entries could be seen across different redfish path, remove the URI |
| 325 | # where the attribute is non-existent. |
| 326 | # Example: |
| 327 | # ['/redfish/v1/Chassis/chassis/Power', |
| 328 | # '/redfish/v1/Chassis/motherboard/Power'] |
| 329 | FOR ${idx} IN @{power_uri_list} |
| 330 | ${power}= redfish_utils.Get Attribute ${idx} PowerControl |
| 331 | Log Dictionary ${power[0]} |
Sushma M M | d4d13f0 | 2020-02-13 03:42:41 -0600 | [diff] [blame] | 332 | |
George Keishing | d5f179e | 2020-07-14 16:07:31 -0500 | [diff] [blame] | 333 | # Ensure the path does have the attribute else set to EMPTY as default to skip. |
| 334 | ${value}= Get Variable Value ${power[0]['PowerConsumedWatts']} ${EMPTY} |
| 335 | Run Keyword If "${value}" == "${EMPTY}" |
| 336 | ... Remove Values From List ${power_uri_list} ${idx} |
| 337 | |
| 338 | # Check the next available element in the list. |
| 339 | Continue For Loop If "${value}" == "${EMPTY}" |
| 340 | |
| 341 | ${ipmi_redfish_power_diff}= |
| 342 | ... Evaluate abs(${${power[0]['PowerConsumedWatts']}} - ${ipmi_reading['instantaneous_power_reading']}) |
| 343 | Should Be True ${ipmi_redfish_power_diff} <= ${allowed_power_diff} |
| 344 | ... msg=Power reading above allowed threshold ${allowed_power_diff}. |
| 345 | END |
| 346 | |
George Keishing | e68cbfb | 2020-08-12 11:11:58 -0500 | [diff] [blame] | 347 | # Double check, the validation has at least one valid path. |
George Keishing | d5f179e | 2020-07-14 16:07:31 -0500 | [diff] [blame] | 348 | Should Not Be Empty ${power_uri_list} |
George Keishing | e68cbfb | 2020-08-12 11:11:58 -0500 | [diff] [blame] | 349 | ... msg=Should contain at least one element in the list. |
Sushma M M | fd2f428 | 2020-03-18 04:12:47 -0500 | [diff] [blame] | 350 | |
| 351 | |
| 352 | Verify Power Reading Via Raw Command |
| 353 | [Documentation] Get dcmi power reading via IPMI raw command. |
| 354 | |
| 355 | ${ipmi_raw_output}= Run IPMI Standard Command |
| 356 | ... raw ${IPMI_RAW_CMD['power_reading']['Get'][0]} |
| 357 | |
| 358 | ${power_reading_ipmi}= Set Variable ${ipmi_raw_output.split()[1]} |
| 359 | ${power_reading_ipmi}= |
| 360 | ... Convert To Integer 0x${power_reading_ipmi} |
| 361 | |
| 362 | # Example of power reading via Redfish |
| 363 | # "@odata.id": "/redfish/v1/Chassis/chassis/Power#/PowerControl/0", |
| 364 | # "@odata.type": "#Power.v1_0_0.PowerControl", |
| 365 | # "MemberId": "0", |
| 366 | # "Name": "Chassis Power Control", |
| 367 | # "PowerConsumedWatts": 145.0, |
| 368 | |
Jorge Cisneros | 187f177 | 2022-08-22 14:03:08 +0000 | [diff] [blame] | 369 | ${power}= Redfish.Get Properties /redfish/v1/Chassis/${CHASSIS_ID}/Power |
Sushma M M | fd2f428 | 2020-03-18 04:12:47 -0500 | [diff] [blame] | 370 | ${redfish_reading}= Set Variable ${power['PowerControl'][0]['PowerConsumedWatts']} |
| 371 | |
| 372 | ${ipmi_redfish_power_diff}= |
| 373 | ... Evaluate abs(${redfish_reading} - ${power_reading_ipmi}) |
| 374 | |
| 375 | Should Be True ${ipmi_redfish_power_diff} <= ${allowed_power_diff} |
Sushma M M | 89882ce | 2020-03-31 17:21:37 -0500 | [diff] [blame] | 376 | ... msg=Power reading above allowed threshold ${allowed_power_diff}. |
| 377 | |
| 378 | |
srichn28 | 4c7d446 | 2022-08-22 03:40:49 -0500 | [diff] [blame] | 379 | Set Present Bit Via IPMI and Verify Using Redfish |
| 380 | [Documentation] Set present bit of sensor via IPMI and verify using Redfish. |
| 381 | [Arguments] ${component} ${status} |
Sushma M M | 89882ce | 2020-03-31 17:21:37 -0500 | [diff] [blame] | 382 | |
| 383 | # Description of argument(s): |
Sushma M M | 89882ce | 2020-03-31 17:21:37 -0500 | [diff] [blame] | 384 | # component The Redfish component of IPMI sensor. |
srichn28 | 4c7d446 | 2022-08-22 03:40:49 -0500 | [diff] [blame] | 385 | # status Status of the bit to be set(e.g. Absent, Present). |
Sushma M M | 89882ce | 2020-03-31 17:21:37 -0500 | [diff] [blame] | 386 | |
srichn28 | 4c7d446 | 2022-08-22 03:40:49 -0500 | [diff] [blame] | 387 | ${sensor_list}= Get Available Sensors ${component} |
| 388 | ${sensor_name}= Set Variable ${sensor_list[0]} |
| 389 | ${sensor_id}= Get Sensor Id For Sensor ${sensor_name} |
Sushma M M | 89882ce | 2020-03-31 17:21:37 -0500 | [diff] [blame] | 390 | |
srichn28 | 4c7d446 | 2022-08-22 03:40:49 -0500 | [diff] [blame] | 391 | Run Keyword If '${status}' == 'Absent' |
| 392 | ... Run IPMI Command |
| 393 | ... 0x04 0x30 ${sensor_id} 0xa9 0x00 0x00 0x00 0x80 0x00 0x00 0x20 0x00 |
| 394 | ... ELSE IF '${status}' == 'Enabled' |
| 395 | ... Run IPMI Command |
| 396 | ... 0x04 0x30 ${sensor_id} 0xa9 0x00 0x80 0x00 0x00 0x00 0x00 0x20 0x00 |
Sushma M M | c4cabd5 | 2020-04-08 09:32:37 -0500 | [diff] [blame] | 397 | |
srichn28 | 4c7d446 | 2022-08-22 03:40:49 -0500 | [diff] [blame] | 398 | # Redfish cpu components have "-" instead of "_" (e.g.: dcm0-cpu0). |
| 399 | ${cpu_name}= Replace String ${sensor_name} _ - |
| 400 | ${sensor_properties}= Redfish.Get Properties /redfish/v1/Systems/system/Processors/${cpu_name} |
Sushma M M | 89882ce | 2020-03-31 17:21:37 -0500 | [diff] [blame] | 401 | |
srichn28 | 4c7d446 | 2022-08-22 03:40:49 -0500 | [diff] [blame] | 402 | # Example of CPU state via Redfish |
George Keishing | 52eb7c2 | 2022-03-11 10:58:53 -0600 | [diff] [blame] | 403 | |
srichn28 | 4c7d446 | 2022-08-22 03:40:49 -0500 | [diff] [blame] | 404 | # "ProcessorType": "CPU", |
| 405 | # "SerialNumber": "YA1936422499", |
| 406 | # "Socket": "", |
| 407 | # "SparePartNumber": "F210110", |
| 408 | # "Status": { |
| 409 | # "Health": "OK", |
| 410 | # "State": "Absent" |
| 411 | # } |
Sushma M M | 89882ce | 2020-03-31 17:21:37 -0500 | [diff] [blame] | 412 | |
srichn28 | 4c7d446 | 2022-08-22 03:40:49 -0500 | [diff] [blame] | 413 | Should Be True '${sensor_properties['Status']['State']}' == '${status}' |
Sushma M M | c69a3d3 | 2020-06-10 18:13:08 -0500 | [diff] [blame] | 414 | |
| 415 | |
| 416 | Verify Power Supply Sensor Threshold |
| 417 | [Documentation] Get power supply sensor threshold value via IPMI and verify using Redfish. |
| 418 | [Arguments] ${ipmi_threshold_id} ${redfish_threshold_id} |
| 419 | |
| 420 | # Description of argument(s): |
| 421 | # ipmi_threshold_id The sensor threshold component of IPMI sensor. |
| 422 | # redfish_threshold_id The sensor threshold component of Redfish sensor. |
| 423 | |
| 424 | |
| 425 | # Example of ipmi sensor output |
| 426 | # Locating sensor record... |
| 427 | # Sensor ID : ps0_input_voltag (0xf7) |
| 428 | # Entity ID : 10.19 |
| 429 | # Sensor Type (Threshold) : Voltage |
| 430 | # Sensor Reading : 208 (+/- 0) Volts |
| 431 | # Status : ok |
| 432 | # Lower Non-Recoverable : na |
| 433 | # Lower Critical : 180.000 |
| 434 | # Lower Non-Critical : 200.000 |
| 435 | # Upper Non-Critical : 290.000 |
| 436 | # Upper Critical : 300.000 |
| 437 | # Upper Non-Recoverable : na |
| 438 | # Positive Hysteresis : Unspecified |
| 439 | # Negative Hysteresis : Unspecified |
| 440 | |
| 441 | |
| 442 | ${ipmi_sensor_output}= Run External IPMI Standard Command sensor get ps0_input_voltag |
| 443 | ${ipmi_threshold_output}= Get Lines Containing String ${ipmi_sensor_output} ${ipmi_threshold_id} |
| 444 | ${ipmi_threshold_reading}= Fetch From Right ${ipmi_threshold_output} :${SPACE} |
| 445 | |
| 446 | ${ipmi_threshold_reading}= Set Variable If '${ipmi_threshold_reading}' == 'na' |
| 447 | ... ${0} ${ipmi_threshold_reading} |
| 448 | |
| 449 | # Example of redfish sensor output |
| 450 | # "@odata.id": "/redfish/v1/Chassis/chassis/Power#/Voltages/0", |
| 451 | # "@odata.type": "#Power.v1_0_0.Voltage", |
| 452 | # "LowerThresholdCritical": 180.0, |
| 453 | # "LowerThresholdNonCritical": 200.0, |
| 454 | # "MaxReadingRange": 0.0, |
| 455 | # "MemberId": "ps0_input_voltage", |
| 456 | # "MinReadingRange": 0.0, |
| 457 | # "Name": "ps0 input voltage", |
| 458 | # "ReadingVolts": 209.5, |
| 459 | # "Status": { |
| 460 | # "Health": "OK", |
| 461 | # "State": "Enabled" |
| 462 | # }, |
| 463 | # "UpperThresholdCritical": 300.0, |
| 464 | # "UpperThresholdNonCritical": 290.0 |
| 465 | |
Jorge Cisneros | 187f177 | 2022-08-22 14:03:08 +0000 | [diff] [blame] | 466 | @{redfish_readings}= Redfish.Get Attribute /redfish/v1/Chassis/${CHASSIS_ID}/Power Voltages |
Sushma M M | c69a3d3 | 2020-06-10 18:13:08 -0500 | [diff] [blame] | 467 | FOR ${data} IN @{redfish_readings} |
| 468 | Run keyword if '${data}[MemberId]' == 'ps0_input_voltage' |
| 469 | ... Should Be Equal As Numbers ${data['${redfish_threshold_id}']} ${ipmi_threshold_reading} |
| 470 | END |
srichn28 | a9df540 | 2022-08-17 07:44:11 -0500 | [diff] [blame] | 471 | |
| 472 | |
| 473 | Get Available Sensors |
| 474 | [Documentation] Get all the available sensors for the required component. |
| 475 | ... Returns a list of available sensors. |
| 476 | [Arguments] ${sensor_component} |
| 477 | |
| 478 | # Description of argument(s): |
| 479 | # sensor_component sensor component name.(e.g.:cpu) |
| 480 | |
| 481 | ${resp}= Run IPMI Standard Command sdr elist |
| 482 | ${sensor_list}= Create List |
| 483 | ${sensors}= Get Lines Containing String ${resp} ${sensor_component} |
| 484 | ${sensors}= Split To Lines ${sensors} |
| 485 | |
| 486 | # Example of IPMI sdr elist command. |
| 487 | |
| 488 | # dcm0_cpu0 | 41h | ok | 3.1 | Presence detected |
| 489 | # dcm0_cpu1 | 42h | ok | 3.2 | Presence detected, Disabled |
| 490 | # dcm1_cpu0 | 43h | ok | 3.3 | Presence detected |
| 491 | # dcm1_cpu1 | 44h | ok | 3.4 | Presence detected, Disabled |
| 492 | # dcm2_cpu0 | 45h | ns | 3.5 | Disabled |
| 493 | # dcm2_cpu1 | 46h | ns | 3.6 | Disabled |
| 494 | # dcm3_cpu0 | 47h | ns | 3.7 | Disabled |
| 495 | # dcm3_cpu1 | 48h | ns | 3.8 | Disabled |
| 496 | |
| 497 | FOR ${line} IN @{sensors} |
| 498 | ${sensor_name}= Set Variable ${line.split('|')[0].strip()} |
| 499 | |
| 500 | # Adding sensors to the list whose presence is detected. |
| 501 | ${contains}= Evaluate "Presence detected" in "${line}" |
| 502 | Run Keyword IF "${contains}" == "True" |
| 503 | ... Append To List ${sensor_list} ${sensor_name} |
| 504 | END |
| 505 | |
| 506 | # Example of output for ${sensor_list} |
| 507 | # ['dcm0_cpu0', 'dcm0_cpu1', 'dcm1_cpu0', 'dcm1_cpu1'] |
| 508 | |
| 509 | [RETURN] ${sensor_list} |
| 510 | |
| 511 | |
| 512 | Get Sensor Id For Sensor |
| 513 | [Documentation] Returns the sensor ID value for the given sensor. |
| 514 | [Arguments] ${sensor_name} |
| 515 | |
| 516 | # Description of argument(s): |
| 517 | # sensor_name Name of sensor whose ID is required(e.g.: dcm0_cpu0, dcm0_cpu1 etc). |
| 518 | |
| 519 | ${get_resp}= Run IPMI Standard Command sensor get ${sensor_name} |
| 520 | |
| 521 | # Example of sensor get command. |
| 522 | |
| 523 | # Locating sensor record... |
| 524 | # Sensor ID : dcm0_cpu0 (0x41) |
| 525 | # Entity ID : 3.1 |
| 526 | # Sensor Type (Discrete): Processor |
| 527 | # States Asserted : Processor |
| 528 | # [Presence detected] |
| 529 | |
| 530 | ${line}= Get Lines Containing String ${get_resp} Sensor ID |
| 531 | ${sensor_id}= Set Variable ${line[-5:-1]} |
| 532 | |
| 533 | # Example of output for ${sensor_id} is 0x41. |
| 534 | |
| 535 | [RETURN] ${sensor_id} |
| 536 | |