blob: 26173f4d5edddc2901fe2681ea4684fb81a7b3cd [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
Steven Sombarecf10e32019-07-25 08:51:00 -050011Test Setup Printn
Steven Sombarc90c8e22019-05-21 11:28:48 -050012Test Teardown Test Teardown Execution
13
14*** Variables ***
15
16# The passing criteria. Must have at least this many.
Steven Sombarbccfd512019-06-05 15:50:35 -050017${min_num_dimms} 2
18${min_num_cpus} 1
Steven Sombar815fa632019-07-16 14:24:40 -050019${min_num_cores} 18
20${min_num_powersupplies} 1
Steven Sombarc90c8e22019-05-21 11:28:48 -050021
22
23*** Test Cases ***
24
Steven Sombarecf10e32019-07-25 08:51:00 -050025
Steven Sombarc90c8e22019-05-21 11:28:48 -050026Get Processor Inventory Via Redfish And Verify
27 [Documentation] Get the number of CPUs that are functional and enabled.
28 [Tags] Get_Processor_Inventory_Via_Redfish_And_Verify
29
Michael Walsh09083a82019-08-01 12:46:16 -050030 Rprint Vars num_valid_cpus min_num_cpus
31 Valid Range num_valid_cpus ${min_num_cpus}
Steven Sombarc90c8e22019-05-21 11:28:48 -050032
33
Steven Sombar815fa632019-07-16 14:24:40 -050034Get Available CPU Cores And Verify
35 [Documentation] Get the total number of cores in the system and
36 ... verify that it is at or above the minimum.
37 [Tags] Get_Available_CPU_Cores_And_Verify
38
39 ${total_num_cores}= Set Variable ${0}
40
Steven Sombarecf10e32019-07-25 08:51:00 -050041 :FOR ${processor} IN @{cpu_uris}
42 ${is_functional}= Check If FRU Is Functional ${processor}
43 Run Keyword If not ${is_functional} Continue For Loop
44 ${processor_cores}= Get CPU TotalCores ${processor}
Steven Sombar815fa632019-07-16 14:24:40 -050045 ${total_num_cores}= Evaluate $total_num_cores + $processor_cores
46 END
47
48 Rprint Vars total_num_cores
Steven Sombarecf10e32019-07-25 08:51:00 -050049
Steven Sombar815fa632019-07-16 14:24:40 -050050 Run Keyword If ${total_num_cores} < ${min_num_cores}
51 ... Fail Too few CPU cores found.
52
53
Steven Sombarc90c8e22019-05-21 11:28:48 -050054Get 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 Sombarbccfd512019-06-05 15:50:35 -050058 Verify FRU Inventory Minimums Memory ${min_num_dimms}
59
60
Steven Sombar815fa632019-07-16 14:24:40 -050061Get System Serial And Verify Populated
62 [Documentation] Check that the System SerialNumber is non-blank.
63 [Tags] Get_System_Serial_And_Verify_Populated
Steven Sombarbccfd512019-06-05 15:50:35 -050064
65 ${serial_number}= Redfish.Get Attribute ${SYSTEM_BASE_URI} SerialNumber
66 Rvalid Value serial_number
67 Rprint Vars serial_number
68
69
70Get Model And Verify Populated
71 [Documentation] Check that the Model is non-blank.
72 [Tags] Get_Model_And_Verify_Populated
73
74 ${model}= Redfish.Get Attribute ${SYSTEM_BASE_URI} Model
75 Rvalid Value model
76 Rprint Vars model
Steven Sombarc90c8e22019-05-21 11:28:48 -050077
78
Steven Sombar815fa632019-07-16 14:24:40 -050079Get Available Power Supplies And Verify
80 [Documentation] Get the number of functional power supplies and
81 ... verify that it is at or above the minimum.
82 [Tags] Get_Available_Power_Supplies_And_Verify
83
84 ${total_num_supplies}= Set Variable ${0}
85
Steven Sombarecf10e32019-07-25 08:51:00 -050086 :FOR ${chassis_uri} IN @{powersupply_uris}
87 ${is_functional}= Check If FRU Is Functional ${chassis_uri}
Steven Sombar815fa632019-07-16 14:24:40 -050088 ${total_num_supplies}= Evaluate $total_num_supplies + $is_functional
89 END
90
91 Rprint Vars total_num_supplies
92
93 Run Keyword If ${total_num_supplies} < ${min_num_powersupplies}
94 ... Fail Too few power supplies found.
95
96
97Get Motherboard Serial And Verify Populated
98 [Documentation] Check that the Motherboard SerialNumber is non-blank.
99 [Tags] Get_Motherboard_Serial_And_Verify_Populated
100
101 ${serial_number}= Redfish.Get Attribute
102 ... ${REDFISH_CHASSIS_URI}motherboard SerialNumber
103 Rvalid Value serial_number
104 Rprint Vars serial_number
105
106
Steven Sombarecf10e32019-07-25 08:51:00 -0500107Get GPU Inventory Via Redfish
108 [Documentation] Get the number of GPUs.
109 [Tags] Get_GPU_Inventory_Via_Redfish
110
111 # There may be 0-6 GPUs in a system.
112 # GPUs may have one of three states:
113 # "Absent", "Enabled", or "UnavailableOffline".
114 # Or GPUs may not be listed at all under the URI
115 # /redfish/v1/Systems/system/Processors.
116 # So for now, only print the total of GPUs present.
117
118 Rprint Vars num_valid_gpus
119
120
Steven Sombarc90c8e22019-05-21 11:28:48 -0500121*** Keywords ***
122
123
Steven Sombarecf10e32019-07-25 08:51:00 -0500124Get Inventory URIs
125 [Documentation] Get and return a tuple of lists of URIs for CPU,
126 ... GPU and PowerSupplies.
127
128 ${processor_uris}=
129 ... Redfish_Utils.Get Member List ${SYSTEM_BASE_URI}Processors
130 # Example of processor_uris:
131 # /redfish/v1/Systems/system/Processors/cpu0
132 # /redfish/v1/Systems/system/Processors/cpu1
133 # /redfish/v1/Systems/system/Processors/gv100card0
134 # /redfish/v1/Systems/system/Processors/gv100card1
135 # /redfish/v1/Systems/system/Processors/gv100card2
136 # /redfish/v1/Systems/system/Processors/gv100card3
137 # /redfish/v1/Systems/system/Processors/gv100card4
138
139 ${cpu_uris}= Get Matches ${processor_uris} *cpu*
140 ${gpu_uris}= Get Matches ${processor_uris} *gv*
141
142 ${chassis_uris}= Redfish_Utils.Get Member List ${REDFISH_CHASSIS_URI}
143 # Example of chassis_uris:
144 # /redfish/v1/Chassis/chasis
145 # /redfish/v1/Chassis/motherboard
146 # /redfish/v1/Chassis/powersupply0
147 # /redfish/v1/Chassis/powersupply1
148
149 ${powersupply_uris}= Get Matches ${chassis_uris} *powersupp*
150
151 [Return] ${cpu_uris} ${gpu_uris} ${powersupply_uris}
152
153
154Get CPU TotalCores
155 [Documentation] Return the TotalCores of a CPU.
156 ... Return 0 if this attribute is missing or NONE.
157 [Arguments] ${processor}
158
159 # Description of Argument(s):
160 # processor The Redfish URI of a CPU (e.g.
161 # "/redfish/v1/Systems/system/Processors/cpu0").
162
163 ${total_cores}= Redfish.Get Attribute ${processor} TotalCores
164 Return From Keyword If ${total_cores} is ${NONE} ${0}
165 [Return] ${total_cores}
166
167
Steven Sombarbccfd512019-06-05 15:50:35 -0500168Verify FRU Inventory Minimums
George Keishing3292d4a2019-06-19 02:04:53 -0500169 [Documentation] Verify a minimum number of FRUs.
Steven Sombarbccfd512019-06-05 15:50:35 -0500170 [Arguments] ${fru_type} ${min_num_frus}
Steven Sombarc90c8e22019-05-21 11:28:48 -0500171
172 # Description of Argument(s):
Steven Sombarbccfd512019-06-05 15:50:35 -0500173 # fru_type The type of FRU (e.g. "Processors", "Memory", etc.).
174 # min_num_frus The minimum acceptable number of FRUs found.
Steven Sombarc90c8e22019-05-21 11:28:48 -0500175
Steven Sombarbccfd512019-06-05 15:50:35 -0500176 # A valid FRU will have a "State" key of "Enabled" and a "Health" key
177 # of "OK".
Steven Sombarc90c8e22019-05-21 11:28:48 -0500178
Steven Sombarbccfd512019-06-05 15:50:35 -0500179 ${status} ${num_valid_frus}= Run Key U Get Num Valid FRUs \ ${fru_type}
Steven Sombarc90c8e22019-05-21 11:28:48 -0500180
Steven Sombarecf10e32019-07-25 08:51:00 -0500181 Rprint Vars fru_type num_valid_frus min_num_frus
182
Steven Sombarbccfd512019-06-05 15:50:35 -0500183 Return From Keyword If ${num_valid_frus} >= ${min_num_frus}
184 Fail Too few "${fru_type}" FRUs found, found only ${num_valid_frus}.
Steven Sombarc90c8e22019-05-21 11:28:48 -0500185
186
Steven Sombarecf10e32019-07-25 08:51:00 -0500187Check If FRU Is Functional
Steven Sombar815fa632019-07-16 14:24:40 -0500188 [Documentation] Return 1 if a power supply is OK and either
189 ... Enabled or StandbyOffline. Return 0 otherwise.
190 [Arguments] ${chassis_uri}
191
192 # Description of Argument(s):
193 # chassis_uri The Redfish uri of a power supply
194 # (e.g. "/redfish/v1/Chassis/powersupply0").
195
196 ${status}= Redfish.Get Attribute ${chassis_uri} Status
197
198 ${state_check}= Set Variable "${status['Health']}" == "OK" and
199 ${state_check}= Catenate ${state_check} ("${status['State']}" == "StandbyOffline" or
200 ${state_check}= Catenate ${state_check} "${status['State']}" == "Enabled")
201
202 ${is_functional}= Run Keyword If ${state_check}
203 ... Set Variable ${1}
204 ... ELSE
205 ... Set Variable ${0}
206
207 [Return] ${is_functional}
208
209
Steven Sombarc90c8e22019-05-21 11:28:48 -0500210Suite Teardown Execution
211 [Documentation] Do the post suite teardown.
212
213 Redfish.Logout
214
215
216Suite Setup Execution
217 [Documentation] Do test case setup tasks.
218
Steven Sombarecf10e32019-07-25 08:51:00 -0500219 Redfish Power On stack_mode=skip
Steven Sombarc90c8e22019-05-21 11:28:48 -0500220 Redfish.Login
Steven Sombarecf10e32019-07-25 08:51:00 -0500221
222 ${cpu_uris} ${gpu_uris} ${powersupply_uris}= Get Inventory URIs
223
224 Set Suite Variable ${cpu_uris}
225 Set Suite Variable ${gpu_uris}
226 Set Suite Variable ${powersupply_uris}
227
228 ${num_valid_cpus}= Get Length ${cpu_uris}
229 ${num_valid_gpus}= Get Length ${gpu_uris}
230
231 Set Suite Variable ${num_valid_cpus}
232 Set Suite Variable ${num_valid_gpus}
Steven Sombarc90c8e22019-05-21 11:28:48 -0500233
234
235Test Teardown Execution
236 [Documentation] Do the post test teardown.
237
238 FFDC On Test Case Fail