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 |
Anusha Dathatri | 88ccaff | 2020-02-07 05:17:53 -0600 | [diff] [blame] | 7 | |
| 8 | Suite Setup Redfish.Login |
| 9 | Suite Teardown Redfish.Logout |
| 10 | Test Setup Printn |
| 11 | Test Teardown FFDC On Test Case Fail |
| 12 | |
Sushma M M | be808b9 | 2020-02-03 23:12:14 -0600 | [diff] [blame] | 13 | |
| 14 | *** Variables *** |
| 15 | ${allowed_temp_diff} ${1} |
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 | |
Anusha Dathatri | 88ccaff | 2020-02-07 05:17:53 -0600 | [diff] [blame] | 122 | *** Keywords *** |
| 123 | |
| 124 | Get Temperature Reading And Verify In Redfish |
| 125 | [Documentation] Get IPMI or DCMI sensor reading and verify in Redfish. |
| 126 | [Arguments] ${command_type} ${sensor_id} ${member_id} |
| 127 | |
| 128 | # Description of argument(s): |
| 129 | # command_type Type of command used to get sensor data (eg. IPMI, DCMI). |
| 130 | # sensor_id Sensor id used to get reading in IPMI or DCMI. |
| 131 | # member_id Member id of sensor data in Redfish. |
| 132 | |
| 133 | ${ipmi_value}= Run Keyword If '${command_type}' == 'IPMI' Get IPMI Sensor Reading ${sensor_id} |
| 134 | ... ELSE Get DCMI Sensor Reading ${sensor_id} |
| 135 | |
| 136 | ${redfish_value}= Get Temperature Reading From Redfish ${member_id} |
| 137 | |
| 138 | Valid Range ${ipmi_value} ${redfish_value-1.000} ${redfish_value+1.000} |
| 139 | |
| 140 | |
| 141 | Get IPMI Sensor Reading |
| 142 | [Documentation] Get reading from IPMI sensor reading command. |
| 143 | [Arguments] ${sensor_id} |
| 144 | |
| 145 | # Description of argument(s): |
| 146 | # sensor_id Sensor id used to get reading in IPMI. |
| 147 | |
| 148 | ${data}= Run IPMI Standard Command sensor reading ${sensor_id} |
| 149 | |
| 150 | # Example reading: |
| 151 | # pcie | 28.500 |
| 152 | |
| 153 | ${sensor_value}= Set Variable ${data.split('| ')[1].strip()} |
| 154 | [Return] ${sensor_value} |
| 155 | |
| 156 | |
| 157 | Get DCMI Sensor Reading |
| 158 | [Documentation] Get reading from DCMI sensors command. |
| 159 | [Arguments] ${sensor_id} |
| 160 | |
| 161 | # Description of argument(s): |
| 162 | # sensor_id Sensor id used to get reading in DCMI. |
| 163 | |
| 164 | ${data}= Run IPMI Standard Command dcmi sensors |
| 165 | ${sensor_data}= Get Lines Containing String ${data} ${sensor_id} |
| 166 | |
| 167 | # Example reading: |
| 168 | # Record ID 0x00fd: pcie | 28.50 degrees C | ok |
| 169 | |
| 170 | ${sensor_value}= Set Variable ${sensor_data.split(' | ')[1].strip('degrees C').strip()} |
| 171 | [Return] ${sensor_value} |
| 172 | |
| 173 | |
| 174 | Get Temperature Reading From Redfish |
| 175 | [Documentation] Get temperature reading from Redfish. |
| 176 | [Arguments] ${member_id} |
| 177 | |
| 178 | # Description of argument(s): |
| 179 | # member_id Member id of temperature. |
| 180 | |
| 181 | @{redfish_readings}= Redfish.Get Attribute /redfish/v1/Chassis/chassis/Thermal Temperatures |
| 182 | FOR ${data} IN @{redfish_readings} |
| 183 | ${redfish_value}= Set Variable If '&{data}[MemberId]' == '${member_id}' |
| 184 | ... &{data}[ReadingCelsius] |
| 185 | Exit For Loop If '&{data}[MemberId]' == '${member_id}' |
| 186 | END |
Sushma M M | d4d13f0 | 2020-02-13 03:42:41 -0600 | [diff] [blame^] | 187 | [Return] ${redfish_value} |
| 188 | |
| 189 | |
| 190 | Verify Power Reading Using IPMI And Redfish |
| 191 | [Documentation] Verify power reading using IPMI and Redfish. |
| 192 | |
| 193 | # Example of power reading command output via IPMI. |
| 194 | # Instantaneous power reading: 235 Watts |
| 195 | # Minimum during sampling period: 235 Watts |
| 196 | # Maximum during sampling period: 235 Watts |
| 197 | # Average power reading over sample period: 235 Watts |
| 198 | # IPMI timestamp: Thu Jan 1 00:00:00 1970 |
| 199 | # Sampling period: 00000000 Seconds. |
| 200 | # Power reading state is: deactivated |
| 201 | |
| 202 | ${ipmi_reading}= Get IPMI Power Reading |
| 203 | |
| 204 | ${power}= Redfish.Get Properties /redfish/v1/Chassis/chassis/Power |
| 205 | ${redfish_reading}= Set Variable ${power['PowerControl'][0]['PowerConsumedWatts']} |
| 206 | |
| 207 | ${ipmi_redfish_power_diff}= |
| 208 | ... Evaluate abs(${redfish_reading} - ${ipmi_reading['instantaneous_power_reading']}) |
| 209 | |
| 210 | Should Be True ${ipmi_redfish_power_diff} <= ${allowed_power_diff} |
| 211 | ... msg=Power reading above allowed threshold ${allowed_power_diff}. |