1 #!/usr/bin/env python
\r
3 # NEPI, a framework to manage network experiments
\r
4 # Copyright (C) 2013 INRIA
\r
6 # This program is free software: you can redistribute it and/or modify
\r
7 # it under the terms of the GNU General Public License version 2 as
\r
8 # published by the Free Software Foundation;
\r
10 # This program is distributed in the hope that it will be useful,
\r
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 # GNU General Public License for more details.
\r
15 # You should have received a copy of the GNU General Public License
\r
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
\r
18 # Author: Damien Saucez <damien.saucez@inria.fr>
\r
19 # Alina Quereilhac <alina.quereilhac@inria.fr>
\r
22 from experiment_interconnected_ns3_ns3 import ExperimentInterconnectedNs3Ns3
\r
23 from nepi.execution.ec import ExperimentController
\r
24 from nepi.execution.resource import ResourceManager
\r
26 # Experiment parameters
\r
27 experiment_id = "case_b"
\r
28 agent = ["10.0.2.1", "10.0.1.1"]
\r
29 netblock = ["10.0.1.0", "10.0.2.0"]
\r
30 prefix = ["24", "24"]
\r
32 # list of hosts for running the experiment on
\r
34 {"hostname":"onelab4.warsaw.rd.tp.pl",
\r
35 "username":"inria_nepi",
\r
36 "identity": "%s/.ssh/id_rsa_planetlab" % (os.environ['HOME'])},
\r
37 {"hostname":"planet2.servers.ua.pt",
\r
38 "username":"inria_nepi",
\r
39 "identity": "%s/.ssh/id_rsa_planetlab" % (os.environ['HOME'])}
\r
43 os.environ["NEPI_NTHREADS"] = "1"
\r
44 ResourceManager._reschedule_delay = "0s"
\r
46 # == Experimentation setup ====================================================
\r
48 # Prepare the ExperimentController
\r
49 ec = ExperimentController(exp_id = experiment_id)
\r
51 # Create the simulated network
\r
53 # On the first machine
\r
54 xp1 = ExperimentInterconnectedNs3Ns3(ec, node_info[0], nb_nodes[0])
\r
55 xp1.build_topology(netblock = netblock[0], prefix = prefix[0], target = agent[0])
\r
57 # On the second machine
\r
58 xp2 = ExperimentInterconnectedNs3Ns3(ec, node_info[1], nb_nodes[1])
\r
59 xp2.build_topology(netblock = netblock[1], prefix = prefix[1], target = agent[1])
\r
61 # interconnect the two experiments
\r
62 xp1.interconnect(xp2)
\r
64 # Let's run the experiment
\r
66 ec.wait_finished( xp1.apps[1:len(xp1.apps)] + xp2.apps[1:len(xp2.apps)] )
\r
69 # and see the output
\r
70 stdout = ec.trace(xp1.apps[0], "stdout")
\r
71 print "1[", stdout, "]"
\r
73 stdout = ec.trace(xp2.apps[0], "stdout")
\r
74 print "2[", stdout, "]"
\r