blob: cfb974ab00eb85bb44c5ebc9910c52714b9c6053 [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 Keishingda0aa882017-12-05 06:44:03 -060015Suite Setup Suite Setup Execution
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.
George Keishing01b59ac2017-11-24 10:43:58 -060036 [Tags] Verify_Boxelder_Present_Property
George Keishing3d734312017-07-24 04:10:25 -050037 # 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
George Keishinge4e1d272017-11-24 06:05:21 -060056Verify UUID Entry
57 [Documentation] UUID entry should exist in BMC planar property.
58 [Tags] Verify_UUID_Entry
59 # Example:
60 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc":
61 # {
62 # "BuildDate": "",
63 # "FieldReplaceable": 0,
64 # "Manufacturer": "IBM",
65 # "Model": "",
66 # "PartNumber": "01DH051",
67 # "Present": 1,
68 # "PrettyName": "BMC PLANAR ",
69 # "SerialNumber": "000000000000"
70 # "UUID": ""
71 # },
72 ${json_data}= Get Inventory system/chassis/motherboard/boxelder/bmc
73 Should Not Be Empty ${json_data["data"]["UUID"]}
74
75
George Keishing3d734312017-07-24 04:10:25 -050076Verify Boxelder MAC Address Property Is Populated
77 [Documentation] Boxelder should be present by default.
78 [Tags] Verify_Boxelder_MAC_Address_Property_Is_Populated
79 # Example:
80 # /xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc/ethernet
81 # {
82 # "FieldReplaceable": 0,
83 # "MACAddress": "00:00:00:00:00:00",
84 # "Present": 1,
85 # "PrettyName": ""
86 # }
87
88 ${json_data}= Get Inventory
89 ... system/chassis/motherboard/boxelder/bmc/ethernet
90 Should Be True ${json_data["data"]["Present"]}
91 Should Not Be Equal As Strings
92 ... ${json_data["data"]["MACAddress"]} 00:00:00:00:00:00
93
94 # eth0 Link encap:Ethernet HWaddr 70:E2:84:14:23:F9
95 ${mac_addr} ${stderr} ${rc}= BMC Execute Command
96 ... /sbin/ifconfig -a | grep HWaddr | awk -F'HWaddr ' '{print $2}'
97 ... return_stderr=True
98 Should Be Empty ${stderr}
Rahul Maheshwari844dbe72017-09-18 00:24:23 -050099 Should Be Equal As Strings ${json_data["data"]["MACAddress"]}
100 ... ${mac_addr.strip()} msg=MAC address configured incorrectly.
101 ... ignore_case=True
George Keishing3d734312017-07-24 04:10:25 -0500102
103
George Keishingc8166ed2017-02-24 03:53:38 -0600104Verify Chassis Motherboard Properties
105 [Documentation] Check if chassis motherboard properties are
106 ... populated valid.
107 [Tags] Verify_Chassis_Motherboard_Properties
108 # When the host is booted, the following properties should
109 # be populated Manufacturer, PartNumber, SerialNumber and
110 # it should not be zero's.
111 # Example:
112 # "data": {
113 # "/xyz/openbmc_project/inventory/system/chassis/motherboard": {
114 # "BuildDate": "",
115 # "Manufacturer": "0000000000000000",
116 # "Model": "",
117 # "PartNumber": "0000000",
118 # "Present": 0,
119 # "PrettyName": "SYSTEM PLANAR ",
120 # "SerialNumber": "000000000000"
121 # }
122 ${properties}= Get Inventory system/chassis/motherboard
123 Should Not Be Equal As Strings
George Keishingc8166ed2017-02-24 03:53:38 -0600124 ... ${properties["data"]["PartNumber"]} 0000000
125 ... msg=motherboard part number invalid.
126 Should Not Be Equal As Strings
127 ... ${properties["data"]["SerialNumber"]} 000000000000
128 ... msg=motherboard serial number invalid.
Chris Austenb29d2e82016-06-07 12:25:35 -0500129
George Keishingae355302017-03-13 04:34:58 -0500130Verify CPU Present
131 [Documentation] Check if the FRU "Present" is set for CPU's.
132 [Tags] Verify_CPU_Present
133 # System inventory cpu list:
134 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
135 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
136 # Example:
137 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0": {
138 # "FieldReplaceable": 1,
139 # "BuildDate": "",
140 # "Cached": 0,
141 # "SerialNumber": "YA3933741574",
142 # "Version": "10",
143 # "Model": "",
144 # "PrettyName": "PROCESSOR MODULE",
145 # "PartNumber": "01HL322",
146 # "Present": 1,
147 # "Manufacturer": "IBM"
148 # },
149 # The CPU properties "Present" should be boolean 1.
150
151 ${cpu_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system cpu
152 :FOR ${cpu_uri} IN @{cpu_list}
153 \ ${present}= Read Attribute ${cpu_uri} Present
154 \ Should Be True ${present}
155
156
157Verify DIMM Present
158 [Documentation] Check if the FRU "Present" is set for DIMM's.
159 [Tags] Verify_DIMM_Present
160 # Example:
161 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
162 # "FieldReplaceable": 1,
163 # "BuildDate": "",
164 # "Cached": 0,
165 # "SerialNumber": "0x0300cf4f",
166 # "Version": "0x00",
167 # "Model": "M393A1G40EB1-CRC ",
168 # "PrettyName": "0x0c",
169 # "PartNumber": "",
170 # "Present": 1,
171 # "Manufacturer": "0xce80"
172 # },
173
174 # The DIMM properties "Present" should be boolean 1.
175
176 ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm
177 :FOR ${dimm_uri} IN @{dimm_list}
178 \ ${present}= Read Attribute ${dimm_uri} Present
179 \ Should Be True ${present}
180
181
George Keishingefa97352017-03-13 07:13:03 -0500182Verify FRU Properties
183 [Documentation] Verify the FRU properties fields.
184 [Tags] Verify_FRU_Properties
185 # Example:
186 # A FRU would have "FieldReplaceable" set to boolean 1 and should have
187 # the following entries
188 # "fru": [
189 # "FieldReplaceable"
190 # "BuildDate",
191 # "Cached"
192 # "SerialNumber",
193 # "Version",
194 # "Model",
195 # "PrettyName",
196 # "PartNumber",
197 # "Present",
198 # "Manufacturer",
199 # ]
200 # and FRU which doesn't have one of this fields is an error.
201 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
202 # "FieldReplaceable": 1,
203 # "BuildDate": "",
204 # "Cached": 0,
205 # "SerialNumber": "0x0300cf4f",
206 # "Version": "0x00",
207 # "Model": "M393A1G40EB1-CRC ",
208 # "PrettyName": "0x0c",
209 # "PartNumber": "",
210 # "Present": 1,
211 # "Manufacturer": "0xce80"
212 # },
213
214 ${system_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system *
215 ${fru_list}= Qualified FRU List @{system_list}
George Keishingda0aa882017-12-05 06:44:03 -0600216 Validate FRU Properties Fields fru @{fru_list}
217
218
219Verify GPU Properties
220 [Documentation] Verify the GPU properties fields.
221 [Tags] Verify_GPU_Properties
222 # Example:
223 # A GPU property should have the following entries:
224 # "gpu":[
225 # "PrettyName",
226 # "Present",
227 # "Functional"
228 # ]
229 # GPU inventory:
230 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/gv100card2": {
231 # "Functional": 1,
232 # "Present": 1,
233 # "PrettyName": ""
234 # },
235
236
237 ${system_list}= Get Endpoint Paths
238 ... ${HOST_INVENTORY_URI}system/chassis/motherboard gv*
239 Validate FRU Properties Fields gpu @{system_list}
240
241
242Verify Core Properties
243 [Documentation] Verify the core property fields.
244 [Tags] Verify_Core_Properties
245 # Example:
246 # A core property should have the following entries:
247 # "core":[
248 # "PrettyName",
249 # "Present",
250 # "Functional"
251 # ]
252 # core inventory:
253 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1/core0": {
254 # "Functional": 1,
255 # "Present": 1,
256 # "PrettyName": ""
257 # },
258
259 ${system_list}= Get Endpoint Paths
260 ... ${HOST_INVENTORY_URI}system/chassis/motherboard core*
261 Validate FRU Properties Fields core @{system_list}
262
George Keishingefa97352017-03-13 07:13:03 -0500263
George Keishingca8c61b2017-12-11 11:48:00 -0600264Verify Fan Properties
265 [Documentation] Verify the fan property fields.
266 [Tags] Verify_Fan_Properties
267 # Example:
268 # A fan property should have the following entries:
269 # "core":[
270 # "PrettyName",
271 # "Present",
272 # "MeetsMinimumShipLevel",
273 # "Functional"
274 # ]
275 # fan inventory:
276 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/fan0": {
277 # "Functional": 1,
278 # "MeetsMinimumShipLevel": 1,
279 # "Present": 1,
280 # "PrettyName": "fan0"
281 # },
282
283 ${system_list}= Get Endpoint Paths
284 ... ${HOST_INVENTORY_URI}system/chassis/motherboard fan*
285 Validate FRU Properties Fields fan @{system_list}
286
George Keishing071d8da2017-03-24 09:13:16 -0500287
288Verify Core Functional State
289 [Documentation] Verify that "Present" core property is set if "Functional"
290 ... core property is set.
291 [Tags] Verify_Core_Functional_State
292 # Example:
293 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core5":{
294 # "Functional": 1,
295 # "Present": 1,
296 # "PrettyName": ""
297 # },
298 ${core_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system core
299 :FOR ${core_uri} IN @{core_list}
300 \ ${status}= Run Keyword And Return Status
301 ... Check URL Property If Functional ${core_uri}
George Keishingc5658392017-04-27 23:05:18 -0500302 \ Continue For Loop If '${status}' == '${False}'
George Keishing071d8da2017-03-24 09:13:16 -0500303 \ ${present}= Read Attribute ${core_uri} Present
304 \ Should Be True ${present}
305 ... msg=${core_uri} is functional but not present.
306
307
308Verify DIMM Functional State
309 [Documentation] Verify that "Present" DIMM property is set if "Functional"
310 ... DIMM property is set.
311 [Tags] Verify_DIMM_Functional_State
312 # Example:
313 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
314 # "BuildDate": "",
315 # "Cached": 0,
316 # "FieldReplaceable": 1,
317 # "Functional": 1,
318 # "Manufacturer": "0xce80",
319 # "Model": "M393A1G40EB1-CRC ",
320 # "PartNumber": "",
321 # "Present": 1,
322 # "PrettyName": "0x0c",
323 # "SerialNumber": "0x0300cf4f",
324 # "Version": "0x00"
325 # },
326
327 ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm
328 :FOR ${dimm_uri} IN @{dimm_list}
329 \ ${status}= Run Keyword And Return Status
330 ... Check URL Property If Functional ${dimm_uri}
George Keishingc5658392017-04-27 23:05:18 -0500331 \ Continue For Loop If '${status}' == '${False}'
George Keishing071d8da2017-03-24 09:13:16 -0500332 \ ${present}= Read Attribute ${dimm_uri} Present
333 \ Should Be True ${present}
334 ... msg=${dimm_uri} is functional but not present.
335
George Keishing3c205b12017-05-13 04:09:33 -0500336
337Verify Fan Functional State
338 [Documentation] Verify that "Present" fan property is set if "Functional"
339 ... fan property is set.
340 [Tags] Verify_Fan_Functional_State
341 # Example:
342 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/fan0": {
343 # "Functional": 1,
344 # "Present": 1,
345 # "PrettyName": "fan0"
346 # },
347
348 ${fan_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system fan*
349 Should Not Be Empty ${fan_list}
350 :FOR ${fan_uri} IN @{fan_list}
351 \ ${status}= Run Keyword And Return Status
352 ... Check URL Property If Functional ${fan_uri}
353 \ Continue For Loop If '${status}' == '${False}'
354 \ ${present}= Read Attribute ${fan_uri} Present
355 \ Should Be True ${present}
356 ... msg=${fan_uri} is functional but "Present" is not set.
357
Sweta Potthuri56631f52017-11-10 02:19:38 -0600358Verify CPU Functional State
359 [Documentation] Verify that "Present" CPU property is set if "Functional"
360 ... CPU property is set.
361 [Tags] Verify_CPU_Functional_State
362
363 # Example of cpu* endpoint data:
364 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0": {
365 # "Functional": 1,
366 # "Present": 1,
367 # "PrettyName": "cpu0"
368 # },
369
370 ${cpu_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system cpu*
371 Should Not Be Empty ${cpu_list}
372 :FOR ${cpu_uri} IN @{cpu_list}
373 \ ${status}= Run Keyword And Return Status
374 ... Check URL Property If Functional ${cpu_uri}
375 \ Continue For Loop If '${status}' == '${False}'
376 \ ${present}= Read Attribute ${cpu_uri} Present
377 \ Should Be True ${present}
378 ... msg=${cpu_uri} is functional but "Present" is not set.
George Keishing3c205b12017-05-13 04:09:33 -0500379
George Keishing53a75f72017-11-17 12:50:30 -0600380
381Verify GPU Functional State
382 [Documentation] Verify that "Functional" GPU property is set if "Present"
383 ... GPU property is set
384 [Tags] Verify_GPU_Functional_State
385
386 # Example of gv* endpoint data:
387 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/gv100card4": {
388 # "Functional": 1,
389 # "Present": 1,
390 # "PrettyName": ""
391 # },
392
393
George Keishingc7b161b2017-12-01 09:58:12 -0600394 ${gpu_list}= Get Endpoint Paths
395 ... ${HOST_INVENTORY_URI}system/chassis/motherboard gv*
George Keishing53a75f72017-11-17 12:50:30 -0600396 Should Not Be Empty ${gpu_list}
397 :FOR ${gpu_uri} IN @{gpu_list}
398 \ ${status}= Run Keyword And Return Status
399 ... Check URL Property If Functional ${gpu_uri}
400 \ Continue For Loop If '${status}' == '${False}'
401 \ ${present}= Read Attribute ${gpu_uri} Present
402 \ Should Be True ${present}
403 ... msg=${gpu_uri} is functional but "Present" is not set.
404
405
George Keishing04c6b2c2017-06-15 12:33:59 -0500406Check Air Or Water Cooled
407 [Documentation] Check if this system is Air or water cooled.
408 [Tags] Check_Air_Or_Water_Cooled
409 # Example:
410 # "/xyz/openbmc_project/inventory/system/chassis": {
411 # "AirCooled": 1,
412 # "WaterCooled": 0
413 # },
414
415 ${air_cooled}= Read Attribute
416 ... /xyz/openbmc_project/inventory/system/chassis AirCooled
417 Log AirCooled:${air_cooled}
418
419 ${water_cooled}= Read Attribute
420 ... /xyz/openbmc_project/inventory/system/chassis WaterCooled
421 Log WaterCooled:${water_cooled}
422
423 Run Keyword If ${air_cooled}==${0} and ${water_cooled}==${0}
424 ... Fail Neither AirCooled or WaterCooled.
425
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500426Verify Minimal CPU Inventory
427 [Documentation] Verify minimal CPU inventory.
428 [Tags] Verify_Minimal_CPU_Inventory
429
430 # item minimum_count
431 cpu 1
432 [Template] Minimum Inventory
433
434Verify Minimal DIMM Inventory
435 [Documentation] Verify minimal DIMM inventory.
436 [Tags] Verify_Minimal_DIMM_Inventory
437
438 # item minimum_count
439 dimm 2
440 [Template] Minimum Inventory
441
442Verify Minimal Core Inventory
443 [Documentation] Verify minimal core inventory.
444 [Tags] Verify_Minimal_Core_Inventory
445
446 # item minimum_count
447 core 1
448 [Template] Minimum Inventory
449
450Verify Minimal Memory Buffer Inventory
451 [Documentation] Verify minimal memory buffer inventory.
452 [Tags] Verify_Minimal_Memory_Buffer_Inventory
453
454 # item minimum_count
455 memory_buffer 1
456 [Template] Minimum Inventory
457
458Verify Minimal Fan Inventory
459 [Documentation] Verify minimal fan inventory.
460 [Tags] Verify_Minimal_Fan_Inventory
461
462 # item minimum_count
463 fan 2
464 [Template] Minimum Inventory
465
466Verify Minimal Main Planar Inventory
467 [Documentation] Verify minimal main planar inventory.
468 [Tags] Verify_Minimal_Main_Planar_Inventory
469
470 # item minimum_count
471 main_planar 1
472 [Template] Minimum Inventory
473
474Verify Minimal System Inventory
475 [Documentation] Verify minimal system inventory.
476 [Tags] Verify_Minimal_System_Inventory
477
478 # item minimum_count
479 system 1
480 [Template] Minimum Inventory
George Keishing04c6b2c2017-06-15 12:33:59 -0500481
George Keishing03ebc292017-08-02 01:22:02 -0500482Verify Minimal Power Supply Inventory
483 [Documentation] Verify minimal power supply inventory.
484 [Tags] Verify_Minimal_Power_Supply_Inventory
485 # Example:
George Keishing1b71f222017-11-23 14:02:49 -0600486 # "/xyz/openbmc_project/inventory/system/chassis/powersupply0",
487 # "/xyz/openbmc_project/inventory/system/chassis/powersupply1",
George Keishing03ebc292017-08-02 01:22:02 -0500488
489 # item minimum_count
George Keishing1b71f222017-11-23 14:02:49 -0600490 powersupply 1
George Keishing03ebc292017-08-02 01:22:02 -0500491 [Template] Minimum Inventory
492
George Keishingfafbfdb2017-08-30 23:51:23 -0500493
494Verify Inventory List After Reboot
495 [Documentation] Verify inventory list after reboot.
496 [Tags] Verify_Inventory_List_After_Reboot
497
498 Repeat Keyword ${LOOP_COUNT} times Choose Boot Option reboot
499
500
501Verify Inventory List After Reset
502 [Documentation] Verify inventory list after reset.
503 [Tags] Verify_Inventory_List_After_Reset
504
505 Repeat Keyword ${LOOP_COUNT} times Choose Boot Option reset
506
Chris Austenb29d2e82016-06-07 12:25:35 -0500507*** Keywords ***
508
George Keishingda0aa882017-12-05 06:44:03 -0600509Suite Setup Execution
George Keishingc8166ed2017-02-24 03:53:38 -0600510 [Documentation] Do the initial suite setup.
George Keishing25577a22017-07-12 05:18:46 -0500511
Sweta Potthuriaf741cb2017-07-04 09:41:17 -0500512 # Boot Host.
George Keishingda0aa882017-12-05 06:44:03 -0600513 REST Power On stack_mode=skip quiet=1
George Keishingcaac9f32017-03-09 02:14:27 -0600514
George Keishingc8166ed2017-02-24 03:53:38 -0600515Get Inventory
516 [Documentation] Get the properties of an endpoint.
517 [Arguments] ${endpoint}
518 # Description of arguments:
519 # endpoint string for which url path ending.
520 # Example: "system" is the endpoint for url
521 # /xyz/openbmc_project/inventory/system
522 ${resp}= OpenBMC Get Request ${HOST_INVENTORY_URI}${endpoint}
523 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
524 ${jsondata}= To JSON ${resp.content}
525 [Return] ${jsondata}
George Keishingefa97352017-03-13 07:13:03 -0500526
527
528Qualified FRU List
529 [Documentation] Build the list of valid FRUs.
530 [Arguments] @{system_list}
531 # Description of arguments:
532 # system_list List of system inventory URLs.
533 # Example:
534 # /xyz/openbmc_project/inventory/system/chassis/motherboard
535 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
536 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
537 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
538 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm1
539 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm2
540 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm3
541 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm4
542 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm5
543 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm6
544 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm7
545
546 ${fru_list}= Create List
547 :FOR ${fru_uri} IN @{system_list}
George Keishingdf5ab122017-04-17 04:01:11 -0500548 \ ${resp}= OpenBMC Get Request ${fru_uri}/attr/FieldReplaceable
George Keishingda0aa882017-12-05 06:44:03 -0600549 ... quiet=${1}
George Keishingdf5ab122017-04-17 04:01:11 -0500550 \ ${jsondata}= To JSON ${resp.content}
551 \ ${status}= Run Keyword And Return Status
552 ... Should Be True ${jsondata['data']} == ${1}
George Keishingefa97352017-03-13 07:13:03 -0500553 \ Run Keyword If '${status}' == '${True}'
554 ... Append To List ${fru_list} ${fru_uri}
555
556 [Return] ${fru_list}
557
558
559Validate FRU Properties Fields
560 [Documentation] Compare valid FRUs from system vs expected FRU set.
George Keishingda0aa882017-12-05 06:44:03 -0600561 [Arguments] ${fru_type} @{fru_list}
562
George Keishingefa97352017-03-13 07:13:03 -0500563 # Description of arguments:
George Keishingda0aa882017-12-05 06:44:03 -0600564 # fru_type FRU type name (e.g. "gpu", "fru", "fan", etc.).
George Keishingefa97352017-03-13 07:13:03 -0500565 # fru_list List of qualified FRU URLs.
566
567 # Build the pre-defined set list from data/inventory.py derived from
568 # a group of YAML files.
569 # Example:
570 # set(['Version', 'PartNumber', 'SerialNumber', 'FieldReplaceable',
571 # 'BuildDate', 'Present', 'Manufacturer', 'PrettyName', 'Cached', 'Model'])
George Keishingda0aa882017-12-05 06:44:03 -0600572 ${fru_set}= List To Set ${inventory_dict['${fru_type}']}
George Keishingefa97352017-03-13 07:13:03 -0500573
574 # Iterate through the FRU's url and compare the set dictionary keys
575 # with the pre-define inventory data.
576 :FOR ${fru_url_path} IN @{fru_list}
577 \ ${fru_field}= Read Properties ${fru_url_path}
578 # ------------------------------------------------------------
579 # ${fru_field.viewkeys()} extracts the list of keys from the
580 # JSON dictionary as a set.
581 # ------------------------------------------------------------
582 \ Should Be Equal ${fru_field.viewkeys()} ${fru_set}
583
George Keishing071d8da2017-03-24 09:13:16 -0500584
585Check URL Property If Functional
586 [Arguments] ${url_path}
587 # Description of arguments:
588 # url_path Full url path of the inventory object.
589 # Example: DIMM / core property url's
590 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
591 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core0
592 ${state}= Read Attribute ${url_path} Functional
593 Should Be True ${state}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500594
George Keishingfafbfdb2017-08-30 23:51:23 -0500595Choose Boot Option
596 [Documentation] Choose BMC reset or host reboot.
597 [Arguments] ${option}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500598
George Keishingfafbfdb2017-08-30 23:51:23 -0500599 Run Keyword If '${option}' == 'reboot'
600 ... Verify Inventory List Before And After Reboot
601 ... ELSE
602 ... Verify Inventory List Before And After Reset
603
604
605Verify Inventory List Before And After Reboot
606 [Documentation] Verify inventory list before and after reboot.
607
George Keishingda0aa882017-12-05 06:44:03 -0600608 REST Power On stack_mode=skip quiet=1
George Keishingfafbfdb2017-08-30 23:51:23 -0500609 Delete Error Logs
610 ${inventory_before}= Get URL List ${HOST_INVENTORY_URI}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500611 Initiate Host Reboot
George Keishingf0680ee2017-08-19 15:22:53 -0500612 Wait Until Keyword Succeeds 10 min 10 sec Is OS Booted
George Keishingfafbfdb2017-08-30 23:51:23 -0500613 Delete Error Logs
614 ${inventory_after}= Get URL List ${HOST_INVENTORY_URI}
615 Lists Should Be Equal ${inventory_before} ${inventory_after}
616
617
618Verify Inventory List Before And After Reset
619 [Documentation] Verify inventory list before and after BMC reset.
620
George Keishingda0aa882017-12-05 06:44:03 -0600621 REST Power On stack_mode=skip quiet=1
George Keishingfafbfdb2017-08-30 23:51:23 -0500622 Delete Error Logs
623 ${inventory_before}= Get URL List ${HOST_INVENTORY_URI}
624 OBMC Reboot (run)
625 Delete Error Logs
626 ${inventory_after}= Get URL List ${HOST_INVENTORY_URI}
627 Lists Should Be Equal ${inventory_before} ${inventory_after}
628
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500629
630Minimum Inventory
631 [Documentation] Check for minimum inventory.
632 [Arguments] ${item} ${minimum_count}
633
634 # Description of argument(s):
635 # item Inventory name (example: "fan/cpu/dimm/etc").
636 # minimum_count The minimum number of the given item.
637
638 ${count}= Get Number Hardware Items ${item}
639 Should Be True ${count}>=${minimum_count}
640
641Get Number Hardware Items
642 [Documentation] Get the count of the total present currently on inventory.
643 [Arguments] ${item}
644
645 # Description of argument(s):
646 # item Inventory name (example: "fan/cpu/dimm/etc").
647
648 ${count_inventory} Set Variable ${0}
649 ${list}= Get Endpoint Paths ${HOST_INVENTORY_URI}/system/
650 ... ${item}
651
652 : FOR ${element} IN @{list}
653 \ ${present}= Read Properties ${element}
654 \ ${count_inventory}= Set Variable if ${present['Present']} == 1
655 \ ... ${count_inventory+1} ${count_inventory}
656 [return] ${count_inventory}