1*** Settings ***
2
3Documentation    Module to test IPMI chassis functionality.
4Resource         ../lib/ipmi_client.robot
5Resource         ../lib/openbmc_ffdc.robot
6Library          ../lib/ipmi_utils.py
7
8Test Teardown    FFDC On Test Case Fail
9
10*** Test Cases ***
11
12IPMI Chassis Status On
13    [Documentation]  This test case verfies system power on status
14    ...               using IPMI Get Chassis status command.
15    [Tags]  IPMI_Chassis_Status_On
16
17    Redfish Power On  stack_mode=skip  quiet=1
18    ${resp}=  Run IPMI Standard Command  chassis status
19    ${power_status}=  Get Lines Containing String  ${resp}  System Power
20    Should Contain  ${power_status}  on
21
22IPMI Chassis Status Off
23    [Documentation]  This test case verfies system power off status
24    ...               using IPMI Get Chassis status command.
25    [Tags]  IPMI_Chassis_Status_Off
26
27    Redfish Power Off  stack_mode=skip  quiet=1
28    ${resp}=  Run IPMI Standard Command  chassis status
29    ${power_status}=  Get Lines Containing String  ${resp}  System Power
30    Should Contain  ${power_status}  off
31
32Verify Host PowerOff Via IPMI
33    [Documentation]   Verify host power off operation using external IPMI command.
34    [Tags]  Verify_Host_PowerOff_Via_IPMI
35
36    IPMI Power Off
37    ${ipmi_state}=  Get Host State Via External IPMI
38    Valid Value  ipmi_state  ['off']
39
40Verify Host PowerOn Via IPMI
41    [Documentation]   Verify host power on operation using external IPMI command.
42    [Tags]  Verify_Host_PowerOn_Via_IPMI
43
44    IPMI Power On
45    ${ipmi_state}=  Get Host State Via External IPMI
46    Valid Value  ipmi_state  ['on']
47
48
49Verify Soft Shutdown
50    [Documentation]  Verify host OS shutdown softly via IPMI command.
51    [Tags]  Verify_Soft_Stutdown
52
53    Redfish Power On  stack_mode=skip
54    Run IPMI Standard Command  chassis power soft
55    Wait Until Keyword Succeeds  3 min  10 sec  Is Host Off Via IPMI
56
57
58Verify Chassis Power Policy
59    [Documentation]  Verify setting chassis power policy via IPMI command.
60    [Tags]  Verify_Chassis_Power_Policy
61    [Setup]  Test Setup Execution
62    [Teardown]  Run Keywords  FFDC On Test Case Fail  AND
63    ...  Run IPMI Standard Command  chassis policy ${initial_power_policy}
64    [Template]  Set Chassis Power Policy Via IPMI And Verify
65
66    # power_policy
67    always-off
68    always-on
69    previous
70
71
72*** Keywords ***
73
74Set Chassis Power Policy Via IPMI And Verify
75    [Documentation]  Set chasiss power policy via IPMI and verify.
76    [Arguments]  ${power_policy}
77
78    # Description of argument(s):
79    # power_policy    Chassis power policy to be set(e.g. "always-off", "always-on").
80
81    Run IPMI Standard Command  chassis policy ${power_policy}
82    ${resp}=  Get Chassis Status
83    Valid Value  resp['power_restore_policy']  ['${power_policy}']
84
85
86Test Setup Execution
87    [Documentation]  Do test setup tasks.
88
89    ${chassis_status}=  Get Chassis Status
90    Set Test Variable  ${initial_power_policy}  ${chassis_status['power_restore_policy']}
91
92