Added test case to verify certificate persistency after BMC update.

Resolves openbmc/openbmc-test-automation#1470

Change-Id: I586132c1c661c8c865d9a3f7ac9853cda9163488
Signed-off-by: Rahul Maheshwari <rahulmaheshwari@in.ibm.com>
diff --git a/extended/code_update/bmc_code_update.robot b/extended/code_update/bmc_code_update.robot
index 7d6a332..0cf0c28 100644
--- a/extended/code_update/bmc_code_update.robot
+++ b/extended/code_update/bmc_code_update.robot
@@ -14,6 +14,7 @@
 Resource          ../../lib/openbmc_ffdc.robot
 Resource          ../../lib/dump_utils.robot
 Resource          ../../lib/ipmi_client.robot
+Resource          ../../lib/certificate_utils.robot
 
 Suite Setup       Suite Setup Execution
 
@@ -197,6 +198,30 @@
     ...  Run External IPMI Standard Command  lan print
 
 
+Test Certificate Persistency After BMC Code Update
+    [Documentation]  Test certificate persistency after BMC update.
+    [Tags]  Test_Certificate_Persistency_After_BMC_Code_Update
+
+    ${cert_file_path}=  Generate Certificate File Via Openssl
+    ...  Valid Certificate Valid Privatekey
+    ${file_data}=  OperatingSystem.Get Binary File  ${cert_file_path}
+    ${cert_file_content}=  OperatingSystem.Get File  ${cert_file_path}
+
+    Install Certificate File On BMC  ${CLIENT_CERTIFICATE_URI}
+    ...  data=${file_data}
+
+    ${bmc_cert_content}=  Get Certificate File Content From BMC  Client
+    Should Contain  ${cert_file_content}  ${bmc_cert_content}
+
+    Upload And Activate Image  ${IMAGE_FILE_PATH}
+    ...  skip_if_active=${SKIP_UPDATE_IF_ACTIVE}
+    OBMC Reboot (off)
+    Verify Running BMC Image  ${IMAGE_FILE_PATH}
+
+    ${bmc_cert_content}=  Get Certificate File Content From BMC  Client
+    Should Contain  ${cert_file_content}  ${bmc_cert_content}
+
+
 Test Basic BMC Performance After Code Update
     [Documentation]  Check performance of memory, CPU & file system of BMC.
     [Tags]  Test_Basic_BMC_Performance_After_Code_Update