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
35698385
Commit
35698385
authored
12 years ago
by
Bob Lantz
Browse files
Options
Downloads
Patches
Plain Diff
Updated for new Topo API
parent
8c7c4812
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
custom/topo-2sw-2host.py
+12
-22
12 additions, 22 deletions
custom/topo-2sw-2host.py
with
12 additions
and
22 deletions
custom/topo-2sw-2host.py
+
12
−
22
View file @
35698385
...
...
@@ -11,36 +11,26 @@
"""
from
mininet.topo
import
Topo
from
mininet.node
import
Node
class
MyTopo
(
Topo
):
"
Simple topology example.
"
def
__init__
(
self
,
enable_all
=
True
):
def
__init__
(
self
):
"
Create custom topo.
"
#
Add default members to class.
super
(
MyTopo
,
self
)
.
__init__
()
#
Initialize topology
Topo
.
__init__
(
self
)
#
Set Node IDs for
hosts and switches
leftHost
=
1
leftSwitch
=
2
righ
tSwitch
=
3
right
Host
=
4
#
Add
hosts and switches
leftHost
=
self
.
addHost
(
'
h1
'
)
rightHost
=
self
.
addHost
(
'
h2
'
)
lef
tSwitch
=
self
.
addSwitch
(
'
s3
'
)
right
Switch
=
self
.
addSwitch
(
'
s4
'
)
# Add nodes
self
.
addNode
(
leftSwitch
,
Node
(
isSwitch
=
True
)
)
self
.
addNode
(
rightSwitch
,
Node
(
isSwitch
=
True
)
)
self
.
addNode
(
leftHost
,
Node
(
isSwitch
=
False
)
)
self
.
addNode
(
rightHost
,
Node
(
isSwitch
=
False
)
)
# Add edges
self
.
add_edge
(
leftHost
,
leftSwitch
)
self
.
add_edge
(
leftSwitch
,
rightSwitch
)
self
.
add_edge
(
rightSwitch
,
rightHost
)
# Consider all switches and hosts 'on'
self
.
enable_all
()
# Add links
self
.
addLink
(
leftHost
,
leftSwitch
)
self
.
addLink
(
leftSwitch
,
rightSwitch
)
self
.
addLink
(
rightSwitch
,
rightHost
)
topos
=
{
'
mytopo
'
:
(
lambda
:
MyTopo
()
)
}
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