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
3e6b3dd2
Commit
3e6b3dd2
authored
14 years ago
by
Bob Lantz
Browse files
Options
Downloads
Patches
Plain Diff
Added an example of how to make an empty Mininet and add things to it.
parent
c58bb42f
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
examples/emptynet.py
+45
-0
45 additions, 0 deletions
examples/emptynet.py
with
45 additions
and
0 deletions
examples/emptynet.py
0 → 100755
+
45
−
0
View file @
3e6b3dd2
#!/usr/bin/python
"""
This example shows how to create an empty Mininet() object
(without a topology object) and add nodes to it manually.
"""
from
mininet.net
import
Mininet
from
mininet.node
import
Controller
from
mininet.cli
import
CLI
from
mininet.log
import
setLogLevel
def
emptyNet
():
"
Create an empty network and add nodes to it.
"
net
=
Mininet
(
controller
=
Controller
)
print
"
*** Adding controller
"
c0
=
net
.
addController
(
'
c0
'
)
print
"
*** Adding hosts
"
h1
=
net
.
addHost
(
'
h1
'
,
ip
=
'
10.0.0.1
'
)
h2
=
net
.
addHost
(
'
h2
'
,
ip
=
'
10.0.0.2
'
)
print
"
*** Adding switch
"
s3
=
net
.
addSwitch
(
'
s3
'
)
print
"
*** Creating links
"
h1
.
linkTo
(
s3
)
h2
.
linkTo
(
s3
)
print
"
*** Starting network
"
net
.
build
()
net
.
start
()
print
"
*** Running CLI
"
setLogLevel
(
'
info
'
)
CLI
(
net
)
print
"
*** Stopping network
"
net
.
stop
()
if
__name__
==
'
__main__
'
:
emptyNet
()
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