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
7eeaed99
Commit
7eeaed99
authored
10 years ago
by
cody burkard
Browse files
Options
Downloads
Patches
Plain Diff
use udp with iperf to measure loss. pings are not reliable
parent
12095a12
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
examples/simpleperf.py
+5
-6
5 additions, 6 deletions
examples/simpleperf.py
examples/test/test_simpleperf.py
+10
-29
10 additions, 29 deletions
examples/test/test_simpleperf.py
with
15 additions
and
35 deletions
examples/simpleperf.py
+
5
−
6
View file @
7eeaed99
...
...
@@ -31,17 +31,16 @@ def __init__(self, n=2, **opts):
def
perfTest
():
"
Create network and run simple performance test
"
topo
=
SingleSwitchTopo
(
n
=
4
)
net
=
Mininet
(
topo
=
topo
,
host
=
CPULimitedHost
,
link
=
TCLink
)
topo
=
SingleSwitchTopo
(
n
=
4
)
net
=
Mininet
(
topo
=
topo
,
host
=
CPULimitedHost
,
link
=
TCLink
,
autoStaticArp
=
True
)
net
.
start
()
print
"
Dumping host connections
"
dumpNodeConnections
(
net
.
hosts
)
print
"
Testing network connectivity
"
net
.
pingAll
()
print
"
Testing bandwidth between h1 and h4
"
h1
,
h4
=
net
.
getNodeByName
(
'
h1
'
,
'
h4
'
)
net
.
iperf
(
(
h1
,
h4
)
)
results
=
net
.
iperf
(
(
h1
,
h4
),
l4Type
=
'
UDP
'
)
net
.
stop
()
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
examples/test/test_simpleperf.py
+
10
−
29
View file @
7eeaed99
...
...
@@ -6,12 +6,8 @@
import
unittest
import
pexpect
import
re
import
sys
from
mininet.log
import
setLogLevel
from
mininet.net
import
Mininet
from
mininet.node
import
CPULimitedHost
from
mininet.link
import
TCLink
from
mininet.examples.simpleperf
import
SingleSwitchTopo
...
...
@@ -19,35 +15,20 @@ class testSimplePerf( unittest.TestCase ):
@unittest.skipIf
(
'
-quick
'
in
sys
.
argv
,
'
long test
'
)
def
testE2E
(
self
):
"
Run the example and verify ping and iperf results
"
"
Run the example and verify iperf results
"
BW
=
10
TOLERANCE
=
.
8
expectedBw
=
BW
*
TOLERANCE
p
=
pexpect
.
spawn
(
'
python -m mininet.examples.simpleperf
'
)
# check ping results
p
.
expect
(
"
Results: (\d+)% dropped
"
,
timeout
=
120
)
loss
=
int
(
p
.
match
.
group
(
1
)
)
self
.
assertTrue
(
0
<
loss
<
100
)
# check iperf results
p
.
expect
(
"
Results: \[
'
([\d\.]+) .bits/sec
"
,
timeout
=
480
)
bw
=
float
(
p
.
match
.
group
(
1
)
)
self
.
assertTrue
(
bw
>
0
)
p
.
expect
(
"
Results: \[
'
10M
'
,
'
([\d\.]+) .bits/sec
"
,
timeout
=
480
)
measuredBw
=
float
(
p
.
match
.
group
(
1
)
)
lowerBound
=
expectedBw
*
TOLERANCE
upperBound
=
expectedBw
+
expectedBw
*
(
1
-
TOLERANCE
)
self
.
assertGreaterEqual
(
measuredBw
,
lowerBound
)
self
.
assertLessEqual
(
measuredBw
,
upperBound
)
p
.
wait
()
def
testTopo
(
self
):
"""
Import SingleSwitchTopo from example and test connectivity between two hosts
Note: this test may fail very rarely because it is non-deterministic
i.e. links are configured with 10% packet loss, but if we get unlucky and
none or all of the packets are dropped, the test will fail
"""
topo
=
SingleSwitchTopo
(
n
=
4
)
net
=
Mininet
(
topo
=
topo
,
host
=
CPULimitedHost
,
link
=
TCLink
)
net
.
start
()
h1
,
h4
=
net
.
get
(
'
h1
'
,
'
h4
'
)
# have h1 ping h4 ten times
expectStr
=
'
(\d+) packets transmitted, (\d+) received, (\d+)% packet loss
'
output
=
h1
.
cmd
(
'
ping -c 10 %s
'
%
h4
.
IP
()
)
m
=
re
.
search
(
expectStr
,
output
)
loss
=
int
(
m
.
group
(
3
)
)
net
.
stop
()
self
.
assertTrue
(
0
<
loss
<
100
)
if
__name__
==
'
__main__
'
:
setLogLevel
(
'
warning
'
)
unittest
.
main
()
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