REST and Redfish supported driver
Changes:
- Added REDFISH_REST_SUPPORTED global var as part of the
lib/bmc_redfish_utils.py init function.
- Update boot test to select supported BMC REST or Reddfish
fucntions to set.
There are driver still out there in community which supports both
legacy REST (/xyz/openbmc_project/) and new redfish (/redfish/v1/).
This new logic is to derieve early in the program and use in the
functional and boot test path.
Tested:
- Disable REST and test the change.
- Test the change in current latest level of driver.
Change-Id: I0e0b480b97b64df8a264a3d54e7159e90b33f4af
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/bmc_redfish_utils.py b/lib/bmc_redfish_utils.py
index b9a39a2..f8d2a94 100644
--- a/lib/bmc_redfish_utils.py
+++ b/lib/bmc_redfish_utils.py
@@ -11,13 +11,28 @@
class bmc_redfish_utils(object):
+ ROBOT_LIBRARY_SCOPE = 'TEST SUITE'
+
def __init__(self):
r"""
Initialize the bmc_redfish_utils object.
"""
# Obtain a reference to the global redfish object.
+ self.__inited__ = False
self._redfish_ = BuiltIn().get_library_instance('redfish')
+ # There is a possibility that a given driver support both redfish and
+ # legacy REST.
+ self._redfish_.login()
+ self._rest_response_ = \
+ self._redfish_.get("/xyz/openbmc_project/", valid_status_codes=[200, 404])
+
+ # If REST URL /xyz/openbmc_project/ is supported.
+ if self._rest_response_.status == 200:
+ self.__inited__ = True
+
+ BuiltIn().set_global_variable("${REDFISH_REST_SUPPORTED}", self.__inited__)
+
def get_redfish_session_info(self):
r"""
Returns redfish sessions info dictionary.