chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test IPMI Inband SDR commands. |
| 3 | ... Following IPMI command are verified, |
| 4 | ... 1. Get SDR, |
| 5 | ... 2. Get Device SDR Info, |
| 6 | ... 3. Reserve Device SDR Repository, |
| 7 | ... 4. Get Device SDR. |
| 8 | |
| 9 | Resource ../lib/ipmi_client.robot |
| 10 | Resource ../lib/openbmc_ffdc.robot |
| 11 | Resource ../lib/boot_utils.robot |
| 12 | Library ../lib/ipmi_utils.py |
| 13 | Variables ../data/ipmi_raw_cmd_table.py |
| 14 | |
| 15 | Suite setup Redfish.Login |
| 16 | Suite Teardown Redfish.Logout |
| 17 | Test Teardown FFDC On Test Case Fail |
| 18 | |
| 19 | Force Tags SDR_Test |
| 20 | |
| 21 | |
| 22 | *** Test Cases *** |
| 23 | |
| 24 | Verify Get SDR For Maximum Record Via IPMI |
| 25 | [Documentation] Verify Get SDR for each and every record one by one via IPMI lanplus. |
| 26 | [Tags] Verify_Get_SDR_For_Maximum_Record_Via_IPMI |
| 27 | |
| 28 | # Gets the Total Record Count from SDR Info and the last Record entry number. |
| 29 | ${record_count} ${last_record}= Get Record Count And Last Record From SDR |
| 30 | |
| 31 | # Validate each and every record till the last record. |
| 32 | FOR ${record} IN RANGE 0 ${record_count} |
| 33 | # Convert number to hexadecimal record ID. |
| 34 | ${recordhex}= Convert To Hex ${record} length=2 lowercase=yes |
| 35 | |
| 36 | # Get SDR command. |
| 37 | ${resp}= Run IPMI Standard Command |
| 38 | ... raw ${IPMI_RAW_CMD['Get SDR']['Get'][1]} 0x00 0x00 0x${recordhex} 0x00 0x00 0xff |
| 39 | ${get_SDR}= Split String ${resp} |
| 40 | |
| 41 | # If the record ID reaches the last data available, the next record ID will be ff ff. |
| 42 | # eg, If total record ID available is 115, record IDs : 0 - 114, |
| 43 | # Then when record ID reaches last record ID (i.e 114 (decimal) - 72h), |
| 44 | # Get SDR response bytes 0:2 will be - ff ff 72 00 .... |
| 45 | # If not then (say 25 - 19h ), 1a 00 19 00 .... |
| 46 | |
| 47 | IF '${record}' != '${last_record}' |
| 48 | # current record ID in response data. |
| 49 | Should Be Equal ${get_SDR[2]} ${recordhex} |
| 50 | Should Be Equal ${get_SDR[3]} 00 |
| 51 | |
| 52 | # Next record ID in response data. |
| 53 | ${record_next}= Evaluate ${record} + 1 |
| 54 | ${record_next}= Convert To Hex ${record_next} length=2 lowercase=yes |
| 55 | Should Be Equal ${get_SDR[0]} ${record_next} |
| 56 | Should Be Equal ${get_SDR[1]} 00 |
| 57 | ELSE |
| 58 | # Next record ID in response data. |
| 59 | Should Be Equal ${get_SDR[0]} ff |
| 60 | Should Be Equal ${get_SDR[1]} ff |
| 61 | |
| 62 | # current record ID in response data. |
| 63 | Should Be Equal ${get_SDR[2]} ${recordhex} |
| 64 | Should Be Equal ${get_SDR[3]} 00 |
| 65 | END |
| 66 | |
| 67 | # Response Data Count - total records (max - FFh - 255 in decimal). |
| 68 | ${response_data}= Set Variable ${get_SDR[2:]} |
| 69 | ${length}= Get Length ${response_data} |
| 70 | Should Be True 0<${length}<=255 |
| 71 | END |
| 72 | |
| 73 | |
| 74 | Verify Sensor And SDR Count In Get Device SDR Info Via Inband IPMI |
| 75 | [Documentation] Verify Sensor and SDR Count in Get Device SDR Info via inband IPMI. |
| 76 | [Tags] Verify_Sensor_And_SDR_Count_In_Get_Device_SDR_Info_Via_Inband_IPMI |
| 77 | |
| 78 | # Get Sensor count and SDR elist all count from IPMI LAN interface. |
| 79 | ${sensor_count_lan1} ${SDR_count_lan1}= Get Count for Sensor And SDR Elist All |
| 80 | |
| 81 | # Get Sensor Count From Get Device SDR Info command. |
| 82 | ${sensor_count1}= Get Sensor Count From SDR Info |
| 83 | # Compare Get Device SDR Sensor count with Sensor count from lanplus. |
| 84 | Should Be Equal As Integers ${sensor_count1} ${sensor_count_lan1} |
| 85 | |
| 86 | # Get SDR Count From Get Device SDR Info command. |
| 87 | ${SDR_count1}= Get SDR Count From SDR Info |
| 88 | # Compare Get Device SDR Sdr count with SDR Elist All count from lanplus. |
| 89 | Should Be Equal As Integers ${SDR_count1} ${SDR_count_lan1} |
| 90 | |
| 91 | # Reboot Host using Chassis Power Cycle. |
| 92 | IPMI Power Cycle |
| 93 | |
| 94 | # Get Sensor count and SDR elist all count from IPMI lanplus interface. |
| 95 | ${sensor_count_lan2} ${SDR_count_lan2}= Get Count for Sensor And SDR Elist All |
| 96 | |
| 97 | # Get Sensor Count From Get Device SDR Info command. |
| 98 | ${sensor_count2}= Get Sensor Count From SDR Info |
| 99 | # Compare Get Device SDR Sensor count with Sensor count from lanplus. |
| 100 | Should Be Equal As Integers ${sensor_count2} ${sensor_count_lan2} |
| 101 | |
| 102 | # Get SDR Count From Get Device SDR Info command. |
| 103 | ${SDR_count2}= Get SDR Count From SDR Info |
| 104 | # Compare Get Device SDR Sdr count with SDR Elist All count from lanplus. |
| 105 | Should Be Equal As Integers ${SDR_count2} ${SDR_count_lan2} |
| 106 | |
| 107 | |
| 108 | Verify Timestamp In Get Device SDR Info Via Inband IPMI |
| 109 | [Documentation] Verify timestamp In Get Device SDR Info via inband IPMI. |
| 110 | [Tags] Verify_Timestamp_In_Get_Device_SDR_Info_Via_Inband_IPMI |
| 111 | |
| 112 | # Reboot Host using Chassis Power Cycle. |
| 113 | IPMI Power Cycle |
| 114 | |
| 115 | # Get epoch Timestamp obtained from Get Device SDR Info command. |
| 116 | ${SDR_timestamp}= Get Device SDR Timestamp |
| 117 | |
| 118 | # Get current date from BMC Native Date command and convert to epoch. |
| 119 | ${bmc_date}= Get Current Date from BMC |
| 120 | ${epoch_bmc}= Convert Date ${bmc_date} epoch exclude_millis=yes date_format=%m/%d/%Y %H:%M:%S |
| 121 | |
| 122 | # Compare time difference between bmc time and Get Device SDR Info timestamp. |
| 123 | # The maximum time difference should be less then 6 minute - 360 seconds. |
| 124 | ${difference}= Evaluate int(${epoch_bmc}) - int(${SDR_timestamp}) |
| 125 | Should Be True ${difference}<=360 |
| 126 | |
| 127 | |
| 128 | Verify Get Device SDR Info For Invalid Data Request |
| 129 | [Documentation] Verify Get Device SDR Info via inband IPMI with extra bytes. |
| 130 | [Tags] Verify_Get_Device_SDR_Info_For_Invalid_Data_Request |
| 131 | |
| 132 | # Sensor Count Via Device SDR Info with extra bytes. |
| 133 | ${resp}= Run Keyword and Expect Error *${IPMI_RAW_CMD['Device_SDR']['Get_Info'][3]}* |
| 134 | ... Run Inband IPMI Standard Command |
| 135 | ... raw ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][0]} 0x00 |
| 136 | # Proper error code should be returned. |
| 137 | Should Contain ${resp} ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][2]} |
| 138 | |
| 139 | # SDR Count Via Device SDR Info with extra bytes. |
| 140 | ${resp}= Run Keyword and Expect Error *${IPMI_RAW_CMD['Device_SDR']['Get_Info'][3]}* |
| 141 | ... Run Inband IPMI Standard Command |
| 142 | ... raw ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][1]} 0x00 |
| 143 | # Proper error code should be returned. |
| 144 | Should Contain ${resp} ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][2]} |
| 145 | |
| 146 | |
| 147 | Verify Device SDR Info Via IPMI Lanplus |
| 148 | [Documentation] Verify whether Get Device SDR Info command is accessible via lanplus. |
| 149 | [Tags] Verify_Device_SDR_Info_Via_IPMI_Lanplus |
| 150 | |
| 151 | # Sensor Count Via Device SDR Info via lanplus. |
| 152 | ${resp}= Run Keyword and Expect Error *${IPMI_RAW_CMD['Device_SDR']['Get_Info'][5]}* |
| 153 | ... Run IPMI Standard Command |
| 154 | ... raw ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][0]} |
| 155 | # Proper error code should be returned. |
| 156 | Should Contain ${resp} ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][4]} |
| 157 | |
| 158 | # SDR Count Via Device SDR Info via lanplus. |
| 159 | ${resp}= Run Keyword and Expect Error *${IPMI_RAW_CMD['Device_SDR']['Get_Info'][5]}* |
| 160 | ... Run IPMI Standard Command |
| 161 | ... raw ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][1]} |
| 162 | # Proper error code should be returned. |
| 163 | Should Contain ${resp} ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][4]} |
| 164 | |
| 165 | |
| 166 | Verify Reserve Device SDR Repository Via Inband IPMI |
| 167 | [Documentation] Verify Reserve Device SDR Repository via inband IPMI. |
| 168 | [Tags] Verify_Reserve_Device_SDR_Repository_Via_Inband_IPMI |
| 169 | |
| 170 | # Reserve Device SDR Repository via inband IPMI. |
| 171 | ${resp}= Get Reserve Device SDR Repository |
| 172 | ${reserve_id}= Split String ${resp} |
| 173 | |
| 174 | # Identify the byte count. |
| 175 | ${length}= Get Length ${reserve_id} |
| 176 | Should Be Equal As Integers ${length} 2 |
| 177 | |
| 178 | |
| 179 | Verify Reserve Device SDR Repository For Invalid Data Request |
| 180 | [Documentation] Verify Reserve Device SDR Repository via inband IPMI with extra request bytes. |
| 181 | [Tags] Verify_Reserve_Device_SDR_Repository_For_Invalid_Data_Request |
| 182 | |
| 183 | # Reserve Device SDR Repository with extra request bytes. |
| 184 | ${resp}= Run Keyword and Expect Error *${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][2]}* |
| 185 | ... Run Inband IPMI Standard Command |
| 186 | ... raw ${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][0]} 0x00 |
| 187 | # Proper error code should be returned. |
| 188 | Should Contain ${resp} ${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][1]} |
| 189 | |
| 190 | |
| 191 | Verify Reserve Device SDR Repository Info Via IPMI Lanplus |
| 192 | [Documentation] Verify whether Reserve Device SDR Repository command is accessible via lanplus. |
George Keishing | e45d262 | 2022-05-05 07:27:30 -0500 | [diff] [blame] | 193 | [Tags] Verify_Reserve_Device_SDR_Repository_Info_Via_IPMI_Lanplus |
chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 194 | |
| 195 | # Reserve Device SDR Repository via lanplus. |
| 196 | ${resp}= Run Keyword and Expect Error *${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][4]}* |
| 197 | ... Run IPMI Standard Command |
| 198 | ... raw ${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][0]} |
| 199 | # Proper error code should be returned. |
| 200 | Should Contain ${resp} ${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][3]} |
| 201 | |
| 202 | |
| 203 | Verify Reserve Device SDR Repository For Partial Record |
George Keishing | 6e64126 | 2022-05-05 10:46:22 -0500 | [diff] [blame] | 204 | [Documentation] Verify whether reservation ID of Reserve Device SDR Repository is accessible |
| 205 | ... to fetch partial record from Get Device SDR. |
chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 206 | [Tags] Verify_Reserve_Device_SDR_Repository_For_Partial_Record |
| 207 | |
| 208 | # Get Reservation ID. |
| 209 | ${resp}= Get Reserve Device SDR Repository |
| 210 | ${reserve_id}= Split String ${resp} |
| 211 | |
| 212 | # Check whether the response for Get device SDR command is obtained with the given Reservation ID. |
| 213 | ${resp}= Run IPMI Standard Command |
| 214 | ... raw ${IPMI_RAW_CMD['Device_SDR']['Get'][0]} 0x${reserve_id[0]} 0x${reserve_id[1]} 0x00 0x00 0x00 0x0f |
| 215 | ${resp}= Split String ${resp} |
| 216 | # Record data starts from ${resp[2]}. |
| 217 | ${resp}= Set Variable ${resp[2:]} |
| 218 | ${length}= Get Length ${resp} |
| 219 | Should Be Equal As Integers ${length} 15 |
| 220 | |
| 221 | |
| 222 | Verify Reserve Device SDR Repository For Partial Record After BMC Reboot |
| 223 | [Documentation] Verify whether Reservation ID of Reserve Device SDR Repository, |
| 224 | ... is accessible after bmc reboot to fetch partial record from Get Device SDR. |
| 225 | [Tags] Verify_Reserve_Device_SDR_Repository_For_Partial_Record_After_BMC_Reboot |
| 226 | |
| 227 | # Generate Reservation ID. |
| 228 | ${resp}= Get Reserve Device SDR Repository |
| 229 | ${reserve_id}= Split String ${resp} |
| 230 | |
| 231 | # Check whether the response for Get device SDR command is obtained with the given Reservation ID. |
| 232 | ${resp1}= Run IPMI Standard Command |
| 233 | ... raw ${IPMI_RAW_CMD['Device_SDR']['Get'][0]} 0x${reserve_id[0]} 0x${reserve_id[1]} 0x00 0x00 0x00 0x0f |
| 234 | |
| 235 | # Reboot bmc. |
| 236 | Run IPMI Standard Command raw ${IPMI_RAW_CMD['Resets']['cold'][0]} |
| 237 | Wait Until Keyword Succeeds 3 min 10 sec Is BMC Unpingable |
| 238 | Wait Until Keyword Succeeds 3 min 10 sec Is BMC Operational |
| 239 | |
| 240 | # Check whether the response for Get device SDR command is obtained with the given Reservation ID. |
| 241 | # Reserve IDs are volatile so once bmc is rebooted, new Reserve ID should be generated. |
| 242 | ${resp2}= Run Keyword and Expect Error *${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][5]}* |
| 243 | ... Run IPMI Standard Command |
| 244 | ... raw ${IPMI_RAW_CMD['Device_SDR']['Get'][0]} ${reserve_id[0]} ${reserve_id[1]} 0x00 0x00 0x00 0x0f |
| 245 | |
| 246 | |
| 247 | Verify Reserve Device SDR Repository Invalid Reservation ID For Partial Record |
| 248 | [Documentation] Verify whether invalid reservation ID of Reserve Device SDR Repository, |
| 249 | ... is accessible to fetch partial record from Get Device SDR. |
| 250 | [Tags] Verify_Reserve_Device_SDR_Repository_Invalid_Reservation_ID_For_Partial_Record |
| 251 | |
| 252 | # Generate Reservation ID 1. |
| 253 | ${resp}= Get Reserve Device SDR Repository |
| 254 | ${reserve_id}= Split String ${resp} |
| 255 | |
| 256 | # Generate Reservation ID 2. |
| 257 | ${resp2}= Get Reserve Device SDR Repository |
| 258 | |
| 259 | # Check whether response for Gner device SDR command is obtained with Reservation ID 1. |
| 260 | # Once Reservation ID is overwritten, old Reservation ID will be invalid. |
| 261 | ${resp1}= Run Keyword and Expect Error *${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][5]}* |
| 262 | ... Run IPMI Standard Command |
| 263 | ... raw ${IPMI_RAW_CMD['Device_SDR']['Get'][0]} 0x${reserve_id[0]} 0x${reserve_id[1]} 0x00 0x00 0x00 0x0f |
| 264 | |
| 265 | |
| 266 | Verify Get Device SDR For Maximum Record Via IPMI |
| 267 | [Documentation] Verify Get Device SDR for each and every Record Via IPMI lanplus. |
| 268 | [Tags] Verify_Get_Device_SDR_For_Maximum_Record_Via_IPMI |
| 269 | |
| 270 | # Gets the Total Record Count from SDR Info and the last Record entry number. |
| 271 | ${record_count} ${last_record}= Get Record Count And Last Record From SDR |
| 272 | |
| 273 | # Validate each and every record till the last record. |
| 274 | FOR ${record} IN RANGE 0 ${record_count} |
| 275 | # Convert number to hexadecimal record ID. |
| 276 | ${recordhex}= Convert To Hex ${record} length=2 lowercase=yes |
| 277 | |
| 278 | # Get SDR command. |
| 279 | ${resp}= Run IPMI Standard Command |
| 280 | ... raw ${IPMI_RAW_CMD['Device_SDR']['Get'][0]} 0x00 0x00 0x${recordhex} 0x00 0x00 0xff |
| 281 | ${get_dev_SDR}= Split String ${resp} |
| 282 | |
| 283 | # If the record ID reaches the last data available, the next record ID will be ff ff |
| 284 | # eg, If total record ID available is 115, record IDs : 0 - 114, |
| 285 | # Then when record ID reaches last record ID (i.e 114 (in decimal) - 72h), |
| 286 | # Get SDR response bytes 0:2 will be - ff ff 72 00 .... |
| 287 | # If not then (say 25 - 19h ), 1a 00 19 00 .... |
| 288 | |
| 289 | IF '${record}' != '${last_record}' |
| 290 | # current record ID in response data. |
| 291 | Should Be Equal ${get_dev_SDR[2]} ${recordhex} |
| 292 | Should Be Equal ${get_dev_SDR[3]} 00 |
| 293 | |
| 294 | # Next record ID in response data. |
| 295 | ${record_next}= Evaluate ${record} + 1 |
| 296 | ${record_next}= Convert To Hex ${record_next} length=2 lowercase=yes |
| 297 | Should Be Equal ${get_dev_SDR[0]} ${record_next} |
| 298 | Should Be Equal ${get_dev_SDR[1]} 00 |
| 299 | |
| 300 | ELSE |
| 301 | # Next record ID in response data. |
| 302 | Should Be Equal ${get_dev_SDR[0]} ff |
| 303 | Should Be Equal ${get_dev_SDR[1]} ff |
| 304 | |
| 305 | # current record ID in response data. |
| 306 | Should Be Equal ${get_dev_SDR[2]} ${recordhex} |
| 307 | Should Be Equal ${get_dev_SDR[3]} 00 |
| 308 | |
| 309 | END |
| 310 | # Response data count - total record ID (max - FFh - 255 in decimal). |
| 311 | ${response_data}= Set Variable ${get_dev_SDR[2:]} |
| 312 | ${length}= Get Length ${response_data} |
| 313 | Should Be True 0<${length}<=255 |
| 314 | END |
| 315 | |
| 316 | |
| 317 | Verify Get Device SDR For Invalid Data Request Via IPMI |
| 318 | [Documentation] Verify Get Device SDR via IPMI lanplus with extra bytes. |
| 319 | [Tags] Verify_Get_Device_SDR_For_Invalid_Data_Request_Via_IPMI |
| 320 | |
| 321 | # Get SDR command with extra bytes. |
| 322 | ${resp}= Run Keyword and Expect Error *${IPMI_RAW_CMD['Device_SDR']['Get'][3]}* |
| 323 | ... Run IPMI Standard Command |
| 324 | ... raw ${IPMI_RAW_CMD['Device_SDR']['Get'][0]} 0x00 0x00 ${IPMI_RAW_CMD['Device_SDR']['Get'][1]} 0x00 |
| 325 | # Proper error code should be returned. |
| 326 | Should Contain ${resp} ${IPMI_RAW_CMD['Device_SDR']['Get'][2]} |
| 327 | |
| 328 | |
| 329 | *** Keywords *** |
| 330 | |
| 331 | Get IPMI Sensor Count |
| 332 | [Documentation] Get sensors count using "SDR elist all" command. |
| 333 | # Example of "SDR elist all" command output: |
| 334 | # BootProgress | 03h | ok | 34.2 | |
| 335 | # OperatingSystemS | 05h | ok | 35.1 | |
| 336 | # AttemptsLeft | 07h | ok | 34.1 | |
| 337 | # occ0 | 08h | ok | 210.1 | Device Disabled |
| 338 | # occ1 | 09h | ok | 210.2 | Device Disabled |
| 339 | # p0_core0_temp | 11h | ns | 3.1 | Disabled |
| 340 | # cpu0_core0 | 12h | ok | 208.1 | Presence detected |
| 341 | # p0_core1_temp | 14h | ns | 3.2 | Disabled |
| 342 | # cpu0_core1 | 15h | ok | 208.2 | Presence detected |
| 343 | # p0_core2_temp | 17h | ns | 3.3 | Disabled |
| 344 | # .. |
| 345 | # .. |
| 346 | # .. |
| 347 | # .. |
| 348 | # .. |
| 349 | # .. |
| 350 | # fan3 | 00h | ns | 29.4 | Logical FRU @35h |
| 351 | # bmc | 00h | ns | 6.1 | Logical FRU @3Ch |
| 352 | # ethernet | 00h | ns | 1.1 | Logical FRU @46h |
| 353 | |
| 354 | ${output}= Run IPMI Standard Command SDR elist all |
| 355 | ${sensor_list}= Split String ${output} \n |
| 356 | ${sensor_count}= Get Length ${sensor_list} |
| 357 | [Return] ${sensor_count} |
| 358 | |
| 359 | |
| 360 | Get Device SDR Info For Sensor Data |
| 361 | [Documentation] Get Device SDR Info via inband IPMI and return response data with Sensor count. |
| 362 | |
| 363 | # Get Device SDR Info for Sensor data. |
| 364 | ${sensor_data}= Run Inband IPMI Standard Command |
| 365 | ... raw ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][0]} |
| 366 | |
| 367 | [Return] ${sensor_data} |
| 368 | |
| 369 | |
| 370 | Get Device SDR Info For SDR Data |
| 371 | [Documentation] Get Device SDR Info via inband IPMI and return response data with SDR count. |
| 372 | |
| 373 | # Get Device SDR Info for SDR data. |
| 374 | ${SDR_data}= Run Inband IPMI Standard Command |
| 375 | ... raw ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][1]} |
| 376 | |
| 377 | [Return] ${SDR_data} |
| 378 | |
| 379 | |
| 380 | Get Sensor Count From SDR Info |
| 381 | [Documentation] Get Sensor Count from Get Device SDR Info data. |
| 382 | |
| 383 | # Get Device SDR Info Via inband IPMI for Sensor count. |
| 384 | ${sensor_data}= Get Device SDR Info For Sensor Data |
| 385 | |
| 386 | # Get Sensor count from Get Device SDR Info count - bytie 0. |
| 387 | ${sensor_data}= Split String ${sensor_data} |
| 388 | ${sensor_count}= Set Variable ${sensor_data[0]} |
| 389 | ${sensor_count}= Convert To Integer ${sensor_count} 16 |
| 390 | |
| 391 | [Return] ${sensor_count} |
| 392 | |
| 393 | |
| 394 | Get SDR Count From SDR Info |
| 395 | [Documentation] Get SDR Count from Get Device SDR Info data. |
| 396 | |
| 397 | # Get Device SDR Info Via inband IPMI for SDR count. |
| 398 | ${SDR_data}= Get Device SDR Info For SDR Data |
| 399 | |
| 400 | # Get SDR count from Get Device SDR Info count - byte 0. |
| 401 | ${SDR_data}= Split String ${SDR_data} |
| 402 | ${SDR_count}= Set Variable ${SDR_data[0]} |
| 403 | ${SDR_count}= Convert To Integer ${SDR_count} 16 |
| 404 | |
| 405 | [Return] ${SDR_count} |
| 406 | |
| 407 | |
| 408 | Get Device SDR Timestamp |
| 409 | [Documentation] Get Timestamp from Get Device SDR Info. |
| 410 | |
| 411 | # Get Device SDR Info Via inband IPMI for Sendor count. |
| 412 | ${sensor_data}= Get Device SDR Info For Sensor Data |
| 413 | # Get Device SDR Info Via inband IPMI for SDR count. |
| 414 | ${SDR_data}= Get Device SDR Info For SDR Data |
| 415 | |
| 416 | # Split into list. |
| 417 | ${sensor_data}= Split String ${sensor_data} |
| 418 | ${SDR_data}= Split String ${SDR_data} |
| 419 | |
| 420 | # Timestamp for the Get SDR count will be from Response byte 2 to N. |
| 421 | # Compare the timestamps for Sensor data and SDR data. |
| 422 | Should Be Equal ${sensor_data[2:]} ${SDR_data[2:]} |
| 423 | |
| 424 | # Convert Bytestamp to Epoch timestamp. |
| 425 | ${timestamp}= Set Variable ${SDR_data[2:]} |
| 426 | Reverse List ${timestamp} |
| 427 | ${timestamp}= Evaluate "".join(${timestamp}) |
| 428 | # Prefixes 0s for expected bytes. |
| 429 | ${timestamp}= Zfill Data ${timestamp} 8 |
| 430 | ${timestamp}= Convert To Integer ${timestamp} 16 |
| 431 | |
| 432 | [Return] ${timestamp} |
| 433 | |
| 434 | |
| 435 | Get Count for Sensor And SDR Elist All |
| 436 | [Documentation] Get Sensor and SDR elist all count via IPMI lanplus. |
| 437 | |
| 438 | # Get Sensor list via IPMI lanplus. |
| 439 | ${sensor_count}= Run IPMI Standard Command sensor | wc -l |
| 440 | # Get SDR elist all via IPMI lanplus. |
| 441 | ${SDR_count}= Get IPMI Sensor Count |
| 442 | |
| 443 | [Return] ${sensor_count} ${SDR_count} |
| 444 | |
| 445 | |
| 446 | Get Reserve Device SDR Repository |
| 447 | [Documentation] Get Reserve Device SDR Repository via Inband IPMI. |
| 448 | |
| 449 | # Reserve Device SDR Repository command via inband. |
| 450 | ${resp}= Run Inband IPMI Standard Command |
| 451 | ... raw ${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][0]} |
| 452 | |
| 453 | [Return] ${resp} |
| 454 | |
| 455 | |
| 456 | Get IPMI SDR Status Info |
| 457 | [Documentation] Returns status for given IPMI SDR Info. |
| 458 | [Arguments] ${setting} |
| 459 | # Description of argument(s): |
| 460 | # setting SDR Info which needs to be read(e.g. "SDR Version"). |
| 461 | # SDR Version : 0x51 |
| 462 | # Record Count : 58 |
| 463 | # Free Space : 9312 bytes |
| 464 | # Most recent Addition : 03/10/2022 05:56:02 |
| 465 | # Most recent Erase : 02/07/2106 06:28:15 |
| 466 | # SDR overflow : yes |
| 467 | # SDR Repository Update Support : unspecified |
| 468 | # Delete SDR supported : no |
| 469 | # Partial Add SDR supported : no |
| 470 | # Reserve SDR repository supported : yes |
| 471 | # SDR Repository Alloc info supported : yes |
| 472 | |
| 473 | # Get SDR Info IPMI command. |
| 474 | ${resp}= Run IPMI Standard Command SDR info |
| 475 | |
| 476 | # Return lines for given IPMI SDR Info. |
| 477 | ${setting_line}= Get Lines Containing String ${resp} ${setting} |
| 478 | ... case-insensitive |
| 479 | ${setting_status}= Fetch From Right ${setting_line} :${SPACE} |
| 480 | |
| 481 | [Return] ${setting_status} |
| 482 | |
| 483 | |
| 484 | Get Record Count And Last Record From SDR |
| 485 | [Documentation] Returns total record count from IPMI SDR Info and last SDR record. |
| 486 | |
| 487 | # Returns Record count from IPMI SDR Info. |
| 488 | ${record_count}= Get IPMI SDR Status Info Record Count |
| 489 | |
| 490 | # Identifies Last record ID. |
| 491 | # If Record Count = 58 (3Ah), record IDs range from 0 to 57. |
| 492 | # Then Last record ID will be 57 (in decimal) - 39h. |
| 493 | ${last_record}= Evaluate ${record_count} - 1 |
| 494 | |
| 495 | [Return] ${record_count} ${last_record} |