Merge branch '2.0dev' into 2.0merge
Conflicts: .gitignore .pylint examples/miniedit.py mininet/node.py mininet/util.py util/install.sh util/vm/install-mininet-vm.sh
This commit is contained in:
Executable
+94
@@ -0,0 +1,94 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Attempt to build debian packages for OVS
|
||||
|
||||
set -e # exit on error
|
||||
set -u # exit on undefined variable
|
||||
|
||||
kvers=`uname -r`
|
||||
ksrc=/lib/modules/$kvers/build
|
||||
dist=`lsb_release -is | tr [A-Z] [a-z]`
|
||||
release=`lsb_release -rs`
|
||||
arch=`uname -m`
|
||||
buildsuffix=-2
|
||||
if [ "$arch" = "i686" ]; then arch=i386; fi
|
||||
if [ "$arch" = "x86_64" ]; then arch=amd64; fi
|
||||
|
||||
overs=1.4.0
|
||||
ovs=openvswitch-$overs
|
||||
ovstgz=$ovs.tar.gz
|
||||
ovsurl=http://openvswitch.org/releases/$ovstgz
|
||||
|
||||
install='sudo apt-get install -y'
|
||||
|
||||
echo "*** Installing debian/ubuntu build system"
|
||||
$install build-essential devscripts ubuntu-dev-tools debhelper dh-make
|
||||
$install diff patch cdbs quilt gnupg fakeroot lintian pbuilder piuparts
|
||||
$install module-assistant
|
||||
|
||||
echo "*** Installing OVS dependencies"
|
||||
$install pkg-config gcc make python-dev libssl-dev libtool
|
||||
$install dkms ipsec-tools
|
||||
|
||||
echo "*** Installing headers for $kvers"
|
||||
$install linux-headers-$kvers
|
||||
|
||||
echo "*** Retrieving OVS source"
|
||||
wget -c $ovsurl
|
||||
tar xzf $ovstgz
|
||||
cd $ovs
|
||||
|
||||
echo "*** Patching OVS source"
|
||||
# Not sure why this fails, but off it goes!
|
||||
sed -i -e 's/dh_strip/# dh_strip/' debian/rules
|
||||
if [ "$release" = "10.04" ]; then
|
||||
# Lucid doesn't seem to have all the packages for ovsdbmonitor
|
||||
echo "*** Patching debian/rules to remove dh_python2"
|
||||
sed -i -e 's/dh_python2/dh_pysupport/' debian/rules
|
||||
echo "*** Not building ovsdbmonitor since it's too hard on 10.04"
|
||||
mv debian/ovsdbmonitor.install debian/ovsdbmonitor.install.backup
|
||||
sed -i -e 's/ovsdbmonitor.install/ovsdbmonitor.install.backup/' Makefile.in
|
||||
else
|
||||
# Install a bag of hurt for ovsdbmonitor
|
||||
$install python-pyside.qtcore pyqt4-dev-tools python-twisted python-twisted-bin \
|
||||
python-twisted-core python-twisted-conch python-anyjson python-zope.interface
|
||||
fi
|
||||
# init script was written to assume that commands complete
|
||||
sed -i -e 's/^set -e/#set -e/' debian/openvswitch-controller.init
|
||||
|
||||
echo "*** Building OVS user packages"
|
||||
opts=--with-linux=/lib/modules/`uname -r`/build
|
||||
fakeroot make -f debian/rules DATAPATH_CONFIGURE_OPTS=$opts binary
|
||||
|
||||
echo "*** Building OVS datapath kernel module package"
|
||||
# Still looking for the "right" way to do this...
|
||||
sudo mkdir -p /usr/src/linux
|
||||
ln -sf _debian/openvswitch.tar.gz .
|
||||
sudo make -f debian/rules.modules KSRC=$ksrc KVERS=$kvers binary-modules
|
||||
|
||||
echo "*** Built the following packages:"
|
||||
cd ~
|
||||
ls -l *deb
|
||||
|
||||
archive=ovs-$overs-core-$dist-$release-$arch$buildsuffix.tar
|
||||
ovsbase='common pki switch brcompat controller datapath-dkms'
|
||||
echo "*** Packing up $ovsbase .debs into:"
|
||||
echo " $archive"
|
||||
pkgs=""
|
||||
for component in $ovsbase; do
|
||||
if echo $component | egrep 'dkms|pki'; then
|
||||
# Architecture-independent packages
|
||||
deb=(openvswitch-${component}_$overs*all.deb)
|
||||
else
|
||||
deb=(openvswitch-${component}_$overs*$arch.deb)
|
||||
fi
|
||||
pkgs="$pkgs $deb"
|
||||
done
|
||||
rm -rf $archive
|
||||
tar cf $archive $pkgs
|
||||
|
||||
echo "*** Contents of archive $archive:"
|
||||
tar tf $archive
|
||||
|
||||
echo "*** Done (hopefully)"
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ if __name__ == '__main__':
|
||||
fixLines( infile.readlines(), outfid )
|
||||
infile.close()
|
||||
os.close( outfid )
|
||||
call( [ 'doxypy.py', outname ] )
|
||||
call( [ 'doxypy', outname ] )
|
||||
|
||||
|
||||
|
||||
|
||||
+202
-58
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Mininet install script for Ubuntu (and Debian Lenny)
|
||||
# Brandon Heller (brandonh@stanford.edu)
|
||||
|
||||
@@ -16,57 +17,78 @@ KERNEL_LOC=http://www.openflow.org/downloads/mininet
|
||||
DIST=Unknown
|
||||
RELEASE=Unknown
|
||||
CODENAME=Unknown
|
||||
ARCH=`uname -m`
|
||||
if [ "$ARCH" = "x86_64" ]; then ARCH="amd64"; fi
|
||||
if [ "$ARCH" = "i686" ]; then ARCH="i386"; fi
|
||||
|
||||
test -e /etc/debian_version && DIST="Debian"
|
||||
grep Ubuntu /etc/lsb-release &> /dev/null && DIST="Ubuntu"
|
||||
if [ "$DIST" = "Ubuntu" ] || [ "$DIST" = "Debian" ]; then
|
||||
sudo apt-get install -y lsb-release
|
||||
install='sudo apt-get -y install'
|
||||
remove='sudo apt-get -y remove'
|
||||
pkginst='sudo dpkg -i'
|
||||
# Prereqs for this script
|
||||
if ! which lsb_release &> /dev/null; then
|
||||
$install lsb-release
|
||||
fi
|
||||
if ! which bc &> /dev/null; then
|
||||
$install bc
|
||||
fi
|
||||
fi
|
||||
if which lsb_release &> /dev/null; then
|
||||
DIST=`lsb_release -is`
|
||||
RELEASE=`lsb_release -rs`
|
||||
CODENAME=`lsb_release -cs`
|
||||
fi
|
||||
echo "Detected Linux distribution: $DIST $RELEASE $CODENAME"
|
||||
echo "Detected Linux distribution: $DIST $RELEASE $CODENAME $ARCH"
|
||||
|
||||
# Kernel params
|
||||
|
||||
if [ "$DIST" = "Debian" ]; then
|
||||
KERNEL_NAME=2.6.33.1-mininet
|
||||
KERNEL_HEADERS=linux-headers-${KERNEL_NAME}_${KERNEL_NAME}-10.00.Custom_i386.deb
|
||||
KERNEL_IMAGE=linux-image-${KERNEL_NAME}_${KERNEL_NAME}-10.00.Custom_i386.deb
|
||||
elif [ "$DIST" = "Ubuntu" ]; then
|
||||
if [ "$DIST" = "Ubuntu" ]; then
|
||||
if [ "$RELEASE" = "10.04" ]; then
|
||||
KERNEL_NAME='3.0.0-15-generic'
|
||||
else
|
||||
KERNEL_NAME=`uname -r`
|
||||
fi
|
||||
KERNEL_HEADERS=linux-headers-${KERNEL_NAME}
|
||||
elif [ "$DIST" = "Debian" ] && [ "$ARCH" = "i386" ] && [ "$CODENAME" = "lenny" ]; then
|
||||
KERNEL_NAME=2.6.33.1-mininet
|
||||
KERNEL_HEADERS=linux-headers-${KERNEL_NAME}_${KERNEL_NAME}-10.00.Custom_i386.deb
|
||||
KERNEL_IMAGE=linux-image-${KERNEL_NAME}_${KERNEL_NAME}-10.00.Custom_i386.deb
|
||||
else
|
||||
echo "Install.sh currently only supports Ubuntu and Debian."
|
||||
echo "Install.sh currently only supports Ubuntu and Debian Lenny i386."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# More distribution info
|
||||
DIST_LC=`echo $DIST | tr [A-Z] [a-z]` # as lower case
|
||||
|
||||
# Kernel Deb pkg to be removed:
|
||||
KERNEL_IMAGE_OLD=linux-image-2.6.26-2-686
|
||||
KERNEL_IMAGE_OLD=linux-image-2.6.26-33-generic
|
||||
|
||||
DRIVERS_DIR=/lib/modules/${KERNEL_NAME}/kernel/drivers/net
|
||||
|
||||
OVS_RELEASE=v1.2.2
|
||||
OVS_RELEASE=1.4.0
|
||||
OVS_PACKAGE_LOC=https://github.com/downloads/mininet/mininet
|
||||
OVS_BUILDSUFFIX=-ignore # was -2
|
||||
OVS_PACKAGE_NAME=ovs-$OVS_RELEASE-core-$DIST_LC-$RELEASE-$ARCH$OVS_BUILDSUFFIX.tar
|
||||
OVS_SRC=~/openvswitch
|
||||
OVS_TAG=v$OVS_RELEASE
|
||||
OVS_BUILD=$OVS_SRC/build-$KERNEL_NAME
|
||||
OVS_KMODS=($OVS_BUILD/datapath/linux/{openvswitch_mod.ko,brcompat_mod.ko})
|
||||
|
||||
function kernel {
|
||||
echo "Install Mininet-compatible kernel if necessary"
|
||||
sudo apt-get update
|
||||
if [ "$DIST" = "Debian" ]; then
|
||||
if [ "$DIST" = "Ubuntu" ] && [ "$RELEASE" = "10.04" ]; then
|
||||
$install linux-image-$KERNEL_NAME
|
||||
elif [ "$DIST" = "Debian" ]; then
|
||||
# The easy approach: download pre-built linux-image and linux-headers packages:
|
||||
wget -c $KERNEL_LOC/$KERNEL_HEADERS
|
||||
wget -c $KERNEL_LOC/$KERNEL_IMAGE
|
||||
|
||||
# Install custom linux headers and image:
|
||||
sudo dpkg -i $KERNEL_IMAGE $KERNEL_HEADERS
|
||||
$pkginst $KERNEL_IMAGE $KERNEL_HEADERS
|
||||
|
||||
# The next two steps are to work around a bug in newer versions of
|
||||
# kernel-package, which fails to add initrd images with the latest kernels.
|
||||
@@ -83,16 +105,15 @@ function kernel {
|
||||
# /boot/grub/menu.lst to set the default to the entry corresponding to the
|
||||
# kernel you just installed.
|
||||
fi
|
||||
if [ "$DIST" = "Ubuntu" ] && [ "$RELEASE" = "10.04" ]; then
|
||||
sudo apt-get -y install linux-image-$KERNEL_NAME
|
||||
fi
|
||||
}
|
||||
|
||||
function kernel_clean {
|
||||
echo "Cleaning kernel..."
|
||||
|
||||
# To save disk space, remove previous kernel
|
||||
sudo apt-get -y remove $KERNEL_IMAGE_OLD
|
||||
if ! $remove $KERNEL_IMAGE_OLD; then
|
||||
echo $KERNEL_IMAGE_OLD not installed.
|
||||
fi
|
||||
|
||||
# Also remove downloaded packages:
|
||||
rm -f ~/linux-headers-* ~/linux-image-*
|
||||
@@ -101,8 +122,9 @@ function kernel_clean {
|
||||
# Install Mininet deps
|
||||
function mn_deps {
|
||||
echo "Installing Mininet dependencies"
|
||||
sudo aptitude install -y gcc make screen psmisc xterm ssh iperf iproute \
|
||||
python-setuptools python-networkx
|
||||
$install gcc make screen psmisc xterm ssh iperf iproute \
|
||||
python-setuptools python-networkx cgroup-bin ethtool help2man \
|
||||
pyflakes pylint pep8
|
||||
|
||||
if [ "$DIST" = "Ubuntu" ] && [ "$RELEASE" = "10.04" ]; then
|
||||
echo "Upgrading networkx to avoid deprecation warning"
|
||||
@@ -124,16 +146,14 @@ function mn_deps {
|
||||
|
||||
# The following will cause a full OF install, covering:
|
||||
# -user switch
|
||||
# -dissector
|
||||
# The instructions below are an abbreviated version from
|
||||
# http://www.openflowswitch.org/wk/index.php/Debian_Install
|
||||
# ... modified to use Debian Lenny rather than unstable.
|
||||
function of {
|
||||
echo "Installing OpenFlow and its tools..."
|
||||
|
||||
echo "Installing OpenFlow reference implementation..."
|
||||
cd ~/
|
||||
sudo apt-get install -y git-core automake m4 pkg-config libtool \
|
||||
make libc6-dev autoconf autotools-dev gcc
|
||||
$install git-core autoconf automake autotools-dev pkg-config \
|
||||
make gcc libtool libc6-dev
|
||||
git clone git://openflowswitch.org/openflow.git
|
||||
cd ~/openflow
|
||||
|
||||
@@ -147,8 +167,8 @@ function of {
|
||||
sudo make install
|
||||
|
||||
# Remove avahi-daemon, which may cause unwanted discovery packets to be
|
||||
# sent during tests, near link status changes:
|
||||
sudo apt-get remove -y avahi-daemon
|
||||
# sent during tests, near link status changes:
|
||||
$remove avahi-daemon
|
||||
|
||||
# Disable IPv6. Add to /etc/modprobe.d/blacklist:
|
||||
if [ "$DIST" = "Ubuntu" ]; then
|
||||
@@ -157,6 +177,38 @@ function of {
|
||||
BLACKLIST=/etc/modprobe.d/blacklist
|
||||
fi
|
||||
sudo sh -c "echo 'blacklist net-pf-10\nblacklist ipv6' >> $BLACKLIST"
|
||||
cd ~
|
||||
}
|
||||
|
||||
function wireshark {
|
||||
echo "Installing Wireshark dissector..."
|
||||
|
||||
sudo apt-get install -y wireshark libgtk2.0-dev
|
||||
|
||||
if [ "$DIST" = "Ubuntu" ] && [ "$RELEASE" != "10.04" ]; then
|
||||
# Install newer version
|
||||
sudo apt-get install -y scons mercurial libglib2.0-dev
|
||||
sudo apt-get install -y libwiretap-dev libwireshark-dev
|
||||
cd ~
|
||||
hg clone https://bitbucket.org/barnstorm/of-dissector
|
||||
cd of-dissector/src
|
||||
export WIRESHARK=/usr/include/wireshark
|
||||
scons
|
||||
# libwireshark0/ on 11.04; libwireshark1/ on later
|
||||
WSDIR=`ls -d /usr/lib/wireshark/libwireshark* | head -1`
|
||||
WSPLUGDIR=$WSDIR/plugins/
|
||||
sudo cp openflow.so $WSPLUGDIR
|
||||
echo "Copied openflow plugin to $WSPLUGDIR"
|
||||
else
|
||||
# Install older version from reference source
|
||||
cd ~/openflow/utilities/wireshark_dissectors/openflow
|
||||
make
|
||||
sudo make install
|
||||
fi
|
||||
|
||||
# Copy coloring rules: OF is white-on-blue:
|
||||
mkdir -p ~/.wireshark
|
||||
cp ~/mininet/util/colorfilters ~/.wireshark
|
||||
}
|
||||
|
||||
|
||||
@@ -194,42 +246,120 @@ function wireshark {
|
||||
|
||||
# Install Open vSwitch
|
||||
# Instructions derived from OVS INSTALL, INSTALL.OpenFlow and README files.
|
||||
|
||||
function ovs {
|
||||
echo "Installing Open vSwitch..."
|
||||
|
||||
if [ "$DIST" = "Debian" ] && [ "$CODENAME" == "lenny" ]; then
|
||||
sudo aptitude -y install pkg-config gcc make git-core python-dev libssl-dev
|
||||
# Install Autoconf 2.63+ backport from Debian Backports repo:
|
||||
# Instructions from http://backports.org/dokuwiki/doku.php?id=instructions
|
||||
sudo su -c "echo 'deb http://www.backports.org/debian lenny-backports main contrib non-free' >> /etc/apt/sources.list"
|
||||
sudo apt-get update
|
||||
sudo apt-get -y --force-yes install debian-backports-keyring
|
||||
sudo apt-get -y --force-yes -t lenny-backports install autoconf
|
||||
# Required for module build/dkms install
|
||||
$install $KERNEL_HEADERS
|
||||
|
||||
ovspresent=0
|
||||
|
||||
# First see if we have packages
|
||||
# XXX wget -c seems to fail from github/amazon s3
|
||||
cd /tmp
|
||||
if wget $OVS_PACKAGE_LOC/$OVS_PACKAGE_NAME 2> /dev/null; then
|
||||
$install patch dkms fakeroot python-argparse
|
||||
tar xf $OVS_PACKAGE_NAME
|
||||
orig=`tar tf $OVS_PACKAGE_NAME`
|
||||
# Now install packages in reasonable dependency order
|
||||
order='dkms common pki openvswitch-switch brcompat controller'
|
||||
pkgs=""
|
||||
for p in $order; do
|
||||
pkg=`echo "$orig" | grep $p`
|
||||
# Annoyingly, things seem to be missing without this flag
|
||||
$pkginst --force-confmiss $pkg
|
||||
done
|
||||
ovspresent=1
|
||||
fi
|
||||
|
||||
if [ "$DIST" = "Ubuntu" ]; then
|
||||
sudo apt-get -y install $KERNEL_HEADERS
|
||||
# Otherwise try distribution's OVS packages
|
||||
if [ "$DIST" = "Ubuntu" ] && [ `expr $RELEASE '>=' 11.10` = 1 ]; then
|
||||
if ! dpkg --get-selections | grep openvswitch-datapath; then
|
||||
# If you've already installed a datapath, assume you
|
||||
# know what you're doing and don't need dkms datapath.
|
||||
# Otherwise, install it.
|
||||
$install openvswitch-datapath-dkms
|
||||
fi
|
||||
if $install openvswitch-switch openvswitch-controller; then
|
||||
echo "Ignoring error installing openvswitch-controller"
|
||||
fi
|
||||
ovspresent=1
|
||||
fi
|
||||
|
||||
# Switch can run on its own, but
|
||||
# Mininet should control the controller
|
||||
if [ -e /etc/init.d/openvswitch-controller ]; then
|
||||
if sudo service openvswitch-controller stop; then
|
||||
echo "Stopped running controller"
|
||||
fi
|
||||
sudo update-rc.d openvswitch-controller disable
|
||||
fi
|
||||
|
||||
if [ $ovspresent = 1 ]; then
|
||||
echo "Done (hopefully) installing packages"
|
||||
cd ~
|
||||
return
|
||||
fi
|
||||
|
||||
# Otherwise attempt to install from source
|
||||
|
||||
$install pkg-config gcc make python-dev libssl-dev libtool
|
||||
|
||||
if [ "$DIST" = "Debian" ]; then
|
||||
if [ "$CODENAME" = "lenny" ]; then
|
||||
$install git-core
|
||||
# Install Autoconf 2.63+ backport from Debian Backports repo:
|
||||
# Instructions from http://backports.org/dokuwiki/doku.php?id=instructions
|
||||
sudo su -c "echo 'deb http://www.backports.org/debian lenny-backports main contrib non-free' >> /etc/apt/sources.list"
|
||||
sudo apt-get update
|
||||
sudo apt-get -y --force-yes install debian-backports-keyring
|
||||
sudo apt-get -y --force-yes -t lenny-backports install autoconf
|
||||
fi
|
||||
else
|
||||
$install git
|
||||
fi
|
||||
|
||||
# Install OVS from release
|
||||
cd ~/
|
||||
git clone git://openvswitch.org/openvswitch
|
||||
git clone git://openvswitch.org/openvswitch $OVS_SRC
|
||||
cd $OVS_SRC
|
||||
git checkout $OVS_RELEASE
|
||||
git checkout $OVS_TAG
|
||||
./boot.sh
|
||||
BUILDDIR=/lib/modules/${KERNEL_NAME}/build
|
||||
if [ ! -e $BUILDDIR ]; then
|
||||
echo "Creating build sdirectory $BUILDDIR"
|
||||
sudo mkdir -p $BUILDDIR
|
||||
fi
|
||||
opts="--with-linux=$BUILDDIR"
|
||||
mkdir -p $OVS_BUILD
|
||||
cd $OVS_BUILD
|
||||
opts="--with-linux=$BUILDDIR"
|
||||
mkdir -p $OVS_BUILD
|
||||
cd $OVS_BUILD
|
||||
../configure $opts
|
||||
make
|
||||
sudo make install
|
||||
# openflowd is deprecated, but for now copy it in
|
||||
sudo cp tests/test-openflowd /usr/local/bin/ovs-openflowd
|
||||
|
||||
modprobe
|
||||
}
|
||||
|
||||
function remove_ovs {
|
||||
pkgs=`dpkg --get-selections | grep openvswitch | awk '{ print $1;}'`
|
||||
echo "Removing existing Open vSwitch packages:"
|
||||
echo $pkgs
|
||||
if ! $remove $pkgs; then
|
||||
echo "Not all packages removed correctly"
|
||||
fi
|
||||
# For some reason this doesn't happen
|
||||
if scripts=`ls /etc/init.d/*openvswitch* 2>/dev/null`; then
|
||||
echo $scripts
|
||||
for s in $scripts; do
|
||||
s=$(basename $s)
|
||||
echo SCRIPT $s
|
||||
sudo service $s stop
|
||||
sudo rm -f /etc/init.d/$s
|
||||
sudo update-rc.d -f $s remove
|
||||
done
|
||||
fi
|
||||
echo "Done removing OVS"
|
||||
}
|
||||
|
||||
# Install NOX with tutorial files
|
||||
@@ -237,17 +367,17 @@ function nox {
|
||||
echo "Installing NOX w/tutorial files..."
|
||||
|
||||
# Install NOX deps:
|
||||
sudo apt-get -y install autoconf automake g++ libtool python python-twisted \
|
||||
$install autoconf automake g++ libtool python python-twisted \
|
||||
swig libssl-dev make
|
||||
if [ "$DIST" = "Debian" ]; then
|
||||
sudo apt-get -y install libboost1.35-dev
|
||||
$install libboost1.35-dev
|
||||
elif [ "$DIST" = "Ubuntu" ]; then
|
||||
sudo apt-get -y install python-dev libboost-dev
|
||||
sudo apt-get -y install libboost-filesystem-dev
|
||||
sudo apt-get -y install libboost-test-dev
|
||||
$install python-dev libboost-dev
|
||||
$install libboost-filesystem-dev
|
||||
$install libboost-test-dev
|
||||
fi
|
||||
# Install NOX optional deps:
|
||||
sudo apt-get install -y libsqlite3-dev python-simplejson
|
||||
$install libsqlite3-dev python-simplejson
|
||||
|
||||
# Fetch NOX destiny
|
||||
cd ~/
|
||||
@@ -259,7 +389,10 @@ function nox {
|
||||
|
||||
# Apply patches
|
||||
git checkout -b tutorial-destiny
|
||||
git am ~/mininet/util/nox-patches/*.patch
|
||||
git am ~/mininet/util/nox-patches/*tutorial-port-nox-destiny*.patch
|
||||
if [ "$DIST" = "Ubuntu" ] && [ `expr $RELEASE '>=' 12.04` = 1 ]; then
|
||||
git am ~/mininet/util/nox-patches/*nox-ubuntu12-hacks.patch
|
||||
fi
|
||||
|
||||
# Build
|
||||
./boot.sh
|
||||
@@ -277,12 +410,19 @@ function nox {
|
||||
#./nox_core -v -i ptcp:
|
||||
}
|
||||
|
||||
# "Install" POX
|
||||
function pox {
|
||||
echo "Installing POX into $HOME/pox..."
|
||||
cd ~
|
||||
git clone https://github.com/noxrepo/pox.git
|
||||
}
|
||||
|
||||
# Install OFtest
|
||||
function oftest {
|
||||
echo "Installing oftest..."
|
||||
|
||||
# Install deps:
|
||||
sudo apt-get install -y tcpdump python-scapy
|
||||
$install tcpdump python-scapy
|
||||
|
||||
# Install oftest:
|
||||
cd ~/
|
||||
@@ -296,7 +436,7 @@ function oftest {
|
||||
function cbench {
|
||||
echo "Installing cbench..."
|
||||
|
||||
sudo apt-get install -y libsnmp-dev libpcap-dev libconfig-dev
|
||||
$install libsnmp-dev libpcap-dev libconfig-dev
|
||||
cd ~/
|
||||
git clone git://openflow.org/oflops.git
|
||||
cd oflops
|
||||
@@ -315,13 +455,13 @@ function other {
|
||||
|
||||
# Install tcpdump and tshark, cmd-line packet dump tools. Also install gitk,
|
||||
# a graphical git history viewer.
|
||||
sudo apt-get install -y tcpdump tshark gitk
|
||||
$install tcpdump tshark gitk
|
||||
|
||||
# Install common text editors
|
||||
sudo apt-get install -y vim nano emacs
|
||||
$install vim nano emacs
|
||||
|
||||
# Install NTP
|
||||
sudo apt-get install -y ntp
|
||||
$install ntp
|
||||
|
||||
# Set git to colorize everything.
|
||||
git config --global color.diff auto
|
||||
@@ -358,8 +498,9 @@ function all {
|
||||
of
|
||||
wireshark
|
||||
ovs
|
||||
modprobe
|
||||
nox
|
||||
# NOX-classic is deprecated, but you can install it manually if desired.
|
||||
# nox
|
||||
pox
|
||||
oftest
|
||||
cbench
|
||||
other
|
||||
@@ -412,8 +553,9 @@ function usage {
|
||||
printf -- ' -f: install open(F)low\n' >&2
|
||||
printf -- ' -h: print this (H)elp message\n' >&2
|
||||
printf -- ' -k: install new (K)ernel\n' >&2
|
||||
printf -- ' -m: install Open vSwitch kernel (M)odule\n' >&2
|
||||
printf -- ' -m: install Open vSwitch kernel (M)odule from source dir\n' >&2
|
||||
printf -- ' -n: install mini(N)et dependencies + core files\n' >&2
|
||||
printf -- ' -r: remove existing Open vSwitch packages\n' >&2
|
||||
printf -- ' -t: install o(T)her stuff\n' >&2
|
||||
printf -- ' -v: install open (V)switch\n' >&2
|
||||
printf -- ' -w: install OpenFlow (w)ireshark dissector\n' >&2
|
||||
@@ -427,7 +569,7 @@ if [ $# -eq 0 ]
|
||||
then
|
||||
all
|
||||
else
|
||||
while getopts 'abcdfhkmntvwx' OPTION
|
||||
while getopts 'abcdfhkmnprtvwx' OPTION
|
||||
do
|
||||
case $OPTION in
|
||||
a) all;;
|
||||
@@ -439,6 +581,8 @@ else
|
||||
k) kernel;;
|
||||
m) modprobe;;
|
||||
n) mn_deps;;
|
||||
p) pox;;
|
||||
r) remove_ovs;;
|
||||
t) other;;
|
||||
v) ovs;;
|
||||
w) wireshark;;
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
From 166693d7cb640d4a41251b87e92c52d9c688196b Mon Sep 17 00:00:00 2001
|
||||
From: Bob Lantz <rlantz@cs.stanford.edu>
|
||||
Date: Mon, 14 May 2012 15:30:44 -0700
|
||||
Subject: [PATCH] Hacks to get NOX classic/destiny to compile under Ubuntu
|
||||
12.04
|
||||
|
||||
Thanks to Srinivasu R. Kanduru for the initial patch.
|
||||
|
||||
Apologies for the hacks - it is my hope that this will be fixed
|
||||
upstream eventually.
|
||||
|
||||
---
|
||||
config/ac_pkg_swig.m4 | 7 ++++---
|
||||
src/Make.vars | 2 +-
|
||||
src/nox/coreapps/pyrt/deferredcallback.cc | 2 +-
|
||||
src/nox/coreapps/pyrt/pyglue.cc | 2 +-
|
||||
src/nox/coreapps/pyrt/pyrt.cc | 2 +-
|
||||
src/nox/netapps/authenticator/auth.i | 2 ++
|
||||
src/nox/netapps/authenticator/flow_util.i | 1 +
|
||||
src/nox/netapps/routing/routing.i | 2 ++
|
||||
.../switch_management/pyswitch_management.i | 2 ++
|
||||
src/nox/netapps/tests/tests.cc | 2 +-
|
||||
src/nox/netapps/topology/pytopology.i | 2 ++
|
||||
11 files changed, 18 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/config/ac_pkg_swig.m4 b/config/ac_pkg_swig.m4
|
||||
index d12556e..9b608f2 100644
|
||||
--- a/config/ac_pkg_swig.m4
|
||||
+++ b/config/ac_pkg_swig.m4
|
||||
@@ -78,9 +78,10 @@ AC_DEFUN([AC_PROG_SWIG],[
|
||||
if test -z "$available_patch" ; then
|
||||
[available_patch=0]
|
||||
fi
|
||||
- if test $available_major -ne $required_major \
|
||||
- -o $available_minor -ne $required_minor \
|
||||
- -o $available_patch -lt $required_patch ; then
|
||||
+ major_done=`test $available_major -gt $required_major`
|
||||
+ minor_done=`test $available_minor -gt $required_minor`
|
||||
+ if test !$major_done -a !$minor_done \
|
||||
+ -a $available_patch -lt $required_patch ; then
|
||||
AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org])
|
||||
SWIG=''
|
||||
else
|
||||
diff --git a/src/Make.vars b/src/Make.vars
|
||||
index d70d6aa..93b2879 100644
|
||||
--- a/src/Make.vars
|
||||
+++ b/src/Make.vars
|
||||
@@ -53,7 +53,7 @@ AM_LDFLAGS += -export-dynamic
|
||||
endif
|
||||
|
||||
# set python runtimefiles to be installed in the same directory as pkg
|
||||
-pkglib_SCRIPTS = $(NOX_RUNTIMEFILES) $(NOX_PYBUILDFILES)
|
||||
+pkgdata_SCRIPTS = $(NOX_RUNTIMEFILES) $(NOX_PYBUILDFILES)
|
||||
BUILT_SOURCES = $(NOX_PYBUILDFILES)
|
||||
|
||||
# Runtime-files build and clean rules
|
||||
diff --git a/src/nox/coreapps/pyrt/deferredcallback.cc b/src/nox/coreapps/pyrt/deferredcallback.cc
|
||||
index 3a40fa7..111a586 100644
|
||||
--- a/src/nox/coreapps/pyrt/deferredcallback.cc
|
||||
+++ b/src/nox/coreapps/pyrt/deferredcallback.cc
|
||||
@@ -69,7 +69,7 @@ DeferredCallback::get_instance(const Callback& c)
|
||||
DeferredCallback* cb = new DeferredCallback(c);
|
||||
|
||||
// flag as used in *_wrap.cc....correct?
|
||||
- return SWIG_Python_NewPointerObj(cb, s, SWIG_POINTER_OWN | 0);
|
||||
+ return SWIG_Python_NewPointerObj(m, cb, s, SWIG_POINTER_OWN | 0);
|
||||
}
|
||||
|
||||
bool
|
||||
diff --git a/src/nox/coreapps/pyrt/pyglue.cc b/src/nox/coreapps/pyrt/pyglue.cc
|
||||
index 48b9716..317fd04 100644
|
||||
--- a/src/nox/coreapps/pyrt/pyglue.cc
|
||||
+++ b/src/nox/coreapps/pyrt/pyglue.cc
|
||||
@@ -874,7 +874,7 @@ to_python(const Flow& flow)
|
||||
if (!s) {
|
||||
throw std::runtime_error("Could not find Flow SWIG type_info");
|
||||
}
|
||||
- return SWIG_Python_NewPointerObj(f, s, SWIG_POINTER_OWN | 0);
|
||||
+ return SWIG_Python_NewPointerObj(m, f, s, SWIG_POINTER_OWN | 0);
|
||||
|
||||
// PyObject* dict = PyDict_New();
|
||||
// if (!dict) {
|
||||
diff --git a/src/nox/coreapps/pyrt/pyrt.cc b/src/nox/coreapps/pyrt/pyrt.cc
|
||||
index fbda461..8ec05d6 100644
|
||||
--- a/src/nox/coreapps/pyrt/pyrt.cc
|
||||
+++ b/src/nox/coreapps/pyrt/pyrt.cc
|
||||
@@ -776,7 +776,7 @@ Python_event_manager::create_python_context(const Context* ctxt,
|
||||
pretty_print_python_exception());
|
||||
}
|
||||
|
||||
- PyObject* pyctxt = SWIG_Python_NewPointerObj(p, s, 0);
|
||||
+ PyObject* pyctxt = SWIG_Python_NewPointerObj(m, p, s, 0);
|
||||
Py_INCREF(pyctxt); // XXX needed?
|
||||
|
||||
//Py_DECREF(m);
|
||||
diff --git a/src/nox/netapps/authenticator/auth.i b/src/nox/netapps/authenticator/auth.i
|
||||
index 1de1a17..bfa04e2 100644
|
||||
--- a/src/nox/netapps/authenticator/auth.i
|
||||
+++ b/src/nox/netapps/authenticator/auth.i
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
%module "nox.netapps.authenticator.pyauth"
|
||||
|
||||
+// Hack to get it to compile -BL
|
||||
+%include "std_list.i"
|
||||
%{
|
||||
#include "core_events.hh"
|
||||
#include "pyrt/pycontext.hh"
|
||||
diff --git a/src/nox/netapps/authenticator/flow_util.i b/src/nox/netapps/authenticator/flow_util.i
|
||||
index f67c3ef..2a314e2 100644
|
||||
--- a/src/nox/netapps/authenticator/flow_util.i
|
||||
+++ b/src/nox/netapps/authenticator/flow_util.i
|
||||
@@ -32,6 +32,7 @@ using namespace vigil::applications;
|
||||
%}
|
||||
|
||||
%include "common-defs.i"
|
||||
+%include "std_list.i"
|
||||
|
||||
%import "netinet/netinet.i"
|
||||
%import "pyrt/event.i"
|
||||
diff --git a/src/nox/netapps/routing/routing.i b/src/nox/netapps/routing/routing.i
|
||||
index 44ccb3d..f9221a2 100644
|
||||
--- a/src/nox/netapps/routing/routing.i
|
||||
+++ b/src/nox/netapps/routing/routing.i
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
%module "nox.netapps.routing.pyrouting"
|
||||
|
||||
+// Hack to get it to compile -BL
|
||||
+%include "std_list.i"
|
||||
%{
|
||||
#include "pyrouting.hh"
|
||||
#include "routing.hh"
|
||||
diff --git a/src/nox/netapps/switch_management/pyswitch_management.i b/src/nox/netapps/switch_management/pyswitch_management.i
|
||||
index 72bfed4..ad2c90d 100644
|
||||
--- a/src/nox/netapps/switch_management/pyswitch_management.i
|
||||
+++ b/src/nox/netapps/switch_management/pyswitch_management.i
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
%module "nox.netapps.pyswitch_management"
|
||||
|
||||
+// Hack to get it to compile -BL
|
||||
+%include "std_list.i"
|
||||
%{
|
||||
#include "switch_management_proxy.hh"
|
||||
#include "pyrt/pycontext.hh"
|
||||
diff --git a/src/nox/netapps/tests/tests.cc b/src/nox/netapps/tests/tests.cc
|
||||
index 20e900d..f027028 100644
|
||||
--- a/src/nox/netapps/tests/tests.cc
|
||||
+++ b/src/nox/netapps/tests/tests.cc
|
||||
@@ -306,7 +306,7 @@ private:
|
||||
throw runtime_error("Could not find PyContext SWIG type_info.");
|
||||
}
|
||||
|
||||
- PyObject* pyctxt = SWIG_Python_NewPointerObj(p, s, 0);
|
||||
+ PyObject* pyctxt = SWIG_Python_NewPointerObj(m, p, s, 0);
|
||||
assert(pyctxt);
|
||||
|
||||
Py_DECREF(m);
|
||||
diff --git a/src/nox/netapps/topology/pytopology.i b/src/nox/netapps/topology/pytopology.i
|
||||
index 94a9f4b..7a8cd94 100644
|
||||
--- a/src/nox/netapps/topology/pytopology.i
|
||||
+++ b/src/nox/netapps/topology/pytopology.i
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
%module "nox.netapps.topology"
|
||||
|
||||
+// Hack to get it to compile -BL
|
||||
+%include "std_list.i"
|
||||
%{
|
||||
#include "pytopology.hh"
|
||||
#include "pyrt/pycontext.hh"
|
||||
--
|
||||
1.7.5.4
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
This patch adds the OpenFlow tutorial module source code to nox-destiny.
|
||||
0001: This patch adds the OpenFlow tutorial module source code to nox-destiny.
|
||||
0002: This patch hacks nox-destiny to compile on Ubuntu 12.04.
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
obj-m = sch_htb.o
|
||||
KVERSION = $(shell uname -r)
|
||||
all:
|
||||
make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules
|
||||
install:
|
||||
test -e /lib/modules/$(KVERSION)/kernel/net/sched/sch_htb.ko.bak || mv /lib/modules/$(KVERSION)/kernel/net/sched/sch_htb.ko /lib/modules/$(KVERSION)/kernel/net/sched/sch_htb.ko.bak
|
||||
cp sch_htb.ko /lib/modules/$(KVERSION)/kernel/net/sched/sch_htb.ko
|
||||
rmmod sch_htb
|
||||
modprobe sch_htb
|
||||
clean:
|
||||
make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean
|
||||
@@ -0,0 +1,10 @@
|
||||
Modified sch_htb implementation with ofbuf support.
|
||||
|
||||
To compile, just type make. To use this module instead
|
||||
of regular sch_htb, do:
|
||||
|
||||
0. make
|
||||
1. rmmod sch_htb
|
||||
2. insmod ./sch_htb.ko
|
||||
|
||||
To revert, just rmmod sch_htb.
|
||||
File diff suppressed because it is too large
Load Diff
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from subprocess import check_output as co
|
||||
from sys import exit
|
||||
|
||||
# Actually run bin/mn rather than importing via python path
|
||||
version = 'Mininet ' + co( 'PYTHONPATH=. bin/mn --version', shell=True )
|
||||
version = version.strip()
|
||||
|
||||
# Find all Mininet path references
|
||||
lines = co( "grep -or 'Mininet \w\.\w\.\w\w*' *", shell=True )
|
||||
|
||||
error = False
|
||||
|
||||
for line in lines.split( '\n' ):
|
||||
if line and 'Binary' not in line:
|
||||
fname, fversion = line.split( ':' )
|
||||
if version != fversion:
|
||||
print "%s: incorrect version '%s' (should be '%s')" % (
|
||||
fname, fversion, version )
|
||||
error = True
|
||||
|
||||
if error:
|
||||
exit( 1 )
|
||||
Reference in New Issue
Block a user