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 |
| 6 | |
| 7 | Suite Setup Redfish.Login |
| 8 | Suite Teardown Redfish.Logout |
| 9 | Test Setup Printn |
| 10 | Test Teardown FFDC On Test Case Fail |
| 11 | |
Sushma M M | be808b9 | 2020-02-03 23:12:14 -0600 | [diff] [blame] | 12 | |
| 13 | *** Variables *** |
| 14 | ${allowed_temp_diff} ${1} |
| 15 | |
| 16 | |
Anusha Dathatri | 88ccaff | 2020-02-07 05:17:53 -0600 | [diff] [blame] | 17 | *** Test Cases *** |
| 18 | |
| 19 | Verify IPMI Temperature Readings using Redfish |
| 20 | [Documentation] Verify temperatures from IPMI sensor reading command using Redfish. |
| 21 | [Tags] Verify_IPMI_Temperature_Readings_using_Redfish |
| 22 | [Template] Get Temperature Reading And Verify In Redfish |
| 23 | |
| 24 | # command_type sensor_id member_id |
| 25 | IPMI pcie pcie |
| 26 | IPMI ambient ambient |
| 27 | |
| 28 | |
| 29 | Verify DCMI Temperature Readings using Redfish |
| 30 | [Documentation] Verify temperatures from DCMI sensor reading command using Redfish. |
| 31 | [Tags] Verify_DCMI_Temperature_Readings_using_Redfish |
| 32 | [Template] Get Temperature Reading And Verify In Redfish |
| 33 | |
| 34 | # command_type sensor_id member_id |
| 35 | DCMI pcie pcie |
| 36 | DCMI ambient ambient |
| 37 | |
Sushma M M | be808b9 | 2020-02-03 23:12:14 -0600 | [diff] [blame] | 38 | |
| 39 | Test Ambient Temperature Via IPMI |
| 40 | [Documentation] Test ambient temperature via IPMI and verify using Redfish. |
| 41 | [Tags] Test_Ambient_Temperature_Via_IPMI |
| 42 | |
| 43 | # Example of IPMI dcmi get_temp_reading output: |
| 44 | # Entity ID Entity Instance Temp. Readings |
| 45 | # Inlet air temperature(40h) 1 +19 C |
| 46 | # CPU temperature sensors(41h) 5 +51 C |
| 47 | # CPU temperature sensors(41h) 6 +50 C |
| 48 | # CPU temperature sensors(41h) 7 +50 C |
| 49 | # CPU temperature sensors(41h) 8 +50 C |
| 50 | # CPU temperature sensors(41h) 9 +50 C |
| 51 | # CPU temperature sensors(41h) 10 +48 C |
| 52 | # CPU temperature sensors(41h) 11 +49 C |
| 53 | # CPU temperature sensors(41h) 12 +47 C |
| 54 | # CPU temperature sensors(41h) 8 +50 C |
| 55 | # CPU temperature sensors(41h) 16 +51 C |
| 56 | # CPU temperature sensors(41h) 24 +50 C |
| 57 | # CPU temperature sensors(41h) 32 +43 C |
| 58 | # CPU temperature sensors(41h) 40 +43 C |
| 59 | # Baseboard temperature sensors(42h) 1 +35 C |
| 60 | |
| 61 | ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10 |
| 62 | Should Contain ${temp_reading} Inlet air temperature |
| 63 | ... msg="Unable to get inlet temperature via DCMI". |
| 64 | |
| 65 | ${ambient_temp_line}= |
| 66 | ... Get Lines Containing String ${temp_reading} |
| 67 | ... Inlet air temperature case-insensitive |
| 68 | |
| 69 | ${ambient_temp_ipmi}= Set Variable ${ambient_temp_line.split('+')[1].strip(' C')} |
| 70 | |
| 71 | # Example of ambient temperature via Redfish |
| 72 | |
| 73 | #"@odata.id": "/redfish/v1/Chassis/chassis/Thermal#/Temperatures/0", |
| 74 | #"@odata.type": "#Thermal.v1_3_0.Temperature", |
| 75 | #"LowerThresholdCritical": 0.0, |
| 76 | #"LowerThresholdNonCritical": 0.0, |
| 77 | #"MaxReadingRangeTemp": 0.0, |
| 78 | #"MemberId": "ambient", |
| 79 | #"MinReadingRangeTemp": 0.0, |
| 80 | #"Name": "ambient", |
| 81 | #"ReadingCelsius": 24.987000000000002, |
| 82 | #"Status": { |
| 83 | #"Health": "OK", |
| 84 | #"State": "Enabled" |
| 85 | #}, |
| 86 | #"UpperThresholdCritical": 35.0, |
| 87 | #"UpperThresholdNonCritical": 25.0 |
| 88 | |
| 89 | ${ambient_temp_redfish}= Get Temperature Reading From Redfish ambient |
| 90 | |
| 91 | ${ipmi_redfish_temp_diff}= |
| 92 | ... Evaluate abs(${ambient_temp_redfish} - ${ambient_temp_ipmi}) |
| 93 | |
| 94 | Should Be True ${ipmi_redfish_temp_diff} <= ${allowed_temp_diff} |
| 95 | ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}. |
| 96 | |
| 97 | |
Anusha Dathatri | 88ccaff | 2020-02-07 05:17:53 -0600 | [diff] [blame] | 98 | *** Keywords *** |
| 99 | |
| 100 | Get Temperature Reading And Verify In Redfish |
| 101 | [Documentation] Get IPMI or DCMI sensor reading and verify in Redfish. |
| 102 | [Arguments] ${command_type} ${sensor_id} ${member_id} |
| 103 | |
| 104 | # Description of argument(s): |
| 105 | # command_type Type of command used to get sensor data (eg. IPMI, DCMI). |
| 106 | # sensor_id Sensor id used to get reading in IPMI or DCMI. |
| 107 | # member_id Member id of sensor data in Redfish. |
| 108 | |
| 109 | ${ipmi_value}= Run Keyword If '${command_type}' == 'IPMI' Get IPMI Sensor Reading ${sensor_id} |
| 110 | ... ELSE Get DCMI Sensor Reading ${sensor_id} |
| 111 | |
| 112 | ${redfish_value}= Get Temperature Reading From Redfish ${member_id} |
| 113 | |
| 114 | Valid Range ${ipmi_value} ${redfish_value-1.000} ${redfish_value+1.000} |
| 115 | |
| 116 | |
| 117 | Get IPMI Sensor Reading |
| 118 | [Documentation] Get reading from IPMI sensor reading command. |
| 119 | [Arguments] ${sensor_id} |
| 120 | |
| 121 | # Description of argument(s): |
| 122 | # sensor_id Sensor id used to get reading in IPMI. |
| 123 | |
| 124 | ${data}= Run IPMI Standard Command sensor reading ${sensor_id} |
| 125 | |
| 126 | # Example reading: |
| 127 | # pcie | 28.500 |
| 128 | |
| 129 | ${sensor_value}= Set Variable ${data.split('| ')[1].strip()} |
| 130 | [Return] ${sensor_value} |
| 131 | |
| 132 | |
| 133 | Get DCMI Sensor Reading |
| 134 | [Documentation] Get reading from DCMI sensors command. |
| 135 | [Arguments] ${sensor_id} |
| 136 | |
| 137 | # Description of argument(s): |
| 138 | # sensor_id Sensor id used to get reading in DCMI. |
| 139 | |
| 140 | ${data}= Run IPMI Standard Command dcmi sensors |
| 141 | ${sensor_data}= Get Lines Containing String ${data} ${sensor_id} |
| 142 | |
| 143 | # Example reading: |
| 144 | # Record ID 0x00fd: pcie | 28.50 degrees C | ok |
| 145 | |
| 146 | ${sensor_value}= Set Variable ${sensor_data.split(' | ')[1].strip('degrees C').strip()} |
| 147 | [Return] ${sensor_value} |
| 148 | |
| 149 | |
| 150 | Get Temperature Reading From Redfish |
| 151 | [Documentation] Get temperature reading from Redfish. |
| 152 | [Arguments] ${member_id} |
| 153 | |
| 154 | # Description of argument(s): |
| 155 | # member_id Member id of temperature. |
| 156 | |
| 157 | @{redfish_readings}= Redfish.Get Attribute /redfish/v1/Chassis/chassis/Thermal Temperatures |
| 158 | FOR ${data} IN @{redfish_readings} |
| 159 | ${redfish_value}= Set Variable If '&{data}[MemberId]' == '${member_id}' |
| 160 | ... &{data}[ReadingCelsius] |
| 161 | Exit For Loop If '&{data}[MemberId]' == '${member_id}' |
| 162 | END |
| 163 | [Return] ${redfish_value} |