From 15f37cc2924947fc432e465b4ed04852ab9d68f7 Mon Sep 17 00:00:00 2001
From: Brandon Heller <brandonh@stanford.edu>
Date: Fri, 18 Dec 2009 20:03:19 -0800
Subject: [PATCH] Add LinearNet test case

---
 mininet/test/test_nets.py | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/mininet/test/test_nets.py b/mininet/test/test_nets.py
index 87dca058..215b1867 100755
--- a/mininet/test/test_nets.py
+++ b/mininet/test/test_nets.py
@@ -7,7 +7,7 @@
 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 @@ def testTree16(self):
             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
-- 
GitLab