blob: ee05cc83d1ba7290c39041ef0d647930d7f23ddd [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
7Suite Setup Launch Browser And Login GUI
8Suite Teardown Close Browser
9Test Setup Test Setup Execution
10
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")]]
Rahul Maheshwari062dceb2021-01-19 04:16:30 -060025
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050026
27${incorrect_ip} 1.2.3.4
28
Sushma M Mef474f42020-07-29 16:25:39 -050029*** Test Cases ***
30
Sushma M M26302992020-08-31 01:15:26 -050031Verify Navigation To LDAP Page
32 [Documentation] Verify navigation to LDAP page.
33 [Tags] Verify_Navigation_To_LDAP_Page
34
35 Page Should Contain Element ${xpath_ldap_heading}
36
37
Sushma M Mef474f42020-07-29 16:25:39 -050038Verify Existence Of All Sections In LDAP Page
39 [Documentation] Verify existence of all sections in LDAP page.
40 [Tags] Verify_Existence_Of_All_Sections_In_LDAP_Page
41
42 Page Should Contain Settings
43 Page Should Contain Role groups
44
45
46Verify Existence Of All Buttons In LDAP Page
47 [Documentation] Verify existence of all buttons in LDAP page.
48 [Tags] Verify_Existence_Of_All_Buttons_In_LDAP_Page
49
50 # Buttons under settings section.
51 Page Should Contain Element ${xpath_service_radio_button}
52 Page Should Contain Element ${xpath_save_settings_button}
53
54 # Buttons under role groups section.
55 Page Should Contain Element ${xpath_add_role_group_button}
56
57
58Verify Existence Of All Checkboxes In LDAP Page
59 [Documentation] Verify existence of all checkboxes in LDAP page.
60 [Tags] Verify_Existence_Of_All_Checkboxes_In_LDAP_Page
61
62 # Checkboxes under settings section.
63 Page Should Contain Element ${xpath_enable_ldap_checkbox}
64 Page Should Contain Element ${xpath_secure_ldap_checkbox}
65
66
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050067Verify LDAP Configurations Editable
68 [Documentation] Verify LDAP configurations are editable.
69 [Tags] Verify_LDAP_Configurations_Editable
70
71 Create LDAP Configuration ${LDAP_SERVER_URI} ${LDAP_TYPE} ${LDAP_BIND_DN}
72 ... ${LDAP_BIND_DN_PASSWORD} ${LDAP_BASE_DN}
73 Wait Until Page Contains Element ${xpath_ldap_url}
74 Textfield Value Should Be ${xpath_ldap_url} ${LDAP_SERVER_URI}
75 Textfield Value Should Be ${xpath_ldap_bind_dn} ${LDAP_BIND_DN}
76 Textfield Value Should Be ${xpath_ldap_password} ${empty}
77 Textfield Value Should Be ${xpath_ldap_base_dn} ${LDAP_BASE_DN}
78
79
Anves Kumar rayankula47892a22021-03-26 03:57:02 -050080Verify Create LDAP Configuration
81 [Documentation] Verify created LDAP configuration.
82 [Tags] Verify_Created_LDAP_Configuration
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050083 [Teardown] Run Keywords Redfish.Logout AND Redfish.Login
Anves Kumar rayankula47892a22021-03-26 03:57:02 -050084
85 Create LDAP Configuration
86 Get LDAP Configuration ${LDAP_TYPE}
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050087 Redfish.Logut
Anves Kumar rayankula47892a22021-03-26 03:57:02 -050088 Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
Anves Kumar rayankula298b6842021-05-24 04:25:19 -050089
90
91Verify LDAP Config Update With Incorrect LDAP IP Address
92 [Documentation] Verify that LDAP login fails with incorrect LDAP IP Address.
93 [Tags] Verify_LDAP_Config_Update_With_Incorrect_LDAP_IP_Address
94 [Teardown] Run Keywords Redfish.Logout AND Redfish.Login
95
96 Create LDAP Configuration ${incorrect_ip} ${LDAP_TYPE} ${LDAP_BIND_DN}
97 ... ${LDAP_BIND_DN_PASSWORD} ${LDAP_BASE_DN}
98
99 Get LDAP Configuration ${LDAP_TYPE}
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500100 Redfish.Logout
Anves Kumar rayankula298b6842021-05-24 04:25:19 -0500101
102 ${resp}= Run Keyword And Return Status
103 ... Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
104 Should Be Equal ${resp} ${False}
105 ... msg=LDAP user was able to login though the incorrect LDAP IP Address.
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500106
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500107
108Verify LDAP Service Disable
109 [Documentation] Verify that LDAP user cannot login when LDAP service is disabled.
110 [Tags] Verify_LDAP_Service_Disable
Anves Kumar rayankula298b6842021-05-24 04:25:19 -0500111 [Teardown] Run Keywords Redfish.Logout AND Redfish.Login
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500112
113 ${status}= Run Keyword And Return Status
114 ... Checkbox Should Be Selected ${xpath_enable_ldap_checkbox}
115
116 Run Keyword If ${status} == ${True}
117 ... Click Element At Coordinates ${xpath_enable_ldap_checkbox} 0 0
118
119 Checkbox Should Not Be Selected ${xpath_enable_ldap_checkbox}
120 Click Element ${xpath_ldap_save_settings}
121 Wait Until Page Contains Successfully saved Open LDAP settings
122 Click Element ${xpath_refresh_button}
123 Wait Until Page Contains Element ${xpath_ldap_heading}
Anves Kumar rayankula298b6842021-05-24 04:25:19 -0500124 Redfish.Logout
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500125
Anves Kumar rayankula298b6842021-05-24 04:25:19 -0500126 ${resp}= Run Keyword And Return Status
127 ... Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500128 Should Be Equal ${resp} ${False}
129 ... msg=LDAP user was able to login even though the LDAP service was disabled.
Anves Kumar rayankula95752762021-04-06 05:14:55 -0500130
131
Sushma M Mef474f42020-07-29 16:25:39 -0500132*** Keywords ***
133
134Test Setup Execution
135 [Documentation] Do test case setup tasks.
136
137 # Navigate to https://xx.xx.xx.xx/#/access-control/ldap LDAP page.
138
139 Click Element ${xpath_access_control_menu}
140 Click Element ${xpath_ldap_sub_menu}
141 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain ldap
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500142
143
144Create LDAP Configuration
145 [Documentation] Create LDAP configuration.
146 [Arguments] ${ldap_server_uri}=${LDAP_SERVER_URI} ${ldap_servicetype}=${LDAP_TYPE}
147 ... ${ldap_bind_dn}=${LDAP_BIND_DN} ${ldap_bind_dn_password}=${LDAP_BIND_DN_PASSWORD}
148 ... ${ldap_base_dn}=${LDAP_BASE_DN}
149
150 # Description of argument(s):
151 # ldap_server_uri LDAP server uri (e.g. ldap://XX.XX.XX.XX).
152 # ldap_type The LDAP type ("ActiveDirectory" or "LDAP").
153 # ldap_bind_dn The LDAP bind distinguished name.
154 # ldap_bind_dn_password The LDAP bind distinguished name password.
155 # ldap_base_dn The LDAP base distinguished name.
156
157 Select Checkbox ${xpath_enable_ldap_checkbox}
158 Checkbox Should Be Selected ${xpath_enable_ldap_checkbox}
159 ${radio_buttons}= Get WebElements ${xpath_service_radio_button}
160
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500161 Run Keyword If '${ldap_service_type}' == 'LDAP'
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500162 ... Click Element At Coordinates ${radio_buttons}[${0}] 0 0
163 ... ELSE Click Element At Coordinates ${radio_buttons}[${1}] 0 0
164
165 Wait Until Page Contains Element ${xpath_ldap_url}
166 Input Text ${xpath_ldap_url} ${ldap_server_uri}
167 Input Text ${xpath_ldap_bind_dn} ${ldap_bind_dn}
168 Input Text ${xpath_ldap_password} ${ldap_bind_dn_password}
169 Input Text ${xpath_ldap_base_dn} ${ldap_base_dn}
170 Click Element ${xpath_ldap_save_settings}
171
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500172 Run Keyword If '${ldap_service_type}'=='LDAP'
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500173 ... Wait Until Page Contains Successfully saved Open LDAP settings
174 ... ELSE
175 ... Wait Until Page Contains Successfully saved Active Directory settings
176
177 Click Element ${xpath_refresh_button}
178 Wait Until Page Contains Element ${xpath_ldap_heading}
179
180
181Get LDAP Configuration
182 [Documentation] Retrieve LDAP Configuration.
183 [Arguments] ${ldap_type}
184
185 # Description of argument(s):
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500186 # ldap_type The LDAP type ("ActiveDirectory" or "LDAP").
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500187
188 ${radio_buttons}= Get WebElements ${xpath_service_radio_button}
189
190 ${status}= Run Keyword And Return Status
Anves Kumar rayankula30a62452021-05-17 00:27:21 -0500191 ... Run Keyword If '${ldap_type}'=='LDAP'
Anves Kumar rayankula47892a22021-03-26 03:57:02 -0500192 ... Checkbox Should Be Selected ${radio_buttons}[${0}]
193 ... ELSE
194 ... Checkbox Should Be Selected ${radio_buttons}[${1}]
195 Should Be Equal ${status} ${True}