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
e52d0ee1
Commit
e52d0ee1
authored
13 years ago
by
Bob Lantz
Browse files
Options
Downloads
Patches
Plain Diff
Fix to work with new Topo class.
parent
ff568819
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
examples/linearbandwidth.py
+28
-29
28 additions, 29 deletions
examples/linearbandwidth.py
with
28 additions
and
29 deletions
examples/linearbandwidth.py
+
28
−
29
View file @
e52d0ee1
...
...
@@ -6,9 +6,9 @@
We construct a network of N hosts and N-1 switches, connected as follows:
h1 <-> s
N+
1 <-> s
N+
2 .. sN
+N
-1
|
|
|
h2
h3
hN
h1 <-> s1 <-> s2 .. sN-1
|
|
|
h2 h3 hN
WARNING: by default, the reference controller only supports 16
switches, so this test WILL NOT WORK unless you have recompiled
...
...
@@ -23,42 +23,40 @@
"""
import
sys
flush
=
sys
.
stdout
.
flush
from
mininet.net
import
Mininet
# from mininet.node import KernelSwitch
from
mininet.node
import
UserSwitch
,
OVSKernelSwitch
from
mininet.topo
import
Topo
,
Node
from
mininet.topo
import
Topo
from
mininet.log
import
lg
from
mininet.util
import
irange
import
sys
flush
=
sys
.
stdout
.
flush
class
LinearTestTopo
(
Topo
):
"
Topology for a string of N hosts and N-1 switches.
"
def
__init__
(
self
,
N
):
def
__init__
(
self
,
N
,
**
params
):
#
Add default members to class.
super
(
LinearTestTopo
,
self
).
__init__
(
)
#
Initialize topology
Topo
.
__init__
(
self
,
**
params
)
# Create switch and host nodes
hosts
=
range
(
1
,
N
+
1
)
switches
=
range
(
N
+
1
,
N
+
N
)
for
h
in
hosts
:
self
.
add_node
(
h
,
Node
(
is_switch
=
False
)
)
for
s
in
switches
:
self
.
add_node
(
s
,
Node
(
is_switch
=
True
)
)
# Create switches and hosts
hosts
=
[
self
.
add_host
(
'
h%s
'
%
h
)
for
h
in
irange
(
1
,
N
)
]
switches
=
[
self
.
add_switch
(
'
s%s
'
%
s
)
for
s
in
irange
(
1
,
N
-
1
)
]
# Wire up switches
for
s
in
switches
[
:
-
1
]:
self
.
add_edge
(
s
,
s
+
1
)
last
=
None
for
switch
in
switches
:
if
last
:
self
.
add_link
(
last
,
switch
)
last
=
switch
# Wire up hosts
self
.
add_edge
(
hosts
[
0
],
switches
[
0
]
)
for
h
in
hosts
[
1
:
]:
self
.
add_edge
(
h
,
h
+
N
-
1
)
# Consider all switches and hosts 'on'
self
.
enable_all
()
self
.
add_link
(
hosts
[
0
],
switches
[
0
]
)
for
host
,
switch
in
zip
(
hosts
[
1
:
],
switches
):
self
.
add_link
(
host
,
switch
)
def
linearBandwidthTest
(
lengths
):
...
...
@@ -69,15 +67,16 @@ def linearBandwidthTest( lengths ):
switchCount
=
max
(
lengths
)
hostCount
=
switchCount
+
1
switches
=
{
# 'reference kernel': KernelSwitch,
'
reference user
'
:
UserSwitch
,
switches
=
{
'
reference user
'
:
UserSwitch
,
'
Open vSwitch kernel
'
:
OVSKernelSwitch
}
topo
=
LinearTestTopo
(
hostCount
)
for
datapath
in
switches
.
keys
():
print
"
*** testing
"
,
datapath
,
"
datapath
"
Switch
=
switches
[
datapath
]
results
[
datapath
]
=
[]
net
=
Mininet
(
topo
=
LinearTestTopo
(
hostCount
)
,
switch
=
Switch
)
net
=
Mininet
(
topo
=
topo
,
switch
=
Switch
)
net
.
start
()
print
"
*** testing basic connectivity
"
for
n
in
lengths
:
...
...
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