Enable session based authentication used by sushy

This commit delegates the session handling to sushy. Earlier
proliantutils was useing Basic authentication even as Sushy was using
session based authentication owing to the limitation on the
number of sessions being created on the iLO redfish systems. Currently
the session creation is delegated to sushy and relies on authentication
mechanism used by it.

Change-Id: Ib150e2662ac664b635c9395096cdecff75bd4ea1
This commit is contained in:
vmud213 2019-08-23 03:45:58 +00:00
parent 9313e66bff
commit 48e58fd50c
2 changed files with 4 additions and 6 deletions

View File

@ -18,7 +18,6 @@ import json
from six.moves.urllib import parse from six.moves.urllib import parse
import sushy import sushy
from sushy import auth
from sushy.resources.system import mappings as sushy_map from sushy.resources.system import mappings as sushy_map
from sushy import utils from sushy import utils
@ -153,10 +152,9 @@ class RedfishOperations(operations.IloOperations):
self._username = username self._username = username
try: try:
basic_auth = auth.BasicAuth(username=username, password=password)
self._sushy = main.HPESushy( self._sushy = main.HPESushy(
address, root_prefix=root_prefix, verify=verify, address, username=username, password=password,
auth=basic_auth) root_prefix=root_prefix, verify=verify)
except sushy.exceptions.SushyError as e: except sushy.exceptions.SushyError as e:
msg = (self._('The Redfish controller at "%(controller)s" has ' msg = (self._('The Redfish controller at "%(controller)s" has '
'thrown error. Error %(error)s') % 'thrown error. Error %(error)s') %

View File

@ -21,7 +21,6 @@ import mock
import sushy import sushy
import testtools import testtools
from sushy import auth
from sushy.resources.system import system from sushy.resources.system import system
from proliantutils import exception from proliantutils import exception
@ -65,7 +64,8 @@ class RedfishOperationsTestCase(testtools.TestCase):
self.assertEqual(('https://1.2.3.4',), args) self.assertEqual(('https://1.2.3.4',), args)
self.assertFalse(kwargs.get('verify')) self.assertFalse(kwargs.get('verify'))
self.assertEqual('/redfish/v1/', kwargs.get('root_prefix')) self.assertEqual('/redfish/v1/', kwargs.get('root_prefix'))
self.assertIsInstance(kwargs.get('auth'), auth.BasicAuth) self.assertEqual('foo', kwargs.get('username'))
self.assertEqual('bar', kwargs.get('password'))
@mock.patch.object(main, 'HPESushy', autospec=True) @mock.patch.object(main, 'HPESushy', autospec=True)
def test_sushy_init_fail(self, sushy_mock): def test_sushy_init_fail(self, sushy_mock):