1*** Settings ***
2Documentation    Verify that Redfish software inventory can be collected.
3
4Resource         ../../lib/resource.robot
5Resource         ../../lib/bmc_redfish_resource.robot
6Resource         ../../lib/openbmc_ffdc.robot
7
8Test Setup       Test Setup Execution
9Test Teardown    Test Teardown Execution
10
11*** Test Cases ***
12
13Verify Redfish Update Service Enabled
14    [Documentation]  Verify "ServiceEnabled" is enabled.
15    [Tags]  Verify_Update_Service_Enabled
16
17    # Example:
18    # "HttpPushUri": "/redfish/v1/UpdateService",
19    # "Id": "UpdateService",
20    # "Name": "Update Service",
21    # "ServiceEnabled": true
22
23    ${resp}=  Redfish.Get  /redfish/v1/UpdateService
24    Should Be Equal As Strings  ${resp.dict["ServiceEnabled"]}  ${True}
25
26
27Verify Redfish Software Inventory Collection
28    [Documentation]  Verify software inventory collection member and object entries.
29    [Tags]  Verify_Redfish_Software_Inventory_Collection
30
31    # Example:
32    # {
33    #    "@odata.type": "#SoftwareInventoryCollection.SoftwareInventoryCollection",
34    #    "Members": [
35    #      {
36    #        "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/a3522998"
37    #      },
38    #      {
39    #        "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/a7c79f71"
40    #      },
41    #      {
42    #        "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/ace821ef"
43    #      }
44    #   ],
45    #   "Members@odata.count": 3,
46    #   "Name": "Software Inventory Collection"
47    # }
48
49    ${resp}=  Redfish.Get  /redfish/v1/UpdateService/FirmwareInventory
50
51    Should Be True  ${resp.dict["Members@odata.count"]} >= ${1}
52    Length Should Be  ${resp.dict["Members"]}  ${resp.dict["Members@odata.count"]}
53
54
55Redfish Software Inventory Status Check
56    [Documentation]  Get firmware inventory entries and do health check status.
57    [Tags]  Redfish_Software_Inventory_Status_Check
58
59    ${resp}=  Redfish.Get  /redfish/v1/UpdateService/FirmwareInventory
60
61    # Entries "Members@odata.count": 3,
62    # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a3522998'}
63    # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a7c79f71'}
64    # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/ace821ef'}
65
66    :FOR  ${entry}  IN RANGE  0  ${resp.dict["Members@odata.count"]}
67    \  ${resp_resource}=  Redfish.Get  ${resp.dict["Members"][${entry}]["@odata.id"]}
68    # Example:
69    # "Status": {
70    #     "Health": "OK",
71    #     "HealthRollup": "OK",
72    #     "State": "Enabled"
73    # },
74    \  Should Be Equal As Strings  ${resp_resource.dict["Status"]["Health"]}  OK
75    \  Should Be Equal As Strings  ${resp_resource.dict["Status"]["HealthRollup"]}  OK
76    \  Should Be Equal As Strings  ${resp_resource.dict["Status"]["State"]}  Enabled
77
78
79*** Keywords ***
80
81Test Setup Execution
82    [Documentation]  Do test case setup tasks.
83
84    Redfish.Login
85
86
87Test Teardown Execution
88    [Documentation]  Do the post test teardown.
89
90    FFDC On Test Case Fail
91    Redfish.Logout
92