blob: e3b38780d75780942d7d8901adb7825e0386b244 [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"]}
George Keishing33dd4432017-09-13 01:48:26 -050051 Should Not Be Equal As Strings
52 ... ${json_data["data"]["SerialNumber"]} 000000000000
53 ... msg=BMC planar serial number invalid.
George Keishing3d734312017-07-24 04:10:25 -050054
55
56Verify Boxelder MAC Address Property Is Populated
57 [Documentation] Boxelder should be present by default.
58 [Tags] Verify_Boxelder_MAC_Address_Property_Is_Populated
59 # Example:
60 # /xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc/ethernet
61 # {
62 # "FieldReplaceable": 0,
63 # "MACAddress": "00:00:00:00:00:00",
64 # "Present": 1,
65 # "PrettyName": ""
66 # }
67
68 ${json_data}= Get Inventory
69 ... system/chassis/motherboard/boxelder/bmc/ethernet
70 Should Be True ${json_data["data"]["Present"]}
71 Should Not Be Equal As Strings
72 ... ${json_data["data"]["MACAddress"]} 00:00:00:00:00:00
73
74 # eth0 Link encap:Ethernet HWaddr 70:E2:84:14:23:F9
75 ${mac_addr} ${stderr} ${rc}= BMC Execute Command
76 ... /sbin/ifconfig -a | grep HWaddr | awk -F'HWaddr ' '{print $2}'
77 ... return_stderr=True
78 Should Be Empty ${stderr}
Rahul Maheshwari844dbe72017-09-18 00:24:23 -050079 Should Be Equal As Strings ${json_data["data"]["MACAddress"]}
80 ... ${mac_addr.strip()} msg=MAC address configured incorrectly.
81 ... ignore_case=True
George Keishing3d734312017-07-24 04:10:25 -050082
83
George Keishingc8166ed2017-02-24 03:53:38 -060084Verify Chassis Motherboard Properties
85 [Documentation] Check if chassis motherboard properties are
86 ... populated valid.
87 [Tags] Verify_Chassis_Motherboard_Properties
88 # When the host is booted, the following properties should
89 # be populated Manufacturer, PartNumber, SerialNumber and
90 # it should not be zero's.
91 # Example:
92 # "data": {
93 # "/xyz/openbmc_project/inventory/system/chassis/motherboard": {
94 # "BuildDate": "",
95 # "Manufacturer": "0000000000000000",
96 # "Model": "",
97 # "PartNumber": "0000000",
98 # "Present": 0,
99 # "PrettyName": "SYSTEM PLANAR ",
100 # "SerialNumber": "000000000000"
101 # }
102 ${properties}= Get Inventory system/chassis/motherboard
103 Should Not Be Equal As Strings
George Keishingc8166ed2017-02-24 03:53:38 -0600104 ... ${properties["data"]["PartNumber"]} 0000000
105 ... msg=motherboard part number invalid.
106 Should Not Be Equal As Strings
107 ... ${properties["data"]["SerialNumber"]} 000000000000
108 ... msg=motherboard serial number invalid.
Chris Austenb29d2e82016-06-07 12:25:35 -0500109
George Keishingae355302017-03-13 04:34:58 -0500110Verify CPU Present
111 [Documentation] Check if the FRU "Present" is set for CPU's.
112 [Tags] Verify_CPU_Present
113 # System inventory cpu list:
114 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
115 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
116 # Example:
117 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0": {
118 # "FieldReplaceable": 1,
119 # "BuildDate": "",
120 # "Cached": 0,
121 # "SerialNumber": "YA3933741574",
122 # "Version": "10",
123 # "Model": "",
124 # "PrettyName": "PROCESSOR MODULE",
125 # "PartNumber": "01HL322",
126 # "Present": 1,
127 # "Manufacturer": "IBM"
128 # },
129 # The CPU properties "Present" should be boolean 1.
130
131 ${cpu_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system cpu
132 :FOR ${cpu_uri} IN @{cpu_list}
133 \ ${present}= Read Attribute ${cpu_uri} Present
134 \ Should Be True ${present}
135
136
137Verify DIMM Present
138 [Documentation] Check if the FRU "Present" is set for DIMM's.
139 [Tags] Verify_DIMM_Present
140 # Example:
141 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
142 # "FieldReplaceable": 1,
143 # "BuildDate": "",
144 # "Cached": 0,
145 # "SerialNumber": "0x0300cf4f",
146 # "Version": "0x00",
147 # "Model": "M393A1G40EB1-CRC ",
148 # "PrettyName": "0x0c",
149 # "PartNumber": "",
150 # "Present": 1,
151 # "Manufacturer": "0xce80"
152 # },
153
154 # The DIMM properties "Present" should be boolean 1.
155
156 ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm
157 :FOR ${dimm_uri} IN @{dimm_list}
158 \ ${present}= Read Attribute ${dimm_uri} Present
159 \ Should Be True ${present}
160
161
George Keishingefa97352017-03-13 07:13:03 -0500162Verify FRU Properties
163 [Documentation] Verify the FRU properties fields.
164 [Tags] Verify_FRU_Properties
165 # Example:
166 # A FRU would have "FieldReplaceable" set to boolean 1 and should have
167 # the following entries
168 # "fru": [
169 # "FieldReplaceable"
170 # "BuildDate",
171 # "Cached"
172 # "SerialNumber",
173 # "Version",
174 # "Model",
175 # "PrettyName",
176 # "PartNumber",
177 # "Present",
178 # "Manufacturer",
179 # ]
180 # and FRU which doesn't have one of this fields is an error.
181 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
182 # "FieldReplaceable": 1,
183 # "BuildDate": "",
184 # "Cached": 0,
185 # "SerialNumber": "0x0300cf4f",
186 # "Version": "0x00",
187 # "Model": "M393A1G40EB1-CRC ",
188 # "PrettyName": "0x0c",
189 # "PartNumber": "",
190 # "Present": 1,
191 # "Manufacturer": "0xce80"
192 # },
193
194 ${system_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system *
195 ${fru_list}= Qualified FRU List @{system_list}
196 Validate FRU Properties Fields @{fru_list}
197
George Keishing071d8da2017-03-24 09:13:16 -0500198
199Verify Core Functional State
200 [Documentation] Verify that "Present" core property is set if "Functional"
201 ... core property is set.
202 [Tags] Verify_Core_Functional_State
203 # Example:
204 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core5":{
205 # "Functional": 1,
206 # "Present": 1,
207 # "PrettyName": ""
208 # },
209 ${core_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system core
210 :FOR ${core_uri} IN @{core_list}
211 \ ${status}= Run Keyword And Return Status
212 ... Check URL Property If Functional ${core_uri}
George Keishingc5658392017-04-27 23:05:18 -0500213 \ Continue For Loop If '${status}' == '${False}'
George Keishing071d8da2017-03-24 09:13:16 -0500214 \ ${present}= Read Attribute ${core_uri} Present
215 \ Should Be True ${present}
216 ... msg=${core_uri} is functional but not present.
217
218
219Verify DIMM Functional State
220 [Documentation] Verify that "Present" DIMM property is set if "Functional"
221 ... DIMM property is set.
222 [Tags] Verify_DIMM_Functional_State
223 # Example:
224 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
225 # "BuildDate": "",
226 # "Cached": 0,
227 # "FieldReplaceable": 1,
228 # "Functional": 1,
229 # "Manufacturer": "0xce80",
230 # "Model": "M393A1G40EB1-CRC ",
231 # "PartNumber": "",
232 # "Present": 1,
233 # "PrettyName": "0x0c",
234 # "SerialNumber": "0x0300cf4f",
235 # "Version": "0x00"
236 # },
237
238 ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm
239 :FOR ${dimm_uri} IN @{dimm_list}
240 \ ${status}= Run Keyword And Return Status
241 ... Check URL Property If Functional ${dimm_uri}
George Keishingc5658392017-04-27 23:05:18 -0500242 \ Continue For Loop If '${status}' == '${False}'
George Keishing071d8da2017-03-24 09:13:16 -0500243 \ ${present}= Read Attribute ${dimm_uri} Present
244 \ Should Be True ${present}
245 ... msg=${dimm_uri} is functional but not present.
246
George Keishing3c205b12017-05-13 04:09:33 -0500247
248Verify Fan Functional State
249 [Documentation] Verify that "Present" fan property is set if "Functional"
250 ... fan property is set.
251 [Tags] Verify_Fan_Functional_State
252 # Example:
253 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/fan0": {
254 # "Functional": 1,
255 # "Present": 1,
256 # "PrettyName": "fan0"
257 # },
258
259 ${fan_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system fan*
260 Should Not Be Empty ${fan_list}
261 :FOR ${fan_uri} IN @{fan_list}
262 \ ${status}= Run Keyword And Return Status
263 ... Check URL Property If Functional ${fan_uri}
264 \ Continue For Loop If '${status}' == '${False}'
265 \ ${present}= Read Attribute ${fan_uri} Present
266 \ Should Be True ${present}
267 ... msg=${fan_uri} is functional but "Present" is not set.
268
269
George Keishing04c6b2c2017-06-15 12:33:59 -0500270Check Air Or Water Cooled
271 [Documentation] Check if this system is Air or water cooled.
272 [Tags] Check_Air_Or_Water_Cooled
273 # Example:
274 # "/xyz/openbmc_project/inventory/system/chassis": {
275 # "AirCooled": 1,
276 # "WaterCooled": 0
277 # },
278
279 ${air_cooled}= Read Attribute
280 ... /xyz/openbmc_project/inventory/system/chassis AirCooled
281 Log AirCooled:${air_cooled}
282
283 ${water_cooled}= Read Attribute
284 ... /xyz/openbmc_project/inventory/system/chassis WaterCooled
285 Log WaterCooled:${water_cooled}
286
287 Run Keyword If ${air_cooled}==${0} and ${water_cooled}==${0}
288 ... Fail Neither AirCooled or WaterCooled.
289
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500290Verify Minimal CPU Inventory
291 [Documentation] Verify minimal CPU inventory.
292 [Tags] Verify_Minimal_CPU_Inventory
293
294 # item minimum_count
295 cpu 1
296 [Template] Minimum Inventory
297
298Verify Minimal DIMM Inventory
299 [Documentation] Verify minimal DIMM inventory.
300 [Tags] Verify_Minimal_DIMM_Inventory
301
302 # item minimum_count
303 dimm 2
304 [Template] Minimum Inventory
305
306Verify Minimal Core Inventory
307 [Documentation] Verify minimal core inventory.
308 [Tags] Verify_Minimal_Core_Inventory
309
310 # item minimum_count
311 core 1
312 [Template] Minimum Inventory
313
314Verify Minimal Memory Buffer Inventory
315 [Documentation] Verify minimal memory buffer inventory.
316 [Tags] Verify_Minimal_Memory_Buffer_Inventory
317
318 # item minimum_count
319 memory_buffer 1
320 [Template] Minimum Inventory
321
322Verify Minimal Fan Inventory
323 [Documentation] Verify minimal fan inventory.
324 [Tags] Verify_Minimal_Fan_Inventory
325
326 # item minimum_count
327 fan 2
328 [Template] Minimum Inventory
329
330Verify Minimal Main Planar Inventory
331 [Documentation] Verify minimal main planar inventory.
332 [Tags] Verify_Minimal_Main_Planar_Inventory
333
334 # item minimum_count
335 main_planar 1
336 [Template] Minimum Inventory
337
338Verify Minimal System Inventory
339 [Documentation] Verify minimal system inventory.
340 [Tags] Verify_Minimal_System_Inventory
341
342 # item minimum_count
343 system 1
344 [Template] Minimum Inventory
George Keishing04c6b2c2017-06-15 12:33:59 -0500345
George Keishing03ebc292017-08-02 01:22:02 -0500346Verify Minimal Power Supply Inventory
347 [Documentation] Verify minimal power supply inventory.
348 [Tags] Verify_Minimal_Power_Supply_Inventory
349 # Example:
350 # "/xyz/openbmc_project/inventory/system/chassis/power_supply0",
351 # "/xyz/openbmc_project/inventory/system/chassis/power_supply1",
352
353 # item minimum_count
354 power_supply 1
355 [Template] Minimum Inventory
356
George Keishingfafbfdb2017-08-30 23:51:23 -0500357
358Verify Inventory List After Reboot
359 [Documentation] Verify inventory list after reboot.
360 [Tags] Verify_Inventory_List_After_Reboot
361
362 Repeat Keyword ${LOOP_COUNT} times Choose Boot Option reboot
363
364
365Verify Inventory List After Reset
366 [Documentation] Verify inventory list after reset.
367 [Tags] Verify_Inventory_List_After_Reset
368
369 Repeat Keyword ${LOOP_COUNT} times Choose Boot Option reset
370
Chris Austenb29d2e82016-06-07 12:25:35 -0500371*** Keywords ***
372
George Keishingc8166ed2017-02-24 03:53:38 -0600373Test Suite Setup
374 [Documentation] Do the initial suite setup.
George Keishing25577a22017-07-12 05:18:46 -0500375
Sweta Potthuriaf741cb2017-07-04 09:41:17 -0500376 # Boot Host.
377 REST Power On
George Keishingcaac9f32017-03-09 02:14:27 -0600378
George Keishingc8166ed2017-02-24 03:53:38 -0600379Get Inventory
380 [Documentation] Get the properties of an endpoint.
381 [Arguments] ${endpoint}
382 # Description of arguments:
383 # endpoint string for which url path ending.
384 # Example: "system" is the endpoint for url
385 # /xyz/openbmc_project/inventory/system
386 ${resp}= OpenBMC Get Request ${HOST_INVENTORY_URI}${endpoint}
387 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
388 ${jsondata}= To JSON ${resp.content}
389 [Return] ${jsondata}
George Keishingefa97352017-03-13 07:13:03 -0500390
391
392Qualified FRU List
393 [Documentation] Build the list of valid FRUs.
394 [Arguments] @{system_list}
395 # Description of arguments:
396 # system_list List of system inventory URLs.
397 # Example:
398 # /xyz/openbmc_project/inventory/system/chassis/motherboard
399 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
400 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
401 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
402 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm1
403 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm2
404 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm3
405 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm4
406 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm5
407 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm6
408 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm7
409
410 ${fru_list}= Create List
411 :FOR ${fru_uri} IN @{system_list}
George Keishingdf5ab122017-04-17 04:01:11 -0500412 \ ${resp}= OpenBMC Get Request ${fru_uri}/attr/FieldReplaceable
413 \ ${jsondata}= To JSON ${resp.content}
414 \ ${status}= Run Keyword And Return Status
415 ... Should Be True ${jsondata['data']} == ${1}
George Keishingefa97352017-03-13 07:13:03 -0500416 \ Run Keyword If '${status}' == '${True}'
417 ... Append To List ${fru_list} ${fru_uri}
418
419 [Return] ${fru_list}
420
421
422Validate FRU Properties Fields
423 [Documentation] Compare valid FRUs from system vs expected FRU set.
424 [Arguments] @{fru_list}
425 # Description of arguments:
426 # fru_list List of qualified FRU URLs.
427
428 # Build the pre-defined set list from data/inventory.py derived from
429 # a group of YAML files.
430 # Example:
431 # set(['Version', 'PartNumber', 'SerialNumber', 'FieldReplaceable',
432 # 'BuildDate', 'Present', 'Manufacturer', 'PrettyName', 'Cached', 'Model'])
433 ${fru_set}= List To Set ${inventory_dict['fru']}
434
435 # Iterate through the FRU's url and compare the set dictionary keys
436 # with the pre-define inventory data.
437 :FOR ${fru_url_path} IN @{fru_list}
438 \ ${fru_field}= Read Properties ${fru_url_path}
439 # ------------------------------------------------------------
440 # ${fru_field.viewkeys()} extracts the list of keys from the
441 # JSON dictionary as a set.
442 # ------------------------------------------------------------
443 \ Should Be Equal ${fru_field.viewkeys()} ${fru_set}
444
George Keishing071d8da2017-03-24 09:13:16 -0500445
446Check URL Property If Functional
447 [Arguments] ${url_path}
448 # Description of arguments:
449 # url_path Full url path of the inventory object.
450 # Example: DIMM / core property url's
451 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
452 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core0
453 ${state}= Read Attribute ${url_path} Functional
454 Should Be True ${state}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500455
George Keishingfafbfdb2017-08-30 23:51:23 -0500456Choose Boot Option
457 [Documentation] Choose BMC reset or host reboot.
458 [Arguments] ${option}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500459
George Keishingfafbfdb2017-08-30 23:51:23 -0500460 Run Keyword If '${option}' == 'reboot'
461 ... Verify Inventory List Before And After Reboot
462 ... ELSE
463 ... Verify Inventory List Before And After Reset
464
465
466Verify Inventory List Before And After Reboot
467 [Documentation] Verify inventory list before and after reboot.
468
469 REST Power On
470 Delete Error Logs
471 ${inventory_before}= Get URL List ${HOST_INVENTORY_URI}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500472 Initiate Host Reboot
George Keishingf0680ee2017-08-19 15:22:53 -0500473 Wait Until Keyword Succeeds 10 min 10 sec Is OS Booted
George Keishingfafbfdb2017-08-30 23:51:23 -0500474 Delete Error Logs
475 ${inventory_after}= Get URL List ${HOST_INVENTORY_URI}
476 Lists Should Be Equal ${inventory_before} ${inventory_after}
477
478
479Verify Inventory List Before And After Reset
480 [Documentation] Verify inventory list before and after BMC reset.
481
482 REST Power On
483 Delete Error Logs
484 ${inventory_before}= Get URL List ${HOST_INVENTORY_URI}
485 OBMC Reboot (run)
486 Delete Error Logs
487 ${inventory_after}= Get URL List ${HOST_INVENTORY_URI}
488 Lists Should Be Equal ${inventory_before} ${inventory_after}
489
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500490
491Minimum Inventory
492 [Documentation] Check for minimum inventory.
493 [Arguments] ${item} ${minimum_count}
494
495 # Description of argument(s):
496 # item Inventory name (example: "fan/cpu/dimm/etc").
497 # minimum_count The minimum number of the given item.
498
499 ${count}= Get Number Hardware Items ${item}
500 Should Be True ${count}>=${minimum_count}
501
502Get Number Hardware Items
503 [Documentation] Get the count of the total present currently on inventory.
504 [Arguments] ${item}
505
506 # Description of argument(s):
507 # item Inventory name (example: "fan/cpu/dimm/etc").
508
509 ${count_inventory} Set Variable ${0}
510 ${list}= Get Endpoint Paths ${HOST_INVENTORY_URI}/system/
511 ... ${item}
512
513 : FOR ${element} IN @{list}
514 \ ${present}= Read Properties ${element}
515 \ ${count_inventory}= Set Variable if ${present['Present']} == 1
516 \ ... ${count_inventory+1} ${count_inventory}
517 [return] ${count_inventory}