]> git.ipfire.org Git - thirdparty/bird.git/blobdiff - filter/test.conf
Merge branch 'master' into mq-filter-stack
[thirdparty/bird.git] / filter / test.conf
index 078dafb9f4f752d052a4462588adbf51a4cec9c8..9abd76f320b0d291ee5d195bf941584091e44663 100644 (file)
@@ -7,8 +7,7 @@
 router id 62.168.0.1;
 
 /* We have to setup any protocol */
-protocol static { ipv4; }
-
+protocol device { }
 
 
 
@@ -25,8 +24,19 @@ function onef(int a)
        return 1;
 }
 
+function twof(int a)
+{
+       return 2;
+}
 
+function oneg(int a)
+{
+       return 1;
+}
 
+bt_test_same(onef, onef, 1);
+bt_test_same(onef, oneg, 1);
+bt_test_same(onef, twof, 0);
 
 /*
  *     Testing boolean expressions
@@ -62,7 +72,6 @@ bt_test_suite(t_bool, "Testing boolean expressions");
 
 
 
-
 /*
  *     Testing integers
  *     ----------------
@@ -126,6 +135,7 @@ int set is;
        bt_assert(2 ~ [ 1, 2, 3 ]);
        bt_assert(5 ~ [ 4 .. 7 ]);
        bt_assert(1 !~ [ 2, 3, 4 ]);
+       bt_assert(999 !~ [ 666, 333 ]);
 
        is = [ 2, 3, 4, 7..11 ];
        bt_assert(10 ~ is);
@@ -312,15 +322,18 @@ function t_ip()
 ip p;
 {
        p = 127.1.2.3;
+       bt_assert(p.is_v4);
        bt_assert(p.mask(8) = 127.0.0.0);
        bt_assert(1.2.3.4 = 1.2.3.4);
        bt_assert(1.2.3.4 = onetwo);
        bt_assert(format(p) = "127.1.2.3");
 
        p = ::fffe:6:c0c:936d:88c7:35d3;
+       bt_assert(!p.is_v4);
        bt_assert(format(p) = "::fffe:6:c0c:936d:88c7:35d3");
 
        p = 1234:5678::;
+       bt_assert(!p.is_v4);
        bt_assert(p.mask(24) = 1234:5600::);
 }
 
@@ -365,8 +378,8 @@ bt_test_suite(t_ip_set, "Testing sets of ip address");
 
 function t_enum()
 {
-       bt_assert(format(RTS_DUMMY)  = "(enum 30)0");           /* XXX */
-       bt_assert(format(RTS_STATIC) = "(enum 30)1");           /* XXX */
+       bt_assert(format(RTS_DUMMY)  = "(enum 30)0");
+       bt_assert(format(RTS_STATIC) = "(enum 30)1");
        bt_assert(RTS_STATIC ~ [RTS_STATIC, RTS_DEVICE]);
        bt_assert(RTS_BGP !~ [RTS_STATIC, RTS_DEVICE]);
 }
@@ -444,8 +457,8 @@ function test_pxset(prefix set pxs)
 function t_prefix_set()
 prefix set pxs;
 {
-       pxs = [ 1.2.0.0/16, 1.4.0.0/16+];
-       bt_assert(format(pxs) = "[1.2.0.0/112{::0.1.0.0}, 1.4.0.0/112{::0.1.255.255}]");
+       pxs = [ 1.2.0.0/16, 1.4.0.0/16+, 44.66.88.64/30{24,28}, 12.34.56.0/24{8,16} ];
+       bt_assert(format(pxs) = "[1.2.0.0/112{::0.1.0.0}, 1.4.0.0/112{::0.1.255.255}, 12.34.0.0/112{::1.255.0.0}, 44.66.88.64/124{::1f0}]");
        bt_assert(1.2.0.0/16 ~ pxs);
        bt_assert(1.4.0.0/16 ~ pxs);
        bt_assert(1.4.0.0/18 ~ pxs);
@@ -548,6 +561,32 @@ bt_test_suite(t_prefix6_set, "Testing prefix IPv6 sets");
 
 
 
+function t_flowspec()
+prefix p;
+{
+       p = flow4 { dst 10.0.0.0/8; };
+       bt_assert(p !~ [ 10.0.0.0/8 ] );
+
+       bt_assert(format(flow4 { dst 10.0.0.0/8; proto = 23; }) = "flow4 { dst 10.0.0.0/8; proto 23; }");
+       bt_assert(format(flow6 { dst ::1/128; src ::2/127; }) = "flow6 { dst ::1/128; src ::2/127; }");
+       bt_assert(format(flow6 { next header false 42; }) = "flow6 { next header false 42; }");
+       bt_assert(format(flow6 { port 80; }) = "flow6 { port 80; }");
+       bt_assert(format(flow6 { dport > 24 && < 30 || 40..50,60..70,80 && >= 90; }) = "flow6 { dport > 24 && < 30 || 40..50,60..70,80 && >= 90; }");
+       bt_assert(format(flow6 { sport 0..0x400; }) = "flow6 { sport 0..1024; }");
+       bt_assert(format(flow6 { icmp type 80; }) = "flow6 { icmp type 80; }");
+       bt_assert(format(flow6 { icmp code 90; }) = "flow6 { icmp code 90; }");
+       bt_assert(format(flow6 { tcp flags 0x03/0x0f; }) = "flow6 { tcp flags 0x3/0x3,0x0/0xc; }");
+       bt_assert(format(flow6 { length 0..65535; }) = "flow6 { length 0..65535; }");
+       bt_assert(format(flow6 { dscp = 63; }) = "flow6 { dscp 63; }");
+       bt_assert(format(flow6 { fragment is_fragment || !first_fragment; }) = "flow6 { fragment is_fragment || !first_fragment; }");
+       bt_assert(format(flow6 { }) = "flow6 { }");
+}
+
+bt_test_suite(t_flowspec, "Testing flowspec routes");
+
+
+
+
 /*
  *     Testing Paths
  *     -------------
@@ -560,14 +599,11 @@ function mkpath(int a; int b)
 
 function t_path()
 bgpmask pm1;
-bgpmask pm2;
 bgppath p2;
 {
-       pm1 =  / 4 3 2 1 /;
-       pm2 = [= 4 3 2 1 =];
+       pm1 = [= 4 3 2 1 =];
 
-       bt_assert(pm1 = pm2);
-       bt_assert(format(pm2) = "[= 4 3 2 1 =]");
+       bt_assert(format(pm1) = "[= 4 3 2 1 =]");
 
        bt_assert(+empty+ = +empty+);
        bt_assert(10 !~ +empty+);
@@ -580,17 +616,14 @@ bgppath p2;
        bt_assert(format(p2) = "(path 4 3 2 1)");
        bt_assert(p2.len = 4);
        bt_assert(p2 ~ pm1);
-       bt_assert(p2 ~ pm2);
        bt_assert(3 ~ p2);
        bt_assert(p2 ~ [2, 10..20]);
        bt_assert(p2 ~ [4, 10..20]);
 
        p2 = prepend(p2, 5);
        bt_assert(p2 !~ pm1);
-       bt_assert(p2 !~ pm2);
        bt_assert(10 !~ p2);
        bt_assert(p2 !~ [8, ten..(2*ten)]);
-       bt_assert(p2 ~  / ? 4 3 2 1 /);
        bt_assert(p2 ~ [= * 4 3 * 1 =]);
        bt_assert(p2 ~ [= (3+2) (2*2) 3 2 1 =]);
        bt_assert(p2 ~ mkpath(5, 4));
@@ -699,31 +732,32 @@ clist r;
        l2 = filter(l2, [(3,3..6)]);
 
        #  clist A (10,20,30)
-       bt_assert(format(l) = "(clist (3,1) (3,2) (3,3) (3,4))");
        bt_assert(l = add(add(add(add(-empty-, (3,1)), (3,2)), (3,3)), (3,4)));
+       bt_assert(format(l) = "(clist (3,1) (3,2) (3,3) (3,4))");
 
        #  clist B (30,40,50)
-       bt_assert(format(l2) = "(clist (3,3) (3,4) (3,5) (3,6))");
        bt_assert(l2 = add(add(add(add(-empty-, (3,3)), (3,4)), (3,5)), (3,6)));
+       bt_assert(format(l2) = "(clist (3,3) (3,4) (3,5) (3,6))");
 
        #  clist A union B
        r = add(l, l2);
-       bt_assert(format(r) = "(clist (3,1) (3,2) (3,3) (3,4) (3,5) (3,6))");
        bt_assert(r = add(add(add(add(add(add(-empty-, (3,1)), (3,2)), (3,3)), (3,4)), (3,5)), (3,6)));
+       bt_assert(format(r) = "(clist (3,1) (3,2) (3,3) (3,4) (3,5) (3,6))");
 
        #  clist A isect B
        r = filter(l, l2);
-       bt_assert(format(r) = "(clist (3,3) (3,4))");
        bt_assert(r = add(add(-empty-, (3,3)), (3,4)));
+       bt_assert(format(r) = "(clist (3,3) (3,4))");
 
        #  clist A \ B
        r = delete(l, l2);
-       bt_assert(format(r) = "(clist (3,1) (3,2))");
        bt_assert(r = add(add(-empty-, (3,1)), (3,2)));
+       bt_assert(format(r) = "(clist (3,1) (3,2))");
 
        #  clist in c set
        r = filter(l, [(3,1), (*,2)]);
        bt_assert(r = add(add(-empty-, (3,1)), (3,2)));
+       bt_assert(format(r) = "(clist (3,1) (3,2))");
 }
 
 bt_test_suite(t_clist, "Testing lists of communities");
@@ -803,31 +837,32 @@ eclist r;
        el2 = add(el2, (rt, 10, 50));
 
        #  eclist A (1,30,40)
-       bt_assert(format(el) = "(eclist (rt, 10, 1) (rt, 10, 30) (rt, 10, 40))");
        bt_assert(el = add(add(add(--empty--, (rt, 10, 1)), (rt, 10, 30)), (rt, 10, 40)));
+       bt_assert(format(el) = "(eclist (rt, 10, 1) (rt, 10, 30) (rt, 10, 40))");
 
        #  eclist B (30,40,50)
-       bt_assert(format(el2) = "(eclist (rt, 10, 30) (rt, 10, 40) (rt, 10, 50))");
        bt_assert(el2 = add(add(add(--empty--, (rt, 10, 30)), (rt, 10, 40)), (rt, 10, 50)));
+       bt_assert(format(el2) = "(eclist (rt, 10, 30) (rt, 10, 40) (rt, 10, 50))");
 
        #  eclist A union B
        r = add(el2, el);
-       bt_assert(format(r) = "(eclist (rt, 10, 30) (rt, 10, 40) (rt, 10, 50) (rt, 10, 1))");
        bt_assert(r = add(add(add(add(--empty--, (rt, 10, 30)), (rt, 10, 40)), (rt, 10, 50)), (rt, 10, 1)));
+       bt_assert(format(r) = "(eclist (rt, 10, 30) (rt, 10, 40) (rt, 10, 50) (rt, 10, 1))");
 
        #  eclist A isect B
        r = filter(el, el2);
-       bt_assert(format(r) = "(eclist (rt, 10, 30) (rt, 10, 40))");
        bt_assert(r = add(add(--empty--, (rt, 10, 30)), (rt, 10, 40)));
+       bt_assert(format(r) = "(eclist (rt, 10, 30) (rt, 10, 40))");
 
        #  eclist A \ B
        r = delete(el, el2);
-       bt_assert(format(r) = "(eclist (rt, 10, 1))");
        bt_assert(r = add(--empty--, (rt, 10, 1)));
+       bt_assert(format(r) = "(eclist (rt, 10, 1))");
 
        #  eclist in ec set
        r = filter(el, [(rt, 10, 1), (rt, 10, 25..30), (ro, 10, 40)]);
        bt_assert(r = add(add(--empty--, (rt, 10, 1)), (rt, 10, 30)));
+       bt_assert(format(r) = "(eclist (rt, 10, 1) (rt, 10, 30))");
 }
 
 bt_test_suite(t_eclist, "Testing lists of extended communities");
@@ -916,22 +951,23 @@ lclist r;
 
        #  lclist A union B
        r = add(ll, ll2);
-       bt_assert(format(r) = "(lclist (10, 10, 10) (20, 20, 20) (30, 30, 30) (40, 40, 40))");
        bt_assert(r = add(add(add(add(---empty---, (10,10,10)), (20,20,20)), (30,30,30)), (40,40,40)));
+       bt_assert(format(r) = "(lclist (10, 10, 10) (20, 20, 20) (30, 30, 30) (40, 40, 40))");
 
        #  lclist A isect B
        r = filter(ll, ll2);
-       bt_assert(format(r) = "(lclist (20, 20, 20) (30, 30, 30))");
        bt_assert(r = add(add(---empty---, (20, 20, 20)), (30, 30, 30)));
+       bt_assert(format(r) = "(lclist (20, 20, 20) (30, 30, 30))");
 
        #  lclist A \ B
        r = delete(ll, ll2);
-       bt_assert(format(r) = "(lclist (10, 10, 10))");
        bt_assert(r = add(---empty---, (10, 10, 10)));
+       bt_assert(format(r) = "(lclist (10, 10, 10))");
 
        #  lclist in lc set
        r = filter(ll, [(5..15, *, *), (20, 15..25, *)]);
        bt_assert(r = add(add(---empty---, (10, 10, 10)), (20, 20, 20)));
+       bt_assert(format(r) = "(lclist (10, 10, 10) (20, 20, 20))");
 }
 
 bt_test_suite(t_lclist, "Testing lists of large communities");
@@ -962,6 +998,7 @@ lc set lls;
        bt_assert(ll !~ [(11, *, *)]);
 
        lls = [(10, 10, 10), (20, 20, 15..25), (30, 30, *), (40, 35..45, *), (50, *, *), (55..65, *, *)];
+       bt_assert(format(lls) = "[(10, 10, 10), (20, 20, 15)..(20, 20, 25), (30, 30, 0)..(30, 30, 4294967295), (40, 35, 0)..(40, 45, 4294967295), (50, 0, 0)..(50, 4294967295, 4294967295), (55, 0, 0)..(65, 4294967295, 4294967295)]");
        bt_assert((10, 10, 10)  ~ lls);
        bt_assert((20, 20, 25)  ~ lls);
        bt_assert((20, 20, 26) !~ lls);
@@ -978,6 +1015,59 @@ bt_test_suite(t_lclist_set, "Testing sets of large communities");
 
 
 
+/*
+ *     Testing Route Distinguishers
+ *     ----------------------------
+ */
+
+function t_rd()
+rd x;
+{
+       x = 12345:20000;
+       bt_assert(format(x) = "12345:20000");
+
+       bt_assert(x = 12345:20000);
+       bt_assert(x < 12345:20010);
+       bt_assert(x != 12346:20000);
+       bt_assert(x != 2:12345:20000);
+       bt_assert(!(x > 12345:200010));
+
+       bt_assert(format(10.0.0.1:1000) = "10.0.0.1:1000");
+       bt_assert(format(100000:20000) = "100000:20000");
+       bt_assert(format(2:100000:20000) = "100000:20000");
+       bt_assert(format(2:1000:1000) = "2:1000:1000");
+}
+
+bt_test_suite(t_rd, "Testing route distinguishers");
+
+
+
+
+/*
+ *     Testing sets of Route Distinguishers
+ *     ------------------------------------
+ */
+
+function t_rd_set()
+rd set rds;
+{
+       rds = [10:20, 100000:100..100000:200];
+       bt_assert(format(rds)  = "[10:20, 100000:100..100000:200]");
+
+       bt_assert(10:20  ~ rds);
+       bt_assert(10:21 !~ rds);
+       bt_assert(100000:90 !~ rds);
+       bt_assert(100000:100 ~ rds);
+       bt_assert(100000:128 ~ rds);
+       bt_assert(100000:200 ~ rds);
+       bt_assert(100010:150 !~ rds);
+}
+
+bt_test_suite(t_rd_set, "Testing sets of route distinguishers");
+
+
+
+
 /*
  *     Testing defined() function
  *     --------------------------
@@ -1027,6 +1117,11 @@ int i;
        return 0;
 }
 
+function callmeagain(int a; int b; int c)
+{
+       return a + b + c;
+}
+
 function fifteen()
 {
        return 15;
@@ -1043,6 +1138,7 @@ function t_call_function()
        bt_assert(callme(3, 2) = 6);
        bt_assert(callme(4, 4) = 16);
        bt_assert(callme(7, 2) = 14);
+       bt_assert(callmeagain(1, 2, 3) = 6);
 }
 
 bt_test_suite(t_call_function, "Testing calling functions");
@@ -1135,30 +1231,159 @@ int j;
        accept "ok I take that";
 }
 
-/*
-roa table rl
+filter roa_filter
+{
+       if net ~ [ 10.0.0.0/8{16,24}, 2000::/3{16,96} ] then {
+               accept;
+       }
+       reject;
+}
+
+roa4 table r4;
+roa6 table r6;
+
+protocol static
+{
+       roa4 { table r4; import filter roa_filter; };
+       route 10.110.0.0/16 max 16 as 1000;
+       route 10.120.0.0/16 max 24 as 1000;
+       route 10.130.0.0/16 max 24 as 2000;
+       route 10.130.128.0/18 max 24 as 3000;
+}
+
+protocol static
 {
-       roa 10.110.0.0/16 max 16 as 1000;
-       roa 10.120.0.0/16 max 24 as 1000;
-       roa 10.130.0.0/16 max 24 as 2000;
-       roa 10.130.128.0/18 max 24 as 3000;
+  roa6 { table r6; import filter roa_filter; };
+  route 2001:0db8:85a3:8a2e::/64 max 96 as 1000;
 }
 
-function test_roa()
+function test_roa_check()
+prefix pfx;
 {
        # cannot be tested in __startup(), sorry
-       print "Testing ROA";
-       print "Should be true: ", roa_check(rl, 10.10.0.0/16, 1000) = ROA_UNKNOWN,
-             " ", roa_check(rl, 10.0.0.0/8, 1000) = ROA_UNKNOWN,
-             " ", roa_check(rl, 10.110.0.0/16, 1000) = ROA_VALID,
-             " ", roa_check(rl, 10.110.0.0/16, 2000) = ROA_INVALID,
-             " ", roa_check(rl, 10.110.32.0/20, 1000) = ROA_INVALID,
-             " ", roa_check(rl, 10.120.32.0/20, 1000) = ROA_VALID;
-       print "Should be true: ", roa_check(rl, 10.120.32.0/20, 2000) = ROA_INVALID,
-             " ", roa_check(rl, 10.120.32.32/28, 1000) = ROA_INVALID,
-             " ", roa_check(rl, 10.130.130.0/24, 1000) = ROA_INVALID,
-             " ", roa_check(rl, 10.130.130.0/24, 2000) = ROA_VALID,
-             " ", roa_check(rl, 10.130.30.0/24, 3000) = ROA_INVALID,
-             " ", roa_check(rl, 10.130.130.0/24, 3000) = ROA_VALID;
+       bt_assert(roa_check(r4, 10.10.0.0/16, 1000) = ROA_UNKNOWN);
+       bt_assert(roa_check(r4, 10.0.0.0/8, 1000) = ROA_UNKNOWN);
+       bt_assert(roa_check(r4, 10.110.0.0/16, 1000) = ROA_VALID);
+       bt_assert(roa_check(r4, 10.110.0.0/16, 2000) = ROA_INVALID);
+       bt_assert(roa_check(r4, 10.110.32.0/20, 1000) = ROA_INVALID);
+       bt_assert(roa_check(r4, 10.120.32.0/20, 1000) = ROA_VALID);
+       bt_assert(roa_check(r4, 10.120.32.0/20, 2000) = ROA_INVALID);
+       bt_assert(roa_check(r4, 10.120.32.32/28, 1000) = ROA_INVALID);
+       bt_assert(roa_check(r4, 10.130.130.0/24, 1000) = ROA_INVALID);
+       bt_assert(roa_check(r4, 10.130.130.0/24, 2000) = ROA_VALID);
+       bt_assert(roa_check(r4, 10.130.30.0/24, 3000) = ROA_INVALID);
+       bt_assert(roa_check(r4, 10.130.130.0/24, 3000) = ROA_VALID);
+
+       bt_assert(roa_check(r6, 2001:0db8:85a3:8a2e:1234::/80, 1000) = ROA_VALID);
+       bt_assert(roa_check(r6, 2001:0db8:85a3:8a2e:1234::/97, 1000) = ROA_INVALID);
+       bt_assert(roa_check(r6, 2001:0db8:85a3:8a2e::/64, 1000) = ROA_VALID);
+       bt_assert(roa_check(r6, 2001:0db8:85a3::/48, 1000) = ROA_UNKNOWN);
+
+       bt_assert(roa_check(r4, 10.10.0.0/16, 1000) = ROA_UNKNOWN);
+       bt_assert(roa_check(r4, 10.0.0.0/8, 1000) = ROA_UNKNOWN);
+       bt_assert(roa_check(r4, 10.110.0.0/16, 1000) = ROA_VALID);
+       bt_assert(roa_check(r4, 10.110.0.0/16, 2000) = ROA_INVALID);
+       bt_assert(roa_check(r4, 10.110.32.0/20, 1000) = ROA_INVALID);
+       bt_assert(roa_check(r4, 10.120.32.0/20, 1000) = ROA_VALID);
+
+       bt_assert(roa_check(r6, 2001:0db8:85a3:8a2e:1234::/80, 1000) = ROA_VALID);
+       bt_assert(roa_check(r6, 2001:0db8:85a3:8a2e:1234::/97, 1000) = ROA_INVALID);
+       bt_assert(roa_check(r6, 2001:0db8:85a3:8a2e::/64, 1000) = ROA_VALID);
+       bt_assert(roa_check(r6, 2001:0db8:85a3::/48, 1000) = ROA_UNKNOWN);
+
+       bt_assert(roa_check(r4, 2001:0db8:85a3:8a2e:1234::/97, 1000) = ROA_UNKNOWN);
+       bt_assert(roa_check(r6, 2001:0db8:85a3:8a2e:1234::/97, 1000) = ROA_INVALID);
+
+       bt_assert(roa_check(r4, 2001:0db8:85a3:8a2e:1234::/80, 1000) = ROA_UNKNOWN);
+       bt_assert(roa_check(r6, 2001:0db8:85a3:8a2e:1234::/80, 1000) = ROA_VALID);
+       bt_assert(roa_check(r4, 2001:0db8:85a3::/48, 1000) = ROA_UNKNOWN);
+       bt_assert(roa_check(r6, 2001:0db8:85a3::/48, 1000) = ROA_UNKNOWN);
+
+       bt_assert(10.130.130.0/24 ~ 0.0.0.0/0);
+       bt_assert(2001:0db8:85a3:8a2e::/64 ~ ::/0);
+       bt_assert(10.130.130.0/24 !~ ::/0);
+       bt_assert(2001:0db8:85a3:8a2e::/64 !~ 0.0.0.0/0);
+
+       pfx = 12.13.0.0/16 max 24 as 1234;
+       bt_assert(pfx.len = 16);
+       bt_assert(pfx.maxlen = 24);
+       bt_assert(pfx.asn = 1234);
+
+       pfx = 1000::/8 max 32 as 1234;
+       bt_assert(pfx.len = 8);
+       bt_assert(pfx.maxlen = 32);
+       bt_assert(pfx.asn = 1234);
+}
+
+bt_test_suite(test_roa_check, "Testing ROA");
+
+/*
+ *      Testing Mixed Net Types
+ *      -----------------------
+ */
+
+function t_mixed_prefix()
+prefix set pxs;
+prefix set pxt;
+{
+       pxs = [ 98.45.0.0/16, 128.128.0.0/12+, 2200::/42-, ::ffff:d000:0/100{98,102}];
+       bt_assert(format(pxs) = "[::/0, ::/2{c000::}, 98.45.0.0/112{::0.1.0.0}, 128.128.0.0/108{::0.31.255.255}, 208.0.0.0/100{::124.0.0.0}, 2200::/42{ffff:ffff:ffc0::}]");
+       bt_assert(::fe00:0:0/88  !~ pxs);
+       bt_assert(::fffe:0:0/95  !~ pxs);
+       bt_assert(::ffff:d800:0/101 ~ pxs);
+       bt_assert(216.0.0.0/5 ~ pxs);
+       bt_assert(212.0.0.0/6 ~ pxs);
+       bt_assert(212.0.0.0/7 !~ pxs);
+       bt_assert(::ffff:8080:8080/121 ~ pxs);
+       bt_assert(::/0 ~ pxs);
+       bt_assert(0.0.0.0/0 !~ pxs);
+       bt_assert(128.135.64.17/32 ~ pxs);
+
+#      pxt = [ 0:1:2 10.1.10.0/24, 0:5:10000 10.1.10.0/24 ];
+#      print pxt;
+
+       bt_assert(format(NET_IP4) = "(enum 36)1"); ## if (net.type = NET_IP4) ...
+       bt_assert(format(NET_VPN6) = "(enum 36)4");
+       bt_assert(format(0:1:2) = "1:2");
+}
+
+bt_test_suite(t_mixed_prefix, "Testing mixed net types");
+
+
+filter vpn_filter
+{
+       bt_assert(format(net) = "1:2 10.1.10.0/24");
+       bt_assert(net.type = NET_VPN4);
+       bt_assert(net.type != NET_IP4);
+       bt_assert(net.type != NET_IP6);
+       bt_assert(net.rd = 0:1:2);
+
+       case (net.type) {
+         NET_IP4: print "IPV4";
+         NET_IP6: print "IPV6";
+       }
+
+       bt_check_assign(from, 10.20.30.40);
+       bt_check_assign(gw, 55.55.55.44);
+
+       bgp_community.add((3,5));
+       bgp_ext_community.add((ro, 135, 999));
+       bgp_large_community.add((6464156, 89646354, 8675643));
+
+       accept;
+}
+
+vpn4 table v4;
+vpn4 table v6;
+
+protocol static
+{
+       vpn4 { table v4; import filter vpn_filter; };
+       route 0:1:2 10.1.10.0/24 unreachable;
+}
+
+protocol static
+{
+       ipv6 { import where false; };
+       route fd01::/48 unreachable;
 }
-*/
\ No newline at end of file