blob: 2d0699b4947d1c3a05d39e05b05d7a2b98c3efaf [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
Steven Sombarecf10e32019-07-25 08:51:00 -050030 Rprint Vars num_valid_cpus
31 Rprint Vars min_num_cpus
32 Rvalid Range num_valid_cpus ${min_num_cpus}..
Steven Sombarc90c8e22019-05-21 11:28:48 -050033
34
Steven Sombar815fa632019-07-16 14:24:40 -050035Get Available CPU Cores And Verify
36 [Documentation] Get the total number of cores in the system and
37 ... verify that it is at or above the minimum.
38 [Tags] Get_Available_CPU_Cores_And_Verify
39
40 ${total_num_cores}= Set Variable ${0}
41
Steven Sombarecf10e32019-07-25 08:51:00 -050042 :FOR ${processor} IN @{cpu_uris}
43 ${is_functional}= Check If FRU Is Functional ${processor}
44 Run Keyword If not ${is_functional} Continue For Loop
45 ${processor_cores}= Get CPU TotalCores ${processor}
Steven Sombar815fa632019-07-16 14:24:40 -050046 ${total_num_cores}= Evaluate $total_num_cores + $processor_cores
47 END
48
49 Rprint Vars total_num_cores
Steven Sombarecf10e32019-07-25 08:51:00 -050050
Steven Sombar815fa632019-07-16 14:24:40 -050051 Run Keyword If ${total_num_cores} < ${min_num_cores}
52 ... Fail Too few CPU cores found.
53
54
Steven Sombarc90c8e22019-05-21 11:28:48 -050055Get Memory Inventory Via Redfish And Verify
56 [Documentation] Get the number of DIMMs that are functional and enabled.
57 [Tags] Get_Memory_Inventory_Via_Redfish_And_Verify
58
Steven Sombarbccfd512019-06-05 15:50:35 -050059 Verify FRU Inventory Minimums Memory ${min_num_dimms}
60
61
Steven Sombar815fa632019-07-16 14:24:40 -050062Get System Serial And Verify Populated
63 [Documentation] Check that the System SerialNumber is non-blank.
64 [Tags] Get_System_Serial_And_Verify_Populated
Steven Sombarbccfd512019-06-05 15:50:35 -050065
66 ${serial_number}= Redfish.Get Attribute ${SYSTEM_BASE_URI} SerialNumber
67 Rvalid Value serial_number
68 Rprint Vars serial_number
69
70
71Get Model And Verify Populated
72 [Documentation] Check that the Model is non-blank.
73 [Tags] Get_Model_And_Verify_Populated
74
75 ${model}= Redfish.Get Attribute ${SYSTEM_BASE_URI} Model
76 Rvalid Value model
77 Rprint Vars model
Steven Sombarc90c8e22019-05-21 11:28:48 -050078
79
Steven Sombar815fa632019-07-16 14:24:40 -050080Get Available Power Supplies And Verify
81 [Documentation] Get the number of functional power supplies and
82 ... verify that it is at or above the minimum.
83 [Tags] Get_Available_Power_Supplies_And_Verify
84
85 ${total_num_supplies}= Set Variable ${0}
86
Steven Sombarecf10e32019-07-25 08:51:00 -050087 :FOR ${chassis_uri} IN @{powersupply_uris}
88 ${is_functional}= Check If FRU Is Functional ${chassis_uri}
Steven Sombar815fa632019-07-16 14:24:40 -050089 ${total_num_supplies}= Evaluate $total_num_supplies + $is_functional
90 END
91
92 Rprint Vars total_num_supplies
93
94 Run Keyword If ${total_num_supplies} < ${min_num_powersupplies}
95 ... Fail Too few power supplies found.
96
97
98Get Motherboard Serial And Verify Populated
99 [Documentation] Check that the Motherboard SerialNumber is non-blank.
100 [Tags] Get_Motherboard_Serial_And_Verify_Populated
101
102 ${serial_number}= Redfish.Get Attribute
103 ... ${REDFISH_CHASSIS_URI}motherboard SerialNumber
104 Rvalid Value serial_number
105 Rprint Vars serial_number
106
107
Steven Sombarecf10e32019-07-25 08:51:00 -0500108Get GPU Inventory Via Redfish
109 [Documentation] Get the number of GPUs.
110 [Tags] Get_GPU_Inventory_Via_Redfish
111
112 # There may be 0-6 GPUs in a system.
113 # GPUs may have one of three states:
114 # "Absent", "Enabled", or "UnavailableOffline".
115 # Or GPUs may not be listed at all under the URI
116 # /redfish/v1/Systems/system/Processors.
117 # So for now, only print the total of GPUs present.
118
119 Rprint Vars num_valid_gpus
120
121
Steven Sombarc90c8e22019-05-21 11:28:48 -0500122*** Keywords ***
123
124
Steven Sombarecf10e32019-07-25 08:51:00 -0500125Get Inventory URIs
126 [Documentation] Get and return a tuple of lists of URIs for CPU,
127 ... GPU and PowerSupplies.
128
129 ${processor_uris}=
130 ... Redfish_Utils.Get Member List ${SYSTEM_BASE_URI}Processors
131 # Example of processor_uris:
132 # /redfish/v1/Systems/system/Processors/cpu0
133 # /redfish/v1/Systems/system/Processors/cpu1
134 # /redfish/v1/Systems/system/Processors/gv100card0
135 # /redfish/v1/Systems/system/Processors/gv100card1
136 # /redfish/v1/Systems/system/Processors/gv100card2
137 # /redfish/v1/Systems/system/Processors/gv100card3
138 # /redfish/v1/Systems/system/Processors/gv100card4
139
140 ${cpu_uris}= Get Matches ${processor_uris} *cpu*
141 ${gpu_uris}= Get Matches ${processor_uris} *gv*
142
143 ${chassis_uris}= Redfish_Utils.Get Member List ${REDFISH_CHASSIS_URI}
144 # Example of chassis_uris:
145 # /redfish/v1/Chassis/chasis
146 # /redfish/v1/Chassis/motherboard
147 # /redfish/v1/Chassis/powersupply0
148 # /redfish/v1/Chassis/powersupply1
149
150 ${powersupply_uris}= Get Matches ${chassis_uris} *powersupp*
151
152 [Return] ${cpu_uris} ${gpu_uris} ${powersupply_uris}
153
154
155Get CPU TotalCores
156 [Documentation] Return the TotalCores of a CPU.
157 ... Return 0 if this attribute is missing or NONE.
158 [Arguments] ${processor}
159
160 # Description of Argument(s):
161 # processor The Redfish URI of a CPU (e.g.
162 # "/redfish/v1/Systems/system/Processors/cpu0").
163
164 ${total_cores}= Redfish.Get Attribute ${processor} TotalCores
165 Return From Keyword If ${total_cores} is ${NONE} ${0}
166 [Return] ${total_cores}
167
168
Steven Sombarbccfd512019-06-05 15:50:35 -0500169Verify FRU Inventory Minimums
George Keishing3292d4a2019-06-19 02:04:53 -0500170 [Documentation] Verify a minimum number of FRUs.
Steven Sombarbccfd512019-06-05 15:50:35 -0500171 [Arguments] ${fru_type} ${min_num_frus}
Steven Sombarc90c8e22019-05-21 11:28:48 -0500172
173 # Description of Argument(s):
Steven Sombarbccfd512019-06-05 15:50:35 -0500174 # fru_type The type of FRU (e.g. "Processors", "Memory", etc.).
175 # min_num_frus The minimum acceptable number of FRUs found.
Steven Sombarc90c8e22019-05-21 11:28:48 -0500176
Steven Sombarbccfd512019-06-05 15:50:35 -0500177 # A valid FRU will have a "State" key of "Enabled" and a "Health" key
178 # of "OK".
Steven Sombarc90c8e22019-05-21 11:28:48 -0500179
Steven Sombarbccfd512019-06-05 15:50:35 -0500180 ${status} ${num_valid_frus}= Run Key U Get Num Valid FRUs \ ${fru_type}
Steven Sombarc90c8e22019-05-21 11:28:48 -0500181
Steven Sombarecf10e32019-07-25 08:51:00 -0500182 Rprint Vars fru_type num_valid_frus min_num_frus
183
Steven Sombarbccfd512019-06-05 15:50:35 -0500184 Return From Keyword If ${num_valid_frus} >= ${min_num_frus}
185 Fail Too few "${fru_type}" FRUs found, found only ${num_valid_frus}.
Steven Sombarc90c8e22019-05-21 11:28:48 -0500186
187
Steven Sombarecf10e32019-07-25 08:51:00 -0500188Check If FRU Is Functional
Steven Sombar815fa632019-07-16 14:24:40 -0500189 [Documentation] Return 1 if a power supply is OK and either
190 ... Enabled or StandbyOffline. Return 0 otherwise.
191 [Arguments] ${chassis_uri}
192
193 # Description of Argument(s):
194 # chassis_uri The Redfish uri of a power supply
195 # (e.g. "/redfish/v1/Chassis/powersupply0").
196
197 ${status}= Redfish.Get Attribute ${chassis_uri} Status
198
199 ${state_check}= Set Variable "${status['Health']}" == "OK" and
200 ${state_check}= Catenate ${state_check} ("${status['State']}" == "StandbyOffline" or
201 ${state_check}= Catenate ${state_check} "${status['State']}" == "Enabled")
202
203 ${is_functional}= Run Keyword If ${state_check}
204 ... Set Variable ${1}
205 ... ELSE
206 ... Set Variable ${0}
207
208 [Return] ${is_functional}
209
210
Steven Sombarc90c8e22019-05-21 11:28:48 -0500211Suite Teardown Execution
212 [Documentation] Do the post suite teardown.
213
214 Redfish.Logout
215
216
217Suite Setup Execution
218 [Documentation] Do test case setup tasks.
219
Steven Sombarecf10e32019-07-25 08:51:00 -0500220 Redfish Power On stack_mode=skip
Steven Sombarc90c8e22019-05-21 11:28:48 -0500221 Redfish.Login
Steven Sombarecf10e32019-07-25 08:51:00 -0500222
223 ${cpu_uris} ${gpu_uris} ${powersupply_uris}= Get Inventory URIs
224
225 Set Suite Variable ${cpu_uris}
226 Set Suite Variable ${gpu_uris}
227 Set Suite Variable ${powersupply_uris}
228
229 ${num_valid_cpus}= Get Length ${cpu_uris}
230 ${num_valid_gpus}= Get Length ${gpu_uris}
231
232 Set Suite Variable ${num_valid_cpus}
233 Set Suite Variable ${num_valid_gpus}
Steven Sombarc90c8e22019-05-21 11:28:48 -0500234
235
236Test Teardown Execution
237 [Documentation] Do the post test teardown.
238
239 FFDC On Test Case Fail