Commit 4ea58ac7 authored by Leigh B Stoller's avatar Leigh B Stoller

Checkpoint support code for using openvswitch. Not enabled, but wanted

to confirm that we could use it for egre tunnels. But would need a
flag day to switch the world over. OVS does not coexist with ip_gre
or the standard bridge module, so all bridges have to be one kind or
the other.
parent 3d182493
......@@ -27,6 +27,7 @@ IFCONFIG=/sbin/ifconfig
ROUTE=/sbin/route
IP=/sbin/ip
BRCTL=/usr/sbin/brctl
OVSCTL=/usr/local/bin/ovs-vsctl
# ELABIFS="veth100.1,br0;veth100.2,brp3"
# ELABBRS="br0:noencap,short;brp3:encap"
......@@ -43,7 +44,11 @@ fi
if [ $ELABCTRLDEV = $DEV ]; then
echo "Emulab configuring network for CT$VEID: control net ($ELABCTRLDEV)"
if [ "x$ELABCTRLBR" != "x" ]; then
$BRCTL addif $ELABCTRLBR $ELABCTRLDEV
if [ -e /usr/local/var/run/openvswitch/ovsdb-server.pid ]; then
$OVSCTL add-port $ELABCTRLBR $ELABCTRLDEV
else
$BRCTL addif $ELABCTRLBR $ELABCTRLDEV
fi
fi
$IFCONFIG $ELABCTRLDEV 2&>1 > /dev/null
while [ $? -ne 0 ]; do
......@@ -78,7 +83,11 @@ echo "$ELABIFS" | sed -e 's/;/\n/g' | \
if [ $_if = $DEV ]; then
echo "Emulab configuring network for CT$VEID: exp net ($_if)"
if [ "x$_br" != "x" ]; then
$BRCTL addif $_br $_if
if [ -e /usr/local/var/run/openvswitch/ovsdb-server.pid ]; then
$OVSCTL add-port $_br $_if
else
$BRCTL addif $_br $_if
fi
fi
$IFCONFIG $_if 2&>1 > /dev/null
while [ $? -ne 0 ]; do
......@@ -96,16 +105,18 @@ echo "$ELABIFS" | sed -e 's/;/\n/g' | \
#
# Get the routes, as for tunnels. This is not a workable approach.
#
echo "$ELABROUTES" | sed -e 's/;/\n/g' | \
while read route; \
do \
_if=`echo "$route" | sed -r -e 's/([^,]*),[^,]*,[^,]*/\1/'`
_rt=`echo "$route" | sed -r -e 's/[^,]*,([^,]*),[^,]*/\1/'`
if [ "x$ELABROUTES" != "x" ]; then
echo "$ELABROUTES" | sed -e 's/;/\n/g' | \
while read route; \
do \
_if=`echo "$route" | sed -r -e 's/([^,]*),[^,]*,[^,]*/\1/'`
_rt=`echo "$route" | sed -r -e 's/[^,]*,([^,]*),[^,]*/\1/'`
if [ $_if = $DEV ]; then
echo "Emulab configuring route for CT$VEID: exp net ($_if)"
$IP route replace $_rt dev $_if table $ROUTETABLE
fi
if [ $_if = $DEV ]; then
echo "Emulab configuring route for CT$VEID: exp net ($_if)"
$IP route replace $_rt dev $_if table $ROUTETABLE
fi
done
fi
exit 0
#!/usr/bin/perl -w
#
# Copyright (c) 2012 University of Utah and the Flux Group.
# Copyright (c) 2012-2013 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -40,6 +40,8 @@ my $XENBR = "xenbr0";
my $BRCTL = "brctl";
my $IPBIN = "ip";
my $IFCONFIGBIN = "ifconfig";
my $OVSCTL = "/usr/local/bin/ovs-vsctl";
my $USE_OPENVSWITCH = 0;
sub usage()
{
......@@ -48,7 +50,7 @@ sub usage()
print "Use -b option to name bridge (defaults to xenbr0)\n";
exit(1);
}
my $optlist = "b:";
my $optlist = "b:o";
my %options = ();
if (! getopts($optlist, \%options)) {
usage();
......@@ -56,6 +58,9 @@ if (! getopts($optlist, \%options)) {
if (defined($options{"b"})) {
$XENBR = $options{"b"};
}
if (defined($options{"o"})) {
$USE_OPENVSWITCH = 1;
}
my $interface = undef;
if (@ARGV == 1) {
......@@ -126,9 +131,14 @@ if ($iscontrol) {
#
# Make the bridge
#
if (system "$BRCTL addbr $XENBR") {
die "xenbridge-setup: Unable to create bridge $XENBR\n";
if ($USE_OPENVSWITCH) {
system("$OVSCTL add-br $XENBR");
}
else {
system("$BRCTL addbr $XENBR");
}
die "xenbridge-setup: Unable to create bridge $XENBR\n"
if ($?);
#
# Remove address from the control net
......@@ -140,9 +150,14 @@ if (system "$IPBIN address flush dev $interface\n") {
#
# Add control net interface to the bridge
#
if (system "$BRCTL addif $XENBR $interface") {
die "xenbridge-setup: Unable to add $interface to bridge $XENBR\n";
if ($USE_OPENVSWITCH) {
system("$OVSCTL add-port $XENBR $interface");
}
else {
system("$BRCTL addif $XENBR $interface");
}
die "xenbridge-setup: Unable to add $interface to bridge $XENBR\n"
if ($?);
#
# Move IP address from the old control net to the bridge
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment