Rahul Maheshwari | 712baaf | 2019-07-29 23:52:36 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Module to test IPMI SEL functionality. |
| 4 | Resource ../lib/ipmi_client.robot |
| 5 | Resource ../lib/openbmc_ffdc.robot |
Vidya-Kalasappanavar | d769075 | 2024-04-30 04:00:15 -0500 | [diff] [blame] | 6 | Resource ../../../lib/logging_utils.robot |
| 7 | |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 8 | Library ../lib/ipmi_utils.py |
Vidya-Kalasappanavar | d769075 | 2024-04-30 04:00:15 -0500 | [diff] [blame] | 9 | Library ../../../lib/logging_utils.py |
| 10 | |
Tony Lee | 160aa87 | 2020-02-12 16:11:39 +0800 | [diff] [blame] | 11 | Variables ../data/ipmi_raw_cmd_table.py |
Rahul Maheshwari | 712baaf | 2019-07-29 23:52:36 -0500 | [diff] [blame] | 12 | |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 13 | Test Setup Test Setup Execution |
Rahul Maheshwari | 712baaf | 2019-07-29 23:52:36 -0500 | [diff] [blame] | 14 | Test Teardown FFDC On Test Case Fail |
| 15 | |
Matt Fischer | 6fb70d9 | 2023-10-24 19:06:33 -0600 | [diff] [blame^] | 16 | Test Tags IPMI_SEL |
George Keishing | 87dc442 | 2023-10-20 12:56:30 +0530 | [diff] [blame] | 17 | |
ganesanb | 11fe27f | 2022-08-24 10:00:17 +0000 | [diff] [blame] | 18 | *** Variables *** |
| 19 | |
| 20 | # Based on 13th byte of add SEL entry command as per IPMI spec |
| 21 | # event_dir and event_type variable value needs to be given. |
| 22 | ${sel_no_entry_msg} SEL has no entries |
| 23 | ${event_type} Lower Non-critical going low |
| 24 | ${event_dir} Asserted |
| 25 | |
Rahul Maheshwari | 712baaf | 2019-07-29 23:52:36 -0500 | [diff] [blame] | 26 | *** Test Cases *** |
| 27 | |
| 28 | Verify IPMI SEL Version |
| 29 | [Documentation] Verify IPMI SEL's version info. |
| 30 | [Tags] Verify_IPMI_SEL_Version |
| 31 | ${version_info}= Get IPMI SEL Setting Version |
| 32 | ${setting_status}= Fetch From Left ${version_info} ( |
| 33 | ${setting_status}= Evaluate $setting_status.replace(' ','') |
| 34 | |
| 35 | Should Be True ${setting_status} >= 1.5 |
| 36 | Should Contain ${version_info} v2 compliant case_insensitive=True |
| 37 | |
| 38 | |
| 39 | Verify Empty SEL |
George Keishing | d349867 | 2022-04-08 09:00:42 -0500 | [diff] [blame] | 40 | [Documentation] Verify IPMI sel clear command clears the SEL entry. |
Rahul Maheshwari | 712baaf | 2019-07-29 23:52:36 -0500 | [diff] [blame] | 41 | [Tags] Verify_Empty_SEL |
George Keishing | dc65667 | 2020-02-25 07:45:16 -0600 | [diff] [blame] | 42 | |
Nandish-Matti | 5df06fa | 2023-03-21 07:26:44 -0500 | [diff] [blame] | 43 | Redfish Power Off stack_mode=skip |
| 44 | |
George Keishing | 3c23088 | 2022-04-29 03:20:24 -0500 | [diff] [blame] | 45 | # Generate an error log and verify there is one at least. |
George Keishing | d349867 | 2022-04-08 09:00:42 -0500 | [diff] [blame] | 46 | Create Test PEL Log |
| 47 | ${resp}= Run IPMI Standard Command sel elist last 1 |
| 48 | Log To Console ${resp} |
| 49 | |
| 50 | Should Contain Any ${resp} system hardware failure Asserted |
| 51 | ... msg=Add SEL Entry failed. |
| 52 | |
| 53 | # Send SEL clear command and verify if it really clears up the SEL entry. |
Rahul Maheshwari | 712baaf | 2019-07-29 23:52:36 -0500 | [diff] [blame] | 54 | Run IPMI Standard Command sel clear |
Vidya-Kalasappanavar | 03d4f0a | 2024-05-15 05:24:30 -0500 | [diff] [blame] | 55 | |
| 56 | # Added a delay for IPMI SEL to clear completely. |
George Keishing | dc65667 | 2020-02-25 07:45:16 -0600 | [diff] [blame] | 57 | Sleep 5s |
Rahul Maheshwari | 712baaf | 2019-07-29 23:52:36 -0500 | [diff] [blame] | 58 | |
| 59 | ${resp}= Run IPMI Standard Command sel list |
Vidya-Kalasappanavar | 03d4f0a | 2024-05-15 05:24:30 -0500 | [diff] [blame] | 60 | |
| 61 | # After executing the IPMI SEL clear command, there will be an informational |
| 62 | # SEL entry in the IPMI SEL. Therefore, checking if the IPMI SEL count is 1 |
| 63 | # after clearing SEL. |
| 64 | |
| 65 | ${sel_count}= Get Line Count ${resp} |
| 66 | Should Be Equal As Strings ${sel_count} 1 |
Rahul Maheshwari | 712baaf | 2019-07-29 23:52:36 -0500 | [diff] [blame] | 67 | |
Tony Lee | 160aa87 | 2020-02-12 16:11:39 +0800 | [diff] [blame] | 68 | |
| 69 | Verify Add SEL Entry |
| 70 | [Documentation] Verify add SEL entry. |
| 71 | [Tags] Verify_Add_SEL_Entry |
| 72 | [Teardown] Run Keywords FFDC On Test Case Fail AND Run IPMI Standard Command sel clear |
| 73 | |
George Keishing | bd8d6ba | 2021-11-17 01:53:51 -0600 | [diff] [blame] | 74 | # The IPMI raw command to generate Temp sensor error is no longer working. |
| 75 | # Our aim is to check if the SEL command is listed in IPMI or not. |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 76 | # Original keyword "Create User Defined SEL" for reference |
George Keishing | bd8d6ba | 2021-11-17 01:53:51 -0600 | [diff] [blame] | 77 | Create Test PEL Log |
| 78 | |
Tony Lee | 160aa87 | 2020-02-12 16:11:39 +0800 | [diff] [blame] | 79 | # Get last SEL entry. |
| 80 | ${resp}= Run IPMI Standard Command sel elist last 1 |
George Keishing | bd8d6ba | 2021-11-17 01:53:51 -0600 | [diff] [blame] | 81 | # output: |
| 82 | # 1 | 11/17/2021 | 07:49:20 | System Event #0x01 | Undetermined system hardware failure | Asserted |
| 83 | Run Keywords Should Contain ${resp} system hardware failure AND |
| 84 | ... Should Contain ${resp} Asserted msg=Add SEL Entry failed. |
Tony Lee | 160aa87 | 2020-02-12 16:11:39 +0800 | [diff] [blame] | 85 | |
| 86 | |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 87 | Verify Add SEL Entry For Any Random Sensor |
| 88 | [Documentation] Create SEL entry and verify for any given random sensor. |
| 89 | [Tags] Verify_Add_SEL_Entry_For_Any_Random_Sensor |
| 90 | [Teardown] Run Keywords FFDC On Test Case Fail AND Run IPMI Standard Command sel clear |
| 91 | |
| 92 | # Get any sensor available from sensor list. |
ganesanb | d282b56 | 2022-05-11 20:30:52 +0530 | [diff] [blame] | 93 | ${sensor_name}= Fetch One Threshold Sensor From Sensor List |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 94 | |
| 95 | # Get Sensor ID from SDR get "sensor". |
| 96 | ${sensor_data1}= Fetch Sensor Details From SDR ${sensor_name} Sensor ID |
ganesanb | 11fe27f | 2022-08-24 10:00:17 +0000 | [diff] [blame] | 97 | ${sensor_number}= Get Bytes From SDR Sensor ${sensor_data1} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 98 | |
| 99 | # Get Sensor Type from SDR get "sensor". |
| 100 | ${sensor_data2}= Fetch Sensor Details From SDR ${sensor_name} Sensor Type (Threshold) |
ganesanb | 11fe27f | 2022-08-24 10:00:17 +0000 | [diff] [blame] | 101 | ${sensor_type_id}= Get Bytes From SDR Sensor ${sensor_data2} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 102 | |
| 103 | # Add SEL Entry. |
| 104 | # ${sel_entry_id} is the Record ID for added record (LSB First). |
| 105 | ${sel_create_resp}= Create SEL ${sensor_type_id} ${sensor_number} |
| 106 | ${sel_entry_id}= Split String ${sel_create_resp} |
| 107 | |
| 108 | # Get last SEL entry. |
ganesanb | 11fe27f | 2022-08-24 10:00:17 +0000 | [diff] [blame] | 109 | ${resp}= Run IPMI Standard Command sel elist |
| 110 | Should Not Contain ${resp} ${sel_no_entry_msg} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 111 | |
ganesanb | 11fe27f | 2022-08-24 10:00:17 +0000 | [diff] [blame] | 112 | # Output of the Sel elist. |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 113 | # Below example is a continuous line statement. |
| 114 | # N | MM/DD/YYYY | HH:MM:SS | Sensor_Type Sensor_Name | |
| 115 | # Lower Non-critical going low | Asserted | Reading 0. |
| 116 | |
ganesanb | 11fe27f | 2022-08-24 10:00:17 +0000 | [diff] [blame] | 117 | ${get_sel_entry}= Get Lines Containing String ${resp} ${sensor_name} |
| 118 | ${sel_entry}= Get Lines Containing String ${get_sel_entry} ${event_type} |
| 119 | Should Contain ${sel_entry} ${event_dir} msg=Add SEL Entry failed. |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 120 | |
| 121 | # Get SEL Entry IPMI Raw Command. |
| 122 | ${entry}= Get SEL Entry Via IPMI ${sel_entry_id[0]} ${sel_entry_id[1]} |
| 123 | |
| 124 | # Compare SEL Record ID. |
| 125 | ${sel_record_id}= Set Variable ${entry[2:4]} |
| 126 | Should Be Equal ${sel_record_id} ${sel_entry_id} |
| 127 | |
| 128 | # Sensor type compare. |
| 129 | Should Be Equal ${sensor_type_id} ${entry[12]} |
| 130 | |
| 131 | # Sensor number compare. |
| 132 | Should Be Equal ${sensor_number} ${entry[13]} |
| 133 | |
| 134 | |
Tony Lee | 160aa87 | 2020-02-12 16:11:39 +0800 | [diff] [blame] | 135 | Verify Reserve SEL |
| 136 | [Documentation] Verify reserve SEL. |
| 137 | [Tags] Verify_Reserve_SEL |
| 138 | |
ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 139 | ${resp}= Run IPMI Command |
| 140 | ... ${IPMI_RAW_CMD['SEL_entry']['Reserve'][0]} |
Tony Lee | 160aa87 | 2020-02-12 16:11:39 +0800 | [diff] [blame] | 141 | ${reserve_id}= Split String ${resp} |
| 142 | |
| 143 | # Execute clear SEL raw command with Reservation ID. |
| 144 | # Command will not execute unless the correct Reservation ID value is provided. |
ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 145 | Run IPMI Command |
| 146 | ... 0x0a 0x47 0x${reserve_id[0]} 0x${reserve_id[1]} 0x43 0x4c 0x52 0xaa |
Tony Lee | 160aa87 | 2020-02-12 16:11:39 +0800 | [diff] [blame] | 147 | |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 148 | # Check SEL list. |
| 149 | ${resp}= Run IPMI Standard Command sel list |
| 150 | Should Contain ${resp} SEL has no entries case_insensitive=True |
| 151 | |
| 152 | |
| 153 | Verify IPMI SEL Most Recent Addition Timestamp |
| 154 | [Documentation] Verify most recent addition timestamp in SEL info. |
| 155 | [Tags] Verify_IPMI_SEL_Most_Recent_Addition_Timestamp |
| 156 | |
| 157 | # Get Most Recent Addition Timestamp from SEL Info. |
| 158 | ${addition_timestamp}= Get Most Recent Addition Timestamp From SEL Info |
| 159 | |
| 160 | IF '${addition_timestamp}' != 'ffffffff' |
| 161 | # Convert to epoch timestamp. |
| 162 | ${epoch_addition}= Convert To Integer ${addition_timestamp} 16 |
| 163 | |
| 164 | # Get SEL List last 1 entry date and time and convert to epoch timestamp. |
| 165 | ${sel_epoch_time}= Get SEL Elist Last Entry Date In Epoch |
| 166 | |
| 167 | # Compare epoch of sel entry timestamp and last addition timestamp. |
| 168 | ${diff}= Evaluate int(${sel_epoch_time}) - int(${epoch_addition}) |
| 169 | Should Be True ${diff}<=600 |
| 170 | |
| 171 | ELSE |
| 172 | # Get any Sensor available from Sensor list |
ganesanb | d282b56 | 2022-05-11 20:30:52 +0530 | [diff] [blame] | 173 | ${sensor_name}= Fetch One Threshold Sensor From Sensor List |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 174 | |
| 175 | # Get Sensor ID from SDR Get "sensor" and Identify Sensor ID. |
| 176 | ${sensor_data1}= Fetch Sensor Details From SDR ${sensor_name} Sensor ID |
ganesanb | 11fe27f | 2022-08-24 10:00:17 +0000 | [diff] [blame] | 177 | ${sensor_number}= Get Bytes From SDR Sensor ${sensor_data1} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 178 | |
| 179 | # Get Sensor Type from SDR Get "sensor" and Identify Sensor Type. |
| 180 | ${sensor_data2}= Fetch Sensor Details From SDR ${sensor_name} Sensor Type (Threshold) |
ganesanb | 11fe27f | 2022-08-24 10:00:17 +0000 | [diff] [blame] | 181 | ${sensor_type_id}= Get Bytes From SDR Sensor ${sensor_data2} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 182 | |
| 183 | # Add SEL Entry. |
| 184 | ${sel_create_resp}= Create SEL ${sensor_type_id} ${sensor_number} |
| 185 | |
| 186 | # Get SEL List last 1 entry date and time and convert to epoch timestamp. |
| 187 | ${sel_epoch_time}= Get SEL Elist Last Entry Date In Epoch |
| 188 | |
| 189 | # Get Most Recent Addition Timestamp from SEL Info. |
| 190 | ${addition}= Get Most Recent Addition Timestamp From SEL Info |
| 191 | ${epoch_addition}= Convert To Integer ${addition} 16 |
| 192 | |
| 193 | # Compare epoch of sel entry timestamp and last addition timestamp. |
| 194 | ${diff}= Evaluate int(${epoch_addition}) - int(${sel_epoch_time}) |
| 195 | Should Be True ${diff}<=5 |
| 196 | END |
| 197 | |
| 198 | |
| 199 | Verify IPMI SEL Most Recent Erase Timestamp |
| 200 | [Documentation] Verify Most Recent Erase Timestamp In SEL Info with current |
| 201 | ... BMC epoch timestamp. |
| 202 | [Tags] Verify_IPMI_SEL_Most_Recent_Erase_Timestamp |
| 203 | |
| 204 | # Get BMC Current Time. |
| 205 | ${bmc_epoch_time}= Get BMC Time In Epoch |
| 206 | |
| 207 | # Get Most Recent Addition Timestamp from SEL Info. |
| 208 | ${addition_timestamp}= Get Most Recent Addition Timestamp From SEL Info |
| 209 | Should Be Equal ${addition_timestamp} ffffffff |
| 210 | |
| 211 | # Get Most Recent Erase Timestamp from SEL Info. |
| 212 | ${erase_timestamp}= Get Most Recent Erase Timestamp From SEL Info |
| 213 | ${epoch_erase}= Convert To Integer ${erase_timestamp} 16 |
| 214 | |
| 215 | # Compare epoch of erase timestamp and current bmc timestamp. |
| 216 | ${diff}= Evaluate int(${epoch_erase}) - int(${bmc_epoch_time}) |
| 217 | Should Be True ${diff}<=5 |
| 218 | |
| 219 | |
| 220 | Verify Clear SEL With Invalid Reservation ID |
| 221 | [Documentation] Verify clear SEL After generating another reserve ID. |
| 222 | [Tags] Verify_Clear_SEL_With_Invalid_Reservation_ID |
| 223 | |
| 224 | # Reserve Sel command - 1. |
ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 225 | ${resp}= Run IPMI Command |
| 226 | ... ${IPMI_RAW_CMD['SEL_entry']['Reserve'][0]} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 227 | ${reserve_id}= Split String ${resp} |
| 228 | |
| 229 | # Reserve Sel command - 2. |
ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 230 | ${resp}= Run IPMI Command |
| 231 | ... ${IPMI_RAW_CMD['SEL_entry']['Reserve'][0]} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 232 | |
| 233 | ${cmd}= Catenate ${IPMI_RAW_CMD['SEL_entry']['Clear_SEL'][0]} 0x${reserve_id[0]} |
| 234 | ... 0x${reserve_id[1]} ${IPMI_RAW_CMD['SEL_entry']['Clear_SEL'][1]} |
| 235 | |
| 236 | # Clear SEL command. |
| 237 | ${clear_resp}= Run Keyword and Expect Error *${IPMI_RAW_CMD['SEL_entry']['Clear_SEL'][4]}* |
ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 238 | ... Run IPMI Command ${cmd} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 239 | Should Contain ${clear_resp} ${IPMI_RAW_CMD['SEL_entry']['Clear_SEL'][5]} |
| 240 | |
| 241 | |
| 242 | Verify Reservation ID Erasure Status |
| 243 | [Documentation] Verify Erasure status by clearing SEL with Reserve ID and verify the response byte, |
| 244 | ... whether erasure status is updated in clear sel command response data using new Reserve ID. |
| 245 | [Tags] Verify_Reservation_ID_Erasure_Status |
| 246 | |
| 247 | # Generate Reserve ID 1. |
ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 248 | ${resp}= Run IPMI Command |
| 249 | ... ${IPMI_RAW_CMD['SEL_entry']['Reserve'][0]} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 250 | ${reserve_id}= Split String ${resp} |
| 251 | |
| 252 | ${cmd1}= Catenate ${IPMI_RAW_CMD['SEL_entry']['Clear_SEL'][0]} 0x${reserve_id[0]} |
| 253 | ... 0x${reserve_id[1]} ${IPMI_RAW_CMD['SEL_entry']['Clear_SEL'][1]} |
| 254 | |
| 255 | # Execute clear SEL raw command with Reservation ID. |
| 256 | # Command will not execute unless the correct Reservation ID value is provided. |
ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 257 | Run IPMI Command ${cmd1} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 258 | |
| 259 | # Generate Reserver ID 2. |
ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 260 | ${resp}= Run IPMI Command |
| 261 | ... ${IPMI_RAW_CMD['SEL_entry']['Reserve'][0]} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 262 | ${reserve_id}= Split String ${resp} |
| 263 | |
| 264 | ${cmd2}= Catenate ${IPMI_RAW_CMD['SEL_entry']['Clear_SEL'][0]} 0x${reserve_id[0]} |
| 265 | ... 0x${reserve_id[1]} ${IPMI_RAW_CMD['SEL_entry']['Clear_SEL'][6]} |
| 266 | |
| 267 | # Check the Erasure status of Clear SEL. |
ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 268 | ${data}= Run IPMI Command ${cmd2} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 269 | |
| 270 | # 00 - Erasure in Progress , 01 - Erasure Complete. |
| 271 | Should Contain Any ${data} 00 01 |
| 272 | |
| 273 | |
| 274 | Verify Clear SEL After Cold Reset |
| 275 | [Documentation] Verify Clear SEL for a reserve SEL ID after Cold Reset. |
| 276 | [Tags] Verify_Clear_SEL_After_Cold_Reset |
| 277 | |
| 278 | # Reserve Sel command. |
ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 279 | ${resp}= Run IPMI Command |
| 280 | ... ${IPMI_RAW_CMD['SEL_entry']['Reserve'][0]} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 281 | ${reserve_id}= Split String ${resp} |
| 282 | |
| 283 | # Run Cold Reset. |
ganesanb | d282b56 | 2022-05-11 20:30:52 +0530 | [diff] [blame] | 284 | IPMI MC Reset Cold (off) |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 285 | |
| 286 | ${cmd}= Catenate ${IPMI_RAW_CMD['SEL_entry']['Clear_SEL'][0]} 0x${reserve_id[0]} |
| 287 | ... 0x${reserve_id[1]} ${IPMI_RAW_CMD['SEL_entry']['Clear_SEL'][1]} |
| 288 | |
| 289 | # Clear SEL command. |
| 290 | ${clear_resp}= Run Keyword and Expect Error *${IPMI_RAW_CMD['SEL_entry']['Clear_SEL'][5]}* |
ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 291 | ... Run IPMI Command ${cmd} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 292 | |
| 293 | Should Contain ${clear_resp} ${IPMI_RAW_CMD['SEL_entry']['Clear_SEL'][4]} |
| 294 | |
Tony Lee | 160aa87 | 2020-02-12 16:11:39 +0800 | [diff] [blame] | 295 | |
Vidya-Kalasappanavar | d769075 | 2024-04-30 04:00:15 -0500 | [diff] [blame] | 296 | Delete Non Existing SEL Event Entry |
| 297 | [Documentation] Delete non existing SEL event entry. |
| 298 | [Tags] Delete_Non_Existing_SEL_Event_Entry |
| 299 | |
| 300 | ${sel_delete}= Run Keyword And Expect Error * |
| 301 | ... Run IPMI Standard Command sel delete 100 |
| 302 | Should Contain ${sel_delete} Unable to delete entry |
| 303 | ... case_insensitive=True |
| 304 | |
| 305 | |
| 306 | Delete Invalid SEL Event Entry |
| 307 | [Documentation] Delete invalid SEL event entry. |
| 308 | [Tags] Delete_Invalid_SEL_Event_Entry |
| 309 | |
| 310 | ${sel_delete}= Run Keyword And Expect Error * |
| 311 | ... Run IPMI Standard Command sel delete abc |
| 312 | Should Contain ${sel_delete} Given SEL ID 'abc' is invalid |
| 313 | ... case_insensitive=True |
| 314 | |
| 315 | |
| 316 | Verify IPMI SEL Event Last Add Time |
| 317 | [Documentation] Verify IPMI SEL's last added timestamp. |
| 318 | [Tags] Verify_IPMI_SEL_Event_Last_Add_Time |
| 319 | [Setup] Install Tarball For Error Creation |
| 320 | |
| 321 | Create Test Error Log |
| 322 | ${sel_time}= Run IPMI Standard Command sel time get |
| 323 | ${sel_time}= Convert Date ${sel_time} |
| 324 | ... date_format=%m/%d/%Y %H:%M:%S exclude_millis=True |
| 325 | |
| 326 | ${sel_last_add_time}= Get IPMI SEL Setting Last Add Time |
| 327 | ${sel_last_add_time}= Convert Date ${sel_last_add_time} |
| 328 | ... date_format=%m/%d/%Y %H:%M:%S exclude_millis=True |
| 329 | |
| 330 | ${time_diff}= |
| 331 | ... Subtract Date From Date ${sel_last_add_time} ${sel_time} |
| 332 | |
| 333 | # Verify if the delay in current time check and last add SEL time |
| 334 | # is less or equals to 2 seconds. |
| 335 | Should Be True ${time_diff} <= 2 |
| 336 | |
| 337 | |
Vidya-Kalasappanavar | 6093f77 | 2024-05-10 06:04:28 -0500 | [diff] [blame] | 338 | Verify IPMI SEL Event Entries |
| 339 | [Documentation] Verify IPMI SEL's entries info. |
| 340 | [Tags] Verify_IPMI_SEL_Event_Entries |
| 341 | [Setup] Install Tarball For Error Creation |
| 342 | |
| 343 | # Clear all SEL entries using IPMI command. |
| 344 | Run IPMI Standard Command sel clear |
| 345 | |
| 346 | # Added a delay for IPMI SEL to clear completely. |
| 347 | Sleep 5s |
| 348 | |
| 349 | # Generate error logs of random count. |
| 350 | ${count}= Evaluate random.randint(1, 5) modules=random |
| 351 | Repeat Keyword ${count} Create Test Error Log |
| 352 | |
| 353 | ${sel_entries_count}= Get IPMI SEL Setting Entries |
| 354 | |
| 355 | # After issuing the IPMI SEL clear command. |
| 356 | # There will be one informational SEL entry in the IPMI SEL. |
| 357 | # So comparing the IPMI SEL count with this additional single entry. |
| 358 | Should Be Equal As Strings ${sel_entries_count} ${count + 1} |
| 359 | |
| 360 | |
Tony Lee | 160aa87 | 2020-02-12 16:11:39 +0800 | [diff] [blame] | 361 | *** Keywords *** |
| 362 | |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 363 | Create User Defined SEL |
| 364 | [Documentation] Create a user defined tempearature sensor SEL. |
Tony Lee | 160aa87 | 2020-02-12 16:11:39 +0800 | [diff] [blame] | 365 | |
| 366 | # Create a SEL. |
| 367 | # Example: |
| 368 | # a | 02/14/2020 | 01:16:58 | Temperature #0x17 | | Asserted |
Tony Lee | 21e5d90 | 2020-04-28 09:28:00 +0800 | [diff] [blame] | 369 | Run IPMI Command |
| 370 | ... 0x0a 0x44 0x00 0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x04 0x01 ${sensor_number} 0x00 0xa0 0x04 0x07 |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 371 | |
| 372 | |
| 373 | Get SEL Entry Via IPMI |
| 374 | [Documentation] Get SEL Entry Via IPMI raw command. |
| 375 | [Arguments] ${record1} ${record2} |
| 376 | |
| 377 | # Description of Argument(s): |
| 378 | # ${record1} Record ID for added record, LS Byte |
| 379 | # ${record2} Record ID for added record, MS Byte |
| 380 | |
| 381 | # For example, when a first sel entry is added with IPMI raw command, the response will be "01 00". |
| 382 | # Here, ${record1} is 01, and ${record2} is 00. |
| 383 | |
| 384 | ${cmd}= Catenate ${IPMI_RAW_CMD['SEL_entry']['Get_SEL_Entry'][0]} 0x${record1} |
| 385 | ... 0x${record2} ${IPMI_RAW_CMD['SEL_entry']['Get_SEL_Entry'][1]} |
| 386 | |
| 387 | # Get SEL Entry Raw command. |
ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 388 | ${resp}= Run IPMI Command ${cmd} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 389 | ${resp}= Split String ${resp} |
| 390 | |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 391 | RETURN ${resp} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 392 | |
| 393 | |
| 394 | Get Most Recent Addition Timestamp From SEL Info |
| 395 | [Documentation] Get Most recent addition timestamp From SEL Info. |
| 396 | |
| 397 | # Get SEL Info raw command. |
| 398 | ${sel_info}= Get SEL Info Via IPMI |
| 399 | |
| 400 | # Get Most Recent Addition timestamp in hex. |
| 401 | ${addition_timestamp}= Set Variable ${sel_info[5:9]} |
| 402 | Reverse List ${addition_timestamp} |
| 403 | ${addition_timestamp}= Evaluate "".join(${addition_timestamp}) |
| 404 | |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 405 | RETURN ${addition_timestamp} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 406 | |
| 407 | |
| 408 | Get Most Recent Erase Timestamp From SEL Info |
| 409 | [Documentation] Get Most recent erase timestamp From SEL Info. |
| 410 | |
| 411 | # Get SEL Info Raw command. |
| 412 | ${sel_info}= Get SEL Info Via IPMI |
| 413 | |
| 414 | # Get Most Recent Erase timestamp in hex. |
| 415 | ${erase_timestamp}= Set Variable ${sel_info[9:13]} |
| 416 | Reverse List ${erase_timestamp} |
| 417 | ${erase_timestamp}= Evaluate "".join(${erase_timestamp}) |
| 418 | |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 419 | RETURN ${erase_timestamp} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 420 | |
| 421 | |
| 422 | Get SEL Elist Last Entry Date In Epoch |
| 423 | [Documentation] Get the time from SEL elist last entry and returns epoch time. |
| 424 | |
| 425 | # Get SEL list last entry. |
| 426 | ${resp}= Run IPMI Standard Command sel elist last 1 |
| 427 | |
| 428 | # Get date from the sel entry and convert to epoch timestamp. |
| 429 | ${sel_entry_date}= Fetch Added SEL Date ${resp} |
| 430 | ${epoch_date}= Convert Date ${sel_entry_date} epoch exclude_millis=yes date_format=%m/%d/%Y %H:%M:%S |
| 431 | |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 432 | RETURN ${epoch_date} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 433 | |
| 434 | |
| 435 | Get BMC Time In Epoch |
| 436 | [Documentation] Get the current time from BMC and returns epoch time. |
| 437 | |
| 438 | # Get the bmc native bmc date command response. |
| 439 | ${date}= Get Current Date from BMC |
| 440 | |
| 441 | ${epoch_date}= Convert Date ${date} epoch exclude_millis=yes date_format=%m/%d/%Y %H:%M:%S |
| 442 | |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 443 | RETURN ${epoch_date} |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 444 | |
| 445 | |
Vidya-Kalasappanavar | d769075 | 2024-04-30 04:00:15 -0500 | [diff] [blame] | 446 | Install Tarball For Error Creation |
| 447 | [Documentation] Install tarball for error log creation. |
| 448 | |
| 449 | ${status}= Run Keyword And Return Status Logging Test Binary Exist |
| 450 | Run Keyword If ${status} == ${False} Install Tarball |
| 451 | |
| 452 | |
chithrag | d7e009b | 2022-03-01 12:20:57 +0000 | [diff] [blame] | 453 | Test Setup Execution |
| 454 | [Documentation] Do test setup tasks. |
| 455 | |
| 456 | Run IPMI Standard Command sel clear |
| 457 | Sleep 5s |