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