Allow PD as Subnetpool during Subnet creations

This commit now allows user to specify 'prefix_delegation'
as a Subnetpool during Subnet creation by using the new
--use-prefix-delegation option so that the IPv6
prefixes can be delegated to routers set up by the
cloud admins.

Change-Id: I67e5d81c4155db2e3c5c41ee1df77f2d77a17689
Closes-Bug: #1513894
This commit is contained in:
Reedip 2017-08-08 09:23:44 +05:30
parent a709c151e6
commit 04ef8a41ac
3 changed files with 19 additions and 1 deletions

View File

@ -18,7 +18,7 @@ Create new subnet
openstack subnet create
[--project <project> [--project-domain <project-domain>]]
[--subnet-pool <subnet-pool> | --use-default-subnet-pool [--prefix-length <prefix-length>]]
[--subnet-pool <subnet-pool> | --use-default-subnet-pool [--prefix-length <prefix-length>] | --use-prefix-delegation]
[--subnet-range <subnet-range>]
[--allocation-pool start=<ip-address>,end=<ip-address>]
[--dhcp | --no-dhcp]
@ -48,6 +48,11 @@ Create new subnet
Subnet pool from which this subnet will obtain a CIDR (name or ID)
.. option:: --use-prefix-delegation
Use 'prefix-delegation' if IP is IPv6 format and IP would be delegated
externally
.. option:: --use-default-subnet-pool
Use default subnet pool for :option:`--ip-version`

View File

@ -186,6 +186,8 @@ def _get_attrs(client_manager, parsed_args, is_create=True):
subnet_pool = client.find_subnet_pool(parsed_args.subnet_pool,
ignore_missing=False)
attrs['subnetpool_id'] = subnet_pool.id
if parsed_args.use_prefix_delegation:
attrs['subnetpool_id'] = "prefix_delegation"
if parsed_args.use_default_subnet_pool:
attrs['use_default_subnet_pool'] = True
if parsed_args.prefix_length is not None:
@ -260,6 +262,11 @@ class CreateSubnet(command.ShowOne):
help=_("Subnet pool from which this subnet will obtain a CIDR "
"(Name or ID)")
)
subnet_pool_group.add_argument(
'--use-prefix-delegation',
help=_("Use 'prefix-delegation' if IP is IPv6 format "
"and IP would be delegated externally")
)
subnet_pool_group.add_argument(
'--use-default-subnet-pool',
action='store_true',

View File

@ -0,0 +1,6 @@
---
features:
- |
Add ``--use-prefix-delegation`` option to the ``subnet create`` command to
specify 'Prefix Delegation' as a subnetpool when creating subnets.
[Bug `1513894 <https://bugs.launchpad.net/bugs/1513894>`_]