1*** Settings ***
2Documentation    This suite tests Redfish Host power operations.
3
4Resource         ../../lib/boot_utils.robot
5Resource         ../../lib/common_utils.robot
6Resource         ../../lib/open_power_utils.robot
7
8Test Setup       Test Setup Execution
9Test Teardown    Test Teardown Execution
10
11*** Test Cases ***
12
13Verify Redfish Host GracefulShutdown
14    [Documentation]  Verify Redfish host graceful shutdown operation.
15    [Tags]  Verify_Redfish_Host_GracefulShutdown
16
17    Redfish Power Off
18
19
20Verify Redfish BMC PowerOn With OCC State
21    [Documentation]  Verify Redfish host power on operation.
22    [Tags]  Verify_Redfish_BMC_PowerOn_With_OCC_State
23
24    Redfish Power On
25
26    # TODO: Replace OCC state check with redfish property when available.
27    Verify OCC State
28
29
30Verify Redfish BMC PowerOn
31    [Documentation]  Verify Redfish host power on operation.
32    [Tags]  Verify_Redfish_Host_PowerOn
33
34    Redfish Power On
35
36    # TODO: Replace OCC state check with redfish property when available.
37    Verify OCC State
38
39    ${power_control}=  Redfish.Get Attribute  ${REDFISH_CHASSIS_POWER_URI}  PowerControl
40    Rprint Vars   power_control
41    Valid Dict  power_control[${0}]  ['PowerConsumedWatts']
42
43
44Verify Redfish BMC GracefulRestart
45    [Documentation]  Verify Redfish host graceful restart operation.
46    [Tags]  Verify_Redfish_Host_GracefulRestart
47
48    RF SYS GracefulRestart
49
50
51Verify Redfish BMC PowerOff
52    [Documentation]  Verify Redfish host power off operation.
53    [Tags]  Verify_Redfish_Host_PowerOff
54
55    Redfish Hard Power Off
56
57*** Keywords ***
58
59Test Setup Execution
60    [Documentation]  Do test case setup tasks.
61
62    Printn
63    Start SOL Console Logging
64    Redfish.Login
65
66
67Test Teardown Execution
68    [Documentation]  Collect FFDC and SOL log.
69
70    FFDC On Test Case Fail
71    ${sol_log}=    Stop SOL Console Logging
72    Log   ${sol_log}
73
74    Run Keyword If  ${REDFISH_SUPPORTED}
75    ...    Redfish Set Auto Reboot  RetryAttempts
76    ...  ELSE
77    ...    Set Auto Reboot  ${1}
78    Redfish.Logout
79