Move TreeNet to new Mininet API

Also remove all non-object-oriented legacy Mininet code and update
tests.

User-space compatibility is untested, but most of the code for it is
still in.
This commit is contained in:
Brandon Heller
2009-12-26 14:25:48 -08:00
parent e3621eb057
commit 8b5062a3a1
5 changed files with 670 additions and 976 deletions
+31 -17
View File
@@ -7,7 +7,13 @@ Test creation and all-pairs ping for each included mininet topo type.
from time import sleep
import unittest
from mininet.net import init, TreeNet, LinearNet, pingTest, DATAPATHS
from mininet.net import init, Mininet #, DATAPATHS
from mininet.node import Switch, Host, NOXController, ControllerParams
from mininet.node import Controller
from mininet.topo import TreeTopo
# temporary, until user-space side is tested
DATAPATHS = ['kernel']
class testMinimal(unittest.TestCase):
'''For each datapath type, test ping with a minimal topology.
@@ -20,9 +26,13 @@ class testMinimal(unittest.TestCase):
init()
for datapath in DATAPATHS:
k = datapath == 'kernel'
network = TreeNet(depth = 1, fanout = 2, kernel = k)
dropped = network.run(pingTest)
controller_params = ControllerParams(0x0a000000, 8) # 10.0.0.0/8
mn = Mininet(TreeTopo(), Switch, Host, Controller,
controller_params)
mn.start()
dropped = mn.ping_test()
self.assertEqual(dropped, 0)
mn.stop()
class testTree(unittest.TestCase):
@@ -33,22 +43,26 @@ class testTree(unittest.TestCase):
init()
for datapath in DATAPATHS:
k = datapath == 'kernel'
network = TreeNet(depth = 2, fanout = 4, kernel = k)
dropped = network.run(pingTest)
controller_params = ControllerParams(0x0a000000, 8) # 10.0.0.0/8
tree_topo = TreeTopo(depth = 3, fanout = 4)
mn = Mininet(tree_topo, Switch, Host, Controller,
controller_params)
mn.start()
dropped = mn.ping_test()
self.assertEqual(dropped, 0)
mn.stop()
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)
#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__':