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
33e39a24
Commit
33e39a24
authored
11 years ago
by
Bob Lantz
Browse files
Options
Downloads
Patches
Plain Diff
Fix some pylint messages.
parent
538a856c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
examples/nat.py
+1
-3
1 addition, 3 deletions
examples/nat.py
mininet/clean.py
+1
-1
1 addition, 1 deletion
mininet/clean.py
mininet/log.py
+8
-10
8 additions, 10 deletions
mininet/log.py
mininet/node.py
+2
-2
2 additions, 2 deletions
mininet/node.py
mininet/term.py
+1
-1
1 addition, 1 deletion
mininet/term.py
with
13 additions
and
17 deletions
examples/nat.py
+
1
−
3
View file @
33e39a24
...
@@ -10,10 +10,9 @@
...
@@ -10,10 +10,9 @@
"""
"""
from
mininet.cli
import
CLI
from
mininet.cli
import
CLI
from
mininet.log
import
lg
,
info
from
mininet.log
import
lg
from
mininet.node
import
Node
from
mininet.node
import
Node
from
mininet.topolib
import
TreeNet
from
mininet.topolib
import
TreeNet
from
mininet.util
import
quietRun
#################################
#################################
def
startNAT
(
root
,
inetIntf
=
'
eth0
'
,
subnet
=
'
10.0/8
'
):
def
startNAT
(
root
,
inetIntf
=
'
eth0
'
,
subnet
=
'
10.0/8
'
):
...
@@ -75,7 +74,6 @@ def connectToInternet( network, switch='s1', rootip='10.254', subnet='10.0/8'):
...
@@ -75,7 +74,6 @@ def connectToInternet( network, switch='s1', rootip='10.254', subnet='10.0/8'):
subnet: Mininet subnet
"""
subnet: Mininet subnet
"""
switch
=
network
.
get
(
switch
)
switch
=
network
.
get
(
switch
)
prefixLen
=
subnet
.
split
(
'
/
'
)[
1
]
prefixLen
=
subnet
.
split
(
'
/
'
)[
1
]
routes
=
[
subnet
]
# host networks to route to
# Create a node in root namespace
# Create a node in root namespace
root
=
Node
(
'
root
'
,
inNamespace
=
False
)
root
=
Node
(
'
root
'
,
inNamespace
=
False
)
...
...
This diff is collapsed.
Click to expand it.
mininet/clean.py
+
1
−
1
View file @
33e39a24
...
@@ -55,7 +55,7 @@ def cleanup():
...
@@ -55,7 +55,7 @@ def cleanup():
sh
(
'
ovs-vsctl del-br
'
+
dp
)
sh
(
'
ovs-vsctl del-br
'
+
dp
)
info
(
"
*** Removing all links of the pattern foo-ethX
\n
"
)
info
(
"
*** Removing all links of the pattern foo-ethX
\n
"
)
links
=
sh
(
"
ip link show | egrep -o
'
(\w+-eth\w+)
'"
).
split
(
'
\n
'
)
links
=
sh
(
r
"
ip link show | egrep -o
'
(\w+-eth\w+)
'"
).
split
(
'
\n
'
)
for
link
in
links
:
for
link
in
links
:
if
link
!=
''
:
if
link
!=
''
:
sh
(
"
ip link del
"
+
link
)
sh
(
"
ip link del
"
+
link
)
...
...
This diff is collapsed.
Click to expand it.
mininet/log.py
+
8
−
10
View file @
33e39a24
...
@@ -60,18 +60,16 @@ class Singleton( type ):
...
@@ -60,18 +60,16 @@ class Singleton( type ):
See http://en.wikipedia.org/wiki/SingletonPattern#Python
See http://en.wikipedia.org/wiki/SingletonPattern#Python
Intended to be used as a __metaclass_ param, as shown for the class
Intended to be used as a __metaclass_ param, as shown for the class
below.
below.
"""
Changed cls first args to mcs to satisfy pylint.
"""
def
__init__
(
cls
,
name
,
bases
,
dict_
):
super
(
Singleton
,
cls
).
__init__
(
name
,
bases
,
dict_
)
cls
.
instance
=
None
def
__init__
(
mcs
,
name
,
bases
,
dict_
):
def
__call__
(
cls
,
*
args
,
**
kw
):
super
(
Singleton
,
mcs
).
__init__
(
name
,
bases
,
dict_
)
if
cls
.
instance
is
None
:
mcs
.
instance
=
None
cls
.
instance
=
super
(
Singleton
,
cls
).
__call__
(
*
args
,
**
kw
)
return
cls
.
instance
def
__call__
(
mcs
,
*
args
,
**
kw
):
if
mcs
.
instance
is
None
:
mcs
.
instance
=
super
(
Singleton
,
mcs
).
__call__
(
*
args
,
**
kw
)
return
mcs
.
instance
class
MininetLogger
(
Logger
,
object
):
class
MininetLogger
(
Logger
,
object
):
...
...
This diff is collapsed.
Click to expand it.
mininet/node.py
+
2
−
2
View file @
33e39a24
...
@@ -759,7 +759,7 @@ def __init__( self, name, dpid=None, opts='', listenPort=None, **params):
...
@@ -759,7 +759,7 @@ def __init__( self, name, dpid=None, opts='', listenPort=None, **params):
def
defaultDpid
(
self
):
def
defaultDpid
(
self
):
"
Derive dpid from switch name, s1 -> 1
"
"
Derive dpid from switch name, s1 -> 1
"
try
:
try
:
dpid
=
int
(
re
.
findall
(
'
\d+
'
,
self
.
name
)[
0
]
)
dpid
=
int
(
re
.
findall
(
r
'
\d+
'
,
self
.
name
)[
0
]
)
dpid
=
hex
(
dpid
)[
2
:
]
dpid
=
hex
(
dpid
)[
2
:
]
dpid
=
'
0
'
*
(
self
.
dpidLen
-
len
(
dpid
)
)
+
dpid
dpid
=
'
0
'
*
(
self
.
dpidLen
-
len
(
dpid
)
)
+
dpid
return
dpid
return
dpid
...
@@ -787,7 +787,7 @@ def sendCmd( self, *cmd, **kwargs ):
...
@@ -787,7 +787,7 @@ def sendCmd( self, *cmd, **kwargs ):
def
connected
(
self
):
def
connected
(
self
):
"
Is the switch connected to a controller? (override this method)
"
"
Is the switch connected to a controller? (override this method)
"
return
False
return
False
and
self
# satisfy pylint
def
__repr__
(
self
):
def
__repr__
(
self
):
"
More informative string representation
"
"
More informative string representation
"
...
...
This diff is collapsed.
Click to expand it.
mininet/term.py
+
1
−
1
View file @
33e39a24
...
@@ -54,7 +54,7 @@ def makeTerm( node, title='Node', term='xterm', display=None ):
...
@@ -54,7 +54,7 @@ def makeTerm( node, title='Node', term='xterm', display=None ):
def
runX11
(
node
,
cmd
):
def
runX11
(
node
,
cmd
):
"
Run an X11 client on a node
"
"
Run an X11 client on a node
"
display
,
tunnel
=
tunnelX11
(
node
)
_
display
,
tunnel
=
tunnelX11
(
node
)
popen
=
node
.
popen
(
cmd
)
popen
=
node
.
popen
(
cmd
)
return
[
tunnel
,
popen
]
return
[
tunnel
,
popen
]
...
...
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