xref: /openbmc/openbmc-test-automation/redfish/update_service/test_firmware_inventory.robot (revision 6dcfc39409545712521643e73827d58900ff93e0)
1c5fab99fSGeorge Keishing*** Settings ***
2dbfe97dbSJoy OnyerikwuDocumentation    Verify that Redfish software inventory can be collected.
3dbfe97dbSJoy Onyerikwu
42db7bcaeSGeorge KeishingResource         ../../lib/resource.robot
5c5fab99fSGeorge KeishingResource         ../../lib/bmc_redfish_resource.robot
63298d5c3SGeorge KeishingResource         ../../lib/openbmc_ffdc.robot
75bd5002fSSushil SinghResource         ../../lib/redfish_code_update_utils.robot
840f76643SGeorge KeishingLibrary          ../../lib/gen_robot_valid.py
93298d5c3SGeorge Keishing
1097c93945SGeorge KeishingTest Setup       Test Setup Execution
1197c93945SGeorge KeishingTest Teardown    Test Teardown Execution
12c5fab99fSGeorge Keishing
136fb70d98SMatt FischerTest Tags     Firmware_Inventory
14504a371eSGeorge Keishing
15c5fab99fSGeorge Keishing*** Test Cases ***
16c5fab99fSGeorge Keishing
175ee33d93SGeorge KeishingVerify Redfish Update Service Enabled
18c5fab99fSGeorge Keishing    [Documentation]  Verify "ServiceEnabled" is enabled.
195236ec54SGeorge Keishing    [Tags]  Verify_Redfish_Update_Service_Enabled
20c5fab99fSGeorge Keishing
21c5fab99fSGeorge Keishing    # Example:
22c5fab99fSGeorge Keishing    # "HttpPushUri": "/redfish/v1/UpdateService",
23c5fab99fSGeorge Keishing    # "Id": "UpdateService",
24c5fab99fSGeorge Keishing    # "Name": "Update Service",
25c5fab99fSGeorge Keishing    # "ServiceEnabled": true
26c5fab99fSGeorge Keishing
2797c93945SGeorge Keishing    ${resp}=  Redfish.Get  /redfish/v1/UpdateService
28c5fab99fSGeorge Keishing    Should Be Equal As Strings  ${resp.dict["ServiceEnabled"]}  ${True}
29c5fab99fSGeorge Keishing
30c5fab99fSGeorge Keishing
315ee33d93SGeorge KeishingVerify Redfish Software Inventory Collection
32c5fab99fSGeorge Keishing    [Documentation]  Verify software inventory collection member and object entries.
335ee33d93SGeorge Keishing    [Tags]  Verify_Redfish_Software_Inventory_Collection
34c5fab99fSGeorge Keishing
35c5fab99fSGeorge Keishing    # Example:
36c5fab99fSGeorge Keishing    # {
37c5fab99fSGeorge Keishing    #    "@odata.type": "#SoftwareInventoryCollection.SoftwareInventoryCollection",
38c5fab99fSGeorge Keishing    #    "Members": [
39c5fab99fSGeorge Keishing    #      {
40c5fab99fSGeorge Keishing    #        "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/a3522998"
41c5fab99fSGeorge Keishing    #      },
42c5fab99fSGeorge Keishing    #      {
43c5fab99fSGeorge Keishing    #        "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/a7c79f71"
44c5fab99fSGeorge Keishing    #      },
45c5fab99fSGeorge Keishing    #      {
46c5fab99fSGeorge Keishing    #        "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/ace821ef"
47c5fab99fSGeorge Keishing    #      }
48c5fab99fSGeorge Keishing    #   ],
49c5fab99fSGeorge Keishing    #   "Members@odata.count": 3,
50c5fab99fSGeorge Keishing    #   "Name": "Software Inventory Collection"
51c5fab99fSGeorge Keishing    # }
52c5fab99fSGeorge Keishing
5397c93945SGeorge Keishing    ${resp}=  Redfish.Get  /redfish/v1/UpdateService/FirmwareInventory
54c5fab99fSGeorge Keishing
55c5fab99fSGeorge Keishing    Should Be True  ${resp.dict["Members@odata.count"]} >= ${1}
56c5fab99fSGeorge Keishing    Length Should Be  ${resp.dict["Members"]}  ${resp.dict["Members@odata.count"]}
57c5fab99fSGeorge Keishing
58c5fab99fSGeorge Keishing
595ee33d93SGeorge KeishingRedfish Software Inventory Status Check
60c5fab99fSGeorge Keishing    [Documentation]  Get firmware inventory entries and do health check status.
615ee33d93SGeorge Keishing    [Tags]  Redfish_Software_Inventory_Status_Check
62c5fab99fSGeorge Keishing
6397c93945SGeorge Keishing    ${resp}=  Redfish.Get  /redfish/v1/UpdateService/FirmwareInventory
64c5fab99fSGeorge Keishing
65c5fab99fSGeorge Keishing    # Entries "Members@odata.count": 3,
66c5fab99fSGeorge Keishing    # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a3522998'}
67c5fab99fSGeorge Keishing    # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a7c79f71'}
68c5fab99fSGeorge Keishing    # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/ace821ef'}
69c5fab99fSGeorge Keishing
7050621144SSushil Singh    FOR  ${entry}  IN RANGE  0  ${resp.dict["Members@odata.count"]}
7150621144SSushil Singh      ${resp_resource}=  Redfish.Get  ${resp.dict["Members"][${entry}]["@odata.id"]}
72c5fab99fSGeorge Keishing    # Example:
73c5fab99fSGeorge Keishing    # "Status": {
74c5fab99fSGeorge Keishing    #     "Health": "OK",
75c5fab99fSGeorge Keishing    #     "HealthRollup": "OK",
76c5fab99fSGeorge Keishing    #     "State": "Enabled"
77c5fab99fSGeorge Keishing    # },
7850621144SSushil Singh      Should Be Equal As Strings  ${resp_resource.dict["Status"]["Health"]}  OK
7950621144SSushil Singh      Should Be Equal As Strings  ${resp_resource.dict["Status"]["HealthRollup"]}  OK
8050621144SSushil Singh      Should Be Equal As Strings  ${resp_resource.dict["Status"]["State"]}  Enabled
8150621144SSushil Singh    END
8297c93945SGeorge Keishing
8397c93945SGeorge Keishing
84d099d360SSivas SRRVerify BMC Version Matches With FirmwareInventory
85d099d360SSivas SRR    [Documentation]  Verify BMC version from FirmwareInventory same as in manager.
86d099d360SSivas SRR    [Tags]  Verify_BMC_Version_Matches_With_FirmwareInventory
87d099d360SSivas SRR
884d430283Sganesanb    ${bmc_manager}=  Redfish.Get  /redfish/v1/Managers/${MANAGER_ID}
89d099d360SSivas SRR    ${manager_bmc_version}=  Get BMC Version
90d099d360SSivas SRR    # Check for manager version and cat /etc/os-release.
91d099d360SSivas SRR    Should Be Equal As Strings
92d099d360SSivas SRR    ...  ${bmc_manager.dict["FirmwareVersion"]}  ${manager_bmc_version.strip('"')}
93d099d360SSivas SRR
94d099d360SSivas SRR    ${resp}=  Redfish.Get  /redfish/v1/UpdateService/FirmwareInventory
95d099d360SSivas SRR
96d099d360SSivas SRR    # Entries "Members@odata.count": 3,
97d099d360SSivas SRR    # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a3522998'}
98d099d360SSivas SRR    # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a7c79f71'}
99d099d360SSivas SRR    # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/ace821ef'}
100d099d360SSivas SRR
101d099d360SSivas SRR    ${actual_count}=  Evaluate  ${resp.dict["Members@odata.count"]}-1
10250621144SSushil Singh    FOR  ${entry}  IN RANGE  0  ${resp.dict["Members@odata.count"]}
10350621144SSushil Singh      ${resp_resource}=  Redfish.Get  ${resp.dict["Members"][${entry}]["@odata.id"]}
104d099d360SSivas SRR    # 3rd comparison of BMC version and verify FirmwareInventory bmc version.
105d099d360SSivas SRR    # Example:
106d099d360SSivas SRR    # "Version": 2.7.0-dev-19-g9b44ea7
107*6dcfc394SSridevi Ramesh      IF  '${resp_resource.dict["Version"]}' == '${manager_bmc_version.strip('"')}'  BREAK
108*6dcfc394SSridevi Ramesh      IF  '${entry}' == '${actual_count}'  Fail  BMC version not there in Firmware Inventory
10950621144SSushil Singh    END
110d099d360SSivas SRR
11150a1be9eSSushil Singh
11240f76643SGeorge KeishingVerify UpdateService Supports TransferProtocol TFTP
11340f76643SGeorge Keishing    [Documentation]  Verify update service supported values have TFTP protocol.
11440f76643SGeorge Keishing    [Tags]  Verify_UpdateService_Supports_TransferProtocol_TFTP
11540f76643SGeorge Keishing
11640f76643SGeorge Keishing    # Example:
11740f76643SGeorge Keishing    #   "Actions": {
11840f76643SGeorge Keishing    #     "#UpdateService.SimpleUpdate": {
11940f76643SGeorge Keishing    #       "TransferProtocol@Redfish.AllowableValues": [
12040f76643SGeorge Keishing    #         "TFTP"
12140f76643SGeorge Keishing    #       ],
12240f76643SGeorge Keishing    #       "target": "/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate"
12340f76643SGeorge Keishing    #     }
12440f76643SGeorge Keishing    #  },
12540f76643SGeorge Keishing
12640f76643SGeorge Keishing    ${allowable_values}=  Redfish.Get Attribute  /redfish/v1/UpdateService  Actions
12740f76643SGeorge Keishing
128e4d41420SGeorge Keishing    Valid Value
129e4d41420SGeorge Keishing    ...  allowable_values["#UpdateService.SimpleUpdate"]["TransferProtocol@Redfish.AllowableValues"][0]
130e4d41420SGeorge Keishing    ...  valid_values=['TFTP']
131e4d41420SGeorge Keishing    Valid Value  allowable_values["#UpdateService.SimpleUpdate"]["target"]
132e4d41420SGeorge Keishing    ...  valid_values=['/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate']
13340f76643SGeorge Keishing
13440f76643SGeorge Keishing
1355bd5002fSSushil SinghVerify Redfish Software Hex ID
1365bd5002fSSushil Singh    [Documentation]  Verify BMC images have valid 8-digit hex IDs.
1375bd5002fSSushil Singh    [Tags]  Verify_Redfish_Software_Hex_ID
1385bd5002fSSushil Singh
1395bd5002fSSushil Singh    ${sw_inv_dict}=  Get Software Inventory State
1405bd5002fSSushil Singh
1415bd5002fSSushil Singh    FOR  ${id_key}  IN  @{sw_inv_dict}
1425bd5002fSSushil Singh      ${sw_inv}=  Get From Dictionary  ${sw_inv_dict}  ${id_key}
1435bd5002fSSushil Singh      Should Be Equal As Strings  ${id_key}  ${sw_inv['image_id']}
1445bd5002fSSushil Singh      Length Should Be  ${sw_inv['image_id']}  ${8}
1455bd5002fSSushil Singh      Should Match Regexp  ${sw_inv['image_id']}  [0-9a-f]*
1465bd5002fSSushil Singh    END
1475bd5002fSSushil Singh
1485bd5002fSSushil Singh
1491d5bd9aeSSushil SinghVerify Redfish FirmwareInventory Is Updateable
1501d5bd9aeSSushil Singh    [Documentation]  Verify the redfish firmware inventory path is updateable.
1511d5bd9aeSSushil Singh    [Tags]  Verify_Redfish_FirmwareInventory_Is_Updateable
1521d5bd9aeSSushil Singh
1531d5bd9aeSSushil Singh    ${sw_member_list}=  Redfish_Utils.Get Member List  /redfish/v1/UpdateService/FirmwareInventory
1541d5bd9aeSSushil Singh
1551d5bd9aeSSushil Singh    # sw_member_list:
1561d5bd9aeSSushil Singh    #   [0]:                            /redfish/v1/UpdateService/FirmwareInventory/98744d76
1571d5bd9aeSSushil Singh    #   [1]:                            /redfish/v1/UpdateService/FirmwareInventory/9a8028ec
1581d5bd9aeSSushil Singh    #   [2]:                            /redfish/v1/UpdateService/FirmwareInventory/acc9e073
1591d5bd9aeSSushil Singh
1601d5bd9aeSSushil Singh    FOR  ${sw_member}  IN  @{sw_member_list}
1611d5bd9aeSSushil Singh      ${resp}=  Redfish.Get Attribute  ${sw_member}  Updateable
1621d5bd9aeSSushil Singh
1631d5bd9aeSSushil Singh      # Example:
1641d5bd9aeSSushil Singh      # "Updateable": true,
1651d5bd9aeSSushil Singh
1661d5bd9aeSSushil Singh      Should Be Equal As Strings  ${resp}  True
1671d5bd9aeSSushil Singh    END
1681d5bd9aeSSushil Singh
1691d5bd9aeSSushil Singh
17050a1be9eSSushil SinghCheck Redfish Functional Image Version Is Same
17150a1be9eSSushil Singh    [Documentation]  Verify functional image version is same as in Redfish managers.
17250a1be9eSSushil Singh    [Tags]  Check_Redfish_Functional_Image_Version_Is_Same
17350a1be9eSSushil Singh    [Template]  Verify Redfish Functional Image Version Is Same
17454551002SSushil Singh
17550a1be9eSSushil Singh    # image
17650a1be9eSSushil Singh    functional_image
17750a1be9eSSushil Singh    backup_image
17854551002SSushil Singh
17954551002SSushil Singh
18050a1be9eSSushil SinghCheck Redfish Backup Image Version Is Same
18150a1be9eSSushil Singh    [Documentation]  Switch to backup image and then verify functional image version
18250a1be9eSSushil Singh    ...  is same as in Redfish managers..
18350a1be9eSSushil Singh    [Tags]  Check_Redfish_Backup_Image_Version_Is_Same
18450a1be9eSSushil Singh    [Template]  Verify Redfish Functional Image Version Is Same
18554551002SSushil Singh
18650a1be9eSSushil Singh    # image
18750a1be9eSSushil Singh    switch_backup_image
18854551002SSushil Singh
18954551002SSushil Singh
190fcce0d3aSSushil SinghVerify Redfish Software Image And Firmware Inventory Are Same
191fcce0d3aSSushil Singh    [Documentation]  Verify the firmware software inventory is same as software images of managers.
192fcce0d3aSSushil Singh    [Tags]  Verify_Redfish_Software_Image_And_Firmware_Inventory_Are_Same
193fcce0d3aSSushil Singh
194fcce0d3aSSushil Singh    # SoftwareImages
195fcce0d3aSSushil Singh    # /redfish/v1/UpdateService/FirmwareInventory/632c5114
196fcce0d3aSSushil Singh    # /redfish/v1/UpdateService/FirmwareInventory/e702a011
197fcce0d3aSSushil Singh
1984d430283Sganesanb    ${firmware_inv_path}=  Redfish.Get Properties  ${REDFISH_BASE_URI}Managers/${MANAGER_ID}
199fcce0d3aSSushil Singh    ${firmware_inv_path}=  Get From Dictionary  ${firmware_inv_path}  Links
200fcce0d3aSSushil Singh    ${sw_image}=  Get From Dictionary  ${firmware_inv_path}  SoftwareImages
201fcce0d3aSSushil Singh
202fcce0d3aSSushil Singh    ${sw_member_list}=  Redfish_Utils.Get Member List  /redfish/v1/UpdateService/FirmwareInventory
203fcce0d3aSSushil Singh
204fcce0d3aSSushil Singh    FOR  ${sw_inv_path}  IN  @{sw_image}
205fcce0d3aSSushil Singh      List Should Contain Value  ${sw_member_list}  ${sw_inv_path['@odata.id']}
206fcce0d3aSSushil Singh    END
207fcce0d3aSSushil Singh
208fcce0d3aSSushil Singh    ${num_records_sw_image}=  Get Length  ${sw_image}
209fcce0d3aSSushil Singh    ${num_records_sw_inv}=  Get Length  ${sw_member_list}
210fcce0d3aSSushil Singh    Should Be Equal  ${num_records_sw_image}  ${num_records_sw_inv}
211fcce0d3aSSushil Singh
212fcce0d3aSSushil Singh
213d8af36d0SSushil SinghCheck If Firmware Image Is Same In Firmware Inventory And Redfish Read Operation
214d8af36d0SSushil Singh    [Documentation]  Check the Redfish firmware inventory path is same as in
215d8af36d0SSushil Singh    ...  active software image of Redfish managers and firmware inventory of update service.
216d8af36d0SSushil Singh    [Tags]  Check_If_Firmware_Image_Is_Same_In_Firmware_Inventory_And_Redfish_Read_Operation
217d8af36d0SSushil Singh
218d8af36d0SSushil Singh    Verify Active Software Image And Firmware Inventory Is Same
219d8af36d0SSushil Singh
220d8af36d0SSushil Singh
221d8af36d0SSushil SinghCheck If Backup Firmware Image Is Same In Firmware Inventory And Redfish Read Operation
222d8af36d0SSushil Singh    [Documentation]  Check the Redfish backup image firmware inventory path is same as in
223d8af36d0SSushil Singh    ...  active software image of Redfish managers and firmware inventory of update service.
224d8af36d0SSushil Singh    [Tags]  Check_If_Backup_Firmware_Image_Is_Same_In_Firmware_Inventory_And_Redfish_Read_Operation
225d8af36d0SSushil Singh
226d8af36d0SSushil Singh    Verify Active Software Image And Firmware Inventory Is Same
227d8af36d0SSushil Singh    Set Backup Firmware Image As Functional
228d8af36d0SSushil Singh    Verify Active Software Image And Firmware Inventory Is Same
229d8af36d0SSushil Singh    Set Backup Firmware Image As Functional
230d8af36d0SSushil Singh    Verify Active Software Image And Firmware Inventory Is Same
231d8af36d0SSushil Singh
232d8af36d0SSushil Singh
2331b8865c4SGeorge KeishingVerify Redfish BIOS Version
2341b8865c4SGeorge Keishing    [Documentation]  Get host firmware version from system inventory.
2351b8865c4SGeorge Keishing    [Tags]  Verify_Redfish_BIOS_Version
2361b8865c4SGeorge Keishing
237c32434a3SYi Hu    ${bios_version}=  Redfish.Get Attribute  /redfish/v1/Systems/${SYSTEM_ID}/  BiosVersion
2381b8865c4SGeorge Keishing    ${pnor_version}=  Get PNOR Version
2391b8865c4SGeorge Keishing    Should Be Equal  ${pnor_version}  ${bios_version}
2401b8865c4SGeorge Keishing
2411b8865c4SGeorge Keishing
24297c93945SGeorge Keishing*** Keywords ***
24397c93945SGeorge Keishing
24497c93945SGeorge KeishingTest Setup Execution
24597c93945SGeorge Keishing    [Documentation]  Do test case setup tasks.
24697c93945SGeorge Keishing
24797c93945SGeorge Keishing    Redfish.Login
248f7a5aa3bSSushil Singh    Redfish Power Off  stack_mode=skip
24997c93945SGeorge Keishing
25097c93945SGeorge Keishing
25197c93945SGeorge KeishingTest Teardown Execution
25297c93945SGeorge Keishing    [Documentation]  Do the post test teardown.
25397c93945SGeorge Keishing
25497c93945SGeorge Keishing    FFDC On Test Case Fail
25597c93945SGeorge Keishing    Redfish.Logout
25650a1be9eSSushil Singh
25750a1be9eSSushil Singh
25850a1be9eSSushil SinghVerify Firmware Version Same In Firmware Inventory And Managers
259d8af36d0SSushil Singh    [Documentation]  Verify the Redfish firmware inventory path version is same as Redfish managers.
26050a1be9eSSushil Singh
26150a1be9eSSushil Singh    # User defined state for software objects.
26250a1be9eSSushil Singh    # Note: "Functional" term refers to firmware which system is currently booted with.
26350a1be9eSSushil Singh
26450a1be9eSSushil Singh    # sw_inv_dict:
26550a1be9eSSushil Singh    #   [b9101858]:
26650a1be9eSSushil Singh    #     [image_type]:                 BMC update
26750a1be9eSSushil Singh    #     [image_id]:                   b9101858
26850a1be9eSSushil Singh    #     [functional]:                 True
26950a1be9eSSushil Singh    #     [version]:                    2.8.0-dev-150-g04508dc9f
27050a1be9eSSushil Singh
27150a1be9eSSushil Singh    ${sw_inv_list}=  Get Functional Firmware  BMC image
27250a1be9eSSushil Singh    ${sw_inv_dict}=  Get Non Functional Firmware  ${sw_inv_list}  True
27350a1be9eSSushil Singh
2744d430283Sganesanb    # /redfish/v1/Managers/${MANAGER_ID}
27550a1be9eSSushil Singh    # "FirmwareVersion": "2.8.0-dev-150-g04508dc9f"
27650a1be9eSSushil Singh
27750a1be9eSSushil Singh    ${firmware_version}=  Redfish.Get Attribute
2784d430283Sganesanb    ...  ${REDFISH_BASE_URI}Managers/${MANAGER_ID}  FirmwareVersion
27950a1be9eSSushil Singh
28050a1be9eSSushil Singh    Should Be Equal  ${sw_inv_dict['version']}  ${firmware_version}
28150a1be9eSSushil Singh
28250a1be9eSSushil Singh
28350a1be9eSSushil SinghVerify Firmware Version Is Not Same In Firmware Inventory And Managers
284d8af36d0SSushil Singh    [Documentation]  Verify the Redfish firmware inventory path version is not same as
28550a1be9eSSushil Singh    ...  Redfish managers for backup image.
28650a1be9eSSushil Singh
28750a1be9eSSushil Singh    # User defined state for software objects.
28850a1be9eSSushil Singh    # Note: "Functional" term refers to firmware which system is currently booted with.
28950a1be9eSSushil Singh
29050a1be9eSSushil Singh    # sw_inv_dict:
29150a1be9eSSushil Singh    #   [b9101858]:
29250a1be9eSSushil Singh    #     [image_type]:                 BMC update
29350a1be9eSSushil Singh    #     [image_id]:                   b9101858
29450a1be9eSSushil Singh    #     [functional]:                 True
29550a1be9eSSushil Singh    #     [version]:                    2.8.0-dev-150-g04508dc9f
29650a1be9eSSushil Singh
29750a1be9eSSushil Singh    ${sw_inv_list}=  Get Functional Firmware  BMC image
29850a1be9eSSushil Singh    ${sw_inv_list}=  Get Non Functional Firmware List  ${sw_inv_list}  False
29950a1be9eSSushil Singh
3004d430283Sganesanb    # /redfish/v1/Managers/${MANAGER_ID}
30150a1be9eSSushil Singh    # "FirmwareVersion": "2.8.0-dev-150-g04508dc9f"
30250a1be9eSSushil Singh
30350a1be9eSSushil Singh    ${firmware_version}=  Redfish.Get Attribute
3044d430283Sganesanb    ...  ${REDFISH_BASE_URI}Managers/${MANAGER_ID}  FirmwareVersion
30550a1be9eSSushil Singh
30650a1be9eSSushil Singh    FOR  ${sw_inv}  IN  @{sw_inv_list}
30750a1be9eSSushil Singh      Should Not Be Equal  ${sw_inv['version']}  ${firmware_version}
30850a1be9eSSushil Singh    END
30950a1be9eSSushil Singh
31050a1be9eSSushil Singh
31150a1be9eSSushil SinghSet Backup Firmware Image As Functional
31250a1be9eSSushil Singh    [Documentation]  Switch to the backup firmware image to make functional.
31350a1be9eSSushil Singh
31450a1be9eSSushil Singh    ${state}=  Get Pre Reboot State
31550a1be9eSSushil Singh    Rprint Vars  state
31650a1be9eSSushil Singh
31750a1be9eSSushil Singh    Switch Backup Firmware Image To Functional
31850a1be9eSSushil Singh    Wait For Reboot  start_boot_seconds=${state['epoch_seconds']}
31950a1be9eSSushil Singh
32050a1be9eSSushil Singh
32150a1be9eSSushil SinghVerify Redfish Functional Image Version Is Same
32250a1be9eSSushil Singh    [Documentation]  Verify the functional image version is same as in firmware inventory and managers.
32350a1be9eSSushil Singh    [Arguments]  ${image}
32450a1be9eSSushil Singh
32550a1be9eSSushil Singh    # Description of argument(s):
326e16f158fSGeorge Keishing    # image           Functional Image or Backup Image
32750a1be9eSSushil Singh
32850a1be9eSSushil Singh    Verify Firmware Version Same In Firmware Inventory And Managers
32950a1be9eSSushil Singh
33050a1be9eSSushil Singh    Run Keyword If  'backup_image' == '${image}'
33150a1be9eSSushil Singh    ...  Verify Firmware Version Is Not Same In Firmware Inventory And Managers
33250a1be9eSSushil Singh
33350a1be9eSSushil Singh    Run Keyword If  'switch_backup_image' == '${image}'
33450a1be9eSSushil Singh    ...  Run Keywords  Set Backup Firmware Image As Functional  AND
33550a1be9eSSushil Singh    ...    Verify Firmware Version Same In Firmware Inventory And Managers  AND
33650a1be9eSSushil Singh    ...    Set Backup Firmware Image As Functional  AND
33750a1be9eSSushil Singh    ...    Verify Firmware Version Same In Firmware Inventory And Managers
33850a1be9eSSushil Singh
339d8af36d0SSushil Singh
340d8af36d0SSushil SinghVerify Active Software Image And Firmware Inventory Is Same
341d8af36d0SSushil Singh    [Documentation]  Verify Redfish firmware inventory path and active software image is same.
342d8af36d0SSushil Singh
343d8af36d0SSushil Singh    # ActiveSoftwareImage
344d8af36d0SSushil Singh    # /redfish/v1/UpdateService/FirmwareInventory/632c5114
345d8af36d0SSushil Singh
346d8af36d0SSushil Singh    # Firmware Inventory
347d8af36d0SSushil Singh    # /redfish/v1/UpdateService/FirmwareInventory
348d8af36d0SSushil Singh    # /redfish/v1/UpdateService/FirmwareInventory/632c5114
349d8af36d0SSushil Singh    # /redfish/v1/UpdateService/FirmwareInventory/632c5444
350d8af36d0SSushil Singh
3514d430283Sganesanb    ${firmware_inv_path}=  Redfish.Get Properties  ${REDFISH_BASE_URI}Managers/${MANAGER_ID}
352d8af36d0SSushil Singh    ${firmware_inv_path}=  Get From Dictionary  ${firmware_inv_path}  Links
353d8af36d0SSushil Singh    ${active_sw_image}=  Get From Dictionary  ${firmware_inv_path}  ActiveSoftwareImage
354d8af36d0SSushil Singh    ${active_sw_image}=  Get From Dictionary  ${active_sw_image}  @odata.id
355d8af36d0SSushil Singh
356d8af36d0SSushil Singh    ${sw_member_list}=  Redfish_Utils.Get Member List  /redfish/v1/UpdateService/FirmwareInventory
357d8af36d0SSushil Singh    List Should Contain Value  ${sw_member_list}  ${active_sw_image}
358