1*** Settings *** 2Documentation Test IPMI sensor IDs. 3 4Resource ../lib/ipmi_client.robot 5Resource ../lib/rest_client.robot 6Resource ../lib/openbmc_ffdc.robot 7Resource ../lib/boot_utils.robot 8Resource ../lib/bmc_redfish_resource.robot 9Library ../lib/ipmi_utils.py 10Library ../lib/utilities.py 11Variables ../data/ipmi_raw_cmd_table.py 12 13Suite setup Suite Setup Execution 14Suite Teardown Redfish.Logout 15Test Teardown Test Teardown Execution 16 17Test Tags IPMI_SDR 18 19*** Test Cases *** 20 21Verify SDR Info 22 [Documentation] Verify sdr info command output. 23 [Tags] Verify_SDR_Info 24 # Example of SDR info command output: 25 # SDR Version : 0x51 26 # Record Count : 216 27 # Free Space : unspecified 28 # Most recent Addition : 29 # Most recent Erase : 30 # SDR overflow : no 31 # SDR Repository Update Support : unspecified 32 # Delete SDR supported : no 33 # Partial Add SDR supported : no 34 # Reserve SDR repository supported : no 35 # SDR Repository Alloc info supported : no 36 37 # Check if delete, partially add, reserve SDR and get SDR alloc info command are supported or not. 38 ${support_delete_sdr}= Fetch IPMI Command Support Status 39 ... ${IPMI_RAW_CMD['SDR']['Delete SDR'][0]} 40 ${support_partial_add}= Fetch IPMI Command Support Status 41 ... ${IPMI_RAW_CMD['SDR']['Partially Add SDR'][0]} 42 ${support_reserve_sdr_repository}= Fetch IPMI Command Support Status 43 ... ${IPMI_RAW_CMD['SDR']['Reserve SDR Repository'][0]} 44 ${support_sdr_repository_alloc_info}= Fetch IPMI Command Support Status 45 ... ${IPMI_RAW_CMD['SDR']['Get SDR allocation Info'][0]} 46 47 ${sdr_info}= Get SDR Info 48 Should Be Equal ${sdr_info['sdr_version']} 0x51 49 50 # Get SDR OEM record count from "sdr elist -vvv" command output. 51 ${sdr_data}= Run IPMI Standard Command sdr elist -vvv 52 ${sdr_oem}= Fetch OEM Sdr Count ${sdr_data} 53 ${sdr_info_record_count}= Evaluate ${sdr_info['record_count']} - ${sdr_oem} 54 55 # Get sensor count from "sdr elist all" command output. 56 ${sensor_count}= Get Sensor Count 57 Should Be Equal As Strings 58 ... ${sdr_info_record_count} ${sensor_count} 59 60 Should Be Equal ${sdr_info['free_space']} unspecified 61 Should Not Be Equal ${sdr_info['most_recent_addition']} ${EMPTY} 62 Should Not Be Equal ${sdr_info['most_recent_erase']} ${EMPTY} 63 Should Be Equal ${sdr_info['sdr_overflow']} yes 64 Should Be Equal ${sdr_info['sdr_repository_update_support']} unspecified 65 Should Be Equal ${sdr_info['delete_sdr_supported']} ${support_delete_sdr} 66 Should Be Equal ${sdr_info['partial_add_sdr_supported']} ${support_partial_add} 67 Should Be Equal ${sdr_info['reserve_sdr_repository_supported']} ${support_reserve_sdr_repository} 68 Should Be Equal ${sdr_info['sdr_repository_alloc_info_supported']} ${support_sdr_repository_alloc_info} 69 70 71Test CPU Core SDR Info At Power On 72 [Documentation] Verify CPU core SDR info via IPMI and Redfish at power on. 73 74 [Tags] Test_CPU_Core_SDR_Info_At_Power_On 75 76 Redfish Power On stack_mode=skip quiet=1 77 Test SDR Info core 78 79 80Test DIMM SDR Info At Power On 81 [Documentation] Verify DIMM SDR info via IPMI and Redfish at power on. 82 83 [Tags] Test_DIMM_SDR_Info_At_Power_On 84 85 Redfish Power On stack_mode=skip quiet=1 86 Test SDR Info dimm 87 88 89Test GPU SDR Info At Power On 90 [Documentation] Verify GPU SDR info via IPMI and Redfish at power on. 91 92 [Tags] Test_GPU_SDR_Info_At_Power_On 93 94 Redfish Power On stack_mode=skip quiet=1 95 Test SDR Info gv100card 96 97 98Test CPU Core SDR Info At Power Off 99 [Documentation] Verify CPU core SDR info via IPMI and Redfish at power off. 100 101 [Tags] Test_CPU_Core_SDR_Info_At_Power_Off 102 103 Redfish Hard Power Off stack_mode=skip quiet=1 104 Test SDR Info core 105 106 107Test DIMM SDR Info At Power Off 108 [Documentation] Verify DIMM SDR info via IPMI and Redfish at power off. 109 110 [Tags] Test_DIMM_SDR_Info_At_Power_Off 111 112 Redfish Hard Power Off stack_mode=skip quiet=1 113 Test SDR Info dimm 114 115 116Test Auto Reboot SDR Info 117 [Documentation] Verify auto reboot SDR info via IPMI and Redfish. 118 [Tags] Test_Auto_Reboot_SDR_Info 119 120 121 ${component_uri_list}= Get Component URIs auto_reboot 122 ${component_uri}= Get From List ${component_uri_list} 0 123 ${state_rest}= Read Attribute ${component_uri} AutoReboot 124 125 ${state_ipmi}= Get SDR Presence Via IPMI auto_reboot${SPACE} 126 127 IF '${state_ipmi}' == 'Disabled' 128 Should Be True ${state_rest} == ${0} 129 ELSE IF '${state_ipmi}' == 'State Asserted' 130 Should Be True ${state_rest} == ${1} 131 END 132 133 134Test TPM Enable SDR Info 135 [Documentation] Verify auto reboot SDR info via IPMI and Redfish. 136 [Tags] Test_TPM_Enable_SDR_Info 137 138 139 ${component_uri_list}= Get Component URIs TPMEnable 140 ${component_uri}= Get From List ${component_uri_list} 0 141 ${state_rest}= Read Attribute ${component_uri} TPMEnable 142 143 ${state_ipmi}= Get SDR Presence Via IPMI auto_reboot${SPACE} 144 145 IF '${state_ipmi}' == 'Disabled' 146 Should Be True ${state_rest} == ${0} 147 ELSE IF '${state_ipmi}' == 'State Asserted' 148 Should Be True ${state_rest} == ${1} 149 END 150 151 152Test Reserve SDR Repository 153 [Documentation] Verify Reserve SDR Repository IPMI command. 154 [Tags] Test_Reserve_SDR_Repository 155 156 ${reservation_id}= Get Reservation ID convert_lsb_to_msb=True 157 158 # Getting another Reservation ID and verify it is different from previous Reservation ID. 159 ${new_reservation_id}= Get Reservation ID convert_lsb_to_msb=True 160 161 Should Not Be Equal ${reservation_id} ${new_reservation_id} 162 ... msg=Getting same reservation ID for second time, reservation ID must be different. 163 164 165Test Get SDR Using Reservation ID 166 [Documentation] Verify get SDR command using reservation ID obtained from Reserve SDR repository. 167 [Tags] Test_Get_SDR_Using_Reservation_ID 168 169 ${reservation_id}= Get Reservation ID add_prefix=True 170 171 # Get SDR full without using Reservation ID. 172 Run IPMI Command ${IPMI_RAW_CMD['SDR']['Get'][0]} 173 174 # Get SDR Partially using Reservation ID. 175 ${get_sdr_raw_cmd}= Catenate 176 ... ${IPMI_RAW_CMD['Get SDR']['Get'][1]} ${reservation_id} 0x${record_id} 0x00 177 ... ${IPMI_RAW_CMD['Get SDR']['Get'][2]} 178 Run IPMI Command ${get_sdr_raw_cmd} 179 180 # Get SDR partially without using reservation ID and expect error. 181 Verify Invalid IPMI Command ${IPMI_RAW_CMD['SDR']['Get'][3]} 0xc5 182 183 184Test Get SDR Using Invalid Reservation ID 185 [Documentation] Verify get SDR command using invalid reservation ID. 186 [Tags] Test_Get_SDR_Using_Invalid_Reservation_ID 187 188 # Generate two reservation ID and verify get SDR partial using old reservation ID. 189 ${first_reservation_id}= Get Reservation ID add_prefix=True 190 ${second_reservation_id}= Get Reservation ID add_prefix=True 191 192 # Creating the raw cmd with First reservation ID. 193 ${get_sdr_raw_cmd}= Catenate 194 ... ${IPMI_RAW_CMD['Get SDR']['Get'][1]} ${first_reservation_id} 0x${record_id} 0x00 195 ... ${IPMI_RAW_CMD['Get SDR']['Get'][2]} 196 197 198Test Reserve SDR Repository After BMC Reboot 199 [Documentation] Verify reserve SDR repository reservation ID after BMC Reboot. 200 [Tags] Test_Reserve_SDR_Repository_After_BMC_Reboot 201 202 # Get Reservation ID before reboot. 203 ${reservation_id_before_reboot}= Get Reservation ID add_prefix=True 204 205 # Cold reset BMC 206 IPMI MC Reset Cold (run) 207 208 # Waiting to for sdr to populate. 209 Sleep 10s 210 211 # Create Get SDR Partially command using reservation ID which got before reboot. 212 ${get_sdr_raw_cmd}= Catenate 213 ... ${IPMI_RAW_CMD['Get SDR']['Get'][1]} ${reservation_id_before_reboot} 0x${record_id} 0x00 214 ... ${IPMI_RAW_CMD['Get SDR']['Get'][2]} 215 216 Verify Invalid IPMI Command ${get_sdr_raw_cmd} 0xc5 217 218 # Verify get SDR partially with new reservation ID after reboot. 219 ${reservation_id_after_reboot}= Get Reservation ID add_prefix=True 220 ${get_sdr_raw_cmd}= Catenate 221 ... ${IPMI_RAW_CMD['Get SDR']['Get'][1]} ${reservation_id_after_reboot} 0x${record_id} 0x00 222 ... ${IPMI_RAW_CMD['Get SDR']['Get'][2]} 223 Run IPMI Command ${get_sdr_raw_cmd} 224 225 226*** Keywords *** 227 228Get Reservation ID 229 [Documentation] Get reservation ID using reserve SDR repository. 230 [Arguments] ${add_prefix}=False ${convert_lsb_to_msb}=False 231 232 # Description of argument(s): 233 # add_prefix If True will prefix "0x" to the reservation ID. 234 # e.g. IPMI response for Reservation ID command will be like 01 00 235 # return reservation ID will be "0x01" for above response. 236 237 # convert_lsb_to_msb If True will convert the reservation ID from LSB first to MSB first. 238 # e.g. IPMI response for reservation ID command will be like 01 0a 239 # return reservation ID will be "a1" for above response. 240 241 ${reservation_id}= Run IPMI Command 242 ... ${IPMI_RAW_CMD['SDR']['Reserve SDR Repository'][0]} 243 244 ${reservation_id}= Run Keyword If ${add_prefix} 245 ... Add Prefix To String ${reservation_id} 0x 246 ... ELSE IF ${convert_lsb_to_msb} 247 ... Convert LSB To MSB ${reservation_id} 248 ... ELSE 249 ... Return From Keyword ${reservation_id} 250 251 RETURN ${reservation_id} 252 253 254Get Sensor Count 255 [Documentation] Get sensors count using "sdr elist all" command. 256 # Example of "sdr elist all" command output: 257 # BootProgress | 03h | ok | 34.2 | 258 # OperatingSystemS | 05h | ok | 35.1 | 259 # AttemptsLeft | 07h | ok | 34.1 | 260 # occ0 | 08h | ok | 210.1 | Device Disabled 261 # occ1 | 09h | ok | 210.2 | Device Disabled 262 # p0_core0_temp | 11h | ns | 3.1 | Disabled 263 # cpu0_core0 | 12h | ok | 208.1 | Presence detected 264 # p0_core1_temp | 14h | ns | 3.2 | Disabled 265 # cpu0_core1 | 15h | ok | 208.2 | Presence detected 266 # p0_core2_temp | 17h | ns | 3.3 | Disabled 267 # .. 268 # .. 269 # .. 270 # .. 271 # .. 272 # .. 273 # fan3 | 00h | ns | 29.4 | Logical FRU @35h 274 # bmc | 00h | ns | 6.1 | Logical FRU @3Ch 275 # ethernet | 00h | ns | 1.1 | Logical FRU @46h 276 277 ${output}= Run IPMI Standard Command sdr elist all 278 ${sensor_list}= Split String ${output} \n 279 ${sensor_count}= Get Length ${sensor_list} 280 RETURN ${sensor_count} 281 282 283Get Component URIs 284 [Documentation] Get URIs for given component from given URIs 285 ... and return as a list. 286 [Arguments] ${component_name} ${uri_list}=${SYSTEM_URI} 287 288 # A sample result returned for the "core" component: 289 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core0 290 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core1 291 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core10 292 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core11 293 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core12 294 # (etc.) 295 296 # Description of argument(s): 297 # component_name Component name (e.g. "core", "dimm", etc.). 298 # uri_list URI list. 299 300 ${component_uris}= Get Matches ${uri_list} 301 ... regexp=^.*[0-9a-z_].${component_name}\[_0-9a-z]*$ 302 ... case_insensitive=${True} 303 RETURN ${component_uris} 304 305 306Get SDR Presence Via IPMI 307 [Documentation] Return presence info from IPMI sensor data record. 308 [Arguments] ${component_name} 309 310 # Description of argument(s): 311 # component_name Component name (e.g. "cpu0_core0", "dimm0", etc.). 312 313 # Example of IPMI SDR elist output. 314 # BootProgress | 03h | ok | 34.2 | 315 # OperatingSystemS | 05h | ok | 35.1 | boot completed - device not specified 316 # AttemptsLeft | 07h | ok | 34.1 | 317 # occ0 | 08h | ok | 210.1 | Device Disabled 318 # occ1 | 09h | ok | 210.2 | Device Disabled 319 # cpu0_core0 | 12h | ok | 208.1 | Presence detected 320 # cpu0_core1 | 15h | ok | 208.2 | Disabled 321 # cpu0_core2 | 18h | ok | 208.3 | Presence detected 322 # dimm0 | A6h | ok | 32.1 | Presence Detected 323 # dimm1 | A8h | ok | 32.2 | Presence Detected 324 # dimm2 | AAh | ok | 32.9 | Presence Detected 325 # gv100card0 | C5h | ok | 216.1 | 0 unspecified 326 # gv100card1 | C8h | ok | 216.2 | 0 unspecified 327 # TPMEnable | D7h | ok | 3.3 | State Asserted 328 # auto_reboot | DAh | ok | 33.2 | State Asserted 329 # volatile | DBh | ok | 33.1 | State Deasserted 330 331 ${sdr_elist_output}= Run IPMI Standard Command sdr elist 332 ${sdr_component_line}= 333 ... Get Lines Containing String ${sdr_elist_output} ${component_name} 334 ... case-insensitive 335 336 ${presence_ipmi}= Fetch From Right ${sdr_component_line} | 337 ${presence_ipmi}= Strip String ${presence_ipmi} 338 RETURN ${presence_ipmi} 339 340 341Verify SDR 342 [Documentation] Verify IPMI sensor data record for given component 343 ... with Redfish. 344 [Arguments] ${component_name} 345 346 # Description of argument(s): 347 # component_name Component name (e.g. "cpu0/core0", "dimm0", etc.). 348 349 ${presence_rest}= Read Attribute 350 ... ${HOST_INVENTORY_URI}system/chassis/motherboard/${component_name} 351 ... Present 352 ${functional_rest}= Read Attribute 353 ... ${HOST_INVENTORY_URI}system/chassis/motherboard/${component_name} 354 ... Functional 355 356 # Replace "/" with "_" if there is any "/" in component name. 357 # e.g. cpu0/core0 to cpu0_core0 358 ${component_name}= Replace String ${component_name} / _ 359 ${presence_ipmi}= Get SDR Presence Via IPMI ${component_name}${SPACE} 360 361 IF '${presence_ipmi}' == 'Disabled' or '${presence_ipmi}' == '' 362 Should Be True ${presence_rest} == ${0} and ${functional_rest} == ${0} 363 ELSE IF '${presence_ipmi}' == 'Presence Detected' or '${presence_ipmi}' == 'Presence detected' 364 Should Be True ${presence_rest} == ${1} and ${functional_rest} == ${1} 365 ELSE IF '${presence_ipmi}' == 'State Asserted' 366 Should Be True ${presence_rest} == ${1} and ${functional_rest} == ${1} 367 ELSE IF '${presence_ipmi}' == 'State Deasserted' 368 Should Be True ${presence_rest} == ${1} and ${functional_rest} == ${0} 369 ELSE 370 Fail msg=Invalid Presence${presence_ipmi} 371 END 372 373 374Test SDR Info 375 [Documentation] Test SDR info for given component. 376 [Arguments] ${component_name} 377 378 # Description of argument(s): 379 # component_name Component name (e.g. "core", "dimm", etc.). 380 381 ${component_uri_list}= Get Component URIs ${component_name} 382 383 FOR ${uri} IN @{component_uri_list} 384 ${component_name}= Fetch From Right ${uri} motherboard/ 385 Log To Console ${component_name} 386 Verify SDR ${component_name} 387 END 388 389Fetch IPMI Command Support Status 390 [Documentation] Return yes if IPMI command is supported. 391 [Arguments] ${ipmi_cmd} 392 393 # Description of argument(s): 394 # ipmi_cmd IPMI command. 395 396 ${resp}= Run IPMI Command ${ipmi_cmd} fail_on_err=0 397 ${resp_code_match}= Get Regexp Matches ${resp} rsp=0xc1 398 399 ${cmd_support}= Set Variable If ${resp_code_match} != [] no yes 400 401 RETURN ${cmd_support} 402 403 404Get SDR Record ID 405 [Documentation] Fetch one record ID from SDR elist IPMI cmd response. 406 407 ${resp}= Run IPMI Standard Command sdr elist 408 ${record_id}= Get Regexp Matches ${resp} \\|\\s+([0-9]+)h\\s+\\| 1 409 410 RETURN ${record_id[0]} 411 412 413Suite Setup Execution 414 [Documentation] Do the initial suite setup. 415 416 Redfish.Login 417 Redfish Power On stack_mode=skip quiet=1 418 419 ${record_id}= Get SDR Record ID 420 Set Suite Variable ${record_id} 421 422 # If REST is supported, then the uri_list will be returned. 423 ${resp}= OpenBMC Get Request ${OPENBMC_BASE_URI} 424 IF '${resp.status_code}' == '${HTTP_OK}' 425 ${uri_list}= Read Properties ${OPENBMC_BASE_URI}list 426 Set Suite Variable ${SYSTEM_URI} ${uri_list} 427 Log ${uri_list} 428 END 429 430 431Test Teardown Execution 432 [Documentation] Do the post test teardown. 433 434 FFDC On Test Case Fail 435