case T_IP:
case T_EC:
case T_LC:
+ case T_RD:
return 1;
default:
case T_QUAD:
case T_EC:
case T_LC:
+ case T_RD:
case T_IP:
$$ = T_SET;
break;
*/
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");
+/*
+ * 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
* --------------------------