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 | |
| 7 | Suite Setup Launch Browser And Login GUI |
| 8 | Suite Teardown Close Browser |
| 9 | Test Setup Test Setup Execution |
| 10 | |
| 11 | |
| 12 | *** Variables *** |
| 13 | |
Sushma M M | 2630299 | 2020-08-31 01:15:26 -0500 | [diff] [blame] | 14 | ${xpath_ldap_heading} //h1[text()="LDAP"] |
Rahul Maheshwari | 062dceb | 2021-01-19 04:16:30 -0600 | [diff] [blame] | 15 | ${xpath_enable_ldap_checkbox} //*[@data-test-id='ldap-checkbox-ldapAuthenticationEnabled'] |
| 16 | ${xpath_secure_ldap_checkbox} //*[@data-test-id='ldap-checkbox-secureLdapEnabled'] |
Sushma M M | ef474f4 | 2020-07-29 16:25:39 -0500 | [diff] [blame] | 17 | ${xpath_service_radio_button} //*[@data-test-id="ldap-radio-activeDirectoryEnabled"] |
| 18 | ${xpath_add_role_group_button} //button[contains(text(),'Add role group')] |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 19 | ${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 Maheshwari | 062dceb | 2021-01-19 04:16:30 -0600 | [diff] [blame] | 25 | |
Anves Kumar rayankula | 298b684 | 2021-05-24 04:25:19 -0500 | [diff] [blame^] | 26 | |
| 27 | ${incorrect_ip} 1.2.3.4 |
| 28 | |
Sushma M M | ef474f4 | 2020-07-29 16:25:39 -0500 | [diff] [blame] | 29 | *** Test Cases *** |
| 30 | |
Sushma M M | 2630299 | 2020-08-31 01:15:26 -0500 | [diff] [blame] | 31 | Verify 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 M | ef474f4 | 2020-07-29 16:25:39 -0500 | [diff] [blame] | 38 | Verify 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 | |
| 46 | Verify 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 | |
| 58 | Verify 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 rayankula | 298b684 | 2021-05-24 04:25:19 -0500 | [diff] [blame^] | 67 | Verify 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 rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 80 | Verify Create LDAP Configuration |
| 81 | [Documentation] Verify created LDAP configuration. |
| 82 | [Tags] Verify_Created_LDAP_Configuration |
Anves Kumar rayankula | 298b684 | 2021-05-24 04:25:19 -0500 | [diff] [blame^] | 83 | [Teardown] Run Keywords Redfish.Logout AND Redfish.Login |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 84 | |
| 85 | Create LDAP Configuration |
| 86 | Get LDAP Configuration ${LDAP_TYPE} |
Anves Kumar rayankula | 298b684 | 2021-05-24 04:25:19 -0500 | [diff] [blame^] | 87 | Redfish.Logut |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 88 | Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD} |
Anves Kumar rayankula | 298b684 | 2021-05-24 04:25:19 -0500 | [diff] [blame^] | 89 | |
| 90 | |
| 91 | Verify 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 rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 100 | Redfish.Logout |
Anves Kumar rayankula | 298b684 | 2021-05-24 04:25:19 -0500 | [diff] [blame^] | 101 | |
| 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 rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 106 | |
Anves Kumar rayankula | 9575276 | 2021-04-06 05:14:55 -0500 | [diff] [blame] | 107 | |
| 108 | Verify LDAP Service Disable |
| 109 | [Documentation] Verify that LDAP user cannot login when LDAP service is disabled. |
| 110 | [Tags] Verify_LDAP_Service_Disable |
Anves Kumar rayankula | 298b684 | 2021-05-24 04:25:19 -0500 | [diff] [blame^] | 111 | [Teardown] Run Keywords Redfish.Logout AND Redfish.Login |
Anves Kumar rayankula | 9575276 | 2021-04-06 05:14:55 -0500 | [diff] [blame] | 112 | |
| 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 rayankula | 298b684 | 2021-05-24 04:25:19 -0500 | [diff] [blame^] | 124 | Redfish.Logout |
Anves Kumar rayankula | 9575276 | 2021-04-06 05:14:55 -0500 | [diff] [blame] | 125 | |
Anves Kumar rayankula | 298b684 | 2021-05-24 04:25:19 -0500 | [diff] [blame^] | 126 | ${resp}= Run Keyword And Return Status |
| 127 | ... Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD} |
Anves Kumar rayankula | 9575276 | 2021-04-06 05:14:55 -0500 | [diff] [blame] | 128 | Should Be Equal ${resp} ${False} |
| 129 | ... 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] | 130 | |
| 131 | |
Sushma M M | ef474f4 | 2020-07-29 16:25:39 -0500 | [diff] [blame] | 132 | *** Keywords *** |
| 133 | |
| 134 | Test 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 rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 142 | |
| 143 | |
| 144 | Create 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 rayankula | 30a6245 | 2021-05-17 00:27:21 -0500 | [diff] [blame] | 161 | Run Keyword If '${ldap_service_type}' == 'LDAP' |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 162 | ... 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 rayankula | 30a6245 | 2021-05-17 00:27:21 -0500 | [diff] [blame] | 172 | Run Keyword If '${ldap_service_type}'=='LDAP' |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 173 | ... 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 | |
| 181 | Get LDAP Configuration |
| 182 | [Documentation] Retrieve LDAP Configuration. |
| 183 | [Arguments] ${ldap_type} |
| 184 | |
| 185 | # Description of argument(s): |
Anves Kumar rayankula | 30a6245 | 2021-05-17 00:27:21 -0500 | [diff] [blame] | 186 | # ldap_type The LDAP type ("ActiveDirectory" or "LDAP"). |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 187 | |
| 188 | ${radio_buttons}= Get WebElements ${xpath_service_radio_button} |
| 189 | |
| 190 | ${status}= Run Keyword And Return Status |
Anves Kumar rayankula | 30a6245 | 2021-05-17 00:27:21 -0500 | [diff] [blame] | 191 | ... Run Keyword If '${ldap_type}'=='LDAP' |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 192 | ... Checkbox Should Be Selected ${radio_buttons}[${0}] |
| 193 | ... ELSE |
| 194 | ... Checkbox Should Be Selected ${radio_buttons}[${1}] |
| 195 | Should Be Equal ${status} ${True} |