GUI: Load Certificates Via Eth1 IP Address And Verify

Change-Id: I1a1bdc3936172962d6d5e436f43a0af05b5aa06d
Signed-off-by: Anves Kumar rayankula <anvesr77@in.ibm.com>
diff --git a/gui/gui_test/server_config/test_obmc_multiple_interfaces.robot b/gui/gui_test/server_config/test_obmc_multiple_interfaces.robot
index 630f179..0980b0c 100644
--- a/gui/gui_test/server_config/test_obmc_multiple_interfaces.robot
+++ b/gui/gui_test/server_config/test_obmc_multiple_interfaces.robot
@@ -3,6 +3,7 @@
 
 Resource        ../../lib/gui_resource.robot
 Resource        ../../../lib/resource.robot
+Resource        ../../../lib/certificate_utils.robot
 
 Suite Setup     Suite Setup Execution
 Test Teardown   FFDC On Test Case Fail
@@ -11,6 +12,14 @@
 
 ${bmc_url}             https://${OPENBMC_HOST}
 ${bmc_url_1}           https://${OPENBMC_HOST_1}
+${LDAP_FILE_PATH}      ${EMPTY}
+${CA_FILE_PATH}        ${EMPTY}
+
+${xpath_add_new_certificate}   //*[contains(text(), ' Add new certificate ')]
+${xpath_certificate_type}      //*[@id="certificate-type"]
+${xpath_upload_file}           //*[@id="certificate-file"]
+${xpath_load_certificate}      //button[text()=' Add ']
+${xpath_close_poup}            //*[@class="close ml-auto mb-1"]
 
 *** Test Cases ***
 
@@ -29,6 +38,17 @@
     Switch Browser  tab2
     Run Keywords  Login GUI  AND  Logout GUI
 
+
+Load Certificates Via Eth1 IP Address And Verify
+    [Documentation]  Verify ability to load LDAP certificate using eth1 IP address.
+    [Tags]  Load_Certificates_Via_Eth1_IP_Address_And_Verify
+    [Template]  Load Certificates On BMC Via GUI
+
+    # bmc_url     certificate_type  file_path
+    ${bmc_url_1}  Client            ${LDAP_FILE_PATH}
+    ${bmc_url_1}  CA                ${CA_FILE_PATH}
+
+
 *** keywords ***
 
 Suite Setup Execution
@@ -39,3 +59,53 @@
     # Check both interfaces are configured and reachable.
     Ping Host  ${OPENBMC_HOST}
     Ping Host  ${OPENBMC_HOST_1}
+
+
+Load Certificates On BMC Via GUI
+    [Documentation]  Load certificate on BMC via GUI.
+    [Arguments]  ${bmc_url}  ${certificate_type}  ${file_path}  ${delete_cert}=${True}
+    [Teardown]  Run Keywords  Logout GUI  AND  Close Browser
+
+    # Description of argument(s):
+    # bmc_url            Openbmc GUI URL to be open.
+    # certificate_type   Certificate type.
+    #                    (e.g. "LDAP Certificate" or "CA Certificate").
+    # file_path          Certificate file path (e.g. "/home/folder/file.pem").
+
+    ${path}  ${ext}=  Split Extension  ${file_path}
+    Run Keyword If  '${certificate_type}' == 'CA' and '${delete_cert}' == '${True}'
+    ...  Delete All CA Certificate Via Redfish
+    ...  ELSE IF  '${certificate_type}' == 'Client' and '${delete_cert}' == '${True}'
+    ...  Delete Certificate Via BMC CLI  ${certificate_type}
+
+    Set Test Variable  ${obmc_gui_url}  https://${OPENBMC_HOST_1}
+    Launch Browser And Login GUI
+    Navigate To SSL Certificate Page
+    Sleep  10s
+    Click Element  ${xpath_add_new_certificate}
+
+    Wait Until Page Contains Element  ${xpath_certificate_type}  timeout=20s
+    Run Keyword If  '${certificate_type}' == 'CA'
+    ...  Select From List By Label  ${xpath_certificate_type}  CA Certificate
+    ...  ELSE IF  '${certificate_type}' == 'Client'
+    ...  Select From List By Label  ${xpath_certificate_type}  LDAP Certificate
+
+    Choose File  ${xpath_upload_file}  ${file_path}
+    Click Element  ${xpath_load_certificate}
+
+    Run Keyword If  '${ext}' !='pem'   Wait Until Page Contains  Error adding certificate.
+
+    Run Keyword If  '${certificate_type}' == 'CA'
+    ...  Wait Until Page Contains  Successfully added CA Certificate.
+    ...  ELSE IF  '${certificate_type}' == 'Client'
+    ...  Wait Until Page Contains  Successfully added LDAP Certificate.
+    Click Element  ${xpath_close_poup}
+
+
+Navigate To SSL Certificate Page
+    [Documentation]  Navigate to SSL Certificate page.
+
+    Click Element  ${xpath_access_control_menu}
+    Click Element  ${xpath_ssl_certificates_sub_menu}
+    Page Should Contain  SSL certificates
+