CLI: add interface dump command
This commit is contained in:
+7
-2
@@ -522,7 +522,7 @@ class Mininet(object):
|
|||||||
class MininetCLI(object):
|
class MininetCLI(object):
|
||||||
'''Simple command-line interface to talk to nodes.'''
|
'''Simple command-line interface to talk to nodes.'''
|
||||||
cmds = ['?', 'help', 'nodes', 'net', 'sh', 'ping_all', 'exit', \
|
cmds = ['?', 'help', 'nodes', 'net', 'sh', 'ping_all', 'exit', \
|
||||||
'ping_pair', 'iperf', 'iperf_udp']
|
'ping_pair', 'iperf', 'iperf_udp', 'intfs']
|
||||||
|
|
||||||
def __init__(self, mininet):
|
def __init__(self, mininet):
|
||||||
self.mn = mininet
|
self.mn = mininet
|
||||||
@@ -561,7 +561,7 @@ class MininetCLI(object):
|
|||||||
' '.join([node.name for node in sorted(self.nodelist)]))
|
' '.join([node.name for node in sorted(self.nodelist)]))
|
||||||
|
|
||||||
def net(self, args):
|
def net(self, args):
|
||||||
'''List network connection.'''
|
'''List network connections.'''
|
||||||
for switch_dpid in self.mn.topo.switches():
|
for switch_dpid in self.mn.topo.switches():
|
||||||
switch = self.mn.nodes[switch_dpid]
|
switch = self.mn.nodes[switch_dpid]
|
||||||
lg.info('%s <->', switch.name)
|
lg.info('%s <->', switch.name)
|
||||||
@@ -591,6 +591,11 @@ class MininetCLI(object):
|
|||||||
udp_bw = args[0] if len(args) else '10M'
|
udp_bw = args[0] if len(args) else '10M'
|
||||||
self.mn.iperf_udp(udp_bw)
|
self.mn.iperf_udp(udp_bw)
|
||||||
|
|
||||||
|
def intfs(self, args):
|
||||||
|
'''List interfaces.'''
|
||||||
|
for dpid, node in self.mn.nodes.iteritems():
|
||||||
|
lg.info('%s: %s\n' % (node.name, ' '.join(node.intfs)))
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
'''Read and execute commands.'''
|
'''Read and execute commands.'''
|
||||||
lg.warn('*** Starting CLI:\n')
|
lg.warn('*** Starting CLI:\n')
|
||||||
|
|||||||
Reference in New Issue
Block a user