5 echo Initializing node...
7 # Initialize server node
20 echo Setting up scripts...
25 for script in tinc-up tinc-down host-up host-down subnet-up subnet-down hosts/foo-up hosts/foo-down hosts/bar-up hosts/bar-down invitation-created invitation-accepted; do
26 cat >$d1/$script << EOF
28 echo $script \$NETNAME,\$NAME,\$DEVICE,\$IFACE,\$NODE,\$REMOTEADDRESS,\$REMOTEPORT,\$SUBNET,\$WEIGHT,\$INVITATION_FILE,\$INVITATION_URL,\$DEBUG >>$OUT
32 cat >$d1/$script.cmd << EOF
33 echo $script %NETNAME%,%NAME%,%DEVICE%,%IFACE%,%NODE%,%REMOTEADDRESS%,%REMOTEPORT%,%SUBNET%,%WEIGHT%,%INVITATION_FILE%,%INVITATION_URL%,%DEBUG% >>$OUT
39 echo Starting server node...
41 $tinc $c1 -n netname start $r1
43 echo foo-started >>$OUT
47 echo Inviting client node...
49 url=`$tinc $c1 -n netname2 invite bar | sed 's/\r//'`
50 file=`cd $d1/invitations; ls | grep -v ed25519_key.priv`
51 echo bar-invited >>$OUT
53 echo Joining client node...
55 $tinc $c2 -n netname3 join $url
56 echo bar-joined >>$OUT
58 # Start and stop client node
60 echo Starting client node...
66 add Subnet fec0::/64#5
72 echo bar-started >>$OUT
79 echo bar-stopped >>$OUT
86 echo bar-started >>$OUT
94 # Check if the script output is what is expected
96 cat >$OUT.expected << EOF
97 tinc-up netname,foo,dummy,,,,,,,,,5
98 subnet-up netname,foo,dummy,,foo,,,10.0.0.1,,,,5
99 subnet-up netname,foo,dummy,,foo,,,fec0::/64,,,,5
101 invitation-created netname2,foo,,,bar,,,,,$d1/invitations/$file,$url,
103 invitation-accepted netname,foo,dummy,,bar,127.0.0.1,,,,,,5
105 host-up netname,foo,dummy,,bar,127.0.0.1,32760,,,,,5
106 hosts/bar-up netname,foo,dummy,,bar,127.0.0.1,32760,,,,,5
107 subnet-up netname,foo,dummy,,bar,127.0.0.1,32760,10.0.0.2,,,,5
108 subnet-up netname,foo,dummy,,bar,127.0.0.1,32760,fec0::/64,5,,,5
110 host-down netname,foo,dummy,,bar,127.0.0.1,32760,,,,,4
111 hosts/bar-down netname,foo,dummy,,bar,127.0.0.1,32760,,,,,4
112 subnet-down netname,foo,dummy,,bar,127.0.0.1,32760,10.0.0.2,,,,4
113 subnet-down netname,foo,dummy,,bar,127.0.0.1,32760,fec0::/64,5,,,4
115 host-up netname,foo,dummy,,bar,127.0.0.1,32760,,,,,5
116 hosts/bar-up netname,foo,dummy,,bar,127.0.0.1,32760,,,,,5
117 subnet-up netname,foo,dummy,,bar,127.0.0.1,32760,10.0.0.2,,,,5
118 subnet-up netname,foo,dummy,,bar,127.0.0.1,32760,fec0::/64,5,,,5
120 host-down netname,foo,dummy,,bar,127.0.0.1,32760,,,,,5
121 hosts/bar-down netname,foo,dummy,,bar,127.0.0.1,32760,,,,,5
122 subnet-down netname,foo,dummy,,bar,127.0.0.1,32760,10.0.0.2,,,,5
123 subnet-down netname,foo,dummy,,bar,127.0.0.1,32760,fec0::/64,5,,,5
124 subnet-down netname,foo,dummy,,foo,,,10.0.0.1,,,,5
125 subnet-down netname,foo,dummy,,foo,,,fec0::/64,,,,5
126 tinc-down netname,foo,dummy,,,,,,,,,5
130 cmp $OUT $OUT.expected