diff --git a/contrib/testnet/genconf.py b/contrib/testnet/genconf.py index 715d32dce..370a28d0e 100755 --- a/contrib/testnet/genconf.py +++ b/contrib/testnet/genconf.py @@ -51,11 +51,11 @@ def main(): } if args.netid: config['router']['netid'] = args.netid - + if args.ip: config['router']['public-ip'] = args.ip config['router']['public-port'] = str(args.baseport + nodeid) - + config['bind'] = { args.ifname: str(args.baseport + nodeid) } diff --git a/contrib/testnet/readme.md b/contrib/testnet/readme.md new file mode 100644 index 000000000..cb95b3334 --- /dev/null +++ b/contrib/testnet/readme.md @@ -0,0 +1,23 @@ +loopback testnet scripts + +requirements: + +* bash +* python3 +* supervisord + + +setup: + +make a testnet compatable lokinet build: + + $ cmake -DWITH_TESTNET=ON -B build-testnet -S . + $ make -C build-testnet lokinet + +usage: + +from root of repo run: + + $ ./contrib/testnet/testnet.sh build-testnet/daemon/lokinet 20 200 + +this will spin up 20 service nodes and 200 clients diff --git a/contrib/testnet/testnet.sh b/contrib/testnet/testnet.sh new file mode 100755 index 000000000..86d55e832 --- /dev/null +++ b/contrib/testnet/testnet.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +for arg in "$1" "$2" "$3" ; do + test x = "x$arg" && echo "usage: $0 path/to/lokinet num_svc num_clients" && exit 1; +done + +script_root=$(dirname $(readlink -e $0)) +testnet_dir=/tmp/lokinet-testnet + +mkdir -p $testnet_dir + +set -x + +$script_root/genconf.py --bin $1 --netid=testnet --out=$testnet_dir/testnet.ini --svc $2 --dir=$testnet_dir --clients $3 || exit 1 +supervisord -n -c $testnet_dir/testnet.ini