1313# under the License.
1414import datetime
1515import functools
16+ import subprocess
1617from unittest import mock
1718
1819import fixtures as og_fixtures
2627from oslo_utils import uuidutils
2728from ovsdbapp .backend .ovs_idl import event
2829from ovsdbapp .backend .ovs_idl import idlutils
30+ import tenacity
2931
3032from neutron .common .ovn import constants as ovn_const
3133from neutron .common import utils as n_utils
@@ -144,6 +146,10 @@ def _create_fip(self, port, fip_address):
144146 'port_id' : port ['id' ]}})
145147 return r1_f2
146148
149+ @tenacity .retry (
150+ retry = tenacity .retry_if_exception_type (subprocess .TimeoutExpired ),
151+ wait = tenacity .wait_exponential (multiplier = 0.02 , max = 1 ),
152+ reraise = True )
147153 def _check_mac_binding_exists (self , macb_id ):
148154 cmd = ['ovsdb-client' , 'transact' ,
149155 self .mech_driver .sb_ovn .connection_string ]
@@ -156,8 +162,7 @@ def _check_mac_binding_exists(self, macb_id):
156162 cmd += ['["OVN_Southbound", {"op": "select", "table": "MAC_Binding", '
157163 '"where": [["_uuid", "==", ["uuid", "%s"]]]}]' % macb_id ]
158164
159- out , _ = processutils .execute (* cmd ,
160- log_errors = False )
165+ out , _ = processutils .execute (* cmd , log_errors = False , timeout = 3 )
161166 return str (macb_id ) in out
162167
163168 def test_floatingip_mac_bindings (self ):
0 commit comments