blob: d405e137b9e627701373a63c496655a3050dbcd0 [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
George Keishing1b8865c2019-07-04 12:16:49 -0500146Verify Redfish BIOS Version
147 [Documentation] Get host firmware version from system inventory.
148 [Tags] Verify_Redfish_BIOS_Version
149
150 ${bios_version}= Redfish.Get Attribute /redfish/v1/Systems/system/ BiosVersion
151 ${pnor_version}= Get PNOR Version
152 Should Be Equal ${pnor_version} ${bios_version}
153
154
George Keishing97c93942019-03-04 12:45:07 -0600155*** Keywords ***
156
157Test Setup Execution
158 [Documentation] Do test case setup tasks.
159
160 Redfish.Login
161
162
163Test Teardown Execution
164 [Documentation] Do the post test teardown.
165
166 FFDC On Test Case Fail
167 Redfish.Logout