Filter: Add support for VPN_RD sets
This commit is contained in:
parent
41b83e52f7
commit
83715aa829
2 changed files with 59 additions and 3 deletions
|
@ -35,6 +35,7 @@ f_valid_set_type(int type)
|
|||
case T_IP:
|
||||
case T_EC:
|
||||
case T_LC:
|
||||
case T_RD:
|
||||
return 1;
|
||||
|
||||
default:
|
||||
|
@ -492,6 +493,7 @@ type:
|
|||
case T_QUAD:
|
||||
case T_EC:
|
||||
case T_LC:
|
||||
case T_RD:
|
||||
case T_IP:
|
||||
$$ = T_SET;
|
||||
break;
|
||||
|
@ -641,9 +643,10 @@ fipa:
|
|||
*/
|
||||
|
||||
set_atom:
|
||||
NUM { $$.type = T_INT; $$.val.i = $1; }
|
||||
| fipa { $$ = $1; }
|
||||
| ENUM { $$.type = pair_a($1); $$.val.i = pair_b($1); }
|
||||
NUM { $$.type = T_INT; $$.val.i = $1; }
|
||||
| fipa { $$ = $1; }
|
||||
| VPN_RD { $$.type = T_RD; $$.val.ec = $1; }
|
||||
| ENUM { $$.type = pair_a($1); $$.val.i = pair_b($1); }
|
||||
| '(' term ')' {
|
||||
$$ = f_eval($2, cfg_mem);
|
||||
if (!f_valid_set_type($$.type)) cf_error("Set-incompatible type");
|
||||
|
|
|
@ -1005,6 +1005,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
|
||||
* --------------------------
|
||||
|
|
Loading…
Reference in a new issue