Add permanent ARP entries for DVR fip/qrouter veth pair

Since we know the IP and MAC addresses of both sides of the
fip/qrouter namespace veth pair device, just add permanent
ARP entries for them.

Change-Id: I6193b00681dfb79222eedfd00c89620321ac1b4f
Related-Bug: #1791989
(cherry picked from commit ac5815a110)
This commit is contained in:
Brian Haley 2018-10-03 14:35:05 -04:00 committed by Slawek Kaplonski
parent 2a3ba92a60
commit 16c2d64bdc
2 changed files with 13 additions and 0 deletions

View File

@ -447,6 +447,13 @@ class FipNamespace(namespaces.Namespace):
self._add_cidr_to_device(rtr_2_fip_dev, str(rtr_2_fip))
self._add_cidr_to_device(fip_2_rtr_dev, str(fip_2_rtr))
# Add permanant ARP entries on each side of veth pair
rtr_2_fip_dev.neigh.add(common_utils.cidr_to_ip(fip_2_rtr),
fip_2_rtr_dev.link.address)
fip_2_rtr_dev.neigh.add(common_utils.cidr_to_ip(rtr_2_fip),
rtr_2_fip_dev.link.address)
self._add_rtr_ext_route_rule_to_route_table(ri, fip_2_rtr,
fip_2_rtr_name)

View File

@ -25,6 +25,7 @@ from neutron.agent.l3 import router_info
from neutron.agent.linux import ip_lib
from neutron.agent.linux import iptables_manager
from neutron.common import exceptions as n_exc
from neutron.common import utils as n_utils
from neutron.tests import base
_uuid = uuidutils.generate_uuid
@ -301,6 +302,11 @@ class TestDvrFipNs(base.BaseTestCase):
device.addr.add.assert_has_calls(expected)
self.assertEqual(2, device.addr.add.call_count)
expected = [mock.call(n_utils.cidr_to_ip(addr_pair[1]), mock.ANY),
mock.call(n_utils.cidr_to_ip(addr_pair[0]), mock.ANY)]
device.neigh.add.assert_has_calls(expected)
self.assertEqual(2, device.neigh.add.call_count)
device.route.add_gateway.assert_called_once_with(
'169.254.31.29', table=16)
self.assertTrue(