diff --git a/neutron/services/vpn/service_drivers/ipsec.py b/neutron/services/vpn/service_drivers/ipsec.py index 2fea0a0be..4ba45a8b3 100644 --- a/neutron/services/vpn/service_drivers/ipsec.py +++ b/neutron/services/vpn/service_drivers/ipsec.py @@ -21,6 +21,7 @@ from neutron import manager from neutron.openstack.common import log as logging from neutron.openstack.common import rpc from neutron.openstack.common.rpc import proxy +from neutron.plugins.common import constants from neutron.services.vpn.common import topics from neutron.services.vpn import service_drivers @@ -72,7 +73,8 @@ class IPsecVpnAgentApi(proxy.RpcProxy): dispatch notification for the agent. """ adminContext = context.is_admin and context or context.elevated() - plugin = manager.NeutronManager.get_plugin() + plugin = manager.NeutronManager.get_service_plugins().get( + constants.L3_ROUTER_NAT) if not version: version = self.RPC_API_VERSION l3_agents = plugin.get_l3_agents_hosting_routers( 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 863d29b8f..627724d54 100644 --- a/neutron/tests/unit/services/vpn/service_drivers/test_ipsec.py +++ b/neutron/tests/unit/services/vpn/service_drivers/test_ipsec.py @@ -19,6 +19,7 @@ import mock from neutron import context from neutron.openstack.common import uuidutils +from neutron.plugins.common import constants from neutron.services.vpn.service_drivers import ipsec as ipsec_driver from neutron.tests import base @@ -46,8 +47,13 @@ class TestIPsecDriver(base.BaseTestCase): plugin_p = mock.patch('neutron.manager.NeutronManager.get_plugin') get_plugin = plugin_p.start() get_plugin.return_value = plugin + service_plugin_p = mock.patch( + 'neutron.manager.NeutronManager.get_service_plugins') + get_service_plugin = service_plugin_p.start() + get_service_plugin.return_value = {constants.L3_ROUTER_NAT: plugin} service_plugin = mock.Mock() + service_plugin.get_l3_agents_hosting_routers.return_value = [l3_agent] service_plugin._get_vpnservice.return_value = { 'router_id': _uuid() }