blob: 1b23246d0d4b1f35899a0b2ac881ec2b803582c3 [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
11Test Teardown Test Teardown Execution
12
13*** Variables ***
14
15# The passing criteria. Must have at least this many.
Steven Sombarbccfd512019-06-05 15:50:35 -050016${min_num_dimms} 2
17${min_num_cpus} 1
Steven Sombar815fa632019-07-16 14:24:40 -050018${min_num_cores} 18
19${min_num_powersupplies} 1
Steven Sombarc90c8e22019-05-21 11:28:48 -050020
21
22*** Test Cases ***
23
24Get Processor Inventory Via Redfish And Verify
25 [Documentation] Get the number of CPUs that are functional and enabled.
26 [Tags] Get_Processor_Inventory_Via_Redfish_And_Verify
27
Steven Sombarbccfd512019-06-05 15:50:35 -050028 Verify FRU Inventory Minimums Processors ${min_num_cpus}
Steven Sombarc90c8e22019-05-21 11:28:48 -050029
30
Steven Sombar815fa632019-07-16 14:24:40 -050031Get Available CPU Cores And Verify
32 [Documentation] Get the total number of cores in the system and
33 ... verify that it is at or above the minimum.
34 [Tags] Get_Available_CPU_Cores_And_Verify
35
36 ${total_num_cores}= Set Variable ${0}
37
George Keishing58b54072019-07-25 04:48:38 -050038 # Example of processor member list:
39 # /redfish/v1/Systems/system/Processors/cpu0
40 # /redfish/v1/Systems/system/Processors/cpu1
41 # /redfish/v1/Systems/system/Processors/gv100card0
42 # /redfish/v1/Systems/system/Processors/gv100card1
43 # /redfish/v1/Systems/system/Processors/gv100card2
44 # /redfish/v1/Systems/system/Processors/gv100card3
45 # /redfish/v1/Systems/system/Processors/gv100card4
46 # /redfish/v1/Systems/system/Processors/gv100card5
47
Steven Sombar815fa632019-07-16 14:24:40 -050048 ${processor_uris}=
49 ... Redfish_Utils.Get Member List ${SYSTEM_BASE_URI}Processors
George Keishing58b54072019-07-25 04:48:38 -050050
51 ${cpu_list}= Get Matches ${processor_uris} *cpu*
52
Steven Sombar815fa632019-07-16 14:24:40 -050053 # Example of processor_uris:
54 # /redfish/v1/Systems/system/Processors/cpu0
55 # /redfish/v1/Systems/system/Processors/cpu1
56
George Keishing58b54072019-07-25 04:48:38 -050057 :FOR ${processor} IN @{cpu_list}
Steven Sombar815fa632019-07-16 14:24:40 -050058 # If the status of the processor is "OK" and "Enabled", get its number
59 # of cores.
60 ${status}= Redfish.Get Attribute ${processor} Status
61 ${processor_cores}= Run Keyword If
62 ... "${status['Health']}" == "OK" and "${status['State']}" == "Enabled"
63 ... Redfish.Get Attribute ${processor} TotalCores
64 ... ELSE
65 ... Set Variable ${0}
66 # Add the number of processor_cores to the total.
67 ${total_num_cores}= Evaluate $total_num_cores + $processor_cores
68 END
69
70 Rprint Vars total_num_cores
71 Run Keyword If ${total_num_cores} < ${min_num_cores}
72 ... Fail Too few CPU cores found.
73
74
Steven Sombarc90c8e22019-05-21 11:28:48 -050075Get Memory Inventory Via Redfish And Verify
76 [Documentation] Get the number of DIMMs that are functional and enabled.
77 [Tags] Get_Memory_Inventory_Via_Redfish_And_Verify
78
Steven Sombarbccfd512019-06-05 15:50:35 -050079 Verify FRU Inventory Minimums Memory ${min_num_dimms}
80
81
Steven Sombar815fa632019-07-16 14:24:40 -050082Get System Serial And Verify Populated
83 [Documentation] Check that the System SerialNumber is non-blank.
84 [Tags] Get_System_Serial_And_Verify_Populated
Steven Sombarbccfd512019-06-05 15:50:35 -050085
86 ${serial_number}= Redfish.Get Attribute ${SYSTEM_BASE_URI} SerialNumber
87 Rvalid Value serial_number
88 Rprint Vars serial_number
89
90
91Get Model And Verify Populated
92 [Documentation] Check that the Model is non-blank.
93 [Tags] Get_Model_And_Verify_Populated
94
95 ${model}= Redfish.Get Attribute ${SYSTEM_BASE_URI} Model
96 Rvalid Value model
97 Rprint Vars model
Steven Sombarc90c8e22019-05-21 11:28:48 -050098
99
Steven Sombar815fa632019-07-16 14:24:40 -0500100Get Available Power Supplies And Verify
101 [Documentation] Get the number of functional power supplies and
102 ... verify that it is at or above the minimum.
103 [Tags] Get_Available_Power_Supplies_And_Verify
104
105 ${total_num_supplies}= Set Variable ${0}
106
107 ${chassis_uris}= Redfish_Utils.Get Member List ${REDFISH_CHASSIS_URI}
108 # Example of chassis_uris:
109 # /redfish/v1/Chassis/chasis
110 # /redfish/v1/Chassis/motherboard
111 # /redfish/v1/Chassis/powersupply0
112
113 :FOR ${chassis_uri} IN @{chassis_uris}
114 ${is_supply}= Evaluate "powersupply" in $chassis_uri
115 ${is_functional}= Run Keyword If ${is_supply}
116 ... Check If Power Supply Is Functional ${chassis_uri}
117 ... ELSE
118 ... Set Variable ${0}
119 ${total_num_supplies}= Evaluate $total_num_supplies + $is_functional
120 END
121
122 Rprint Vars total_num_supplies
123
124 Run Keyword If ${total_num_supplies} < ${min_num_powersupplies}
125 ... Fail Too few power supplies found.
126
127
128Get Motherboard Serial And Verify Populated
129 [Documentation] Check that the Motherboard SerialNumber is non-blank.
130 [Tags] Get_Motherboard_Serial_And_Verify_Populated
131
132 ${serial_number}= Redfish.Get Attribute
133 ... ${REDFISH_CHASSIS_URI}motherboard SerialNumber
134 Rvalid Value serial_number
135 Rprint Vars serial_number
136
137
Steven Sombarc90c8e22019-05-21 11:28:48 -0500138*** Keywords ***
139
140
Steven Sombarbccfd512019-06-05 15:50:35 -0500141Verify FRU Inventory Minimums
George Keishing3292d4a2019-06-19 02:04:53 -0500142 [Documentation] Verify a minimum number of FRUs.
Steven Sombarbccfd512019-06-05 15:50:35 -0500143 [Arguments] ${fru_type} ${min_num_frus}
Steven Sombarc90c8e22019-05-21 11:28:48 -0500144
145 # Description of Argument(s):
Steven Sombarbccfd512019-06-05 15:50:35 -0500146 # fru_type The type of FRU (e.g. "Processors", "Memory", etc.).
147 # min_num_frus The minimum acceptable number of FRUs found.
Steven Sombarc90c8e22019-05-21 11:28:48 -0500148
Steven Sombarbccfd512019-06-05 15:50:35 -0500149 # A valid FRU will have a "State" key of "Enabled" and a "Health" key
150 # of "OK".
Steven Sombarc90c8e22019-05-21 11:28:48 -0500151
Steven Sombarbccfd512019-06-05 15:50:35 -0500152 ${status} ${num_valid_frus}= Run Key U Get Num Valid FRUs \ ${fru_type}
Steven Sombarc90c8e22019-05-21 11:28:48 -0500153
Steven Sombarbccfd512019-06-05 15:50:35 -0500154 Return From Keyword If ${num_valid_frus} >= ${min_num_frus}
155 Fail Too few "${fru_type}" FRUs found, found only ${num_valid_frus}.
Steven Sombarc90c8e22019-05-21 11:28:48 -0500156
157
Steven Sombar815fa632019-07-16 14:24:40 -0500158Check If Power Supply Is Functional
159 [Documentation] Return 1 if a power supply is OK and either
160 ... Enabled or StandbyOffline. Return 0 otherwise.
161 [Arguments] ${chassis_uri}
162
163 # Description of Argument(s):
164 # chassis_uri The Redfish uri of a power supply
165 # (e.g. "/redfish/v1/Chassis/powersupply0").
166
167 ${status}= Redfish.Get Attribute ${chassis_uri} Status
168
169 ${state_check}= Set Variable "${status['Health']}" == "OK" and
170 ${state_check}= Catenate ${state_check} ("${status['State']}" == "StandbyOffline" or
171 ${state_check}= Catenate ${state_check} "${status['State']}" == "Enabled")
172
173 ${is_functional}= Run Keyword If ${state_check}
174 ... Set Variable ${1}
175 ... ELSE
176 ... Set Variable ${0}
177
178 [Return] ${is_functional}
179
180
Steven Sombarc90c8e22019-05-21 11:28:48 -0500181Suite Teardown Execution
182 [Documentation] Do the post suite teardown.
183
184 Redfish.Logout
185
186
187Suite Setup Execution
188 [Documentation] Do test case setup tasks.
189
190 Redfish.Login
Steven Sombarbccfd512019-06-05 15:50:35 -0500191 Printn
Steven Sombarc90c8e22019-05-21 11:28:48 -0500192
193
194Test Teardown Execution
195 [Documentation] Do the post test teardown.
196
197 FFDC On Test Case Fail