diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-01-07 13:53:41 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-01-09 04:55:50 -0800 |
commit | 6733b6afb27f3dd3943d8325d2656f9e98740c17 (patch) | |
tree | 0839216969d5ef75ced3ca7b3574fffaf3388629 /test | |
parent | 78dd33b5a58db3d213e9ef9bf244d20bb063947b (diff) |
test: add global policy test
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'test')
-rw-r--r-- | test/scenario_test/global_policy_test.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/test/scenario_test/global_policy_test.py b/test/scenario_test/global_policy_test.py index a7c95d9a..ec0a5fbe 100644 --- a/test/scenario_test/global_policy_test.py +++ b/test/scenario_test/global_policy_test.py @@ -106,21 +106,31 @@ class GoBGPTestBase(unittest.TestCase): for q in self.quaggas.itervalues(): self.assertTrue(len(self.gobgp.get_adj_rib_out(q)) == 0) - def test_06_change_global_policy(self): + def test_06_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') - self.gobgp.local('gobgp policy statement st0 add action community add 65100:10') + self.gobgp.local('gobgp policy statement st0 add action accept') self.gobgp.local('gobgp policy add p0 st0') - self.gobgp.local('gobgp global policy export add p0 default accept') + self.gobgp.local('gobgp global policy export add p0 default reject') for q in self.quaggas.itervalues(): - self.gobgp.reset(q) + self.gobgp.softreset(q, type='out') - def test_07_neighbor_established(self): + def test_07_check_adj_rib_out(self): for q in self.quaggas.itervalues(): - self.gobgp.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=q) + paths = self.gobgp.get_adj_rib_out(q) + if q == self.quaggas['q1']: + self.assertTrue(len(paths) == 3) + else: + self.assertTrue(len(paths) == 0) + + def test_08_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_08_check_adj_rib_out(self): + def test_09_check_adj_rib_out(self): for q in self.quaggas.itervalues(): paths = self.gobgp.get_adj_rib_out(q) self.assertTrue(len(paths) == 3) |