Changed cleanup to vaporize zombie screen sessions.

Other minor cleanup.
This commit is contained in:
Bob Lantz
2009-12-11 06:17:42 -08:00
parent f4d9e05d05
commit 08cef003f7
5 changed files with 40 additions and 34 deletions
+3 -3
View File
@@ -31,8 +31,8 @@ In order to run Mininet, you must have:
* Root privileges (required for network device access) * Root privileges (required for network device access)
* The netns program (included as netns.c), or an equivalent program called * The netns program (included as netns.c), or an equivalent program
'netns', installed in an appropriate path location. of the same name, installed in an appropriate path location.
* mininet.py installed in an appropriate Python path location. * mininet.py installed in an appropriate Python path location.
@@ -43,7 +43,7 @@ Currently mininet includes:
- A simple network infrastructure (class Network and its descendants - A simple network infrastructure (class Network and its descendants
TreeNet, GridNet and LinearNet) for creating scalable topologies and TreeNet, GridNet and LinearNet) for creating scalable topologies and
running experiments (using someNetwork.run( test ) ) running experiments (e.g. TreeNet(2,3).run(pingTest) )
- Some simple tests which can be run using someNetwork.run( test ) - Some simple tests which can be run using someNetwork.run( test )
+2
View File
@@ -17,4 +17,6 @@ ps ax | egrep -o 'dp[0-9]+' | sed 's/dp/nl:/' | xargs -l1 echo dpctl deldp
echo "Removing vconn junk in /tmp" echo "Removing vconn junk in /tmp"
rm -f /tmp/vconn* /tmp/vlogs* /tmp/*.out /tmp/*.log rm -f /tmp/vconn* /tmp/vlogs* /tmp/*.out /tmp/*.log
echo "Removing old screen sessions"
screen -ls | egrep -o '[0-9]+\.[hsc][0-9]+' | sed 's/\.[hsc][0-9]*//g' | kill -9
+4 -7
View File
@@ -1,13 +1,10 @@
#!/usr/bin/python #!/usr/bin/python
"""Create a network and start sshd(8) on the hosts. """Create a network and start sshd(8) on the hosts.
This is probably overkill - rshd(8) would be While something like rshd(8) would be lighter and faster,
perfectly adequate, considering that the openflow (and perfectly adequate on an in-machine network)
network is private to the machine it's running on. the advantage of running sshd is that scripts can work
It would also be lighter weight/faster. unchanged on mininet and hardware."""
Nonetheless, most people already have sshd installed,
and it's a good demo to show that mininet makes a
'real', usable network! """
from mininet import init, Node, createLink, TreeNet, Cli from mininet import init, Node, createLink, TreeNet, Cli
+1
View File
@@ -23,6 +23,7 @@ def cleanUpScreens():
"Remove moldy old screen sessions." "Remove moldy old screen sessions."
# XXX We need to implement this - otherwise those darned # XXX We need to implement this - otherwise those darned
# screen sessions will just accumulate # screen sessions will just accumulate
output = quietRun( 'screen -ls' )
pass pass
def makeXterms( nodes, title ): def makeXterms( nodes, title ):
+27 -21
View File
@@ -3,14 +3,9 @@
""" """
Mininet: A simple networking testbed for OpenFlow! Mininet: A simple networking testbed for OpenFlow!
Mininet creates simple OpenFlow test networks by using Mininet creates scalable OpenFlow test networks by using
process-based virtualization and network namespaces. process-based virtualization and network namespaces.
This file supports use of either the kernel or user space datapath
from the OpenFlow reference implementation. Up to 32 switches are
supported using the kernel datapath, and 512 (or more) switches are
supported via the user datapath.
Simulated hosts are created as processes in separate network Simulated hosts are created as processes in separate network
namespaces. This allows a complete OpenFlow network to be simulated on namespaces. This allows a complete OpenFlow network to be simulated on
top of a single Linux kernel. top of a single Linux kernel.
@@ -23,6 +18,9 @@ Each host has:
Hosts have a network interface which is configured via ifconfig/ip Hosts have a network interface which is configured via ifconfig/ip
link/etc. with data network IP addresses (e.g. 192.168.123.2 ) link/etc. with data network IP addresses (e.g. 192.168.123.2 )
This version supports both the kernel or user space datapaths
from the OpenFlow reference implementation.
In kernel datapath mode, the controller and switches are simply In kernel datapath mode, the controller and switches are simply
processes in the root namespace. processes in the root namespace.
@@ -50,13 +48,13 @@ Thoughts/TBD:
It should be straightforward to add a function to read It should be straightforward to add a function to read
OpenFlowVMS spec files, but I haven't done so yet. OpenFlowVMS spec files, but I haven't done so yet.
For the moment, specifying configurations and tests in Python For the moment, specifying configurations and tests in Python
is straightforward and concise. is straightforward and relatively concise.
Soon, we'll want to split the various subsystems (core, Soon, we may want to split the various subsystems (core,
cli, tests, etc.) into multiple modules. cli, tests, etc.) into multiple modules.
We may be able to get better performance by using the kernel We don't support nox nicely just yet - you have to hack this file
datapath (using its multiple datapath feature on multiple or subclass things aggressively.
interfaces.) This would eliminate the ofdatapath user processes. We'd like to support OpenVSwitch as well as the reference
OpenVSwitch would still run at user level. implementation.
Bob Lantz Bob Lantz
rlantz@cs.stanford.edu rlantz@cs.stanford.edu
@@ -65,6 +63,7 @@ History:
11/19/09 Initial revision (user datapath only) 11/19/09 Initial revision (user datapath only)
12/08/09 Kernel datapath support complete 12/08/09 Kernel datapath support complete
12/09/09 Moved controller and switch routines into classes 12/09/09 Moved controller and switch routines into classes
12/12/09 Added subdivided network driver workflow
""" """
from subprocess import call, check_call, Popen, PIPE, STDOUT from subprocess import call, check_call, Popen, PIPE, STDOUT
@@ -289,7 +288,13 @@ class Switch( Node ):
def stopKernelDatapath( self ): def stopKernelDatapath( self ):
"Terminate a switch using OpenFlow reference kernel datapath." "Terminate a switch using OpenFlow reference kernel datapath."
quietRun( 'dpctl deldp ' + self.dp ) quietRun( 'dpctl deldp ' + self.dp )
for intf in self.intfs: quietRun( 'ip link del ' + intf ) # In theory the interfaces should go away after we shut down.
# However, this takes time, so we're better off to remove them
# explicitly so that we won't get errors if we run before they
# have been removed by the kernel. Unfortunately this is very slow.
for intf in self.intfs:
quietRun( 'ip link del ' + intf )
sys.stdout.write( '.' ) ; flush()
self.terminate() self.terminate()
def start( self, controller ): def start( self, controller ):
if self.dp is None: self.startUserDatapath( controller ) if self.dp is None: self.startUserDatapath( controller )
@@ -435,14 +440,13 @@ class Network( object ):
def __init__( self, kernel=True, startAddr=( 192, 168, 123, 1) ): def __init__( self, kernel=True, startAddr=( 192, 168, 123, 1) ):
self.kernel, self.startAddr = kernel, startAddr self.kernel, self.startAddr = kernel, startAddr
# Check for kernel modules # Check for kernel modules
tun = quietRun( [ 'sh', '-c', 'lsmod | grep tun' ] ) modules = quietRun( 'lsmod' )
ofdatapath = quietRun( [ 'sh', '-c', 'lsmod | grep ofdatapath' ] ) if not kernel and 'tun' not in modules:
if tun == '' and not kernel:
print "*** Error: kernel module tun not loaded:", print "*** Error: kernel module tun not loaded:",
print " user datapath not supported" print " user datapath not supported"
exit( 1 ) exit( 1 )
if ofdatapath == '' and kernel: if kernel and 'ofdatapath' not in modules:
print "*** Error: ofdatapath not loaded:", print "*** Error: kernel module ofdatapath not loaded:",
print " kernel datapath not supported" print " kernel datapath not supported"
exit( 1 ) exit( 1 )
# Create network, but don't start things up yet! # Create network, but don't start things up yet!
@@ -551,7 +555,9 @@ class TreeNet( Network ):
# Grid network # Grid network
class GridNet( Network ): class GridNet( Network ):
"An N x M grid/mesh network of switches, with hosts at the edges." """An N x M grid/mesh network of switches, with hosts at the edges.
This class also demonstrates creating a somewhat complicated
topology."""
def __init__( self, n, m, kernel=True, linear=False ): def __init__( self, n, m, kernel=True, linear=False ):
self.n, self.m, self.linear = n, m, linear and m == 1 self.n, self.m, self.linear = n, m, linear and m == 1
Network.__init__( self, kernel ) Network.__init__( self, kernel )
@@ -711,7 +717,7 @@ class Cli( object ):
print print
print "Interactive commands are not really supported yet," print "Interactive commands are not really supported yet,"
print "so please limit commands to ones that do not" print "so please limit commands to ones that do not"
print "require user interaction, and that will terminate" print "require user interaction and will terminate"
print "after a reasonable amount of time." print "after a reasonable amount of time."
def nodes( self, args ): def nodes( self, args ):
"List available nodes" "List available nodes"
@@ -725,7 +731,7 @@ class Cli( object ):
for switch in self.switches: for switch in self.switches:
print switch.name, "<->", print switch.name, "<->",
for intf in switch.intfs: for intf in switch.intfs:
node, rintf = switch.connection[ intf ] node, remoteIntf = switch.connection[ intf ]
print node.name, print node.name,
print print
def iperf( self, args ): def iperf( self, args ):