3 # NEPI, a framework to manage network experiments
4 # Copyright (C) 2015 INRIA
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 2 as
8 # published by the Free Software Foundation;
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Author: Damien Saucez <damien.saucez@inria.fr>
19 # Alina Quereilhac <alina.quereilhac@inria.fr>
23 # Note: To run this experiment you need to have a PlanetLab account.
25 # This experiment consists of a simulated wireless sensor network (ns-3)
26 # with one fixed access point (AP), running an agent application, and several
27 # mobile stations that run a transmitter application to send messages to
30 # The same experiment described above is run in parallel with different
31 # number of mobile stations in 2 PlanetLab hosts.
37 # PYTHONPATH=$PYTHONPATH:src python examples/ns3/multi_host/parallel.py
40 from __future__ import print_function
44 from topology import *
46 from nepi.execution.ec import ExperimentController
47 from nepi.execution.resource import ResourceState, ResourceManager
50 os.environ["NEPI_NTHREADS"] = "1"
51 ResourceManager._reschedule_delay = "0s"
53 # list of hosts for running the experiment on
54 hostname1 = "onelab4.warsaw.rd.tp.pl"
55 hostname2 = "planet2.servers.ua.pt"
57 (username, pl_user, pl_password, ssh_key, node_count) = get_options()
59 ec = ExperimentController(exp_id="parallel")
60 counts = [node_count, 10]
61 hosts = [hostname1, hostname2]
66 for hostname in hosts:
67 host, simu = add_host_simu(ec, hostname, username, pl_user, pl_password,
69 simulations.append(simu)
71 node_count = counts.pop()
72 ap, agent = build_ns3_topology(ec, simu, node_count, network="10.1.0.0",
73 prefixlen="24", agent_ip="10.1.0.1")
78 ec.wait_finished(simulations)
81 stdout = ec.trace(agent, "stdout")