blob: d43a383f6de6fb08393fedb07ef897317c770f12 [file] [log] [blame]
Steven Sombarc90c8e22019-05-21 11:28:48 -05001*** Settings ***
Steven Sombarb76d4df2019-08-06 15:03:47 -05002Documentation Inventory of hardware FRUs under redfish.
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
Steven Sombarb76d4df2019-08-06 15:03:47 -050020${min_num_power_supplies} 1
Steven Sombarc90c8e22019-05-21 11:28:48 -050021
22
23*** Test Cases ***
24
Steven Sombarecf10e32019-07-25 08:51:00 -050025
Steven Sombarb76d4df2019-08-06 15:03:47 -050026Verify CPU And Core Count
27 [Documentation] Get the total number of CPUs and cores in the system.
28 ... Verify counts are above minimums.
29 [Tags] Verify_CPU_And_Core_Count
Steven Sombarc90c8e22019-05-21 11:28:48 -050030
Steven Sombarb76d4df2019-08-06 15:03:47 -050031 # Select only CPUs with Health = "OK".
32 ${cpus_ok}= Filter Struct ${cpu_info} [('Health', 'OK')]
33 ${num_cpus}= Get Length ${cpus_ok}
Steven Sombarc90c8e22019-05-21 11:28:48 -050034
Steven Sombarb76d4df2019-08-06 15:03:47 -050035 Rprint Vars num_cpus min_num_cpus
Steven Sombarc90c8e22019-05-21 11:28:48 -050036
Steven Sombarb76d4df2019-08-06 15:03:47 -050037 # Assert that num_cpus is greater than or equal to min_num_cpus.
38 Valid Range num_cpus ${min_num_cpus}
Steven Sombar815fa632019-07-16 14:24:40 -050039
Steven Sombarb76d4df2019-08-06 15:03:47 -050040 # Get the number of cores.
Steven Sombar815fa632019-07-16 14:24:40 -050041 ${total_num_cores}= Set Variable ${0}
Sushma M Md27fc312020-06-19 08:26:50 -050042 FOR ${cpu} IN @{cpus_ok}
Steven Sombarb76d4df2019-08-06 15:03:47 -050043 ${cores}= Get CPU TotalCores ${cpu}
44 ${total_num_cores}= Evaluate $total_num_cores + ${cores}
Steven Sombar815fa632019-07-16 14:24:40 -050045 END
46
Steven Sombarb76d4df2019-08-06 15:03:47 -050047 Rprint Vars total_num_cores min_num_cores
Steven Sombarecf10e32019-07-25 08:51:00 -050048
Steven Sombarb76d4df2019-08-06 15:03:47 -050049 # Assert that total_num_cores is greater than or equal to
50 # min_num_cores.
51 Valid Range total_num_cores ${min_num_cores}
Steven Sombar815fa632019-07-16 14:24:40 -050052
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 Sombarc5d65842019-08-21 15:39:08 -050061Get Memory Summary State And Verify Enabled
62 [Documentation] Check that the state of the MemorySummary attribute
63 ... under /redfish/v1/Systems/system is 'Enabled'.
64 [Tags] Get_Memory_Summary_State_And_Verify_Enabled
65
66 ${status}= Redfish.Get Attribute ${SYSTEM_BASE_URI} MemorySummary
67 ${memory_summary_state}= Set Variable ${status['Status']['State']}
68 Rprint Vars memory_summary_state
69
70 Should Be Equal As Strings Enabled ${memory_summary_state}
71 ... msg=MemorySummary State is not 'Enabled'.
72
73
Steven Sombar815fa632019-07-16 14:24:40 -050074Get System Serial And Verify Populated
75 [Documentation] Check that the System SerialNumber is non-blank.
76 [Tags] Get_System_Serial_And_Verify_Populated
Steven Sombarbccfd512019-06-05 15:50:35 -050077
78 ${serial_number}= Redfish.Get Attribute ${SYSTEM_BASE_URI} SerialNumber
Michael Walshe7edb222019-08-19 17:39:38 -050079 Valid Value serial_number
Steven Sombarbccfd512019-06-05 15:50:35 -050080 Rprint Vars serial_number
81
82
83Get Model And Verify Populated
84 [Documentation] Check that the Model is non-blank.
85 [Tags] Get_Model_And_Verify_Populated
86
87 ${model}= Redfish.Get Attribute ${SYSTEM_BASE_URI} Model
Michael Walshe7edb222019-08-19 17:39:38 -050088 Valid Value model
Steven Sombarbccfd512019-06-05 15:50:35 -050089 Rprint Vars model
Steven Sombarc90c8e22019-05-21 11:28:48 -050090
91
Steven Sombar815fa632019-07-16 14:24:40 -050092Get Available Power Supplies And Verify
93 [Documentation] Get the number of functional power supplies and
94 ... verify that it is at or above the minimum.
95 [Tags] Get_Available_Power_Supplies_And_Verify
96
Steven Sombarb76d4df2019-08-06 15:03:47 -050097 # Select only power supplies with Health = "OK".
98 ${power_supplies_ok}= Filter Struct ${power_supplies} [('Health', 'OK')]
Steven Sombar815fa632019-07-16 14:24:40 -050099
Steven Sombarb76d4df2019-08-06 15:03:47 -0500100 # Count the power supplies that are Enabled or StandbyOffline.
101 ${total_num_supplies}= Set Variable ${0}
Sushma M Md27fc312020-06-19 08:26:50 -0500102 FOR ${power_supply} IN @{power_supplies_ok}
Steven Sombarb76d4df2019-08-06 15:03:47 -0500103 # Example of power_supply:
104 # power_supply = {'@odata.id': '/redfish/v1/Chassis/chassis/Power#/PowerSupplies/0',
105 # 'Manufacturer': '', 'MemberId': 'powersupply0', 'Model': '2100', 'Name':
106 # 'powersupply0', 'PartNumber': 'PNPWR123', 'PowerInputWatts': 394.0,
107 # 'SerialNumber': '75B12W', 'Status': {'Health': 'OK', 'State': 'Enabled'}}
108 ${state}= Set Variable ${power_supply['Status']['State']}
109 ${good_state}= Evaluate
110 ... any(x in '${state}' for x in ('Enabled', 'StandbyOffline'))
111 Run Keyword If not ${good_state} Continue For Loop
112 ${total_num_supplies}= Evaluate $total_num_supplies + ${1}
Steven Sombar815fa632019-07-16 14:24:40 -0500113 END
114
Steven Sombarb76d4df2019-08-06 15:03:47 -0500115 Rprint Vars total_num_supplies min_num_power_supplies
Steven Sombar815fa632019-07-16 14:24:40 -0500116
Steven Sombarb76d4df2019-08-06 15:03:47 -0500117 Valid Range total_num_supplies ${min_num_power_supplies}
Steven Sombar815fa632019-07-16 14:24:40 -0500118
119
120Get Motherboard Serial And Verify Populated
121 [Documentation] Check that the Motherboard SerialNumber is non-blank.
122 [Tags] Get_Motherboard_Serial_And_Verify_Populated
123
George Keishingd2f210a2022-02-23 10:44:10 -0600124 # Python module: get_endpoint_path_list(resource_path, end_point_prefix)
125 ${motherboard_list}= redfish_utils.Get Endpoint Path List ${REDFISH_CHASSIS_URI} motherboard
126
127 ${serial_number}= Redfish.Get Attribute ${motherboard_list[0]} SerialNumber
Michael Walshe7edb222019-08-19 17:39:38 -0500128 Valid Value serial_number
Steven Sombar815fa632019-07-16 14:24:40 -0500129 Rprint Vars serial_number
130
131
Steven Sombarc2ace202019-09-04 13:17:32 -0500132Verify Motherboard Manufacturer Field Value Populated
133 [Documentation] Check that the Motherboard manufacturer is non-blank.
134 [Tags] Verify_Motherboard_Manufacturer_Field_Value_Populated
135
George Keishingd2f210a2022-02-23 10:44:10 -0600136 # Python module: get_endpoint_path_list(resource_path, end_point_prefix)
137 ${motherboard_list}= redfish_utils.Get Endpoint Path List ${REDFISH_CHASSIS_URI} motherboard
138
139 ${motherboard_manufacturer}= Redfish.Get Attribute ${motherboard_list[0]} Manufacturer
Steven Sombarc2ace202019-09-04 13:17:32 -0500140 Valid Value motherboard_manufacturer
George Keishingd2f210a2022-02-23 10:44:10 -0600141 Rprint Vars motherboard_manufacturer
Steven Sombarc2ace202019-09-04 13:17:32 -0500142
143
144Verify Motherboard Partnumber Field Value Populated
145 [Documentation] Check that the Motherboard partnumber is non-blank.
146 [Tags] Verify_Motherboard_Partnumber_Field_Value_Populated
147
George Keishingd2f210a2022-02-23 10:44:10 -0600148 # Python module: get_endpoint_path_list(resource_path, end_point_prefix)
149 ${motherboard_list}= redfish_utils.Get Endpoint Path List ${REDFISH_CHASSIS_URI} motherboard
150
151 ${motherboard_part_number}= Redfish.Get Attribute ${motherboard_list[0]} PartNumber
Steven Sombarc2ace202019-09-04 13:17:32 -0500152 Valid Value motherboard_part_number
George Keishingd2f210a2022-02-23 10:44:10 -0600153 Rprint Vars motherboard_part_number
Steven Sombarc2ace202019-09-04 13:17:32 -0500154
155
Steven Sombarb76d4df2019-08-06 15:03:47 -0500156Check GPU States When Power On
157 [Documentation] Check the State of each of the GPUs
158 ... in the system. A system may have 0-6 GPUs.
159 [Tags] Check_GPU_States_When_Power_On
Steven Sombarecf10e32019-07-25 08:51:00 -0500160
Steven Sombarb76d4df2019-08-06 15:03:47 -0500161 # System was powered-on in Suite Setup.
162 GPU State Check
Steven Sombarecf10e32019-07-25 08:51:00 -0500163
Steven Sombarb76d4df2019-08-06 15:03:47 -0500164
165Check GPU States When Power Off
166 [Documentation] Check the State of the GPUs when power is Off.
167 [Tags] Check_GPU_States_When_Power_Off
168
169 Redfish Power Off
Steven Sombarb76d4df2019-08-06 15:03:47 -0500170 GPU State Check
Steven Sombarecf10e32019-07-25 08:51:00 -0500171
172
Steven Sombarc90c8e22019-05-21 11:28:48 -0500173*** Keywords ***
174
175
Steven Sombarecf10e32019-07-25 08:51:00 -0500176Get CPU TotalCores
177 [Documentation] Return the TotalCores of a CPU.
178 ... Return 0 if this attribute is missing or NONE.
179 [Arguments] ${processor}
180
181 # Description of Argument(s):
182 # processor The Redfish URI of a CPU (e.g.
183 # "/redfish/v1/Systems/system/Processors/cpu0").
184
185 ${total_cores}= Redfish.Get Attribute ${processor} TotalCores
186 Return From Keyword If ${total_cores} is ${NONE} ${0}
187 [Return] ${total_cores}
188
189
Steven Sombarb76d4df2019-08-06 15:03:47 -0500190GPU State Check
191 [Documentation] The state of every "OK" GPU should be
192 ... "Absent", "Enabled", or "UnavailableOffline".
193
194 # Select only GPUs with Health = "OK".
195 ${gpus_ok}= Filter Struct ${gpu_info} [('Health', 'OK')]
196
Sushma M Md27fc312020-06-19 08:26:50 -0500197 FOR ${gpu} IN @{gpus_ok}
Steven Sombarb76d4df2019-08-06 15:03:47 -0500198 ${status}= Redfish.Get Attribute ${gpu} Status
199 ${state}= Set Variable ${status['State']}
200 ${good_state}= Evaluate
201 ... any(x in '${state}' for x in ('Absent', 'Enabled', 'UnavailableOffline'))
202 Rprint Vars gpu state
203 Run Keyword If not ${good_state} Fail
204 ... msg=GPU State is not Absent, Enabled, or UnavailableOffline.
205 END
206
207
208Get Inventory URIs
209 [Documentation] Get and return a tuple of lists of URIs for CPU,
210 ... GPU and PowerSupplies.
211
212 ${processor_info}= Redfish_Utils.Enumerate Request
213 ... ${SYSTEM_BASE_URI}Processors return_json=0
214
215 ${cpu_info}= Filter Struct ${processor_info}
216 ... [('ProcessorType', 'CPU')] regex=1
217
218 ${gpu_info}= Filter Struct ${processor_info}
219 ... [('ProcessorType', 'Accelerator')] regex=1
220
221 ${power_supplies}= Redfish.Get Attribute
222 ... ${REDFISH_CHASSIS_POWER_URI} PowerSupplies
223
224 [Return] ${cpu_info} ${gpu_info} ${power_supplies}
225
226
Steven Sombarbccfd512019-06-05 15:50:35 -0500227Verify FRU Inventory Minimums
George Keishing3292d4a2019-06-19 02:04:53 -0500228 [Documentation] Verify a minimum number of FRUs.
Steven Sombarbccfd512019-06-05 15:50:35 -0500229 [Arguments] ${fru_type} ${min_num_frus}
Steven Sombarc90c8e22019-05-21 11:28:48 -0500230
231 # Description of Argument(s):
Steven Sombarbccfd512019-06-05 15:50:35 -0500232 # fru_type The type of FRU (e.g. "Processors", "Memory", etc.).
233 # min_num_frus The minimum acceptable number of FRUs found.
Steven Sombarc90c8e22019-05-21 11:28:48 -0500234
Steven Sombarbccfd512019-06-05 15:50:35 -0500235 # A valid FRU will have a "State" key of "Enabled" and a "Health" key
236 # of "OK".
Steven Sombarc90c8e22019-05-21 11:28:48 -0500237
Steven Sombarbccfd512019-06-05 15:50:35 -0500238 ${status} ${num_valid_frus}= Run Key U Get Num Valid FRUs \ ${fru_type}
Steven Sombarc90c8e22019-05-21 11:28:48 -0500239
Steven Sombarecf10e32019-07-25 08:51:00 -0500240 Rprint Vars fru_type num_valid_frus min_num_frus
241
Steven Sombarbccfd512019-06-05 15:50:35 -0500242 Return From Keyword If ${num_valid_frus} >= ${min_num_frus}
243 Fail Too few "${fru_type}" FRUs found, found only ${num_valid_frus}.
Steven Sombarc90c8e22019-05-21 11:28:48 -0500244
245
246Suite Teardown Execution
247 [Documentation] Do the post suite teardown.
248
249 Redfish.Logout
250
251
252Suite Setup Execution
253 [Documentation] Do test case setup tasks.
254
255 Redfish.Login
George Keishing07fb41f2020-06-16 08:09:19 -0500256 Redfish Power On stack_mode=skip
Steven Sombarecf10e32019-07-25 08:51:00 -0500257
Steven Sombarb76d4df2019-08-06 15:03:47 -0500258 ${cpu_info} ${gpu_info} ${power_supplies}= Get Inventory URIs
Steven Sombarecf10e32019-07-25 08:51:00 -0500259
Steven Sombarb76d4df2019-08-06 15:03:47 -0500260 Set Suite Variable ${cpu_info}
261 Set Suite Variable ${gpu_info}
262 Set Suite Variable ${power_supplies}
Steven Sombarc90c8e22019-05-21 11:28:48 -0500263
264
265Test Teardown Execution
266 [Documentation] Do the post test teardown.
267
268 FFDC On Test Case Fail