From 51c2907ea2d4ff8498ebe4b9892cffdeeadbc32c Mon Sep 17 00:00:00 2001 From: Katerina Kubecova Date: Fri, 13 Dec 2024 16:16:59 +0100 Subject: [PATCH] filter/test.conf: testing roa subprefixes --- filter/test.conf | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/filter/test.conf b/filter/test.conf index 6ceab152..4478c382 100644 --- a/filter/test.conf +++ b/filter/test.conf @@ -2414,6 +2414,69 @@ prefix pfx; bt_test_suite(t_roa_check, "Testing ROA"); +roa6 table r61; +roa6 table r62; + +protocol static +{ + roa6 { table r61; import filter roa_filter; }; +} + +protocol static +{ + roa6 { table r62; import filter roa_filter; }; + route 2001:0db8::/32 max 35 as 1000; + route 2001:0db8::/32 max 40 as 1001; + route 2001:0db8::/34 max 38 as 1002; + route 2001:0db8::/32 max 35 as 1003; + route 2001:0db8::/36 max 36 as 1004; + route 2001:0db8:c000::/34 max 38 as 1005; +} + +protocol pipe { + export where source ~ [ RTS_STATIC ]; + import all; + table r61; + peer table r62; +} + +function t_roa_subprefix_check() +{ + bt_assert(roa_check(r61, 2001:0db8::/32, 1000) = ROA_VALID); + bt_assert(roa_check(r61, 2001:0db8:c000::/34, 1000) = ROA_VALID); + bt_assert(roa_check(r61, 2001:0db8::/35, 1000) = ROA_VALID); + bt_assert(roa_check(r61, 2001:0db8::/38, 1000) != ROA_VALID); + bt_assert(roa_check(r61, 2001:0db8::/50, 1000) != ROA_VALID); + + bt_assert(roa_check(r61, 2001:0db8::/32, 1001) = ROA_VALID); + bt_assert(roa_check(r61, 2001:0db8::/38, 1001) = ROA_VALID); + bt_assert(roa_check(r61, 2001:0db8::/40, 1001) = ROA_VALID); + bt_assert(roa_check(r61, 2001:0db8::/42, 1001) != ROA_VALID); + + bt_assert(roa_check(r61, 2001:0db8::/32, 1002) != ROA_VALID); + bt_assert(roa_check(r61, 2001:0db8::/34, 1002) = ROA_VALID); + bt_assert(roa_check(r61, 2001:0db8::/38, 1002) = ROA_VALID); + bt_assert(roa_check(r61, 2001:0db8::/40, 1002) != ROA_VALID); + + bt_assert(roa_check(r61, 2001:0db8::/32, 1003) = ROA_VALID); + bt_assert(roa_check(r61, 2001:0db8::/34, 1003) = ROA_VALID); + bt_assert(roa_check(r61, 2001:0db8::/38, 1003) != ROA_VALID); + bt_assert(roa_check(r61, 2001:0db8::/40, 1003) != ROA_VALID); + + bt_assert(roa_check(r61, 2001:0db8::/32, 1004) != ROA_VALID); + bt_assert(roa_check(r61, 2001:0db8::/36, 1004) = ROA_VALID); + bt_assert(roa_check(r61, 2001:0db8::/38, 1004) != ROA_VALID); + bt_assert(roa_check(r61, 2001:0db8::/40, 1004) != ROA_VALID); + + bt_assert(roa_check(r61, 2001:0db8::/32, 1005) != ROA_VALID); + bt_assert(roa_check(r61, 2001:0db8:c000::/34, 1005) = ROA_VALID); + bt_assert(roa_check(r61, 2001:0db8:c000::/38, 1005) = ROA_VALID); + bt_assert(roa_check(r61, 2001:0db8:c000::/40, 1005) != ROA_VALID); +} + +bt_test_suite(t_roa_subprefix_check, "Testing ROA subprefixes"); + + aspa table at; protocol static