Revision 42a0c054 filter/test.conf

View differences:

filter/test.conf
11 11
define xyzzy = (120+10);
12 12
define '1a-a1' = (20+10);
13 13
define one = 1;
14
define ten = 10;
14 15

  
15 16
function onef(int a)
16 17
{
......
56 57
bgpmask pm2;
57 58
bgppath p2;
58 59
clist l;
60
eclist el;
59 61
{
60 62
	pm1 =  / 4 3 2 1 /;
61 63
	pm2 = [= 4 3 2 1 =];
......
118 120
	print "Community list (3,1) ", l;
119 121
	l = delete( l, [(*,(onef(5)))] );
120 122
	print "Community list empty ", l;
123

  
124
	el = -- empty --;
125
	el = add(el, (rt, 10, 20));
126
	el = add(el, (ro, 10.20.30.40, 100));
127
	el = add(el, (ro, 11.21.31.41.mask(16), 200));
128
	print "EC list (rt, 10, 20) (ro, 10.20.30.40, 100) (ro, 11.21.0.0, 200):";
129
	print el;
130
	el = delete(el, (rt, 10, 20));
131
	el = delete(el, (rt, 10, 30));
132
	el = add(el, (unknown 2, ten, 1));
133
	el = add(el, (unknown 5, ten, 1));
134
	el = add(el, (rt, ten, one+one));
135
	el = add(el, (rt, 10, 3));
136
	el = add(el, (rt, 10, 4));
137
	el = add(el, (rt, 10, 5));
138
	el = add(el, (generic, 0x2000a, 3*ten));
139
	el = delete(el, [(rt, 10, 2..ten)]);
140
	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):";
141
	print el;
142
	el = filter(el, [(rt, 10, *)]);
143
	print "EC list (rt, 10, 1) (rt, 10, 30): ", el;
144
	print "Testing EC list, true: ", (rt, 10, 1) ~ el, " ", el ~ [(rt, 10, ten..40)];
145
	print "Testing EC list, false: ", (rt, 10, 20) ~ el, " ", (ro, 10.20.30.40, 100) ~ el, " ", el ~ [(rt, 10, 35..40)], " ", el ~ [(ro, 10, *)];
121 146
}
122 147

  
123 148
function bla()
......
175 200
ip p;
176 201
pair pp;
177 202
quad qq;
203
ec cc;
178 204
int set is;
179 205
int set is1;
180 206
int set is2;
181 207
int set is3;
182 208
pair set ps;
209
ec set ecs;
183 210
prefix set pxs;
184 211
string s;
185 212
{
......
250 277
		", true: ", qq = 1.2.3.4, " ", qq ~ [1.2.3.4, 5.6.7.8],
251 278
		", false: ", qq = 4.3.2.1, " ", qq ~ [1.2.1.1, 1.2.3.5];
252 279

  
280
	cc = (rt, 12345, 200000);
281
	print "Testing EC: (rt, 12345, 200000) = ", cc;
282
	print "Testing EC: (ro, 100000, 20000) = ", (ro, 100000, 20000);
283
	print "Testing EC: (rt, 10.20.30.40, 20000) = ", (rt, 10.20.30.40, 20000);
284
	print "  true: ", cc = (rt, 12345, 200000), " ", cc < (rt, 12345, 200010),
285
		", false: ", cc = (rt, 12346, 200000), " ", cc = (ro, 12345, 200000), " ",  cc > (rt, 12345, 200010);
286

  
287
	ecs = [(rt, ten, (one+onef(0))*10), (ro, 100000, 100..200), (rt, 12345, *)];
288
	print "EC set: ", ecs;
289
	print "Testing EC set, true:  ",  (rt, 10, 20) ~ ecs, "  ", (ro, 100000, 100) ~ ecs, "  ", (ro, 100000, 200) ~ ecs,
290
		"  ", (rt, 12345, 0) ~ ecs, "  ", cc ~ ecs,  "  ", (rt, 12345, 4000000) ~ ecs;
291
	print "Testing EC set, false: ", (ro, 10, 20) ~ ecs, " ", (rt, 10, 21) ~ ecs, " ", (ro, 100000, 99) ~ ecs,
292
		" ", (ro, 12345, 10) ~ ecs, " ", (rt, 12346, 0) ~ ecs, " ", (ro, 0.1.134.160, 150) ~ ecs;
253 293

  
254 294
	s = "Hello";
255 295
	print "Testing string: ", s, " true: ", s ~ "Hell*", " false: ", s ~ "ell*";

Also available in: Unified diff