--- /dev/null
+#!/usr/bin/env python\r
+#\r
+# NEPI, a framework to manage network experiments\r
+# Copyright (C) 2013 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
+import os\r
+from experiment_interconnected_ns3_ns3 import ExperimentInterconnectedNs3Ns3\r
+from nepi.execution.ec import ExperimentController \r
+from nepi.execution.resource import ResourceManager\r
+\r
+# Experiment parameters\r
+experiment_id = "case_b"\r
+agent = ["10.0.2.1", "10.0.1.1"]\r
+netblock = ["10.0.1.0", "10.0.2.0"]\r
+prefix = ["24", "24"]\r
+nb_nodes = [1, 1]\r
+# list of hosts for running the experiment on\r
+node_info = [\r
+ {"hostname":"onelab4.warsaw.rd.tp.pl", \r
+ "username":"inria_nepi", \r
+ "identity": "%s/.ssh/id_rsa_planetlab" % (os.environ['HOME'])}, \r
+ {"hostname":"planet2.servers.ua.pt", \r
+ "username":"inria_nepi", \r
+ "identity": "%s/.ssh/id_rsa_planetlab" % (os.environ['HOME'])}\r
+ ]\r
+\r
+# tunning\r
+os.environ["NEPI_NTHREADS"] = "1"\r
+ResourceManager._reschedule_delay = "0s"\r
+\r
+# == Experimentation setup ====================================================\r
+def main():\r
+ # Prepare the ExperimentController\r
+ ec = ExperimentController(exp_id = experiment_id)\r
+\r
+ # Create the simulated network\r
+ #\r
+ # On the first machine\r
+ xp1 = ExperimentInterconnectedNs3Ns3(ec, node_info[0], nb_nodes[0])\r
+ xp1.build_topology(netblock = netblock[0], prefix = prefix[0], target = agent[0])\r
+ #\r
+ # On the second machine\r
+ xp2 = ExperimentInterconnectedNs3Ns3(ec, node_info[1], nb_nodes[1])\r
+ xp2.build_topology(netblock = netblock[1], prefix = prefix[1], target = agent[1])\r
+\r
+ # interconnect the two experiments\r
+ xp1.interconnect(xp2)\r
+\r
+ # Let's run the experiment\r
+ ec.deploy()\r
+ ec.wait_finished( xp1.apps[1:len(xp1.apps)] + xp2.apps[1:len(xp2.apps)] )\r
+\r
+\r
+ # and see the output\r
+ stdout = ec.trace(xp1.apps[0], "stdout")\r
+ print "1[", stdout, "]"\r
+\r
+ stdout = ec.trace(xp2.apps[0], "stdout")\r
+ print "2[", stdout, "]"\r
+\r
+ # et voila\r
+ ec.shutdown()\r
+\r
+main()\r