From 4ccc7ee941d35f30027264ab244b0656d98ecf0c Mon Sep 17 00:00:00 2001
From: Bob Lantz <rlantz@cs.stanford.edu>
Date: Thu, 10 Dec 2009 01:47:00 -0800
Subject: [PATCH] Added examples, which may or may not work yet.

---
 examples/bigTreePing64.py   | 27 +++++++++++++++++++++++++++
 examples/linearBandwidth.py | 36 ++++++++++++++++++++++++++++++++++++
 mininet.py                  |  1 +
 3 files changed, 64 insertions(+)
 create mode 100755 examples/bigTreePing64.py
 create mode 100755 examples/linearBandwidth.py

diff --git a/examples/bigTreePing64.py b/examples/bigTreePing64.py
new file mode 100755
index 00000000..2ae71433
--- /dev/null
+++ b/examples/bigTreePing64.py
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+
+from mininet import init, TreeNet, iperfTest
+
+def bigTreePing64():
+   """Create a tree network of depth 4 and fanout 2, and 
+      test connectivity using pingTest."""
+
+   results = {}
+   
+   print "*** Testing Mininet with kernel and user datapath"
+   
+   for datapath in [ 'kernel', 'user' ]:
+      k = datapath == 'kernel'
+      results[ datapath ] = []
+      for switchCount in range( 1, 4 ):
+         print "*** Creating Linear Network of size", switchCount
+         network = TreeNet( depth=4, fanout=2, kernel=k )
+         testResult = network.run( iperfTest )
+         results[ datapath ] += testResult
+         
+   print "*** Test results:", results
+      
+if __name__ == '__main__':
+   init()
+   linearBandwidthTest()
+
diff --git a/examples/linearBandwidth.py b/examples/linearBandwidth.py
new file mode 100755
index 00000000..7c38dee7
--- /dev/null
+++ b/examples/linearBandwidth.py
@@ -0,0 +1,36 @@
+#!/usr/bin/python
+
+from mininet import init, LinearNet, iperfTest
+
+def linearBandwidthTest():
+   """Test bandwidth on a linear network of varying size, using both
+      the kernel and user datapaths."""
+  
+   print "*** Testing Mininet with kernel and user datapath"
+   
+   datapaths = [ 'kernel' ]
+   results = {}
+      
+   for datapath in datapaths:
+      k = datapath == 'kernel'
+      results[ datapath ] = []
+      for switchCount in range( 1, 17, 2 ):
+         print "*** Creating Linear Network of size", switchCount
+         network = LinearNet( switchCount, k)
+         bandwidth = network.run( iperfTest )
+         results[ datapath ] += [ ( switchCount, bandwidth ) ]
+         
+   for datapath in datapaths:
+      print
+      print "*** Linear network results for", datapath, "datapath"
+      print
+      result = results[ datapath ]  
+      for switchCount, bandwidth in result:
+         print "switchCount:", switchCount, "bandwidth:", bandwidth[ 0 ]
+       
+if __name__ == '__main__':
+   init()
+   linearBandwidthTest()
+   exit( 1 )
+
+   
\ No newline at end of file
diff --git a/mininet.py b/mininet.py
index 78c2ddb9..ac942335 100755
--- a/mininet.py
+++ b/mininet.py
@@ -752,6 +752,7 @@ def init():
 if __name__ == '__main__':
    init()
    results = {}
+   exit( 1 )
    print "*** Testing Mininet with kernel and user datapath"
    for datapath in [ 'kernel', 'user' ]:
       k = datapath == 'kernel'
-- 
GitLab