2 * This is an example configuration file.
9 define xyzzy = (120+10);
11 function callme(int arg1; int arg2)
16 printn "Function callme called arguments ", arg1, " and ", arg2, ":" ;
20 2: print "dva"; print "jeste jednou dva";
21 3 .. 5: print "tri az pet";
22 else: print "neco jineho";
28 print "fifteen called";
38 print "Testing path masks: ", p;
39 p2 = prepend( + empty +, 1 );
40 p2 = prepend( p2, 2 );
41 p2 = prepend( p2, 3 );
42 p2 = prepend( p2, 4 );
43 print "Testing paths: ", p2;
44 print "Should be true: ", p2 ~ p;
46 p2 = prepend( p2, 5 );
47 print "Should be false: ", p2 ~ p;
48 print "Should be true: ", p2 ~ / ? 4 3 2 1 /, p2, / ? 4 3 2 1 /;
49 print "Should be true: ", p2 ~ / ? 4 3 ? 1 /, p2, / ? 4 3 ? 1 /;
55 print "Community list (1,2) (2,3) ", l;
56 print "Should be true: ", (2,3) ~ l;
57 l = delete( l, (2,3) );
58 print "Community list (1,2) ", l;
59 print "Should be false: ", (2,3) ~ l;
64 print "fifteen called";
69 define onetwo=1.2.3.4;
76 print "Testing filter language:";
78 i = 12*100 + 60/2 + i;
80 print " arithmetics: 1234 = ", i;
81 printn " if statements ";
82 print "what happens here?";
84 if (i = 4) then { print "*** FAIL: if 0"; quitbird; } else printn ".";
85 # if !(i = 3) then { print "*** FAIL: if 0"; quitbird; } else printn ".";
86 if 1234 = i then printn "."; else { print "*** FAIL: if 1 else"; }
87 # if 1 <= 1 then printn "."; else { print "*** FAIL: test 3"; }
88 if 1234 < 1234 then { print "*** FAIL: test 4"; quitbird; } else print "ok";
89 print " must be true: ", 1.2.0.0/16 ~ [ 1.0.0.0/8{ 15 , 17 } ];
90 print " data types; must be true: ", 1.2.3.4 = 1.2.3.4, ",", 1 ~ [1,2,3], ",", 5 ~ [1..20], ",", 2 ~ [ 1, 2, 3 ], ",", 5 ~ [ 4 .. 7 ], ",", 1.2.3.4 ~ [ 1.2.3.3..1.2.3.5 ], ",", 1.2.3.4 ~ 1.0.0.0/8, ",", 1.0.0.0/8 ~ 1.0.0.0/8, ",", 1.0.0.0/8 ~ [ 1.0.0.0/8+ ];
91 print " must be true: ", true && true, ",", true || false;
93 # print " must be true: ", defined(1), ",", defined(1.2.3.4), ",", 1 != 2, ",", 1 <= 2;
94 print " data types: must be false: ", 1 ~ [ 2, 3, 4 ], ",", 5 ~ [ 2, 3, 4, 7..11 ], ",", 1.2.3.4 ~ [ 1.2.3.3, 1.2.3.5 ], ",", (1,2) > (2,2), ",", (1,1) > (1,1), ",", 1.0.0.0/8 ~ [ 1.0.0.0/8- ], ",", 1.2.0.0/17 ~ [ 1.0.0.0/8{ 15 , 16 } ], ",", true && false;
97 print "Testing prefixes: 1.2.0.0/18 = ", px;
99 print "Testing mask : 127.0.0.0 = ", p.mask(8);
100 print "Testing pairs: (1,2) = ", (1,2);
101 print "Testing enums: ", RTS_DUMMY, " ", RTS_STATIC;
103 print "What will this do? ", [ 1, 2, 1, 1, 1, 3, 4, 1, 1, 1, 5 ];
105 print "Testing functions...";
114 print "Testing function calls: 15 = ", i;
118 print "1.2.3.4 = ", onetwo;
122 # print "*** FAIL: this is unreachable";
127 print bgp_path ~ / 65000 /;
132 print bgp_path ~ / 65000 /;
138 print "Heya, filtering route to ", net.ip, " prefixlen ", net.len, " source ", source;
139 print "This route was from ", from;
142 if rip_metric > 15 then {
143 reject "RIP Metric is more than infinity";
148 accept "ok I take that";