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
36417231
Commit
36417231
authored
10 years ago
by
Cody
Browse files
Options
Downloads
Patches
Plain Diff
explaining test
parent
586a9bb6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/numberedports.py
+7
-5
7 additions, 5 deletions
examples/numberedports.py
with
7 additions
and
5 deletions
examples/numberedports.py
+
7
−
5
View file @
36417231
...
...
@@ -2,13 +2,14 @@
"""
Create a network with 5 hosts, numbered 1-4 and 9.
Validate that the port numbers match to the interface name,
and that the ovs ports match the mininet ports.
"""
from
mininet.net
import
Mininet
from
mininet.node
import
Controller
from
mininet.cli
import
CLI
from
mininet.log
import
setLogLevel
,
info
#from mininet.topo import Topo
from
mininet.node
import
Node
def
validatePort
(
self
,
intf
):
...
...
@@ -42,17 +43,18 @@ def net():
s1
=
net
.
addSwitch
(
'
s1
'
)
info
(
'
*** Creating links
\n
'
)
# host 1-4 connect to ports 1-4 on the switch
net
.
addLink
(
h1
,
s1
)
net
.
addLink
(
h2
,
s1
)
net
.
addLink
(
h3
,
s1
)
net
.
addLink
(
h4
,
s1
)
net
.
addLink
(
h5
,
s1
,
port1
=
1
,
port2
=
9
)
net
.
addLink
(
h5
,
s1
,
port1
=
1
,
port2
=
9
)
# specify a different port to connect host 5 to on the switch.
root
=
Node
(
'
root
'
,
inNamespace
=
False
)
info
(
'
*** Starting network
\n
'
)
net
.
start
()
#info( s1.intfs, "\n" )
# print the interfaces
,
their port numbers
, and the port requests
# print the interfaces
and
their port numbers
info
(
'
\n
*** printing and validating the ports running on each interface
\n
'
)
for
intfs
in
s1
.
intfList
():
if
not
intfs
.
name
==
"
lo
"
:
...
...
@@ -62,7 +64,7 @@ def net():
info
(
'
Validated.
\n
'
)
print
'
\n
'
#
info( root.cmd( 'ovs-vsctl list interface | grep -A 2 s1 ' ) )
#
test the network with pingall
net
.
pingAll
()
print
'
\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