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: Alina Quereilhac <alina.quereilhac@inria.fr>
19 # Julien Tribino <julien.tribino@inria.fr>
21 from nepi.execution.resource import ResourceFactory, ResourceAction, ResourceState
22 from nepi.execution.ec import ExperimentController
25 ec = ExperimentController()
27 # Create and Configure the Nodes
29 node1 = ec.register_resource("omf::Node")
30 ec.set(node1, 'hostname', 'servernode.nepivlcexperiment.nepi.wilab2.ilabt.iminds.be')
31 ec.set(node1, 'xmppServer', "xmpp.ilabt.iminds.be")
32 ec.set(node1, 'xmppUser', "nepi")
33 ec.set(node1, 'xmppPort', "5222")
34 ec.set(node1, 'xmppPassword', "1234")
36 iface1 = ec.register_resource("omf::WifiInterface")
37 ec.set(iface1, 'name', 'wlan0')
38 ec.set(iface1, 'mode', "adhoc")
39 ec.set(iface1, 'hw_mode', "g")
40 ec.set(iface1, 'essid', "vlc")
41 ec.set(iface1, 'ip', "192.168.0.1/24")
43 node2 = ec.register_resource("omf::Node")
44 ec.set(node2, 'hostname', 'client1node.nepivlcexperiment.nepi.wilab2.ilabt.iminds.be')
45 ec.set(node2, 'xmppServer', "xmpp.ilabt.iminds.be")
46 ec.set(node2, 'xmppUser', "nepi")
47 ec.set(node2, 'xmppPort', "5222")
48 ec.set(node2, 'xmppPassword', "1234")
50 iface2 = ec.register_resource("omf::WifiInterface")
51 ec.set(iface2, 'name', 'wlan0')
52 ec.set(iface2, 'mode', "adhoc")
53 ec.set(iface2, 'hw_mode', "g")
54 ec.set(iface2, 'essid', "vlc")
55 ec.set(iface2, 'ip', "192.168.0.2/24")
57 node3 = ec.register_resource("omf::Node")
58 ec.set(node3, 'hostname', 'client2node.nepivlcexperiment.nepi.wilab2.ilabt.iminds.be')
59 ec.set(node3, 'xmppServer', "xmpp.ilabt.iminds.be")
60 ec.set(node3, 'xmppUser', "nepi")
61 ec.set(node3, 'xmppPort', "5222")
62 ec.set(node3, 'xmppPassword', "1234")
64 iface3 = ec.register_resource("omf::WifiInterface")
65 ec.set(iface3, 'name', 'wlan0')
66 ec.set(iface3, 'mode', "adhoc")
67 ec.set(iface3, 'hw_mode', "g")
68 ec.set(iface3, 'essid', "vlc")
69 ec.set(iface3, 'ip', "192.168.0.3/24")
71 chan = ec.register_resource("omf::Channel")
72 ec.set(chan, 'channel', "6")
74 # Create and Configure the Application
75 app1 = ec.register_resource("omf::Application")
76 ec.set(app1, 'command', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority /root/vlc/vlc-1.1.13/cvlc /root/10-by-p0d.avi --sout '#duplicate{dst=rtp{dst=192.168.0.2,port=1234,mux=ts},dst=rtp{dst=192.168.0.3,port=1234,mux=ts}}'")
78 app2 = ec.register_resource("omf::Application")
79 ec.set(app2, 'command', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority /root/vlc/vlc-1.1.13/cvlc rtp://192.168.0.2:1234")
81 app3 = ec.register_resource("omf::Application")
82 ec.set(app3, 'command', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority /root/vlc/vlc-1.1.13/cvlc rtp://192.168.0.3:1234")
85 # "echo -e 'new TEST broadcast enabled loop\\n"\
86 # "setup TEST input %s\\n"\
87 # "setup TEST output #rtp{mux=ts,sdp=rtsp://0.0.0.0:8554/TEST}\\n\\n"\
88 # "new test_sched schedule enabled\\n"\
89 # "setup test_sched append control TEST play' > ${SOURCES}/VOD.vlm" % mv)
94 ec.register_connection(iface1, node1)
95 ec.register_connection(iface2, node2)
96 ec.register_connection(iface3, node3)
97 ec.register_connection(iface1, chan)
98 ec.register_connection(iface2, chan)
99 ec.register_connection(iface3, chan)
100 ec.register_connection(app1, node1)
101 ec.register_connection(app2, node2)
102 ec.register_connection(app3, node3)
104 ec.register_condition([app2,app3], ResourceAction.START, app1, ResourceState.STARTED , "4s")
105 ec.register_condition([app1,app2,app3], ResourceAction.STOP, [app2,app3], ResourceState.STARTED , "30s")
111 ec.wait_finished([app1,app2,app3])