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