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 | |
Sushma M M | ef474f4 | 2020-07-29 16:25:39 -0500 | [diff] [blame] | 26 | *** Test Cases *** |
| 27 | |
Sushma M M | 2630299 | 2020-08-31 01:15:26 -0500 | [diff] [blame] | 28 | Verify Navigation To LDAP Page |
| 29 | [Documentation] Verify navigation to LDAP page. |
| 30 | [Tags] Verify_Navigation_To_LDAP_Page |
| 31 | |
| 32 | Page Should Contain Element ${xpath_ldap_heading} |
| 33 | |
| 34 | |
Sushma M M | ef474f4 | 2020-07-29 16:25:39 -0500 | [diff] [blame] | 35 | Verify Existence Of All Sections In LDAP Page |
| 36 | [Documentation] Verify existence of all sections in LDAP page. |
| 37 | [Tags] Verify_Existence_Of_All_Sections_In_LDAP_Page |
| 38 | |
| 39 | Page Should Contain Settings |
| 40 | Page Should Contain Role groups |
| 41 | |
| 42 | |
| 43 | Verify Existence Of All Buttons In LDAP Page |
| 44 | [Documentation] Verify existence of all buttons in LDAP page. |
| 45 | [Tags] Verify_Existence_Of_All_Buttons_In_LDAP_Page |
| 46 | |
| 47 | # Buttons under settings section. |
| 48 | Page Should Contain Element ${xpath_service_radio_button} |
| 49 | Page Should Contain Element ${xpath_save_settings_button} |
| 50 | |
| 51 | # Buttons under role groups section. |
| 52 | Page Should Contain Element ${xpath_add_role_group_button} |
| 53 | |
| 54 | |
| 55 | Verify Existence Of All Checkboxes In LDAP Page |
| 56 | [Documentation] Verify existence of all checkboxes in LDAP page. |
| 57 | [Tags] Verify_Existence_Of_All_Checkboxes_In_LDAP_Page |
| 58 | |
| 59 | # Checkboxes under settings section. |
| 60 | Page Should Contain Element ${xpath_enable_ldap_checkbox} |
| 61 | Page Should Contain Element ${xpath_secure_ldap_checkbox} |
| 62 | |
| 63 | |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 64 | Verify Create LDAP Configuration |
| 65 | [Documentation] Verify created LDAP configuration. |
| 66 | [Tags] Verify_Created_LDAP_Configuration |
| 67 | |
| 68 | Create LDAP Configuration |
| 69 | Get LDAP Configuration ${LDAP_TYPE} |
| 70 | Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD} |
| 71 | Redfish.Logout |
| 72 | Redfish.Login |
| 73 | |
Anves Kumar rayankula | 9575276 | 2021-04-06 05:14:55 -0500 | [diff] [blame] | 74 | |
| 75 | Verify LDAP Service Disable |
| 76 | [Documentation] Verify that LDAP user cannot login when LDAP service is disabled. |
| 77 | [Tags] Verify_LDAP_Service_Disable |
| 78 | |
| 79 | ${status}= Run Keyword And Return Status |
| 80 | ... Checkbox Should Be Selected ${xpath_enable_ldap_checkbox} |
| 81 | |
| 82 | Run Keyword If ${status} == ${True} |
| 83 | ... Click Element At Coordinates ${xpath_enable_ldap_checkbox} 0 0 |
| 84 | |
| 85 | Checkbox Should Not Be Selected ${xpath_enable_ldap_checkbox} |
| 86 | Click Element ${xpath_ldap_save_settings} |
| 87 | Wait Until Page Contains Successfully saved Open LDAP settings |
| 88 | Click Element ${xpath_refresh_button} |
| 89 | Wait Until Page Contains Element ${xpath_ldap_heading} |
| 90 | |
| 91 | ${resp}= Run Keyword And Return Status Redfish.Login ${LDAP_USER} |
| 92 | ... ${LDAP_USER_PASSWORD} |
| 93 | Should Be Equal ${resp} ${False} |
| 94 | ... msg=LDAP user was able to login even though the LDAP service was disabled. |
| 95 | Redfish.Logout |
| 96 | |
| 97 | |
Sushma M M | ef474f4 | 2020-07-29 16:25:39 -0500 | [diff] [blame] | 98 | *** Keywords *** |
| 99 | |
| 100 | Test Setup Execution |
| 101 | [Documentation] Do test case setup tasks. |
| 102 | |
| 103 | # Navigate to https://xx.xx.xx.xx/#/access-control/ldap LDAP page. |
| 104 | |
| 105 | Click Element ${xpath_access_control_menu} |
| 106 | Click Element ${xpath_ldap_sub_menu} |
| 107 | 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] | 108 | |
| 109 | |
| 110 | Create LDAP Configuration |
| 111 | [Documentation] Create LDAP configuration. |
| 112 | [Arguments] ${ldap_server_uri}=${LDAP_SERVER_URI} ${ldap_servicetype}=${LDAP_TYPE} |
| 113 | ... ${ldap_bind_dn}=${LDAP_BIND_DN} ${ldap_bind_dn_password}=${LDAP_BIND_DN_PASSWORD} |
| 114 | ... ${ldap_base_dn}=${LDAP_BASE_DN} |
| 115 | |
| 116 | # Description of argument(s): |
| 117 | # ldap_server_uri LDAP server uri (e.g. ldap://XX.XX.XX.XX). |
| 118 | # ldap_type The LDAP type ("ActiveDirectory" or "LDAP"). |
| 119 | # ldap_bind_dn The LDAP bind distinguished name. |
| 120 | # ldap_bind_dn_password The LDAP bind distinguished name password. |
| 121 | # ldap_base_dn The LDAP base distinguished name. |
| 122 | |
| 123 | Select Checkbox ${xpath_enable_ldap_checkbox} |
| 124 | Checkbox Should Be Selected ${xpath_enable_ldap_checkbox} |
| 125 | ${radio_buttons}= Get WebElements ${xpath_service_radio_button} |
| 126 | |
Anves Kumar rayankula | 30a6245 | 2021-05-17 00:27:21 -0500 | [diff] [blame] | 127 | Run Keyword If '${ldap_service_type}' == 'LDAP' |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 128 | ... Click Element At Coordinates ${radio_buttons}[${0}] 0 0 |
| 129 | ... ELSE Click Element At Coordinates ${radio_buttons}[${1}] 0 0 |
| 130 | |
| 131 | Wait Until Page Contains Element ${xpath_ldap_url} |
| 132 | Input Text ${xpath_ldap_url} ${ldap_server_uri} |
| 133 | Input Text ${xpath_ldap_bind_dn} ${ldap_bind_dn} |
| 134 | Input Text ${xpath_ldap_password} ${ldap_bind_dn_password} |
| 135 | Input Text ${xpath_ldap_base_dn} ${ldap_base_dn} |
| 136 | Click Element ${xpath_ldap_save_settings} |
| 137 | |
Anves Kumar rayankula | 30a6245 | 2021-05-17 00:27:21 -0500 | [diff] [blame] | 138 | Run Keyword If '${ldap_service_type}'=='LDAP' |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 139 | ... Wait Until Page Contains Successfully saved Open LDAP settings |
| 140 | ... ELSE |
| 141 | ... Wait Until Page Contains Successfully saved Active Directory settings |
| 142 | |
| 143 | Click Element ${xpath_refresh_button} |
| 144 | Wait Until Page Contains Element ${xpath_ldap_heading} |
| 145 | |
| 146 | |
| 147 | Get LDAP Configuration |
| 148 | [Documentation] Retrieve LDAP Configuration. |
| 149 | [Arguments] ${ldap_type} |
| 150 | |
| 151 | # Description of argument(s): |
Anves Kumar rayankula | 30a6245 | 2021-05-17 00:27:21 -0500 | [diff] [blame] | 152 | # ldap_type The LDAP type ("ActiveDirectory" or "LDAP"). |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 153 | |
| 154 | ${radio_buttons}= Get WebElements ${xpath_service_radio_button} |
| 155 | |
| 156 | ${status}= Run Keyword And Return Status |
Anves Kumar rayankula | 30a6245 | 2021-05-17 00:27:21 -0500 | [diff] [blame] | 157 | ... Run Keyword If '${ldap_type}'=='LDAP' |
Anves Kumar rayankula | 47892a2 | 2021-03-26 03:57:02 -0500 | [diff] [blame] | 158 | ... Checkbox Should Be Selected ${radio_buttons}[${0}] |
| 159 | ... ELSE |
| 160 | ... Checkbox Should Be Selected ${radio_buttons}[${1}] |
| 161 | Should Be Equal ${status} ${True} |