From 20ec40e222dc57d0121335d9eb6abd6195daad89 Mon Sep 17 00:00:00 2001
From: Dean Troyer <dtroyer@gmail.com>
Date: Tue, 20 Jan 2015 16:44:50 -0600
Subject: [PATCH] Command docs: network

Change-Id: Ia88b6c0ca5205fa5bfc3efa06ac7f84c4a9e5d4e
---
 doc/source/command-objects/network.rst | 135 +++++++++++++++++++++++++
 openstackclient/network/v2/network.py  |  63 +++++++-----
 2 files changed, 174 insertions(+), 24 deletions(-)
 create mode 100644 doc/source/command-objects/network.rst

diff --git a/doc/source/command-objects/network.rst b/doc/source/command-objects/network.rst
new file mode 100644
index 0000000000..cdf2ebfa64
--- /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 0d68f82dc1..c92650846d 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