summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-01-29 22:48:58 +0900
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-01-29 23:34:35 +0900
commit2419b8add20024c3c90210a36cf208a8ef467a10 (patch)
tree34a911a92a9d4142235326b797ee2b29454c8423 /test
parent866edbb8d60a4545e859427598bc376937d9f670 (diff)
test: reinforce global_policy_test.py
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'test')
-rw-r--r--test/scenario_test/global_policy_test.py29
1 files changed, 23 insertions, 6 deletions
diff --git a/test/scenario_test/global_policy_test.py b/test/scenario_test/global_policy_test.py
index ec0a5fbe..2cad385d 100644
--- a/test/scenario_test/global_policy_test.py
+++ b/test/scenario_test/global_policy_test.py
@@ -106,7 +106,21 @@ class GoBGPTestBase(unittest.TestCase):
for q in self.quaggas.itervalues():
self.assertTrue(len(self.gobgp.get_adj_rib_out(q)) == 0)
- def test_06_adv_to_one_peer(self):
+ def test_06_disable_peer2(self):
+ q3 = self.quaggas['q3']
+ # advertise a route which was also advertised by q1
+ # this route will be best for g1 because q3's router-id is larger
+ # than q1
+ q3.add_route('10.0.1.0/24')
+ time.sleep(3)
+ # then disable q3
+ self.gobgp.disable_peer(q3)
+ self.gobgp.wait_for(expected_state=BGP_FSM_IDLE, peer=q3)
+
+ for q in self.quaggas.itervalues():
+ self.assertTrue(len(self.gobgp.get_adj_rib_out(q)) == 0)
+
+ def test_07_adv_to_one_peer(self):
self.gobgp.local('gobgp policy neighbor add ns0 {0}'.format(self.gobgp.peers[self.quaggas['q1']]['neigh_addr'].split('/')[0]))
self.gobgp.local('gobgp policy statement add st0')
self.gobgp.local('gobgp policy statement st0 add condition neighbor ns0')
@@ -116,24 +130,27 @@ class GoBGPTestBase(unittest.TestCase):
for q in self.quaggas.itervalues():
self.gobgp.softreset(q, type='out')
- def test_07_check_adj_rib_out(self):
+ def test_08_check_adj_rib_out(self):
for q in self.quaggas.itervalues():
paths = self.gobgp.get_adj_rib_out(q)
if q == self.quaggas['q1']:
- self.assertTrue(len(paths) == 3)
+ self.assertTrue(len(paths) == 2)
else:
self.assertTrue(len(paths) == 0)
- def test_08_change_global_policy(self):
+ def test_09_change_global_policy(self):
self.gobgp.local('gobgp policy statement st0 add action community add 65100:10')
self.gobgp.local('gobgp global policy export set p0 default accept')
for q in self.quaggas.itervalues():
self.gobgp.softreset(q, type='out')
- def test_09_check_adj_rib_out(self):
+ def test_10_check_adj_rib_out(self):
for q in self.quaggas.itervalues():
paths = self.gobgp.get_adj_rib_out(q)
- self.assertTrue(len(paths) == 3)
+ if q != self.quaggas['q3']:
+ self.assertTrue(len(paths) == 2)
+ else:
+ self.assertTrue(len(paths) == 0)
for path in paths:
if q == self.quaggas['q1']:
self.assertTrue(community_exists(path, '65100:10'))