1*** Settings ***
2Resource         ../../lib/resource.txt
3Resource         ../../lib/bmc_redfish_resource.robot
4
5*** Test Cases ***
6
7Verify Update Service Enabled
8    [Documentation]  Verify "ServiceEnabled" is enabled.
9    [Tags]  Verify_Update_Service_Enabled
10
11    # Example:
12    # "HttpPushUri": "/redfish/v1/UpdateService",
13    # "Id": "UpdateService",
14    # "Name": "Update Service",
15    # "ServiceEnabled": true
16
17    redfish.Login
18    ${resp}=  redfish.Get  /redfish/v1/UpdateService
19    Should Be Equal As Strings  ${resp.status}  ${HTTP_OK}
20    Should Be Equal As Strings  ${resp.dict["ServiceEnabled"]}  ${True}
21    redfish.Logout
22
23
24Verify Software Inventory Collection
25    [Documentation]  Verify software inventory collection member and object entries.
26    [Tags]  Verify_Software_Inventory_Collection
27
28    # Example:
29    # {
30    #    "@odata.type": "#SoftwareInventoryCollection.SoftwareInventoryCollection",
31    #    "Members": [
32    #      {
33    #        "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/a3522998"
34    #      },
35    #      {
36    #        "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/a7c79f71"
37    #      },
38    #      {
39    #        "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/ace821ef"
40    #      }
41    #   ],
42    #   "Members@odata.count": 3,
43    #   "Name": "Software Inventory Collection"
44    # }
45
46    redfish.Login
47    ${resp}=  redfish.Get  /redfish/v1/UpdateService/FirmwareInventory
48    Should Be Equal As Strings  ${resp.status}  ${HTTP_OK}
49
50    Should Be True  ${resp.dict["Members@odata.count"]} >= ${1}
51    Length Should Be  ${resp.dict["Members"]}  ${resp.dict["Members@odata.count"]}
52    redfish.Logout
53
54
55Software Inventory Status Check
56    [Documentation]  Get firmware inventory entries and do health check status.
57    [Tags]  Software_Inventory_Status_Check
58
59    redfish.Login
60    ${resp}=  redfish.Get  /redfish/v1/UpdateService/FirmwareInventory
61    Should Be Equal As Strings  ${resp.status}  ${HTTP_OK}
62
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
68    :FOR  ${entry}  IN RANGE  0  ${resp.dict["Members@odata.count"]}
69    \  ${resp_resource}=  redfish.Get  ${resp.dict["Members"][${entry}]["@odata.id"]}
70    \  Should Be Equal As Strings  ${resp_resource.status}  ${HTTP_OK}
71    # Example:
72    # "Status": {
73    #     "Health": "OK",
74    #     "HealthRollup": "OK",
75    #     "State": "Enabled"
76    # },
77    \  Should Be Equal As Strings  ${resp_resource.dict["Status"]["Health"]}  OK
78    \  Should Be Equal As Strings  ${resp_resource.dict["Status"]["HealthRollup"]}  OK
79    \  Should Be Equal As Strings  ${resp_resource.dict["Status"]["State"]}  Enabled
80