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
ca58c896
Commit
ca58c896
authored
15 years ago
by
Brandon Heller
Browse files
Options
Downloads
Patches
Plain Diff
Restore user-space switch option
Switches and controller in root namespace only, for now.
parent
d856c818
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_run.py
+7
-2
7 additions, 2 deletions
bin/mn_run.py
mininet/net.py
+4
-11
4 additions, 11 deletions
mininet/net.py
mininet/node.py
+11
-7
11 additions, 7 deletions
mininet/node.py
with
22 additions
and
20 deletions
bin/mn_run.py
+
7
−
2
View file @
ca58c896
...
...
@@ -16,7 +16,7 @@
from
mininet.logging_mod
import
lg
,
set_loglevel
,
LEVELS
from
mininet.net
import
Mininet
,
init
from
mininet.node
import
KernelSwitch
,
Host
,
Controller
,
ControllerParams
,
NOX
from
mininet.node
import
RemoteController
from
mininet.node
import
RemoteController
,
UserSwitch
from
mininet.topo
import
SingleSwitchTopo
,
LinearTopo
,
SingleSwitchReversedTopo
# built in topologies, created only when run
...
...
@@ -38,7 +38,8 @@
TOPOS
.
update
(
TOPOS_RIPCORD
)
SWITCH_DEF
=
'
kernel
'
SWITCHES
=
{
'
kernel
'
:
KernelSwitch
}
SWITCHES
=
{
'
kernel
'
:
KernelSwitch
,
'
user
'
:
UserSwitch
}
HOST_DEF
=
'
process
'
HOSTS
=
{
'
process
'
:
Host
}
...
...
@@ -115,6 +116,8 @@ def parse_args(self):
opts
.
add_option
(
'
--port
'
,
type
=
'
string
'
,
default
=
6633
,
help
=
'
[port integer for a listening remote
'
'
controller]
'
)
opts
.
add_option
(
'
--in_namespace
'
,
action
=
'
store_true
'
,
default
=
False
,
help
=
'
sw and ctrl in namespace?
'
)
self
.
options
=
opts
.
parse_args
()[
0
]
def
setup
(
self
):
...
...
@@ -147,10 +150,12 @@ def begin(self):
port
=
self
.
options
.
port
)
controller_params
=
ControllerParams
(
0x0a000000
,
8
)
# 10.0.0.0/8
in_namespace
=
self
.
options
.
in_namespace
xterms
=
self
.
options
.
xterms
mac
=
self
.
options
.
mac
arp
=
self
.
options
.
arp
mn
=
Mininet
(
topo
,
switch
,
host
,
controller
,
controller_params
,
in_namespace
=
in_namespace
,
xterms
=
xterms
,
auto_set_macs
=
mac
,
auto_static_arp
=
arp
)
...
...
This diff is collapsed.
Click to expand it.
mininet/net.py
+
4
−
11
View file @
ca58c896
...
...
@@ -92,7 +92,7 @@ def __init__(self, topo, switch, host, controller, cparams,
@param now build now?
@param xterms if build now, spawn xterms?
@param cleanup if build now, cleanup before creating?
@param in_namespace spawn switches and
hosts in their own
namespace?
@param in_namespace spawn switches and
controller in net
namespace
s
?
@param auto_set_macs set MAC addrs to DPIDs?
@param auto_static_arp set all-pairs static MAC addrs?
'''
...
...
@@ -112,8 +112,6 @@ def __init__(self, topo, switch, host, controller, cparams,
self
.
terms
=
[]
# list of spawned xterm processes
self
.
kernel
=
True
#temporary!
if
build
:
self
.
build
()
...
...
@@ -178,7 +176,7 @@ def _add_controller(self, controller):
@param controller Controller class
'''
controller
=
self
.
controller
(
'
c0
'
,
not
self
.
kernel
)
controller
=
self
.
controller
(
'
c0
'
,
self
.
in_namespace
)
if
controller
:
# allow controller-less setups
self
.
controllers
[
'
c0
'
]
=
controller
...
...
@@ -271,11 +269,6 @@ def build(self):
if
self
.
cleanup
:
pass
# cleanup
# validate topo?
kernel
=
self
.
kernel
if
kernel
:
lg
.
info
(
'
*** Using kernel datapath
\n
'
)
else
:
lg
.
info
(
'
*** Using user datapath
\n
'
)
lg
.
info
(
'
*** Adding controller
\n
'
)
self
.
_add_controller
(
self
.
controller
)
lg
.
info
(
'
*** Creating network
\n
'
)
...
...
@@ -287,13 +280,13 @@ def build(self):
for
switch
in
sorted
(
self
.
topo
.
switches
()):
self
.
_add_switch
(
switch
)
lg
.
info
(
'
0x%x
'
%
switch
)
lg
.
info
(
'
\n
*** Adding edges:
'
)
lg
.
info
(
'
\n
*** Adding edges:
\n
'
)
for
src
,
dst
in
sorted
(
self
.
topo
.
edges
()):
self
.
_add_link
(
src
,
dst
)
lg
.
info
(
'
(0x%x, 0x%x)
'
%
(
src
,
dst
))
lg
.
info
(
'
\n
'
)
if
not
kernel
:
if
self
.
in_namespace
:
lg
.
info
(
'
*** Configuring control network
\n
'
)
self
.
_configureControlNetwork
()
...
...
This diff is collapsed.
Click to expand it.
mininet/node.py
+
11
−
7
View file @
ca58c896
...
...
@@ -259,13 +259,17 @@ def monitor(self):
return
True
,
''
class
UserSwitch
(
Switch
):
'''
User-space switch.
Currently only works in the root namespace.
'''
def
__init__
(
self
,
name
):
'''
Init.
@param name
'''
Node
.
__init__
(
self
,
name
,
inNamespace
=
Tru
e
)
Node
.
__init__
(
self
,
name
,
inNamespace
=
Fals
e
)
def
start
(
self
,
controllers
):
'''
Start OpenFlow reference user datapath.
...
...
@@ -274,17 +278,17 @@ def start(self, controllers):
@param controllers dict of controller names to objects
'''
if
'
c0
'
not
in
controller
:
if
'
c0
'
not
in
controller
s
:
raise
Exception
(
'
User datapath start() requires controller c0
'
)
controller
=
controllers
[
'
c0
'
]
ofdlog
=
'
/tmp/
'
+
self
.
name
+
'
-ofd.log
'
ofplog
=
'
/tmp/
'
+
self
.
name
+
'
-ofp.log
'
self
.
cmd
(
'
ifconfig lo up
'
)
intfs
=
self
.
intfs
[
1
:]
# 0 is mgmt interface
self
.
cmdPrint
(
'
ofdatapath -i
'
+
'
,
'
.
join
(
intfs
)
+
'
ptcp:
1>
'
+
ofdlog
+
'
2>
'
+
ofdlog
+
'
&
'
)
self
.
cmdPrint
(
'
ofprotocol
tcp:
'
+
controller
.
IP
()
+
'
tcp:localhost
--fail=closed 1>
'
+
ofplog
+
'
2>
'
+
intfs
=
self
.
intfs
self
.
cmdPrint
(
'
ofdatapath -i
'
+
'
,
'
.
join
(
intfs
)
+
'
punix:/tmp/
'
+
self
.
name
+
'
1>
'
+
ofdlog
+
'
2>
'
+
ofdlog
+
'
&
'
)
self
.
cmdPrint
(
'
ofprotocol
unix:/tmp/
'
+
self
.
name
+
'
tcp:
'
+
controller
.
IP
()
+
'
--fail=closed 1>
'
+
ofplog
+
'
2>
'
+
ofplog
+
'
&
'
)
def
stop
(
self
):
...
...
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