forked from servalproject/serval-dna
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compatibility
executable file
·91 lines (83 loc) · 3.12 KB
/
compatibility
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
# Tests for network backwards compatibility
#
# Copyright 2012 Serval Project, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
source "${0%/*}/../testframework.sh"
source "${0%/*}/../testdefs.sh"
teardown() {
stop_all_servald_servers
kill_all_servald_processes
assert_no_servald_processes
report_all_servald_servers
}
doc_dna_090_version="Dna lookup of servald in Serval Mesh 0.90"
setup_dna_090_version() {
setup_servald
if ! [ -x "$SERVALD_090" ]; then
error "SERVALD_090 must point to a build being tested for compatibility"
return 1
fi
servald_binary=servald_090
cp "$SERVALD_090" "$SERVALD_VAR/$servald_binary"
export servaldA=$servald_binary
}
start_servald_090() {
# servald configuration and log output has changed, and will continue to change in future
# therefore the operations to start a version 0.90 servald instance are preserved here for future reference
executeOk_servald keyring add
assert [ -e "$SERVALINSTANCE_PATH/serval.keyring" ]
extract_stdout_keyvalue SIDA sid "$rexp_sid"
DIDA=5550001
NAMEA="Agent A. Smith"
executeOk_servald set did $SIDA $DIDA "$NAMEA"
SERVALD_SERVER_CHDIR="$instance_dir" SERVALD_LOG_FILE="$instance_servald_log" executeOk_servald start
wait_until grep "[Ii]nterface .* is up" "$instance_servald_log"
}
test_dna_090_version() {
local DUMMYNET="$SERVALD_VAR/dummy"
>$DUMMYNET
set_instance +A
executeOk_servald config \
set interfaces.0.dummy "$DUMMYNET" \
set debug.overlayframes on
start_servald_090
set_instance +B
executeOk_servald config \
set interfaces.1.file "$DUMMYNET" \
set debug.linkstate on \
set debug.overlayrouting on
create_single_identity
start_servald_server
wait_until grep "LINK STATE; new legacy neighbour $SIDA" "$instance_servald_log"
wait_until grep "REACHABLE VIA BROADCAST sid=$SIDA" "$instance_servald_log"
executeOk_servald route print
tfw_cat --stdout --stderr
assertStdoutGrep --stdout --matches=1 "^${SIDA}:BROADCAST .*:$DUMMYNET:0*\$"
set_instance +A
wait_until grep "PEER REACHABLE, sid=$SIDB" "$instance_servald_log"
executeOk_servald route print
tfw_cat --stdout --stderr
assertStdoutGrep --stdout --matches=1 "^${SIDB}:BROADCAST :0*\$"
executeOk_servald mdp ping $SIDB 1
tfw_cat --stdout --stderr
set_instance +B
executeOk_servald mdp ping $SIDA 1
tfw_cat --stdout --stderr
executeOk_servald dna lookup $DIDA
tfw_cat --stdout --stderr
}
runTests "$@"