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
f1e42ba5
Commit
f1e42ba5
authored
10 years ago
by
Cody
Browse files
Options
Downloads
Patches
Plain Diff
adding ovs version detection to fix port numbering bug
parent
5797f585
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mininet/node.py
+31
-8
31 additions, 8 deletions
mininet/node.py
with
31 additions
and
8 deletions
mininet/node.py
+
31
−
8
View file @
f1e42ba5
...
...
@@ -57,6 +57,8 @@
numCores
,
retry
,
mountCgroups
)
from
mininet.moduledeps
import
moduleDeps
,
pathCheck
,
OVS_KMOD
,
OF_KMOD
,
TUN
from
mininet.link
import
Link
,
Intf
,
TCIntf
from
re
import
findall
from
distutils.version
import
StrictVersion
class
Node
(
object
):
"""
A virtual network node is simply a shell in a network namespace.
...
...
@@ -987,6 +989,15 @@ def setup( cls ):
'
You may wish to try
'
'"
service openvswitch-switch start
"
.
\n
'
)
exit
(
1
)
info
=
quietRun
(
'
ovs-vsctl --version
'
)
cls
.
OVSVersion
=
findall
(
'
\d+\.\d+
'
,
info
)[
0
]
if
cls
.
isOldOVS
():
print
"
using old version of ovs so startup will be slower
"
@classmethod
def
isOldOVS
(
cls
):
return
(
StrictVersion
(
cls
.
OVSVersion
)
<
StrictVersion
(
'
1.10
'
)
)
@classmethod
def
batchShutdown
(
cls
,
switches
):
...
...
@@ -1044,21 +1055,34 @@ def start( self, controllers ):
self
.
cmd
(
'
ifconfig lo up
'
)
# Annoyingly, --if-exists option seems not to work
self
.
cmd
(
'
ovs-vsctl del-br
'
,
self
)
int
(
self
.
dpid
,
16
)
# DPID must be a hex string
# Interfaces and controllers
intfs
=
'
'
.
join
(
'
-- add-port %s %s
'
%
(
self
,
intf
)
intfs
=
'
'
.
join
(
'
-- add-port %s %s
-- set Interface %s ofport_request=%s
'
%
(
self
,
intf
,
intf
,
self
.
ports
[
intf
]
)
for
intf
in
self
.
intfList
()
if
not
intf
.
IP
()
)
clist
=
'
'
.
join
(
'
%s:%s:%d
'
%
(
c
.
protocol
,
c
.
IP
(),
c
.
port
)
for
c
in
controllers
)
if
self
.
listenPort
:
clist
+=
'
ptcp:%s
'
%
self
.
listenPort
# Construct big ovs-vsctl command
cmd
=
(
'
ovs-vsctl add-br %s
'
%
self
+
'
-- set Bridge %s
'
%
self
+
# configure old version ov ovs
if
self
.
isOldOVS
():
self
.
cmd
(
'
ovs-vsctl add-br
'
,
self
)
for
intf
in
self
.
intfList
():
if
not
intf
.
IP
():
self
.
cmd
(
'
ovs-vsctl add-port
'
,
self
,
intf
)
cmd
=
(
'
ovs-vsctl set Bridge %s
'
%
self
+
'
other_config:datapath-id=%s
'
%
self
.
dpid
+
'
-- set-fail-mode %s %s
'
%
(
self
,
self
.
failMode
)
+
intfs
+
'
-- set-controller %s %s
'
%
(
self
,
clist
)
)
'
-- set-controller %s %s
'
%
(
self
,
clist
))
int
(
self
.
dpid
,
16
)
# DPID must be a hex string
# Construct big ovs-vsctl command
if
not
self
.
isOldOVS
():
print
"
using a newer ovs version so startup will be faster
"
cmd
=
(
'
ovs-vsctl add-br %s
'
%
self
+
'
-- set Bridge %s
'
%
self
+
'
other_config:datapath-id=%s
'
%
self
.
dpid
+
'
-- set-fail-mode %s %s
'
%
(
self
,
self
.
failMode
)
+
intfs
+
'
-- set-controller %s %s
'
%
(
self
,
clist
)
)
if
not
self
.
inband
:
cmd
+=
(
'
-- set bridge %s
'
'
other-config:disable-in-band=true
'
%
self
)
...
...
@@ -1274,4 +1298,3 @@ def checkListening( self ):
if
'
Connected
'
not
in
listening
:
warn
(
"
Unable to contact the remote controller
"
"
at %s:%d
\n
"
%
(
self
.
ip
,
self
.
port
)
)
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