diff --git a/mininet/nodelib.py b/mininet/nodelib.py index 1760c7b30b761cf143e1f04d71bc3b6714ea9ec4..dc126bed18a00c38807166d0bb1320a89f342435 100644 --- a/mininet/nodelib.py +++ b/mininet/nodelib.py @@ -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"""