Merge "Create DHCP port for IPv6 subnet"

This commit is contained in:
Jenkins 2014-10-29 14:29:16 +00:00 committed by Gerrit Code Review
commit e2b88e5dae
2 changed files with 18 additions and 2 deletions

View File

@ -238,9 +238,10 @@ class DhcpAgent(manager.Manager):
self.conf, network) self.conf, network)
for subnet in network.subnets: for subnet in network.subnets:
if subnet.enable_dhcp and subnet.ip_version == 4: if subnet.enable_dhcp:
if self.call_driver('enable', network): if self.call_driver('enable', network):
if self.conf.use_namespaces and enable_metadata: if (subnet.ip_version == 4 and self.conf.use_namespaces
and enable_metadata):
self.enable_isolated_metadata_proxy(network) self.enable_isolated_metadata_proxy(network)
enable_metadata = False # Don't trigger twice enable_metadata = False # Don't trigger twice
self.cache.put(network) self.cache.put(network)

View File

@ -64,6 +64,12 @@ fake_subnet3 = dhcp.DictModel(dict(id='bbbbbbbb-1111-2222-bbbbbbbbbbbb',
network_id='12345678-1234-5678-1234567890ab', network_id='12345678-1234-5678-1234567890ab',
cidr='192.168.1.1/24', enable_dhcp=True)) cidr='192.168.1.1/24', enable_dhcp=True))
fake_ipv6_subnet = dhcp.DictModel(dict(id='bbbbbbbb-1111-2222-bbbbbbbbbbbb',
network_id='12345678-1234-5678-1234567890ab',
cidr='2001:0db8::1:0:0:1/128', enable_dhcp=True,
tenant_id=fake_tenant_id,
gateway_ip='2001:0db8::1:0:0:1', ip_version=6))
fake_meta_subnet = dhcp.DictModel(dict(id='bbbbbbbb-1111-2222-bbbbbbbbbbbb', fake_meta_subnet = dhcp.DictModel(dict(id='bbbbbbbb-1111-2222-bbbbbbbbbbbb',
network_id='12345678-1234-5678-1234567890ab', network_id='12345678-1234-5678-1234567890ab',
cidr='169.254.169.252/30', cidr='169.254.169.252/30',
@ -113,6 +119,12 @@ fake_network = dhcp.NetModel(True, dict(id='12345678-1234-5678-1234567890ab',
subnets=[fake_subnet1, fake_subnet2], subnets=[fake_subnet1, fake_subnet2],
ports=[fake_port1])) ports=[fake_port1]))
fake_network_ipv6 = dhcp.NetModel(True, dict(
id='12345678-1234-5678-1234567890ab',
tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
admin_state_up=True,
subnets=[fake_ipv6_subnet]))
isolated_network = dhcp.NetModel( isolated_network = dhcp.NetModel(
True, dict( True, dict(
id='12345678-1234-5678-1234567890ab', id='12345678-1234-5678-1234567890ab',
@ -592,6 +604,9 @@ class TestDhcpAgentEventHandler(base.BaseTestCase):
def test_enable_dhcp_helper(self): def test_enable_dhcp_helper(self):
self._enable_dhcp_helper(fake_network) self._enable_dhcp_helper(fake_network)
def test_enable_dhcp_helper_ipv6_network(self):
self._enable_dhcp_helper(fake_network_ipv6)
def test_enable_dhcp_helper_down_network(self): def test_enable_dhcp_helper_down_network(self):
self.plugin.get_network_info.return_value = fake_down_network self.plugin.get_network_info.return_value = fake_down_network
self.dhcp.enable_dhcp_helper(fake_down_network.id) self.dhcp.enable_dhcp_helper(fake_down_network.id)