X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=examples%2Flinux%2Fccn%2Fvlc_2_hosts_ccndrms.py;h=d531c1ad09737992fc4c7b97fe0cf4b5d6bd0a56;hb=4c64cfa394d6210febf4c384276820093b104106;hp=d0638c9f67c53cea087dfc065bf166f5b9b3621a;hpb=245dc3d34b17d5ccbdb4e438c998bd547a7af076;p=nepi.git diff --git a/examples/linux/ccn/vlc_2_hosts_ccndrms.py b/examples/linux/ccn/vlc_2_hosts_ccndrms.py index d0638c9f..d531c1ad 100755 --- a/examples/linux/ccn/vlc_2_hosts_ccndrms.py +++ b/examples/linux/ccn/vlc_2_hosts_ccndrms.py @@ -19,6 +19,17 @@ # # Author: Alina Quereilhac +# +# topology: +# +# 0 +# / \ +# 0 --- 0 0 --- 0 +# \ / +# 0 +# +# + from nepi.execution.ec import ExperimentController, ECState from nepi.execution.resource import ResourceState, ResourceAction, \ populate_factory @@ -40,16 +51,40 @@ def add_node(ec, host, user, ssh_key = None): def add_ccnd(ec, node): ccnd = ec.register_resource("LinuxCCND") + ec.set(ccnd, "debug", 7) ec.register_connection(ccnd, node) return ccnd -def add_ccnr(ec, ccnd, node): +def add_ccnr(ec, ccnd): ccnr = ec.register_resource("LinuxCCNR") - ec.register_connection(ccnr, node) ec.register_connection(ccnr, ccnd) - return ccnr +def add_fib_entry(ec, ccnd, peer_host): + entry = ec.register_resource("LinuxFIBEntry") + ec.set(entry, "host", peer_host) + ec.register_connection(entry, ccnd) + return entry + +def add_content(ec, ccnr, content_name, content): + co = ec.register_resource("LinuxCCNContent") + ec.set(co, "contentName", content_name) + ec.set(co, "content", content) + ec.register_connection(co, ccnr) + return co + +def add_stream(ec, ccnd, content_name): + command = "sudo -S dbus-uuidgen --ensure ; ( ccncat %s | vlc - ) " % \ + content_name + + app = ec.register_resource("LinuxCCNDApplication") + ec.set(app, "depends", "vlc") + ec.set(app, "forwardX11", True) + ec.set(app, "command", command) + ec.register_connection(app, ccnd) + + return app + if __name__ == '__main__': # Search for available RMs populate_factory() @@ -64,20 +99,27 @@ if __name__ == '__main__': user1 = "inria_alina" user2 = "alina" + content_name = "ccnx:/VIDEO" + video = "/home/alina/repos/nepi/examples/big_buck_bunny_240p_mpeg4_lq.ts" + # Register a ResourceManagers (RMs) node1 = add_node(ec, host1, user1) ccnd1 = add_ccnd(ec, node1) - ccnr1 = add_ccnr(ec, ccnd1, node1) + ccnr1 = add_ccnr(ec, ccnd1) + fibentry1 = add_fib_entry(ec, ccnd1, host2) + co = add_content(ec, ccnr1, content_name, video) node2 = add_node(ec, host2, user2) ccnd2 = add_ccnd(ec, node2) - ccnr2 = add_ccnr(ec, ccnd2, node2) + ccnr2 = add_ccnr(ec, ccnd2) + fibentry2 = add_fib_entry(ec, ccnd2, host1) + app = add_stream(ec, ccnd2, content_name) # Deploy all ResourceManagers ec.deploy() - ec.wait_started([ccnd1, ccnr1, ccnd2, ccnr2]) + ec.wait_finished([app]) # Shutdown the experiment controller ec.shutdown()