diff --git a/neutron/plugins/sriovnicagent/__init__.py b/neutron/plugins/ml2/drivers/mech_sriov/agent/__init__.py similarity index 100% rename from neutron/plugins/sriovnicagent/__init__.py rename to neutron/plugins/ml2/drivers/mech_sriov/agent/__init__.py diff --git a/neutron/plugins/sriovnicagent/common/__init__.py b/neutron/plugins/ml2/drivers/mech_sriov/agent/common/__init__.py similarity index 100% rename from neutron/plugins/sriovnicagent/common/__init__.py rename to neutron/plugins/ml2/drivers/mech_sriov/agent/common/__init__.py diff --git a/neutron/plugins/sriovnicagent/common/config.py b/neutron/plugins/ml2/drivers/mech_sriov/agent/common/config.py similarity index 100% rename from neutron/plugins/sriovnicagent/common/config.py rename to neutron/plugins/ml2/drivers/mech_sriov/agent/common/config.py diff --git a/neutron/plugins/sriovnicagent/common/exceptions.py b/neutron/plugins/ml2/drivers/mech_sriov/agent/common/exceptions.py similarity index 100% rename from neutron/plugins/sriovnicagent/common/exceptions.py rename to neutron/plugins/ml2/drivers/mech_sriov/agent/common/exceptions.py diff --git a/neutron/plugins/sriovnicagent/eswitch_manager.py b/neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py similarity index 98% rename from neutron/plugins/sriovnicagent/eswitch_manager.py rename to neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py index 5d80576a7c0..f8f4bd846be 100644 --- a/neutron/plugins/sriovnicagent/eswitch_manager.py +++ b/neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py @@ -21,8 +21,9 @@ from oslo_log import log as logging import six from neutron.i18n import _LE, _LW -from neutron.plugins.sriovnicagent.common import exceptions as exc -from neutron.plugins.sriovnicagent import pci_lib +from neutron.plugins.ml2.drivers.mech_sriov.agent.common \ + import exceptions as exc +from neutron.plugins.ml2.drivers.mech_sriov.agent import pci_lib LOG = logging.getLogger(__name__) diff --git a/neutron/plugins/sriovnicagent/pci_lib.py b/neutron/plugins/ml2/drivers/mech_sriov/agent/pci_lib.py similarity index 98% rename from neutron/plugins/sriovnicagent/pci_lib.py rename to neutron/plugins/ml2/drivers/mech_sriov/agent/pci_lib.py index 545769fdaa5..05fc0d2f859 100644 --- a/neutron/plugins/sriovnicagent/pci_lib.py +++ b/neutron/plugins/ml2/drivers/mech_sriov/agent/pci_lib.py @@ -19,7 +19,8 @@ from oslo_log import log as logging from neutron.agent.linux import ip_lib from neutron.i18n import _LE, _LW -from neutron.plugins.sriovnicagent.common import exceptions as exc +from neutron.plugins.ml2.drivers.mech_sriov.agent.common \ + import exceptions as exc LOG = logging.getLogger(__name__) diff --git a/neutron/plugins/sriovnicagent/sriov_nic_agent.py b/neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py similarity index 98% rename from neutron/plugins/sriovnicagent/sriov_nic_agent.py rename to neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py index 24a54258d4c..c98e94dc4a7 100644 --- a/neutron/plugins/sriovnicagent/sriov_nic_agent.py +++ b/neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py @@ -34,9 +34,10 @@ from neutron.common import utils as q_utils from neutron import context from neutron.i18n import _LE, _LI from neutron.openstack.common import loopingcall -from neutron.plugins.sriovnicagent.common import config # noqa -from neutron.plugins.sriovnicagent.common import exceptions as exc -from neutron.plugins.sriovnicagent import eswitch_manager as esm +from neutron.plugins.ml2.drivers.mech_sriov.agent.common import config # noqa +from neutron.plugins.ml2.drivers.mech_sriov.agent.common \ + import exceptions as exc +from neutron.plugins.ml2.drivers.mech_sriov.agent import eswitch_manager as esm LOG = logging.getLogger(__name__) diff --git a/neutron/plugins/ml2/drivers/mech_sriov/exceptions.py b/neutron/plugins/ml2/drivers/mech_sriov/mech_driver/exceptions.py similarity index 100% rename from neutron/plugins/ml2/drivers/mech_sriov/exceptions.py rename to neutron/plugins/ml2/drivers/mech_sriov/mech_driver/exceptions.py diff --git a/neutron/plugins/ml2/drivers/mech_sriov/mech_driver.py b/neutron/plugins/ml2/drivers/mech_sriov/mech_driver/mech_driver.py similarity index 98% rename from neutron/plugins/ml2/drivers/mech_sriov/mech_driver.py rename to neutron/plugins/ml2/drivers/mech_sriov/mech_driver/mech_driver.py index 5d9d6f83671..50a95e22683 100644 --- a/neutron/plugins/ml2/drivers/mech_sriov/mech_driver.py +++ b/neutron/plugins/ml2/drivers/mech_sriov/mech_driver/mech_driver.py @@ -22,7 +22,8 @@ from neutron.extensions import portbindings from neutron.i18n import _LE, _LW from neutron.plugins.common import constants as p_const from neutron.plugins.ml2 import driver_api as api -from neutron.plugins.ml2.drivers.mech_sriov import exceptions as exc +from neutron.plugins.ml2.drivers.mech_sriov.mech_driver \ + import exceptions as exc LOG = log.getLogger(__name__) diff --git a/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/__init__.py b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/__init__.py similarity index 100% rename from neutron/tests/unit/plugins/ml2/drivers/mech_sriov/__init__.py rename to neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/__init__.py diff --git a/neutron/tests/unit/plugins/sriovnicagent/__init__.py b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/common/__init__.py similarity index 100% rename from neutron/tests/unit/plugins/sriovnicagent/__init__.py rename to neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/common/__init__.py diff --git a/neutron/tests/unit/plugins/sriovnicagent/common/test_config.py b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/common/test_config.py similarity index 97% rename from neutron/tests/unit/plugins/sriovnicagent/common/test_config.py rename to neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/common/test_config.py index 10210213abb..7b6d473f491 100644 --- a/neutron/tests/unit/plugins/sriovnicagent/common/test_config.py +++ b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/common/test_config.py @@ -17,8 +17,9 @@ from oslo_config import cfg from neutron.common import utils as q_utils -from neutron.plugins.sriovnicagent.common import config -from neutron.plugins.sriovnicagent import sriov_nic_agent as agent +from neutron.plugins.ml2.drivers.mech_sriov.agent.common import config +from neutron.plugins.ml2.drivers.mech_sriov.agent \ + import sriov_nic_agent as agent from neutron.tests import base diff --git a/neutron/tests/unit/plugins/sriovnicagent/test_eswitch_manager.py b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/test_eswitch_manager.py similarity index 69% rename from neutron/tests/unit/plugins/sriovnicagent/test_eswitch_manager.py rename to neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/test_eswitch_manager.py index 3cc1b25d81c..72c5da0c32f 100644 --- a/neutron/tests/unit/plugins/sriovnicagent/test_eswitch_manager.py +++ b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/test_eswitch_manager.py @@ -20,8 +20,9 @@ import mock import testtools -from neutron.plugins.sriovnicagent.common import exceptions as exc -from neutron.plugins.sriovnicagent import eswitch_manager as esm +from neutron.plugins.ml2.drivers.mech_sriov.agent.common \ + import exceptions as exc +from neutron.plugins.ml2.drivers.mech_sriov.agent import eswitch_manager as esm from neutron.tests import base @@ -32,23 +33,25 @@ class TestCreateESwitchManager(base.BaseTestCase): def test_create_eswitch_mgr_fail(self): device_mappings = {'physnet1': 'p6p1'} - with mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "PciOsWrapper.scan_vf_devices", + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.PciOsWrapper.scan_vf_devices", side_effect=exc.InvalidDeviceError( dev_name="p6p1", reason="device" " not found")),\ - mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "PciOsWrapper.is_assigned_vf", return_value=True): + mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.PciOsWrapper.is_assigned_vf", + return_value=True): with testtools.ExpectedException(exc.InvalidDeviceError): esm.ESwitchManager(device_mappings, None) def test_create_eswitch_mgr_ok(self): device_mappings = {'physnet1': 'p6p1'} - with mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "PciOsWrapper.scan_vf_devices", + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.PciOsWrapper.scan_vf_devices", return_value=self.SCANNED_DEVICES),\ - mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "PciOsWrapper.is_assigned_vf", return_value=True): + mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.PciOsWrapper.is_assigned_vf", + return_value=True): esm.ESwitchManager(device_mappings, None) @@ -66,49 +69,52 @@ class TestESwitchManagerApi(base.BaseTestCase): def setUp(self): super(TestESwitchManagerApi, self).setUp() device_mappings = {'physnet1': 'p6p1'} - with mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "PciOsWrapper.scan_vf_devices", + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.PciOsWrapper.scan_vf_devices", return_value=self.SCANNED_DEVICES),\ - mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "PciOsWrapper.is_assigned_vf", return_value=True): + mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.PciOsWrapper.is_assigned_vf", + return_value=True): self.eswitch_mgr = esm.ESwitchManager(device_mappings, None) def test_get_assigned_devices(self): - with mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "EmbSwitch.get_assigned_devices", + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.EmbSwitch.get_assigned_devices", return_value=[self.ASSIGNED_MAC]): result = self.eswitch_mgr.get_assigned_devices() self.assertEqual(set([self.ASSIGNED_MAC]), result) def test_get_device_status_true(self): - with mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "EmbSwitch.get_pci_device", + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.EmbSwitch.get_pci_device", return_value=self.ASSIGNED_MAC),\ - mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "EmbSwitch.get_device_state", return_value=True): + mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.EmbSwitch.get_device_state", + return_value=True): result = self.eswitch_mgr.get_device_state(self.ASSIGNED_MAC, self.PCI_SLOT) self.assertTrue(result) def test_get_device_status_false(self): - with mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "EmbSwitch.get_pci_device", + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.EmbSwitch.get_pci_device", return_value=self.ASSIGNED_MAC),\ - mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "EmbSwitch.get_device_state", + mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.EmbSwitch.get_device_state", return_value=False): result = self.eswitch_mgr.get_device_state(self.ASSIGNED_MAC, self.PCI_SLOT) self.assertFalse(result) def test_get_device_status_mismatch(self): - with mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "EmbSwitch.get_pci_device", + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.EmbSwitch.get_pci_device", return_value=self.ASSIGNED_MAC),\ - mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "EmbSwitch.get_device_state", return_value=True): - with mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "LOG.warning") as log_mock: + mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.EmbSwitch.get_device_state", + return_value=True): + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.LOG.warning") as log_mock: result = self.eswitch_mgr.get_device_state(self.WRONG_MAC, self.PCI_SLOT) log_mock.assert_called_with('device pci mismatch: ' @@ -118,22 +124,22 @@ class TestESwitchManagerApi(base.BaseTestCase): self.assertFalse(result) def test_set_device_status(self): - with mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "EmbSwitch.get_pci_device", + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.EmbSwitch.get_pci_device", return_value=self.ASSIGNED_MAC),\ - mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "EmbSwitch.set_device_state"): + mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.EmbSwitch.set_device_state"): self.eswitch_mgr.set_device_state(self.ASSIGNED_MAC, self.PCI_SLOT, True) def test_set_device_status_mismatch(self): - with mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "EmbSwitch.get_pci_device", + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.EmbSwitch.get_pci_device", return_value=self.ASSIGNED_MAC),\ - mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "EmbSwitch.set_device_state"): - with mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "LOG.warning") as log_mock: + mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.EmbSwitch.set_device_state"): + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.LOG.warning") as log_mock: self.eswitch_mgr.set_device_state(self.WRONG_MAC, self.PCI_SLOT, True) log_mock.assert_called_with('device pci mismatch: ' @@ -142,8 +148,8 @@ class TestESwitchManagerApi(base.BaseTestCase): 'device_mac': self.WRONG_MAC}) def _mock_device_exists(self, pci_slot, mac_address, expected_result): - with mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "EmbSwitch.get_pci_device", + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.EmbSwitch.get_pci_device", return_value=self.ASSIGNED_MAC): result = self.eswitch_mgr.device_exists(mac_address, pci_slot) @@ -160,11 +166,11 @@ class TestESwitchManagerApi(base.BaseTestCase): False) def test_device_exists_mismatch(self): - with mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "EmbSwitch.get_pci_device", + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.EmbSwitch.get_pci_device", return_value=self.ASSIGNED_MAC): - with mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "LOG.warning") as log_mock: + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.LOG.warning") as log_mock: result = self.eswitch_mgr.device_exists(self.WRONG_MAC, self.PCI_SLOT) log_mock.assert_called_with('device pci mismatch: ' @@ -187,37 +193,38 @@ class TestEmbSwitch(base.BaseTestCase): def setUp(self): super(TestEmbSwitch, self).setUp() exclude_devices = set() - with mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "PciOsWrapper.scan_vf_devices", + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.PciOsWrapper.scan_vf_devices", return_value=self.SCANNED_DEVICES): self.emb_switch = esm.EmbSwitch(self.PHYS_NET, self.DEV_NAME, exclude_devices) def test_get_assigned_devices(self): - with mock.patch("neutron.plugins.sriovnicagent.pci_lib." + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent.pci_lib." "PciDeviceIPWrapper.get_assigned_macs", return_value=[self.ASSIGNED_MAC]),\ - mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "PciOsWrapper.is_assigned_vf", return_value=True): + mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.PciOsWrapper.is_assigned_vf", + return_value=True): result = self.emb_switch.get_assigned_devices() self.assertEqual([self.ASSIGNED_MAC], result) def test_get_assigned_devices_empty(self): - with mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "PciOsWrapper.is_assigned_vf", + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.PciOsWrapper.is_assigned_vf", return_value=False): result = self.emb_switch.get_assigned_devices() self.assertFalse(result) def test_get_device_state_ok(self): - with mock.patch("neutron.plugins.sriovnicagent.pci_lib." + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent.pci_lib." "PciDeviceIPWrapper.get_vf_state", return_value=False): result = self.emb_switch.get_device_state(self.PCI_SLOT) self.assertFalse(result) def test_get_device_state_fail(self): - with mock.patch("neutron.plugins.sriovnicagent.pci_lib." + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent.pci_lib." "PciDeviceIPWrapper.get_vf_state", return_value=False): self.assertRaises(exc.InvalidPciSlotError, @@ -225,35 +232,37 @@ class TestEmbSwitch(base.BaseTestCase): self.WRONG_PCI_SLOT) def test_set_device_state_ok(self): - with mock.patch("neutron.plugins.sriovnicagent.pci_lib." + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent.pci_lib." "PciDeviceIPWrapper.set_vf_state"): - with mock.patch("neutron.plugins.sriovnicagent.pci_lib.LOG." - "warning") as log_mock: + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "pci_lib.LOG.warning") as log_mock: self.emb_switch.set_device_state(self.PCI_SLOT, True) self.assertEqual(0, log_mock.call_count) def test_set_device_state_fail(self): - with mock.patch("neutron.plugins.sriovnicagent.pci_lib." + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent.pci_lib." "PciDeviceIPWrapper.set_vf_state"): self.assertRaises(exc.InvalidPciSlotError, self.emb_switch.set_device_state, self.WRONG_PCI_SLOT, True) def test_get_pci_device(self): - with mock.patch("neutron.plugins.sriovnicagent.pci_lib." + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent.pci_lib." "PciDeviceIPWrapper.get_assigned_macs", return_value=[self.ASSIGNED_MAC]),\ - mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "PciOsWrapper.is_assigned_vf", return_value=True): + mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.PciOsWrapper.is_assigned_vf", + return_value=True): result = self.emb_switch.get_pci_device(self.PCI_SLOT) self.assertEqual(self.ASSIGNED_MAC, result) def test_get_pci_device_fail(self): - with mock.patch("neutron.plugins.sriovnicagent.pci_lib." + with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent.pci_lib." "PciDeviceIPWrapper.get_assigned_macs", return_value=[self.ASSIGNED_MAC]),\ - mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." - "PciOsWrapper.is_assigned_vf", return_value=True): + mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent." + "eswitch_manager.PciOsWrapper.is_assigned_vf", + return_value=True): result = self.emb_switch.get_pci_device(self.WRONG_PCI_SLOT) self.assertIsNone(result) diff --git a/neutron/tests/unit/plugins/sriovnicagent/test_pci_lib.py b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/test_pci_lib.py similarity index 96% rename from neutron/tests/unit/plugins/sriovnicagent/test_pci_lib.py rename to neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/test_pci_lib.py index 17862c9185d..62a10f0fba0 100644 --- a/neutron/tests/unit/plugins/sriovnicagent/test_pci_lib.py +++ b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/test_pci_lib.py @@ -16,8 +16,9 @@ import mock -from neutron.plugins.sriovnicagent.common import exceptions as exc -from neutron.plugins.sriovnicagent import pci_lib +from neutron.plugins.ml2.drivers.mech_sriov.agent.common \ + import exceptions as exc +from neutron.plugins.ml2.drivers.mech_sriov.agent import pci_lib from neutron.tests import base diff --git a/neutron/tests/unit/plugins/sriovnicagent/test_sriov_nic_agent.py b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/test_sriov_nic_agent.py similarity index 98% rename from neutron/tests/unit/plugins/sriovnicagent/test_sriov_nic_agent.py rename to neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/test_sriov_nic_agent.py index 2fc6ad09edb..5e16c15b3a9 100644 --- a/neutron/tests/unit/plugins/sriovnicagent/test_sriov_nic_agent.py +++ b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/test_sriov_nic_agent.py @@ -17,8 +17,8 @@ import mock from oslo_config import cfg -from neutron.plugins.sriovnicagent.common import config # noqa -from neutron.plugins.sriovnicagent import sriov_nic_agent +from neutron.plugins.ml2.drivers.mech_sriov.agent.common import config # noqa +from neutron.plugins.ml2.drivers.mech_sriov.agent import sriov_nic_agent from neutron.tests import base DEVICE_MAC = '11:22:33:44:55:66' diff --git a/neutron/tests/unit/plugins/sriovnicagent/common/__init__.py b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/mech_driver/__init__.py similarity index 100% rename from neutron/tests/unit/plugins/sriovnicagent/common/__init__.py rename to neutron/tests/unit/plugins/ml2/drivers/mech_sriov/mech_driver/__init__.py diff --git a/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/test_mech_sriov_nic_switch.py b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/mech_driver/test_mech_sriov_nic_switch.py similarity index 97% rename from neutron/tests/unit/plugins/ml2/drivers/mech_sriov/test_mech_sriov_nic_switch.py rename to neutron/tests/unit/plugins/ml2/drivers/mech_sriov/mech_driver/test_mech_sriov_nic_switch.py index ffe80768933..8b28eb087ed 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/test_mech_sriov_nic_switch.py +++ b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/mech_driver/test_mech_sriov_nic_switch.py @@ -22,8 +22,9 @@ from neutron.extensions import portbindings from neutron.plugins.common import constants as p_const from neutron.plugins.ml2 import config # noqa from neutron.plugins.ml2 import driver_api as api -from neutron.plugins.ml2.drivers.mech_sriov import exceptions as exc -from neutron.plugins.ml2.drivers.mech_sriov import mech_driver +from neutron.plugins.ml2.drivers.mech_sriov.mech_driver \ + import exceptions as exc +from neutron.plugins.ml2.drivers.mech_sriov.mech_driver import mech_driver from neutron.tests.unit.plugins.ml2 import _test_mech_agent as base MELLANOX_CONNECTX3_PCI_INFO = '15b3:1004' @@ -165,7 +166,7 @@ class SriovSwitchMechProfileTestCase(SriovNicSwitchMechanismBaseTestCase): def test_profile_unsupported_pci_info(self): with mock.patch('neutron.plugins.ml2.drivers.mech_sriov.' - 'mech_driver.LOG') as log_mock: + 'mech_driver.mech_driver.LOG') as log_mock: self._check_vif_for_pci_info('xxxx:yyyy', None) log_mock.debug.assert_called_with('Refusing to bind due to ' 'unsupported pci_vendor device') @@ -182,14 +183,14 @@ class SriovSwitchMechProfileFailTestCase(SriovNicSwitchMechanismBaseTestCase): def test_profile_missing_profile(self): with mock.patch('neutron.plugins.ml2.drivers.mech_sriov.' - 'mech_driver.LOG') as log_mock: + 'mech_driver.mech_driver.LOG') as log_mock: self._check_for_pci_vendor_info({}) log_mock.debug.assert_called_with("Missing profile in port" " binding") def test_profile_missing_pci_vendor_info(self): with mock.patch('neutron.plugins.ml2.drivers.mech_sriov.' - 'mech_driver.LOG') as log_mock: + 'mech_driver.mech_driver.LOG') as log_mock: self._check_for_pci_vendor_info({'aa': 'bb'}) log_mock.debug.assert_called_with("Missing pci vendor" " info in profile") diff --git a/setup.cfg b/setup.cfg index be54b3a1de5..4b10e3ea285 100644 --- a/setup.cfg +++ b/setup.cfg @@ -110,7 +110,7 @@ console_scripts = neutron-rootwrap-daemon = oslo_rootwrap.cmd:daemon neutron-usage-audit = neutron.cmd.usage_audit:main neutron-metering-agent = neutron.cmd.eventlet.services.metering_agent:main - neutron-sriov-nic-agent = neutron.plugins.sriovnicagent.sriov_nic_agent:main + neutron-sriov-nic-agent = neutron.plugins.ml2.drivers.mech_sriov.agent.sriovnicagent.sriov_nic_agent:main neutron-sanity-check = neutron.cmd.sanity_check:main neutron-cisco-apic-service-agent = neutron.plugins.ml2.drivers.cisco.apic.apic_topology:service_main neutron-cisco-apic-host-agent = neutron.plugins.ml2.drivers.cisco.apic.apic_topology:agent_main @@ -187,7 +187,7 @@ neutron.ml2.mechanism_drivers = brocade = networking_brocade.vdx.ml2driver.mechanism_brocade:BrocadeMechanism brocade_fi_ni = neutron.plugins.ml2.drivers.brocade.fi_ni.mechanism_brocade_fi_ni:BrocadeFiNiMechanism fslsdn = neutron.plugins.ml2.drivers.freescale.mechanism_fslsdn:FslsdnMechanismDriver - sriovnicswitch = neutron.plugins.ml2.drivers.mech_sriov.mech_driver:SriovNicSwitchMechanismDriver + sriovnicswitch = neutron.plugins.ml2.drivers.mech_sriov.mech_driver.mech_driver:SriovNicSwitchMechanismDriver nuage = neutron.plugins.ml2.drivers.mech_nuage.driver:NuageMechanismDriver fake_agent = neutron.tests.unit.plugins.ml2.drivers.mech_fake_agent:FakeAgentMechanismDriver sdnve = neutron.plugins.ml2.drivers.ibm.mechanism_sdnve:SdnveMechanismDriver diff --git a/tools/check_unit_test_structure.sh b/tools/check_unit_test_structure.sh index 673b2f9cc5a..191c86a8aec 100755 --- a/tools/check_unit_test_structure.sh +++ b/tools/check_unit_test_structure.sh @@ -21,7 +21,7 @@ ignore_regexes=( # The following open source plugin tests are not actually unit # tests and are ignored pending their relocation to the functional # test tree. - "^plugins/ml2/drivers/mech_sriov/test_mech_sriov_nic_switch.py$" + "^plugins/ml2/drivers/mech_sriov/mech_driver/test_mech_sriov_nic_switch.py$" "^plugins/ml2/test_security_group.py$" "^plugins/ml2/test_port_binding.py$" "^plugins/ml2/test_extension_driver_api.py$" diff --git a/tox.ini b/tox.ini index 28184b94482..dd78040a24f 100644 --- a/tox.ini +++ b/tox.ini @@ -106,10 +106,8 @@ commands = sphinx-build -W -b html doc/source doc/build/html commands = python -m testtools.run \ neutron.tests.unit.services.metering.drivers.test_iptables \ neutron.tests.unit.services.l3_router.test_l3_apic \ - neutron.tests.unit.plugins.sriovnicagent.test_sriov_nic_agent \ - neutron.tests.unit.plugins.sriovnicagent.test_eswitch_manager \ - neutron.tests.unit.plugins.sriovnicagent.common.test_config \ - neutron.tests.unit.plugins.sriovnicagent.test_pci_lib \ + neutron.tests.unit.plugins.ml2.drivers.mech_sriov.agent.test_sriov_nic_agent \ + neutron.tests.unit.plugins.ml2.drivers.mech_sriov.agent.test_pci_lib \ neutron.tests.unit.plugins.ml2.drivers.openvswitch.agent.ovs_test_base \ neutron.tests.unit.plugins.ml2.drivers.openvswitch.agent.openflow.ovs_ofctl.test_br_phys \ neutron.tests.unit.plugins.ml2.drivers.openvswitch.agent.openflow.ovs_ofctl.test_br_int \ @@ -129,7 +127,7 @@ commands = python -m testtools.run \ neutron.tests.unit.plugins.ml2.drivers.base_type_tunnel \ neutron.tests.unit.plugins.ml2.drivers.opendaylight.test_driver \ neutron.tests.unit.plugins.ml2.drivers.ext_test \ - neutron.tests.unit.plugins.ml2.drivers.mech_sriov.test_mech_sriov_nic_switch \ + neutron.tests.unit.plugins.ml2.drivers.mech_sriov.mech_driver.test_mech_sriov_nic_switch \ neutron.tests.unit.plugins.ml2.drivers.mech_fake_agent \ neutron.tests.unit.plugins.ml2.drivers.test_type_vxlan \ neutron.tests.unit.plugins.ml2.drivers.test_type_gre \