blob: e413b56f30af0492bb106227802c52939b3fd2eb [file] [log] [blame]
Sushma M Mef474f42020-07-29 16:25:39 -05001*** Settings ***
2
Rahul Maheshwari142642d2021-08-24 00:00:15 -05003Documentation Test OpenBMC GUI "LDAP" sub-menu of "Security and access".
Sushma M Mef474f42020-07-29 16:25:39 -05004
Rahul Maheshwari41747da2020-11-17 09:09:52 -06005Resource ../../lib/gui_resource.robot
Anves Kumar rayankulab44c9572021-04-27 00:44:06 -05006Resource ../../../lib/bmc_ldap_utils.robot
Sushma M Mef474f42020-07-29 16:25:39 -05007
Anves Kumar rayankula010efe62021-06-09 09:00:58 -05008Suite Setup Suite Setup Execution
Sushma M Mef474f42020-07-29 16:25:39 -05009Suite Teardown Close Browser
Sushma M Mef474f42020-07-29 16:25:39 -050010
11
12*** Variables ***
13
Sushma M M26302992020-08-31 01:15:26 -050014${xpath_ldap_heading} //h1[text()="LDAP"]
Sweta Potthurifd889f52021-08-17 02:45:12 -050015${xpath_enable_ldap_checkbox} //*[@data-test-id='ldap-checkbox-ldapAuthenticationEnabled']//following-sibling::label
Rahul Maheshwari062dceb2021-01-19 04:16:30 -060016${xpath_secure_ldap_checkbox} //*[@data-test-id='ldap-checkbox-secureLdapEnabled']
Sushma M Mef474f42020-07-29 16:25:39 -050017${xpath_service_radio_button} //*[@data-test-id="ldap-radio-activeDirectoryEnabled"]
18${xpath_add_role_group_button} //button[contains(text(),'Add role group')]
Anves Kumar rayankula47892a22021-03-26 03:57:02 -050019${xpath_ldap_url} //*[@data-test-id='ldap-input-serverUri']
20${xpath_ldap_bind_dn} //*[@data-test-id='ldap-input-bindDn']
21${xpath_ldap_password} //*[@id='bind-password']
22${xpath_ldap_base_dn} //*[@data-test-id='ldap-input-baseDn']
23${xpath_ldap_save_settings} //*[@data-test-id='ldap-button-saveSettings']
24${xpath_select_refresh_button} //*[text()[contains(.,"Refresh")]]
Anves Kumar rayankulab44c9572021-04-27 00:44:06 -050025${xpath_add_group_name} //*[@id="role-group-name"]
26${xpath_add_group_Privilege} //*[@id="privilege"]
27${xpath_add_privilege_button} //button[text()=" Add "]
28${xpath_delete_group_button} //*[@title="Delete"]
29${xpath_delete_button} //button[text()="Delete"]
Rahul Maheshwari062dceb2021-01-19 04:16:30 -060030
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050031
32${incorrect_ip} 1.2.3.4
Priya Sinhac1294c92022-08-02 00:33:02 -050033${wrong_ldap_port} 135
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050034
Sushma M Mef474f42020-07-29 16:25:39 -050035*** Test Cases ***
36
Sushma M M26302992020-08-31 01:15:26 -050037Verify Navigation To LDAP Page
38 [Documentation] Verify navigation to LDAP page.
39 [Tags] Verify_Navigation_To_LDAP_Page
40
41 Page Should Contain Element ${xpath_ldap_heading}
42
43
Sushma M Mef474f42020-07-29 16:25:39 -050044Verify Existence Of All Sections In LDAP Page
45 [Documentation] Verify existence of all sections in LDAP page.
46 [Tags] Verify_Existence_Of_All_Sections_In_LDAP_Page
47
48 Page Should Contain Settings
49 Page Should Contain Role groups
50
51
52Verify Existence Of All Buttons In LDAP Page
53 [Documentation] Verify existence of all buttons in LDAP page.
54 [Tags] Verify_Existence_Of_All_Buttons_In_LDAP_Page
55
56 # Buttons under settings section.
57 Page Should Contain Element ${xpath_service_radio_button}
58 Page Should Contain Element ${xpath_save_settings_button}
59
60 # Buttons under role groups section.
61 Page Should Contain Element ${xpath_add_role_group_button}
62
63
64Verify Existence Of All Checkboxes In LDAP Page
65 [Documentation] Verify existence of all checkboxes in LDAP page.
66 [Tags] Verify_Existence_Of_All_Checkboxes_In_LDAP_Page
67
68 # Checkboxes under settings section.
69 Page Should Contain Element ${xpath_enable_ldap_checkbox}
70 Page Should Contain Element ${xpath_secure_ldap_checkbox}
71
72
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050073Verify LDAP Configurations Editable
74 [Documentation] Verify LDAP configurations are editable.
75 [Tags] Verify_LDAP_Configurations_Editable
76
Anves Kumar rayankula010efe62021-06-09 09:00:58 -050077 Create LDAP Configuration ${LDAP_SERVER_URI} ${LDAP_TYPE} ${LDAP_BIND_DN}
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050078 ... ${LDAP_BIND_DN_PASSWORD} ${LDAP_BASE_DN}
79 Wait Until Page Contains Element ${xpath_ldap_url}
80 Textfield Value Should Be ${xpath_ldap_url} ${LDAP_SERVER_URI}
81 Textfield Value Should Be ${xpath_ldap_bind_dn} ${LDAP_BIND_DN}
82 Textfield Value Should Be ${xpath_ldap_password} ${empty}
83 Textfield Value Should Be ${xpath_ldap_base_dn} ${LDAP_BASE_DN}
84
85
Anves Kumar rayankula47892a22021-03-26 03:57:02 -050086Verify Create LDAP Configuration
87 [Documentation] Verify created LDAP configuration.
George Keishingd6a77972022-01-31 12:50:29 -060088 [Tags] Verify_Create_LDAP_Configuration
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050089 [Teardown] Run Keywords Redfish.Logout AND Redfish.Login
Anves Kumar rayankula47892a22021-03-26 03:57:02 -050090
91 Create LDAP Configuration
92 Get LDAP Configuration ${LDAP_TYPE}
Anves Kumar rayankula010efe62021-06-09 09:00:58 -050093 Redfish.Logout
Anves Kumar rayankula47892a22021-03-26 03:57:02 -050094 Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050095
96
97Verify LDAP Config Update With Incorrect LDAP IP Address
98 [Documentation] Verify that LDAP login fails with incorrect LDAP IP Address.
99 [Tags] Verify_LDAP_Config_Update_With_Incorrect_LDAP_IP_Address
100 [Teardown] Run Keywords Redfish.Logout AND Redfish.Login
101
102 Create LDAP Configuration ${incorrect_ip} ${LDAP_TYPE} ${LDAP_BIND_DN}
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500103 ... ${LDAP_BIND_DN_PASSWORD} ${LDAP_BASE_DN} ${LDAP_MODE}
Anves Kumar rayankula298b6842021-05-24 04:25:19 -0500104
105 Get LDAP Configuration ${LDAP_TYPE}
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500106 Redfish.Logout
Anves Kumar rayankula298b6842021-05-24 04:25:19 -0500107
108 ${resp}= Run Keyword And Return Status
109 ... Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
110 Should Be Equal ${resp} ${False}
111 ... msg=LDAP user was able to login though the incorrect LDAP IP Address.
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500112
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500113
114Verify LDAP Service Disable
115 [Documentation] Verify that LDAP user cannot login when LDAP service is disabled.
116 [Tags] Verify_LDAP_Service_Disable
Anves Kumar rayankula298b6842021-05-24 04:25:19 -0500117 [Teardown] Run Keywords Redfish.Logout AND Redfish.Login
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500118
119 ${status}= Run Keyword And Return Status
120 ... Checkbox Should Be Selected ${xpath_enable_ldap_checkbox}
121
122 Run Keyword If ${status} == ${True}
123 ... Click Element At Coordinates ${xpath_enable_ldap_checkbox} 0 0
124
125 Checkbox Should Not Be Selected ${xpath_enable_ldap_checkbox}
126 Click Element ${xpath_ldap_save_settings}
127 Wait Until Page Contains Successfully saved Open LDAP settings
128 Click Element ${xpath_refresh_button}
129 Wait Until Page Contains Element ${xpath_ldap_heading}
Anves Kumar rayankula298b6842021-05-24 04:25:19 -0500130 Redfish.Logout
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500131
Anves Kumar rayankula298b6842021-05-24 04:25:19 -0500132 ${resp}= Run Keyword And Return Status
133 ... Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500134 Should Be Equal ${resp} ${False}
135 ... msg=LDAP user was able to login even though the LDAP service was disabled.
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500136
137
Anves Kumar rayankulab44c9572021-04-27 00:44:06 -0500138Verify LDAP User With Admin Privilege
139 [Documentation] Verify that LDAP user with administrator privilege is able to do BMC reboot.
140 [Tags] Verify_LDAP_User_With_Admin_Privilege
141 [Teardown] Run Keywords Redfish.Login AND Delete LDAP Role Group ${GROUP_NAME}
142
143 Update LDAP Configuration with LDAP User Role And Group ${GROUP_NAME} ${GROUP_PRIVILEGE}
144 Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
145 Redfish OBMC Reboot (off)
146 Redfish.Logout
147
148
Anves Kumar rayankula454b7912021-06-21 06:54:23 -0500149Verify Enabling LDAP
150 [Documentation] Verify that LDAP can be enabled from disabled state.
151 [Tags] Verify_Enabling_LDAP
152
153 Disable LDAP Configuration
154 Create LDAP Configuration
155
156
Anves Kumar rayankula272acf42021-06-23 01:51:24 -0500157Read Network Configuration Via Different User Roles And Verify Using GUI
158 [Documentation] Read network configuration via different user roles and verify.
159 [Tags] Read_Network_Configuration_Via_Different_User_Roles_And_Verify_Using_GUI
160 [Template] Update LDAP User Role And Read Network Configuration Via GUI
161
162 # group_name user_role valid_status_code
163 ${GROUP_NAME} Administrator ${HTTP_OK}
164 ${GROUP_NAME} Operator ${HTTP_OK}
165 ${GROUP_NAME} ReadOnly ${HTTP_OK}
166 ${GROUP_NAME} NoAccess ${HTTP_FORBIDDEN}
167
168
Priya Sinhac1294c92022-08-02 00:33:02 -0500169Verify LDAP Login Fails On Wrong LDAP Port
170 [Documentation] Verify that LDAP login fails when wrong port is entered in LDAP URL.
171 [Tags] Verify_LDAP_Login_Fails_On_Wrong_LDAP_Port
172 [Teardown] Run Keywords Redfish.Logout AND Redfish.Login
173
174 ${ldap_uri_wrong_port}= Catenate SEPARATOR=: ${LDAP_SERVER_URI} ${wrong_ldap_port}
175 Create LDAP Configuration ${ldap_uri_wrong_port} ${LDAP_TYPE} ${LDAP_BIND_DN}
176 ... ${LDAP_BIND_DN_PASSWORD} ${LDAP_BASE_DN} ${LDAP_MODE}
177
178 Get LDAP Configuration ${LDAP_TYPE}
179 Redfish.Logout
180
181 ${resp}= Run Keyword And Return Status
182 ... Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
183 Should Be Equal ${resp} ${False}
184 ... msg=LDAP user was able to login though the wrong port in LDAP URL
185
Sushma M Mef474f42020-07-29 16:25:39 -0500186*** Keywords ***
187
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500188Suite Setup Execution
Sushma M Mef474f42020-07-29 16:25:39 -0500189 [Documentation] Do test case setup tasks.
190
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500191 Launch Browser And Login GUI
192
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500193 # Navigate to https://xx.xx.xx.xx/#/security-and-access/ldap LDAP page.
194 Click Element ${xpath_secuity_and_accesss_menu}
Sushma M Mef474f42020-07-29 16:25:39 -0500195 Click Element ${xpath_ldap_sub_menu}
196 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain ldap
rramyasr-in9e2c96f2023-01-24 07:59:34 -0600197 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30
Sweta Potthurifd889f52021-08-17 02:45:12 -0500198 Wait Until Element Is Enabled ${xpath_enable_ldap_checkbox} timeout=10s
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500199
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500200 Valid Value LDAP_TYPE valid_values=["ActiveDirectory", "LDAP"]
201 Valid Value LDAP_USER
202 Valid Value LDAP_USER_PASSWORD
203 Valid Value GROUP_PRIVILEGE
204 Valid Value GROUP_NAME
205 Valid Value LDAP_SERVER_URI
206 Valid Value LDAP_BIND_DN_PASSWORD
207 Valid Value LDAP_BIND_DN
208 Valid Value LDAP_BASE_DN
209 Valid Value LDAP_MODE valid_values=["secure", "nonsecure"]
210
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500211
212Create LDAP Configuration
213 [Documentation] Create LDAP configuration.
214 [Arguments] ${ldap_server_uri}=${LDAP_SERVER_URI} ${ldap_servicetype}=${LDAP_TYPE}
215 ... ${ldap_bind_dn}=${LDAP_BIND_DN} ${ldap_bind_dn_password}=${LDAP_BIND_DN_PASSWORD}
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500216 ... ${ldap_base_dn}=${LDAP_BASE_DN} ${ldap_mode}=${LDAP_MODE}
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500217
218 # Description of argument(s):
219 # ldap_server_uri LDAP server uri (e.g. ldap://XX.XX.XX.XX).
220 # ldap_type The LDAP type ("ActiveDirectory" or "LDAP").
221 # ldap_bind_dn The LDAP bind distinguished name.
222 # ldap_bind_dn_password The LDAP bind distinguished name password.
223 # ldap_base_dn The LDAP base distinguished name.
224
Sweta Potthurifd889f52021-08-17 02:45:12 -0500225 # Clearing existing LDAP configuration by disabling it.
226 Redfish.Patch ${REDFISH_BASE_URI}AccountService
227 ... body={'${LDAP_TYPE}': {'ServiceEnabled': ${False}}}
228
229 # Wait for GUI to reflect LDAP disabled status.
230 Run Keywords Refresh GUI AND Sleep 10s
231
232 Click Element ${xpath_enable_ldap_checkbox}
233 ${radio_buttons}= Get WebElements ${xpath_service_radio_button}
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500234
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500235 Run Keyword If '${ldap_service_type}' == 'LDAP'
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500236 ... Click Element At Coordinates ${radio_buttons}[${0}] 0 0
237 ... ELSE Click Element At Coordinates ${radio_buttons}[${1}] 0 0
238
239 Wait Until Page Contains Element ${xpath_ldap_url}
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500240 Run Keyword If '${ldap_mode}' == 'secure'
241 ... Click Element At Coordinates ${xpath_secure_ldap_checkbox} 0 0
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500242
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500243 Input Text ${xpath_ldap_url} ${ldap_server_uri}
244 Input Text ${xpath_ldap_bind_dn} ${ldap_bind_dn}
245 Input Text ${xpath_ldap_password} ${ldap_bind_dn_password}
246 Input Text ${xpath_ldap_base_dn} ${ldap_base_dn}
247 Click Element ${xpath_ldap_save_settings}
248
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500249 Run Keyword If '${ldap_service_type}'=='LDAP'
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500250 ... Wait Until Page Contains Successfully saved Open LDAP settings
251 ... ELSE
252 ... Wait Until Page Contains Successfully saved Active Directory settings
253
254 Click Element ${xpath_refresh_button}
255 Wait Until Page Contains Element ${xpath_ldap_heading}
256
257
258Get LDAP Configuration
259 [Documentation] Retrieve LDAP Configuration.
260 [Arguments] ${ldap_type}
261
262 # Description of argument(s):
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500263 # ldap_type The LDAP type ("ActiveDirectory" or "LDAP").
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500264
265 ${radio_buttons}= Get WebElements ${xpath_service_radio_button}
266
267 ${status}= Run Keyword And Return Status
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500268 ... Run Keyword If '${ldap_type}'=='LDAP'
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500269 ... Checkbox Should Be Selected ${radio_buttons}[${0}]
270 ... ELSE
271 ... Checkbox Should Be Selected ${radio_buttons}[${1}]
272 Should Be Equal ${status} ${True}
Anves Kumar rayankulab44c9572021-04-27 00:44:06 -0500273
274
275Update LDAP Configuration With LDAP User Role And Group
276 [Documentation] Update LDAP configuration update with LDAP user role and group.
277 [Arguments] ${group_name} ${group_privilege}
278
279 # Description of argument(s):
280 # group_name The group name of LDAP user.
281 # group_privilege The group privilege for LDAP user
282 # (e.g. "Administrator", "Operator", "ReadOnly" or "NoAcccess").
283
284 Create LDAP Configuration
285 Click Element ${xpath_add_role_group_button}
286 Input Text ${xpath_add_group_name} ${group_name}
287 Select From List By Value ${xpath_add_group_Privilege} ${group_privilege}
288 Click Element ${xpath_add_privilege_button}
289
290 # Verify group name after adding.
291 ${ldap_group_name}= Get LDAP Privilege And Group Name Via Redfish
292 List Should Contain Value ${ldap_group_name} ${group_name}
293
294
295Delete LDAP Role Group
296 [Documentation] Delete LDAP role group.
297 [Arguments] ${group_name}
298
299 # Description of argument(s):
300 # group_name The group name of LDAP user.
301
302 # Verify given group name is exist before deleting.
303 ${ldap_group_name}= Get LDAP Privilege And Group Name Via Redfish
304 List Should Contain Value ${ldap_group_name} ${group_name} msg=${group_name} not available.
305
306 ${get_groupname_index}= Get Index From List ${ldap_group_name} ${group_name}
307 ${delete_group_elements}= Get WebElements ${xpath_delete_group_button}
308 Click Element ${delete_group_elements}[${get_groupname_index}]
309 Click Element ${xpath_delete_button}
310
311 # Verify group name after deleting.
312 ${ldap_group_name}= Get LDAP Privilege And Group Name Via Redfish
313 List Should Not Contain Value ${ldap_group_name} ${group_name} msg=${group_name} not available.
Anves Kumar rayankula454b7912021-06-21 06:54:23 -0500314
315
316Disable LDAP Configuration
317 [Documentation] Disable LDAP configuration on BMC.
318
319 ${status}= Run Keyword And Return Status
320 ... Checkbox Should Be Selected ${xpath_enable_ldap_checkbox}
321
322 Run Keyword If ${status} == ${True}
323 ... Click Element At Coordinates ${xpath_enable_ldap_checkbox} 0 0
324
325 Checkbox Should Not Be Selected ${xpath_enable_ldap_checkbox}
326 Click Element ${xpath_ldap_save_settings}
327 Wait Until Page Contains Successfully saved Open LDAP settings
328 Click Element ${xpath_refresh_button}
329 Wait Until Page Contains Element ${xpath_ldap_heading}
330
Anves Kumar rayankula272acf42021-06-23 01:51:24 -0500331
332Login BMC And Navigate To LDAP Page
333 [Documentation] Login BMC and navigate to ldap page.
334 [Arguments] ${username}=${OPENBMC_USERNAME} ${password}=${OPENBMC_PASSWORD}
335
336 # Description of argument(s):
337 # username The username to be used for login.
338 # password The password to be used for login.
339
340 Login GUI ${username} ${password}
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500341 # Navigate to https://xx.xx.xx.xx/#/security-and-access/ldap LDAP page.
342 Click Element ${xpath_secuity_and_accesss_menu}
Anves Kumar rayankula272acf42021-06-23 01:51:24 -0500343 Click Element ${xpath_ldap_sub_menu}
344 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain ldap
345
346
347Update LDAP User Role And Read Network Configuration Via GUI
348 [Documentation] Update LDAP user role and read network configuration via GUI.
349 [Arguments] ${group_name} ${user_role} ${valid_status_codes}
350 [Teardown] Run Keywords Logout GUI AND Login BMC And Navigate To LDAP Page
351 ... AND Delete LDAP Role Group ${group_name}
352
353 # Description of argument(s):
354 # group_privilege The group privilege ("Administrator", "Operator", "ReadOnly" or "NoAccess").
355 # group_name The group name of user.
356 # valid_status_code The expected valid status code.
357
358
359 Update LDAP Configuration with LDAP User Role And Group ${group_name} ${user_role}
360 Logout GUI
361 Login GUI ${LDAP_USER} ${LDAP_USER_PASSWORD}
362 Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
363
364 Click Element ${xpath_server_configuration}
365 Click Element ${xpath_select_network_settings}
366 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network-settings
367
368 ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI} valid_status_codes=[${valid_status_codes}]
369 Return From Keyword If ${valid_status_codes} == ${HTTP_FORBIDDEN}
370
371 ${host_name}= Redfish.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName
372 Textfield Value Should Be ${xpath_hostname_input} ${host_name}
373
374 ${mac_address}= Redfish.Get Attribute ${REDFISH_NW_ETH0_URI} MACAddress
375 Textfield Value Should Be ${xpath_mac_address_input} ${mac_address}
Priya Sinhac1294c92022-08-02 00:33:02 -0500376