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