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
94c02695
Commit
94c02695
authored
13 years ago
by
Bob Lantz
Browse files
Options
Downloads
Patches
Plain Diff
Clarify precedence of default classes.
parent
d8c88bed
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
mininet/topo.py
+11
-8
11 additions, 8 deletions
mininet/topo.py
with
11 additions
and
8 deletions
mininet/topo.py
+
11
−
8
View file @
94c02695
...
...
@@ -17,7 +17,6 @@
from
networkx
import
Graph
from
mininet.node
import
SWITCH_PORT_BASE
,
Host
,
OVSSwitch
from
mininet.link
import
Link
# BL: it's hard to figure out how to do this right yet remain flexible
# These classes will be used as the defaults if no class is passed
...
...
@@ -93,7 +92,7 @@ class Edge(object):
'''
Edge-specific metadata for a StructuredTopo graph.
'''
def
__init__
(
self
,
admin_on
=
True
,
power_on
=
True
,
fault
=
False
,
cls
=
Link
,
**
params
):
cls
=
None
,
**
params
):
'''
Init.
@param admin_on administratively on or off; defaults to True
...
...
@@ -109,13 +108,17 @@ def __init__(self, admin_on=True, power_on=True, fault=False,
class
Topo
(
object
):
'''
Data center network representation for structured multi-trees.
'''
"""
Data center network representation for structured multi-trees.
Note that the order of precedence is:
per-node/link classes and parameters
per-topo classes
per-network classes
"""
def
__init__
(
self
,
node
=
Host
,
switch
=
None
,
link
=
Link
):
def
__init__
(
self
,
node
=
None
,
switch
=
None
,
link
=
None
):
"""
Create Topo object.
node: default node/host class
switch: default switch class
L
ink: default link class
"""
node: default node/host class
(optional)
switch: default switch class
(optional)
l
ink: default link class
(optional)
"""
self
.
g
=
Graph
()
self
.
node_info
=
{}
# dpids hash to Node objects
self
.
edge_info
=
{}
# (src_dpid, dst_dpid) tuples hash to Edge objects
...
...
@@ -146,7 +149,7 @@ def add_edge(self, src, dst, edge=None):
src
,
dst
=
tuple
(
sorted
([
src
,
dst
]))
self
.
g
.
add_edge
(
src
,
dst
)
if
not
edge
:
edge
=
Edge
(
link
=
self
.
link
)
edge
=
Edge
(
cls
=
self
.
link
)
self
.
edge_info
[(
src
,
dst
)]
=
edge
self
.
add_port
(
src
,
dst
)
...
...
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