1*** Settings *** 2Documentation 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 9Resource ../lib/ipmi_client.robot 10Resource ../lib/openbmc_ffdc.robot 11Resource ../lib/boot_utils.robot 12Library ../lib/ipmi_utils.py 13Variables ../data/ipmi_raw_cmd_table.py 14 15Suite setup Redfish.Login 16Suite Teardown Redfish.Logout 17Test Teardown FFDC On Test Case Fail 18 19Force Tags SDR_Test 20 21 22*** Test Cases *** 23 24Verify 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 74Verify 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 108Verify 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 128Verify 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 147Verify 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 166Verify 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 179Verify 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 191Verify Reserve Device SDR Repository Info Via IPMI Lanplus 192 [Documentation] Verify whether Reserve Device SDR Repository command is accessible via lanplus. 193 [Tags] Verify_Reserve_Device_SDR_Repository_Info_Via_IPMI_Lanplus 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 203Verify Reserve Device SDR Repository For Partial Record 204 [Documentation] Verify whether reservation ID of Reserve Device SDR Repository is accessible to fetch partial record from Get Device SDR. 205 [Tags] Verify_Reserve_Device_SDR_Repository_For_Partial_Record 206 207 # Get Reservation ID. 208 ${resp}= Get Reserve Device SDR Repository 209 ${reserve_id}= Split String ${resp} 210 211 # Check whether the response for Get device SDR command is obtained with the given Reservation ID. 212 ${resp}= Run IPMI Standard Command 213 ... raw ${IPMI_RAW_CMD['Device_SDR']['Get'][0]} 0x${reserve_id[0]} 0x${reserve_id[1]} 0x00 0x00 0x00 0x0f 214 ${resp}= Split String ${resp} 215 # Record data starts from ${resp[2]}. 216 ${resp}= Set Variable ${resp[2:]} 217 ${length}= Get Length ${resp} 218 Should Be Equal As Integers ${length} 15 219 220 221Verify Reserve Device SDR Repository For Partial Record After BMC Reboot 222 [Documentation] Verify whether Reservation ID of Reserve Device SDR Repository, 223 ... is accessible after bmc reboot to fetch partial record from Get Device SDR. 224 [Tags] Verify_Reserve_Device_SDR_Repository_For_Partial_Record_After_BMC_Reboot 225 226 # Generate Reservation ID. 227 ${resp}= Get Reserve Device SDR Repository 228 ${reserve_id}= Split String ${resp} 229 230 # Check whether the response for Get device SDR command is obtained with the given Reservation ID. 231 ${resp1}= Run IPMI Standard Command 232 ... raw ${IPMI_RAW_CMD['Device_SDR']['Get'][0]} 0x${reserve_id[0]} 0x${reserve_id[1]} 0x00 0x00 0x00 0x0f 233 234 # Reboot bmc. 235 Run IPMI Standard Command raw ${IPMI_RAW_CMD['Resets']['cold'][0]} 236 Wait Until Keyword Succeeds 3 min 10 sec Is BMC Unpingable 237 Wait Until Keyword Succeeds 3 min 10 sec Is BMC Operational 238 239 # Check whether the response for Get device SDR command is obtained with the given Reservation ID. 240 # Reserve IDs are volatile so once bmc is rebooted, new Reserve ID should be generated. 241 ${resp2}= Run Keyword and Expect Error *${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][5]}* 242 ... Run IPMI Standard Command 243 ... raw ${IPMI_RAW_CMD['Device_SDR']['Get'][0]} ${reserve_id[0]} ${reserve_id[1]} 0x00 0x00 0x00 0x0f 244 245 246Verify Reserve Device SDR Repository Invalid Reservation ID For Partial Record 247 [Documentation] Verify whether invalid reservation ID of Reserve Device SDR Repository, 248 ... is accessible to fetch partial record from Get Device SDR. 249 [Tags] Verify_Reserve_Device_SDR_Repository_Invalid_Reservation_ID_For_Partial_Record 250 251 # Generate Reservation ID 1. 252 ${resp}= Get Reserve Device SDR Repository 253 ${reserve_id}= Split String ${resp} 254 255 # Generate Reservation ID 2. 256 ${resp2}= Get Reserve Device SDR Repository 257 258 # Check whether response for Gner device SDR command is obtained with Reservation ID 1. 259 # Once Reservation ID is overwritten, old Reservation ID will be invalid. 260 ${resp1}= Run Keyword and Expect Error *${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][5]}* 261 ... Run IPMI Standard Command 262 ... raw ${IPMI_RAW_CMD['Device_SDR']['Get'][0]} 0x${reserve_id[0]} 0x${reserve_id[1]} 0x00 0x00 0x00 0x0f 263 264 265Verify Get Device SDR For Maximum Record Via IPMI 266 [Documentation] Verify Get Device SDR for each and every Record Via IPMI lanplus. 267 [Tags] Verify_Get_Device_SDR_For_Maximum_Record_Via_IPMI 268 269 # Gets the Total Record Count from SDR Info and the last Record entry number. 270 ${record_count} ${last_record}= Get Record Count And Last Record From SDR 271 272 # Validate each and every record till the last record. 273 FOR ${record} IN RANGE 0 ${record_count} 274 # Convert number to hexadecimal record ID. 275 ${recordhex}= Convert To Hex ${record} length=2 lowercase=yes 276 277 # Get SDR command. 278 ${resp}= Run IPMI Standard Command 279 ... raw ${IPMI_RAW_CMD['Device_SDR']['Get'][0]} 0x00 0x00 0x${recordhex} 0x00 0x00 0xff 280 ${get_dev_SDR}= Split String ${resp} 281 282 # If the record ID reaches the last data available, the next record ID will be ff ff 283 # eg, If total record ID available is 115, record IDs : 0 - 114, 284 # Then when record ID reaches last record ID (i.e 114 (in decimal) - 72h), 285 # Get SDR response bytes 0:2 will be - ff ff 72 00 .... 286 # If not then (say 25 - 19h ), 1a 00 19 00 .... 287 288 IF '${record}' != '${last_record}' 289 # current record ID in response data. 290 Should Be Equal ${get_dev_SDR[2]} ${recordhex} 291 Should Be Equal ${get_dev_SDR[3]} 00 292 293 # Next record ID in response data. 294 ${record_next}= Evaluate ${record} + 1 295 ${record_next}= Convert To Hex ${record_next} length=2 lowercase=yes 296 Should Be Equal ${get_dev_SDR[0]} ${record_next} 297 Should Be Equal ${get_dev_SDR[1]} 00 298 299 ELSE 300 # Next record ID in response data. 301 Should Be Equal ${get_dev_SDR[0]} ff 302 Should Be Equal ${get_dev_SDR[1]} ff 303 304 # current record ID in response data. 305 Should Be Equal ${get_dev_SDR[2]} ${recordhex} 306 Should Be Equal ${get_dev_SDR[3]} 00 307 308 END 309 # Response data count - total record ID (max - FFh - 255 in decimal). 310 ${response_data}= Set Variable ${get_dev_SDR[2:]} 311 ${length}= Get Length ${response_data} 312 Should Be True 0<${length}<=255 313 END 314 315 316Verify Get Device SDR For Invalid Data Request Via IPMI 317 [Documentation] Verify Get Device SDR via IPMI lanplus with extra bytes. 318 [Tags] Verify_Get_Device_SDR_For_Invalid_Data_Request_Via_IPMI 319 320 # Get SDR command with extra bytes. 321 ${resp}= Run Keyword and Expect Error *${IPMI_RAW_CMD['Device_SDR']['Get'][3]}* 322 ... Run IPMI Standard Command 323 ... raw ${IPMI_RAW_CMD['Device_SDR']['Get'][0]} 0x00 0x00 ${IPMI_RAW_CMD['Device_SDR']['Get'][1]} 0x00 324 # Proper error code should be returned. 325 Should Contain ${resp} ${IPMI_RAW_CMD['Device_SDR']['Get'][2]} 326 327 328*** Keywords *** 329 330Get IPMI Sensor Count 331 [Documentation] Get sensors count using "SDR elist all" command. 332 # Example of "SDR elist all" command output: 333 # BootProgress | 03h | ok | 34.2 | 334 # OperatingSystemS | 05h | ok | 35.1 | 335 # AttemptsLeft | 07h | ok | 34.1 | 336 # occ0 | 08h | ok | 210.1 | Device Disabled 337 # occ1 | 09h | ok | 210.2 | Device Disabled 338 # p0_core0_temp | 11h | ns | 3.1 | Disabled 339 # cpu0_core0 | 12h | ok | 208.1 | Presence detected 340 # p0_core1_temp | 14h | ns | 3.2 | Disabled 341 # cpu0_core1 | 15h | ok | 208.2 | Presence detected 342 # p0_core2_temp | 17h | ns | 3.3 | Disabled 343 # .. 344 # .. 345 # .. 346 # .. 347 # .. 348 # .. 349 # fan3 | 00h | ns | 29.4 | Logical FRU @35h 350 # bmc | 00h | ns | 6.1 | Logical FRU @3Ch 351 # ethernet | 00h | ns | 1.1 | Logical FRU @46h 352 353 ${output}= Run IPMI Standard Command SDR elist all 354 ${sensor_list}= Split String ${output} \n 355 ${sensor_count}= Get Length ${sensor_list} 356 [Return] ${sensor_count} 357 358 359Get Device SDR Info For Sensor Data 360 [Documentation] Get Device SDR Info via inband IPMI and return response data with Sensor count. 361 362 # Get Device SDR Info for Sensor data. 363 ${sensor_data}= Run Inband IPMI Standard Command 364 ... raw ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][0]} 365 366 [Return] ${sensor_data} 367 368 369Get Device SDR Info For SDR Data 370 [Documentation] Get Device SDR Info via inband IPMI and return response data with SDR count. 371 372 # Get Device SDR Info for SDR data. 373 ${SDR_data}= Run Inband IPMI Standard Command 374 ... raw ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][1]} 375 376 [Return] ${SDR_data} 377 378 379Get Sensor Count From SDR Info 380 [Documentation] Get Sensor Count from Get Device SDR Info data. 381 382 # Get Device SDR Info Via inband IPMI for Sensor count. 383 ${sensor_data}= Get Device SDR Info For Sensor Data 384 385 # Get Sensor count from Get Device SDR Info count - bytie 0. 386 ${sensor_data}= Split String ${sensor_data} 387 ${sensor_count}= Set Variable ${sensor_data[0]} 388 ${sensor_count}= Convert To Integer ${sensor_count} 16 389 390 [Return] ${sensor_count} 391 392 393Get SDR Count From SDR Info 394 [Documentation] Get SDR Count from Get Device SDR Info data. 395 396 # Get Device SDR Info Via inband IPMI for SDR count. 397 ${SDR_data}= Get Device SDR Info For SDR Data 398 399 # Get SDR count from Get Device SDR Info count - byte 0. 400 ${SDR_data}= Split String ${SDR_data} 401 ${SDR_count}= Set Variable ${SDR_data[0]} 402 ${SDR_count}= Convert To Integer ${SDR_count} 16 403 404 [Return] ${SDR_count} 405 406 407Get Device SDR Timestamp 408 [Documentation] Get Timestamp from Get Device SDR Info. 409 410 # Get Device SDR Info Via inband IPMI for Sendor count. 411 ${sensor_data}= Get Device SDR Info For Sensor Data 412 # Get Device SDR Info Via inband IPMI for SDR count. 413 ${SDR_data}= Get Device SDR Info For SDR Data 414 415 # Split into list. 416 ${sensor_data}= Split String ${sensor_data} 417 ${SDR_data}= Split String ${SDR_data} 418 419 # Timestamp for the Get SDR count will be from Response byte 2 to N. 420 # Compare the timestamps for Sensor data and SDR data. 421 Should Be Equal ${sensor_data[2:]} ${SDR_data[2:]} 422 423 # Convert Bytestamp to Epoch timestamp. 424 ${timestamp}= Set Variable ${SDR_data[2:]} 425 Reverse List ${timestamp} 426 ${timestamp}= Evaluate "".join(${timestamp}) 427 # Prefixes 0s for expected bytes. 428 ${timestamp}= Zfill Data ${timestamp} 8 429 ${timestamp}= Convert To Integer ${timestamp} 16 430 431 [Return] ${timestamp} 432 433 434Get Count for Sensor And SDR Elist All 435 [Documentation] Get Sensor and SDR elist all count via IPMI lanplus. 436 437 # Get Sensor list via IPMI lanplus. 438 ${sensor_count}= Run IPMI Standard Command sensor | wc -l 439 # Get SDR elist all via IPMI lanplus. 440 ${SDR_count}= Get IPMI Sensor Count 441 442 [Return] ${sensor_count} ${SDR_count} 443 444 445Get Reserve Device SDR Repository 446 [Documentation] Get Reserve Device SDR Repository via Inband IPMI. 447 448 # Reserve Device SDR Repository command via inband. 449 ${resp}= Run Inband IPMI Standard Command 450 ... raw ${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][0]} 451 452 [Return] ${resp} 453 454 455Get IPMI SDR Status Info 456 [Documentation] Returns status for given IPMI SDR Info. 457 [Arguments] ${setting} 458 # Description of argument(s): 459 # setting SDR Info which needs to be read(e.g. "SDR Version"). 460 # SDR Version : 0x51 461 # Record Count : 58 462 # Free Space : 9312 bytes 463 # Most recent Addition : 03/10/2022 05:56:02 464 # Most recent Erase : 02/07/2106 06:28:15 465 # SDR overflow : yes 466 # SDR Repository Update Support : unspecified 467 # Delete SDR supported : no 468 # Partial Add SDR supported : no 469 # Reserve SDR repository supported : yes 470 # SDR Repository Alloc info supported : yes 471 472 # Get SDR Info IPMI command. 473 ${resp}= Run IPMI Standard Command SDR info 474 475 # Return lines for given IPMI SDR Info. 476 ${setting_line}= Get Lines Containing String ${resp} ${setting} 477 ... case-insensitive 478 ${setting_status}= Fetch From Right ${setting_line} :${SPACE} 479 480 [Return] ${setting_status} 481 482 483Get Record Count And Last Record From SDR 484 [Documentation] Returns total record count from IPMI SDR Info and last SDR record. 485 486 # Returns Record count from IPMI SDR Info. 487 ${record_count}= Get IPMI SDR Status Info Record Count 488 489 # Identifies Last record ID. 490 # If Record Count = 58 (3Ah), record IDs range from 0 to 57. 491 # Then Last record ID will be 57 (in decimal) - 39h. 492 ${last_record}= Evaluate ${record_count} - 1 493 494 [Return] ${record_count} ${last_record} 495