X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=examples%2Fomf%2Fnitos_omf6_vlc.py;h=eb615fe30d42ed0592cdc4be53737e5bdd977186;hb=039fbd9629d7570d4c175a5448d24badcd0f3aba;hp=749dd358a44cbf2c7017963a4f1d2dcf005d7efa;hpb=02869f33bedd89aa8371b84e8e3b059800e23f53;p=nepi.git diff --git a/examples/omf/nitos_omf6_vlc.py b/examples/omf/nitos_omf6_vlc.py index 749dd358..eb615fe3 100644 --- a/examples/omf/nitos_omf6_vlc.py +++ b/examples/omf/nitos_omf6_vlc.py @@ -6,9 +6,8 @@ # Copyright (C) 2013 INRIA # # This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -47,6 +46,8 @@ # - t3 (t2 + 2s) : Kill the application # +from __future__ import print_function + from nepi.execution.resource import ResourceAction, ResourceState from nepi.execution.ec import ExperimentController @@ -80,7 +81,7 @@ chan = options.channel ec = ExperimentController(exp_id="nitos_omf6_vlc") # Create and Configure the Nodes -node1 = ec.register_resource("OMFNode") +node1 = ec.register_resource("omf::Node") ec.set(node1, "hostname", nodex) ec.set(node1, "xmppUser", slicename) ec.set(node1, "xmppServer", "nitlab.inf.uth.gr") @@ -88,16 +89,16 @@ ec.set(node1, "xmppPort", "5222") ec.set(node1, "xmppPassword", "1234") # Create and Configure the Interfaces -iface1 = ec.register_resource("OMFWifiInterface") +iface1 = ec.register_resource("omf::WifiInterface") ec.set(iface1, "name", "wlan0") ec.set(iface1, "mode", "adhoc") ec.set(iface1, "hw_mode", "g") -ec.set(iface1, "essid", "ping") +ec.set(iface1, "essid", "vlc") ec.set(iface1, "ip", "192.168.0.%s/24" % nodex[-2:]) ec.register_connection(node1, iface1) # Create and Configure the Nodes -node2 = ec.register_resource("OMFNode") +node2 = ec.register_resource("omf::Node") ec.set(node2, "hostname", nodez) ec.set(node2, "xmppUser", slicename) ec.set(node2, "xmppServer", "nitlab.inf.uth.gr") @@ -105,16 +106,16 @@ ec.set(node2, "xmppPort", "5222") ec.set(node2, "xmppPassword", "1234") # Create and Configure the Interfaces -iface2 = ec.register_resource("OMFWifiInterface") +iface2 = ec.register_resource("omf::WifiInterface") ec.set(iface2, "name", "wlan0") ec.set(iface2, "mode", "adhoc") ec.set(iface2, "hw_mode", "g") -ec.set(iface2, "essid", "ping") +ec.set(iface2, "essid", "vlc") ec.set(iface2, "ip", "192.168.0.%s/24" % nodez[-2:]) ec.register_connection(node2, iface2) # Create and Configure the Channel -channel = ec.register_resource("OMFChannel") +channel = ec.register_resource("omf::Channel") ec.set(channel, "channel", chan) ec.set(channel, "xmppUser", slicename) ec.set(channel, "xmppServer", "nitlab.inf.uth.gr") @@ -126,14 +127,14 @@ ec.register_connection(iface2, channel) client_ip = "192.168.0.%s" % nodez[-2:] # Create and Configure the Application -app1 = ec.register_resource("OMFApplication") +app1 = ec.register_resource("omf::Application") ec.set(app1, "command", "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority /root/vlc/vlc-1.1.13/cvlc /root/10-by-p0d.avi --sout '#rtp{dst=%s,port=5004,mux=ts}'" % client_ip) ec.register_connection(app1, node1) ## Add a OMFApplication to run the client VLC and count the numer of bytes ## transmitted, using wc. -app2 = ec.register_resource("OMFApplication") +app2 = ec.register_resource("omf::Application") ec.set(app2, "command", "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority /root/vlc/vlc-1.1.13/cvlc rtp://%s:5004 | wc -c "% client_ip) @@ -157,7 +158,7 @@ ec.wait_finished([app2]) # Retrieve the bytes transmitted count and print it byte_count = ec.trace(app2, "stdout") -print "BYTES transmitted", byte_count +print("BYTES transmitted", byte_count) ## If you redirected the video to standard output, you can try to ## retrieve the stdout of the VLC client