2 from neco.execution.resource import ResourceFactory
3 from neco.execution.ec import ExperimentController
5 from neco.resources.omf.omf_node import OMFNode
6 from neco.resources.omf.omf_application import OMFApplication
7 from neco.resources.omf.omf_interface import OMFWifiInterface
8 from neco.resources.omf.omf_channel import OMFChannel
16 ec = ExperimentController()
18 # Register the different RM that will be used
19 ResourceFactory.register_type(OMFNode)
20 ResourceFactory.register_type(OMFWifiInterface)
21 ResourceFactory.register_type(OMFChannel)
22 ResourceFactory.register_type(OMFApplication)
24 # Create and Configure the Nodes
25 guid = ec.register_resource("OMFNode")
26 node1 = ec.get_resource(guid)
27 node1.set('hostname', 'omf.plexus.wlab17')
28 node1.set('xmppSlice', "nepi")
29 node1.set('xmppHost', "xmpp-plexus.onelab.eu")
30 node1.set('xmppPort', "5222")
31 node1.set('xmppPassword', "1234")
33 guid = ec.register_resource("OMFNode")
34 node2 = ec.get_resource(guid)
35 node2.set('hostname', "omf.plexus.wlab37")
36 node2.set('xmppSlice', "nepi")
37 node2.set('xmppHost', "xmpp-plexus.onelab.eu")
38 node2.set('xmppPort', "5222")
39 node2.set('xmppPassword', "1234")
41 # Create and Configure the Interfaces
42 guid = ec.register_resource("OMFWifiInterface")
43 iface1 = ec.get_resource(guid)
44 iface1.set('alias', "w0")
45 iface1.set('mode', "adhoc")
46 iface1.set('type', "g")
47 iface1.set('essid', "helloworld")
48 iface1.set('ip', "10.0.0.17")
49 iface1.set('xmppSlice', "nepi")
50 iface1.set('xmppHost', "xmpp-plexus.onelab.eu")
51 iface1.set('xmppPort', "5222")
52 iface1.set('xmppPassword', "1234")
54 guid = ec.register_resource("OMFWifiInterface")
55 iface2 = ec.get_resource(guid)
56 iface2.set('alias', "w0")
57 iface2.set('mode', "adhoc")
58 iface2.set('type', 'g')
59 iface2.set('essid', "helloworld")
60 iface2.set('ip', "10.0.0.37")
61 iface2.set('xmppSlice', "nepi")
62 iface2.set('xmppHost', "xmpp-plexus.onelab.eu")
63 iface2.set('xmppPort', "5222")
64 iface2.set('xmppPassword', "1234")
66 # Create and Configure the Channel
67 guid = ec.register_resource("OMFChannel")
68 channel = ec.get_resource(guid)
69 channel.set('channel', "6")
70 channel.set('xmppSlice', "nepi")
71 channel.set('xmppHost', "xmpp-plexus.onelab.eu")
72 channel.set('xmppPort', "5222")
73 channel.set('xmppPassword', "1234")
75 # Create and Configure the Application
76 guid = ec.register_resource("OMFApplication")
77 app1 = ec.get_resource(guid)
78 app1.set('appid', 'Vlc#1')
79 app1.set('path', "/opt/vlc-1.1.13/cvlc")
80 app1.set('args', "/opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}'")
81 app1.set('env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
82 app1.set('xmppSlice', "nepi")
83 app1.set('xmppHost', "xmpp-plexus.onelab.eu")
84 app1.set('xmppPort', "5222")
85 app1.set('xmppPassword', "1234")
87 guid = ec.register_resource("OMFApplication")
88 app2 = ec.get_resource(guid)
89 app2.set('appid', 'Vlc#2')
90 app2.set('path', "/opt/vlc-1.1.13/cvlc")
91 app2.set('args', "rtp://10.0.0.37:1234")
92 app2.set('env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
93 app2.set('xmppSlice', "nepi")
94 app2.set('xmppHost', "xmpp-plexus.onelab.eu")
95 app2.set('xmppPort', "5222")
96 app2.set('xmppPassword', "1234")
98 guid = ec.register_resource("OMFApplication")
99 app3 = ec.get_resource(guid)
100 app3.set('appid', 'Kill#2')
101 app3.set('path', "/usr/bin/killall")
102 app3.set('args', "vlc")
104 app3.set('xmppSlice', "nepi")
105 app3.set('xmppHost', "xmpp-plexus.onelab.eu")
106 app3.set('xmppPort', "5222")
107 app3.set('xmppPassword', "1234")
110 app3.connect(node1.guid)
111 node1.connect(app3.guid)
113 app1.connect(node1.guid)
114 node1.connect(app1.guid)
116 node1.connect(iface1.guid)
117 iface1.connect(node1.guid)
119 iface1.connect(channel.guid)
120 channel.connect(iface1.guid)
122 channel.connect(iface2.guid)
123 iface2.connect(channel.guid)
125 iface2.connect(node2.guid)
126 node2.connect(iface2.guid)
128 node2.connect(app2.guid)
129 app2.connect(node2.guid)
146 # Start the Interfaces
155 # Start the Application
162 # Stop the Application