Merge "Add new config option for IPv6 Prefix Delegation"

This commit is contained in:
Jenkins 2015-11-11 08:42:32 +00:00 committed by Gerrit Code Review
commit 87ce4868ca
7 changed files with 21 additions and 11 deletions

View File

@ -166,11 +166,17 @@
# 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)

View File

@ -78,6 +78,9 @@ core_opts = [
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 "

View File

@ -142,8 +142,8 @@ IPV6_MODES = [DHCPV6_STATEFUL, DHCPV6_STATELESS, IPV6_SLAAC]
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

View File

@ -632,6 +632,8 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
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):

View File

@ -30,8 +30,7 @@ class TestL3RpcCallback(testlib_api.SqlTestCase):
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()

View File

@ -1713,8 +1713,7 @@ fixed_ips=ip_address%%3D%s&fixed_ips=ip_address%%3D%s&fixed_ips=subnet_id%%3D%s
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,
@ -2814,6 +2813,7 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase):
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',
@ -2856,6 +2856,7 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase):
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'],

View File

@ -290,8 +290,7 @@ class TestDbBasePluginIpam(test_db_base.NeutronDbPluginV2TestCase):
@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,