summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-11-29 12:02:16 +0000
committerOle Trøan <otroan@employees.org>2018-11-30 13:04:54 +0000
commit774356ad5a5660cad99b6d88e0d84f657a636a55 (patch)
tree862a6aa3f6a626b2439508a2707bb6114e24afdc /test
parent0ae445ea1152e04dc73d2daf63fe0ffe0c5fd4ad (diff)
GBP: UT more robust for endpoint timeout
Change-Id: Ib78c747fa3e304f7158f8182d060e11e4e778400 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'test')
-rw-r--r--test/test_gbp.py33
1 files changed, 17 insertions, 16 deletions
diff --git a/test/test_gbp.py b/test/test_gbp.py
index 4a5969213be..f49ba4c49e1 100644
--- a/test/test_gbp.py
+++ b/test/test_gbp.py
@@ -1424,6 +1424,16 @@ class TestGBP(VppTestCase):
is_inside=0,
is_add=0)
+ def wait_for_ep_timeout(self, sw_if_index=None, ip=None, mac=None,
+ n_tries=100, s_time=1):
+ while (n_tries):
+ if not find_gbp_endpoint(self, sw_if_index, ip, mac):
+ return True
+ n_tries = n_tries - 1
+ self.sleep(s_time)
+ self.assertFalse(find_gbp_endpoint(self, sw_if_index, ip, mac))
+ return False
+
def test_gbp_learn_l2(self):
""" GBP L2 Endpoint Learning """
@@ -1586,10 +1596,9 @@ class TestGBP(VppTestCase):
# If we sleep for the threshold time, the learnt endpoints should
# age out
#
- self.sleep(2)
for l in learnt:
- self.assertFalse(find_gbp_endpoint(self,
- mac=l['mac']))
+ self.wait_for_ep_timeout(vx_tun_l2_1.sw_if_index,
+ mac=l['mac'])
#
# repeat. the do not learn bit is set so the EPs are not learnt
@@ -1660,11 +1669,9 @@ class TestGBP(VppTestCase):
self.assertTrue(rx[VXLAN].gpflags.A)
self.assertFalse(rx[VXLAN].gpflags.D)
- self.sleep(2)
for l in learnt:
- self.assertFalse(find_gbp_endpoint(self,
- vx_tun_l2_1.sw_if_index,
- mac=l['mac']))
+ self.wait_for_ep_timeout(vx_tun_l2_1.sw_if_index,
+ mac=l['mac'])
#
# repeat in the other EPG
@@ -1809,11 +1816,9 @@ class TestGBP(VppTestCase):
#
# clean up
#
- self.sleep(2)
for l in learnt:
- self.assertFalse(find_gbp_endpoint(self,
- vx_tun_l2_1.sw_if_index,
- mac=l['mac']))
+ self.wait_for_ep_timeout(vx_tun_l2_1.sw_if_index,
+ mac=l['mac'])
self.pg2.unconfig_ip4()
self.pg3.unconfig_ip4()
@@ -2161,7 +2166,6 @@ class TestGBP(VppTestCase):
self.assertEqual(inner[IP].src, ep.ip4.address)
self.assertEqual(inner[IP].dst, l['ip'])
- self.sleep(2)
for l in learnt:
self.assertFalse(find_gbp_endpoint(self,
tep1_sw_if_index,
@@ -2236,11 +2240,8 @@ class TestGBP(VppTestCase):
self.assertEqual(inner[IPv6].dst, l['ip6'])
self.logger.info(self.vapi.cli("sh gbp endpoint"))
- self.sleep(2)
for l in learnt:
- self.assertFalse(find_gbp_endpoint(self,
- tep1_sw_if_index,
- ip=l['ip']))
+ self.wait_for_ep_timeout(ip=l['ip'])
#
# Static sends to unknown EP with no route