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
22f807fc
Commit
22f807fc
authored
14 years ago
by
Bob Lantz
Browse files
Options
Downloads
Patches
Plain Diff
Reinstated multitest example and updated examples/README.
parent
b2ef87ae
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
+15
-3
15 additions, 3 deletions
examples/README
examples/multitest.py
+36
-0
36 additions, 0 deletions
examples/multitest.py
with
51 additions
and
3 deletions
examples/README
+
15
−
3
View file @
22f807fc
Mininet Examples
---
These examples are intended to help you get started using
Mininet's Python API:
Mininet's Python API.
---
linearbandwidth.py:
This example shows how to create a custom topology programatically
by subclassing Topo, and how to run a series of tests on it.
multitest.py:
This example creates a network and runs multiple tests on it.
scratchnet.py, scratchnetuser.py:
These two examples demonstrate how to create a network by using the lowest-
level Mininet functions. Generally the higher-level API is easier to use,
but scratchnet shows what is going on behind the scenes.
sshd.py:
This example shows how to run an sshd process in each host, allowing
you to log in via ssh. This requires connecting the Mininet data network
to an interface in the root namespace (generaly the control network
already lives in the root namespace, so it does not need to be explicitly
connected.)
udpbwtest.py:
This example shows how to run a test across an entire network, and monitor
...
...
This diff is collapsed.
Click to expand it.
examples/multitest.py
0 → 100755
+
36
−
0
View file @
22f807fc
#!/usr/bin/python
"""
This example shows how to create a network and run multiple tests.
For a more complicated test example, see udpbwtest.py.
"""
from
mininet.cli
import
CLI
from
mininet.log
import
lg
,
info
from
mininet.net
import
init
,
Mininet
from
mininet.node
import
KernelSwitch
from
mininet.topolib
import
TreeTopo
def
ifconfigTest
(
net
):
"
Run ifconfig on all hosts in net.
"
hosts
=
net
.
hosts
for
host
in
hosts
:
info
(
host
.
cmd
(
'
ifconfig
'
)
)
if
__name__
==
'
__main__
'
:
lg
.
setLogLevel
(
'
info
'
)
info
(
"
*** Initializing Mininet and kernel modules
\n
"
)
KernelSwitch
.
setup
()
init
()
info
(
"
*** Creating network
\n
"
)
network
=
Mininet
(
TreeTopo
(
depth
=
2
,
fanout
=
2
),
switch
=
KernelSwitch
)
info
(
"
*** Starting network
\n
"
)
network
.
start
()
info
(
"
*** Running ping test
\n
"
)
network
.
pingAll
()
info
(
"
*** Running ifconfig test
\n
"
)
ifconfigTest
(
network
)
info
(
"
*** Starting CLI (type
'
exit
'
to exit)
\n
"
)
CLI
(
network
)
info
(
"
*** Stopping network
\n
"
)
network
.
stop
()
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