Add TCLink for simplified tc-limited link creation.
This commit is contained in:
@@ -22,7 +22,7 @@ from mininet.log import lg, LEVELS, info, warn
|
|||||||
from mininet.net import Mininet, MininetWithControlNet
|
from mininet.net import Mininet, MininetWithControlNet
|
||||||
from mininet.node import Host, CPULimitedHost, Controller, OVSController, NOX
|
from mininet.node import Host, CPULimitedHost, Controller, OVSController, NOX
|
||||||
from mininet.node import RemoteController, UserSwitch, OVSKernelSwitch
|
from mininet.node import RemoteController, UserSwitch, OVSKernelSwitch
|
||||||
from mininet.link import Intf, TCIntf
|
from mininet.link import Link, TCLink
|
||||||
from mininet.topo import SingleSwitchTopo, LinearTopo, SingleSwitchReversedTopo
|
from mininet.topo import SingleSwitchTopo, LinearTopo, SingleSwitchReversedTopo
|
||||||
from mininet.topolib import TreeTopo
|
from mininet.topolib import TreeTopo
|
||||||
from mininet.util import makeNumeric, custom
|
from mininet.util import makeNumeric, custom
|
||||||
@@ -74,9 +74,9 @@ CONTROLLERS = { 'ref': Controller,
|
|||||||
'remote': RemoteController,
|
'remote': RemoteController,
|
||||||
'none': lambda name: None }
|
'none': lambda name: None }
|
||||||
|
|
||||||
INTFDEF = 'default'
|
LINKDEF = 'default'
|
||||||
INTFS = { 'default': Intf,
|
LINKS = { 'default': Link,
|
||||||
'tc': TCIntf }
|
'tc': TCLink }
|
||||||
|
|
||||||
|
|
||||||
# optional tests to run
|
# optional tests to run
|
||||||
@@ -182,7 +182,7 @@ class MininetRunner( object ):
|
|||||||
addDictOption( opts, SWITCHES, SWITCHDEF, 'switch' )
|
addDictOption( opts, SWITCHES, SWITCHDEF, 'switch' )
|
||||||
addDictOption( opts, HOSTS, HOSTDEF, 'host' )
|
addDictOption( opts, HOSTS, HOSTDEF, 'host' )
|
||||||
addDictOption( opts, CONTROLLERS, CONTROLLERDEF, 'controller' )
|
addDictOption( opts, CONTROLLERS, CONTROLLERDEF, 'controller' )
|
||||||
addDictOption( opts, INTFS, INTFDEF, 'intf' )
|
addDictOption( opts, LINKS, LINKDEF, 'link' )
|
||||||
addDictOption( opts, TOPOS, TOPODEF, 'topo' )
|
addDictOption( opts, TOPOS, TOPODEF, 'topo' )
|
||||||
|
|
||||||
opts.add_option( '--clean', '-c', action='store_true',
|
opts.add_option( '--clean', '-c', action='store_true',
|
||||||
@@ -246,7 +246,7 @@ class MininetRunner( object ):
|
|||||||
switch = customNode( SWITCHES, self.options.switch )
|
switch = customNode( SWITCHES, self.options.switch )
|
||||||
host = customNode( HOSTS, self.options.host )
|
host = customNode( HOSTS, self.options.host )
|
||||||
controller = customNode( CONTROLLERS, self.options.controller )
|
controller = customNode( CONTROLLERS, self.options.controller )
|
||||||
intf = customNode( INTFS, self.options.intf )
|
link = customNode( LINKS, self.options.link )
|
||||||
|
|
||||||
if self.validate:
|
if self.validate:
|
||||||
self.validate( self.options )
|
self.validate( self.options )
|
||||||
@@ -262,7 +262,7 @@ class MininetRunner( object ):
|
|||||||
listenPort = self.options.listenport
|
listenPort = self.options.listenport
|
||||||
mn = Net( topo=topo,
|
mn = Net( topo=topo,
|
||||||
switch=switch, host=host, controller=controller,
|
switch=switch, host=host, controller=controller,
|
||||||
intf=intf,
|
link=link,
|
||||||
ipBase=ipBase,
|
ipBase=ipBase,
|
||||||
inNamespace=inNamespace,
|
inNamespace=inNamespace,
|
||||||
xterms=xterms, autoSetMacs=mac,
|
xterms=xterms, autoSetMacs=mac,
|
||||||
|
|||||||
@@ -371,3 +371,14 @@ class Link( object ):
|
|||||||
|
|
||||||
def __str__( self ):
|
def __str__( self ):
|
||||||
return '%s<->%s' % ( self.intf1, self.intf2 )
|
return '%s<->%s' % ( self.intf1, self.intf2 )
|
||||||
|
|
||||||
|
class TCLink( Link ):
|
||||||
|
"Link with symmetric TC interfaces configured via opts"
|
||||||
|
def __init__( self, node1, node2, port1=None, port2=None,
|
||||||
|
intfName1=None, intfName2=None, **params ):
|
||||||
|
Link.__init__( self, node1, node2, port1=None, port2=None,
|
||||||
|
intfName1=None, intfName2=None,
|
||||||
|
cls1=TCIntf,
|
||||||
|
cls2=TCIntf,
|
||||||
|
params1=params,
|
||||||
|
params2=params)
|
||||||
|
|||||||
Reference in New Issue
Block a user