blob: ad7918b2b79edd36b05a13f43b2372de75c44f7f [file] [log] [blame]
George Keishingc5fab992019-02-02 08:50:37 -06001*** Settings ***
Joy Onyerikwudbfe97d2019-03-11 19:44:56 -05002Documentation Verify that Redfish software inventory can be collected.
3
George Keishing2db7bca2019-02-14 13:03:08 -06004Resource ../../lib/resource.robot
George Keishingc5fab992019-02-02 08:50:37 -06005Resource ../../lib/bmc_redfish_resource.robot
George Keishing3298d5c2019-02-12 06:59:25 -06006Resource ../../lib/openbmc_ffdc.robot
Sushil Singh5bd50022021-06-03 07:11:59 -05007Resource ../../lib/redfish_code_update_utils.robot
George Keishing40f76642019-07-01 02:09:33 -05008Library ../../lib/gen_robot_valid.py
George Keishing3298d5c2019-02-12 06:59:25 -06009
George Keishing97c93942019-03-04 12:45:07 -060010Test Setup Test Setup Execution
11Test Teardown Test Teardown Execution
George Keishingc5fab992019-02-02 08:50:37 -060012
Matt Fischer6fb70d92023-10-24 19:06:33 -060013Test Tags Firmware_Inventory
George Keishing504a3712022-07-22 09:41:28 -050014
George Keishingc5fab992019-02-02 08:50:37 -060015*** Test Cases ***
16
George Keishing5ee33d92019-02-02 12:33:25 -060017Verify Redfish Update Service Enabled
George Keishingc5fab992019-02-02 08:50:37 -060018 [Documentation] Verify "ServiceEnabled" is enabled.
George Keishing5236ec52022-01-31 12:07:58 -060019 [Tags] Verify_Redfish_Update_Service_Enabled
George Keishingc5fab992019-02-02 08:50:37 -060020
21 # Example:
22 # "HttpPushUri": "/redfish/v1/UpdateService",
23 # "Id": "UpdateService",
24 # "Name": "Update Service",
25 # "ServiceEnabled": true
26
George Keishing97c93942019-03-04 12:45:07 -060027 ${resp}= Redfish.Get /redfish/v1/UpdateService
George Keishingc5fab992019-02-02 08:50:37 -060028 Should Be Equal As Strings ${resp.dict["ServiceEnabled"]} ${True}
George Keishingc5fab992019-02-02 08:50:37 -060029
30
George Keishing5ee33d92019-02-02 12:33:25 -060031Verify Redfish Software Inventory Collection
George Keishingc5fab992019-02-02 08:50:37 -060032 [Documentation] Verify software inventory collection member and object entries.
George Keishing5ee33d92019-02-02 12:33:25 -060033 [Tags] Verify_Redfish_Software_Inventory_Collection
George Keishingc5fab992019-02-02 08:50:37 -060034
35 # Example:
36 # {
37 # "@odata.type": "#SoftwareInventoryCollection.SoftwareInventoryCollection",
38 # "Members": [
39 # {
40 # "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/a3522998"
41 # },
42 # {
43 # "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/a7c79f71"
44 # },
45 # {
46 # "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/ace821ef"
47 # }
48 # ],
49 # "Members@odata.count": 3,
50 # "Name": "Software Inventory Collection"
51 # }
52
George Keishing97c93942019-03-04 12:45:07 -060053 ${resp}= Redfish.Get /redfish/v1/UpdateService/FirmwareInventory
George Keishingc5fab992019-02-02 08:50:37 -060054
55 Should Be True ${resp.dict["Members@odata.count"]} >= ${1}
56 Length Should Be ${resp.dict["Members"]} ${resp.dict["Members@odata.count"]}
George Keishingc5fab992019-02-02 08:50:37 -060057
58
George Keishing5ee33d92019-02-02 12:33:25 -060059Redfish Software Inventory Status Check
George Keishingc5fab992019-02-02 08:50:37 -060060 [Documentation] Get firmware inventory entries and do health check status.
George Keishing5ee33d92019-02-02 12:33:25 -060061 [Tags] Redfish_Software_Inventory_Status_Check
George Keishingc5fab992019-02-02 08:50:37 -060062
George Keishing97c93942019-03-04 12:45:07 -060063 ${resp}= Redfish.Get /redfish/v1/UpdateService/FirmwareInventory
George Keishingc5fab992019-02-02 08:50:37 -060064
65 # Entries "Members@odata.count": 3,
66 # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a3522998'}
67 # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a7c79f71'}
68 # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/ace821ef'}
69
Sushil Singh50621142020-06-16 11:12:21 -050070 FOR ${entry} IN RANGE 0 ${resp.dict["Members@odata.count"]}
71 ${resp_resource}= Redfish.Get ${resp.dict["Members"][${entry}]["@odata.id"]}
George Keishingc5fab992019-02-02 08:50:37 -060072 # Example:
73 # "Status": {
74 # "Health": "OK",
75 # "HealthRollup": "OK",
76 # "State": "Enabled"
77 # },
Sushil Singh50621142020-06-16 11:12:21 -050078 Should Be Equal As Strings ${resp_resource.dict["Status"]["Health"]} OK
79 Should Be Equal As Strings ${resp_resource.dict["Status"]["HealthRollup"]} OK
80 Should Be Equal As Strings ${resp_resource.dict["Status"]["State"]} Enabled
81 END
George Keishing97c93942019-03-04 12:45:07 -060082
83
Sivas SRRd099d362019-03-07 03:33:03 -060084Verify BMC Version Matches With FirmwareInventory
85 [Documentation] Verify BMC version from FirmwareInventory same as in manager.
86 [Tags] Verify_BMC_Version_Matches_With_FirmwareInventory
87
ganesanb4d430282023-04-27 14:33:23 +000088 ${bmc_manager}= Redfish.Get /redfish/v1/Managers/${MANAGER_ID}
Sivas SRRd099d362019-03-07 03:33:03 -060089 ${manager_bmc_version}= Get BMC Version
90 # Check for manager version and cat /etc/os-release.
91 Should Be Equal As Strings
92 ... ${bmc_manager.dict["FirmwareVersion"]} ${manager_bmc_version.strip('"')}
93
94 ${resp}= Redfish.Get /redfish/v1/UpdateService/FirmwareInventory
95
96 # Entries "Members@odata.count": 3,
97 # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a3522998'}
98 # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a7c79f71'}
99 # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/ace821ef'}
100
101 ${actual_count}= Evaluate ${resp.dict["Members@odata.count"]}-1
Sushil Singh50621142020-06-16 11:12:21 -0500102 FOR ${entry} IN RANGE 0 ${resp.dict["Members@odata.count"]}
103 ${resp_resource}= Redfish.Get ${resp.dict["Members"][${entry}]["@odata.id"]}
Sivas SRRd099d362019-03-07 03:33:03 -0600104 # 3rd comparison of BMC version and verify FirmwareInventory bmc version.
105 # Example:
106 # "Version": 2.7.0-dev-19-g9b44ea7
Sridevi Ramesh6dcfc392025-05-06 11:09:43 -0500107 IF '${resp_resource.dict["Version"]}' == '${manager_bmc_version.strip('"')}' BREAK
108 IF '${entry}' == '${actual_count}' Fail BMC version not there in Firmware Inventory
Sushil Singh50621142020-06-16 11:12:21 -0500109 END
Sivas SRRd099d362019-03-07 03:33:03 -0600110
Sushil Singh50a1be92021-06-15 06:52:36 -0500111
George Keishing40f76642019-07-01 02:09:33 -0500112Verify UpdateService Supports TransferProtocol TFTP
113 [Documentation] Verify update service supported values have TFTP protocol.
114 [Tags] Verify_UpdateService_Supports_TransferProtocol_TFTP
115
116 # Example:
117 # "Actions": {
118 # "#UpdateService.SimpleUpdate": {
119 # "TransferProtocol@Redfish.AllowableValues": [
120 # "TFTP"
121 # ],
122 # "target": "/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate"
123 # }
124 # },
125
126 ${allowable_values}= Redfish.Get Attribute /redfish/v1/UpdateService Actions
127
George Keishinge4d41422019-12-12 11:17:03 -0600128 Valid Value
129 ... allowable_values["#UpdateService.SimpleUpdate"]["TransferProtocol@Redfish.AllowableValues"][0]
130 ... valid_values=['TFTP']
131 Valid Value allowable_values["#UpdateService.SimpleUpdate"]["target"]
132 ... valid_values=['/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate']
George Keishing40f76642019-07-01 02:09:33 -0500133
134
Igor Kanyukaacd09bf2025-11-24 11:14:53 +0000135Verify Redfish Software ID
Sushil Singh5bd50022021-06-03 07:11:59 -0500136 [Documentation] Verify BMC images have valid 8-digit hex IDs.
Igor Kanyukaacd09bf2025-11-24 11:14:53 +0000137 [Tags] Verify_Redfish_Software_ID
Sushil Singh5bd50022021-06-03 07:11:59 -0500138
139 ${sw_inv_dict}= Get Software Inventory State
140
141 FOR ${id_key} IN @{sw_inv_dict}
142 ${sw_inv}= Get From Dictionary ${sw_inv_dict} ${id_key}
143 Should Be Equal As Strings ${id_key} ${sw_inv['image_id']}
Igor Kanyukaacd09bf2025-11-24 11:14:53 +0000144 Should Match Regexp ${sw_inv['image_id']} [0-9_a-z]*
Sushil Singh5bd50022021-06-03 07:11:59 -0500145 END
146
147
Sushil Singh1d5bd9a2021-06-07 00:51:42 -0500148Verify Redfish FirmwareInventory Is Updateable
149 [Documentation] Verify the redfish firmware inventory path is updateable.
150 [Tags] Verify_Redfish_FirmwareInventory_Is_Updateable
151
152 ${sw_member_list}= Redfish_Utils.Get Member List /redfish/v1/UpdateService/FirmwareInventory
153
154 # sw_member_list:
155 # [0]: /redfish/v1/UpdateService/FirmwareInventory/98744d76
156 # [1]: /redfish/v1/UpdateService/FirmwareInventory/9a8028ec
157 # [2]: /redfish/v1/UpdateService/FirmwareInventory/acc9e073
158
159 FOR ${sw_member} IN @{sw_member_list}
160 ${resp}= Redfish.Get Attribute ${sw_member} Updateable
161
162 # Example:
163 # "Updateable": true,
164
165 Should Be Equal As Strings ${resp} True
Sushil Singh1d5bd9a2021-06-07 00:51:42 -0500166 END
167
168
Sushil Singh50a1be92021-06-15 06:52:36 -0500169Check Redfish Functional Image Version Is Same
170 [Documentation] Verify functional image version is same as in Redfish managers.
171 [Tags] Check_Redfish_Functional_Image_Version_Is_Same
172 [Template] Verify Redfish Functional Image Version Is Same
Sushil Singh54551002021-06-08 02:35:48 -0500173
Sushil Singh50a1be92021-06-15 06:52:36 -0500174 # image
175 functional_image
176 backup_image
Sushil Singh54551002021-06-08 02:35:48 -0500177
Sushil Singh54551002021-06-08 02:35:48 -0500178
Sushil Singh50a1be92021-06-15 06:52:36 -0500179Check Redfish Backup Image Version Is Same
180 [Documentation] Switch to backup image and then verify functional image version
181 ... is same as in Redfish managers..
182 [Tags] Check_Redfish_Backup_Image_Version_Is_Same
183 [Template] Verify Redfish Functional Image Version Is Same
Sushil Singh54551002021-06-08 02:35:48 -0500184
Sushil Singh50a1be92021-06-15 06:52:36 -0500185 # image
186 switch_backup_image
Sushil Singh54551002021-06-08 02:35:48 -0500187
188
Sushil Singhfcce0d32021-06-18 00:06:51 -0500189Verify Redfish Software Image And Firmware Inventory Are Same
190 [Documentation] Verify the firmware software inventory is same as software images of managers.
191 [Tags] Verify_Redfish_Software_Image_And_Firmware_Inventory_Are_Same
192
193 # SoftwareImages
194 # /redfish/v1/UpdateService/FirmwareInventory/632c5114
195 # /redfish/v1/UpdateService/FirmwareInventory/e702a011
196
ganesanb4d430282023-04-27 14:33:23 +0000197 ${firmware_inv_path}= Redfish.Get Properties ${REDFISH_BASE_URI}Managers/${MANAGER_ID}
Sushil Singhfcce0d32021-06-18 00:06:51 -0500198 ${firmware_inv_path}= Get From Dictionary ${firmware_inv_path} Links
199 ${sw_image}= Get From Dictionary ${firmware_inv_path} SoftwareImages
200
201 ${sw_member_list}= Redfish_Utils.Get Member List /redfish/v1/UpdateService/FirmwareInventory
202
203 FOR ${sw_inv_path} IN @{sw_image}
204 List Should Contain Value ${sw_member_list} ${sw_inv_path['@odata.id']}
205 END
206
207 ${num_records_sw_image}= Get Length ${sw_image}
208 ${num_records_sw_inv}= Get Length ${sw_member_list}
209 Should Be Equal ${num_records_sw_image} ${num_records_sw_inv}
210
211
Sushil Singhd8af36d2021-08-10 02:14:34 -0500212Check If Firmware Image Is Same In Firmware Inventory And Redfish Read Operation
213 [Documentation] Check the Redfish firmware inventory path is same as in
214 ... active software image of Redfish managers and firmware inventory of update service.
215 [Tags] Check_If_Firmware_Image_Is_Same_In_Firmware_Inventory_And_Redfish_Read_Operation
216
217 Verify Active Software Image And Firmware Inventory Is Same
218
219
220Check If Backup Firmware Image Is Same In Firmware Inventory And Redfish Read Operation
221 [Documentation] Check the Redfish backup image firmware inventory path is same as in
222 ... active software image of Redfish managers and firmware inventory of update service.
223 [Tags] Check_If_Backup_Firmware_Image_Is_Same_In_Firmware_Inventory_And_Redfish_Read_Operation
224
225 Verify Active Software Image And Firmware Inventory Is Same
226 Set Backup Firmware Image As Functional
227 Verify Active Software Image And Firmware Inventory Is Same
228 Set Backup Firmware Image As Functional
229 Verify Active Software Image And Firmware Inventory Is Same
230
231
George Keishing1b8865c2019-07-04 12:16:49 -0500232Verify Redfish BIOS Version
233 [Documentation] Get host firmware version from system inventory.
234 [Tags] Verify_Redfish_BIOS_Version
235
Yi Huc32434a2024-01-11 17:33:10 -0800236 ${bios_version}= Redfish.Get Attribute /redfish/v1/Systems/${SYSTEM_ID}/ BiosVersion
George Keishing1b8865c2019-07-04 12:16:49 -0500237 ${pnor_version}= Get PNOR Version
238 Should Be Equal ${pnor_version} ${bios_version}
239
240
George Keishing97c93942019-03-04 12:45:07 -0600241*** Keywords ***
242
243Test Setup Execution
244 [Documentation] Do test case setup tasks.
245
246 Redfish.Login
Sushil Singhf7a5aa32023-04-12 09:40:43 -0500247 Redfish Power Off stack_mode=skip
George Keishing97c93942019-03-04 12:45:07 -0600248
249
250Test Teardown Execution
251 [Documentation] Do the post test teardown.
252
253 FFDC On Test Case Fail
254 Redfish.Logout
Sushil Singh50a1be92021-06-15 06:52:36 -0500255
256
257Verify Firmware Version Same In Firmware Inventory And Managers
Sushil Singhd8af36d2021-08-10 02:14:34 -0500258 [Documentation] Verify the Redfish firmware inventory path version is same as Redfish managers.
Sushil Singh50a1be92021-06-15 06:52:36 -0500259
260 # User defined state for software objects.
261 # Note: "Functional" term refers to firmware which system is currently booted with.
262
263 # sw_inv_dict:
264 # [b9101858]:
265 # [image_type]: BMC update
266 # [image_id]: b9101858
267 # [functional]: True
268 # [version]: 2.8.0-dev-150-g04508dc9f
269
270 ${sw_inv_list}= Get Functional Firmware BMC image
271 ${sw_inv_dict}= Get Non Functional Firmware ${sw_inv_list} True
272
ganesanb4d430282023-04-27 14:33:23 +0000273 # /redfish/v1/Managers/${MANAGER_ID}
Sushil Singh50a1be92021-06-15 06:52:36 -0500274 # "FirmwareVersion": "2.8.0-dev-150-g04508dc9f"
275
276 ${firmware_version}= Redfish.Get Attribute
ganesanb4d430282023-04-27 14:33:23 +0000277 ... ${REDFISH_BASE_URI}Managers/${MANAGER_ID} FirmwareVersion
Sushil Singh50a1be92021-06-15 06:52:36 -0500278
279 Should Be Equal ${sw_inv_dict['version']} ${firmware_version}
280
281
282Verify Firmware Version Is Not Same In Firmware Inventory And Managers
Sushil Singhd8af36d2021-08-10 02:14:34 -0500283 [Documentation] Verify the Redfish firmware inventory path version is not same as
Sushil Singh50a1be92021-06-15 06:52:36 -0500284 ... Redfish managers for backup image.
285
286 # User defined state for software objects.
287 # Note: "Functional" term refers to firmware which system is currently booted with.
288
289 # sw_inv_dict:
290 # [b9101858]:
291 # [image_type]: BMC update
292 # [image_id]: b9101858
293 # [functional]: True
294 # [version]: 2.8.0-dev-150-g04508dc9f
295
296 ${sw_inv_list}= Get Functional Firmware BMC image
297 ${sw_inv_list}= Get Non Functional Firmware List ${sw_inv_list} False
298
ganesanb4d430282023-04-27 14:33:23 +0000299 # /redfish/v1/Managers/${MANAGER_ID}
Sushil Singh50a1be92021-06-15 06:52:36 -0500300 # "FirmwareVersion": "2.8.0-dev-150-g04508dc9f"
301
302 ${firmware_version}= Redfish.Get Attribute
ganesanb4d430282023-04-27 14:33:23 +0000303 ... ${REDFISH_BASE_URI}Managers/${MANAGER_ID} FirmwareVersion
Sushil Singh50a1be92021-06-15 06:52:36 -0500304
305 FOR ${sw_inv} IN @{sw_inv_list}
306 Should Not Be Equal ${sw_inv['version']} ${firmware_version}
307 END
308
309
310Set Backup Firmware Image As Functional
311 [Documentation] Switch to the backup firmware image to make functional.
312
313 ${state}= Get Pre Reboot State
314 Rprint Vars state
315
316 Switch Backup Firmware Image To Functional
317 Wait For Reboot start_boot_seconds=${state['epoch_seconds']}
318
319
320Verify Redfish Functional Image Version Is Same
321 [Documentation] Verify the functional image version is same as in firmware inventory and managers.
322 [Arguments] ${image}
323
324 # Description of argument(s):
George Keishinge16f1582022-12-15 07:32:21 -0600325 # image Functional Image or Backup Image
Sushil Singh50a1be92021-06-15 06:52:36 -0500326
327 Verify Firmware Version Same In Firmware Inventory And Managers
328
George Keishingd1e05072025-05-12 19:57:26 +0530329 IF 'backup_image' == '${image}'
330 Verify Firmware Version Is Not Same In Firmware Inventory And Managers
331 END
Sushil Singh50a1be92021-06-15 06:52:36 -0500332
George Keishingd1e05072025-05-12 19:57:26 +0530333 IF 'switch_backup_image' == '${image}'
334 Set Backup Firmware Image As Functional
335 Verify Firmware Version Same In Firmware Inventory And Managers
336 Set Backup Firmware Image As Functional
337 Verify Firmware Version Same In Firmware Inventory And Managers
338 END
Sushil Singh50a1be92021-06-15 06:52:36 -0500339
Sushil Singhd8af36d2021-08-10 02:14:34 -0500340
341Verify Active Software Image And Firmware Inventory Is Same
342 [Documentation] Verify Redfish firmware inventory path and active software image is same.
343
344 # ActiveSoftwareImage
345 # /redfish/v1/UpdateService/FirmwareInventory/632c5114
346
347 # Firmware Inventory
348 # /redfish/v1/UpdateService/FirmwareInventory
349 # /redfish/v1/UpdateService/FirmwareInventory/632c5114
350 # /redfish/v1/UpdateService/FirmwareInventory/632c5444
351
ganesanb4d430282023-04-27 14:33:23 +0000352 ${firmware_inv_path}= Redfish.Get Properties ${REDFISH_BASE_URI}Managers/${MANAGER_ID}
Sushil Singhd8af36d2021-08-10 02:14:34 -0500353 ${firmware_inv_path}= Get From Dictionary ${firmware_inv_path} Links
354 ${active_sw_image}= Get From Dictionary ${firmware_inv_path} ActiveSoftwareImage
355 ${active_sw_image}= Get From Dictionary ${active_sw_image} @odata.id
356
357 ${sw_member_list}= Redfish_Utils.Get Member List /redfish/v1/UpdateService/FirmwareInventory
358 List Should Contain Value ${sw_member_list} ${active_sw_image}