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
e8623fdc
Commit
e8623fdc
authored
10 years ago
by
Tomasz Buchert
Browse files
Options
Downloads
Patches
Plain Diff
introducing OVSBridge
parent
a56d9a66
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/mn
+2
-1
2 additions, 1 deletion
bin/mn
mininet/node.py
+48
-18
48 additions, 18 deletions
mininet/node.py
with
50 additions
and
19 deletions
bin/mn
+
2
−
1
View file @
e8623fdc
...
@@ -26,7 +26,7 @@ from mininet.log import lg, LEVELS, info, debug, error
...
@@ -26,7 +26,7 @@ from mininet.log import lg, LEVELS, info, debug, error
from
mininet.net
import
Mininet
,
MininetWithControlNet
,
VERSION
from
mininet.net
import
Mininet
,
MininetWithControlNet
,
VERSION
from
mininet.node
import
(
Host
,
CPULimitedHost
,
Controller
,
OVSController
,
from
mininet.node
import
(
Host
,
CPULimitedHost
,
Controller
,
OVSController
,
NOX
,
RemoteController
,
DefaultController
,
NOX
,
RemoteController
,
DefaultController
,
UserSwitch
,
OVSSwitch
,
UserSwitch
,
OVSBridge
,
OVSSwitch
,
OVSLegacyKernelSwitch
,
IVSSwitch
)
OVSLegacyKernelSwitch
,
IVSSwitch
)
from
mininet.nodelib
import
LinuxBridge
from
mininet.nodelib
import
LinuxBridge
from
mininet.link
import
Link
,
TCLink
from
mininet.link
import
Link
,
TCLink
...
@@ -48,6 +48,7 @@ TOPOS = { 'minimal': lambda: SingleSwitchTopo( k=2 ),
...
@@ -48,6 +48,7 @@ TOPOS = { 'minimal': lambda: SingleSwitchTopo( k=2 ),
SWITCHDEF
=
'
ovsk
'
SWITCHDEF
=
'
ovsk
'
SWITCHES
=
{
'
user
'
:
UserSwitch
,
SWITCHES
=
{
'
user
'
:
UserSwitch
,
'
ovs
'
:
OVSSwitch
,
'
ovs
'
:
OVSSwitch
,
'
ovsb
'
:
OVSBridge
,
# Keep ovsk for compatibility with 2.0
# Keep ovsk for compatibility with 2.0
'
ovsk
'
:
OVSSwitch
,
'
ovsk
'
:
OVSSwitch
,
'
ovsl
'
:
OVSLegacyKernelSwitch
,
'
ovsl
'
:
OVSLegacyKernelSwitch
,
...
...
This diff is collapsed.
Click to expand it.
mininet/node.py
+
48
−
18
View file @
e8623fdc
...
@@ -996,20 +996,8 @@ def stop( self ):
...
@@ -996,20 +996,8 @@ def stop( self ):
self
.
deleteIntfs
()
self
.
deleteIntfs
()
class
OVSSwitch
(
Switch
):
class
OVSSwitchBase
(
Switch
):
"
Open vSwitch switch. Depends on ovs-vsctl.
"
'
a base class for OVS switches; does not contain OpenFlow code at all
'
def
__init__
(
self
,
name
,
failMode
=
'
secure
'
,
datapath
=
'
kernel
'
,
inband
=
False
,
**
params
):
"""
Init.
name: name for switch
failMode: controller loss behavior (secure|open)
datapath: userspace or kernel mode (kernel|user)
inband: use in-band control (False)
"""
Switch
.
__init__
(
self
,
name
,
**
params
)
self
.
failMode
=
failMode
self
.
datapath
=
datapath
self
.
inband
=
inband
@classmethod
@classmethod
def
setup
(
cls
):
def
setup
(
cls
):
...
@@ -1045,10 +1033,6 @@ def batchShutdown( cls, switches ):
...
@@ -1045,10 +1033,6 @@ def batchShutdown( cls, switches ):
'
--
'
.
join
(
'
--if-exists del-br %s
'
%
s
'
--
'
.
join
(
'
--if-exists del-br %s
'
%
s
for
s
in
switches
)
)
for
s
in
switches
)
)
def
dpctl
(
self
,
*
args
):
"
Run ovs-ofctl command
"
return
self
.
cmd
(
'
ovs-ofctl
'
,
args
[
0
],
self
,
*
args
[
1
:
]
)
@staticmethod
@staticmethod
def
TCReapply
(
intf
):
def
TCReapply
(
intf
):
"""
Unfortunately OVS and Mininet are fighting
"""
Unfortunately OVS and Mininet are fighting
...
@@ -1067,6 +1051,52 @@ def detach( self, intf ):
...
@@ -1067,6 +1051,52 @@ def detach( self, intf ):
"
Disconnect a data port
"
"
Disconnect a data port
"
self
.
cmd
(
'
ovs-vsctl del-port
'
,
self
,
intf
)
self
.
cmd
(
'
ovs-vsctl del-port
'
,
self
,
intf
)
class
OVSBridge
(
OVSSwitchBase
):
"
OpenVSwitch Bridge (similar to OVSSwitch, but no OpenFlow)
"
def
__init__
(
self
,
name
,
**
kwargs
):
OVSSwitchBase
.
__init__
(
self
,
name
,
**
kwargs
)
def
connected
(
self
):
return
True
def
start
(
self
,
controllers
):
if
self
.
inNamespace
:
raise
Exception
(
'
OVS kernel switch does not work in a namespace
'
)
self
.
cmd
(
'
ovs-vsctl del-br
'
,
self
)
intfs
=
'
'
.
join
(
'
-- add-port %s %s
'
%
(
self
,
intf
)
for
intf
in
self
.
intfList
()
if
not
intf
.
IP
()
)
cmd
=
(
'
ovs-vsctl add-br %s
'
%
self
+
intfs
)
self
.
cmd
(
cmd
)
for
intf
in
self
.
intfList
():
self
.
TCReapply
(
intf
)
def
stop
(
self
):
self
.
cmd
(
'
ovs-vsctl del-br
'
,
self
)
self
.
deleteIntfs
()
class
OVSSwitch
(
OVSSwitchBase
):
"
Open vSwitch switch using OpenFlow controller. Depends on ovs-vsctl.
"
def
__init__
(
self
,
name
,
failMode
=
'
secure
'
,
datapath
=
'
kernel
'
,
inband
=
False
,
**
params
):
"""
Init.
name: name for switch
failMode: controller loss behavior (secure|open)
datapath: userspace or kernel mode (kernel|user)
inband: use in-band control (False)
"""
OVSSwitchBase
.
__init__
(
self
,
name
,
**
params
)
self
.
failMode
=
failMode
self
.
datapath
=
datapath
self
.
inband
=
inband
def
dpctl
(
self
,
*
args
):
"
Run ovs-ofctl command
"
return
self
.
cmd
(
'
ovs-ofctl
'
,
args
[
0
],
self
,
*
args
[
1
:
]
)
def
controllerUUIDs
(
self
):
def
controllerUUIDs
(
self
):
"
Return ovsdb UUIDs for our controllers
"
"
Return ovsdb UUIDs for our controllers
"
uuids
=
[]
uuids
=
[]
...
...
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