blob: 10eb7933e29d8a9533f77bb30a9f029f841afc5a [file] [log] [blame]
Rahul Maheshwari35aa8d52018-03-11 23:56:51 -05001*** Settings ***
2Documentation Test IPMI FRU data.
3
4Resource ../../lib/rest_client.robot
5Resource ../../lib/ipmi_client.robot
6Resource ../../lib/openbmc_ffdc.robot
7Resource ../../lib/boot_utils.robot
8Library ../../lib/ipmi_utils.py
9
10Variables ../data/ipmi_rest_fru_field_map.py
11
12Test Teardown Test Teardown Execution
13Suite Setup Suite Setup Execution
14
15
16*** Test Cases ***
17
18Test FRU Info At Power On
19 [Documentation] Verify FRU info via IPMI and REST at power on.
20 [Tags] Test_FRU_Info_At_Power_On
21 [Template] Verify FRU Info
22
23 # component_name
24 cpu
25 dimm
26 fan
27 bmc
28 system
29 powersupply
30 gv100card
31
32
33*** Keywords ***
34
35Get Component Fru Info Via REST
36 [Documentation] Get FRU Information Via REST for the given component.
37 [Arguments] ${component_name}
38
39 # Description of argument(s):
40 # component_name The name of the component (e.g. "cpu", "dimm", etc.).
41
42 ${inventory_uris}= Read Properties ${HOST_INVENTORY_URI}list quiet=${1}
43 # From the inventory_uris, select just the ones for the component of
44 # interest.
45 ${component_uris}= Get Matches ${inventory_uris}
Michael Walshd917c6e2018-12-11 10:09:09 -060046 ... regexp=^.*[0-9a-z_].${component_name}\[0-9]*$
Rahul Maheshwari35aa8d52018-03-11 23:56:51 -050047
48 # Get the component information for each record.
49 ${component_frus}= Create List
50 : FOR ${component_uri} IN @{component_uris}
51 \ ${result}= Read Properties ${component_uri} quiet=${1}
52 \ ${component}= Fetch From Right ${component_uri} /
53 \ Set To Dictionary ${result} fru_device_description ${component}
54 \ Append To List ${component_frus} ${result}
55 [Return] ${component_frus}
56
57
58Verify FRU Info
59 [Documentation] Verify FRU information of given component.
60 [Arguments] ${component_name}
61
62 # Description of argument(s):
63 # component_name The name of the component (e.g. "cpu", "dimm", etc.).
64
65 ${ipmi_fru_component_info}= Get Component FRU Info ${component_name}
66 ... ${fru_objs}
67 # Example of output from "Get Component FRU Info" keyword for CPU component.
68 #
69 # ipmi_fru_info:
70 # ipmi_fru_info[0]:
71 # [fru_device_description]: cpu0 (ID 1)
72 # [board_mfg_date]: Sun Dec 31 18:00:00 1995
73 # [board_mfg]: <Manufacturer Name>
74 # [board_product]: PROCESSOR MODULE
75 # [board_serial]: YA1934301835
76 # [board_part_number]: 02CY211
77 # ipmi_fru_info[1]:
78 # [fru_device_description]: cpu1 (ID 2)
79 # [board_mfg_date]: Sun Dec 31 18:00:00 1995
80 # [board_mfg]: <Manufacturer Name>
81 # [board_product]: PROCESSOR MODULE
82 # [board_serial]: YA1934301834
83 # [board_part_number]: 02CY211
84
85 ${rest_fru_component_info}= Get Component FRU Info Via REST
86 ... ${component_name}
87 # Example of output from "Get Component FRU Info Via REST" keyword for
88 # CPU component.
89 #
90 # rest_fru_info:
91 # rest_fru_info[0]:
92 # [FieldReplaceable]: 1
93 # [BuildDate]: 1996-01-01 - 00:00:00
94 # [fru_device_description]: cpu0
95 # [Cached]: 0
96 # [SerialNumber]: YA1934301835
97 # [Functional]: 1
98 # [Version]: 22
99 # [Model]: <blank>
100 # [PrettyName]: PROCESSOR MODULE
101 # [PartNumber]: 02CY211
102 # [Present]: 1
103 # [Manufacturer]: <Manufacturer Name>
104 # rest_fru_info[1]:
105 # [FieldReplaceable]: 1
106 # [BuildDate]: 1996-01-01 - 00:00:00
107 # [fru_device_description]: cpu1
108 # [Cached]: 0
109 # [SerialNumber]: YA1934301834
110 # [Functional]: 1
111 # [Version]: 22
112 # [Model]: <blank>
113 # [PrettyName]: PROCESSOR MODULE
114 # [PartNumber]: 02CY211
115 # [Present]: 1
116 # [Manufacturer]: <Manufacturer Name>
117
118 ${inventory_uris}= Read Properties
119 ... ${HOST_INVENTORY_URI}list quiet=${1}
120
121 # From the inventory_uris, select just the ones for the component of
122 # interest. Example for cpu:
123 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
124 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
125 ${component_uris}= Get Matches ${inventory_uris}
Michael Walshd917c6e2018-12-11 10:09:09 -0600126 ... regexp=^.*[0-9a-z_].${component_name}\[0-9]*$
Rahul Maheshwari35aa8d52018-03-11 23:56:51 -0500127
128 : FOR ${uri} IN @{component_uris}
129 \ ${sub_component}= Fetch From Right ${uri} /
130 \ ${ipmi_index}= Get Index Of FRU Sub Component Info
131 \ ... ${ipmi_fru_component_info} ${sub_component}
132 \ ${rest_index}= Get Index Of FRU Sub Component Info
133 \ ... ${rest_fru_component_info} ${sub_component}
134 \ ${ipmi_fru_sub_component}=
135 \ ... Get From List ${ipmi_fru_component_info} ${ipmi_index}
136 \ ${rest_fru_sub_component}=
137 \ ... Get From List ${rest_fru_component_info} ${rest_index}
138 \ Compare IPMI And REST FRU Component Info ${ipmi_fru_sub_component}
139 \ ... ${rest_fru_sub_component} ${component_name}
140
141
142Get Index Of FRU Sub Component Info
143 [Documentation] Get index of FRU sub component info from FRU component
144 ... data.
145 [Arguments] ${fru_component_info} ${sub_component}
146 # fru_component_info FRU component data as a list of dictionaries.
147 # ipmi_cpu_fru_info[0]:
148 # fru_device_description: cpu0 (ID 1)
149 # board_mfg_date: Sun Dec 31 18:00:00 1995
150 # board_mfg: <Manufacturer Name>
151 # board_product: PROCESSOR MODULE
152 # board_serial: YA1934302970
153 # board_part_number: 02CY211
154 # ipmi_cpu_fru_info[1]:
155 # fru_device_description: cpu1 (ID 2)
156 # board_mfg_date: Sun Dec 31 18:00:00 1995
157 # board_mfg: <Manufacturer Name>
158 # board_product: PROCESSOR MODULE
159 # board_serial: YA1934302965
160 # board_part_number: 02CY211
161 # sub_component Sub component name (e.g. "cpu0", "cpu1", etc.).
162
163 ${sub_component_count}= Get Length ${fru_component_info}
164 ${index}= Set Variable ${0}
165
166 : FOR ${rest_fru_sub_component} IN @{fru_component_info}
167 \ ${fru_component_section}=
168 \ ... Get From List ${fru_component_info} ${index}
Rahul Maheshwari23097dd2019-01-21 03:47:54 -0600169 \ # Get FRU name from IPMI's fru_device_description field.
170 \ # Example "cpu0" from "cpu0 (ID 1)".
171 \ ${fru_name}= Fetch From Left
172 \ ... ${fru_component_section['fru_device_description']} ${SPACE}
173 \ ${status}= Run Keyword And Return Status Should Be Equal
174 \ ... ${fru_name} ${sub_component}
Rahul Maheshwari35aa8d52018-03-11 23:56:51 -0500175 \ Exit For Loop If '${status}' == '${True}'
176 \ ${index}= Evaluate ${index} + 1
177 \ Exit For Loop If ${index} >= ${sub_component_count}
178
179 [Return] ${index}
180
181
182Compare IPMI And REST FRU Component Info
183 [Documentation] Compare IPMI And REST FRU Component data objects.
184 [Arguments] ${ipmi_fru_component_obj} ${rest_fru_component_obj}
185 ... ${component_name}
186
187 # Description of argument(s):
188 # ipmi_fru_component_obj IPMI FRU component data in dictionary.
189 # Example:
190 # fru_device_description: cpu0 (ID 1)
191 # board_mfg_date: Sun Dec 31 18:00:00 1995
192 # board_mfg: <Manufacturer Name>
193 # board_product: PROCESSOR MODULE
194 # board_serial: YA1934302970
195 # board_part_number: 02CY211
196 # rest_fru_component_obj REST FRU component data in dictionary.
197 # Example:
198 # FieldReplaceable: 1
199 # BuildDate: 1996-01-01 - 00:00:00
200 # Cached: 0
201 # SerialNumber: YA1934302970
202 # Functional: 1
203 # Version: 22
204 # Model: <blank>
205 # PrettyName: PROCESSOR MODULE
206 # PartNumber: 02CY211
207 # Present: 1
208 # Manufacturer: <Manufacturer Name>
209 # component_name The name of the component (e.g. "cpu", "dimm", etc.).
210
211 # Get key_map from ipmi_rest_fru_field_map.
212 ${key_map}= Set Variable ${ipmi_rest_fru_field_map['${component_name}']}
213 : FOR ${ipmi_key} IN @{ipmi_rest_fru_field_map['${component_name}'].keys()}
214 \ ${rest_key}= Set Variable ${key_map['${ipmi_key}']}
215 \ Should Contain ${rest_fru_component_obj['${rest_key}']}
216 ... ${ipmi_fru_component_obj['${ipmi_key}']}
217 ... msg=Comparison failed.
218
219
220Test Teardown Execution
221 [Documentation] Do the post test teardown.
222
223 FFDC On Test Case Fail
224
225
226Suite Setup Execution
227 [Documentation] Do test setup initialization.
228
229 REST Power On stack_mode=skip quiet=1
230 ${fru_objs}= Get Fru Info
231 Set Suite Variable ${fru_objs}
232