blob: 8988d34ba730f2597882355373e976b9adee9930 [file] [log] [blame]
Steven Sombarc90c8e22019-05-21 11:28:48 -05001*** Settings ***
Steven Sombarbccfd512019-06-05 15:50:35 -05002Documentation Inventory of hardware FRUs under redfish/systems.
Steven Sombarc90c8e22019-05-21 11:28:48 -05003
4Resource ../../lib/bmc_redfish_resource.robot
5Resource ../../lib/bmc_redfish_utils.robot
6Resource ../../lib/openbmc_ffdc.robot
Steven Sombarbccfd512019-06-05 15:50:35 -05007Library ../../lib/gen_robot_valid.py
Steven Sombarc90c8e22019-05-21 11:28:48 -05008
9Suite Setup Suite Setup Execution
10Suite Teardown Suite Teardown Execution
11Test Teardown Test Teardown Execution
12
13*** Variables ***
14
15# The passing criteria. Must have at least this many.
Steven Sombarbccfd512019-06-05 15:50:35 -050016${min_num_dimms} 2
17${min_num_cpus} 1
Steven Sombar815fa632019-07-16 14:24:40 -050018${min_num_cores} 18
19${min_num_powersupplies} 1
Steven Sombarc90c8e22019-05-21 11:28:48 -050020
21
22*** Test Cases ***
23
24Get 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 Sombarbccfd512019-06-05 15:50:35 -050028 Verify FRU Inventory Minimums Processors ${min_num_cpus}
Steven Sombarc90c8e22019-05-21 11:28:48 -050029
30
Steven Sombar815fa632019-07-16 14:24:40 -050031Get 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 Sombarc90c8e22019-05-21 11:28:48 -050062Get 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 Sombarbccfd512019-06-05 15:50:35 -050066 Verify FRU Inventory Minimums Memory ${min_num_dimms}
67
68
Steven Sombar815fa632019-07-16 14:24:40 -050069Get System Serial And Verify Populated
70 [Documentation] Check that the System SerialNumber is non-blank.
71 [Tags] Get_System_Serial_And_Verify_Populated
Steven Sombarbccfd512019-06-05 15:50:35 -050072
73 ${serial_number}= Redfish.Get Attribute ${SYSTEM_BASE_URI} SerialNumber
74 Rvalid Value serial_number
75 Rprint Vars serial_number
76
77
78Get 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 Sombarc90c8e22019-05-21 11:28:48 -050085
86
Steven Sombar815fa632019-07-16 14:24:40 -050087Get 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
115Get 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 Sombarc90c8e22019-05-21 11:28:48 -0500125*** Keywords ***
126
127
Steven Sombarbccfd512019-06-05 15:50:35 -0500128Verify FRU Inventory Minimums
George Keishing3292d4a2019-06-19 02:04:53 -0500129 [Documentation] Verify a minimum number of FRUs.
Steven Sombarbccfd512019-06-05 15:50:35 -0500130 [Arguments] ${fru_type} ${min_num_frus}
Steven Sombarc90c8e22019-05-21 11:28:48 -0500131
132 # Description of Argument(s):
Steven Sombarbccfd512019-06-05 15:50:35 -0500133 # fru_type The type of FRU (e.g. "Processors", "Memory", etc.).
134 # min_num_frus The minimum acceptable number of FRUs found.
Steven Sombarc90c8e22019-05-21 11:28:48 -0500135
Steven Sombarbccfd512019-06-05 15:50:35 -0500136 # A valid FRU will have a "State" key of "Enabled" and a "Health" key
137 # of "OK".
Steven Sombarc90c8e22019-05-21 11:28:48 -0500138
Steven Sombarbccfd512019-06-05 15:50:35 -0500139 ${status} ${num_valid_frus}= Run Key U Get Num Valid FRUs \ ${fru_type}
Steven Sombarc90c8e22019-05-21 11:28:48 -0500140
Steven Sombarbccfd512019-06-05 15:50:35 -0500141 Return From Keyword If ${num_valid_frus} >= ${min_num_frus}
142 Fail Too few "${fru_type}" FRUs found, found only ${num_valid_frus}.
Steven Sombarc90c8e22019-05-21 11:28:48 -0500143
144
Steven Sombar815fa632019-07-16 14:24:40 -0500145Check 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 Sombarc90c8e22019-05-21 11:28:48 -0500168Suite Teardown Execution
169 [Documentation] Do the post suite teardown.
170
171 Redfish.Logout
172
173
174Suite Setup Execution
175 [Documentation] Do test case setup tasks.
176
177 Redfish.Login
Steven Sombarbccfd512019-06-05 15:50:35 -0500178 Printn
Steven Sombarc90c8e22019-05-21 11:28:48 -0500179
180
181Test Teardown Execution
182 [Documentation] Do the post test teardown.
183
184 FFDC On Test Case Fail