diff options
Diffstat (limited to 'filter/test.conf')
-rw-r--r-- | filter/test.conf | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/filter/test.conf b/filter/test.conf index ca8e26f..19372f2 100644 --- a/filter/test.conf +++ b/filter/test.conf @@ -11,6 +11,7 @@ router id 62.168.0.1; define xyzzy = (120+10); define '1a-a1' = (20+10); define one = 1; +define ten = 10; function onef(int a) { @@ -56,6 +57,7 @@ bgpmask pm1; bgpmask pm2; bgppath p2; clist l; +eclist el; { pm1 = / 4 3 2 1 /; pm2 = [= 4 3 2 1 =]; @@ -118,6 +120,29 @@ clist l; print "Community list (3,1) ", l; l = delete( l, [(*,(onef(5)))] ); print "Community list empty ", l; + + el = -- empty --; + el = add(el, (rt, 10, 20)); + el = add(el, (ro, 10.20.30.40, 100)); + el = add(el, (ro, 11.21.31.41.mask(16), 200)); + print "EC list (rt, 10, 20) (ro, 10.20.30.40, 100) (ro, 11.21.0.0, 200):"; + print el; + el = delete(el, (rt, 10, 20)); + el = delete(el, (rt, 10, 30)); + el = add(el, (unknown 2, ten, 1)); + el = add(el, (unknown 5, ten, 1)); + el = add(el, (rt, ten, one+one)); + el = add(el, (rt, 10, 3)); + el = add(el, (rt, 10, 4)); + el = add(el, (rt, 10, 5)); + el = add(el, (generic, 0x2000a, 3*ten)); + el = delete(el, [(rt, 10, 2..ten)]); + print "EC list (ro, 10.20.30.40, 100) (ro, 11.21.0.0, 200) (rt, 10, 1) (unknown 0x5, 10, 1) (rt, 10, 30):"; + print el; + el = filter(el, [(rt, 10, *)]); + print "EC list (rt, 10, 1) (rt, 10, 30): ", el; + print "Testing EC list, true: ", (rt, 10, 1) ~ el, " ", el ~ [(rt, 10, ten..40)]; + print "Testing EC list, false: ", (rt, 10, 20) ~ el, " ", (ro, 10.20.30.40, 100) ~ el, " ", el ~ [(rt, 10, 35..40)], " ", el ~ [(ro, 10, *)]; } function bla() @@ -175,11 +200,13 @@ prefix px; ip p; pair pp; quad qq; +ec cc; int set is; int set is1; int set is2; int set is3; pair set ps; +ec set ecs; prefix set pxs; string s; { @@ -250,6 +277,19 @@ string s; ", true: ", qq = 1.2.3.4, " ", qq ~ [1.2.3.4, 5.6.7.8], ", false: ", qq = 4.3.2.1, " ", qq ~ [1.2.1.1, 1.2.3.5]; + cc = (rt, 12345, 200000); + print "Testing EC: (rt, 12345, 200000) = ", cc; + print "Testing EC: (ro, 100000, 20000) = ", (ro, 100000, 20000); + print "Testing EC: (rt, 10.20.30.40, 20000) = ", (rt, 10.20.30.40, 20000); + print " true: ", cc = (rt, 12345, 200000), " ", cc < (rt, 12345, 200010), + ", false: ", cc = (rt, 12346, 200000), " ", cc = (ro, 12345, 200000), " ", cc > (rt, 12345, 200010); + + ecs = [(rt, ten, (one+onef(0))*10), (ro, 100000, 100..200), (rt, 12345, *)]; + print "EC set: ", ecs; + print "Testing EC set, true: ", (rt, 10, 20) ~ ecs, " ", (ro, 100000, 100) ~ ecs, " ", (ro, 100000, 200) ~ ecs, + " ", (rt, 12345, 0) ~ ecs, " ", cc ~ ecs, " ", (rt, 12345, 4000000) ~ ecs; + print "Testing EC set, false: ", (ro, 10, 20) ~ ecs, " ", (rt, 10, 21) ~ ecs, " ", (ro, 100000, 99) ~ ecs, + " ", (ro, 12345, 10) ~ ecs, " ", (rt, 12346, 0) ~ ecs, " ", (ro, 0.1.134.160, 150) ~ ecs; s = "Hello"; print "Testing string: ", s, " true: ", s ~ "Hell*", " false: ", s ~ "ell*"; |