tinc-gui: Reformat codebase according to PEP8
[tinc] / test / import-export.test
1 #!/bin/sh
2
3 . ./testlib.sh
4
5 # Initialize three nodes
6
7 $tinc $c1 <<EOF
8 init foo
9 set DeviceType dummy
10 set Port 32752
11 set Address localhost
12 EOF
13
14 $tinc $c2 <<EOF
15 init bar
16 set DeviceType dummy
17 set Port 0
18 EOF
19
20 $tinc $c3 <<EOF
21 init baz
22 set DeviceType dummy
23 set Port 0
24 EOF
25
26 # Test import, export and exchange commands
27
28 $tinc $c1 export | $tinc $c2 exchange | $tinc $c1 import
29
30 # Test export-all and exchange-all
31
32 $tinc $c1 export-all | $tinc $c3 exchange | $tinc $c1 import
33 $tinc $c1 exchange-all </dev/null | $tinc $c2 import
34
35 # Test equivalence of host config files
36
37 cmp $d1/hosts/foo $d2/hosts/foo
38 cmp $d1/hosts/foo $d3/hosts/foo
39 cmp $d1/hosts/bar $d2/hosts/bar
40 cmp $d1/hosts/bar $d3/hosts/bar
41 cmp $d1/hosts/baz $d2/hosts/baz
42 cmp $d1/hosts/baz $d3/hosts/baz
43
44 # Check whether the nodes can connect to each other
45
46 $tinc $c1 start $r1
47
48 $tinc $c2 add ConnectTo foo
49 $tinc $c3 add ConnectTo foo
50
51 sleep 1
52
53 $tinc $c2 start $r2
54 $tinc $c3 start $r3
55
56 sleep 1
57
58 test `$tinc $c1 dump reachable nodes | wc -l` = 3
59 test `$tinc $c2 dump reachable nodes | wc -l` = 3
60 test `$tinc $c3 dump reachable nodes | wc -l` = 3
61
62 $tinc $c3 stop
63 $tinc $c2 stop
64 $tinc $c1 stop