3 # NEPI, a framework to manage network experiments
4 # Copyright (C) 2013 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: Lucia Guevgeozian <lucia.guevgeozian_odizzio@inria.fr>
20 from nepi.execution.ec import ExperimentController
21 from nepi.execution.resource import ResourceAction, ResourceState
24 exp_id = "multihop_ssh"
25 ec = ExperimentController(exp_id)
28 node1 = ec.register_resource("linux::Node")
29 ec.set(node1, "hostname", "wlab29.")
30 ec.set(node1, "username", "root")
31 ec.set(node1, "gatewayUser", "etourdi")
32 ec.set(node1, "gateway", "etourdi.pl.sophia.inria.fr")
33 ec.set(node1, "cleanExperiment", True)
34 ec.set(node1, "cleanProcesses", True)
37 node2 = ec.register_resource("linux::Node")
38 ec.set(node2, "hostname", "wlab5.")
39 ec.set(node2, "username", "root")
40 ec.set(node2, "gatewayUser", "etourdi")
41 ec.set(node2, "gateway", "etourdi.pl.sophia.inria.fr")
42 ec.set(node2, "cleanExperiment", True)
43 ec.set(node2, "cleanProcesses", True)
45 app1 = ec.register_resource("linux::Application")
46 video= "../big_buck_bunny_240p_mpeg4_lq.ts"
47 ec.set(app1, "sources", video)
48 command = "cat ${SRC}/big_buck_bunny_240p_mpeg4_lq.ts| nc wlab5. 1234"
49 ec.set(app1, "command", command)
50 ec.register_connection(app1, node1)
52 app2 = ec.register_resource("linux::Application")
53 command = "nc -dl 1234 > big_buck_copied_movie.ts"
54 ec.set(app2, "command", command)
55 ec.register_connection(app2, node2)
58 ec.register_condition(app1, ResourceAction.START, app2, ResourceState.STARTED)
63 ec.wait_finished([app1, app2])