Skip to content
Snippets Groups Projects
Commit c98514ae authored by Brandon Heller's avatar Brandon Heller
Browse files

Support more topologies

parent ac65ea3f
No related branches found
No related tags found
No related merge requests found
......@@ -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}
......
......@@ -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 testTree16(self):
'''Ping test with both datapaths on 16-host topology'''
def testTree9(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
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment