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
3b4738c2
Commit
3b4738c2
authored
10 years ago
by
Bob Lantz
Browse files
Options
Downloads
Patches
Plain Diff
First crack at setting controller backoff in single command
parent
30ebb852
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mininet/node.py
+30
-14
30 additions, 14 deletions
mininet/node.py
with
30 additions
and
14 deletions
mininet/node.py
+
30
−
14
View file @
3b4738c2
...
@@ -1174,7 +1174,7 @@ def patchOpts( intf ):
...
@@ -1174,7 +1174,7 @@ def patchOpts( intf ):
intf1
,
intf2
=
intf
.
link
.
intf1
,
intf
.
link
.
intf2
intf1
,
intf2
=
intf
.
link
.
intf1
,
intf
.
link
.
intf2
peer
=
intf1
if
intf1
!=
intf
else
intf2
peer
=
intf1
if
intf1
!=
intf
else
intf2
return
(
'
-- set Interface %s type=patch
'
return
(
'
-- set Interface %s type=patch
'
'
-- set Interface %s options:peer=%s
'
%
'
-- set Interface %s options:peer=%s
'
%
(
intf
,
intf
,
peer
)
)
(
intf
,
intf
,
peer
)
)
# pylint: disable=too-many-branches
# pylint: disable=too-many-branches
...
@@ -1191,19 +1191,27 @@ def start( self, controllers ):
...
@@ -1191,19 +1191,27 @@ def start( self, controllers ):
+
self
.
patchOpts
(
intf
)
+
self
.
patchOpts
(
intf
)
for
intf
in
self
.
intfList
()
for
intf
in
self
.
intfList
()
if
self
.
ports
[
intf
]
and
not
intf
.
IP
()
)
if
self
.
ports
[
intf
]
and
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 for new versions of OVS
# Construct big ovs-vsctl command for new versions of OVS
clist
=
[
(
self
.
name
+
c
.
name
,
'
%s:%s:%d
'
%
(
c
.
protocol
,
c
.
IP
(),
c
.
port
)
)
for
c
in
controllers
]
if
self
.
listenPort
:
clist
.
append
(
(
self
.
name
+
'
-listen
'
,
'
ptcp:%s
'
%
self
.
listenPort
)
)
if
not
self
.
isOldOVS
():
if
not
self
.
isOldOVS
():
ccmd
=
'
-- --id=@%s create Controller target=
\\
"
%s
\\
"'
if
self
.
reconnectms
:
ccmd
+=
'
max_backoff=%d
'
%
self
.
reconnectms
cargs
=
''
.
join
(
ccmd
%
(
name
,
target
)
for
name
,
target
in
clist
)
clist
=
'
,
'
.
join
(
'
@%s
'
%
name
for
name
,
_target
in
clist
)
cmd
=
(
'
-- --if-exists del-br %s
'
%
self
+
cmd
=
(
'
-- --if-exists del-br %s
'
%
self
+
'
-- add-br %s
'
%
self
+
'
-- add-br %s
'
%
self
+
'
-- set
B
ridge %s
'
%
self
+
'
-- set
b
ridge %s
'
%
self
+
'
other_config:datapath-id=%s
'
%
self
.
dpid
+
'
other_config:datapath-id=%s
'
%
self
.
dpid
+
'
-- set-
fail
-
mode
%s %
s
'
%
(
self
,
self
.
failMode
)
+
'
fail
_
mode
=
%s
'
%
self
.
failMode
+
intfs
+
'
controller=[%s]
'
%
clist
+
'
-- set-controller %s %s
'
%
(
self
,
clist
)
)
intfs
+
cargs
)
# Construct ovs-vsctl commands for old versions of OVS
# Construct ovs-vsctl commands for old versions of OVS
else
:
else
:
# Annoyingly, --if-exists option seems not to work
# Annoyingly, --if-exists option seems not to work
...
@@ -1215,7 +1223,7 @@ def start( self, controllers ):
...
@@ -1215,7 +1223,7 @@ def start( self, controllers ):
cmd
=
(
'
set Bridge %s
'
%
self
+
cmd
=
(
'
set Bridge %s
'
%
self
+
'
other_config:datapath-id=%s
'
%
self
.
dpid
+
'
other_config:datapath-id=%s
'
%
self
.
dpid
+
'
-- set-fail-mode %s %s
'
%
(
self
,
self
.
failMode
)
+
'
-- set-fail-mode %s %s
'
%
(
self
,
self
.
failMode
)
+
'
-- set-controller %s %s
'
%
(
self
,
clist
)
)
'
-- set-controller %s %s
'
%
(
self
,
'
'
.
join
(
clist
)
)
)
if
not
self
.
inband
:
if
not
self
.
inband
:
cmd
+=
(
'
-- set bridge %s
'
cmd
+=
(
'
-- set bridge %s
'
'
other-config:disable-in-band=true
'
%
self
)
'
other-config:disable-in-band=true
'
%
self
)
...
@@ -1228,7 +1236,7 @@ def start( self, controllers ):
...
@@ -1228,7 +1236,7 @@ def start( self, controllers ):
# Do it!!
# Do it!!
self
.
vsctl
(
cmd
)
self
.
vsctl
(
cmd
)
# Reconnect quickly to controllers (1s vs. 15s max_backoff)
# Reconnect quickly to controllers (1s vs. 15s max_backoff)
if
self
.
reconnectms
:
if
self
.
isOldOVS
()
and
self
.
reconnectms
:
uuids
=
[
'
-- set Controller %s max_backoff=%d
'
%
uuids
=
[
'
-- set Controller %s max_backoff=%d
'
%
(
uuid
,
self
.
reconnectms
)
(
uuid
,
self
.
reconnectms
)
for
uuid
in
self
.
controllerUUIDs
()
]
for
uuid
in
self
.
controllerUUIDs
()
]
...
@@ -1273,12 +1281,19 @@ def connected( self ):
...
@@ -1273,12 +1281,19 @@ def connected( self ):
class
OVSBatch
(
OVSSwitch
):
class
OVSBatch
(
OVSSwitch
):
"
Experiment: batch startup of OVS switches
"
"
Experiment: batch startup of OVS switches
"
reconnectms
=
1000
# shared for all switches
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
kwargs
.
update
(
reconnectms
=
None
)
self
.
commands
=
[]
self
.
commands
=
[]
self
.
started
=
False
self
.
started
=
False
# Use global rather than local reconnectms
reconnectms
=
kwargs
.
pop
(
'
reconnectms
'
,
1000
)
self
.
__class__
.
reconnectms
=
max
(
reconnectms
,
self
.
__class__
.
reconnectms
)
kwargs
.
update
(
reconnectms
=
None
)
super
(
OVSBatch
,
self
).
__init__
(
*
args
,
**
kwargs
)
super
(
OVSBatch
,
self
).
__init__
(
*
args
,
**
kwargs
)
@classmethod
@classmethod
def
batchStartup
(
cls
,
switches
):
def
batchStartup
(
cls
,
switches
):
"
Batch startup for OVS
"
"
Batch startup for OVS
"
...
@@ -1291,11 +1306,11 @@ def batchStartup( cls, switches ):
...
@@ -1291,11 +1306,11 @@ def batchStartup( cls, switches ):
cmds
+=
'
'
+
cmd
.
strip
()
cmds
+=
'
'
+
cmd
.
strip
()
# Split into 1 MB blocks
# Split into 1 MB blocks
if
len
(
cmds
)
>
1000000
:
if
len
(
cmds
)
>
1000000
:
print
quiet
Run
(
'
ovs-vsctl
'
+
cmds
)
err
Run
(
'
ovs-vsctl
'
+
cmds
,
shell
=
True
)
cmds
=
''
cmds
=
''
switch
.
started
=
True
switch
.
started
=
True
if
cmds
:
if
cmds
:
quietRun
(
'
ovs-vsctl
'
+
cmds
)
quietRun
(
'
ovs-vsctl
'
+
cmds
,
shell
=
True
)
return
True
return
True
def
vsctl
(
self
,
*
args
,
**
kwargs
):
def
vsctl
(
self
,
*
args
,
**
kwargs
):
...
@@ -1428,6 +1443,7 @@ def stop( self, *args, **kwargs ):
...
@@ -1428,6 +1443,7 @@ def stop( self, *args, **kwargs ):
"
Stop controller.
"
"
Stop controller.
"
self
.
cmd
(
'
kill %
'
+
self
.
command
)
self
.
cmd
(
'
kill %
'
+
self
.
command
)
self
.
cmd
(
'
wait %
'
+
self
.
command
)
self
.
cmd
(
'
wait %
'
+
self
.
command
)
kwargs
.
update
(
deleteIntfs
=
False
)
super
(
Controller
,
self
).
stop
(
*
args
,
**
kwargs
)
super
(
Controller
,
self
).
stop
(
*
args
,
**
kwargs
)
def
IP
(
self
,
intf
=
None
):
def
IP
(
self
,
intf
=
None
):
...
...
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