Merge "Discard port with ofport -1 in _get_ofport_moves"

This commit is contained in:
Zuul 2023-01-09 06:33:29 +00:00 committed by Gerrit Code Review
commit 1374b01cfb
2 changed files with 13 additions and 0 deletions

View File

@ -1683,6 +1683,11 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
if name not in current:
continue
current_ofport = current[name]
# NOTE(amorin) Discarding port that disappeared from ovs
# This will avoid moving that port to skipped_devices
# and forget about deleting it. See #lp-1992109
if current_ofport == ovs_lib.INVALID_OFPORT:
continue
if ofport != current_ofport:
port_moves.append(name)
return port_moves

View File

@ -2512,6 +2512,14 @@ class TestOvsNeutronAgent(object):
self.assertEqual(expected,
self.agent._get_ofport_moves(current, previous))
def test__get_ofport_moves_invalid(self):
previous = {'port1': 1, 'port2': 2}
current = {'port1': -1, 'port2': 2}
# we expect it to tell nothing
expected = []
self.assertEqual(expected,
self.agent._get_ofport_moves(current, previous))
def test_update_stale_ofport_rules_clears_old(self):
self.agent.prevent_arp_spoofing = True
self.agent.vifname_to_ofport_map = {'port1': 1, 'port2': 2}