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 |
| 11 | Test Teardown Test Teardown Execution |
| 12 | |
| 13 | *** Variables *** |
| 14 | |
| 15 | # The passing criteria. Must have at least this many. |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 16 | ${min_num_dimms} 2 |
| 17 | ${min_num_cpus} 1 |
Steven Sombar | 815fa63 | 2019-07-16 14:24:40 -0500 | [diff] [blame] | 18 | ${min_num_cores} 18 |
| 19 | ${min_num_powersupplies} 1 |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 20 | |
| 21 | |
| 22 | *** Test Cases *** |
| 23 | |
| 24 | Get Processor Inventory Via Redfish And Verify |
| 25 | [Documentation] Get the number of CPUs that are functional and enabled. |
| 26 | [Tags] Get_Processor_Inventory_Via_Redfish_And_Verify |
| 27 | |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 28 | Verify FRU Inventory Minimums Processors ${min_num_cpus} |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 29 | |
| 30 | |
Steven Sombar | 815fa63 | 2019-07-16 14:24:40 -0500 | [diff] [blame] | 31 | Get Available CPU Cores And Verify |
| 32 | [Documentation] Get the total number of cores in the system and |
| 33 | ... verify that it is at or above the minimum. |
| 34 | [Tags] Get_Available_CPU_Cores_And_Verify |
| 35 | |
| 36 | ${total_num_cores}= Set Variable ${0} |
| 37 | |
George Keishing | 58b5407 | 2019-07-25 04:48:38 -0500 | [diff] [blame] | 38 | # Example of processor member list: |
| 39 | # /redfish/v1/Systems/system/Processors/cpu0 |
| 40 | # /redfish/v1/Systems/system/Processors/cpu1 |
| 41 | # /redfish/v1/Systems/system/Processors/gv100card0 |
| 42 | # /redfish/v1/Systems/system/Processors/gv100card1 |
| 43 | # /redfish/v1/Systems/system/Processors/gv100card2 |
| 44 | # /redfish/v1/Systems/system/Processors/gv100card3 |
| 45 | # /redfish/v1/Systems/system/Processors/gv100card4 |
| 46 | # /redfish/v1/Systems/system/Processors/gv100card5 |
| 47 | |
Steven Sombar | 815fa63 | 2019-07-16 14:24:40 -0500 | [diff] [blame] | 48 | ${processor_uris}= |
| 49 | ... Redfish_Utils.Get Member List ${SYSTEM_BASE_URI}Processors |
George Keishing | 58b5407 | 2019-07-25 04:48:38 -0500 | [diff] [blame] | 50 | |
| 51 | ${cpu_list}= Get Matches ${processor_uris} *cpu* |
| 52 | |
Steven Sombar | 815fa63 | 2019-07-16 14:24:40 -0500 | [diff] [blame] | 53 | # Example of processor_uris: |
| 54 | # /redfish/v1/Systems/system/Processors/cpu0 |
| 55 | # /redfish/v1/Systems/system/Processors/cpu1 |
| 56 | |
George Keishing | 58b5407 | 2019-07-25 04:48:38 -0500 | [diff] [blame] | 57 | :FOR ${processor} IN @{cpu_list} |
Steven Sombar | 815fa63 | 2019-07-16 14:24:40 -0500 | [diff] [blame] | 58 | # If the status of the processor is "OK" and "Enabled", get its number |
| 59 | # of cores. |
| 60 | ${status}= Redfish.Get Attribute ${processor} Status |
| 61 | ${processor_cores}= Run Keyword If |
| 62 | ... "${status['Health']}" == "OK" and "${status['State']}" == "Enabled" |
| 63 | ... Redfish.Get Attribute ${processor} TotalCores |
| 64 | ... ELSE |
| 65 | ... Set Variable ${0} |
| 66 | # Add the number of processor_cores to the total. |
| 67 | ${total_num_cores}= Evaluate $total_num_cores + $processor_cores |
| 68 | END |
| 69 | |
| 70 | Rprint Vars total_num_cores |
| 71 | Run Keyword If ${total_num_cores} < ${min_num_cores} |
| 72 | ... Fail Too few CPU cores found. |
| 73 | |
| 74 | |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 75 | Get Memory Inventory Via Redfish And Verify |
| 76 | [Documentation] Get the number of DIMMs that are functional and enabled. |
| 77 | [Tags] Get_Memory_Inventory_Via_Redfish_And_Verify |
| 78 | |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 79 | Verify FRU Inventory Minimums Memory ${min_num_dimms} |
| 80 | |
| 81 | |
Steven Sombar | 815fa63 | 2019-07-16 14:24:40 -0500 | [diff] [blame] | 82 | Get System Serial And Verify Populated |
| 83 | [Documentation] Check that the System SerialNumber is non-blank. |
| 84 | [Tags] Get_System_Serial_And_Verify_Populated |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 85 | |
| 86 | ${serial_number}= Redfish.Get Attribute ${SYSTEM_BASE_URI} SerialNumber |
| 87 | Rvalid Value serial_number |
| 88 | Rprint Vars serial_number |
| 89 | |
| 90 | |
| 91 | Get Model And Verify Populated |
| 92 | [Documentation] Check that the Model is non-blank. |
| 93 | [Tags] Get_Model_And_Verify_Populated |
| 94 | |
| 95 | ${model}= Redfish.Get Attribute ${SYSTEM_BASE_URI} Model |
| 96 | Rvalid Value model |
| 97 | Rprint Vars model |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 98 | |
| 99 | |
Steven Sombar | 815fa63 | 2019-07-16 14:24:40 -0500 | [diff] [blame] | 100 | Get Available Power Supplies And Verify |
| 101 | [Documentation] Get the number of functional power supplies and |
| 102 | ... verify that it is at or above the minimum. |
| 103 | [Tags] Get_Available_Power_Supplies_And_Verify |
| 104 | |
| 105 | ${total_num_supplies}= Set Variable ${0} |
| 106 | |
| 107 | ${chassis_uris}= Redfish_Utils.Get Member List ${REDFISH_CHASSIS_URI} |
| 108 | # Example of chassis_uris: |
| 109 | # /redfish/v1/Chassis/chasis |
| 110 | # /redfish/v1/Chassis/motherboard |
| 111 | # /redfish/v1/Chassis/powersupply0 |
| 112 | |
| 113 | :FOR ${chassis_uri} IN @{chassis_uris} |
| 114 | ${is_supply}= Evaluate "powersupply" in $chassis_uri |
| 115 | ${is_functional}= Run Keyword If ${is_supply} |
| 116 | ... Check If Power Supply Is Functional ${chassis_uri} |
| 117 | ... ELSE |
| 118 | ... Set Variable ${0} |
| 119 | ${total_num_supplies}= Evaluate $total_num_supplies + $is_functional |
| 120 | END |
| 121 | |
| 122 | Rprint Vars total_num_supplies |
| 123 | |
| 124 | Run Keyword If ${total_num_supplies} < ${min_num_powersupplies} |
| 125 | ... Fail Too few power supplies found. |
| 126 | |
| 127 | |
| 128 | Get Motherboard Serial And Verify Populated |
| 129 | [Documentation] Check that the Motherboard SerialNumber is non-blank. |
| 130 | [Tags] Get_Motherboard_Serial_And_Verify_Populated |
| 131 | |
| 132 | ${serial_number}= Redfish.Get Attribute |
| 133 | ... ${REDFISH_CHASSIS_URI}motherboard SerialNumber |
| 134 | Rvalid Value serial_number |
| 135 | Rprint Vars serial_number |
| 136 | |
| 137 | |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 138 | *** Keywords *** |
| 139 | |
| 140 | |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 141 | Verify FRU Inventory Minimums |
George Keishing | 3292d4a | 2019-06-19 02:04:53 -0500 | [diff] [blame] | 142 | [Documentation] Verify a minimum number of FRUs. |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 143 | [Arguments] ${fru_type} ${min_num_frus} |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 144 | |
| 145 | # Description of Argument(s): |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 146 | # fru_type The type of FRU (e.g. "Processors", "Memory", etc.). |
| 147 | # min_num_frus The minimum acceptable number of FRUs found. |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 148 | |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 149 | # A valid FRU will have a "State" key of "Enabled" and a "Health" key |
| 150 | # of "OK". |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 151 | |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 152 | ${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] | 153 | |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 154 | Return From Keyword If ${num_valid_frus} >= ${min_num_frus} |
| 155 | Fail Too few "${fru_type}" FRUs found, found only ${num_valid_frus}. |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 156 | |
| 157 | |
Steven Sombar | 815fa63 | 2019-07-16 14:24:40 -0500 | [diff] [blame] | 158 | Check If Power Supply Is Functional |
| 159 | [Documentation] Return 1 if a power supply is OK and either |
| 160 | ... Enabled or StandbyOffline. Return 0 otherwise. |
| 161 | [Arguments] ${chassis_uri} |
| 162 | |
| 163 | # Description of Argument(s): |
| 164 | # chassis_uri The Redfish uri of a power supply |
| 165 | # (e.g. "/redfish/v1/Chassis/powersupply0"). |
| 166 | |
| 167 | ${status}= Redfish.Get Attribute ${chassis_uri} Status |
| 168 | |
| 169 | ${state_check}= Set Variable "${status['Health']}" == "OK" and |
| 170 | ${state_check}= Catenate ${state_check} ("${status['State']}" == "StandbyOffline" or |
| 171 | ${state_check}= Catenate ${state_check} "${status['State']}" == "Enabled") |
| 172 | |
| 173 | ${is_functional}= Run Keyword If ${state_check} |
| 174 | ... Set Variable ${1} |
| 175 | ... ELSE |
| 176 | ... Set Variable ${0} |
| 177 | |
| 178 | [Return] ${is_functional} |
| 179 | |
| 180 | |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 181 | Suite Teardown Execution |
| 182 | [Documentation] Do the post suite teardown. |
| 183 | |
| 184 | Redfish.Logout |
| 185 | |
| 186 | |
| 187 | Suite Setup Execution |
| 188 | [Documentation] Do test case setup tasks. |
| 189 | |
| 190 | Redfish.Login |
Steven Sombar | bccfd51 | 2019-06-05 15:50:35 -0500 | [diff] [blame] | 191 | Printn |
Steven Sombar | c90c8e2 | 2019-05-21 11:28:48 -0500 | [diff] [blame] | 192 | |
| 193 | |
| 194 | Test Teardown Execution |
| 195 | [Documentation] Do the post test teardown. |
| 196 | |
| 197 | FFDC On Test Case Fail |