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
72fd120d
Commit
72fd120d
authored
10 years ago
by
Cody Burkard
Browse files
Options
Downloads
Patches
Plain Diff
added default controller class
parent
1aed2b8a
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
+3
-2
3 additions, 2 deletions
bin/mn
mininet/net.py
+4
-3
4 additions, 3 deletions
mininet/net.py
mininet/node.py
+9
-0
9 additions, 0 deletions
mininet/node.py
with
16 additions
and
5 deletions
bin/mn
+
3
−
2
View file @
72fd120d
...
...
@@ -25,7 +25,7 @@ from mininet.cli import CLI
from
mininet.log
import
lg
,
LEVELS
,
info
,
debug
,
error
from
mininet.net
import
Mininet
,
MininetWithControlNet
,
VERSION
from
mininet.node
import
(
Host
,
CPULimitedHost
,
Controller
,
OVSController
,
NOX
,
RemoteController
,
UserSwitch
,
OVSKernelSwitch
,
NOX
,
RemoteController
,
DefaultController
,
UserSwitch
,
OVSKernelSwitch
,
OVSLegacyKernelSwitch
,
IVSSwitch
)
from
mininet.link
import
Link
,
TCLink
from
mininet.topo
import
SingleSwitchTopo
,
LinearTopo
,
SingleSwitchReversedTopo
...
...
@@ -53,11 +53,12 @@ HOSTS = { 'proc': Host,
'
rt
'
:
custom
(
CPULimitedHost
,
sched
=
'
rt
'
),
'
cfs
'
:
custom
(
CPULimitedHost
,
sched
=
'
cfs
'
)
}
CONTROLLERDEF
=
'
ovsc
'
CONTROLLERDEF
=
'
default
'
CONTROLLERS
=
{
'
ref
'
:
Controller
,
'
ovsc
'
:
OVSController
,
'
nox
'
:
NOX
,
'
remote
'
:
RemoteController
,
'
default
'
:
DefaultController
,
'
none
'
:
lambda
name
:
None
}
LINKDEF
=
'
default
'
...
...
This diff is collapsed.
Click to expand it.
mininet/net.py
+
4
−
3
View file @
72fd120d
...
...
@@ -95,7 +95,7 @@
from
mininet.cli
import
CLI
from
mininet.log
import
info
,
error
,
debug
,
output
from
mininet.node
import
Host
,
OVSKernelSwitch
,
Controller
from
mininet.node
import
Host
,
OVSKernelSwitch
,
DefaultController
,
Controller
from
mininet.link
import
Link
,
Intf
from
mininet.util
import
quietRun
,
fixLimits
,
numCores
,
ensureRoot
from
mininet.util
import
macColonHex
,
ipStr
,
ipParse
,
netParse
,
ipAdd
...
...
@@ -213,16 +213,17 @@ def addController( self, name='c0', controller=None, **params ):
if
not
controller
:
controller
=
self
.
controller
# Construct new controller if one is not given
if
isinstance
(
name
,
Controller
):
if
isinstance
(
name
,
Controller
):
controller_new
=
name
# Pylint thinks controller is a str()
# pylint: disable=E1103
name
=
controller_new
.
name
# pylint: enable=E1103
else
:
# bookmark
controller_new
=
controller
(
name
,
**
params
)
# Add new controller to net
if
controller_new
:
# allow controller-less setups
if
controller_new
:
# allow controller-less setups
self
.
controllers
.
append
(
controller_new
)
self
.
nameToNode
[
name
]
=
controller_new
return
controller_new
...
...
This diff is collapsed.
Click to expand it.
mininet/node.py
+
9
−
0
View file @
72fd120d
...
...
@@ -1278,6 +1278,15 @@ def __repr__( self ):
self
.
__class__
.
__name__
,
self
.
name
,
self
.
IP
(),
self
.
port
,
self
.
pid
)
class
DefaultController
(
Controller
):
"
find any controller that is available and run it
"
def
__init__
(
self
,
name
,
**
kwargs
):
"
search for any installed controller
"
controllers
=
[
'
controller
'
,
'
ovs-controller
'
,
'
test-controller
'
]
# , 'pox', 'ryu' ] # test-controller is the important part
for
c
in
controllers
:
if
quietRun
(
"
which
"
+
c
):
Controller
.
__init__
(
self
,
name
,
controller
=
c
,
**
kwargs
)
break
class
OVSController
(
Controller
):
"
Open vSwitch controller
"
...
...
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