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