1*** Settings *** 2Documentation Inventory of hardware FRUs under redfish. 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_power_supplies} 1 21 22 23*** Test Cases *** 24 25Verify CPU And Core Count 26 [Documentation] Get the total number of CPUs and cores in the system. 27 ... Verify counts are above minimums. 28 [Tags] Verify_CPU_And_Core_Count 29 30 # Select only CPUs with Health = "OK". 31 ${cpus_ok}= Filter Struct ${cpu_info} [('Health', 'OK')] 32 ${num_cpus}= Get Length ${cpus_ok} 33 34 Rprint Vars num_cpus min_num_cpus 35 36 # Assert that num_cpus is greater than or equal to min_num_cpus. 37 Valid Range num_cpus ${min_num_cpus} 38 39 # Get the number of cores. 40 ${total_num_cores}= Set Variable ${0} 41 FOR ${cpu} IN @{cpus_ok} 42 ${cores}= Get CPU TotalCores ${cpu} 43 ${total_num_cores}= Evaluate $total_num_cores + ${cores} 44 END 45 46 Rprint Vars total_num_cores min_num_cores 47 48 # Assert that total_num_cores is greater than or equal to 49 # min_num_cores. 50 Valid Range total_num_cores ${min_num_cores} 51 52 53Get Memory Inventory Via Redfish And Verify 54 [Documentation] Get the number of DIMMs that are functional and enabled. 55 [Tags] Get_Memory_Inventory_Via_Redfish_And_Verify 56 57 Verify FRU Inventory Minimums Memory ${min_num_dimms} 58 59 60Get Memory Summary State And Verify Enabled 61 [Documentation] Check that the state of the MemorySummary attribute 62 ... under /redfish/v1/Systems/system is 'Enabled'. 63 [Tags] Get_Memory_Summary_State_And_Verify_Enabled 64 65 ${status}= Redfish.Get Attribute ${SYSTEM_BASE_URI} MemorySummary 66 ${memory_summary_state}= Set Variable ${status['Status']['State']} 67 Rprint Vars memory_summary_state 68 69 Should Be Equal As Strings Enabled ${memory_summary_state} 70 ... msg=MemorySummary State is not 'Enabled'. 71 72 73Get System Serial And Verify Populated 74 [Documentation] Check that the System SerialNumber is non-blank. 75 [Tags] Get_System_Serial_And_Verify_Populated 76 77 ${serial_number}= Redfish.Get Attribute ${SYSTEM_BASE_URI} SerialNumber 78 Valid Value serial_number 79 Rprint Vars serial_number 80 81 82Get Model And Verify Populated 83 [Documentation] Check that the Model is non-blank. 84 [Tags] Get_Model_And_Verify_Populated 85 86 ${model}= Redfish.Get Attribute ${SYSTEM_BASE_URI} Model 87 Valid Value model 88 Rprint Vars model 89 90 91Get Available Power Supplies And Verify 92 [Documentation] Get the number of functional power supplies and 93 ... verify that it is at or above the minimum. 94 [Tags] Get_Available_Power_Supplies_And_Verify 95 96 # Select only power supplies with Health = "OK". 97 ${power_supplies_ok}= Filter Struct ${power_supplies} [('Health', 'OK')] 98 99 # Count the power supplies that are Enabled or StandbyOffline. 100 ${total_num_supplies}= Set Variable ${0} 101 FOR ${power_supply} IN @{power_supplies_ok} 102 # Example of power_supply: 103 # power_supply = {'@odata.id': '/redfish/v1/Chassis/chassis/Power#/PowerSupplies/0', 104 # 'Manufacturer': '', 'MemberId': 'powersupply0', 'Model': '2100', 'Name': 105 # 'powersupply0', 'PartNumber': 'PNPWR123', 'PowerInputWatts': 394.0, 106 # 'SerialNumber': '75B12W', 'Status': {'Health': 'OK', 'State': 'Enabled'}} 107 ${state}= Set Variable ${power_supply['Status']['State']} 108 ${good_state}= Evaluate 109 ... any(x in '${state}' for x in ('Enabled', 'StandbyOffline')) 110 IF not ${good_state} CONTINUE 111 ${total_num_supplies}= Evaluate $total_num_supplies + ${1} 112 END 113 114 Rprint Vars total_num_supplies min_num_power_supplies 115 116 Valid Range total_num_supplies ${min_num_power_supplies} 117 118 119Get Motherboard Serial And Verify Populated 120 [Documentation] Check that the Motherboard SerialNumber is non-blank. 121 [Tags] Get_Motherboard_Serial_And_Verify_Populated 122 123 ${serial_number}= Redfish.Get Attribute ${REDFISH_CHASSIS_URI}${CHASSIS_ID} SerialNumber 124 Valid Value serial_number 125 Rprint Vars serial_number 126 127 128Verify Motherboard Manufacturer Field Value Populated 129 [Documentation] Check that the Motherboard manufacturer is non-blank. 130 [Tags] Verify_Motherboard_Manufacturer_Field_Value_Populated 131 132 ${motherboard_manufacturer}= Redfish.Get Attribute ${REDFISH_CHASSIS_URI}${CHASSIS_ID} Manufacturer 133 Valid Value motherboard_manufacturer 134 Rprint Vars motherboard_manufacturer 135 136 137Verify Motherboard Partnumber Field Value Populated 138 [Documentation] Check that the Motherboard partnumber is non-blank. 139 [Tags] Verify_Motherboard_Partnumber_Field_Value_Populated 140 141 ${motherboard_part_number}= Redfish.Get Attribute ${REDFISH_CHASSIS_URI}${CHASSIS_ID} PartNumber 142 Valid Value motherboard_part_number 143 Rprint Vars motherboard_part_number 144 145 146Check GPU States When Power On 147 [Documentation] Check the State of each of the GPUs 148 ... in the system. A system may have 0-6 GPUs. 149 [Tags] Check_GPU_States_When_Power_On 150 151 # System was powered-on in Suite Setup. 152 GPU State Check 153 154 155Check GPU States When Power Off 156 [Documentation] Check the State of the GPUs when power is Off. 157 [Tags] Check_GPU_States_When_Power_Off 158 159 Redfish Power Off 160 GPU State Check 161 162 163*** Keywords *** 164 165 166Get CPU TotalCores 167 [Documentation] Return the TotalCores of a CPU. 168 ... Return 0 if this attribute is missing or NONE. 169 [Arguments] ${processor} 170 171 # Description of Argument(s): 172 # processor The Redfish URI of a CPU (e.g. 173 # "/redfish/v1/Systems/system/Processors/cpu0"). 174 175 ${total_cores}= Redfish.Get Attribute ${processor} TotalCores 176 IF ${total_cores} is ${NONE} RETURN ${0} 177 RETURN ${total_cores} 178 179 180GPU State Check 181 [Documentation] The state of every "OK" GPU should be 182 ... "Absent", "Enabled", or "UnavailableOffline". 183 184 # Select only GPUs with Health = "OK". 185 ${gpus_ok}= Filter Struct ${gpu_info} [('Health', 'OK')] 186 187 FOR ${gpu} IN @{gpus_ok} 188 ${status}= Redfish.Get Attribute ${gpu} Status 189 ${state}= Set Variable ${status['State']} 190 ${good_state}= Evaluate 191 ... any(x in '${state}' for x in ('Absent', 'Enabled', 'UnavailableOffline')) 192 Rprint Vars gpu state 193 IF not ${good_state} 194 Fail msg=GPU State is not Absent, Enabled, or UnavailableOffline. 195 END 196 END 197 198 199Get Inventory URIs 200 [Documentation] Get and return a tuple of lists of URIs for CPU, 201 ... GPU and PowerSupplies. 202 203 204 ${processor_info}= Redfish_Utils.Enumerate Request 205 ... ${SYSTEM_BASE_URI}Processors return_json=0 206 207 ${cpu_info}= Filter Struct ${processor_info} 208 ... [('ProcessorType', 'CPU')] regex=1 209 210 ${gpu_info}= Filter Struct ${processor_info} 211 ... [('ProcessorType', 'Accelerator')] regex=1 212 213 ${power_supplies}= Redfish.Get Attribute 214 ... ${REDFISH_CHASSIS_URI}${CHASSIS_ID}/Power PowerSupplies 215 216 RETURN ${cpu_info} ${gpu_info} ${power_supplies} 217 218 219Verify FRU Inventory Minimums 220 [Documentation] Verify a minimum number of FRUs. 221 [Arguments] ${fru_type} ${min_num_frus} 222 223 # Description of Argument(s): 224 # fru_type The type of FRU (e.g. "Processors", "Memory", etc.). 225 # min_num_frus The minimum acceptable number of FRUs found. 226 227 # A valid FRU will have a "State" key of "Enabled" and a "Health" key 228 # of "OK". 229 230 ${status} ${num_valid_frus}= Run Key U Get Num Valid FRUs \ ${fru_type} 231 232 Rprint Vars fru_type num_valid_frus min_num_frus 233 234 Return From Keyword If ${num_valid_frus} >= ${min_num_frus} 235 Fail Too few "${fru_type}" FRUs found, found only ${num_valid_frus}. 236 237 238Suite Teardown Execution 239 [Documentation] Do the post suite teardown. 240 241 Redfish.Logout 242 243 244Suite Setup Execution 245 [Documentation] Do test case setup tasks. 246 247 Redfish.Login 248 Redfish Power On stack_mode=skip 249 250 ${cpu_info} ${gpu_info} ${power_supplies}= Get Inventory URIs 251 252 Set Suite Variable ${cpu_info} 253 Set Suite Variable ${gpu_info} 254 Set Suite Variable ${power_supplies} 255 256 257Test Teardown Execution 258 [Documentation] Do the post test teardown. 259 260 FFDC On Test Case Fail 261