1*** Settings ***
2Documentation    Test BMC Manager functionality.
3Resource         ../../lib/resource.robot
4Resource         ../../lib/bmc_redfish_resource.robot
5Resource         ../../lib/common_utils.robot
6Resource         ../../lib/openbmc_ffdc.robot
7Resource         ../../lib/boot_utils.robot
8Resource         ../../lib/open_power_utils.robot
9
10Test Setup       Test Setup Execution
11Test Teardown    Test Teardown Execution
12
13
14*** Variables ***
15
16${SYSTEM_SHUTDOWN_TIME}    ${5}
17
18# Strings to check from journald.
19${REBOOT_REGEX}    ^\-- Reboot --
20
21*** Test Cases ***
22
23Verify Redfish BMC Firmware Version
24    [Documentation]  Get firmware version from BMC manager.
25    [Tags]  Verify_Redfish_BMC_Firmware_Version
26
27    Redfish.Login
28    ${resp}=  Redfish.Get  /redfish/v1/Managers/bmc
29    Should Be Equal As Strings  ${resp.status}  ${HTTP_OK}
30    ${bmc_version}=  Get BMC Version
31    Should Be Equal As Strings
32    ...  ${resp.dict["FirmwareVersion"]}  ${bmc_version.strip('"')}
33
34
35Verify Redfish BMC Manager Properties
36    [Documentation]  Verify BMC managers resource properties.
37    [Tags]  Verify_Redfish_BMC_Manager_Properties
38
39    Redfish.Login
40    ${resp}=  Redfish.Get  /redfish/v1/Managers/bmc
41    Should Be Equal As Strings  ${resp.status}  ${HTTP_OK}
42    # Example:
43    #  "Description": "Baseboard Management Controller"
44    #  "Id": "bmc"
45    #  "Model": "OpenBmc",
46    #  "Name": "OpenBmc Manager",
47    #  "UUID": "xxxxxxxx-xxx-xxx-xxx-xxxxxxxxxxxx"
48    #  "PowerState": "On"
49
50    Should Be Equal As Strings
51    ...  ${resp.dict["Description"]}  Baseboard Management Controller
52    Should Be Equal As Strings  ${resp.dict["Id"]}  bmc
53    Should Be Equal As Strings  ${resp.dict["Model"]}  OpenBmc
54    Should Be Equal As Strings  ${resp.dict["Name"]}  OpenBmc Manager
55    Should Not Be Empty  ${resp.dict["UUID"]}
56    Should Be Equal As Strings  ${resp.dict["PowerState"]}  On
57
58
59Redfish BMC Manager GracefulRestart When Host Off
60    [Documentation]  BMC graceful restart when host is powered off.
61    [Tags]  Redfish_BMC_Manager_GracefulRestart_When_Host_Off
62
63    # "Actions": {
64    # "#Manager.Reset": {
65    #  "ResetType@Redfish.AllowableValues": [
66    #    "GracefulRestart"
67    #  ],
68    #  "target": "/redfish/v1/Managers/bmc/Actions/Manager.Reset"
69    # }
70
71    ${test_file_path}=  Set Variable  /tmp/before_bmcreboot
72    BMC Execute Command  touch ${test_file_path}
73
74    Redfish OBMC Reboot (off)
75
76    BMC Execute Command  if [ -f ${test_file_path} ] ; then false ; fi
77    Verify BMC RTC And UTC Time Drift
78
79    # Check for journald persistency post reboot.
80    Check For Regex In Journald  ${REBOOT_REGEX}  error_check=${1}
81
82
83Verify Boot Count After BMC Reboot
84    [Documentation]  Verify boot count increments on BMC reboot.
85    [Tags]  Verify_Boot_Count_After_BMC_Reboot
86
87    Set BMC Boot Count  ${0}
88    Redfish OBMC Reboot (off)
89    ${boot_count}=  Get BMC Boot Count
90    Should Be Equal  ${boot_count}  ${1}  msg=Boot count is not incremented.
91
92
93Redfish BMC Manager GracefulRestart When Host Booted
94    [Documentation]  BMC graceful restart when host is running.
95    [Tags]  Redfish_BMC_Manager_GracefulRestart_When_Host_Booted
96
97    Redfish OBMC Reboot (run)
98
99    # TODO: Replace OCC state check with redfish property when available.
100    Verify OCC State
101
102
103*** Keywords ***
104
105Test Setup Execution
106    [Documentation]  Do test case setup tasks.
107
108    redfish.Login
109
110
111Test Teardown Execution
112    [Documentation]  Do the post test teardown.
113
114    FFDC On Test Case Fail
115    redfish.Logout
116