summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/network/v2/network.py24
-rw-r--r--openstackclient/tests/network/v2/test_network.py6
2 files changed, 26 insertions, 4 deletions
diff --git a/openstackclient/network/v2/network.py b/openstackclient/network/v2/network.py
index 9fd7e28b..6730ce85 100644
--- a/openstackclient/network/v2/network.py
+++ b/openstackclient/network/v2/network.py
@@ -90,11 +90,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='<provider-network-type>',
@@ -116,6 +122,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 = {}
@@ -206,7 +222,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):
@@ -410,7 +426,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):
diff --git a/openstackclient/tests/network/v2/test_network.py b/openstackclient/tests/network/v2/test_network.py
index 8f91e20e..c6736c56 100644
--- a/openstackclient/tests/network/v2/test_network.py
+++ b/openstackclient/tests/network/v2/test_network.py
@@ -148,6 +148,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
"--provider-network-type", "vlan",
"--provider-physical-network", "physnet1",
"--provider-segment", "400",
+ "--transparent-vlan",
self._network.name,
]
verifylist = [
@@ -161,6 +162,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
('provider_network_type', 'vlan'),
('physical_network', 'physnet1'),
('segmentation_id', '400'),
+ ('transparent_vlan', True),
('name', self._network.name),
]
@@ -178,6 +180,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
'provider:network_type': 'vlan',
'provider:physical_network': 'physnet1',
'provider:segmentation_id': '400',
+ 'vlan_transparent': True,
})
self.assertEqual(self.columns, columns)
self.assertEqual(self.data, data)
@@ -486,6 +489,7 @@ class TestSetNetwork(TestNetwork):
'--provider-network-type', 'vlan',
'--provider-physical-network', 'physnet1',
'--provider-segment', '400',
+ '--no-transparent-vlan',
]
verifylist = [
('network', self._network.name),
@@ -497,6 +501,7 @@ class TestSetNetwork(TestNetwork):
('provider_network_type', 'vlan'),
('physical_network', 'physnet1'),
('segmentation_id', '400'),
+ ('no_transparent_vlan', True),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@@ -511,6 +516,7 @@ class TestSetNetwork(TestNetwork):
'provider:network_type': 'vlan',
'provider:physical_network': 'physnet1',
'provider:segmentation_id': '400',
+ 'vlan_transparent': False,
}
self.network.update_network.assert_called_once_with(
self._network, **attrs)