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
8b8bb375
Commit
8b8bb375
authored
12 years ago
by
Bob Lantz
Browse files
Options
Downloads
Patches
Plain Diff
Remove unnecessary addHost() function, and clarify things a bit.
Fixes #102
parent
0aefb0e0
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/controllers.py
+11
-17
11 additions, 17 deletions
examples/controllers.py
with
11 additions
and
17 deletions
examples/controllers.py
+
11
−
17
View file @
8b8bb375
#!/usr/bin/python
"""
This example creates a multi-controller network from
semi-scratch; note a topo object could also be used and
would be passed into the Mininet() constructor.
This example creates a multi-controller network from semi-scratch by
using the net.add*() API and manually starting the switches and controllers.
Note that one could also create a custom switch class and pass it into
the Mininet() constructor.
"""
from
mininet.net
import
Mininet
from
mininet.node
import
Controller
,
OVS
Kernel
Switch
from
mininet.node
import
Controller
,
OVSSwitch
from
mininet.cli
import
CLI
from
mininet.log
import
setLogLevel
Switch
=
OVSKernelSwitch
def
addHost
(
net
,
N
):
"
Create host hN and add to net.
"
name
=
'
h%d
'
%
N
ip
=
'
10.0.0.%d
'
%
N
return
net
.
addHost
(
name
,
ip
=
ip
)
def
multiControllerNet
():
"
Create a network with multiple controllers.
"
"
Create a network
from semi-scratch
with multiple controllers.
"
net
=
Mininet
(
controller
=
Controller
,
switch
=
Switch
)
net
=
Mininet
(
controller
=
Controller
,
switch
=
OVS
Switch
,
build
=
False
)
print
"
*** Creating controllers
"
print
"
*** Creating
(reference)
controllers
"
c1
=
net
.
addController
(
'
c1
'
,
port
=
6633
)
c2
=
net
.
addController
(
'
c2
'
,
port
=
6634
)
...
...
@@ -33,8 +27,8 @@ def multiControllerNet():
s2
=
net
.
addSwitch
(
'
s2
'
)
print
"
*** Creating hosts
"
hosts1
=
[
addHost
(
net
,
n
)
for
n
in
3
,
4
]
hosts2
=
[
addHost
(
net
,
n
)
for
n
in
5
,
6
]
hosts1
=
[
net
.
addHost
(
'
h%d
'
%
n
)
for
n
in
3
,
4
]
hosts2
=
[
net
.
addHost
(
'
h%d
'
%
n
)
for
n
in
5
,
6
]
print
"
*** Creating links
"
for
h
in
hosts1
:
...
...
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