Browse Source

Merge "Add "igmp_snooping_enable" config option for OVS agent" into stable/queens

changes/69/739669/2
Zuul 3 weeks ago
committed by Gerrit Code Review
parent
commit
88e4dcc10e
7 changed files with 66 additions and 5 deletions
  1. +12
    -0
      neutron/agent/common/ovs_lib.py
  2. +11
    -0
      neutron/conf/agent/ovs_conf.py
  3. +1
    -0
      neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py
  4. +2
    -0
      neutron/tests/functional/agent/l2/base.py
  5. +19
    -0
      neutron/tests/functional/agent/test_ovs_lib.py
  6. +14
    -5
      neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_tunnel.py
  7. +7
    -0
      releasenotes/notes/add-igmp_snooping_enable-config-option-6a0e15e4ed0a2cf7.yaml

+ 12
- 0
neutron/agent/common/ovs_lib.py View File

@@ -268,6 +268,18 @@ class OVSBridge(BaseOVS):
protocol,
key=version_from_protocol)

def set_igmp_snooping_state(self, state):
state = bool(state)
other_config = {
'mcast-snooping-disable-flood-unregistered': str(state)}
with self.ovsdb.transaction() as txn:
txn.add(
self.ovsdb.db_set('Bridge', self.br_name,
('mcast_snooping_enable', state)))
txn.add(
self.ovsdb.db_set('Bridge', self.br_name,
('other_config', other_config)))

def create(self, secure_mode=False):
other_config = {
'mac-table-size': str(cfg.CONF.OVS.bridge_mac_table_size)}


+ 11
- 0
neutron/conf/agent/ovs_conf.py View File

@@ -34,6 +34,17 @@ OPTS = [
'outside a reasonable range (10 to 1,000,000) might be '
'overridden by Open vSwitch according to the '
'documentation.')),
cfg.BoolOpt('igmp_snooping_enable', default=False,
help=_('Enable IGMP snooping for integration bridge. If this '
'option is set to True, support for Internet Group '
'Management Protocol (IGMP) is enabled in integration '
'bridge. '
'Setting this option to True will also enable Open '
'vSwitch mcast-snooping-disable-flood-unregistered '
'flag. This option will disable flooding of '
'unregistered multicast packets to all ports. '
'The switch will send unregistered multicast packets '
'only to ports connected to multicast routers.')),
]




+ 1
- 0
neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py View File

@@ -1055,6 +1055,7 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
self.int_br.create()
self.int_br.set_secure_mode()
self.int_br.setup_controllers(self.conf)
self.int_br.set_igmp_snooping_state(self.conf.OVS.igmp_snooping_enable)

if self.conf.AGENT.drop_flows_on_start:
# Delete the patch port between br-int and br-tun if we're deleting


+ 2
- 0
neutron/tests/functional/agent/l2/base.py View File

@@ -29,6 +29,7 @@ from neutron.agent.linux import interface
from neutron.agent.linux import polling
from neutron.common import utils
from neutron.conf.agent import common as agent_config
from neutron.conf.agent import ovs_conf as ovs_agent_config
from neutron.conf import common as common_config
from neutron.conf.plugins.ml2.drivers import agent
from neutron.conf.plugins.ml2.drivers import ovs_conf
@@ -75,6 +76,7 @@ class OVSAgentTestFramework(base.BaseOVSLinuxTestCase):
agent_config.register_interface_opts(config)
agent_config.register_interface_driver_opts_helper(config)
agent_config.register_agent_state_opts_helper(config)
ovs_agent_config.register_ovs_agent_opts(config)
ext_manager.register_opts(config)
return config



+ 19
- 0
neutron/tests/functional/agent/test_ovs_lib.py View File

@@ -186,6 +186,25 @@ class OVSBridgeTestCase(OVSBridgeTestBase):
self.br.db_get_val('Bridge', self.br.br_name, 'protocols'),
['OpenFlow10', 'OpenFlow12', 'OpenFlow13'])

def _test_set_igmp_snooping_state(self, state):
self.br.set_igmp_snooping_state(state)
self.assertEqual(
state,
self.br.db_get_val(
'Bridge', self.br.br_name, 'mcast_snooping_enable'))
br_other_config = self.ovs.ovsdb.db_find(
'Bridge', ('name', '=', self.br.br_name), columns=['other_config']
).execute()[0]['other_config']
self.assertEqual(
str(state),
br_other_config['mcast-snooping-disable-flood-unregistered'])

def test_set_igmp_snooping_enabled(self):
self._test_set_igmp_snooping_state(True)

def test_set_igmp_snooping_disabled(self):
self._test_set_igmp_snooping_state(False)

def test_get_datapath_id(self):
brdev = ip_lib.IPDevice(self.br.br_name)
dpid = brdev.link.attributes['link/ether'].replace(':', '')


+ 14
- 5
neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_tunnel.py View File

@@ -192,7 +192,7 @@ class TunnelTest(object):
'_check_bridge_datapath_id').start()
self._define_expected_calls()

def _define_expected_calls(self, arp_responder=False):
def _define_expected_calls(self, arp_responder=False, igmp_snooping=False):
self.mock_int_bridge_cls_expected = [
mock.call(self.INT_BRIDGE,
datapath_type=mock.ANY),
@@ -211,6 +211,7 @@ class TunnelTest(object):
mock.call.create(),
mock.call.set_secure_mode(),
mock.call.setup_controllers(mock.ANY),
mock.call.set_igmp_snooping_state(igmp_snooping),
mock.call.setup_default_table(),
]

@@ -344,7 +345,13 @@ class TunnelTest(object):
# The next two tests use l2_pop flag to test ARP responder
def test_construct_with_arp_responder(self):
self._build_agent(l2_population=True, arp_responder=True)
self._define_expected_calls(True)
self._define_expected_calls(arp_responder=True)
self._verify_mock_calls()

def test_construct_with_igmp_snooping(self):
cfg.CONF.set_override('igmp_snooping_enable', True, 'OVS')
self._build_agent()
self._define_expected_calls(igmp_snooping=True)
self._verify_mock_calls()

def test_construct_without_arp_responder(self):
@@ -660,7 +667,7 @@ class TunnelTestRyu(TunnelTest, ovs_test_base.OVSRyuTestBase):
class TunnelTestUseVethInterco(TunnelTest):
USE_VETH_INTERCONNECTION = True

def _define_expected_calls(self, arp_responder=False):
def _define_expected_calls(self, arp_responder=False, igmp_snooping=False):
self.mock_int_bridge_cls_expected = [
mock.call(self.INT_BRIDGE,
datapath_type=mock.ANY),
@@ -678,6 +685,7 @@ class TunnelTestUseVethInterco(TunnelTest):
mock.call.create(),
mock.call.set_secure_mode(),
mock.call.setup_controllers(mock.ANY),
mock.call.set_igmp_snooping_state(igmp_snooping),
mock.call.setup_default_table(),
]

@@ -759,8 +767,9 @@ class TunnelTestUseVethIntercoRyu(TunnelTestUseVethInterco,
class TunnelTestWithMTU(TunnelTestUseVethInterco):
VETH_MTU = 1500

def _define_expected_calls(self, arp_responder=False):
super(TunnelTestWithMTU, self)._define_expected_calls(arp_responder)
def _define_expected_calls(self, arp_responder=False, igmp_snooping=False):
super(TunnelTestWithMTU, self)._define_expected_calls(
arp_responder, igmp_snooping)
self.inta_expected.append(mock.call.link.set_mtu(self.VETH_MTU))
self.intb_expected.append(mock.call.link.set_mtu(self.VETH_MTU))



+ 7
- 0
releasenotes/notes/add-igmp_snooping_enable-config-option-6a0e15e4ed0a2cf7.yaml View File

@@ -0,0 +1,7 @@
---
features:
- |
Add new configuration option ``igmp_snooping_enable``. New option is in
``OVS`` config section and is used by openvswitch agent.
This option is used to enable support for Internet Group Management
Protocol (IGMP) in integration bridge.

Loading…
Cancel
Save