blob: f87c7f16ce26e4bca17a69e4edd3c37af98410c3 [file] [log] [blame]
Prashanth Kattiabbce3d2021-06-29 04:56:37 -05001*** Settings ***
2Documentation Test BMC manager protocol enable/disable functionality.
3
Prashanth Kattiabbce3d2021-06-29 04:56:37 -05004Resource ../../lib/bmc_redfish_resource.robot
5Resource ../../lib/openbmc_ffdc.robot
Prashanth Kattif59a73e2021-09-22 03:03:58 -05006Resource ../../lib/protocol_setting_utils.robot
Prashanth Kattiabbce3d2021-06-29 04:56:37 -05007
Brian Ma274b7242021-12-09 09:00:45 +08008Suite Setup Suite Setup Execution
9Suite Teardown Run Keywords Enable IPMI Protocol ${initial_ipmi_state} AND Redfish.Logout
Prashanth Katti2e413452021-07-13 02:26:45 -050010Test Teardown FFDC On Test Case Fail
Prashanth Kattiabbce3d2021-06-29 04:56:37 -050011
George Keishing6217ea32023-10-16 09:58:41 +053012Force Tags BMC_Protocol_Settings
Prashanth Kattiabbce3d2021-06-29 04:56:37 -050013
Prashanth Katti70620172021-07-28 07:17:39 -050014*** Variables ***
15
Megha G Ne2b32b62022-12-23 03:43:08 -060016${cmd_prefix} ipmitool -I lanplus -C 17 -p 623 -U ${IPMI_USERNAME} -P ${IPMI_PASSWORD}
17${SETTING_WAIT_TIMEOUT} 30s
Prashanth Katti70620172021-07-28 07:17:39 -050018
19
Prashanth Kattiabbce3d2021-06-29 04:56:37 -050020*** Test Cases ***
21
Prashanth Katti2e413452021-07-13 02:26:45 -050022Verify 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 Kattiabbce3d2021-06-29 04:56:37 -050030Enable 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
43Disable SSH Protocol And Verify
44 [Documentation] Disable SSH protocol and verify.
George Keishing53a5c892022-07-19 22:40:52 -050045 [Tags] Disable_SSH_Protocol_And_Verify
Prashanth Kattiabbce3d2021-06-29 04:56:37 -050046 [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
62Enable SSH Protocol And Check Persistency On BMC Reboot
63 [Documentation] Enable SSH protocol and verify persistency.
George Keishing53a5c892022-07-19 22:40:52 -050064 [Tags] Enable_SSH_Protocol_And_Check_Persistency_On_BMC_Reboot
Prashanth Kattiabbce3d2021-06-29 04:56:37 -050065
66 Enable SSH Protocol ${True}
67
68 # Reboot BMC and verify persistency.
Megha GNa4c40402022-07-21 03:15:57 -050069 Redfish OBMC Reboot (off) stack_mode=skip
Prashanth Kattiabbce3d2021-06-29 04:56:37 -050070
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
78Disable SSH Protocol And Check Persistency On BMC Reboot
79 [Documentation] Disable SSH protocol and verify persistency.
George Keishing53a5c892022-07-19 22:40:52 -050080 [Tags] Disable_SSH_Protocol_And_Check_Persistency_On_BMC_Reboot
Prashanth Kattiabbce3d2021-06-29 04:56:37 -050081 [Teardown] Enable SSH Protocol ${True}
82
83 # Disable SSH interface.
84 Enable SSH Protocol ${False}
85
86 # Reboot BMC and verify persistency.
Megha GNa4c40402022-07-21 03:15:57 -050087 Redfish OBMC Reboot (off) stack_mode=skip
Prashanth Kattiabbce3d2021-06-29 04:56:37 -050088
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 Katti2e413452021-07-13 02:26:45 -0500100Verify 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
113Verify 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 Katti70620172021-07-28 07:17:39 -0500136Enable IPMI Protocol And Verify
137 [Documentation] Enable IPMI protocol and verify.
138 [Tags] Enable_IPMI_Protocol_And_Verify
Prashanth Katti70620172021-07-28 07:17:39 -0500139
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
149Disable 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
meghagnef433de2022-02-08 00:57:52 -0600167Enable IPMI Protocol And Check Persistency On BMC Reboot
George Keishing33be3592022-03-08 08:52:25 -0600168 [Documentation] Set the IPMI protocol attribute to True, reset BMC, and verify
169 ... that the setting persists.
meghagnef433de2022-02-08 00:57:52 -0600170 [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
183Disable IPMI Protocol And Check Persistency On BMC Reboot
George Keishing33be3592022-03-08 08:52:25 -0600184 [Documentation] Set the IPMI protocol attribute to False, reset BMC, and verify
185 ... that the setting persists.
meghagnef433de2022-02-08 00:57:52 -0600186 [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 GNe21e1a32022-08-09 00:26:13 -0500204Configure 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 Nab2553e2022-11-29 01:01:22 -0600208 [Teardown] Run Keywords FFDC On Test Case Fail
209 ... AND Enable SSH Protocol ${True}
meghagn6f1d9d82021-11-11 21:56:21 -0600210
Megha GNe21e1a32022-08-09 00:26:13 -0500211 # ssh_state ipmi_state
212 ${True} ${False}
213 ${True} ${True}
214 ${False} ${True}
215 ${False} ${False}
meghagn6f1d9d82021-11-11 21:56:21 -0600216
217
Megha G Nab2553e2022-11-29 01:01:22 -0600218Configure 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 N7735cbb2022-11-15 23:22:10 -0600225
Megha G Nab2553e2022-11-29 01:01:22 -0600226 # ssh_state ipmi_state persistency_check
227 ${True} ${False} ${True}
228 ${True} ${True} ${True}
229 ${False} ${True} ${True}
230 ${False} ${False} ${True}
Megha G N7735cbb2022-11-15 23:22:10 -0600231
232
Prashanth Kattiabbce3d2021-06-29 04:56:37 -0500233*** Keywords ***
234
Brian Ma274b7242021-12-09 09:00:45 +0800235Suite 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 GNe21e1a32022-08-09 00:26:13 -0500242 Sleep ${NETWORK_TIMEOUT}s
Brian Ma274b7242021-12-09 09:00:45 +0800243
meghagn6f1d9d82021-11-11 21:56:21 -0600244
245Set SSH And IPMI Protocol
246 [Documentation] Set SSH and IPMI protocol state.
Megha G N7735cbb2022-11-15 23:22:10 -0600247 [Arguments] ${ssh_state} ${ipmi_state} ${persistency_check}=${False}
meghagn6f1d9d82021-11-11 21:56:21 -0600248
249 # Description of argument(s):
Megha GNe21e1a32022-08-09 00:26:13 -0500250 # 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).
meghagn6f1d9d82021-11-11 21:56:21 -0600252
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 Ne2b32b62022-12-23 03:43:08 -0600261 Sleep ${SETTING_WAIT_TIMEOUT}
Megha GNe21e1a32022-08-09 00:26:13 -0500262
Megha G Nab2553e2022-11-29 01:01:22 -0600263 Run Keyword if ${persistency_check} == ${True}
264 ... Redfish OBMC Reboot (off) stack_mode=skip
Megha GNe21e1a32022-08-09 00:26:13 -0500265 Verify Protocol State ${ssh_state} ${ipmi_state}
266
267
268Verify 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.