Delete all redfish session from the BMC
Change-Id: Ic0a505a804285b2777a0b4e03e3df5d66fdef3fa
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/extended/standby_bmc.robot b/extended/standby_bmc.robot
index 4996532..0279680 100644
--- a/extended/standby_bmc.robot
+++ b/extended/standby_bmc.robot
@@ -17,6 +17,8 @@
Resource ../lib/bmc_network_utils.robot
Resource ../lib/bmc_cleanup.robot
Resource ../lib/dump_utils.robot
+Resource ../lib/bmc_redfish_resource.robot
+Resource ../lib/bmc_redfish_utils.robot
Library ../lib/gen_misc.py
*** Variables ***
@@ -79,6 +81,7 @@
Run Keyword And Ignore Error Delete All Error Logs
Run Keyword And Ignore Error Delete All Dumps
+ Run Keyword And Ignore Error Delete All Redfish Sessions
Check For Current Boot Application Failures
*** Keywords ***
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