Update redfish delete session logic
Changes:
- Added keyword to get session with client id populated.
- Added logic to remove sessions with client id.
Change-Id: Ifee7867315144f786764ff58d21138ac78e19979
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/bmc_redfish_utils.robot b/lib/bmc_redfish_utils.robot
index 680bb52..7a69863 100644
--- a/lib/bmc_redfish_utils.robot
+++ b/lib/bmc_redfish_utils.robot
@@ -121,11 +121,41 @@
# Remove the current login session from the list.
Remove Values From List ${resp_list} ${saved_session_info["location"]}
+ # Remove session with client_id populated from the list.
+ ${client_id_list}= Get Session With Client Id ${resp_list}
+ Log To Console Client sessions skip list: ${client_id_list}
+ FOR ${client_session} IN @{client_id_list}
+ Remove Values From List ${resp_list} ${client_session}
+ END
+
FOR ${session} IN @{resp_list}
Run Keyword And Ignore Error Redfish.Delete ${session}
END
+Get Session With Client Id
+ [Documentation] Iterate through the active sessions and return sessions populated with client id.
+ [Arguments] ${session_list}
+
+ # Description of argument(s):
+ # session_list Active session list from SessionService.
+
+ # "Oem": {
+ # "OpenBMC": {
+ # "@odata.type": "#OemSession.v1_0_0.Session",
+ # "ClientID": "MYID=Vd57f62*2811504"
+ # }
+
+ ${client_id_sessions}= Create List
+ FOR ${session} IN @{session_list}
+ ${resp}= Redfish.Get ${session} valid_status_codes=[200,404]
+ Run Keyword If '${resp.dict["Oem"]["OpenBMC"]["ClientID"]}' != '${EMPTY}'
+ ... Append To List ${client_id_sessions} ${session}
+ END
+
+ [Return] ${client_id_sessions}
+
+
Get Valid FRUs
[Documentation] Return a dictionary containing all of the valid FRU records for the given fru_type.
[Arguments] ${fru_type}