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