Merge "Remove flows for ARP reply MAC change"

This commit is contained in:
Zuul 2021-02-11 13:25:37 +00:00 committed by Gerrit Code Review
commit 26337b9278
3 changed files with 30 additions and 2 deletions

View File

@ -24,6 +24,16 @@ from neutron.plugins.ml2.drivers.openvswitch.agent.common import constants
class OVSDVRInterfaceMixin(object):
def delete_arp_destination_change(self, target_mac_address,
orig_mac_address):
(_dp, _ofp, ofpp) = self._get_dp()
match = ofpp.OFPMatch(eth_dst=orig_mac_address,
eth_type=ether_types.ETH_TYPE_ARP,
arp_tha=target_mac_address,
arp_op=arp.ARP_REPLY)
self.uninstall_flows(table_id=constants.LOCAL_SWITCHING,
match=match)
def change_arp_destination_mac(self, target_mac_address,
orig_mac_address):
"""Change destination MAC from dvr_host_mac to internal gateway MAC.

View File

@ -742,6 +742,13 @@ class OVSDVRNeutronAgent(object):
self.firewall.delete_accepted_egress_direct_flow(
subnet_info['gateway_mac'], lvm.vlan)
if (ip_version == n_const.IP_VERSION_4 and
subnet_info.get('gateway_mac')):
# remove ARP reply destination MAC address change flow
self.int_br.delete_arp_destination_change(
target_mac_address=subnet_info['gateway_mac'],
orig_mac_address=self.dvr_mac_address)
if lvm.network_type in constants.DVR_PHYSICAL_NETWORK_TYPES:
br = self.phys_brs[physical_network]
if lvm.network_type in constants.TUNNEL_NETWORK_TYPES:

View File

@ -3501,6 +3501,7 @@ class TestOvsDvrNeutronAgent(object):
phys_br = mock.create_autospec(self.br_phys_cls('br-phys'))
int_br.set_db_attribute.return_value = True
int_br.db_get_val.return_value = {}
int_br.delete_arp_destination_change = mock.Mock()
with mock.patch.object(self.agent.dvr_agent.plugin_rpc,
'get_subnet_for_dvr',
return_value={'gateway_ip': gateway_ip,
@ -3546,8 +3547,12 @@ class TestOvsDvrNeutronAgent(object):
phys_br.reset_mock()
ports_to_unbind = {}
expected_br_int_mock_calls_gateway_port = 2
expected_br_int_mock_calls_nongateway_port = 1
if ip_version == n_const.IP_VERSION_4:
expected_br_int_mock_calls_gateway_port = 3
expected_br_int_mock_calls_nongateway_port = 2
else:
expected_br_int_mock_calls_gateway_port = 2
expected_br_int_mock_calls_nongateway_port = 1
if port_type == 'gateway':
ports_to_unbind = {
self._port: expected_br_int_mock_calls_gateway_port
@ -3576,6 +3581,12 @@ class TestOvsDvrNeutronAgent(object):
vlan_tag=lvid,
gateway_ip=gateway_ip),
]
host_mac = self.agent.dvr_agent.dvr_mac_address
expected_on_int_br += [
mock.call.delete_arp_destination_change(
target_mac_address=gateway_mac,
orig_mac_address=host_mac)
]
else:
expected_on_tun_br = [
mock.call.delete_dvr_process_ipv6(