scripts: add script for testing bandwidth limitation through iperf
authorRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Thu, 21 Apr 2011 20:31:58 +0000 (23:31 +0300)
committerRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Thu, 21 Apr 2011 20:32:39 +0000 (23:32 +0300)
scripts/kvm/mrun-tunneled-iperf-2by2 [new file with mode: 0755]
scripts/kvm/run-tunneled-iperf-client [new file with mode: 0755]
scripts/kvm/run-tunneled-iperf-server [new file with mode: 0755]

diff --git a/scripts/kvm/mrun-tunneled-iperf-2by2 b/scripts/kvm/mrun-tunneled-iperf-2by2
new file mode 100755 (executable)
index 0000000..0a0cdd3
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+#
+# Run iperf server and client on remote KVM systems.
+#
+# 2011, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro
+#
+
+default_config=destinations.default.conf
+
+if test $# -ge 2; then
+    echo "Usage: $0 [config]" 1>&2
+    exit 1
+elif test $# -eq 1; then
+    config="$1"
+else
+    config=${default_config}
+fi
+
+# 1 - debug enabled
+# 0 or none - debug disabled
+_DEBUG_=1
+
+DEBUG()
+{
+    if test "x${_DEBUG_}" == "x1"; then
+        echo $@ 1>&2
+    fi
+}
+
+while read local_port destination; do
+    DEBUG "Running iperf server on ${destination}"
+    ssh -n -f -l root localhost -p ${local_port} "iperf -s"
+    read local_port_c destination_c
+    DEBUG "Running iperfc lient on ${destination_c}"
+    ssh -n -f -l root localhost -p ${local_port_c} "iperf -c ${destination}"
+done < <(grep -v '^[ \t]*#' ${config} | grep -v '^[ \t]*$')
+
+sleep 20
diff --git a/scripts/kvm/run-tunneled-iperf-client b/scripts/kvm/run-tunneled-iperf-client
new file mode 100755 (executable)
index 0000000..3588f85
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+if test $# -ne 2; then
+    echo "Usage: $0 local_port iperf_server_ip" 1>&2
+    exit 1
+fi
+
+local_port=$1
+iperf_server_ip=$2
+ssh -l root localhost -p ${local_port} "iperf -c ${iperf_server_ip}"
diff --git a/scripts/kvm/run-tunneled-iperf-server b/scripts/kvm/run-tunneled-iperf-server
new file mode 100755 (executable)
index 0000000..84ea1d6
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+if test $# -ne 1; then
+    echo "Usage: $0 local_port" 1>&2
+    exit 1
+fi
+
+local_port=$1
+ssh -l root localhost -p ${local_port} "iperf -s"