xref: /openbmc/openbmc-test-automation/redfish/managers/test_bmc_protocol_settings.robot (revision f59a73e8da935ff76c82e58d63dc06f42ffd4b56)
1abbce3daSPrashanth Katti*** Settings ***
2abbce3daSPrashanth KattiDocumentation  Test BMC manager protocol enable/disable functionality.
3abbce3daSPrashanth Katti
4abbce3daSPrashanth KattiResource   ../../lib/bmc_redfish_resource.robot
5abbce3daSPrashanth KattiResource   ../../lib/openbmc_ffdc.robot
6*f59a73e8SPrashanth KattiResource   ../../lib/protocol_setting_utils.robot
7abbce3daSPrashanth Katti
8abbce3daSPrashanth KattiSuite Setup     Redfish.Login
92e413457SPrashanth KattiSuite Teardown  Redfish.Logout
10abbce3daSPrashanth KattiTest Teardown   FFDC On Test Case Fail
11abbce3daSPrashanth Katti
12abbce3daSPrashanth Katti
1370620175SPrashanth Katti*** Variables ***
1470620175SPrashanth Katti
1570620175SPrashanth Katti${cmd_prefix}  ipmitool -I lanplus -C 17 -p 623 -U ${OPENBMC_USERNAME} -P ${OPENBMC_PASSWORD}
1670620175SPrashanth Katti
1770620175SPrashanth Katti
18abbce3daSPrashanth Katti*** Test Cases ***
19abbce3daSPrashanth Katti
202e413457SPrashanth KattiVerify SSH Is Enabled By Default
212e413457SPrashanth Katti    [Documentation]  Verify SSH is enabled by default.
222e413457SPrashanth Katti    [Tags]  Verify_SSH_Is_Enabled_By_Default
232e413457SPrashanth Katti
242e413457SPrashanth Katti    # Check if SSH is enabled by default.
252e413457SPrashanth Katti    Verify SSH Protocol State  ${True}
262e413457SPrashanth Katti
272e413457SPrashanth Katti
28abbce3daSPrashanth KattiEnable SSH Protocol And Verify
29abbce3daSPrashanth Katti    [Documentation]  Enable SSH protocol and verify.
30abbce3daSPrashanth Katti    [Tags]  Enable_SSH_Protocol_And_Verify
31abbce3daSPrashanth Katti
32abbce3daSPrashanth Katti    Enable SSH Protocol  ${True}
33abbce3daSPrashanth Katti
34abbce3daSPrashanth Katti    # Check if SSH is really enabled via Redfish.
35abbce3daSPrashanth Katti    Verify SSH Protocol State  ${True}
36abbce3daSPrashanth Katti
37abbce3daSPrashanth Katti    # Check if SSH login and commands on SSH session work.
38abbce3daSPrashanth Katti    Verify SSH Login And Commands Work
39abbce3daSPrashanth Katti
40abbce3daSPrashanth Katti
41abbce3daSPrashanth KattiDisable SSH Protocol And Verify
42abbce3daSPrashanth Katti    [Documentation]  Disable SSH protocol and verify.
43abbce3daSPrashanth Katti    [Teardown]  Enable SSH Protocol  ${True}
44abbce3daSPrashanth Katti
45abbce3daSPrashanth Katti    # Disable SSH interface.
46abbce3daSPrashanth Katti    Enable SSH Protocol  ${False}
47abbce3daSPrashanth Katti
48abbce3daSPrashanth Katti    # Check if SSH is really disabled via Redfish.
49abbce3daSPrashanth Katti    Verify SSH Protocol State  ${False}
50abbce3daSPrashanth Katti
51abbce3daSPrashanth Katti    # Check if SSH login and commands fail.
52abbce3daSPrashanth Katti    ${status}=  Run Keyword And Return Status
53abbce3daSPrashanth Katti    ...  Verify SSH Login And Commands Work
54abbce3daSPrashanth Katti
55abbce3daSPrashanth Katti    Should Be Equal As Strings  ${status}  False
56abbce3daSPrashanth Katti    ...  msg=SSH Login and commands are working after disabling SSH.
57abbce3daSPrashanth Katti
58abbce3daSPrashanth Katti
59abbce3daSPrashanth KattiEnable SSH Protocol And Check Persistency On BMC Reboot
60abbce3daSPrashanth Katti    [Documentation]  Enable SSH protocol and verify persistency.
61abbce3daSPrashanth Katti
62abbce3daSPrashanth Katti    Enable SSH Protocol  ${True}
63abbce3daSPrashanth Katti
64abbce3daSPrashanth Katti    # Reboot BMC and verify persistency.
65abbce3daSPrashanth Katti    OBMC Reboot (off)
66abbce3daSPrashanth Katti
67abbce3daSPrashanth Katti    # Check if SSH is really enabled via Redfish.
68abbce3daSPrashanth Katti    Verify SSH Protocol State  ${True}
69abbce3daSPrashanth Katti
70abbce3daSPrashanth Katti    # Check if SSH login and commands on SSH session work.
71abbce3daSPrashanth Katti    Verify SSH Login And Commands Work
72abbce3daSPrashanth Katti
73abbce3daSPrashanth Katti
74abbce3daSPrashanth KattiDisable SSH Protocol And Check Persistency On BMC Reboot
75abbce3daSPrashanth Katti    [Documentation]  Disable SSH protocol and verify persistency.
76abbce3daSPrashanth Katti    [Teardown]  Enable SSH Protocol  ${True}
77abbce3daSPrashanth Katti
78abbce3daSPrashanth Katti    # Disable SSH interface.
79abbce3daSPrashanth Katti    Enable SSH Protocol  ${False}
80abbce3daSPrashanth Katti
81abbce3daSPrashanth Katti    # Reboot BMC and verify persistency.
82abbce3daSPrashanth Katti    OBMC Reboot (off)
83abbce3daSPrashanth Katti
84abbce3daSPrashanth Katti    # Check if SSH is really disabled via Redfish.
85abbce3daSPrashanth Katti    Verify SSH Protocol State  ${False}
86abbce3daSPrashanth Katti
87abbce3daSPrashanth Katti    # Check if SSH login and commands fail.
88abbce3daSPrashanth Katti    ${status}=  Run Keyword And Return Status
89abbce3daSPrashanth Katti    ...  Verify SSH Login And Commands Work
90abbce3daSPrashanth Katti
91abbce3daSPrashanth Katti    Should Be Equal As Strings  ${status}  False
92abbce3daSPrashanth Katti    ...  msg=SSH Login and commands are working after disabling SSH.
93abbce3daSPrashanth Katti
94abbce3daSPrashanth Katti
952e413457SPrashanth KattiVerify Disabling SSH Port Does Not Disable Serial Console Port
962e413457SPrashanth Katti    [Documentation]  Verify disabling SSH does not disable serial console port.
972e413457SPrashanth Katti    [Tags]  Verify_Disabling_SSH_Port_Does_Not_Disable_Serial_Console_Port
982e413457SPrashanth Katti    [Teardown]  Enable SSH Protocol  ${True}
992e413457SPrashanth Katti
1002e413457SPrashanth Katti    # Disable SSH interface.
1012e413457SPrashanth Katti    Enable SSH Protocol  ${False}
1022e413457SPrashanth Katti
1032e413457SPrashanth Katti    # Check able to establish connection with serial port console.
1042e413457SPrashanth Katti    Open Connection And Log In  host=${OPENBMC_HOST}  port=2200
1052e413457SPrashanth Katti    Close All Connections
1062e413457SPrashanth Katti
1072e413457SPrashanth Katti
1082e413457SPrashanth KattiVerify Existing SSH Session Gets Closed On Disabling SSH
1092e413457SPrashanth Katti    [Documentation]  Verify existing SSH session gets closed on disabling ssh.
1102e413457SPrashanth Katti    [Tags]  Verify_Existing_SSH_Session_Gets_Closed_On_Disabling_SSH
1112e413457SPrashanth Katti    [Teardown]  Enable SSH Protocol  ${True}
1122e413457SPrashanth Katti
1132e413457SPrashanth Katti    # Open SSH connection.
1142e413457SPrashanth Katti    Open Connection And Login
1152e413457SPrashanth Katti
1162e413457SPrashanth Katti    # Disable SSH interface.
1172e413457SPrashanth Katti    Enable SSH Protocol  ${False}
1182e413457SPrashanth Katti
1192e413457SPrashanth Katti    # Check if SSH is really disabled via Redfish.
1202e413457SPrashanth Katti    Verify SSH Protocol State  ${False}
1212e413457SPrashanth Katti
1222e413457SPrashanth Katti    # Try to execute CLI command on SSH connection.
1232e413457SPrashanth Katti    # It should fail as disable SSH will close pre existing sessions.
1242e413457SPrashanth Katti    ${status}=  Run Keyword And Return Status
1252e413457SPrashanth Katti    ...  BMC Execute Command  /sbin/ip addr
1262e413457SPrashanth Katti
1272e413457SPrashanth Katti    Should Be Equal As Strings  ${status}  False
1282e413457SPrashanth Katti    ...  msg=Disabling SSH has not closed existing SSH sessions.
1292e413457SPrashanth Katti
1302e413457SPrashanth Katti
13170620175SPrashanth KattiEnable IPMI Protocol And Verify
13270620175SPrashanth Katti    [Documentation]  Enable IPMI protocol and verify.
13370620175SPrashanth Katti    [Tags]  Enable_IPMI_Protocol_And_Verify
13470620175SPrashanth Katti    [Teardown]  Enable IPMI Protocol  ${False}
13570620175SPrashanth Katti
13670620175SPrashanth Katti    Enable IPMI Protocol  ${True}
13770620175SPrashanth Katti
13870620175SPrashanth Katti    # Check if IPMI is really enabled via Redfish.
13970620175SPrashanth Katti    Verify IPMI Protocol State  ${True}
14070620175SPrashanth Katti
14170620175SPrashanth Katti    # Check if IPMI commands starts working.
14270620175SPrashanth Katti    Verify IPMI Works  lan print
14370620175SPrashanth Katti
14470620175SPrashanth Katti
14570620175SPrashanth KattiDisable IPMI Protocol And Verify
14670620175SPrashanth Katti    [Documentation]  Disable IPMI protocol and verify.
14770620175SPrashanth Katti    [Tags]  Disable_IPMI_Protocol_And_Verify
14870620175SPrashanth Katti
14970620175SPrashanth Katti    # Disable IPMI interface.
15070620175SPrashanth Katti    Enable IPMI Protocol  ${False}
15170620175SPrashanth Katti
15270620175SPrashanth Katti    # Check if IPMI is really disabled via Redfish.
15370620175SPrashanth Katti    Verify IPMI Protocol State  ${False}
15470620175SPrashanth Katti
15570620175SPrashanth Katti    # Check if IPMI commands fail.
15670620175SPrashanth Katti    ${status}=  Run Keyword And Return Status
15770620175SPrashanth Katti    ...  Verify IPMI Works  lan print
15870620175SPrashanth Katti
15970620175SPrashanth Katti    Should Be Equal As Strings  ${status}  False
16070620175SPrashanth Katti    ...  msg=IPMI commands are working after disabling IPMI.
16170620175SPrashanth Katti
16270620175SPrashanth Katti
163abbce3daSPrashanth Katti*** Keywords ***
164abbce3daSPrashanth Katti
165