From 1d2dda1d3cbd3f7ad2df8fb0bce24271b1240bdc Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Mon, 2 Jun 2014 15:47:46 +0200 Subject: [PATCH] Introduced rpc_compat.create_connection() This will be used to emulate oslo-rpc API using oslo.messaging. blueprint oslo-messaging Change-Id: I2c1aa159132e4aad0138d4b0b7ff90eb98ed400c --- neutron/services/vpn/device_drivers/cisco_ipsec.py | 3 +-- neutron/services/vpn/device_drivers/ipsec.py | 3 +-- neutron/services/vpn/service_drivers/cisco_ipsec.py | 3 +-- neutron/services/vpn/service_drivers/ipsec.py | 3 +-- .../unit/services/vpn/device_drivers/test_cisco_ipsec.py | 2 +- neutron/tests/unit/services/vpn/device_drivers/test_ipsec.py | 2 +- .../unit/services/vpn/service_drivers/test_cisco_ipsec.py | 4 ++-- neutron/tests/unit/services/vpn/service_drivers/test_ipsec.py | 2 +- 8 files changed, 9 insertions(+), 13 deletions(-) diff --git a/neutron/services/vpn/device_drivers/cisco_ipsec.py b/neutron/services/vpn/device_drivers/cisco_ipsec.py index 9a6288072..ba19460d7 100644 --- a/neutron/services/vpn/device_drivers/cisco_ipsec.py +++ b/neutron/services/vpn/device_drivers/cisco_ipsec.py @@ -29,7 +29,6 @@ from neutron import context as ctx from neutron.openstack.common import lockutils from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall -from neutron.openstack.common import rpc from neutron.plugins.common import constants from neutron.plugins.common import utils as plugin_utils from neutron.services.vpn.common import topics @@ -192,7 +191,7 @@ class CiscoCsrIPsecDriver(device_drivers.DeviceDriver): # TODO(ihrachys): we can't use RpcCallback here due to # inheritance issues self.host = host - self.conn = rpc.create_connection(new=True) + self.conn = rpc_compat.create_connection(new=True) context = ctx.get_admin_context_without_session() node_topic = '%s.%s' % (topics.CISCO_IPSEC_AGENT_TOPIC, self.host) diff --git a/neutron/services/vpn/device_drivers/ipsec.py b/neutron/services/vpn/device_drivers/ipsec.py index 893ddc88f..0d9ded960 100644 --- a/neutron/services/vpn/device_drivers/ipsec.py +++ b/neutron/services/vpn/device_drivers/ipsec.py @@ -33,7 +33,6 @@ from neutron import context from neutron.openstack.common import lockutils from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall -from neutron.openstack.common import rpc from neutron.plugins.common import constants from neutron.plugins.common import utils as plugin_utils from neutron.services.vpn.common import topics @@ -495,7 +494,7 @@ class IPsecDriver(device_drivers.DeviceDriver): self.conf = self.agent.conf self.root_helper = self.agent.root_helper self.host = host - self.conn = rpc.create_connection(new=True) + self.conn = rpc_compat.create_connection(new=True) self.context = context.get_admin_context_without_session() self.topic = topics.IPSEC_AGENT_TOPIC node_topic = '%s.%s' % (self.topic, self.host) diff --git a/neutron/services/vpn/service_drivers/cisco_ipsec.py b/neutron/services/vpn/service_drivers/cisco_ipsec.py index 1d33da50e..856572319 100644 --- a/neutron/services/vpn/service_drivers/cisco_ipsec.py +++ b/neutron/services/vpn/service_drivers/cisco_ipsec.py @@ -20,7 +20,6 @@ from neutron.common import rpc as n_rpc from neutron.common import rpc_compat from neutron.openstack.common import excutils from neutron.openstack.common import log as logging -from neutron.openstack.common import rpc from neutron.plugins.common import constants from neutron.services.vpn.common import topics from neutron.services.vpn import service_drivers @@ -91,7 +90,7 @@ class CiscoCsrIPsecVPNDriver(service_drivers.VpnDriver): def __init__(self, service_plugin): super(CiscoCsrIPsecVPNDriver, self).__init__(service_plugin) self.callbacks = CiscoCsrIPsecVpnDriverCallBack(self) - self.conn = rpc.create_connection(new=True) + self.conn = rpc_compat.create_connection(new=True) self.conn.create_consumer( topics.CISCO_IPSEC_DRIVER_TOPIC, self.callbacks.create_rpc_dispatcher(), diff --git a/neutron/services/vpn/service_drivers/ipsec.py b/neutron/services/vpn/service_drivers/ipsec.py index 9e529fd09..cf4b055d8 100644 --- a/neutron/services/vpn/service_drivers/ipsec.py +++ b/neutron/services/vpn/service_drivers/ipsec.py @@ -19,7 +19,6 @@ import netaddr from neutron.common import rpc as n_rpc from neutron.common import rpc_compat from neutron.openstack.common import log as logging -from neutron.openstack.common import rpc from neutron.services.vpn.common import topics from neutron.services.vpn import service_drivers @@ -76,7 +75,7 @@ class IPsecVPNDriver(service_drivers.VpnDriver): def __init__(self, service_plugin): super(IPsecVPNDriver, self).__init__(service_plugin) self.callbacks = IPsecVpnDriverCallBack(self) - self.conn = rpc.create_connection(new=True) + self.conn = rpc_compat.create_connection(new=True) self.conn.create_consumer( topics.IPSEC_DRIVER_TOPIC, self.callbacks.create_rpc_dispatcher(), diff --git a/neutron/tests/unit/services/vpn/device_drivers/test_cisco_ipsec.py b/neutron/tests/unit/services/vpn/device_drivers/test_cisco_ipsec.py index 562416bd4..20f2ccba3 100644 --- a/neutron/tests/unit/services/vpn/device_drivers/test_cisco_ipsec.py +++ b/neutron/tests/unit/services/vpn/device_drivers/test_cisco_ipsec.py @@ -399,7 +399,7 @@ class TestCiscoCsrIPsecDeviceDriverSyncStatuses(base.BaseTestCase): def setUp(self): super(TestCiscoCsrIPsecDeviceDriverSyncStatuses, self).setUp() - for klass in ['neutron.openstack.common.rpc.create_connection', + for klass in ['neutron.common.rpc_compat.create_connection', 'neutron.context.get_admin_context_without_session', 'neutron.openstack.common.' 'loopingcall.FixedIntervalLoopingCall']: diff --git a/neutron/tests/unit/services/vpn/device_drivers/test_ipsec.py b/neutron/tests/unit/services/vpn/device_drivers/test_ipsec.py index c7bc4d719..29867a144 100644 --- a/neutron/tests/unit/services/vpn/device_drivers/test_ipsec.py +++ b/neutron/tests/unit/services/vpn/device_drivers/test_ipsec.py @@ -47,7 +47,7 @@ class TestIPsecDeviceDriver(base.BaseTestCase): 'os.makedirs', 'os.path.isdir', 'neutron.agent.linux.utils.replace_file', - 'neutron.openstack.common.rpc.create_connection', + 'neutron.common.rpc_compat.create_connection', 'neutron.services.vpn.device_drivers.ipsec.' 'OpenSwanProcess._gen_config_content', 'shutil.rmtree', diff --git a/neutron/tests/unit/services/vpn/service_drivers/test_cisco_ipsec.py b/neutron/tests/unit/services/vpn/service_drivers/test_cisco_ipsec.py index c513330c8..f78d8b16c 100644 --- a/neutron/tests/unit/services/vpn/service_drivers/test_cisco_ipsec.py +++ b/neutron/tests/unit/services/vpn/service_drivers/test_cisco_ipsec.py @@ -44,7 +44,7 @@ class TestCiscoIPsecDriverValidation(base.BaseTestCase): def setUp(self): super(TestCiscoIPsecDriverValidation, self).setUp() - mock.patch('neutron.openstack.common.rpc.create_connection').start() + mock.patch('neutron.common.rpc_compat.create_connection').start() self.service_plugin = mock.Mock() self.driver = ipsec_driver.CiscoCsrIPsecVPNDriver(self.service_plugin) self.context = n_ctx.Context('some_user', 'some_tenant') @@ -284,7 +284,7 @@ class TestCiscoIPsecDriver(base.BaseTestCase): super(TestCiscoIPsecDriver, self).setUp() dbapi.configure_db() self.addCleanup(dbapi.clear_db) - mock.patch('neutron.openstack.common.rpc.create_connection').start() + mock.patch('neutron.common.rpc_compat.create_connection').start() l3_agent = mock.Mock() l3_agent.host = FAKE_HOST diff --git a/neutron/tests/unit/services/vpn/service_drivers/test_ipsec.py b/neutron/tests/unit/services/vpn/service_drivers/test_ipsec.py index 33aebe977..2f7cbfaf9 100644 --- a/neutron/tests/unit/services/vpn/service_drivers/test_ipsec.py +++ b/neutron/tests/unit/services/vpn/service_drivers/test_ipsec.py @@ -37,7 +37,7 @@ FAKE_HOST = 'fake_host' class TestIPsecDriver(base.BaseTestCase): def setUp(self): super(TestIPsecDriver, self).setUp() - mock.patch('neutron.openstack.common.rpc.create_connection').start() + mock.patch('neutron.common.rpc_compat.create_connection').start() l3_agent = mock.Mock() l3_agent.host = FAKE_HOST