summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/drivers/modules/network/test_common.py
diff options
context:
space:
mode:
authorHamdy Khader <hamdyk@mellanox.com>2018-07-18 16:21:43 +0300
committerHamdy Khader <hamdyk@mellanox.com>2019-02-07 15:24:34 +0200
commita41c7a95920358af2fe23e4e102fc514a81d81c0 (patch)
treed5b62113cdef6f4359fa1453ede2cadac7b44895 /ironic/tests/unit/drivers/modules/network/test_common.py
parent4404292276446b6e81590993db8ebd4f4c482f93 (diff)
downloadironic-a41c7a95920358af2fe23e4e102fc514a81d81c0.tar.gz
Add support for Smart NICs
Extend Ironic to enable use of Smart NICs to implement generic networking services for baremetal servers. Extending the ramdisk, direct, iscsi and ansible deployment Interfaces to support the Smart NIC use-cases. For Smart NIC use-case the baremetal node must be powered on and booted into bios then wait for agent that runs on the Smart NIC to be alive then do the network changes required. Task: #26932 Story: #2003346 Change-Id: I00d6f13dd991074e4f45ada4d7cf4ccc0edbc7e1
Diffstat (limited to 'ironic/tests/unit/drivers/modules/network/test_common.py')
-rw-r--r--ironic/tests/unit/drivers/modules/network/test_common.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/ironic/tests/unit/drivers/modules/network/test_common.py b/ironic/tests/unit/drivers/modules/network/test_common.py
index ac9d4e4a4..b8b418230 100644
--- a/ironic/tests/unit/drivers/modules/network/test_common.py
+++ b/ironic/tests/unit/drivers/modules/network/test_common.py
@@ -430,6 +430,26 @@ class TestCommonFunctions(db_base.DbTestCase):
common.plug_port_to_tenant_network,
task, self.port)
+ @mock.patch.object(neutron_common, 'wait_for_host_agent', autospec=True)
+ @mock.patch.object(neutron_common, 'wait_for_port_status', autospec=True)
+ @mock.patch.object(neutron_common, 'get_client', autospec=True)
+ def test_plug_port_to_tenant_network_smartnic_port(
+ self, mock_gc, wait_port_mock, wait_agent_mock):
+ nclient = mock.MagicMock()
+ mock_gc.return_value = nclient
+ local_link_connection = self.port.local_link_connection
+ local_link_connection['hostname'] = 'hostname'
+ self.port.local_link_connection = local_link_connection
+ self.port.internal_info = {common.TENANT_VIF_KEY: self.vif_id}
+ self.port.is_smartnic = True
+ self.port.save()
+ with task_manager.acquire(self.context, self.node.id) as task:
+ common.plug_port_to_tenant_network(task, self.port)
+ wait_agent_mock.assert_called_once_with(
+ nclient, 'hostname')
+ wait_port_mock.assert_called_once_with(
+ nclient, self.vif_id, 'ACTIVE')
+
class TestVifPortIDMixin(db_base.DbTestCase):