blob: 54037672f448382e5f862f1d2d45385be44e07fb [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
George Keishingc8166ed2017-02-24 03:53:38 -06002Documentation System inventory related test.
3
Chris Austenb29d2e82016-06-07 12:25:35 -05004Resource ../lib/rest_client.robot
5Resource ../lib/utils.robot
Rahul Maheshwari908df572017-02-16 04:41:54 -06006Resource ../lib/state_manager.robot
George Keishingd55a4be2016-08-26 03:28:17 -05007Resource ../lib/openbmc_ffdc.robot
Sweta Potthuri654cbc02017-06-15 10:10:55 -05008Resource ../lib/list_utils.robot
George Keishingefa97352017-03-13 07:13:03 -05009Library ../lib/utilities.py
Chris Austenb29d2e82016-06-07 12:25:35 -050010
11Variables ../data/variables.py
George Keishingc8166ed2017-02-24 03:53:38 -060012Variables ../data/inventory.py
Chris Austenb29d2e82016-06-07 12:25:35 -050013
George Keishingc8166ed2017-02-24 03:53:38 -060014Suite setup Test Suite Setup
Rahul Maheshwari908df572017-02-16 04:41:54 -060015Test Teardown FFDC On Test Case Fail
Chris Austenb29d2e82016-06-07 12:25:35 -050016
Rahul Maheshwari3e9b0de2017-03-20 06:25:44 -050017Force Tags Inventory
18
Sweta Potthuri654cbc02017-06-15 10:10:55 -050019***Variables***
20
21${LOOP_COUNT} ${1}
22
Chris Austenb29d2e82016-06-07 12:25:35 -050023*** Test Cases ***
24
George Keishingc8166ed2017-02-24 03:53:38 -060025Verify System Inventory Path
26 [Documentation] Check if system inventory path exist.
27 [Tags] Verify_System_Inventory_Path
28 # When the host is booted, system inventory path should exist.
29 # Example: /xyz/openbmc_project/inventory/system
30 Get Inventory system
Chris Austenb29d2e82016-06-07 12:25:35 -050031
Rahul Maheshwaribb20f732016-10-24 06:27:14 -050032
George Keishingc8166ed2017-02-24 03:53:38 -060033Verify Chassis Motherboard Properties
34 [Documentation] Check if chassis motherboard properties are
35 ... populated valid.
36 [Tags] Verify_Chassis_Motherboard_Properties
37 # When the host is booted, the following properties should
38 # be populated Manufacturer, PartNumber, SerialNumber and
39 # it should not be zero's.
40 # Example:
41 # "data": {
42 # "/xyz/openbmc_project/inventory/system/chassis/motherboard": {
43 # "BuildDate": "",
44 # "Manufacturer": "0000000000000000",
45 # "Model": "",
46 # "PartNumber": "0000000",
47 # "Present": 0,
48 # "PrettyName": "SYSTEM PLANAR ",
49 # "SerialNumber": "000000000000"
50 # }
51 ${properties}= Get Inventory system/chassis/motherboard
52 Should Not Be Equal As Strings
53 ... ${properties["data"]["Manufacturer"]} 0000000000000000
54 ... msg=motherboard field invalid.
55 Should Not Be Equal As Strings
56 ... ${properties["data"]["PartNumber"]} 0000000
57 ... msg=motherboard part number invalid.
58 Should Not Be Equal As Strings
59 ... ${properties["data"]["SerialNumber"]} 000000000000
60 ... msg=motherboard serial number invalid.
Chris Austenb29d2e82016-06-07 12:25:35 -050061
George Keishingae355302017-03-13 04:34:58 -050062Verify CPU Present
63 [Documentation] Check if the FRU "Present" is set for CPU's.
64 [Tags] Verify_CPU_Present
65 # System inventory cpu list:
66 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
67 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
68 # Example:
69 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0": {
70 # "FieldReplaceable": 1,
71 # "BuildDate": "",
72 # "Cached": 0,
73 # "SerialNumber": "YA3933741574",
74 # "Version": "10",
75 # "Model": "",
76 # "PrettyName": "PROCESSOR MODULE",
77 # "PartNumber": "01HL322",
78 # "Present": 1,
79 # "Manufacturer": "IBM"
80 # },
81 # The CPU properties "Present" should be boolean 1.
82
83 ${cpu_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system cpu
84 :FOR ${cpu_uri} IN @{cpu_list}
85 \ ${present}= Read Attribute ${cpu_uri} Present
86 \ Should Be True ${present}
87
88
89Verify DIMM Present
90 [Documentation] Check if the FRU "Present" is set for DIMM's.
91 [Tags] Verify_DIMM_Present
92 # Example:
93 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
94 # "FieldReplaceable": 1,
95 # "BuildDate": "",
96 # "Cached": 0,
97 # "SerialNumber": "0x0300cf4f",
98 # "Version": "0x00",
99 # "Model": "M393A1G40EB1-CRC ",
100 # "PrettyName": "0x0c",
101 # "PartNumber": "",
102 # "Present": 1,
103 # "Manufacturer": "0xce80"
104 # },
105
106 # The DIMM properties "Present" should be boolean 1.
107
108 ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm
109 :FOR ${dimm_uri} IN @{dimm_list}
110 \ ${present}= Read Attribute ${dimm_uri} Present
111 \ Should Be True ${present}
112
113
George Keishingefa97352017-03-13 07:13:03 -0500114Verify FRU Properties
115 [Documentation] Verify the FRU properties fields.
116 [Tags] Verify_FRU_Properties
117 # Example:
118 # A FRU would have "FieldReplaceable" set to boolean 1 and should have
119 # the following entries
120 # "fru": [
121 # "FieldReplaceable"
122 # "BuildDate",
123 # "Cached"
124 # "SerialNumber",
125 # "Version",
126 # "Model",
127 # "PrettyName",
128 # "PartNumber",
129 # "Present",
130 # "Manufacturer",
131 # ]
132 # and FRU which doesn't have one of this fields is an error.
133 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
134 # "FieldReplaceable": 1,
135 # "BuildDate": "",
136 # "Cached": 0,
137 # "SerialNumber": "0x0300cf4f",
138 # "Version": "0x00",
139 # "Model": "M393A1G40EB1-CRC ",
140 # "PrettyName": "0x0c",
141 # "PartNumber": "",
142 # "Present": 1,
143 # "Manufacturer": "0xce80"
144 # },
145
146 ${system_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system *
147 ${fru_list}= Qualified FRU List @{system_list}
148 Validate FRU Properties Fields @{fru_list}
149
George Keishing071d8da2017-03-24 09:13:16 -0500150
151Verify Core Functional State
152 [Documentation] Verify that "Present" core property is set if "Functional"
153 ... core property is set.
154 [Tags] Verify_Core_Functional_State
155 # Example:
156 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core5":{
157 # "Functional": 1,
158 # "Present": 1,
159 # "PrettyName": ""
160 # },
161 ${core_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system core
162 :FOR ${core_uri} IN @{core_list}
163 \ ${status}= Run Keyword And Return Status
164 ... Check URL Property If Functional ${core_uri}
George Keishingc5658392017-04-27 23:05:18 -0500165 \ Continue For Loop If '${status}' == '${False}'
George Keishing071d8da2017-03-24 09:13:16 -0500166 \ ${present}= Read Attribute ${core_uri} Present
167 \ Should Be True ${present}
168 ... msg=${core_uri} is functional but not present.
169
170
171Verify DIMM Functional State
172 [Documentation] Verify that "Present" DIMM property is set if "Functional"
173 ... DIMM property is set.
174 [Tags] Verify_DIMM_Functional_State
175 # Example:
176 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
177 # "BuildDate": "",
178 # "Cached": 0,
179 # "FieldReplaceable": 1,
180 # "Functional": 1,
181 # "Manufacturer": "0xce80",
182 # "Model": "M393A1G40EB1-CRC ",
183 # "PartNumber": "",
184 # "Present": 1,
185 # "PrettyName": "0x0c",
186 # "SerialNumber": "0x0300cf4f",
187 # "Version": "0x00"
188 # },
189
190 ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm
191 :FOR ${dimm_uri} IN @{dimm_list}
192 \ ${status}= Run Keyword And Return Status
193 ... Check URL Property If Functional ${dimm_uri}
George Keishingc5658392017-04-27 23:05:18 -0500194 \ Continue For Loop If '${status}' == '${False}'
George Keishing071d8da2017-03-24 09:13:16 -0500195 \ ${present}= Read Attribute ${dimm_uri} Present
196 \ Should Be True ${present}
197 ... msg=${dimm_uri} is functional but not present.
198
George Keishing3c205b12017-05-13 04:09:33 -0500199
200Verify Fan Functional State
201 [Documentation] Verify that "Present" fan property is set if "Functional"
202 ... fan property is set.
203 [Tags] Verify_Fan_Functional_State
204 # Example:
205 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/fan0": {
206 # "Functional": 1,
207 # "Present": 1,
208 # "PrettyName": "fan0"
209 # },
210
211 ${fan_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system fan*
212 Should Not Be Empty ${fan_list}
213 :FOR ${fan_uri} IN @{fan_list}
214 \ ${status}= Run Keyword And Return Status
215 ... Check URL Property If Functional ${fan_uri}
216 \ Continue For Loop If '${status}' == '${False}'
217 \ ${present}= Read Attribute ${fan_uri} Present
218 \ Should Be True ${present}
219 ... msg=${fan_uri} is functional but "Present" is not set.
220
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500221Verify Inventory List After Reboot
222 [Documentation] Verify Inventory List After Reboot
223 [Tags] Verify_Inventory_List_After_Reboot
224
225 Repeat Keyword ${LOOP_COUNT} times Verify Inventory List Before And After Reboot
George Keishing3c205b12017-05-13 04:09:33 -0500226
George Keishing04c6b2c2017-06-15 12:33:59 -0500227Check Air Or Water Cooled
228 [Documentation] Check if this system is Air or water cooled.
229 [Tags] Check_Air_Or_Water_Cooled
230 # Example:
231 # "/xyz/openbmc_project/inventory/system/chassis": {
232 # "AirCooled": 1,
233 # "WaterCooled": 0
234 # },
235
236 ${air_cooled}= Read Attribute
237 ... /xyz/openbmc_project/inventory/system/chassis AirCooled
238 Log AirCooled:${air_cooled}
239
240 ${water_cooled}= Read Attribute
241 ... /xyz/openbmc_project/inventory/system/chassis WaterCooled
242 Log WaterCooled:${water_cooled}
243
244 Run Keyword If ${air_cooled}==${0} and ${water_cooled}==${0}
245 ... Fail Neither AirCooled or WaterCooled.
246
247
Chris Austenb29d2e82016-06-07 12:25:35 -0500248*** Keywords ***
249
George Keishingc8166ed2017-02-24 03:53:38 -0600250Test Suite Setup
251 [Documentation] Do the initial suite setup.
George Keishing25577a22017-07-12 05:18:46 -0500252
253 # Reboot host to re-power on clean if host is not "off".
George Keishingc8166ed2017-02-24 03:53:38 -0600254 ${current_state}= Get Host State
255 Run Keyword If '${current_state}' == 'Off'
256 ... Initiate Host Boot
George Keishing25577a22017-07-12 05:18:46 -0500257 ... ELSE Initiate Host Reboot
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500258
George Keishingcaac9f32017-03-09 02:14:27 -0600259 Wait Until Keyword Succeeds
260 ... 10 min 10 sec Is OS Starting
261
Chris Austenb29d2e82016-06-07 12:25:35 -0500262
George Keishingc8166ed2017-02-24 03:53:38 -0600263Get Inventory
264 [Documentation] Get the properties of an endpoint.
265 [Arguments] ${endpoint}
266 # Description of arguments:
267 # endpoint string for which url path ending.
268 # Example: "system" is the endpoint for url
269 # /xyz/openbmc_project/inventory/system
270 ${resp}= OpenBMC Get Request ${HOST_INVENTORY_URI}${endpoint}
271 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
272 ${jsondata}= To JSON ${resp.content}
273 [Return] ${jsondata}
George Keishingefa97352017-03-13 07:13:03 -0500274
275
276Qualified FRU List
277 [Documentation] Build the list of valid FRUs.
278 [Arguments] @{system_list}
279 # Description of arguments:
280 # system_list List of system inventory URLs.
281 # Example:
282 # /xyz/openbmc_project/inventory/system/chassis/motherboard
283 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
284 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
285 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
286 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm1
287 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm2
288 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm3
289 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm4
290 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm5
291 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm6
292 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm7
293
294 ${fru_list}= Create List
295 :FOR ${fru_uri} IN @{system_list}
George Keishingdf5ab122017-04-17 04:01:11 -0500296 \ ${resp}= OpenBMC Get Request ${fru_uri}/attr/FieldReplaceable
297 \ ${jsondata}= To JSON ${resp.content}
298 \ ${status}= Run Keyword And Return Status
299 ... Should Be True ${jsondata['data']} == ${1}
George Keishingefa97352017-03-13 07:13:03 -0500300 \ Run Keyword If '${status}' == '${True}'
301 ... Append To List ${fru_list} ${fru_uri}
302
303 [Return] ${fru_list}
304
305
306Validate FRU Properties Fields
307 [Documentation] Compare valid FRUs from system vs expected FRU set.
308 [Arguments] @{fru_list}
309 # Description of arguments:
310 # fru_list List of qualified FRU URLs.
311
312 # Build the pre-defined set list from data/inventory.py derived from
313 # a group of YAML files.
314 # Example:
315 # set(['Version', 'PartNumber', 'SerialNumber', 'FieldReplaceable',
316 # 'BuildDate', 'Present', 'Manufacturer', 'PrettyName', 'Cached', 'Model'])
317 ${fru_set}= List To Set ${inventory_dict['fru']}
318
319 # Iterate through the FRU's url and compare the set dictionary keys
320 # with the pre-define inventory data.
321 :FOR ${fru_url_path} IN @{fru_list}
322 \ ${fru_field}= Read Properties ${fru_url_path}
323 # ------------------------------------------------------------
324 # ${fru_field.viewkeys()} extracts the list of keys from the
325 # JSON dictionary as a set.
326 # ------------------------------------------------------------
327 \ Should Be Equal ${fru_field.viewkeys()} ${fru_set}
328
George Keishing071d8da2017-03-24 09:13:16 -0500329
330Check URL Property If Functional
331 [Arguments] ${url_path}
332 # Description of arguments:
333 # url_path Full url path of the inventory object.
334 # Example: DIMM / core property url's
335 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
336 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core0
337 ${state}= Read Attribute ${url_path} Functional
338 Should Be True ${state}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500339
340Verify Inventory List Before And After Reboot
341 [Documentation] Verify Inventory list before and after reboot.
342
343 Initiate Host Boot
344 Wait Until Keyword Succeeds 10 min 10 sec Is OS Starting
345 ${inv_before}= Get URL List ${HOST_INVENTORY_URI}
346 Initiate Host Reboot
347 Wait Until Keyword Succeeds 10 min 10 sec Is OS Starting
348 ${inv_after}= Get URL List ${HOST_INVENTORY_URI}
349 Lists Should Be Equal ${inv_before} ${inv_after}