blob: f12e73f1ed2120c9b1e89f920615537c7a9d90d7 [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
Sushma M Mef474f42020-07-29 16:25:39 -05006
Anves Kumar rayankula010efe62021-06-09 09:00:58 -05007Suite Setup Suite Setup Execution
Sushma M Mef474f42020-07-29 16:25:39 -05008Suite Teardown Close Browser
Sushma M Mef474f42020-07-29 16:25:39 -05009
10
11*** Variables ***
12
Sushma M M26302992020-08-31 01:15:26 -050013${xpath_ldap_heading} //h1[text()="LDAP"]
Rahul Maheshwari062dceb2021-01-19 04:16:30 -060014${xpath_enable_ldap_checkbox} //*[@data-test-id='ldap-checkbox-ldapAuthenticationEnabled']
15${xpath_secure_ldap_checkbox} //*[@data-test-id='ldap-checkbox-secureLdapEnabled']
Sushma M Mef474f42020-07-29 16:25:39 -050016${xpath_service_radio_button} //*[@data-test-id="ldap-radio-activeDirectoryEnabled"]
17${xpath_add_role_group_button} //button[contains(text(),'Add role group')]
Anves Kumar rayankula47892a22021-03-26 03:57:02 -050018${xpath_ldap_url} //*[@data-test-id='ldap-input-serverUri']
19${xpath_ldap_bind_dn} //*[@data-test-id='ldap-input-bindDn']
20${xpath_ldap_password} //*[@id='bind-password']
21${xpath_ldap_base_dn} //*[@data-test-id='ldap-input-baseDn']
22${xpath_ldap_save_settings} //*[@data-test-id='ldap-button-saveSettings']
23${xpath_select_refresh_button} //*[text()[contains(.,"Refresh")]]
Rahul Maheshwari062dceb2021-01-19 04:16:30 -060024
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050025
26${incorrect_ip} 1.2.3.4
27
Sushma M Mef474f42020-07-29 16:25:39 -050028*** Test Cases ***
29
Sushma M M26302992020-08-31 01:15:26 -050030Verify Navigation To LDAP Page
31 [Documentation] Verify navigation to LDAP page.
32 [Tags] Verify_Navigation_To_LDAP_Page
33
34 Page Should Contain Element ${xpath_ldap_heading}
35
36
Sushma M Mef474f42020-07-29 16:25:39 -050037Verify Existence Of All Sections In LDAP Page
38 [Documentation] Verify existence of all sections in LDAP page.
39 [Tags] Verify_Existence_Of_All_Sections_In_LDAP_Page
40
41 Page Should Contain Settings
42 Page Should Contain Role groups
43
44
45Verify Existence Of All Buttons In LDAP Page
46 [Documentation] Verify existence of all buttons in LDAP page.
47 [Tags] Verify_Existence_Of_All_Buttons_In_LDAP_Page
48
49 # Buttons under settings section.
50 Page Should Contain Element ${xpath_service_radio_button}
51 Page Should Contain Element ${xpath_save_settings_button}
52
53 # Buttons under role groups section.
54 Page Should Contain Element ${xpath_add_role_group_button}
55
56
57Verify Existence Of All Checkboxes In LDAP Page
58 [Documentation] Verify existence of all checkboxes in LDAP page.
59 [Tags] Verify_Existence_Of_All_Checkboxes_In_LDAP_Page
60
61 # Checkboxes under settings section.
62 Page Should Contain Element ${xpath_enable_ldap_checkbox}
63 Page Should Contain Element ${xpath_secure_ldap_checkbox}
64
65
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050066Verify LDAP Configurations Editable
67 [Documentation] Verify LDAP configurations are editable.
68 [Tags] Verify_LDAP_Configurations_Editable
69
Anves Kumar rayankula010efe62021-06-09 09:00:58 -050070 Create LDAP Configuration ${LDAP_SERVER_URI} ${LDAP_TYPE} ${LDAP_BIND_DN}
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050071 ... ${LDAP_BIND_DN_PASSWORD} ${LDAP_BASE_DN}
72 Wait Until Page Contains Element ${xpath_ldap_url}
73 Textfield Value Should Be ${xpath_ldap_url} ${LDAP_SERVER_URI}
74 Textfield Value Should Be ${xpath_ldap_bind_dn} ${LDAP_BIND_DN}
75 Textfield Value Should Be ${xpath_ldap_password} ${empty}
76 Textfield Value Should Be ${xpath_ldap_base_dn} ${LDAP_BASE_DN}
77
78
Anves Kumar rayankula47892a22021-03-26 03:57:02 -050079Verify Create LDAP Configuration
80 [Documentation] Verify created LDAP configuration.
81 [Tags] Verify_Created_LDAP_Configuration
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050082 [Teardown] Run Keywords Redfish.Logout AND Redfish.Login
Anves Kumar rayankula47892a22021-03-26 03:57:02 -050083
84 Create LDAP Configuration
85 Get LDAP Configuration ${LDAP_TYPE}
Anves Kumar rayankula010efe62021-06-09 09:00:58 -050086 Redfish.Logout
Anves Kumar rayankula47892a22021-03-26 03:57:02 -050087 Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050088
89
90Verify LDAP Config Update With Incorrect LDAP IP Address
91 [Documentation] Verify that LDAP login fails with incorrect LDAP IP Address.
92 [Tags] Verify_LDAP_Config_Update_With_Incorrect_LDAP_IP_Address
93 [Teardown] Run Keywords Redfish.Logout AND Redfish.Login
94
95 Create LDAP Configuration ${incorrect_ip} ${LDAP_TYPE} ${LDAP_BIND_DN}
Anves Kumar rayankula010efe62021-06-09 09:00:58 -050096 ... ${LDAP_BIND_DN_PASSWORD} ${LDAP_BASE_DN} ${LDAP_MODE}
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050097
98 Get LDAP Configuration ${LDAP_TYPE}
Anves Kumar rayankula47892a22021-03-26 03:57:02 -050099 Redfish.Logout
Anves Kumar rayankula298b6842021-05-24 04:25:19 -0500100
101 ${resp}= Run Keyword And Return Status
102 ... Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
103 Should Be Equal ${resp} ${False}
104 ... msg=LDAP user was able to login though the incorrect LDAP IP Address.
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500105
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500106
107Verify LDAP Service Disable
108 [Documentation] Verify that LDAP user cannot login when LDAP service is disabled.
109 [Tags] Verify_LDAP_Service_Disable
Anves Kumar rayankula298b6842021-05-24 04:25:19 -0500110 [Teardown] Run Keywords Redfish.Logout AND Redfish.Login
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500111
112 ${status}= Run Keyword And Return Status
113 ... Checkbox Should Be Selected ${xpath_enable_ldap_checkbox}
114
115 Run Keyword If ${status} == ${True}
116 ... Click Element At Coordinates ${xpath_enable_ldap_checkbox} 0 0
117
118 Checkbox Should Not Be Selected ${xpath_enable_ldap_checkbox}
119 Click Element ${xpath_ldap_save_settings}
120 Wait Until Page Contains Successfully saved Open LDAP settings
121 Click Element ${xpath_refresh_button}
122 Wait Until Page Contains Element ${xpath_ldap_heading}
Anves Kumar rayankula298b6842021-05-24 04:25:19 -0500123 Redfish.Logout
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500124
Anves Kumar rayankula298b6842021-05-24 04:25:19 -0500125 ${resp}= Run Keyword And Return Status
126 ... Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500127 Should Be Equal ${resp} ${False}
128 ... msg=LDAP user was able to login even though the LDAP service was disabled.
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500129
130
Sushma M Mef474f42020-07-29 16:25:39 -0500131*** Keywords ***
132
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500133Suite Setup Execution
Sushma M Mef474f42020-07-29 16:25:39 -0500134 [Documentation] Do test case setup tasks.
135
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500136 Launch Browser And Login GUI
137
Sushma M Mef474f42020-07-29 16:25:39 -0500138 # Navigate to https://xx.xx.xx.xx/#/access-control/ldap LDAP page.
139
140 Click Element ${xpath_access_control_menu}
141 Click Element ${xpath_ldap_sub_menu}
142 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain ldap
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500143
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500144 Valid Value LDAP_TYPE valid_values=["ActiveDirectory", "LDAP"]
145 Valid Value LDAP_USER
146 Valid Value LDAP_USER_PASSWORD
147 Valid Value GROUP_PRIVILEGE
148 Valid Value GROUP_NAME
149 Valid Value LDAP_SERVER_URI
150 Valid Value LDAP_BIND_DN_PASSWORD
151 Valid Value LDAP_BIND_DN
152 Valid Value LDAP_BASE_DN
153 Valid Value LDAP_MODE valid_values=["secure", "nonsecure"]
154
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500155
156Create LDAP Configuration
157 [Documentation] Create LDAP configuration.
158 [Arguments] ${ldap_server_uri}=${LDAP_SERVER_URI} ${ldap_servicetype}=${LDAP_TYPE}
159 ... ${ldap_bind_dn}=${LDAP_BIND_DN} ${ldap_bind_dn_password}=${LDAP_BIND_DN_PASSWORD}
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500160 ... ${ldap_base_dn}=${LDAP_BASE_DN} ${ldap_mode}=${LDAP_MODE}
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500161
162 # Description of argument(s):
163 # ldap_server_uri LDAP server uri (e.g. ldap://XX.XX.XX.XX).
164 # ldap_type The LDAP type ("ActiveDirectory" or "LDAP").
165 # ldap_bind_dn The LDAP bind distinguished name.
166 # ldap_bind_dn_password The LDAP bind distinguished name password.
167 # ldap_base_dn The LDAP base distinguished name.
168
169 Select Checkbox ${xpath_enable_ldap_checkbox}
170 Checkbox Should Be Selected ${xpath_enable_ldap_checkbox}
171 ${radio_buttons}= Get WebElements ${xpath_service_radio_button}
172
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500173 Run Keyword If '${ldap_service_type}' == 'LDAP'
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500174 ... Click Element At Coordinates ${radio_buttons}[${0}] 0 0
175 ... ELSE Click Element At Coordinates ${radio_buttons}[${1}] 0 0
176
177 Wait Until Page Contains Element ${xpath_ldap_url}
Anves Kumar rayankula010efe62021-06-09 09:00:58 -0500178 Run Keyword If '${ldap_mode}' == 'secure'
179 ... Click Element At Coordinates ${xpath_secure_ldap_checkbox} 0 0
180 ... ELSE Unselect Checkbox ${xpath_secure_ldap_checkbox}
181
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500182 Input Text ${xpath_ldap_url} ${ldap_server_uri}
183 Input Text ${xpath_ldap_bind_dn} ${ldap_bind_dn}
184 Input Text ${xpath_ldap_password} ${ldap_bind_dn_password}
185 Input Text ${xpath_ldap_base_dn} ${ldap_base_dn}
186 Click Element ${xpath_ldap_save_settings}
187
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500188 Run Keyword If '${ldap_service_type}'=='LDAP'
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500189 ... Wait Until Page Contains Successfully saved Open LDAP settings
190 ... ELSE
191 ... Wait Until Page Contains Successfully saved Active Directory settings
192
193 Click Element ${xpath_refresh_button}
194 Wait Until Page Contains Element ${xpath_ldap_heading}
195
196
197Get LDAP Configuration
198 [Documentation] Retrieve LDAP Configuration.
199 [Arguments] ${ldap_type}
200
201 # Description of argument(s):
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500202 # ldap_type The LDAP type ("ActiveDirectory" or "LDAP").
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500203
204 ${radio_buttons}= Get WebElements ${xpath_service_radio_button}
205
206 ${status}= Run Keyword And Return Status
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500207 ... Run Keyword If '${ldap_type}'=='LDAP'
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500208 ... Checkbox Should Be Selected ${radio_buttons}[${0}]
209 ... ELSE
210 ... Checkbox Should Be Selected ${radio_buttons}[${1}]
211 Should Be Equal ${status} ${True}