Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mininet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Olaf Bergmann
mininet
Commits
08cef003
Commit
08cef003
authored
15 years ago
by
Bob Lantz
Browse files
Options
Downloads
Patches
Plain Diff
Changed cleanup to vaporize zombie screen sessions.
Other minor cleanup.
parent
f4d9e05d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
README
+3
-3
3 additions, 3 deletions
README
cleanup
+2
-0
2 additions, 0 deletions
cleanup
examples/sshd.py
+5
-8
5 additions, 8 deletions
examples/sshd.py
examples/xterms.py
+2
-1
2 additions, 1 deletion
examples/xterms.py
mininet.py
+28
-22
28 additions, 22 deletions
mininet.py
with
40 additions
and
34 deletions
README
+
3
−
3
View file @
08cef003
...
...
@@ -31,8 +31,8 @@ In order to run Mininet, you must have:
* Root privileges (required for network device access)
* The netns program (included as netns.c), or an equivalent program
called
'netns'
, installed in an appropriate path location.
* The netns program (included as netns.c), or an equivalent program
of the same name
, installed in an appropriate 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
TreeNet, GridNet and LinearNet) for creating scalable topologies and
running experiments (
using someNetwork.run( t
est
) )
running experiments (
e.g. TreeNet(2,3).run(pingT
est) )
- Some simple tests which can be run using someNetwork.run( test )
...
...
This diff is collapsed.
Click to expand it.
cleanup
+
2
−
0
View file @
08cef003
...
...
@@ -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"
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
This diff is collapsed.
Click to expand it.
examples/sshd.py
+
5
−
8
View file @
08cef003
#!/usr/bin/python
"""
Create a network and start sshd(8) on the hosts.
This is probably overkill - rshd(8) would be
perfectly adequate, considering that the openflow
network is private to the machine it
'
s running on.
It would also be lighter weight/faster.
Nonetheless, most people already have sshd installed,
and it
'
s a good demo to show that mininet makes a
'
real
'
, usable network!
"""
While something like rshd(8) would be lighter and faster,
(and perfectly adequate on an in-machine network)
the advantage of running sshd is that scripts can work
unchanged on mininet and hardware.
"""
from
mininet
import
init
,
Node
,
createLink
,
TreeNet
,
Cli
...
...
@@ -16,7 +13,7 @@ def nets( hosts ):
nets
=
{}
for
host
in
hosts
:
net
=
host
.
IP
().
split
(
'
.
'
)[
:
-
1
]
net
=
'
.
'
.
join
(
net
)
+
'
.0/24
'
net
=
'
.
'
.
join
(
net
)
+
'
.0/24
'
nets
[
net
]
=
True
return
nets
.
keys
()
...
...
This diff is collapsed.
Click to expand it.
examples/xterms.py
+
2
−
1
View file @
08cef003
...
...
@@ -20,9 +20,10 @@ def makeXterm( node, title ):
return
Popen
(
cmd
)
def
cleanUpScreens
():
"
Remove moldy old screen sessions.
"
"
Remove moldy old screen sessions.
"
# XXX We need to implement this - otherwise those darned
# screen sessions will just accumulate
output
=
quietRun
(
'
screen -ls
'
)
pass
def
makeXterms
(
nodes
,
title
):
...
...
This diff is collapsed.
Click to expand it.
mininet.py
+
28
−
22
View file @
08cef003
...
...
@@ -3,14 +3,9 @@
"""
Mininet: A simple networking testbed for OpenFlow!
Mininet creates s
imp
le OpenFlow test networks by using
Mininet creates s
calab
le OpenFlow test networks by using
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
namespaces. This allows a complete OpenFlow network to be simulated on
top of a single Linux kernel.
...
...
@@ -23,6 +18,9 @@
Hosts have a network interface which is configured via ifconfig/ip
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
processes in the root namespace.
...
...
@@ -48,15 +46,15 @@
Thoughts/TBD:
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
is straightforward and concise.
Soon, we
'
ll
want to split the various subsystems (core,
is straightforward and
relatively
concise.
Soon, we
may
want to split the various subsystems (core,
cli, tests, etc.) into multiple modules.
We
may be able to ge
t
b
et
ter performance by using the kernel
datapath (using its multiple datapath feature on multiple
interfaces.) This would eliminate the ofdatapath user processes.
OpenVSwitch would still run at user level
.
We
don
'
t support nox nicely jus
t
y
et
- you have to hack this file
or subclass things aggressively.
We
'
d like to support OpenVSwitch as well as the reference
implementation
.
Bob Lantz
rlantz@cs.stanford.edu
...
...
@@ -65,6 +63,7 @@
11/19/09 Initial revision (user datapath only)
12/08/09 Kernel datapath support complete
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
...
...
@@ -289,7 +288,13 @@ def startKernelDatapath( self, controller):
def
stopKernelDatapath
(
self
):
"
Terminate a switch using OpenFlow reference kernel datapath.
"
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
()
def
start
(
self
,
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
)
):
self
.
kernel
,
self
.
startAddr
=
kernel
,
startAddr
# Check for kernel modules
tun
=
quietRun
(
[
'
sh
'
,
'
-c
'
,
'
lsmod | grep tun
'
]
)
ofdatapath
=
quietRun
(
[
'
sh
'
,
'
-c
'
,
'
lsmod | grep ofdatapath
'
]
)
if
tun
==
''
and
not
kernel
:
modules
=
quietRun
(
'
lsmod
'
)
if
not
kernel
and
'
tun
'
not
in
modules
:
print
"
*** Error: kernel module tun not loaded:
"
,
print
"
user datapath not supported
"
exit
(
1
)
if
ofdatapath
==
''
and
kernel
:
print
"
*** Error: ofdatapath not loaded:
"
,
if
kernel
and
'
ofdatapath
'
not
in
modules
:
print
"
*** Error:
kernel module
ofdatapath not loaded:
"
,
print
"
kernel datapath not supported
"
exit
(
1
)
# Create network, but don't start things up yet!
...
...
@@ -551,7 +555,9 @@ def makeNet( self, controller ):
# Grid 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
):
self
.
n
,
self
.
m
,
self
.
linear
=
n
,
m
,
linear
and
m
==
1
Network
.
__init__
(
self
,
kernel
)
...
...
@@ -711,7 +717,7 @@ def help( self, args ):
print
print
"
Interactive commands are not really supported yet,
"
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.
"
def
nodes
(
self
,
args
):
"
List available nodes
"
...
...
@@ -725,7 +731,7 @@ def net( self, args ):
for
switch
in
self
.
switches
:
print
switch
.
name
,
"
<->
"
,
for
intf
in
switch
.
intfs
:
node
,
r
i
ntf
=
switch
.
connection
[
intf
]
node
,
r
emoteI
ntf
=
switch
.
connection
[
intf
]
print
node
.
name
,
print
def
iperf
(
self
,
args
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment