aboutsummaryrefslogtreecommitdiffstats
path: root/testing/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'testing/scripts')
-rwxr-xr-xtesting/scripts/function.sh44
-rwxr-xr-xtesting/scripts/start-bridges66
-rwxr-xr-xtesting/scripts/start-switches39
-rwxr-xr-xtesting/scripts/stop-bridges51
4 files changed, 161 insertions, 39 deletions
diff --git a/testing/scripts/function.sh b/testing/scripts/function.sh
index 22fce327c..917c972c7 100755
--- a/testing/scripts/function.sh
+++ b/testing/scripts/function.sh
@@ -83,3 +83,47 @@ function searchandreplace {
rm -f "$TMPFILE"
}
+
+#############################################
+# add a bridge
+#
+
+function umlbr_add {
+ brctl addbr "umlbr$1"
+ brctl setfd "umlbr$1" 0
+ brctl setageing "umlbr$1" 3600
+ brctl stp "umlbr$1" off
+ ifconfig "umlbr$1" "$2" netmask "$3" up
+}
+
+#############################################
+# delete a bridge
+#
+
+function umlbr_del {
+ ifconfig "umlbr$1" down &> /dev/null 2>&1
+ brctl delbr "umlbr$1" &> /dev/null 2>&1
+}
+
+#############################################
+# add a tap interface to a bridge
+#
+
+function umlbr_add_tap {
+ tunctl -t "tap$1_$2" &> /dev/null 2>&1
+ ifconfig "tap$1_$2" 0.0.0.0 promisc up &> /dev/null 2>&1
+ brctl addif "umlbr$1" "tap$1_$2" &> /dev/null 2>&1
+ cecho-n "$2.."
+ }
+
+#############################################
+# delete a tap interface from a bridge
+#
+
+function umlbr_del_tap {
+ ifconfig "umlbr$2" down &> /dev/null 2>&1
+ brctl delif "umlbr$1" "tap$1_$2" &> /dev/null 2>&1
+ tunctl -d "tap$1_$2" &> /dev/null 2>&1
+ cecho-n "$2.."
+ }
+
diff --git a/testing/scripts/start-bridges b/testing/scripts/start-bridges
new file mode 100755
index 000000000..676f80951
--- /dev/null
+++ b/testing/scripts/start-bridges
@@ -0,0 +1,66 @@
+#!/bin/bash
+# start the UML bridges in the kernel using the brctl command
+#
+# Copyright (C) 2009 Andreas Steffen
+# HSR Hochschule fuer Technik Rapperswil
+#
+# 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+#
+# 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.
+#
+# RCSID $Id: $
+
+DIR=`dirname $0`
+
+source $DIR/function.sh
+
+# create umlbr1 and its taps
+#
+if [ `brctl show | grep umlbr1 | wc -l` -eq 1 ]
+then
+ cecho " * Great, umlbr1 is already running!"
+else
+ cecho-n " * Starting umlbr1 with taps.."
+ umlbr_add 1 10.1.0.254 255.255.0.0
+ umlbr_add_tap 1 alice
+ umlbr_add_tap 1 venus
+ umlbr_add_tap 1 moon
+ cgecho "done"
+fi
+
+# create umlbr0 and its taps
+#
+if [ `brctl show | grep umlbr0 | wc -l` -eq 1 ]
+then
+ cecho " * Great, umlbr0 is already running!"
+else
+ cecho-n " * Starting umlbr0 with taps.."
+ umlbr_add 0 192.168.0.254 255.255.255.0
+ umlbr_add_tap 0 alice
+ umlbr_add_tap 0 moon
+ umlbr_add_tap 0 carol
+ umlbr_add_tap 0 winnetou
+ umlbr_add_tap 0 dave
+ umlbr_add_tap 0 sun
+ cgecho "done"
+fi
+
+# create umlbr2 and its taps
+#
+if [ `brctl show | grep umlbr2 | wc -l` -eq 1 ]
+then
+ cecho " * Great, umlbr2 is already running!"
+else
+ cecho-n " * Starting umlbr2 with taps.."
+ umlbr_add 2 10.2.0.254 255.255.0.0
+ umlbr_add_tap 2 sun
+ umlbr_add_tap 2 bob
+ cgecho "done"
+fi
+
diff --git a/testing/scripts/start-switches b/testing/scripts/start-switches
deleted file mode 100755
index 1a6c9d8f6..000000000
--- a/testing/scripts/start-switches
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-# starts the UML switches
-#
-# Copyright (C) 2004 Eric Marchionni, Patrik Rayo
-# Zuercher Hochschule Winterthur
-#
-# 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. See <http://www.fsf.org/copyleft/gpl.txt>.
-#
-# 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.
-#
-# RCSID $Id$
-
-DIR=`dirname $0`
-
-source $DIR/function.sh
-
-[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found"
-
-source $DIR/../testing.conf
-
-for n in 0 1 2
-do
- if [ `ps aux | grep uml_switch | grep umlswitch$n | wc -l` -eq 1 ]
- then
- cecho " * Great, umlswitch$n is already running!"
- else
- cecho-n " * Starting umlswitch$n.."
- uml_switch -tap tap$n -unix /tmp/umlswitch$n -daemon >/dev/null 2>&1 </dev/null
- sleep 2
- eval ifconfig "tap$n \$IFCONFIG_$n up"
- cgecho "done"
- fi
-done
diff --git a/testing/scripts/stop-bridges b/testing/scripts/stop-bridges
new file mode 100755
index 000000000..9633bfa55
--- /dev/null
+++ b/testing/scripts/stop-bridges
@@ -0,0 +1,51 @@
+#!/bin/bash
+# stop the UML bridges in the kernel using the brctl command
+#
+# Copyright (C) 2009 Andreas Steffen
+# HSR Hochschule fuer Technik Rapperswil
+#
+# 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. See <http://www.fsf.org/copyleft/gpl.txt>.
+#
+# 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.
+#
+# RCSID $Id: $
+
+DIR=`dirname $0`
+
+source $DIR/function.sh
+
+# stop umlbr1 and its taps
+#
+cecho-n " * Stopping umlbr1 with taps.."
+umlbr_del_tap 1 alice
+umlbr_del_tap 1 venus
+umlbr_del_tap 1 moon
+umlbr_del 1
+cgecho "done"
+
+# stop umlbr0 and its taps
+#
+cecho-n " * Stopping umlbr0 with taps.."
+umlbr_del_tap 0 alice
+umlbr_del_tap 0 moon
+umlbr_del_tap 0 carol
+umlbr_del_tap 0 winnetou
+umlbr_del_tap 0 dave
+umlbr_del_tap 0 sun
+umlbr_del 0
+cgecho "done"
+
+# stop umlbr2 and its taps
+#
+cecho-n " * Stopping umlbr2 with taps.."
+umlbr_del_tap 2 sun
+umlbr_del_tap 2 bob
+umlbr_del 2
+cgecho "done"
+