2012-07-06 05:09:25 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Tests for Serval rhizome protocol.
|
|
|
|
#
|
2013-02-06 08:25:31 +00:00
|
|
|
# Copyright 2012 Serval Project, Inc.
|
2012-07-06 05:09:25 +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.
|
|
|
|
|
|
|
|
source "${0%/*}/../testframework.sh"
|
|
|
|
source "${0%/*}/../testdefs.sh"
|
|
|
|
source "${0%/*}/../testdefs_rhizome.sh"
|
|
|
|
|
|
|
|
shopt -s extglob
|
|
|
|
|
2012-10-18 01:16:32 +00:00
|
|
|
finally() {
|
|
|
|
stop_all_servald_servers
|
|
|
|
}
|
|
|
|
|
2012-07-06 05:09:25 +00:00
|
|
|
teardown() {
|
|
|
|
kill_all_servald_processes
|
|
|
|
assert_no_servald_processes
|
2012-10-18 01:16:32 +00:00
|
|
|
report_all_servald_servers
|
2012-07-06 05:09:25 +00:00
|
|
|
}
|
|
|
|
|
2014-03-12 03:59:27 +00:00
|
|
|
default_config() {
|
2012-12-06 02:01:19 +00:00
|
|
|
executeOk_servald config \
|
2013-04-05 07:09:23 +00:00
|
|
|
set log.console.level debug \
|
2013-04-05 06:25:14 +00:00
|
|
|
set log.console.show_pid on \
|
|
|
|
set log.console.show_time on \
|
2012-12-06 02:01:19 +00:00
|
|
|
set debug.rhizome on \
|
2014-01-31 07:32:41 +00:00
|
|
|
set debug.http_server on \
|
2013-10-26 15:07:07 +00:00
|
|
|
set debug.httpd on \
|
2013-11-28 07:14:37 +00:00
|
|
|
set debug.rhizome_manifest on \
|
|
|
|
set debug.rhizome_ads on \
|
2012-12-11 05:29:46 +00:00
|
|
|
set debug.rhizome_tx on \
|
2015-03-16 01:52:38 +00:00
|
|
|
set debug.rhizome_rx on
|
2012-07-06 05:09:25 +00:00
|
|
|
}
|
|
|
|
|
2014-03-12 03:59:27 +00:00
|
|
|
# Called by start_servald_instances for each instance.
|
|
|
|
configure_servald_server() {
|
|
|
|
add_servald_interface
|
|
|
|
default_config
|
|
|
|
}
|
|
|
|
|
2012-07-17 04:39:35 +00:00
|
|
|
setup_common() {
|
2012-07-06 05:09:25 +00:00
|
|
|
setup_servald
|
|
|
|
assert_no_servald_processes
|
2012-10-18 01:16:32 +00:00
|
|
|
foreach_instance +A +B create_single_identity
|
|
|
|
set_instance +B
|
2012-07-16 08:59:29 +00:00
|
|
|
}
|
|
|
|
|
2013-08-13 02:36:05 +00:00
|
|
|
receive_and_update_bundle() {
|
2013-11-30 19:19:50 +00:00
|
|
|
wait_until "$@" bundle_received_by $BID:$VERSION +B
|
2012-07-17 04:39:35 +00:00
|
|
|
set_instance +B
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald rhizome list
|
2012-10-17 07:40:39 +00:00
|
|
|
assert_rhizome_list --fromhere=0 file1
|
2012-10-18 07:16:17 +00:00
|
|
|
assert_rhizome_received file1
|
2012-07-17 04:39:35 +00:00
|
|
|
set_instance +A
|
2012-10-18 07:16:17 +00:00
|
|
|
rhizome_update_file file1 file2
|
2012-07-11 07:13:21 +00:00
|
|
|
set_instance +B
|
2013-11-30 19:19:50 +00:00
|
|
|
wait_until "$@" bundle_received_by $BID:$VERSION +B
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald rhizome list
|
2012-10-17 07:40:39 +00:00
|
|
|
assert_rhizome_list --fromhere=0 file2
|
2012-10-18 07:16:17 +00:00
|
|
|
assert_rhizome_received file2
|
2012-07-06 05:09:25 +00:00
|
|
|
}
|
2012-07-17 04:39:35 +00:00
|
|
|
|
2013-08-13 02:36:05 +00:00
|
|
|
doc_FileTransfer="New bundle and update transfer to one node"
|
|
|
|
setup_FileTransfer() {
|
|
|
|
setup_common
|
|
|
|
set_instance +A
|
2013-11-11 05:51:26 +00:00
|
|
|
rhizome_add_file file1 250000
|
2013-08-13 02:36:05 +00:00
|
|
|
start_servald_instances +A +B
|
|
|
|
foreach_instance +A assert_peers_are_instances +B
|
|
|
|
foreach_instance +B assert_peers_are_instances +A
|
|
|
|
}
|
|
|
|
test_FileTransfer() {
|
|
|
|
receive_and_update_bundle
|
|
|
|
}
|
|
|
|
|
2013-01-03 05:42:24 +00:00
|
|
|
doc_EncryptedTransfer="Encrypted payload can be opened by destination"
|
|
|
|
setup_EncryptedTransfer() {
|
|
|
|
setup_common
|
|
|
|
set_instance +A
|
|
|
|
echo "Clear Text" >file1
|
|
|
|
echo -e "service=MeshMS1\nsender=$SIDA\nrecipient=$SIDB" >file1.manifest
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald rhizome add file $SIDA file1 file1.manifest
|
2013-01-03 05:42:24 +00:00
|
|
|
extract_manifest_id BID file1.manifest
|
|
|
|
extract_manifest_version VERSION file1.manifest
|
|
|
|
start_servald_instances +A +B
|
|
|
|
foreach_instance +A assert_peers_are_instances +B
|
|
|
|
foreach_instance +B assert_peers_are_instances +A
|
|
|
|
}
|
|
|
|
test_EncryptedTransfer() {
|
|
|
|
wait_until bundle_received_by $BID:$VERSION +B
|
|
|
|
set_instance +B
|
|
|
|
executeOk_servald rhizome extract file $BID file1x
|
|
|
|
assert diff file1 file1x
|
|
|
|
}
|
|
|
|
|
2013-03-05 00:25:18 +00:00
|
|
|
doc_NoFetch="Disabling fetching still allows pushing bundles"
|
|
|
|
setup_NoFetch() {
|
|
|
|
setup_common
|
|
|
|
set_instance +A
|
|
|
|
rhizome_add_file file1
|
|
|
|
BID1=$BID
|
|
|
|
VERSION1=$VERSION
|
|
|
|
set_instance +B
|
|
|
|
rhizome_add_file file2
|
|
|
|
BID2=$BID
|
|
|
|
VERSION2=$VERSION
|
|
|
|
executeOk_servald config set rhizome.fetch 0
|
|
|
|
start_servald_instances +A +B
|
|
|
|
}
|
|
|
|
test_NoFetch() {
|
|
|
|
wait_until bundle_received_by $BID2:$VERSION2 +A
|
|
|
|
set_instance +A
|
|
|
|
executeOk_servald rhizome list
|
|
|
|
assert_rhizome_list --fromhere=1 file1 --fromhere=0 file2
|
|
|
|
set_instance +B
|
|
|
|
executeOk_servald rhizome list
|
|
|
|
assert_rhizome_list --fromhere=1 file2
|
|
|
|
}
|
|
|
|
|
2012-11-30 04:32:34 +00:00
|
|
|
doc_DisablingHTTPServer="Disabling HTTP rhizome transports works"
|
|
|
|
setup_DisablingHTTPServer() {
|
|
|
|
setup_common
|
|
|
|
set_instance +A
|
2013-08-20 23:51:40 +00:00
|
|
|
rhizome_add_file file1 2048
|
2012-11-30 04:32:34 +00:00
|
|
|
executeOk_servald config set rhizome.http.enable 0
|
|
|
|
start_servald_instances +A
|
|
|
|
}
|
|
|
|
test_DisablingHTTPServer() {
|
2012-11-30 04:36:31 +00:00
|
|
|
!rhizome_http_server_started
|
2012-11-30 04:32:34 +00:00
|
|
|
}
|
|
|
|
|
2012-11-30 07:12:17 +00:00
|
|
|
doc_HTTPTransport="Rhizome over HTTP transport"
|
|
|
|
setup_HTTPTransport() {
|
|
|
|
setup_common
|
|
|
|
set_instance +B
|
2013-08-15 04:23:37 +00:00
|
|
|
executeOk_servald config set rhizome.mdp.enable 0
|
2012-11-30 07:12:17 +00:00
|
|
|
set_instance +A
|
2013-08-15 04:23:37 +00:00
|
|
|
executeOk_servald config set rhizome.mdp.enable 0
|
2013-08-20 23:51:40 +00:00
|
|
|
rhizome_add_file file1 2048
|
2012-11-30 07:12:17 +00:00
|
|
|
start_servald_instances +A +B
|
|
|
|
foreach_instance +A assert_peers_are_instances +B
|
|
|
|
foreach_instance +B assert_peers_are_instances +A
|
|
|
|
}
|
|
|
|
test_HTTPTransport() {
|
2013-08-13 02:36:05 +00:00
|
|
|
receive_and_update_bundle
|
2012-11-30 07:12:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
doc_MDPTransport="Rhizome over MDP transport"
|
|
|
|
setup_MDPTransport() {
|
|
|
|
setup_common
|
2013-07-17 06:17:35 +00:00
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config \
|
|
|
|
set rhizome.http.enable 0
|
2012-11-30 07:12:17 +00:00
|
|
|
set_instance +A
|
2013-08-20 23:51:40 +00:00
|
|
|
rhizome_add_file file1 2048
|
2012-11-30 07:12:17 +00:00
|
|
|
start_servald_instances +A +B
|
|
|
|
foreach_instance +A assert_peers_are_instances +B
|
|
|
|
foreach_instance +B assert_peers_are_instances +A
|
|
|
|
}
|
|
|
|
test_MDPTransport() {
|
2013-08-13 02:36:05 +00:00
|
|
|
receive_and_update_bundle
|
|
|
|
}
|
|
|
|
|
2013-08-25 07:07:44 +00:00
|
|
|
doc_MDPTransportFailOver="Rhizome fails over to MDP transport"
|
|
|
|
setup_MDPTransportFailOver() {
|
|
|
|
setup_common
|
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config \
|
2014-01-31 07:32:41 +00:00
|
|
|
set debug.nohttptx 1 \
|
2013-08-25 07:07:44 +00:00
|
|
|
set rhizome.mdp.enable 1
|
|
|
|
set_instance +A
|
|
|
|
rhizome_add_file file1 2048
|
|
|
|
start_servald_instances +A +B
|
|
|
|
foreach_instance +A assert_peers_are_instances +B
|
|
|
|
foreach_instance +B assert_peers_are_instances +A
|
|
|
|
}
|
|
|
|
test_MDPTransportFailOver() {
|
|
|
|
receive_and_update_bundle
|
|
|
|
}
|
|
|
|
|
2013-08-13 02:36:05 +00:00
|
|
|
doc_UnicastTransfer="Rhizome over unicast MDP link"
|
|
|
|
setup_UnicastTransfer() {
|
2014-03-12 03:59:27 +00:00
|
|
|
configure_servald_server() {
|
|
|
|
default_config
|
|
|
|
executeOk_servald config \
|
|
|
|
set rhizome.http.enable 0
|
|
|
|
}
|
2013-08-13 02:36:05 +00:00
|
|
|
setup_common
|
2012-11-30 07:12:17 +00:00
|
|
|
set_instance +A
|
2014-03-12 03:59:27 +00:00
|
|
|
add_servald_interface --file
|
2013-08-20 23:51:40 +00:00
|
|
|
rhizome_add_file file1 2048
|
2012-11-30 07:12:17 +00:00
|
|
|
set_instance +B
|
2014-03-12 03:59:27 +00:00
|
|
|
add_servald_interface --file
|
2013-08-13 02:36:05 +00:00
|
|
|
executeOk_servald config \
|
2015-03-16 01:52:38 +00:00
|
|
|
set interfaces.1.broadcast.drop on
|
2013-08-13 02:36:05 +00:00
|
|
|
start_servald_instances +A +B
|
|
|
|
foreach_instance +A assert_peers_are_instances +B
|
|
|
|
foreach_instance +B assert_peers_are_instances +A
|
2012-11-30 07:12:17 +00:00
|
|
|
}
|
2013-08-13 02:36:05 +00:00
|
|
|
test_UnicastTransfer() {
|
|
|
|
receive_and_update_bundle
|
|
|
|
}
|
|
|
|
|
2013-09-13 04:32:35 +00:00
|
|
|
|
2013-08-15 04:23:37 +00:00
|
|
|
doc_journalMDP="Transfer and update a journal bundle via MDP"
|
|
|
|
setup_journalMDP() {
|
|
|
|
setup_common
|
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config \
|
|
|
|
set rhizome.http.enable 0
|
|
|
|
set_instance +A
|
2013-08-20 23:51:40 +00:00
|
|
|
create_file file1 2048
|
|
|
|
create_file file2 2048
|
2013-08-15 04:23:37 +00:00
|
|
|
executeOk_servald rhizome journal append $SIDA "" file1
|
|
|
|
extract_stdout_manifestid BID
|
|
|
|
extract_stdout_version VERSION
|
|
|
|
start_servald_instances +A +B
|
|
|
|
foreach_instance +A assert_peers_are_instances +B
|
|
|
|
foreach_instance +B assert_peers_are_instances +A
|
|
|
|
}
|
|
|
|
test_journalMDP() {
|
|
|
|
wait_until bundle_received_by $BID:$VERSION +B
|
|
|
|
set_instance +A
|
|
|
|
executeOk_servald rhizome journal append $SIDA $BID file2
|
|
|
|
extract_stdout_version VERSION2
|
|
|
|
set_instance +B
|
|
|
|
wait_until bundle_received_by $BID:$VERSION2 +B
|
|
|
|
assertGrep $instance_servald_log "Copying [0-9]\+ bytes from previous journal"
|
|
|
|
}
|
2012-11-30 07:12:17 +00:00
|
|
|
|
2013-08-15 07:30:43 +00:00
|
|
|
doc_journalHTTP="Transfer and update a journal bundle via HTTP"
|
|
|
|
setup_journalHTTP() {
|
|
|
|
setup_common
|
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config \
|
|
|
|
set rhizome.mdp.enable 0
|
|
|
|
set_instance +A
|
2013-08-20 23:51:40 +00:00
|
|
|
create_file file1 2048
|
|
|
|
create_file file2 2048
|
2013-08-15 07:30:43 +00:00
|
|
|
executeOk_servald rhizome journal append $SIDA "" file1
|
|
|
|
extract_stdout_manifestid BID
|
|
|
|
extract_stdout_version VERSION
|
|
|
|
start_servald_instances +A +B
|
|
|
|
foreach_instance +A assert_peers_are_instances +B
|
|
|
|
foreach_instance +B assert_peers_are_instances +A
|
|
|
|
}
|
|
|
|
test_journalHTTP() {
|
|
|
|
wait_until bundle_received_by $BID:$VERSION +B
|
|
|
|
set_instance +A
|
|
|
|
executeOk_servald rhizome journal append $SIDA $BID file2
|
|
|
|
extract_stdout_version VERSION2
|
|
|
|
set_instance +B
|
|
|
|
wait_until bundle_received_by $BID:$VERSION2 +B
|
|
|
|
assertGrep $instance_servald_log "Copying [0-9]\+ bytes from previous journal"
|
|
|
|
}
|
|
|
|
|
2013-02-20 03:59:08 +00:00
|
|
|
#common setup and test routines for transferring a 1MB file
|
|
|
|
setup_bigfile_common() {
|
2012-11-30 12:27:34 +00:00
|
|
|
set_instance +A
|
|
|
|
dd if=/dev/urandom of=file1 bs=1k count=1k 2>&1
|
|
|
|
echo x >>file1
|
|
|
|
ls -l file1
|
|
|
|
rhizome_add_file file1
|
|
|
|
start_servald_instances +A +B
|
|
|
|
foreach_instance +A assert_peers_are_instances +B
|
|
|
|
foreach_instance +B assert_peers_are_instances +A
|
|
|
|
}
|
2013-02-20 03:59:08 +00:00
|
|
|
bigfile_common_test() {
|
2012-11-30 12:27:34 +00:00
|
|
|
set_instance +B
|
2013-08-13 02:36:05 +00:00
|
|
|
wait_until --timeout=120 bundle_received_by $BID:$VERSION +B
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald rhizome list
|
2012-11-30 12:27:34 +00:00
|
|
|
assert_rhizome_list --fromhere=0 file1
|
|
|
|
assert_rhizome_received file1
|
|
|
|
}
|
|
|
|
|
2013-02-20 03:59:08 +00:00
|
|
|
doc_FileTransferBigMDP="Big new bundle transfers to one node via MDP"
|
|
|
|
setup_FileTransferBigMDP() {
|
|
|
|
setup_common
|
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config set rhizome.http.enable 0
|
|
|
|
setup_bigfile_common
|
|
|
|
}
|
|
|
|
test_FileTransferBigMDP() {
|
|
|
|
bigfile_common_test
|
|
|
|
}
|
|
|
|
|
2013-07-17 06:17:35 +00:00
|
|
|
doc_FileTransferUnreliableBigMDP="Big new bundle over unreliable MDP transport"
|
|
|
|
setup_FileTransferUnreliableBigMDP() {
|
2014-03-12 03:59:27 +00:00
|
|
|
configure_servald_server() {
|
|
|
|
add_servald_interface --file
|
|
|
|
default_config
|
|
|
|
executeOk_servald config \
|
|
|
|
set rhizome.http.enable 0 \
|
|
|
|
set interfaces.1.drop_packets 10
|
|
|
|
}
|
2013-07-17 06:17:35 +00:00
|
|
|
setup_common
|
|
|
|
setup_bigfile_common
|
|
|
|
}
|
|
|
|
test_FileTransferUnreliableBigMDP() {
|
|
|
|
bigfile_common_test
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-11-30 12:27:34 +00:00
|
|
|
doc_FileTransferBig="Big new bundle transfers to one node via HTTP"
|
2012-07-17 04:39:35 +00:00
|
|
|
setup_FileTransferBig() {
|
|
|
|
setup_common
|
2013-02-20 03:59:08 +00:00
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config set rhizome.mdp.enable 0
|
|
|
|
setup_bigfile_common
|
2012-07-17 04:39:35 +00:00
|
|
|
}
|
|
|
|
test_FileTransferBig() {
|
2013-02-20 03:59:08 +00:00
|
|
|
bigfile_common_test
|
2012-07-17 04:39:35 +00:00
|
|
|
}
|
|
|
|
|
2013-02-20 03:59:08 +00:00
|
|
|
doc_FileTransferBigMDPExtBlob="Big new bundle transfers to one node via MDP, external blob file"
|
|
|
|
setup_FileTransferBigMDPExtBlob() {
|
2012-07-17 04:39:35 +00:00
|
|
|
setup_common
|
2013-02-20 03:59:08 +00:00
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config \
|
|
|
|
set rhizome.http.enable 0 \
|
2013-12-30 04:21:20 +00:00
|
|
|
set rhizome.max_blob_size 0 \
|
2014-03-12 03:18:08 +00:00
|
|
|
set debug.rhizome_store 1
|
2013-02-20 03:59:08 +00:00
|
|
|
setup_bigfile_common
|
2012-07-11 08:12:30 +00:00
|
|
|
}
|
2013-02-20 03:59:08 +00:00
|
|
|
test_FileTransferBigMDPExtBlob() {
|
|
|
|
bigfile_common_test
|
2012-07-11 08:12:30 +00:00
|
|
|
}
|
|
|
|
|
2013-02-20 03:59:08 +00:00
|
|
|
doc_FileTransferBigHTTPExtBlob="Big new bundle transfers to one node via HTTP, external blob file"
|
|
|
|
setup_FileTransferBigHTTPExtBlob() {
|
2012-12-01 00:26:48 +00:00
|
|
|
setup_common
|
2013-02-20 03:59:08 +00:00
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config \
|
|
|
|
set rhizome.mdp.enable 0 \
|
2013-12-30 04:21:20 +00:00
|
|
|
set rhizome.max_blob_size 0 \
|
2014-03-12 03:18:08 +00:00
|
|
|
set debug.rhizome_store 1
|
2013-02-20 03:59:08 +00:00
|
|
|
setup_bigfile_common
|
|
|
|
}
|
|
|
|
test_FileTransferBigHTTPExtBlob() {
|
|
|
|
bigfile_common_test
|
|
|
|
}
|
|
|
|
|
|
|
|
# common setup and test routines for transfers to 4 nodes
|
|
|
|
setup_multitransfer_common() {
|
2012-12-01 00:26:48 +00:00
|
|
|
set_instance +A
|
2013-08-20 23:51:40 +00:00
|
|
|
rhizome_add_file file1 2048
|
2013-02-20 03:59:08 +00:00
|
|
|
start_servald_instances +A +B +C +D +E
|
|
|
|
set_instance +A
|
|
|
|
assert_peers_are_instances +B +C +D +E
|
2012-12-01 00:26:48 +00:00
|
|
|
set_instance +B
|
2013-02-20 03:59:08 +00:00
|
|
|
assert_peers_are_instances +A +C +D +E
|
2012-12-01 00:26:48 +00:00
|
|
|
set_instance +C
|
2013-02-20 03:59:08 +00:00
|
|
|
assert_peers_are_instances +A +B +D +E
|
2012-12-01 00:26:48 +00:00
|
|
|
set_instance +D
|
2013-02-20 03:59:08 +00:00
|
|
|
assert_peers_are_instances +A +B +C +E
|
2012-12-01 00:26:48 +00:00
|
|
|
set_instance +E
|
2013-02-20 03:59:08 +00:00
|
|
|
assert_peers_are_instances +A +B +C +D
|
2012-12-01 00:26:48 +00:00
|
|
|
}
|
2013-02-20 03:59:08 +00:00
|
|
|
multitransfer_common_test() {
|
2012-12-01 00:26:48 +00:00
|
|
|
wait_until bundle_received_by $BID:$VERSION +B +C +D +E
|
|
|
|
for i in B C D E; do
|
|
|
|
set_instance +$i
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald rhizome list
|
2012-12-01 00:26:48 +00:00
|
|
|
assert_rhizome_list --fromhere=0 file1
|
|
|
|
assert_rhizome_received file1
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2013-02-20 03:59:08 +00:00
|
|
|
doc_FileTransferMulti="New bundle transfers to four nodes via HTTP"
|
|
|
|
setup_FileTransferMulti() {
|
2013-02-17 06:31:23 +00:00
|
|
|
setup_common
|
2013-02-20 03:59:08 +00:00
|
|
|
foreach_instance +A +B +C +D +E \
|
|
|
|
executeOk_servald config set rhizome.mdp.enable 0
|
|
|
|
setup_multitransfer_common
|
2013-02-17 06:31:23 +00:00
|
|
|
}
|
2013-02-20 03:59:08 +00:00
|
|
|
test_FileTransferMulti() {
|
|
|
|
multitransfer_common_test
|
|
|
|
}
|
|
|
|
|
|
|
|
doc_FileTransferMultiMDP="New bundle transfers to four nodes via MDP"
|
|
|
|
setup_FileTransferMultiMDP() {
|
|
|
|
setup_common
|
|
|
|
foreach_instance +A +B +C +D +E \
|
|
|
|
executeOk_servald config set rhizome.http.enable 0
|
|
|
|
setup_multitransfer_common
|
|
|
|
}
|
|
|
|
test_FileTransferMultiMDP() {
|
|
|
|
multitransfer_common_test
|
2013-02-17 06:31:23 +00:00
|
|
|
}
|
|
|
|
|
2013-02-16 09:55:26 +00:00
|
|
|
doc_FileTransferMultiMDPExtBlob="New bundle transfers to four nodes via MDP, external blob files"
|
|
|
|
setup_FileTransferMultiMDPExtBlob() {
|
|
|
|
setup_common
|
2013-02-20 03:59:08 +00:00
|
|
|
foreach_instance +A +B +C +D +E \
|
|
|
|
executeOk_servald config \
|
|
|
|
set rhizome.http.enable 0 \
|
2013-12-30 04:21:20 +00:00
|
|
|
set rhizome.max_blob_size 0 \
|
2014-03-12 03:18:08 +00:00
|
|
|
set debug.rhizome_store 1
|
2013-02-20 03:59:08 +00:00
|
|
|
setup_multitransfer_common
|
2013-02-16 09:55:26 +00:00
|
|
|
}
|
|
|
|
test_FileTransferMultiMDPExtBlob() {
|
2013-02-20 03:59:08 +00:00
|
|
|
multitransfer_common_test
|
|
|
|
}
|
|
|
|
|
|
|
|
doc_FileTransferMultiHTTPExtBlob="New bundle transfers to four nodes via HTTP, external blob files"
|
|
|
|
setup_FileTransferMultiHTTPExtBlob() {
|
|
|
|
setup_common
|
|
|
|
foreach_instance +A +B +C +D +E \
|
|
|
|
executeOk_servald config \
|
|
|
|
set rhizome.mdp.enable 0 \
|
2013-12-30 04:21:20 +00:00
|
|
|
set rhizome.max_blob_size 0 \
|
2014-03-12 03:18:08 +00:00
|
|
|
set debug.rhizome_store 1
|
2013-02-20 03:59:08 +00:00
|
|
|
setup_multitransfer_common
|
|
|
|
}
|
|
|
|
test_FileTransferMultiHTTPExtBlob() {
|
|
|
|
multitransfer_common_test
|
2013-02-16 09:55:26 +00:00
|
|
|
}
|
2012-12-01 00:26:48 +00:00
|
|
|
|
2012-07-17 04:39:35 +00:00
|
|
|
doc_FileTransferDelete="Payload deletion transfers to one node"
|
2012-07-16 08:59:29 +00:00
|
|
|
setup_FileTransferDelete() {
|
2012-07-17 04:39:35 +00:00
|
|
|
setup_common
|
|
|
|
set_instance +A
|
2012-10-18 07:16:17 +00:00
|
|
|
rhizome_add_file file1
|
2012-07-16 08:59:29 +00:00
|
|
|
start_servald_instances +A +B
|
2012-09-14 06:39:28 +00:00
|
|
|
foreach_instance +A assert_peers_are_instances +B
|
|
|
|
foreach_instance +B assert_peers_are_instances +A
|
2012-10-17 07:40:39 +00:00
|
|
|
wait_until bundle_received_by $BID:$VERSION +B
|
2012-07-16 08:59:29 +00:00
|
|
|
set_instance +A
|
|
|
|
>file1_2
|
2012-10-18 07:16:17 +00:00
|
|
|
rhizome_update_file file1 file1_2
|
2012-07-16 08:59:29 +00:00
|
|
|
}
|
|
|
|
test_FileTransferDelete() {
|
2012-10-17 07:40:39 +00:00
|
|
|
wait_until bundle_received_by $BID:$VERSION +B
|
2012-07-16 08:59:29 +00:00
|
|
|
set_instance +B
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald rhizome list
|
2012-10-17 07:40:39 +00:00
|
|
|
assert_rhizome_list --fromhere=0 file1_2
|
2012-10-18 07:16:17 +00:00
|
|
|
assert_rhizome_received file1_2
|
2012-07-16 08:59:29 +00:00
|
|
|
}
|
|
|
|
|
2013-08-22 05:44:21 +00:00
|
|
|
doc_CorruptPayload="A corrupted payload should be re-fetched"
|
|
|
|
setup_CorruptPayload() {
|
|
|
|
setup_common
|
|
|
|
set_instance +A
|
2014-03-12 03:18:08 +00:00
|
|
|
executeOk_servald config \
|
|
|
|
set rhizome.max_blob_size 0 \
|
|
|
|
set debug.rhizome_store 1
|
2013-08-22 05:44:21 +00:00
|
|
|
rhizome_add_file file1 1024
|
|
|
|
start_servald_instances +A +B
|
|
|
|
wait_until bundle_received_by $BID:$VERSION +B
|
2014-03-07 06:25:38 +00:00
|
|
|
assert cmp file1 "$SERVALINSTANCE_PATH/blob/$FILEHASH"
|
|
|
|
create_file file2 1024
|
2015-11-30 13:49:01 +00:00
|
|
|
assert --error-on-fail ! cmp file1 file2
|
2014-03-07 06:25:38 +00:00
|
|
|
cp file2 "$SERVALINSTANCE_PATH/blob/$FILEHASH"
|
2013-08-22 05:44:21 +00:00
|
|
|
execute --exit-status=255 $servald rhizome extract file $BID file1a
|
2014-03-07 06:25:38 +00:00
|
|
|
# TODO at the moment, the re-fetch is only triggered by restarting the
|
|
|
|
# daemon. Eventually (when the Rhizome Rank is implemented), the re-fetch
|
|
|
|
# shoud be automatic and immediate without restarting the daemon.
|
2013-08-22 05:44:21 +00:00
|
|
|
stop_servald_server
|
|
|
|
start_servald_server
|
2014-03-07 06:25:38 +00:00
|
|
|
}
|
|
|
|
test_CorruptPayload() {
|
2014-02-27 23:30:49 +00:00
|
|
|
wait_until grep -i "Stored file $FILEHASH" $LOGA
|
2014-03-07 06:25:38 +00:00
|
|
|
executeOk $servald rhizome extract file $BID file1a
|
2014-02-27 23:30:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
doc_MissingPayload="A missing payload should be re-fetched"
|
|
|
|
setup_MissingPayload() {
|
|
|
|
setup_common
|
|
|
|
set_instance +A
|
2014-03-12 03:18:08 +00:00
|
|
|
executeOk_servald config \
|
|
|
|
set rhizome.max_blob_size 0 \
|
|
|
|
set debug.rhizome_store 1
|
2014-02-27 23:30:49 +00:00
|
|
|
rhizome_add_file file1 1024
|
2014-03-07 06:25:38 +00:00
|
|
|
assert cmp file1 "$SERVALINSTANCE_PATH/blob/$FILEHASH"
|
2014-02-27 23:30:49 +00:00
|
|
|
start_servald_instances +A +B
|
|
|
|
wait_until bundle_received_by $BID:$VERSION +B
|
2014-03-07 06:25:38 +00:00
|
|
|
rm -f "$SERVALINSTANCE_PATH/blob/$FILEHASH"
|
2014-03-03 04:41:50 +00:00
|
|
|
execute --exit-status=1 --stderr $servald rhizome extract file $BID file1a
|
|
|
|
# TODO at the moment, the re-fetch is only triggered by restarting the
|
|
|
|
# daemon. Eventually (when the Rhizome Rank is implemented), the re-fetch
|
|
|
|
# shoud be automatic and immediate without restarting the daemon.
|
2014-02-27 23:30:49 +00:00
|
|
|
stop_servald_server
|
|
|
|
start_servald_server
|
2014-03-03 04:41:50 +00:00
|
|
|
}
|
|
|
|
test_MissingPayload() {
|
2013-08-22 05:44:21 +00:00
|
|
|
wait_until grep -i "Stored file $FILEHASH" $LOGA
|
2014-03-03 04:41:50 +00:00
|
|
|
executeOk $servald rhizome extract file $BID file1a
|
2013-08-22 05:44:21 +00:00
|
|
|
}
|
|
|
|
|
2014-06-06 04:09:50 +00:00
|
|
|
doc_ConnectOnEnable="Enable and disable rhizome while fetching"
|
|
|
|
setup_ConnectOnEnable(){
|
|
|
|
setup_common
|
|
|
|
set_instance +A
|
|
|
|
dd if=/dev/urandom of=file1 bs=1k count=1k 2>&1
|
|
|
|
echo x >>file1
|
|
|
|
rhizome_add_file file1
|
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config \
|
|
|
|
set rhizome.enable off
|
|
|
|
start_servald_instances +A +B
|
|
|
|
}
|
|
|
|
test_ConnectOnEnable(){
|
|
|
|
# TODO try to force disabling rhizome mid transfer
|
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config \
|
|
|
|
set rhizome.enable on \
|
|
|
|
sync
|
|
|
|
sleep 2
|
|
|
|
foreach_instance +A +B \
|
|
|
|
executeOk_servald config \
|
|
|
|
set rhizome.enable off \
|
|
|
|
sync
|
|
|
|
sleep 3
|
|
|
|
}
|
|
|
|
|
2013-10-26 09:58:47 +00:00
|
|
|
doc_HttpFetchRange="Fetch a file range using HTTP GET"
|
2013-08-15 06:17:39 +00:00
|
|
|
setup_HttpFetchRange() {
|
2013-10-14 06:18:20 +00:00
|
|
|
setup_curl 7
|
2013-08-15 06:17:39 +00:00
|
|
|
setup_common
|
|
|
|
set_instance +A
|
2013-10-26 09:58:47 +00:00
|
|
|
rhizome_add_file file1 100
|
|
|
|
tail --bytes +33 file1 >file1.tail
|
2013-08-15 06:17:39 +00:00
|
|
|
start_servald_instances +A
|
|
|
|
wait_until rhizome_http_server_started +A
|
|
|
|
get_rhizome_server_port PORTA +A
|
|
|
|
}
|
|
|
|
test_HttpFetchRange() {
|
|
|
|
executeOk curl \
|
|
|
|
--silent --fail --show-error \
|
|
|
|
--output http.output \
|
|
|
|
--dump-header http.headers \
|
|
|
|
--write-out '%{http_code}\n' \
|
|
|
|
--continue-at 32 \
|
|
|
|
"http://$addr_localhost:$PORTA/rhizome/file/$FILEHASH"
|
2013-10-26 09:58:47 +00:00
|
|
|
tfw_cat -v http.headers http.output
|
|
|
|
assertGrep http.headers "^Content-Range: bytes 32-99/100
$"
|
|
|
|
assertGrep http.headers "^Content-Length: 68
$"
|
|
|
|
tfw_cat -v file1.tail http.output
|
|
|
|
assert cmp file1.tail http.output
|
2013-08-15 06:17:39 +00:00
|
|
|
}
|
|
|
|
|
2012-10-02 07:46:44 +00:00
|
|
|
doc_HttpImport="Import bundle using HTTP POST multi-part form."
|
|
|
|
setup_HttpImport() {
|
2013-10-14 06:18:20 +00:00
|
|
|
setup_curl 7
|
2012-10-02 07:46:44 +00:00
|
|
|
setup_common
|
|
|
|
cat >README.WHYNOTSIPS <<'EOF'
|
|
|
|
When we were looking at implementing secure calls for OpenBTS it was suggested
|
|
|
|
that we configure Asterisk to use SIPS/ZRTP. This would have been relatively
|
|
|
|
easy to setup, however there are a few problems.
|
2012-10-18 07:16:17 +00:00
|
|
|
.
|
2012-10-02 07:46:44 +00:00
|
|
|
Number one is that when Asterisk checks the certificates it will either
|
|
|
|
validate the certificate (checking the chain of trust and so on) and then
|
|
|
|
check that the common name attribute on the certificate matches the hostname
|
|
|
|
of the peer, or it will do none of these checks. This code is in main/tcptls.c
|
|
|
|
line 206 (in version 1.8.14.1).
|
2012-10-18 07:16:17 +00:00
|
|
|
.
|
2012-10-02 07:46:44 +00:00
|
|
|
This is undesirable in a setup where there is limited or no infrastructure as
|
|
|
|
there is not likely to be a DNS server setup, or even rigid IP assignments
|
|
|
|
that would allow a static hosts file based setup. This situation would force
|
|
|
|
the administrator to disable the checks completely which would allow a trivial
|
|
|
|
man in the middle attack.
|
2012-10-18 07:16:17 +00:00
|
|
|
.
|
2012-10-02 07:46:44 +00:00
|
|
|
It would be possible to modify Asterisk to have a third way where it validates
|
|
|
|
the certificate and checks the chain of trust but does not look at the common
|
|
|
|
name. We decided against this approach as the VOMP channel driver was written
|
|
|
|
in time to avoid it.
|
|
|
|
EOF
|
|
|
|
set_instance +B
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald rhizome add file $SIDB README.WHYNOTSIPS README.WHYNOTSIPS.manifest
|
2012-10-02 07:46:44 +00:00
|
|
|
assert_manifest_complete README.WHYNOTSIPS.manifest
|
|
|
|
assert_stdout_add_file README.WHYNOTSIPS
|
|
|
|
set_instance +A
|
|
|
|
start_servald_instances +A
|
|
|
|
wait_until rhizome_http_server_started +A
|
|
|
|
get_rhizome_server_port PORTA +A
|
|
|
|
}
|
|
|
|
test_HttpImport() {
|
|
|
|
executeOk curl \
|
|
|
|
--silent --fail --show-error \
|
|
|
|
--output http.output \
|
|
|
|
--dump-header http.headers \
|
|
|
|
--write-out '%{http_code}\n' \
|
|
|
|
--form 'data=@README.WHYNOTSIPS' \
|
|
|
|
--form 'manifest=@README.WHYNOTSIPS.manifest' \
|
|
|
|
"$addr_localhost:$PORTA/rhizome/import"
|
|
|
|
tfw_cat http.headers http.output
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald rhizome list
|
2012-10-17 07:40:39 +00:00
|
|
|
assert_rhizome_list --fromhere=0 README.WHYNOTSIPS
|
2012-10-18 07:16:17 +00:00
|
|
|
assert_rhizome_received README.WHYNOTSIPS
|
2012-10-02 07:46:44 +00:00
|
|
|
}
|
|
|
|
|
2012-10-04 04:55:08 +00:00
|
|
|
doc_HttpAddLocal="Add file locally using HTTP, returns manifest"
|
|
|
|
setup_HttpAddLocal() {
|
2013-10-14 06:18:20 +00:00
|
|
|
setup_curl 7
|
2012-10-04 04:55:08 +00:00
|
|
|
setup_common
|
|
|
|
set_instance +A
|
2012-12-06 02:01:19 +00:00
|
|
|
executeOk_servald config \
|
|
|
|
set rhizome.api.addfile.uri_path "/rhizome/secretaddfile" \
|
|
|
|
set rhizome.api.addfile.default_author $SIDA
|
2012-10-04 04:55:08 +00:00
|
|
|
start_servald_instances +A
|
|
|
|
wait_until rhizome_http_server_started +A
|
|
|
|
get_rhizome_server_port PORTA +A
|
|
|
|
}
|
|
|
|
test_HttpAddLocal() {
|
|
|
|
echo 'File file1' >file1
|
2012-12-05 04:53:59 +00:00
|
|
|
executeOk curl --silent --form 'data=@file1' "http://${addr_localhost}:$PORTA/rhizome/secretaddfile" --output file1.manifest
|
2012-10-04 04:55:08 +00:00
|
|
|
assert_manifest_complete file1.manifest
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald rhizome list
|
2012-10-17 07:40:39 +00:00
|
|
|
assert_rhizome_list --fromhere=1 file1
|
2012-10-04 04:55:08 +00:00
|
|
|
extract_manifest_name name file1.manifest
|
|
|
|
assert [ "$name" = file1 ]
|
2012-10-18 07:16:17 +00:00
|
|
|
assert_rhizome_received file1
|
2012-10-04 04:55:08 +00:00
|
|
|
}
|
|
|
|
|
2013-02-08 00:09:41 +00:00
|
|
|
setup_direct() {
|
2012-08-27 06:59:46 +00:00
|
|
|
set_instance +A
|
2013-02-08 00:09:41 +00:00
|
|
|
rhizome_add_file fileA1 1000
|
|
|
|
BID_A1=$BID
|
|
|
|
VERSION_A1=$VERSION
|
|
|
|
rhizome_add_file fileA2 10000
|
|
|
|
BID_A2=$BID
|
|
|
|
VERSION_A2=$VERSION
|
|
|
|
rhizome_add_file fileA3 100000
|
|
|
|
BID_A3=$BID
|
|
|
|
VERSION_A3=$VERSION
|
2013-12-13 07:18:58 +00:00
|
|
|
start_servald_instances +A
|
2012-08-27 06:59:46 +00:00
|
|
|
wait_until rhizome_http_server_started +A
|
|
|
|
get_rhizome_server_port PORTA +A
|
|
|
|
set_instance +B
|
2012-12-06 02:01:19 +00:00
|
|
|
executeOk_servald config \
|
2013-04-05 06:25:14 +00:00
|
|
|
set log.console.level debug \
|
|
|
|
set log.console.show_time on \
|
2012-12-06 02:01:19 +00:00
|
|
|
set debug.rhizome on \
|
2014-01-31 07:32:41 +00:00
|
|
|
set debug.httpd on \
|
2012-12-11 05:29:46 +00:00
|
|
|
set debug.rhizome_tx on \
|
2013-04-02 04:24:46 +00:00
|
|
|
set debug.rhizome_rx on
|
2013-02-08 00:09:41 +00:00
|
|
|
rhizome_add_file fileB1 2000
|
|
|
|
BID_B1=$BID
|
|
|
|
VERSION_B1=$VERSION
|
|
|
|
rhizome_add_file fileB2 20000
|
|
|
|
BID_B2=$BID
|
|
|
|
VERSION_B2=$VERSION
|
|
|
|
rhizome_add_file fileB3 200000
|
|
|
|
BID_B3=$BID
|
|
|
|
VERSION_B3=$VERSION
|
2012-08-27 06:59:46 +00:00
|
|
|
}
|
|
|
|
|
2013-04-02 04:24:46 +00:00
|
|
|
setup_direct_peer() {
|
|
|
|
executeOk_servald config \
|
|
|
|
set rhizome.direct.peer.0 "http://${addr_localhost}:${PORTA}"
|
|
|
|
}
|
|
|
|
|
|
|
|
doc_DirectPush="One way direct push bundles to configured peer"
|
2012-10-04 04:55:08 +00:00
|
|
|
setup_DirectPush() {
|
2012-08-27 06:59:46 +00:00
|
|
|
setup_common
|
2013-02-08 00:09:41 +00:00
|
|
|
setup_direct
|
2013-04-02 04:24:46 +00:00
|
|
|
setup_direct_peer
|
2013-10-28 03:55:16 +00:00
|
|
|
executeOk ls -l
|
|
|
|
tfw_cat --stdout
|
2012-08-27 06:59:46 +00:00
|
|
|
}
|
2012-10-04 04:55:08 +00:00
|
|
|
test_DirectPush() {
|
2012-10-03 16:15:09 +00:00
|
|
|
set_instance +B
|
2012-10-03 15:55:55 +00:00
|
|
|
executeOk_servald rhizome direct push
|
2012-10-04 08:08:33 +00:00
|
|
|
tfw_cat --stdout --stderr
|
2013-02-08 00:09:41 +00:00
|
|
|
assert bundle_received_by $BID_B1:$VERSION_B1 $BID_B2:$VERSION_B2 $BID_B3:$VERSION_B3 +A
|
2012-10-03 16:15:09 +00:00
|
|
|
set_instance +A
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald rhizome list
|
2013-02-08 00:09:41 +00:00
|
|
|
assert_rhizome_list --fromhere=1 fileA1 fileA2 fileA3 --fromhere=0 fileB1 fileB2 fileB3
|
|
|
|
assert_rhizome_received fileB1
|
|
|
|
assert_rhizome_received fileB2
|
|
|
|
assert_rhizome_received fileB3
|
2012-10-02 10:31:46 +00:00
|
|
|
set_instance +B
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald rhizome list
|
2013-02-08 00:09:41 +00:00
|
|
|
assert_rhizome_list --fromhere=1 fileB1 fileB2 fileB3
|
2012-08-27 06:59:46 +00:00
|
|
|
}
|
|
|
|
|
2013-04-02 04:24:46 +00:00
|
|
|
doc_DirectPushArg="One way direct push bundles to given peer URL"
|
|
|
|
setup_DirectPushArg() {
|
|
|
|
setup_common
|
|
|
|
setup_direct
|
|
|
|
}
|
|
|
|
test_DirectPushArg() {
|
|
|
|
set_instance +B
|
|
|
|
executeOk_servald rhizome direct push "http://${addr_localhost}:${PORTA}"
|
|
|
|
tfw_cat --stdout --stderr
|
|
|
|
assert bundle_received_by $BID_B1:$VERSION_B1 $BID_B2:$VERSION_B2 $BID_B3:$VERSION_B3 +A
|
|
|
|
set_instance +A
|
|
|
|
executeOk_servald rhizome list
|
|
|
|
assert_rhizome_list --fromhere=1 fileA1 fileA2 fileA3 --fromhere=0 fileB1 fileB2 fileB3
|
|
|
|
assert_rhizome_received fileB1
|
|
|
|
assert_rhizome_received fileB2
|
|
|
|
assert_rhizome_received fileB3
|
|
|
|
set_instance +B
|
|
|
|
executeOk_servald rhizome list
|
|
|
|
assert_rhizome_list --fromhere=1 fileB1 fileB2 fileB3
|
|
|
|
}
|
|
|
|
|
|
|
|
doc_DirectPull="One way direct pull bundle from configured peer"
|
2012-10-04 04:55:08 +00:00
|
|
|
setup_DirectPull() {
|
2012-08-27 06:59:46 +00:00
|
|
|
setup_common
|
2013-02-08 00:09:41 +00:00
|
|
|
setup_direct
|
2013-04-02 04:24:46 +00:00
|
|
|
setup_direct_peer
|
2012-08-27 06:59:46 +00:00
|
|
|
}
|
2012-10-04 04:55:08 +00:00
|
|
|
test_DirectPull() {
|
2012-10-03 16:15:09 +00:00
|
|
|
set_instance +B
|
2012-10-03 15:55:55 +00:00
|
|
|
executeOk_servald rhizome direct pull
|
2012-10-04 08:08:33 +00:00
|
|
|
tfw_cat --stdout --stderr
|
2013-10-03 17:41:54 +00:00
|
|
|
assert bundle_received_by $BID_A1:$VERSION_A1 $BID_A2:$VERSION_A2 $BID_A3:$VERSION_A3 --stderr
|
2012-10-03 16:15:09 +00:00
|
|
|
set_instance +A
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald rhizome list
|
2013-02-08 00:09:41 +00:00
|
|
|
assert_rhizome_list --fromhere=1 fileA1 fileA2 fileA3
|
2012-10-02 13:22:56 +00:00
|
|
|
set_instance +B
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald rhizome list
|
2013-02-08 00:09:41 +00:00
|
|
|
assert_rhizome_list --fromhere=0 fileA1 fileA2 fileA3 --fromhere=1 fileB1 fileB2 fileB3
|
|
|
|
assert_rhizome_received fileA1
|
|
|
|
assert_rhizome_received fileA2
|
|
|
|
assert_rhizome_received fileA3
|
2012-08-27 06:59:46 +00:00
|
|
|
}
|
|
|
|
|
2013-04-02 04:24:46 +00:00
|
|
|
doc_DirectSync="Two-way direct sync bundles with configured peer"
|
2012-10-04 04:55:08 +00:00
|
|
|
setup_DirectSync() {
|
2012-08-27 06:59:46 +00:00
|
|
|
setup_common
|
2013-02-08 00:09:41 +00:00
|
|
|
setup_direct
|
2013-04-02 04:24:46 +00:00
|
|
|
setup_direct_peer
|
2012-08-27 06:59:46 +00:00
|
|
|
}
|
2012-10-04 04:55:08 +00:00
|
|
|
test_DirectSync() {
|
2012-10-03 16:17:12 +00:00
|
|
|
set_instance +B
|
2012-10-02 23:45:18 +00:00
|
|
|
executeOk_servald rhizome direct sync
|
2012-10-04 08:08:33 +00:00
|
|
|
tfw_cat --stdout --stderr
|
2013-10-03 17:41:54 +00:00
|
|
|
assert bundle_received_by $BID_A1:$VERSION_A1 $BID_A2:$VERSION_A2 $BID_A3:$VERSION_A3 --stderr
|
2012-10-03 16:17:12 +00:00
|
|
|
set_instance +A
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald rhizome list
|
2013-02-08 00:09:41 +00:00
|
|
|
assert_rhizome_list --fromhere=1 fileA1 fileA2 fileA3 --fromhere=0 fileB1 fileB2 fileB3
|
|
|
|
assert_rhizome_received fileB1
|
|
|
|
assert_rhizome_received fileB2
|
|
|
|
assert_rhizome_received fileB3
|
2012-08-27 06:59:46 +00:00
|
|
|
set_instance +B
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald rhizome list
|
2013-02-08 00:09:41 +00:00
|
|
|
assert_rhizome_list --fromhere=0 fileA1 fileA2 fileA3 --fromhere=1 fileB1 fileB2 fileB3
|
|
|
|
assert_rhizome_received fileA1
|
|
|
|
assert_rhizome_received fileA2
|
|
|
|
assert_rhizome_received fileA3
|
2012-10-17 07:40:39 +00:00
|
|
|
}
|
|
|
|
|
2013-10-24 02:45:50 +00:00
|
|
|
interface_up() {
|
|
|
|
$GREP "Interface .* is up" $instance_servald_log || return 1
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
start_radio_instance() {
|
|
|
|
executeOk_servald config \
|
|
|
|
set debug.rhizome on \
|
|
|
|
set debug.rhizome_ads on \
|
|
|
|
set debug.rhizome_tx on \
|
|
|
|
set debug.rhizome_rx on \
|
2013-10-30 06:39:37 +00:00
|
|
|
set debug.radio_link on \
|
2013-10-24 02:45:50 +00:00
|
|
|
set rhizome.advertise.interval 5000 \
|
2013-11-04 01:42:58 +00:00
|
|
|
set rhizome.rhizome_mdp_block_size 375 \
|
2013-10-24 02:45:50 +00:00
|
|
|
set log.console.level debug \
|
|
|
|
set log.console.show_pid on \
|
|
|
|
set log.console.show_time on \
|
|
|
|
set interfaces.1.type CATEAR \
|
2015-03-16 01:52:38 +00:00
|
|
|
set interfaces.1.broadcast.tick_ms 5000 \
|
2013-10-24 02:45:50 +00:00
|
|
|
set interfaces.1.socket_type STREAM \
|
2015-03-16 01:52:38 +00:00
|
|
|
set interfaces.1.broadcast.encapsulation SINGLE \
|
2013-10-24 02:45:50 +00:00
|
|
|
set interfaces.1.point_to_point on
|
|
|
|
start_servald_server
|
|
|
|
wait_until interface_up
|
|
|
|
}
|
|
|
|
|
2013-11-25 02:24:29 +00:00
|
|
|
start_fakeradio() {
|
|
|
|
$servald_build_root/fakeradio $1 $2 > "$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-10-24 02:45:50 +00:00
|
|
|
doc_SimulatedRadio="MDP Transfer over simulated radio link (~90% packet arrival)"
|
|
|
|
setup_SimulatedRadio() {
|
|
|
|
setup_common
|
2013-11-25 02:24:29 +00:00
|
|
|
start_fakeradio 4 0.9
|
2013-10-24 02:45:50 +00:00
|
|
|
set_instance +A
|
2013-11-25 02:24:29 +00:00
|
|
|
rhizome_add_file file1 5000
|
2013-10-24 02:45:50 +00:00
|
|
|
executeOk_servald config \
|
|
|
|
set interfaces.1.file "$END1"
|
|
|
|
set_instance +B
|
|
|
|
executeOk_servald config \
|
|
|
|
set interfaces.1.file "$END2"
|
|
|
|
foreach_instance +A +B start_radio_instance
|
|
|
|
}
|
|
|
|
test_SimulatedRadio() {
|
|
|
|
receive_and_update_bundle
|
|
|
|
}
|
|
|
|
teardown_SimulatedRadio() {
|
|
|
|
teardown
|
|
|
|
tfw_log "Killing fakeradio, pid=$FAKERADIO_PID"
|
|
|
|
kill $FAKERADIO_PID
|
|
|
|
tfw_cat "$SERVALD_VAR/radioerr"
|
|
|
|
}
|
|
|
|
|
|
|
|
doc_SimulatedRadio2="MDP Transfer over simulated radio link (~50% packet arrival)"
|
|
|
|
setup_SimulatedRadio2() {
|
|
|
|
setup_common
|
2013-11-25 02:24:29 +00:00
|
|
|
start_fakeradio 4 0.5
|
2013-10-24 02:45:50 +00:00
|
|
|
set_instance +A
|
2013-11-25 02:24:29 +00:00
|
|
|
rhizome_add_file file1 5000
|
2013-10-24 02:45:50 +00:00
|
|
|
executeOk_servald config \
|
|
|
|
set interfaces.1.file "$END1"
|
|
|
|
set_instance +B
|
|
|
|
executeOk_servald config \
|
|
|
|
set interfaces.1.file "$END2"
|
|
|
|
foreach_instance +A +B start_radio_instance
|
|
|
|
}
|
|
|
|
test_SimulatedRadio2() {
|
2013-11-30 19:19:50 +00:00
|
|
|
receive_and_update_bundle --timeout=120
|
2013-10-24 02:45:50 +00:00
|
|
|
}
|
|
|
|
teardown_SimulatedRadio2() {
|
|
|
|
teardown
|
|
|
|
tfw_log "Killing fakeradio, pid=$FAKERADIO_PID"
|
|
|
|
kill $FAKERADIO_PID
|
|
|
|
tfw_cat "$SERVALD_VAR/radioerr"
|
|
|
|
}
|
|
|
|
|
2012-07-06 05:09:25 +00:00
|
|
|
runTests "$@"
|