blob: 7f90b08baeb72975ca673b4696f0667cdf4a1de6 [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
13*** Test Cases ***
14
George Keishing5ee33d92019-02-02 12:33:25 -060015Verify Redfish Update Service Enabled
George Keishingc5fab992019-02-02 08:50:37 -060016 [Documentation] Verify "ServiceEnabled" is enabled.
17 [Tags] Verify_Update_Service_Enabled
18
19 # Example:
20 # "HttpPushUri": "/redfish/v1/UpdateService",
21 # "Id": "UpdateService",
22 # "Name": "Update Service",
23 # "ServiceEnabled": true
24
George Keishing97c93942019-03-04 12:45:07 -060025 ${resp}= Redfish.Get /redfish/v1/UpdateService
George Keishingc5fab992019-02-02 08:50:37 -060026 Should Be Equal As Strings ${resp.dict["ServiceEnabled"]} ${True}
George Keishingc5fab992019-02-02 08:50:37 -060027
28
George Keishing5ee33d92019-02-02 12:33:25 -060029Verify Redfish Software Inventory Collection
George Keishingc5fab992019-02-02 08:50:37 -060030 [Documentation] Verify software inventory collection member and object entries.
George Keishing5ee33d92019-02-02 12:33:25 -060031 [Tags] Verify_Redfish_Software_Inventory_Collection
George Keishingc5fab992019-02-02 08:50:37 -060032
33 # Example:
34 # {
35 # "@odata.type": "#SoftwareInventoryCollection.SoftwareInventoryCollection",
36 # "Members": [
37 # {
38 # "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/a3522998"
39 # },
40 # {
41 # "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/a7c79f71"
42 # },
43 # {
44 # "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/ace821ef"
45 # }
46 # ],
47 # "Members@odata.count": 3,
48 # "Name": "Software Inventory Collection"
49 # }
50
George Keishing97c93942019-03-04 12:45:07 -060051 ${resp}= Redfish.Get /redfish/v1/UpdateService/FirmwareInventory
George Keishingc5fab992019-02-02 08:50:37 -060052
53 Should Be True ${resp.dict["Members@odata.count"]} >= ${1}
54 Length Should Be ${resp.dict["Members"]} ${resp.dict["Members@odata.count"]}
George Keishingc5fab992019-02-02 08:50:37 -060055
56
George Keishing5ee33d92019-02-02 12:33:25 -060057Redfish Software Inventory Status Check
George Keishingc5fab992019-02-02 08:50:37 -060058 [Documentation] Get firmware inventory entries and do health check status.
George Keishing5ee33d92019-02-02 12:33:25 -060059 [Tags] Redfish_Software_Inventory_Status_Check
George Keishingc5fab992019-02-02 08:50:37 -060060
George Keishing97c93942019-03-04 12:45:07 -060061 ${resp}= Redfish.Get /redfish/v1/UpdateService/FirmwareInventory
George Keishingc5fab992019-02-02 08:50:37 -060062
63 # Entries "Members@odata.count": 3,
64 # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a3522998'}
65 # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a7c79f71'}
66 # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/ace821ef'}
67
Sushil Singh50621142020-06-16 11:12:21 -050068 FOR ${entry} IN RANGE 0 ${resp.dict["Members@odata.count"]}
69 ${resp_resource}= Redfish.Get ${resp.dict["Members"][${entry}]["@odata.id"]}
George Keishingc5fab992019-02-02 08:50:37 -060070 # Example:
71 # "Status": {
72 # "Health": "OK",
73 # "HealthRollup": "OK",
74 # "State": "Enabled"
75 # },
Sushil Singh50621142020-06-16 11:12:21 -050076 Should Be Equal As Strings ${resp_resource.dict["Status"]["Health"]} OK
77 Should Be Equal As Strings ${resp_resource.dict["Status"]["HealthRollup"]} OK
78 Should Be Equal As Strings ${resp_resource.dict["Status"]["State"]} Enabled
79 END
George Keishing97c93942019-03-04 12:45:07 -060080
81
Sivas SRRd099d362019-03-07 03:33:03 -060082Verify BMC Version Matches With FirmwareInventory
83 [Documentation] Verify BMC version from FirmwareInventory same as in manager.
84 [Tags] Verify_BMC_Version_Matches_With_FirmwareInventory
85
86 ${bmc_manager}= Redfish.Get /redfish/v1/Managers/bmc
87 ${manager_bmc_version}= Get BMC Version
88 # Check for manager version and cat /etc/os-release.
89 Should Be Equal As Strings
90 ... ${bmc_manager.dict["FirmwareVersion"]} ${manager_bmc_version.strip('"')}
91
92 ${resp}= Redfish.Get /redfish/v1/UpdateService/FirmwareInventory
93
94 # Entries "Members@odata.count": 3,
95 # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a3522998'}
96 # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a7c79f71'}
97 # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/ace821ef'}
98
99 ${actual_count}= Evaluate ${resp.dict["Members@odata.count"]}-1
Sushil Singh50621142020-06-16 11:12:21 -0500100 FOR ${entry} IN RANGE 0 ${resp.dict["Members@odata.count"]}
101 ${resp_resource}= Redfish.Get ${resp.dict["Members"][${entry}]["@odata.id"]}
Sivas SRRd099d362019-03-07 03:33:03 -0600102 # 3rd comparison of BMC version and verify FirmwareInventory bmc version.
103 # Example:
104 # "Version": 2.7.0-dev-19-g9b44ea7
Sushil Singh50621142020-06-16 11:12:21 -0500105 Exit For Loop If '${resp_resource.dict["Version"]}' == '${manager_bmc_version.strip('"')}'
106 Run Keyword If '${entry}' == '${actual_count}' Fail BMC version not there in Firmware Inventory
107 END
Sivas SRRd099d362019-03-07 03:33:03 -0600108
George Keishing40f76642019-07-01 02:09:33 -0500109Verify UpdateService Supports TransferProtocol TFTP
110 [Documentation] Verify update service supported values have TFTP protocol.
111 [Tags] Verify_UpdateService_Supports_TransferProtocol_TFTP
112
113 # Example:
114 # "Actions": {
115 # "#UpdateService.SimpleUpdate": {
116 # "TransferProtocol@Redfish.AllowableValues": [
117 # "TFTP"
118 # ],
119 # "target": "/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate"
120 # }
121 # },
122
123 ${allowable_values}= Redfish.Get Attribute /redfish/v1/UpdateService Actions
124
George Keishinge4d41422019-12-12 11:17:03 -0600125 Valid Value
126 ... allowable_values["#UpdateService.SimpleUpdate"]["TransferProtocol@Redfish.AllowableValues"][0]
127 ... valid_values=['TFTP']
128 Valid Value allowable_values["#UpdateService.SimpleUpdate"]["target"]
129 ... valid_values=['/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate']
George Keishing40f76642019-07-01 02:09:33 -0500130
131
Sushil Singh5bd50022021-06-03 07:11:59 -0500132Verify Redfish Software Hex ID
133 [Documentation] Verify BMC images have valid 8-digit hex IDs.
134 [Tags] Verify_Redfish_Software_Hex_ID
135
136 ${sw_inv_dict}= Get Software Inventory State
137
138 FOR ${id_key} IN @{sw_inv_dict}
139 ${sw_inv}= Get From Dictionary ${sw_inv_dict} ${id_key}
140 Should Be Equal As Strings ${id_key} ${sw_inv['image_id']}
141 Length Should Be ${sw_inv['image_id']} ${8}
142 Should Match Regexp ${sw_inv['image_id']} [0-9a-f]*
143 END
144
145
Sushil Singh1d5bd9a2021-06-07 00:51:42 -0500146Verify Redfish FirmwareInventory Is Updateable
147 [Documentation] Verify the redfish firmware inventory path is updateable.
148 [Tags] Verify_Redfish_FirmwareInventory_Is_Updateable
149
150 ${sw_member_list}= Redfish_Utils.Get Member List /redfish/v1/UpdateService/FirmwareInventory
151
152 # sw_member_list:
153 # [0]: /redfish/v1/UpdateService/FirmwareInventory/98744d76
154 # [1]: /redfish/v1/UpdateService/FirmwareInventory/9a8028ec
155 # [2]: /redfish/v1/UpdateService/FirmwareInventory/acc9e073
156
157 FOR ${sw_member} IN @{sw_member_list}
158 ${resp}= Redfish.Get Attribute ${sw_member} Updateable
159
160 # Example:
161 # "Updateable": true,
162
163 Should Be Equal As Strings ${resp} True
164
165 END
166
167
Sushil Singh54551002021-06-08 02:35:48 -0500168Verify Redfish Functional Version Is Same
169 [Documentation] Verify the redfish firmware inventory path version is same as redfish managers.
170 [Tags] Verify_Redfish_Functional_Version_Is_Same
171
172 # User defined state for software objects.
173 # Note: "Functional" term refers to firmware which system is currently booted with.
174
175 # sw_inv_dict:
176 # [b9101858]:
177 # [image_type]: BMC update
178 # [image_id]: b9101858
179 # [functional]: True
180 # [version]: 2.8.0-dev-150-g04508dc9f
181
182 ${sw_inv_dict}= Get Functional Firmware BMC image
183 ${sw_inv_dict}= Get Non Functional Firmware ${sw_inv_dict} True
184
185 # /redfish/v1/Managers/bmc
186 # "FirmwareVersion": "2.8.0-dev-150-g04508dc9f"
187
188 ${firmware_version}= Redfish.Get Attribute
189 ... ${REDFISH_BASE_URI}Managers/bmc FirmwareVersion
190
191 Should Be Equal ${sw_inv_dict['version']} ${firmware_version}
192
193
George Keishing1b8865c2019-07-04 12:16:49 -0500194Verify Redfish BIOS Version
195 [Documentation] Get host firmware version from system inventory.
196 [Tags] Verify_Redfish_BIOS_Version
197
198 ${bios_version}= Redfish.Get Attribute /redfish/v1/Systems/system/ BiosVersion
199 ${pnor_version}= Get PNOR Version
200 Should Be Equal ${pnor_version} ${bios_version}
201
202
George Keishing97c93942019-03-04 12:45:07 -0600203*** Keywords ***
204
205Test Setup Execution
206 [Documentation] Do test case setup tasks.
207
208 Redfish.Login
209
210
211Test Teardown Execution
212 [Documentation] Do the post test teardown.
213
214 FFDC On Test Case Fail
215 Redfish.Logout