blob: e298b16a16c7fc9cf8f883ee07e5f93d90cb67b4 [file] [log] [blame]
Sushma M Mef474f42020-07-29 16:25:39 -05001*** Settings ***
2
3Documentation Test OpenBMC GUI "LDAP" sub-menu of "Access control".
4
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"]
Rahul Maheshwari062dceb2021-01-19 04:16:30 -060015${xpath_enable_ldap_checkbox} //*[@data-test-id='ldap-checkbox-ldapAuthenticationEnabled']
16${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
33
Sushma M Mef474f42020-07-29 16:25:39 -050034*** Test Cases ***
35
Sushma M M26302992020-08-31 01:15:26 -050036Verify Navigation To LDAP Page
37 [Documentation] Verify navigation to LDAP page.
38 [Tags] Verify_Navigation_To_LDAP_Page
39
40 Page Should Contain Element ${xpath_ldap_heading}
41
42
Sushma M Mef474f42020-07-29 16:25:39 -050043Verify Existence Of All Sections In LDAP Page
44 [Documentation] Verify existence of all sections in LDAP page.
45 [Tags] Verify_Existence_Of_All_Sections_In_LDAP_Page
46
47 Page Should Contain Settings
48 Page Should Contain Role groups
49
50
51Verify Existence Of All Buttons In LDAP Page
52 [Documentation] Verify existence of all buttons in LDAP page.
53 [Tags] Verify_Existence_Of_All_Buttons_In_LDAP_Page
54
55 # Buttons under settings section.
56 Page Should Contain Element ${xpath_service_radio_button}
57 Page Should Contain Element ${xpath_save_settings_button}
58
59 # Buttons under role groups section.
60 Page Should Contain Element ${xpath_add_role_group_button}
61
62
63Verify Existence Of All Checkboxes In LDAP Page
64 [Documentation] Verify existence of all checkboxes in LDAP page.
65 [Tags] Verify_Existence_Of_All_Checkboxes_In_LDAP_Page
66
67 # Checkboxes under settings section.
68 Page Should Contain Element ${xpath_enable_ldap_checkbox}
69 Page Should Contain Element ${xpath_secure_ldap_checkbox}
70
71
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050072Verify LDAP Configurations Editable
73 [Documentation] Verify LDAP configurations are editable.
74 [Tags] Verify_LDAP_Configurations_Editable
75
Anves Kumar rayankula010efe62021-06-09 09:00:58 -050076 Create LDAP Configuration ${LDAP_SERVER_URI} ${LDAP_TYPE} ${LDAP_BIND_DN}
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050077 ... ${LDAP_BIND_DN_PASSWORD} ${LDAP_BASE_DN}
78 Wait Until Page Contains Element ${xpath_ldap_url}
79 Textfield Value Should Be ${xpath_ldap_url} ${LDAP_SERVER_URI}
80 Textfield Value Should Be ${xpath_ldap_bind_dn} ${LDAP_BIND_DN}
81 Textfield Value Should Be ${xpath_ldap_password} ${empty}
82 Textfield Value Should Be ${xpath_ldap_base_dn} ${LDAP_BASE_DN}
83
84
Anves Kumar rayankula47892a22021-03-26 03:57:02 -050085Verify Create LDAP Configuration
86 [Documentation] Verify created LDAP configuration.
87 [Tags] Verify_Created_LDAP_Configuration
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050088 [Teardown] Run Keywords Redfish.Logout AND Redfish.Login
Anves Kumar rayankula47892a22021-03-26 03:57:02 -050089
90 Create LDAP Configuration
91 Get LDAP Configuration ${LDAP_TYPE}
Anves Kumar rayankula010efe62021-06-09 09:00:58 -050092 Redfish.Logout
Anves Kumar rayankula47892a22021-03-26 03:57:02 -050093 Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050094
95
96Verify LDAP Config Update With Incorrect LDAP IP Address
97 [Documentation] Verify that LDAP login fails with incorrect LDAP IP Address.
98 [Tags] Verify_LDAP_Config_Update_With_Incorrect_LDAP_IP_Address
99 [Teardown] Run Keywords Redfish.Logout AND Redfish.Login
100
101 Create LDAP Configuration ${incorrect_ip} ${LDAP_TYPE} ${LDAP_BIND_DN}
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500102 ... ${LDAP_BIND_DN_PASSWORD} ${LDAP_BASE_DN} ${LDAP_MODE}
Anves Kumar rayankula298b6842021-05-24 04:25:19 -0500103
104 Get LDAP Configuration ${LDAP_TYPE}
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500105 Redfish.Logout
Anves Kumar rayankula298b6842021-05-24 04:25:19 -0500106
107 ${resp}= Run Keyword And Return Status
108 ... Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
109 Should Be Equal ${resp} ${False}
110 ... msg=LDAP user was able to login though the incorrect LDAP IP Address.
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500111
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500112
113Verify LDAP Service Disable
114 [Documentation] Verify that LDAP user cannot login when LDAP service is disabled.
115 [Tags] Verify_LDAP_Service_Disable
Anves Kumar rayankula298b6842021-05-24 04:25:19 -0500116 [Teardown] Run Keywords Redfish.Logout AND Redfish.Login
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500117
118 ${status}= Run Keyword And Return Status
119 ... Checkbox Should Be Selected ${xpath_enable_ldap_checkbox}
120
121 Run Keyword If ${status} == ${True}
122 ... Click Element At Coordinates ${xpath_enable_ldap_checkbox} 0 0
123
124 Checkbox Should Not Be Selected ${xpath_enable_ldap_checkbox}
125 Click Element ${xpath_ldap_save_settings}
126 Wait Until Page Contains Successfully saved Open LDAP settings
127 Click Element ${xpath_refresh_button}
128 Wait Until Page Contains Element ${xpath_ldap_heading}
Anves Kumar rayankula298b6842021-05-24 04:25:19 -0500129 Redfish.Logout
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500130
Anves Kumar rayankula298b6842021-05-24 04:25:19 -0500131 ${resp}= Run Keyword And Return Status
132 ... Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500133 Should Be Equal ${resp} ${False}
134 ... msg=LDAP user was able to login even though the LDAP service was disabled.
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500135
136
Anves Kumar rayankulab44c9572021-04-27 00:44:06 -0500137Verify LDAP User With Admin Privilege
138 [Documentation] Verify that LDAP user with administrator privilege is able to do BMC reboot.
139 [Tags] Verify_LDAP_User_With_Admin_Privilege
140 [Teardown] Run Keywords Redfish.Login AND Delete LDAP Role Group ${GROUP_NAME}
141
142 Update LDAP Configuration with LDAP User Role And Group ${GROUP_NAME} ${GROUP_PRIVILEGE}
143 Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
144 Redfish OBMC Reboot (off)
145 Redfish.Logout
146
147
Anves Kumar rayankula454b7912021-06-21 06:54:23 -0500148Verify Enabling LDAP
149 [Documentation] Verify that LDAP can be enabled from disabled state.
150 [Tags] Verify_Enabling_LDAP
151
152 Disable LDAP Configuration
153 Create LDAP Configuration
154
155
Anves Kumar rayankula272acf42021-06-23 01:51:24 -0500156Read Network Configuration Via Different User Roles And Verify Using GUI
157 [Documentation] Read network configuration via different user roles and verify.
158 [Tags] Read_Network_Configuration_Via_Different_User_Roles_And_Verify_Using_GUI
159 [Template] Update LDAP User Role And Read Network Configuration Via GUI
160
161 # group_name user_role valid_status_code
162 ${GROUP_NAME} Administrator ${HTTP_OK}
163 ${GROUP_NAME} Operator ${HTTP_OK}
164 ${GROUP_NAME} ReadOnly ${HTTP_OK}
165 ${GROUP_NAME} NoAccess ${HTTP_FORBIDDEN}
166
167
Sushma M Mef474f42020-07-29 16:25:39 -0500168*** Keywords ***
169
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500170Suite Setup Execution
Sushma M Mef474f42020-07-29 16:25:39 -0500171 [Documentation] Do test case setup tasks.
172
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500173 Launch Browser And Login GUI
174
Sushma M Mef474f42020-07-29 16:25:39 -0500175 # Navigate to https://xx.xx.xx.xx/#/access-control/ldap LDAP page.
Sushma M Mef474f42020-07-29 16:25:39 -0500176 Click Element ${xpath_access_control_menu}
177 Click Element ${xpath_ldap_sub_menu}
178 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain ldap
Anves Kumar rayankula272acf42021-06-23 01:51:24 -0500179 Element Should Be Enabled ${xpath_enable_ldap_checkbox}
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500180
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500181 Valid Value LDAP_TYPE valid_values=["ActiveDirectory", "LDAP"]
182 Valid Value LDAP_USER
183 Valid Value LDAP_USER_PASSWORD
184 Valid Value GROUP_PRIVILEGE
185 Valid Value GROUP_NAME
186 Valid Value LDAP_SERVER_URI
187 Valid Value LDAP_BIND_DN_PASSWORD
188 Valid Value LDAP_BIND_DN
189 Valid Value LDAP_BASE_DN
190 Valid Value LDAP_MODE valid_values=["secure", "nonsecure"]
191
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500192
193Create LDAP Configuration
194 [Documentation] Create LDAP configuration.
195 [Arguments] ${ldap_server_uri}=${LDAP_SERVER_URI} ${ldap_servicetype}=${LDAP_TYPE}
196 ... ${ldap_bind_dn}=${LDAP_BIND_DN} ${ldap_bind_dn_password}=${LDAP_BIND_DN_PASSWORD}
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500197 ... ${ldap_base_dn}=${LDAP_BASE_DN} ${ldap_mode}=${LDAP_MODE}
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500198
199 # Description of argument(s):
200 # ldap_server_uri LDAP server uri (e.g. ldap://XX.XX.XX.XX).
201 # ldap_type The LDAP type ("ActiveDirectory" or "LDAP").
202 # ldap_bind_dn The LDAP bind distinguished name.
203 # ldap_bind_dn_password The LDAP bind distinguished name password.
204 # ldap_base_dn The LDAP base distinguished name.
205
206 Select Checkbox ${xpath_enable_ldap_checkbox}
207 Checkbox Should Be Selected ${xpath_enable_ldap_checkbox}
208 ${radio_buttons}= Get WebElements ${xpath_service_radio_button}
209
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500210 Run Keyword If '${ldap_service_type}' == 'LDAP'
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500211 ... Click Element At Coordinates ${radio_buttons}[${0}] 0 0
212 ... ELSE Click Element At Coordinates ${radio_buttons}[${1}] 0 0
213
214 Wait Until Page Contains Element ${xpath_ldap_url}
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500215 Run Keyword If '${ldap_mode}' == 'secure'
216 ... Click Element At Coordinates ${xpath_secure_ldap_checkbox} 0 0
217 ... ELSE Unselect Checkbox ${xpath_secure_ldap_checkbox}
218
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500219 Input Text ${xpath_ldap_url} ${ldap_server_uri}
220 Input Text ${xpath_ldap_bind_dn} ${ldap_bind_dn}
221 Input Text ${xpath_ldap_password} ${ldap_bind_dn_password}
222 Input Text ${xpath_ldap_base_dn} ${ldap_base_dn}
223 Click Element ${xpath_ldap_save_settings}
224
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500225 Run Keyword If '${ldap_service_type}'=='LDAP'
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500226 ... Wait Until Page Contains Successfully saved Open LDAP settings
227 ... ELSE
228 ... Wait Until Page Contains Successfully saved Active Directory settings
229
230 Click Element ${xpath_refresh_button}
231 Wait Until Page Contains Element ${xpath_ldap_heading}
232
233
234Get LDAP Configuration
235 [Documentation] Retrieve LDAP Configuration.
236 [Arguments] ${ldap_type}
237
238 # Description of argument(s):
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500239 # ldap_type The LDAP type ("ActiveDirectory" or "LDAP").
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500240
241 ${radio_buttons}= Get WebElements ${xpath_service_radio_button}
242
243 ${status}= Run Keyword And Return Status
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500244 ... Run Keyword If '${ldap_type}'=='LDAP'
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500245 ... Checkbox Should Be Selected ${radio_buttons}[${0}]
246 ... ELSE
247 ... Checkbox Should Be Selected ${radio_buttons}[${1}]
248 Should Be Equal ${status} ${True}
Anves Kumar rayankulab44c9572021-04-27 00:44:06 -0500249
250
251Update LDAP Configuration With LDAP User Role And Group
252 [Documentation] Update LDAP configuration update with LDAP user role and group.
253 [Arguments] ${group_name} ${group_privilege}
254
255 # Description of argument(s):
256 # group_name The group name of LDAP user.
257 # group_privilege The group privilege for LDAP user
258 # (e.g. "Administrator", "Operator", "ReadOnly" or "NoAcccess").
259
260 Create LDAP Configuration
261 Click Element ${xpath_add_role_group_button}
262 Input Text ${xpath_add_group_name} ${group_name}
263 Select From List By Value ${xpath_add_group_Privilege} ${group_privilege}
264 Click Element ${xpath_add_privilege_button}
265
266 # Verify group name after adding.
267 ${ldap_group_name}= Get LDAP Privilege And Group Name Via Redfish
268 List Should Contain Value ${ldap_group_name} ${group_name}
269
270
271Delete LDAP Role Group
272 [Documentation] Delete LDAP role group.
273 [Arguments] ${group_name}
274
275 # Description of argument(s):
276 # group_name The group name of LDAP user.
277
278 # Verify given group name is exist before deleting.
279 ${ldap_group_name}= Get LDAP Privilege And Group Name Via Redfish
280 List Should Contain Value ${ldap_group_name} ${group_name} msg=${group_name} not available.
281
282 ${get_groupname_index}= Get Index From List ${ldap_group_name} ${group_name}
283 ${delete_group_elements}= Get WebElements ${xpath_delete_group_button}
284 Click Element ${delete_group_elements}[${get_groupname_index}]
285 Click Element ${xpath_delete_button}
286
287 # Verify group name after deleting.
288 ${ldap_group_name}= Get LDAP Privilege And Group Name Via Redfish
289 List Should Not Contain Value ${ldap_group_name} ${group_name} msg=${group_name} not available.
Anves Kumar rayankula454b7912021-06-21 06:54:23 -0500290
291
292Disable LDAP Configuration
293 [Documentation] Disable LDAP configuration on BMC.
294
295 ${status}= Run Keyword And Return Status
296 ... Checkbox Should Be Selected ${xpath_enable_ldap_checkbox}
297
298 Run Keyword If ${status} == ${True}
299 ... Click Element At Coordinates ${xpath_enable_ldap_checkbox} 0 0
300
301 Checkbox Should Not Be Selected ${xpath_enable_ldap_checkbox}
302 Click Element ${xpath_ldap_save_settings}
303 Wait Until Page Contains Successfully saved Open LDAP settings
304 Click Element ${xpath_refresh_button}
305 Wait Until Page Contains Element ${xpath_ldap_heading}
306
Anves Kumar rayankula272acf42021-06-23 01:51:24 -0500307
308Login BMC And Navigate To LDAP Page
309 [Documentation] Login BMC and navigate to ldap page.
310 [Arguments] ${username}=${OPENBMC_USERNAME} ${password}=${OPENBMC_PASSWORD}
311
312 # Description of argument(s):
313 # username The username to be used for login.
314 # password The password to be used for login.
315
316 Login GUI ${username} ${password}
317 # Navigate to https://xx.xx.xx.xx/#/access-control/ldap LDAP page.
318 Click Element ${xpath_access_control_menu}
319 Click Element ${xpath_ldap_sub_menu}
320 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain ldap
321
322
323Update LDAP User Role And Read Network Configuration Via GUI
324 [Documentation] Update LDAP user role and read network configuration via GUI.
325 [Arguments] ${group_name} ${user_role} ${valid_status_codes}
326 [Teardown] Run Keywords Logout GUI AND Login BMC And Navigate To LDAP Page
327 ... AND Delete LDAP Role Group ${group_name}
328
329 # Description of argument(s):
330 # group_privilege The group privilege ("Administrator", "Operator", "ReadOnly" or "NoAccess").
331 # group_name The group name of user.
332 # valid_status_code The expected valid status code.
333
334
335 Update LDAP Configuration with LDAP User Role And Group ${group_name} ${user_role}
336 Logout GUI
337 Login GUI ${LDAP_USER} ${LDAP_USER_PASSWORD}
338 Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
339
340 Click Element ${xpath_server_configuration}
341 Click Element ${xpath_select_network_settings}
342 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network-settings
343
344 ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI} valid_status_codes=[${valid_status_codes}]
345 Return From Keyword If ${valid_status_codes} == ${HTTP_FORBIDDEN}
346
347 ${host_name}= Redfish.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName
348 Textfield Value Should Be ${xpath_hostname_input} ${host_name}
349
350 ${mac_address}= Redfish.Get Attribute ${REDFISH_NW_ETH0_URI} MACAddress
351 Textfield Value Should Be ${xpath_mac_address_input} ${mac_address}