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
ccca871a
Commit
ccca871a
authored
14 years ago
by
Brandon Heller
Browse files
Options
Downloads
Patches
Plain Diff
Add passive listening port
parent
2d48b463
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bin/mn
+5
-1
5 additions, 1 deletion
bin/mn
mininet/net.py
+13
-6
13 additions, 6 deletions
mininet/net.py
mininet/node.py
+4
-1
4 additions, 1 deletion
mininet/node.py
with
22 additions
and
8 deletions
bin/mn
+
5
−
1
View file @
ccca871a
...
...
@@ -176,6 +176,9 @@ class MininetRunner( object ):
'
controller]
'
)
opts
.
add_option
(
'
--innamespace
'
,
action
=
'
store_true
'
,
default
=
False
,
help
=
'
sw and ctrl in namespace?
'
)
opts
.
add_option
(
'
--listenport
'
,
type
=
'
int
'
,
default
=
6634
,
help
=
'
[base port for passive switch listening
'
'
controller]
'
)
opts
.
add_option
(
'
--pre
'
,
type
=
'
string
'
,
default
=
None
,
help
=
'
[CLI script to run before tests]
'
)
opts
.
add_option
(
'
--post
'
,
type
=
'
string
'
,
default
=
None
,
...
...
@@ -222,10 +225,11 @@ class MininetRunner( object ):
xterms
=
self
.
options
.
xterms
mac
=
self
.
options
.
mac
arp
=
self
.
options
.
arp
listenPort
=
self
.
options
.
listenport
mn
=
Mininet
(
topo
,
switch
,
host
,
controller
,
controllerParams
,
inNamespace
=
inNamespace
,
xterms
=
xterms
,
autoSetMacs
=
mac
,
autoStaticArp
=
arp
)
autoStaticArp
=
arp
,
listenPort
=
listenPort
)
if
self
.
options
.
pre
:
CLI
(
mn
,
script
=
self
.
options
.
pre
)
...
...
This diff is collapsed.
Click to expand it.
mininet/net.py
+
13
−
6
View file @
ccca871a
...
...
@@ -108,7 +108,7 @@ def __init__( self, topo=None, switch=KernelSwitch, host=Host,
cparams
=
ControllerParams
(
'
10.0.0.0
'
,
8
),
build
=
True
,
xterms
=
False
,
cleanup
=
False
,
inNamespace
=
False
,
autoSetMacs
=
False
,
autoStaticArp
=
False
):
autoSetMacs
=
False
,
autoStaticArp
=
False
,
listenPort
=
None
):
"""
Create Mininet object.
topo: Topo (topology) object or None
switch: Switch class
...
...
@@ -120,7 +120,9 @@ def __init__( self, topo=None, switch=KernelSwitch, host=Host,
cleanup: if build now, cleanup before creating?
inNamespace: spawn switches and controller in net namespaces?
autoSetMacs: set MAC addrs from topo?
autoStaticArp: set all-pairs static MAC addrs?
"""
autoStaticArp: set all-pairs static MAC addrs?
listenPort: base listening port to open; will be incremented for
each additional switch in the net if inNamespace=False
"""
self
.
switch
=
switch
self
.
host
=
host
self
.
controller
=
controller
...
...
@@ -131,6 +133,7 @@ def __init__( self, topo=None, switch=KernelSwitch, host=Host,
self
.
cleanup
=
cleanup
self
.
autoSetMacs
=
autoSetMacs
self
.
autoStaticArp
=
autoStaticArp
self
.
listenPort
=
listenPort
self
.
hosts
=
[]
self
.
switches
=
[]
...
...
@@ -162,13 +165,17 @@ def addSwitch( self, name, mac=None, ip=None ):
"""
Add switch.
name: name of switch to add
mac: default MAC address for kernel/OVS switch intf 0
returns: added switch
"""
returns: added switch
side effect: increments the listenPort member variable.
"""
if
self
.
switch
==
UserSwitch
:
sw
=
self
.
switch
(
name
,
defaultMAC
=
mac
,
defaultIP
=
ip
,
inNamespace
=
self
.
inNamespace
)
sw
=
self
.
switch
(
name
,
listenPort
=
self
.
listenPort
,
defaultMAC
=
mac
,
defaultIP
=
ip
,
inNamespace
=
self
.
inNamespace
)
else
:
sw
=
self
.
switch
(
name
,
defaultMAC
=
mac
,
defaultIP
=
ip
,
dp
=
self
.
dps
,
sw
=
self
.
switch
(
name
,
listenPort
=
self
.
listenPort
,
defaultMAC
=
mac
,
defaultIP
=
ip
,
dp
=
self
.
dps
,
inNamespace
=
self
.
inNamespace
)
if
not
self
.
inNamespace
:
self
.
listenPort
+=
1
self
.
dps
+=
1
self
.
switches
.
append
(
sw
)
self
.
nameToNode
[
name
]
=
sw
...
...
This diff is collapsed.
Click to expand it.
mininet/node.py
+
4
−
1
View file @
ccca871a
...
...
@@ -434,9 +434,12 @@ class Switch( Node ):
portBase
=
SWITCH_PORT_BASE
# 0 for OF < 1.0, 1 for OF >= 1.0
def
__init__
(
self
,
name
,
opts
=
''
,
**
kwargs
):
def
__init__
(
self
,
name
,
opts
=
''
,
listenPort
=
None
,
**
kwargs
):
Node
.
__init__
(
self
,
name
,
**
kwargs
)
self
.
opts
=
opts
self
.
listenPort
=
listenPort
if
self
.
listenPort
:
self
.
opts
+=
'
--listen=ptcp:%i
'
%
self
.
listenPort
def
sendCmd
(
self
,
*
cmd
,
**
kwargs
):
"""
Send command to Node.
...
...
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