X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=examples%2Fns3%2Fmulti_host%2Fparallel.py;h=fa53457c7e82a5aeb4fc6fde920fd62db76ac6e8;hb=039fbd9629d7570d4c175a5448d24badcd0f3aba;hp=a0be0a9a4fa14606d20cdc0451aae2469d18a539;hpb=4ffa02a6eeaf8c5daacb10d8f52fc15782af84ab;p=nepi.git
diff --git a/examples/ns3/multi_host/parallel.py b/examples/ns3/multi_host/parallel.py
index a0be0a9a..fa53457c 100644
--- a/examples/ns3/multi_host/parallel.py
+++ b/examples/ns3/multi_host/parallel.py
@@ -1,85 +1,87 @@
-#!/usr/bin/env python
-#
-# NEPI, a framework to manage network experiments
-# Copyright (C) 2015 INRIA
-#
-# This program is free software: you can redistribute it and/or modify
-# 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
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-#
-# Author: Damien Saucez
-# Alina Quereilhac
-#
-
-#
-# Note: To run this experiment you need to have a PlanetLab account.
-#
-# This experiment consists of a simulated wireless sensor network (ns-3)
-# with one fixed access point (AP), running an agent application, and several
-# mobile stations that run a transmitter application to send messages to
-# the AP.
-#
-# The same experiment described above is run in parallel with different
-# number of mobile stations in 2 PlanetLab hosts.
-#
-
-#
-# command line:
-#
-# PYTHONPATH=$PYTHONPATH:src python examples/ns3/multi_host/parallel.py
-#
-
-import os
-
-from topology import *
-
-from nepi.execution.ec import ExperimentController
-from nepi.execution.resource import ResourceState, ResourceManager
-
-# tunning
-os.environ["NEPI_NTHREADS"] = "1"
-ResourceManager._reschedule_delay = "0s"
-
-# list of hosts for running the experiment on
-hostname1 = "onelab4.warsaw.rd.tp.pl"
-hostname2 = "planet2.servers.ua.pt"
-
-(username, pl_user, pl_password, ssh_key, node_count) = get_options()
-
-ec = ExperimentController(exp_id="parallel")
-counts = [node_count, 10]
-hosts = [hostname1, hostname2]
-
-simulations = []
-agents = []
-
-for hostname in hosts:
- host, simu = add_host_simu(ec, hostname, username, pl_user, pl_password,
- ssh_key)
- simulations.append(simu)
-
- node_count = counts.pop()
- ap, agent = build_ns3_topology(ec, simu, node_count, network="10.1.0.0",
- prefixlen="24", agent_ip="10.1.0.1")
- agents.append(agent)
-
-ec.deploy()
-
-ec.wait_finished(simulations)
-
-for agent in agents:
- stdout = ec.trace(agent, "stdout")
- print " Agent says:"
- print stdout
-
-ec.shutdown()
-
-
+#!/usr/bin/env python
+#
+# NEPI, a framework to manage network experiments
+# Copyright (C) 2015 INRIA
+#
+# This program is free software: you can redistribute it and/or modify
+# 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+# Author: Damien Saucez
+# Alina Quereilhac
+#
+
+#
+# Note: To run this experiment you need to have a PlanetLab account.
+#
+# This experiment consists of a simulated wireless sensor network (ns-3)
+# with one fixed access point (AP), running an agent application, and several
+# mobile stations that run a transmitter application to send messages to
+# the AP.
+#
+# The same experiment described above is run in parallel with different
+# number of mobile stations in 2 PlanetLab hosts.
+#
+
+#
+# command line:
+#
+# PYTHONPATH=$PYTHONPATH:src python examples/ns3/multi_host/parallel.py
+#
+
+from __future__ import print_function
+
+import os
+
+from topology import *
+
+from nepi.execution.ec import ExperimentController
+from nepi.execution.resource import ResourceState, ResourceManager
+
+# tunning
+os.environ["NEPI_NTHREADS"] = "1"
+ResourceManager._reschedule_delay = "0s"
+
+# list of hosts for running the experiment on
+hostname1 = "onelab4.warsaw.rd.tp.pl"
+hostname2 = "planet2.servers.ua.pt"
+
+(username, pl_user, pl_password, ssh_key, node_count) = get_options()
+
+ec = ExperimentController(exp_id="parallel")
+counts = [node_count, 10]
+hosts = [hostname1, hostname2]
+
+simulations = []
+agents = []
+
+for hostname in hosts:
+ host, simu = add_host_simu(ec, hostname, username, pl_user, pl_password,
+ ssh_key)
+ simulations.append(simu)
+
+ node_count = counts.pop()
+ ap, agent = build_ns3_topology(ec, simu, node_count, network="10.1.0.0",
+ prefixlen="24", agent_ip="10.1.0.1")
+ agents.append(agent)
+
+ec.deploy()
+
+ec.wait_finished(simulations)
+
+for agent in agents:
+ stdout = ec.trace(agent, "stdout")
+ print(" Agent says:")
+ print(stdout)
+
+ec.shutdown()
+
+