use print() - import print_function - should be fine for both py2 and py3
[nepi.git] / test / resources / linux / ns3 / ns3simulation.py
old mode 100644 (file)
new mode 100755 (executable)
index 8501f64..5f7ce29
@@ -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
@@ -18,6 +17,8 @@
 #
 # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
 
+from __future__ import print_function
+
 from nepi.execution.ec import ExperimentController 
 from nepi.execution.trace import TraceAttr
 
@@ -136,7 +137,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
     def t_p2p_ping(self, host, user = None, identity = None):
         ec = ExperimentController(exp_id = "test-ns3-p2p-ping")
         
-        node = ec.register_resource("LinuxNode")
+        node = ec.register_resource("linux::Node")
         if host == "localhost":
             ec.set(node, "hostname", "localhost")
         else:
@@ -147,7 +148,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
         ec.set(node, "cleanProcesses", True)
         #ec.set(node, "cleanHome", True)
 
-        simu = ec.register_resource("LinuxNS3Simulation")
+        simu = ec.register_resource("linux::ns3::Simulation")
         ec.set(simu, "verbose", True)
         ec.register_connection(simu, node)
 
@@ -187,7 +188,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
     def t_csma_ping(self, host, user = None, identity = None):
         ec = ExperimentController(exp_id = "test-ns3-csma-ping")
         
-        node = ec.register_resource("LinuxNode")
+        node = ec.register_resource("linux::Node")
         if host == "localhost":
             ec.set(node, "hostname", "localhost")
         else:
@@ -198,7 +199,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
         ec.set(node, "cleanProcesses", True)
         #ec.set(node, "cleanHome", True)
 
-        simu = ec.register_resource("LinuxNS3Simulation")
+        simu = ec.register_resource("linux::ns3::Simulation")
         ec.set(simu, "verbose", True)
         ec.register_connection(simu, node)
 
@@ -238,7 +239,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
     def t_user_sources(self, host, user = None, identity = None):
         ec = ExperimentController(exp_id = "test-ns3-user-sources")
         
-        node = ec.register_resource("LinuxNode")
+        node = ec.register_resource("linux::Node")
         if host == "localhost":
             ec.set(node, "hostname", "localhost")
         else:
@@ -249,7 +250,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
         ec.set(node, "cleanProcesses", True)
         #ec.set(node, "cleanHome", True)
 
-        simu = ec.register_resource("LinuxNS3Simulation")
+        simu = ec.register_resource("linux::ns3::Simulation")
         ec.set(simu, "verbose", True)
         sources = os.path.join(os.path.dirname(os.path.realpath(__file__)), 
                 "ns-3.18-user.tar.gz")
@@ -293,7 +294,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
     def t_compile_debug_mode(self, host, user = None, identity = None):
         ec = ExperimentController(exp_id = "test-ns3-debug-mode")
         
-        node = ec.register_resource("LinuxNode")
+        node = ec.register_resource("linux::Node")
         if host == "localhost":
             ec.set(node, "hostname", host)
         else:
@@ -304,7 +305,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
         ec.set(node, "cleanProcesses", True)
         #ec.set(node, "cleanHome", True)
 
-        simu = ec.register_resource("LinuxNS3Simulation")
+        simu = ec.register_resource("linux::ns3::Simulation")
         ec.set(simu, "verbose", True)
         ec.set(simu, "nsLog", "V4Ping:Node")
         ec.set(simu, "buildMode", "debug")
@@ -350,7 +351,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
     def t_real_time(self, host, user = None, identity = None):
         ec = ExperimentController(exp_id = "test-ns3-real-time")
         
-        node = ec.register_resource("LinuxNode")
+        node = ec.register_resource("linux::Node")
         if host == "localhost":
             ec.set(node, "hostname", "localhost")
         else:
@@ -361,7 +362,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
 
         #ec.set(node, "cleanHome", True)
 
-        simu = ec.register_resource("LinuxNS3Simulation")
+        simu = ec.register_resource("linux::ns3::Simulation")
         ec.set(simu, "simulatorImplementationType", "ns3::RealtimeSimulatorImpl")
         ec.set(simu, "checksumEnabled", True)
         ec.set(simu, "verbose", True)
@@ -411,7 +412,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
     def t_traces(self, host, user = None, identity = None):
         ec = ExperimentController(exp_id = "test-ns3-traces")
         
-        node = ec.register_resource("LinuxNode")
+        node = ec.register_resource("linux::Node")
         if host == "localhost":
             ec.set(node, "hostname", "localhost")
         else:
@@ -422,7 +423,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
         ec.set(node, "cleanProcesses", True)
         #ec.set(node, "cleanHome", True)
 
-        simu = ec.register_resource("LinuxNS3Simulation")
+        simu = ec.register_resource("linux::ns3::Simulation")
         ec.set(simu, "verbose", True)
         ec.register_connection(simu, node)
 
@@ -494,7 +495,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
 
         ec = ExperimentController(exp_id = "test-ns3-wifi-ping")
         
-        node = ec.register_resource("LinuxNode")
+        node = ec.register_resource("linux::Node")
         if host == "localhost":
             ec.set(node, "hostname", "localhost")
         else:
@@ -505,7 +506,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
         ec.set(node, "cleanProcesses", True)
         #ec.set(node, "cleanHome", True)
 
-        simu = ec.register_resource("LinuxNS3Simulation")
+        simu = ec.register_resource("linux::ns3::Simulation")
         ec.set(simu, "verbose", True)
         ec.register_connection(simu, node)
 
@@ -557,7 +558,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
         """
         ec = ExperimentController(exp_id = "test-ns3-routes")
         
-        node = ec.register_resource("LinuxNode")
+        node = ec.register_resource("linux::Node")
         if host == "localhost":
             ec.set(node, "hostname", host)
         else:
@@ -568,7 +569,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
         ec.set(node, "cleanProcesses", True)
         #ec.set(node, "cleanHome", True)
 
-        simu = ec.register_resource("LinuxNS3Simulation")
+        simu = ec.register_resource("linux::ns3::Simulation")
         ec.set(simu, "verbose", True)
         ec.register_connection(simu, node)
 
@@ -674,7 +675,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
         """
         ec = ExperimentController(exp_id = "test-ns3-routing")
         
-        node = ec.register_resource("LinuxNode")
+        node = ec.register_resource("linux::Node")
         if host == "localhost":
             ec.set(node, "hostname", "localhost")
         else:
@@ -685,7 +686,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
         ec.set(node, "cleanProcesses", True)
         #ec.set(node, "cleanHome", True)
 
-        simu = ec.register_resource("LinuxNS3Simulation")
+        simu = ec.register_resource("linux::ns3::Simulation")
         ec.set(simu, "verbose", True)
         ec.set(simu, "populateRoutingTables", True)
         ec.register_connection(simu, node)
@@ -745,7 +746,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
         
         stdout = ec.trace(simu, "stdout")
 
-        print stdout
+        print(stdout)
 
         expected = "20 packets transmitted, 20 received, 0% packet loss"
         self.assertTrue(stdout.find(expected) > -1)
@@ -756,7 +757,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
     def t_dce(self, host, user = None, identity = None):
         ec = ExperimentController(exp_id = "test-ns3-dce")
         
-        node = ec.register_resource("LinuxNode")
+        node = ec.register_resource("linux::Node")
         if host == "localhost":
             ec.set(node, "hostname", host)
         else:
@@ -767,7 +768,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
         ec.set(node, "cleanProcesses", True)
         #ec.set(node, "cleanHome", True)
 
-        simu = ec.register_resource("LinuxNS3Simulation")
+        simu = ec.register_resource("linux::ns3::Simulation")
         ec.set(simu, "verbose", True)
         ec.set(simu, "buildMode", "debug")
         ec.set(simu, "nsLog", "DceApplication")
@@ -789,7 +790,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
         ec.register_connection(chan, p2p2)
 
         ### create applications
-        udp_perf = ec.register_resource("ns3::DceApplication")
+        udp_perf = ec.register_resource("linux::ns3::dce::Application")
         ec.set (udp_perf, "binary", "udp-perf")
         ec.set (udp_perf, "stackSize", 1<<20)
         ec.set (udp_perf, "arguments", "--duration=10;--nodes=2")
@@ -797,7 +798,7 @@ class LinuxNS3SimulationTest(unittest.TestCase):
         ec.set (udp_perf, "StopTime", "20s")
         ec.register_connection(udp_perf, nsnode1)
 
-        udp_perf_client = ec.register_resource("ns3::DceApplication")
+        udp_perf_client = ec.register_resource("linux::ns3::dce::Application")
         ec.set (udp_perf_client, "binary", "udp-perf")
         ec.set (udp_perf_client, "stackSize", 1<<20)
         ec.set (udp_perf_client, "arguments", "--client;--nodes=2;--host=10.0.0.1;--duration=10")