blob: 76b03b7e56bf718fd2eb37a2403fb2a70057da0e [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
22${LOOP_COUNT} ${1}
23
Chris Austenb29d2e82016-06-07 12:25:35 -050024*** Test Cases ***
25
George Keishingc8166ed2017-02-24 03:53:38 -060026Verify System Inventory Path
27 [Documentation] Check if system inventory path exist.
28 [Tags] Verify_System_Inventory_Path
29 # When the host is booted, system inventory path should exist.
30 # Example: /xyz/openbmc_project/inventory/system
31 Get Inventory system
Chris Austenb29d2e82016-06-07 12:25:35 -050032
Rahul Maheshwaribb20f732016-10-24 06:27:14 -050033
George Keishing3d734312017-07-24 04:10:25 -050034Verify Boxelder Present Property
35 [Documentation] Boxelder should be present by default.
36 [Tags] Verify that boxelder 'Present' property is present by default.
37 # Example:
38 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc":
39 # {
40 # "BuildDate": "",
41 # "FieldReplaceable": 0,
42 # "Manufacturer": "IBM",
43 # "Model": "",
44 # "PartNumber": "01DH051",
45 # "Present": 1,
46 # "PrettyName": "BMC PLANAR ",
47 # "SerialNumber": "000000000000"
48 # },
49 ${json_data}= Get Inventory system/chassis/motherboard/boxelder/bmc
50 Should Be True ${json_data["data"]["Present"]}
51
52
53Verify Boxelder MAC Address Property Is Populated
54 [Documentation] Boxelder should be present by default.
55 [Tags] Verify_Boxelder_MAC_Address_Property_Is_Populated
56 # Example:
57 # /xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc/ethernet
58 # {
59 # "FieldReplaceable": 0,
60 # "MACAddress": "00:00:00:00:00:00",
61 # "Present": 1,
62 # "PrettyName": ""
63 # }
64
65 ${json_data}= Get Inventory
66 ... system/chassis/motherboard/boxelder/bmc/ethernet
67 Should Be True ${json_data["data"]["Present"]}
68 Should Not Be Equal As Strings
69 ... ${json_data["data"]["MACAddress"]} 00:00:00:00:00:00
70
71 # eth0 Link encap:Ethernet HWaddr 70:E2:84:14:23:F9
72 ${mac_addr} ${stderr} ${rc}= BMC Execute Command
73 ... /sbin/ifconfig -a | grep HWaddr | awk -F'HWaddr ' '{print $2}'
74 ... return_stderr=True
75 Should Be Empty ${stderr}
Rahul Maheshwari844dbe72017-09-18 00:24:23 -050076 Should Be Equal As Strings ${json_data["data"]["MACAddress"]}
77 ... ${mac_addr.strip()} msg=MAC address configured incorrectly.
78 ... ignore_case=True
George Keishing3d734312017-07-24 04:10:25 -050079
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
266
George Keishing04c6b2c2017-06-15 12:33:59 -0500267Check Air Or Water Cooled
268 [Documentation] Check if this system is Air or water cooled.
269 [Tags] Check_Air_Or_Water_Cooled
270 # Example:
271 # "/xyz/openbmc_project/inventory/system/chassis": {
272 # "AirCooled": 1,
273 # "WaterCooled": 0
274 # },
275
276 ${air_cooled}= Read Attribute
277 ... /xyz/openbmc_project/inventory/system/chassis AirCooled
278 Log AirCooled:${air_cooled}
279
280 ${water_cooled}= Read Attribute
281 ... /xyz/openbmc_project/inventory/system/chassis WaterCooled
282 Log WaterCooled:${water_cooled}
283
284 Run Keyword If ${air_cooled}==${0} and ${water_cooled}==${0}
285 ... Fail Neither AirCooled or WaterCooled.
286
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500287Verify Minimal CPU Inventory
288 [Documentation] Verify minimal CPU inventory.
289 [Tags] Verify_Minimal_CPU_Inventory
290
291 # item minimum_count
292 cpu 1
293 [Template] Minimum Inventory
294
295Verify Minimal DIMM Inventory
296 [Documentation] Verify minimal DIMM inventory.
297 [Tags] Verify_Minimal_DIMM_Inventory
298
299 # item minimum_count
300 dimm 2
301 [Template] Minimum Inventory
302
303Verify Minimal Core Inventory
304 [Documentation] Verify minimal core inventory.
305 [Tags] Verify_Minimal_Core_Inventory
306
307 # item minimum_count
308 core 1
309 [Template] Minimum Inventory
310
311Verify Minimal Memory Buffer Inventory
312 [Documentation] Verify minimal memory buffer inventory.
313 [Tags] Verify_Minimal_Memory_Buffer_Inventory
314
315 # item minimum_count
316 memory_buffer 1
317 [Template] Minimum Inventory
318
319Verify Minimal Fan Inventory
320 [Documentation] Verify minimal fan inventory.
321 [Tags] Verify_Minimal_Fan_Inventory
322
323 # item minimum_count
324 fan 2
325 [Template] Minimum Inventory
326
327Verify Minimal Main Planar Inventory
328 [Documentation] Verify minimal main planar inventory.
329 [Tags] Verify_Minimal_Main_Planar_Inventory
330
331 # item minimum_count
332 main_planar 1
333 [Template] Minimum Inventory
334
335Verify Minimal System Inventory
336 [Documentation] Verify minimal system inventory.
337 [Tags] Verify_Minimal_System_Inventory
338
339 # item minimum_count
340 system 1
341 [Template] Minimum Inventory
George Keishing04c6b2c2017-06-15 12:33:59 -0500342
George Keishing03ebc292017-08-02 01:22:02 -0500343Verify Minimal Power Supply Inventory
344 [Documentation] Verify minimal power supply inventory.
345 [Tags] Verify_Minimal_Power_Supply_Inventory
346 # Example:
347 # "/xyz/openbmc_project/inventory/system/chassis/power_supply0",
348 # "/xyz/openbmc_project/inventory/system/chassis/power_supply1",
349
350 # item minimum_count
351 power_supply 1
352 [Template] Minimum Inventory
353
George Keishingfafbfdb2017-08-30 23:51:23 -0500354
355Verify Inventory List After Reboot
356 [Documentation] Verify inventory list after reboot.
357 [Tags] Verify_Inventory_List_After_Reboot
358
359 Repeat Keyword ${LOOP_COUNT} times Choose Boot Option reboot
360
361
362Verify Inventory List After Reset
363 [Documentation] Verify inventory list after reset.
364 [Tags] Verify_Inventory_List_After_Reset
365
366 Repeat Keyword ${LOOP_COUNT} times Choose Boot Option reset
367
Chris Austenb29d2e82016-06-07 12:25:35 -0500368*** Keywords ***
369
George Keishingc8166ed2017-02-24 03:53:38 -0600370Test Suite Setup
371 [Documentation] Do the initial suite setup.
George Keishing25577a22017-07-12 05:18:46 -0500372
Sweta Potthuriaf741cb2017-07-04 09:41:17 -0500373 # Boot Host.
374 REST Power On
George Keishingcaac9f32017-03-09 02:14:27 -0600375
George Keishingc8166ed2017-02-24 03:53:38 -0600376Get Inventory
377 [Documentation] Get the properties of an endpoint.
378 [Arguments] ${endpoint}
379 # Description of arguments:
380 # endpoint string for which url path ending.
381 # Example: "system" is the endpoint for url
382 # /xyz/openbmc_project/inventory/system
383 ${resp}= OpenBMC Get Request ${HOST_INVENTORY_URI}${endpoint}
384 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
385 ${jsondata}= To JSON ${resp.content}
386 [Return] ${jsondata}
George Keishingefa97352017-03-13 07:13:03 -0500387
388
389Qualified FRU List
390 [Documentation] Build the list of valid FRUs.
391 [Arguments] @{system_list}
392 # Description of arguments:
393 # system_list List of system inventory URLs.
394 # Example:
395 # /xyz/openbmc_project/inventory/system/chassis/motherboard
396 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
397 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
398 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
399 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm1
400 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm2
401 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm3
402 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm4
403 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm5
404 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm6
405 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm7
406
407 ${fru_list}= Create List
408 :FOR ${fru_uri} IN @{system_list}
George Keishingdf5ab122017-04-17 04:01:11 -0500409 \ ${resp}= OpenBMC Get Request ${fru_uri}/attr/FieldReplaceable
410 \ ${jsondata}= To JSON ${resp.content}
411 \ ${status}= Run Keyword And Return Status
412 ... Should Be True ${jsondata['data']} == ${1}
George Keishingefa97352017-03-13 07:13:03 -0500413 \ Run Keyword If '${status}' == '${True}'
414 ... Append To List ${fru_list} ${fru_uri}
415
416 [Return] ${fru_list}
417
418
419Validate FRU Properties Fields
420 [Documentation] Compare valid FRUs from system vs expected FRU set.
421 [Arguments] @{fru_list}
422 # Description of arguments:
423 # fru_list List of qualified FRU URLs.
424
425 # Build the pre-defined set list from data/inventory.py derived from
426 # a group of YAML files.
427 # Example:
428 # set(['Version', 'PartNumber', 'SerialNumber', 'FieldReplaceable',
429 # 'BuildDate', 'Present', 'Manufacturer', 'PrettyName', 'Cached', 'Model'])
430 ${fru_set}= List To Set ${inventory_dict['fru']}
431
432 # Iterate through the FRU's url and compare the set dictionary keys
433 # with the pre-define inventory data.
434 :FOR ${fru_url_path} IN @{fru_list}
435 \ ${fru_field}= Read Properties ${fru_url_path}
436 # ------------------------------------------------------------
437 # ${fru_field.viewkeys()} extracts the list of keys from the
438 # JSON dictionary as a set.
439 # ------------------------------------------------------------
440 \ Should Be Equal ${fru_field.viewkeys()} ${fru_set}
441
George Keishing071d8da2017-03-24 09:13:16 -0500442
443Check URL Property If Functional
444 [Arguments] ${url_path}
445 # Description of arguments:
446 # url_path Full url path of the inventory object.
447 # Example: DIMM / core property url's
448 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
449 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core0
450 ${state}= Read Attribute ${url_path} Functional
451 Should Be True ${state}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500452
George Keishingfafbfdb2017-08-30 23:51:23 -0500453Choose Boot Option
454 [Documentation] Choose BMC reset or host reboot.
455 [Arguments] ${option}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500456
George Keishingfafbfdb2017-08-30 23:51:23 -0500457 Run Keyword If '${option}' == 'reboot'
458 ... Verify Inventory List Before And After Reboot
459 ... ELSE
460 ... Verify Inventory List Before And After Reset
461
462
463Verify Inventory List Before And After Reboot
464 [Documentation] Verify inventory list before and after reboot.
465
466 REST Power On
467 Delete Error Logs
468 ${inventory_before}= Get URL List ${HOST_INVENTORY_URI}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500469 Initiate Host Reboot
George Keishingf0680ee2017-08-19 15:22:53 -0500470 Wait Until Keyword Succeeds 10 min 10 sec Is OS Booted
George Keishingfafbfdb2017-08-30 23:51:23 -0500471 Delete Error Logs
472 ${inventory_after}= Get URL List ${HOST_INVENTORY_URI}
473 Lists Should Be Equal ${inventory_before} ${inventory_after}
474
475
476Verify Inventory List Before And After Reset
477 [Documentation] Verify inventory list before and after BMC reset.
478
479 REST Power On
480 Delete Error Logs
481 ${inventory_before}= Get URL List ${HOST_INVENTORY_URI}
482 OBMC Reboot (run)
483 Delete Error Logs
484 ${inventory_after}= Get URL List ${HOST_INVENTORY_URI}
485 Lists Should Be Equal ${inventory_before} ${inventory_after}
486
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500487
488Minimum Inventory
489 [Documentation] Check for minimum inventory.
490 [Arguments] ${item} ${minimum_count}
491
492 # Description of argument(s):
493 # item Inventory name (example: "fan/cpu/dimm/etc").
494 # minimum_count The minimum number of the given item.
495
496 ${count}= Get Number Hardware Items ${item}
497 Should Be True ${count}>=${minimum_count}
498
499Get Number Hardware Items
500 [Documentation] Get the count of the total present currently on inventory.
501 [Arguments] ${item}
502
503 # Description of argument(s):
504 # item Inventory name (example: "fan/cpu/dimm/etc").
505
506 ${count_inventory} Set Variable ${0}
507 ${list}= Get Endpoint Paths ${HOST_INVENTORY_URI}/system/
508 ... ${item}
509
510 : FOR ${element} IN @{list}
511 \ ${present}= Read Properties ${element}
512 \ ${count_inventory}= Set Variable if ${present['Present']} == 1
513 \ ... ${count_inventory+1} ${count_inventory}
514 [return] ${count_inventory}