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
c98514ae
Commit
c98514ae
authored
15 years ago
by
Brandon Heller
Browse files
Options
Downloads
Patches
Plain Diff
Support more topologies
parent
ac65ea3f
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
-3
7 additions, 3 deletions
bin/mn_run.py
mininet/test/test_nets.py
+33
-22
33 additions, 22 deletions
mininet/test/test_nets.py
mininet/topo.py
+2
-2
2 additions, 2 deletions
mininet/topo.py
with
42 additions
and
27 deletions
bin/mn_run.py
+
7
−
3
View file @
c98514ae
...
...
@@ -7,7 +7,7 @@
from
optparse
import
OptionParser
import
time
from
ripcord.topo
import
FatTreeTopo
from
ripcord.topo
import
FatTreeTopo
,
SingleSwitchTopo
,
LinearTopo
from
mininet.logging_mod
import
lg
,
set_loglevel
,
LEVELS
from
mininet.net
import
Mininet
,
init
...
...
@@ -16,12 +16,16 @@
# built in topologies, created only when run
TOPO_DEF
=
'
minimal
'
TOPOS
=
{
'
minimal
'
:
(
lambda
:
TreeTopo
(
depth
=
2
,
fanout
=
2
)),
TOPOS
=
{
'
minimal
'
:
(
lambda
:
SingleSwitchTopo
(
k
=
2
)),
'
tree16
'
:
(
lambda
:
TreeTopo
(
depth
=
3
,
fanout
=
4
)),
'
tree64
'
:
(
lambda
:
TreeTopo
(
depth
=
4
,
fanout
=
4
)),
'
tree1024
'
:
(
lambda
:
TreeTopo
(
depth
=
3
,
fanout
=
32
)),
'
fattree4
'
:
(
lambda
:
FatTreeTopo
(
k
=
4
)),
'
fattree6
'
:
(
lambda
:
FatTreeTopo
(
k
=
6
))}
'
fattree6
'
:
(
lambda
:
FatTreeTopo
(
k
=
6
)),
'
single4
'
:
(
lambda
:
SingleSwitchTopo
(
k
=
4
)),
'
single100
'
:
(
lambda
:
SingleSwitchTopo
(
k
=
100
)),
'
linear2
'
:
(
lambda
:
LinearTopo
(
k
=
2
)),
'
linear100
'
:
(
lambda
:
LinearTopo
(
k
=
100
))}
SWITCH_DEF
=
'
kernel
'
SWITCHES
=
{
'
kernel
'
:
KernelSwitch
}
...
...
This diff is collapsed.
Click to expand it.
mininet/test/test_nets.py
+
33
−
22
View file @
c98514ae
...
...
@@ -7,7 +7,9 @@
from
time
import
sleep
import
unittest
from
mininet.net
import
init
,
Mininet
#, DATAPATHS
from
ripcord.topo
import
SingleSwitchTopo
,
LinearTopo
from
mininet.net
import
init
,
Mininet
from
mininet.node
import
KernelSwitch
,
Host
,
ControllerParams
from
mininet.node
import
Controller
from
mininet.topo
import
TreeTopo
...
...
@@ -15,18 +17,39 @@
# temporary, until user-space side is tested
SWITCHES
=
{
'
kernel
'
:
KernelSwitch
}
class
testMinimal
(
unittest
.
TestCase
):
'''
For each datapath type, test ping with a minimal topology.
Each topology has two hosts and one switch.
'''
class
testSingleSwitch
(
unittest
.
TestCase
):
'''
For each datapath type, test ping with single switch topologies.
'''
def
testMinimal
(
self
):
'''
Ping test with both datapaths on minimal topology
'''
init
()
for
switch
in
SWITCHES
.
values
():
controller_params
=
ControllerParams
(
0x0a000000
,
8
)
# 10.0.0.0/8
mn
=
Mininet
(
TreeTopo
(),
switch
,
Host
,
Controller
,
mn
=
Mininet
(
SingleSwitchTopo
(),
switch
,
Host
,
Controller
,
controller_params
)
dropped
=
mn
.
run
(
'
ping
'
)
self
.
assertEqual
(
dropped
,
0
)
def
testSingle5
(
self
):
'''
Ping test with both datapaths on 5-host single-switch topology
'''
init
()
for
switch
in
SWITCHES
.
values
():
controller_params
=
ControllerParams
(
0x0a000000
,
8
)
# 10.0.0.0/8
mn
=
Mininet
(
SingleSwitchTopo
(
k
=
5
),
switch
,
Host
,
Controller
,
controller_params
)
dropped
=
mn
.
run
(
'
ping
'
)
self
.
assertEqual
(
dropped
,
0
)
class
testLinear
(
unittest
.
TestCase
):
'''
For each datapath type, test all-pairs ping with LinearNet.
'''
def
testLinear5
(
self
):
'''
Ping test with both datapaths on a 5-switch topology
'''
init
()
for
switch
in
SWITCHES
.
values
():
controller_params
=
ControllerParams
(
0x0a000000
,
8
)
# 10.0.0.0/8
mn
=
Mininet
(
LinearTopo
(
k
=
5
),
switch
,
Host
,
Controller
,
controller_params
)
dropped
=
mn
.
run
(
'
ping
'
)
self
.
assertEqual
(
dropped
,
0
)
...
...
@@ -35,29 +58,17 @@ def testMinimal(self):
class
testTree
(
unittest
.
TestCase
):
'''
For each datapath type, test all-pairs ping with TreeNet.
'''
def
testTree
16
(
self
):
'''
Ping test with both datapaths on
16
-host topology
'''
def
testTree
9
(
self
):
'''
Ping test with both datapaths on
9
-host topology
'''
init
()
for
switch
in
SWITCHES
.
values
():
controller_params
=
ControllerParams
(
0x0a000000
,
8
)
# 10.0.0.0/8
tree_topo
=
TreeTopo
(
depth
=
3
,
fanout
=
4
)
tree_topo
=
TreeTopo
(
depth
=
3
,
fanout
=
3
)
mn
=
Mininet
(
tree_topo
,
switch
,
Host
,
Controller
,
controller_params
)
dropped
=
mn
.
run
(
'
ping
'
)
self
.
assertEqual
(
dropped
,
0
)
#class testLinear(unittest.TestCase):
# '''For each datapath type, test all-pairs ping with LinearNet.'''
#
# def testLinear10(self):
# '''Ping test with both datapaths on 10-switch topology'''
# init()
# for datapath in DATAPATHS:
# k = datapath == 'kernel'
# network = network = LinearNet(10, kernel=k)
# dropped = network.run(pingTest)
# self.assertEqual(dropped, 0)
if
__name__
==
'
__main__
'
:
unittest
.
main
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
mininet/topo.py
+
2
−
2
View file @
c98514ae
...
...
@@ -87,9 +87,9 @@ def __init__(self, depth = 2, fanout = 2, speed = 1.0, enable_all = True):
self
.
enable_all
()
def
port
(
self
,
src
,
dst
):
'''
Get port number
(optional)
'''
Get port number
Note that the topological significance of DPIDs
in FatTreeTopo
enables
Note that the topological significance of DPIDs enables
this function to be implemented statelessly.
@param src source switch DPID
...
...
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