Init. name: name to give controller noxArgs: arguments (strings) to pass to NOX
( self, name, *noxArgs, **kwargs )
| 1509 | "Controller to run a NOX application." |
| 1510 | |
| 1511 | def __init__( self, name, *noxArgs, **kwargs ): |
| 1512 | """Init. |
| 1513 | name: name to give controller |
| 1514 | noxArgs: arguments (strings) to pass to NOX""" |
| 1515 | if not noxArgs: |
| 1516 | warn( 'warning: no NOX modules specified; ' |
| 1517 | 'running packetdump only\n' ) |
| 1518 | noxArgs = [ 'packetdump' ] |
| 1519 | elif not isinstance( noxArgs, ( list, tuple ) ): |
| 1520 | noxArgs = [ noxArgs ] |
| 1521 | |
| 1522 | if 'NOX_CORE_DIR' not in os.environ: |
| 1523 | exit( 'exiting; please set missing NOX_CORE_DIR env var' ) |
| 1524 | noxCoreDir = os.environ[ 'NOX_CORE_DIR' ] |
| 1525 | |
| 1526 | Controller.__init__( self, name, |
| 1527 | command=noxCoreDir + '/nox_core', |
| 1528 | cargs='--libdir=/usr/local/lib -v ' |
| 1529 | '-i ptcp:%s ' + |
| 1530 | ' '.join( noxArgs ), |
| 1531 | cdir=noxCoreDir, |
| 1532 | **kwargs ) |
| 1533 | |
| 1534 | class Ryu( Controller ): |
| 1535 | "Ryu OpenFlow Controller" |