Skip to content
Snippets Groups Projects
Commit f0f9907b authored by Bob Lantz's avatar Bob Lantz
Browse files

Add setup() and dpctl() methods for LinuxBridge

Also adds docstrings.
Fixes #422
parent c4fc6304
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,8 @@
from mininet.node import Node, Switch
from mininet.log import setLogLevel, info
from mininet.moduledeps import pathCheck
class LinuxBridge( Switch ):
"Linux Bridge (with optional spanning tree)"
......@@ -31,6 +33,7 @@ def connected( self ):
return True
def start( self, controllers ):
"Start Linux bridge"
self.cmd( 'ifconfig', self, 'down' )
self.cmd( 'brctl delbr', self )
self.cmd( 'brctl addbr', self )
......@@ -43,9 +46,20 @@ def start( self, controllers ):
self.cmd( 'ifconfig', self, 'up' )
def stop( self ):
"Stop Linux bridge"
self.cmd( 'ifconfig', self, 'down' )
self.cmd( 'brctl delbr', self )
def dpctl( self, *args ):
"Run brctl command"
return self.cmd( 'brctl', *args )
@classmethod
def setup( cls ):
"Make sure our class dependencies are available"
pathCheck( 'brctl', moduleName='bridge-utils' )
class NAT( Node ):
"""NAT: Provides connectivity to external network"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment