gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: -add scripts to deploy DHT tests with DH


From: gnunet
Subject: [gnunet] branch master updated: -add scripts to deploy DHT tests with DHTU
Date: Sat, 19 Feb 2022 16:49:56 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 0fe3e352f -add scripts to deploy DHT tests with DHTU
0fe3e352f is described below

commit 0fe3e352f2e96ef677ea588480413a3893665d63
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Feb 19 16:49:48 2022 +0100

    -add scripts to deploy DHT tests with DHTU
---
 src/dht/Makefile.am              |  5 ++-
 src/dht/dhtu_testbed_connect.sh  | 31 +++++++++++++++
 src/dht/dhtu_testbed_deploy.conf | 26 +++++++++++++
 src/dht/dhtu_testbed_deploy.sh   | 84 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 145 insertions(+), 1 deletion(-)

diff --git a/src/dht/Makefile.am b/src/dht/Makefile.am
index 6d1090901..f9cd26094 100644
--- a/src/dht/Makefile.am
+++ b/src/dht/Makefile.am
@@ -213,7 +213,10 @@ EXTRA_DIST = \
   test_dht_line.conf \
   test_dht_tools.conf \
   test_dht_tools.py.in \
-  test_dht_multipeer_topology.dat
+  test_dht_multipeer_topology.dat \
+  dhtu_testbed_connect.sh \
+  dhtu_testbed_deploy.conf \
+  dhtu_testbed_deploy.sh
 
 if HAVE_PYTHON
 check_SCRIPTS = \
diff --git a/src/dht/dhtu_testbed_connect.sh b/src/dht/dhtu_testbed_connect.sh
new file mode 100755
index 000000000..871e9eb1b
--- /dev/null
+++ b/src/dht/dhtu_testbed_connect.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+# This file is in the public domain.
+
+# Helper script for dhtu_testbed_deploy.sh.
+# Do not invoke directly.
+
+n=$1
+CFG="/tmp/deployment/${n}.conf"
+HELLO=`gnunet-dht-hello -c $CFG`
+
+# Create dense topology:
+#for OFF in `seq 1 $MAX`
+#do
+#    TCFG="/tmp/deployment/${OFF}.conf"
+#    gnunet-dht-hello -c $TCFG $HELLO
+#done
+#exit 0
+
+# Create sparse topology:
+R=1
+while test `expr $R \* $R \* $R` -lt $MAX
+do
+    END=`expr $R \* $R`
+    for M in `seq $R $R $END`
+    do
+        OFF=`expr \( $n + $M \) % $MAX`
+        TCFG="/tmp/deployment/${OFF}.conf"
+        gnunet-dht-hello -c $TCFG $HELLO
+    done
+    R=`expr $R + 1`
+done
diff --git a/src/dht/dhtu_testbed_deploy.conf b/src/dht/dhtu_testbed_deploy.conf
new file mode 100644
index 000000000..59d69894a
--- /dev/null
+++ b/src/dht/dhtu_testbed_deploy.conf
@@ -0,0 +1,26 @@
+# This file is in the public domain.
+
+# Simple configuration template to deploy a DHT testbed
+# with peers using the IP underlay.
+
+[paths]
+GNUNET_DATA_HOME=/tmp/%N%
+
+[dht]
+UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-dht-%N%.sock
+
+[dhtu-ip]
+ENABLED = YES
+NSE = 10
+UDP_PORT = %N%
+
+[dhtu-gnunet]
+ENABLED = NO
+
+[statistics]
+DISABLE = YES
+
+[dhtcache]
+DATABASE = heap
+QUOTA = 50 MB
+DISABLE_BF_RC = YES
diff --git a/src/dht/dhtu_testbed_deploy.sh b/src/dht/dhtu_testbed_deploy.sh
new file mode 100755
index 000000000..908bbf685
--- /dev/null
+++ b/src/dht/dhtu_testbed_deploy.sh
@@ -0,0 +1,84 @@
+#!/bin/bash
+# This file is in the public domain.
+
+# We will use UDP ports above this number.
+MINPORT=10000
+
+# Cleanup to run whenever we exit
+function cleanup()
+{
+    for n in `jobs -p`
+    do
+        kill $n 2> /dev/null || true
+    done
+    wait
+}
+
+# Install cleanup handler (except for kill -9)
+trap cleanup EXIT
+
+if test -z "$1"
+then
+    echo "Call with the number of peers to launch."
+    exit 1
+fi
+
+if test ! -x `which parallel`
+then
+    echo "This script requires GNU parallel"
+    exit 1
+fi
+
+if test ! -x `which gnunet-service-dht`
+then
+    echo "This script requires gnunet-service-dht in \$PATH"
+    exit 1
+fi
+
+if test ! -x `which gnunet-dht-hello`
+then
+    echo "This script requires gnunet-dht-hello in \$PATH"
+    exit 1
+fi
+
+MAX=`expr $1 - 1`
+
+# export GNUNET_FORCE_LOG="dht*;;;;DEBUG"
+
+echo -n "Starting $1 peers "
+mkdir -p /tmp/deployment
+for n in `seq 0 $MAX`
+do
+    PORT=`expr $MINPORT + $n`
+    CFG="/tmp/deployment/${n}.conf"
+    cat dhtu_testbed_deploy.conf | sed -e "s/%N%/$PORT/" > $CFG
+    gnunet-service-dht -c $CFG &> /tmp/deployment/$n.log &
+    echo -n "."
+done
+
+echo ""
+echo "$1 peers ready".
+
+unset GNUNET_FORCE_LOG
+
+function connect()
+{
+  n=$1
+}
+
+echo -n "Connecting peers ..."
+
+export MAX
+if test 0 != $MAX
+then
+  seq 0 $MAX | parallel ./dhtu_testbed_connect.sh :::
+fi
+
+
+echo ""
+echo "Network ready. Press ENTER to terminate the testbed!"
+echo "Interact with peers using '-c /tmp/deployment/\$N.conf'"
+
+read
+
+exit 0

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]