From cdeaca8682255f2c5ed356ff1365d28aaebf8002 Mon Sep 17 00:00:00 2001
From: Brandon Heller <brandonh@stanford.edu>
Date: Fri, 5 Mar 2010 04:11:29 -0800
Subject: [PATCH] Rename cliinfo debug level to output

---
 bin/mn         |  4 ++--
 mininet/cli.py | 14 +++++++-------
 mininet/log.py | 18 +++++++++---------
 mininet/net.py | 18 +++++++++---------
 4 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/bin/mn b/bin/mn
index a6cf6abc..497a02f5 100755
--- a/bin/mn
+++ b/bin/mn
@@ -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
diff --git a/mininet/cli.py b/mininet/cli.py
index 133d4dce..4c901784 100644
--- a/mininet/cli.py
+++ b/mininet/cli.py
@@ -38,7 +38,7 @@
 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 @@ def do_help( self, args ):
     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 @@ def do_iperfudp( self, args ):
     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"
diff --git a/mininet/log.py b/mininet/log.py
index 46334bf5..c34631e7 100644
--- a/mininet/log.py
+++ b/mininet/log.py
@@ -8,11 +8,11 @@
 # 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 @@ def setLogLevel( self, levelname=None ):
     # 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 newfn( *args ):
     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 ]
diff --git a/mininet/net.py b/mininet/net.py
index 39720bbe..c3e79795 100755
--- a/mininet/net.py
+++ b/mininet/net.py
@@ -89,7 +89,7 @@
 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 @@ def ping( self, hosts=None ):
         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 @@ def ping( self, hosts=None ):
                         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 @@ def iperf( self, hosts=None, l4Type='TCP', udpBw='10M' ):
         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 @@ def iperf( self, hosts=None, l4Type='TCP', udpBw='10M' ):
         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' ):
-- 
GitLab