blob: 7142790450333c2381218c35eb6fd65797035fc6 [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
Igor Kanyukafeb79d62025-10-20 21:24:03 +010014Test Tags Systems_Inventory
15
Steven Sombarc90c8e22019-05-21 11:28:48 -050016*** Variables ***
17
18# The passing criteria. Must have at least this many.
Steven Sombarbccfd512019-06-05 15:50:35 -050019${min_num_dimms} 2
20${min_num_cpus} 1
Steven Sombar815fa632019-07-16 14:24:40 -050021${min_num_cores} 18
Steven Sombarb76d4df2019-08-06 15:03:47 -050022${min_num_power_supplies} 1
Steven Sombarc90c8e22019-05-21 11:28:48 -050023
24
25*** Test Cases ***
26
Steven Sombarb76d4df2019-08-06 15:03:47 -050027Verify CPU And Core Count
28 [Documentation] Get the total number of CPUs and cores in the system.
29 ... Verify counts are above minimums.
30 [Tags] Verify_CPU_And_Core_Count
Steven Sombarc90c8e22019-05-21 11:28:48 -050031
Steven Sombarb76d4df2019-08-06 15:03:47 -050032 # Select only CPUs with Health = "OK".
33 ${cpus_ok}= Filter Struct ${cpu_info} [('Health', 'OK')]
34 ${num_cpus}= Get Length ${cpus_ok}
Steven Sombarc90c8e22019-05-21 11:28:48 -050035
Steven Sombarb76d4df2019-08-06 15:03:47 -050036 Rprint Vars num_cpus min_num_cpus
Steven Sombarc90c8e22019-05-21 11:28:48 -050037
Steven Sombarb76d4df2019-08-06 15:03:47 -050038 # Assert that num_cpus is greater than or equal to min_num_cpus.
39 Valid Range num_cpus ${min_num_cpus}
Steven Sombar815fa632019-07-16 14:24:40 -050040
Steven Sombarb76d4df2019-08-06 15:03:47 -050041 # Get the number of cores.
Steven Sombar815fa632019-07-16 14:24:40 -050042 ${total_num_cores}= Set Variable ${0}
Sushma M Md27fc312020-06-19 08:26:50 -050043 FOR ${cpu} IN @{cpus_ok}
Steven Sombarb76d4df2019-08-06 15:03:47 -050044 ${cores}= Get CPU TotalCores ${cpu}
45 ${total_num_cores}= Evaluate $total_num_cores + ${cores}
Steven Sombar815fa632019-07-16 14:24:40 -050046 END
47
Steven Sombarb76d4df2019-08-06 15:03:47 -050048 Rprint Vars total_num_cores min_num_cores
Steven Sombarecf10e32019-07-25 08:51:00 -050049
Steven Sombarb76d4df2019-08-06 15:03:47 -050050 # Assert that total_num_cores is greater than or equal to
51 # min_num_cores.
52 Valid Range total_num_cores ${min_num_cores}
Steven Sombar815fa632019-07-16 14:24:40 -050053
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 Sombarc5d65842019-08-21 15:39:08 -050062Get Memory Summary State And Verify Enabled
63 [Documentation] Check that the state of the MemorySummary attribute
64 ... under /redfish/v1/Systems/system is 'Enabled'.
65 [Tags] Get_Memory_Summary_State_And_Verify_Enabled
66
67 ${status}= Redfish.Get Attribute ${SYSTEM_BASE_URI} MemorySummary
68 ${memory_summary_state}= Set Variable ${status['Status']['State']}
69 Rprint Vars memory_summary_state
70
71 Should Be Equal As Strings Enabled ${memory_summary_state}
72 ... msg=MemorySummary State is not 'Enabled'.
73
74
Steven Sombar815fa632019-07-16 14:24:40 -050075Get System Serial And Verify Populated
76 [Documentation] Check that the System SerialNumber is non-blank.
77 [Tags] Get_System_Serial_And_Verify_Populated
Steven Sombarbccfd512019-06-05 15:50:35 -050078
79 ${serial_number}= Redfish.Get Attribute ${SYSTEM_BASE_URI} SerialNumber
Michael Walshe7edb222019-08-19 17:39:38 -050080 Valid Value serial_number
Steven Sombarbccfd512019-06-05 15:50:35 -050081 Rprint Vars serial_number
82
83
84Get Model And Verify Populated
85 [Documentation] Check that the Model is non-blank.
86 [Tags] Get_Model_And_Verify_Populated
87
88 ${model}= Redfish.Get Attribute ${SYSTEM_BASE_URI} Model
Michael Walshe7edb222019-08-19 17:39:38 -050089 Valid Value model
Steven Sombarbccfd512019-06-05 15:50:35 -050090 Rprint Vars model
Steven Sombarc90c8e22019-05-21 11:28:48 -050091
92
Steven Sombar815fa632019-07-16 14:24:40 -050093Get Available Power Supplies And Verify
94 [Documentation] Get the number of functional power supplies and
95 ... verify that it is at or above the minimum.
96 [Tags] Get_Available_Power_Supplies_And_Verify
97
Steven Sombarb76d4df2019-08-06 15:03:47 -050098 # Select only power supplies with Health = "OK".
99 ${power_supplies_ok}= Filter Struct ${power_supplies} [('Health', 'OK')]
Steven Sombar815fa632019-07-16 14:24:40 -0500100
Steven Sombarb76d4df2019-08-06 15:03:47 -0500101 # Count the power supplies that are Enabled or StandbyOffline.
102 ${total_num_supplies}= Set Variable ${0}
Sushma M Md27fc312020-06-19 08:26:50 -0500103 FOR ${power_supply} IN @{power_supplies_ok}
Steven Sombarb76d4df2019-08-06 15:03:47 -0500104 # Example of power_supply:
105 # power_supply = {'@odata.id': '/redfish/v1/Chassis/chassis/Power#/PowerSupplies/0',
106 # 'Manufacturer': '', 'MemberId': 'powersupply0', 'Model': '2100', 'Name':
107 # 'powersupply0', 'PartNumber': 'PNPWR123', 'PowerInputWatts': 394.0,
108 # 'SerialNumber': '75B12W', 'Status': {'Health': 'OK', 'State': 'Enabled'}}
109 ${state}= Set Variable ${power_supply['Status']['State']}
110 ${good_state}= Evaluate
111 ... any(x in '${state}' for x in ('Enabled', 'StandbyOffline'))
Sridevi Rameshc6e7f932025-05-07 11:26:54 -0500112
Sridevi Rameshe54be142025-05-05 00:52:45 -0500113 IF not ${good_state} CONTINUE
Steven Sombarb76d4df2019-08-06 15:03:47 -0500114 ${total_num_supplies}= Evaluate $total_num_supplies + ${1}
Steven Sombar815fa632019-07-16 14:24:40 -0500115 END
116
Steven Sombarb76d4df2019-08-06 15:03:47 -0500117 Rprint Vars total_num_supplies min_num_power_supplies
Steven Sombar815fa632019-07-16 14:24:40 -0500118
Steven Sombarb76d4df2019-08-06 15:03:47 -0500119 Valid Range total_num_supplies ${min_num_power_supplies}
Steven Sombar815fa632019-07-16 14:24:40 -0500120
121
122Get Motherboard Serial And Verify Populated
123 [Documentation] Check that the Motherboard SerialNumber is non-blank.
124 [Tags] Get_Motherboard_Serial_And_Verify_Populated
125
George Keishing6ec9d702022-03-07 11:46:53 -0600126 ${serial_number}= Redfish.Get Attribute ${REDFISH_CHASSIS_URI}${CHASSIS_ID} SerialNumber
Michael Walshe7edb222019-08-19 17:39:38 -0500127 Valid Value serial_number
Steven Sombar815fa632019-07-16 14:24:40 -0500128 Rprint Vars serial_number
129
130
Steven Sombarc2ace202019-09-04 13:17:32 -0500131Verify Motherboard Manufacturer Field Value Populated
132 [Documentation] Check that the Motherboard manufacturer is non-blank.
133 [Tags] Verify_Motherboard_Manufacturer_Field_Value_Populated
134
George Keishing6ec9d702022-03-07 11:46:53 -0600135 ${motherboard_manufacturer}= Redfish.Get Attribute ${REDFISH_CHASSIS_URI}${CHASSIS_ID} Manufacturer
Steven Sombarc2ace202019-09-04 13:17:32 -0500136 Valid Value motherboard_manufacturer
George Keishingd2f210a2022-02-23 10:44:10 -0600137 Rprint Vars motherboard_manufacturer
Steven Sombarc2ace202019-09-04 13:17:32 -0500138
139
140Verify Motherboard Partnumber Field Value Populated
141 [Documentation] Check that the Motherboard partnumber is non-blank.
142 [Tags] Verify_Motherboard_Partnumber_Field_Value_Populated
143
George Keishing6ec9d702022-03-07 11:46:53 -0600144 ${motherboard_part_number}= Redfish.Get Attribute ${REDFISH_CHASSIS_URI}${CHASSIS_ID} PartNumber
Steven Sombarc2ace202019-09-04 13:17:32 -0500145 Valid Value motherboard_part_number
George Keishingd2f210a2022-02-23 10:44:10 -0600146 Rprint Vars motherboard_part_number
Steven Sombarc2ace202019-09-04 13:17:32 -0500147
148
Steven Sombarb76d4df2019-08-06 15:03:47 -0500149Check GPU States When Power On
150 [Documentation] Check the State of each of the GPUs
151 ... in the system. A system may have 0-6 GPUs.
152 [Tags] Check_GPU_States_When_Power_On
Steven Sombarecf10e32019-07-25 08:51:00 -0500153
Steven Sombarb76d4df2019-08-06 15:03:47 -0500154 # System was powered-on in Suite Setup.
155 GPU State Check
Steven Sombarecf10e32019-07-25 08:51:00 -0500156
Steven Sombarb76d4df2019-08-06 15:03:47 -0500157
158Check GPU States When Power Off
159 [Documentation] Check the State of the GPUs when power is Off.
160 [Tags] Check_GPU_States_When_Power_Off
161
162 Redfish Power Off
Steven Sombarb76d4df2019-08-06 15:03:47 -0500163 GPU State Check
Steven Sombarecf10e32019-07-25 08:51:00 -0500164
165
Steven Sombarc90c8e22019-05-21 11:28:48 -0500166*** Keywords ***
167
168
Steven Sombarecf10e32019-07-25 08:51:00 -0500169Get CPU TotalCores
170 [Documentation] Return the TotalCores of a CPU.
171 ... Return 0 if this attribute is missing or NONE.
172 [Arguments] ${processor}
173
174 # Description of Argument(s):
175 # processor The Redfish URI of a CPU (e.g.
176 # "/redfish/v1/Systems/system/Processors/cpu0").
177
178 ${total_cores}= Redfish.Get Attribute ${processor} TotalCores
Sridevi Rameshe54be142025-05-05 00:52:45 -0500179 IF ${total_cores} is ${NONE} RETURN ${0}
George Keishing409df052024-01-17 22:36:14 +0530180 RETURN ${total_cores}
Steven Sombarecf10e32019-07-25 08:51:00 -0500181
182
Steven Sombarb76d4df2019-08-06 15:03:47 -0500183GPU State Check
184 [Documentation] The state of every "OK" GPU should be
185 ... "Absent", "Enabled", or "UnavailableOffline".
186
187 # Select only GPUs with Health = "OK".
188 ${gpus_ok}= Filter Struct ${gpu_info} [('Health', 'OK')]
189
Sushma M Md27fc312020-06-19 08:26:50 -0500190 FOR ${gpu} IN @{gpus_ok}
Steven Sombarb76d4df2019-08-06 15:03:47 -0500191 ${status}= Redfish.Get Attribute ${gpu} Status
192 ${state}= Set Variable ${status['State']}
193 ${good_state}= Evaluate
194 ... any(x in '${state}' for x in ('Absent', 'Enabled', 'UnavailableOffline'))
195 Rprint Vars gpu state
Sridevi Rameshe54be142025-05-05 00:52:45 -0500196 IF not ${good_state}
197 Fail msg=GPU State is not Absent, Enabled, or UnavailableOffline.
198 END
Steven Sombarb76d4df2019-08-06 15:03:47 -0500199 END
200
201
202Get Inventory URIs
203 [Documentation] Get and return a tuple of lists of URIs for CPU,
204 ... GPU and PowerSupplies.
205
Sridevi Rameshe54be142025-05-05 00:52:45 -0500206
Steven Sombarb76d4df2019-08-06 15:03:47 -0500207 ${processor_info}= Redfish_Utils.Enumerate Request
208 ... ${SYSTEM_BASE_URI}Processors return_json=0
209
210 ${cpu_info}= Filter Struct ${processor_info}
211 ... [('ProcessorType', 'CPU')] regex=1
212
213 ${gpu_info}= Filter Struct ${processor_info}
214 ... [('ProcessorType', 'Accelerator')] regex=1
215
216 ${power_supplies}= Redfish.Get Attribute
Glukhov Mikhail148b5b82023-01-20 15:14:44 +0300217 ... ${REDFISH_CHASSIS_URI}${CHASSIS_ID}/Power PowerSupplies
Steven Sombarb76d4df2019-08-06 15:03:47 -0500218
George Keishing409df052024-01-17 22:36:14 +0530219 RETURN ${cpu_info} ${gpu_info} ${power_supplies}
Steven Sombarb76d4df2019-08-06 15:03:47 -0500220
221
Steven Sombarbccfd512019-06-05 15:50:35 -0500222Verify FRU Inventory Minimums
George Keishing3292d4a2019-06-19 02:04:53 -0500223 [Documentation] Verify a minimum number of FRUs.
Steven Sombarbccfd512019-06-05 15:50:35 -0500224 [Arguments] ${fru_type} ${min_num_frus}
Steven Sombarc90c8e22019-05-21 11:28:48 -0500225
226 # Description of Argument(s):
Steven Sombarbccfd512019-06-05 15:50:35 -0500227 # fru_type The type of FRU (e.g. "Processors", "Memory", etc.).
228 # min_num_frus The minimum acceptable number of FRUs found.
Steven Sombarc90c8e22019-05-21 11:28:48 -0500229
Steven Sombarbccfd512019-06-05 15:50:35 -0500230 # A valid FRU will have a "State" key of "Enabled" and a "Health" key
231 # of "OK".
Steven Sombarc90c8e22019-05-21 11:28:48 -0500232
Steven Sombarbccfd512019-06-05 15:50:35 -0500233 ${status} ${num_valid_frus}= Run Key U Get Num Valid FRUs \ ${fru_type}
Steven Sombarc90c8e22019-05-21 11:28:48 -0500234
Steven Sombarecf10e32019-07-25 08:51:00 -0500235 Rprint Vars fru_type num_valid_frus min_num_frus
236
Steven Sombarbccfd512019-06-05 15:50:35 -0500237 Return From Keyword If ${num_valid_frus} >= ${min_num_frus}
238 Fail Too few "${fru_type}" FRUs found, found only ${num_valid_frus}.
Steven Sombarc90c8e22019-05-21 11:28:48 -0500239
240
241Suite Teardown Execution
242 [Documentation] Do the post suite teardown.
243
244 Redfish.Logout
245
246
247Suite Setup Execution
248 [Documentation] Do test case setup tasks.
249
250 Redfish.Login
George Keishing07fb41f2020-06-16 08:09:19 -0500251 Redfish Power On stack_mode=skip
Steven Sombarecf10e32019-07-25 08:51:00 -0500252
Steven Sombarb76d4df2019-08-06 15:03:47 -0500253 ${cpu_info} ${gpu_info} ${power_supplies}= Get Inventory URIs
Steven Sombarecf10e32019-07-25 08:51:00 -0500254
Steven Sombarb76d4df2019-08-06 15:03:47 -0500255 Set Suite Variable ${cpu_info}
256 Set Suite Variable ${gpu_info}
257 Set Suite Variable ${power_supplies}
Steven Sombarc90c8e22019-05-21 11:28:48 -0500258
259
260Test Teardown Execution
261 [Documentation] Do the post test teardown.
262
263 FFDC On Test Case Fail