Change import path.
neutron.db -> neutron_lib.db neutron.manager.NeutronManager -> neutron_lib.plugins.directory Change-Id: I1d6d9b60a2fc830e77134727ebb07e5105a9ceab
This commit is contained in:
parent
7f8d01f9d9
commit
4edc55fff8
|
@ -18,7 +18,7 @@
|
||||||
from logging import config as logging_config
|
from logging import config as logging_config
|
||||||
|
|
||||||
from alembic import context
|
from alembic import context
|
||||||
from neutron.db import model_base
|
from neutron_lib.db import model_base
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_db.sqlalchemy import session
|
from oslo_db.sqlalchemy import session
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
|
@ -16,11 +16,11 @@ from oslo_config import cfg
|
||||||
|
|
||||||
from neutron.extensions import portbindings
|
from neutron.extensions import portbindings
|
||||||
from neutron.extensions import portsecurity as psec
|
from neutron.extensions import portsecurity as psec
|
||||||
from neutron import manager
|
|
||||||
from neutron.plugins.ml2 import driver_api as api
|
from neutron.plugins.ml2 import driver_api as api
|
||||||
from neutron.plugins.ml2 import rpc
|
from neutron.plugins.ml2 import rpc
|
||||||
from neutron.services.qos import qos_consts
|
from neutron.services.qos import qos_consts
|
||||||
from neutron_lib import constants
|
from neutron_lib import constants
|
||||||
|
from neutron_lib.plugins import directory
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
from networking_nec._i18n import _LW, _LI
|
from networking_nec._i18n import _LW, _LI
|
||||||
|
@ -49,7 +49,7 @@ class NwaML2ServerRpcCallbacks(rpc.RpcCallbacks):
|
||||||
"%(agent_id)s with host %(host)s",
|
"%(agent_id)s with host %(host)s",
|
||||||
{'device': device, 'agent_id': agent_id, 'host': host})
|
{'device': device, 'agent_id': agent_id, 'host': host})
|
||||||
|
|
||||||
plugin = manager.NeutronManager.get_plugin()
|
plugin = directory.get_plugin()
|
||||||
port_id = plugin._device_to_port_id(rpc_context, device)
|
port_id = plugin._device_to_port_id(rpc_context, device)
|
||||||
port_context = plugin.get_bound_port_context(rpc_context,
|
port_context = plugin.get_bound_port_context(rpc_context,
|
||||||
port_id,
|
port_id,
|
||||||
|
|
|
@ -16,8 +16,8 @@ from neutron.db import api as db_api
|
||||||
from neutron.db.models import segment as segments_db
|
from neutron.db.models import segment as segments_db
|
||||||
from neutron.db import models_v2
|
from neutron.db import models_v2
|
||||||
from neutron.db import segments_db as db_ml2
|
from neutron.db import segments_db as db_ml2
|
||||||
from neutron import manager
|
|
||||||
from neutron_lib import constants
|
from neutron_lib import constants
|
||||||
|
from neutron_lib.plugins import directory
|
||||||
from oslo_log import helpers
|
from oslo_log import helpers
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
import oslo_messaging
|
import oslo_messaging
|
||||||
|
@ -33,7 +33,7 @@ class NwaL2ServerRpcCallback(object):
|
||||||
target = oslo_messaging.Target(version='1.0')
|
target = oslo_messaging.Target(version='1.0')
|
||||||
|
|
||||||
def get_nwa_network_by_port_id(self, rpc_context, **kwargs):
|
def get_nwa_network_by_port_id(self, rpc_context, **kwargs):
|
||||||
plugin = manager.NeutronManager.get_plugin()
|
plugin = directory.get_plugin()
|
||||||
port_id = kwargs.get('port_id')
|
port_id = kwargs.get('port_id')
|
||||||
port = plugin.get_port(rpc_context, port_id)
|
port = plugin.get_port(rpc_context, port_id)
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class NwaL2ServerRpcCallback(object):
|
||||||
return network
|
return network
|
||||||
|
|
||||||
def get_nwa_network_by_subnet_id(self, rpc_context, **kwargs):
|
def get_nwa_network_by_subnet_id(self, rpc_context, **kwargs):
|
||||||
plugin = manager.NeutronManager.get_plugin()
|
plugin = directory.get_plugin()
|
||||||
subnet_id = kwargs.get('subnet_id')
|
subnet_id = kwargs.get('subnet_id')
|
||||||
subnet = plugin.get_subnet(rpc_context, subnet_id)
|
subnet = plugin.get_subnet(rpc_context, subnet_id)
|
||||||
|
|
||||||
|
@ -51,14 +51,14 @@ class NwaL2ServerRpcCallback(object):
|
||||||
return network
|
return network
|
||||||
|
|
||||||
def get_nwa_network(self, rpc_context, **kwargs):
|
def get_nwa_network(self, rpc_context, **kwargs):
|
||||||
plugin = manager.NeutronManager.get_plugin()
|
plugin = directory.get_plugin()
|
||||||
net_id = kwargs.get('network_id')
|
net_id = kwargs.get('network_id')
|
||||||
network = plugin.get_network(rpc_context, net_id)
|
network = plugin.get_network(rpc_context, net_id)
|
||||||
|
|
||||||
return network
|
return network
|
||||||
|
|
||||||
def get_nwa_networks(self, rpc_context, **kwargs):
|
def get_nwa_networks(self, rpc_context, **kwargs):
|
||||||
plugin = manager.NeutronManager.get_plugin()
|
plugin = directory.get_plugin()
|
||||||
networks = plugin.get_networks(rpc_context)
|
networks = plugin.get_networks(rpc_context)
|
||||||
|
|
||||||
return networks
|
return networks
|
||||||
|
@ -85,7 +85,7 @@ class NwaL2ServerRpcCallback(object):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# 2 change port state
|
# 2 change port state
|
||||||
plugin = manager.NeutronManager.get_plugin()
|
plugin = directory.get_plugin()
|
||||||
plugin.update_port_status(
|
plugin.update_port_status(
|
||||||
rpc_context,
|
rpc_context,
|
||||||
port_id,
|
port_id,
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from neutron.db import api as db_api
|
from neutron.db import api as db_api
|
||||||
from neutron import manager
|
from neutron_lib.plugins import directory
|
||||||
from oslo_log import helpers
|
from oslo_log import helpers
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
import oslo_messaging
|
import oslo_messaging
|
||||||
|
@ -122,7 +122,7 @@ class TenantBindingServerRpcCallback(object):
|
||||||
with session.begin(subtransactions=True):
|
with session.begin(subtransactions=True):
|
||||||
q_tids = [q.tenant_id
|
q_tids = [q.tenant_id
|
||||||
for q in necnwa_api.get_nwa_tenant_queues(session)]
|
for q in necnwa_api.get_nwa_tenant_queues(session)]
|
||||||
plugin = manager.NeutronManager.get_plugin()
|
plugin = directory.get_plugin()
|
||||||
tenant_ids = [server['tenant_id'] for server in kwargs['servers']]
|
tenant_ids = [server['tenant_id'] for server in kwargs['servers']]
|
||||||
ret = []
|
ret = []
|
||||||
for tenant_id in set(q_tids) - set(tenant_ids):
|
for tenant_id in set(q_tids) - set(tenant_ids):
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from neutron.extensions import l3
|
from neutron.extensions import l3
|
||||||
from neutron import manager
|
from neutron_lib import constants
|
||||||
from neutron.plugins.common import constants as plugin_constants
|
from neutron_lib.plugins import directory
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
import oslo_messaging
|
import oslo_messaging
|
||||||
|
|
||||||
|
@ -28,8 +28,7 @@ class NwaL3ServerRpcCallback(object):
|
||||||
@property
|
@property
|
||||||
def l3plugin(self):
|
def l3plugin(self):
|
||||||
if not hasattr(self, '_l3plugin'):
|
if not hasattr(self, '_l3plugin'):
|
||||||
self._l3plugin = manager.NeutronManager.get_service_plugins()[
|
self._l3plugin = directory.get_plugin(constants.L3)
|
||||||
plugin_constants.L3_ROUTER_NAT]
|
|
||||||
return self._l3plugin
|
return self._l3plugin
|
||||||
|
|
||||||
def update_floatingip_status(self, context, floatingip_id, status):
|
def update_floatingip_status(self, context, floatingip_id, status):
|
||||||
|
|
|
@ -64,7 +64,7 @@ class TestNECNWAServerRpcCallbacks(base.BaseTestCase):
|
||||||
'NECNWAL2Plugin.get_bound_port_context')
|
'NECNWAL2Plugin.get_bound_port_context')
|
||||||
@mock.patch('networking_nec.nwa.l2.plugin.'
|
@mock.patch('networking_nec.nwa.l2.plugin.'
|
||||||
'NECNWAL2Plugin._device_to_port_id')
|
'NECNWAL2Plugin._device_to_port_id')
|
||||||
@mock.patch('neutron.manager.NeutronManager.get_plugin')
|
@mock.patch('neutron_lib.plugins.directory.get_plugin')
|
||||||
def test_get_device_details(self, f1, f2, f3):
|
def test_get_device_details(self, f1, f2, f3):
|
||||||
rpc_context = mock.MagicMock()
|
rpc_context = mock.MagicMock()
|
||||||
f1.return_value = self.l2_plugin
|
f1.return_value = self.l2_plugin
|
||||||
|
@ -82,7 +82,7 @@ class TestNECNWAServerRpcCallbacks(base.BaseTestCase):
|
||||||
'NECNWAL2Plugin.get_bound_port_context')
|
'NECNWAL2Plugin.get_bound_port_context')
|
||||||
@mock.patch('networking_nec.nwa.l2.plugin.'
|
@mock.patch('networking_nec.nwa.l2.plugin.'
|
||||||
'NECNWAL2Plugin._device_to_port_id')
|
'NECNWAL2Plugin._device_to_port_id')
|
||||||
@mock.patch('neutron.manager.NeutronManager.get_plugin')
|
@mock.patch('neutron_lib.plugins.directory.get_plugin')
|
||||||
def test_get_device_details_no_segment(self, f1, f2, f3, f4, f5, f6):
|
def test_get_device_details_no_segment(self, f1, f2, f3, f4, f5, f6):
|
||||||
rpc_context = mock.MagicMock()
|
rpc_context = mock.MagicMock()
|
||||||
f1.return_value = self.l2_plugin
|
f1.return_value = self.l2_plugin
|
||||||
|
@ -102,7 +102,7 @@ class TestNECNWAServerRpcCallbacks(base.BaseTestCase):
|
||||||
'NECNWAL2Plugin.get_bound_port_context')
|
'NECNWAL2Plugin.get_bound_port_context')
|
||||||
@mock.patch('networking_nec.nwa.l2.plugin.'
|
@mock.patch('networking_nec.nwa.l2.plugin.'
|
||||||
'NECNWAL2Plugin._device_to_port_id')
|
'NECNWAL2Plugin._device_to_port_id')
|
||||||
@mock.patch('neutron.manager.NeutronManager.get_plugin')
|
@mock.patch('neutron_lib.plugins.directory.get_plugin')
|
||||||
def test_get_device_details_multi_segment(self, f1, f2, f3, f4, f5, f6):
|
def test_get_device_details_multi_segment(self, f1, f2, f3, f4, f5, f6):
|
||||||
rpc_context = mock.MagicMock()
|
rpc_context = mock.MagicMock()
|
||||||
f1.return_value = self.l2_plugin
|
f1.return_value = self.l2_plugin
|
||||||
|
@ -122,7 +122,7 @@ class TestNECNWAServerRpcCallbacks(base.BaseTestCase):
|
||||||
'NECNWAL2Plugin.get_bound_port_context')
|
'NECNWAL2Plugin.get_bound_port_context')
|
||||||
@mock.patch('networking_nec.nwa.l2.plugin.'
|
@mock.patch('networking_nec.nwa.l2.plugin.'
|
||||||
'NECNWAL2Plugin._device_to_port_id')
|
'NECNWAL2Plugin._device_to_port_id')
|
||||||
@mock.patch('neutron.manager.NeutronManager.get_plugin')
|
@mock.patch('neutron_lib.plugins.directory.get_plugin')
|
||||||
def test_get_device_details_segment_size_miss_match(self, f1, f2, f3, f4,
|
def test_get_device_details_segment_size_miss_match(self, f1, f2, f3, f4,
|
||||||
f5, f6):
|
f5, f6):
|
||||||
rpc_context = mock.MagicMock()
|
rpc_context = mock.MagicMock()
|
||||||
|
@ -141,7 +141,7 @@ class TestNECNWAServerRpcCallbacks(base.BaseTestCase):
|
||||||
'NECNWAL2Plugin.get_bound_port_context')
|
'NECNWAL2Plugin.get_bound_port_context')
|
||||||
@mock.patch('networking_nec.nwa.l2.plugin.'
|
@mock.patch('networking_nec.nwa.l2.plugin.'
|
||||||
'NECNWAL2Plugin._device_to_port_id')
|
'NECNWAL2Plugin._device_to_port_id')
|
||||||
@mock.patch('neutron.manager.NeutronManager.get_plugin')
|
@mock.patch('neutron_lib.plugins.directory.get_plugin')
|
||||||
def test_get_device_details_segment_zero(self, f1, f2, f3, f4, f5, f6):
|
def test_get_device_details_segment_zero(self, f1, f2, f3, f4, f5, f6):
|
||||||
rpc_context = mock.MagicMock()
|
rpc_context = mock.MagicMock()
|
||||||
f1.return_value = self.l2_plugin
|
f1.return_value = self.l2_plugin
|
||||||
|
@ -162,7 +162,7 @@ class TestNECNWAServerRpcCallbacks(base.BaseTestCase):
|
||||||
'NECNWAL2Plugin.get_bound_port_context')
|
'NECNWAL2Plugin.get_bound_port_context')
|
||||||
@mock.patch('networking_nec.nwa.l2.plugin.'
|
@mock.patch('networking_nec.nwa.l2.plugin.'
|
||||||
'NECNWAL2Plugin._device_to_port_id')
|
'NECNWAL2Plugin._device_to_port_id')
|
||||||
@mock.patch('neutron.manager.NeutronManager.get_plugin')
|
@mock.patch('neutron_lib.plugins.directory.get_plugin')
|
||||||
def test_get_device_details_segment_not_binding(self, f1, f2, f3, f4, f5,
|
def test_get_device_details_segment_not_binding(self, f1, f2, f3, f4, f5,
|
||||||
f6, f7):
|
f6, f7):
|
||||||
rpc_context = mock.MagicMock()
|
rpc_context = mock.MagicMock()
|
||||||
|
@ -192,7 +192,7 @@ class TestNECNWAServerRpcCallbacks(base.BaseTestCase):
|
||||||
'NECNWAL2Plugin.get_bound_port_context')
|
'NECNWAL2Plugin.get_bound_port_context')
|
||||||
@mock.patch('networking_nec.nwa.l2.plugin.'
|
@mock.patch('networking_nec.nwa.l2.plugin.'
|
||||||
'NECNWAL2Plugin._device_to_port_id')
|
'NECNWAL2Plugin._device_to_port_id')
|
||||||
@mock.patch('neutron.manager.NeutronManager.get_plugin')
|
@mock.patch('neutron_lib.plugins.directory.get_plugin')
|
||||||
def test_get_device_details_bound_segment(self, f1, f2, f3, f4, f5,
|
def test_get_device_details_bound_segment(self, f1, f2, f3, f4, f5,
|
||||||
f6, f7):
|
f6, f7):
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ class TestNECNWAServerRpcCallbacks(base.BaseTestCase):
|
||||||
'NECNWAL2Plugin.get_bound_port_context')
|
'NECNWAL2Plugin.get_bound_port_context')
|
||||||
@mock.patch('networking_nec.nwa.l2.plugin.'
|
@mock.patch('networking_nec.nwa.l2.plugin.'
|
||||||
'NECNWAL2Plugin._device_to_port_id')
|
'NECNWAL2Plugin._device_to_port_id')
|
||||||
@mock.patch('neutron.manager.NeutronManager.get_plugin')
|
@mock.patch('neutron_lib.plugins.directory.get_plugin')
|
||||||
def test_get_device_details_port_state_change(self, f1, f2, f3, f4, f5,
|
def test_get_device_details_port_state_change(self, f1, f2, f3, f4, f5,
|
||||||
f6, f7):
|
f6, f7):
|
||||||
rpc_context = mock.MagicMock()
|
rpc_context = mock.MagicMock()
|
||||||
|
@ -237,7 +237,7 @@ class TestNECNWAServerRpcCallbacks(base.BaseTestCase):
|
||||||
kwargs={'test': "sample"})
|
kwargs={'test': "sample"})
|
||||||
self.assertTrue(device)
|
self.assertTrue(device)
|
||||||
|
|
||||||
@mock.patch('neutron.manager.NeutronManager.get_plugin')
|
@mock.patch('neutron_lib.plugins.directory.get_plugin')
|
||||||
def test_update_device_up(self, dummy1):
|
def test_update_device_up(self, dummy1):
|
||||||
rpc_context = mock.MagicMock()
|
rpc_context = mock.MagicMock()
|
||||||
dummy1.return_value = None
|
dummy1.return_value = None
|
||||||
|
|
|
@ -26,7 +26,7 @@ class TestTenantBindingServerRpcCallback(base.BaseTestCase):
|
||||||
self.callback = tenant_cb.TenantBindingServerRpcCallback()
|
self.callback = tenant_cb.TenantBindingServerRpcCallback()
|
||||||
|
|
||||||
@mock.patch('neutron.db.api.get_session')
|
@mock.patch('neutron.db.api.get_session')
|
||||||
@mock.patch('neutron.manager.NeutronManager.get_plugin')
|
@mock.patch('neutron_lib.plugins.directory.get_plugin')
|
||||||
@mock.patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_queues')
|
@mock.patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_queues')
|
||||||
def test_update_tenant_rpc_servers_both_empty(self, gntq, gs, gp):
|
def test_update_tenant_rpc_servers_both_empty(self, gntq, gs, gp):
|
||||||
gntq.return_value = []
|
gntq.return_value = []
|
||||||
|
@ -36,7 +36,7 @@ class TestTenantBindingServerRpcCallback(base.BaseTestCase):
|
||||||
self.assertEqual(rd, {'servers': []})
|
self.assertEqual(rd, {'servers': []})
|
||||||
|
|
||||||
@mock.patch('neutron.db.api.get_session')
|
@mock.patch('neutron.db.api.get_session')
|
||||||
@mock.patch('neutron.manager.NeutronManager.get_plugin')
|
@mock.patch('neutron_lib.plugins.directory.get_plugin')
|
||||||
@mock.patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_queues')
|
@mock.patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_queues')
|
||||||
def test_update_tenant_rpc_servers_both_equal(self, gntq, plugin, gs):
|
def test_update_tenant_rpc_servers_both_equal(self, gntq, plugin, gs):
|
||||||
q1 = mock.MagicMock()
|
q1 = mock.MagicMock()
|
||||||
|
@ -50,7 +50,7 @@ class TestTenantBindingServerRpcCallback(base.BaseTestCase):
|
||||||
self.assertEqual(plugin.nwa_rpc.delete_server.call_count, 0)
|
self.assertEqual(plugin.nwa_rpc.delete_server.call_count, 0)
|
||||||
|
|
||||||
@mock.patch('neutron.db.api.get_session')
|
@mock.patch('neutron.db.api.get_session')
|
||||||
@mock.patch('neutron.manager.NeutronManager.get_plugin')
|
@mock.patch('neutron_lib.plugins.directory.get_plugin')
|
||||||
@mock.patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_queues')
|
@mock.patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_queues')
|
||||||
def test_update_tenant_rpc_servers_create(self, gntq, gp, gs):
|
def test_update_tenant_rpc_servers_create(self, gntq, gp, gs):
|
||||||
q1 = mock.MagicMock()
|
q1 = mock.MagicMock()
|
||||||
|
@ -67,7 +67,7 @@ class TestTenantBindingServerRpcCallback(base.BaseTestCase):
|
||||||
self.assertEqual(plugin.nwa_rpc.delete_server.call_count, 0)
|
self.assertEqual(plugin.nwa_rpc.delete_server.call_count, 0)
|
||||||
|
|
||||||
@mock.patch('neutron.db.api.get_session')
|
@mock.patch('neutron.db.api.get_session')
|
||||||
@mock.patch('neutron.manager.NeutronManager.get_plugin')
|
@mock.patch('neutron_lib.plugins.directory.get_plugin')
|
||||||
@mock.patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_queues')
|
@mock.patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_queues')
|
||||||
def test_update_tenant_rpc_servers_delete(self, gntq, gp, gs):
|
def test_update_tenant_rpc_servers_delete(self, gntq, gp, gs):
|
||||||
gntq.return_value = []
|
gntq.return_value = []
|
||||||
|
|
Loading…
Reference in New Issue