3 # shellcheck disable=SC1090
6 echo [STEP] Initializing server node
20 echo [STEP] Setting up scripts
22 OUT=$DIR_FOO/scripts.out
28 subnet-up subnet-down \
29 hosts/foo-up hosts/foo-down \
30 hosts/bar-up hosts/bar-down \
31 invitation-created invitation-accepted; do
35 if is_windows && [ -n "\$INVITATION_FILE" ]; then
36 INVITATION_FILE=\$(cygpath --unix -- "\$INVITATION_FILE")
38 echo >>'$OUT' "$script" "$TINC_SCRIPT_VARS"
42 create_script foo "$script" "$commands"
45 echo [STEP] Starting server node
47 start_tinc foo -n netname
48 wait_script foo subnet-up 2
49 echo foo-started >>"$OUT"
51 echo [STEP] Inviting client node
53 url=$(tinc foo -n netname2 invite bar)
54 file=$(basename "$(find "$DIR_FOO/invitations" -type f ! -name ed25519_key.priv)")
57 file=$(cygpath --unix -- "$file")
60 wait_script foo invitation-created
61 echo bar-invited >>"$OUT"
63 echo [STEP] Joining client node
65 tinc bar -n netname3 join "$url"
66 wait_script foo invitation-accepted
67 echo bar-joined >>"$OUT"
69 echo [STEP] Starting client node
75 add Subnet fec0::/64#5
79 wait_script foo subnet-up 2
80 echo bar-started-1 >>"$OUT"
84 wait_script foo subnet-down 2
85 echo bar-stopped >>"$OUT"
89 wait_script foo subnet-up 2
90 echo bar-started-2 >>"$OUT"
92 echo [STEP] Stop server node
96 wait_script foo tinc-down
98 echo [STEP] Check if the script output is what is expected
100 cat >"$OUT.expected" <<EOF
101 tinc-up netname,foo,dummy,,,,,,,,,5
102 subnet-up netname,foo,dummy,,foo,,,10.0.0.1,,,,5
103 subnet-up netname,foo,dummy,,foo,,,fec0::/64,,,,5
105 invitation-created netname2,foo,,,bar,,,,,$DIR_FOO/invitations/$file,$url,
107 invitation-accepted netname,foo,dummy,,bar,127.0.0.1,,,,,,5
109 host-up netname,foo,dummy,,bar,127.0.0.1,$port_bar,,,,,5
110 hosts/bar-up netname,foo,dummy,,bar,127.0.0.1,$port_bar,,,,,5
111 subnet-up netname,foo,dummy,,bar,127.0.0.1,$port_bar,10.0.0.2,,,,5
112 subnet-up netname,foo,dummy,,bar,127.0.0.1,$port_bar,fec0::/64,5,,,5
114 host-down netname,foo,dummy,,bar,127.0.0.1,$port_bar,,,,,4
115 hosts/bar-down netname,foo,dummy,,bar,127.0.0.1,$port_bar,,,,,4
116 subnet-down netname,foo,dummy,,bar,127.0.0.1,$port_bar,10.0.0.2,,,,4
117 subnet-down netname,foo,dummy,,bar,127.0.0.1,$port_bar,fec0::/64,5,,,4
119 host-up netname,foo,dummy,,bar,127.0.0.1,$port_bar,,,,,5
120 hosts/bar-up netname,foo,dummy,,bar,127.0.0.1,$port_bar,,,,,5
121 subnet-up netname,foo,dummy,,bar,127.0.0.1,$port_bar,10.0.0.2,,,,5
122 subnet-up netname,foo,dummy,,bar,127.0.0.1,$port_bar,fec0::/64,5,,,5
124 host-down netname,foo,dummy,,bar,127.0.0.1,$port_bar,,,,,5
125 hosts/bar-down netname,foo,dummy,,bar,127.0.0.1,$port_bar,,,,,5
126 subnet-down netname,foo,dummy,,bar,127.0.0.1,$port_bar,10.0.0.2,,,,5
127 subnet-down netname,foo,dummy,,bar,127.0.0.1,$port_bar,fec0::/64,5,,,5
128 subnet-down netname,foo,dummy,,foo,,,10.0.0.1,,,,5
129 subnet-down netname,foo,dummy,,foo,,,fec0::/64,,,,5
130 tinc-down netname,foo,dummy,,,,,,,,,5
133 diff -w "$OUT" "$OUT.expected"