Rename cliinfo debug level to output
This commit is contained in:
@@ -178,10 +178,10 @@ class MininetRunner( object ):
|
||||
"Setup and validate environment."
|
||||
|
||||
# set logging verbosity
|
||||
if LEVELS[self.options.verbosity] > LEVELS['cliinfo']:
|
||||
if LEVELS[self.options.verbosity] > LEVELS['output']:
|
||||
print ( '*** WARNING: selected verbosity level (%s) will hide CLI '
|
||||
'output!\n'
|
||||
'Please restart Mininet with -v [debug, info, cliinfo].' )
|
||||
'Please restart Mininet with -v [debug, info, output].' )
|
||||
lg.setLogLevel( self.options.verbosity )
|
||||
|
||||
# validate environment setup
|
||||
|
||||
+7
-7
@@ -38,7 +38,7 @@ Bugs/limitations:
|
||||
from subprocess import call
|
||||
from cmd import Cmd
|
||||
|
||||
from mininet.log import info, cliinfo
|
||||
from mininet.log import info, output
|
||||
|
||||
class CLI( Cmd ):
|
||||
"Simple command-line interface to talk to nodes."
|
||||
@@ -84,16 +84,16 @@ class CLI( Cmd ):
|
||||
def do_nodes( self, args ):
|
||||
"List all nodes."
|
||||
nodes = ' '.join( [ node.name for node in sorted( self.nodelist ) ] )
|
||||
cliinfo( 'available nodes are: \n%s\n' % nodes )
|
||||
output( 'available nodes are: \n%s\n' % nodes )
|
||||
|
||||
def do_net( self, args ):
|
||||
"List network connections."
|
||||
for switch in self.mn.switches:
|
||||
cliinfo( switch.name, '<->' )
|
||||
output( switch.name, '<->' )
|
||||
for intf in switch.intfs.values():
|
||||
name = switch.connection[ intf ][ 1 ]
|
||||
cliinfo( ' %s' % name )
|
||||
cliinfo( '\n' )
|
||||
output( ' %s' % name )
|
||||
output( '\n' )
|
||||
|
||||
def do_sh( self, args ):
|
||||
"Run an external shell command"
|
||||
@@ -138,13 +138,13 @@ class CLI( Cmd ):
|
||||
def do_intfs( self, args ):
|
||||
"List interfaces."
|
||||
for node in self.nodelist:
|
||||
cliinfo( '%s: %s\n' %
|
||||
output( '%s: %s\n' %
|
||||
( node.name, ' '.join( sorted( node.intfs.values() ) ) ) )
|
||||
|
||||
def do_dump( self, args ):
|
||||
"Dump node info."
|
||||
for node in self.nodelist:
|
||||
cliinfo( '%s\n' % node )
|
||||
output( '%s\n' % node )
|
||||
|
||||
def do_exit( self, args ):
|
||||
"Exit"
|
||||
|
||||
+9
-9
@@ -8,11 +8,11 @@ import types
|
||||
# the output of the commands they execute, plus any errors or warnings. This
|
||||
# level is in between info and warning. CLI info-level commands should not be
|
||||
# printed during regression tests.
|
||||
CLIINFO = 25
|
||||
OUTPUT = 25
|
||||
|
||||
LEVELS = { 'debug': logging.DEBUG,
|
||||
'info': logging.INFO,
|
||||
'cliinfo': CLIINFO,
|
||||
'output': OUTPUT,
|
||||
'warning': logging.WARNING,
|
||||
'error': logging.ERROR,
|
||||
'critical': logging.CRITICAL }
|
||||
@@ -131,18 +131,18 @@ class MininetLogger( Logger, object ):
|
||||
# Not sure why this is occurring - this function definitely gets called.
|
||||
|
||||
# See /usr/lib/python2.5/logging/__init__.py; modified from warning()
|
||||
def cliinfo( self, msg, *args, **kwargs ):
|
||||
"""Log 'msg % args' with severity 'CLIINFO'.
|
||||
def output( self, msg, *args, **kwargs ):
|
||||
"""Log 'msg % args' with severity 'OUTPUT'.
|
||||
|
||||
To pass exception information, use the keyword argument exc_info
|
||||
with a true value, e.g.
|
||||
|
||||
logger.warning("Houston, we have a %s", "cli output", exc_info=1)
|
||||
"""
|
||||
if self.manager.disable >= CLIINFO:
|
||||
if self.manager.disable >= OUTPUT:
|
||||
return
|
||||
if self.isEnabledFor( CLIINFO ):
|
||||
self._log( CLIINFO, msg, args, kwargs )
|
||||
if self.isEnabledFor( OUTPUT ):
|
||||
self._log( OUTPUT, msg, args, kwargs )
|
||||
|
||||
# pylint: enable-msg=E0202
|
||||
|
||||
@@ -170,6 +170,6 @@ def makeListCompatible( fn ):
|
||||
setattr( newfn, '__doc__', fn.__doc__ )
|
||||
return newfn
|
||||
|
||||
info, cliinfo, warn, error, debug = lg.info, lg.cliinfo, lg.warn, lg.error, \
|
||||
lg.debug = [ makeListCompatible( f ) for f in lg.info, lg.cliinfo, lg.warn,
|
||||
info, output, warn, error, debug = lg.info, lg.output, lg.warn, lg.error, \
|
||||
lg.debug = [ makeListCompatible( f ) for f in lg.info, lg.output, lg.warn,
|
||||
lg.error, lg.debug ]
|
||||
|
||||
+9
-9
@@ -89,7 +89,7 @@ import signal
|
||||
from time import sleep
|
||||
|
||||
from mininet.cli import CLI
|
||||
from mininet.log import info, error, debug, cliinfo
|
||||
from mininet.log import info, error, debug, output
|
||||
from mininet.node import Host, UserSwitch, KernelSwitch, Controller
|
||||
from mininet.node import ControllerParams
|
||||
from mininet.util import quietRun, fixLimits
|
||||
@@ -402,9 +402,9 @@ class Mininet( object ):
|
||||
ploss = None
|
||||
if not hosts:
|
||||
hosts = self.hosts
|
||||
cliinfo( '*** Ping: testing ping reachability\n' )
|
||||
output( '*** Ping: testing ping reachability\n' )
|
||||
for node in hosts:
|
||||
cliinfo( '%s -> ' % node.name )
|
||||
output( '%s -> ' % node.name )
|
||||
for dest in hosts:
|
||||
if node != dest:
|
||||
result = node.cmd( 'ping -c1 ' + dest.IP() )
|
||||
@@ -416,10 +416,10 @@ class Mininet( object ):
|
||||
node.cmdPrint( 'route' )
|
||||
exit( 1 )
|
||||
lost += sent - received
|
||||
cliinfo( ( '%s ' % dest.name ) if received else 'X ' )
|
||||
cliinfo( '\n' )
|
||||
output( ( '%s ' % dest.name ) if received else 'X ' )
|
||||
output( '\n' )
|
||||
ploss = 100 * lost / packets
|
||||
cliinfo( "*** Results: %i%% dropped (%d/%d lost)\n" %
|
||||
output( "*** Results: %i%% dropped (%d/%d lost)\n" %
|
||||
( ploss, lost, packets ) )
|
||||
return ploss
|
||||
|
||||
@@ -456,8 +456,8 @@ class Mininet( object ):
|
||||
else:
|
||||
assert len( hosts ) == 2
|
||||
host0, host1 = hosts
|
||||
cliinfo( '*** Iperf: testing ' + l4Type + ' bandwidth between ' )
|
||||
cliinfo( "%s and %s\n" % ( host0.name, host1.name ) )
|
||||
output( '*** Iperf: testing ' + l4Type + ' bandwidth between ' )
|
||||
output( "%s and %s\n" % ( host0.name, host1.name ) )
|
||||
host0.cmd( 'killall -9 iperf' )
|
||||
iperfArgs = 'iperf '
|
||||
bwArgs = ''
|
||||
@@ -476,7 +476,7 @@ class Mininet( object ):
|
||||
result = [ self._parseIperf( server ), self._parseIperf( client ) ]
|
||||
if l4Type == 'UDP':
|
||||
result.insert( 0, udpBw )
|
||||
cliinfo( '*** Results: %s\n' % result )
|
||||
output( '*** Results: %s\n' % result )
|
||||
return result
|
||||
|
||||
def iperfUdp( self, udpBw='10M' ):
|
||||
|
||||
Reference in New Issue
Block a user