Add support for NMI(Non Maskable Interrupt)

This commit adds support for NMI for Gen9 and Gen10 servers.

Note: These is no RIBCL interface to perform NMI using RIBCL.

Change-Id: Iaf663443179417e47d022098c73a4776d41d4287
Partial-Bug: #1762311
This commit is contained in:
Shivanand Tendulker
2018-04-09 02:53:24 -04:00
parent 60910b9257
commit f3db9b7c8a
9 changed files with 139 additions and 1 deletions

View File

@@ -1011,6 +1011,24 @@ class IloClientTestCase(testtools.TestCase):
call_mock.assert_called_once_with('get_essential_properties')
self.assertFalse(snmp_mock.called)
@mock.patch.object(client.IloClient, '_call_method')
def test_inject_nmi(self, call_mock):
self.client.inject_nmi()
call_mock.assert_called_once_with('inject_nmi')
@mock.patch.object(ris.RISOperations, 'inject_nmi')
def test_inject_nmi_gen9(self, inject_nmi_mock):
self.client.model = 'Gen9'
self.client.inject_nmi()
inject_nmi_mock.assert_called_once_with()
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_inject_nmi_gen8(self, product_mock):
self.client.model = 'Gen8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'not supported',
self.client.inject_nmi)
class IloRedfishClientTestCase(testtools.TestCase):

View File

@@ -1041,6 +1041,13 @@ class IloRibclTestCaseBeforeRisSupport(unittest.TestCase):
self.ilo.set_vm_status('cdrom', 'boot_once', 'yes')
self.assertTrue(request_ilo_mock.called)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_inject_nmi(self, product_name_mock):
product_name_mock.return_value = constants.GET_PRODUCT_NAME
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'ProLiant DL380 G7',
self.ilo.inject_nmi)
if __name__ == '__main__':
unittest.main()

View File

@@ -1239,6 +1239,25 @@ class IloRisTestCase(testtools.TestCase):
self.client.hold_pwr_btn()
press_pwr_btn_mock.assert_called_once_with(pushType="PressAndHold")
@mock.patch.object(ris.RISOperations, '_perform_power_op')
@mock.patch.object(ris.RISOperations, 'get_host_power_status')
def test_inject_nmi(self, get_power_status_mock,
perform_power_op_mock):
get_power_status_mock.return_value = 'ON'
self.client.inject_nmi()
get_power_status_mock.assert_called_once_with()
perform_power_op_mock.assert_called_once_with('Nmi')
@mock.patch.object(ris.RISOperations, '_perform_power_op')
@mock.patch.object(ris.RISOperations, 'get_host_power_status')
def test_inject_nmi_exc(self, get_power_status_mock,
perform_power_op_mock):
get_power_status_mock.return_value = 'OFF'
self.assertRaises(exception.IloError,
self.client.inject_nmi)
get_power_status_mock.assert_called_once_with()
self.assertFalse(perform_power_op_mock.called)
class TestRISOperationsPrivateMethods(testtools.TestCase):