* Force reinstall on 'make install'

This allows you to install a modified version with 'make install'.

* Simplify RyuController and update for current Ryu

Notes:

The Ryu() constructor has changed slightly. We still add
`--ofp-tcp-listen-port %s` to the end of `cargs` to make
Controller() happy.

`command` is now `ryu run` so it includes the `run` command
but can be specified explicitly as needed.

You should be able to run Ryu's simple_switch by using:

    mn --controller ryu

and pass alternate modules such as simple_switch_13:

    mn --controller ryu,ryu.app.simple_switch_13

Unfortunately simple_switch_stp seems like it may be broken
for Python 3.8, which is too bad because we'd like to test
the Torus topo with it.
This commit is contained in:
lantz
2021-02-07 16:08:45 -08:00
committed by GitHub
parent 7b240ce5b8
commit c2fb4d2e8c
+14 -20
View File
@@ -1505,32 +1505,26 @@ class NOX( Controller ):
Controller.__init__( self, name, Controller.__init__( self, name,
command=noxCoreDir + '/nox_core', command=noxCoreDir + '/nox_core',
cargs='--libdir=/usr/local/lib -v -i ptcp:%s ' + cargs='--libdir=/usr/local/lib -v '
'-i ptcp:%s ' +
' '.join( noxArgs ), ' '.join( noxArgs ),
cdir=noxCoreDir, cdir=noxCoreDir,
**kwargs ) **kwargs )
class Ryu( Controller ): class Ryu( Controller ):
"Controller to run Ryu application" "Ryu OpenFlow Controller"
def __init__( self, name, *ryuArgs, **kwargs ): def __init__( self, name, ryuArgs='ryu.app.simple_switch',
command='ryu run', **kwargs ):
"""Init. """Init.
name: name to give controller. name: name to give controller.
ryuArgs: arguments and modules to pass to Ryu""" ryuArgs: modules to pass to Ryu (ryu.app.simple_switch)
homeDir = quietRun( 'printenv HOME' ).strip( '\r\n' ) command: comand to run Ryu ('ryu run')"""
ryuCoreDir = '%s/ryu/ryu/app/' % homeDir if isinstance( ryuArgs, ( list, tuple ) ):
if not ryuArgs: ryuArgs = ' '.join( ryuArgs )
warn( 'warning: no Ryu modules specified; ' cargs = kwargs.pop(
'running simple_switch only\n' ) 'cargs', ryuArgs + ' --ofp-tcp-listen-port %s' )
ryuArgs = [ ryuCoreDir + 'simple_switch.py' ] Controller.__init__( self, name, command=command,
elif not isinstance( ryuArgs, ( list, tuple ) ): cargs=cargs, **kwargs )
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 ):