MCPcopy Create free account
hub / github.com/mininet/mininet / addSwitch

Method addSwitch

mininet/net.py:255–271  ·  view source on GitHub ↗

Add switch. name: name of switch to add cls: custom switch class/constructor (optional) returns: added switch side effect: increments listenPort ivar .

( self, name, cls=None, **params )

Source from the content-addressed store, hash-verified

253 self.delNode( host, nodes=self.hosts )
254
255 def addSwitch( self, name, cls=None, **params ):
256 """Add switch.
257 name: name of switch to add
258 cls: custom switch class/constructor (optional)
259 returns: added switch
260 side effect: increments listenPort ivar ."""
261 defaults = { 'listenPort': self.listenPort,
262 'inNamespace': self.inNamespace }
263 defaults.update( params )
264 if not cls:
265 cls = self.switch
266 sw = cls( name, **defaults )
267 if not self.inNamespace and self.listenPort:
268 self.listenPort += 1
269 self.switches.append( sw )
270 self.nameToNode[ name ] = sw
271 return sw
272
273 def delSwitch( self, switch ):
274 "Delete a switch"

Callers 10

buildFromTopoMethod · 0.95
testDefaultDpidMethod · 0.95
testDefaultDpidLenMethod · 0.95
testRemoteNetFunction · 0.95
emptyNetFunction · 0.95
multiControllerNetFunction · 0.95
intfOptionsFunction · 0.95
testPortNumberingFunction · 0.95

Calls 1

appendMethod · 0.80

Tested by 4

testDefaultDpidMethod · 0.76
testDefaultDpidLenMethod · 0.76