2 NEPI, a framework to manage network experiments
3 Copyright (C) 2013 INRIA
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
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>
28 omf.plexus.wlab17 omf.plexus.wlab37
29 0--------------------------------------------------0
37 - t1 : VLC Server start
38 - t2 (t1 + 4s) : VLC Client start
39 - t3 (t2 + 22s) : Client and Server Stop
40 - t4 (t3 + 3s): Kill all the applications
45 from nepi.execution.resource import ResourceFactory, ResourceAction, ResourceState
46 from nepi.execution.ec import ExperimentController
49 ec = ExperimentController()
51 # Create and Configure the Nodes
52 node1 = ec.register_resource("OMFNode")
53 ec.set(node1, 'hostname', 'omf.plexus.wlab17')
54 ec.set(node1, 'xmppUser', "nepi")
55 ec.set(node1, 'xmppServer', "xmpp-plexus.onelab.eu")
56 ec.set(node1, 'xmppPort', "5222")
57 ec.set(node1, 'xmppPassword', "1234")
58 ec.set(node1, 'version', "5")
60 node2 = ec.register_resource("OMFNode")
61 ec.set(node2, 'hostname', "omf.plexus.wlab37")
62 ec.set(node2, 'xmppUser', "nepi")
63 ec.set(node2, 'xmppServer', "xmpp-plexus.onelab.eu")
64 ec.set(node2, 'xmppPort', "5222")
65 ec.set(node2, 'xmppPassword', "1234")
66 ec.set(node2, 'version', "5")
68 # Create and Configure the Interfaces
69 iface1 = ec.register_resource("OMFWifiInterface")
70 ec.set(iface1, 'name', "wlan0")
71 ec.set(iface1, 'mode', "adhoc")
72 ec.set(iface1, 'hw_mode', "g")
73 ec.set(iface1, 'essid', "vlcexp")
74 ec.set(iface1, 'ip', "10.0.0.17")
75 ec.set(iface1, 'version', "5")
77 iface2 = ec.register_resource("OMFWifiInterface")
78 ec.set(iface2, 'name', "wlan0")
79 ec.set(iface2, 'mode', "adhoc")
80 ec.set(iface2, 'hw_mode', 'g')
81 ec.set(iface2, 'essid', "vlcexp")
82 ec.set(iface2, 'ip', "10.0.0.37/24")
83 ec.set(iface2, 'version', "5")
85 # Create and Configure the Channel
86 channel = ec.register_resource("OMFChannel")
87 ec.set(channel, 'channel', "6")
88 ec.set(channel, 'xmppUser', "nepi")
89 ec.set(channel, 'xmppServer', "xmpp-plexus.onelab.eu")
90 ec.set(channel, 'xmppPort', "5222")
91 ec.set(channel, 'xmppPassword', "1234")
92 ec.set(channel, 'version', "5")
94 # Create and Configure the Application
95 app1 = ec.register_resource("OMFApplication")
96 ec.set(app1, 'appid', 'Vlc#1')
97 ec.set(app1, 'command', "/opt/vlc-1.1.13/cvlc --quiet /opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}'")
98 #ec.set(app1, 'command', "/opt/vlc-1.1.13/cvlc --quiet /opt/big_buck_bunny_240p_mpeg4.ts --sout '#rtp{dst=10.0.0.XX,port=1234,mux=ts} '")
99 #ec.set(app1, 'command', "/opt/vlc-1.1.13/cvlc --quiet /opt/big_buck_bunny_240p_mpeg4_lq.ts --sout '#rtp{dst=10.0.0.XX,port=1234,mux=ts} '")
100 ec.set(app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
101 ec.set(app1, 'version', "5")
103 app2 = ec.register_resource("OMFApplication")
104 ec.set(app2, 'appid', 'Vlc#2')
105 ec.set(app2, 'command', "/opt/vlc-1.1.13/cvlc --quiet rtp://10.0.0.37:1234")
106 ec.set(app2, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
107 ec.set(app2, 'version', "5")
109 app3 = ec.register_resource("OMFApplication")
110 ec.set(app3, 'appid', 'Kill#1')
111 ec.set(app3, 'command', "/usr/bin/killall vlc")
112 ec.set(app3, 'env', " ")
113 ec.set(app3, 'version', "5")
115 app4 = ec.register_resource("OMFApplication")
116 ec.set(app4, 'appid', 'Kill#2')
117 ec.set(app4, 'command', "/usr/bin/killall vlc")
118 ec.set(app4, 'env', " ")
119 ec.set(app4, 'version', "5")
122 ec.register_connection(app3, node1)
123 ec.register_connection(app1, node1)
124 ec.register_connection(node1, iface1)
125 ec.register_connection(iface1, channel)
126 ec.register_connection(iface2, channel)
127 ec.register_connection(node2, iface2)
128 ec.register_connection(app2, node2)
129 ec.register_connection(app4, node2)
132 ec.register_condition(app2, ResourceAction.START, app1, ResourceState.STARTED , "4s")
133 ec.register_condition([app1, app2], ResourceAction.STOP, app2, ResourceState.STARTED , "22s")
134 ec.register_condition([app3, app4], ResourceAction.START, app2, ResourceState.STOPPED , "1s")
135 ec.register_condition([app3, app4], ResourceAction.STOP, app3, ResourceState.STARTED , "1s")
140 ec.wait_finished([app1, app2, app3])