blob: e03b918185cea4088e02253a5028ce13f0324306 [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
George Keishing0d930e92023-01-25 13:19:37 -0600100 ... Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME}
101 ... Run IPMI Standard Command sel info
meghagn56eba262021-09-16 07:05:52 -0500102
103 Should Be Equal As Strings ${status} False
104 ... msg=IPMI command is working after disabling IPMI.
105
106
meghagnb5c88b02021-09-14 00:32:27 -0500107Enable IPMI Via GUI And Verify
meghagn2052fdd2021-12-07 02:42:31 -0600108 [Documentation] Login to GUI Policies page,enable IPMI and
109 ... verify that IPMI command works after enabling IPMI.
meghagnb5c88b02021-09-14 00:32:27 -0500110 [Tags] Enable_IPMI_Via_GUI_And_Verify
meghagnb5c88b02021-09-14 00:32:27 -0500111
meghagn2052fdd2021-12-07 02:42:31 -0600112 Set Policy Via GUI IPMI Enabled
George Keishing0d930e92023-01-25 13:19:37 -0600113 Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME}
114 ... Run IPMI Standard Command sel info
meghagnb5c88b02021-09-14 00:32:27 -0500115
116
meghagn2052fdd2021-12-07 02:42:31 -0600117Enable SSH Via GUI And Verify Persistency On BMC Reboot
118 [Documentation] Login to GUI Policies page,enable SSH and
119 ... verify persistency of SSH connection on BMC reboot.
120 [Tags] Enable_SSH_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
121
122 Set Policy Via GUI SSH Enabled
123
124 Reboot BMC via GUI
125
126 Wait Until Keyword Succeeds 5 min 30 sec Open Connection And Login
127
128
129Enable IPMI Via GUI And Verify Persistency On BMC Reboot
130 [Documentation] Login to GUI Policies page,enable IPMI and
131 ... verify persistency of IPMI command work on BMC reboot.
132 [Tags] Enable_IPMI_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
133
134 Set Policy Via GUI IPMI Enabled
135
136 Reboot BMC via GUI
137
138 Wait Until Keyword Succeeds 2 min 30 sec Run IPMI Standard Command sel info
139
140
meghagn3fb3d1b2022-01-28 01:27:59 -0600141Disable SSH Via GUI And Verify Persistency On BMC Reboot
142 [Documentation] Login to GUI Policies page,disable SSH and
143 ... verify that SSH to BMC stops working after disabling SSH on BMC reboot.
144 [Tags] Disable_SSH_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
145 [Teardown] Run Keywords Wait Until Keyword Succeeds 2 min 15 sec Enable SSH Protocol ${True}
146 ... AND Wait Until Keyword Succeeds 2 min 15 sec Open Connection And Login
147
148 Set Policy Via GUI SSH Disabled
149
150 Reboot BMC via GUI
151
152 ${status}= Run Keyword And Return Status
Priya Sinha9f3de2b2022-08-26 01:59:46 -0500153 ... Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} Open Connection And Login
meghagn3fb3d1b2022-01-28 01:27:59 -0600154
155 Should Be Equal As Strings ${status} False
156 ... msg=SSH login still working after disabling SSH.
157
158
159Disable IPMI Via GUI And Verify Persistency On BMC Reboot
160 [Documentation] Login to GUI Policies page,disable IPMI and
George Keishing86d85f42022-08-18 23:02:22 -0500161 ... verify persistency of IPMI command does not work on BMC reboot.
meghagn3fb3d1b2022-01-28 01:27:59 -0600162 [Tags] Disable_IPMI_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
163 [Teardown] Run Keywords Wait Until Keyword Succeeds 2 min 15 sec Enable IPMI Protocol ${True}
164 ... AND Wait Until Keyword Succeeds 2 min 15 sec Run IPMI Standard Command sel info
165
166 Set Policy Via GUI IPMI Disabled
167
168 Reboot BMC via GUI
169
170 ${status}= Run Keyword And Return Status
George Keishing0d930e92023-01-25 13:19:37 -0600171 ... Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME}
172 ... Run IPMI Standard Command sel info
meghagn3fb3d1b2022-01-28 01:27:59 -0600173
174 Should Be Equal As Strings ${status} False
175 ... msg=IPMI command is working after disabling IPMI.
176
177
Megha G N212f0cf2022-11-22 00:55:49 -0600178Configure SSH And IPMI Settings Via GUI And Verify
179 [Documentation] Login to GUI Policies page,set SSH and IPMI toggle and
180 ... verify SSH & IPMI after the settings.
181 [Tags] Configure_SSH_And_IPMI_Settings_Via_GUI_And_Verify
182 [Setup] Fetch IPMI And SSH Settings
183 [Template] Set SSH And IPMI State Via GUI
184 [Teardown] Set SSH And IPMI State Via GUI ${initial_ssh_setting} ${initial_ipmi_setting}
185
186 # ssh_state ipmi_state
187 Enabled Enabled
188 Disabled Disabled
189 Enabled Disabled
190 Disabled Enabled
191
192
Megha G N50eaf4e2023-01-18 01:28:24 -0600193Configure SSH And IPMI Settings Via GUI And Verify Its Persistency
194 [Documentation] Login to GUI Policies page,set SSH and IPMI toggle and
195 ... verify SSH & IPMI settings after BMC reboot.
196 [Tags] Configure_SSH_And_IPMI_Settings_Via_GUI_And_Verify_Its_Persistency
197 [Setup] Fetch IPMI And SSH Settings
198 [Template] Set SSH And IPMI State Via GUI
199 [Teardown] Set SSH And IPMI State Via GUI ${initial_ssh_setting} ${initial_ipmi_setting}
200
201 # ssh_state ipmi_state persistency_check
202 Enabled Enabled True
203 Disabled Disabled True
204 Enabled Disabled True
205 Disabled Enabled True
206
207
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -0500208*** Keywords ***
209
210Test Setup Execution
211 [Documentation] Do test case setup tasks.
meghagn2052fdd2021-12-07 02:42:31 -0600212
Megha G N212f0cf2022-11-22 00:55:49 -0600213 Wait Until Keyword Succeeds 30 sec 15 sec Click Element ${xpath_secuity_and_accesss_menu}
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500214 Click Element ${xpath_policies_sub_menu}
Priya Sinha9f3de2b2022-08-26 01:59:46 -0500215 Wait Until Keyword Succeeds 30 sec 15 sec Location Should Contain policies
Megha G N42d5cc92023-02-15 03:55:40 -0600216 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=1min
meghagn12345f942dae2021-08-27 02:53:00 -0500217
meghagn2052fdd2021-12-07 02:42:31 -0600218Set Policy Via GUI
219
220 [Documentation] Login to GUI Policies page and set policy.
221 [Arguments] ${policy} ${state}
222
223 # Description of argument(s):
224 # policy policy to be set(e.g. SSH, IPMI).
225 # state state to be set(e.g. Enable, Disable).
226
227 ${opposite_state_gui} ${opposite_state_redfish}= Run Keyword If
228 ... '${state}' == 'Enabled' Set Variable Disabled ${False}
229 ... ELSE IF '${state}' == 'Disabled' Set Variable Enabled ${True}
230
231 # Setting policy to an opposite value via Redfish.
232 Run Keyword If '${policy}' == 'SSH'
233 ... Enable SSH Protocol ${opposite_state_redfish}
234 ... ELSE IF '${policy}' == 'IPMI'
235 ... Enable IPMI Protocol ${opposite_state_redfish}
236
237 ${policy_toggle_button}= Run Keyword If '${policy}' == 'SSH'
238 ... Set variable ${xpath_bmc_ssh_toggle}
239 ... ELSE IF '${policy}' == 'IPMI'
240 ... Set variable ${xpath_network_ipmi_toggle}
241
242 Wait Until Keyword Succeeds 1 min 30 sec
243 ... Refresh GUI And Verify Element Value ${policy_toggle_button} ${opposite_state_gui}
244 Click Element ${policy_toggle_button}
245
246 # Wait for GUI to reflect policy status.
247 Wait Until Keyword Succeeds 1 min 30 sec
248 ... Refresh GUI And Verify Element Value ${policy_toggle_button} ${state}
Megha G N212f0cf2022-11-22 00:55:49 -0600249
250
251Verify Policy State
252 [Documentation] Verify if the current SSH and IPMI setting matches with
253 ... given values.
254
255 # Verify SSH state value.
256 ${status}= Run Keyword And Return Status
257 ... Open Connection And Login
258
259 Run Keyword If '${status}' == 'True'
260 ... Element Text Should Be ${xpath_bmc_ssh_toggle} Enabled
261 ... ELSE IF '${status}' == 'False'
262 ... Element Text Should Be ${xpath_bmc_ssh_toggle} Disabled
263
264 # Verify IPMI state value.
265 ${status}= Run Keyword And Return Status
George Keishing0d930e92023-01-25 13:19:37 -0600266 ... Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME}
267 ... Run IPMI Standard Command sel info
Megha G N212f0cf2022-11-22 00:55:49 -0600268
269 Run Keyword If '${status}' == 'True'
270 ... Element Text Should Be ${xpath_network_ipmi_toggle} Enabled
271 ... ELSE IF '${status}' == 'False'
272 ... Element Text Should Be ${xpath_network_ipmi_toggle} Disabled
273
274
275Set SSH And IPMI State Via GUI
276 [Documentation] Set SSH and IPMI states via GUI.
Megha G N42d5cc92023-02-15 03:55:40 -0600277 [Arguments] ${ssh_state} ${ipmi_state} ${persistency_check}=${False}
Megha G N212f0cf2022-11-22 00:55:49 -0600278
279 # Description of argument(s):
280 # ssh_state State of SSH to be set (e.g. Enabled, Disabled).
George Keishinga87ee1e2023-01-11 22:55:45 -0600281 # ipmi_state State of IPMI to be set (e.g. Enabled, Disabled).
Megha G N212f0cf2022-11-22 00:55:49 -0600282
283 ${current_ssh_state}= Get Text ${xpath_bmc_ssh_toggle}
284
285 Run Keyword If '${ssh_state}' == '${current_ssh_state}'
286 # When SSH state is already set to given value, click SSH toggle
287 # button twice to reset SSH value back to its original value.
288 ... Run Keywords Click Element ${xpath_bmc_ssh_toggle}
289 ... AND Click Element ${xpath_bmc_ssh_toggle}
290 ... ELSE IF '${ssh_state}' != '${current_ssh_state}'
291 ... Click Element ${xpath_bmc_ssh_toggle}
292
293 ${current_ipmi_state}= Get Text ${xpath_network_ipmi_toggle}
294
295 Run Keyword If '${ipmi_state}' == '${current_ipmi_state}'
296 # When IPMI state is already set to given value, click IPMI toggle
297 # button twice to reset IPMI value back to its original value.
298 ... Run Keywords Click Element ${xpath_network_ipmi_toggle}
299 ... AND Click Element ${xpath_network_ipmi_toggle}
300 ... ELSE IF '${ipmi_state}' != '${current_ipmi_state}'
301 ... Click Element ${xpath_network_ipmi_toggle}
302
Megha G N50eaf4e2023-01-18 01:28:24 -0600303 Run Keyword If ${persistency_check} == ${True}
304 ... Run Keywords Reboot BMC via GUI AND Test Setup Execution
305
Megha G Ne1499122023-01-25 00:41:02 -0600306 Wait Until Keyword Succeeds 30 sec 15 sec Verify Policy State
Megha G N212f0cf2022-11-22 00:55:49 -0600307
308
309Fetch IPMI And SSH Settings
310 [Documentation] Note down the initial states of SSH and IPMI.
311
312 Test Setup Execution
313 ${initial_ssh_setting}= Get Text ${xpath_bmc_ssh_toggle}
314 Set Suite Variable ${initial_ssh_setting}
315 ${initial_ipmi_setting}= Get Text ${xpath_network_ipmi_toggle}
316 Set Suite Variable ${initial_ipmi_setting}