Merge "Add support for vlan transparency in the OVN driver"

This commit is contained in:
Zuul 2020-11-15 15:10:22 +00:00 committed by Gerrit Code Review
commit f6e2c45bcd
5 changed files with 37 additions and 2 deletions

View File

@ -291,3 +291,6 @@ NEUTRON_AVAILABILITY_ZONES = 'neutron-availability-zones'
OVN_CMS_OPTIONS = 'ovn-cms-options'
CMS_OPT_CHASSIS_AS_GW = 'enable-chassis-as-gw'
CMS_OPT_AVAILABILITY_ZONES = 'availability-zones'
# OVN vlan transparency option
VLAN_PASSTHRU = 'vlan-passthru'

View File

@ -152,6 +152,10 @@ class OVNMechanismDriver(api.MechanismDriver):
def sb_ovn(self):
return self._sb_ovn
def check_vlan_transparency(self, context):
"""OVN driver vlan transparency support."""
return True
def _setup_vif_port_bindings(self):
self.supported_vnic_types = [portbindings.VNIC_NORMAL,
portbindings.VNIC_DIRECT,

View File

@ -1574,8 +1574,11 @@ class OVNClient(object):
# Enable IGMP snooping if igmp_snooping_enable is enabled in Neutron
value = 'true' if ovn_conf.is_igmp_snooping_enabled() else 'false'
vlan_transparent = (
'true' if network.get('vlan_transparent') else 'false')
params['other_config'] = {ovn_const.MCAST_SNOOP: value,
ovn_const.MCAST_FLOOD_UNREGISTERED: value}
ovn_const.MCAST_FLOOD_UNREGISTERED: value,
ovn_const.VLAN_PASSTHRU: vlan_transparent}
return params
def create_network(self, context, network):

View File

@ -83,6 +83,7 @@ class TestOVNMechanismDriver(test_plugin.Ml2PluginV2TestCase):
group='ovn')
ovn_conf.cfg.CONF.set_override('dns_servers', ['8.8.8.8'],
group='ovn')
cfg.CONF.set_override('vlan_transparent', True)
super(TestOVNMechanismDriver, self).setUp()
mm = directory.get_plugin().mechanism_manager
self.mech_driver = mm.mech_drivers['ovn'].obj
@ -717,7 +718,8 @@ class TestOVNMechanismDriver(test_plugin.Ml2PluginV2TestCase):
ovn_utils.ovn_name(net['id']), external_ids=mock.ANY,
may_exist=True,
other_config={ovn_const.MCAST_SNOOP: value,
ovn_const.MCAST_FLOOD_UNREGISTERED: value})
ovn_const.MCAST_FLOOD_UNREGISTERED: value,
ovn_const.VLAN_PASSTHRU: 'false'})
def test_create_network_igmp_snoop_enabled(self):
self._create_network_igmp_snoop(enabled=True)
@ -725,6 +727,25 @@ class TestOVNMechanismDriver(test_plugin.Ml2PluginV2TestCase):
def test_create_network_igmp_snoop_disabled(self):
self._create_network_igmp_snoop(enabled=False)
def _create_network_vlan_passthru(self, enabled):
nb_idl = self.mech_driver._ovn_client._nb_idl
net = self._make_network(self.fmt, name='net1',
admin_state_up=True,
vlan_transparent=enabled)['network']
value = 'true' if enabled else 'false'
nb_idl.ls_add.assert_called_once_with(
ovn_utils.ovn_name(net['id']), external_ids=mock.ANY,
may_exist=True,
other_config={ovn_const.MCAST_SNOOP: 'false',
ovn_const.MCAST_FLOOD_UNREGISTERED: 'false',
ovn_const.VLAN_PASSTHRU: value})
def test_create_network_vlan_passthru_enabled(self):
self._create_network_vlan_passthru(enabled=True)
def test_create_network_vlan_passthru_disabled(self):
self._create_network_vlan_passthru(enabled=False)
def test_create_network_create_localnet_port_tunnel_network_type(self):
nb_idl = self.mech_driver._ovn_client._nb_idl
self._make_network(self.fmt, name='net1',

View File

@ -0,0 +1,4 @@
---
features:
- |
Added support for the ``vlan-transparent`` in the OVN mechanism driver.