From 00c149a28f72ee7236e836a7f128fce9ca5e1e09 Mon Sep 17 00:00:00 2001 From: reedip Date: Tue, 19 Apr 2016 13:46:15 +0900 Subject: Add VLAN Transparent option to ``osc network`` osc network set and network create now support --transparent-vlan|--no-transparent-vlan options to add/remove vlan transparency from the network. Change-Id: I845eb8f541cd32a4c4b28f929a63b205e7e31756 Closes-Bug: 1545537 --- openstackclient/network/v2/network.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'openstackclient/network') diff --git a/openstackclient/network/v2/network.py b/openstackclient/network/v2/network.py index 4b77971a..dab20b74 100644 --- a/openstackclient/network/v2/network.py +++ b/openstackclient/network/v2/network.py @@ -93,11 +93,17 @@ def _get_attrs(client_manager, parsed_args): attrs['provider:physical_network'] = parsed_args.physical_network if parsed_args.segmentation_id: attrs['provider:segmentation_id'] = parsed_args.segmentation_id + # Update VLAN Transparency for networks + if parsed_args.transparent_vlan: + attrs['vlan_transparent'] = True + if parsed_args.no_transparent_vlan: + attrs['vlan_transparent'] = False return attrs -def _add_provider_network_options(parser): - # Add provider network options +def _add_additional_network_options(parser): + # Add additional network options + parser.add_argument( '--provider-network-type', metavar='', @@ -119,6 +125,16 @@ def _add_provider_network_options(parser): help=_("VLAN ID for VLAN networks or Tunnel ID for GRE/VXLAN " "networks")) + vlan_transparent_grp = parser.add_mutually_exclusive_group() + vlan_transparent_grp.add_argument( + '--transparent-vlan', + action='store_true', + help=_("Make the network VLAN transparent")) + vlan_transparent_grp.add_argument( + '--no-transparent-vlan', + action='store_true', + help=_("Do not make the network VLAN transparent")) + def _get_attrs_compute(client_manager, parsed_args): attrs = {} @@ -209,7 +225,7 @@ class CreateNetwork(common.NetworkAndComputeShowOne): help=_("Do not use the network as the default external network. " "(default)") ) - _add_provider_network_options(parser) + _add_additional_network_options(parser) return parser def update_parser_compute(self, parser): @@ -413,7 +429,7 @@ class SetNetwork(command.Command): action='store_true', help=_("Do not use the network as the default external network") ) - _add_provider_network_options(parser) + _add_additional_network_options(parser) return parser def take_action(self, parsed_args): -- cgit v1.2.1