Merge "NSX: ensure that no LSN is created on external networks"

This commit is contained in:
Jenkins 2014-05-09 02:22:41 +00:00 committed by Gerrit Code Review
commit d9f199bf4f
2 changed files with 9 additions and 0 deletions

View File

@ -207,6 +207,9 @@ def handle_network_dhcp_access(plugin, context, network, action):
% {"action": action, "resource": network})
if action == 'create_network':
network_id = network['id']
if network.get(external_net.EXTERNAL):
LOG.info(_("Network %s is external: no LSN to create"), network_id)
return
plugin.lsn_manager.lsn_create(context, network_id)
elif action == 'delete_network':
# NOTE(armando-migliaccio): on delete_network, network

View File

@ -1142,6 +1142,12 @@ class DhcpTestCase(base.BaseTestCase):
self.plugin.lsn_manager.lsn_create.assert_called_once_with(
mock.ANY, network['id'])
def test_handle_create_network_router_external(self):
network = {'id': 'foo_network_id', 'router:external': True}
nsx.handle_network_dhcp_access(
self.plugin, mock.ANY, network, 'create_network')
self.assertFalse(self.plugin.lsn_manager.lsn_create.call_count)
def test_handle_delete_network(self):
network_id = 'foo_network_id'
self.plugin.lsn_manager.lsn_delete_by_network.return_value = (