From 28c2cdc2c438f308bbd1b2f3f2cc5c9d89b49f11 Mon Sep 17 00:00:00 2001 From: Bob Lantz Date: Fri, 6 Jul 2012 23:30:14 -0700 Subject: [PATCH] Workaround for openvswitch_mod rename and pass code check. --- bin/mn | 4 ++-- mininet/moduledeps.py | 2 +- mininet/node.py | 8 +++++--- mininet/util.py | 4 +--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/mn b/bin/mn index a8b12cd..77f65b8 100755 --- a/bin/mn +++ b/bin/mn @@ -18,7 +18,7 @@ import time from mininet.clean import cleanup from mininet.cli import CLI -from mininet.log import lg, LEVELS, info, warn +from mininet.log import lg, LEVELS, info from mininet.net import Mininet, MininetWithControlNet, VERSION from mininet.node import ( Host, CPULimitedHost, Controller, OVSController, NOX, RemoteController, UserSwitch, OVSKernelSwitch, @@ -26,7 +26,7 @@ from mininet.node import ( Host, CPULimitedHost, Controller, OVSController, from mininet.link import Link, TCLink from mininet.topo import SingleSwitchTopo, LinearTopo, SingleSwitchReversedTopo from mininet.topolib import TreeTopo -from mininet.util import makeNumeric, custom, customConstructor, splitArgs +from mininet.util import custom, customConstructor from mininet.util import buildTopo diff --git a/mininet/moduledeps.py b/mininet/moduledeps.py index 15b575d..584d6c7 100644 --- a/mininet/moduledeps.py +++ b/mininet/moduledeps.py @@ -19,7 +19,7 @@ def modprobe( mod ): return quietRun( [ 'modprobe', mod ] ) OF_KMOD = 'ofdatapath' -OVS_KMOD = 'openvswitch_mod' +OVS_KMOD = 'openvswitch_mod' # Renamed 'openvswitch' in OVS 1.7+/Linux 3.5+ TUN = 'tun' def moduleDeps( subtract=None, add=None ): diff --git a/mininet/node.py b/mininet/node.py index 8e4786d..4ed4c92 100644 --- a/mininet/node.py +++ b/mininet/node.py @@ -896,7 +896,9 @@ class OVSSwitch( Switch ): "Make sure Open vSwitch is installed and working" pathCheck( 'ovs-vsctl', moduleName='Open vSwitch (openvswitch.org)') - moduleDeps( subtract=OF_KMOD, add=OVS_KMOD ) + # This should no longer be needed, and it breaks + # with OVS 1.7 which has renamed the kernel module: + # moduleDeps( subtract=OF_KMOD, add=OVS_KMOD ) out, err, exitcode = errRun( 'ovs-vsctl -t 1 show' ) if exitcode: error( out + err + @@ -985,10 +987,10 @@ class Controller( Node ): if 'Unable' not in listening: servers = self.cmd( 'netstat -atp' ).split( '\n' ) pstr = ':%d ' % self.port - info = servers[ 0:1 ] + [ s for s in servers if pstr in s ] + clist = servers[ 0:1 ] + [ s for s in servers if pstr in s ] raise Exception( "Please shut down the controller which is" " running on port %d:\n" % self.port + - '\n'.join( info ) ) + '\n'.join( clist ) ) def start( self ): """Start on controller. diff --git a/mininet/util.py b/mininet/util.py index 19cb552..bb645fe 100644 --- a/mininet/util.py +++ b/mininet/util.py @@ -1,6 +1,6 @@ "Utility functions for Mininet." -from mininet.log import output, info, error +from mininet.log import output, info, error, warn from time import sleep from resource import setrlimit, RLIMIT_NPROC, RLIMIT_NOFILE @@ -419,7 +419,6 @@ def splitArgs( argstr ): def customConstructor( constructors, argStr ): """Return custom constructor based on argStr - The args and key/val pairs in argsStr will be automatically applied when the generated constructor is later used. """ @@ -444,7 +443,6 @@ def customConstructor( constructors, argStr ): def buildTopo( topos, topoStr ): """Create topology from string with format (object, arg1, arg2,...). - input topos is a dict of topo names to constructors, possibly w/args. """ topo, args, kwargs = splitArgs( topoStr )