Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 1 | *** Settings *** |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 2 | Documentation Inventory of hardware FRUs under redfish/systems. |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 3 | |
| 4 | Resource ../../lib/bmc_redfish_resource.robot |
| 5 | Resource ../../lib/bmc_redfish_utils.robot |
| 6 | Resource ../../lib/openbmc_ffdc.robot |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 7 | Library ../../lib/gen_robot_valid.py |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 8 | |
| 9 | Suite Setup Suite Setup Execution |
| 10 | Suite Teardown Suite Teardown Execution |
Steven Sombar | ecf10e3 | 2019-07-25 08:51:00 -0500 | [diff] [blame] | 11 | Test Setup Printn |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 12 | Test Teardown Test Teardown Execution |
| 13 | |
| 14 | *** Variables *** |
| 15 | |
| 16 | # The passing criteria. Must have at least this many. |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 17 | ${min_num_dimms} 2 |
| 18 | ${min_num_cpus} 1 |
Steven Sombar | 815fa63 | 2019-07-16 14:24:40 -0500 | [diff] [blame] | 19 | ${min_num_cores} 18 |
| 20 | ${min_num_powersupplies} 1 |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 21 | |
| 22 | |
| 23 | *** Test Cases *** |
| 24 | |
Steven Sombar | ecf10e3 | 2019-07-25 08:51:00 -0500 | [diff] [blame] | 25 | |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 26 | Get Processor Inventory Via Redfish And Verify |
| 27 | [Documentation] Get the number of CPUs that are functional and enabled. |
| 28 | [Tags] Get_Processor_Inventory_Via_Redfish_And_Verify |
| 29 | |
Michael Walsh | 09083a8 | 2019-08-01 12:46:16 -0500 | [diff] [blame^] | 30 | Rprint Vars num_valid_cpus min_num_cpus |
| 31 | Valid Range num_valid_cpus ${min_num_cpus} |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 32 | |
| 33 | |
Steven Sombar | 815fa63 | 2019-07-16 14:24:40 -0500 | [diff] [blame] | 34 | Get Available CPU Cores And Verify |
| 35 | [Documentation] Get the total number of cores in the system and |
| 36 | ... verify that it is at or above the minimum. |
| 37 | [Tags] Get_Available_CPU_Cores_And_Verify |
| 38 | |
| 39 | ${total_num_cores}= Set Variable ${0} |
| 40 | |
Steven Sombar | ecf10e3 | 2019-07-25 08:51:00 -0500 | [diff] [blame] | 41 | :FOR ${processor} IN @{cpu_uris} |
| 42 | ${is_functional}= Check If FRU Is Functional ${processor} |
| 43 | Run Keyword If not ${is_functional} Continue For Loop |
| 44 | ${processor_cores}= Get CPU TotalCores ${processor} |
Steven Sombar | 815fa63 | 2019-07-16 14:24:40 -0500 | [diff] [blame] | 45 | ${total_num_cores}= Evaluate $total_num_cores + $processor_cores |
| 46 | END |
| 47 | |
| 48 | Rprint Vars total_num_cores |
Steven Sombar | ecf10e3 | 2019-07-25 08:51:00 -0500 | [diff] [blame] | 49 | |
Steven Sombar | 815fa63 | 2019-07-16 14:24:40 -0500 | [diff] [blame] | 50 | Run Keyword If ${total_num_cores} < ${min_num_cores} |
| 51 | ... Fail Too few CPU cores found. |
| 52 | |
| 53 | |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 54 | Get Memory Inventory Via Redfish And Verify |
| 55 | [Documentation] Get the number of DIMMs that are functional and enabled. |
| 56 | [Tags] Get_Memory_Inventory_Via_Redfish_And_Verify |
| 57 | |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 58 | Verify FRU Inventory Minimums Memory ${min_num_dimms} |
| 59 | |
| 60 | |
Steven Sombar | 815fa63 | 2019-07-16 14:24:40 -0500 | [diff] [blame] | 61 | Get System Serial And Verify Populated |
| 62 | [Documentation] Check that the System SerialNumber is non-blank. |
| 63 | [Tags] Get_System_Serial_And_Verify_Populated |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 64 | |
| 65 | ${serial_number}= Redfish.Get Attribute ${SYSTEM_BASE_URI} SerialNumber |
| 66 | Rvalid Value serial_number |
| 67 | Rprint Vars serial_number |
| 68 | |
| 69 | |
| 70 | Get Model And Verify Populated |
| 71 | [Documentation] Check that the Model is non-blank. |
| 72 | [Tags] Get_Model_And_Verify_Populated |
| 73 | |
| 74 | ${model}= Redfish.Get Attribute ${SYSTEM_BASE_URI} Model |
| 75 | Rvalid Value model |
| 76 | Rprint Vars model |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 77 | |
| 78 | |
Steven Sombar | 815fa63 | 2019-07-16 14:24:40 -0500 | [diff] [blame] | 79 | Get Available Power Supplies And Verify |
| 80 | [Documentation] Get the number of functional power supplies and |
| 81 | ... verify that it is at or above the minimum. |
| 82 | [Tags] Get_Available_Power_Supplies_And_Verify |
| 83 | |
| 84 | ${total_num_supplies}= Set Variable ${0} |
| 85 | |
Steven Sombar | ecf10e3 | 2019-07-25 08:51:00 -0500 | [diff] [blame] | 86 | :FOR ${chassis_uri} IN @{powersupply_uris} |
| 87 | ${is_functional}= Check If FRU Is Functional ${chassis_uri} |
Steven Sombar | 815fa63 | 2019-07-16 14:24:40 -0500 | [diff] [blame] | 88 | ${total_num_supplies}= Evaluate $total_num_supplies + $is_functional |
| 89 | END |
| 90 | |
| 91 | Rprint Vars total_num_supplies |
| 92 | |
| 93 | Run Keyword If ${total_num_supplies} < ${min_num_powersupplies} |
| 94 | ... Fail Too few power supplies found. |
| 95 | |
| 96 | |
| 97 | Get Motherboard Serial And Verify Populated |
| 98 | [Documentation] Check that the Motherboard SerialNumber is non-blank. |
| 99 | [Tags] Get_Motherboard_Serial_And_Verify_Populated |
| 100 | |
| 101 | ${serial_number}= Redfish.Get Attribute |
| 102 | ... ${REDFISH_CHASSIS_URI}motherboard SerialNumber |
| 103 | Rvalid Value serial_number |
| 104 | Rprint Vars serial_number |
| 105 | |
| 106 | |
Steven Sombar | ecf10e3 | 2019-07-25 08:51:00 -0500 | [diff] [blame] | 107 | Get GPU Inventory Via Redfish |
| 108 | [Documentation] Get the number of GPUs. |
| 109 | [Tags] Get_GPU_Inventory_Via_Redfish |
| 110 | |
| 111 | # There may be 0-6 GPUs in a system. |
| 112 | # GPUs may have one of three states: |
| 113 | # "Absent", "Enabled", or "UnavailableOffline". |
| 114 | # Or GPUs may not be listed at all under the URI |
| 115 | # /redfish/v1/Systems/system/Processors. |
| 116 | # So for now, only print the total of GPUs present. |
| 117 | |
| 118 | Rprint Vars num_valid_gpus |
| 119 | |
| 120 | |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 121 | *** Keywords *** |
| 122 | |
| 123 | |
Steven Sombar | ecf10e3 | 2019-07-25 08:51:00 -0500 | [diff] [blame] | 124 | Get Inventory URIs |
| 125 | [Documentation] Get and return a tuple of lists of URIs for CPU, |
| 126 | ... GPU and PowerSupplies. |
| 127 | |
| 128 | ${processor_uris}= |
| 129 | ... Redfish_Utils.Get Member List ${SYSTEM_BASE_URI}Processors |
| 130 | # Example of processor_uris: |
| 131 | # /redfish/v1/Systems/system/Processors/cpu0 |
| 132 | # /redfish/v1/Systems/system/Processors/cpu1 |
| 133 | # /redfish/v1/Systems/system/Processors/gv100card0 |
| 134 | # /redfish/v1/Systems/system/Processors/gv100card1 |
| 135 | # /redfish/v1/Systems/system/Processors/gv100card2 |
| 136 | # /redfish/v1/Systems/system/Processors/gv100card3 |
| 137 | # /redfish/v1/Systems/system/Processors/gv100card4 |
| 138 | |
| 139 | ${cpu_uris}= Get Matches ${processor_uris} *cpu* |
| 140 | ${gpu_uris}= Get Matches ${processor_uris} *gv* |
| 141 | |
| 142 | ${chassis_uris}= Redfish_Utils.Get Member List ${REDFISH_CHASSIS_URI} |
| 143 | # Example of chassis_uris: |
| 144 | # /redfish/v1/Chassis/chasis |
| 145 | # /redfish/v1/Chassis/motherboard |
| 146 | # /redfish/v1/Chassis/powersupply0 |
| 147 | # /redfish/v1/Chassis/powersupply1 |
| 148 | |
| 149 | ${powersupply_uris}= Get Matches ${chassis_uris} *powersupp* |
| 150 | |
| 151 | [Return] ${cpu_uris} ${gpu_uris} ${powersupply_uris} |
| 152 | |
| 153 | |
| 154 | Get CPU TotalCores |
| 155 | [Documentation] Return the TotalCores of a CPU. |
| 156 | ... Return 0 if this attribute is missing or NONE. |
| 157 | [Arguments] ${processor} |
| 158 | |
| 159 | # Description of Argument(s): |
| 160 | # processor The Redfish URI of a CPU (e.g. |
| 161 | # "/redfish/v1/Systems/system/Processors/cpu0"). |
| 162 | |
| 163 | ${total_cores}= Redfish.Get Attribute ${processor} TotalCores |
| 164 | Return From Keyword If ${total_cores} is ${NONE} ${0} |
| 165 | [Return] ${total_cores} |
| 166 | |
| 167 | |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 168 | Verify FRU Inventory Minimums |
George Keishing | 3292d4a | 2019-06-19 02:04:53 -0500 | [diff] [blame] | 169 | [Documentation] Verify a minimum number of FRUs. |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 170 | [Arguments] ${fru_type} ${min_num_frus} |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 171 | |
| 172 | # Description of Argument(s): |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 173 | # fru_type The type of FRU (e.g. "Processors", "Memory", etc.). |
| 174 | # min_num_frus The minimum acceptable number of FRUs found. |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 175 | |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 176 | # A valid FRU will have a "State" key of "Enabled" and a "Health" key |
| 177 | # of "OK". |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 178 | |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 179 | ${status} ${num_valid_frus}= Run Key U Get Num Valid FRUs \ ${fru_type} |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 180 | |
Steven Sombar | ecf10e3 | 2019-07-25 08:51:00 -0500 | [diff] [blame] | 181 | Rprint Vars fru_type num_valid_frus min_num_frus |
| 182 | |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 183 | Return From Keyword If ${num_valid_frus} >= ${min_num_frus} |
| 184 | Fail Too few "${fru_type}" FRUs found, found only ${num_valid_frus}. |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 185 | |
| 186 | |
Steven Sombar | ecf10e3 | 2019-07-25 08:51:00 -0500 | [diff] [blame] | 187 | Check If FRU Is Functional |
Steven Sombar | 815fa63 | 2019-07-16 14:24:40 -0500 | [diff] [blame] | 188 | [Documentation] Return 1 if a power supply is OK and either |
| 189 | ... Enabled or StandbyOffline. Return 0 otherwise. |
| 190 | [Arguments] ${chassis_uri} |
| 191 | |
| 192 | # Description of Argument(s): |
| 193 | # chassis_uri The Redfish uri of a power supply |
| 194 | # (e.g. "/redfish/v1/Chassis/powersupply0"). |
| 195 | |
| 196 | ${status}= Redfish.Get Attribute ${chassis_uri} Status |
| 197 | |
| 198 | ${state_check}= Set Variable "${status['Health']}" == "OK" and |
| 199 | ${state_check}= Catenate ${state_check} ("${status['State']}" == "StandbyOffline" or |
| 200 | ${state_check}= Catenate ${state_check} "${status['State']}" == "Enabled") |
| 201 | |
| 202 | ${is_functional}= Run Keyword If ${state_check} |
| 203 | ... Set Variable ${1} |
| 204 | ... ELSE |
| 205 | ... Set Variable ${0} |
| 206 | |
| 207 | [Return] ${is_functional} |
| 208 | |
| 209 | |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 210 | Suite Teardown Execution |
| 211 | [Documentation] Do the post suite teardown. |
| 212 | |
| 213 | Redfish.Logout |
| 214 | |
| 215 | |
| 216 | Suite Setup Execution |
| 217 | [Documentation] Do test case setup tasks. |
| 218 | |
Steven Sombar | ecf10e3 | 2019-07-25 08:51:00 -0500 | [diff] [blame] | 219 | Redfish Power On stack_mode=skip |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 220 | Redfish.Login |
Steven Sombar | ecf10e3 | 2019-07-25 08:51:00 -0500 | [diff] [blame] | 221 | |
| 222 | ${cpu_uris} ${gpu_uris} ${powersupply_uris}= Get Inventory URIs |
| 223 | |
| 224 | Set Suite Variable ${cpu_uris} |
| 225 | Set Suite Variable ${gpu_uris} |
| 226 | Set Suite Variable ${powersupply_uris} |
| 227 | |
| 228 | ${num_valid_cpus}= Get Length ${cpu_uris} |
| 229 | ${num_valid_gpus}= Get Length ${gpu_uris} |
| 230 | |
| 231 | Set Suite Variable ${num_valid_cpus} |
| 232 | Set Suite Variable ${num_valid_gpus} |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 233 | |
| 234 | |
| 235 | Test Teardown Execution |
| 236 | [Documentation] Do the post test teardown. |
| 237 | |
| 238 | FFDC On Test Case Fail |