Add retry on Conflict for manual speaker bind
Dynamic routing agent supports only 1 speaker per agent now.
Running tests concurrently may fail with "agent is already
associated to a BGP speaker."
Retry for test with manual agent assignment.
Related-PRODX: PRODX-54807
Change-Id: I2b1569bc2a951153b933a4ee01332bad9547b8cc
diff --git a/neutron_tempest_plugin/neutron_dynamic_routing/scenario/ipv4/test_ipv4.py b/neutron_tempest_plugin/neutron_dynamic_routing/scenario/ipv4/test_ipv4.py
index 5a9deae..a488014 100644
--- a/neutron_tempest_plugin/neutron_dynamic_routing/scenario/ipv4/test_ipv4.py
+++ b/neutron_tempest_plugin/neutron_dynamic_routing/scenario/ipv4/test_ipv4.py
@@ -17,6 +17,8 @@
from tempest.common import utils
from tempest import config
from tempest.lib import decorators
+from tempest.lib import exceptions
+import tenacity
from neutron_tempest_plugin.neutron_dynamic_routing import frr
from neutron_tempest_plugin.neutron_dynamic_routing.frr import constants
@@ -137,6 +139,14 @@
cls.tnet_gen = cls.get_subnet(start='10.10.1.0', end='10.10.255.0',
step=256)
+ @tenacity.retry(
+ stop=tenacity.stop_after_attempt(10),
+ wait=tenacity.wait_fixed(2),
+ retry=tenacity.retry_if_exception_type(exceptions.Conflict),
+ reraise=True)
+ def _add_bgp_speaker_to_agent(self, agent_id, speaker_id):
+ self.bgp_client.add_bgp_speaker_to_dragent(agent_id, speaker_id)
+
@decorators.attr(type='smoke')
@decorators.idempotent_id('7f2acbc2-ff88-4a63-aa02-a2f9feb3f5b0')
def test_check_neighbor_established(self):
@@ -262,9 +272,7 @@
agent_id = agent_list[0]['id']
self.bgp_client.remove_bgp_speaker_from_dragent(agent_id, speaker_id)
self.r_ass[0].bgp_check_neighbor_absent('dnr')
- self.bgp_client.add_bgp_speaker_to_dragent(
- agent_id, speaker_id, ignore_errors=True
- )
+ self._add_bgp_speaker_to_agent(agent_id, speaker_id)
self.r_ass[0].bgp_check_neighbor_state(
'dnr', constants.BGP_FSM_ESTABLISHED
)