blob: 0fb5f7638e4b57029b3f69904c5dca028098da29 [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
101 ... ${properties["data"]["Manufacturer"]} 0000000000000000
102 ... msg=motherboard field invalid.
103 Should Not Be Equal As Strings
104 ... ${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
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500269Verify Inventory List After Reboot
270 [Documentation] Verify Inventory List After Reboot
271 [Tags] Verify_Inventory_List_After_Reboot
272
273 Repeat Keyword ${LOOP_COUNT} times Verify Inventory List Before And After Reboot
George Keishing3c205b12017-05-13 04:09:33 -0500274
George Keishing04c6b2c2017-06-15 12:33:59 -0500275Check Air Or Water Cooled
276 [Documentation] Check if this system is Air or water cooled.
277 [Tags] Check_Air_Or_Water_Cooled
278 # Example:
279 # "/xyz/openbmc_project/inventory/system/chassis": {
280 # "AirCooled": 1,
281 # "WaterCooled": 0
282 # },
283
284 ${air_cooled}= Read Attribute
285 ... /xyz/openbmc_project/inventory/system/chassis AirCooled
286 Log AirCooled:${air_cooled}
287
288 ${water_cooled}= Read Attribute
289 ... /xyz/openbmc_project/inventory/system/chassis WaterCooled
290 Log WaterCooled:${water_cooled}
291
292 Run Keyword If ${air_cooled}==${0} and ${water_cooled}==${0}
293 ... Fail Neither AirCooled or WaterCooled.
294
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500295Verify Minimal CPU Inventory
296 [Documentation] Verify minimal CPU inventory.
297 [Tags] Verify_Minimal_CPU_Inventory
298
299 # item minimum_count
300 cpu 1
301 [Template] Minimum Inventory
302
303Verify Minimal DIMM Inventory
304 [Documentation] Verify minimal DIMM inventory.
305 [Tags] Verify_Minimal_DIMM_Inventory
306
307 # item minimum_count
308 dimm 2
309 [Template] Minimum Inventory
310
311Verify Minimal Core Inventory
312 [Documentation] Verify minimal core inventory.
313 [Tags] Verify_Minimal_Core_Inventory
314
315 # item minimum_count
316 core 1
317 [Template] Minimum Inventory
318
319Verify Minimal Memory Buffer Inventory
320 [Documentation] Verify minimal memory buffer inventory.
321 [Tags] Verify_Minimal_Memory_Buffer_Inventory
322
323 # item minimum_count
324 memory_buffer 1
325 [Template] Minimum Inventory
326
327Verify Minimal Fan Inventory
328 [Documentation] Verify minimal fan inventory.
329 [Tags] Verify_Minimal_Fan_Inventory
330
331 # item minimum_count
332 fan 2
333 [Template] Minimum Inventory
334
335Verify Minimal Main Planar Inventory
336 [Documentation] Verify minimal main planar inventory.
337 [Tags] Verify_Minimal_Main_Planar_Inventory
338
339 # item minimum_count
340 main_planar 1
341 [Template] Minimum Inventory
342
343Verify Minimal System Inventory
344 [Documentation] Verify minimal system inventory.
345 [Tags] Verify_Minimal_System_Inventory
346
347 # item minimum_count
348 system 1
349 [Template] Minimum Inventory
George Keishing04c6b2c2017-06-15 12:33:59 -0500350
George Keishing03ebc292017-08-02 01:22:02 -0500351Verify Minimal Power Supply Inventory
352 [Documentation] Verify minimal power supply inventory.
353 [Tags] Verify_Minimal_Power_Supply_Inventory
354 # Example:
355 # "/xyz/openbmc_project/inventory/system/chassis/power_supply0",
356 # "/xyz/openbmc_project/inventory/system/chassis/power_supply1",
357
358 # item minimum_count
359 power_supply 1
360 [Template] Minimum Inventory
361
Chris Austenb29d2e82016-06-07 12:25:35 -0500362*** Keywords ***
363
George Keishingc8166ed2017-02-24 03:53:38 -0600364Test Suite Setup
365 [Documentation] Do the initial suite setup.
George Keishing25577a22017-07-12 05:18:46 -0500366
Sweta Potthuriaf741cb2017-07-04 09:41:17 -0500367 # Boot Host.
368 REST Power On
George Keishingcaac9f32017-03-09 02:14:27 -0600369
George Keishingc8166ed2017-02-24 03:53:38 -0600370Get Inventory
371 [Documentation] Get the properties of an endpoint.
372 [Arguments] ${endpoint}
373 # Description of arguments:
374 # endpoint string for which url path ending.
375 # Example: "system" is the endpoint for url
376 # /xyz/openbmc_project/inventory/system
377 ${resp}= OpenBMC Get Request ${HOST_INVENTORY_URI}${endpoint}
378 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
379 ${jsondata}= To JSON ${resp.content}
380 [Return] ${jsondata}
George Keishingefa97352017-03-13 07:13:03 -0500381
382
383Qualified FRU List
384 [Documentation] Build the list of valid FRUs.
385 [Arguments] @{system_list}
386 # Description of arguments:
387 # system_list List of system inventory URLs.
388 # Example:
389 # /xyz/openbmc_project/inventory/system/chassis/motherboard
390 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
391 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
392 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
393 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm1
394 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm2
395 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm3
396 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm4
397 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm5
398 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm6
399 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm7
400
401 ${fru_list}= Create List
402 :FOR ${fru_uri} IN @{system_list}
George Keishingdf5ab122017-04-17 04:01:11 -0500403 \ ${resp}= OpenBMC Get Request ${fru_uri}/attr/FieldReplaceable
404 \ ${jsondata}= To JSON ${resp.content}
405 \ ${status}= Run Keyword And Return Status
406 ... Should Be True ${jsondata['data']} == ${1}
George Keishingefa97352017-03-13 07:13:03 -0500407 \ Run Keyword If '${status}' == '${True}'
408 ... Append To List ${fru_list} ${fru_uri}
409
410 [Return] ${fru_list}
411
412
413Validate FRU Properties Fields
414 [Documentation] Compare valid FRUs from system vs expected FRU set.
415 [Arguments] @{fru_list}
416 # Description of arguments:
417 # fru_list List of qualified FRU URLs.
418
419 # Build the pre-defined set list from data/inventory.py derived from
420 # a group of YAML files.
421 # Example:
422 # set(['Version', 'PartNumber', 'SerialNumber', 'FieldReplaceable',
423 # 'BuildDate', 'Present', 'Manufacturer', 'PrettyName', 'Cached', 'Model'])
424 ${fru_set}= List To Set ${inventory_dict['fru']}
425
426 # Iterate through the FRU's url and compare the set dictionary keys
427 # with the pre-define inventory data.
428 :FOR ${fru_url_path} IN @{fru_list}
429 \ ${fru_field}= Read Properties ${fru_url_path}
430 # ------------------------------------------------------------
431 # ${fru_field.viewkeys()} extracts the list of keys from the
432 # JSON dictionary as a set.
433 # ------------------------------------------------------------
434 \ Should Be Equal ${fru_field.viewkeys()} ${fru_set}
435
George Keishing071d8da2017-03-24 09:13:16 -0500436
437Check URL Property If Functional
438 [Arguments] ${url_path}
439 # Description of arguments:
440 # url_path Full url path of the inventory object.
441 # Example: DIMM / core property url's
442 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
443 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core0
444 ${state}= Read Attribute ${url_path} Functional
445 Should Be True ${state}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500446
447Verify Inventory List Before And After Reboot
448 [Documentation] Verify Inventory list before and after reboot.
449
450 Initiate Host Boot
451 Wait Until Keyword Succeeds 10 min 10 sec Is OS Starting
452 ${inv_before}= Get URL List ${HOST_INVENTORY_URI}
453 Initiate Host Reboot
454 Wait Until Keyword Succeeds 10 min 10 sec Is OS Starting
455 ${inv_after}= Get URL List ${HOST_INVENTORY_URI}
456 Lists Should Be Equal ${inv_before} ${inv_after}
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500457
458Minimum Inventory
459 [Documentation] Check for minimum inventory.
460 [Arguments] ${item} ${minimum_count}
461
462 # Description of argument(s):
463 # item Inventory name (example: "fan/cpu/dimm/etc").
464 # minimum_count The minimum number of the given item.
465
466 ${count}= Get Number Hardware Items ${item}
467 Should Be True ${count}>=${minimum_count}
468
469Get Number Hardware Items
470 [Documentation] Get the count of the total present currently on inventory.
471 [Arguments] ${item}
472
473 # Description of argument(s):
474 # item Inventory name (example: "fan/cpu/dimm/etc").
475
476 ${count_inventory} Set Variable ${0}
477 ${list}= Get Endpoint Paths ${HOST_INVENTORY_URI}/system/
478 ... ${item}
479
480 : FOR ${element} IN @{list}
481 \ ${present}= Read Properties ${element}
482 \ ${count_inventory}= Set Variable if ${present['Present']} == 1
483 \ ... ${count_inventory+1} ${count_inventory}
484 [return] ${count_inventory}