diff --git a/proliantutils/redfish/redfish.py b/proliantutils/redfish/redfish.py index f356eee0..237b6445 100644 --- a/proliantutils/redfish/redfish.py +++ b/proliantutils/redfish/redfish.py @@ -18,6 +18,7 @@ import json from six.moves.urllib import parse import sushy +from sushy import auth from sushy.resources.system import mappings as sushy_map from sushy import utils @@ -141,9 +142,10 @@ class RedfishOperations(operations.IloOperations): self._username = username try: + basic_auth = auth.BasicAuth(username=username, password=password) self._sushy = main.HPESushy( - address, username=username, password=password, - root_prefix=root_prefix, verify=verify) + address, root_prefix=root_prefix, verify=verify, + auth=basic_auth) except sushy.exceptions.SushyError as e: msg = (self._('The Redfish controller at "%(controller)s" has ' 'thrown error. Error %(error)s') % diff --git a/proliantutils/tests/redfish/resources/test_update_service.py b/proliantutils/tests/redfish/resources/test_update_service.py index 9f7284d3..1728c757 100644 --- a/proliantutils/tests/redfish/resources/test_update_service.py +++ b/proliantutils/tests/redfish/resources/test_update_service.py @@ -40,8 +40,6 @@ class HPEUpdateServiceTestCase(testtools.TestCase): self.rf_client = redfish.RedfishOperations( '1.2.3.4', username='foo', password='bar') - sushy_mock.assert_called_once_with( - 'https://1.2.3.4', 'foo', 'bar', '/redfish/v1/', False) self.us_inst = update_service.HPEUpdateService( self.conn, '/redfish/v1/UpdateService/1', redfish_version='1.0.2') diff --git a/proliantutils/tests/redfish/test_redfish.py b/proliantutils/tests/redfish/test_redfish.py index d8a97583..50ca77df 100644 --- a/proliantutils/tests/redfish/test_redfish.py +++ b/proliantutils/tests/redfish/test_redfish.py @@ -21,6 +21,9 @@ import mock import sushy import testtools +from sushy import auth +from sushy.resources.system import system + from proliantutils import exception from proliantutils.ilo import constants as ilo_cons from proliantutils.redfish import main @@ -38,7 +41,6 @@ from proliantutils.redfish.resources.system.storage import array_controller from proliantutils.redfish.resources.system.storage \ import common as common_storage from proliantutils.redfish.resources.system import system as pro_sys -from sushy.resources.system import system @ddt.ddt @@ -59,8 +61,11 @@ class RedfishOperationsTestCase(testtools.TestCase): self.rf_client = redfish.RedfishOperations( '1.2.3.4', username='foo', password='bar') - sushy_mock.assert_called_once_with( - 'https://1.2.3.4', 'foo', 'bar', '/redfish/v1/', False) + args, kwargs = sushy_mock.call_args + self.assertEqual(('https://1.2.3.4',), args) + self.assertFalse(kwargs.get('verify')) + self.assertEqual('/redfish/v1/', kwargs.get('root_prefix')) + self.assertIsInstance(kwargs.get('auth'), auth.BasicAuth) @mock.patch.object(main, 'HPESushy', autospec=True) def test_sushy_init_fail(self, sushy_mock): diff --git a/requirements.txt b/requirements.txt index 1ce97522..048ceb1e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,4 +9,4 @@ retrying!=1.3.0,>=1.2.3 # Apache-2.0 pysnmp>=4.2.3,<5.0.0 # BSD # Redfish communication uses the Sushy library -sushy +sushy>=1.3.1