[OVN][FT] Check the subport Port_Binding is created before deletion

When a trunk subport is created and assigned to a trunk, a
"Port_Binding" register is created. If the subport is then deleted from
the trunk, this "Port_Binding" register is deleted. This patch, before
removing the subport from the trunk, adds a check for this
"Port_Binding" register creation.

Closes-Bug: #2117405
Signed-off-by: Rodolfo Alonso Hernandez <ralonsoh@redhat.com>
Change-Id: I68a8c972ed88e4c62dc4de59fe3904cb85278b1c
(cherry picked from commit 40692e922a)
This commit is contained in:
Rodolfo Alonso Hernandez
2025-09-09 10:30:27 +00:00
committed by Yatin Karel
parent a845b98a6d
commit 41b9dfa5d1

View File

@@ -27,8 +27,6 @@ from neutron.tests.functional import base
class WaitForPortBindingDeleteEvent(event.WaitEvent):
event_name = 'WaitForPortBindingDeleteEvent'
def __init__(self, port_id):
table = 'Port_Binding'
events = (self.ROW_DELETE, )
@@ -36,6 +34,14 @@ class WaitForPortBindingDeleteEvent(event.WaitEvent):
super().__init__(events, table, conditions, timeout=10)
class WaitForPortBindingCreateEvent(event.WaitEvent):
def __init__(self, port_id):
table = 'Port_Binding'
events = (self.ROW_CREATE, )
conditions = (('logical_port', '=', port_id), )
super().__init__(events, table, conditions, timeout=10)
class WaitForLSPSubportEvent(event.WaitEvent):
event_name = 'WaitForLSPSubportEvent'
@@ -148,18 +154,23 @@ class TestOVNTrunkDriver(base.TestOVNFunctionalBase):
lsp_subport = WaitForLSPSubportEvent(subport['port_id'])
self.mech_driver.nb_ovn.idl.notify_handler.watch_event(
lsp_subport)
pb_create = WaitForPortBindingCreateEvent(subport['port_id'])
self.mech_driver.sb_ovn.idl.notify_handler.watch_event(
pb_create)
with self.trunk([subport]) as trunk:
# Wait for the subport LSP to be assigned as a subport.
self.assertTrue(lsp_subport.wait())
pb_event = WaitForPortBindingDeleteEvent(subport['port_id'])
self.assertTrue(pb_create.wait())
pb_delete = WaitForPortBindingDeleteEvent(subport['port_id'])
self.mech_driver.sb_ovn.idl.notify_handler.watch_event(
pb_event)
pb_delete)
self.trunk_plugin.remove_subports(self.context, trunk['id'],
{'sub_ports': [subport]})
new_trunk = self.trunk_plugin.get_trunk(self.context,
trunk['id'])
# Wait for the subport LSP to be unbound.
self.assertTrue(pb_event.wait())
self.assertTrue(pb_delete.wait())
self._verify_trunk_info(new_trunk, has_items=False)
def test_trunk_delete(self):