blob: 109a70f2747e61806fee46a5b3b32900dba60727 [file] [log] [blame]
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -05001*** Settings ***
2
meghagn12345f942dae2021-08-27 02:53:00 -05003Documentation Test OpenBMC GUI "Policies" sub-menu of "Security and Access" menu.
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -05004
5Resource ../../lib/gui_resource.robot
meghagn56eba262021-09-16 07:05:52 -05006Resource ../lib/ipmi_client.robot
meghagn2052fdd2021-12-07 02:42:31 -06007Resource ../lib/protocol_setting_utils.robot
8Resource ../lib/common_utils.robot
Priya Sinha9f3de2b2022-08-26 01:59:46 -05009Suite Setup Run Keywords Launch Browser And Login GUI AND Redfish.Login
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050010Suite Teardown Close Browser
11Test Setup Test Setup Execution
12
George Keishing0302e9a2023-10-12 21:48:35 +053013Force Tags Policies_Sub_Menu
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050014
15*** Variables ***
rramyasr-in9e2c96f2023-01-24 07:59:34 -060016
17
rramyasr-in34960622022-08-11 11:35:04 -050018${xpath_policies_heading} //h1[text()="Policies"]
19${xpath_bmc_ssh_toggle} //*[@data-test-id='policies-toggle-bmcShell']
20... /following-sibling::label
21${xpath_network_ipmi_toggle} //*[@data-test-id='polices-toggle-networkIpmi']
22... /following-sibling::label
23${xpath_host_tpm_toggle} //input[@id='host-tpm-policy']
24${xpath_virtual_tpm_toggle} //*[@data-test-id='policies-toggle-vtpm']
25${xpath_rtad_toggle} //*[@data-test-id='policies-toggle-rtad']
26${xpath_usb_firmware_update_policy_toggle} //*[@data-test-id='policies-toggle-usbFirmwareUpdatePolicy']
27${xpath_secure_version_lockin_toggle} //*[@data-test-id='policies-toggle-svle']
28${xpath_host_usb_enablement_toggle} //*[@data-test-id='policies-toggle-hostUsb']
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050029
rramyasr-in9e2c96f2023-01-24 07:59:34 -060030
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050031*** Test Cases ***
32
Rahul Maheshwari142642d2021-08-24 00:00:15 -050033Verify Navigation To Policies Page
meghagn12345f942dae2021-08-27 02:53:00 -050034 [Documentation] Verify navigation to policies page.
Rahul Maheshwari142642d2021-08-24 00:00:15 -050035 [Tags] Verify_Navigation_To_Policies_Page
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050036
Rahul Maheshwari142642d2021-08-24 00:00:15 -050037 Page Should Contain Element ${xpath_policies_heading}
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050038
39
Rahul Maheshwari142642d2021-08-24 00:00:15 -050040Verify Existence Of All Sections In Policies Page
41 [Documentation] Verify existence of all sections in policies page.
42 [Tags] Verify_Existence_Of_All_Sections_In_Policies_Page
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050043
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050044 Page Should Contain BMC shell (via SSH)
45 Page Should Contain Network IPMI (out-of-band IPMI)
rramyasr-in03f42372022-06-16 11:51:11 -050046 Page Should Contain Host TPM
47 Page Should Contain VirtualTPM
48 Page Should Contain RTAD
49 Page Should Contain USB firmware update policy
50 Page Should Contain Secure version lock-in
51 Page Should Contain Host USB enablement
meghagn2052fdd2021-12-07 02:42:31 -060052
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050053
Rahul Maheshwari142642d2021-08-24 00:00:15 -050054Verify Existence Of All Buttons In Policies Page
55 [Documentation] Verify existence of All Buttons in policies page.
56 [Tags] Verify_Existence_Of_All_Buttons_In_Policies_Page
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050057
58 Page Should Contain Element ${xpath_bmc_ssh_toggle}
59 Page Should Contain Element ${xpath_network_ipmi_toggle}
rramyasr-in34960622022-08-11 11:35:04 -050060 Page Should Contain Element ${xpath_host_tpm_toggle}
61 Page Should Contain Element ${xpath_virtual_tpm_toggle}
62 Page Should Contain Element ${xpath_rtad_toggle}
63 Page Should Contain Element ${xpath_usb_firmware_update_policy_toggle}
64 Page Should Contain Element ${xpath_secure_version_lockin_toggle}
65 Page Should Contain Element ${xpath_host_usb_enablement_toggle}
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050066
67
meghagn12345f942dae2021-08-27 02:53:00 -050068Enable SSH Via GUI And Verify
meghagn2052fdd2021-12-07 02:42:31 -060069 [Documentation] Login to GUI Policies page,enable SSH toggle and
70 ... verify that SSH to BMC starts working after enabling SSH.
meghagn12345f942dae2021-08-27 02:53:00 -050071 [Tags] Enable_SSH_Via_GUI_And_Verify
meghagn12345f942dae2021-08-27 02:53:00 -050072
meghagn2052fdd2021-12-07 02:42:31 -060073 Set Policy Via GUI SSH Enabled
Priya Sinha9f3de2b2022-08-26 01:59:46 -050074 Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} Open Connection And Login
meghagn12345f942dae2021-08-27 02:53:00 -050075
76
meghagn07db9622021-09-13 07:22:28 -050077Disable SSH Via GUI And Verify
meghagn2052fdd2021-12-07 02:42:31 -060078 [Documentation] Login to GUI Policies page,disable SSH and
79 ... verify that SSH to BMC stops working after disabling SSH.
meghagn07db9622021-09-13 07:22:28 -050080 [Tags] Disable_SSH_Via_GUI_And_Verify
meghagn2052fdd2021-12-07 02:42:31 -060081 [Teardown] Run Keywords Enable SSH Protocol ${True} AND
Priya Sinha9f3de2b2022-08-26 01:59:46 -050082 ... Wait Until Keyword Succeeds 30 sec 15 sec Open Connection And Login
meghagn07db9622021-09-13 07:22:28 -050083
meghagn2052fdd2021-12-07 02:42:31 -060084 Set Policy Via GUI SSH Disabled
meghagn07db9622021-09-13 07:22:28 -050085
86 ${status}= Run Keyword And Return Status
87 ... Open Connection And Login
88
89 Should Be Equal As Strings ${status} False
90 ... msg=SSH login still working after disabling SSH.
91
92
meghagn56eba262021-09-16 07:05:52 -050093Disable IPMI Via GUI And Verify
meghagn2052fdd2021-12-07 02:42:31 -060094 [Documentation] Login to GUI Policies page,disable IPMI and
George Keishingde7e0452022-02-01 07:04:41 -060095 ... verify that IPMI command does not work after disabling IPMI.
meghagn56eba262021-09-16 07:05:52 -050096 [Tags] Disable_IPMI_Via_GUI_And_Verify
meghagn56eba262021-09-16 07:05:52 -050097
meghagn2052fdd2021-12-07 02:42:31 -060098 Set Policy Via GUI IPMI Disabled
meghagn56eba262021-09-16 07:05:52 -050099
100 ${status}= Run Keyword And Return Status
George Keishing0d930e92023-01-25 13:19:37 -0600101 ... Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME}
102 ... Run IPMI Standard Command sel info
meghagn56eba262021-09-16 07:05:52 -0500103
104 Should Be Equal As Strings ${status} False
105 ... msg=IPMI command is working after disabling IPMI.
106
107
meghagnb5c88b02021-09-14 00:32:27 -0500108Enable IPMI Via GUI And Verify
meghagn2052fdd2021-12-07 02:42:31 -0600109 [Documentation] Login to GUI Policies page,enable IPMI and
110 ... verify that IPMI command works after enabling IPMI.
meghagnb5c88b02021-09-14 00:32:27 -0500111 [Tags] Enable_IPMI_Via_GUI_And_Verify
meghagnb5c88b02021-09-14 00:32:27 -0500112
meghagn2052fdd2021-12-07 02:42:31 -0600113 Set Policy Via GUI IPMI Enabled
George Keishing0d930e92023-01-25 13:19:37 -0600114 Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME}
115 ... Run IPMI Standard Command sel info
meghagnb5c88b02021-09-14 00:32:27 -0500116
117
meghagn2052fdd2021-12-07 02:42:31 -0600118Enable SSH Via GUI And Verify Persistency On BMC Reboot
119 [Documentation] Login to GUI Policies page,enable SSH and
120 ... verify persistency of SSH connection on BMC reboot.
121 [Tags] Enable_SSH_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
122
123 Set Policy Via GUI SSH Enabled
124
125 Reboot BMC via GUI
126
127 Wait Until Keyword Succeeds 5 min 30 sec Open Connection And Login
128
129
130Enable IPMI Via GUI And Verify Persistency On BMC Reboot
131 [Documentation] Login to GUI Policies page,enable IPMI and
132 ... verify persistency of IPMI command work on BMC reboot.
133 [Tags] Enable_IPMI_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
134
135 Set Policy Via GUI IPMI Enabled
136
137 Reboot BMC via GUI
138
139 Wait Until Keyword Succeeds 2 min 30 sec Run IPMI Standard Command sel info
140
141
meghagn3fb3d1b2022-01-28 01:27:59 -0600142Disable SSH Via GUI And Verify Persistency On BMC Reboot
143 [Documentation] Login to GUI Policies page,disable SSH and
144 ... verify that SSH to BMC stops working after disabling SSH on BMC reboot.
145 [Tags] Disable_SSH_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
146 [Teardown] Run Keywords Wait Until Keyword Succeeds 2 min 15 sec Enable SSH Protocol ${True}
147 ... AND Wait Until Keyword Succeeds 2 min 15 sec Open Connection And Login
148
149 Set Policy Via GUI SSH Disabled
150
151 Reboot BMC via GUI
152
153 ${status}= Run Keyword And Return Status
Priya Sinha9f3de2b2022-08-26 01:59:46 -0500154 ... Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} Open Connection And Login
meghagn3fb3d1b2022-01-28 01:27:59 -0600155
156 Should Be Equal As Strings ${status} False
157 ... msg=SSH login still working after disabling SSH.
158
159
160Disable IPMI Via GUI And Verify Persistency On BMC Reboot
161 [Documentation] Login to GUI Policies page,disable IPMI and
George Keishing86d85f42022-08-18 23:02:22 -0500162 ... verify persistency of IPMI command does not work on BMC reboot.
meghagn3fb3d1b2022-01-28 01:27:59 -0600163 [Tags] Disable_IPMI_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
164 [Teardown] Run Keywords Wait Until Keyword Succeeds 2 min 15 sec Enable IPMI Protocol ${True}
165 ... AND Wait Until Keyword Succeeds 2 min 15 sec Run IPMI Standard Command sel info
166
167 Set Policy Via GUI IPMI Disabled
168
169 Reboot BMC via GUI
170
171 ${status}= Run Keyword And Return Status
George Keishing0d930e92023-01-25 13:19:37 -0600172 ... Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME}
173 ... Run IPMI Standard Command sel info
meghagn3fb3d1b2022-01-28 01:27:59 -0600174
175 Should Be Equal As Strings ${status} False
176 ... msg=IPMI command is working after disabling IPMI.
177
178
Megha G N212f0cf2022-11-22 00:55:49 -0600179Configure SSH And IPMI Settings Via GUI And Verify
180 [Documentation] Login to GUI Policies page,set SSH and IPMI toggle and
181 ... verify SSH & IPMI after the settings.
182 [Tags] Configure_SSH_And_IPMI_Settings_Via_GUI_And_Verify
183 [Setup] Fetch IPMI And SSH Settings
184 [Template] Set SSH And IPMI State Via GUI
185 [Teardown] Set SSH And IPMI State Via GUI ${initial_ssh_setting} ${initial_ipmi_setting}
186
187 # ssh_state ipmi_state
188 Enabled Enabled
189 Disabled Disabled
190 Enabled Disabled
191 Disabled Enabled
192
193
Megha G N50eaf4e2023-01-18 01:28:24 -0600194Configure SSH And IPMI Settings Via GUI And Verify Its Persistency
195 [Documentation] Login to GUI Policies page,set SSH and IPMI toggle and
196 ... verify SSH & IPMI settings after BMC reboot.
197 [Tags] Configure_SSH_And_IPMI_Settings_Via_GUI_And_Verify_Its_Persistency
198 [Setup] Fetch IPMI And SSH Settings
199 [Template] Set SSH And IPMI State Via GUI
200 [Teardown] Set SSH And IPMI State Via GUI ${initial_ssh_setting} ${initial_ipmi_setting}
201
202 # ssh_state ipmi_state persistency_check
203 Enabled Enabled True
204 Disabled Disabled True
205 Enabled Disabled True
206 Disabled Enabled True
207
208
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -0500209*** Keywords ***
210
211Test Setup Execution
212 [Documentation] Do test case setup tasks.
meghagn2052fdd2021-12-07 02:42:31 -0600213
Megha G N212f0cf2022-11-22 00:55:49 -0600214 Wait Until Keyword Succeeds 30 sec 15 sec Click Element ${xpath_secuity_and_accesss_menu}
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500215 Click Element ${xpath_policies_sub_menu}
Priya Sinha9f3de2b2022-08-26 01:59:46 -0500216 Wait Until Keyword Succeeds 30 sec 15 sec Location Should Contain policies
Megha G N42d5cc92023-02-15 03:55:40 -0600217 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=1min
meghagn12345f942dae2021-08-27 02:53:00 -0500218
meghagn2052fdd2021-12-07 02:42:31 -0600219Set Policy Via GUI
220
221 [Documentation] Login to GUI Policies page and set policy.
222 [Arguments] ${policy} ${state}
223
224 # Description of argument(s):
225 # policy policy to be set(e.g. SSH, IPMI).
226 # state state to be set(e.g. Enable, Disable).
227
228 ${opposite_state_gui} ${opposite_state_redfish}= Run Keyword If
229 ... '${state}' == 'Enabled' Set Variable Disabled ${False}
230 ... ELSE IF '${state}' == 'Disabled' Set Variable Enabled ${True}
231
232 # Setting policy to an opposite value via Redfish.
233 Run Keyword If '${policy}' == 'SSH'
234 ... Enable SSH Protocol ${opposite_state_redfish}
235 ... ELSE IF '${policy}' == 'IPMI'
236 ... Enable IPMI Protocol ${opposite_state_redfish}
237
238 ${policy_toggle_button}= Run Keyword If '${policy}' == 'SSH'
239 ... Set variable ${xpath_bmc_ssh_toggle}
240 ... ELSE IF '${policy}' == 'IPMI'
241 ... Set variable ${xpath_network_ipmi_toggle}
242
243 Wait Until Keyword Succeeds 1 min 30 sec
244 ... Refresh GUI And Verify Element Value ${policy_toggle_button} ${opposite_state_gui}
245 Click Element ${policy_toggle_button}
246
247 # Wait for GUI to reflect policy status.
248 Wait Until Keyword Succeeds 1 min 30 sec
249 ... Refresh GUI And Verify Element Value ${policy_toggle_button} ${state}
Megha G N212f0cf2022-11-22 00:55:49 -0600250
251
252Verify Policy State
253 [Documentation] Verify if the current SSH and IPMI setting matches with
254 ... given values.
255
256 # Verify SSH state value.
257 ${status}= Run Keyword And Return Status
258 ... Open Connection And Login
259
260 Run Keyword If '${status}' == 'True'
261 ... Element Text Should Be ${xpath_bmc_ssh_toggle} Enabled
262 ... ELSE IF '${status}' == 'False'
263 ... Element Text Should Be ${xpath_bmc_ssh_toggle} Disabled
264
265 # Verify IPMI state value.
266 ${status}= Run Keyword And Return Status
George Keishing0d930e92023-01-25 13:19:37 -0600267 ... Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME}
268 ... Run IPMI Standard Command sel info
Megha G N212f0cf2022-11-22 00:55:49 -0600269
270 Run Keyword If '${status}' == 'True'
271 ... Element Text Should Be ${xpath_network_ipmi_toggle} Enabled
272 ... ELSE IF '${status}' == 'False'
273 ... Element Text Should Be ${xpath_network_ipmi_toggle} Disabled
274
275
276Set SSH And IPMI State Via GUI
277 [Documentation] Set SSH and IPMI states via GUI.
Megha G N42d5cc92023-02-15 03:55:40 -0600278 [Arguments] ${ssh_state} ${ipmi_state} ${persistency_check}=${False}
Megha G N212f0cf2022-11-22 00:55:49 -0600279
280 # Description of argument(s):
281 # ssh_state State of SSH to be set (e.g. Enabled, Disabled).
George Keishinga87ee1e2023-01-11 22:55:45 -0600282 # ipmi_state State of IPMI to be set (e.g. Enabled, Disabled).
Megha G N212f0cf2022-11-22 00:55:49 -0600283
284 ${current_ssh_state}= Get Text ${xpath_bmc_ssh_toggle}
285
286 Run Keyword If '${ssh_state}' == '${current_ssh_state}'
287 # When SSH state is already set to given value, click SSH toggle
288 # button twice to reset SSH value back to its original value.
289 ... Run Keywords Click Element ${xpath_bmc_ssh_toggle}
290 ... AND Click Element ${xpath_bmc_ssh_toggle}
291 ... ELSE IF '${ssh_state}' != '${current_ssh_state}'
292 ... Click Element ${xpath_bmc_ssh_toggle}
293
294 ${current_ipmi_state}= Get Text ${xpath_network_ipmi_toggle}
295
296 Run Keyword If '${ipmi_state}' == '${current_ipmi_state}'
297 # When IPMI state is already set to given value, click IPMI toggle
298 # button twice to reset IPMI value back to its original value.
299 ... Run Keywords Click Element ${xpath_network_ipmi_toggle}
300 ... AND Click Element ${xpath_network_ipmi_toggle}
301 ... ELSE IF '${ipmi_state}' != '${current_ipmi_state}'
302 ... Click Element ${xpath_network_ipmi_toggle}
303
Megha G N50eaf4e2023-01-18 01:28:24 -0600304 Run Keyword If ${persistency_check} == ${True}
305 ... Run Keywords Reboot BMC via GUI AND Test Setup Execution
306
Megha G Ne1499122023-01-25 00:41:02 -0600307 Wait Until Keyword Succeeds 30 sec 15 sec Verify Policy State
Megha G N212f0cf2022-11-22 00:55:49 -0600308
309
310Fetch IPMI And SSH Settings
311 [Documentation] Note down the initial states of SSH and IPMI.
312
313 Test Setup Execution
314 ${initial_ssh_setting}= Get Text ${xpath_bmc_ssh_toggle}
315 Set Suite Variable ${initial_ssh_setting}
316 ${initial_ipmi_setting}= Get Text ${xpath_network_ipmi_toggle}
317 Set Suite Variable ${initial_ipmi_setting}