Browse Source

Merge "Don't add arp responder for non tunnel network port" into stable/stein

changes/61/742361/1
Zuul 3 weeks ago
committed by Gerrit Code Review
parent
commit
0d514d3c15
2 changed files with 36 additions and 0 deletions
  1. +7
    -0
      neutron/plugins/ml2/drivers/l2pop/mech_driver.py
  2. +29
    -0
      neutron/tests/unit/plugins/ml2/drivers/l2pop/test_mech_driver.py

+ 7
- 0
neutron/plugins/ml2/drivers/l2pop/mech_driver.py View File

@@ -120,6 +120,13 @@ class L2populationMechanismDriver(api.MechanismDriver):
if not agent_host:
return

# We should not add arp responder for non tunnel network type
port_context = context._plugin_context
agent = l2pop_db.get_agent_by_host(port_context, agent_host)
segment = context.bottom_bound_segment
if not self._validate_segment(segment, port['id'], agent):
return

agent_ip = l2pop_db.get_agent_ip_by_host(context._plugin_context,
agent_host)



+ 29
- 0
neutron/tests/unit/plugins/ml2/drivers/l2pop/test_mech_driver.py View File

@@ -1090,6 +1090,35 @@ class TestL2PopulationRpcTestCase(test_plugin.Ml2PluginV2TestCase):
self.mock_fanout.assert_called_with(
mock.ANY, 'add_fdb_entries', add_expected)

def test_fixed_ips_changed_vlan(self):
self._register_ml2_agents()

with self.subnet(network=self._network2) as subnet:
host_arg = {portbindings.HOST_ID: HOST}
fixed_ips = [{'subnet_id': subnet['subnet']['id'],
'ip_address': '10.0.0.2'}]
with self.port(subnet=subnet, cidr='10.0.0.0/24',
device_owner=DEVICE_OWNER_COMPUTE,
arg_list=(portbindings.HOST_ID,),
fixed_ips=fixed_ips,
**host_arg) as port:
p = port['port']

device = 'tap' + p['id']

self.callbacks.update_device_up(self.adminContext,
agent_id=HOST,
device=device)

data = {'port': {'fixed_ips': [{'ip_address': '10.0.0.2'},
{'ip_address': '10.0.0.10'}]}}
self.new_update_request('ports', data, p['id'])
l2pop_mech = l2pop_mech_driver.L2populationMechanismDriver()
l2pop_mech.L2PopulationAgentNotify = mock.Mock()
l2notify = l2pop_mech.L2PopulationAgentNotify
l2notify.update_fdb_entries = mock.Mock()
self.assertFalse(l2notify.update_fdb_entries.called)

def test_fixed_ips_changed(self):
self._register_ml2_agents()



Loading…
Cancel
Save