2013-09-01 19:07:02 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
. ./testlib.sh
|
|
|
|
|
|
|
|
# Initialize three nodes
|
|
|
|
|
|
|
|
$tinc $c1 <<EOF
|
|
|
|
init foo
|
2013-09-01 22:15:18 +00:00
|
|
|
set DeviceType dummy
|
|
|
|
set Port 32752
|
|
|
|
set Address localhost
|
2013-09-01 19:07:02 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
$tinc $c2 <<EOF
|
|
|
|
init bar
|
2013-09-01 22:15:18 +00:00
|
|
|
set DeviceType dummy
|
|
|
|
set Port 0
|
2013-09-01 19:07:02 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
$tinc $c3 <<EOF
|
|
|
|
init baz
|
2013-09-01 22:15:18 +00:00
|
|
|
set DeviceType dummy
|
|
|
|
set Port 0
|
2013-09-01 19:07:02 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
# Test import, export and exchange commands
|
|
|
|
|
|
|
|
$tinc $c1 export | $tinc $c2 exchange | $tinc $c1 import
|
|
|
|
|
|
|
|
# Test export-all and exchange-all
|
|
|
|
|
|
|
|
$tinc $c1 export-all | $tinc $c3 exchange | $tinc $c1 import
|
|
|
|
$tinc $c1 exchange-all </dev/null | $tinc $c2 import
|
|
|
|
|
|
|
|
# Test equivalence of host config files
|
|
|
|
|
|
|
|
cmp $d1/hosts/foo $d2/hosts/foo
|
|
|
|
cmp $d1/hosts/foo $d3/hosts/foo
|
|
|
|
cmp $d1/hosts/bar $d2/hosts/bar
|
|
|
|
cmp $d1/hosts/bar $d3/hosts/bar
|
|
|
|
cmp $d1/hosts/baz $d2/hosts/baz
|
|
|
|
cmp $d1/hosts/baz $d3/hosts/baz
|
2013-09-01 22:15:18 +00:00
|
|
|
|
|
|
|
# Check whether the nodes can connect to each other
|
|
|
|
|
|
|
|
$tinc $c1 start $r1
|
|
|
|
|
|
|
|
$tinc $c2 add ConnectTo foo
|
|
|
|
$tinc $c3 add ConnectTo foo
|
|
|
|
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
$tinc $c2 start $r2
|
|
|
|
$tinc $c3 start $r3
|
|
|
|
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
test `$tinc $c1 dump reachable nodes | wc -l` = 3
|
|
|
|
test `$tinc $c2 dump reachable nodes | wc -l` = 3
|
|
|
|
test `$tinc $c3 dump reachable nodes | wc -l` = 3
|
|
|
|
|
|
|
|
$tinc $c3 stop
|
|
|
|
$tinc $c2 stop
|
|
|
|
$tinc $c1 stop
|