Revision 08643fe6

View differences:

mininet/cli.py
36 36

  
37 37
from mininet.log import info, output, error
38 38
from mininet.term import makeTerms, runX11
39
from mininet.util import quietRun, isShellBuiltin, dumpNodeConnections
39
from mininet.util import ( quietRun, isShellBuiltin, dumpNodeConnections,
40
                         dumpPorts )
40 41

  
41 42
class CLI( Cmd ):
42 43
    "Simple command-line interface to talk to nodes."
......
127 128
        nodes = ' '.join( sorted( self.mn ) )
128 129
        output( 'available nodes are: \n%s\n' % nodes )
129 130

  
131
    def do_ports( self, line ):
132
        "display ports and interfaces for each switch"
133
        dumpPorts( self.mn.switches )
134

  
130 135
    def do_net( self, _line ):
131 136
        "List network connections."
132 137
        dumpNodeConnections( self.mn.values() )
mininet/util.py
237 237
    nodes = net.controllers + net.switches + net.hosts
238 238
    dumpNodeConnections( nodes )
239 239

  
240
def dumpPorts( switches ):
241
    "dump interface to openflow port mappings for each switch"
242
    for switch in switches:
243
        output( '%s ' % switch.name )
244
        for intf in switch.intfList():
245
            port = switch.ports[ intf ]
246
            output( '%s:%d ' % ( intf, port ) )
247
        output( '\n' )
248

  
240 249
# IP and Mac address formatting and parsing
241 250

  
242 251
def _colonHex( val, bytecount ):

Also available in: Unified diff