blob: adf5c9a7177d224b272c8a958fba0f8ec19c03e1 [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
Sushma M Mef474f42020-07-29 16:25:39 -0500148*** Keywords ***
149
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500150Suite Setup Execution
Sushma M Mef474f42020-07-29 16:25:39 -0500151 [Documentation] Do test case setup tasks.
152
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500153 Launch Browser And Login GUI
154
Sushma M Mef474f42020-07-29 16:25:39 -0500155 # Navigate to https://xx.xx.xx.xx/#/access-control/ldap LDAP page.
Sushma M Mef474f42020-07-29 16:25:39 -0500156 Click Element ${xpath_access_control_menu}
157 Click Element ${xpath_ldap_sub_menu}
158 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain ldap
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500159
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500160 Valid Value LDAP_TYPE valid_values=["ActiveDirectory", "LDAP"]
161 Valid Value LDAP_USER
162 Valid Value LDAP_USER_PASSWORD
163 Valid Value GROUP_PRIVILEGE
164 Valid Value GROUP_NAME
165 Valid Value LDAP_SERVER_URI
166 Valid Value LDAP_BIND_DN_PASSWORD
167 Valid Value LDAP_BIND_DN
168 Valid Value LDAP_BASE_DN
169 Valid Value LDAP_MODE valid_values=["secure", "nonsecure"]
170
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500171
172Create LDAP Configuration
173 [Documentation] Create LDAP configuration.
174 [Arguments] ${ldap_server_uri}=${LDAP_SERVER_URI} ${ldap_servicetype}=${LDAP_TYPE}
175 ... ${ldap_bind_dn}=${LDAP_BIND_DN} ${ldap_bind_dn_password}=${LDAP_BIND_DN_PASSWORD}
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500176 ... ${ldap_base_dn}=${LDAP_BASE_DN} ${ldap_mode}=${LDAP_MODE}
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500177
178 # Description of argument(s):
179 # ldap_server_uri LDAP server uri (e.g. ldap://XX.XX.XX.XX).
180 # ldap_type The LDAP type ("ActiveDirectory" or "LDAP").
181 # ldap_bind_dn The LDAP bind distinguished name.
182 # ldap_bind_dn_password The LDAP bind distinguished name password.
183 # ldap_base_dn The LDAP base distinguished name.
184
185 Select Checkbox ${xpath_enable_ldap_checkbox}
186 Checkbox Should Be Selected ${xpath_enable_ldap_checkbox}
187 ${radio_buttons}= Get WebElements ${xpath_service_radio_button}
188
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500189 Run Keyword If '${ldap_service_type}' == 'LDAP'
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500190 ... Click Element At Coordinates ${radio_buttons}[${0}] 0 0
191 ... ELSE Click Element At Coordinates ${radio_buttons}[${1}] 0 0
192
193 Wait Until Page Contains Element ${xpath_ldap_url}
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500194 Run Keyword If '${ldap_mode}' == 'secure'
195 ... Click Element At Coordinates ${xpath_secure_ldap_checkbox} 0 0
196 ... ELSE Unselect Checkbox ${xpath_secure_ldap_checkbox}
197
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500198 Input Text ${xpath_ldap_url} ${ldap_server_uri}
199 Input Text ${xpath_ldap_bind_dn} ${ldap_bind_dn}
200 Input Text ${xpath_ldap_password} ${ldap_bind_dn_password}
201 Input Text ${xpath_ldap_base_dn} ${ldap_base_dn}
202 Click Element ${xpath_ldap_save_settings}
203
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500204 Run Keyword If '${ldap_service_type}'=='LDAP'
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500205 ... Wait Until Page Contains Successfully saved Open LDAP settings
206 ... ELSE
207 ... Wait Until Page Contains Successfully saved Active Directory settings
208
209 Click Element ${xpath_refresh_button}
210 Wait Until Page Contains Element ${xpath_ldap_heading}
211
212
213Get LDAP Configuration
214 [Documentation] Retrieve LDAP Configuration.
215 [Arguments] ${ldap_type}
216
217 # Description of argument(s):
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500218 # ldap_type The LDAP type ("ActiveDirectory" or "LDAP").
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500219
220 ${radio_buttons}= Get WebElements ${xpath_service_radio_button}
221
222 ${status}= Run Keyword And Return Status
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500223 ... Run Keyword If '${ldap_type}'=='LDAP'
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500224 ... Checkbox Should Be Selected ${radio_buttons}[${0}]
225 ... ELSE
226 ... Checkbox Should Be Selected ${radio_buttons}[${1}]
227 Should Be Equal ${status} ${True}
Anves Kumar rayankulab44c9572021-04-27 00:44:06 -0500228
229
230Update LDAP Configuration With LDAP User Role And Group
231 [Documentation] Update LDAP configuration update with LDAP user role and group.
232 [Arguments] ${group_name} ${group_privilege}
233
234 # Description of argument(s):
235 # group_name The group name of LDAP user.
236 # group_privilege The group privilege for LDAP user
237 # (e.g. "Administrator", "Operator", "ReadOnly" or "NoAcccess").
238
239 Create LDAP Configuration
240 Click Element ${xpath_add_role_group_button}
241 Input Text ${xpath_add_group_name} ${group_name}
242 Select From List By Value ${xpath_add_group_Privilege} ${group_privilege}
243 Click Element ${xpath_add_privilege_button}
244
245 # Verify group name after adding.
246 ${ldap_group_name}= Get LDAP Privilege And Group Name Via Redfish
247 List Should Contain Value ${ldap_group_name} ${group_name}
248
249
250Delete LDAP Role Group
251 [Documentation] Delete LDAP role group.
252 [Arguments] ${group_name}
253
254 # Description of argument(s):
255 # group_name The group name of LDAP user.
256
257 # Verify given group name is exist before deleting.
258 ${ldap_group_name}= Get LDAP Privilege And Group Name Via Redfish
259 List Should Contain Value ${ldap_group_name} ${group_name} msg=${group_name} not available.
260
261 ${get_groupname_index}= Get Index From List ${ldap_group_name} ${group_name}
262 ${delete_group_elements}= Get WebElements ${xpath_delete_group_button}
263 Click Element ${delete_group_elements}[${get_groupname_index}]
264 Click Element ${xpath_delete_button}
265
266 # Verify group name after deleting.
267 ${ldap_group_name}= Get LDAP Privilege And Group Name Via Redfish
268 List Should Not Contain Value ${ldap_group_name} ${group_name} msg=${group_name} not available.