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