2012-10-09 14:49:24 +10:30
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Tests for Route discovery
|
2013-02-06 18:55:31 +10:30
|
|
|
#
|
|
|
|
# Copyright 2012 Serval Project, Inc.
|
2012-10-09 14:49:24 +10:30
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2013-05-29 11:48:48 +09:30
|
|
|
|
2012-10-09 14:49:24 +10:30
|
|
|
source "${0%/*}/../testframework.sh"
|
|
|
|
source "${0%/*}/../testdefs.sh"
|
|
|
|
|
2012-12-08 15:09:41 +10:30
|
|
|
interface_up() {
|
2013-08-19 16:59:10 +09:30
|
|
|
$GREP "Interface .* is up" $instance_servald_log || return 1
|
|
|
|
return 0
|
2012-10-09 14:49:24 +10:30
|
|
|
}
|
|
|
|
|
2013-12-16 14:54:16 +10:30
|
|
|
link_matches() {
|
|
|
|
local interface_ex=".*"
|
2014-05-05 13:22:36 +09:30
|
|
|
local link_type="\(BROADCAST\|UNICAST\)"
|
2013-12-16 14:54:16 +10:30
|
|
|
local via="0*"
|
|
|
|
local sid=""
|
|
|
|
while [ $# -ne 0 ]; do
|
|
|
|
case "$1" in
|
|
|
|
--interface) interface_ex="$2"; shift 2;;
|
|
|
|
--broadcast) link_type="BROADCAST"; shift;;
|
|
|
|
--unicast) link_type="UNICAST"; shift;;
|
|
|
|
--via) link_type="INDIRECT"; via="$2"; interface_ex=""; shift 2;;
|
2014-05-05 13:22:36 +09:30
|
|
|
--any) via=".*"; link_type=".*"; shift;;
|
2013-12-16 14:54:16 +10:30
|
|
|
*) break;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
sid="$1"
|
|
|
|
tfw_log "Looking for link ${sid}, ${link_type}, ${interface_ex}, ${via}"
|
2018-03-21 18:01:33 +10:30
|
|
|
if ! $GREP "^${sid}:${link_type}:${interface_ex}:${via}:" "$TFWSTDOUT"; then
|
2013-07-08 17:12:56 +09:30
|
|
|
tfw_log "Link not found"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2013-12-16 14:54:16 +10:30
|
|
|
has_link() {
|
|
|
|
executeOk_servald route print
|
|
|
|
link_matches $@
|
|
|
|
}
|
|
|
|
|
2014-05-05 13:22:36 +09:30
|
|
|
has_no_link() {
|
2014-05-29 16:41:27 +09:30
|
|
|
has_link --any $@ || return 0
|
2014-05-05 13:22:36 +09:30
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2013-05-10 12:05:28 +09:30
|
|
|
path_exists() {
|
|
|
|
local dest
|
Refactor manifest: specific setter functions
Replace generic rhizome_manifest_set() and rhizome_manifest_set_ll()
with per-field setter functions, eg, rhizome_manifest_set_filesize().
Struct rhizome_manifest elements for all known fields, to replace the
use of rhizome_manifest_get() and rhizome_manifest_get_ll() everywhere:
sender, recipient, service, name, date, bundle_key.
Add boolean validity flags for binary blob types, to avoid having to compare
with many bytes of all-zero to detect presence, eg, has_sender, has_recipient,
has_author, has_bundle_key. These maintained by the setter functions.
Rename existing manifest struct elements to be the same as their field
names: fileLength -> filesize, journalTail -> tail.
More use of unsigned int, size_t and uint64_t for payload sizes, offsets, byte
counts, etc. especially in rhizome_store.c and meshms.c. More uniform use of
size_t to dimension memory buffers. Fix some printf(3) style format strings
for 64-bit correctness on 32-bit systems. Use new constant RHIZOME_SIZE_UNSET
instead of -1 to indicate unknown dimension, and explicitly assert its absence
before comparisons and arithmetic, for safety.
Replace some 'int' loop variables with 'unsigned' where appropriate.
Fix bugs discovered in MeshMS bundle private/public key generation and
bundle secret key handling for export/extract commands.
Instrument the first MeshMS test case to aid debugging.
New debug config flag: debug.manifest logs all modifications to all manifest
fields by setter functions.
Rename debug config flag: debug.rhizome_bind -> debug.rhizome_sql_bind.
2013-10-30 23:22:19 +10:30
|
|
|
eval dest=\$$#
|
2013-05-10 12:05:28 +09:30
|
|
|
local dest_sidvar=SID${dest#+}
|
2014-05-30 14:55:25 +09:30
|
|
|
local first_inst=$1
|
|
|
|
local next_inst=$first_inst
|
2013-05-10 12:05:28 +09:30
|
|
|
shift
|
Refactor manifest: specific setter functions
Replace generic rhizome_manifest_set() and rhizome_manifest_set_ll()
with per-field setter functions, eg, rhizome_manifest_set_filesize().
Struct rhizome_manifest elements for all known fields, to replace the
use of rhizome_manifest_get() and rhizome_manifest_get_ll() everywhere:
sender, recipient, service, name, date, bundle_key.
Add boolean validity flags for binary blob types, to avoid having to compare
with many bytes of all-zero to detect presence, eg, has_sender, has_recipient,
has_author, has_bundle_key. These maintained by the setter functions.
Rename existing manifest struct elements to be the same as their field
names: fileLength -> filesize, journalTail -> tail.
More use of unsigned int, size_t and uint64_t for payload sizes, offsets, byte
counts, etc. especially in rhizome_store.c and meshms.c. More uniform use of
size_t to dimension memory buffers. Fix some printf(3) style format strings
for 64-bit correctness on 32-bit systems. Use new constant RHIZOME_SIZE_UNSET
instead of -1 to indicate unknown dimension, and explicitly assert its absence
before comparisons and arithmetic, for safety.
Replace some 'int' loop variables with 'unsigned' where appropriate.
Fix bugs discovered in MeshMS bundle private/public key generation and
bundle secret key handling for export/extract commands.
Instrument the first MeshMS test case to aid debugging.
New debug config flag: debug.manifest logs all modifications to all manifest
fields by setter functions.
Rename debug config flag: debug.rhizome_bind -> debug.rhizome_sql_bind.
2013-10-30 23:22:19 +10:30
|
|
|
local I
|
2013-05-10 12:05:28 +09:30
|
|
|
for I; do
|
|
|
|
local sidvar=SID${I#+}
|
|
|
|
[ -n "${!sidvar}" ] || break
|
2013-12-16 14:54:16 +10:30
|
|
|
set_instance $next_inst
|
|
|
|
executeOk_servald route print
|
|
|
|
link_matches ${!sidvar} || return 1
|
2014-09-23 14:15:08 +09:30
|
|
|
[ $I = $dest ] && break
|
2013-12-16 14:54:16 +10:30
|
|
|
link_matches --via ${!sidvar} ${!dest_sidvar} || return 1
|
2013-05-10 12:05:28 +09:30
|
|
|
next_inst=$I
|
|
|
|
done
|
2014-05-30 14:55:25 +09:30
|
|
|
# so we think this path should exist, check that it works
|
|
|
|
set_instance $first_inst
|
2015-04-07 13:56:19 +09:30
|
|
|
executeOk_servald mdp trace --timeout=20 "${!dest_sidvar}"
|
2014-09-23 14:15:08 +09:30
|
|
|
# assertStdoutGrep "^[0-9]+:${!dest_sidvar}\$"
|
2014-05-30 14:55:25 +09:30
|
|
|
tfw_cat --stdout
|
2013-05-10 12:05:28 +09:30
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2013-12-16 14:54:16 +10:30
|
|
|
configure_servald_server() {
|
2012-12-06 12:31:19 +10:30
|
|
|
executeOk_servald config \
|
2013-04-12 17:18:25 +09:30
|
|
|
set debug.mdprequests yes \
|
2013-04-29 10:06:22 +09:30
|
|
|
set debug.linkstate yes \
|
2018-03-21 18:01:33 +10:30
|
|
|
set debug.subscriber yes \
|
2013-04-30 16:35:45 +09:30
|
|
|
set debug.verbose yes \
|
2013-05-01 16:20:04 +09:30
|
|
|
set debug.overlayrouting yes \
|
2013-05-24 13:52:31 +09:30
|
|
|
set log.console.level debug \
|
|
|
|
set log.console.show_pid on \
|
|
|
|
set log.console.show_time on \
|
2012-12-11 09:56:21 +10:30
|
|
|
set rhizome.enable no
|
2012-10-09 14:49:24 +10:30
|
|
|
}
|
|
|
|
|
2012-11-26 14:40:22 +10:30
|
|
|
log_routing_table() {
|
|
|
|
executeOk_servald route print
|
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2012-10-09 14:49:24 +10:30
|
|
|
teardown() {
|
2012-11-26 14:40:22 +10:30
|
|
|
foreach_instance_with_pidfile log_routing_table
|
2012-10-09 14:49:24 +10:30
|
|
|
stop_all_servald_servers
|
|
|
|
kill_all_servald_processes
|
|
|
|
assert_no_servald_processes
|
2012-11-26 14:40:22 +10:30
|
|
|
report_all_servald_servers
|
2012-10-09 14:49:24 +10:30
|
|
|
}
|
|
|
|
|
2013-02-14 16:02:09 +10:30
|
|
|
doc_single_link="Start 2 instances on one link"
|
2012-10-09 14:49:24 +10:30
|
|
|
setup_single_link() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
2013-12-13 17:48:58 +10:30
|
|
|
foreach_instance +A +B add_servald_interface 1
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B start_servald_server
|
2012-10-09 14:49:24 +10:30
|
|
|
}
|
|
|
|
test_single_link() {
|
2013-08-08 15:20:31 +09:30
|
|
|
wait_until --timeout=10 path_exists +A +B
|
|
|
|
wait_until --timeout=5 path_exists +B +A
|
2012-10-09 14:49:24 +10:30
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDA" 1
|
2014-01-29 15:39:12 +10:30
|
|
|
tfw_cat --stdout --stderr
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDB" 1
|
2012-10-09 16:09:33 +10:30
|
|
|
tfw_cat --stdout --stderr
|
2012-10-09 14:49:24 +10:30
|
|
|
}
|
|
|
|
|
2013-04-08 10:03:25 +09:30
|
|
|
doc_multiple_ids="Route between multiple identities"
|
|
|
|
setup_multiple_ids() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_identities 2
|
2014-05-30 14:55:25 +09:30
|
|
|
SIDA=$SIDA1
|
|
|
|
SIDB=$SIDB1
|
2013-12-13 17:48:58 +10:30
|
|
|
foreach_instance +A +B add_servald_interface 1
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B start_servald_server
|
2013-04-08 10:03:25 +09:30
|
|
|
}
|
|
|
|
test_multiple_ids() {
|
2013-12-16 14:54:16 +10:30
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until has_link --any "$SIDB1"
|
|
|
|
wait_until has_link --any "$SIDB2"
|
2013-12-16 14:54:16 +10:30
|
|
|
set_instance +B
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until has_link --any "$SIDA1"
|
|
|
|
wait_until has_link --any "$SIDA2"
|
2013-04-08 10:03:25 +09:30
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDB1" 1
|
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDB2" 1
|
2013-04-08 10:03:25 +09:30
|
|
|
set_instance +B
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDA1" 1
|
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDA2" 1
|
2013-04-08 10:03:25 +09:30
|
|
|
}
|
|
|
|
|
2013-10-10 15:59:44 +10:30
|
|
|
doc_unlock_ids="Routes appear and disappear as identities are [un]locked"
|
|
|
|
setup_unlock_ids() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
2013-12-13 17:48:58 +10:30
|
|
|
foreach_instance +A +B add_servald_interface 1
|
2013-10-10 15:59:44 +10:30
|
|
|
set_instance +A
|
|
|
|
executeOk_servald keyring add 'entry-pin'
|
|
|
|
extract_stdout_keyvalue SIDX sid "$rexp_sid"
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B start_servald_server
|
2013-10-10 15:59:44 +10:30
|
|
|
}
|
|
|
|
test_unlock_ids() {
|
|
|
|
wait_until path_exists +A +B
|
|
|
|
wait_until path_exists +B +A
|
|
|
|
set_instance +A
|
|
|
|
executeOk_servald id enter pin 'entry-pin'
|
2013-12-16 14:54:16 +10:30
|
|
|
set_instance +B
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until has_link --via "$SIDA" "$SIDX"
|
2013-10-10 15:59:44 +10:30
|
|
|
set_instance +A
|
2013-10-14 15:40:42 +10:30
|
|
|
executeOk_servald id relinquish pin 'entry-pin'
|
2013-10-10 15:59:44 +10:30
|
|
|
set_instance +B
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until --timeout=30 has_no_link "$SIDX"
|
2013-10-10 15:59:44 +10:30
|
|
|
}
|
|
|
|
|
|
|
|
doc_migrate_id="Unlocking the same identity triggers migration"
|
|
|
|
setup_migrate_id() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
set_instance +A
|
|
|
|
executeOk_servald keyring add 'entry-pin'
|
|
|
|
extract_stdout_keyvalue SIDX sid "$rexp_sid"
|
|
|
|
executeOk_servald keyring dump --entry-pin=entry-pin --secret sidx
|
|
|
|
tfw_cat sidx
|
|
|
|
set_instance +B
|
2014-10-31 15:00:52 +10:30
|
|
|
executeOk_servald keyring load sidx 'entry-pin'
|
2013-10-10 15:59:44 +10:30
|
|
|
foreach_instance +A +B create_single_identity
|
2013-12-13 17:48:58 +10:30
|
|
|
foreach_instance +A +B add_servald_interface 1
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B start_servald_server
|
2013-10-10 15:59:44 +10:30
|
|
|
}
|
|
|
|
test_migrate_id() {
|
2014-10-31 15:00:52 +10:30
|
|
|
wait_until --timeout=10 path_exists +A +B
|
|
|
|
wait_until --timeout=10 path_exists +B +A
|
2013-10-10 15:59:44 +10:30
|
|
|
set_instance +A
|
|
|
|
executeOk_servald id enter pin 'entry-pin'
|
2013-12-16 14:54:16 +10:30
|
|
|
set_instance +B
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until --timeout=10 has_link --via "$SIDA" "$SIDX"
|
2013-10-10 15:59:44 +10:30
|
|
|
set_instance +B
|
|
|
|
executeOk_servald id enter pin 'entry-pin'
|
2013-12-16 14:54:16 +10:30
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until --timeout=10 has_link --via "$SIDB" "$SIDX"
|
2013-10-10 15:59:44 +10:30
|
|
|
}
|
|
|
|
|
2013-02-14 14:18:56 +10:30
|
|
|
doc_single_mdp="Use single MDP per packet encapsulation"
|
|
|
|
setup_single_mdp() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
2013-12-13 17:48:58 +10:30
|
|
|
foreach_instance +A +B add_servald_interface 1
|
2015-03-16 12:22:38 +10:30
|
|
|
foreach_instance +A +B executeOk_servald config \
|
|
|
|
set interfaces.1.broadcast.encapsulation single \
|
|
|
|
set interfaces.1.unicast.encapsulation single
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B start_servald_server
|
2013-02-14 14:18:56 +10:30
|
|
|
}
|
|
|
|
test_single_mdp() {
|
2013-05-10 12:05:28 +09:30
|
|
|
wait_until path_exists +A +B
|
|
|
|
wait_until path_exists +B +A
|
2013-02-14 14:18:56 +10:30
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDB" 1
|
2013-02-14 14:18:56 +10:30
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
|
|
|
doc_mismatched_encap="Mismatched MDP packet encapsulation"
|
|
|
|
setup_mismatched_encap() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
2013-12-13 17:48:58 +10:30
|
|
|
foreach_instance +A +B add_servald_interface 1
|
2015-03-16 12:22:38 +10:30
|
|
|
foreach_instance +A executeOk_servald config \
|
|
|
|
set interfaces.1.broadcast.encapsulation single \
|
|
|
|
set interfaces.1.unicast.encapsulation single
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B start_servald_server
|
2013-02-14 14:18:56 +10:30
|
|
|
}
|
|
|
|
test_mismatched_encap() {
|
2013-05-10 12:05:28 +09:30
|
|
|
wait_until path_exists +A +B
|
|
|
|
wait_until path_exists +B +A
|
2013-02-14 14:18:56 +10:30
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDB" 1
|
2013-02-14 14:18:56 +10:30
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2013-07-16 15:16:07 +09:30
|
|
|
doc_single_p2p="Start 2 instances on a point to point link"
|
|
|
|
setup_single_p2p() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
2013-12-13 17:48:58 +10:30
|
|
|
foreach_instance +A +B add_servald_interface 1
|
2013-07-16 15:16:07 +09:30
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config \
|
2015-03-16 12:22:38 +10:30
|
|
|
set interfaces.1.broadcast.encapsulation single \
|
|
|
|
set interfaces.1.unicast.send off \
|
2013-07-16 15:16:07 +09:30
|
|
|
set interfaces.1.point_to_point on
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B start_servald_server
|
2013-07-16 15:16:07 +09:30
|
|
|
}
|
|
|
|
test_single_p2p() {
|
|
|
|
wait_until path_exists +A +B
|
|
|
|
wait_until path_exists +B +A
|
|
|
|
assertGrep "$instance_servald_log" 'Established point to point link'
|
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDB" 1
|
2013-07-16 15:16:07 +09:30
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2013-11-25 12:54:29 +10:30
|
|
|
start_fakeradio() {
|
2018-03-27 17:16:11 +10:30
|
|
|
"$servald_build_root/fakeradio" 4 1 > "$SERVALD_VAR/radioout" 2> "$SERVALD_VAR/radioerr" &
|
2013-11-25 12:54:29 +10:30
|
|
|
FAKERADIO_PID=$!
|
|
|
|
wait_until $GREP "^right:" "$SERVALD_VAR/radioout"
|
2016-01-26 23:56:27 +10:30
|
|
|
local _line=`head -n 1 "$SERVALD_VAR/radioout"`
|
2013-11-25 12:54:29 +10:30
|
|
|
END1="${_line#*:}"
|
2016-01-26 23:56:27 +10:30
|
|
|
_line=`tail -n 1 "$SERVALD_VAR/radioout"`
|
2013-11-25 12:54:29 +10:30
|
|
|
END2="${_line#*:}"
|
|
|
|
tfw_log "Started fakeradio pid=$FAKERADIO_PID, end1=$END1, end2=$END2"
|
|
|
|
}
|
2013-02-20 10:21:56 +10:30
|
|
|
|
2013-08-19 16:59:10 +09:30
|
|
|
doc_simulate_extender="Simulate a mesh extender radio link"
|
|
|
|
setup_simulate_extender() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
2013-11-25 12:54:29 +10:30
|
|
|
start_fakeradio
|
2013-08-19 16:59:10 +09:30
|
|
|
set_instance +A
|
|
|
|
executeOk_servald config \
|
|
|
|
set interfaces.1.file "$END1"
|
|
|
|
set_instance +B
|
|
|
|
executeOk_servald config \
|
|
|
|
set interfaces.1.file "$END2"
|
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config \
|
2013-08-27 20:43:56 +09:30
|
|
|
set debug.packetradio on \
|
2013-10-30 17:09:37 +10:30
|
|
|
set debug.radio_link on \
|
2013-08-19 16:59:10 +09:30
|
|
|
set interfaces.1.type CATEAR \
|
2015-03-16 12:22:38 +10:30
|
|
|
set interfaces.1.broadcast.tick_ms 5000 \
|
2016-05-10 11:01:37 +09:30
|
|
|
set interfaces.1.idle_tick_ms 5000 \
|
2013-08-19 16:59:10 +09:30
|
|
|
set interfaces.1.socket_type STREAM \
|
2015-03-16 12:22:38 +10:30
|
|
|
set interfaces.1.broadcast.encapsulation SINGLE \
|
2013-10-08 16:36:07 +10:30
|
|
|
set interfaces.1.point_to_point on
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B start_servald_server
|
2013-08-19 16:59:10 +09:30
|
|
|
}
|
|
|
|
test_simulate_extender() {
|
|
|
|
wait_until path_exists +A +B
|
|
|
|
wait_until path_exists +B +A
|
2013-08-27 20:43:56 +09:30
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDB" 1
|
2013-08-27 20:43:56 +09:30
|
|
|
tfw_cat --stdout --stderr
|
2013-08-19 16:59:10 +09:30
|
|
|
}
|
|
|
|
teardown_simulate_extender() {
|
|
|
|
teardown
|
|
|
|
tfw_log "Killing fakeradio, pid=$FAKERADIO_PID"
|
|
|
|
kill $FAKERADIO_PID
|
|
|
|
tfw_cat "$SERVALD_VAR/radioerr"
|
|
|
|
}
|
|
|
|
|
2015-03-30 14:15:08 +10:30
|
|
|
doc_lowband_broadcast="Link detection over low bandwith links"
|
2015-03-16 12:22:38 +10:30
|
|
|
setup_lowband_broadcast() {
|
|
|
|
setup_servald
|
|
|
|
foreach_instance +A +B create_single_identity
|
|
|
|
foreach_instance +A +B add_servald_interface 1
|
|
|
|
foreach_instance +A +B executeOk_servald config \
|
2015-03-30 14:15:08 +10:30
|
|
|
set interfaces.1.broadcast.packet_interval 2000000 \
|
|
|
|
set interfaces.1.broadcast.transmit_timeout_ms 6200 \
|
2015-03-16 12:22:38 +10:30
|
|
|
set interfaces.1.broadcast.tick_ms 15000 \
|
2016-05-10 11:01:37 +09:30
|
|
|
set interfaces.1.idle_tick_ms 30000 \
|
2015-03-30 14:15:08 +10:30
|
|
|
set interfaces.1.broadcast.mtu 210 \
|
2015-03-16 12:22:38 +10:30
|
|
|
set interfaces.1.broadcast.route off \
|
|
|
|
set interfaces.1.unicast.send off
|
|
|
|
foreach_instance +A +B start_servald_server
|
|
|
|
}
|
|
|
|
test_lowband_broadcast() {
|
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --interval=3 --timeout=6 "$SIDB" 3
|
2015-03-16 12:22:38 +10:30
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2014-05-02 14:02:25 +09:30
|
|
|
_simulator() {
|
|
|
|
# TODO timeout & failure reporting?
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk --timeout=120 --error-on-fail "$servald_build_root/simulator" <$SIM_IN
|
2014-05-02 14:02:25 +09:30
|
|
|
tfw_cat --stdout --stderr
|
2018-03-27 17:16:11 +10:30
|
|
|
rm "$SIM_IN"
|
2014-05-02 14:02:25 +09:30
|
|
|
}
|
|
|
|
start_simulator() {
|
|
|
|
SIM_IN="$PWD/SIM_IN"
|
|
|
|
mkfifo "$SIM_IN"
|
|
|
|
exec 8<>"$SIM_IN" # stop fifo from blocking
|
|
|
|
fork %simulator _simulator
|
|
|
|
}
|
|
|
|
simulator_command() {
|
|
|
|
tfw_log "$@"
|
|
|
|
assert_fork_is_running %simulator
|
|
|
|
echo "$@" >>"$SIM_IN"
|
|
|
|
}
|
|
|
|
simulator_quit() {
|
|
|
|
simulator_command quit
|
|
|
|
fork_wait %simulator
|
|
|
|
}
|
|
|
|
|
2013-02-14 16:02:09 +10:30
|
|
|
doc_multiple_nodes="Multiple nodes on one link"
|
2012-11-30 13:45:08 +10:30
|
|
|
setup_multiple_nodes() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B +C +D create_single_identity
|
2013-12-13 17:48:58 +10:30
|
|
|
foreach_instance +A +B +C +D add_servald_interface 1
|
2014-05-02 14:02:25 +09:30
|
|
|
start_simulator
|
|
|
|
simulator_command create "net" "$SERVALD_VAR/dummy1/"
|
2014-05-30 14:55:25 +09:30
|
|
|
# note if we need to force broadcast packets so that the routes stabilise quickly
|
|
|
|
foreach_instance +A +B +C +D executeOk_servald config \
|
|
|
|
set interfaces.1.prefer_unicast 0
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B +C +D start_servald_server
|
2012-11-30 13:45:08 +10:30
|
|
|
}
|
|
|
|
test_multiple_nodes() {
|
2014-05-02 14:02:25 +09:30
|
|
|
simulator_command set "net" "latency" "100"
|
|
|
|
simulator_command up "net"
|
|
|
|
wait_until --timeout=10 path_exists +A +B
|
|
|
|
wait_until --timeout=5 path_exists +A +C
|
|
|
|
wait_until --timeout=5 path_exists +A +D
|
|
|
|
wait_until --timeout=5 path_exists +B +A
|
|
|
|
wait_until --timeout=5 path_exists +C +A
|
|
|
|
wait_until --timeout=5 path_exists +D +A
|
2012-11-30 13:45:08 +10:30
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDB" 1
|
2012-11-30 13:45:08 +10:30
|
|
|
tfw_cat --stdout --stderr
|
2014-05-02 14:02:25 +09:30
|
|
|
simulator_command set "net" "latency" "150"
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDC" 1
|
2012-11-30 13:45:08 +10:30
|
|
|
tfw_cat --stdout --stderr
|
2014-05-02 14:02:25 +09:30
|
|
|
simulator_command set "net" "latency" "200"
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDD" 1
|
2012-11-30 13:45:08 +10:30
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
2014-05-02 14:02:25 +09:30
|
|
|
finally_multiple_nodes() {
|
|
|
|
simulator_quit
|
|
|
|
}
|
2012-11-30 13:45:08 +10:30
|
|
|
|
2013-08-09 12:18:14 +09:30
|
|
|
doc_scan="Network scan with isolated clients"
|
2012-12-08 15:09:41 +10:30
|
|
|
setup_scan() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
2013-08-09 16:19:45 +09:30
|
|
|
foreach_instance +A +B +C create_single_identity
|
2013-12-13 17:48:58 +10:30
|
|
|
foreach_instance +A +B +C add_servald_interface --file 1
|
2013-08-09 16:19:45 +09:30
|
|
|
foreach_instance +A +B +C \
|
2012-12-08 15:09:41 +10:30
|
|
|
executeOk_servald config \
|
2015-03-16 12:22:38 +10:30
|
|
|
set interfaces.1.broadcast.drop on
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B +C start_servald_server
|
|
|
|
foreach_instance +A +B +C \
|
|
|
|
wait_until interface_up
|
2012-12-08 15:09:41 +10:30
|
|
|
}
|
|
|
|
test_scan() {
|
2012-12-11 09:56:21 +10:30
|
|
|
set_instance +A
|
|
|
|
executeOk_servald scan
|
2015-03-30 16:30:10 +10:30
|
|
|
wait_until --timeout=10 scan_completed
|
2016-09-27 15:51:23 +09:30
|
|
|
wait_until --timeout=10 path_exists +B +A +C
|
|
|
|
wait_until --timeout=10 path_exists +C +A +B
|
|
|
|
|
|
|
|
set_instance +A
|
2013-08-09 16:19:45 +09:30
|
|
|
wait_until --timeout=10 has_seen_instances +B +C
|
|
|
|
executeOk_servald route print
|
2018-03-27 17:16:11 +10:30
|
|
|
link_matches --unicast "$SIDB"
|
|
|
|
link_matches --unicast "$SIDC"
|
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDB" 1
|
2012-12-14 12:14:55 +10:30
|
|
|
tfw_cat --stdout --stderr
|
2016-09-27 15:51:23 +09:30
|
|
|
|
2013-08-09 16:19:45 +09:30
|
|
|
set_instance +B
|
2012-12-11 09:56:21 +10:30
|
|
|
executeOk_servald route print
|
2018-03-27 17:16:11 +10:30
|
|
|
link_matches --unicast "$SIDA"
|
|
|
|
link_matches --via "$SIDA" "$SIDC"
|
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDC" 1
|
2013-08-09 16:19:45 +09:30
|
|
|
tfw_cat --stdout --stderr
|
2012-12-08 15:09:41 +10:30
|
|
|
}
|
|
|
|
|
2013-08-12 14:21:31 +09:30
|
|
|
doc_scan_one="Network scan a single address"
|
|
|
|
setup_scan_one() {
|
|
|
|
setup_scan
|
|
|
|
}
|
|
|
|
test_scan_one() {
|
|
|
|
set_instance +A
|
|
|
|
executeOk_servald scan 127.0.1.2
|
|
|
|
wait_until scan_completed
|
|
|
|
wait_until --timeout=10 has_seen_instances +B
|
|
|
|
executeOk_servald route print
|
2018-03-27 17:16:11 +10:30
|
|
|
link_matches --unicast "$SIDB"
|
2013-08-12 14:21:31 +09:30
|
|
|
assertStdoutGrep --matches=0 "^$SIDC:"
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDB" 1
|
2013-08-12 14:21:31 +09:30
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2016-01-20 17:00:08 +10:30
|
|
|
setup_fixedAddress() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
|
|
|
foreach_instance +A +B executeOk_servald config \
|
|
|
|
set server.interface_path "$SERVALD_VAR" \
|
|
|
|
set interfaces.0.file dummy1 \
|
|
|
|
set interfaces.0.socket_type file \
|
|
|
|
set interfaces.0.type wifi \
|
|
|
|
set interfaces.0.broadcast.send off \
|
|
|
|
set interfaces.0.broadcast.drop on \
|
|
|
|
set interfaces.0.default_route 1 \
|
|
|
|
set interfaces.0.dummy_netmask 255.255.255.0
|
|
|
|
set_instance +A
|
|
|
|
executeOk_servald config \
|
|
|
|
set hosts.$SIDB.address 10.0.2.1 \
|
|
|
|
set interfaces.0.dummy_address 10.0.1.1
|
|
|
|
set_instance +B
|
|
|
|
executeOk_servald config \
|
|
|
|
set interfaces.0.dummy_address 10.0.2.1
|
|
|
|
touch "$SERVALD_VAR/dummy1"
|
|
|
|
foreach_instance +A +B start_servald_server
|
|
|
|
foreach_instance +A +B \
|
|
|
|
wait_until interface_up
|
|
|
|
}
|
|
|
|
doc_fixedAddress="Establish a link from a configured fixed address"
|
|
|
|
test_fixedAddress() {
|
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDB" 5
|
2016-01-20 17:00:08 +10:30
|
|
|
tfw_cat --stdout
|
|
|
|
wait_until path_exists +A +B
|
|
|
|
}
|
|
|
|
|
2013-02-14 16:02:09 +10:30
|
|
|
scan_completed() {
|
2018-03-27 17:16:11 +10:30
|
|
|
$GREP "Scan completed" "$instance_servald_log" || return 1
|
2013-02-14 16:02:09 +10:30
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2013-05-29 11:48:48 +09:30
|
|
|
doc_single_filter="Single device with a broadcast filter"
|
|
|
|
setup_single_filter() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
2013-12-13 17:48:58 +10:30
|
|
|
foreach_instance +A +B add_servald_interface --file 1
|
2013-05-29 11:48:48 +09:30
|
|
|
set_instance +B
|
|
|
|
executeOk_servald config \
|
2015-03-16 12:22:38 +10:30
|
|
|
set interfaces.1.broadcast.drop on
|
2014-05-23 15:59:57 +09:30
|
|
|
set_instance +A
|
|
|
|
executeOk_servald config \
|
2015-03-16 12:22:38 +10:30
|
|
|
set interfaces.1.unicast.drop on
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B start_servald_server
|
2013-05-29 11:48:48 +09:30
|
|
|
}
|
|
|
|
test_single_filter() {
|
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until --timeout=10 has_link --unicast "$SIDB"
|
2013-12-16 14:54:16 +10:30
|
|
|
set_instance +B
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until --timeout=5 has_link --broadcast "$SIDA"
|
2014-01-29 15:39:12 +10:30
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDB" 1
|
2013-05-29 11:48:48 +09:30
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2013-02-14 16:02:09 +10:30
|
|
|
doc_broadcast_only="Broadcast packets only"
|
2013-01-29 11:57:13 +11:00
|
|
|
setup_broadcast_only() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
2014-05-02 14:02:25 +09:30
|
|
|
foreach_instance +A +B add_servald_interface 1
|
|
|
|
start_simulator
|
|
|
|
simulator_command create "net" "$SERVALD_VAR/dummy1/"
|
|
|
|
simulator_command set "net" "drop_unicast" "1"
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B start_servald_server
|
2013-01-29 11:57:13 +11:00
|
|
|
}
|
|
|
|
test_broadcast_only() {
|
2014-05-02 14:02:25 +09:30
|
|
|
simulator_command up "net"
|
2013-12-16 14:54:16 +10:30
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until has_link --broadcast "$SIDB"
|
2013-12-16 14:54:16 +10:30
|
|
|
set_instance +B
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until has_link --broadcast "$SIDA"
|
2013-01-29 11:57:13 +11:00
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDB" 1
|
2013-01-29 11:57:13 +11:00
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
2014-05-02 14:02:25 +09:30
|
|
|
finally_broadcast_only() {
|
|
|
|
simulator_quit
|
|
|
|
}
|
2013-01-29 11:57:13 +11:00
|
|
|
|
2013-02-14 16:02:09 +10:30
|
|
|
doc_prefer_unicast="Prefer unicast packets"
|
2013-01-29 11:57:13 +11:00
|
|
|
setup_prefer_unicast() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
2013-12-13 17:48:58 +10:30
|
|
|
foreach_instance +A +B add_servald_interface 1
|
2013-01-29 11:57:13 +11:00
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config \
|
|
|
|
set interfaces.1.prefer_unicast 1 \
|
|
|
|
set debug.overlayframes 1
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B start_servald_server
|
2013-01-29 11:57:13 +11:00
|
|
|
}
|
|
|
|
test_prefer_unicast() {
|
2013-12-16 14:54:16 +10:30
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until has_link --unicast "$SIDB"
|
2013-12-16 14:54:16 +10:30
|
|
|
set_instance +B
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until has_link --unicast "$SIDA"
|
2013-05-29 11:48:48 +09:30
|
|
|
wait_until path_exists +A +B
|
|
|
|
wait_until path_exists +B +A
|
2013-01-29 11:57:13 +11:00
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDB" 1
|
2013-01-29 11:57:13 +11:00
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2014-05-23 15:59:57 +09:30
|
|
|
doc_prefer_broadcast="Prefer broadcast packets"
|
|
|
|
setup_prefer_broadcast() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
|
|
|
foreach_instance +A +B add_servald_interface 1
|
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config \
|
|
|
|
set interfaces.1.prefer_unicast 0 \
|
|
|
|
set debug.overlayframes 1
|
|
|
|
foreach_instance +A +B start_servald_server
|
|
|
|
}
|
|
|
|
test_prefer_broadcast() {
|
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until has_link --broadcast "$SIDB"
|
2014-05-23 15:59:57 +09:30
|
|
|
set_instance +B
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until has_link --broadcast "$SIDA"
|
2014-05-23 15:59:57 +09:30
|
|
|
wait_until path_exists +A +B
|
|
|
|
wait_until path_exists +B +A
|
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDB" 1
|
2014-05-23 15:59:57 +09:30
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2013-02-14 16:02:09 +10:30
|
|
|
doc_multihop_linear="Start 4 instances in a linear arrangement"
|
2012-10-09 14:49:24 +10:30
|
|
|
setup_multihop_linear() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B +C +D create_single_identity
|
2013-12-13 17:48:58 +10:30
|
|
|
foreach_instance +A +B add_servald_interface 1
|
|
|
|
foreach_instance +B +C add_servald_interface 2
|
|
|
|
foreach_instance +C +D add_servald_interface 3
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B +C +D start_servald_server
|
2012-10-09 14:49:24 +10:30
|
|
|
}
|
|
|
|
test_multihop_linear() {
|
2013-05-10 12:05:28 +09:30
|
|
|
wait_until path_exists +A +B +C +D
|
|
|
|
wait_until path_exists +D +C +B +A
|
2012-10-09 14:49:24 +10:30
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald --stdout --stderr mdp ping --timeout=3 "$SIDD" 1
|
2012-10-09 16:09:33 +10:30
|
|
|
tfw_cat --stdout --stderr
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp trace "$SIDD"
|
2014-09-23 14:15:08 +09:30
|
|
|
tfw_cat --stdout --stderr
|
2013-05-10 12:05:28 +09:30
|
|
|
assertStdoutGrep --matches=1 "^0:$SIDA\$"
|
|
|
|
assertStdoutGrep --matches=1 "^1:$SIDB\$"
|
|
|
|
assertStdoutGrep --matches=1 "^2:$SIDC\$"
|
|
|
|
assertStdoutGrep --matches=1 "^3:$SIDD\$"
|
|
|
|
assertStdoutGrep --matches=1 "^4:$SIDC\$"
|
|
|
|
assertStdoutGrep --matches=1 "^5:$SIDB\$"
|
|
|
|
assertStdoutGrep --matches=1 "^6:$SIDA\$"
|
2012-10-09 14:49:24 +10:30
|
|
|
}
|
|
|
|
|
2013-08-09 16:19:45 +09:30
|
|
|
doc_unicast_route="Route across unicast links"
|
|
|
|
setup_unicast_route() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B +C +D create_single_identity
|
2013-12-13 17:48:58 +10:30
|
|
|
foreach_instance +A +B add_servald_interface --file 1
|
|
|
|
foreach_instance +B +C add_servald_interface --file 2
|
|
|
|
foreach_instance +C +D add_servald_interface --file 3
|
2013-08-09 16:19:45 +09:30
|
|
|
set_instance +A
|
|
|
|
executeOk_servald config \
|
2015-03-16 12:22:38 +10:30
|
|
|
set interfaces.1.broadcast.drop on
|
2013-08-09 16:19:45 +09:30
|
|
|
set_instance +C
|
|
|
|
executeOk_servald config \
|
2015-03-16 12:22:38 +10:30
|
|
|
set interfaces.2.broadcast.drop on \
|
|
|
|
set interfaces.3.broadcast.drop on
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B +C +D start_servald_server
|
2013-08-09 16:19:45 +09:30
|
|
|
}
|
|
|
|
test_unicast_route() {
|
|
|
|
wait_until --timeout=20 path_exists +A +B +C +D
|
|
|
|
wait_until --timeout=5 path_exists +D +C +B +A
|
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 "$SIDD" 1
|
2013-08-09 16:19:45 +09:30
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2013-04-29 17:07:36 +09:30
|
|
|
setup_offline() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B +C +D create_single_identity
|
2013-12-13 17:48:58 +10:30
|
|
|
foreach_instance +A +B +C add_servald_interface 1
|
|
|
|
foreach_instance +A +B +D add_servald_interface 2
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B +C +D start_servald_server
|
2013-04-29 17:07:36 +09:30
|
|
|
}
|
|
|
|
|
|
|
|
instance_offline() {
|
|
|
|
local I N
|
|
|
|
for I; do
|
2018-03-27 17:16:11 +10:30
|
|
|
[ "$I" = "$instance_arg" ] && continue
|
2013-04-29 17:07:36 +09:30
|
|
|
for ((N=1; 1; ++N)); do
|
2018-03-27 17:16:11 +10:30
|
|
|
local sidvar="SID${I#+}$N"
|
2013-04-29 17:07:36 +09:30
|
|
|
[ -n "${!sidvar}" ] || break
|
2014-05-05 13:22:36 +09:30
|
|
|
tfw_log "Checking if $I is offline for $instance_arg"
|
2018-03-27 17:16:11 +10:30
|
|
|
has_no_link "${!sidvar}" || return 1
|
2013-04-29 17:07:36 +09:30
|
|
|
done
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
doc_offline="One node going offline"
|
|
|
|
test_offline() {
|
|
|
|
foreach_instance +A +B +C +D \
|
|
|
|
wait_until has_seen_instances +A +B +C +D
|
|
|
|
stop_servald_server +C
|
|
|
|
foreach_instance +A +B +D \
|
|
|
|
wait_until --timeout=30 instance_offline +C
|
|
|
|
}
|
|
|
|
|
2015-11-16 13:47:28 +10:30
|
|
|
doc_lose_neighbours="Lose and regain neighbours due to network timeout"
|
2013-05-31 11:32:13 +09:30
|
|
|
setup_lose_neighbours() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
2014-05-02 14:02:25 +09:30
|
|
|
start_simulator
|
|
|
|
simulator_command create "net1" "$SERVALD_VAR/dummy1/"
|
|
|
|
simulator_command create "net2" "$SERVALD_VAR/dummy2/"
|
2013-05-31 11:32:13 +09:30
|
|
|
foreach_instance +A +B +C create_single_identity
|
2013-12-13 17:48:58 +10:30
|
|
|
foreach_instance +A +B add_servald_interface 1
|
|
|
|
foreach_instance +B +C add_servald_interface 2
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B +C start_servald_server
|
2013-05-31 11:32:13 +09:30
|
|
|
}
|
|
|
|
test_lose_neighbours() {
|
2014-05-02 14:02:25 +09:30
|
|
|
simulator_command up "net1" "net2"
|
2013-05-31 11:32:13 +09:30
|
|
|
wait_until path_exists +A +B +C
|
|
|
|
wait_until path_exists +C +B +A
|
2014-05-02 14:02:25 +09:30
|
|
|
simulator_command down "net1" "net2"
|
2013-05-31 11:32:13 +09:30
|
|
|
foreach_instance +A +C \
|
|
|
|
wait_until --timeout=30 instance_offline +B
|
2013-06-11 10:17:41 +09:30
|
|
|
set_instance +A
|
|
|
|
wait_until --timeout=30 instance_offline +C
|
2014-05-02 14:02:25 +09:30
|
|
|
simulator_command up "net1" "net2"
|
2013-12-11 16:41:57 +10:30
|
|
|
wait_until --timeout=20 path_exists +A +B +C
|
|
|
|
wait_until --timeout=20 path_exists +C +B +A
|
2013-05-31 11:32:13 +09:30
|
|
|
}
|
2014-05-02 14:02:25 +09:30
|
|
|
finally_lose_neighbours() {
|
|
|
|
simulator_quit
|
|
|
|
}
|
2013-05-31 11:32:13 +09:30
|
|
|
|
2014-06-12 16:46:53 +09:30
|
|
|
doc_interfaceBounce="Lose and regain neighbours due to disabling interface"
|
|
|
|
setup_interfaceBounce() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
start_simulator
|
|
|
|
simulator_command create "net1" "$SERVALD_VAR/dummy1/"
|
|
|
|
foreach_instance +A +B create_single_identity
|
|
|
|
foreach_instance +A +B add_servald_interface 1
|
|
|
|
foreach_instance +A +B start_servald_server
|
|
|
|
}
|
|
|
|
test_interfaceBounce() {
|
|
|
|
simulator_command up "net1"
|
|
|
|
wait_until path_exists +A +B
|
|
|
|
wait_until path_exists +B +A
|
|
|
|
set_instance +A
|
|
|
|
executeOk_servald config set interfaces.1.exclude on sync
|
|
|
|
wait_until --timeout=30 instance_offline +B
|
|
|
|
set_instance +B
|
|
|
|
wait_until --timeout=30 instance_offline +A
|
|
|
|
set_instance +A
|
|
|
|
executeOk_servald config del interfaces.1.exclude sync
|
|
|
|
wait_until path_exists +A +B
|
|
|
|
wait_until path_exists +B +A
|
|
|
|
}
|
|
|
|
finally_interfaceBounce() {
|
|
|
|
simulator_quit
|
|
|
|
}
|
|
|
|
|
2015-11-16 13:47:28 +10:30
|
|
|
doc_noLinkPollution="Don't ask for explanation of links to dead nodes"
|
|
|
|
setup_noLinkPollution() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
start_simulator
|
|
|
|
simulator_command create "net1" "$SERVALD_VAR/dummy1/"
|
|
|
|
# TODO re-roll identities until there's no possible SID prefix collision?
|
|
|
|
foreach_instance +A +B +C +D create_single_identity
|
|
|
|
foreach_instance +A +B +C +D add_servald_interface 1
|
2016-01-12 10:28:30 +10:30
|
|
|
foreach_instance +A +B +C +D executeOk_servald config set debug.subscriber on
|
2015-11-16 13:47:28 +10:30
|
|
|
foreach_instance +A +B +C start_servald_server
|
|
|
|
simulator_command up "net1"
|
|
|
|
wait_until path_exists +A +B
|
|
|
|
wait_until path_exists +A +C
|
|
|
|
foreach_instance +B +C stop_servald_server
|
|
|
|
set_instance +A
|
|
|
|
wait_until --timeout=30 instance_offline +B
|
|
|
|
wait_until --timeout=30 instance_offline +C
|
|
|
|
set_instance +D
|
|
|
|
start_servald_server
|
|
|
|
wait_until path_exists +A +D
|
|
|
|
wait_until path_exists +D +A
|
|
|
|
}
|
|
|
|
test_noLinkPollution() {
|
|
|
|
set_instance +D
|
|
|
|
executeOk_servald id allpeers
|
|
|
|
tfw_cat --stdout
|
2016-01-12 10:28:30 +10:30
|
|
|
# The test is considered a success if D doesn't find out about BOTH B and C
|
|
|
|
# There is still a chance that 3 ID's will have the same 16 bit prefix, but those are fairly slim odds
|
|
|
|
assertStdoutLineCount '<' 5
|
2015-11-16 13:47:28 +10:30
|
|
|
}
|
|
|
|
|
2013-05-01 15:46:47 +09:30
|
|
|
setup_multi_interface() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
2014-05-02 14:02:25 +09:30
|
|
|
start_simulator
|
|
|
|
simulator_command create "wlan0" "$SERVALD_VAR/dummy1/"
|
|
|
|
simulator_command create "eth0" "$SERVALD_VAR/dummy2/"
|
2013-05-01 15:46:47 +09:30
|
|
|
foreach_instance +A +B create_single_identity
|
2013-12-13 17:48:58 +10:30
|
|
|
foreach_instance +A +B add_servald_interface --wifi 1
|
|
|
|
foreach_instance +A +B add_servald_interface --ethernet 2
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B start_servald_server
|
2013-05-01 15:46:47 +09:30
|
|
|
}
|
|
|
|
|
|
|
|
doc_multi_interface="Multiple links of different types to the same neighbour"
|
|
|
|
test_multi_interface() {
|
2014-05-02 14:02:25 +09:30
|
|
|
simulator_command up "wlan0" "eth0"
|
2013-05-01 15:46:47 +09:30
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until has_link --interface "dummy2.*" "$SIDB"
|
2013-08-30 17:23:24 +09:30
|
|
|
set_instance +B
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until has_link --interface "dummy2.*" "$SIDA"
|
2013-08-30 17:23:24 +09:30
|
|
|
set_instance +A
|
2014-05-02 14:02:25 +09:30
|
|
|
simulator_command down "eth0"
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until has_link --interface "dummy1.*" "$SIDB"
|
2013-08-30 17:23:24 +09:30
|
|
|
set_instance +B
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until has_link --interface "dummy1.*" "$SIDA"
|
2013-08-30 17:23:24 +09:30
|
|
|
set_instance +A
|
2014-05-02 14:02:25 +09:30
|
|
|
simulator_command up "eth0"
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until has_link --interface "dummy2.*" "$SIDB"
|
2013-05-01 15:46:47 +09:30
|
|
|
set_instance +B
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until has_link --interface "dummy2.*" "$SIDA"
|
2013-05-01 15:46:47 +09:30
|
|
|
}
|
2014-05-02 14:02:25 +09:30
|
|
|
finally_multi_interface() {
|
|
|
|
simulator_quit
|
|
|
|
}
|
2013-05-01 15:46:47 +09:30
|
|
|
|
2014-04-17 16:09:34 +09:30
|
|
|
doc_ping_unreliable_1hop="Ping over a 1-hop unreliable link"
|
|
|
|
setup_ping_unreliable_1hop() {
|
2013-05-15 11:33:43 +09:30
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
2014-05-02 14:02:25 +09:30
|
|
|
foreach_instance +A +B add_servald_interface 1
|
|
|
|
start_simulator
|
|
|
|
simulator_command create "net" "$SERVALD_VAR/dummy1/"
|
|
|
|
simulator_command set "net" "drop_packets" "40"
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B start_servald_server
|
2013-05-15 11:33:43 +09:30
|
|
|
}
|
2014-04-17 16:09:34 +09:30
|
|
|
test_ping_unreliable_1hop() {
|
2014-05-02 14:02:25 +09:30
|
|
|
simulator_command up "net"
|
|
|
|
wait_until --timeout=10 path_exists +A +B
|
|
|
|
wait_until --timeout=5 path_exists +B +A
|
2013-05-15 11:33:43 +09:30
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --interval=0.100 --timeout=3 --wait-for-duplicates "$SIDB" 100
|
2013-05-24 13:52:31 +09:30
|
|
|
tfw_cat --stdout --stderr
|
2016-01-26 23:56:27 +10:30
|
|
|
received=$($SED -n -e 's/.*\<\([0-9][0-9]*\) packets received.*/\1/p' "$TFWSTDOUT") || error "malformed ping output"
|
|
|
|
duplicates=$($SED -n -e 's/.*\<\([0-9][0-9]*\) duplicates.*/\1/p' "$TFWSTDOUT") || error "malformed ping output"
|
2014-05-05 14:33:52 +09:30
|
|
|
assert [ "$received" -ge 98 ]
|
|
|
|
assert [ "$duplicates" -le 2 ]
|
2013-05-24 13:52:31 +09:30
|
|
|
}
|
2014-05-02 14:02:25 +09:30
|
|
|
finally_ping_unreliable_1hop() {
|
|
|
|
simulator_quit
|
|
|
|
}
|
2013-05-24 13:52:31 +09:30
|
|
|
|
2014-04-17 16:09:34 +09:30
|
|
|
doc_ping_unreliable_2hop="Ping over a 2-hop unreliable link"
|
|
|
|
setup_ping_unreliable_2hop() {
|
2013-05-24 13:52:31 +09:30
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B +C create_single_identity
|
2014-05-02 14:02:25 +09:30
|
|
|
foreach_instance +A +B add_servald_interface 1
|
|
|
|
foreach_instance +B +C add_servald_interface 2
|
|
|
|
start_simulator
|
|
|
|
simulator_command create "net1" "$SERVALD_VAR/dummy1/"
|
|
|
|
simulator_command set "net1" "drop_packets" "40"
|
|
|
|
simulator_command create "net2" "$SERVALD_VAR/dummy2/"
|
|
|
|
simulator_command set "net2" "drop_packets" "40"
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B +C start_servald_server
|
2013-05-24 13:52:31 +09:30
|
|
|
}
|
2014-04-17 16:09:34 +09:30
|
|
|
test_ping_unreliable_2hop() {
|
2014-05-02 14:02:25 +09:30
|
|
|
simulator_command up "net1" "net2"
|
2013-05-24 13:52:31 +09:30
|
|
|
wait_until path_exists +A +B +C
|
|
|
|
wait_until path_exists +C +B +A
|
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --interval=0.100 --timeout=3 --wait-for-duplicates "$SIDC" 100
|
2013-05-15 11:33:43 +09:30
|
|
|
tfw_cat --stdout --stderr
|
2016-01-26 23:56:27 +10:30
|
|
|
received=$($SED -n -e 's/.*\<\([0-9]\+\) packets received.*/\1/p' "$TFWSTDOUT") || error "malformed ping output"
|
|
|
|
duplicates=$($SED -n -e 's/.*\<\([0-9]\+\) duplicates.*/\1/p' "$TFWSTDOUT") || error "malformed ping output"
|
2014-05-05 14:33:52 +09:30
|
|
|
assert [ "$received" -ge 98 ]
|
2014-09-23 14:15:08 +09:30
|
|
|
assert [ "$duplicates" -le 5 ]
|
2013-05-15 11:33:43 +09:30
|
|
|
}
|
2014-05-02 14:02:25 +09:30
|
|
|
finally_ping_unreliable_2hop() {
|
|
|
|
simulator_quit
|
|
|
|
}
|
|
|
|
|
|
|
|
# TODO implement congestion control, use this test as a basis for improving...
|
|
|
|
doc_ping_congested="Ping flood over an unreliable and congested link"
|
|
|
|
setup_ping_congested() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
|
|
|
foreach_instance +A +B add_servald_interface 1
|
|
|
|
start_simulator
|
|
|
|
simulator_command create "net1" "$SERVALD_VAR/dummy1/"
|
|
|
|
simulator_command set "net1" \
|
|
|
|
"drop_packets" "20" \
|
|
|
|
"latency" "20" \
|
|
|
|
"rate" "20000"
|
|
|
|
foreach_instance +A +B +C start_servald_server
|
|
|
|
}
|
|
|
|
test_ping_congested() {
|
|
|
|
simulator_command up "net1"
|
|
|
|
wait_until --timeout=10 path_exists +A +B
|
|
|
|
wait_until --timeout=5 path_exists +B +A
|
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --interval=0.100 --timeout=3 "$SIDB" 100
|
2014-05-02 14:02:25 +09:30
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
finally_ping_congested() {
|
|
|
|
simulator_quit
|
|
|
|
}
|
2013-05-15 11:33:43 +09:30
|
|
|
|
2014-04-17 16:09:34 +09:30
|
|
|
doc_brping_unreliable_1hop="Broadcast ping over a 1-hop unreliable link"
|
|
|
|
setup_brping_unreliable_1hop() {
|
2013-05-20 13:23:35 +09:30
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
2014-05-02 14:02:25 +09:30
|
|
|
foreach_instance +A +B add_servald_interface 1
|
|
|
|
start_simulator
|
|
|
|
simulator_command create "net" "$SERVALD_VAR/dummy1/"
|
|
|
|
simulator_command set "net" "drop_packets" "20"
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B start_servald_server
|
2013-05-20 13:23:35 +09:30
|
|
|
}
|
2014-04-17 16:09:34 +09:30
|
|
|
test_brping_unreliable_1hop() {
|
2014-05-02 14:02:25 +09:30
|
|
|
simulator_command up "net"
|
2013-05-20 13:23:35 +09:30
|
|
|
wait_until path_exists +A +B
|
|
|
|
wait_until path_exists +B +A
|
|
|
|
set_instance +A
|
2014-04-17 16:09:34 +09:30
|
|
|
executeOk_servald mdp ping --interval=0.100 --timeout=2 --wait-for-duplicates broadcast 100
|
2013-05-20 13:23:35 +09:30
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
2014-05-02 14:02:25 +09:30
|
|
|
finally_brping_unreliable_1hop() {
|
|
|
|
simulator_quit
|
|
|
|
}
|
2013-05-20 13:23:35 +09:30
|
|
|
|
2013-05-16 14:06:08 +09:30
|
|
|
doc_unreliable_links="Prefer a longer, better path vs an unreliable link"
|
2013-05-07 13:29:42 +09:30
|
|
|
setup_unreliable_links() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B +C create_single_identity
|
2014-05-02 14:02:25 +09:30
|
|
|
foreach_instance +A +B add_servald_interface 1
|
|
|
|
foreach_instance +B +C add_servald_interface 2
|
|
|
|
foreach_instance +A +C add_servald_interface 3
|
|
|
|
start_simulator
|
|
|
|
simulator_command create "net1" "$SERVALD_VAR/dummy1/"
|
|
|
|
simulator_command create "net2" "$SERVALD_VAR/dummy2/"
|
|
|
|
simulator_command create "net3" "$SERVALD_VAR/dummy3/"
|
|
|
|
simulator_command set "net1" "drop_packets" "5"
|
|
|
|
simulator_command set "net2" "drop_packets" "5"
|
2015-06-22 11:57:37 +09:30
|
|
|
simulator_command set "net3" "drop_packets" "60"
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B +C start_servald_server
|
2013-05-07 13:29:42 +09:30
|
|
|
}
|
|
|
|
test_unreliable_links() {
|
2014-05-02 14:02:25 +09:30
|
|
|
simulator_command up "net1" "net2" "net3"
|
2013-05-10 12:05:28 +09:30
|
|
|
wait_until path_exists +A +B +C
|
|
|
|
wait_until path_exists +C +B +A
|
2013-05-07 13:29:42 +09:30
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --interval=0.100 --timeout=3 --wait-for-duplicates "$SIDC" 50
|
2013-05-07 13:29:42 +09:30
|
|
|
tfw_cat --stdout --stderr
|
2016-01-26 23:56:27 +10:30
|
|
|
received=$($SED -n -e 's/.*\<\([0-9]\+\) packets received.*/\1/p' "$TFWSTDOUT") || error "malformed ping output"
|
|
|
|
duplicates=$($SED -n -e 's/.*\<\([0-9]\+\) duplicates.*/\1/p' "$TFWSTDOUT") || error "malformed ping output"
|
2015-06-22 11:57:37 +09:30
|
|
|
assert [ "$received" -ge 20 ]
|
2015-06-22 12:30:18 +09:30
|
|
|
assert [ "$duplicates" -le 10 ]
|
2014-05-05 14:33:52 +09:30
|
|
|
# make sure the path is still there.
|
2013-05-20 13:23:35 +09:30
|
|
|
wait_until path_exists +A +B +C
|
|
|
|
wait_until path_exists +C +B +A
|
2013-05-07 13:29:42 +09:30
|
|
|
}
|
2014-05-02 14:02:25 +09:30
|
|
|
finally_unreliable_links() {
|
|
|
|
simulator_quit
|
|
|
|
}
|
2013-05-07 13:29:42 +09:30
|
|
|
|
2015-06-22 11:57:37 +09:30
|
|
|
# TODO test with *really* unreliable links, eg 90%+ packet loss
|
2013-05-08 10:58:26 +09:30
|
|
|
doc_unreliable_links2="Choose the best multihop path with some unreliable links"
|
|
|
|
setup_unreliable_links2() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B +C +D create_single_identity
|
2014-05-02 14:02:25 +09:30
|
|
|
foreach_instance +A +B add_servald_interface 1
|
|
|
|
foreach_instance +A +C add_servald_interface 2
|
|
|
|
foreach_instance +A +D add_servald_interface 3
|
|
|
|
foreach_instance +B +C add_servald_interface 4
|
|
|
|
foreach_instance +B +D add_servald_interface 5
|
|
|
|
foreach_instance +C +D add_servald_interface 6
|
|
|
|
start_simulator
|
|
|
|
simulator_command create "net1" "$SERVALD_VAR/dummy1/"
|
|
|
|
simulator_command create "net2" "$SERVALD_VAR/dummy2/"
|
|
|
|
simulator_command create "net3" "$SERVALD_VAR/dummy3/"
|
|
|
|
simulator_command create "net4" "$SERVALD_VAR/dummy4/"
|
|
|
|
simulator_command create "net5" "$SERVALD_VAR/dummy5/"
|
|
|
|
simulator_command create "net6" "$SERVALD_VAR/dummy6/"
|
|
|
|
simulator_command set "net1" "drop_packets" "5"
|
|
|
|
simulator_command set "net2" "drop_packets" "60"
|
2015-06-22 11:57:37 +09:30
|
|
|
simulator_command set "net3" "drop_packets" "70"
|
2014-05-02 14:02:25 +09:30
|
|
|
simulator_command set "net4" "drop_packets" "5"
|
|
|
|
simulator_command set "net5" "drop_packets" "60"
|
|
|
|
simulator_command set "net6" "drop_packets" "5"
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B +C +D start_servald_server
|
2013-05-08 10:58:26 +09:30
|
|
|
}
|
|
|
|
test_unreliable_links2() {
|
2014-05-02 14:02:25 +09:30
|
|
|
simulator_command up "net1" "net2" "net3" "net4" "net5" "net6"
|
|
|
|
wait_until --timeout=20 path_exists +A +B +C +D
|
|
|
|
wait_until --timeout=20 path_exists +D +C +B +A
|
2013-05-08 10:58:26 +09:30
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --interval=0.100 --timeout=3 --wait-for-duplicates "$SIDD" 50
|
2013-05-08 10:58:26 +09:30
|
|
|
tfw_cat --stdout --stderr
|
2016-01-26 23:56:27 +10:30
|
|
|
received=$($SED -n -e 's/.*\<\([0-9]\+\) packets received.*/\1/p' "$TFWSTDOUT") || error "malformed ping output"
|
|
|
|
duplicates=$($SED -n -e 's/.*\<\([0-9]\+\) duplicates.*/\1/p' "$TFWSTDOUT") || error "malformed ping output"
|
2015-06-22 11:57:37 +09:30
|
|
|
assert [ "$received" -ge 20 ]
|
2015-06-22 12:30:18 +09:30
|
|
|
assert [ "$duplicates" -le 10 ]
|
2014-05-05 14:33:52 +09:30
|
|
|
wait_until --timeout=20 path_exists +A +B +C +D
|
|
|
|
wait_until --timeout=20 path_exists +D +C +B +A
|
2013-05-08 10:58:26 +09:30
|
|
|
}
|
2014-05-02 14:02:25 +09:30
|
|
|
finally_unreliable_links2() {
|
|
|
|
simulator_quit
|
|
|
|
}
|
2013-05-08 10:58:26 +09:30
|
|
|
|
2013-04-29 17:07:36 +09:30
|
|
|
setup_circle() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B +C +D +E +F +G +H create_single_identity
|
2013-12-13 17:48:58 +10:30
|
|
|
foreach_instance +A +B add_servald_interface 1
|
|
|
|
foreach_instance +B +C add_servald_interface 2
|
|
|
|
foreach_instance +C +D add_servald_interface 3
|
|
|
|
foreach_instance +D +E add_servald_interface 4
|
|
|
|
foreach_instance +E +F add_servald_interface 5
|
|
|
|
foreach_instance +F +G add_servald_interface 6
|
|
|
|
foreach_instance +G +H add_servald_interface 7
|
|
|
|
foreach_instance +H +A add_servald_interface 8
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B +C +D +E +F +G +H start_servald_server
|
2013-04-29 17:07:36 +09:30
|
|
|
}
|
|
|
|
|
|
|
|
doc_circle="Circle of nodes with one going offline"
|
|
|
|
test_circle() {
|
|
|
|
foreach_instance +A +B +C +D +E +F +G +H \
|
|
|
|
wait_until has_seen_instances +A +B +C +D +E +F +G +H
|
2013-05-10 12:05:28 +09:30
|
|
|
wait_until path_exists +A +B +C
|
|
|
|
wait_until path_exists +C +B +A
|
2013-04-29 17:07:36 +09:30
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 --wait-for-duplicates "$SIDC" 1
|
2013-04-29 17:07:36 +09:30
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
stop_servald_server +B
|
2013-04-30 16:35:45 +09:30
|
|
|
foreach_instance +A +C \
|
|
|
|
wait_until --timeout=10 instance_offline +B
|
2013-05-10 12:05:28 +09:30
|
|
|
wait_until path_exists +A +H +G +F +E +D +C
|
|
|
|
wait_until path_exists +C +D +E +F +G +H +A
|
2013-04-30 16:35:45 +09:30
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 --wait-for-duplicates "$SIDC" 1
|
2013-04-29 17:07:36 +09:30
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2012-10-10 16:22:31 +10:30
|
|
|
setup_crowded_mess() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
# BCDE & DEFG form squares, ABC & FGH form triangles
|
|
|
|
foreach_instance +A +B +C +D +E +F +G +H create_single_identity
|
2013-12-13 17:48:58 +10:30
|
|
|
foreach_instance +A +B +C add_servald_interface 1
|
|
|
|
foreach_instance +B +D add_servald_interface 2
|
|
|
|
foreach_instance +C +E add_servald_interface 3
|
|
|
|
foreach_instance +D +E add_servald_interface 4
|
|
|
|
foreach_instance +D +F add_servald_interface 5
|
|
|
|
foreach_instance +E +G add_servald_interface 6
|
|
|
|
foreach_instance +F +G +H add_servald_interface 7
|
2013-12-16 14:54:16 +10:30
|
|
|
foreach_instance +A +B +C +D +E +F +G +H start_servald_server
|
2012-10-10 16:22:31 +10:30
|
|
|
}
|
|
|
|
|
|
|
|
doc_crowded_mess="Multiple possible paths"
|
|
|
|
test_crowded_mess() {
|
2013-12-16 14:54:16 +10:30
|
|
|
set_instance +H
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until has_link --via "[0-9A-F]*" "$SIDA"
|
2012-10-10 16:22:31 +10:30
|
|
|
set_instance +A
|
2018-03-27 17:16:11 +10:30
|
|
|
wait_until has_link --via "[0-9A-F]*" "$SIDH"
|
|
|
|
executeOk_servald mdp trace "$SIDD"
|
2014-06-02 14:28:07 +09:30
|
|
|
assertStdoutGrep --matches=1 "^[0-9]:${SIDD}\$"
|
2014-05-30 14:55:25 +09:30
|
|
|
tfw_cat --stdout
|
2018-03-27 17:16:11 +10:30
|
|
|
executeOk_servald mdp ping --timeout=3 --wait-for-duplicates "$SIDH" 3
|
2013-08-09 16:19:45 +09:30
|
|
|
tfw_cat --stdout --stderr
|
2012-10-10 16:22:31 +10:30
|
|
|
}
|
|
|
|
|
2012-10-09 14:49:24 +10:30
|
|
|
runTests "$@"
|