Rahul Maheshwari | 77ab160 | 2018-02-28 07:21:55 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test IPMI sensor IDs. |
| 3 | |
| 4 | Resource ../../lib/rest_client.robot |
| 5 | Resource ../../lib/ipmi_client.robot |
| 6 | Resource ../../lib/openbmc_ffdc.robot |
| 7 | Resource ../../lib/boot_utils.robot |
| 8 | |
| 9 | Suite setup Suite Setup Execution |
| 10 | Test Teardown Test Teardown Execution |
| 11 | |
| 12 | Force Tags SDR_Test |
| 13 | |
| 14 | |
| 15 | *** Test Cases *** |
| 16 | |
| 17 | |
| 18 | Test CPU Core SDR Info At Power On |
| 19 | [Documentation] Verify CPU core SDR info via IPMI and REST at power on. |
| 20 | |
| 21 | [Tags] Test_CPU_Core_SDR_Info_At_Power_On |
| 22 | |
| 23 | REST Power On stack_mode=skip quiet=1 |
| 24 | Test SDR Info core |
| 25 | |
| 26 | |
| 27 | Test DIMM SDR Info At Power On |
| 28 | [Documentation] Verify DIMM SDR info via IPMI and REST at power on. |
| 29 | |
| 30 | [Tags] Test_DIMM_SDR_Info_At_Power_On |
| 31 | |
| 32 | REST Power On stack_mode=skip quiet=1 |
| 33 | Test SDR Info dimm |
| 34 | |
| 35 | Test CPU Core SDR Info At Power Off |
| 36 | [Documentation] Verify CPU core SDR info via IPMI and REST at power off. |
| 37 | |
| 38 | [Tags] Test_CPU_Core_SDR_Info_At_Power_Off |
| 39 | |
| 40 | REST Power Off stack_mode=skip quiet=1 |
| 41 | Test SDR Info core |
| 42 | |
| 43 | |
| 44 | Test DIMM SDR Info At Power Off |
| 45 | [Documentation] Verify DIMM SDR info via IPMI and REST at power off. |
| 46 | |
| 47 | [Tags] Test_DIMM_SDR_Info_At_Power_Off |
| 48 | |
| 49 | REST Power Off stack_mode=skip quiet=1 |
| 50 | Test SDR Info dimm |
| 51 | |
| 52 | |
| 53 | *** Keywords *** |
| 54 | |
| 55 | Get Component URIs |
| 56 | [Documentation] Get URIs for given component from given URIs |
| 57 | ... and return as a list. |
| 58 | [Arguments] ${component_name} ${uri_list}=${SYSTEM_URI} |
| 59 | |
| 60 | # A sample result returned for the "core" component: |
| 61 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core0 |
| 62 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core1 |
| 63 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core10 |
| 64 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core11 |
| 65 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core12 |
| 66 | # (etc.) |
| 67 | |
| 68 | # Description of argument(s): |
| 69 | # component_name Component name (e.g. "core", "dimm", etc.). |
| 70 | # uri_list URI list. |
| 71 | |
| 72 | ${component_uris}= Get Matches ${uri_list} |
| 73 | ... regexp=^.*[0-9a-z_].${component_name}[0-9]*$ |
| 74 | [Return] ${component_uris} |
| 75 | |
| 76 | |
| 77 | Get SDR Presence Via IPMI |
| 78 | [Documentation] Return presence info from IPMI sensor data record. |
| 79 | [Arguments] ${component_name} |
| 80 | |
| 81 | # Description of argument(s): |
| 82 | # component_name Component name (e.g. "cpu0_core0", "dimm0", etc.). |
| 83 | |
| 84 | # Example of IPMI SDR elist output. |
| 85 | # BootProgress | 03h | ok | 34.2 | |
| 86 | # OperatingSystemS | 05h | ok | 35.1 | boot completed - device not specified |
| 87 | # AttemptsLeft | 07h | ok | 34.1 | |
| 88 | # occ0 | 08h | ok | 210.1 | Device Disabled |
| 89 | # occ1 | 09h | ok | 210.2 | Device Disabled |
| 90 | # cpu0_core0 | 12h | ok | 208.1 | Presence detected |
| 91 | # cpu0_core1 | 15h | ok | 208.2 | Disabled |
| 92 | # cpu0_core2 | 18h | ok | 208.3 | Presence detected |
| 93 | # dimm0 | A6h | ok | 32.1 | Presence Detected |
| 94 | # dimm1 | A8h | ok | 32.2 | Presence Detected |
| 95 | # dimm2 | AAh | ok | 32.9 | Presence Detected |
| 96 | # gv100card0 | C5h | ok | 216.1 | 0 unspecified |
| 97 | # gv100card1 | C8h | ok | 216.2 | 0 unspecified |
| 98 | # TPMEnable | D7h | ok | 3.3 | State Asserted |
| 99 | # auto_reboot | DAh | ok | 33.2 | State Asserted |
| 100 | # volatile | DBh | ok | 33.1 | State Deasserted |
| 101 | |
| 102 | ${sdr_elist_output}= Run IPMI Standard Command sdr elist |
| 103 | ${sdr_component_line}= |
| 104 | ... Get Lines Containing String ${sdr_elist_output} ${component_name} |
| 105 | ... case-insensitive |
| 106 | |
| 107 | ${presence_ipmi}= Fetch From Right ${sdr_component_line} | |
| 108 | ${presence_ipmi}= Strip String ${presence_ipmi} |
| 109 | [Return] ${presence_ipmi} |
| 110 | |
| 111 | |
| 112 | Verify SDR |
| 113 | [Documentation] Verify IPMI sensor data record for given component |
| 114 | ... with REST. |
| 115 | [Arguments] ${component_name} |
| 116 | |
| 117 | # Description of argument(s): |
| 118 | # component_name Component name (e.g. "cpu0/core0", "dimm0", etc.). |
| 119 | |
| 120 | ${presence_rest}= Read Attribute |
| 121 | ... ${HOST_INVENTORY_URI}system/chassis/motherboard/${component_name} |
| 122 | ... Present |
| 123 | ${functional_rest}= Read Attribute |
| 124 | ... ${HOST_INVENTORY_URI}system/chassis/motherboard/${component_name} |
| 125 | ... Functional |
| 126 | |
| 127 | # Replace "/" with "_" if there is any "/" in component name. |
| 128 | # e.g. cpu0/core0 to cpu0_core0 |
| 129 | ${component_name}= Replace String ${component_name} / _ |
| 130 | ${presence_ipmi}= Get SDR Presence Via IPMI ${component_name}${SPACE} |
| 131 | |
| 132 | Run Keyword If '${presence_ipmi}' == 'Disabled' |
| 133 | ... Should Be True ${presence_rest} == 0 and ${functional_rest} == 0 |
| 134 | ... ELSE IF '${presence_ipmi}' == 'Presence Detected' or '${presence_ipmi}' == 'Presence detected' |
| 135 | ... Should Be True ${presence_rest} == 1 and ${functional_rest} == 1 |
| 136 | ... ELSE IF '${presence_ipmi}' == 'State Asserted' |
| 137 | ... Should Be True ${presence_rest} == 1 and ${functional_rest} == 1 |
| 138 | ... ELSE IF '${presence_ipmi}' == 'State Deasserted' |
| 139 | ... Should Be True ${presence_rest} == 1 and ${functional_rest} == 0 |
| 140 | ... ELSE Fail msg=Invalid Presence${presence_ipmi} |
| 141 | |
| 142 | |
| 143 | Test SDR Info |
| 144 | [Documentation] Test SDR info for given component. |
| 145 | [Arguments] ${component_name} |
| 146 | |
| 147 | # Description of argument(s): |
| 148 | # component_name Component name (e.g. "core", "dimm", etc.). |
| 149 | |
| 150 | ${component_uri_list}= Get Component URIs ${component_name} |
| 151 | : FOR ${uri} IN @{component_uri_list} |
| 152 | \ ${component_name}= Fetch From Right ${uri} motherboard/ |
| 153 | \ Log To Console ${component_name} |
| 154 | \ Verify SDR ${component_name} |
| 155 | |
| 156 | |
| 157 | Suite Setup Execution |
| 158 | [Documentation] Do the initial suite setup. |
| 159 | |
| 160 | REST Power On stack_mode=skip quiet=1 |
| 161 | |
| 162 | ${uri_list}= Read Properties ${OPENBMC_BASE_URI}list |
| 163 | Set Suite Variable ${SYSTEM_URI} ${uri_list} |
| 164 | Log ${uri_list} |
| 165 | |
| 166 | |
| 167 | Test Teardown Execution |
| 168 | [Documentation] Do the post test teardown. |
| 169 | |
| 170 | FFDC On Test Case Fail |