summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSatoshi Fujimoto <satoshi.fujimoto7@gmail.com>2017-05-09 16:09:56 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-05-12 09:48:01 +0900
commite82d26b1b54e45061966c29be666da8dd7cd6577 (patch)
tree12a43debe7629a4e0be080273c601f48acd371af
parent2bcb040dcb7cbac322d23c1848398ad0314de8dd (diff)
test_table_manager: Add unit tests for L2VPN 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.py87
1 files changed, 87 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 ce27d6e5..c9c9f55e 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
@@ -848,3 +848,90 @@ class Test_TableCoreManager(unittest.TestCase):
prefix=prefix,
is_withdraw=False,
)
+
+ def test_update_flowspec_vrf_table_l2vpn(self):
+ flowspec_family = 'l2vpnfs'
+ route_family = 'l2vpnfs'
+ route_dist = '65001:100'
+ rules = {
+ 'dst_mac': '12:34:56:78:9a:bc',
+ }
+ actions = {
+ 'traffic_rate': {
+ 'as_number': 0,
+ 'rate_info': 100.0,
+ },
+ }
+ prefix = 'l2vpnfs(dst_mac:12:34:56:78:9a:bc)'
+
+ 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_l2vpn_without_actions(self):
+ flowspec_family = 'l2vpnfs'
+ route_family = 'l2vpnfs'
+ route_dist = '65001:100'
+ rules = {
+ 'dst_mac': '12:34:56:78:9a:bc',
+ }
+ prefix = 'l2vpnfs(dst_mac:12:34:56:78:9a:bc)'
+
+ 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_l2vpn_invalid_actions(self):
+ flowspec_family = 'l2vpnfs'
+ route_family = 'l2vpnfs'
+ route_dist = '65001:100'
+ rules = {
+ 'dst_mac': '12:34:56:78:9a:bc',
+ }
+ actions = {
+ 'invalid_actions': {
+ 'invalid_param': 10,
+ },
+ }
+ prefix = 'l2vpnfs(dst_mac:12:34:56:78:9a:bc)'
+
+ 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_l2vpn_invalid_route_family(self):
+ flowspec_family = 'l2vpnfs'
+ route_family = 'invalid'
+ route_dist = '65001:100'
+ rules = {
+ 'dst_mac': '12:34:56:78:9a:bc',
+ }
+ prefix = 'l2vpnfs(dst_mac:12:34:56:78:9a:bc)'
+
+ 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,
+ )