diff options
Diffstat (limited to 'test/scenario_test/ibgp_router_test.py')
-rw-r--r-- | test/scenario_test/ibgp_router_test.py | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/test/scenario_test/ibgp_router_test.py b/test/scenario_test/ibgp_router_test.py index 59815e6e..4b709681 100644 --- a/test/scenario_test/ibgp_router_test.py +++ b/test/scenario_test/ibgp_router_test.py @@ -101,27 +101,27 @@ class GoBGPTestBase(unittest.TestCase): for q in self.quaggas.itervalues(): paths = self.gobgp.get_adj_rib_out(q) # bgp speaker mustn't forward iBGP routes to iBGP peers - self.assertTrue(len(paths) == 0) + self.assertEqual(len(paths), 0) def test_04_originate_path(self): self.gobgp.add_route('10.10.0.0/24') dst = self.gobgp.get_global_rib('10.10.0.0/24') - self.assertTrue(len(dst) == 1) - self.assertTrue(len(dst[0]['paths']) == 1) + self.assertEqual(len(dst), 1) + self.assertEqual(len(dst[0]['paths']), 1) path = dst[0]['paths'][0] - self.assertTrue(path['nexthop'] == '0.0.0.0') - self.assertTrue(len(path['aspath']) == 0) + self.assertEqual(path['nexthop'], '0.0.0.0') + self.assertEqual(len(path['aspath']), 0) def test_05_check_gobgp_adj_rib_out(self): for q in self.quaggas.itervalues(): paths = self.gobgp.get_adj_rib_out(q) - self.assertTrue(len(paths) == len(self.gobgp.routes)) + self.assertEqual(len(paths), len(self.gobgp.routes)) path = paths[0] - self.assertTrue(path['nlri']['prefix'] == '10.10.0.0/24') + self.assertEqual(path['nlri']['prefix'], '10.10.0.0/24') peer_info = self.gobgp.peers[q] local_addr = peer_info['local_addr'].split('/')[0] - self.assertTrue(path['nexthop'] == local_addr) - self.assertTrue(len(path['aspath']) == 0) + self.assertEqual(path['nexthop'], local_addr) + self.assertEqual(len(path['aspath']), 0) # check routes are properly advertised to all BGP speaker def test_06_check_quagga_global_rib(self): @@ -145,13 +145,13 @@ class GoBGPTestBase(unittest.TestCase): self.assertTrue(r in (p['prefix'] for p in global_rib)) for rr in global_rib: if rr['prefix'] == r: - self.assertTrue(rr['nexthop'] == local_addr) + self.assertEqual(rr['nexthop'], local_addr) for r in q.routes.keys(): self.assertTrue(r in (p['prefix'] for p in global_rib)) for rr in global_rib: if rr['prefix'] == r: - self.assertTrue(rr['nexthop'] == '0.0.0.0') + self.assertEqual(rr['nexthop'], '0.0.0.0') done = True if done: @@ -185,8 +185,8 @@ class GoBGPTestBase(unittest.TestCase): for path in paths: peer_info = self.gobgp.peers[q3] local_addr = peer_info['local_addr'].split('/')[0] - self.assertTrue(path['nexthop'] == local_addr) - self.assertTrue(path['aspath'] == [self.gobgp.asn]) + self.assertEqual(path['nexthop'], local_addr) + self.assertEqual(path['aspath'], [self.gobgp.asn]) def test_10_check_gobgp_ibgp_adj_rib_out(self): q1 = self.quaggas['q1'] @@ -196,14 +196,14 @@ class GoBGPTestBase(unittest.TestCase): for prefix in q3.routes.iterkeys(): paths = self.gobgp.get_adj_rib_out(q1, prefix) - self.assertTrue(len(paths) == 1) + self.assertEqual(len(paths), 1) path = paths[0] # bgp router mustn't change nexthop of routes from eBGP peers # which are sent to iBGP peers - self.assertTrue(path['nexthop'] == neigh_addr) + self.assertEqual(path['nexthop'], neigh_addr) # bgp router mustn't change aspath of routes from eBGP peers # which are sent to iBGP peers - self.assertTrue(path['aspath'] == [q3.asn]) + self.assertEqual(path['aspath'], [q3.asn]) # disable ebgp peer, check ebgp routes are removed def test_11_disable_ebgp_peer(self): @@ -214,13 +214,13 @@ class GoBGPTestBase(unittest.TestCase): for route in q3.routes.iterkeys(): dst = self.gobgp.get_global_rib(route) - self.assertTrue(len(dst) == 0) + self.assertEqual(len(dst), 0) for q in self.quaggas.itervalues(): paths = self.gobgp.get_adj_rib_out(q) # only gobgp's locally generated routes must exists print paths - self.assertTrue(len(paths) == len(self.gobgp.routes)) + self.assertEqual(len(paths), len(self.gobgp.routes)) def test_12_disable_ibgp_peer(self): q1 = self.quaggas['q1'] @@ -229,7 +229,7 @@ class GoBGPTestBase(unittest.TestCase): for route in q1.routes.iterkeys(): dst = self.gobgp.get_global_rib(route) - self.assertTrue(len(dst) == 0) + self.assertEqual(len(dst), 0) def test_13_enable_ibgp_peer(self): q1 = self.quaggas['q1'] @@ -240,7 +240,7 @@ class GoBGPTestBase(unittest.TestCase): for q in self.quaggas.itervalues(): paths = self.gobgp.get_adj_rib_out(q) # only gobgp's locally generated routes must exists - self.assertTrue(len(paths) == len(self.gobgp.routes)) + self.assertEqual(len(paths), len(self.gobgp.routes)) def test_15_add_ebgp_peer(self): q4 = QuaggaBGPContainer(name='q4', asn=65001, router_id='192.168.0.5') |