xref: /openbmc/openbmc-test-automation/xcat/test_power_operation.robot (revision 069b266e40a93fda3992c888062745b1ac920473)
1*** Settings ***
2Documentation   Module for testing BMC via XCAT.
3
4Resource        ../lib/xcat/resource.robot
5Resource        ../lib/xcat/xcat_utils.robot
6Resource        ../lib/state_manager.robot
7
8Library         OperatingSystem
9Library         String
10
11Suite Setup     Test Suite Setup
12
13*** Test Cases ***
14
15Verify Power On Via XCAT
16    [Documentation]  Power on system via XCAT and verify using REST.
17    [Tags]  Verify_Power_On_Via_XCAT
18
19    Execute Command On XCAT  rpower  on
20    Wait Until Keyword Succeeds  10 min  10 sec  Is Host Running
21
22Verify Power Off Via XCAT
23    [Documentation]  Power off system via XCAT and verify using REST.
24    [Tags]  Verify_Power_Off_Via_XCAT
25
26    Execute Command On XCAT  rpower  off
27    Wait Until Keyword Succeeds  6 min  10 sec  Is Host Off
28
29Verify BMC State Via XCAT
30    [Documentation]  Verify BMC state using REST and XCAT.
31    [Tags]  Verify_BMC_State_Via_XCAT
32
33    ${xcat_resp}=  Execute Command On XCAT  rpower  bmcstate
34    ${rest_resp}=  Get BMC State
35    Should Contain  ${xcat_resp}  ${rest_resp}
36
37Verify Soft Power Off Followed With Power On
38    [Documentation]  Verify soft power off system followed with power on.
39    [Tags]  Verify_Soft_Power_Off_Followed_With_Power_On
40    [Setup]  Initiate Host Boot
41
42    Execute Command On XCAT  rpower  softoff
43    Wait Until Keyword Succeeds  6 min  10 sec  Is Host Off
44
45    Execute Command On XCAT  rpower  on
46    Wait Until Keyword Succeeds  10 min  10 sec  Is Host Running
47
48Verify Hard Power Off Followed With Power On
49    [Documentation]  Verify hard power off system followed with power on.
50    [Tags]  Verify_Hard_Power_Off_Followed_With_Power_On
51    [Setup]  Initiate Host Boot
52
53    Execute Command On XCAT  rpower  off
54    Wait Until Keyword Succeeds  6 min  10 sec  Is Host Off
55
56    Execute Command On XCAT  rpower  on
57    Wait Until Keyword Succeeds  10 min  10 sec  Is Host Running
58
59*** Keywords ***
60
61Test Suite Setup
62    [Documentation]  Do the initial suite setup.
63
64    Open Connection And Login To XCAT
65
66    # Check if XCAT is installed.
67    ${cmd_output}=  Execute Command  ${XCAT_DIR_PATH}/lsxcatd -v
68    Should Not Be Empty  ${cmd_output}  msg=XCAT not installed.
69
70    Add Nodes To XCAT  ${OPENBMC_HOST}
71