Support more topologies

This commit is contained in:
Brandon Heller
2010-01-03 02:44:08 -08:00
parent ac65ea3ff3
commit c98514ae44
3 changed files with 42 additions and 27 deletions
+33 -22
View File
@@ -7,7 +7,9 @@ Test creation and all-pairs ping for each included mininet topo type.
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 @@ from mininet.topo import TreeTopo
# 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 @@ class testMinimal(unittest.TestCase):
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()