2012-10-09 04:19:24 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Tests for Route discovery
|
2013-02-06 08:25:31 +00:00
|
|
|
#
|
|
|
|
# Copyright 2012 Serval Project, Inc.
|
2012-10-09 04:19:24 +00:00
|
|
|
#
|
|
|
|
# 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 02:18:48 +00:00
|
|
|
|
2012-10-09 04:19:24 +00:00
|
|
|
source "${0%/*}/../testframework.sh"
|
|
|
|
source "${0%/*}/../testdefs.sh"
|
|
|
|
|
2012-12-08 04:39:41 +00:00
|
|
|
interface_up() {
|
2013-08-19 07:29:10 +00:00
|
|
|
$GREP "Interface .* is up" $instance_servald_log || return 1
|
|
|
|
return 0
|
2012-10-09 04:19:24 +00:00
|
|
|
}
|
|
|
|
|
2013-12-16 04:24:16 +00:00
|
|
|
link_matches() {
|
|
|
|
local interface_ex=".*"
|
|
|
|
local link_type="\(BROADCAST\|\UNICAST\)"
|
|
|
|
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;;
|
|
|
|
*) break;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
sid="$1"
|
|
|
|
tfw_log "Looking for link ${sid}, ${link_type}, ${interface_ex}, ${via}"
|
|
|
|
if ! grep "^${sid}:${link_type}:${interface_ex}:${via}\$" $_tfw_tmp/stdout; then
|
2013-07-08 07:42:56 +00:00
|
|
|
tfw_log "Link not found"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2013-12-16 04:24:16 +00:00
|
|
|
has_link() {
|
|
|
|
executeOk_servald route print
|
|
|
|
link_matches $@
|
|
|
|
}
|
|
|
|
|
2013-05-10 02:35:28 +00:00
|
|
|
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 12:52:19 +00:00
|
|
|
eval dest=\$$#
|
2013-05-10 02:35:28 +00:00
|
|
|
local dest_sidvar=SID${dest#+}
|
|
|
|
local next_inst=$1
|
|
|
|
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 12:52:19 +00:00
|
|
|
local I
|
2013-05-10 02:35:28 +00:00
|
|
|
for I; do
|
|
|
|
local sidvar=SID${I#+}
|
|
|
|
[ -n "${!sidvar}" ] || break
|
2013-12-16 04:24:16 +00:00
|
|
|
set_instance $next_inst
|
|
|
|
executeOk_servald route print
|
|
|
|
link_matches ${!sidvar} || return 1
|
|
|
|
[ $I = $dest ] && return 0
|
|
|
|
link_matches --via ${!sidvar} ${!dest_sidvar} || return 1
|
2013-05-10 02:35:28 +00:00
|
|
|
next_inst=$I
|
|
|
|
done
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2013-12-16 04:24:16 +00:00
|
|
|
configure_servald_server() {
|
2012-12-06 02:01:19 +00:00
|
|
|
executeOk_servald config \
|
2013-04-12 07:48:25 +00:00
|
|
|
set debug.mdprequests yes \
|
2013-04-29 00:36:22 +00:00
|
|
|
set debug.linkstate yes \
|
2013-04-30 07:05:45 +00:00
|
|
|
set debug.verbose yes \
|
2013-05-01 06:50:04 +00:00
|
|
|
set debug.overlayrouting yes \
|
2013-05-24 04:22:31 +00:00
|
|
|
set log.console.level debug \
|
|
|
|
set log.console.show_pid on \
|
|
|
|
set log.console.show_time on \
|
2012-12-10 23:26:21 +00:00
|
|
|
set rhizome.enable no
|
2012-10-09 04:19:24 +00:00
|
|
|
}
|
|
|
|
|
2012-11-26 04:10:22 +00:00
|
|
|
log_routing_table() {
|
|
|
|
executeOk_servald route print
|
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2012-10-09 04:19:24 +00:00
|
|
|
teardown() {
|
2012-11-26 04:10:22 +00:00
|
|
|
foreach_instance_with_pidfile log_routing_table
|
2012-10-09 04:19:24 +00:00
|
|
|
stop_all_servald_servers
|
|
|
|
kill_all_servald_processes
|
|
|
|
assert_no_servald_processes
|
2012-11-26 04:10:22 +00:00
|
|
|
report_all_servald_servers
|
2012-10-09 04:19:24 +00:00
|
|
|
}
|
|
|
|
|
2013-02-14 05:32:09 +00:00
|
|
|
doc_single_link="Start 2 instances on one link"
|
2012-10-09 04:19:24 +00:00
|
|
|
setup_single_link() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
2013-12-13 07:18:58 +00:00
|
|
|
foreach_instance +A +B add_servald_interface 1
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B start_servald_server
|
2012-10-09 04:19:24 +00:00
|
|
|
}
|
|
|
|
test_single_link() {
|
2013-08-08 05:50:31 +00:00
|
|
|
wait_until --timeout=10 path_exists +A +B
|
|
|
|
wait_until --timeout=5 path_exists +B +A
|
2012-10-09 04:19:24 +00:00
|
|
|
set_instance +A
|
2014-01-29 05:09:12 +00:00
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDA 1
|
|
|
|
tfw_cat --stdout --stderr
|
2013-04-26 07:23:04 +00:00
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDB 1
|
2012-10-09 05:39:33 +00:00
|
|
|
tfw_cat --stdout --stderr
|
2012-10-09 04:19:24 +00:00
|
|
|
}
|
|
|
|
|
2013-04-08 00:33:25 +00:00
|
|
|
doc_multiple_ids="Route between multiple identities"
|
|
|
|
setup_multiple_ids() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_identities 2
|
2013-12-13 07:18:58 +00:00
|
|
|
foreach_instance +A +B add_servald_interface 1
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B start_servald_server
|
2013-04-08 00:33:25 +00:00
|
|
|
}
|
|
|
|
test_multiple_ids() {
|
2013-05-10 02:35:28 +00:00
|
|
|
wait_until path_exists +A +B
|
2013-12-16 04:24:16 +00:00
|
|
|
set_instance +A
|
|
|
|
wait_until has_link --via $SIDB1 $SIDB2
|
2013-05-10 02:35:28 +00:00
|
|
|
wait_until path_exists +B +A
|
2013-12-16 04:24:16 +00:00
|
|
|
set_instance +B
|
|
|
|
wait_until has_link --via $SIDA1 $SIDA2
|
2013-04-08 00:33:25 +00:00
|
|
|
set_instance +A
|
2013-04-26 07:23:04 +00:00
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDB2 1
|
2013-04-08 00:33:25 +00:00
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
executeOk_servald route print
|
2013-12-16 04:24:16 +00:00
|
|
|
link_matches --broadcast $SIDB1
|
|
|
|
link_matches --via $SIDB1 $SIDB2
|
2013-04-08 00:33:25 +00:00
|
|
|
set_instance +B
|
2013-04-26 07:23:04 +00:00
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDA2 1
|
2013-04-08 00:33:25 +00:00
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
executeOk_servald route print
|
2013-12-16 04:24:16 +00:00
|
|
|
link_matches --broadcast $SIDA1
|
|
|
|
link_matches --via $SIDA1 $SIDA2
|
2013-04-08 00:33:25 +00:00
|
|
|
}
|
|
|
|
|
2013-10-10 05:29:44 +00:00
|
|
|
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 07:18:58 +00:00
|
|
|
foreach_instance +A +B add_servald_interface 1
|
2013-10-10 05:29:44 +00:00
|
|
|
set_instance +A
|
|
|
|
executeOk_servald keyring add 'entry-pin'
|
|
|
|
extract_stdout_keyvalue SIDX sid "$rexp_sid"
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B start_servald_server
|
2013-10-10 05:29:44 +00:00
|
|
|
}
|
|
|
|
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 04:24:16 +00:00
|
|
|
set_instance +B
|
|
|
|
wait_until has_link --via $SIDA $SIDX
|
2013-10-10 05:29:44 +00:00
|
|
|
set_instance +A
|
2013-10-14 05:10:42 +00:00
|
|
|
executeOk_servald id relinquish pin 'entry-pin'
|
2013-10-10 05:29:44 +00:00
|
|
|
set_instance +B
|
|
|
|
wait_until --timeout=30 sid_offline $SIDX
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
executeOk_servald keyring load sidx '' 'entry-pin'
|
|
|
|
foreach_instance +A +B create_single_identity
|
2013-12-13 07:18:58 +00:00
|
|
|
foreach_instance +A +B add_servald_interface 1
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B start_servald_server
|
2013-10-10 05:29:44 +00:00
|
|
|
}
|
|
|
|
test_migrate_id() {
|
|
|
|
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 04:24:16 +00:00
|
|
|
set_instance +B
|
|
|
|
wait_until has_link --via $SIDA $SIDX
|
2013-10-10 05:29:44 +00:00
|
|
|
set_instance +B
|
|
|
|
executeOk_servald id enter pin 'entry-pin'
|
2013-12-16 04:24:16 +00:00
|
|
|
set_instance +A
|
|
|
|
wait_until --timeout=30 has_link --via $SIDB $SIDX
|
2013-10-10 05:29:44 +00:00
|
|
|
}
|
|
|
|
|
2013-02-14 03:48:56 +00:00
|
|
|
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 07:18:58 +00:00
|
|
|
foreach_instance +A +B add_servald_interface 1
|
2013-02-14 03:48:56 +00:00
|
|
|
foreach_instance +A +B executeOk_servald config set interfaces.1.encapsulation single
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B start_servald_server
|
2013-02-14 03:48:56 +00:00
|
|
|
}
|
|
|
|
test_single_mdp() {
|
2013-05-10 02:35:28 +00:00
|
|
|
wait_until path_exists +A +B
|
|
|
|
wait_until path_exists +B +A
|
2013-02-14 03:48:56 +00:00
|
|
|
set_instance +A
|
2013-04-26 07:23:04 +00:00
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDB 1
|
2013-02-14 03:48:56 +00:00
|
|
|
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 07:18:58 +00:00
|
|
|
foreach_instance +A +B add_servald_interface 1
|
2013-02-14 03:48:56 +00:00
|
|
|
foreach_instance +A executeOk_servald config set interfaces.1.encapsulation single
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B start_servald_server
|
2013-02-14 03:48:56 +00:00
|
|
|
}
|
|
|
|
test_mismatched_encap() {
|
2013-05-10 02:35:28 +00:00
|
|
|
wait_until path_exists +A +B
|
|
|
|
wait_until path_exists +B +A
|
2013-02-14 03:48:56 +00:00
|
|
|
set_instance +A
|
2013-04-26 07:23:04 +00:00
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDB 1
|
2013-02-14 03:48:56 +00:00
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2013-07-16 05:46:07 +00:00
|
|
|
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 07:18:58 +00:00
|
|
|
foreach_instance +A +B add_servald_interface 1
|
2013-07-16 05:46:07 +00:00
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config \
|
|
|
|
set interfaces.1.encapsulation single \
|
|
|
|
set interfaces.1.point_to_point on
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B start_servald_server
|
2013-07-16 05:46:07 +00:00
|
|
|
}
|
|
|
|
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
|
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDB 1
|
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2013-02-19 23:51:56 +00:00
|
|
|
doc_slip_encoding="Test slip encoding and decoding"
|
|
|
|
setup_slip_encoding() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
}
|
|
|
|
test_slip_encoding() {
|
2013-04-22 06:31:38 +00:00
|
|
|
executeOk_servald test slip --seed=1 --iterations=2000
|
2013-02-19 23:51:56 +00:00
|
|
|
}
|
2013-11-25 02:24:29 +00:00
|
|
|
start_fakeradio() {
|
|
|
|
$servald_build_root/fakeradio 4 1 > "$SERVALD_VAR/radioout" 2> "$SERVALD_VAR/radioerr" &
|
|
|
|
FAKERADIO_PID=$!
|
|
|
|
wait_until $GREP "^right:" "$SERVALD_VAR/radioout"
|
|
|
|
local _line=`head "$SERVALD_VAR/radioout" -n 1`
|
|
|
|
END1="${_line#*:}"
|
|
|
|
_line=`tail "$SERVALD_VAR/radioout" -n 1`
|
|
|
|
END2="${_line#*:}"
|
|
|
|
tfw_log "Started fakeradio pid=$FAKERADIO_PID, end1=$END1, end2=$END2"
|
|
|
|
}
|
2013-02-19 23:51:56 +00:00
|
|
|
|
2013-08-19 07:29:10 +00:00
|
|
|
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 02:24:29 +00:00
|
|
|
start_fakeradio
|
2013-08-19 07:29:10 +00:00
|
|
|
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 11:13:56 +00:00
|
|
|
set debug.throttling on \
|
|
|
|
set debug.packetradio on \
|
2013-10-30 06:39:37 +00:00
|
|
|
set debug.radio_link on \
|
2013-08-19 07:29:10 +00:00
|
|
|
set interfaces.1.type CATEAR \
|
2013-10-08 06:06:07 +00:00
|
|
|
set interfaces.1.mdp.tick_ms 5000 \
|
2013-08-19 07:29:10 +00:00
|
|
|
set interfaces.1.socket_type STREAM \
|
|
|
|
set interfaces.1.encapsulation SINGLE \
|
2013-10-08 06:06:07 +00:00
|
|
|
set interfaces.1.point_to_point on
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B start_servald_server
|
2013-08-19 07:29:10 +00:00
|
|
|
}
|
|
|
|
test_simulate_extender() {
|
|
|
|
wait_until path_exists +A +B
|
|
|
|
wait_until path_exists +B +A
|
2013-08-27 11:13:56 +00:00
|
|
|
set_instance +A
|
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDB 1
|
|
|
|
tfw_cat --stdout --stderr
|
2013-08-19 07:29:10 +00:00
|
|
|
}
|
|
|
|
teardown_simulate_extender() {
|
|
|
|
teardown
|
|
|
|
tfw_log "Killing fakeradio, pid=$FAKERADIO_PID"
|
|
|
|
kill $FAKERADIO_PID
|
|
|
|
tfw_cat "$SERVALD_VAR/radioerr"
|
|
|
|
}
|
|
|
|
|
2013-02-14 05:32:09 +00:00
|
|
|
doc_multiple_nodes="Multiple nodes on one link"
|
2012-11-30 03:15:08 +00:00
|
|
|
setup_multiple_nodes() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B +C +D create_single_identity
|
2013-12-13 07:18:58 +00:00
|
|
|
foreach_instance +A +B +C +D add_servald_interface 1
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B +C +D start_servald_server
|
2012-11-30 03:15:08 +00:00
|
|
|
}
|
|
|
|
test_multiple_nodes() {
|
2013-05-10 02:35:28 +00:00
|
|
|
wait_until path_exists +A +B
|
|
|
|
wait_until path_exists +A +C
|
|
|
|
wait_until path_exists +A +D
|
2013-08-12 04:51:31 +00:00
|
|
|
wait_until path_exists +B +A
|
|
|
|
wait_until path_exists +C +A
|
|
|
|
wait_until path_exists +D +A
|
2012-11-30 03:15:08 +00:00
|
|
|
set_instance +A
|
2013-04-26 07:23:04 +00:00
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDB 1
|
2012-11-30 03:15:08 +00:00
|
|
|
tfw_cat --stdout --stderr
|
2013-04-26 07:23:04 +00:00
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDC 1
|
2012-11-30 03:15:08 +00:00
|
|
|
tfw_cat --stdout --stderr
|
2013-04-26 07:23:04 +00:00
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDD 1
|
2012-11-30 03:15:08 +00:00
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2013-08-09 02:48:14 +00:00
|
|
|
doc_scan="Network scan with isolated clients"
|
2012-12-08 04:39:41 +00:00
|
|
|
setup_scan() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
2013-08-09 06:49:45 +00:00
|
|
|
foreach_instance +A +B +C create_single_identity
|
2013-12-13 07:18:58 +00:00
|
|
|
foreach_instance +A +B +C add_servald_interface --file 1
|
2013-08-09 06:49:45 +00:00
|
|
|
foreach_instance +A +B +C \
|
2012-12-08 04:39:41 +00:00
|
|
|
executeOk_servald config \
|
2013-08-12 04:51:31 +00:00
|
|
|
set interfaces.1.drop_broadcasts on
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B +C start_servald_server
|
|
|
|
foreach_instance +A +B +C \
|
|
|
|
wait_until interface_up
|
2012-12-08 04:39:41 +00:00
|
|
|
}
|
|
|
|
test_scan() {
|
2012-12-10 23:26:21 +00:00
|
|
|
set_instance +A
|
|
|
|
executeOk_servald scan
|
|
|
|
wait_until scan_completed
|
2013-08-09 06:49:45 +00:00
|
|
|
wait_until --timeout=10 has_seen_instances +B +C
|
|
|
|
executeOk_servald route print
|
2013-12-16 04:24:16 +00:00
|
|
|
link_matches --unicast $SIDB
|
|
|
|
link_matches --unicast $SIDC
|
2013-04-26 07:23:04 +00:00
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDB 1
|
2012-12-14 01:44:55 +00:00
|
|
|
tfw_cat --stdout --stderr
|
2013-08-09 06:49:45 +00:00
|
|
|
set_instance +B
|
2012-12-10 23:26:21 +00:00
|
|
|
executeOk_servald route print
|
2013-12-16 04:24:16 +00:00
|
|
|
link_matches --unicast $SIDA
|
|
|
|
link_matches --via $SIDA $SIDC
|
2013-08-09 06:49:45 +00:00
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDC 1
|
|
|
|
tfw_cat --stdout --stderr
|
2012-12-08 04:39:41 +00:00
|
|
|
}
|
|
|
|
|
2013-08-12 04:51:31 +00:00
|
|
|
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
|
2013-12-16 04:24:16 +00:00
|
|
|
link_matches --unicast $SIDB
|
2013-08-12 04:51:31 +00:00
|
|
|
assertStdoutGrep --matches=0 "^$SIDC:"
|
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDB 1
|
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2013-02-14 05:32:09 +00:00
|
|
|
scan_completed() {
|
2013-08-09 06:49:45 +00:00
|
|
|
grep "Scan completed" $instance_servald_log || return 1
|
2013-02-14 05:32:09 +00:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2013-05-29 02:18:48 +00:00
|
|
|
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 07:18:58 +00:00
|
|
|
foreach_instance +A +B add_servald_interface --file 1
|
2013-05-29 02:18:48 +00:00
|
|
|
set_instance +B
|
|
|
|
executeOk_servald config \
|
2013-08-12 04:51:31 +00:00
|
|
|
set interfaces.1.drop_broadcasts on
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B start_servald_server
|
2013-05-29 02:18:48 +00:00
|
|
|
}
|
|
|
|
test_single_filter() {
|
|
|
|
set_instance +A
|
2013-12-16 04:24:16 +00:00
|
|
|
wait_until --timeout=10 has_link --unicast $SIDB
|
|
|
|
set_instance +B
|
|
|
|
wait_until --timeout=5 has_link --broadcast $SIDA
|
2014-01-29 05:09:12 +00:00
|
|
|
set_instance +A
|
2013-05-29 02:18:48 +00:00
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDB 1
|
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2013-02-14 05:32:09 +00:00
|
|
|
doc_broadcast_only="Broadcast packets only"
|
2013-01-29 00:57:13 +00:00
|
|
|
setup_broadcast_only() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
2013-12-13 07:18:58 +00:00
|
|
|
foreach_instance +A +B add_servald_interface --file 1
|
2013-05-10 02:35:28 +00:00
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config set interfaces.1.drop_unicasts 1
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B start_servald_server
|
2013-01-29 00:57:13 +00:00
|
|
|
}
|
|
|
|
test_broadcast_only() {
|
2013-12-16 04:24:16 +00:00
|
|
|
set_instance +A
|
|
|
|
wait_until has_link --broadcast $SIDB
|
|
|
|
set_instance +B
|
|
|
|
wait_until has_link --broadcast $SIDA
|
2013-01-29 00:57:13 +00:00
|
|
|
set_instance +A
|
2013-04-26 07:23:04 +00:00
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDB 1
|
2013-01-29 00:57:13 +00:00
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2013-02-14 05:32:09 +00:00
|
|
|
doc_prefer_unicast="Prefer unicast packets"
|
2013-01-29 00:57:13 +00:00
|
|
|
setup_prefer_unicast() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
2013-12-13 07:18:58 +00:00
|
|
|
foreach_instance +A +B add_servald_interface 1
|
2013-01-29 00:57:13 +00:00
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config \
|
|
|
|
set interfaces.1.prefer_unicast 1 \
|
|
|
|
set debug.overlayframes 1
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B start_servald_server
|
2013-01-29 00:57:13 +00:00
|
|
|
}
|
|
|
|
test_prefer_unicast() {
|
2013-12-16 04:24:16 +00:00
|
|
|
set_instance +A
|
|
|
|
wait_until has_link --unicast $SIDB
|
|
|
|
set_instance +B
|
|
|
|
wait_until has_link --unicast $SIDA
|
2013-05-29 02:18:48 +00:00
|
|
|
wait_until path_exists +A +B
|
|
|
|
wait_until path_exists +B +A
|
2013-01-29 00:57:13 +00:00
|
|
|
set_instance +A
|
2013-04-26 07:23:04 +00:00
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDB 1
|
2013-01-29 00:57:13 +00:00
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2013-02-14 05:32:09 +00:00
|
|
|
doc_multihop_linear="Start 4 instances in a linear arrangement"
|
2012-10-09 04:19:24 +00:00
|
|
|
setup_multihop_linear() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B +C +D create_single_identity
|
2013-12-13 07:18:58 +00:00
|
|
|
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 04:24:16 +00:00
|
|
|
foreach_instance +A +B +C +D start_servald_server
|
2012-10-09 04:19:24 +00:00
|
|
|
}
|
|
|
|
test_multihop_linear() {
|
2013-05-10 02:35:28 +00:00
|
|
|
wait_until path_exists +A +B +C +D
|
|
|
|
wait_until path_exists +D +C +B +A
|
2012-10-09 04:19:24 +00:00
|
|
|
set_instance +A
|
2013-04-26 07:23:04 +00:00
|
|
|
executeOk_servald --stdout --stderr mdp ping --timeout=3 $SIDD 1
|
2012-10-09 05:39:33 +00:00
|
|
|
tfw_cat --stdout --stderr
|
2013-02-18 04:01:01 +00:00
|
|
|
executeOk_servald mdp trace $SIDD
|
2013-05-10 02:35:28 +00:00
|
|
|
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 04:19:24 +00:00
|
|
|
}
|
|
|
|
|
2013-08-09 06:49:45 +00:00
|
|
|
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 07:18:58 +00:00
|
|
|
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 06:49:45 +00:00
|
|
|
set_instance +A
|
|
|
|
executeOk_servald config \
|
2013-08-12 04:51:31 +00:00
|
|
|
set interfaces.1.drop_broadcasts on
|
2013-08-09 06:49:45 +00:00
|
|
|
set_instance +C
|
|
|
|
executeOk_servald config \
|
2013-08-12 04:51:31 +00:00
|
|
|
set interfaces.2.drop_broadcasts on \
|
|
|
|
set interfaces.3.drop_broadcasts on
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B +C +D start_servald_server
|
2013-08-09 06:49:45 +00:00
|
|
|
}
|
|
|
|
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
|
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDD 1
|
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2013-04-29 07:37:36 +00:00
|
|
|
setup_offline() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B +C +D create_single_identity
|
2013-12-13 07:18:58 +00:00
|
|
|
foreach_instance +A +B +C add_servald_interface 1
|
|
|
|
foreach_instance +A +B +D add_servald_interface 2
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B +C +D start_servald_server
|
2013-04-29 07:37:36 +00:00
|
|
|
}
|
|
|
|
|
2013-10-10 05:29:44 +00:00
|
|
|
sid_offline() {
|
|
|
|
if ! grep "NOT REACHABLE sid=${1}" $instance_servald_log; then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2013-04-29 07:37:36 +00:00
|
|
|
instance_offline() {
|
|
|
|
local I N
|
|
|
|
for I; do
|
|
|
|
[ $I = $instance_arg ] && continue
|
|
|
|
for ((N=1; 1; ++N)); do
|
|
|
|
local sidvar=SID${I#+}$N
|
|
|
|
[ -n "${!sidvar}" ] || break
|
2013-10-10 05:29:44 +00:00
|
|
|
if sid_offline ${!sidvar}; then
|
2013-04-29 07:37:36 +00:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2013-05-31 02:02:13 +00:00
|
|
|
doc_lose_neighbours="Lose and regain neighbours"
|
|
|
|
setup_lose_neighbours() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B +C create_single_identity
|
2013-12-13 07:18:58 +00:00
|
|
|
foreach_instance +A +B add_servald_interface 1
|
|
|
|
foreach_instance +B +C add_servald_interface 2
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B +C start_servald_server
|
2013-05-31 02:02:13 +00:00
|
|
|
}
|
|
|
|
test_lose_neighbours() {
|
|
|
|
wait_until path_exists +A +B +C
|
|
|
|
wait_until path_exists +C +B +A
|
|
|
|
stop_servald_server +B
|
|
|
|
foreach_instance +A +C \
|
|
|
|
wait_until --timeout=30 instance_offline +B
|
2013-06-11 00:47:41 +00:00
|
|
|
set_instance +A
|
|
|
|
wait_until --timeout=30 instance_offline +C
|
2013-05-31 02:02:13 +00:00
|
|
|
start_servald_server +B
|
2013-12-11 06:11:57 +00:00
|
|
|
wait_until --timeout=20 path_exists +A +B +C
|
|
|
|
wait_until --timeout=20 path_exists +C +B +A
|
2013-05-31 02:02:13 +00:00
|
|
|
}
|
|
|
|
|
2013-05-01 06:16:47 +00:00
|
|
|
setup_multi_interface() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
2013-12-13 07:18:58 +00:00
|
|
|
foreach_instance +A +B add_servald_interface --wifi 1
|
|
|
|
foreach_instance +A +B add_servald_interface --ethernet 2
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B start_servald_server
|
2013-05-01 06:16:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
doc_multi_interface="Multiple links of different types to the same neighbour"
|
|
|
|
test_multi_interface() {
|
|
|
|
set_instance +A
|
2013-12-16 04:24:16 +00:00
|
|
|
wait_until has_link --interface "dummy2.*" $SIDB
|
2013-08-30 07:53:24 +00:00
|
|
|
set_instance +B
|
2013-12-16 04:24:16 +00:00
|
|
|
wait_until has_link --interface "dummy2.*" $SIDA
|
2013-08-30 07:53:24 +00:00
|
|
|
set_instance +A
|
|
|
|
executeOk_servald config set interfaces.2.exclude 1
|
2013-12-16 04:24:16 +00:00
|
|
|
wait_until has_link --interface "dummy1.*" $SIDB
|
2013-08-30 07:53:24 +00:00
|
|
|
set_instance +B
|
2013-12-16 04:24:16 +00:00
|
|
|
wait_until has_link --interface "dummy1.*" $SIDA
|
2013-08-30 07:53:24 +00:00
|
|
|
set_instance +A
|
|
|
|
executeOk_servald config del interfaces.2.exclude
|
2013-12-16 04:24:16 +00:00
|
|
|
wait_until has_link --interface "dummy2.*" $SIDB
|
2013-05-01 06:16:47 +00:00
|
|
|
set_instance +B
|
2013-12-16 04:24:16 +00:00
|
|
|
wait_until has_link --interface "dummy2.*" $SIDA
|
2013-05-01 06:16:47 +00:00
|
|
|
}
|
|
|
|
|
2013-05-15 06:26:43 +00:00
|
|
|
# TODO assert that all packets arrive? assert that no duplicates arrive?
|
2013-05-15 04:57:38 +00:00
|
|
|
doc_ping_unreliable="Ping over a 1-hop unreliable link"
|
2013-05-15 02:03:43 +00:00
|
|
|
setup_ping_unreliable() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
2013-12-13 07:18:58 +00:00
|
|
|
foreach_instance +A +B add_servald_interface --file 1
|
2013-05-15 02:03:43 +00:00
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config \
|
2013-08-12 04:51:31 +00:00
|
|
|
set interfaces.1.drop_packets 40
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B start_servald_server
|
2013-05-15 02:03:43 +00:00
|
|
|
}
|
|
|
|
test_ping_unreliable() {
|
|
|
|
wait_until path_exists +A +B
|
|
|
|
wait_until path_exists +B +A
|
|
|
|
set_instance +A
|
2013-05-27 04:45:06 +00:00
|
|
|
executeOk_servald mdp ping --interval=0.100 --timeout=3 $SIDB 100
|
2013-05-24 04:22:31 +00:00
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2013-05-27 04:52:31 +00:00
|
|
|
doc_ping_unreliable2="Ping over a 2-hop unreliable link"
|
|
|
|
setup_ping_unreliable2() {
|
2013-05-24 04:22:31 +00:00
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B +C create_single_identity
|
2013-12-13 07:18:58 +00:00
|
|
|
foreach_instance +A +B add_servald_interface --file 1
|
2013-05-24 04:22:31 +00:00
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config \
|
2013-08-12 04:51:31 +00:00
|
|
|
set interfaces.1.drop_packets 40
|
2013-12-13 07:18:58 +00:00
|
|
|
foreach_instance +B +C add_servald_interface --file 2
|
2013-05-24 04:22:31 +00:00
|
|
|
foreach_instance +B +C \
|
|
|
|
executeOk_servald config \
|
2013-08-12 04:51:31 +00:00
|
|
|
set interfaces.2.drop_packets 40
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B +C start_servald_server
|
2013-05-24 04:22:31 +00:00
|
|
|
}
|
2013-05-27 04:52:31 +00:00
|
|
|
test_ping_unreliable2() {
|
2013-05-24 04:22:31 +00:00
|
|
|
wait_until path_exists +A +B +C
|
|
|
|
wait_until path_exists +C +B +A
|
|
|
|
set_instance +A
|
2013-05-27 04:45:06 +00:00
|
|
|
executeOk_servald mdp ping --interval=0.100 --timeout=3 $SIDC 100
|
2013-05-15 02:03:43 +00:00
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2013-05-20 03:53:35 +00:00
|
|
|
doc_brping_unreliable="Broadcast ping over a 1-hop unreliable link"
|
|
|
|
setup_brping_unreliable() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B create_single_identity
|
2013-12-13 07:18:58 +00:00
|
|
|
foreach_instance +A +B add_servald_interface --file 1
|
2013-05-20 03:53:35 +00:00
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config \
|
2013-08-12 04:51:31 +00:00
|
|
|
set interfaces.1.drop_packets 20
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B start_servald_server
|
2013-05-20 03:53:35 +00:00
|
|
|
}
|
|
|
|
test_brping_unreliable() {
|
|
|
|
wait_until path_exists +A +B
|
|
|
|
wait_until path_exists +B +A
|
|
|
|
set_instance +A
|
2013-05-27 04:45:06 +00:00
|
|
|
executeOk_servald mdp ping --interval=0.100 --timeout=2 broadcast 100
|
2013-05-20 03:53:35 +00:00
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2013-05-16 04:36:08 +00:00
|
|
|
doc_unreliable_links="Prefer a longer, better path vs an unreliable link"
|
2013-05-07 03:59:42 +00:00
|
|
|
setup_unreliable_links() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B +C create_single_identity
|
2013-12-13 07:18:58 +00:00
|
|
|
foreach_instance +A +B add_servald_interface --file 1
|
|
|
|
foreach_instance +B +C add_servald_interface --file 2
|
|
|
|
foreach_instance +A +C add_servald_interface --file 3
|
2013-05-07 03:59:42 +00:00
|
|
|
set_instance +A
|
|
|
|
executeOk_servald config \
|
2013-08-12 04:51:31 +00:00
|
|
|
set interfaces.1.drop_packets 5 \
|
|
|
|
set interfaces.3.drop_packets 70
|
2013-05-08 01:28:26 +00:00
|
|
|
set_instance +B
|
|
|
|
executeOk_servald config \
|
2013-08-12 04:51:31 +00:00
|
|
|
set interfaces.1.drop_packets 5 \
|
|
|
|
set interfaces.2.drop_packets 5
|
2013-05-07 03:59:42 +00:00
|
|
|
set_instance +C
|
|
|
|
executeOk_servald config \
|
2013-08-12 04:51:31 +00:00
|
|
|
set interfaces.2.drop_packets 5 \
|
|
|
|
set interfaces.3.drop_packets 70
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B +C start_servald_server
|
2013-05-07 03:59:42 +00:00
|
|
|
}
|
|
|
|
test_unreliable_links() {
|
2013-05-10 02:35:28 +00:00
|
|
|
wait_until path_exists +A +B +C
|
|
|
|
wait_until path_exists +C +B +A
|
2013-05-07 03:59:42 +00:00
|
|
|
set_instance +A
|
2013-05-16 04:36:08 +00:00
|
|
|
executeOk_servald mdp ping --interval=0.100 --timeout=3 $SIDC 30
|
2013-05-07 03:59:42 +00:00
|
|
|
tfw_cat --stdout --stderr
|
2013-05-20 03:53:35 +00:00
|
|
|
wait_until path_exists +A +B +C
|
|
|
|
wait_until path_exists +C +B +A
|
2013-05-07 03:59:42 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 01:28:26 +00:00
|
|
|
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
|
2013-12-13 07:18:58 +00:00
|
|
|
foreach_instance +A +B add_servald_interface --file 1
|
|
|
|
foreach_instance +A +C add_servald_interface --file 2
|
|
|
|
foreach_instance +A +D add_servald_interface --file 3
|
|
|
|
foreach_instance +B +C add_servald_interface --file 4
|
|
|
|
foreach_instance +B +D add_servald_interface --file 5
|
|
|
|
foreach_instance +C +D add_servald_interface --file 6
|
2013-05-08 01:28:26 +00:00
|
|
|
set_instance +A
|
|
|
|
executeOk_servald config \
|
2013-08-12 04:51:31 +00:00
|
|
|
set interfaces.1.drop_packets 5 \
|
|
|
|
set interfaces.2.drop_packets 40 \
|
|
|
|
set interfaces.3.drop_packets 90
|
2013-05-08 01:28:26 +00:00
|
|
|
set_instance +B
|
|
|
|
executeOk_servald config \
|
2013-08-12 04:51:31 +00:00
|
|
|
set interfaces.1.drop_packets 5 \
|
|
|
|
set interfaces.4.drop_packets 5 \
|
|
|
|
set interfaces.5.drop_packets 40
|
2013-05-08 01:28:26 +00:00
|
|
|
set_instance +C
|
|
|
|
executeOk_servald config \
|
2013-08-12 04:51:31 +00:00
|
|
|
set interfaces.2.drop_packets 40 \
|
|
|
|
set interfaces.4.drop_packets 5 \
|
|
|
|
set interfaces.6.drop_packets 5
|
2013-05-08 01:28:26 +00:00
|
|
|
set_instance +D
|
|
|
|
executeOk_servald config \
|
2013-08-12 04:51:31 +00:00
|
|
|
set interfaces.3.drop_packets 90 \
|
|
|
|
set interfaces.5.drop_packets 40 \
|
|
|
|
set interfaces.6.drop_packets 5
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B +C +D start_servald_server
|
2013-05-08 01:28:26 +00:00
|
|
|
}
|
|
|
|
test_unreliable_links2() {
|
2013-05-10 02:35:28 +00:00
|
|
|
wait_until path_exists +A +B +C +D
|
|
|
|
wait_until path_exists +D +C +B +A
|
2013-05-08 01:28:26 +00:00
|
|
|
set_instance +A
|
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDD 5
|
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2013-04-29 07:37:36 +00:00
|
|
|
setup_circle() {
|
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
|
|
|
foreach_instance +A +B +C +D +E +F +G +H create_single_identity
|
2013-12-13 07:18:58 +00:00
|
|
|
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 04:24:16 +00:00
|
|
|
foreach_instance +A +B +C +D +E +F +G +H start_servald_server
|
2013-04-29 07:37:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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 02:35:28 +00:00
|
|
|
wait_until path_exists +A +B +C
|
|
|
|
wait_until path_exists +C +B +A
|
2013-04-29 07:37:36 +00:00
|
|
|
set_instance +A
|
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDC 1
|
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
stop_servald_server +B
|
2013-04-30 07:05:45 +00:00
|
|
|
foreach_instance +A +C \
|
|
|
|
wait_until --timeout=10 instance_offline +B
|
2013-05-10 02:35:28 +00:00
|
|
|
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 07:05:45 +00:00
|
|
|
set_instance +A
|
2013-04-29 07:37:36 +00:00
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDC 1
|
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
}
|
|
|
|
|
2012-10-10 05:52:31 +00:00
|
|
|
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 07:18:58 +00:00
|
|
|
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-10-08 06:06:07 +00:00
|
|
|
foreach_instance +A +B +C +D +E +F +G +H \
|
|
|
|
executeOk_servald config \
|
|
|
|
set mdp.iftype.wifi.reachable_timeout_ms 60000
|
2013-12-16 04:24:16 +00:00
|
|
|
foreach_instance +A +B +C +D +E +F +G +H start_servald_server
|
2012-10-10 05:52:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
doc_crowded_mess="Multiple possible paths"
|
|
|
|
test_crowded_mess() {
|
2013-12-16 04:24:16 +00:00
|
|
|
set_instance +H
|
|
|
|
wait_until has_link --via "[0-9A-F]*" $SIDA
|
2012-10-10 05:52:31 +00:00
|
|
|
set_instance +A
|
2013-12-16 04:24:16 +00:00
|
|
|
wait_until has_link --via "[0-9A-F]*" $SIDH
|
2013-08-09 06:49:45 +00:00
|
|
|
executeOk_servald mdp ping --timeout=3 $SIDH 1
|
|
|
|
tfw_cat --stdout --stderr
|
2012-10-10 05:52:31 +00:00
|
|
|
}
|
|
|
|
|
2012-10-09 04:19:24 +00:00
|
|
|
runTests "$@"
|