X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=test%2Fresources%2Flinux%2Fns3%2Fns3simulation.py;h=f00dcadee31fb9ac9be2d23d75dbe2540e01d116;hb=1d2350d56f314a6e3de43517a66f7e2f48128d44;hp=8501f64be4fda691cad0d59f8f40051a1cad1270;hpb=0a796df7191ef93f55f42d378315d97721aa5cb2;p=nepi.git diff --git a/test/resources/linux/ns3/ns3simulation.py b/test/resources/linux/ns3/ns3simulation.py index 8501f64b..f00dcade 100755 --- a/test/resources/linux/ns3/ns3simulation.py +++ b/test/resources/linux/ns3/ns3simulation.py @@ -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 +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) @@ -473,16 +474,16 @@ class LinuxNS3SimulationTest(unittest.TestCase): output = ec.trace(guid, trace) size = ec.trace(guid, trace, attr = TraceAttr.SIZE) - self.assertEquals(size, len(output)) + self.assertEqual(size, len(output)) self.assertTrue(size > 100) block = ec.trace(guid, trace, attr = TraceAttr.STREAM, block = 5, offset = 1) - self.assertEquals(block, output[5:10]) + self.assertEqual(block, output[5:10]) trace_path = ec.trace(guid, trace, attr = TraceAttr.PATH) rm = ec.get_resource(guid) path = os.path.join(rm_simu.run_home, rm._trace_filename.get(trace)) - self.assertEquals(trace_path, path) + self.assertEqual(trace_path, path) ec.shutdown() @@ -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")