1*** Settings ***
2Documentation    Module to test IPMI disable functionality.
3
4Resource         ../lib/ipmi_client.robot
5Resource         ../lib/openbmc_ffdc.robot
6Library          ../lib/ipmi_utils.py
7
8Test Tags       IPMI_Disable
9
10*** Test Cases ***
11
12Verify Disabling And Enabling IPMI Via Host
13    [Documentation]  Verify disabling and enabling IPMI via host.
14    [Tags]  Verify_Disabling_And_Enabling_IPMI_Via_Host
15    [Teardown]  Run Keywords  FFDC On Test Case Fail
16    ...  AND  Run Inband IPMI Standard Command  lan set ${CHANNEL_NUMBER} access on
17
18    # Disable IPMI and verify
19    Run Inband IPMI Standard Command  lan set ${CHANNEL_NUMBER} access off
20    Run Keyword and Expect Error  *Unable to establish IPMI*
21    ...  Run External IPMI Standard Command  lan print ${CHANNEL_NUMBER}
22
23    # Enable IPMI and verify
24    Run Inband IPMI Standard Command  lan set ${CHANNEL_NUMBER} access on
25    ${lan_print_info}=  Get Lan Print Dict  ${CHANNEL_NUMBER}
26
27    ${openbmc_host_name}  ${openbmc_ip}=  Get Host Name IP  host=${OPENBMC_HOST}
28    Rprint Vars  lan_print_info  openbmc_ip
29    Valid Value  lan_print_info['IP Address']  ['${openbmc_ip}']
30
31
32Verify Disabling IPMI Via OOB IPMI
33    [Documentation]  Verify disabling IPMI via out of band IPMI.
34    [Tags]  Verify_Disabling_IPMI_Via_OOB_IPMI
35    [Teardown]  Run Keywords  FFDC On Test Case Fail
36    ...  AND  Run Inband IPMI Standard Command  lan set ${CHANNEL_NUMBER} access on
37
38    # Disable IPMI via OOB IPMI and verify
39    ${resp}=  Run Keyword and Ignore Error
40    ...  Run External IPMI Standard Command  lan set ${CHANNEL_NUMBER} access off
41    Should Contain any  ${resp}  ${EMPTY}  Set Channel Access for channel ${CHANNEL_NUMBER} was successful.
42    Run Keyword and Expect Error  *Unable to establish IPMI*
43    ...  Run External IPMI Standard Command  lan print ${CHANNEL_NUMBER}
44
45    # Enable IPMI via Host and verify
46    Run Inband IPMI Standard Command  lan set ${CHANNEL_NUMBER} access on
47    ${lan_print_info}=  Get Lan Print Dict  ${CHANNEL_NUMBER}
48
49    ${openbmc_host_name}  ${openbmc_ip}=  Get Host Name IP  host=${OPENBMC_HOST}
50    Rprint Vars  lan_print_info  openbmc_ip
51    Valid Value  lan_print_info['IP Address']  ['${openbmc_ip}']
52
53
54Verify IPMI Disable Persistency After BMC Reboot
55    [Documentation]  Verify IPMI disable persistency after BMC reboot.
56    [Tags]  Verify_IPMI_Disable_Persistency_After_BMC_Reboot
57    [Teardown]  Run Keywords  FFDC On Test Case Fail
58    ...  AND  Run Inband IPMI Standard Command  lan set ${CHANNEL_NUMBER} access on
59
60    # Disable IPMI and reboot BMC.
61    Run Inband IPMI Standard Command  lan set ${CHANNEL_NUMBER} access off
62    OBMC Reboot (run)
63
64    # Verify that IPMI remains disabled after reboot.
65    Run Keyword and Expect Error  *Unable to establish IPMI*
66    ...  Run External IPMI Standard Command  lan print ${CHANNEL_NUMBER}
67
68