summaryrefslogtreecommitdiffhomepage
path: root/test/scenario_test/gobgp_test.py
diff options
context:
space:
mode:
authorHiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>2015-04-10 15:22:12 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-04-14 08:10:28 +0900
commit9ce5445ce939db263740220d90bb6429872d71de (patch)
treee4555b7b78f2dfa31e868a602d3d09186e0194fe /test/scenario_test/gobgp_test.py
parentc9ddb33e456e1994e6ec389978362f000c0d9685 (diff)
scenario_test: bgp_router_test retry checking rib
Diffstat (limited to 'test/scenario_test/gobgp_test.py')
-rw-r--r--test/scenario_test/gobgp_test.py28
1 files changed, 26 insertions, 2 deletions
diff --git a/test/scenario_test/gobgp_test.py b/test/scenario_test/gobgp_test.py
index c98a4236..2e998178 100644
--- a/test/scenario_test/gobgp_test.py
+++ b/test/scenario_test/gobgp_test.py
@@ -308,15 +308,19 @@ class GoBGPTestBase(unittest.TestCase):
return True
- def compare_route_with_quagga_configs(self, address, quagga_rib):
+ def compare_route_with_quagga_configs(self, address, quagga_rib, route_server=True):
for quagga_config in self.quagga_configs:
for destination in quagga_config.destinations.itervalues():
for path in destination.paths:
network = path.network.split("/")[0]
- nexthop = path.nexthop
if quagga_config.peer_ip == address:
nexthop = "0.0.0.0"
+ else:
+ if route_server:
+ nexthop = path.nexthop
+ else:
+ nexthop = self.gobgp_ip
found = False
for quagga_path in quagga_rib:
@@ -327,3 +331,23 @@ class GoBGPTestBase(unittest.TestCase):
return False
return True
+
+ def compare_global_rib_with_quagga_configs(self, rib):
+ for quagga_config in self.quagga_configs:
+ peer_ip = quagga_config.peer_ip
+ for d in quagga_config.destinations.itervalues():
+ for p in d.paths:
+ print "check of %s's route %s existence in gobgp global rib" % (
+ peer_ip, p.network)
+ exist = False
+ for dst in rib:
+ for path in dst['paths']:
+ if path['network'] == p.network:
+ exist = True
+ if exist:
+ is_nexthop_same = path['nexthop'] == p.nexthop
+ if not is_nexthop_same:
+ return False
+ if not exist:
+ return False
+ return True