Merge "Don't install iptables rules if neutron is filtering"

This commit is contained in:
Jenkins 2017-03-10 15:12:31 +00:00 committed by Gerrit Code Review
commit 3a2b19fab3
2 changed files with 11 additions and 2 deletions

View File

@ -102,7 +102,10 @@ class LinuxBridgePlugin(plugin.PluginBase):
bridge_name, iface, mtu=mtu)
else:
iface = self.config.flat_interface or network.bridge_interface
linux_net.ensure_bridge(bridge_name, iface)
# only put in iptables rules if Neutron not filtering
install_filters = not vif.has_traffic_filtering
linux_net.ensure_bridge(bridge_name, iface,
filtering=install_filters)
def unplug(self, vif, instance_info):
# Nothing required to unplug a port for a VIF using standard

View File

@ -66,14 +66,20 @@ class PluginTest(testtools.TestCase):
address='ca:fe:de:ad:be:ef',
network=network,
dev_name='tap-xxx-yyy-zzz',
has_traffic_filtering=True,
bridge_name="br0")
plugin = linux_bridge.LinuxBridgePlugin.load("linux_bridge")
plugin.plug(vif, self.instance)
mock_ensure_bridge.assert_called_with("br0", "eth0")
mock_ensure_bridge.assert_called_with("br0", "eth0", filtering=False)
self.assertEqual(len(mock_ensure_vlan_bridge.calls), 0)
mock_ensure_bridge.reset_mock()
vif.has_traffic_filtering = False
plugin.plug(vif, self.instance)
mock_ensure_bridge.assert_called_with("br0", "eth0", filtering=True)
def test_plug_bridge_create_br_vlan_mtu_in_model(self):
self._test_plug_bridge_create_br_vlan(mtu=1234)