Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
432fba2
Beginning crack at user OVS. However, packets aren't forwarded; annoy…
lantz Oct 28, 2010
902c431
Working on getting user mode OVS.
lantz Nov 15, 2010
89a3807
Remove debug printing for startintfs.
lantz Nov 23, 2010
b5590cf
Cleaned up OVS user sitch and made moduledeps more verbose.
lantz Nov 23, 2010
c9c3fca
Added support for OVS controller.
lantz Nov 24, 2010
6a4c149
Added code to delete stale OVS datapaths.
lantz Nov 24, 2010
e36bd46
Include mnexec.c in the Python sdist package, and compile mnexec
Mar 15, 2011
d7134dd
Add a parameter to waitOutput that allows searching for a specific pa…
May 13, 2011
d2f1e0e
Host mobility support for attaching/detaching hosts from switches.
May 17, 2011
14c462b
Run commands with sudo so mininet can be directly imported by
May 19, 2011
ff3810d
Spawn shell subprocesses in a pseudo-tty, to insulate it from signals
Jun 9, 2011
7204e4f
Look for \r\n rather than just \n, now that shell subprocesses are
Jun 22, 2011
65da848
Integrate RemoteSwitch class into mininet; add explicit dpid field to
Jul 18, 2011
cce1a6e
Kill stale user-mode switch processes on initialization
Sep 6, 2011
8bd9d8a
Switch to Open vSwitch 1.1.1 for stability.
lantz Jun 28, 2011
b04cf31
Git clone oflops from openflow.org rather than www.openflow.org
lantz Jun 30, 2011
6eeb0e7
Add option to install cbench aka oflops
lantz Jun 30, 2011
3e18365
Workaround in oflops build for possible autoreconf bug.
lantz Jun 30, 2011
8a26b43
Upgrade networkx on Ubuntu 10.04 LTS to avoid deprecation warning.
lantz Jun 30, 2011
42539e8
Avoid printing out grep results.
lantz Jun 30, 2011
6cd4a62
Revert inadvertent print in node.py
lantz Jun 30, 2011
83ab4ca
Have install.sh apply controller patch for > 16 switches
lantz Jun 30, 2011
eaf10f5
Minor text updates in preparation for ONS release.
lantz Oct 13, 2011
83f42e9
Mininet Pre-Beta -> Mininet 1.0.0; (c) 2009-2011
lantz Oct 14, 2011
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Preliminary Mininet Installation/Configuration Notes
Mininet Installation/Configuration Notes

Mininet 1.0rc0
Mininet 1.0.0

---

Expand All @@ -20,20 +20,22 @@ Boot up the VM image, log in, and follow the instructions on the wiki page.
An additional advantage of using the VM image is that it doesn't mess with
your native OS installation or damage it in any way.

2. Native installation (experimental!) for Ubuntu and Debian 5
2. Native installation (experimental!) for Ubuntu 10.04 LTS

If you are running Ubuntu or Debian 5, you may be able to use our handy
install.sh script, which is in mininet/util.
If you are running Ubuntu 10.04 LTS (or possibly Debian 5), you may be
able to use our handy install.sh script, which is in mininet/util.

WARNING: USE AT YOUR OWN RISK!

install.sh is a bit intrusive and may possibly damage your OS
and/or home directory. Although we hope it won't do anything completely
terrible, you may want to look at the script before you run it, and you
should make sure your system and home directory are backed up just in case!
install.sh is a bit intrusive and may possibly damage your OS and/or
home directory, by creating/modifying several directories such as
mininet, openflow, openvswitch and noxcore. Although we hope it won't
do anything completely terrible, you may want to look at the script
before you run it, and you should make sure your system and home
directory are backed up just in case!

To install ALL of the software which we use for OpenFlow tutorials, you may
use
To install ALL of the software which we use for OpenFlow tutorials,
you may use

$ mininet/util/install.sh

Expand All @@ -43,9 +45,9 @@ Alternately, you can install just the pieces you need.

We recommend the following steps, in order:

a) On Debian 5, first install a Mininet-compatible kernel:
[a) On Debian 5, first install a Mininet-compatible kernel:
$ mininet/util/install.sh -k
Reboot and run 'uname -r' to make sure you're running the new kernel.
Reboot and run 'uname -r' to make sure you're running the new kernel.]

b) Install mininet and its dependencies:
$ mininet/util/install.sh -n
Expand All @@ -59,6 +61,10 @@ d) Install Open vSwitch and its kernel module
e) If you wish to install the version of NOX we use in the tutorial:
$ mininet/util/install.sh -x

Note: NOX development is progressing over time, so after you complete
the tutorial you may wish to install the latest and greatest NOX from
noxrepo.org.

Good luck! Some additional installation notes are provided below, for
the brave and/or Linux-savvy, or those who are trying to understand what
is installed and why.
Expand Down
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Mininet Pre-Beta License
Mininet 1.0.0 License

Copyright (c) 2009-2010 Bob Lantz and Brandon Heller
Copyright (c) 2009-2011 Bob Lantz and Brandon Heller

We are making Mininet available for public use and benefit with the
expectation that others will use, modify and enhance the Software and
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include mnexec.c
exclude bin/mnexec
9 changes: 5 additions & 4 deletions README
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

Mininet: A Simple Virtual Testbed for OpenFlow
Mininet: A Simple Virtual Testbed for OpenFlow/SDN
or
How to Squeeze a 1024-node OpenFlow Network onto your Laptop

Mininet 1.0rc0
Mininet 1.0.0

---
Welcome to Mininet!
Expand Down Expand Up @@ -74,9 +74,10 @@ Batteries are not included (yet!)
However, some preliminary installation notes are included in the INSTALL
file.

Additionally, much useful information is available on the Mininet wiki:
Additionally, much useful information, including a Mininet tutorial,
is available on the Mininet wiki:

http://www.openflowswitch.org/foswiki/bin/view/OpenFlow/Mininet
http://openflow.org/mininet

Enjoy, and good luck!

Expand Down
5 changes: 4 additions & 1 deletion bin/mn
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ from mininet.log import lg, LEVELS, info
from mininet.net import Mininet, init
from mininet.node import KernelSwitch, Host, Controller, ControllerParams, NOX
from mininet.node import RemoteController, UserSwitch, OVSKernelSwitch
from mininet.node import OVSUserSwitch
from mininet.topo import SingleSwitchTopo, LinearTopo, SingleSwitchReversedTopo
from mininet.topolib import TreeTopo
from mininet.util import makeNumeric
Expand All @@ -37,14 +38,16 @@ TOPOS = { 'minimal': lambda: SingleSwitchTopo( k=2 ),
SWITCHDEF = 'ovsk'
SWITCHES = { 'kernel': KernelSwitch,
'user': UserSwitch,
'ovsk': OVSKernelSwitch }
'ovsk': OVSKernelSwitch,
'ovsu': OVSUserSwitch }

HOSTDEF = 'process'
HOSTS = { 'process': Host }

CONTROLLERDEF = 'ref'
# a and b are the name and inNamespace params.
CONTROLLERS = { 'ref': Controller,
'ovs': lambda name: Controller( name, command='ovs-controller' ),
'nox_dump': lambda name: NOX( name, 'packetdump' ),
'nox_pysw': lambda name: NOX( name, 'pyswitch' ),
'remote': lambda name: None,
Expand Down
11 changes: 8 additions & 3 deletions mininet/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ def cleanup():
"""Clean up junk which might be left over from old runs;
do fast stuff before slow dp and link removal!"""

info("*** Removing excess controllers/ofprotocols/ofdatapaths/pings/noxes"
info("*** Removing excess controllers/switches/pings/noxes"
"\n")
zombies = 'controller ofprotocol ofdatapath ping nox_core lt-nox_core '
zombies += 'ovs-openflowd udpbwtest'
zombies += 'ovs-openflowd udpbwtest ovs-openflowd ovs-controller'
# Note: real zombie processes can't actually be killed, since they
# are already (un)dead. Then again,
# you can't connect to them either, so they're mostly harmless.
Expand All @@ -42,9 +42,14 @@ def cleanup():
info( "*** Removing excess kernel datapaths\n" )
dps = sh( "ps ax | egrep -o 'dp[0-9]+' | sed 's/dp/nl:/'" ).split( '\n' )
for dp in dps:
if dp != '':
if dp:
sh( 'dpctl deldp ' + dp )

ovsdps = sh( "ovs-dpctl show | egrep '\w+@\w+:'" ).split( '\n' )
for dp in dps:
if dp:
sh( 'ovs-dpctl del-dp ' + dp )

info( "*** Removing all links of the pattern foo-ethX\n" )
links = sh( "ip link show | egrep -o '(\w+-eth\w+)'" ).split( '\n' )
for link in links:
Expand Down
34 changes: 27 additions & 7 deletions mininet/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,22 @@ def do_link( self, line ):
else:
self.mn.configLinkStatus( *args )

def do_attach( self, line ):
"Create new link between a host and a switch"
args = line.split()
if len(args) != 2:
error( 'invalid number of args: attach host switch\n' )
else:
self.mn.attachHost(*args)

def do_detach( self, line ):
"Detach a host from a switch"
args = line.split()
if len(args) < 1 or len(args) > 2:
error( 'invalid number of args: detach host [switch]\n' )
else:
self.mn.detachHost(*args)

def do_xterm( self, line, term='xterm' ):
"Spawn xterm(s) for the given node(s)."
args = line.split()
Expand Down Expand Up @@ -300,9 +316,17 @@ def default( self, line ):
if first in self.nodemap:
node = self.nodemap[ first ]
# Substitute IP addresses for node names in command
rest = [ self.nodemap[ arg ].IP()
if arg in self.nodemap else arg
for arg in rest ]
for index in range(len(rest)):
arg = rest[index]
if arg in self.nodemap:
ip = self.nodemap[arg].IP()
if not ip:
error('%s is an unreachable, detached host\n' % arg)
return
rest[index] = ip
#rest = [ self.nodemap[ arg ].IP()
# if arg in self.nodemap else arg
# for arg in rest ]
rest = ' '.join( rest )
# Run cmd on node:
builtin = isShellBuiltin( first )
Expand All @@ -321,10 +345,6 @@ def waitForNode( self, node ):
bothPoller = poll()
bothPoller.register( self.stdin )
bothPoller.register( node.stdout )
if self.isatty():
# Buffer by character, so that interactive
# commands sort of work
quietRun( 'stty -icanon min 1' )
while True:
try:
bothPoller.poll()
Expand Down
9 changes: 5 additions & 4 deletions mininet/moduledeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def modprobe( mod ):
OVS_KMOD = 'openvswitch_mod'
TUN = 'tun'

def moduleDeps( subtract=None, add=None ):
def moduleDeps( subtract=None, add=None, moduleName='it' ):
"""Handle module dependencies.
subtract: string or list of module names to remove, if already loaded
add: string or list of module names to add, if not already loaded"""
Expand All @@ -47,9 +47,10 @@ def moduleDeps( subtract=None, add=None ):
info( '*** Loading ' + mod + '\n' )
modprobeOutput = modprobe( mod )
if modprobeOutput:
error( 'Error inserting ' + mod +
' - is it installed and available via modprobe?\n' +
'Error was: "%s"\n' % modprobeOutput )
error( 'Error inserting ' + mod + '\n'
'Is %s installed and available via modprobe?\n' %
moduleName +
'Error was: "%s"\n' % modprobeOutput.strip() )
if mod not in lsmod():
error( 'Failed to insert ' + mod + ' - quitting.\n' )
exit( 1 )
Expand Down
85 changes: 77 additions & 8 deletions mininet/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@

from mininet.cli import CLI
from mininet.log import info, error, debug, output
from mininet.node import Host, UserSwitch, OVSKernelSwitch, Controller
from mininet.node import ControllerParams
from mininet.node import Host, Switch, UserSwitch, OVSKernelSwitch, RemoteSwitch
from mininet.node import Controller, ControllerParams
from mininet.util import quietRun, fixLimits
from mininet.util import createLink, macColonHex, ipStr, ipParse
from mininet.term import cleanUpScreens, makeTerms
Expand Down Expand Up @@ -181,6 +181,16 @@ def addSwitch( self, name, mac=None, ip=None ):
self.nameToNode[ name ] = sw
return sw

def addRemoteSwitch( self, name, remotePorts, dpid=None ):
"""Add a RemoteSwitch.
name: name of switch to add
remotePorts: kernel interface name for each switch port
returns: added switch"""
sw = RemoteSwitch( name, dpid=dpid, remotePorts=remotePorts )
self.switches.append( sw )
self.nameToNode[ name ] = sw
return sw

def addController( self, name='c0', controller=None, **kwargs ):
"""Add controller.
controller: Controller class"""
Expand Down Expand Up @@ -546,6 +556,70 @@ def configLinkStatus( self, src, dst, status ):
if result:
error( 'link dst status change failed: %s\n' % result )

def attachHost( self, hostName, switchName ):
if hostName not in self.nameToNode:
error( 'host not in network: %s\n' % hostName )
return

if switchName not in self.nameToNode:
error( 'switch not in network: %s\n' % switchName )
return

host = self.nameToNode[hostName]
if not isinstance(host, Host):
error('%s is not a host' % hostName)
return

sw = self.nameToNode[switchName]
if not isinstance(sw, Switch):
error('%s is not a switch' % switchName)
return

if not isinstance(sw, OVSKernelSwitch):
error('attachHost only works with OVS kernel switches')
return

hostIntf, swIntf = host.linkTo(sw)

host.setIP( hostIntf, host.defaultIP, self.cparams.prefixLen )
host.setDefaultRoute( hostIntf )
if self.autoSetMacs:
host.setMAC( hostIntf, host.defaultMAC )
#if self.autoStaticArp:
# for h in self.hosts:
# if h != host:
# host.setARP( ip=h.IP(), mac=h.MAC() )
# h.setARP( ip=host.IP(), mac=host.MAC() )


def detachHost( self, hostName, switchName=None ):
if hostName not in self.nameToNode:
error( 'host not in network: %s\n' % hostName )
return

host = self.nameToNode[hostName]
if not isinstance(host, Host):
error('%s is not a host' % hostName)
return

if switchName:
if switchName not in self.nameToNode:
error( 'switch not in network: %s\n' % switchName )
return

sw = self.nameToNode[switchName]
if not isinstance(sw, Switch):
error('%s is not a switch' % switchName)
return

if not isinstance(sw, OVSKernelSwitch):
error('attachHost only works with OVS kernel switches')
return
else:
sw = None

host.unlinkFrom(sw)

def interact( self ):
"Start network and run our simple CLI."
self.start()
Expand All @@ -561,16 +635,11 @@ def init():
"Initialize Mininet."
if init.inited:
return
if os.getuid() != 0:
# Note: this script must be run as root
# Perhaps we should do so automatically!
print "*** Mininet must run as root."
exit( 1 )
# If which produces no output, then mnexec is not in the path.
# May want to loosen this to handle mnexec in the current dir.
if not quietRun( 'which mnexec' ):
raise Exception( "Could not find mnexec - check $PATH" )
fixLimits()
#fixLimits()
init.inited = True

init.inited = False
Expand Down
Loading