@@ -69,6 +69,22 @@ def __init__(self, chassis_name):
69
69
super ().__init__ (events , 'Chassis_Private' , conditions , timeout = 15 )
70
70
71
71
72
+ class WaitForPortBindingFIPEvent (event .WaitEvent ):
73
+ event_name = 'WaitForPortBindingFIPEvent'
74
+
75
+ def __init__ (self , fip ):
76
+ events = (self .ROW_UPDATE , )
77
+ self ._fip = fip
78
+ super ().__init__ (events , 'Port_Binding' , {}, timeout = 15 )
79
+
80
+ def match_fn (self , event , row , old = None ):
81
+ try :
82
+ return (row .external_ids [ovn_const .OVN_PORT_FIP_EXT_ID_KEY ] ==
83
+ self ._fip )
84
+ except (AttributeError , KeyError ):
85
+ return False
86
+
87
+
72
88
class DistributedLockTestEvent (event .WaitEvent ):
73
89
ONETIME = False
74
90
COUNTER = 0
@@ -219,10 +235,15 @@ def test_floatingip_mac_bindings(self):
219
235
port = self .create_port ()
220
236
221
237
# Ensure that the MAC_Binding entry gets deleted after creating a FIP
238
+ fip_event = WaitForPortBindingFIPEvent ('100.0.0.21' )
239
+ self .mech_driver .sb_ovn .idl .notify_handler .watch_event (fip_event )
222
240
fip = self ._create_fip (port , '100.0.0.21' )
241
+ self .assertTrue (fip_event .wait ())
242
+ # TODO(ralonsoh): restore the timeout=15 value (or even lower) once
243
+ # the eventlet removal finishes.
223
244
n_utils .wait_until_true (
224
245
lambda : not self ._check_mac_binding_exists (macb_id ),
225
- timeout = 15 , sleep = 1 )
246
+ timeout = 30 , sleep = 1 )
226
247
227
248
# Now that the FIP is created, add a new MAC_Binding entry with the
228
249
# same IP address
@@ -231,9 +252,11 @@ def test_floatingip_mac_bindings(self):
231
252
232
253
# Ensure that the MAC_Binding entry gets deleted after deleting the FIP
233
254
self .l3_plugin .delete_floatingip (self .context , fip ['id' ])
255
+ # TODO(ralonsoh): restore the timeout=15 value (or even lower) once
256
+ # the eventlet removal finishes.
234
257
n_utils .wait_until_true (
235
258
lambda : not self ._check_mac_binding_exists (macb_id ),
236
- timeout = 15 , sleep = 1 )
259
+ timeout = 30 , sleep = 1 )
237
260
238
261
def _test_port_binding_and_status (self , port_id , action , status ):
239
262
# This function binds or unbinds port to chassis and
0 commit comments