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
8bebd377
Commit
8bebd377
authored
13 years ago
by
Bob Lantz
Browse files
Options
Downloads
Patches
Plain Diff
Fix is_switch() to always succeed + whitespace edits.
parent
e52d0ee1
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
+7
-6
7 additions, 6 deletions
mininet/topo.py
with
7 additions
and
6 deletions
mininet/topo.py
+
7
−
6
View file @
8bebd377
...
...
@@ -16,7 +16,7 @@
# from networkx.classes.graph import Graph
from
networkx
import
Graph
from
mininet.util
import
netParse
,
ipStr
,
irange
,
natural
,
naturalSeq
from
mininet.util
import
irange
,
natural
,
naturalSeq
class
Topo
(
object
):
"
Data center network representation for structured multi-trees.
"
...
...
@@ -38,7 +38,7 @@ def add_node(self, name, *args, **opts):
"""
Add Node to graph.
add_node(
'
name
'
, dict) <or> add_node(
'
name
'
, **opts)
name: name
args: dict of node options
args: dict of node options
opts: node options
"""
self
.
g
.
add_node
(
name
)
if
args
and
type
(
args
[
0
])
is
dict
:
...
...
@@ -50,7 +50,7 @@ def add_host(self, name, *args, **opts):
"""
Convenience method: Add host to graph.
add_host(
'
name
'
, dict) <or> add_host(
'
name
'
, **opts)
name: name
args: dict of node options
args: dict of node options
opts: node options
"""
if
not
opts
and
self
.
hopts
:
opts
=
self
.
hopts
...
...
@@ -60,7 +60,7 @@ def add_switch(self, name, **opts):
"""
Convenience method: Add switch to graph.
add_switch(
'
name
'
, dict) <or> add_switch(
'
name
'
, **opts)
name: name
args: dict of node options
args: dict of node options
opts: node options
"""
if
not
opts
and
self
.
sopts
:
opts
=
self
.
sopts
...
...
@@ -102,7 +102,7 @@ def add_port(self, src, dst):
if
src
not
in
self
.
ports
[
dst
]:
# num outlinks
self
.
ports
[
dst
][
src
]
=
len
(
self
.
ports
[
dst
])
+
dst_base
def
nodes
(
self
,
sort
=
True
):
"
Return nodes in graph
"
if
sort
:
...
...
@@ -113,7 +113,7 @@ def nodes(self, sort=True):
def
is_switch
(
self
,
n
):
'''
Returns true if node is a switch.
'''
info
=
self
.
node_info
[
n
]
return
info
and
info
[
'
is_switch
'
]
return
info
and
info
.
get
(
'
is_switch
'
,
False
)
def
switches
(
self
,
sort
=
True
):
'''
Return switches.
...
...
@@ -163,6 +163,7 @@ def nodeInfo( self, name ):
return
info
if
info
is
not
None
else
{}
def
setNodeInfo
(
self
,
name
,
info
):
"
Set metadata (dict) for node
"
self
.
node_info
[
name
]
=
info
@staticmethod
...
...
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