summaryrefslogtreecommitdiffhomepage
path: root/test/lib
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-11-07 19:08:34 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-11-07 19:08:34 -0800
commit0af24ff85d4e30a513a2de4821afdf1873642f45 (patch)
tree4f7eefd181c0854a78011587a03fd9b5556e223a /test/lib
parenta30b3c2126054f448c21adb56361357249665ddf (diff)
test: add change of best paths from ibgp and ebgp
gobgp has two ibgp peers and one ebgp. 1. the best path is from ebgp so advertise it to ibgp peers. 2. one of ibgp peer sends the same path so now the path from ibgp becomes best. 3. gobgp doesn't advertise it to another ibgp and needs to withdraw the best from ebgp. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/base.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/lib/base.py b/test/lib/base.py
index 5f73b45d..d23cc0d7 100644
--- a/test/lib/base.py
+++ b/test/lib/base.py
@@ -47,6 +47,19 @@ BGP_ATTR_TYPE_EXTENDED_COMMUNITIES = 16
env.abort_exception = RuntimeError
output.stderr = False
+def wait_for_completion(f, timeout=120):
+ interval = 1
+ count = 0
+ while True:
+ if f():
+ return
+
+ time.sleep(interval)
+ count += interval
+ if count >= timeout:
+ raise Exception('timeout')
+
+
def try_several_times(f, t=3, s=1):
e = None
for i in range(t):