1*** Settings *** 2Documentation Inventory of hardware FRUs under redfish/systems. 3 4Resource ../../lib/bmc_redfish_resource.robot 5Resource ../../lib/bmc_redfish_utils.robot 6Resource ../../lib/openbmc_ffdc.robot 7Library ../../lib/gen_robot_valid.py 8 9Suite Setup Suite Setup Execution 10Suite Teardown Suite Teardown Execution 11Test Setup Printn 12Test Teardown Test Teardown Execution 13 14*** Variables *** 15 16# The passing criteria. Must have at least this many. 17${min_num_dimms} 2 18${min_num_cpus} 1 19${min_num_cores} 18 20${min_num_powersupplies} 1 21 22 23*** Test Cases *** 24 25 26Get 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 30 Rprint Vars num_valid_cpus min_num_cpus 31 Valid Range num_valid_cpus ${min_num_cpus} 32 33 34Get 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 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} 45 ${total_num_cores}= Evaluate $total_num_cores + $processor_cores 46 END 47 48 Rprint Vars total_num_cores 49 50 Run Keyword If ${total_num_cores} < ${min_num_cores} 51 ... Fail Too few CPU cores found. 52 53 54Get 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 58 Verify FRU Inventory Minimums Memory ${min_num_dimms} 59 60 61Get System Serial And Verify Populated 62 [Documentation] Check that the System SerialNumber is non-blank. 63 [Tags] Get_System_Serial_And_Verify_Populated 64 65 ${serial_number}= Redfish.Get Attribute ${SYSTEM_BASE_URI} SerialNumber 66 Rvalid Value serial_number 67 Rprint Vars serial_number 68 69 70Get 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 77 78 79Get 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 86 :FOR ${chassis_uri} IN @{powersupply_uris} 87 ${is_functional}= Check If FRU Is Functional ${chassis_uri} 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 97Get 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 107Get 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 121*** Keywords *** 122 123 124Get 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 154Get 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 168Verify FRU Inventory Minimums 169 [Documentation] Verify a minimum number of FRUs. 170 [Arguments] ${fru_type} ${min_num_frus} 171 172 # Description of Argument(s): 173 # fru_type The type of FRU (e.g. "Processors", "Memory", etc.). 174 # min_num_frus The minimum acceptable number of FRUs found. 175 176 # A valid FRU will have a "State" key of "Enabled" and a "Health" key 177 # of "OK". 178 179 ${status} ${num_valid_frus}= Run Key U Get Num Valid FRUs \ ${fru_type} 180 181 Rprint Vars fru_type num_valid_frus min_num_frus 182 183 Return From Keyword If ${num_valid_frus} >= ${min_num_frus} 184 Fail Too few "${fru_type}" FRUs found, found only ${num_valid_frus}. 185 186 187Check If FRU Is Functional 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 210Suite Teardown Execution 211 [Documentation] Do the post suite teardown. 212 213 Redfish.Logout 214 215 216Suite Setup Execution 217 [Documentation] Do test case setup tasks. 218 219 Redfish Power On stack_mode=skip 220 Redfish.Login 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} 233 234 235Test Teardown Execution 236 [Documentation] Do the post test teardown. 237 238 FFDC On Test Case Fail 239