--- /dev/null
+#!/usr/bin/env python\r
+#\r
+# NEPI, a framework to manage network experiments\r
+# Copyright (C) 2015 INRIA\r
+#\r
+# This program is free software: you can redistribute it and/or modify\r
+# it under the terms of the GNU General Public License version 2 as\r
+# published by the Free Software Foundation;\r
+#\r
+# This program is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU General Public License for more details.\r
+#\r
+# You should have received a copy of the GNU General Public License\r
+# along with this program. If not, see <http://www.gnu.org/licenses/>.\r
+#\r
+# Author: Damien Saucez <damien.saucez@inria.fr>\r
+# Alina Quereilhac <alina.quereilhac@inria.fr>\r
+#\r
+\r
+#\r
+# Note: To run this experiment you need to have a PlanetLab account.\r
+#\r
+# This experiment consists of a simulated wireless sensor network (ns-3)\r
+# with one fixed access point (AP), running an agent application, and several\r
+# mobile stations that run a transmitter application to send messages to\r
+# the AP.\r
+#\r
+# The same experiment described above is run in parallel with different\r
+# number of mobile stations in 2 PlanetLab hosts.\r
+#\r
+\r
+#\r
+# command line:\r
+#\r
+# PYTHONPATH=$PYTHONPATH:src python examples/ns3/multi_host/parallel.py\r
+#\r
+\r
+import os\r
+\r
+from topology import *\r
+\r
+from nepi.execution.ec import ExperimentController\r
+from nepi.execution.resource import ResourceState, ResourceManager\r
+\r
+# tunning\r
+os.environ["NEPI_NTHREADS"] = "1"\r
+ResourceManager._reschedule_delay = "0s"\r
+\r
+# list of hosts for running the experiment on\r
+hostname1 = "onelab4.warsaw.rd.tp.pl"\r
+hostname2 = "planet2.servers.ua.pt"\r
+\r
+(username, pl_user, pl_password, ssh_key, node_count) = get_options()\r
+\r
+ec = ExperimentController(exp_id="parallel")\r
+counts = [node_count, 10]\r
+hosts = [hostname1, hostname2]\r
+\r
+simulations = []\r
+agents = []\r
+\r
+for hostname in hosts:\r
+ host, simu = add_host_simu(ec, hostname, username, pl_user, pl_password, \r
+ ssh_key)\r
+ simulations.append(simu)\r
+\r
+ node_count = counts.pop()\r
+ ap, agent = build_ns3_topology(ec, simu, node_count, network="10.1.0.0", \r
+ prefixlen="24", agent_ip="10.1.0.1")\r
+ agents.append(agent)\r
+\r
+ec.deploy()\r
+\r
+ec.wait_finished(simulations)\r
+\r
+for agent in agents:\r
+ stdout = ec.trace(agent, "stdout")\r
+ print " Agent says:"\r
+ print stdout\r
+\r
+ec.shutdown()\r
+\r
+\r