Minor cleanup of mn/net and fixes for CLI.
All commands should work now.
This commit is contained in:
@@ -113,7 +113,6 @@ class MininetRunner( object ):
|
|||||||
index = sys.argv.index( '--custom' )
|
index = sys.argv.index( '--custom' )
|
||||||
if len( sys.argv ) > index + 1:
|
if len( sys.argv ) > index + 1:
|
||||||
custom = sys.argv[ index + 1 ]
|
custom = sys.argv[ index + 1 ]
|
||||||
print "custom = %s" % custom
|
|
||||||
self.parseCustomFile( custom )
|
self.parseCustomFile( custom )
|
||||||
else:
|
else:
|
||||||
raise Exception( 'Custom file name not found' )
|
raise Exception( 'Custom file name not found' )
|
||||||
|
|||||||
+4
-4
@@ -47,8 +47,8 @@ class CLI( Cmd ):
|
|||||||
|
|
||||||
def __init__( self, mininet ):
|
def __init__( self, mininet ):
|
||||||
self.mn = mininet
|
self.mn = mininet
|
||||||
|
self.nodelist = self.mn.hosts + self.mn.switches + self.mn.controllers
|
||||||
self.nodemap = {} # map names to Node objects
|
self.nodemap = {} # map names to Node objects
|
||||||
self.nodelist = self.mn.switches + self.mn.hosts + self.mn.controllers
|
|
||||||
for node in self.nodelist:
|
for node in self.nodelist:
|
||||||
self.nodemap[ node.name ] = node
|
self.nodemap[ node.name ] = node
|
||||||
Cmd.__init__( self )
|
Cmd.__init__( self )
|
||||||
@@ -91,7 +91,7 @@ class CLI( Cmd ):
|
|||||||
for switch in self.mn.switches:
|
for switch in self.mn.switches:
|
||||||
info( '%s <->', switch.name )
|
info( '%s <->', switch.name )
|
||||||
for intf in switch.intfs:
|
for intf in switch.intfs:
|
||||||
node = switch.connection[ intf ]
|
node, name = switch.connection[ intf ]
|
||||||
info( ' %s' % node.name )
|
info( ' %s' % node.name )
|
||||||
info( '\n' )
|
info( '\n' )
|
||||||
|
|
||||||
@@ -118,12 +118,12 @@ class CLI( Cmd ):
|
|||||||
|
|
||||||
def do_intfs( self, args ):
|
def do_intfs( self, args ):
|
||||||
"List interfaces."
|
"List interfaces."
|
||||||
for node in self.mn.nodes.values():
|
for node in self.nodelist:
|
||||||
info( '%s: %s\n' % ( node.name, ' '.join( node.intfs ) ) )
|
info( '%s: %s\n' % ( node.name, ' '.join( node.intfs ) ) )
|
||||||
|
|
||||||
def do_dump( self, args ):
|
def do_dump( self, args ):
|
||||||
"Dump node info."
|
"Dump node info."
|
||||||
for node in self.mn.nodes.values():
|
for node in self.nodelist:
|
||||||
info( '%s\n' % node )
|
info( '%s\n' % node )
|
||||||
|
|
||||||
def do_exit( self, args ):
|
def do_exit( self, args ):
|
||||||
|
|||||||
+1
-1
@@ -384,7 +384,7 @@ class Mininet( object ):
|
|||||||
info( '\n' )
|
info( '\n' )
|
||||||
info( '*** Stopping %i switches\n' % len( self.switches ) )
|
info( '*** Stopping %i switches\n' % len( self.switches ) )
|
||||||
for switch in self.switches:
|
for switch in self.switches:
|
||||||
info( '%s ' % switch.name )
|
info( switch.name )
|
||||||
switch.stop()
|
switch.stop()
|
||||||
info( '\n' )
|
info( '\n' )
|
||||||
info( '*** Stopping %i controllers\n' % len( self.controllers ) )
|
info( '*** Stopping %i controllers\n' % len( self.controllers ) )
|
||||||
|
|||||||
Reference in New Issue
Block a user