Add option to invalidate all the guard records

Changes:
     - User driven option to invalidate all the guard records.
       By default DELETE_OLD_GUARD_FILE is set to 0.

       User should use robot option:
       -v DELETE_OLD_GUARD_FILE:1
       to call this option into force.

Tested:
     - Ran from sandbox.

Change-Id: I0f3a066253d0d03d3e6d0b0733630079b85dbb5c
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/redfish/extended/redfish_bmc_code_update.robot b/redfish/extended/redfish_bmc_code_update.robot
index d607676..187d462 100644
--- a/redfish/extended/redfish_bmc_code_update.robot
+++ b/redfish/extended/redfish_bmc_code_update.robot
@@ -33,9 +33,11 @@
 
 *** Variables ***
 
-${FORCE_UPDATE}          ${0}
-${LOOP_COUNT}            ${2}
-${DELETE_ERRLOGS}        ${1}
+${FORCE_UPDATE}             ${0}
+${LOOP_COUNT}               ${2}
+${DELETE_ERRLOGS}           ${1}
+# Refer: https://github.com/open-power/guard
+${DELETE_OLD_GUARD_FILE}    ${0}
 
 ${ACTIVATION_WAIT_TIMEOUT}     8 min
 
@@ -123,6 +125,10 @@
     Run Keyword And Ignore Error  Redfish Delete All BMC Dumps
     Run Keyword If  ${DELETE_ERRLOGS} == ${1}
     ...   Run Keyword And Ignore Error  Redfish Purge Event Log
+    # To invalidate all the guard records.
+    Run Keyword If  '${DELETE_OLD_GUARD_FILE}' == '${1}'
+    ...  BMC Execute Command  guard -I
+
     # Checking for file existence.
     Valid File Path  IMAGE_FILE_PATH