diff options
| author | reedip <reedip.banerjee@nectechnologies.in> | 2016-03-14 15:35:46 +0900 |
|---|---|---|
| committer | Reedip <reedip.banerjee@nectechnologies.in> | 2016-04-06 16:01:24 +0000 |
| commit | 107bc5164f99ef956d952273235648c7f8f26764 (patch) | |
| tree | ff5074d39b2e30a38db0fa4ee9de3396ba85d50d /openstackclient/network | |
| parent | 55b37d5e33f322077303a895d3453320b3895f11 (diff) | |
| download | python-openstackclient-107bc5164f99ef956d952273235648c7f8f26764.tar.gz | |
Add external network options to osc network create
The following patch adds the options "--external" & "--internal"
and the suboptions to "external": "--default" & "--no-default",
to "osc network create" CLI to provide the user an option to create
a network as an external network.
Change-Id: Idf73714bb94c0610ea164131140a51848908b00b
Partial-Bug: #1545537
Diffstat (limited to 'openstackclient/network')
| -rw-r--r-- | openstackclient/network/v2/network.py | 29 |
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) |
