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