summaryrefslogtreecommitdiff
path: root/openstackclient/network
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-04-06 19:20:56 +0000
committerGerrit Code Review <review@openstack.org>2016-04-06 19:20:56 +0000
commit60a91a65720fb8fb1a18556d16daa89f9a340cf6 (patch)
tree04312593c5b43ae5f01a1d9dc93256b870d511ca /openstackclient/network
parent523ab58fb682efe7f0ac6fcf4746d2d434c7b5ac (diff)
parent107bc5164f99ef956d952273235648c7f8f26764 (diff)
downloadpython-openstackclient-60a91a65720fb8fb1a18556d16daa89f9a340cf6.tar.gz
Merge "Add external network options to osc network create"
Diffstat (limited to 'openstackclient/network')
-rw-r--r--openstackclient/network/v2/network.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/openstackclient/network/v2/network.py b/openstackclient/network/v2/network.py
index 42648e45..6fd18efb 100644
--- a/openstackclient/network/v2/network.py
+++ b/openstackclient/network/v2/network.py
@@ -144,6 +144,27 @@ class CreateNetwork(common.NetworkAndComputeShowOne):
'(requires the Network Availability Zone extension, '
'this option can be repeated).',
)
+ external_router_grp = parser.add_mutually_exclusive_group()
+ external_router_grp.add_argument(
+ '--external',
+ action='store_true',
+ help='Set this network as an external network. '
+ 'Requires the "external-net" extension to be enabled.')
+ external_router_grp.add_argument(
+ '--internal',
+ action='store_true',
+ help='Set this network as an internal network (default)')
+ default_router_grp = parser.add_mutually_exclusive_group()
+ default_router_grp.add_argument(
+ '--default',
+ action='store_true',
+ help='Specify if this network should be used as '
+ 'the default external network')
+ default_router_grp.add_argument(
+ '--no-default',
+ action='store_true',
+ help='Do not use the network as the default external network.'
+ 'By default, no network is set as an external network.')
return parser
def update_parser_compute(self, parser):
@@ -156,6 +177,14 @@ class CreateNetwork(common.NetworkAndComputeShowOne):
def take_action_network(self, client, parsed_args):
attrs = _get_attrs(self.app.client_manager, parsed_args)
+ if parsed_args.internal:
+ attrs['router:external'] = False
+ if parsed_args.external:
+ attrs['router:external'] = True
+ if parsed_args.no_default:
+ attrs['is_default'] = False
+ if parsed_args.default:
+ attrs['is_default'] = True
obj = client.create_network(**attrs)
columns = _get_columns(obj)
data = utils.get_item_properties(obj, columns, formatters=_formatters)