Revision 686a9993

View differences:

bin/mn
25 25
from mininet.log import lg, LEVELS, info, debug, warn, error
26 26
from mininet.net import Mininet, MininetWithControlNet, VERSION
27 27
from mininet.node import ( Host, CPULimitedHost, Controller, OVSController,
28
                           NOX, RemoteController, DefaultController,
28
                           RYU, NOX, RemoteController, DefaultController,
29 29
                           UserSwitch, OVSSwitch,
30 30
                           OVSLegacyKernelSwitch, IVSSwitch )
31 31
from mininet.nodelib import LinuxBridge
......
74 74
                'nox': NOX,
75 75
                'remote': RemoteController,
76 76
                'default': DefaultController,
77
                'ryu': RYU,
77 78
                'none': lambda name: None }
78 79

  
79 80
LINKDEF = 'default'
mininet/node.py
1347 1347
                             cdir=noxCoreDir,
1348 1348
                             **kwargs )
1349 1349

  
1350
class RYU( Controller ):
1351
    "Controller to run Ryu application"
1352
    def __init__( self, name, *ryuArgs, **kwargs ):
1353
        """Init.
1354
        name: name to give controller.
1355
        ryuArgs: arguments and modules to pass to Ryu"""
1356
        homeDir = quietRun( 'printenv HOME' ).strip( '\r\n' )
1357
        ryuCoreDir = '%s/ryu/ryu/app/' % homeDir
1358
        if not ryuArgs:
1359
            warn( 'warning: no Ryu modules specified; '
1360
                  'running simple_switch only\n' )
1361
            ryuArgs = [ ryuCoreDir + 'simple_switch.py' ]
1362
        elif type( ryuArgs ) not in ( list, tuple ):
1363
            ryuArgs = [ ryuArgs ]
1364

  
1365
        Controller.__init__( self, name,
1366
                         command='ryu-manager',
1367
                         cargs='--ofp-tcp-listen-port %s ' + 
1368
                         ' '.join( ryuArgs ),
1369
                         cdir=ryuCoreDir,
1370
                         **kwargs )
1350 1371

  
1351 1372
class RemoteController( Controller ):
1352 1373
    "Controller running outside of Mininet's control."
util/install.sh
383 383
    sudo make install
384 384
}
385 385

  
386
# Install RYU
387
function ryu {
388
    echo "Installing RYU..."
389

  
390
    # install Ryu dependencies"
391
    $install autoconf automake g++ libtool python make
392
    if [ "$DIST" = "Ubuntu" ]; then
393
        $install libxml2 libxslt-dev python-pip python-dev
394
        sudo pip install gevent
395
    elif [ "$DIST" = "Debian" ]; then
396
        $install libxml2 libxslt-dev python-pip python-dev
397
        sudo pip install gevent
398
    fi
399

  
400
    # if needed, update python-six
401
    SIX_VER=`pip show six | grep Version | awk '{print $2}'`
402
    if version_ge 1.7.0 $SIX_VER; then
403
        echo "Installing python-six version 1.7.0..."
404
        sudo pip install -I six==1.7.0
405
    fi
406
    # fetch RYU
407
    cd $BUILD_DIR/
408
    git clone git://github.com/osrg/ryu.git ryu
409
    cd ryu
410

  
411
    # install ryu
412
    sudo python ./setup.py install
413

  
414
    # Add symbolic link to /usr/bin
415
    sudo ln -s ./bin/ryu-manager /usr/local/bin/ryu-manager
416
}
417

  
386 418
# Install NOX with tutorial files
387 419
function nox {
388 420
    echo "Installing NOX w/tutorial files..."
......
645 677
}
646 678

  
647 679
function usage {
648
    printf '\nUsage: %s [-abcdfhikmnprtvVwx03]\n\n' $(basename $0) >&2
680
    printf '\nUsage: %s [-abcdfhikmnprtvVwxy03]\n\n' $(basename $0) >&2
649 681

  
650 682
    printf 'This install script attempts to install useful packages\n' >&2
651 683
    printf 'for Mininet. It should (hopefully) work on Ubuntu 11.10+\n' >&2
......
672 704
    printf -- ' -v: install Open (V)switch\n' >&2
673 705
    printf -- ' -V <version>: install a particular version of Open (V)switch on Ubuntu\n' >&2
674 706
    printf -- ' -w: install OpenFlow (W)ireshark dissector\n' >&2
707
    printf -- ' -y: install R(y)u Controller\n' >&2
675 708
    printf -- ' -x: install NO(X) Classic OpenFlow controller\n' >&2
676 709
    printf -- ' -0: (default) -0[fx] installs OpenFlow 1.0 versions\n' >&2
677 710
    printf -- ' -3: -3[fx] installs OpenFlow 1.3 versions\n' >&2
......
684 717
then
685 718
    all
686 719
else
687
    while getopts 'abcdefhikmnprs:tvV:wx03' OPTION
720
    while getopts 'abcdefhikmnprs:tvV:wxy03' OPTION
688 721
    do
689 722
      case $OPTION in
690 723
      a)    all;;
......
717 750
            1.3) nox13;;
718 751
            *)  echo "Invalid OpenFlow version $OF_VERSION";;
719 752
            esac;;
753
      y)    ryu;;
720 754
      0)    OF_VERSION=1.0;;
721 755
      3)    OF_VERSION=1.3;;
722 756
      ?)    usage;;

Also available in: Unified diff