Create multiple session and verify
Changes:
- Added set session key function in lib.
- Added get session info function in lib utils.
- Added test case to create 50 session and verify.
Tested: On Master
Change-Id: Iaf740c83d77fb1da7be65903872219e21b53c79e
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/bmc_redfish.py b/lib/bmc_redfish.py
index 92001c9..d0f22a3 100644
--- a/lib/bmc_redfish.py
+++ b/lib/bmc_redfish.py
@@ -64,8 +64,27 @@
password=self._password_,
default_prefix=self._default_prefix_)
self._robj_.login(auth=redfish.AuthMethod.SESSION)
+ self._session_key_ = self._robj_.get_session_key()
self._session_location_ = self._robj_.get_session_location()
+ def set_session_key(self, session_key):
+ r"""
+ Update the session key instance.
+
+ session_key Redfish valid session key.
+ """
+ self._robj_.set_session_key(session_key)
+
+ def set_session_location(self, session_location):
+ r"""
+ Update the session location instance.
+
+ session_location Redfish valid session location.
+ Example:
+ /redfish/v1/SessionService/Sessions/j04tD83QQn
+ """
+ self._robj_.set_session_location(session_location)
+
def get(self, resource_path, *args, **kwargs):
r"""
Perform a GET request and return response.
diff --git a/lib/bmc_redfish_utils.py b/lib/bmc_redfish_utils.py
index 832da44..daa09e1 100644
--- a/lib/bmc_redfish_utils.py
+++ b/lib/bmc_redfish_utils.py
@@ -17,6 +17,21 @@
# Obtain a reference to the global redfish object.
self._redfish_ = BuiltIn().get_library_instance('redfish')
+ def get_redfish_session_info(self):
+ r"""
+ Returns redfish sessions info dictionary.
+
+ {
+ 'key': 'yLXotJnrh5nDhXj5lLiH' ,
+ 'location': '/redfish/v1/SessionService/Sessions/nblYY4wlz0'
+ }
+ """
+ session_dict = {
+ "key": self._redfish_._session_key_,
+ "location": self._redfish_._session_location_
+ }
+ return session_dict
+
def get_attribute(self, resource_path, attribute):
r"""
Get resource attribute.