Skip to content

Commit

Permalink
Use L3 api from vpn ipsec driver via service plugin
Browse files Browse the repository at this point in the history
VPNaaS and ML2 plugin won't work, because ML2 plugin
supports service version of L3.
In this commit, we modify ipsec driver to use L3 plugin.
This is also backward compatible change, because if L2 plugin
supports L3 get_service_plugin API returns L2 plugin.

Fixes bug 1238846

Change-Id: I36e541bb2e3e1df2e01f73a74f3e9005af6c38b7
Note: Exsiting unit test covers this change
(cherry picked from commit 8eb5735)
  • Loading branch information
Nachi Ueno authored and markmcclain committed Oct 12, 2013
1 parent 1cb74d6 commit 8d8b27d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion neutron/services/vpn/service_drivers/ipsec.py
Expand Up @@ -21,6 +21,7 @@
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

Expand Down Expand Up @@ -72,7 +73,8 @@ def _agent_notification(self, context, method, router_id,
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(
Expand Down
6 changes: 6 additions & 0 deletions neutron/tests/unit/services/vpn/service_drivers/test_ipsec.py
Expand Up @@ -19,6 +19,7 @@

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

Expand Down Expand Up @@ -46,8 +47,13 @@ def setUp(self):
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()
}
Expand Down

0 comments on commit 8d8b27d

Please sign in to comment.