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