blob: a1799aae3f0ae5b7200491872c9f106f78b0d2c9 [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
George Keishingefa97352017-03-13 07:13:03 -05009Library ../lib/utilities.py
Chris Austenb29d2e82016-06-07 12:25:35 -050010
11Variables ../data/variables.py
George Keishingc8166ed2017-02-24 03:53:38 -060012Variables ../data/inventory.py
Chris Austenb29d2e82016-06-07 12:25:35 -050013
George Keishingc8166ed2017-02-24 03:53:38 -060014Suite setup Test Suite Setup
Rahul Maheshwari908df572017-02-16 04:41:54 -060015Test Teardown FFDC On Test Case Fail
Chris Austenb29d2e82016-06-07 12:25:35 -050016
Rahul Maheshwari3e9b0de2017-03-20 06:25:44 -050017Force Tags Inventory
18
Sweta Potthuri654cbc02017-06-15 10:10:55 -050019***Variables***
20
21${LOOP_COUNT} ${1}
22
Chris Austenb29d2e82016-06-07 12:25:35 -050023*** Test Cases ***
24
George Keishingc8166ed2017-02-24 03:53:38 -060025Verify System Inventory Path
26 [Documentation] Check if system inventory path exist.
27 [Tags] Verify_System_Inventory_Path
28 # When the host is booted, system inventory path should exist.
29 # Example: /xyz/openbmc_project/inventory/system
30 Get Inventory system
Chris Austenb29d2e82016-06-07 12:25:35 -050031
Rahul Maheshwaribb20f732016-10-24 06:27:14 -050032
George Keishing3d734312017-07-24 04:10:25 -050033Verify Boxelder Present Property
34 [Documentation] Boxelder should be present by default.
35 [Tags] Verify that boxelder 'Present' property is present by default.
36 # Example:
37 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc":
38 # {
39 # "BuildDate": "",
40 # "FieldReplaceable": 0,
41 # "Manufacturer": "IBM",
42 # "Model": "",
43 # "PartNumber": "01DH051",
44 # "Present": 1,
45 # "PrettyName": "BMC PLANAR ",
46 # "SerialNumber": "000000000000"
47 # },
48 ${json_data}= Get Inventory system/chassis/motherboard/boxelder/bmc
49 Should Be True ${json_data["data"]["Present"]}
50
51
52Verify Boxelder MAC Address Property Is Populated
53 [Documentation] Boxelder should be present by default.
54 [Tags] Verify_Boxelder_MAC_Address_Property_Is_Populated
55 # Example:
56 # /xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc/ethernet
57 # {
58 # "FieldReplaceable": 0,
59 # "MACAddress": "00:00:00:00:00:00",
60 # "Present": 1,
61 # "PrettyName": ""
62 # }
63
64 ${json_data}= Get Inventory
65 ... system/chassis/motherboard/boxelder/bmc/ethernet
66 Should Be True ${json_data["data"]["Present"]}
67 Should Not Be Equal As Strings
68 ... ${json_data["data"]["MACAddress"]} 00:00:00:00:00:00
69
70 # eth0 Link encap:Ethernet HWaddr 70:E2:84:14:23:F9
71 ${mac_addr} ${stderr} ${rc}= BMC Execute Command
72 ... /sbin/ifconfig -a | grep HWaddr | awk -F'HWaddr ' '{print $2}'
73 ... return_stderr=True
74 Should Be Empty ${stderr}
75 Should Be Equal As Strings ${json_data["data"]["MACAddress"]} ${mac_addr}
76 ... msg=MAC address configured incorrectly.
77
78
George Keishingc8166ed2017-02-24 03:53:38 -060079Verify Chassis Motherboard Properties
80 [Documentation] Check if chassis motherboard properties are
81 ... populated valid.
82 [Tags] Verify_Chassis_Motherboard_Properties
83 # When the host is booted, the following properties should
84 # be populated Manufacturer, PartNumber, SerialNumber and
85 # it should not be zero's.
86 # Example:
87 # "data": {
88 # "/xyz/openbmc_project/inventory/system/chassis/motherboard": {
89 # "BuildDate": "",
90 # "Manufacturer": "0000000000000000",
91 # "Model": "",
92 # "PartNumber": "0000000",
93 # "Present": 0,
94 # "PrettyName": "SYSTEM PLANAR ",
95 # "SerialNumber": "000000000000"
96 # }
97 ${properties}= Get Inventory system/chassis/motherboard
98 Should Not Be Equal As Strings
99 ... ${properties["data"]["Manufacturer"]} 0000000000000000
100 ... msg=motherboard field invalid.
101 Should Not Be Equal As Strings
102 ... ${properties["data"]["PartNumber"]} 0000000
103 ... msg=motherboard part number invalid.
104 Should Not Be Equal As Strings
105 ... ${properties["data"]["SerialNumber"]} 000000000000
106 ... msg=motherboard serial number invalid.
Chris Austenb29d2e82016-06-07 12:25:35 -0500107
George Keishingae355302017-03-13 04:34:58 -0500108Verify CPU Present
109 [Documentation] Check if the FRU "Present" is set for CPU's.
110 [Tags] Verify_CPU_Present
111 # System inventory cpu list:
112 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
113 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
114 # Example:
115 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0": {
116 # "FieldReplaceable": 1,
117 # "BuildDate": "",
118 # "Cached": 0,
119 # "SerialNumber": "YA3933741574",
120 # "Version": "10",
121 # "Model": "",
122 # "PrettyName": "PROCESSOR MODULE",
123 # "PartNumber": "01HL322",
124 # "Present": 1,
125 # "Manufacturer": "IBM"
126 # },
127 # The CPU properties "Present" should be boolean 1.
128
129 ${cpu_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system cpu
130 :FOR ${cpu_uri} IN @{cpu_list}
131 \ ${present}= Read Attribute ${cpu_uri} Present
132 \ Should Be True ${present}
133
134
135Verify DIMM Present
136 [Documentation] Check if the FRU "Present" is set for DIMM's.
137 [Tags] Verify_DIMM_Present
138 # Example:
139 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
140 # "FieldReplaceable": 1,
141 # "BuildDate": "",
142 # "Cached": 0,
143 # "SerialNumber": "0x0300cf4f",
144 # "Version": "0x00",
145 # "Model": "M393A1G40EB1-CRC ",
146 # "PrettyName": "0x0c",
147 # "PartNumber": "",
148 # "Present": 1,
149 # "Manufacturer": "0xce80"
150 # },
151
152 # The DIMM properties "Present" should be boolean 1.
153
154 ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm
155 :FOR ${dimm_uri} IN @{dimm_list}
156 \ ${present}= Read Attribute ${dimm_uri} Present
157 \ Should Be True ${present}
158
159
George Keishingefa97352017-03-13 07:13:03 -0500160Verify FRU Properties
161 [Documentation] Verify the FRU properties fields.
162 [Tags] Verify_FRU_Properties
163 # Example:
164 # A FRU would have "FieldReplaceable" set to boolean 1 and should have
165 # the following entries
166 # "fru": [
167 # "FieldReplaceable"
168 # "BuildDate",
169 # "Cached"
170 # "SerialNumber",
171 # "Version",
172 # "Model",
173 # "PrettyName",
174 # "PartNumber",
175 # "Present",
176 # "Manufacturer",
177 # ]
178 # and FRU which doesn't have one of this fields is an error.
179 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
180 # "FieldReplaceable": 1,
181 # "BuildDate": "",
182 # "Cached": 0,
183 # "SerialNumber": "0x0300cf4f",
184 # "Version": "0x00",
185 # "Model": "M393A1G40EB1-CRC ",
186 # "PrettyName": "0x0c",
187 # "PartNumber": "",
188 # "Present": 1,
189 # "Manufacturer": "0xce80"
190 # },
191
192 ${system_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system *
193 ${fru_list}= Qualified FRU List @{system_list}
194 Validate FRU Properties Fields @{fru_list}
195
George Keishing071d8da2017-03-24 09:13:16 -0500196
197Verify Core Functional State
198 [Documentation] Verify that "Present" core property is set if "Functional"
199 ... core property is set.
200 [Tags] Verify_Core_Functional_State
201 # Example:
202 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core5":{
203 # "Functional": 1,
204 # "Present": 1,
205 # "PrettyName": ""
206 # },
207 ${core_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system core
208 :FOR ${core_uri} IN @{core_list}
209 \ ${status}= Run Keyword And Return Status
210 ... Check URL Property If Functional ${core_uri}
George Keishingc5658392017-04-27 23:05:18 -0500211 \ Continue For Loop If '${status}' == '${False}'
George Keishing071d8da2017-03-24 09:13:16 -0500212 \ ${present}= Read Attribute ${core_uri} Present
213 \ Should Be True ${present}
214 ... msg=${core_uri} is functional but not present.
215
216
217Verify DIMM Functional State
218 [Documentation] Verify that "Present" DIMM property is set if "Functional"
219 ... DIMM property is set.
220 [Tags] Verify_DIMM_Functional_State
221 # Example:
222 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
223 # "BuildDate": "",
224 # "Cached": 0,
225 # "FieldReplaceable": 1,
226 # "Functional": 1,
227 # "Manufacturer": "0xce80",
228 # "Model": "M393A1G40EB1-CRC ",
229 # "PartNumber": "",
230 # "Present": 1,
231 # "PrettyName": "0x0c",
232 # "SerialNumber": "0x0300cf4f",
233 # "Version": "0x00"
234 # },
235
236 ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm
237 :FOR ${dimm_uri} IN @{dimm_list}
238 \ ${status}= Run Keyword And Return Status
239 ... Check URL Property If Functional ${dimm_uri}
George Keishingc5658392017-04-27 23:05:18 -0500240 \ Continue For Loop If '${status}' == '${False}'
George Keishing071d8da2017-03-24 09:13:16 -0500241 \ ${present}= Read Attribute ${dimm_uri} Present
242 \ Should Be True ${present}
243 ... msg=${dimm_uri} is functional but not present.
244
George Keishing3c205b12017-05-13 04:09:33 -0500245
246Verify Fan Functional State
247 [Documentation] Verify that "Present" fan property is set if "Functional"
248 ... fan property is set.
249 [Tags] Verify_Fan_Functional_State
250 # Example:
251 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/fan0": {
252 # "Functional": 1,
253 # "Present": 1,
254 # "PrettyName": "fan0"
255 # },
256
257 ${fan_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system fan*
258 Should Not Be Empty ${fan_list}
259 :FOR ${fan_uri} IN @{fan_list}
260 \ ${status}= Run Keyword And Return Status
261 ... Check URL Property If Functional ${fan_uri}
262 \ Continue For Loop If '${status}' == '${False}'
263 \ ${present}= Read Attribute ${fan_uri} Present
264 \ Should Be True ${present}
265 ... msg=${fan_uri} is functional but "Present" is not set.
266
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500267Verify Inventory List After Reboot
268 [Documentation] Verify Inventory List After Reboot
269 [Tags] Verify_Inventory_List_After_Reboot
270
271 Repeat Keyword ${LOOP_COUNT} times Verify Inventory List Before And After Reboot
George Keishing3c205b12017-05-13 04:09:33 -0500272
George Keishing04c6b2c2017-06-15 12:33:59 -0500273Check Air Or Water Cooled
274 [Documentation] Check if this system is Air or water cooled.
275 [Tags] Check_Air_Or_Water_Cooled
276 # Example:
277 # "/xyz/openbmc_project/inventory/system/chassis": {
278 # "AirCooled": 1,
279 # "WaterCooled": 0
280 # },
281
282 ${air_cooled}= Read Attribute
283 ... /xyz/openbmc_project/inventory/system/chassis AirCooled
284 Log AirCooled:${air_cooled}
285
286 ${water_cooled}= Read Attribute
287 ... /xyz/openbmc_project/inventory/system/chassis WaterCooled
288 Log WaterCooled:${water_cooled}
289
290 Run Keyword If ${air_cooled}==${0} and ${water_cooled}==${0}
291 ... Fail Neither AirCooled or WaterCooled.
292
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500293Verify Minimal CPU Inventory
294 [Documentation] Verify minimal CPU inventory.
295 [Tags] Verify_Minimal_CPU_Inventory
296
297 # item minimum_count
298 cpu 1
299 [Template] Minimum Inventory
300
301Verify Minimal DIMM Inventory
302 [Documentation] Verify minimal DIMM inventory.
303 [Tags] Verify_Minimal_DIMM_Inventory
304
305 # item minimum_count
306 dimm 2
307 [Template] Minimum Inventory
308
309Verify Minimal Core Inventory
310 [Documentation] Verify minimal core inventory.
311 [Tags] Verify_Minimal_Core_Inventory
312
313 # item minimum_count
314 core 1
315 [Template] Minimum Inventory
316
317Verify Minimal Memory Buffer Inventory
318 [Documentation] Verify minimal memory buffer inventory.
319 [Tags] Verify_Minimal_Memory_Buffer_Inventory
320
321 # item minimum_count
322 memory_buffer 1
323 [Template] Minimum Inventory
324
325Verify Minimal Fan Inventory
326 [Documentation] Verify minimal fan inventory.
327 [Tags] Verify_Minimal_Fan_Inventory
328
329 # item minimum_count
330 fan 2
331 [Template] Minimum Inventory
332
333Verify Minimal Main Planar Inventory
334 [Documentation] Verify minimal main planar inventory.
335 [Tags] Verify_Minimal_Main_Planar_Inventory
336
337 # item minimum_count
338 main_planar 1
339 [Template] Minimum Inventory
340
341Verify Minimal System Inventory
342 [Documentation] Verify minimal system inventory.
343 [Tags] Verify_Minimal_System_Inventory
344
345 # item minimum_count
346 system 1
347 [Template] Minimum Inventory
George Keishing04c6b2c2017-06-15 12:33:59 -0500348
George Keishing03ebc292017-08-02 01:22:02 -0500349Verify Minimal Power Supply Inventory
350 [Documentation] Verify minimal power supply inventory.
351 [Tags] Verify_Minimal_Power_Supply_Inventory
352 # Example:
353 # "/xyz/openbmc_project/inventory/system/chassis/power_supply0",
354 # "/xyz/openbmc_project/inventory/system/chassis/power_supply1",
355
356 # item minimum_count
357 power_supply 1
358 [Template] Minimum Inventory
359
Chris Austenb29d2e82016-06-07 12:25:35 -0500360*** Keywords ***
361
George Keishingc8166ed2017-02-24 03:53:38 -0600362Test Suite Setup
363 [Documentation] Do the initial suite setup.
George Keishing25577a22017-07-12 05:18:46 -0500364
365 # Reboot host to re-power on clean if host is not "off".
George Keishingc8166ed2017-02-24 03:53:38 -0600366 ${current_state}= Get Host State
367 Run Keyword If '${current_state}' == 'Off'
368 ... Initiate Host Boot
George Keishing25577a22017-07-12 05:18:46 -0500369 ... ELSE Initiate Host Reboot
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500370
George Keishingcaac9f32017-03-09 02:14:27 -0600371 Wait Until Keyword Succeeds
372 ... 10 min 10 sec Is OS Starting
373
George Keishingc8166ed2017-02-24 03:53:38 -0600374Get Inventory
375 [Documentation] Get the properties of an endpoint.
376 [Arguments] ${endpoint}
377 # Description of arguments:
378 # endpoint string for which url path ending.
379 # Example: "system" is the endpoint for url
380 # /xyz/openbmc_project/inventory/system
381 ${resp}= OpenBMC Get Request ${HOST_INVENTORY_URI}${endpoint}
382 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
383 ${jsondata}= To JSON ${resp.content}
384 [Return] ${jsondata}
George Keishingefa97352017-03-13 07:13:03 -0500385
386
387Qualified FRU List
388 [Documentation] Build the list of valid FRUs.
389 [Arguments] @{system_list}
390 # Description of arguments:
391 # system_list List of system inventory URLs.
392 # Example:
393 # /xyz/openbmc_project/inventory/system/chassis/motherboard
394 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
395 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
396 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
397 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm1
398 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm2
399 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm3
400 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm4
401 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm5
402 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm6
403 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm7
404
405 ${fru_list}= Create List
406 :FOR ${fru_uri} IN @{system_list}
George Keishingdf5ab122017-04-17 04:01:11 -0500407 \ ${resp}= OpenBMC Get Request ${fru_uri}/attr/FieldReplaceable
408 \ ${jsondata}= To JSON ${resp.content}
409 \ ${status}= Run Keyword And Return Status
410 ... Should Be True ${jsondata['data']} == ${1}
George Keishingefa97352017-03-13 07:13:03 -0500411 \ Run Keyword If '${status}' == '${True}'
412 ... Append To List ${fru_list} ${fru_uri}
413
414 [Return] ${fru_list}
415
416
417Validate FRU Properties Fields
418 [Documentation] Compare valid FRUs from system vs expected FRU set.
419 [Arguments] @{fru_list}
420 # Description of arguments:
421 # fru_list List of qualified FRU URLs.
422
423 # Build the pre-defined set list from data/inventory.py derived from
424 # a group of YAML files.
425 # Example:
426 # set(['Version', 'PartNumber', 'SerialNumber', 'FieldReplaceable',
427 # 'BuildDate', 'Present', 'Manufacturer', 'PrettyName', 'Cached', 'Model'])
428 ${fru_set}= List To Set ${inventory_dict['fru']}
429
430 # Iterate through the FRU's url and compare the set dictionary keys
431 # with the pre-define inventory data.
432 :FOR ${fru_url_path} IN @{fru_list}
433 \ ${fru_field}= Read Properties ${fru_url_path}
434 # ------------------------------------------------------------
435 # ${fru_field.viewkeys()} extracts the list of keys from the
436 # JSON dictionary as a set.
437 # ------------------------------------------------------------
438 \ Should Be Equal ${fru_field.viewkeys()} ${fru_set}
439
George Keishing071d8da2017-03-24 09:13:16 -0500440
441Check URL Property If Functional
442 [Arguments] ${url_path}
443 # Description of arguments:
444 # url_path Full url path of the inventory object.
445 # Example: DIMM / core property url's
446 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
447 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core0
448 ${state}= Read Attribute ${url_path} Functional
449 Should Be True ${state}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500450
451Verify Inventory List Before And After Reboot
452 [Documentation] Verify Inventory list before and after reboot.
453
454 Initiate Host Boot
455 Wait Until Keyword Succeeds 10 min 10 sec Is OS Starting
456 ${inv_before}= Get URL List ${HOST_INVENTORY_URI}
457 Initiate Host Reboot
458 Wait Until Keyword Succeeds 10 min 10 sec Is OS Starting
459 ${inv_after}= Get URL List ${HOST_INVENTORY_URI}
460 Lists Should Be Equal ${inv_before} ${inv_after}
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500461
462Minimum Inventory
463 [Documentation] Check for minimum inventory.
464 [Arguments] ${item} ${minimum_count}
465
466 # Description of argument(s):
467 # item Inventory name (example: "fan/cpu/dimm/etc").
468 # minimum_count The minimum number of the given item.
469
470 ${count}= Get Number Hardware Items ${item}
471 Should Be True ${count}>=${minimum_count}
472
473Get Number Hardware Items
474 [Documentation] Get the count of the total present currently on inventory.
475 [Arguments] ${item}
476
477 # Description of argument(s):
478 # item Inventory name (example: "fan/cpu/dimm/etc").
479
480 ${count_inventory} Set Variable ${0}
481 ${list}= Get Endpoint Paths ${HOST_INVENTORY_URI}/system/
482 ... ${item}
483
484 : FOR ${element} IN @{list}
485 \ ${present}= Read Properties ${element}
486 \ ${count_inventory}= Set Variable if ${present['Present']} == 1
487 \ ... ${count_inventory+1} ${count_inventory}
488 [return] ${count_inventory}