Delete all redfish session from the BMC
Change-Id: Ic0a505a804285b2777a0b4e03e3df5d66fdef3fa
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/bmc_redfish_utils.robot b/lib/bmc_redfish_utils.robot
index 86591f3..c0dba64 100644
--- a/lib/bmc_redfish_utils.robot
+++ b/lib/bmc_redfish_utils.robot
@@ -53,3 +53,21 @@
# The logout may very well fail because the system was just asked to
# reset itself.
Run Keyword And Ignore Error Redfish.Logout
+
+
+Delete All Redfish Sessions
+ [Documentation] Delete all active redfish sessions.
+
+ Redfish.Login
+ ${saved_session_info}= Get Redfish Session Info
+
+ ${resp_list}= Redfish_Utils.Get Member List
+ ... /redfish/v1/SessionService/Sessions
+
+ # Remove the current login session from the list.
+ Remove Values From List ${resp_list} ${saved_session_info["location"]}
+
+ :FOR ${session} IN @{resp_list}
+ \ Redfish.Delete ${session}
+
+ Redfish.Logout