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
87b60214
Commit
87b60214
authored
10 years ago
by
Cody
Browse files
Options
Downloads
Patches
Plain Diff
restructured code and added a test for the numberedports.py example
parent
50f50809
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/README.md
+5
-0
5 additions, 0 deletions
examples/README.md
examples/test/test_numberedports.py
+51
-0
51 additions, 0 deletions
examples/test/test_numberedports.py
with
56 additions
and
0 deletions
examples/README.md
+
5
−
0
View file @
87b60214
...
...
@@ -117,3 +117,8 @@ memory and `sysctl` configuration (see `INSTALL`.)
This example creates a 64-host tree network, and attempts to check full
connectivity using
`ping`
, for different switch/datapath types.
#### numberedports.py
This example verifies the mininet ofport numbers match up to the ovs port numbers.
It also verifies that the port numbers match up to the interface numbers
This diff is collapsed.
Click to expand it.
examples/test/test_numberedports.py
0 → 100755
+
51
−
0
View file @
87b60214
#!/usr/bin/env python
"""
Test for numberedports.py
"""
import
unittest
import
pexpect
from
collections
import
defaultdict
class
testNumberedports
(
unittest
.
TestCase
):
def
testConsistency
(
self
):
"""
verify consistency between mininet and ovs ports
"""
p
=
pexpect
.
spawn
(
'
python -m mininet.examples.numberedports
'
)
opts
=
[
'
Validating that s1-eth\d is actually on port \d ... Validated.
'
,
'
Validating that s1-eth\d is actually on port \d ... WARNING
'
,
pexpect
.
EOF
]
correct_ports
=
True
count
=
0
while
True
:
index
=
p
.
expect
(
opts
)
if
index
==
0
:
count
+=
1
elif
index
==
1
:
correct_ports
=
False
elif
index
==
2
:
self
.
assertNotEqual
(
0
,
count
)
break
self
.
assertTrue
(
correct_ports
)
def
testNumbering
(
self
):
"""
verify that all of the port numbers are printed correctly and consistent with their interface
"""
p
=
pexpect
.
spawn
(
'
python -m mininet.examples.numberedports
'
)
opts
=
[
'
s1-eth(\d+) : (\d+)
'
,
pexpect
.
EOF
]
count_intfs
=
0
while
True
:
index
=
p
.
expect
(
opts
)
if
index
==
0
:
count_intfs
+=
1
intfport
=
p
.
match
.
group
(
1
)
ofport
=
p
.
match
.
group
(
2
)
self
.
assertEqual
(
intfport
,
ofport
)
elif
index
==
1
:
self
.
assertNotEqual
(
0
,
count_intfs
)
break
if
__name__
==
'
__main__
'
:
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