Sushma M M | ef474f4 | 2020-07-29 16:25:39 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Test OpenBMC GUI "LDAP" sub-menu of "Access control". |
| 4 | |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 5 | Resource ../../lib/gui_resource.robot |
Sushma M M | ef474f4 | 2020-07-29 16:25:39 -0500 | [diff] [blame] | 6 | |
Anves Kumar rayankula | 010efe6 | 2021-06-09 09:00:58 -0500 | [diff] [blame^] | 7 | Suite Setup Suite Setup Execution |
Sushma M M | ef474f4 | 2020-07-29 16:25:39 -0500 | [diff] [blame] | 8 | Suite Teardown Close Browser |
Sushma M M | ef474f4 | 2020-07-29 16:25:39 -0500 | [diff] [blame] | 9 | |
| 10 | |
| 11 | *** Variables *** |
| 12 | |
Sushma M M | 2630299 | 2020-08-31 01:15:26 -0500 | [diff] [blame] | 13 | ${xpath_ldap_heading} //h1[text()="LDAP"] |
Rahul Maheshwari | 062dceb | 2021-01-19 04:16:30 -0600 | [diff] [blame] | 14 | ${xpath_enable_ldap_checkbox} //*[@data-test-id='ldap-checkbox-ldapAuthenticationEnabled'] |
| 15 | ${xpath_secure_ldap_checkbox} //*[@data-test-id='ldap-checkbox-secureLdapEnabled'] |
Sushma M M | ef474f4 | 2020-07-29 16:25:39 -0500 | [diff] [blame] | 16 | ${xpath_service_radio_button} //*[@data-test-id="ldap-radio-activeDirectoryEnabled"] |
| 17 | ${xpath_add_role_group_button} //button[contains(text(),'Add role group')] |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 18 | ${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 Maheshwari | 062dceb | 2021-01-19 04:16:30 -0600 | [diff] [blame] | 24 | |
Anves Kumar rayankula | 298b684 | 2021-05-24 04:25:19 -0500 | [diff] [blame] | 25 | |
| 26 | ${incorrect_ip} 1.2.3.4 |
| 27 | |
Sushma M M | ef474f4 | 2020-07-29 16:25:39 -0500 | [diff] [blame] | 28 | *** Test Cases *** |
| 29 | |
Sushma M M | 2630299 | 2020-08-31 01:15:26 -0500 | [diff] [blame] | 30 | Verify 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 M | ef474f4 | 2020-07-29 16:25:39 -0500 | [diff] [blame] | 37 | Verify 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 | |
| 45 | Verify 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 | |
| 57 | Verify 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 rayankula | 298b684 | 2021-05-24 04:25:19 -0500 | [diff] [blame] | 66 | Verify LDAP Configurations Editable |
| 67 | [Documentation] Verify LDAP configurations are editable. |
| 68 | [Tags] Verify_LDAP_Configurations_Editable |
| 69 | |
Anves Kumar rayankula | 010efe6 | 2021-06-09 09:00:58 -0500 | [diff] [blame^] | 70 | Create LDAP Configuration ${LDAP_SERVER_URI} ${LDAP_TYPE} ${LDAP_BIND_DN} |
Anves Kumar rayankula | 298b684 | 2021-05-24 04:25:19 -0500 | [diff] [blame] | 71 | ... ${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 rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 79 | Verify Create LDAP Configuration |
| 80 | [Documentation] Verify created LDAP configuration. |
| 81 | [Tags] Verify_Created_LDAP_Configuration |
Anves Kumar rayankula | 298b684 | 2021-05-24 04:25:19 -0500 | [diff] [blame] | 82 | [Teardown] Run Keywords Redfish.Logout AND Redfish.Login |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 83 | |
| 84 | Create LDAP Configuration |
| 85 | Get LDAP Configuration ${LDAP_TYPE} |
Anves Kumar rayankula | 010efe6 | 2021-06-09 09:00:58 -0500 | [diff] [blame^] | 86 | Redfish.Logout |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 87 | Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD} |
Anves Kumar rayankula | 298b684 | 2021-05-24 04:25:19 -0500 | [diff] [blame] | 88 | |
| 89 | |
| 90 | Verify 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 rayankula | 010efe6 | 2021-06-09 09:00:58 -0500 | [diff] [blame^] | 96 | ... ${LDAP_BIND_DN_PASSWORD} ${LDAP_BASE_DN} ${LDAP_MODE} |
Anves Kumar rayankula | 298b684 | 2021-05-24 04:25:19 -0500 | [diff] [blame] | 97 | |
| 98 | Get LDAP Configuration ${LDAP_TYPE} |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 99 | Redfish.Logout |
Anves Kumar rayankula | 298b684 | 2021-05-24 04:25:19 -0500 | [diff] [blame] | 100 | |
| 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 rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 105 | |
Anves Kumar rayankula | 9575276 | 2021-04-06 05:14:55 -0500 | [diff] [blame] | 106 | |
| 107 | Verify LDAP Service Disable |
| 108 | [Documentation] Verify that LDAP user cannot login when LDAP service is disabled. |
| 109 | [Tags] Verify_LDAP_Service_Disable |
Anves Kumar rayankula | 298b684 | 2021-05-24 04:25:19 -0500 | [diff] [blame] | 110 | [Teardown] Run Keywords Redfish.Logout AND Redfish.Login |
Anves Kumar rayankula | 9575276 | 2021-04-06 05:14:55 -0500 | [diff] [blame] | 111 | |
| 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 rayankula | 298b684 | 2021-05-24 04:25:19 -0500 | [diff] [blame] | 123 | Redfish.Logout |
Anves Kumar rayankula | 9575276 | 2021-04-06 05:14:55 -0500 | [diff] [blame] | 124 | |
Anves Kumar rayankula | 298b684 | 2021-05-24 04:25:19 -0500 | [diff] [blame] | 125 | ${resp}= Run Keyword And Return Status |
| 126 | ... Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD} |
Anves Kumar rayankula | 9575276 | 2021-04-06 05:14:55 -0500 | [diff] [blame] | 127 | Should Be Equal ${resp} ${False} |
| 128 | ... msg=LDAP user was able to login even though the LDAP service was disabled. |
Anves Kumar rayankula | 9575276 | 2021-04-06 05:14:55 -0500 | [diff] [blame] | 129 | |
| 130 | |
Sushma M M | ef474f4 | 2020-07-29 16:25:39 -0500 | [diff] [blame] | 131 | *** Keywords *** |
| 132 | |
Anves Kumar rayankula | 010efe6 | 2021-06-09 09:00:58 -0500 | [diff] [blame^] | 133 | Suite Setup Execution |
Sushma M M | ef474f4 | 2020-07-29 16:25:39 -0500 | [diff] [blame] | 134 | [Documentation] Do test case setup tasks. |
| 135 | |
Anves Kumar rayankula | 010efe6 | 2021-06-09 09:00:58 -0500 | [diff] [blame^] | 136 | Launch Browser And Login GUI |
| 137 | |
Sushma M M | ef474f4 | 2020-07-29 16:25:39 -0500 | [diff] [blame] | 138 | # 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 rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 143 | |
Anves Kumar rayankula | 010efe6 | 2021-06-09 09:00:58 -0500 | [diff] [blame^] | 144 | 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 rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 155 | |
| 156 | Create 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 rayankula | 010efe6 | 2021-06-09 09:00:58 -0500 | [diff] [blame^] | 160 | ... ${ldap_base_dn}=${LDAP_BASE_DN} ${ldap_mode}=${LDAP_MODE} |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 161 | |
| 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 rayankula | 30a6245 | 2021-05-17 00:27:21 -0500 | [diff] [blame] | 173 | Run Keyword If '${ldap_service_type}' == 'LDAP' |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 174 | ... 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 rayankula | 010efe6 | 2021-06-09 09:00:58 -0500 | [diff] [blame^] | 178 | 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 rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 182 | 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 rayankula | 30a6245 | 2021-05-17 00:27:21 -0500 | [diff] [blame] | 188 | Run Keyword If '${ldap_service_type}'=='LDAP' |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 189 | ... 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 | |
| 197 | Get LDAP Configuration |
| 198 | [Documentation] Retrieve LDAP Configuration. |
| 199 | [Arguments] ${ldap_type} |
| 200 | |
| 201 | # Description of argument(s): |
Anves Kumar rayankula | 30a6245 | 2021-05-17 00:27:21 -0500 | [diff] [blame] | 202 | # ldap_type The LDAP type ("ActiveDirectory" or "LDAP"). |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 203 | |
| 204 | ${radio_buttons}= Get WebElements ${xpath_service_radio_button} |
| 205 | |
| 206 | ${status}= Run Keyword And Return Status |
Anves Kumar rayankula | 30a6245 | 2021-05-17 00:27:21 -0500 | [diff] [blame] | 207 | ... Run Keyword If '${ldap_type}'=='LDAP' |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 208 | ... Checkbox Should Be Selected ${radio_buttons}[${0}] |
| 209 | ... ELSE |
| 210 | ... Checkbox Should Be Selected ${radio_buttons}[${1}] |
| 211 | Should Be Equal ${status} ${True} |