Prashanth Katti | abbce3d | 2021-06-29 04:56:37 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test BMC manager protocol enable/disable functionality. |
| 3 | |
Prashanth Katti | abbce3d | 2021-06-29 04:56:37 -0500 | [diff] [blame] | 4 | Resource ../../lib/bmc_redfish_resource.robot |
| 5 | Resource ../../lib/openbmc_ffdc.robot |
Prashanth Katti | f59a73e | 2021-09-22 03:03:58 -0500 | [diff] [blame] | 6 | Resource ../../lib/protocol_setting_utils.robot |
Prashanth Katti | abbce3d | 2021-06-29 04:56:37 -0500 | [diff] [blame] | 7 | |
Brian Ma | 274b724 | 2021-12-09 09:00:45 +0800 | [diff] [blame] | 8 | Suite Setup Suite Setup Execution |
| 9 | Suite Teardown Run Keywords Enable IPMI Protocol ${initial_ipmi_state} AND Redfish.Logout |
Prashanth Katti | 2e41345 | 2021-07-13 02:26:45 -0500 | [diff] [blame] | 10 | Test Teardown FFDC On Test Case Fail |
Prashanth Katti | abbce3d | 2021-06-29 04:56:37 -0500 | [diff] [blame] | 11 | |
George Keishing | 6217ea3 | 2023-10-16 09:58:41 +0530 | [diff] [blame] | 12 | Force Tags BMC_Protocol_Settings |
Prashanth Katti | abbce3d | 2021-06-29 04:56:37 -0500 | [diff] [blame] | 13 | |
Prashanth Katti | 7062017 | 2021-07-28 07:17:39 -0500 | [diff] [blame] | 14 | *** Variables *** |
| 15 | |
Megha G N | e2b32b6 | 2022-12-23 03:43:08 -0600 | [diff] [blame] | 16 | ${cmd_prefix} ipmitool -I lanplus -C 17 -p 623 -U ${IPMI_USERNAME} -P ${IPMI_PASSWORD} |
| 17 | ${SETTING_WAIT_TIMEOUT} 30s |
Prashanth Katti | 7062017 | 2021-07-28 07:17:39 -0500 | [diff] [blame] | 18 | |
| 19 | |
Prashanth Katti | abbce3d | 2021-06-29 04:56:37 -0500 | [diff] [blame] | 20 | *** Test Cases *** |
| 21 | |
Prashanth Katti | 2e41345 | 2021-07-13 02:26:45 -0500 | [diff] [blame] | 22 | Verify SSH Is Enabled By Default |
| 23 | [Documentation] Verify SSH is enabled by default. |
| 24 | [Tags] Verify_SSH_Is_Enabled_By_Default |
| 25 | |
| 26 | # Check if SSH is enabled by default. |
| 27 | Verify SSH Protocol State ${True} |
| 28 | |
| 29 | |
Prashanth Katti | abbce3d | 2021-06-29 04:56:37 -0500 | [diff] [blame] | 30 | Enable SSH Protocol And Verify |
| 31 | [Documentation] Enable SSH protocol and verify. |
| 32 | [Tags] Enable_SSH_Protocol_And_Verify |
| 33 | |
| 34 | Enable SSH Protocol ${True} |
| 35 | |
| 36 | # Check if SSH is really enabled via Redfish. |
| 37 | Verify SSH Protocol State ${True} |
| 38 | |
| 39 | # Check if SSH login and commands on SSH session work. |
| 40 | Verify SSH Login And Commands Work |
| 41 | |
| 42 | |
| 43 | Disable SSH Protocol And Verify |
| 44 | [Documentation] Disable SSH protocol and verify. |
George Keishing | 53a5c89 | 2022-07-19 22:40:52 -0500 | [diff] [blame] | 45 | [Tags] Disable_SSH_Protocol_And_Verify |
Prashanth Katti | abbce3d | 2021-06-29 04:56:37 -0500 | [diff] [blame] | 46 | [Teardown] Enable SSH Protocol ${True} |
| 47 | |
| 48 | # Disable SSH interface. |
| 49 | Enable SSH Protocol ${False} |
| 50 | |
| 51 | # Check if SSH is really disabled via Redfish. |
| 52 | Verify SSH Protocol State ${False} |
| 53 | |
| 54 | # Check if SSH login and commands fail. |
| 55 | ${status}= Run Keyword And Return Status |
| 56 | ... Verify SSH Login And Commands Work |
| 57 | |
| 58 | Should Be Equal As Strings ${status} False |
| 59 | ... msg=SSH Login and commands are working after disabling SSH. |
| 60 | |
| 61 | |
| 62 | Enable SSH Protocol And Check Persistency On BMC Reboot |
| 63 | [Documentation] Enable SSH protocol and verify persistency. |
George Keishing | 53a5c89 | 2022-07-19 22:40:52 -0500 | [diff] [blame] | 64 | [Tags] Enable_SSH_Protocol_And_Check_Persistency_On_BMC_Reboot |
Prashanth Katti | abbce3d | 2021-06-29 04:56:37 -0500 | [diff] [blame] | 65 | |
| 66 | Enable SSH Protocol ${True} |
| 67 | |
| 68 | # Reboot BMC and verify persistency. |
Megha GN | a4c4040 | 2022-07-21 03:15:57 -0500 | [diff] [blame] | 69 | Redfish OBMC Reboot (off) stack_mode=skip |
Prashanth Katti | abbce3d | 2021-06-29 04:56:37 -0500 | [diff] [blame] | 70 | |
| 71 | # Check if SSH is really enabled via Redfish. |
| 72 | Verify SSH Protocol State ${True} |
| 73 | |
| 74 | # Check if SSH login and commands on SSH session work. |
| 75 | Verify SSH Login And Commands Work |
| 76 | |
| 77 | |
| 78 | Disable SSH Protocol And Check Persistency On BMC Reboot |
| 79 | [Documentation] Disable SSH protocol and verify persistency. |
George Keishing | 53a5c89 | 2022-07-19 22:40:52 -0500 | [diff] [blame] | 80 | [Tags] Disable_SSH_Protocol_And_Check_Persistency_On_BMC_Reboot |
Prashanth Katti | abbce3d | 2021-06-29 04:56:37 -0500 | [diff] [blame] | 81 | [Teardown] Enable SSH Protocol ${True} |
| 82 | |
| 83 | # Disable SSH interface. |
| 84 | Enable SSH Protocol ${False} |
| 85 | |
| 86 | # Reboot BMC and verify persistency. |
Megha GN | a4c4040 | 2022-07-21 03:15:57 -0500 | [diff] [blame] | 87 | Redfish OBMC Reboot (off) stack_mode=skip |
Prashanth Katti | abbce3d | 2021-06-29 04:56:37 -0500 | [diff] [blame] | 88 | |
| 89 | # Check if SSH is really disabled via Redfish. |
| 90 | Verify SSH Protocol State ${False} |
| 91 | |
| 92 | # Check if SSH login and commands fail. |
| 93 | ${status}= Run Keyword And Return Status |
| 94 | ... Verify SSH Login And Commands Work |
| 95 | |
| 96 | Should Be Equal As Strings ${status} False |
| 97 | ... msg=SSH Login and commands are working after disabling SSH. |
| 98 | |
| 99 | |
Prashanth Katti | 2e41345 | 2021-07-13 02:26:45 -0500 | [diff] [blame] | 100 | Verify Disabling SSH Port Does Not Disable Serial Console Port |
| 101 | [Documentation] Verify disabling SSH does not disable serial console port. |
| 102 | [Tags] Verify_Disabling_SSH_Port_Does_Not_Disable_Serial_Console_Port |
| 103 | [Teardown] Enable SSH Protocol ${True} |
| 104 | |
| 105 | # Disable SSH interface. |
| 106 | Enable SSH Protocol ${False} |
| 107 | |
| 108 | # Check able to establish connection with serial port console. |
| 109 | Open Connection And Log In host=${OPENBMC_HOST} port=2200 |
| 110 | Close All Connections |
| 111 | |
| 112 | |
| 113 | Verify Existing SSH Session Gets Closed On Disabling SSH |
| 114 | [Documentation] Verify existing SSH session gets closed on disabling ssh. |
| 115 | [Tags] Verify_Existing_SSH_Session_Gets_Closed_On_Disabling_SSH |
| 116 | [Teardown] Enable SSH Protocol ${True} |
| 117 | |
| 118 | # Open SSH connection. |
| 119 | Open Connection And Login |
| 120 | |
| 121 | # Disable SSH interface. |
| 122 | Enable SSH Protocol ${False} |
| 123 | |
| 124 | # Check if SSH is really disabled via Redfish. |
| 125 | Verify SSH Protocol State ${False} |
| 126 | |
| 127 | # Try to execute CLI command on SSH connection. |
| 128 | # It should fail as disable SSH will close pre existing sessions. |
| 129 | ${status}= Run Keyword And Return Status |
| 130 | ... BMC Execute Command /sbin/ip addr |
| 131 | |
| 132 | Should Be Equal As Strings ${status} False |
| 133 | ... msg=Disabling SSH has not closed existing SSH sessions. |
| 134 | |
| 135 | |
Prashanth Katti | 7062017 | 2021-07-28 07:17:39 -0500 | [diff] [blame] | 136 | Enable IPMI Protocol And Verify |
| 137 | [Documentation] Enable IPMI protocol and verify. |
| 138 | [Tags] Enable_IPMI_Protocol_And_Verify |
Prashanth Katti | 7062017 | 2021-07-28 07:17:39 -0500 | [diff] [blame] | 139 | |
| 140 | Enable IPMI Protocol ${True} |
| 141 | |
| 142 | # Check if IPMI is really enabled via Redfish. |
| 143 | Verify IPMI Protocol State ${True} |
| 144 | |
| 145 | # Check if IPMI commands starts working. |
| 146 | Verify IPMI Works lan print |
| 147 | |
| 148 | |
| 149 | Disable IPMI Protocol And Verify |
| 150 | [Documentation] Disable IPMI protocol and verify. |
| 151 | [Tags] Disable_IPMI_Protocol_And_Verify |
| 152 | |
| 153 | # Disable IPMI interface. |
| 154 | Enable IPMI Protocol ${False} |
| 155 | |
| 156 | # Check if IPMI is really disabled via Redfish. |
| 157 | Verify IPMI Protocol State ${False} |
| 158 | |
| 159 | # Check if IPMI commands fail. |
| 160 | ${status}= Run Keyword And Return Status |
| 161 | ... Verify IPMI Works lan print |
| 162 | |
| 163 | Should Be Equal As Strings ${status} False |
| 164 | ... msg=IPMI commands are working after disabling IPMI. |
| 165 | |
| 166 | |
meghagn | ef433de | 2022-02-08 00:57:52 -0600 | [diff] [blame] | 167 | Enable IPMI Protocol And Check Persistency On BMC Reboot |
George Keishing | 33be359 | 2022-03-08 08:52:25 -0600 | [diff] [blame] | 168 | [Documentation] Set the IPMI protocol attribute to True, reset BMC, and verify |
| 169 | ... that the setting persists. |
meghagn | ef433de | 2022-02-08 00:57:52 -0600 | [diff] [blame] | 170 | [Tags] Enable_IPMI_Protocol_And_Check_Persistency_On_BMC_Reboot |
| 171 | |
| 172 | Enable IPMI Protocol ${True} |
| 173 | |
| 174 | Redfish OBMC Reboot (off) stack_mode=skip |
| 175 | |
| 176 | # Check if the IPMI enabled is set. |
| 177 | Verify IPMI Protocol State ${True} |
| 178 | |
| 179 | # Confirm that IPMI commands to access BMC work. |
| 180 | Verify IPMI Works lan print |
| 181 | |
| 182 | |
| 183 | Disable IPMI Protocol And Check Persistency On BMC Reboot |
George Keishing | 33be359 | 2022-03-08 08:52:25 -0600 | [diff] [blame] | 184 | [Documentation] Set the IPMI protocol attribute to False, reset BMC, and verify |
| 185 | ... that the setting persists. |
meghagn | ef433de | 2022-02-08 00:57:52 -0600 | [diff] [blame] | 186 | [Tags] Disable_IPMI_Protocol_And_Check_Persistency_On_BMC_Reboot |
| 187 | |
| 188 | # Disable IPMI interface. |
| 189 | Enable IPMI Protocol ${False} |
| 190 | |
| 191 | Redfish OBMC Reboot (off) stack_mode=skip |
| 192 | |
| 193 | # Check if the IPMI disabled is set. |
| 194 | Verify IPMI Protocol State ${False} |
| 195 | |
| 196 | # Confirm that IPMI connection request fails. |
| 197 | ${status}= Run Keyword And Return Status |
| 198 | ... Verify IPMI Works lan print |
| 199 | |
| 200 | Should Be Equal As Strings ${status} False |
| 201 | ... msg=IPMI commands are working after disabling IPMI. |
| 202 | |
| 203 | |
Megha GN | e21e1a3 | 2022-08-09 00:26:13 -0500 | [diff] [blame] | 204 | Configure SSH And IPMI Settings And Verify |
| 205 | [Documentation] Set the SSH and IPMI protocol attribute to True/False, and verify. |
| 206 | [Tags] Configure_SSH_And_IPMI_Settings_And_Verify |
| 207 | [Template] Set SSH And IPMI Protocol |
Megha G N | ab2553e | 2022-11-29 01:01:22 -0600 | [diff] [blame] | 208 | [Teardown] Run Keywords FFDC On Test Case Fail |
| 209 | ... AND Enable SSH Protocol ${True} |
meghagn | 6f1d9d8 | 2021-11-11 21:56:21 -0600 | [diff] [blame] | 210 | |
Megha GN | e21e1a3 | 2022-08-09 00:26:13 -0500 | [diff] [blame] | 211 | # ssh_state ipmi_state |
| 212 | ${True} ${False} |
| 213 | ${True} ${True} |
| 214 | ${False} ${True} |
| 215 | ${False} ${False} |
meghagn | 6f1d9d8 | 2021-11-11 21:56:21 -0600 | [diff] [blame] | 216 | |
| 217 | |
Megha G N | ab2553e | 2022-11-29 01:01:22 -0600 | [diff] [blame] | 218 | Configure SSH And IPMI Settings And Verify Persistency On BMC Reboot |
| 219 | [Documentation] Set the SSH and IPMI protocol attribute to True/False, and verify |
| 220 | ... it's persistency after BMC reboot. |
| 221 | [Tags] Configure_SSH_And_IPMI_Settings_And_Verify_Persistency_On_BMC_Reboot |
| 222 | [Template] Set SSH And IPMI Protocol |
| 223 | [Teardown] Run Keywords FFDC On Test Case Fail |
| 224 | ... AND Enable SSH Protocol ${True} |
Megha G N | 7735cbb | 2022-11-15 23:22:10 -0600 | [diff] [blame] | 225 | |
Megha G N | ab2553e | 2022-11-29 01:01:22 -0600 | [diff] [blame] | 226 | # ssh_state ipmi_state persistency_check |
| 227 | ${True} ${False} ${True} |
| 228 | ${True} ${True} ${True} |
| 229 | ${False} ${True} ${True} |
| 230 | ${False} ${False} ${True} |
Megha G N | 7735cbb | 2022-11-15 23:22:10 -0600 | [diff] [blame] | 231 | |
| 232 | |
Prashanth Katti | abbce3d | 2021-06-29 04:56:37 -0500 | [diff] [blame] | 233 | *** Keywords *** |
| 234 | |
Brian Ma | 274b724 | 2021-12-09 09:00:45 +0800 | [diff] [blame] | 235 | Suite Setup Execution |
| 236 | [Documentation] Do suite setup tasks. |
| 237 | |
| 238 | Redfish.Login |
| 239 | |
| 240 | ${state}= Run Keyword And Return Status Verify IPMI Protocol State |
| 241 | Set Suite Variable ${initial_ipmi_state} ${state} |
Megha GN | e21e1a3 | 2022-08-09 00:26:13 -0500 | [diff] [blame] | 242 | Sleep ${NETWORK_TIMEOUT}s |
Brian Ma | 274b724 | 2021-12-09 09:00:45 +0800 | [diff] [blame] | 243 | |
meghagn | 6f1d9d8 | 2021-11-11 21:56:21 -0600 | [diff] [blame] | 244 | |
| 245 | Set SSH And IPMI Protocol |
| 246 | [Documentation] Set SSH and IPMI protocol state. |
Megha G N | 7735cbb | 2022-11-15 23:22:10 -0600 | [diff] [blame] | 247 | [Arguments] ${ssh_state} ${ipmi_state} ${persistency_check}=${False} |
meghagn | 6f1d9d8 | 2021-11-11 21:56:21 -0600 | [diff] [blame] | 248 | |
| 249 | # Description of argument(s): |
Megha GN | e21e1a3 | 2022-08-09 00:26:13 -0500 | [diff] [blame] | 250 | # ssh_state State of SSH to be set (e.g. True, False). |
| 251 | # ipmi_state State of IPMI to be set (e.g. True, False). |
meghagn | 6f1d9d8 | 2021-11-11 21:56:21 -0600 | [diff] [blame] | 252 | |
| 253 | ${ssh_protocol_state}= Create Dictionary ProtocolEnabled=${ssh_state} |
| 254 | ${ipmi_protocol_state}= Create Dictionary ProtocolEnabled=${ipmi_state} |
| 255 | ${data}= Create Dictionary SSH=${ssh_protocol_state} IPMI=${ipmi_protocol_state} |
| 256 | |
| 257 | Redfish.Patch ${REDFISH_NW_PROTOCOL_URI} body=&{data} |
| 258 | ... valid_status_codes=[${HTTP_NO_CONTENT}] |
| 259 | |
| 260 | # Wait for timeout for new values to take effect. |
Megha G N | e2b32b6 | 2022-12-23 03:43:08 -0600 | [diff] [blame] | 261 | Sleep ${SETTING_WAIT_TIMEOUT} |
Megha GN | e21e1a3 | 2022-08-09 00:26:13 -0500 | [diff] [blame] | 262 | |
Megha G N | ab2553e | 2022-11-29 01:01:22 -0600 | [diff] [blame] | 263 | Run Keyword if ${persistency_check} == ${True} |
| 264 | ... Redfish OBMC Reboot (off) stack_mode=skip |
Megha GN | e21e1a3 | 2022-08-09 00:26:13 -0500 | [diff] [blame] | 265 | Verify Protocol State ${ssh_state} ${ipmi_state} |
| 266 | |
| 267 | |
| 268 | Verify Protocol State |
| 269 | [Documentation] Verify SSH and IPMI protocol state. |
| 270 | [Arguments] ${ssh_state} ${ipmi_state} |
| 271 | |
| 272 | # Description of argument(s): |
| 273 | # ssh_state State of SSH to be verified (e.g. True, False). |
| 274 | # ipmi_state State of IPMI to be verified (e.g. True, False). |
| 275 | |
| 276 | # Verify SSH state value. |
| 277 | ${status}= Run Keyword And Return Status |
| 278 | ... Verify SSH Login And Commands Work |
| 279 | Should Be Equal As Strings ${status} ${ssh_state} |
| 280 | ... msg=SSH states are not matching. |
| 281 | |
| 282 | # Verify IPMI state value. |
| 283 | ${status}= Run Keyword And Return Status |
| 284 | ... Verify IPMI Works lan print |
| 285 | |
| 286 | Should Be Equal As Strings ${status} ${ipmi_state} |
| 287 | ... msg=IPMI states are not matching. |