summaryrefslogtreecommitdiffhomepage
path: root/test/lib/gobgp.py
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-04-03 10:10:07 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-04-05 22:15:19 +0900
commita5b81ba381af74d872fb9fea0a4581262241aaae (patch)
treed5b54c57728f51a697e11bf1fd320777209753d2 /test/lib/gobgp.py
parentf94eb1fe9230f614a8fa8f5a40329cc43bdd173f (diff)
server: add missing broadcastBests when dropping peer's routes
fix regression introduced by e6682c52ba3e09c4111bc94c938909cdcacd7d72 also add a test to check the behavior. Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'test/lib/gobgp.py')
-rw-r--r--test/lib/gobgp.py29
1 files changed, 27 insertions, 2 deletions
diff --git a/test/lib/gobgp.py b/test/lib/gobgp.py
index 774113e0..b8413f40 100644
--- a/test/lib/gobgp.py
+++ b/test/lib/gobgp.py
@@ -17,6 +17,8 @@ from base import *
import json
import toml
from itertools import chain
+from threading import Thread
+import socket
def extract_path_attribute(path, typ):
for a in path['attrs']:
@@ -52,7 +54,7 @@ class GoBGPContainer(BGPContainer):
local(cmd, capture=True)
cmd = "chmod 755 {0}/start.sh".format(self.config_dir)
local(cmd, capture=True)
- self.local("{0}/start.sh".format(self.SHARED_VOLUME), flag='-d')
+ self.local("{0}/start.sh".format(self.SHARED_VOLUME), detach=True)
def graceful_restart(self):
self.local("pkill -INT gobgpd")
@@ -61,7 +63,7 @@ class GoBGPContainer(BGPContainer):
cmd = 'cp {0}/zebra.conf {1}/'.format(self.SHARED_VOLUME, self.QUAGGA_VOLUME)
self.local(cmd)
cmd = '/usr/lib/quagga/zebra -f {0}/zebra.conf'.format(self.QUAGGA_VOLUME)
- self.local(cmd, flag='-d')
+ self.local(cmd, detach=True)
def run(self):
super(GoBGPContainer, self).run()
@@ -125,6 +127,29 @@ class GoBGPContainer(BGPContainer):
p["aspath"] = self._get_as_path(p)
return ret
+ def monitor_global_rib(self, queue, rf='ipv4'):
+ def monitor():
+ it = self.local('gobgp -j monitor global rib -a {0}'.format(rf), stream=True)
+ buf = ''
+ try:
+ for line in it:
+ if line == '\n':
+ p = json.loads(buf)[0]
+ p["nexthop"] = self._get_nexthop(p)
+ p["aspath"] = self._get_as_path(p)
+ queue.put(p)
+ buf = ''
+ else:
+ buf += line
+ except socket.timeout:
+ #self.local('pkill -x gobgp')
+ queue.put('timeout')
+ return
+
+ t = Thread(target=monitor)
+ t.daemon = True
+ t.start()
+
def _get_adj_rib(self, adj_type, peer, prefix='', rf='ipv4'):
if peer not in self.peers:
raise Exception('not found peer {0}'.format(peer.router_id))