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
f7c2df25
Commit
f7c2df25
authored
15 years ago
by
Brandon Heller
Browse files
Options
Downloads
Patches
Plain Diff
Support OpenVSwitch in kernel-mode
parent
723d068c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bin/mn_run.py
+3
-2
3 additions, 2 deletions
bin/mn_run.py
mininet/net.py
+2
-2
2 additions, 2 deletions
mininet/net.py
mininet/node.py
+56
-3
56 additions, 3 deletions
mininet/node.py
with
61 additions
and
7 deletions
bin/mn_run.py
+
3
−
2
View file @
f7c2df25
...
...
@@ -16,7 +16,7 @@
from
mininet.logging_mod
import
lg
,
LEVELS
from
mininet.net
import
Mininet
,
init
from
mininet.node
import
KernelSwitch
,
Host
,
Controller
,
ControllerParams
,
NOX
from
mininet.node
import
RemoteController
,
UserSwitch
from
mininet.node
import
RemoteController
,
UserSwitch
,
OVSKernelSwitch
from
mininet.topo
import
SingleSwitchTopo
,
LinearTopo
,
SingleSwitchReversedTopo
# built in topologies, created only when run
...
...
@@ -39,7 +39,8 @@
SWITCH_DEF
=
'
kernel
'
SWITCHES
=
{
'
kernel
'
:
KernelSwitch
,
'
user
'
:
UserSwitch
}
'
user
'
:
UserSwitch
,
'
ovsk
'
:
OVSKernelSwitch
}
HOST_DEF
=
'
process
'
HOSTS
=
{
'
process
'
:
Host
}
...
...
This diff is collapsed.
Click to expand it.
mininet/net.py
+
2
−
2
View file @
f7c2df25
...
...
@@ -53,7 +53,7 @@
from
time
import
sleep
from
mininet.logging_mod
import
lg
from
mininet.node
import
KernelSwitch
from
mininet.node
import
KernelSwitch
,
OVSKernelSwitch
from
mininet.util
import
quietRun
,
fixLimits
from
mininet.util
import
make_veth_pair
,
move_intf
,
retry
,
MOVEINTF_DELAY
from
mininet.xterm
import
cleanUpScreens
,
makeXterms
...
...
@@ -135,7 +135,7 @@ def _add_switch(self, dpid):
sw_dpid
=
None
if
self
.
auto_set_macs
:
sw_dpid
=
dpid
if
self
.
switch
is
KernelSwitch
:
if
self
.
switch
is
KernelSwitch
or
self
.
switch
is
OVSKernelSwitch
:
sw
=
self
.
switch
(
'
s_
'
+
self
.
topo
.
name
(
dpid
),
dp
=
self
.
dps
,
dpid
=
sw_dpid
)
self
.
dps
+=
1
...
...
This diff is collapsed.
Click to expand it.
mininet/node.py
+
56
−
3
View file @
f7c2df25
...
...
@@ -306,8 +306,6 @@ def stop(self):
class
KernelSwitch
(
Switch
):
'''
Kernel-space switch.
Much faster than user-space!
Currently only works in the root namespace.
'''
...
...
@@ -348,7 +346,7 @@ def start(self, controllers):
self
.
execed
=
False
def
stop
(
self
):
'''
Terminate
reference
kernel datapath.
'''
'''
Terminate kernel datapath.
'''
quietRun
(
'
dpctl deldp nl:%i
'
%
self
.
dp
)
# In theory the interfaces should go away after we shut down.
# However, this takes time, so we're better off to remove them
...
...
@@ -360,6 +358,61 @@ def stop(self):
lg
.
info
(
'
.
'
)
class
OVSKernelSwitch
(
Switch
):
'''
Open VSwitch kernel-space switch.
Currently only works in the root namespace.
'''
def
__init__
(
self
,
name
,
dp
=
None
,
dpid
=
None
):
'''
Init.
@param name
@param dp netlink id (0, 1, 2, ...)
@param dpid datapath ID as unsigned int; random value if None
'''
Switch
.
__init__
(
self
,
name
,
inNamespace
=
False
)
self
.
dp
=
dp
self
.
dpid
=
dpid
def
start
(
self
,
controllers
):
'''
Start up kernel datapath.
'''
ofplog
=
'
/tmp/
'
+
self
.
name
+
'
-ofp.log
'
quietRun
(
'
ifconfig lo up
'
)
# Delete local datapath if it exists;
# then create a new one monitoring the given interfaces
quietRun
(
'
ovs-dpctl del-dp dp%i
'
%
self
.
dp
)
self
.
cmdPrint
(
'
ovs-dpctl add-dp dp%i
'
%
self
.
dp
)
if
self
.
dpid
:
intf
=
'
dp
'
%
self
.
dp
mac_str
=
macColonHex
(
self
.
dpid
)
self
.
cmd
([
'
ifconfig
'
,
intf
,
'
hw
'
,
'
ether
'
,
mac_str
])
if
len
(
self
.
ports
)
!=
max
(
self
.
ports
.
keys
())
+
1
:
raise
Exception
(
'
only contiguous, zero-indexed port ranges
'
'
supported: %s
'
%
self
.
ports
)
intfs
=
[
self
.
ports
[
port
]
for
port
in
self
.
ports
.
keys
()]
self
.
cmdPrint
(
'
ovs-dpctl add-if dp
'
+
str
(
self
.
dp
)
+
'
'
+
'
'
.
join
(
intfs
))
# Run protocol daemon
self
.
cmdPrint
(
'
ovs-openflowd dp
'
+
str
(
self
.
dp
)
+
'
tcp:
'
+
controllers
[
'
c0
'
].
IP
()
+
'
:
'
+
'
--fail=closed 1>
'
+
ofplog
+
'
2>
'
+
ofplog
+
'
&
'
)
self
.
execed
=
False
def
stop
(
self
):
'''
Terminate kernel datapath.
'''
quietRun
(
'
ovs-dpctl del-dp dp%i
'
%
self
.
dp
)
# 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.
self
.
cmd
(
'
kill %ovs-openflowd
'
)
for
intf
in
self
.
intfs
:
quietRun
(
'
ip link del
'
+
intf
)
lg
.
info
(
'
.
'
)
class
Controller
(
Node
):
'''
A Controller is a Node that is running (or has execed) an
OpenFlow controller.
'''
...
...
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