Skip to content

Commit 4fa5543

Browse files
ralonsohkarelyatin
authored andcommitted
[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 <[email protected]> Change-Id: I68a8c972ed88e4c62dc4de59fe3904cb85278b1c (cherry picked from commit 40692e9)
1 parent d0349fe commit 4fa5543

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

neutron/tests/functional/services/trunk/drivers/ovn/test_trunk_driver.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,21 @@
2727

2828

2929
class WaitForPortBindingDeleteEvent(event.WaitEvent):
30-
event_name = 'WaitForPortBindingDeleteEvent'
31-
3230
def __init__(self, port_id):
3331
table = 'Port_Binding'
3432
events = (self.ROW_DELETE, )
3533
conditions = (('logical_port', '=', port_id), )
3634
super().__init__(events, table, conditions, timeout=10)
3735

3836

37+
class WaitForPortBindingCreateEvent(event.WaitEvent):
38+
def __init__(self, port_id):
39+
table = 'Port_Binding'
40+
events = (self.ROW_CREATE, )
41+
conditions = (('logical_port', '=', port_id), )
42+
super().__init__(events, table, conditions, timeout=10)
43+
44+
3945
class WaitForLSPSubportEvent(event.WaitEvent):
4046
event_name = 'WaitForLSPSubportEvent'
4147

@@ -148,18 +154,23 @@ def test_subport_delete(self):
148154
lsp_subport = WaitForLSPSubportEvent(subport['port_id'])
149155
self.mech_driver.nb_ovn.idl.notify_handler.watch_event(
150156
lsp_subport)
157+
pb_create = WaitForPortBindingCreateEvent(subport['port_id'])
158+
self.mech_driver.sb_ovn.idl.notify_handler.watch_event(
159+
pb_create)
151160
with self.trunk([subport]) as trunk:
152161
# Wait for the subport LSP to be assigned as a subport.
153162
self.assertTrue(lsp_subport.wait())
154-
pb_event = WaitForPortBindingDeleteEvent(subport['port_id'])
163+
self.assertTrue(pb_create.wait())
164+
165+
pb_delete = WaitForPortBindingDeleteEvent(subport['port_id'])
155166
self.mech_driver.sb_ovn.idl.notify_handler.watch_event(
156-
pb_event)
167+
pb_delete)
157168
self.trunk_plugin.remove_subports(self.context, trunk['id'],
158169
{'sub_ports': [subport]})
159170
new_trunk = self.trunk_plugin.get_trunk(self.context,
160171
trunk['id'])
161172
# Wait for the subport LSP to be unbound.
162-
self.assertTrue(pb_event.wait())
173+
self.assertTrue(pb_delete.wait())
163174
self._verify_trunk_info(new_trunk, has_items=False)
164175

165176
def test_trunk_delete(self):

0 commit comments

Comments
 (0)