blob: 36e173e320b003a27f74eb8d2d46abed90a31fc8 [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
13
14*** Variables ***
rramyasr-in9e2c96f2023-01-24 07:59:34 -060015
16
rramyasr-in34960622022-08-11 11:35:04 -050017${xpath_policies_heading} //h1[text()="Policies"]
18${xpath_bmc_ssh_toggle} //*[@data-test-id='policies-toggle-bmcShell']
19... /following-sibling::label
20${xpath_network_ipmi_toggle} //*[@data-test-id='polices-toggle-networkIpmi']
21... /following-sibling::label
22${xpath_host_tpm_toggle} //input[@id='host-tpm-policy']
23${xpath_virtual_tpm_toggle} //*[@data-test-id='policies-toggle-vtpm']
24${xpath_rtad_toggle} //*[@data-test-id='policies-toggle-rtad']
25${xpath_usb_firmware_update_policy_toggle} //*[@data-test-id='policies-toggle-usbFirmwareUpdatePolicy']
26${xpath_secure_version_lockin_toggle} //*[@data-test-id='policies-toggle-svle']
27${xpath_host_usb_enablement_toggle} //*[@data-test-id='policies-toggle-hostUsb']
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050028
rramyasr-in9e2c96f2023-01-24 07:59:34 -060029
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050030*** Test Cases ***
31
Rahul Maheshwari142642d2021-08-24 00:00:15 -050032Verify Navigation To Policies Page
meghagn12345f942dae2021-08-27 02:53:00 -050033 [Documentation] Verify navigation to policies page.
Rahul Maheshwari142642d2021-08-24 00:00:15 -050034 [Tags] Verify_Navigation_To_Policies_Page
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050035
Rahul Maheshwari142642d2021-08-24 00:00:15 -050036 Page Should Contain Element ${xpath_policies_heading}
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050037
38
Rahul Maheshwari142642d2021-08-24 00:00:15 -050039Verify Existence Of All Sections In Policies Page
40 [Documentation] Verify existence of all sections in policies page.
41 [Tags] Verify_Existence_Of_All_Sections_In_Policies_Page
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050042
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050043 Page Should Contain BMC shell (via SSH)
44 Page Should Contain Network IPMI (out-of-band IPMI)
rramyasr-in03f42372022-06-16 11:51:11 -050045 Page Should Contain Host TPM
46 Page Should Contain VirtualTPM
47 Page Should Contain RTAD
48 Page Should Contain USB firmware update policy
49 Page Should Contain Secure version lock-in
50 Page Should Contain Host USB enablement
meghagn2052fdd2021-12-07 02:42:31 -060051
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050052
Rahul Maheshwari142642d2021-08-24 00:00:15 -050053Verify Existence Of All Buttons In Policies Page
54 [Documentation] Verify existence of All Buttons in policies page.
55 [Tags] Verify_Existence_Of_All_Buttons_In_Policies_Page
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050056
57 Page Should Contain Element ${xpath_bmc_ssh_toggle}
58 Page Should Contain Element ${xpath_network_ipmi_toggle}
rramyasr-in34960622022-08-11 11:35:04 -050059 Page Should Contain Element ${xpath_host_tpm_toggle}
60 Page Should Contain Element ${xpath_virtual_tpm_toggle}
61 Page Should Contain Element ${xpath_rtad_toggle}
62 Page Should Contain Element ${xpath_usb_firmware_update_policy_toggle}
63 Page Should Contain Element ${xpath_secure_version_lockin_toggle}
64 Page Should Contain Element ${xpath_host_usb_enablement_toggle}
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050065
66
meghagn12345f942dae2021-08-27 02:53:00 -050067Enable SSH Via GUI And Verify
meghagn2052fdd2021-12-07 02:42:31 -060068 [Documentation] Login to GUI Policies page,enable SSH toggle and
69 ... verify that SSH to BMC starts working after enabling SSH.
meghagn12345f942dae2021-08-27 02:53:00 -050070 [Tags] Enable_SSH_Via_GUI_And_Verify
meghagn12345f942dae2021-08-27 02:53:00 -050071
meghagn2052fdd2021-12-07 02:42:31 -060072 Set Policy Via GUI SSH Enabled
Priya Sinha9f3de2b2022-08-26 01:59:46 -050073 Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} Open Connection And Login
meghagn12345f942dae2021-08-27 02:53:00 -050074
75
meghagn07db9622021-09-13 07:22:28 -050076Disable SSH Via GUI And Verify
meghagn2052fdd2021-12-07 02:42:31 -060077 [Documentation] Login to GUI Policies page,disable SSH and
78 ... verify that SSH to BMC stops working after disabling SSH.
meghagn07db9622021-09-13 07:22:28 -050079 [Tags] Disable_SSH_Via_GUI_And_Verify
meghagn2052fdd2021-12-07 02:42:31 -060080 [Teardown] Run Keywords Enable SSH Protocol ${True} AND
Priya Sinha9f3de2b2022-08-26 01:59:46 -050081 ... Wait Until Keyword Succeeds 30 sec 15 sec Open Connection And Login
meghagn07db9622021-09-13 07:22:28 -050082
meghagn2052fdd2021-12-07 02:42:31 -060083 Set Policy Via GUI SSH Disabled
meghagn07db9622021-09-13 07:22:28 -050084
85 ${status}= Run Keyword And Return Status
86 ... Open Connection And Login
87
88 Should Be Equal As Strings ${status} False
89 ... msg=SSH login still working after disabling SSH.
90
91
meghagn56eba262021-09-16 07:05:52 -050092Disable IPMI Via GUI And Verify
meghagn2052fdd2021-12-07 02:42:31 -060093 [Documentation] Login to GUI Policies page,disable IPMI and
George Keishingde7e0452022-02-01 07:04:41 -060094 ... verify that IPMI command does not work after disabling IPMI.
meghagn56eba262021-09-16 07:05:52 -050095 [Tags] Disable_IPMI_Via_GUI_And_Verify
meghagn56eba262021-09-16 07:05:52 -050096
meghagn2052fdd2021-12-07 02:42:31 -060097 Set Policy Via GUI IPMI Disabled
meghagn56eba262021-09-16 07:05:52 -050098
99 ${status}= Run Keyword And Return Status
Priya Sinha9f3de2b2022-08-26 01:59:46 -0500100 ... Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} Run IPMI Standard Command sel info
meghagn56eba262021-09-16 07:05:52 -0500101
102 Should Be Equal As Strings ${status} False
103 ... msg=IPMI command is working after disabling IPMI.
104
105
meghagnb5c88b02021-09-14 00:32:27 -0500106Enable IPMI Via GUI And Verify
meghagn2052fdd2021-12-07 02:42:31 -0600107 [Documentation] Login to GUI Policies page,enable IPMI and
108 ... verify that IPMI command works after enabling IPMI.
meghagnb5c88b02021-09-14 00:32:27 -0500109 [Tags] Enable_IPMI_Via_GUI_And_Verify
meghagnb5c88b02021-09-14 00:32:27 -0500110
meghagn2052fdd2021-12-07 02:42:31 -0600111 Set Policy Via GUI IPMI Enabled
Priya Sinha9f3de2b2022-08-26 01:59:46 -0500112 Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} Run IPMI Standard Command sel info
meghagnb5c88b02021-09-14 00:32:27 -0500113
114
meghagn2052fdd2021-12-07 02:42:31 -0600115Enable SSH Via GUI And Verify Persistency On BMC Reboot
116 [Documentation] Login to GUI Policies page,enable SSH and
117 ... verify persistency of SSH connection on BMC reboot.
118 [Tags] Enable_SSH_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
119
120 Set Policy Via GUI SSH Enabled
121
122 Reboot BMC via GUI
123
124 Wait Until Keyword Succeeds 5 min 30 sec Open Connection And Login
125
126
127Enable IPMI Via GUI And Verify Persistency On BMC Reboot
128 [Documentation] Login to GUI Policies page,enable IPMI and
129 ... verify persistency of IPMI command work on BMC reboot.
130 [Tags] Enable_IPMI_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
131
132 Set Policy Via GUI IPMI Enabled
133
134 Reboot BMC via GUI
135
136 Wait Until Keyword Succeeds 2 min 30 sec Run IPMI Standard Command sel info
137
138
meghagn3fb3d1b2022-01-28 01:27:59 -0600139Disable SSH Via GUI And Verify Persistency On BMC Reboot
140 [Documentation] Login to GUI Policies page,disable SSH and
141 ... verify that SSH to BMC stops working after disabling SSH on BMC reboot.
142 [Tags] Disable_SSH_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
143 [Teardown] Run Keywords Wait Until Keyword Succeeds 2 min 15 sec Enable SSH Protocol ${True}
144 ... AND Wait Until Keyword Succeeds 2 min 15 sec Open Connection And Login
145
146 Set Policy Via GUI SSH Disabled
147
148 Reboot BMC via GUI
149
150 ${status}= Run Keyword And Return Status
Priya Sinha9f3de2b2022-08-26 01:59:46 -0500151 ... Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} Open Connection And Login
meghagn3fb3d1b2022-01-28 01:27:59 -0600152
153 Should Be Equal As Strings ${status} False
154 ... msg=SSH login still working after disabling SSH.
155
156
157Disable IPMI Via GUI And Verify Persistency On BMC Reboot
158 [Documentation] Login to GUI Policies page,disable IPMI and
George Keishing86d85f42022-08-18 23:02:22 -0500159 ... verify persistency of IPMI command does not work on BMC reboot.
meghagn3fb3d1b2022-01-28 01:27:59 -0600160 [Tags] Disable_IPMI_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
161 [Teardown] Run Keywords Wait Until Keyword Succeeds 2 min 15 sec Enable IPMI Protocol ${True}
162 ... AND Wait Until Keyword Succeeds 2 min 15 sec Run IPMI Standard Command sel info
163
164 Set Policy Via GUI IPMI Disabled
165
166 Reboot BMC via GUI
167
168 ${status}= Run Keyword And Return Status
Priya Sinha9f3de2b2022-08-26 01:59:46 -0500169 ... Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} Run IPMI Standard Command sel info
meghagn3fb3d1b2022-01-28 01:27:59 -0600170
171 Should Be Equal As Strings ${status} False
172 ... msg=IPMI command is working after disabling IPMI.
173
174
Megha G N212f0cf2022-11-22 00:55:49 -0600175Configure SSH And IPMI Settings Via GUI And Verify
176 [Documentation] Login to GUI Policies page,set SSH and IPMI toggle and
177 ... verify SSH & IPMI after the settings.
178 [Tags] Configure_SSH_And_IPMI_Settings_Via_GUI_And_Verify
179 [Setup] Fetch IPMI And SSH Settings
180 [Template] Set SSH And IPMI State Via GUI
181 [Teardown] Set SSH And IPMI State Via GUI ${initial_ssh_setting} ${initial_ipmi_setting}
182
183 # ssh_state ipmi_state
184 Enabled Enabled
185 Disabled Disabled
186 Enabled Disabled
187 Disabled Enabled
188
189
Megha G N50eaf4e2023-01-18 01:28:24 -0600190Configure SSH And IPMI Settings Via GUI And Verify Its Persistency
191 [Documentation] Login to GUI Policies page,set SSH and IPMI toggle and
192 ... verify SSH & IPMI settings after BMC reboot.
193 [Tags] Configure_SSH_And_IPMI_Settings_Via_GUI_And_Verify_Its_Persistency
194 [Setup] Fetch IPMI And SSH Settings
195 [Template] Set SSH And IPMI State Via GUI
196 [Teardown] Set SSH And IPMI State Via GUI ${initial_ssh_setting} ${initial_ipmi_setting}
197
198 # ssh_state ipmi_state persistency_check
199 Enabled Enabled True
200 Disabled Disabled True
201 Enabled Disabled True
202 Disabled Enabled True
203
204
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -0500205*** Keywords ***
206
207Test Setup Execution
208 [Documentation] Do test case setup tasks.
meghagn2052fdd2021-12-07 02:42:31 -0600209
Megha G N212f0cf2022-11-22 00:55:49 -0600210 Wait Until Keyword Succeeds 30 sec 15 sec Click Element ${xpath_secuity_and_accesss_menu}
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500211 Click Element ${xpath_policies_sub_menu}
Priya Sinha9f3de2b2022-08-26 01:59:46 -0500212 Wait Until Keyword Succeeds 30 sec 15 sec Location Should Contain policies
rramyasr-in9e2c96f2023-01-24 07:59:34 -0600213 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30
meghagn12345f942dae2021-08-27 02:53:00 -0500214
meghagn2052fdd2021-12-07 02:42:31 -0600215Set Policy Via GUI
216
217 [Documentation] Login to GUI Policies page and set policy.
218 [Arguments] ${policy} ${state}
219
220 # Description of argument(s):
221 # policy policy to be set(e.g. SSH, IPMI).
222 # state state to be set(e.g. Enable, Disable).
223
224 ${opposite_state_gui} ${opposite_state_redfish}= Run Keyword If
225 ... '${state}' == 'Enabled' Set Variable Disabled ${False}
226 ... ELSE IF '${state}' == 'Disabled' Set Variable Enabled ${True}
227
228 # Setting policy to an opposite value via Redfish.
229 Run Keyword If '${policy}' == 'SSH'
230 ... Enable SSH Protocol ${opposite_state_redfish}
231 ... ELSE IF '${policy}' == 'IPMI'
232 ... Enable IPMI Protocol ${opposite_state_redfish}
233
234 ${policy_toggle_button}= Run Keyword If '${policy}' == 'SSH'
235 ... Set variable ${xpath_bmc_ssh_toggle}
236 ... ELSE IF '${policy}' == 'IPMI'
237 ... Set variable ${xpath_network_ipmi_toggle}
238
239 Wait Until Keyword Succeeds 1 min 30 sec
240 ... Refresh GUI And Verify Element Value ${policy_toggle_button} ${opposite_state_gui}
241 Click Element ${policy_toggle_button}
242
243 # Wait for GUI to reflect policy status.
244 Wait Until Keyword Succeeds 1 min 30 sec
245 ... Refresh GUI And Verify Element Value ${policy_toggle_button} ${state}
Megha G N212f0cf2022-11-22 00:55:49 -0600246
247
248Verify Policy State
249 [Documentation] Verify if the current SSH and IPMI setting matches with
250 ... given values.
251
252 # Verify SSH state value.
253 ${status}= Run Keyword And Return Status
254 ... Open Connection And Login
255
256 Run Keyword If '${status}' == 'True'
257 ... Element Text Should Be ${xpath_bmc_ssh_toggle} Enabled
258 ... ELSE IF '${status}' == 'False'
259 ... Element Text Should Be ${xpath_bmc_ssh_toggle} Disabled
260
261 # Verify IPMI state value.
262 ${status}= Run Keyword And Return Status
263 ... Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} Run IPMI Standard Command sel info
264
265 Run Keyword If '${status}' == 'True'
266 ... Element Text Should Be ${xpath_network_ipmi_toggle} Enabled
267 ... ELSE IF '${status}' == 'False'
268 ... Element Text Should Be ${xpath_network_ipmi_toggle} Disabled
269
270
271Set SSH And IPMI State Via GUI
272 [Documentation] Set SSH and IPMI states via GUI.
273 [Arguments] ${ssh_state} ${ipmi_state}
274
275 # Description of argument(s):
276 # ssh_state State of SSH to be set (e.g. Enabled, Disabled).
George Keishinga87ee1e2023-01-11 22:55:45 -0600277 # ipmi_state State of IPMI to be set (e.g. Enabled, Disabled).
Megha G N212f0cf2022-11-22 00:55:49 -0600278
279 ${current_ssh_state}= Get Text ${xpath_bmc_ssh_toggle}
280
281 Run Keyword If '${ssh_state}' == '${current_ssh_state}'
282 # When SSH state is already set to given value, click SSH toggle
283 # button twice to reset SSH value back to its original value.
284 ... Run Keywords Click Element ${xpath_bmc_ssh_toggle}
285 ... AND Click Element ${xpath_bmc_ssh_toggle}
286 ... ELSE IF '${ssh_state}' != '${current_ssh_state}'
287 ... Click Element ${xpath_bmc_ssh_toggle}
288
289 ${current_ipmi_state}= Get Text ${xpath_network_ipmi_toggle}
290
291 Run Keyword If '${ipmi_state}' == '${current_ipmi_state}'
292 # When IPMI state is already set to given value, click IPMI toggle
293 # button twice to reset IPMI value back to its original value.
294 ... Run Keywords Click Element ${xpath_network_ipmi_toggle}
295 ... AND Click Element ${xpath_network_ipmi_toggle}
296 ... ELSE IF '${ipmi_state}' != '${current_ipmi_state}'
297 ... Click Element ${xpath_network_ipmi_toggle}
298
Megha G N50eaf4e2023-01-18 01:28:24 -0600299 Run Keyword If ${persistency_check} == ${True}
300 ... Run Keywords Reboot BMC via GUI AND Test Setup Execution
301
Megha G Ne1499122023-01-25 00:41:02 -0600302 Wait Until Keyword Succeeds 30 sec 15 sec Verify Policy State
Megha G N212f0cf2022-11-22 00:55:49 -0600303
304
305Fetch IPMI And SSH Settings
306 [Documentation] Note down the initial states of SSH and IPMI.
307
308 Test Setup Execution
309 ${initial_ssh_setting}= Get Text ${xpath_bmc_ssh_toggle}
310 Set Suite Variable ${initial_ssh_setting}
311 ${initial_ipmi_setting}= Get Text ${xpath_network_ipmi_toggle}
312 Set Suite Variable ${initial_ipmi_setting}