Merge "Local IP: skip ports with invalid ofport"

This commit is contained in:
Zuul 2022-01-27 00:27:54 +00:00 committed by Gerrit Code Review
commit 528a516768
2 changed files with 12 additions and 0 deletions

View File

@ -465,6 +465,11 @@ class OVSIntegrationBridge(ovs_bridge.OVSAgentBridge,
eth_type=0x86DD) eth_type=0x86DD)
def setup_local_egress_flows(self, in_port, vlan): 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 # Setting priority to 8 to give advantage to ARP/MAC spoofing rules
self.install_goto(table_id=constants.LOCAL_SWITCHING, self.install_goto(table_id=constants.LOCAL_SWITCHING,
priority=8, priority=8,

View File

@ -716,6 +716,13 @@ class OVSIntegrationBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase):
] ]
self.assertEqual(expected, self.mock.mock_calls) 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): def test_install_garp_blocker(self):
vlan = 2222 vlan = 2222
ip = '192.0.0.10' ip = '192.0.0.10'