summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDean Troyer <dtroyer@gmail.com>2015-01-20 16:44:50 -0600
committerDean Troyer <dtroyer@gmail.com>2015-01-21 17:49:43 -0600
commit20ec40e222dc57d0121335d9eb6abd6195daad89 (patch)
treed3f2e1c3b7833a5990d27f4443712c3a37021f3d
parent95fe3fda3d041a4fa761040c80214d4ca5f29aaa (diff)
downloadpython-openstackclient-20ec40e222dc57d0121335d9eb6abd6195daad89.tar.gz
Command docs: network
Change-Id: Ia88b6c0ca5205fa5bfc3efa06ac7f84c4a9e5d4e
-rw-r--r--doc/source/command-objects/network.rst135
-rw-r--r--openstackclient/network/v2/network.py63
2 files changed, 174 insertions, 24 deletions
diff --git a/doc/source/command-objects/network.rst b/doc/source/command-objects/network.rst
new file mode 100644
index 00000000..cdf2ebfa
--- /dev/null
+++ b/doc/source/command-objects/network.rst
@@ -0,0 +1,135 @@
+=======
+network
+=======
+
+Network v2
+
+network create
+--------------
+
+Create new network
+
+.. program:: network create
+.. code:: bash
+
+ os network create
+ [--enable | --disable]
+ [--share | --no-share]
+ <name>
+
+.. option:: --enable
+
+ Enable network (default)
+
+.. option:: --disable
+
+ Disable network
+
+.. option:: --share
+
+ Share the network between projects
+
+.. option:: --no-share
+
+ Do not share the network between projects
+
+.. _network_create-name:
+.. describe:: <name>
+
+ New network name
+
+network delete
+--------------
+
+Delete network(s)
+
+.. program:: network delete
+.. code:: bash
+
+ os network delete
+ <network> [<network> ...]
+
+.. _network_delete-project:
+.. describe:: <network>
+
+ Network to delete (name or ID)
+
+network list
+------------
+
+List networks
+
+.. program:: network list
+.. code:: bash
+
+ os network list
+ [--external]
+ [--dhcp]
+ [--long]
+
+.. option:: --external
+
+ List external networks
+
+.. option:: --dhcp
+
+ ID of the DHCP agent
+
+.. option:: --long
+
+ List additional fields in output
+
+network set
+-----------
+
+Set network properties
+
+.. program:: network set
+.. code:: bash
+
+ os network set
+ [--name <name>]
+ [--enable | --disable]
+ [--share | --no-share]
+ <network>
+
+.. option:: --name <name>
+
+ Set network name
+
+.. option:: --enable
+
+ Enable network
+
+.. option:: --disable
+
+ Disable network
+
+.. option:: --share
+
+ Share the network between projects
+
+.. option:: --no-share
+
+ Do not share the network between projects
+
+.. _network_set-name:
+.. describe:: <network>
+
+ Network to modify (name or ID)
+
+network show
+------------
+
+Display network details
+
+.. program:: network show
+.. code:: bash
+
+ os network show
+ <network>
+
+.. _network_show-name:
+.. describe:: <network>
+
+ Network to display (name or ID)
diff --git a/openstackclient/network/v2/network.py b/openstackclient/network/v2/network.py
index 0d68f82d..c9265084 100644
--- a/openstackclient/network/v2/network.py
+++ b/openstackclient/network/v2/network.py
@@ -32,37 +32,45 @@ def filters(data):
class CreateNetwork(show.ShowOne):
- """Create a network"""
+ """Create new network"""
log = logging.getLogger(__name__ + '.CreateNetwork')
def get_parser(self, prog_name):
parser = super(CreateNetwork, self).get_parser(prog_name)
parser.add_argument(
- 'name', metavar='<network_name>',
- help='Name of network to create')
+ 'name',
+ metavar='<name>',
+ help='New network name',
+ )
admin_group = parser.add_mutually_exclusive_group()
admin_group.add_argument(
'--enable',
dest='admin_state',
- default=True,
action='store_true',
- help='Set administrative state up')
+ default=True,
+ help='Enable network (default)',
+ )
admin_group.add_argument(
'--disable',
dest='admin_state',
action='store_false',
- help='Set administrative state down')
+ help='Disable network',
+ )
share_group = parser.add_mutually_exclusive_group()
share_group.add_argument(
'--share',
- dest='shared', action='store_true',
+ dest='shared',
+ action='store_true',
default=None,
- help='Share the network across tenants')
+ help='Share the network between projects',
+ )
share_group.add_argument(
'--no-share',
- dest='shared', action='store_false',
- help='Do not share the network across tenants')
+ dest='shared',
+ action='store_false',
+ help='Do not share the network between projects',
+ )
return parser
def take_action(self, parsed_args):
@@ -96,7 +104,7 @@ class DeleteNetwork(command.Command):
'networks',
metavar="<network>",
nargs="+",
- help=("Network(s) to delete (name or ID)")
+ help=("Network to delete (name or ID)")
)
return parser
@@ -171,34 +179,41 @@ class SetNetwork(command.Command):
parser.add_argument(
'identifier',
metavar="<network>",
- help=("Name or identifier of network to set")
+ help=("Network to modify (name or ID)")
+ )
+ parser.add_argument(
+ '--name',
+ metavar='<name>',
+ help='Set network name',
)
admin_group = parser.add_mutually_exclusive_group()
admin_group.add_argument(
'--enable',
dest='admin_state',
- default=None,
action='store_true',
- help='Set administrative state up')
+ default=None,
+ help='Enable network',
+ )
admin_group.add_argument(
'--disable',
dest='admin_state',
action='store_false',
- help='Set administrative state down')
- parser.add_argument(
- '--name',
- metavar='<network_name>',
- help='New name for the network')
+ help='Disable network',
+ )
share_group = parser.add_mutually_exclusive_group()
share_group.add_argument(
'--share',
- dest='shared', action='store_true',
+ dest='shared',
+ action='store_true',
default=None,
- help='Share the network across tenants')
+ help='Share the network between projects',
+ )
share_group.add_argument(
'--no-share',
- dest='shared', action='store_false',
- help='Do not share the network across tenants')
+ dest='shared',
+ action='store_false',
+ help='Do not share the network between projects',
+ )
return parser
def take_action(self, parsed_args):
@@ -231,7 +246,7 @@ class ShowNetwork(show.ShowOne):
parser.add_argument(
'identifier',
metavar="<network>",
- help=("Name or identifier of network to show")
+ help=("Network to display (name or ID)")
)
return parser