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