diff options
author | Satoshi Fujimoto <satoshi.fujimoto7@gmail.com> | 2017-05-09 16:09:47 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-05-12 09:46:48 +0900 |
commit | f8654b67c7a959a43199a7d4ac5ffdbb72619e6c (patch) | |
tree | 3edc296b338e33c56b17172b684fb691048cb9ba | |
parent | c53605385ef3be4fbf0e3adaad9c5d123a42faac (diff) |
test_table_manager: Add unit tests for IPv6 Flow Spec
Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/tests/unit/services/protocols/bgp/core_managers/test_table_manager.py | 165 |
1 files changed, 165 insertions, 0 deletions
diff --git a/ryu/tests/unit/services/protocols/bgp/core_managers/test_table_manager.py b/ryu/tests/unit/services/protocols/bgp/core_managers/test_table_manager.py index 86ba818e..ce27d6e5 100644 --- a/ryu/tests/unit/services/protocols/bgp/core_managers/test_table_manager.py +++ b/ryu/tests/unit/services/protocols/bgp/core_managers/test_table_manager.py @@ -683,3 +683,168 @@ class Test_TableCoreManager(unittest.TestCase): is_withdraw=False, actions=actions, ) + + def test_update_flowspec_global_table_ipv6(self): + flowspec_family = 'ipv6fs' + rules = { + 'dst_prefix': '2001::3/128/32', + } + actions = { + 'traffic_rate': { + 'as_number': 0, + 'rate_info': 100.0, + }, + } + prefix = 'ipv6fs(dst_prefix:2001::3/128/32)' + + self._test_update_flowspec_global_table( + flowspec_family=flowspec_family, + rules=rules, + prefix=prefix, + is_withdraw=False, + actions=actions, + ) + + def test_update_flowspec_global_table_ipv6_without_actions(self): + flowspec_family = 'ipv6fs' + rules = { + 'dst_prefix': '2001::3/128/32', + } + prefix = 'ipv6fs(dst_prefix:2001::3/128/32)' + + self._test_update_flowspec_global_table( + flowspec_family=flowspec_family, + rules=rules, + prefix=prefix, + is_withdraw=False, + ) + + @raises(BgpCoreError) + def test_update_flowspec_global_table_ipv6_invalid_actions(self): + flowspec_family = 'ipv6fs' + rules = { + 'dst_prefix': '2001::3/128/32', + } + actions = { + 'invalid_actions': { + 'invalid_param': 10, + }, + } + prefix = 'ipv4fs(dst_prefix:2001::3/128/32)' + + self._test_update_flowspec_global_table( + flowspec_family=flowspec_family, + rules=rules, + prefix=prefix, + is_withdraw=False, + actions=actions, + ) + + @raises(BgpCoreError) + def test_update_flowspec_global_table_ipv6_invalid_flowspec_family(self): + flowspec_family = 'invalid' + rules = { + 'dst_prefix': '2001::3/128/32', + } + actions = { + 'traffic_rate': { + 'as_number': 0, + 'rate_info': 100.0, + }, + } + prefix = 'ipv4fs(dst_prefix:2001::3/128/32)' + + self._test_update_flowspec_global_table( + flowspec_family=flowspec_family, + rules=rules, + prefix=prefix, + is_withdraw=False, + actions=actions, + ) + + def test_update_flowspec_vrf_table_vpnv6(self): + flowspec_family = 'vpnv6fs' + route_family = 'ipv6fs' + route_dist = '65001:100' + rules = { + 'dst_prefix': '2001::3/128/32', + } + actions = { + 'traffic_rate': { + 'as_number': 0, + 'rate_info': 100.0, + }, + } + prefix = 'ipv6fs(dst_prefix:2001::3/128/32)' + + self._test_update_flowspec_vrf_table( + flowspec_family=flowspec_family, + route_family=route_family, + route_dist=route_dist, + rules=rules, + prefix=prefix, + is_withdraw=False, + actions=actions, + ) + + def test_update_flowspec_vrf_table_vpnv6_without_actions(self): + flowspec_family = 'vpnv6fs' + route_family = 'ipv6fs' + route_dist = '65001:100' + rules = { + 'dst_prefix': '2001::3/128/32', + } + prefix = 'ipv6fs(dst_prefix:2001::3/128/32)' + + self._test_update_flowspec_vrf_table( + flowspec_family=flowspec_family, + route_family=route_family, + route_dist=route_dist, + rules=rules, + prefix=prefix, + is_withdraw=False, + ) + + @raises(BgpCoreError) + def test_update_flowspec_vrf_table_vpnv6_invalid_actions(self): + flowspec_family = 'vpnv6fs' + route_family = 'ipv6fs' + route_dist = '65001:100' + rules = { + 'dst_prefix': '2001::3/128/32', + } + actions = { + 'invalid_actions': { + 'invalid_param': 10, + }, + } + prefix = 'ipv6fs(dst_prefix:2001::3/128/32)' + + self._test_update_flowspec_vrf_table( + flowspec_family=flowspec_family, + route_family=route_family, + route_dist=route_dist, + rules=rules, + prefix=prefix, + is_withdraw=False, + actions=actions, + ) + + @raises(BgpCoreError) + def test_update_flowspec_vrf_table_vpnv6_invalid_route_family(self): + flowspec_family = 'vpnv6fs' + route_family = 'invalid' + route_dist = '65001:100' + rules = { + 'dst_prefix': '2001::3/128/32', + } + prefix = 'ipv4fs(dst_prefix:2001::3/128/32)' + + self._test_update_flowspec_vrf_table( + flowspec_family=flowspec_family, + route_family=route_family, + route_dist=route_dist, + rules=rules, + prefix=prefix, + is_withdraw=False, + ) |