Skip to content
Snippets Groups Projects
Commit 89cc29b4 authored by lantz's avatar lantz
Browse files

Merge pull request #367 from cdburkard/devel/Ryu

add Ryu controller support to Mininet
parents dedb06b2 686a9993
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,7 @@ from mininet.cli import CLI ...@@ -25,7 +25,7 @@ from mininet.cli import CLI
from mininet.log import lg, LEVELS, info, debug, warn, error from mininet.log import lg, LEVELS, info, debug, warn, error
from mininet.net import Mininet, MininetWithControlNet, VERSION from mininet.net import Mininet, MininetWithControlNet, VERSION
from mininet.node import ( Host, CPULimitedHost, Controller, OVSController, from mininet.node import ( Host, CPULimitedHost, Controller, OVSController,
NOX, RemoteController, DefaultController, RYU, NOX, RemoteController, DefaultController,
UserSwitch, OVSSwitch, UserSwitch, OVSSwitch,
OVSLegacyKernelSwitch, IVSSwitch ) OVSLegacyKernelSwitch, IVSSwitch )
from mininet.nodelib import LinuxBridge from mininet.nodelib import LinuxBridge
...@@ -74,6 +74,7 @@ CONTROLLERS = { 'ref': Controller, ...@@ -74,6 +74,7 @@ CONTROLLERS = { 'ref': Controller,
'nox': NOX, 'nox': NOX,
'remote': RemoteController, 'remote': RemoteController,
'default': DefaultController, 'default': DefaultController,
'ryu': RYU,
'none': lambda name: None } 'none': lambda name: None }
LINKDEF = 'default' LINKDEF = 'default'
......
...@@ -1347,6 +1347,27 @@ def __init__( self, name, *noxArgs, **kwargs ): ...@@ -1347,6 +1347,27 @@ def __init__( self, name, *noxArgs, **kwargs ):
cdir=noxCoreDir, cdir=noxCoreDir,
**kwargs ) **kwargs )
class RYU( Controller ):
"Controller to run Ryu application"
def __init__( self, name, *ryuArgs, **kwargs ):
"""Init.
name: name to give controller.
ryuArgs: arguments and modules to pass to Ryu"""
homeDir = quietRun( 'printenv HOME' ).strip( '\r\n' )
ryuCoreDir = '%s/ryu/ryu/app/' % homeDir
if not ryuArgs:
warn( 'warning: no Ryu modules specified; '
'running simple_switch only\n' )
ryuArgs = [ ryuCoreDir + 'simple_switch.py' ]
elif type( ryuArgs ) not in ( list, tuple ):
ryuArgs = [ ryuArgs ]
Controller.__init__( self, name,
command='ryu-manager',
cargs='--ofp-tcp-listen-port %s ' +
' '.join( ryuArgs ),
cdir=ryuCoreDir,
**kwargs )
class RemoteController( Controller ): class RemoteController( Controller ):
"Controller running outside of Mininet's control." "Controller running outside of Mininet's control."
......
...@@ -383,6 +383,38 @@ function ivs { ...@@ -383,6 +383,38 @@ function ivs {
sudo make install sudo make install
} }
# Install RYU
function ryu {
echo "Installing RYU..."
# install Ryu dependencies"
$install autoconf automake g++ libtool python make
if [ "$DIST" = "Ubuntu" ]; then
$install libxml2 libxslt-dev python-pip python-dev
sudo pip install gevent
elif [ "$DIST" = "Debian" ]; then
$install libxml2 libxslt-dev python-pip python-dev
sudo pip install gevent
fi
# if needed, update python-six
SIX_VER=`pip show six | grep Version | awk '{print $2}'`
if version_ge 1.7.0 $SIX_VER; then
echo "Installing python-six version 1.7.0..."
sudo pip install -I six==1.7.0
fi
# fetch RYU
cd $BUILD_DIR/
git clone git://github.com/osrg/ryu.git ryu
cd ryu
# install ryu
sudo python ./setup.py install
# Add symbolic link to /usr/bin
sudo ln -s ./bin/ryu-manager /usr/local/bin/ryu-manager
}
# Install NOX with tutorial files # Install NOX with tutorial files
function nox { function nox {
echo "Installing NOX w/tutorial files..." echo "Installing NOX w/tutorial files..."
...@@ -645,7 +677,7 @@ function vm_clean { ...@@ -645,7 +677,7 @@ function vm_clean {
} }
function usage { function usage {
printf '\nUsage: %s [-abcdfhikmnprtvVwx03]\n\n' $(basename $0) >&2 printf '\nUsage: %s [-abcdfhikmnprtvVwxy03]\n\n' $(basename $0) >&2
printf 'This install script attempts to install useful packages\n' >&2 printf 'This install script attempts to install useful packages\n' >&2
printf 'for Mininet. It should (hopefully) work on Ubuntu 11.10+\n' >&2 printf 'for Mininet. It should (hopefully) work on Ubuntu 11.10+\n' >&2
...@@ -672,6 +704,7 @@ function usage { ...@@ -672,6 +704,7 @@ function usage {
printf -- ' -v: install Open (V)switch\n' >&2 printf -- ' -v: install Open (V)switch\n' >&2
printf -- ' -V <version>: install a particular version of Open (V)switch on Ubuntu\n' >&2 printf -- ' -V <version>: install a particular version of Open (V)switch on Ubuntu\n' >&2
printf -- ' -w: install OpenFlow (W)ireshark dissector\n' >&2 printf -- ' -w: install OpenFlow (W)ireshark dissector\n' >&2
printf -- ' -y: install R(y)u Controller\n' >&2
printf -- ' -x: install NO(X) Classic OpenFlow controller\n' >&2 printf -- ' -x: install NO(X) Classic OpenFlow controller\n' >&2
printf -- ' -0: (default) -0[fx] installs OpenFlow 1.0 versions\n' >&2 printf -- ' -0: (default) -0[fx] installs OpenFlow 1.0 versions\n' >&2
printf -- ' -3: -3[fx] installs OpenFlow 1.3 versions\n' >&2 printf -- ' -3: -3[fx] installs OpenFlow 1.3 versions\n' >&2
...@@ -684,7 +717,7 @@ if [ $# -eq 0 ] ...@@ -684,7 +717,7 @@ if [ $# -eq 0 ]
then then
all all
else else
while getopts 'abcdefhikmnprs:tvV:wx03' OPTION while getopts 'abcdefhikmnprs:tvV:wxy03' OPTION
do do
case $OPTION in case $OPTION in
a) all;; a) all;;
...@@ -717,6 +750,7 @@ else ...@@ -717,6 +750,7 @@ else
1.3) nox13;; 1.3) nox13;;
*) echo "Invalid OpenFlow version $OF_VERSION";; *) echo "Invalid OpenFlow version $OF_VERSION";;
esac;; esac;;
y) ryu;;
0) OF_VERSION=1.0;; 0) OF_VERSION=1.0;;
3) OF_VERSION=1.3;; 3) OF_VERSION=1.3;;
?) usage;; ?) usage;;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment