Skip to content

Commit b02cce5

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Command docs: network"
2 parents 326f7e3 + 20ec40e commit b02cce5

2 files changed

Lines changed: 174 additions & 24 deletions

File tree

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
=======
2+
network
3+
=======
4+
5+
Network v2
6+
7+
network create
8+
--------------
9+
10+
Create new network
11+
12+
.. program:: network create
13+
.. code:: bash
14+
15+
os network create
16+
[--enable | --disable]
17+
[--share | --no-share]
18+
<name>
19+
20+
.. option:: --enable
21+
22+
Enable network (default)
23+
24+
.. option:: --disable
25+
26+
Disable network
27+
28+
.. option:: --share
29+
30+
Share the network between projects
31+
32+
.. option:: --no-share
33+
34+
Do not share the network between projects
35+
36+
.. _network_create-name:
37+
.. describe:: <name>
38+
39+
New network name
40+
41+
network delete
42+
--------------
43+
44+
Delete network(s)
45+
46+
.. program:: network delete
47+
.. code:: bash
48+
49+
os network delete
50+
<network> [<network> ...]
51+
52+
.. _network_delete-project:
53+
.. describe:: <network>
54+
55+
Network to delete (name or ID)
56+
57+
network list
58+
------------
59+
60+
List networks
61+
62+
.. program:: network list
63+
.. code:: bash
64+
65+
os network list
66+
[--external]
67+
[--dhcp]
68+
[--long]
69+
70+
.. option:: --external
71+
72+
List external networks
73+
74+
.. option:: --dhcp
75+
76+
ID of the DHCP agent
77+
78+
.. option:: --long
79+
80+
List additional fields in output
81+
82+
network set
83+
-----------
84+
85+
Set network properties
86+
87+
.. program:: network set
88+
.. code:: bash
89+
90+
os network set
91+
[--name <name>]
92+
[--enable | --disable]
93+
[--share | --no-share]
94+
<network>
95+
96+
.. option:: --name <name>
97+
98+
Set network name
99+
100+
.. option:: --enable
101+
102+
Enable network
103+
104+
.. option:: --disable
105+
106+
Disable network
107+
108+
.. option:: --share
109+
110+
Share the network between projects
111+
112+
.. option:: --no-share
113+
114+
Do not share the network between projects
115+
116+
.. _network_set-name:
117+
.. describe:: <network>
118+
119+
Network to modify (name or ID)
120+
121+
network show
122+
------------
123+
124+
Display network details
125+
126+
.. program:: network show
127+
.. code:: bash
128+
129+
os network show
130+
<network>
131+
132+
.. _network_show-name:
133+
.. describe:: <network>
134+
135+
Network to display (name or ID)

‎openstackclient/network/v2/network.py‎

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,37 +32,45 @@ def filters(data):
3232

3333

3434
class CreateNetwork(show.ShowOne):
35-
"""Create a network"""
35+
"""Create new network"""
3636

3737
log = logging.getLogger(__name__ + '.CreateNetwork')
3838

3939
def get_parser(self, prog_name):
4040
parser = super(CreateNetwork, self).get_parser(prog_name)
4141
parser.add_argument(
42-
'name', metavar='<network_name>',
43-
help='Name of network to create')
42+
'name',
43+
metavar='<name>',
44+
help='New network name',
45+
)
4446
admin_group = parser.add_mutually_exclusive_group()
4547
admin_group.add_argument(
4648
'--enable',
4749
dest='admin_state',
48-
default=True,
4950
action='store_true',
50-
help='Set administrative state up')
51+
default=True,
52+
help='Enable network (default)',
53+
)
5154
admin_group.add_argument(
5255
'--disable',
5356
dest='admin_state',
5457
action='store_false',
55-
help='Set administrative state down')
58+
help='Disable network',
59+
)
5660
share_group = parser.add_mutually_exclusive_group()
5761
share_group.add_argument(
5862
'--share',
59-
dest='shared', action='store_true',
63+
dest='shared',
64+
action='store_true',
6065
default=None,
61-
help='Share the network across tenants')
66+
help='Share the network between projects',
67+
)
6268
share_group.add_argument(
6369
'--no-share',
64-
dest='shared', action='store_false',
65-
help='Do not share the network across tenants')
70+
dest='shared',
71+
action='store_false',
72+
help='Do not share the network between projects',
73+
)
6674
return parser
6775

6876
def take_action(self, parsed_args):
@@ -96,7 +104,7 @@ def get_parser(self, prog_name):
96104
'networks',
97105
metavar="<network>",
98106
nargs="+",
99-
help=("Network(s) to delete (name or ID)")
107+
help=("Network to delete (name or ID)")
100108
)
101109
return parser
102110

@@ -171,34 +179,41 @@ def get_parser(self, prog_name):
171179
parser.add_argument(
172180
'identifier',
173181
metavar="<network>",
174-
help=("Name or identifier of network to set")
182+
help=("Network to modify (name or ID)")
183+
)
184+
parser.add_argument(
185+
'--name',
186+
metavar='<name>',
187+
help='Set network name',
175188
)
176189
admin_group = parser.add_mutually_exclusive_group()
177190
admin_group.add_argument(
178191
'--enable',
179192
dest='admin_state',
180-
default=None,
181193
action='store_true',
182-
help='Set administrative state up')
194+
default=None,
195+
help='Enable network',
196+
)
183197
admin_group.add_argument(
184198
'--disable',
185199
dest='admin_state',
186200
action='store_false',
187-
help='Set administrative state down')
188-
parser.add_argument(
189-
'--name',
190-
metavar='<network_name>',
191-
help='New name for the network')
201+
help='Disable network',
202+
)
192203
share_group = parser.add_mutually_exclusive_group()
193204
share_group.add_argument(
194205
'--share',
195-
dest='shared', action='store_true',
206+
dest='shared',
207+
action='store_true',
196208
default=None,
197-
help='Share the network across tenants')
209+
help='Share the network between projects',
210+
)
198211
share_group.add_argument(
199212
'--no-share',
200-
dest='shared', action='store_false',
201-
help='Do not share the network across tenants')
213+
dest='shared',
214+
action='store_false',
215+
help='Do not share the network between projects',
216+
)
202217
return parser
203218

204219
def take_action(self, parsed_args):
@@ -231,7 +246,7 @@ def get_parser(self, prog_name):
231246
parser.add_argument(
232247
'identifier',
233248
metavar="<network>",
234-
help=("Name or identifier of network to show")
249+
help=("Network to display (name or ID)")
235250
)
236251
return parser
237252

0 commit comments

Comments
 (0)