X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=examples%2Fns3%2Fmulti_host%2Fdistributed.py;h=c3aef65ad6b47934d650ee0114e2c7e123295005;hb=039fbd9629d7570d4c175a5448d24badcd0f3aba;hp=c1a5a8b0d89e5d9823a90912e59a2e333c171ec6;hpb=4ffa02a6eeaf8c5daacb10d8f52fc15782af84ab;p=nepi.git
diff --git a/examples/ns3/multi_host/distributed.py b/examples/ns3/multi_host/distributed.py
index c1a5a8b0..c3aef65a 100644
--- a/examples/ns3/multi_host/distributed.py
+++ b/examples/ns3/multi_host/distributed.py
@@ -1,82 +1,84 @@
-#!/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 experiment uses 2 networks like the one described above, running in 2
-# independent ns-3 instances in remote hosts, and transparently connected
-# through a UDP tunnel.
-
-#
-# command line:
-#
-# PYTHONPATH=$PYTHONPATH:src python examples/ns3/multi_host/ditributed.py
-#
-
-import os
-
-from nepi.execution.ec import ExperimentController
-from nepi.execution.resource import ResourceState, ResourceManager
-
-from topology import *
-
-# 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="distributed")
-
-host1, simu1 = add_host_simu(ec, hostname1, username, pl_user, pl_password,
- ssh_key)
-
-ap1, agent1 = build_ns3_topology(ec, simu1, node_count, network="10.1.0.0",
- prefixlen="24", agent_ip="10.1.0.1")
-
-host2, simu2 = add_host_simu(ec, hostname2, username, pl_user, pl_password, ssh_key)
-ap2, agent2 = build_ns3_topology(ec, simu2, node_count, network="10.2.0.0", prefixlen="24", agent_ip="10.1.0.1")
-
-fddev1 = add_fdnet_device(ec, ap1, "10.0.0.1", "30")
-fddev2 = add_fdnet_device(ec, ap2, "10.0.0.2", "30")
-
-connect_with_udp_tunnel(ec, fddev1, fddev2)
-
-ec.deploy()
-
-ec.wait_finished([simu1, simu2])
-
-stdout = ec.trace(agent1, "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 experiment uses 2 networks like the one described above, running in 2
+# independent ns-3 instances in remote hosts, and transparently connected
+# through a UDP tunnel.
+
+#
+# command line:
+#
+# PYTHONPATH=$PYTHONPATH:src python examples/ns3/multi_host/ditributed.py
+#
+
+from __future__ import print_function
+
+import os
+
+from nepi.execution.ec import ExperimentController
+from nepi.execution.resource import ResourceState, ResourceManager
+
+from topology import *
+
+# 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="distributed")
+
+host1, simu1 = add_host_simu(ec, hostname1, username, pl_user, pl_password,
+ ssh_key)
+
+ap1, agent1 = build_ns3_topology(ec, simu1, node_count, network="10.1.0.0",
+ prefixlen="24", agent_ip="10.1.0.1")
+
+host2, simu2 = add_host_simu(ec, hostname2, username, pl_user, pl_password, ssh_key)
+ap2, agent2 = build_ns3_topology(ec, simu2, node_count, network="10.2.0.0", prefixlen="24", agent_ip="10.1.0.1")
+
+fddev1 = add_fdnet_device(ec, ap1, "10.0.0.1", "30")
+fddev2 = add_fdnet_device(ec, ap2, "10.0.0.2", "30")
+
+connect_with_udp_tunnel(ec, fddev1, fddev2)
+
+ec.deploy()
+
+ec.wait_finished([simu1, simu2])
+
+stdout = ec.trace(agent1, "stdout")
+print(" Agent says:")
+print(stdout)
+
+ec.shutdown()
+