fix all-tests
[nepi.git] / examples / openvswitch / ping_over_udpTapTunnel_performance_test_triangleTopo.py
index 5032822..51e4a03 100644 (file)
@@ -4,9 +4,8 @@
 #    Copyright (C) 2013 INRIA
 #
 #    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation, either version 3 of the License, or
-#    (at your option) any later version.
+#    it under the terms of the GNU General Public License version 2 as
+#    published by the Free Software Foundation;
 #
 #    This program is distributed in the hope that it will be useful,
 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -65,10 +64,11 @@ def add_udptun(ec, tap1, tap2):
     ec.register_connection(tap2, udptun)
     return udptun
 
-def add_vroute(ec, network, tap):
+def add_vroute(ec, network, prefix, tap):
     vroute = ec.register_resource("planetlab::Vroute")
-    ec.set(vroute, "action", "add")
     ec.set(vroute, "network", network)
+    ec.set(vroute, "prefix", prefix)
+    ec.set(vroute, "nexthop", ec.get(tap, "pointopoint"))
     ec.register_connection(vroute, tap)
     return vroute
 
@@ -127,16 +127,16 @@ udptun5 = add_udptun(ec, tap152, tap156)
 udptun6 = add_udptun(ec, tap204, tap206)
 
 ## Create the PlanetLab Route ## 
-vroute1 = add_vroute(ec, "192.168.3.0", tap1)
-vroute2 = add_vroute(ec, "192.168.3.0", tap13)
-vroute3 = add_vroute(ec, "192.168.3.0", tap25)
+vroute1 = add_vroute(ec, "192.168.3.0", "24", tap1)
+vroute2 = add_vroute(ec, "192.168.3.0", "24", tap13)
+vroute3 = add_vroute(ec, "192.168.3.0", "24", tap25)
 
-vroute7 = add_vroute(ec, "192.168.3.8", tap102)
-vroute8 = add_vroute(ec, "192.168.3.0", tap104)
-vroute9 = add_vroute(ec, "192.168.3.24", tap152)
-vroute10 = add_vroute(ec, "192.168.3.0", tap156)
-vroute11 = add_vroute(ec, "192.168.3.24", tap204)
-vroute12 = add_vroute(ec, "192.168.3.8", tap206)
+vroute7 = add_vroute(ec, "192.168.3.8", "29", tap102)
+vroute8 = add_vroute(ec, "192.168.3.0", "29", tap104)
+vroute9 = add_vroute(ec, "192.168.3.24", "29", tap152)
+vroute10 = add_vroute(ec, "192.168.3.0", "29", tap156)
+vroute11 = add_vroute(ec, "192.168.3.24", "29", tap204)
+vroute12 = add_vroute(ec, "192.168.3.8", "29", tap206)
 
 ## Create all the Ping ## 
 
@@ -180,44 +180,42 @@ ping23 = ec.trace(app23, 'stdout')
 ping24 = ec.trace(app24, 'stdout')
 ping25 = ec.trace(app25, 'stdout')
 
-f = open("examples/openvswitch/ping_over_udpTapTunnel_performance_test.txt", 'w')
+with open("examples/openvswitch/ping_over_udpTapTunnel_performance_test.txt", 'w') as f:
 
-if not ping25:
-  ec.shutdown()
+    if not ping25:
+        ec.shutdown()
   
 
-f.write("************ Ping From Host 1 : 192.168.3.1 ********************\n\n")
-f.write(ping1)
-f.write("----------------------------------------\n\n")
-f.write(ping2)
-f.write("----------------------------------------\n\n")
-f.write(ping3)
-f.write("----------------------------------------\n\n")
-f.write(ping4)
-f.write("----------------------------------------\n\n")
-f.write(ping5)
-f.write("************ Ping From Host 2 : 192.168.3.13 ********************\n\n")
-f.write(ping11)
-f.write("----------------------------------------\n\n")
-f.write(ping12)
-f.write("----------------------------------------\n\n")
-f.write(ping13)
-f.write("----------------------------------------\n\n")
-f.write(ping14)
-f.write("----------------------------------------\n\n")
-f.write(ping15)
-f.write("************ Ping From Host 3 : 192.168.3.25 ********************\n\n")
-f.write(ping21)
-f.write("----------------------------------------\n\n")
-f.write(ping22)
-f.write("----------------------------------------\n\n")
-f.write(ping23)
-f.write("----------------------------------------\n\n")
-f.write(ping24)
-f.write("----------------------------------------\n\n")
-f.write(ping25)
-
-f.close()
+    f.write("************ Ping From Host 1 : 192.168.3.1 ********************\n\n")
+    f.write(ping1)
+    f.write("----------------------------------------\n\n")
+    f.write(ping2)
+    f.write("----------------------------------------\n\n")
+    f.write(ping3)
+    f.write("----------------------------------------\n\n")
+    f.write(ping4)
+    f.write("----------------------------------------\n\n")
+    f.write(ping5)
+    f.write("************ Ping From Host 2 : 192.168.3.13 ********************\n\n")
+    f.write(ping11)
+    f.write("----------------------------------------\n\n")
+    f.write(ping12)
+    f.write("----------------------------------------\n\n")
+    f.write(ping13)
+    f.write("----------------------------------------\n\n")
+    f.write(ping14)
+    f.write("----------------------------------------\n\n")
+    f.write(ping15)
+    f.write("************ Ping From Host 3 : 192.168.3.25 ********************\n\n")
+    f.write(ping21)
+    f.write("----------------------------------------\n\n")
+    f.write(ping22)
+    f.write("----------------------------------------\n\n")
+    f.write(ping23)
+    f.write("----------------------------------------\n\n")
+    f.write(ping24)
+    f.write("----------------------------------------\n\n")
+    f.write(ping25)
 
 # Delete the overlay network
 ec.shutdown()