#!/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.

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

