1*** Settings ***
2Resource         ../../lib/resource.robot
3Resource         ../../lib/bmc_redfish_resource.robot
4Resource         ../../lib/common_utils.robot
5Resource         ../../lib/openbmc_ffdc.robot
6
7Test Teardown    FFDC On Test Case Fail
8Suite Teardown   redfish.Logout
9
10*** Test Cases ***
11
12Verify Redfish BMC Firmware Version
13    [Documentation]  Get firmware version from BMC manager.
14    [Tags]  Verify_Redfish_BMC_Firmware_Version
15
16    redfish.Login
17    ${resp}=  redfish.Get  /redfish/v1/Managers/bmc
18    Should Be Equal As Strings  ${resp.status}  ${HTTP_OK}
19    ${bmc_version}=  Get BMC Version
20    Should Be Equal As Strings
21    ...  ${resp.dict["FirmwareVersion"]}  ${bmc_version.strip('"')}
22    redfish.Logout
23
24
25Verify Redfish BMC Manager Properties
26    [Documentation]  Verify BMC managers resource properties.
27    [Tags]  Verify_Redfish_BMC_Manager_Properties
28
29    redfish.Login
30    ${resp}=  redfish.Get  /redfish/v1/Managers/bmc
31    Should Be Equal As Strings  ${resp.status}  ${HTTP_OK}
32    # Example:
33    #  "Description": "Baseboard Management Controller"
34    #  "Id": "bmc"
35    #  "Model": "OpenBmc",
36    #  "Name": "OpenBmc Manager",
37    #  "UUID": "xxxxxxxx-xxx-xxx-xxx-xxxxxxxxxxxx"
38    #  "PowerState": "On"
39
40    Should Be Equal As Strings
41    ...  ${resp.dict["Description"]}  Baseboard Management Controller
42    Should Be Equal As Strings  ${resp.dict["Id"]}  bmc
43    Should Be Equal As Strings  ${resp.dict["Model"]}  OpenBmc
44    Should Be Equal As Strings  ${resp.dict["Name"]}  OpenBmc Manager
45    Should Not Be Empty  ${resp.dict["UUID"]}
46    Should Be Equal As Strings  ${resp.dict["PowerState"]}  On
47    redfish.Logout
48
49
50Test Redfish BMC Manager GracefulRestart
51    [Documentation]  BMC graceful restart.
52    [Tags]  Test_Redfish_BMC_Manager_GracefulRestart
53
54    # Example:
55    # "Actions": {
56    # "#Manager.Reset": {
57    #  "ResetType@Redfish.AllowableValues": [
58    #    "GracefulRestart"
59    #  ],
60    #  "target": "/redfish/v1/Managers/bmc/Actions/Manager.Reset"
61    # }
62
63    redfish.Login
64    ${payload}=  Create Dictionary  ResetType=GracefulRestart
65    ${resp}=  redfish.Post  Managers/bmc/Actions/Manager.Reset  body=&{payload}
66    Should Be Equal As Strings  ${resp.status}  ${HTTP_OK}
67
68    # TODO: Add logic to ping and check BMC online state
69
70
71
72