blob: 32a2d9c169f4d280772bc40088e6ead1b79aa5e9 [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
Sweta Potthuriaf741cb2017-07-04 09:41:17 -05009Resource ../lib/boot_utils.robot
George Keishingefa97352017-03-13 07:13:03 -050010Library ../lib/utilities.py
Chris Austenb29d2e82016-06-07 12:25:35 -050011
12Variables ../data/variables.py
George Keishingc8166ed2017-02-24 03:53:38 -060013Variables ../data/inventory.py
Chris Austenb29d2e82016-06-07 12:25:35 -050014
George Keishingc8166ed2017-02-24 03:53:38 -060015Suite setup Test Suite Setup
Rahul Maheshwari908df572017-02-16 04:41:54 -060016Test Teardown FFDC On Test Case Fail
Chris Austenb29d2e82016-06-07 12:25:35 -050017
Rahul Maheshwari3e9b0de2017-03-20 06:25:44 -050018Force Tags Inventory
19
Sweta Potthuri654cbc02017-06-15 10:10:55 -050020***Variables***
21
Sweta Potthuriaf741cb2017-07-04 09:41:17 -050022${stack_mode} skip
Sweta Potthuri654cbc02017-06-15 10:10:55 -050023${LOOP_COUNT} ${1}
24
Chris Austenb29d2e82016-06-07 12:25:35 -050025*** Test Cases ***
26
George Keishingc8166ed2017-02-24 03:53:38 -060027Verify System Inventory Path
28 [Documentation] Check if system inventory path exist.
29 [Tags] Verify_System_Inventory_Path
30 # When the host is booted, system inventory path should exist.
31 # Example: /xyz/openbmc_project/inventory/system
32 Get Inventory system
Chris Austenb29d2e82016-06-07 12:25:35 -050033
Rahul Maheshwaribb20f732016-10-24 06:27:14 -050034
George Keishing3d734312017-07-24 04:10:25 -050035Verify Boxelder Present Property
36 [Documentation] Boxelder should be present by default.
37 [Tags] Verify that boxelder 'Present' property is present by default.
38 # Example:
39 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc":
40 # {
41 # "BuildDate": "",
42 # "FieldReplaceable": 0,
43 # "Manufacturer": "IBM",
44 # "Model": "",
45 # "PartNumber": "01DH051",
46 # "Present": 1,
47 # "PrettyName": "BMC PLANAR ",
48 # "SerialNumber": "000000000000"
49 # },
50 ${json_data}= Get Inventory system/chassis/motherboard/boxelder/bmc
51 Should Be True ${json_data["data"]["Present"]}
52
53
54Verify Boxelder MAC Address Property Is Populated
55 [Documentation] Boxelder should be present by default.
56 [Tags] Verify_Boxelder_MAC_Address_Property_Is_Populated
57 # Example:
58 # /xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc/ethernet
59 # {
60 # "FieldReplaceable": 0,
61 # "MACAddress": "00:00:00:00:00:00",
62 # "Present": 1,
63 # "PrettyName": ""
64 # }
65
66 ${json_data}= Get Inventory
67 ... system/chassis/motherboard/boxelder/bmc/ethernet
68 Should Be True ${json_data["data"]["Present"]}
69 Should Not Be Equal As Strings
70 ... ${json_data["data"]["MACAddress"]} 00:00:00:00:00:00
71
72 # eth0 Link encap:Ethernet HWaddr 70:E2:84:14:23:F9
73 ${mac_addr} ${stderr} ${rc}= BMC Execute Command
74 ... /sbin/ifconfig -a | grep HWaddr | awk -F'HWaddr ' '{print $2}'
75 ... return_stderr=True
76 Should Be Empty ${stderr}
77 Should Be Equal As Strings ${json_data["data"]["MACAddress"]} ${mac_addr}
78 ... msg=MAC address configured incorrectly.
79
80
George Keishingc8166ed2017-02-24 03:53:38 -060081Verify Chassis Motherboard Properties
82 [Documentation] Check if chassis motherboard properties are
83 ... populated valid.
84 [Tags] Verify_Chassis_Motherboard_Properties
85 # When the host is booted, the following properties should
86 # be populated Manufacturer, PartNumber, SerialNumber and
87 # it should not be zero's.
88 # Example:
89 # "data": {
90 # "/xyz/openbmc_project/inventory/system/chassis/motherboard": {
91 # "BuildDate": "",
92 # "Manufacturer": "0000000000000000",
93 # "Model": "",
94 # "PartNumber": "0000000",
95 # "Present": 0,
96 # "PrettyName": "SYSTEM PLANAR ",
97 # "SerialNumber": "000000000000"
98 # }
99 ${properties}= Get Inventory system/chassis/motherboard
100 Should Not Be Equal As Strings
George Keishingc8166ed2017-02-24 03:53:38 -0600101 ... ${properties["data"]["PartNumber"]} 0000000
102 ... msg=motherboard part number invalid.
103 Should Not Be Equal As Strings
104 ... ${properties["data"]["SerialNumber"]} 000000000000
105 ... msg=motherboard serial number invalid.
Chris Austenb29d2e82016-06-07 12:25:35 -0500106
George Keishingae355302017-03-13 04:34:58 -0500107Verify CPU Present
108 [Documentation] Check if the FRU "Present" is set for CPU's.
109 [Tags] Verify_CPU_Present
110 # System inventory cpu list:
111 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
112 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
113 # Example:
114 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0": {
115 # "FieldReplaceable": 1,
116 # "BuildDate": "",
117 # "Cached": 0,
118 # "SerialNumber": "YA3933741574",
119 # "Version": "10",
120 # "Model": "",
121 # "PrettyName": "PROCESSOR MODULE",
122 # "PartNumber": "01HL322",
123 # "Present": 1,
124 # "Manufacturer": "IBM"
125 # },
126 # The CPU properties "Present" should be boolean 1.
127
128 ${cpu_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system cpu
129 :FOR ${cpu_uri} IN @{cpu_list}
130 \ ${present}= Read Attribute ${cpu_uri} Present
131 \ Should Be True ${present}
132
133
134Verify DIMM Present
135 [Documentation] Check if the FRU "Present" is set for DIMM's.
136 [Tags] Verify_DIMM_Present
137 # Example:
138 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
139 # "FieldReplaceable": 1,
140 # "BuildDate": "",
141 # "Cached": 0,
142 # "SerialNumber": "0x0300cf4f",
143 # "Version": "0x00",
144 # "Model": "M393A1G40EB1-CRC ",
145 # "PrettyName": "0x0c",
146 # "PartNumber": "",
147 # "Present": 1,
148 # "Manufacturer": "0xce80"
149 # },
150
151 # The DIMM properties "Present" should be boolean 1.
152
153 ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm
154 :FOR ${dimm_uri} IN @{dimm_list}
155 \ ${present}= Read Attribute ${dimm_uri} Present
156 \ Should Be True ${present}
157
158
George Keishingefa97352017-03-13 07:13:03 -0500159Verify FRU Properties
160 [Documentation] Verify the FRU properties fields.
161 [Tags] Verify_FRU_Properties
162 # Example:
163 # A FRU would have "FieldReplaceable" set to boolean 1 and should have
164 # the following entries
165 # "fru": [
166 # "FieldReplaceable"
167 # "BuildDate",
168 # "Cached"
169 # "SerialNumber",
170 # "Version",
171 # "Model",
172 # "PrettyName",
173 # "PartNumber",
174 # "Present",
175 # "Manufacturer",
176 # ]
177 # and FRU which doesn't have one of this fields is an error.
178 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
179 # "FieldReplaceable": 1,
180 # "BuildDate": "",
181 # "Cached": 0,
182 # "SerialNumber": "0x0300cf4f",
183 # "Version": "0x00",
184 # "Model": "M393A1G40EB1-CRC ",
185 # "PrettyName": "0x0c",
186 # "PartNumber": "",
187 # "Present": 1,
188 # "Manufacturer": "0xce80"
189 # },
190
191 ${system_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system *
192 ${fru_list}= Qualified FRU List @{system_list}
193 Validate FRU Properties Fields @{fru_list}
194
George Keishing071d8da2017-03-24 09:13:16 -0500195
196Verify Core Functional State
197 [Documentation] Verify that "Present" core property is set if "Functional"
198 ... core property is set.
199 [Tags] Verify_Core_Functional_State
200 # Example:
201 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core5":{
202 # "Functional": 1,
203 # "Present": 1,
204 # "PrettyName": ""
205 # },
206 ${core_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system core
207 :FOR ${core_uri} IN @{core_list}
208 \ ${status}= Run Keyword And Return Status
209 ... Check URL Property If Functional ${core_uri}
George Keishingc5658392017-04-27 23:05:18 -0500210 \ Continue For Loop If '${status}' == '${False}'
George Keishing071d8da2017-03-24 09:13:16 -0500211 \ ${present}= Read Attribute ${core_uri} Present
212 \ Should Be True ${present}
213 ... msg=${core_uri} is functional but not present.
214
215
216Verify DIMM Functional State
217 [Documentation] Verify that "Present" DIMM property is set if "Functional"
218 ... DIMM property is set.
219 [Tags] Verify_DIMM_Functional_State
220 # Example:
221 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
222 # "BuildDate": "",
223 # "Cached": 0,
224 # "FieldReplaceable": 1,
225 # "Functional": 1,
226 # "Manufacturer": "0xce80",
227 # "Model": "M393A1G40EB1-CRC ",
228 # "PartNumber": "",
229 # "Present": 1,
230 # "PrettyName": "0x0c",
231 # "SerialNumber": "0x0300cf4f",
232 # "Version": "0x00"
233 # },
234
235 ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm
236 :FOR ${dimm_uri} IN @{dimm_list}
237 \ ${status}= Run Keyword And Return Status
238 ... Check URL Property If Functional ${dimm_uri}
George Keishingc5658392017-04-27 23:05:18 -0500239 \ Continue For Loop If '${status}' == '${False}'
George Keishing071d8da2017-03-24 09:13:16 -0500240 \ ${present}= Read Attribute ${dimm_uri} Present
241 \ Should Be True ${present}
242 ... msg=${dimm_uri} is functional but not present.
243
George Keishing3c205b12017-05-13 04:09:33 -0500244
245Verify Fan Functional State
246 [Documentation] Verify that "Present" fan property is set if "Functional"
247 ... fan property is set.
248 [Tags] Verify_Fan_Functional_State
249 # Example:
250 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/fan0": {
251 # "Functional": 1,
252 # "Present": 1,
253 # "PrettyName": "fan0"
254 # },
255
256 ${fan_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system fan*
257 Should Not Be Empty ${fan_list}
258 :FOR ${fan_uri} IN @{fan_list}
259 \ ${status}= Run Keyword And Return Status
260 ... Check URL Property If Functional ${fan_uri}
261 \ Continue For Loop If '${status}' == '${False}'
262 \ ${present}= Read Attribute ${fan_uri} Present
263 \ Should Be True ${present}
264 ... msg=${fan_uri} is functional but "Present" is not set.
265
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500266Verify Inventory List After Reboot
267 [Documentation] Verify Inventory List After Reboot
268 [Tags] Verify_Inventory_List_After_Reboot
269
270 Repeat Keyword ${LOOP_COUNT} times Verify Inventory List Before And After Reboot
George Keishing3c205b12017-05-13 04:09:33 -0500271
George Keishing04c6b2c2017-06-15 12:33:59 -0500272Check Air Or Water Cooled
273 [Documentation] Check if this system is Air or water cooled.
274 [Tags] Check_Air_Or_Water_Cooled
275 # Example:
276 # "/xyz/openbmc_project/inventory/system/chassis": {
277 # "AirCooled": 1,
278 # "WaterCooled": 0
279 # },
280
281 ${air_cooled}= Read Attribute
282 ... /xyz/openbmc_project/inventory/system/chassis AirCooled
283 Log AirCooled:${air_cooled}
284
285 ${water_cooled}= Read Attribute
286 ... /xyz/openbmc_project/inventory/system/chassis WaterCooled
287 Log WaterCooled:${water_cooled}
288
289 Run Keyword If ${air_cooled}==${0} and ${water_cooled}==${0}
290 ... Fail Neither AirCooled or WaterCooled.
291
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500292Verify Minimal CPU Inventory
293 [Documentation] Verify minimal CPU inventory.
294 [Tags] Verify_Minimal_CPU_Inventory
295
296 # item minimum_count
297 cpu 1
298 [Template] Minimum Inventory
299
300Verify Minimal DIMM Inventory
301 [Documentation] Verify minimal DIMM inventory.
302 [Tags] Verify_Minimal_DIMM_Inventory
303
304 # item minimum_count
305 dimm 2
306 [Template] Minimum Inventory
307
308Verify Minimal Core Inventory
309 [Documentation] Verify minimal core inventory.
310 [Tags] Verify_Minimal_Core_Inventory
311
312 # item minimum_count
313 core 1
314 [Template] Minimum Inventory
315
316Verify Minimal Memory Buffer Inventory
317 [Documentation] Verify minimal memory buffer inventory.
318 [Tags] Verify_Minimal_Memory_Buffer_Inventory
319
320 # item minimum_count
321 memory_buffer 1
322 [Template] Minimum Inventory
323
324Verify Minimal Fan Inventory
325 [Documentation] Verify minimal fan inventory.
326 [Tags] Verify_Minimal_Fan_Inventory
327
328 # item minimum_count
329 fan 2
330 [Template] Minimum Inventory
331
332Verify Minimal Main Planar Inventory
333 [Documentation] Verify minimal main planar inventory.
334 [Tags] Verify_Minimal_Main_Planar_Inventory
335
336 # item minimum_count
337 main_planar 1
338 [Template] Minimum Inventory
339
340Verify Minimal System Inventory
341 [Documentation] Verify minimal system inventory.
342 [Tags] Verify_Minimal_System_Inventory
343
344 # item minimum_count
345 system 1
346 [Template] Minimum Inventory
George Keishing04c6b2c2017-06-15 12:33:59 -0500347
George Keishing03ebc292017-08-02 01:22:02 -0500348Verify Minimal Power Supply Inventory
349 [Documentation] Verify minimal power supply inventory.
350 [Tags] Verify_Minimal_Power_Supply_Inventory
351 # Example:
352 # "/xyz/openbmc_project/inventory/system/chassis/power_supply0",
353 # "/xyz/openbmc_project/inventory/system/chassis/power_supply1",
354
355 # item minimum_count
356 power_supply 1
357 [Template] Minimum Inventory
358
Chris Austenb29d2e82016-06-07 12:25:35 -0500359*** Keywords ***
360
George Keishingc8166ed2017-02-24 03:53:38 -0600361Test Suite Setup
362 [Documentation] Do the initial suite setup.
George Keishing25577a22017-07-12 05:18:46 -0500363
Sweta Potthuriaf741cb2017-07-04 09:41:17 -0500364 # Boot Host.
365 REST Power On
George Keishingcaac9f32017-03-09 02:14:27 -0600366
George Keishingc8166ed2017-02-24 03:53:38 -0600367Get Inventory
368 [Documentation] Get the properties of an endpoint.
369 [Arguments] ${endpoint}
370 # Description of arguments:
371 # endpoint string for which url path ending.
372 # Example: "system" is the endpoint for url
373 # /xyz/openbmc_project/inventory/system
374 ${resp}= OpenBMC Get Request ${HOST_INVENTORY_URI}${endpoint}
375 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
376 ${jsondata}= To JSON ${resp.content}
377 [Return] ${jsondata}
George Keishingefa97352017-03-13 07:13:03 -0500378
379
380Qualified FRU List
381 [Documentation] Build the list of valid FRUs.
382 [Arguments] @{system_list}
383 # Description of arguments:
384 # system_list List of system inventory URLs.
385 # Example:
386 # /xyz/openbmc_project/inventory/system/chassis/motherboard
387 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
388 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
389 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
390 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm1
391 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm2
392 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm3
393 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm4
394 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm5
395 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm6
396 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm7
397
398 ${fru_list}= Create List
399 :FOR ${fru_uri} IN @{system_list}
George Keishingdf5ab122017-04-17 04:01:11 -0500400 \ ${resp}= OpenBMC Get Request ${fru_uri}/attr/FieldReplaceable
401 \ ${jsondata}= To JSON ${resp.content}
402 \ ${status}= Run Keyword And Return Status
403 ... Should Be True ${jsondata['data']} == ${1}
George Keishingefa97352017-03-13 07:13:03 -0500404 \ Run Keyword If '${status}' == '${True}'
405 ... Append To List ${fru_list} ${fru_uri}
406
407 [Return] ${fru_list}
408
409
410Validate FRU Properties Fields
411 [Documentation] Compare valid FRUs from system vs expected FRU set.
412 [Arguments] @{fru_list}
413 # Description of arguments:
414 # fru_list List of qualified FRU URLs.
415
416 # Build the pre-defined set list from data/inventory.py derived from
417 # a group of YAML files.
418 # Example:
419 # set(['Version', 'PartNumber', 'SerialNumber', 'FieldReplaceable',
420 # 'BuildDate', 'Present', 'Manufacturer', 'PrettyName', 'Cached', 'Model'])
421 ${fru_set}= List To Set ${inventory_dict['fru']}
422
423 # Iterate through the FRU's url and compare the set dictionary keys
424 # with the pre-define inventory data.
425 :FOR ${fru_url_path} IN @{fru_list}
426 \ ${fru_field}= Read Properties ${fru_url_path}
427 # ------------------------------------------------------------
428 # ${fru_field.viewkeys()} extracts the list of keys from the
429 # JSON dictionary as a set.
430 # ------------------------------------------------------------
431 \ Should Be Equal ${fru_field.viewkeys()} ${fru_set}
432
George Keishing071d8da2017-03-24 09:13:16 -0500433
434Check URL Property If Functional
435 [Arguments] ${url_path}
436 # Description of arguments:
437 # url_path Full url path of the inventory object.
438 # Example: DIMM / core property url's
439 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
440 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core0
441 ${state}= Read Attribute ${url_path} Functional
442 Should Be True ${state}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500443
444Verify Inventory List Before And After Reboot
445 [Documentation] Verify Inventory list before and after reboot.
446
447 Initiate Host Boot
George Keishingf0680ee2017-08-19 15:22:53 -0500448 Wait Until Keyword Succeeds 10 min 10 sec Is OS Booted
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500449 ${inv_before}= Get URL List ${HOST_INVENTORY_URI}
450 Initiate Host Reboot
George Keishingf0680ee2017-08-19 15:22:53 -0500451 Wait Until Keyword Succeeds 10 min 10 sec Is OS Booted
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500452 ${inv_after}= Get URL List ${HOST_INVENTORY_URI}
453 Lists Should Be Equal ${inv_before} ${inv_after}
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500454
455Minimum Inventory
456 [Documentation] Check for minimum inventory.
457 [Arguments] ${item} ${minimum_count}
458
459 # Description of argument(s):
460 # item Inventory name (example: "fan/cpu/dimm/etc").
461 # minimum_count The minimum number of the given item.
462
463 ${count}= Get Number Hardware Items ${item}
464 Should Be True ${count}>=${minimum_count}
465
466Get Number Hardware Items
467 [Documentation] Get the count of the total present currently on inventory.
468 [Arguments] ${item}
469
470 # Description of argument(s):
471 # item Inventory name (example: "fan/cpu/dimm/etc").
472
473 ${count_inventory} Set Variable ${0}
474 ${list}= Get Endpoint Paths ${HOST_INVENTORY_URI}/system/
475 ... ${item}
476
477 : FOR ${element} IN @{list}
478 \ ${present}= Read Properties ${element}
479 \ ${count_inventory}= Set Variable if ${present['Present']} == 1
480 \ ... ${count_inventory+1} ${count_inventory}
481 [return] ${count_inventory}