The DHCP agent is inconsistent in how it handles subnets whose
ipv6_address_mode is not slaac. While the DHCP agent writes out both
DHCPv6 host entries and DHCPv6 options for ports scoped by the subnet
for dnsmasq to use, subnet specific options are not written.
This patch addresses this inconsistency by generating subnet specific
options when the subnet's ipv6_address_mode is not slaac.
Closes-Bug: #
1501451
Change-Id: I372c93fa5667e955c7b81181daa2e66f47d85fdf
subnet_to_interface_ip = self._make_subnet_interface_ip_map()
isolated_subnets = self.get_isolated_subnets(self.network)
for i, subnet in enumerate(self.network.subnets):
+ addr_mode = getattr(subnet, 'ipv6_address_mode', None)
if (not subnet.enable_dhcp or
(subnet.ip_version == 6 and
- getattr(subnet, 'ipv6_address_mode', None)
- in [None, constants.IPV6_SLAAC])):
+ addr_mode == constants.IPV6_SLAAC)):
continue
if subnet.dns_nameservers:
options.append(
self.safe.assert_called_once_with('/foo/opts', expected)
+ def test_output_opts_file_ipv6_address_mode_unset(self):
+ fake_v6 = '2001:0200:feed:7ac0::1'
+ expected = (
+ 'tag:tag0,option6:dns-server,%s\n'
+ 'tag:tag0,option6:domain-search,openstacklocal').lstrip() % (
+ '[' + fake_v6 + ']')
+
+ self._test_output_opts_file(expected, FakeV6Network())
+
@property
def _test_no_dhcp_domain_alloc_data(self):
exp_host_name = '/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/host'