blob: bc4b267c6167bc4844ab450c154a649ff1dd6cb2 [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
12
Prashanth Katti70620172021-07-28 07:17:39 -050013*** Variables ***
14
Megha G Ne2b32b62022-12-23 03:43:08 -060015${cmd_prefix} ipmitool -I lanplus -C 17 -p 623 -U ${IPMI_USERNAME} -P ${IPMI_PASSWORD}
16${SETTING_WAIT_TIMEOUT} 30s
Prashanth Katti70620172021-07-28 07:17:39 -050017
18
Prashanth Kattiabbce3d2021-06-29 04:56:37 -050019*** Test Cases ***
20
Prashanth Katti2e413452021-07-13 02:26:45 -050021Verify SSH Is Enabled By Default
22 [Documentation] Verify SSH is enabled by default.
23 [Tags] Verify_SSH_Is_Enabled_By_Default
24
25 # Check if SSH is enabled by default.
26 Verify SSH Protocol State ${True}
27
28
Prashanth Kattiabbce3d2021-06-29 04:56:37 -050029Enable SSH Protocol And Verify
30 [Documentation] Enable SSH protocol and verify.
31 [Tags] Enable_SSH_Protocol_And_Verify
32
33 Enable SSH Protocol ${True}
34
35 # Check if SSH is really enabled via Redfish.
36 Verify SSH Protocol State ${True}
37
38 # Check if SSH login and commands on SSH session work.
39 Verify SSH Login And Commands Work
40
41
42Disable SSH Protocol And Verify
43 [Documentation] Disable SSH protocol and verify.
George Keishing53a5c892022-07-19 22:40:52 -050044 [Tags] Disable_SSH_Protocol_And_Verify
Prashanth Kattiabbce3d2021-06-29 04:56:37 -050045 [Teardown] Enable SSH Protocol ${True}
46
47 # Disable SSH interface.
48 Enable SSH Protocol ${False}
49
50 # Check if SSH is really disabled via Redfish.
51 Verify SSH Protocol State ${False}
52
53 # Check if SSH login and commands fail.
54 ${status}= Run Keyword And Return Status
55 ... Verify SSH Login And Commands Work
56
57 Should Be Equal As Strings ${status} False
58 ... msg=SSH Login and commands are working after disabling SSH.
59
60
61Enable SSH Protocol And Check Persistency On BMC Reboot
62 [Documentation] Enable SSH protocol and verify persistency.
George Keishing53a5c892022-07-19 22:40:52 -050063 [Tags] Enable_SSH_Protocol_And_Check_Persistency_On_BMC_Reboot
Prashanth Kattiabbce3d2021-06-29 04:56:37 -050064
65 Enable SSH Protocol ${True}
66
67 # Reboot BMC and verify persistency.
Megha GNa4c40402022-07-21 03:15:57 -050068 Redfish OBMC Reboot (off) stack_mode=skip
Prashanth Kattiabbce3d2021-06-29 04:56:37 -050069
70 # Check if SSH is really enabled via Redfish.
71 Verify SSH Protocol State ${True}
72
73 # Check if SSH login and commands on SSH session work.
74 Verify SSH Login And Commands Work
75
76
77Disable SSH Protocol And Check Persistency On BMC Reboot
78 [Documentation] Disable SSH protocol and verify persistency.
George Keishing53a5c892022-07-19 22:40:52 -050079 [Tags] Disable_SSH_Protocol_And_Check_Persistency_On_BMC_Reboot
Prashanth Kattiabbce3d2021-06-29 04:56:37 -050080 [Teardown] Enable SSH Protocol ${True}
81
82 # Disable SSH interface.
83 Enable SSH Protocol ${False}
84
85 # Reboot BMC and verify persistency.
Megha GNa4c40402022-07-21 03:15:57 -050086 Redfish OBMC Reboot (off) stack_mode=skip
Prashanth Kattiabbce3d2021-06-29 04:56:37 -050087
88 # Check if SSH is really disabled via Redfish.
89 Verify SSH Protocol State ${False}
90
91 # Check if SSH login and commands fail.
92 ${status}= Run Keyword And Return Status
93 ... Verify SSH Login And Commands Work
94
95 Should Be Equal As Strings ${status} False
96 ... msg=SSH Login and commands are working after disabling SSH.
97
98
Prashanth Katti2e413452021-07-13 02:26:45 -050099Verify Disabling SSH Port Does Not Disable Serial Console Port
100 [Documentation] Verify disabling SSH does not disable serial console port.
101 [Tags] Verify_Disabling_SSH_Port_Does_Not_Disable_Serial_Console_Port
102 [Teardown] Enable SSH Protocol ${True}
103
104 # Disable SSH interface.
105 Enable SSH Protocol ${False}
106
107 # Check able to establish connection with serial port console.
108 Open Connection And Log In host=${OPENBMC_HOST} port=2200
109 Close All Connections
110
111
112Verify Existing SSH Session Gets Closed On Disabling SSH
113 [Documentation] Verify existing SSH session gets closed on disabling ssh.
114 [Tags] Verify_Existing_SSH_Session_Gets_Closed_On_Disabling_SSH
115 [Teardown] Enable SSH Protocol ${True}
116
117 # Open SSH connection.
118 Open Connection And Login
119
120 # Disable SSH interface.
121 Enable SSH Protocol ${False}
122
123 # Check if SSH is really disabled via Redfish.
124 Verify SSH Protocol State ${False}
125
126 # Try to execute CLI command on SSH connection.
127 # It should fail as disable SSH will close pre existing sessions.
128 ${status}= Run Keyword And Return Status
129 ... BMC Execute Command /sbin/ip addr
130
131 Should Be Equal As Strings ${status} False
132 ... msg=Disabling SSH has not closed existing SSH sessions.
133
134
Prashanth Katti70620172021-07-28 07:17:39 -0500135Enable IPMI Protocol And Verify
136 [Documentation] Enable IPMI protocol and verify.
137 [Tags] Enable_IPMI_Protocol_And_Verify
Prashanth Katti70620172021-07-28 07:17:39 -0500138
139 Enable IPMI Protocol ${True}
140
141 # Check if IPMI is really enabled via Redfish.
142 Verify IPMI Protocol State ${True}
143
144 # Check if IPMI commands starts working.
145 Verify IPMI Works lan print
146
147
148Disable IPMI Protocol And Verify
149 [Documentation] Disable IPMI protocol and verify.
150 [Tags] Disable_IPMI_Protocol_And_Verify
151
152 # Disable IPMI interface.
153 Enable IPMI Protocol ${False}
154
155 # Check if IPMI is really disabled via Redfish.
156 Verify IPMI Protocol State ${False}
157
158 # Check if IPMI commands fail.
159 ${status}= Run Keyword And Return Status
160 ... Verify IPMI Works lan print
161
162 Should Be Equal As Strings ${status} False
163 ... msg=IPMI commands are working after disabling IPMI.
164
165
meghagnef433de2022-02-08 00:57:52 -0600166Enable IPMI Protocol And Check Persistency On BMC Reboot
George Keishing33be3592022-03-08 08:52:25 -0600167 [Documentation] Set the IPMI protocol attribute to True, reset BMC, and verify
168 ... that the setting persists.
meghagnef433de2022-02-08 00:57:52 -0600169 [Tags] Enable_IPMI_Protocol_And_Check_Persistency_On_BMC_Reboot
170
171 Enable IPMI Protocol ${True}
172
173 Redfish OBMC Reboot (off) stack_mode=skip
174
175 # Check if the IPMI enabled is set.
176 Verify IPMI Protocol State ${True}
177
178 # Confirm that IPMI commands to access BMC work.
179 Verify IPMI Works lan print
180
181
182Disable IPMI Protocol And Check Persistency On BMC Reboot
George Keishing33be3592022-03-08 08:52:25 -0600183 [Documentation] Set the IPMI protocol attribute to False, reset BMC, and verify
184 ... that the setting persists.
meghagnef433de2022-02-08 00:57:52 -0600185 [Tags] Disable_IPMI_Protocol_And_Check_Persistency_On_BMC_Reboot
186
187 # Disable IPMI interface.
188 Enable IPMI Protocol ${False}
189
190 Redfish OBMC Reboot (off) stack_mode=skip
191
192 # Check if the IPMI disabled is set.
193 Verify IPMI Protocol State ${False}
194
195 # Confirm that IPMI connection request fails.
196 ${status}= Run Keyword And Return Status
197 ... Verify IPMI Works lan print
198
199 Should Be Equal As Strings ${status} False
200 ... msg=IPMI commands are working after disabling IPMI.
201
202
Megha GNe21e1a32022-08-09 00:26:13 -0500203Configure SSH And IPMI Settings And Verify
204 [Documentation] Set the SSH and IPMI protocol attribute to True/False, and verify.
205 [Tags] Configure_SSH_And_IPMI_Settings_And_Verify
206 [Template] Set SSH And IPMI Protocol
Megha G Nab2553e2022-11-29 01:01:22 -0600207 [Teardown] Run Keywords FFDC On Test Case Fail
208 ... AND Enable SSH Protocol ${True}
meghagn6f1d9d82021-11-11 21:56:21 -0600209
Megha GNe21e1a32022-08-09 00:26:13 -0500210 # ssh_state ipmi_state
211 ${True} ${False}
212 ${True} ${True}
213 ${False} ${True}
214 ${False} ${False}
meghagn6f1d9d82021-11-11 21:56:21 -0600215
216
Megha G Nab2553e2022-11-29 01:01:22 -0600217Configure SSH And IPMI Settings And Verify Persistency On BMC Reboot
218 [Documentation] Set the SSH and IPMI protocol attribute to True/False, and verify
219 ... it's persistency after BMC reboot.
220 [Tags] Configure_SSH_And_IPMI_Settings_And_Verify_Persistency_On_BMC_Reboot
221 [Template] Set SSH And IPMI Protocol
222 [Teardown] Run Keywords FFDC On Test Case Fail
223 ... AND Enable SSH Protocol ${True}
Megha G N7735cbb2022-11-15 23:22:10 -0600224
Megha G Nab2553e2022-11-29 01:01:22 -0600225 # ssh_state ipmi_state persistency_check
226 ${True} ${False} ${True}
227 ${True} ${True} ${True}
228 ${False} ${True} ${True}
229 ${False} ${False} ${True}
Megha G N7735cbb2022-11-15 23:22:10 -0600230
231
Prashanth Kattiabbce3d2021-06-29 04:56:37 -0500232*** Keywords ***
233
Brian Ma274b7242021-12-09 09:00:45 +0800234Suite Setup Execution
235 [Documentation] Do suite setup tasks.
236
237 Redfish.Login
238
239 ${state}= Run Keyword And Return Status Verify IPMI Protocol State
240 Set Suite Variable ${initial_ipmi_state} ${state}
Megha GNe21e1a32022-08-09 00:26:13 -0500241 Sleep ${NETWORK_TIMEOUT}s
Brian Ma274b7242021-12-09 09:00:45 +0800242
meghagn6f1d9d82021-11-11 21:56:21 -0600243
244Set SSH And IPMI Protocol
245 [Documentation] Set SSH and IPMI protocol state.
Megha G N7735cbb2022-11-15 23:22:10 -0600246 [Arguments] ${ssh_state} ${ipmi_state} ${persistency_check}=${False}
meghagn6f1d9d82021-11-11 21:56:21 -0600247
248 # Description of argument(s):
Megha GNe21e1a32022-08-09 00:26:13 -0500249 # ssh_state State of SSH to be set (e.g. True, False).
250 # ipmi_state State of IPMI to be set (e.g. True, False).
meghagn6f1d9d82021-11-11 21:56:21 -0600251
252 ${ssh_protocol_state}= Create Dictionary ProtocolEnabled=${ssh_state}
253 ${ipmi_protocol_state}= Create Dictionary ProtocolEnabled=${ipmi_state}
254 ${data}= Create Dictionary SSH=${ssh_protocol_state} IPMI=${ipmi_protocol_state}
255
256 Redfish.Patch ${REDFISH_NW_PROTOCOL_URI} body=&{data}
257 ... valid_status_codes=[${HTTP_NO_CONTENT}]
258
259 # Wait for timeout for new values to take effect.
Megha G Ne2b32b62022-12-23 03:43:08 -0600260 Sleep ${SETTING_WAIT_TIMEOUT}
Megha GNe21e1a32022-08-09 00:26:13 -0500261
Megha G Nab2553e2022-11-29 01:01:22 -0600262 Run Keyword if ${persistency_check} == ${True}
263 ... Redfish OBMC Reboot (off) stack_mode=skip
Megha GNe21e1a32022-08-09 00:26:13 -0500264 Verify Protocol State ${ssh_state} ${ipmi_state}
265
266
267Verify Protocol State
268 [Documentation] Verify SSH and IPMI protocol state.
269 [Arguments] ${ssh_state} ${ipmi_state}
270
271 # Description of argument(s):
272 # ssh_state State of SSH to be verified (e.g. True, False).
273 # ipmi_state State of IPMI to be verified (e.g. True, False).
274
275 # Verify SSH state value.
276 ${status}= Run Keyword And Return Status
277 ... Verify SSH Login And Commands Work
278 Should Be Equal As Strings ${status} ${ssh_state}
279 ... msg=SSH states are not matching.
280
281 # Verify IPMI state value.
282 ${status}= Run Keyword And Return Status
283 ... Verify IPMI Works lan print
284
285 Should Be Equal As Strings ${status} ${ipmi_state}
286 ... msg=IPMI states are not matching.