Cleaning up examples folder
authorAlina Quereilhac <alina.quereilhac@inria.fr>
Thu, 11 Sep 2014 14:16:18 +0000 (16:16 +0200)
committerAlina Quereilhac <alina.quereilhac@inria.fr>
Thu, 11 Sep 2014 14:16:18 +0000 (16:16 +0200)
examples/linux/ccn_simple_transfer.py [moved from examples/linux/ccn/ccn_simple_transfer.py with 80% similarity]
examples/linux/netcat_file_transfer.py
examples/linux/ping.py
examples/linux/testing/ccncat_2_nodes.py [moved from examples/linux/ccn/ccncat_2_nodes.py with 100% similarity]
examples/linux/testing/ccncat_extended_ring_topo.py [moved from examples/linux/ccn/ccncat_extended_ring_topo.py with 100% similarity]
examples/linux/vlc_streaming.py
src/nepi/resources/linux/ccn/ccnd.py

similarity index 80%
rename from examples/linux/ccn/ccn_simple_transfer.py
rename to examples/linux/ccn_simple_transfer.py
index 19c7841..7e06207 100644 (file)
 #
 # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
 #
-# Instructions to run this example:
-#
-# 1. First edit the script file where required (See ASSING messages)
-#
-# 2. Then, run the script:
+
+# Example of how to run this experiment (replace with your information):
 #
 # $ cd <path-to-nepi>
-# $ PYTHONPATH=$PYTHONPATHS:src python examples/linux/ccn/two_nodes_file_retrieval.py
+# python examples/linux/ccn_simple_transfer.py -a <hostname1> -b <hostname2> -u <username> -i <ssh-key>
+
+# CCN topology:
+#
+#                
+#                 
+#  content                  ccncat
+#  Linux host               Linux host
+#     0 ------- network -------- 1
 #
 
 from nepi.execution.ec import ExperimentController
@@ -54,6 +59,8 @@ ssh_key = options.ssh_key
 ## Create the experiment controller
 ec = ExperimentController(exp_id = "ccn_simple_transfer")
 
+##### CONFIGURING NODE 1
+
 ## Register node 1
 node1 = ec.register_resource("LinuxNode")
 # Set the hostname of the first node to use for the experiment
@@ -67,6 +74,33 @@ ec.set(node1, "cleanExperiment", True)
 # Kill all running processes in the node before running the experiment
 ec.set(node1, "cleanProcesses", True)
 
+## Register a CCN daemon in node 1
+ccnd1 = ec.register_resource("LinuxCCND")
+# Set ccnd log level to 7
+ec.set(ccnd1, "debug", 7)
+ec.register_connection(ccnd1, node1)
+
+## Register a repository in node 1
+ccnr1 = ec.register_resource("LinuxCCNR")
+ec.register_connection(ccnr1, ccnd1)
+
+## Push the file into the repository
+local_path_to_content = os.path.join(
+        os.path.dirname(os.path.realpath(__file__)),
+            "..", "big_buck_bunny_240p_mpeg4_lq.ts")
+
+content_name = "ccnx:/test/FILE"
+
+# Add a content to the repository
+co = ec.register_resource("LinuxCCNContent")
+ec.set(co, "contentName", content_name)
+# NEPI will upload the specified file to the remote node and write it
+# into the CCN repository
+ec.set(co, "content", local_path_to_content)
+ec.register_connection(co, ccnr1)
+
+##### CONFIGURING NODE 2
+
 ## Register node 2 
 node2 = ec.register_resource("LinuxNode")
 # Set the hostname of the first node to use for the experiment
@@ -80,35 +114,18 @@ ec.set(node2, "cleanExperiment", True)
 # Kill all running processes in the node before running the experiment
 ec.set(node2, "cleanProcesses", True)
 
-## Register a CCN daemon in node 1
-ccnd1 = ec.register_resource("LinuxCCND")
-# Set ccnd log level to 7
-ec.set(ccnd1, "debug", 7)
-ec.register_connection(ccnd1, node1)
-
 ## Register a CCN daemon in node 2
 ccnd2 = ec.register_resource("LinuxCCND")
 # Set ccnd log level to 7
 ec.set(ccnd2, "debug", 7)
 ec.register_connection(ccnd2, node2)
 
-## Register a repository in node 1
-ccnr1 = ec.register_resource("LinuxCCNR")
-ec.register_connection(ccnr1, ccnd1)
-
-## Push the file into the repository
-local_path_to_content = os.path.join(
-        os.path.dirname(os.path.realpath(__file__)),
-            "..", "..",
-            "big_buck_bunny_240p_mpeg4_lq.ts")
+## Retrieve the file stored in node 1 from node 2
+ccncat = ec.register_resource("LinuxCCNCat")
+ec.set(ccncat, "contentName", content_name)
+ec.register_connection(ccncat, ccnd2)
 
-# Register a FIB entry from node 1 to node 2
-co = ec.register_resource("LinuxCCNContent")
-ec.set(co, "contentName", "ccnx:/test/FILE1")
-# NEPI will upload the specified file to the remote node and write it
-# into the CCN repository
-ec.set(co, "content", local_path_to_content)
-ec.register_connection(co, ccnr1)
+##### INTERCONNECTING CCN NODES ...
 
 # Register a FIB entry from node 1 to node 2
 entry1 = ec.register_resource("LinuxFIBEntry")
@@ -120,30 +137,19 @@ entry2 = ec.register_resource("LinuxFIBEntry")
 ec.set(entry2, "host", hostname1)
 ec.register_connection(entry2, ccnd2)
 
-## Retrieve the file stored in node 1 from node 2
-command = "ccncat ccnx:/test/FILE1"
-app = ec.register_resource("LinuxCCNApplication")
-ec.set(app, "command", command)
-ec.register_connection(app, ccnd2)
-
-# Register a collector to automatically collect the ccnd logs
-# to a local directory
-col1 = ec.register_resource("Collector")
-ec.set(col1, "traceName", "stderr")
-ec.set(col1, "subDir", hostname1)
-ec.register_connection(col1, ccnd1)
-
-col2 = ec.register_resource("Collector")
-ec.set(col2, "traceName", "stderr")
-ec.set(col2, "subDir", hostname2)
-ec.register_connection(col2, ccnd2)
-
-print "Results stored at", ec.exp_dir
+##### STARTING THE EXPERIMENT
 
 ## Deploy all resources
 ec.deploy()
 
 # Wait until the ccncat is finished
-ec.wait_finished([app])
+ec.wait_finished([ccncat])
+
+stdout = ec.trace(ccncat, "stdout")
+f = open("video.ts", "w")
+f.write(stdout)
+f.close()
 
 ec.shutdown()
+
+print "Transfered FILE stored localy at video.ts"
index 69091b4..e2047d1 100644 (file)
 #         Alina Quereilhac <alina.quereilhac@inria.fr>
 #
 #
-# Example of how to run this experiment (replace with your credentials):
+# Example of how to run this experiment (replace with your information):
 #
 # $ cd <path-to-nepi>
-# python examples/linux/netcat_file_transfer.py -a <hostanme1> -b <hostname2> -u <username> -i <ssh-key>
+# python examples/linux/netcat_file_transfer.py -a <hostname1> -b <hostname2> -u <username> -i <ssh-key>
 
 from nepi.execution.ec import ExperimentController
 from nepi.execution.resource import ResourceAction, ResourceState
@@ -139,3 +139,5 @@ f.close()
 
 ec.shutdown()
 
+print "Total bytes transfered saved to bw.txt..."
+
index 9e67f58..3e9f03a 100644 (file)
 #
 # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
 
+# Example of how to run this experiment (replace with your information):
+#
+# $ cd <path-to-nepi>
+# python examples/linux/ping.py -a <hostname> -u <username> -i <ssh-key>
+
+
 from nepi.execution.ec import ExperimentController 
 
 from optparse import OptionParser, SUPPRESS_HELP
index 6d01a9b..49e2e7e 100644 (file)
 #
 # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
 #
-# Example of how to run this experiment (replace with your credentials):
+# Example of how to run this experiment (replace with your information):
 #
 # $ cd <path-to-nepi>
-# $ PYTHONPATH=$PYTHONPATH:~/repos/nepi/src python examples/linux/vlc_streaming.py -u inria_nepi -i ~/.ssh/id_rsa_planetlab -a planetlab1.u-strasbg.fr -b planetlab1.utt.fr | vlc -
-
+# python examples/linux/vlc_streaming.py -a <hostname1> -b <hostname2> -u <username> -i <ssh-key>
 
 from nepi.execution.ec import ExperimentController
 from nepi.execution.resource import ResourceState, ResourceAction 
@@ -115,8 +114,12 @@ ec.deploy()
 # Wait until the ccncat is finished
 ec.wait_finished([server])
 
-print ec.trace(client, "VIDEO")
+video = ec.trace(client, "VIDEO")
+f = open("video.ts", "w")
+f.write(video)
+f.close()
 
 ec.shutdown()
 
+print "Streamed VIDEO stored localy at video.ts"
 
index ffaee50..1fc8979 100644 (file)
@@ -282,7 +282,7 @@ class LinuxCCND(LinuxApplication):
 
     @property
     def _sources(self):
-        return "http://www.ccnx.org/releases/ccnx-0.8.1.tar.gz"
+        return "http://www.ccnx.org/releases/ccnx-0.8.2.tar.gz"
 
     @property
     def _build(self):