Add mTLS option for redfish test
When the BMC only enables mTLS auth type at build time. Robot test
should be test normally. Adding "MTLS_ENABLED" environment variable as
an option and modifications to achieve it.
Signed-off-by: Tony Lee <tony.lee@quantatw.com>
Change-Id: I68c753a453f0c958c900f8ba3e1d73145e093d6c
diff --git a/lib/bmc_redfish_utils.py b/lib/bmc_redfish_utils.py
index a39c5d9..ea39930 100644
--- a/lib/bmc_redfish_utils.py
+++ b/lib/bmc_redfish_utils.py
@@ -9,6 +9,8 @@
from robot.libraries.BuiltIn import BuiltIn
import gen_print as gp
+MTLS_ENABLED = BuiltIn().get_variable_value("${MTLS_ENABLED}")
+
class bmc_redfish_utils(object):
@@ -22,15 +24,18 @@
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:
+ if MTLS_ENABLED == 'True':
self.__inited__ = True
+ else:
+ # 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__)