Added test to verify installed CA certificate

Added testcases:
- Verify Installed CA Certificate

Change-Id: I2e8fb36c3ebbde167b1aa2dcc3611ba05cbb9024
Signed-off-by: manashsarma <manashsarma@in.ibm.com>
diff --git a/gui/gui_test/access_control/test_obmc_gui_certificate.robot b/gui/gui_test/access_control/test_obmc_gui_certificate.robot
index 40e62b6..111bcc2 100644
--- a/gui/gui_test/access_control/test_obmc_gui_certificate.robot
+++ b/gui/gui_test/access_control/test_obmc_gui_certificate.robot
@@ -3,8 +3,8 @@
 Documentation  Test OpenBMC GUI "SSL Certificates" sub-menu of "Access control".
 
 Resource        ../../lib/resource.robot
+Resource        ../../../lib/certificate_utils.robot
 
-Suite Setup     Launch Browser And Login GUI
 Suite Teardown  Close Browser
 Test Setup      Test Setup Execution
 
@@ -74,11 +74,42 @@
      Page Should Contain Element  ${xpath_generate_csr_submit}
 
 
+Verify Installed CA Certificate
+    [Documentation]  Install CA certificate and verify the same via GUI.
+    [Tags]  Verify_Installed_CA_Certificate
+
+    Delete All CA Certificate Via Redfish
+
+    # Install CA certificate via Redfish.
+    ${file_data}=  Generate Certificate File Data
+    Install Certificate File On BMC  ${REDFISH_CA_CERTIFICATE_URI}  ok  data=${file_data}
+
+    # Verify CA certificate availability in GUI.
+    Page Should Contain  CA Certificate
+
+
 *** Keywords ***
 
+Generate Certificate File Data
+    [Documentation]  Generate data of certificate file.
+
+    ${cert_file_path}=  Generate Certificate File Via Openssl  Valid Certificate  365
+    ${bytes}=  OperatingSystem.Get Binary File  ${cert_file_path}
+    ${file_data}=  Decode Bytes To String  ${bytes}  UTF-8
+
+    [return]  ${file_data}
+
+
 Test Setup Execution
     [Documentation]  Do test case setup tasks.
 
     Click Element  ${xpath_access_control_menu}
     Click Element  ${xpath_ssl_certificates_sub_menu}
     Wait Until Keyword Succeeds  30 sec  10 sec  Location Should Contain  ssl-certificates
+
+
+Suite Setup Execution
+    [Documentation]  Do test case suite setup tasks.
+
+    Launch Browser And Login GUI
+    Create Directory  certificate_dir
diff --git a/lib/certificate_utils.robot b/lib/certificate_utils.robot
index 895ca64..6deaf6c 100755
--- a/lib/certificate_utils.robot
+++ b/lib/certificate_utils.robot
@@ -157,3 +157,10 @@
     ${openssl_cert_content}=  Get Certificate Content From BMC Via Openssl
     Should Contain  ${cert_file_content}  ${openssl_cert_content}
 
+
+Delete All CA Certificate Via Redfish
+    [Documentation]  Delete all CA certificate via Redfish.
+    ${cert_list}=  Redfish_Utils.Get Member List  /redfish/v1/Managers/bmc/Truststore/Certificates
+    FOR  ${cert}  IN  @{cert_list}
+      Redfish.Delete  ${cert}  valid_status_codes=[${HTTP_NO_CONTENT}]
+    END
diff --git a/redfish/managers/test_certificate.robot b/redfish/managers/test_certificate.robot
index 73bb388..88101c5 100644
--- a/redfish/managers/test_certificate.robot
+++ b/redfish/managers/test_certificate.robot
@@ -421,15 +421,6 @@
     ...  valid_status_codes=[${HTTP_NOT_FOUND}, ${HTTP_INTERNAL_SERVER_ERROR}]
 
 
-Delete All CA Certificate Via Redfish
-    [Documentation]  Delete all CA certificate via Redfish.
-
-    ${cert_list}=  Redfish_Utils.Get Member List  /redfish/v1/Managers/bmc/Truststore/Certificates
-    FOR  ${cert}  IN  @{cert_list}
-      Redfish.Delete  ${cert}  valid_status_codes=[${HTTP_NO_CONTENT}]
-    END
-
-
 Suite Setup Execution
     [Documentation]  Do suite setup tasks.
 
@@ -446,4 +437,4 @@
 Suite Teardown
     [Documentation]  Do suite teardown tasks.
 
-    Redfish.Logout
\ No newline at end of file
+    Redfish.Logout