1*** Settings ***
2Resource         ../../lib/resource.robot
3Resource         ../../lib/bmc_redfish_resource.robot
4Resource         ../../lib/openbmc_ffdc.robot
5
6Test Teardown    FFDC On Test Case Fail
7
8*** Test Cases ***
9
10Verify Redfish Update Service Enabled
11    [Documentation]  Verify "ServiceEnabled" is enabled.
12    [Tags]  Verify_Update_Service_Enabled
13
14    # Example:
15    # "HttpPushUri": "/redfish/v1/UpdateService",
16    # "Id": "UpdateService",
17    # "Name": "Update Service",
18    # "ServiceEnabled": true
19
20    redfish.Login
21    ${resp}=  redfish.Get  /redfish/v1/UpdateService
22    Should Be Equal As Strings  ${resp.status}  ${HTTP_OK}
23    Should Be Equal As Strings  ${resp.dict["ServiceEnabled"]}  ${True}
24    redfish.Logout
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    redfish.Login
50    ${resp}=  redfish.Get  /redfish/v1/UpdateService/FirmwareInventory
51    Should Be Equal As Strings  ${resp.status}  ${HTTP_OK}
52
53    Should Be True  ${resp.dict["Members@odata.count"]} >= ${1}
54    Length Should Be  ${resp.dict["Members"]}  ${resp.dict["Members@odata.count"]}
55    redfish.Logout
56
57
58Redfish Software Inventory Status Check
59    [Documentation]  Get firmware inventory entries and do health check status.
60    [Tags]  Redfish_Software_Inventory_Status_Check
61
62    redfish.Login
63    ${resp}=  redfish.Get  /redfish/v1/UpdateService/FirmwareInventory
64    Should Be Equal As Strings  ${resp.status}  ${HTTP_OK}
65
66    # Entries "Members@odata.count": 3,
67    # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a3522998'}
68    # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a7c79f71'}
69    # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/ace821ef'}
70
71    :FOR  ${entry}  IN RANGE  0  ${resp.dict["Members@odata.count"]}
72    \  ${resp_resource}=  redfish.Get  ${resp.dict["Members"][${entry}]["@odata.id"]}
73    \  Should Be Equal As Strings  ${resp_resource.status}  ${HTTP_OK}
74    # Example:
75    # "Status": {
76    #     "Health": "OK",
77    #     "HealthRollup": "OK",
78    #     "State": "Enabled"
79    # },
80    \  Should Be Equal As Strings  ${resp_resource.dict["Status"]["Health"]}  OK
81    \  Should Be Equal As Strings  ${resp_resource.dict["Status"]["HealthRollup"]}  OK
82    \  Should Be Equal As Strings  ${resp_resource.dict["Status"]["State"]}  Enabled
83    redfish.Logout
84