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
ad2fda25
Commit
ad2fda25
authored
14 years ago
by
Bob Lantz
Browse files
Options
Downloads
Patches
Plain Diff
Attempt to make iperf test more robust.
parent
1dcc0476
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/net.py
+12
-3
12 additions, 3 deletions
mininet/net.py
with
12 additions
and
3 deletions
mininet/net.py
+
12
−
3
View file @
ad2fda25
...
...
@@ -473,17 +473,22 @@ def _parseIperf( iperfOutput ):
iperfOutput: string
returns: result string
"""
r
=
r
'
([\d\.]+ \w+/sec)
'
m
=
re
.
search
(
r
,
iperfOutput
)
m
=
re
.
findall
(
r
,
iperfOutput
)
if
m
:
return
m
.
group
(
1
)
return
m
[
-
1
]
else
:
raise
Exception
(
'
could not parse iperf output:
'
+
iperfOutput
)
# was: raise Exception(...)
error
(
'
could not parse iperf output:
'
+
iperfOutput
)
return
''
def
iperf
(
self
,
hosts
=
None
,
l4Type
=
'
TCP
'
,
udpBw
=
'
10M
'
):
"""
Run iperf between two hosts.
hosts: list of hosts; if None, uses opposite hosts
l4Type: string, one of [ TCP, UDP ]
returns: results two-element array of server and client speeds
"""
if
not
quietRun
(
'
which telnet
'
):
error
(
'
Cannot find telnet in $PATH - required for iperf test
'
)
return
if
not
hosts
:
hosts
=
[
self
.
hosts
[
0
],
self
.
hosts
[
-
1
]
]
else
:
...
...
@@ -503,6 +508,10 @@ def iperf( self, hosts=None, l4Type='TCP', udpBw='10M' ):
servout
=
''
while
server
.
lastPid
is
None
:
servout
+=
server
.
monitor
()
while
'
Connected
'
not
in
client
.
cmd
(
'
sh -c
"
echo A | telnet -e A %s 5001
"'
%
server
.
IP
()):
output
(
'
waiting for iperf to start up
'
)
sleep
(.
5
)
cliout
=
client
.
cmd
(
iperfArgs
+
'
-t 5 -c
'
+
server
.
IP
()
+
'
'
+
bwArgs
)
debug
(
'
Client output: %s
\n
'
%
cliout
)
...
...
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