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 6f59a73e8SPrashanth KattiResource ../../lib/protocol_setting_utils.robot 7abbce3daSPrashanth Katti 8274b7241SBrian MaSuite Setup Suite Setup Execution 9274b7241SBrian MaSuite Teardown Run Keywords Enable IPMI Protocol ${initial_ipmi_state} AND 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. 824ddcb4d4SBrian Ma Redfish BMC Reboot 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 13570620175SPrashanth Katti Enable IPMI Protocol ${True} 13670620175SPrashanth Katti 13770620175SPrashanth Katti # Check if IPMI is really enabled via Redfish. 13870620175SPrashanth Katti Verify IPMI Protocol State ${True} 13970620175SPrashanth Katti 14070620175SPrashanth Katti # Check if IPMI commands starts working. 14170620175SPrashanth Katti Verify IPMI Works lan print 14270620175SPrashanth Katti 14370620175SPrashanth Katti 14470620175SPrashanth KattiDisable IPMI Protocol And Verify 14570620175SPrashanth Katti [Documentation] Disable IPMI protocol and verify. 14670620175SPrashanth Katti [Tags] Disable_IPMI_Protocol_And_Verify 14770620175SPrashanth Katti 14870620175SPrashanth Katti # Disable IPMI interface. 14970620175SPrashanth Katti Enable IPMI Protocol ${False} 15070620175SPrashanth Katti 15170620175SPrashanth Katti # Check if IPMI is really disabled via Redfish. 15270620175SPrashanth Katti Verify IPMI Protocol State ${False} 15370620175SPrashanth Katti 15470620175SPrashanth Katti # Check if IPMI commands fail. 15570620175SPrashanth Katti ${status}= Run Keyword And Return Status 15670620175SPrashanth Katti ... Verify IPMI Works lan print 15770620175SPrashanth Katti 15870620175SPrashanth Katti Should Be Equal As Strings ${status} False 15970620175SPrashanth Katti ... msg=IPMI commands are working after disabling IPMI. 16070620175SPrashanth Katti 16170620175SPrashanth Katti 162*ef433de8SmeghagnEnable IPMI Protocol And Check Persistency On BMC Reboot 163*ef433de8Smeghagn [Documentation] Set the IPMI protocol attribute to True, reset BMC, and verify that the setting persists. 164*ef433de8Smeghagn [Tags] Enable_IPMI_Protocol_And_Check_Persistency_On_BMC_Reboot 165*ef433de8Smeghagn 166*ef433de8Smeghagn Enable IPMI Protocol ${True} 167*ef433de8Smeghagn 168*ef433de8Smeghagn Redfish OBMC Reboot (off) stack_mode=skip 169*ef433de8Smeghagn 170*ef433de8Smeghagn # Check if the IPMI enabled is set. 171*ef433de8Smeghagn Verify IPMI Protocol State ${True} 172*ef433de8Smeghagn 173*ef433de8Smeghagn # Confirm that IPMI commands to access BMC work. 174*ef433de8Smeghagn Verify IPMI Works lan print 175*ef433de8Smeghagn 176*ef433de8Smeghagn 177*ef433de8SmeghagnDisable IPMI Protocol And Check Persistency On BMC Reboot 178*ef433de8Smeghagn [Documentation] Set the IPMI protocol attribute to False, reset BMC, and verify that the setting persists. 179*ef433de8Smeghagn [Tags] Disable_IPMI_Protocol_And_Check_Persistency_On_BMC_Reboot 180*ef433de8Smeghagn 181*ef433de8Smeghagn # Disable IPMI interface. 182*ef433de8Smeghagn Enable IPMI Protocol ${False} 183*ef433de8Smeghagn 184*ef433de8Smeghagn Redfish OBMC Reboot (off) stack_mode=skip 185*ef433de8Smeghagn 186*ef433de8Smeghagn # Check if the IPMI disabled is set. 187*ef433de8Smeghagn Verify IPMI Protocol State ${False} 188*ef433de8Smeghagn 189*ef433de8Smeghagn # Confirm that IPMI connection request fails. 190*ef433de8Smeghagn ${status}= Run Keyword And Return Status 191*ef433de8Smeghagn ... Verify IPMI Works lan print 192*ef433de8Smeghagn 193*ef433de8Smeghagn Should Be Equal As Strings ${status} False 194*ef433de8Smeghagn ... msg=IPMI commands are working after disabling IPMI. 195*ef433de8Smeghagn 196*ef433de8Smeghagn 197abbce3daSPrashanth Katti*** Keywords *** 198abbce3daSPrashanth Katti 199274b7241SBrian MaSuite Setup Execution 200274b7241SBrian Ma [Documentation] Do suite setup tasks. 201274b7241SBrian Ma 202274b7241SBrian Ma Redfish.Login 203274b7241SBrian Ma 204274b7241SBrian Ma ${state}= Run Keyword And Return Status Verify IPMI Protocol State 205274b7241SBrian Ma Set Suite Variable ${initial_ipmi_state} ${state} 206274b7241SBrian Ma 207274b7241SBrian Ma 2084ddcb4d4SBrian MaIs BMC LastResetTime Changed 2094ddcb4d4SBrian Ma [Documentation] return fail if BMC last reset time is not changed 2104ddcb4d4SBrian Ma [Arguments] ${reset_time} 2114ddcb4d4SBrian Ma 2124ddcb4d4SBrian Ma ${last_reset_time}= Redfish.Get Attribute /redfish/v1/Managers/bmc LastResetTime 2134ddcb4d4SBrian Ma Should Not Be Equal ${last_reset_time} ${reset_time} 2144ddcb4d4SBrian Ma 2154ddcb4d4SBrian Ma 2164ddcb4d4SBrian MaRedfish BMC Reboot 2174ddcb4d4SBrian Ma [Documentation] Use Redfish API reboot BMC and wait for BMC ready 2184ddcb4d4SBrian Ma 2194ddcb4d4SBrian Ma # Get BMC last reset time for compare 2204ddcb4d4SBrian Ma ${last_reset_time}= Redfish.Get Attribute /redfish/v1/Managers/bmc LastResetTime 2214ddcb4d4SBrian Ma 2224ddcb4d4SBrian Ma # Reboot BMC by Redfish API 2234ddcb4d4SBrian Ma Redfish BMC Reset Operation 2244ddcb4d4SBrian Ma 2254ddcb4d4SBrian Ma # Wait for BMC real reboot and Redfish API ready 2264ddcb4d4SBrian Ma Wait Until Keyword Succeeds 3 min 10 sec Is BMC LastResetTime Changed ${last_reset_time} 2274ddcb4d4SBrian Ma 228