2013-05-28 06:18:04 +00:00
|
|
|
#!/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
|
|
|
|
}
|
|
|
|
|
2013-07-08 06:31:58 +00:00
|
|
|
doc_dna_090_version="Dna lookup of servald in Serval Mesh 0.90"
|
|
|
|
setup_dna_090_version() {
|
2013-05-28 06:18:04 +00:00
|
|
|
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"
|
2013-07-08 06:31:58 +00:00
|
|
|
DIDA=5550001
|
|
|
|
NAMEA="Agent A. Smith"
|
2018-03-27 06:46:11 +00:00
|
|
|
executeOk_servald set did "$SIDA" "$DIDA" "$NAMEA"
|
2013-05-28 06:18:04 +00:00
|
|
|
SERVALD_SERVER_CHDIR="$instance_dir" SERVALD_LOG_FILE="$instance_servald_log" executeOk_servald start
|
|
|
|
wait_until grep "[Ii]nterface .* is up" "$instance_servald_log"
|
|
|
|
}
|
|
|
|
|
2013-07-08 06:31:58 +00:00
|
|
|
test_dna_090_version() {
|
2013-05-28 06:18:04 +00:00
|
|
|
local DUMMYNET="$SERVALD_VAR/dummy"
|
|
|
|
>$DUMMYNET
|
|
|
|
set_instance +A
|
|
|
|
executeOk_servald config \
|
|
|
|
set interfaces.0.dummy "$DUMMYNET" \
|
2013-07-08 06:31:58 +00:00
|
|
|
set debug.overlayframes on
|
2013-05-28 06:18:04 +00:00
|
|
|
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
|
2013-07-08 06:31:58 +00:00
|
|
|
assertStdoutGrep --stdout --matches=1 "^${SIDA}:BROADCAST .*:$DUMMYNET:0*\$"
|
2013-05-28 06:18:04 +00:00
|
|
|
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*\$"
|
2018-03-27 06:46:11 +00:00
|
|
|
executeOk_servald mdp ping "$SIDB" 1
|
2013-05-28 06:18:04 +00:00
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
set_instance +B
|
2018-03-27 06:46:11 +00:00
|
|
|
executeOk_servald mdp ping "$SIDA" 1
|
2013-05-28 06:18:04 +00:00
|
|
|
tfw_cat --stdout --stderr
|
2018-03-27 06:46:11 +00:00
|
|
|
executeOk_servald dna lookup "$DIDA"
|
2013-07-08 06:31:58 +00:00
|
|
|
tfw_cat --stdout --stderr
|
2013-05-28 06:18:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
runTests "$@"
|
|
|
|
|