blob: 34694c4c5ec1b39ed937a3e4799829dc77c1446c [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
George Keishingefa97352017-03-13 07:13:03 -05008Library ../lib/utilities.py
Chris Austenb29d2e82016-06-07 12:25:35 -05009
10Variables ../data/variables.py
George Keishingc8166ed2017-02-24 03:53:38 -060011Variables ../data/inventory.py
Chris Austenb29d2e82016-06-07 12:25:35 -050012
George Keishingc8166ed2017-02-24 03:53:38 -060013Suite setup Test Suite Setup
Rahul Maheshwari908df572017-02-16 04:41:54 -060014Test Teardown FFDC On Test Case Fail
Chris Austenb29d2e82016-06-07 12:25:35 -050015
Rahul Maheshwari3e9b0de2017-03-20 06:25:44 -050016Force Tags Inventory
17
Chris Austenb29d2e82016-06-07 12:25:35 -050018*** Test Cases ***
19
George Keishingc8166ed2017-02-24 03:53:38 -060020Verify System Inventory Path
21 [Documentation] Check if system inventory path exist.
22 [Tags] Verify_System_Inventory_Path
23 # When the host is booted, system inventory path should exist.
24 # Example: /xyz/openbmc_project/inventory/system
25 Get Inventory system
Chris Austenb29d2e82016-06-07 12:25:35 -050026
Rahul Maheshwaribb20f732016-10-24 06:27:14 -050027
George Keishingc8166ed2017-02-24 03:53:38 -060028Verify Chassis Motherboard Properties
29 [Documentation] Check if chassis motherboard properties are
30 ... populated valid.
31 [Tags] Verify_Chassis_Motherboard_Properties
32 # When the host is booted, the following properties should
33 # be populated Manufacturer, PartNumber, SerialNumber and
34 # it should not be zero's.
35 # Example:
36 # "data": {
37 # "/xyz/openbmc_project/inventory/system/chassis/motherboard": {
38 # "BuildDate": "",
39 # "Manufacturer": "0000000000000000",
40 # "Model": "",
41 # "PartNumber": "0000000",
42 # "Present": 0,
43 # "PrettyName": "SYSTEM PLANAR ",
44 # "SerialNumber": "000000000000"
45 # }
46 ${properties}= Get Inventory system/chassis/motherboard
47 Should Not Be Equal As Strings
48 ... ${properties["data"]["Manufacturer"]} 0000000000000000
49 ... msg=motherboard field invalid.
50 Should Not Be Equal As Strings
51 ... ${properties["data"]["PartNumber"]} 0000000
52 ... msg=motherboard part number invalid.
53 Should Not Be Equal As Strings
54 ... ${properties["data"]["SerialNumber"]} 000000000000
55 ... msg=motherboard serial number invalid.
Chris Austenb29d2e82016-06-07 12:25:35 -050056
George Keishingae355302017-03-13 04:34:58 -050057Verify CPU Present
58 [Documentation] Check if the FRU "Present" is set for CPU's.
59 [Tags] Verify_CPU_Present
60 # System inventory cpu list:
61 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
62 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
63 # Example:
64 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0": {
65 # "FieldReplaceable": 1,
66 # "BuildDate": "",
67 # "Cached": 0,
68 # "SerialNumber": "YA3933741574",
69 # "Version": "10",
70 # "Model": "",
71 # "PrettyName": "PROCESSOR MODULE",
72 # "PartNumber": "01HL322",
73 # "Present": 1,
74 # "Manufacturer": "IBM"
75 # },
76 # The CPU properties "Present" should be boolean 1.
77
78 ${cpu_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system cpu
79 :FOR ${cpu_uri} IN @{cpu_list}
80 \ ${present}= Read Attribute ${cpu_uri} Present
81 \ Should Be True ${present}
82
83
84Verify DIMM Present
85 [Documentation] Check if the FRU "Present" is set for DIMM's.
86 [Tags] Verify_DIMM_Present
87 # Example:
88 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
89 # "FieldReplaceable": 1,
90 # "BuildDate": "",
91 # "Cached": 0,
92 # "SerialNumber": "0x0300cf4f",
93 # "Version": "0x00",
94 # "Model": "M393A1G40EB1-CRC ",
95 # "PrettyName": "0x0c",
96 # "PartNumber": "",
97 # "Present": 1,
98 # "Manufacturer": "0xce80"
99 # },
100
101 # The DIMM properties "Present" should be boolean 1.
102
103 ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm
104 :FOR ${dimm_uri} IN @{dimm_list}
105 \ ${present}= Read Attribute ${dimm_uri} Present
106 \ Should Be True ${present}
107
108
George Keishingefa97352017-03-13 07:13:03 -0500109Verify FRU Properties
110 [Documentation] Verify the FRU properties fields.
111 [Tags] Verify_FRU_Properties
112 # Example:
113 # A FRU would have "FieldReplaceable" set to boolean 1 and should have
114 # the following entries
115 # "fru": [
116 # "FieldReplaceable"
117 # "BuildDate",
118 # "Cached"
119 # "SerialNumber",
120 # "Version",
121 # "Model",
122 # "PrettyName",
123 # "PartNumber",
124 # "Present",
125 # "Manufacturer",
126 # ]
127 # and FRU which doesn't have one of this fields is an error.
128 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
129 # "FieldReplaceable": 1,
130 # "BuildDate": "",
131 # "Cached": 0,
132 # "SerialNumber": "0x0300cf4f",
133 # "Version": "0x00",
134 # "Model": "M393A1G40EB1-CRC ",
135 # "PrettyName": "0x0c",
136 # "PartNumber": "",
137 # "Present": 1,
138 # "Manufacturer": "0xce80"
139 # },
140
141 ${system_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system *
142 ${fru_list}= Qualified FRU List @{system_list}
143 Validate FRU Properties Fields @{fru_list}
144
Chris Austenb29d2e82016-06-07 12:25:35 -0500145*** Keywords ***
146
George Keishingc8166ed2017-02-24 03:53:38 -0600147Test Suite Setup
148 [Documentation] Do the initial suite setup.
149 ${current_state}= Get Host State
150 Run Keyword If '${current_state}' == 'Off'
151 ... Initiate Host Boot
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500152
George Keishingcaac9f32017-03-09 02:14:27 -0600153 Wait Until Keyword Succeeds
154 ... 10 min 10 sec Is OS Starting
155
Chris Austenb29d2e82016-06-07 12:25:35 -0500156
George Keishingc8166ed2017-02-24 03:53:38 -0600157Get Inventory
158 [Documentation] Get the properties of an endpoint.
159 [Arguments] ${endpoint}
160 # Description of arguments:
161 # endpoint string for which url path ending.
162 # Example: "system" is the endpoint for url
163 # /xyz/openbmc_project/inventory/system
164 ${resp}= OpenBMC Get Request ${HOST_INVENTORY_URI}${endpoint}
165 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
166 ${jsondata}= To JSON ${resp.content}
167 [Return] ${jsondata}
George Keishingefa97352017-03-13 07:13:03 -0500168
169
170Qualified FRU List
171 [Documentation] Build the list of valid FRUs.
172 [Arguments] @{system_list}
173 # Description of arguments:
174 # system_list List of system inventory URLs.
175 # Example:
176 # /xyz/openbmc_project/inventory/system/chassis/motherboard
177 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
178 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
179 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
180 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm1
181 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm2
182 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm3
183 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm4
184 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm5
185 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm6
186 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm7
187
188 ${fru_list}= Create List
189 :FOR ${fru_uri} IN @{system_list}
190 \ ${is_fru}= OpenBMC Get Request ${fru_uri}/attr/FieldReplaceable
191 \ ${status}= Run Keyword And Return Status Should Be True ${is_fru}
192 \ Run Keyword If '${status}' == '${True}'
193 ... Append To List ${fru_list} ${fru_uri}
194
195 [Return] ${fru_list}
196
197
198Validate FRU Properties Fields
199 [Documentation] Compare valid FRUs from system vs expected FRU set.
200 [Arguments] @{fru_list}
201 # Description of arguments:
202 # fru_list List of qualified FRU URLs.
203
204 # Build the pre-defined set list from data/inventory.py derived from
205 # a group of YAML files.
206 # Example:
207 # set(['Version', 'PartNumber', 'SerialNumber', 'FieldReplaceable',
208 # 'BuildDate', 'Present', 'Manufacturer', 'PrettyName', 'Cached', 'Model'])
209 ${fru_set}= List To Set ${inventory_dict['fru']}
210
211 # Iterate through the FRU's url and compare the set dictionary keys
212 # with the pre-define inventory data.
213 :FOR ${fru_url_path} IN @{fru_list}
214 \ ${fru_field}= Read Properties ${fru_url_path}
215 # ------------------------------------------------------------
216 # ${fru_field.viewkeys()} extracts the list of keys from the
217 # JSON dictionary as a set.
218 # ------------------------------------------------------------
219 \ Should Be Equal ${fru_field.viewkeys()} ${fru_set}
220