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