Merge "Add VLAN Transparent option to `osc network
`"
This commit is contained in:
commit
3d12ae8e03
doc/source/command-objects
openstackclient
releasenotes/notes
@ -28,6 +28,7 @@ Create new network
|
||||
[--provider-network-type <provider-network-type>]
|
||||
[--provider-physical-network <provider-physical-network>]
|
||||
[--provider-segment <provider-segment>]
|
||||
[--transparent-vlan | --no-transparent-vlan]
|
||||
<name>
|
||||
|
||||
.. option:: --project <project>
|
||||
@ -123,6 +124,18 @@ Create new network
|
||||
|
||||
*Network version 2 only*
|
||||
|
||||
.. option:: --transparent-vlan
|
||||
|
||||
Make the network VLAN transparent
|
||||
|
||||
*Network version 2 only*
|
||||
|
||||
.. option:: --no-transparent-vlan
|
||||
|
||||
Do not make the network VLAN transparent
|
||||
|
||||
*Network version 2 only*
|
||||
|
||||
.. _network_create-name:
|
||||
.. describe:: <name>
|
||||
|
||||
@ -182,6 +195,7 @@ Set network properties
|
||||
[--provider-network-type <provider-network-type>]
|
||||
[--provider-physical-network <provider-physical-network>]
|
||||
[--provider-segment <provider-segment>]
|
||||
[--transparent-vlan | --no-transparent-vlan]
|
||||
<network>
|
||||
|
||||
.. option:: --name <name>
|
||||
@ -234,6 +248,14 @@ Set network properties
|
||||
|
||||
VLAN ID for VLAN networks or Tunnel ID for GRE/VXLAN networks
|
||||
|
||||
.. option:: --transparent-vlan
|
||||
|
||||
Make the network VLAN transparent
|
||||
|
||||
.. option:: --no-transparent-vlan
|
||||
|
||||
Do not make the network VLAN transparent
|
||||
|
||||
.. _network_set-network:
|
||||
.. describe:: <network>
|
||||
|
||||
|
@ -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):
|
||||
|
@ -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)
|
||||
|
@ -0,0 +1,9 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
``network create`` and ``network set`` now support
|
||||
``--transparent-vlan`` and ``--no-transparent-vlan``
|
||||
options to add/remove VLAN transparency attributes
|
||||
from networks.
|
||||
This option is available in Network V2 only.
|
||||
[Bug `1545537 <https://bugs.launchpad.net/bugs/1545537>`_]
|
Loading…
x
Reference in New Issue
Block a user