diff options
author | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2016-11-12 09:01:33 +0000 |
---|---|---|
committer | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2016-11-14 00:58:25 +0000 |
commit | b77dc6aa54d0d2ebe4858ab688a10a44ef4cf773 (patch) | |
tree | b17eabc69fee61dde9d26dca39060970f4033c9c /test/scenario_test/global_policy_test.py | |
parent | b68491f62cff983d360753130aa4ff77ae753602 (diff) |
policy: fix bug of policy with multiple statements
policy can have multiple statements. In each statement, when condition
is matched, route-action is finally evaluated after actions with mods.
When route-action is 'none', we contine to next statement if it exists.
When route-action is 'accept' or 'reject', we stop proceeding.
This patch fixes a bug that route-action can't be set to 'none' which
means route-action always be set to 'accept' or 'reject' and can't proceed
to the next statement.
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'test/scenario_test/global_policy_test.py')
-rw-r--r-- | test/scenario_test/global_policy_test.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/scenario_test/global_policy_test.py b/test/scenario_test/global_policy_test.py index 4c5bbb55..0d1e1ba9 100644 --- a/test/scenario_test/global_policy_test.py +++ b/test/scenario_test/global_policy_test.py @@ -248,6 +248,22 @@ class GoBGPTestBase(unittest.TestCase): num4 = len(self.gobgp.get_adj_rib_out(q1)) self.assertTrue(num1 + 1 == num4) + def test_17_multi_statement(self): + self.gobgp.local('gobgp policy statement st3 add action med set 100') + self.gobgp.local('gobgp policy statement st4 add action local-pref 100') + self.gobgp.local('gobgp policy add p3 st3 st4') + self.gobgp.local('gobgp global policy import set p3 default accept') + + self.gobgp.add_route('10.70.0.0/24') + time.sleep(1) + rib = self.gobgp.get_global_rib('10.70.0.0/24') + self.assertTrue(len(rib) == 1) + self.assertTrue(len(rib[0]['paths']) == 1) + path = rib[0]['paths'][0] + self.assertTrue(path['med'] == 100) + self.assertTrue(path['local-pref'] == 100) + + if __name__ == '__main__': if os.geteuid() is not 0: |