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*** Variables ***
14
15*** Test Cases ***
16
17Verify Power On Via XCAT
18    [Documentation]  Power on system via XCAT and verify using REST.
19    [Tags]  Verify_Power_On_Via_XCAT
20
21    Execute Command On XCAT  rpower  on
22    Wait Until Keyword Succeeds  10 min  10 sec  Is Host Running
23
24
25Verify Power Off Via XCAT
26    [Documentation]  Power off system via XCAT and verify using REST.
27    [Tags]  Verify_Power_Off_Via_XCAT
28
29    Execute Command On XCAT  rpower  off
30    Wait Until Keyword Succeeds  6 min  10 sec  Is Host Off
31
32
33Verify BMC State Via XCAT
34    [Documentation]  Verify BMC state using REST and XCAT.
35    [Tags]  Verify_BMC_State_Via_XCAT
36
37    ${xcat_resp}=  Execute Command On XCAT  rpower  bmcstate
38    ${rest_resp}=  Get BMC State
39    Should contain  ${xcat_resp}  ${rest_resp}
40
41
42Verify Soft Power Off Followed With Power On
43    [Documentation]  Verify soft power off system followed with power on.
44    [Tags]  Verify_Soft_Power_Off_Followed_With_Power_On
45    [Setup]  Initiate Host Boot
46
47    Execute Command On XCAT  rpower  softoff
48    Wait Until Keyword Succeeds  6 min  10 sec  Is Host Off
49
50    Execute Command On XCAT  rpower  on
51    Wait Until Keyword Succeeds  10 min  10 sec  Is Host Running
52
53
54Verify Hard Power Off Followed With Power On
55    [Documentation]  Verify hard power off system followed with power on.
56    [Tags]  Verify_Hard_Power_Off_Followed_With_Power_On
57    [Setup]  Initiate Host Boot
58
59    Execute Command On XCAT  rpower  off
60    Wait Until Keyword Succeeds  6 min  10 sec  Is Host Off
61
62    Execute Command On XCAT  rpower  on
63    Wait Until Keyword Succeeds  10 min  10 sec  Is Host Running
64
65
66*** Keywords ***
67
68Test Suite Setup
69    [Documentation]  Do the initial suite setup.
70
71    Open Connection And Login To XCAT
72
73    # Check if XCAT is installed.
74    ${cmd_output}=  Execute Command  ${XCAT_DIR_PATH}/lsxcatd -v
75    Should Not Be Empty  ${cmd_output}  msg=XCAT not installed.
76
77    Add Nodes To XCAT  ${OPENBMC_HOST}
78