blob: 0c2224e28e55820913b3096b5f4c9a1a2faa3cbd [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 Sombarb76d4df2019-08-06 15:03:47 -050025Verify CPU And Core Count
26 [Documentation] Get the total number of CPUs and cores in the system.
27 ... Verify counts are above minimums.
28 [Tags] Verify_CPU_And_Core_Count
Steven Sombarc90c8e22019-05-21 11:28:48 -050029
Steven Sombarb76d4df2019-08-06 15:03:47 -050030 # Select only CPUs with Health = "OK".
31 ${cpus_ok}= Filter Struct ${cpu_info} [('Health', 'OK')]
32 ${num_cpus}= Get Length ${cpus_ok}
Steven Sombarc90c8e22019-05-21 11:28:48 -050033
Steven Sombarb76d4df2019-08-06 15:03:47 -050034 Rprint Vars num_cpus min_num_cpus
Steven Sombarc90c8e22019-05-21 11:28:48 -050035
Steven Sombarb76d4df2019-08-06 15:03:47 -050036 # Assert that num_cpus is greater than or equal to min_num_cpus.
37 Valid Range num_cpus ${min_num_cpus}
Steven Sombar815fa632019-07-16 14:24:40 -050038
Steven Sombarb76d4df2019-08-06 15:03:47 -050039 # Get the number of cores.
Steven Sombar815fa632019-07-16 14:24:40 -050040 ${total_num_cores}= Set Variable ${0}
Sushma M Md27fc312020-06-19 08:26:50 -050041 FOR ${cpu} IN @{cpus_ok}
Steven Sombarb76d4df2019-08-06 15:03:47 -050042 ${cores}= Get CPU TotalCores ${cpu}
43 ${total_num_cores}= Evaluate $total_num_cores + ${cores}
Steven Sombar815fa632019-07-16 14:24:40 -050044 END
45
Steven Sombarb76d4df2019-08-06 15:03:47 -050046 Rprint Vars total_num_cores min_num_cores
Steven Sombarecf10e32019-07-25 08:51:00 -050047
Steven Sombarb76d4df2019-08-06 15:03:47 -050048 # Assert that total_num_cores is greater than or equal to
49 # min_num_cores.
50 Valid Range total_num_cores ${min_num_cores}
Steven Sombar815fa632019-07-16 14:24:40 -050051
52
Steven Sombarc90c8e22019-05-21 11:28:48 -050053Get Memory Inventory Via Redfish And Verify
54 [Documentation] Get the number of DIMMs that are functional and enabled.
55 [Tags] Get_Memory_Inventory_Via_Redfish_And_Verify
56
Steven Sombarbccfd512019-06-05 15:50:35 -050057 Verify FRU Inventory Minimums Memory ${min_num_dimms}
58
59
Steven Sombarc5d65842019-08-21 15:39:08 -050060Get Memory Summary State And Verify Enabled
61 [Documentation] Check that the state of the MemorySummary attribute
62 ... under /redfish/v1/Systems/system is 'Enabled'.
63 [Tags] Get_Memory_Summary_State_And_Verify_Enabled
64
65 ${status}= Redfish.Get Attribute ${SYSTEM_BASE_URI} MemorySummary
66 ${memory_summary_state}= Set Variable ${status['Status']['State']}
67 Rprint Vars memory_summary_state
68
69 Should Be Equal As Strings Enabled ${memory_summary_state}
70 ... msg=MemorySummary State is not 'Enabled'.
71
72
Steven Sombar815fa632019-07-16 14:24:40 -050073Get System Serial And Verify Populated
74 [Documentation] Check that the System SerialNumber is non-blank.
75 [Tags] Get_System_Serial_And_Verify_Populated
Steven Sombarbccfd512019-06-05 15:50:35 -050076
77 ${serial_number}= Redfish.Get Attribute ${SYSTEM_BASE_URI} SerialNumber
Michael Walshe7edb222019-08-19 17:39:38 -050078 Valid Value serial_number
Steven Sombarbccfd512019-06-05 15:50:35 -050079 Rprint Vars serial_number
80
81
82Get Model And Verify Populated
83 [Documentation] Check that the Model is non-blank.
84 [Tags] Get_Model_And_Verify_Populated
85
86 ${model}= Redfish.Get Attribute ${SYSTEM_BASE_URI} Model
Michael Walshe7edb222019-08-19 17:39:38 -050087 Valid Value model
Steven Sombarbccfd512019-06-05 15:50:35 -050088 Rprint Vars model
Steven Sombarc90c8e22019-05-21 11:28:48 -050089
90
Steven Sombar815fa632019-07-16 14:24:40 -050091Get Available Power Supplies And Verify
92 [Documentation] Get the number of functional power supplies and
93 ... verify that it is at or above the minimum.
94 [Tags] Get_Available_Power_Supplies_And_Verify
95
Steven Sombarb76d4df2019-08-06 15:03:47 -050096 # Select only power supplies with Health = "OK".
97 ${power_supplies_ok}= Filter Struct ${power_supplies} [('Health', 'OK')]
Steven Sombar815fa632019-07-16 14:24:40 -050098
Steven Sombarb76d4df2019-08-06 15:03:47 -050099 # Count the power supplies that are Enabled or StandbyOffline.
100 ${total_num_supplies}= Set Variable ${0}
Sushma M Md27fc312020-06-19 08:26:50 -0500101 FOR ${power_supply} IN @{power_supplies_ok}
Steven Sombarb76d4df2019-08-06 15:03:47 -0500102 # Example of power_supply:
103 # power_supply = {'@odata.id': '/redfish/v1/Chassis/chassis/Power#/PowerSupplies/0',
104 # 'Manufacturer': '', 'MemberId': 'powersupply0', 'Model': '2100', 'Name':
105 # 'powersupply0', 'PartNumber': 'PNPWR123', 'PowerInputWatts': 394.0,
106 # 'SerialNumber': '75B12W', 'Status': {'Health': 'OK', 'State': 'Enabled'}}
107 ${state}= Set Variable ${power_supply['Status']['State']}
108 ${good_state}= Evaluate
109 ... any(x in '${state}' for x in ('Enabled', 'StandbyOffline'))
Sridevi Rameshe54be142025-05-05 00:52:45 -0500110 IF not ${good_state} CONTINUE
Steven Sombarb76d4df2019-08-06 15:03:47 -0500111 ${total_num_supplies}= Evaluate $total_num_supplies + ${1}
Steven Sombar815fa632019-07-16 14:24:40 -0500112 END
113
Steven Sombarb76d4df2019-08-06 15:03:47 -0500114 Rprint Vars total_num_supplies min_num_power_supplies
Steven Sombar815fa632019-07-16 14:24:40 -0500115
Steven Sombarb76d4df2019-08-06 15:03:47 -0500116 Valid Range total_num_supplies ${min_num_power_supplies}
Steven Sombar815fa632019-07-16 14:24:40 -0500117
118
119Get Motherboard Serial And Verify Populated
120 [Documentation] Check that the Motherboard SerialNumber is non-blank.
121 [Tags] Get_Motherboard_Serial_And_Verify_Populated
122
George Keishing6ec9d702022-03-07 11:46:53 -0600123 ${serial_number}= Redfish.Get Attribute ${REDFISH_CHASSIS_URI}${CHASSIS_ID} SerialNumber
Michael Walshe7edb222019-08-19 17:39:38 -0500124 Valid Value serial_number
Steven Sombar815fa632019-07-16 14:24:40 -0500125 Rprint Vars serial_number
126
127
Steven Sombarc2ace202019-09-04 13:17:32 -0500128Verify Motherboard Manufacturer Field Value Populated
129 [Documentation] Check that the Motherboard manufacturer is non-blank.
130 [Tags] Verify_Motherboard_Manufacturer_Field_Value_Populated
131
George Keishing6ec9d702022-03-07 11:46:53 -0600132 ${motherboard_manufacturer}= Redfish.Get Attribute ${REDFISH_CHASSIS_URI}${CHASSIS_ID} Manufacturer
Steven Sombarc2ace202019-09-04 13:17:32 -0500133 Valid Value motherboard_manufacturer
George Keishingd2f210a2022-02-23 10:44:10 -0600134 Rprint Vars motherboard_manufacturer
Steven Sombarc2ace202019-09-04 13:17:32 -0500135
136
137Verify Motherboard Partnumber Field Value Populated
138 [Documentation] Check that the Motherboard partnumber is non-blank.
139 [Tags] Verify_Motherboard_Partnumber_Field_Value_Populated
140
George Keishing6ec9d702022-03-07 11:46:53 -0600141 ${motherboard_part_number}= Redfish.Get Attribute ${REDFISH_CHASSIS_URI}${CHASSIS_ID} PartNumber
Steven Sombarc2ace202019-09-04 13:17:32 -0500142 Valid Value motherboard_part_number
George Keishingd2f210a2022-02-23 10:44:10 -0600143 Rprint Vars motherboard_part_number
Steven Sombarc2ace202019-09-04 13:17:32 -0500144
145
Steven Sombarb76d4df2019-08-06 15:03:47 -0500146Check GPU States When Power On
147 [Documentation] Check the State of each of the GPUs
148 ... in the system. A system may have 0-6 GPUs.
149 [Tags] Check_GPU_States_When_Power_On
Steven Sombarecf10e32019-07-25 08:51:00 -0500150
Steven Sombarb76d4df2019-08-06 15:03:47 -0500151 # System was powered-on in Suite Setup.
152 GPU State Check
Steven Sombarecf10e32019-07-25 08:51:00 -0500153
Steven Sombarb76d4df2019-08-06 15:03:47 -0500154
155Check GPU States When Power Off
156 [Documentation] Check the State of the GPUs when power is Off.
157 [Tags] Check_GPU_States_When_Power_Off
158
159 Redfish Power Off
Steven Sombarb76d4df2019-08-06 15:03:47 -0500160 GPU State Check
Steven Sombarecf10e32019-07-25 08:51:00 -0500161
162
Steven Sombarc90c8e22019-05-21 11:28:48 -0500163*** Keywords ***
164
165
Steven Sombarecf10e32019-07-25 08:51:00 -0500166Get CPU TotalCores
167 [Documentation] Return the TotalCores of a CPU.
168 ... Return 0 if this attribute is missing or NONE.
169 [Arguments] ${processor}
170
171 # Description of Argument(s):
172 # processor The Redfish URI of a CPU (e.g.
173 # "/redfish/v1/Systems/system/Processors/cpu0").
174
175 ${total_cores}= Redfish.Get Attribute ${processor} TotalCores
Sridevi Rameshe54be142025-05-05 00:52:45 -0500176 IF ${total_cores} is ${NONE} RETURN ${0}
George Keishing409df052024-01-17 22:36:14 +0530177 RETURN ${total_cores}
Steven Sombarecf10e32019-07-25 08:51:00 -0500178
179
Steven Sombarb76d4df2019-08-06 15:03:47 -0500180GPU State Check
181 [Documentation] The state of every "OK" GPU should be
182 ... "Absent", "Enabled", or "UnavailableOffline".
183
184 # Select only GPUs with Health = "OK".
185 ${gpus_ok}= Filter Struct ${gpu_info} [('Health', 'OK')]
186
Sushma M Md27fc312020-06-19 08:26:50 -0500187 FOR ${gpu} IN @{gpus_ok}
Steven Sombarb76d4df2019-08-06 15:03:47 -0500188 ${status}= Redfish.Get Attribute ${gpu} Status
189 ${state}= Set Variable ${status['State']}
190 ${good_state}= Evaluate
191 ... any(x in '${state}' for x in ('Absent', 'Enabled', 'UnavailableOffline'))
192 Rprint Vars gpu state
Sridevi Rameshe54be142025-05-05 00:52:45 -0500193 IF not ${good_state}
194 Fail msg=GPU State is not Absent, Enabled, or UnavailableOffline.
195 END
Steven Sombarb76d4df2019-08-06 15:03:47 -0500196 END
197
198
199Get Inventory URIs
200 [Documentation] Get and return a tuple of lists of URIs for CPU,
201 ... GPU and PowerSupplies.
202
Sridevi Rameshe54be142025-05-05 00:52:45 -0500203
Steven Sombarb76d4df2019-08-06 15:03:47 -0500204 ${processor_info}= Redfish_Utils.Enumerate Request
205 ... ${SYSTEM_BASE_URI}Processors return_json=0
206
207 ${cpu_info}= Filter Struct ${processor_info}
208 ... [('ProcessorType', 'CPU')] regex=1
209
210 ${gpu_info}= Filter Struct ${processor_info}
211 ... [('ProcessorType', 'Accelerator')] regex=1
212
213 ${power_supplies}= Redfish.Get Attribute
Glukhov Mikhail148b5b82023-01-20 15:14:44 +0300214 ... ${REDFISH_CHASSIS_URI}${CHASSIS_ID}/Power PowerSupplies
Steven Sombarb76d4df2019-08-06 15:03:47 -0500215
George Keishing409df052024-01-17 22:36:14 +0530216 RETURN ${cpu_info} ${gpu_info} ${power_supplies}
Steven Sombarb76d4df2019-08-06 15:03:47 -0500217
218
Steven Sombarbccfd512019-06-05 15:50:35 -0500219Verify FRU Inventory Minimums
George Keishing3292d4a2019-06-19 02:04:53 -0500220 [Documentation] Verify a minimum number of FRUs.
Steven Sombarbccfd512019-06-05 15:50:35 -0500221 [Arguments] ${fru_type} ${min_num_frus}
Steven Sombarc90c8e22019-05-21 11:28:48 -0500222
223 # Description of Argument(s):
Steven Sombarbccfd512019-06-05 15:50:35 -0500224 # fru_type The type of FRU (e.g. "Processors", "Memory", etc.).
225 # min_num_frus The minimum acceptable number of FRUs found.
Steven Sombarc90c8e22019-05-21 11:28:48 -0500226
Steven Sombarbccfd512019-06-05 15:50:35 -0500227 # A valid FRU will have a "State" key of "Enabled" and a "Health" key
228 # of "OK".
Steven Sombarc90c8e22019-05-21 11:28:48 -0500229
Steven Sombarbccfd512019-06-05 15:50:35 -0500230 ${status} ${num_valid_frus}= Run Key U Get Num Valid FRUs \ ${fru_type}
Steven Sombarc90c8e22019-05-21 11:28:48 -0500231
Steven Sombarecf10e32019-07-25 08:51:00 -0500232 Rprint Vars fru_type num_valid_frus min_num_frus
233
Steven Sombarbccfd512019-06-05 15:50:35 -0500234 Return From Keyword If ${num_valid_frus} >= ${min_num_frus}
235 Fail Too few "${fru_type}" FRUs found, found only ${num_valid_frus}.
Steven Sombarc90c8e22019-05-21 11:28:48 -0500236
237
238Suite Teardown Execution
239 [Documentation] Do the post suite teardown.
240
241 Redfish.Logout
242
243
244Suite Setup Execution
245 [Documentation] Do test case setup tasks.
246
247 Redfish.Login
George Keishing07fb41f2020-06-16 08:09:19 -0500248 Redfish Power On stack_mode=skip
Steven Sombarecf10e32019-07-25 08:51:00 -0500249
Steven Sombarb76d4df2019-08-06 15:03:47 -0500250 ${cpu_info} ${gpu_info} ${power_supplies}= Get Inventory URIs
Steven Sombarecf10e32019-07-25 08:51:00 -0500251
Steven Sombarb76d4df2019-08-06 15:03:47 -0500252 Set Suite Variable ${cpu_info}
253 Set Suite Variable ${gpu_info}
254 Set Suite Variable ${power_supplies}
Steven Sombarc90c8e22019-05-21 11:28:48 -0500255
256
257Test Teardown Execution
258 [Documentation] Do the post test teardown.
259
260 FFDC On Test Case Fail