summaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2021-08-17 14:21:53 +0200
committert3sserakt <t3ss@posteo.de>2021-08-17 14:21:53 +0200
commit1e063cd73452396778cf00127346b9b08a922317 (patch)
treedc0c119ecf8511c5c56a469e580fee09800fc45a /src/testing
parent0f00c002810907f4edf740203bdf24d81124fd32 (diff)
- renamed methods and variables to prepare moving files from testbed to testing, to fix circular dependency problem
Diffstat (limited to 'src/testing')
-rwxr-xr-xsrc/testing/netjail_exec.sh16
-rwxr-xr-xsrc/testing/netjail_start.sh52
-rwxr-xr-xsrc/testing/netjail_stop.sh26
-rw-r--r--src/testing/testing_api_cmd_send_peer_ready.c4
4 files changed, 96 insertions, 2 deletions
diff --git a/src/testing/netjail_exec.sh b/src/testing/netjail_exec.sh
new file mode 100755
index 000000000..b76d2e444
--- /dev/null
+++ b/src/testing/netjail_exec.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+. "./../testbed/netjail_core.sh"
+
+set -eu
+set -x
+
+export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+
+M=$1
+N=$2
+
+NODE=$(netjail_print_name "N" $N $M)
+
+
+
+netjail_node_exec_without_fds $NODE $3 $4 $5 $1 $2
diff --git a/src/testing/netjail_start.sh b/src/testing/netjail_start.sh
new file mode 100755
index 000000000..4c1c33c83
--- /dev/null
+++ b/src/testing/netjail_start.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+. "./../testbed/netjail_core.sh"
+
+set -eu
+set -x
+
+export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+
+LOCAL_M=$1
+GLOBAL_N=$2
+
+# TODO: stunserver? ..and globally known peer?
+
+shift 2
+
+LOCAL_GROUP="192.168.15"
+GLOBAL_GROUP="92.68.150"
+
+NETWORK_NET=$(netjail_print_name "n" $GLOBAL_N $LOCAL_M)
+
+netjail_bridge $NETWORK_NET
+
+for N in $(seq $GLOBAL_N); do
+ ROUTER=$(netjail_print_name "R" $N)
+
+ netjail_node $ROUTER
+ netjail_node_link_bridge $ROUTER $NETWORK_NET "$GLOBAL_GROUP.$N" 24
+
+ ROUTER_NET=$(netjail_print_name "r" $N)
+
+ netjail_bridge $ROUTER_NET
+
+ for M in $(seq $LOCAL_M); do
+ NODE=$(netjail_print_name "N" $N $M)
+
+ netjail_node $NODE
+ netjail_node_link_bridge $NODE $ROUTER_NET "$LOCAL_GROUP.$M" 24
+ done
+
+ ROUTER_ADDR="$LOCAL_GROUP.$(($LOCAL_M+1))"
+
+ netjail_node_link_bridge $ROUTER $ROUTER_NET $ROUTER_ADDR 24
+ netjail_node_add_nat $ROUTER $ROUTER_ADDR 24
+
+ for M in $(seq $LOCAL_M); do
+ NODE=$(netjail_print_name "N" $N $M)
+
+ netjail_node_add_default $NODE $ROUTER_ADDR
+ done
+done
+
+
diff --git a/src/testing/netjail_stop.sh b/src/testing/netjail_stop.sh
new file mode 100755
index 000000000..689bf7ae9
--- /dev/null
+++ b/src/testing/netjail_stop.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+. "./../testbed/netjail_core.sh"
+
+set -eu
+set -x
+
+export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+
+LOCAL_M=$1
+GLOBAL_N=$2
+NETWORK_NET=$(netjail_print_name "n" $GLOBAL_N $LOCAL_M)
+
+shift 2
+
+for N in $(seq $GLOBAL_N); do
+ for M in $(seq $LOCAL_M); do
+ netjail_node_clear $(netjail_print_name "N" $N $M)
+ done
+
+ netjail_bridge_clear $(netjail_print_name "r" $N)
+ netjail_node_clear $(netjail_print_name "R" $N)
+done
+
+netjail_bridge_clear $NETWORK_NET
+
+echo "Done"
diff --git a/src/testing/testing_api_cmd_send_peer_ready.c b/src/testing/testing_api_cmd_send_peer_ready.c
index 27761c4d5..e5e004924 100644
--- a/src/testing/testing_api_cmd_send_peer_ready.c
+++ b/src/testing/testing_api_cmd_send_peer_ready.c
@@ -32,7 +32,7 @@
struct SendPeerReadyState
{
- TESTBED_CMD_HELPER_write_cb write_message;
+ TESTING_CMD_HELPER_write_cb write_message;
struct GNUNET_CMDS_PEER_STARTED *reply;
};
@@ -85,7 +85,7 @@ send_peer_ready_run (void *cls,
*/
struct GNUNET_TESTING_Command
GNUNET_TESTING_cmd_send_peer_ready (const char *label,
- TESTBED_CMD_HELPER_write_cb write_message)
+ TESTING_CMD_HELPER_write_cb write_message)
{
struct SendPeerReadyState *sprs;