diff --git a/doc/source/cli/command-objects/subnet.rst b/doc/source/cli/command-objects/subnet.rst index c228dc207..0a56ccf18 100644 --- a/doc/source/cli/command-objects/subnet.rst +++ b/doc/source/cli/command-objects/subnet.rst @@ -18,7 +18,7 @@ Create new subnet openstack subnet create [--project [--project-domain ]] - [--subnet-pool | --use-default-subnet-pool [--prefix-length ]] + [--subnet-pool | --use-default-subnet-pool [--prefix-length ] | --use-prefix-delegation] [--subnet-range ] [--allocation-pool start=,end=] [--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` diff --git a/openstackclient/network/v2/subnet.py b/openstackclient/network/v2/subnet.py index b96dff7f9..c71358a52 100644 --- a/openstackclient/network/v2/subnet.py +++ b/openstackclient/network/v2/subnet.py @@ -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', diff --git a/releasenotes/notes/bug-1513894-6d2f05db6e1df744.yaml b/releasenotes/notes/bug-1513894-6d2f05db6e1df744.yaml new file mode 100644 index 000000000..a7d750557 --- /dev/null +++ b/releasenotes/notes/bug-1513894-6d2f05db6e1df744.yaml @@ -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 `_]