mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-08 12:18:42 +00:00
filter/test.conf: tests for net_addr
This commit is contained in:
parent
21213be523
commit
2f35cb9093
@ -506,6 +506,9 @@ prefix px;
|
||||
|
||||
bt_assert(1.2.3.4 ~ 1.0.0.0/8);
|
||||
bt_assert(1.0.0.0/8 ~ 1.0.0.0/8);
|
||||
|
||||
bt_assert(px.len = 18);
|
||||
bt_assert(px.ip = 1.2.0.0);
|
||||
}
|
||||
|
||||
bt_test_suite(t_prefix, "Testing prefixes");
|
||||
@ -642,6 +645,8 @@ function t_prefix6()
|
||||
bt_assert(1020:3040:5060::/48 ~ 1020:3040::/32);
|
||||
bt_assert(1020:3040::/31 !~ 1020:3040::/32);
|
||||
bt_assert(1020:3041::/33 !~ 1020:3040::/32);
|
||||
bt_assert(px.len = 18);
|
||||
bt_assert(px.ip = 1020::);
|
||||
}
|
||||
|
||||
bt_test_suite(t_prefix6, "Testing prefix IPv6");
|
||||
@ -716,8 +721,43 @@ bt_test_suite(t_prefix6_set, "Testing prefix IPv6 sets");
|
||||
|
||||
|
||||
|
||||
function t_net_vpn()
|
||||
{
|
||||
prefix p;
|
||||
p = 100:200 10.0.1.0/24;
|
||||
bt_assert(p.type = NET_VPN4);
|
||||
bt_assert(p.len = 24);
|
||||
bt_assert(p.ip = 10.0.1.0);
|
||||
bt_assert(p.rd = 100:200);
|
||||
bt_assert(format(p) = "100:200 10.0.1.0/24");
|
||||
|
||||
function t_flowspec()
|
||||
prefix q;
|
||||
q = 1012:2024 fe80:386c::/32;
|
||||
bt_assert(q.type = NET_VPN6);
|
||||
bt_assert(q.len = 32);
|
||||
bt_assert(q.ip = fe80:386c::);
|
||||
bt_assert(q.rd = 1012:2024);
|
||||
bt_assert(format(q) = "1012:2024 fe80:386c::/32");
|
||||
}
|
||||
|
||||
bt_test_suite(t_net_vpn, "Testing vpn networks");
|
||||
|
||||
function t_net_saddr()
|
||||
{
|
||||
prefix p;
|
||||
p = fe80:386c::/32 from 2001:db8:1:13::/64;
|
||||
bt_assert(p.type = NET_IP6_SADR);
|
||||
bt_assert(p.len = 32);
|
||||
bt_assert(p.ip = fe80:386c::);
|
||||
bt_assert(format(p) = "fe80:386c::/32 from 2001:db8:1:13::/64");
|
||||
bt_assert(p.src = 2001:db8:1:13::/64);
|
||||
bt_assert(p.dst = fe80:386c::/32);
|
||||
}
|
||||
|
||||
bt_test_suite(t_net_saddr, "Testing saddr networks");
|
||||
|
||||
|
||||
function t_net_flowspec()
|
||||
prefix p;
|
||||
{
|
||||
p = flow4 { dst 10.0.0.0/8; };
|
||||
@ -737,9 +777,22 @@ prefix p;
|
||||
bt_assert(format(flow6 { fragment is_fragment || !first_fragment; }) = "flow6 { fragment is_fragment || !first_fragment; }");
|
||||
bt_assert(format(flow6 { label 1000..2000; }) = "flow6 { label 1000..2000; }");
|
||||
bt_assert(format(flow6 { }) = "flow6 { }");
|
||||
|
||||
bt_assert(p.type = NET_FLOW4);
|
||||
bt_assert(p.len = 8);
|
||||
bt_assert(p.ip = 10.0.0.0);
|
||||
bt_assert(p.src = 0.0.0.0/0);
|
||||
bt_assert(p.dst = 10.0.0.0/8);
|
||||
|
||||
p = flow6 { dst ::1/128; };
|
||||
bt_assert(p.type = NET_FLOW6);
|
||||
bt_assert(p.len = 128);
|
||||
bt_assert(p.ip = ::1);
|
||||
bt_assert(p.src = ::/0);
|
||||
bt_assert(p.dst = ::1/128);
|
||||
}
|
||||
|
||||
bt_test_suite(t_flowspec, "Testing flowspec routes");
|
||||
bt_test_suite(t_net_flowspec, "Testing flowspec routes");
|
||||
|
||||
|
||||
|
||||
@ -2057,11 +2110,15 @@ prefix pfx;
|
||||
bt_assert(pfx.len = 16);
|
||||
bt_assert(pfx.maxlen = 24);
|
||||
bt_assert(pfx.asn = 1234);
|
||||
bt_assert(pfx.ip = 12.13.0.0);
|
||||
bt_assert(format(pfx) = "12.13.0.0/16-24 AS1234");
|
||||
|
||||
pfx = 1000::/8 max 32 as 1234;
|
||||
bt_assert(pfx.len = 8);
|
||||
bt_assert(pfx.maxlen = 32);
|
||||
bt_assert(pfx.asn = 1234);
|
||||
bt_assert(pfx.ip = 1000::);
|
||||
bt_assert(format(pfx) = "1000::/8-32 AS1234");
|
||||
}
|
||||
|
||||
bt_test_suite(t_roa_check, "Testing ROA");
|
||||
|
Loading…
Reference in New Issue
Block a user