Verify Expired Server Certificate Replace

Signed-off-by: Anusha Dathatri <adathatr@in.ibm.com>
Change-Id: I64bb119c95733dd1300e10a26cf50228c765a7e1
diff --git a/redfish/managers/test_certificate.robot b/redfish/managers/test_certificate.robot
index ab23d19..d27985a 100644
--- a/redfish/managers/test_certificate.robot
+++ b/redfish/managers/test_certificate.robot
@@ -202,6 +202,16 @@
     Install And Verify Certificate Via Redfish  CA  Expired Certificate  error
 
 
+Verify Expired Server Certificate Replace
+    [Documentation]  Verify replacing the server certificate with an expired one.
+    [Tags]  Verify_Expired_Server_Certificate_Replace
+    [Setup]  Get Current BMC Date
+    [Teardown]  Run Keywords  FFDC On Test Case Fail  AND
+    ...  Restore BMC Date
+
+    Modify BMC Date
+    Replace Certificate Via Redfish  Server  Expired Certificate  error
+
 *** Keywords ***
 
 Install And Verify Certificate Via Redfish
@@ -298,12 +308,13 @@
     ...  ELSE IF  '${cert_type}' == 'CA'
     ...    Install And Verify Certificate Via Redfish  ${cert_type}  Valid Certificate  ok
 
-    ${time}=  Set Variable If  '${cert_format}' == 'Expired Certificate'  -10  365
-    ${cert_file_path}=  Generate Certificate File Via Openssl  ${cert_format}  ${time}
+    ${cert_file_path}=  Generate Certificate File Via Openssl  ${cert_format}
 
     ${bytes}=  OperatingSystem.Get Binary File  ${cert_file_path}
     ${file_data}=  Decode Bytes To String  ${bytes}  UTF-8
 
+    Run Keyword If  '${cert_format}' == 'Expired Certificate'  Modify BMC Date  future
+
     ${certificate_uri}=  Set Variable If
     ...  '${cert_type}' == 'Server'  ${REDFISH_HTTPS_CERTIFICATE_URI}/1
     ...  '${cert_type}' == 'Client'  ${REDFISH_LDAP_CERTIFICATE_URI}/1