Skip purging REST/Redfish session post boot run

Changes:
      - Added flag for user to control the behaviour of default
        session delete to prevent function testing during BMC reset
        which relies on persistency of the session.

Change-Id: I0b6e8926af99a8a1ec8193c0afab823a2c606864
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/obmc_boot_test.py b/lib/obmc_boot_test.py
index ccc81c4..a0f3e77 100755
--- a/lib/obmc_boot_test.py
+++ b/lib/obmc_boot_test.py
@@ -68,6 +68,7 @@
     status_dir_path = os.path.normpath(status_dir_path) + os.sep
 redfish_supported = BuiltIn().get_variable_value("${REDFISH_SUPPORTED}", default=False)
 redfish_rest_supported = BuiltIn().get_variable_value("${REDFISH_REST_SUPPORTED}", default=False)
+redfish_delete_sessions = int(BuiltIn().get_variable_value("${REDFISH_DELETE_SESSIONS}", default=1))
 if redfish_supported:
     redfish = BuiltIn().get_library_instance('redfish')
     default_power_on = "Redfish Power On"
@@ -995,8 +996,9 @@
 
     # This should help prevent ConnectionErrors.
     # Purge all redfish and REST connection sessions.
-    grk.run_key_u("Close All Connections", ignore=1)
-    grk.run_key_u("Delete All Redfish Sessions", ignore=1)
+    if redfish_delete_sessions:
+        grk.run_key_u("Close All Connections", ignore=1)
+        grk.run_key_u("Delete All Redfish Sessions", ignore=1)
 
     return True
 
diff --git a/lib/resource.robot b/lib/resource.robot
index 91d81bb..4aa1a09 100755
--- a/lib/resource.robot
+++ b/lib/resource.robot
@@ -9,7 +9,10 @@
 
 # Transition REST vs Redfish ONLY temporary changes for stagging
 # automation infrastructure change and for continuity.
-${REDFISH_SUPPORT_TRANS_STATE}    0
+${REDFISH_SUPPORT_TRANS_STATE}    ${0}
+
+# By default Delete all Redfish session per boot run.
+${REDFISH_DELETE_SESSIONS}        ${1}
 
 ${OPENBMC_MODEL}  ${EMPTY}
 ${OPENBMC_HOST}   ${EMPTY}