Added testcase to Verify LDAP Configuration Created

Change-Id: Id142dea012234c07acbfb08a5f2aaa56a22d3bb4
Signed-off-by: Anves Kumar rayankula <anvesr77@in.ibm.com>
diff --git a/gui/gui_test/access_control/test_obmc_gui_ldap.robot b/gui/gui_test/access_control/test_obmc_gui_ldap.robot
index 00d2dac..8bc9ee2 100644
--- a/gui/gui_test/access_control/test_obmc_gui_ldap.robot
+++ b/gui/gui_test/access_control/test_obmc_gui_ldap.robot
@@ -16,7 +16,12 @@
 ${xpath_secure_ldap_checkbox}           //*[@data-test-id='ldap-checkbox-secureLdapEnabled']
 ${xpath_service_radio_button}           //*[@data-test-id="ldap-radio-activeDirectoryEnabled"]
 ${xpath_add_role_group_button}          //button[contains(text(),'Add role group')]
-
+${xpath_ldap_url}                       //*[@data-test-id='ldap-input-serverUri']
+${xpath_ldap_bind_dn}                   //*[@data-test-id='ldap-input-bindDn']
+${xpath_ldap_password}                  //*[@id='bind-password']
+${xpath_ldap_base_dn}                   //*[@data-test-id='ldap-input-baseDn']
+${xpath_ldap_save_settings}             //*[@data-test-id='ldap-button-saveSettings']
+${xpath_select_refresh_button}          //*[text()[contains(.,"Refresh")]]
 
 *** Test Cases ***
 
@@ -56,6 +61,16 @@
     Page Should Contain Element  ${xpath_secure_ldap_checkbox}
 
 
+Verify Create LDAP Configuration
+    [Documentation]  Verify created LDAP configuration.
+    [Tags]  Verify_Created_LDAP_Configuration
+
+    Create LDAP Configuration
+    Get LDAP Configuration  ${LDAP_TYPE}
+    Redfish.Login  ${LDAP_USER}  ${LDAP_USER_PASSWORD}
+    Redfish.Logout
+    Redfish.Login
+
 *** Keywords ***
 
 Test Setup Execution
@@ -66,3 +81,57 @@
     Click Element  ${xpath_access_control_menu}
     Click Element  ${xpath_ldap_sub_menu}
     Wait Until Keyword Succeeds  30 sec  10 sec  Location Should Contain  ldap
+
+
+Create LDAP Configuration
+    [Documentation]  Create LDAP configuration.
+    [Arguments]  ${ldap_server_uri}=${LDAP_SERVER_URI}  ${ldap_servicetype}=${LDAP_TYPE}
+    ...  ${ldap_bind_dn}=${LDAP_BIND_DN}  ${ldap_bind_dn_password}=${LDAP_BIND_DN_PASSWORD}
+    ...  ${ldap_base_dn}=${LDAP_BASE_DN}
+
+    # Description of argument(s):
+    # ldap_server_uri        LDAP server uri (e.g. ldap://XX.XX.XX.XX).
+    # ldap_type              The LDAP type ("ActiveDirectory" or "LDAP").
+    # ldap_bind_dn           The LDAP bind distinguished name.
+    # ldap_bind_dn_password  The LDAP bind distinguished name password.
+    # ldap_base_dn           The LDAP base distinguished name.
+
+    Select Checkbox  ${xpath_enable_ldap_checkbox}
+    Checkbox Should Be Selected  ${xpath_enable_ldap_checkbox}
+    ${radio_buttons}=    Get WebElements    ${xpath_service_radio_button}
+
+    Run Keyword If  '${ldap_service_type}' == 'OpenLDAP'
+    ...  Click Element At Coordinates  ${radio_buttons}[${0}]  0  0
+    ...  ELSE  Click Element At Coordinates  ${radio_buttons}[${1}]  0  0
+
+    Wait Until Page Contains Element  ${xpath_ldap_url}
+    Input Text  ${xpath_ldap_url}  ${ldap_server_uri}
+    Input Text  ${xpath_ldap_bind_dn}  ${ldap_bind_dn}
+    Input Text  ${xpath_ldap_password}  ${ldap_bind_dn_password}
+    Input Text  ${xpath_ldap_base_dn}  ${ldap_base_dn}
+    Click Element  ${xpath_ldap_save_settings}
+
+    Run Keyword If  '${ldap_service_type}'=='OpenLDAP'
+    ...  Wait Until Page Contains  Successfully saved Open LDAP settings
+    ...  ELSE
+    ...  Wait Until Page Contains  Successfully saved Active Directory settings
+
+    Click Element  ${xpath_refresh_button}
+    Wait Until Page Contains Element  ${xpath_ldap_heading}
+
+
+Get LDAP Configuration
+    [Documentation]  Retrieve LDAP Configuration.
+    [Arguments]   ${ldap_type}
+
+    # Description of argument(s):
+    # ldap_type  The LDAP type ("ActiveDirectory" or "OpenLDAP").
+
+    ${radio_buttons}=  Get WebElements  ${xpath_service_radio_button}
+
+    ${status}=  Run Keyword And Return Status
+    ...  Run Keyword If  '${ldap_type}'=='OpenLDAP'
+    ...  Checkbox Should Be Selected  ${radio_buttons}[${0}]
+    ...  ELSE
+    ...  Checkbox Should Be Selected  ${radio_buttons}[${1}]
+    Should Be Equal  ${status}  ${True}