With the impending deprecation of the default subnetpool configuration
options, IPv6 PD needs to be enabled with a new config option.
This patch adds the 'ipv6_pd_enabled' option to neutron.conf, and makes
all of the necessary changes for its use.
DocImpact
Change-Id: I43486c5a13ee2ff0097355afe7e1f3ef8794b185
Closes-Bug:
1501835
# Default Subnet Pool to be used for IPv6 subnet-allocation.
# Specifies by UUID the pool to be used in case of subnet-create being
-# called without a subnet-pool ID. Set to "prefix_delegation"
-# to enable IPv6 Prefix Delegation in a PD-capable environment.
-# See the description for default_ipv4_subnet_pool for more information.
+# called without a subnet-pool ID. See the description for
+# default_ipv4_subnet_pool for more information.
# default_ipv6_subnet_pool =
+# Set to True to enable IPv6 Prefix Delegation for subnet-allocation in a
+# PD-capable environment. Users making subnet-create requests for v6 subnets
+# without providing a cidr or subnetpool ID will be given a cidr via the Prefix
+# Delegation mechanism. Note that enabling PD will override the behavior of
+# the default IPv6 subnetpool.
+# ipv6_pd_enabled =
+
# =========== items for MTU selection and advertisement =============
# Advertise MTU. If True, effort is made to advertise MTU
# settings to VMs via network methods (ie. DHCP and RA MTU options)
cfg.StrOpt('default_ipv6_subnet_pool',
help=_("Default IPv6 subnet-pool to be used for automatic "
"subnet CIDR allocation")),
+ cfg.BoolOpt('ipv6_pd_enabled', default=False,
+ help=_("Enables IPv6 Prefix Delegation for automatic subnet "
+ "CIDR allocation")),
cfg.IntOpt('dhcp_lease_duration', default=86400,
deprecated_name='dhcp_lease_time',
help=_("DHCP lease duration (in seconds). Use -1 to tell "
IPV6_LLA_PREFIX = 'fe80::/64'
-# Human-readable ID to which default_ipv6_subnet_pool should be set to
-# indicate that IPv6 Prefix Delegation should be used to allocate subnet CIDRs
+# Human-readable ID to which the subnetpool ID should be set to
+# indicate that IPv6 Prefix Delegation is enabled for a given subnet
IPV6_PD_POOL_ID = 'prefix_delegation'
# Special provisional prefix for IPv6 Prefix Delegation
if ip_version == 4:
return cfg.CONF.default_ipv4_subnet_pool
+ if cfg.CONF.ipv6_pd_enabled:
+ return constants.IPV6_PD_POOL_ID
return cfg.CONF.default_ipv6_subnet_pool
def create_subnet(self, context, subnet):
self.setup_coreplugin(test_db_base_plugin_v2.DB_PLUGIN_KLASS)
self.plugin = manager.NeutronManager.get_plugin()
self.ctx = context.get_admin_context()
- cfg.CONF.set_override('default_ipv6_subnet_pool',
- constants.IPV6_PD_POOL_ID)
+ cfg.CONF.set_override('ipv6_pd_enabled', True)
self.callbacks = l3_rpc.L3RpcCallback()
self.network = self._prepare_network()
if ipv6_pd:
cidr = None
gateway = None
- cfg.CONF.set_override('default_ipv6_subnet_pool',
- constants.IPV6_PD_POOL_ID)
+ cfg.CONF.set_override('ipv6_pd_enabled', True)
return (self._make_subnet(self.fmt, network, gateway=gateway,
cidr=cidr, ip_version=6,
ipv6_ra_mode=ra_addr_mode,
def test_create_subnet_only_ip_version_v6_no_pool(self):
with self.network() as network:
tenant_id = network['network']['tenant_id']
+ cfg.CONF.set_override('ipv6_pd_enabled', False)
cfg.CONF.set_override('default_ipv6_subnet_pool', None)
data = {'subnet': {'network_id': network['network']['id'],
'ip_version': '6',
tenant_id=tenant_id,
min_prefixlen='64') as subnetpool:
subnetpool_id = subnetpool['subnetpool']['id']
+ cfg.CONF.set_override('ipv6_pd_enabled', False)
cfg.CONF.set_override('default_ipv6_subnet_pool',
subnetpool_id)
data = {'subnet': {'network_id': network['network']['id'],
@mock.patch('neutron.ipam.driver.Pool')
def test_create_ipv6_pd_subnet_over_ipam(self, pool_mock):
mocks = self._prepare_mocks_with_pool_mock(pool_mock)
- cfg.CONF.set_override('default_ipv6_subnet_pool',
- constants.IPV6_PD_POOL_ID)
+ cfg.CONF.set_override('ipv6_pd_enabled', True)
cidr = constants.PROVISIONAL_IPV6_PD_PREFIX
allocation_pools = [netaddr.IPRange('::2', '::ffff:ffff:ffff:ffff')]
with self.subnet(cidr=None, ip_version=6,