From 2a41b0e152915ceac66e82defb2b6610c925a76f Mon Sep 17 00:00:00 2001 From: Oleg Bondarev Date: Wed, 12 Jan 2022 12:31:21 +0300 Subject: [PATCH] Local IP: skip ports with invalid ofport Some time ago a patch was merged that let's OVS agent to not skip ports with invalid ofport [1]. Thus for Local IP processing we need to explicitly skip such ports. [1] https://review.opendev.org/c/openstack/neutron/+/640258 Partial-Bug: #1930200 Change-Id: I43ba007b4813c02b1cf712252b0925e649fa5813 --- .../drivers/openvswitch/agent/openflow/native/br_int.py | 5 +++++ .../openvswitch/agent/openflow/native/test_br_int.py | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/native/br_int.py b/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/native/br_int.py index 4a2b995b44f..670dc798dfa 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/native/br_int.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/native/br_int.py @@ -462,6 +462,11 @@ class OVSIntegrationBridge(ovs_bridge.OVSAgentBridge, eth_type=0x86DD) def setup_local_egress_flows(self, in_port, vlan): + if in_port == constants.OFPORT_INVALID: + LOG.warning("Invalid ofport: %s, vlan: %s - " + "skipping setup_local_egress_flows", in_port, vlan) + return + # Setting priority to 8 to give advantage to ARP/MAC spoofing rules self.install_goto(table_id=constants.LOCAL_SWITCHING, priority=8, diff --git a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/openflow/native/test_br_int.py b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/openflow/native/test_br_int.py index cef47441501..aee09d9c2cb 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/openflow/native/test_br_int.py +++ b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/openflow/native/test_br_int.py @@ -716,6 +716,13 @@ class OVSIntegrationBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase): ] self.assertEqual(expected, self.mock.mock_calls) + def test_setup_local_egress_flows_ofport_invalid(self): + in_port = constants.OFPORT_INVALID + vlan = 3333 + self.br.setup_local_egress_flows(in_port=in_port, vlan=vlan) + + self.assertFalse(self.mock.called) + def test_install_garp_blocker(self): vlan = 2222 ip = '192.0.0.10'