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