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 | |
| 12 | *** Test Cases *** |
| 13 | |
| 14 | Verify IPMI Temperature Readings using Redfish |
| 15 | [Documentation] Verify temperatures from IPMI sensor reading command using Redfish. |
| 16 | [Tags] Verify_IPMI_Temperature_Readings_using_Redfish |
| 17 | [Template] Get Temperature Reading And Verify In Redfish |
| 18 | |
| 19 | # command_type sensor_id member_id |
| 20 | IPMI pcie pcie |
| 21 | IPMI ambient ambient |
| 22 | |
| 23 | |
| 24 | Verify DCMI Temperature Readings using Redfish |
| 25 | [Documentation] Verify temperatures from DCMI sensor reading command using Redfish. |
| 26 | [Tags] Verify_DCMI_Temperature_Readings_using_Redfish |
| 27 | [Template] Get Temperature Reading And Verify In Redfish |
| 28 | |
| 29 | # command_type sensor_id member_id |
| 30 | DCMI pcie pcie |
| 31 | DCMI ambient ambient |
| 32 | |
| 33 | *** Keywords *** |
| 34 | |
| 35 | Get Temperature Reading And Verify In Redfish |
| 36 | [Documentation] Get IPMI or DCMI sensor reading and verify in Redfish. |
| 37 | [Arguments] ${command_type} ${sensor_id} ${member_id} |
| 38 | |
| 39 | # Description of argument(s): |
| 40 | # command_type Type of command used to get sensor data (eg. IPMI, DCMI). |
| 41 | # sensor_id Sensor id used to get reading in IPMI or DCMI. |
| 42 | # member_id Member id of sensor data in Redfish. |
| 43 | |
| 44 | ${ipmi_value}= Run Keyword If '${command_type}' == 'IPMI' Get IPMI Sensor Reading ${sensor_id} |
| 45 | ... ELSE Get DCMI Sensor Reading ${sensor_id} |
| 46 | |
| 47 | ${redfish_value}= Get Temperature Reading From Redfish ${member_id} |
| 48 | |
| 49 | Valid Range ${ipmi_value} ${redfish_value-1.000} ${redfish_value+1.000} |
| 50 | |
| 51 | |
| 52 | Get IPMI Sensor Reading |
| 53 | [Documentation] Get reading from IPMI sensor reading command. |
| 54 | [Arguments] ${sensor_id} |
| 55 | |
| 56 | # Description of argument(s): |
| 57 | # sensor_id Sensor id used to get reading in IPMI. |
| 58 | |
| 59 | ${data}= Run IPMI Standard Command sensor reading ${sensor_id} |
| 60 | |
| 61 | # Example reading: |
| 62 | # pcie | 28.500 |
| 63 | |
| 64 | ${sensor_value}= Set Variable ${data.split('| ')[1].strip()} |
| 65 | [Return] ${sensor_value} |
| 66 | |
| 67 | |
| 68 | Get DCMI Sensor Reading |
| 69 | [Documentation] Get reading from DCMI sensors command. |
| 70 | [Arguments] ${sensor_id} |
| 71 | |
| 72 | # Description of argument(s): |
| 73 | # sensor_id Sensor id used to get reading in DCMI. |
| 74 | |
| 75 | ${data}= Run IPMI Standard Command dcmi sensors |
| 76 | ${sensor_data}= Get Lines Containing String ${data} ${sensor_id} |
| 77 | |
| 78 | # Example reading: |
| 79 | # Record ID 0x00fd: pcie | 28.50 degrees C | ok |
| 80 | |
| 81 | ${sensor_value}= Set Variable ${sensor_data.split(' | ')[1].strip('degrees C').strip()} |
| 82 | [Return] ${sensor_value} |
| 83 | |
| 84 | |
| 85 | Get Temperature Reading From Redfish |
| 86 | [Documentation] Get temperature reading from Redfish. |
| 87 | [Arguments] ${member_id} |
| 88 | |
| 89 | # Description of argument(s): |
| 90 | # member_id Member id of temperature. |
| 91 | |
| 92 | @{redfish_readings}= Redfish.Get Attribute /redfish/v1/Chassis/chassis/Thermal Temperatures |
| 93 | FOR ${data} IN @{redfish_readings} |
| 94 | ${redfish_value}= Set Variable If '&{data}[MemberId]' == '${member_id}' |
| 95 | ... &{data}[ReadingCelsius] |
| 96 | Exit For Loop If '&{data}[MemberId]' == '${member_id}' |
| 97 | END |
| 98 | [Return] ${redfish_value} |