Ensure permanent mac entry is added for the right device
For vlan provider network we need to add the mac entry for the cr-lrp pointing to the vlan device, not the bridge itself. Otherwise this won't work when the router has snat disable. Story 2010620 Task 47553 Change-Id: I2171faf62b57030465b5860a9a3c95aaac1e45ec
This commit is contained in:
parent
1f83823a95
commit
b3ef8feb38
@ -320,13 +320,15 @@ class OVNBGPDriver(driver_api.AgentDriverBase):
|
|||||||
for ip in port_ips:
|
for ip in port_ips:
|
||||||
try:
|
try:
|
||||||
if lladdr:
|
if lladdr:
|
||||||
|
dev = bridge_device
|
||||||
|
if bridge_vlan:
|
||||||
|
dev = '{}.{}'.format(dev, bridge_vlan)
|
||||||
linux_net.add_ip_rule(
|
linux_net.add_ip_rule(
|
||||||
ip, self.ovn_routing_tables[bridge_device],
|
ip, self.ovn_routing_tables[bridge_device],
|
||||||
bridge_device, lladdr=lladdr)
|
dev=dev, lladdr=lladdr)
|
||||||
else:
|
else:
|
||||||
linux_net.add_ip_rule(
|
linux_net.add_ip_rule(
|
||||||
ip, self.ovn_routing_tables[bridge_device],
|
ip, self.ovn_routing_tables[bridge_device])
|
||||||
bridge_device)
|
|
||||||
except agent_exc.InvalidPortIP:
|
except agent_exc.InvalidPortIP:
|
||||||
LOG.exception("Invalid IP to create a rule for port"
|
LOG.exception("Invalid IP to create a rule for port"
|
||||||
" on the provider network: %s", ip)
|
" on the provider network: %s", ip)
|
||||||
@ -912,7 +914,7 @@ class OVNBGPDriver(driver_api.AgentDriverBase):
|
|||||||
self.chassis)
|
self.chassis)
|
||||||
try:
|
try:
|
||||||
linux_net.add_ip_rule(
|
linux_net.add_ip_rule(
|
||||||
ip, self.ovn_routing_tables[bridge_device], bridge_device)
|
ip, self.ovn_routing_tables[bridge_device])
|
||||||
except agent_exc.InvalidPortIP:
|
except agent_exc.InvalidPortIP:
|
||||||
LOG.exception("Invalid IP to create a rule for the "
|
LOG.exception("Invalid IP to create a rule for the "
|
||||||
"lrp (network router interface) port: %s", ip)
|
"lrp (network router interface) port: %s", ip)
|
||||||
|
@ -281,7 +281,7 @@ class TestOVNBGPDriver(test_base.TestCase):
|
|||||||
mock_add_ips_dev.assert_called_once_with(
|
mock_add_ips_dev.assert_called_once_with(
|
||||||
CONF.bgp_nic, [self.ipv4])
|
CONF.bgp_nic, [self.ipv4])
|
||||||
mock_add_rule.assert_called_once_with(
|
mock_add_rule.assert_called_once_with(
|
||||||
self.ipv4, 'fake-table', self.bridge)
|
self.ipv4, 'fake-table')
|
||||||
mock_add_route.assert_called_once_with(
|
mock_add_route.assert_called_once_with(
|
||||||
mock.ANY, self.ipv4, 'fake-table', self.bridge, vlan=10)
|
mock.ANY, self.ipv4, 'fake-table', self.bridge, vlan=10)
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ class TestOVNBGPDriver(test_base.TestCase):
|
|||||||
mock_add_ips_dev.assert_called_once_with(
|
mock_add_ips_dev.assert_called_once_with(
|
||||||
CONF.bgp_nic, [self.ipv4])
|
CONF.bgp_nic, [self.ipv4])
|
||||||
mock_add_rule.assert_called_once_with(
|
mock_add_rule.assert_called_once_with(
|
||||||
self.ipv4, 'fake-table', self.bridge)
|
self.ipv4, 'fake-table')
|
||||||
mock_add_route.assert_not_called()
|
mock_add_route.assert_not_called()
|
||||||
|
|
||||||
@mock.patch.object(linux_net, 'add_ips_to_dev')
|
@mock.patch.object(linux_net, 'add_ips_to_dev')
|
||||||
@ -319,7 +319,8 @@ class TestOVNBGPDriver(test_base.TestCase):
|
|||||||
mock_add_ips_dev.assert_called_once_with(
|
mock_add_ips_dev.assert_called_once_with(
|
||||||
CONF.bgp_nic, [self.ipv4])
|
CONF.bgp_nic, [self.ipv4])
|
||||||
mock_add_rule.assert_called_once_with(
|
mock_add_rule.assert_called_once_with(
|
||||||
self.ipv4, 'fake-table', self.bridge, lladdr='fake-mac')
|
self.ipv4, 'fake-table', dev='{}.{}'.format(self.bridge, 10),
|
||||||
|
lladdr='fake-mac')
|
||||||
mock_add_route.assert_called_once_with(
|
mock_add_route.assert_called_once_with(
|
||||||
mock.ANY, self.ipv4, 'fake-table', self.bridge, vlan=10)
|
mock.ANY, self.ipv4, 'fake-table', self.bridge, vlan=10)
|
||||||
|
|
||||||
@ -593,7 +594,7 @@ class TestOVNBGPDriver(test_base.TestCase):
|
|||||||
|
|
||||||
# Assert that the add methods were called
|
# Assert that the add methods were called
|
||||||
mock_add_rule.assert_called_once_with(
|
mock_add_rule.assert_called_once_with(
|
||||||
'{}/32'.format(self.ipv4), 'fake-table', self.bridge)
|
'{}/32'.format(self.ipv4), 'fake-table')
|
||||||
mock_add_route.assert_called_once_with(
|
mock_add_route.assert_called_once_with(
|
||||||
mock.ANY, self.ipv4, 'fake-table', self.bridge,
|
mock.ANY, self.ipv4, 'fake-table', self.bridge,
|
||||||
vlan=10, mask='32', via=self.fip)
|
vlan=10, mask='32', via=self.fip)
|
||||||
@ -680,7 +681,7 @@ class TestOVNBGPDriver(test_base.TestCase):
|
|||||||
# Assert that the add methods were called
|
# Assert that the add methods were called
|
||||||
mock_ipv6_gua.assert_called_once_with('{}/128'.format(self.ipv6))
|
mock_ipv6_gua.assert_called_once_with('{}/128'.format(self.ipv6))
|
||||||
mock_add_rule.assert_called_once_with(
|
mock_add_rule.assert_called_once_with(
|
||||||
'{}/128'.format(self.ipv6), 'fake-table', self.bridge)
|
'{}/128'.format(self.ipv6), 'fake-table')
|
||||||
mock_add_route.assert_called_once_with(
|
mock_add_route.assert_called_once_with(
|
||||||
mock.ANY, self.ipv6, 'fake-table', self.bridge,
|
mock.ANY, self.ipv6, 'fake-table', self.bridge,
|
||||||
vlan=10, mask='128', via=self.fip)
|
vlan=10, mask='128', via=self.fip)
|
||||||
@ -764,7 +765,7 @@ class TestOVNBGPDriver(test_base.TestCase):
|
|||||||
self.bgp_driver._process_lrp_port(router_port, 'gateway_port')
|
self.bgp_driver._process_lrp_port(router_port, 'gateway_port')
|
||||||
|
|
||||||
mock_add_rule.assert_called_once_with(
|
mock_add_rule.assert_called_once_with(
|
||||||
'{}/32'.format(self.ipv4), 'fake-table', self.bridge)
|
'{}/32'.format(self.ipv4), 'fake-table')
|
||||||
# Assert that add_ip_route() was not called
|
# Assert that add_ip_route() was not called
|
||||||
mock_add_route.assert_not_called()
|
mock_add_route.assert_not_called()
|
||||||
|
|
||||||
@ -927,8 +928,8 @@ class TestOVNBGPDriver(test_base.TestCase):
|
|||||||
mock_add_ip_dev.assert_called_once_with(
|
mock_add_ip_dev.assert_called_once_with(
|
||||||
CONF.bgp_nic, ips)
|
CONF.bgp_nic, ips)
|
||||||
|
|
||||||
expected_calls = [mock.call(self.ipv4, 'fake-table', self.bridge),
|
expected_calls = [mock.call(self.ipv4, 'fake-table'),
|
||||||
mock.call(self.ipv6, 'fake-table', self.bridge)]
|
mock.call(self.ipv6, 'fake-table')]
|
||||||
mock_add_rule.assert_has_calls(expected_calls)
|
mock_add_rule.assert_has_calls(expected_calls)
|
||||||
|
|
||||||
expected_calls = [mock.call(mock.ANY, self.ipv4, 'fake-table',
|
expected_calls = [mock.call(mock.ANY, self.ipv4, 'fake-table',
|
||||||
@ -963,8 +964,8 @@ class TestOVNBGPDriver(test_base.TestCase):
|
|||||||
mock_add_ip_dev.assert_called_once_with(
|
mock_add_ip_dev.assert_called_once_with(
|
||||||
CONF.bgp_nic, ips)
|
CONF.bgp_nic, ips)
|
||||||
|
|
||||||
expected_calls = [mock.call(self.ipv4, 'fake-table', self.bridge),
|
expected_calls = [mock.call(self.ipv4, 'fake-table'),
|
||||||
mock.call(self.ipv6, 'fake-table', self.bridge)]
|
mock.call(self.ipv6, 'fake-table')]
|
||||||
mock_add_rule.assert_has_calls(expected_calls)
|
mock_add_rule.assert_has_calls(expected_calls)
|
||||||
|
|
||||||
expected_calls = [mock.call(mock.ANY, self.ipv4, 'fake-table',
|
expected_calls = [mock.call(mock.ANY, self.ipv4, 'fake-table',
|
||||||
@ -999,7 +1000,7 @@ class TestOVNBGPDriver(test_base.TestCase):
|
|||||||
mock_add_ip_dev.assert_called_once_with(
|
mock_add_ip_dev.assert_called_once_with(
|
||||||
CONF.bgp_nic, [self.fip])
|
CONF.bgp_nic, [self.fip])
|
||||||
mock_add_rule.assert_called_once_with(
|
mock_add_rule.assert_called_once_with(
|
||||||
self.fip, 'fake-table', self.bridge)
|
self.fip, 'fake-table')
|
||||||
mock_add_route.assert_called_once_with(
|
mock_add_route.assert_called_once_with(
|
||||||
mock.ANY, self.fip, 'fake-table', self.bridge, vlan=10)
|
mock.ANY, self.fip, 'fake-table', self.bridge, vlan=10)
|
||||||
|
|
||||||
@ -1047,8 +1048,8 @@ class TestOVNBGPDriver(test_base.TestCase):
|
|||||||
mock_add_ip_dev.assert_called_once_with(
|
mock_add_ip_dev.assert_called_once_with(
|
||||||
CONF.bgp_nic, ips)
|
CONF.bgp_nic, ips)
|
||||||
|
|
||||||
expected_calls = [mock.call(self.ipv4, 'fake-table', self.bridge),
|
expected_calls = [mock.call(self.ipv4, 'fake-table'),
|
||||||
mock.call(self.ipv6, 'fake-table', self.bridge)]
|
mock.call(self.ipv6, 'fake-table')]
|
||||||
mock_add_rule.assert_has_calls(expected_calls)
|
mock_add_rule.assert_has_calls(expected_calls)
|
||||||
|
|
||||||
expected_calls = [mock.call(mock.ANY, self.ipv4, 'fake-table',
|
expected_calls = [mock.call(mock.ANY, self.ipv4, 'fake-table',
|
||||||
@ -1112,9 +1113,11 @@ class TestOVNBGPDriver(test_base.TestCase):
|
|||||||
mock_add_ip_dev.assert_called_once_with(
|
mock_add_ip_dev.assert_called_once_with(
|
||||||
CONF.bgp_nic, ips)
|
CONF.bgp_nic, ips)
|
||||||
|
|
||||||
expected_calls = [mock.call(self.ipv4, 'fake-table', self.bridge,
|
expected_calls = [mock.call(self.ipv4, 'fake-table',
|
||||||
|
dev='{}.{}'.format(self.bridge, 10),
|
||||||
lladdr=self.mac),
|
lladdr=self.mac),
|
||||||
mock.call(self.ipv6, 'fake-table', self.bridge,
|
mock.call(self.ipv6, 'fake-table',
|
||||||
|
dev='{}.{}'.format(self.bridge, 10),
|
||||||
lladdr=self.mac)]
|
lladdr=self.mac)]
|
||||||
mock_add_rule.assert_has_calls(expected_calls)
|
mock_add_rule.assert_has_calls(expected_calls)
|
||||||
|
|
||||||
@ -1626,7 +1629,7 @@ class TestOVNBGPDriver(test_base.TestCase):
|
|||||||
'{}/32'.format(self.ipv4), self.lrp0, self.cr_lrp0, 'fake-lrp-dp')
|
'{}/32'.format(self.ipv4), self.lrp0, self.cr_lrp0, 'fake-lrp-dp')
|
||||||
|
|
||||||
mock_add_rule.assert_called_once_with(
|
mock_add_rule.assert_called_once_with(
|
||||||
'{}/32'.format(self.ipv4), 'fake-table', self.bridge)
|
'{}/32'.format(self.ipv4), 'fake-table')
|
||||||
mock_add_route.assert_called_once_with(
|
mock_add_route.assert_called_once_with(
|
||||||
mock.ANY, self.ipv4, 'fake-table', self.bridge, vlan=None,
|
mock.ANY, self.ipv4, 'fake-table', self.bridge, vlan=None,
|
||||||
mask='32', via=self.fip)
|
mask='32', via=self.fip)
|
||||||
@ -1671,7 +1674,7 @@ class TestOVNBGPDriver(test_base.TestCase):
|
|||||||
'{}/32'.format(self.ipv4), self.lrp0, self.cr_lrp0, 'fake-lrp-dp')
|
'{}/32'.format(self.ipv4), self.lrp0, self.cr_lrp0, 'fake-lrp-dp')
|
||||||
|
|
||||||
mock_add_rule.assert_called_once_with(
|
mock_add_rule.assert_called_once_with(
|
||||||
'{}/32'.format(self.ipv4), 'fake-table', self.bridge)
|
'{}/32'.format(self.ipv4), 'fake-table')
|
||||||
mock_add_route.assert_not_called()
|
mock_add_route.assert_not_called()
|
||||||
mock_expose_tenant_port.assert_not_called()
|
mock_expose_tenant_port.assert_not_called()
|
||||||
|
|
||||||
@ -1712,7 +1715,7 @@ class TestOVNBGPDriver(test_base.TestCase):
|
|||||||
'{}/128'.format(self.ipv6), self.lrp0, self.cr_lrp0, 'fake-lrp-dp')
|
'{}/128'.format(self.ipv6), self.lrp0, self.cr_lrp0, 'fake-lrp-dp')
|
||||||
|
|
||||||
mock_add_rule.assert_called_once_with(
|
mock_add_rule.assert_called_once_with(
|
||||||
'{}/128'.format(self.ipv6), 'fake-table', self.bridge)
|
'{}/128'.format(self.ipv6), 'fake-table')
|
||||||
mock_add_route.assert_called_once_with(
|
mock_add_route.assert_called_once_with(
|
||||||
mock.ANY, self.ipv6, 'fake-table', self.bridge, vlan=None,
|
mock.ANY, self.ipv6, 'fake-table', self.bridge, vlan=None,
|
||||||
mask='128', via=self.fip)
|
mask='128', via=self.fip)
|
||||||
|
Loading…
Reference in New Issue
Block a user