Add LinearNet test case

This commit is contained in:
Brandon Heller
2009-12-18 20:36:48 -08:00
parent 7b804ffbae
commit 15f37cc292
+16 -3
View File
@@ -7,7 +7,7 @@ Test creation and all-pairs ping for each included mininet topo type.
from time import sleep
import unittest
from mininet.mininet import init, TreeNet, pingTest, DATAPATHS
from mininet.mininet import init, TreeNet, LinearNet, pingTest, DATAPATHS
class testMinimal(unittest.TestCase):
'''For each datapath type, test ping with a minimal topology.
@@ -16,7 +16,7 @@ class testMinimal(unittest.TestCase):
'''
def testMinimal(self):
'''Ping test with user-space datapath on minimal topology'''
'''Ping test with both datapaths on minimal topology'''
init()
for datapath in DATAPATHS:
k = datapath == 'kernel'
@@ -29,7 +29,7 @@ class testTree(unittest.TestCase):
'''For each datapath type, test all-pairs ping with TreeNet.'''
def testTree16(self):
'''Ping test with user-space datapath on minimal topology'''
'''Ping test with both datapaths on 16-host topology'''
init()
for datapath in DATAPATHS:
k = datapath == 'kernel'
@@ -38,5 +38,18 @@ class testTree(unittest.TestCase):
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()