Merge "Updates 'set_one_time_boot' to accept MAC address."

This commit is contained in:
Zuul 2017-12-06 21:00:04 +00:00 committed by Gerrit Code Review
commit 9d3b681841
4 changed files with 21 additions and 8 deletions

View File

@ -339,9 +339,9 @@ class IloClient(operations.IloOperations):
"""
return self._call_method('set_host_power', power)
def set_one_time_boot(self, value):
def set_one_time_boot(self, value, mac=None):
"""Configures a single boot from a specific device."""
return self._call_method('set_one_time_boot', value)
return self._call_method('set_one_time_boot', value, mac)
def insert_virtual_media(self, url, device='FLOPPY'):
"""Notifies iLO of the location of a virtual media diskette image."""

View File

@ -135,7 +135,7 @@ class IloOperations(object):
"""
raise exception.IloCommandNotSupportedError(ERRMSG)
def set_one_time_boot(self, value):
def set_one_time_boot(self, value, mac=None):
"""Configures a single boot from a specific device."""
raise exception.IloCommandNotSupportedError(ERRMSG)

View File

@ -407,8 +407,15 @@ class RIBCLOperations(operations.IloOperations):
raise exception.IloInvalidInputError(
"Invalid input. The expected input is ON or OFF.")
def set_one_time_boot(self, value):
"""Configures a single boot from a specific device."""
def set_one_time_boot(self, value, mac=None):
"""Configures a single boot from a specific device.
:param value: specific device to which the boot option is set
:param mac: MAC value of the data NIC in case ISCSI target is
set as boot device. This value may not be used
here since RIBCL does not support setting ISCSI
target. However included here for consistency.
"""
dic = {'value': value}
data = self._execute_command(
'SET_ONE_TIME_BOOT', 'SERVER_INFO', 'write', dic)

View File

@ -433,7 +433,13 @@ class IloClientTestCase(testtools.TestCase):
@mock.patch.object(client.IloClient, '_call_method')
def test_set_one_time_boot(self, call_mock):
self.client.set_one_time_boot('CDROM')
call_mock.assert_called_once_with('set_one_time_boot', 'CDROM')
call_mock.assert_called_once_with('set_one_time_boot', 'CDROM', None)
@mock.patch.object(client.IloClient, '_call_method')
def test_set_one_time_boot_with_mac(self, call_mock):
mac = '3863bb43683c'
self.client.set_one_time_boot('ISCSI', mac)
call_mock.assert_called_once_with('set_one_time_boot', 'ISCSI', mac)
@mock.patch.object(client.IloClient, '_call_method')
def test_insert_virtual_media(self, call_mock):
@ -806,13 +812,13 @@ class IloClientTestCase(testtools.TestCase):
def test_set_one_time_boot_gen9(self, set_one_time_boot_mock):
self.client.model = 'Gen9'
self.client.set_one_time_boot('cdrom')
set_one_time_boot_mock.assert_called_once_with('cdrom')
set_one_time_boot_mock.assert_called_once_with('cdrom', None)
@mock.patch.object(ribcl.RIBCLOperations, 'set_one_time_boot')
def test_set_one_time_boot_gen8(self, set_one_time_boot_mock):
self.client.model = 'Gen8'
self.client.set_one_time_boot('cdrom')
set_one_time_boot_mock.assert_called_once_with('cdrom')
set_one_time_boot_mock.assert_called_once_with('cdrom', None)
@mock.patch.object(ris.RISOperations, 'update_persistent_boot')
def test_update_persistent_boot_gen9(self, update_persistent_boot_mock):