|
@@ -35,17 +35,33 @@ echo "modparam(\"carrierroute\", \"config_source\", \"db\")" >> $CFG
|
|
|
# setup database
|
|
|
MYSQL="mysql openser -u openser --password=openserrw -e"
|
|
|
|
|
|
-$MYSQL "insert into openser.route_tree (id, carrier) values ('1', 'carrier1');"
|
|
|
-$MYSQL "insert into openser.route_tree (id, carrier) values ('2', 'default');"
|
|
|
-
|
|
|
-$MYSQL "insert into openser.carrierroute (id, carrier, scan_prefix, domain, prob, strip, rewrite_host) values ('1','1','49','0','0.5','0','host1.local');"
|
|
|
-$MYSQL "insert into openser.carrierroute (id, carrier, scan_prefix, domain, prob, strip, rewrite_host) values ('2','1','49','0','0.5','0','host2.local');"
|
|
|
-$MYSQL "insert into openser.carrierroute (id, carrier, scan_prefix, domain, prob, strip, rewrite_host) values ('3','1','42','0','0.3','0','host3.local');"
|
|
|
-$MYSQL "insert into openser.carrierroute (id, carrier, scan_prefix, domain, prob, strip, rewrite_host) values ('4','1','42','0','0.7','0','host4.local');"
|
|
|
-$MYSQL "insert into openser.carrierroute (id, carrier, scan_prefix, domain, prob, strip, rewrite_host) values ('5','1','','0','0.1','0','host5.local');"
|
|
|
-$MYSQL "insert into openser.carrierroute (id, carrier, scan_prefix, domain, prob, strip, rewrite_host) values ('6','2','','0','1','0','host6.local');"
|
|
|
+$MYSQL "insert into route_tree (id, carrier) values ('1', 'carrier1');"
|
|
|
+$MYSQL "insert into route_tree (id, carrier) values ('2', 'default');"
|
|
|
+$MYSQL "insert into route_tree (id, carrier) values ('3', 'carrier2');"
|
|
|
+
|
|
|
+$MYSQL "insert into carrierroute (id, carrier, domain, scan_prefix, prob, strip, rewrite_host) values ('1','1','0','49','0.5','0','host1.local');"
|
|
|
+$MYSQL "insert into carrierroute (id, carrier, domain, scan_prefix, prob, strip, rewrite_host) values ('2','1','0','49','0.5','0','host2.local');"
|
|
|
+$MYSQL "insert into carrierroute (id, carrier, domain, scan_prefix, prob, strip, rewrite_host) values ('3','1','0','42','0.3','0','host3.local');"
|
|
|
+$MYSQL "insert into carrierroute (id, carrier, domain, scan_prefix, prob, strip, rewrite_host) values ('4','1','0','42','0.7','0','host4.local');"
|
|
|
+$MYSQL "insert into carrierroute (id, carrier, domain, scan_prefix, prob, strip, rewrite_host) values ('5','1','0','','0.1','0','host5.local');"
|
|
|
+$MYSQL "insert into carrierroute (id, carrier, domain, scan_prefix, prob, strip, rewrite_host) values ('6','1','1','','0.1','0','host5.local');"
|
|
|
+$MYSQL "insert into carrierroute (id, carrier, domain, scan_prefix, prob, strip, rewrite_host) values ('7','1','2','','0.1','0','host5.local');"
|
|
|
+$MYSQL "insert into carrierroute (id, carrier, domain, scan_prefix, prob, strip, rewrite_host) values ('8','2','0','','1','0','host6.local');"
|
|
|
+$MYSQL "insert into carrierroute (id, carrier, domain, scan_prefix, prob, strip, rewrite_host) values ('9','2','1','','1','0','host6.local');"
|
|
|
+$MYSQL "insert into carrierroute (id, carrier, domain, scan_prefix, prob, strip, rewrite_host) values ('10','2','2','','1','0','host6.local');"
|
|
|
+$MYSQL "insert into carrierroute (id, carrier, domain, scan_prefix, prob, strip, rewrite_host) values ('11','3','0','','1','0','host1.local');"
|
|
|
+
|
|
|
+$MYSQL "insert into carrierfailureroute(id, carrier, domain, scan_prefix, host_name, reply_code, flags,
|
|
|
+mask, next_domain) values ('1', '1', '1', '49', 'host1.local', '404', '', '', '2');"
|
|
|
+$MYSQL "insert into carrierfailureroute(id, carrier, domain, scan_prefix, host_name, reply_code, flags,
|
|
|
+mask, next_domain) values ('2', '1', '1', '49', 'host1.local', '4..', '', '', '3');"
|
|
|
+$MYSQL "insert into carrierfailureroute(id, carrier, domain, scan_prefix, host_name, reply_code, flags,
|
|
|
+mask, next_domain) values ('3', '2', '1', '49', 'host1.local', '503', '', '', '2');"
|
|
|
+$MYSQL "insert into carrierfailureroute(id, carrier, domain, scan_prefix, host_name, reply_code, flags,
|
|
|
+mask, next_domain) values ('4', '2', '2', '49', 'host1.local', '5..', '', '', '3');"
|
|
|
|
|
|
../openser -w . -f $CFG > /dev/null
|
|
|
+
|
|
|
ret=$?
|
|
|
|
|
|
sleep 1
|
|
@@ -68,9 +84,18 @@ Printing tree for domain 0
|
|
|
49: 50.000 %, 'host2.local': ON, '0', '', '', ''
|
|
|
49: 50.000 %, 'host1.local': ON, '0', '', '', ''
|
|
|
NULL: 100.000 %, 'host5.local': ON, '0', '', '', ''
|
|
|
+Printing tree for domain 1
|
|
|
+ NULL: 100.000 %, 'host5.local': ON, '0', '', '', ''
|
|
|
+Printing tree for domain 2
|
|
|
+ NULL: 100.000 %, 'host5.local': ON, '0', '', '', ''
|
|
|
Printing tree for carrier default (2)
|
|
|
Printing tree for domain 0
|
|
|
- NULL: 100.000 %, 'host6.local': ON, '0', '', '', ''" $TMPFILE`
|
|
|
+ NULL: 100.000 %, 'host6.local': ON, '0', '', '', ''
|
|
|
+Printing tree for domain 1
|
|
|
+ NULL: 100.000 %, 'host6.local': ON, '0', '', '', ''
|
|
|
+Printing tree for carrier carrier2 (3)
|
|
|
+Printing tree for domain 0
|
|
|
+ NULL: 100.000 %, 'host1.local': ON, '0', '', '', ''" $TMPFILE`
|
|
|
if [ "$tmp" = "" ] ; then
|
|
|
ret=0
|
|
|
else
|
|
@@ -83,8 +108,13 @@ killall -9 openser
|
|
|
# cleanup database
|
|
|
$MYSQL "delete from route_tree where id = 1;"
|
|
|
$MYSQL "delete from route_tree where id = 2;"
|
|
|
-$MYSQL "delete from openser.carrierroute where carrier=1;"
|
|
|
-$MYSQL "delete from openser.carrierroute where carrier=2;"
|
|
|
+$MYSQL "delete from route_tree where id = 3;"
|
|
|
+$MYSQL "delete from carrierroute where carrier=1;"
|
|
|
+$MYSQL "delete from carrierroute where carrier=2;"
|
|
|
+$MYSQL "delete from carrierroute where carrier=3;"
|
|
|
+$MYSQL "delete from carrierfailureroute where carrier=1;"
|
|
|
+$MYSQL "delete from carrierfailureroute where carrier=2;"
|
|
|
+$MYSQL "delete from carrierfailureroute where carrier=3;"
|
|
|
|
|
|
cd ../test
|
|
|
|