From 0af24ff85d4e30a513a2de4821afdf1873642f45 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Mon, 7 Nov 2016 19:08:34 -0800 Subject: 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 --- test/lib/base.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/lib') 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): -- cgit v1.2.3