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
0cd489a7
Commit
0cd489a7
authored
15 years ago
by
Brandon Heller
Browse files
Options
Downloads
Patches
Plain Diff
Add iperf UDP test
parent
8a034f4f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/mn_run.py
+1
-1
1 addition, 1 deletion
bin/mn_run.py
mininet/net.py
+26
-6
26 additions, 6 deletions
mininet/net.py
with
27 additions
and
7 deletions
bin/mn_run.py
+
1
−
1
View file @
0cd489a7
...
...
@@ -37,7 +37,7 @@
'
none
'
:
lambda
a
,
b
:
None
}
# optional tests to run
TESTS
=
[
'
cli
'
,
'
build
'
,
'
ping_all
'
,
'
ping_pair
'
,
'
iperf
'
,
'
all
'
]
TESTS
=
[
'
cli
'
,
'
build
'
,
'
ping_all
'
,
'
ping_pair
'
,
'
iperf
'
,
'
all
'
,
'
iperf_udp
'
]
def
add_dict_option
(
opts
,
choices_dict
,
default
,
name
,
help_str
=
None
):
'''
Convenience function to add choices dicts to OptionParser.
...
...
This diff is collapsed.
Click to expand it.
mininet/net.py
+
26
−
6
View file @
0cd489a7
...
...
@@ -436,10 +436,12 @@ def _parseIperf(iperfOutput):
else
:
raise
Exception
(
'
could not parse iperf output
'
)
def
iperf
(
self
,
hosts
=
None
,
verbose
=
False
):
def
iperf
(
self
,
hosts
=
None
,
l4_type
=
'
TCP
'
,
udp_bw
=
'
10M
'
,
verbose
=
True
):
'''
Run iperf between two hosts.
@param hosts list of host DPIDs; if None, uses opposite hosts
@param l4_type string, one of [TCP, UDP]
@param verbose verbose printing
@return results two-element array of server and client speeds
'''
...
...
@@ -450,22 +452,35 @@ def iperf(self, hosts = None, verbose = False):
assert
len
(
hosts
)
==
2
host0
=
self
.
nodes
[
hosts
[
0
]]
host1
=
self
.
nodes
[
hosts
[
1
]]
lg
.
info
(
'
*** Iperf: testing bandwidth between
'
)
lg
.
info
(
'
*** Iperf: testing
'
+
l4_type
+
'
bandwidth between
'
)
lg
.
info
(
"
%s and %s
\n
"
%
(
host0
.
name
,
host1
.
name
))
host0
.
cmd
(
'
killall -9 iperf
'
)
server
=
host0
.
cmd
(
'
iperf -s &
'
)
iperf_args
=
'
iperf
'
bw_args
=
''
if
l4_type
==
'
UDP
'
:
iperf_args
+=
'
-u
'
bw_args
=
'
-b
'
+
udp_bw
+
'
'
elif
l4_type
!=
'
TCP
'
:
raise
Exception
(
'
Unexpected l4 type: %s
'
%
l4_type
)
server
=
host0
.
cmd
(
iperf_args
+
'
-s &
'
)
if
verbose
:
lg
.
info
(
'
%s
\n
'
%
server
)
client
=
host1
.
cmd
(
'
iperf
-t 5 -c
'
+
host0
.
IP
())
client
=
host1
.
cmd
(
iperf
_args
+
'
-t 5 -c
'
+
host0
.
IP
()
+
'
'
+
bw_args
)
if
verbose
:
lg
.
info
(
'
%s
\n
'
%
client
)
server
=
host0
.
cmd
(
'
killall -9 iperf
'
)
if
verbose
:
lg
.
info
(
'
%s
\n
'
%
server
)
result
=
[
self
.
_parseIperf
(
server
),
self
.
_parseIperf
(
client
)]
if
l4_type
==
'
UDP
'
:
result
.
insert
(
0
,
udp_bw
)
lg
.
info
(
'
*** Results: %s
\n
'
%
result
)
return
result
def
iperf_udp
(
self
,
udp_bw
=
'
10M
'
):
'''
Run iperf UDP test.
'''
return
self
.
iperf
(
l4_type
=
'
UDP
'
,
udp_bw
=
udp_bw
)
def
interact
(
self
):
'''
Start network and run our simple CLI.
'''
self
.
start
()
...
...
@@ -477,7 +492,7 @@ def interact(self):
class
MininetCLI
(
object
):
'''
Simple command-line interface to talk to nodes.
'''
cmds
=
[
'
?
'
,
'
help
'
,
'
nodes
'
,
'
net
'
,
'
sh
'
,
'
ping_all
'
,
'
exit
'
,
\
'
ping_pair
'
,
'
iperf
'
]
'
ping_pair
'
,
'
iperf
'
,
'
iperf_udp
'
]
def
__init__
(
self
,
mininet
):
self
.
mn
=
mininet
...
...
@@ -538,9 +553,14 @@ def ping_pair(self, args):
self
.
mn
.
ping_pair
()
def
iperf
(
self
,
args
):
'''
Simple iperf test between two hosts.
'''
'''
Simple iperf
TCP
test between two hosts.
'''
self
.
mn
.
iperf
()
def
iperf_udp
(
self
,
args
):
'''
Simple iperf UDP test between two hosts.
'''
udp_bw
=
args
[
0
]
if
len
(
args
)
else
'
10M
'
self
.
mn
.
iperf_udp
(
udp_bw
)
def
run
(
self
):
'''
Read and execute commands.
'''
lg
.
warn
(
'
*** Starting CLI:
\n
'
)
...
...
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