State i18() changes and help messages improved

Add _() to wrap help message in network commands.
And also some improvement for help message.

Change-Id: Ib3e498f5976ba98c44fd4eec2d1623263b3db53e
Partial-bug: 1570924
This commit is contained in:
Tang Chen 2016-04-16 10:59:37 +08:00
parent 8eade18624
commit 89445855ac
13 changed files with 248 additions and 220 deletions

View File

@ -59,7 +59,7 @@ Create new network
.. option:: --availability-zone-hint <availability-zone> .. option:: --availability-zone-hint <availability-zone>
Availability Zone in which to create this network Availability Zone in which to create this network
(requires the Network Availability Zone extension, (Network Availability Zone extension required,
repeat option to set multiple availability zones) repeat option to set multiple availability zones)
*Network version 2 only* *Network version 2 only*
@ -72,8 +72,8 @@ Create new network
.. option:: --external .. option:: --external
Set this network as an external network. Set this network as an external network
Requires the "external-net" extension to be enabled. (external-net extension required)
*Network version 2 only* *Network version 2 only*
@ -92,8 +92,8 @@ Create new network
.. option:: --no-default .. option:: --no-default
Do not use the network as the default external network. Do not use the network as the default external network
By default, no network is set as an external network. (default)
*Network version 2 only* *Network version 2 only*
@ -197,7 +197,7 @@ Set network properties
.. option:: --external .. option:: --external
Set this network as an external network. Set this network as an external network.
Requires the "external-net" extension to be enabled. (external-net extension required)
.. option:: --internal .. option:: --internal
@ -205,8 +205,7 @@ Set network properties
.. option:: --default .. option:: --default
Specify if this network should be used as Set the network as the default external network
the default external network
.. option:: --no-default .. option:: --no-default

View File

@ -45,8 +45,8 @@ Create new port
.. option:: --vnic-type <vnic-type> .. option:: --vnic-type <vnic-type>
VNIC type for this port (direct | direct-physical | macvtap | normal | baremetal). VNIC type for this port (direct | direct-physical | macvtap | normal | baremetal,
If unspecified during port creation, default value will be 'normal'. default: normal)
.. option:: --binding-profile <binding-profile> .. option:: --binding-profile <binding-profile>
@ -141,7 +141,7 @@ Set port properties
.. option:: --no-fixed-ip .. option:: --no-fixed-ip
Clear existing information of fixed-ips Clear existing information of fixed IP addresses
.. option:: --device <device-id> .. option:: --device <device-id>
@ -153,8 +153,8 @@ Set port properties
.. option:: --vnic-type <vnic-type> .. option:: --vnic-type <vnic-type>
VNIC type for this port (direct | direct-physical | macvtap | normal | baremetal). VNIC type for this port (direct | direct-physical | macvtap | normal | baremetal,
If unspecified during port creation, default value will be 'normal'. default: normal)
.. option:: --binding-profile <binding-profile> .. option:: --binding-profile <binding-profile>

View File

@ -87,7 +87,7 @@ Create new router
.. option:: --availability-zone-hint <availability-zone> .. option:: --availability-zone-hint <availability-zone>
Availability Zone in which to create this router Availability Zone in which to create this router
(requires the Router Availability Zone extension, (Router Availability Zone extension required,
repeat option to set multiple availability zones) repeat option to set multiple availability zones)
.. _router_create-name: .. _router_create-name:

View File

@ -49,8 +49,8 @@ Create subnet pool
.. option:: --address-scope <address-scope> .. option:: --address-scope <address-scope>
Set address scope associated with the subnet pool (name or ID). Set address scope associated with the subnet pool (name or ID),
Prefixes must be unique across address scopes. prefixes must be unique across address scopes
.. _subnet_pool_create-name: .. _subnet_pool_create-name:
.. describe:: <name> .. describe:: <name>
@ -128,8 +128,8 @@ Set subnet pool properties
.. option:: --address-scope <address-scope> .. option:: --address-scope <address-scope>
Set address scope associated with the subnet pool (name or ID). Set address scope associated with the subnet pool (name or ID),
Prefixes must be unique across address scopes. prefixes must be unique across address scopes
.. option:: --no-address-scope .. option:: --no-address-scope

View File

@ -206,7 +206,7 @@ Set subnet properties
subnet show subnet show
----------- -----------
Show subnet details Display subnet details
.. program:: subnet show .. program:: subnet show
.. code:: bash .. code:: bash
@ -217,4 +217,4 @@ Show subnet details
.. _subnet_show-subnet: .. _subnet_show-subnet:
.. describe:: <subnet> .. describe:: <subnet>
Subnet to show (name or ID) Subnet to display (name or ID)

View File

@ -14,6 +14,7 @@
"""IP Floating action implementations""" """IP Floating action implementations"""
from openstackclient.common import utils from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.network import common from openstackclient.network import common
@ -63,7 +64,7 @@ class CreateFloatingIP(common.NetworkAndComputeShowOne):
parser.add_argument( parser.add_argument(
'network', 'network',
metavar='<network>', metavar='<network>',
help='Network to allocate floating IP from (name or ID)', help=_("Network to allocate floating IP from (name or ID)")
) )
return parser return parser
@ -71,26 +72,26 @@ class CreateFloatingIP(common.NetworkAndComputeShowOne):
parser.add_argument( parser.add_argument(
'--subnet', '--subnet',
metavar='<subnet>', metavar='<subnet>',
help="Subnet on which you want to create the floating IP " help=_("Subnet on which you want to create the floating IP "
"(name or ID)" "(name or ID)")
) )
parser.add_argument( parser.add_argument(
'--port', '--port',
metavar='<port>', metavar='<port>',
help="Port to be associated with the floating IP " help=_("Port to be associated with the floating IP "
"(name or ID)" "(name or ID)")
) )
parser.add_argument( parser.add_argument(
'--floating-ip-address', '--floating-ip-address',
metavar='<floating-ip-address>', metavar='<floating-ip-address>',
dest='floating_ip_address', dest='floating_ip_address',
help="Floating IP address" help=_("Floating IP address")
) )
parser.add_argument( parser.add_argument(
'--fixed-ip-address', '--fixed-ip-address',
metavar='<fixed-ip-address>', metavar='<fixed-ip-address>',
dest='fixed_ip_address', dest='fixed_ip_address',
help="Fixed IP address mapped to the floating IP" help=_("Fixed IP address mapped to the floating IP")
) )
return parser return parser
@ -115,7 +116,7 @@ class DeleteFloatingIP(common.NetworkAndComputeCommand):
parser.add_argument( parser.add_argument(
'floating_ip', 'floating_ip',
metavar="<floating-ip>", metavar="<floating-ip>",
help=("Floating IP to delete (IP address or ID)") help=_("Floating IP to delete (IP address or ID)")
) )
return parser return parser
@ -189,7 +190,7 @@ class ShowFloatingIP(common.NetworkAndComputeShowOne):
parser.add_argument( parser.add_argument(
'floating_ip', 'floating_ip',
metavar="<floating-ip>", metavar="<floating-ip>",
help=("Floating IP to display (IP address or ID)") help=_("Floating IP to display (IP address or ID)")
) )
return parser return parser

View File

@ -16,6 +16,7 @@
from openstackclient.common import command from openstackclient.common import command
from openstackclient.common import exceptions from openstackclient.common import exceptions
from openstackclient.common import utils from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common from openstackclient.identity import common as identity_common
from openstackclient.network import common from openstackclient.network import common
@ -110,19 +111,19 @@ class CreateNetwork(common.NetworkAndComputeShowOne):
parser.add_argument( parser.add_argument(
'name', 'name',
metavar='<name>', metavar='<name>',
help='New network name', help=_("New network name")
) )
share_group = parser.add_mutually_exclusive_group() share_group = parser.add_mutually_exclusive_group()
share_group.add_argument( share_group.add_argument(
'--share', '--share',
action='store_true', action='store_true',
default=None, default=None,
help='Share the network between projects', help=_("Share the network between projects")
) )
share_group.add_argument( share_group.add_argument(
'--no-share', '--no-share',
action='store_true', action='store_true',
help='Do not share the network between projects', help=_("Do not share the network between projects")
) )
return parser return parser
@ -132,17 +133,17 @@ class CreateNetwork(common.NetworkAndComputeShowOne):
'--enable', '--enable',
action='store_true', action='store_true',
default=True, default=True,
help='Enable network (default)', help=_("Enable network (default)")
) )
admin_group.add_argument( admin_group.add_argument(
'--disable', '--disable',
action='store_true', action='store_true',
help='Disable network', help=_("Disable network")
) )
parser.add_argument( parser.add_argument(
'--project', '--project',
metavar='<project>', metavar='<project>',
help="Owner's project (name or ID)" help=_("Owner's project (name or ID)")
) )
identity_common.add_project_domain_option_to_parser(parser) identity_common.add_project_domain_option_to_parser(parser)
parser.add_argument( parser.add_argument(
@ -150,58 +151,65 @@ class CreateNetwork(common.NetworkAndComputeShowOne):
action='append', action='append',
dest='availability_zone_hints', dest='availability_zone_hints',
metavar='<availability-zone>', metavar='<availability-zone>',
help='Availability Zone in which to create this network ' help=_("Availability Zone in which to create this network "
'(requires the Network Availability Zone extension, ' "(Network Availability Zone extension required, "
'repeat option to set multiple availability zones)', "repeat option to set multiple availability zones)")
) )
external_router_grp = parser.add_mutually_exclusive_group() external_router_grp = parser.add_mutually_exclusive_group()
external_router_grp.add_argument( external_router_grp.add_argument(
'--external', '--external',
action='store_true', action='store_true',
help='Set this network as an external network. ' help=_("Set this network as an external network "
'Requires the "external-net" extension to be enabled.') "(external-net extension required)")
)
external_router_grp.add_argument( external_router_grp.add_argument(
'--internal', '--internal',
action='store_true', action='store_true',
help='Set this network as an internal network (default)') help=_("Set this network as an internal network (default)")
)
default_router_grp = parser.add_mutually_exclusive_group() default_router_grp = parser.add_mutually_exclusive_group()
default_router_grp.add_argument( default_router_grp.add_argument(
'--default', '--default',
action='store_true', action='store_true',
help='Specify if this network should be used as ' help=_("Specify if this network should be used as "
'the default external network') "the default external network")
)
default_router_grp.add_argument( default_router_grp.add_argument(
'--no-default', '--no-default',
action='store_true', action='store_true',
help='Do not use the network as the default external network.' help=_("Do not use the network as the default external network. "
'By default, no network is set as an external network.') "(default)")
)
parser.add_argument( parser.add_argument(
'--provider-network-type', '--provider-network-type',
metavar='<provider-network-type>', metavar='<provider-network-type>',
choices=['flat', 'gre', 'local', choices=['flat', 'gre', 'local',
'vlan', 'vxlan'], 'vlan', 'vxlan'],
help='The physical mechanism by which the virtual network ' help=_("The physical mechanism by which the virtual network "
'is implemented. The supported options are: ' "is implemented. The supported options are: "
'flat, gre, local, vlan, vxlan') "flat, gre, local, vlan, vxlan")
)
parser.add_argument( parser.add_argument(
'--provider-physical-network', '--provider-physical-network',
metavar='<provider-physical-network>', metavar='<provider-physical-network>',
dest='physical_network', dest='physical_network',
help='Name of the physical network over which the virtual ' help=_("Name of the physical network over which the virtual "
'network is implemented') "network is implemented")
)
parser.add_argument( parser.add_argument(
'--provider-segment', '--provider-segment',
metavar='<provider-segment>', metavar='<provider-segment>',
dest='segmentation_id', dest='segmentation_id',
help='VLAN ID for VLAN networks or Tunnel ID for GRE/VXLAN ' help=_("VLAN ID for VLAN networks or Tunnel ID for GRE/VXLAN "
'networks') "networks")
)
return parser return parser
def update_parser_compute(self, parser): def update_parser_compute(self, parser):
parser.add_argument( parser.add_argument(
'--subnet', '--subnet',
metavar='<subnet>', metavar='<subnet>',
help="IPv4 subnet for fixed IPs (in CIDR notation)" help=_("IPv4 subnet for fixed IPs (in CIDR notation)")
) )
return parser return parser
@ -350,57 +358,60 @@ class SetNetwork(command.Command):
parser.add_argument( parser.add_argument(
'network', 'network',
metavar="<network>", metavar="<network>",
help=("Network to modify (name or ID)") help=_("Network to modify (name or ID)")
) )
parser.add_argument( parser.add_argument(
'--name', '--name',
metavar='<name>', metavar='<name>',
help='Set network name', help=_("Set network name")
) )
admin_group = parser.add_mutually_exclusive_group() admin_group = parser.add_mutually_exclusive_group()
admin_group.add_argument( admin_group.add_argument(
'--enable', '--enable',
action='store_true', action='store_true',
default=None, default=None,
help='Enable network', help=_("Enable network")
) )
admin_group.add_argument( admin_group.add_argument(
'--disable', '--disable',
action='store_true', action='store_true',
help='Disable network', help=_("Disable network")
) )
share_group = parser.add_mutually_exclusive_group() share_group = parser.add_mutually_exclusive_group()
share_group.add_argument( share_group.add_argument(
'--share', '--share',
action='store_true', action='store_true',
default=None, default=None,
help='Share the network between projects', help=_("Share the network between projects")
) )
share_group.add_argument( share_group.add_argument(
'--no-share', '--no-share',
action='store_true', action='store_true',
help='Do not share the network between projects', help=_("Do not share the network between projects")
) )
external_router_grp = parser.add_mutually_exclusive_group() external_router_grp = parser.add_mutually_exclusive_group()
external_router_grp.add_argument( external_router_grp.add_argument(
'--external', '--external',
action='store_true', action='store_true',
help='Set this network as an external network. ' help=_("Set this network as an external network "
'Requires the "external-net" extension to be enabled.') "(external-net extension required)")
)
external_router_grp.add_argument( external_router_grp.add_argument(
'--internal', '--internal',
action='store_true', action='store_true',
help='Set this network as an internal network') help=_("Set this network as an internal network")
)
default_router_grp = parser.add_mutually_exclusive_group() default_router_grp = parser.add_mutually_exclusive_group()
default_router_grp.add_argument( default_router_grp.add_argument(
'--default', '--default',
action='store_true', action='store_true',
help='Specify if this network should be used as ' help=_("Set the network as the default external network")
'the default external network') )
default_router_grp.add_argument( default_router_grp.add_argument(
'--no-default', '--no-default',
action='store_true', action='store_true',
help='Do not use the network as the default external network.') help=_("Do not use the network as the default external network")
)
return parser return parser
def take_action(self, parsed_args): def take_action(self, parsed_args):
@ -422,7 +433,7 @@ class ShowNetwork(common.NetworkAndComputeShowOne):
parser.add_argument( parser.add_argument(
'network', 'network',
metavar="<network>", metavar="<network>",
help=("Network to display (name or ID)") help=_("Network to display (name or ID)")
) )
return parser return parser

View File

@ -158,7 +158,7 @@ def _add_updatable_args(parser):
device_group.add_argument( device_group.add_argument(
'--device', '--device',
metavar='<device-id>', metavar='<device-id>',
help='Port device ID', help=_("Port device ID")
) )
device_group.add_argument( device_group.add_argument(
'--device-id', '--device-id',
@ -168,22 +168,23 @@ def _add_updatable_args(parser):
parser.add_argument( parser.add_argument(
'--device-owner', '--device-owner',
metavar='<device-owner>', metavar='<device-owner>',
help='Device owner of this port') help=_("Device owner of this port")
)
parser.add_argument( parser.add_argument(
'--vnic-type', '--vnic-type',
metavar='<vnic-type>', metavar='<vnic-type>',
choices=['direct', 'direct-physical', 'macvtap', choices=['direct', 'direct-physical', 'macvtap',
'normal', 'baremetal'], 'normal', 'baremetal'],
help="VNIC type for this port (direct | direct-physical |" help=_("VNIC type for this port (direct | direct-physical | "
" macvtap | normal | baremetal). If unspecified during" "macvtap | normal | baremetal, default: normal)")
" port creation, default value will be 'normal'.") )
# NOTE(dtroyer): --host-id is deprecated in Mar 2016. Do not # NOTE(dtroyer): --host-id is deprecated in Mar 2016. Do not
# remove before 3.x release or Mar 2017. # remove before 3.x release or Mar 2017.
host_group = parser.add_mutually_exclusive_group() host_group = parser.add_mutually_exclusive_group()
host_group.add_argument( host_group.add_argument(
'--host', '--host',
metavar='<host-id>', metavar='<host-id>',
help='Allocate port on host <host-id> (ID only)', help=_("Allocate port on host <host-id> (ID only)")
) )
host_group.add_argument( host_group.add_argument(
'--host-id', '--host-id',
@ -202,47 +203,53 @@ class CreatePort(command.ShowOne):
'--network', '--network',
metavar='<network>', metavar='<network>',
required=True, required=True,
help='Network this port belongs to (name or ID)') help=_("Network this port belongs to (name or ID)")
)
_add_updatable_args(parser) _add_updatable_args(parser)
parser.add_argument( parser.add_argument(
'--fixed-ip', '--fixed-ip',
metavar='subnet=<subnet>,ip-address=<ip-address>', metavar='subnet=<subnet>,ip-address=<ip-address>',
action=parseractions.MultiKeyValueAction, action=parseractions.MultiKeyValueAction,
optional_keys=['subnet', 'ip-address'], optional_keys=['subnet', 'ip-address'],
help='Desired IP and/or subnet (name or ID) for this port: ' help=_("Desired IP and/or subnet (name or ID) for this port: "
'subnet=<subnet>,ip-address=<ip-address> ' "subnet=<subnet>,ip-address=<ip-address> "
'(repeat option to set multiple fixed IP addresses)') "(repeat option to set multiple fixed IP addresses)")
)
parser.add_argument( parser.add_argument(
'--binding-profile', '--binding-profile',
metavar='<binding-profile>', metavar='<binding-profile>',
action=parseractions.KeyValueAction, action=parseractions.KeyValueAction,
help='Custom data to be passed as binding:profile: <key>=<value> ' help=_("Custom data to be passed as binding:profile: "
'(repeat option to set multiple binding:profile data)') "<key>=<value> "
"(repeat option to set multiple binding:profile data)")
)
admin_group = parser.add_mutually_exclusive_group() admin_group = parser.add_mutually_exclusive_group()
admin_group.add_argument( admin_group.add_argument(
'--enable', '--enable',
action='store_true', action='store_true',
default=True, default=True,
help='Enable port (default)', help=_("Enable port (default)")
) )
admin_group.add_argument( admin_group.add_argument(
'--disable', '--disable',
action='store_true', action='store_true',
help='Disable port', help=_("Disable port")
) )
parser.add_argument( parser.add_argument(
'--mac-address', '--mac-address',
metavar='<mac-address>', metavar='<mac-address>',
help='MAC address of this port') help=_("MAC address of this port")
)
parser.add_argument( parser.add_argument(
'--project', '--project',
metavar='<project>', metavar='<project>',
help="Owner's project (name or ID)") help=_("Owner's project (name or ID)")
)
identity_common.add_project_domain_option_to_parser(parser)
parser.add_argument( parser.add_argument(
'name', 'name',
metavar='<name>', metavar='<name>',
help='Name of this port') help='Name of this port')
identity_common.add_project_domain_option_to_parser(parser)
# TODO(singhj): Add support for extended options: # TODO(singhj): Add support for extended options:
# qos,security groups,dhcp, address pairs # qos,security groups,dhcp, address pairs
return parser return parser
@ -270,7 +277,7 @@ class DeletePort(command.Command):
'port', 'port',
metavar="<port>", metavar="<port>",
nargs="+", nargs="+",
help=("Port(s) to delete (name or ID)") help=_("Port(s) to delete (name or ID)")
) )
return parser return parser
@ -291,7 +298,7 @@ class ListPort(command.Lister):
'--router', '--router',
metavar='<router>', metavar='<router>',
dest='router', dest='router',
help='List only ports attached to this router (name or ID)', help=_("List only ports attached to this router (name or ID)")
) )
return parser return parser
@ -337,21 +344,17 @@ class SetPort(command.Command):
'--enable', '--enable',
action='store_true', action='store_true',
default=None, default=None,
help='Enable port', help=_("Enable port")
) )
admin_group.add_argument( admin_group.add_argument(
'--disable', '--disable',
action='store_true', action='store_true',
help='Disable port', help=_("Disable port")
) )
parser.add_argument( parser.add_argument(
'--name', '--name',
metavar="<name>", metavar="<name>",
help=('Set port name')) help=_("Set port name")
parser.add_argument(
'port',
metavar="<port>",
help=("Port to modify (name or ID)")
) )
fixed_ip = parser.add_mutually_exclusive_group() fixed_ip = parser.add_mutually_exclusive_group()
fixed_ip.add_argument( fixed_ip.add_argument(
@ -359,24 +362,34 @@ class SetPort(command.Command):
metavar='subnet=<subnet>,ip-address=<ip-address>', metavar='subnet=<subnet>,ip-address=<ip-address>',
action=parseractions.MultiKeyValueAction, action=parseractions.MultiKeyValueAction,
optional_keys=['subnet', 'ip-address'], optional_keys=['subnet', 'ip-address'],
help='Desired IP and/or subnet (name or ID) for this port: ' help=_("Desired IP and/or subnet (name or ID) for this port: "
'subnet=<subnet>,ip-address=<ip-address> ' "subnet=<subnet>,ip-address=<ip-address> "
'(repeat option to set multiple fixed IP addresses)') "(repeat option to set multiple fixed IP addresses)")
)
fixed_ip.add_argument( fixed_ip.add_argument(
'--no-fixed-ip', '--no-fixed-ip',
action='store_true', action='store_true',
help='Clear existing information of fixed-ips') help=_("Clear existing information of fixed IP addresses")
)
binding_profile = parser.add_mutually_exclusive_group() binding_profile = parser.add_mutually_exclusive_group()
binding_profile.add_argument( binding_profile.add_argument(
'--binding-profile', '--binding-profile',
metavar='<binding-profile>', metavar='<binding-profile>',
action=parseractions.KeyValueAction, action=parseractions.KeyValueAction,
help='Custom data to be passed as binding:profile: <key>=<value> ' help=_("Custom data to be passed as binding:profile: "
'(repeat option to set multiple binding:profile data)') "<key>=<value> "
"(repeat option to set multiple binding:profile data)")
)
binding_profile.add_argument( binding_profile.add_argument(
'--no-binding-profile', '--no-binding-profile',
action='store_true', action='store_true',
help='Clear existing information of binding:profile') help=_("Clear existing information of binding:profile")
)
parser.add_argument(
'port',
metavar="<port>",
help=_("Port to modify (name or ID)")
)
return parser return parser
def take_action(self, parsed_args): def take_action(self, parsed_args):
@ -413,7 +426,7 @@ class ShowPort(command.ShowOne):
parser.add_argument( parser.add_argument(
'port', 'port',
metavar="<port>", metavar="<port>",
help="Port to display (name or ID)" help=_("Port to display (name or ID)")
) )
return parser return parser

View File

@ -19,6 +19,7 @@ from openstackclient.common import command
from openstackclient.common import exceptions from openstackclient.common import exceptions
from openstackclient.common import parseractions from openstackclient.common import parseractions
from openstackclient.common import utils from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common from openstackclient.identity import common as identity_common
@ -95,12 +96,12 @@ class AddPortToRouter(command.Command):
parser.add_argument( parser.add_argument(
'router', 'router',
metavar='<router>', metavar='<router>',
help="Router to which port will be added (name or ID)", help=_("Router to which port will be added (name or ID)")
) )
parser.add_argument( parser.add_argument(
'port', 'port',
metavar='<port>', metavar='<port>',
help="Port to be added (name or ID)", help=_("Port to be added (name or ID)")
) )
return parser return parser
@ -119,12 +120,12 @@ class AddSubnetToRouter(command.Command):
parser.add_argument( parser.add_argument(
'router', 'router',
metavar='<router>', metavar='<router>',
help="Router to which subnet will be added (name or ID)", help=_("Router to which subnet will be added (name or ID)")
) )
parser.add_argument( parser.add_argument(
'subnet', 'subnet',
metavar='<subnet>', metavar='<subnet>',
help="Subnet to be added (name or ID)", help=_("Subnet to be added (name or ID)")
) )
return parser return parser
@ -146,43 +147,43 @@ class CreateRouter(command.ShowOne):
parser.add_argument( parser.add_argument(
'name', 'name',
metavar='<name>', metavar='<name>',
help="New router name", help=_("New router name")
) )
admin_group = parser.add_mutually_exclusive_group() admin_group = parser.add_mutually_exclusive_group()
admin_group.add_argument( admin_group.add_argument(
'--enable', '--enable',
action='store_true', action='store_true',
default=True, default=True,
help="Enable router (default)", help=_("Enable router (default)")
) )
admin_group.add_argument( admin_group.add_argument(
'--disable', '--disable',
action='store_true', action='store_true',
help="Disable router", help=_("Disable router")
) )
parser.add_argument( parser.add_argument(
'--distributed', '--distributed',
dest='distributed', dest='distributed',
action='store_true', action='store_true',
default=False, default=False,
help="Create a distributed router", help=_("Create a distributed router")
) )
parser.add_argument( parser.add_argument(
'--project', '--project',
metavar='<project>', metavar='<project>',
help="Owner's project (name or ID)", help=_("Owner's project (name or ID)")
) )
identity_common.add_project_domain_option_to_parser(parser)
parser.add_argument( parser.add_argument(
'--availability-zone-hint', '--availability-zone-hint',
metavar='<availability-zone>', metavar='<availability-zone>',
action='append', action='append',
dest='availability_zone_hints', dest='availability_zone_hints',
help='Availability Zone in which to create this router ' help=_("Availability Zone in which to create this router "
'(requires the Router Availability Zone extension, ' "(Router Availability Zone extension required, "
'repeat option to set multiple availability zones)', "repeat option to set multiple availability zones)")
) )
identity_common.add_project_domain_option_to_parser(parser)
return parser return parser
def take_action(self, parsed_args): def take_action(self, parsed_args):
@ -206,7 +207,7 @@ class DeleteRouter(command.Command):
'router', 'router',
metavar="<router>", metavar="<router>",
nargs="+", nargs="+",
help=("Router(s) to delete (name or ID)") help=_("Router(s) to delete (name or ID)")
) )
return parser return parser
@ -226,7 +227,7 @@ class ListRouter(command.Lister):
'--long', '--long',
action='store_true', action='store_true',
default=False, default=False,
help='List additional fields in output', help=_("List additional fields in output")
) )
return parser return parser
@ -279,12 +280,12 @@ class RemovePortFromRouter(command.Command):
parser.add_argument( parser.add_argument(
'router', 'router',
metavar='<router>', metavar='<router>',
help="Router from which port will be removed (name or ID)", help=_("Router from which port will be removed (name or ID)")
) )
parser.add_argument( parser.add_argument(
'port', 'port',
metavar='<port>', metavar='<port>',
help="Port to be removed (name or ID).", help=_("Port to be removed (name or ID)")
) )
return parser return parser
@ -303,12 +304,12 @@ class RemoveSubnetFromRouter(command.Command):
parser.add_argument( parser.add_argument(
'router', 'router',
metavar='<router>', metavar='<router>',
help="Router from which the subnet will be removed (name or ID)", help=_("Router from which the subnet will be removed (name or ID)")
) )
parser.add_argument( parser.add_argument(
'subnet', 'subnet',
metavar='<subnet>', metavar='<subnet>',
help="Subnet to be removed (name or ID)", help=_("Subnet to be removed (name or ID)")
) )
return parser return parser
@ -330,35 +331,35 @@ class SetRouter(command.Command):
parser.add_argument( parser.add_argument(
'router', 'router',
metavar="<router>", metavar="<router>",
help=("Router to modify (name or ID)") help=_("Router to modify (name or ID)")
) )
parser.add_argument( parser.add_argument(
'--name', '--name',
metavar='<name>', metavar='<name>',
help='Set router name', help=_("Set router name")
) )
admin_group = parser.add_mutually_exclusive_group() admin_group = parser.add_mutually_exclusive_group()
admin_group.add_argument( admin_group.add_argument(
'--enable', '--enable',
action='store_true', action='store_true',
default=None, default=None,
help='Enable router', help=_("Enable router")
) )
admin_group.add_argument( admin_group.add_argument(
'--disable', '--disable',
action='store_true', action='store_true',
help='Disable router', help=_("Disable router")
) )
distribute_group = parser.add_mutually_exclusive_group() distribute_group = parser.add_mutually_exclusive_group()
distribute_group.add_argument( distribute_group.add_argument(
'--distributed', '--distributed',
action='store_true', action='store_true',
help="Set router to distributed mode (disabled router only)", help=_("Set router to distributed mode (disabled router only)")
) )
distribute_group.add_argument( distribute_group.add_argument(
'--centralized', '--centralized',
action='store_true', action='store_true',
help="Set router to centralized mode (disabled router only)", help=_("Set router to centralized mode (disabled router only)")
) )
routes_group = parser.add_mutually_exclusive_group() routes_group = parser.add_mutually_exclusive_group()
routes_group.add_argument( routes_group.add_argument(
@ -368,15 +369,15 @@ class SetRouter(command.Command):
dest='routes', dest='routes',
default=None, default=None,
required_keys=['destination', 'gateway'], required_keys=['destination', 'gateway'],
help="Routes associated with the router " help=_("Routes associated with the router "
"destination: destination subnet (in CIDR notation) " "destination: destination subnet (in CIDR notation) "
"gateway: nexthop IP address " "gateway: nexthop IP address "
"(repeat option to set multiple routes)", "(repeat option to set multiple routes)")
) )
routes_group.add_argument( routes_group.add_argument(
'--clear-routes', '--clear-routes',
action='store_true', action='store_true',
help="Clear routes associated with the router", help=_("Clear routes associated with the router")
) )
# TODO(tangchen): Support setting 'ha' property in 'router set' # TODO(tangchen): Support setting 'ha' property in 'router set'
@ -408,7 +409,7 @@ class ShowRouter(command.ShowOne):
parser.add_argument( parser.add_argument(
'router', 'router',
metavar="<router>", metavar="<router>",
help="Router to display (name or ID)" help=_("Router to display (name or ID)")
) )
return parser return parser

View File

@ -17,6 +17,7 @@ import argparse
import six import six
from openstackclient.common import utils from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common from openstackclient.identity import common as identity_common
from openstackclient.network import common from openstackclient.network import common
from openstackclient.network import utils as network_utils from openstackclient.network import utils as network_utils
@ -99,12 +100,12 @@ class CreateSecurityGroup(common.NetworkAndComputeShowOne):
parser.add_argument( parser.add_argument(
"name", "name",
metavar="<name>", metavar="<name>",
help="New security group name", help=_("New security group name")
) )
parser.add_argument( parser.add_argument(
"--description", "--description",
metavar="<description>", metavar="<description>",
help="Security group description", help=_("Security group description")
) )
return parser return parser
@ -112,7 +113,7 @@ class CreateSecurityGroup(common.NetworkAndComputeShowOne):
parser.add_argument( parser.add_argument(
'--project', '--project',
metavar='<project>', metavar='<project>',
help="Owner's project (name or ID)" help=_("Owner's project (name or ID)")
) )
identity_common.add_project_domain_option_to_parser(parser) identity_common.add_project_domain_option_to_parser(parser)
return parser return parser
@ -169,7 +170,7 @@ class DeleteSecurityGroup(common.NetworkAndComputeCommand):
parser.add_argument( parser.add_argument(
'group', 'group',
metavar='<group>', metavar='<group>',
help='Security group to delete (name or ID)', help=_("Security group to delete (name or ID)")
) )
return parser return parser
@ -204,7 +205,7 @@ class ListSecurityGroup(common.NetworkAndComputeLister):
'--all-projects', '--all-projects',
action='store_true', action='store_true',
default=False, default=False,
help='Display information from all projects (admin only)', help=_("Display information from all projects (admin only)")
) )
return parser return parser
@ -240,17 +241,17 @@ class SetSecurityGroup(common.NetworkAndComputeCommand):
parser.add_argument( parser.add_argument(
'group', 'group',
metavar='<group>', metavar='<group>',
help='Security group to modify (name or ID)', help=_("Security group to modify (name or ID)")
) )
parser.add_argument( parser.add_argument(
'--name', '--name',
metavar='<new-name>', metavar='<new-name>',
help='New security group name', help=_("New security group name")
) )
parser.add_argument( parser.add_argument(
"--description", "--description",
metavar="<description>", metavar="<description>",
help="New security group description", help=_("New security group description")
) )
return parser return parser
@ -295,7 +296,7 @@ class ShowSecurityGroup(common.NetworkAndComputeShowOne):
parser.add_argument( parser.add_argument(
'group', 'group',
metavar='<group>', metavar='<group>',
help='Security group to display (name or ID)', help=_("Security group to display (name or ID)")
) )
return parser return parser

View File

@ -23,6 +23,7 @@ except ImportError:
from openstackclient.common import exceptions from openstackclient.common import exceptions
from openstackclient.common import parseractions from openstackclient.common import parseractions
from openstackclient.common import utils from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common from openstackclient.identity import common as identity_common
from openstackclient.network import common from openstackclient.network import common
from openstackclient.network import utils as network_utils from openstackclient.network import utils as network_utils
@ -78,27 +79,27 @@ class CreateSecurityGroupRule(common.NetworkAndComputeShowOne):
default="tcp", default="tcp",
choices=['icmp', 'tcp', 'udp'], choices=['icmp', 'tcp', 'udp'],
type=_convert_to_lowercase, type=_convert_to_lowercase,
help="IP protocol (icmp, tcp, udp; default: tcp)", help=_("IP protocol (icmp, tcp, udp; default: tcp)")
) )
source_group = parser.add_mutually_exclusive_group() source_group = parser.add_mutually_exclusive_group()
source_group.add_argument( source_group.add_argument(
"--src-ip", "--src-ip",
metavar="<ip-address>", metavar="<ip-address>",
help="Source IP address block (may use CIDR notation; " help=_("Source IP address block (may use CIDR notation; "
"default for IPv4 rule: 0.0.0.0/0)", "default for IPv4 rule: 0.0.0.0/0)")
) )
source_group.add_argument( source_group.add_argument(
"--src-group", "--src-group",
metavar="<group>", metavar="<group>",
help="Source security group (name or ID)", help=_("Source security group (name or ID)")
) )
parser.add_argument( parser.add_argument(
"--dst-port", "--dst-port",
metavar="<port-range>", metavar="<port-range>",
default=(0, 0), default=(0, 0),
action=parseractions.RangeAction, action=parseractions.RangeAction,
help="Destination port, may be a single port or port range: " help=_("Destination port, may be a single port or port range: "
"137:139 (only required for IP protocols tcp and udp)", "137:139 (only required for IP protocols tcp and udp)")
) )
return parser return parser
@ -107,24 +108,23 @@ class CreateSecurityGroupRule(common.NetworkAndComputeShowOne):
direction_group.add_argument( direction_group.add_argument(
'--ingress', '--ingress',
action='store_true', action='store_true',
help='Rule applies to incoming network traffic (default)', help=_("Rule applies to incoming network traffic (default)")
) )
direction_group.add_argument( direction_group.add_argument(
'--egress', '--egress',
action='store_true', action='store_true',
help='Rule applies to outgoing network traffic', help=_("Rule applies to outgoing network traffic")
) )
parser.add_argument( parser.add_argument(
'--ethertype', '--ethertype',
metavar='<ethertype>', metavar='<ethertype>',
choices=['IPv4', 'IPv6'], choices=['IPv4', 'IPv6'],
help='Ethertype of network traffic ' help=_("Ethertype of network traffic (IPv4, IPv6; default: IPv4)")
'(IPv4, IPv6; default: IPv4)',
) )
parser.add_argument( parser.add_argument(
'--project', '--project',
metavar='<project>', metavar='<project>',
help="Owner's project (name or ID)" help=_("Owner's project (name or ID)")
) )
identity_common.add_project_domain_option_to_parser(parser) identity_common.add_project_domain_option_to_parser(parser)
return parser return parser
@ -218,7 +218,7 @@ class DeleteSecurityGroupRule(common.NetworkAndComputeCommand):
parser.add_argument( parser.add_argument(
'rule', 'rule',
metavar='<rule>', metavar='<rule>',
help='Security group rule to delete (ID only)', help=_("Security group rule to delete (ID only)")
) )
return parser return parser
@ -238,7 +238,7 @@ class ListSecurityGroupRule(common.NetworkAndComputeLister):
'group', 'group',
metavar='<group>', metavar='<group>',
nargs='?', nargs='?',
help='List all rules in this security group (name or ID)', help=_("List all rules in this security group (name or ID)")
) )
return parser return parser
@ -333,7 +333,7 @@ class ShowSecurityGroupRule(common.NetworkAndComputeShowOne):
parser.add_argument( parser.add_argument(
'rule', 'rule',
metavar="<rule>", metavar="<rule>",
help="Security group rule to display (ID only)" help=_("Security group rule to display (ID only)")
) )
return parser return parser

View File

@ -20,6 +20,7 @@ from openstackclient.common import command
from openstackclient.common import exceptions from openstackclient.common import exceptions
from openstackclient.common import parseractions from openstackclient.common import parseractions
from openstackclient.common import utils from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common from openstackclient.identity import common as identity_common
@ -50,17 +51,17 @@ def _get_common_parse_arguments(parser):
dest='allocation_pools', dest='allocation_pools',
action=parseractions.MultiKeyValueAction, action=parseractions.MultiKeyValueAction,
required_keys=['start', 'end'], required_keys=['start', 'end'],
help='Allocation pool IP addresses for this subnet ' help=_("Allocation pool IP addresses for this subnet "
'e.g.: start=192.168.199.2,end=192.168.199.254 ' "e.g.: start=192.168.199.2,end=192.168.199.254 "
'(repeat option to add multiple IP addresses)', "(repeat option to add multiple IP addresses)")
) )
parser.add_argument( parser.add_argument(
'--dns-nameserver', '--dns-nameserver',
metavar='<dns-nameserver>', metavar='<dns-nameserver>',
action='append', action='append',
dest='dns_nameservers', dest='dns_nameservers',
help='DNS server for this subnet ' help=_("DNS server for this subnet "
'(repeat option to set multiple DNS servers)', "(repeat option to set multiple DNS servers)")
) )
parser.add_argument( parser.add_argument(
'--host-route', '--host-route',
@ -68,11 +69,11 @@ def _get_common_parse_arguments(parser):
dest='host_routes', dest='host_routes',
action=parseractions.MultiKeyValueAction, action=parseractions.MultiKeyValueAction,
required_keys=['destination', 'gateway'], required_keys=['destination', 'gateway'],
help='Additional route for this subnet ' help=_("Additional route for this subnet "
'e.g.: destination=10.10.0.0/16,gateway=192.168.71.254 ' "e.g.: destination=10.10.0.0/16,gateway=192.168.71.254 "
'destination: destination subnet (in CIDR notation) ' "destination: destination subnet (in CIDR notation) "
'gateway: nexthop IP address ' "gateway: nexthop IP address "
'(repeat option to add multiple routes)', "(repeat option to add multiple routes)")
) )
@ -174,87 +175,87 @@ class CreateSubnet(command.ShowOne):
parser = super(CreateSubnet, self).get_parser(prog_name) parser = super(CreateSubnet, self).get_parser(prog_name)
parser.add_argument( parser.add_argument(
'name', 'name',
help='New subnet name', help=_("New subnet name")
) )
parser.add_argument( parser.add_argument(
'--project', '--project',
metavar='<project>', metavar='<project>',
help="Owner's project (name or ID)", help=_("Owner's project (name or ID)")
) )
identity_common.add_project_domain_option_to_parser(parser) identity_common.add_project_domain_option_to_parser(parser)
subnet_pool_group = parser.add_mutually_exclusive_group() subnet_pool_group = parser.add_mutually_exclusive_group()
subnet_pool_group.add_argument( subnet_pool_group.add_argument(
'--subnet-pool', '--subnet-pool',
metavar='<subnet-pool>', metavar='<subnet-pool>',
help='Subnet pool from which this subnet will obtain a CIDR ' help=_("Subnet pool from which this subnet will obtain a CIDR "
'(Name or ID)', "(Name or ID)")
) )
subnet_pool_group.add_argument( subnet_pool_group.add_argument(
'--use-default-subnet-pool', '--use-default-subnet-pool',
action='store_true', action='store_true',
help='Use default subnet pool for --ip-version', help=_("Use default subnet pool for --ip-version")
) )
parser.add_argument( parser.add_argument(
'--prefix-length', '--prefix-length',
metavar='<prefix-length>', metavar='<prefix-length>',
help='Prefix length for subnet allocation from subnet pool', help=_("Prefix length for subnet allocation from subnet pool")
) )
parser.add_argument( parser.add_argument(
'--subnet-range', '--subnet-range',
metavar='<subnet-range>', metavar='<subnet-range>',
help='Subnet range in CIDR notation ' help=_("Subnet range in CIDR notation "
'(required if --subnet-pool is not specified, ' "(required if --subnet-pool is not specified, "
'optional otherwise)', "optional otherwise)")
) )
dhcp_enable_group = parser.add_mutually_exclusive_group() dhcp_enable_group = parser.add_mutually_exclusive_group()
dhcp_enable_group.add_argument( dhcp_enable_group.add_argument(
'--dhcp', '--dhcp',
action='store_true', action='store_true',
default=True, default=True,
help='Enable DHCP (default)', help=_("Enable DHCP (default)")
) )
dhcp_enable_group.add_argument( dhcp_enable_group.add_argument(
'--no-dhcp', '--no-dhcp',
action='store_true', action='store_true',
help='Disable DHCP', help=_("Disable DHCP")
) )
parser.add_argument( parser.add_argument(
'--gateway', '--gateway',
metavar='<gateway>', metavar='<gateway>',
default='auto', default='auto',
help="Specify a gateway for the subnet. The three options are: " help=_("Specify a gateway for the subnet. The three options are: "
"<ip-address>: Specific IP address to use as the gateway, " "<ip-address>: Specific IP address to use as the gateway, "
"'auto': Gateway address should automatically be chosen from " "'auto': Gateway address should automatically be chosen "
"within the subnet itself, 'none': This subnet will not use " "from within the subnet itself, 'none': This subnet will "
"a gateway, e.g.: --gateway 192.168.9.1, --gateway auto, " "not use a gateway, e.g.: --gateway 192.168.9.1, "
"--gateway none (default is 'auto')", "--gateway auto, --gateway none (default is 'auto')")
) )
parser.add_argument( parser.add_argument(
'--ip-version', '--ip-version',
type=int, type=int,
default=4, default=4,
choices=[4, 6], choices=[4, 6],
help='IP version (default is 4). Note that when subnet pool is ' help=_("IP version (default is 4). Note that when subnet pool is "
'specified, IP version is determined from the subnet pool ' "specified, IP version is determined from the subnet pool "
'and this option is ignored.', "and this option is ignored")
) )
parser.add_argument( parser.add_argument(
'--ipv6-ra-mode', '--ipv6-ra-mode',
choices=['dhcpv6-stateful', 'dhcpv6-stateless', 'slaac'], choices=['dhcpv6-stateful', 'dhcpv6-stateless', 'slaac'],
help='IPv6 RA (Router Advertisement) mode, ' help=_("IPv6 RA (Router Advertisement) mode, "
'valid modes: [dhcpv6-stateful, dhcpv6-stateless, slaac]', "valid modes: [dhcpv6-stateful, dhcpv6-stateless, slaac]")
) )
parser.add_argument( parser.add_argument(
'--ipv6-address-mode', '--ipv6-address-mode',
choices=['dhcpv6-stateful', 'dhcpv6-stateless', 'slaac'], choices=['dhcpv6-stateful', 'dhcpv6-stateless', 'slaac'],
help='IPv6 address mode, ' help=_("IPv6 address mode, "
'valid modes: [dhcpv6-stateful, dhcpv6-stateless, slaac]', "valid modes: [dhcpv6-stateful, dhcpv6-stateless, slaac]")
) )
parser.add_argument( parser.add_argument(
'--network', '--network',
required=True, required=True,
metavar='<network>', metavar='<network>',
help='Network this subnet belongs to (name or ID)', help=_("Network this subnet belongs to (name or ID)")
) )
_get_common_parse_arguments(parser) _get_common_parse_arguments(parser)
return parser return parser
@ -276,7 +277,7 @@ class DeleteSubnet(command.Command):
parser.add_argument( parser.add_argument(
'subnet', 'subnet',
metavar="<subnet>", metavar="<subnet>",
help="Subnet to delete (name or ID)", help=_("Subnet to delete (name or ID)")
) )
return parser return parser
@ -295,7 +296,7 @@ class ListSubnet(command.Lister):
'--long', '--long',
action='store_true', action='store_true',
default=False, default=False,
help='List additional fields in output', help=_("List additional fields in output")
) )
return parser return parser
@ -327,32 +328,32 @@ class SetSubnet(command.Command):
parser.add_argument( parser.add_argument(
'subnet', 'subnet',
metavar="<subnet>", metavar="<subnet>",
help=("Subnet to modify (name or ID)") help=_("Subnet to modify (name or ID)")
) )
parser.add_argument( parser.add_argument(
'--name', '--name',
metavar='<name>', metavar='<name>',
help='Updated name of the subnet', help=_("Updated name of the subnet")
) )
dhcp_enable_group = parser.add_mutually_exclusive_group() dhcp_enable_group = parser.add_mutually_exclusive_group()
dhcp_enable_group.add_argument( dhcp_enable_group.add_argument(
'--dhcp', '--dhcp',
action='store_true', action='store_true',
default=None, default=None,
help='Enable DHCP', help=_("Enable DHCP")
) )
dhcp_enable_group.add_argument( dhcp_enable_group.add_argument(
'--no-dhcp', '--no-dhcp',
action='store_true', action='store_true',
help='Disable DHCP', help=_("Disable DHCP")
) )
parser.add_argument( parser.add_argument(
'--gateway', '--gateway',
metavar='<gateway>', metavar='<gateway>',
help="Specify a gateway for the subnet. The options are: " help=_("Specify a gateway for the subnet. The options are: "
"<ip-address>: Specific IP address to use as the gateway, " "<ip-address>: Specific IP address to use as the gateway, "
"'none': This subnet will not use a gateway, " "'none': This subnet will not use a gateway, "
"e.g.: --gateway 192.168.9.1, --gateway none" "e.g.: --gateway 192.168.9.1, --gateway none")
) )
_get_common_parse_arguments(parser) _get_common_parse_arguments(parser)
return parser return parser
@ -376,14 +377,14 @@ class SetSubnet(command.Command):
class ShowSubnet(command.ShowOne): class ShowSubnet(command.ShowOne):
"""Show subnet details""" """Display subnet details"""
def get_parser(self, prog_name): def get_parser(self, prog_name):
parser = super(ShowSubnet, self).get_parser(prog_name) parser = super(ShowSubnet, self).get_parser(prog_name)
parser.add_argument( parser.add_argument(
'subnet', 'subnet',
metavar="<subnet>", metavar="<subnet>",
help="Subnet to show (name or ID)", help=_("Subnet to display (name or ID)")
) )
return parser return parser

View File

@ -17,6 +17,7 @@ from openstackclient.common import command
from openstackclient.common import exceptions from openstackclient.common import exceptions
from openstackclient.common import parseractions from openstackclient.common import parseractions
from openstackclient.common import utils from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common from openstackclient.identity import common as identity_common
@ -73,26 +74,26 @@ def _add_prefix_options(parser):
metavar='<pool-prefix>', metavar='<pool-prefix>',
dest='prefixes', dest='prefixes',
action='append', action='append',
help='Set subnet pool prefixes (in CIDR notation) ' help=_("Set subnet pool prefixes (in CIDR notation) "
'(repeat option to set multiple prefixes)', "(repeat option to set multiple prefixes)")
) )
parser.add_argument( parser.add_argument(
'--default-prefix-length', '--default-prefix-length',
metavar='<default-prefix-length>', metavar='<default-prefix-length>',
action=parseractions.NonNegativeAction, action=parseractions.NonNegativeAction,
help='Set subnet pool default prefix length', help=_("Set subnet pool default prefix length")
) )
parser.add_argument( parser.add_argument(
'--min-prefix-length', '--min-prefix-length',
metavar='<min-prefix-length>', metavar='<min-prefix-length>',
action=parseractions.NonNegativeAction, action=parseractions.NonNegativeAction,
help='Set subnet pool minimum prefix length', help=_("Set subnet pool minimum prefix length")
) )
parser.add_argument( parser.add_argument(
'--max-prefix-length', '--max-prefix-length',
metavar='<max-prefix-length>', metavar='<max-prefix-length>',
action=parseractions.NonNegativeAction, action=parseractions.NonNegativeAction,
help='Set subnet pool maximum prefix length', help=_("Set subnet pool maximum prefix length")
) )
@ -104,21 +105,21 @@ class CreateSubnetPool(command.ShowOne):
parser.add_argument( parser.add_argument(
'name', 'name',
metavar='<name>', metavar='<name>',
help='Name of the new subnet pool' help=_("Name of the new subnet pool")
) )
_add_prefix_options(parser) _add_prefix_options(parser)
parser.add_argument( parser.add_argument(
'--project', '--project',
metavar='<project>', metavar='<project>',
help="Owner's project (name or ID)", help=_("Owner's project (name or ID)")
) )
identity_common.add_project_domain_option_to_parser(parser) identity_common.add_project_domain_option_to_parser(parser)
parser.add_argument( parser.add_argument(
'--address-scope', '--address-scope',
metavar='<address-scope>', metavar='<address-scope>',
help="Set address scope associated with the subnet pool " help=_("Set address scope associated with the subnet pool "
"(name or ID). Prefixes must be unique across address " "(name or ID), prefixes must be unique across address "
"scopes.", "scopes")
) )
return parser return parser
@ -142,7 +143,7 @@ class DeleteSubnetPool(command.Command):
parser.add_argument( parser.add_argument(
'subnet_pool', 'subnet_pool',
metavar='<subnet-pool>', metavar='<subnet-pool>',
help='Subnet pool to delete (name or ID)' help=_("Subnet pool to delete (name or ID)")
) )
return parser return parser
@ -161,7 +162,7 @@ class ListSubnetPool(command.Lister):
'--long', '--long',
action='store_true', action='store_true',
default=False, default=False,
help='List additional fields in output', help=_("List additional fields in output")
) )
return parser return parser
@ -210,26 +211,26 @@ class SetSubnetPool(command.Command):
parser.add_argument( parser.add_argument(
'subnet_pool', 'subnet_pool',
metavar='<subnet-pool>', metavar='<subnet-pool>',
help='Subnet pool to modify (name or ID)' help=_("Subnet pool to modify (name or ID)")
) )
parser.add_argument( parser.add_argument(
'--name', '--name',
metavar='<name>', metavar='<name>',
help='Set subnet pool name', help=_("Set subnet pool name")
) )
_add_prefix_options(parser) _add_prefix_options(parser)
address_scope_group = parser.add_mutually_exclusive_group() address_scope_group = parser.add_mutually_exclusive_group()
address_scope_group.add_argument( address_scope_group.add_argument(
'--address-scope', '--address-scope',
metavar='<address-scope>', metavar='<address-scope>',
help="Set address scope associated with the subnet pool " help=_("Set address scope associated with the subnet pool "
"(name or ID). Prefixes must be unique across address " "(name or ID), prefixes must be unique across address "
"scopes.", "scopes")
) )
address_scope_group.add_argument( address_scope_group.add_argument(
'--no-address-scope', '--no-address-scope',
action='store_true', action='store_true',
help="Remove address scope associated with the subnet pool", help=_("Remove address scope associated with the subnet pool")
) )
return parser return parser
@ -258,7 +259,7 @@ class ShowSubnetPool(command.ShowOne):
parser.add_argument( parser.add_argument(
'subnet_pool', 'subnet_pool',
metavar='<subnet-pool>', metavar='<subnet-pool>',
help='Subnet pool to display (name or ID)' help=_("Subnet pool to display (name or ID)")
) )
return parser return parser