Adding examples/linux/dce/dce_ccn_application.py
[nepi.git] / examples / linux / dce / custom_dce_ccn.py
index f062b08..b22d668 100644 (file)
@@ -83,8 +83,10 @@ ec.register_connection(chan, p2p1)
 ec.register_connection(chan, p2p2)
 
 ### create applications
-ccnd1 = ec.register_resource("ns3::LinuxCCNDceApplication")
 
+# Add a LinuxCCNDceApplication to ns-3 node 1 to install custom ccnx sources
+# and run a CCNx daemon
+ccnd1 = ec.register_resource("ns3::LinuxCCNDceApplication")
 # NOTE THAT INSTALLATION MIGHT FAIL IF openjdk-6-jdk is not installed
 ec.set(ccnd1, "depends", "libpcap0.8-dev openjdk-6-jdk ant1.8 autoconf "
     "libssl-dev libexpat-dev libpcap-dev libecryptfs0 libxml2-utils auto"
@@ -104,6 +106,8 @@ ec.set (ccnd1, "StartTime", "1s")
 ec.set (ccnd1, "StopTime", "20s")
 ec.register_connection(ccnd1, nsnode1)
 
+# Add a CCN repository to ns-3 node1 manually configuring all
+# parameters
 repofile = os.path.join(
     os.path.dirname(os.path.realpath(__file__)), 
     "..", "..", "..",
@@ -118,14 +122,10 @@ ec.set (ccnr, "StartTime", "2s")
 ec.set (ccnr, "StopTime", "120s")
 ec.register_connection(ccnr, nsnode1)
 
-ccndc1 = ec.register_resource("ns3::LinuxCCNDceApplication")
-ec.set (ccndc1, "binary", "ccndc")
-ec.set (ccndc1, "arguments", "-v;add;ccnx:/;udp;10.0.0.2")
-ec.set (ccndc1, "stackSize", 1<<20)
-ec.set (ccndc1, "StartTime", "2s")
-ec.set (ccndc1, "StopTime", "120s")
-ec.register_connection(ccndc1, nsnode1)
-
+# Add a LinuxCCNDceApplication to ns-3 node 1 to run a CCN
+# daemon. Note that the CCNx sources and build instructions 
+# do not need to be specified again (NEPI will take the 
+# instructions from the first definition).
 ccnd2 = ec.register_resource("ns3::LinuxCCNDceApplication")
 ec.set (ccnd2, "binary", "ccnd")
 ec.set (ccnd2, "stackSize", 1<<20)
@@ -134,6 +134,16 @@ ec.set (ccnd2, "StartTime", "1s")
 ec.set (ccnd2, "StopTime", "120s")
 ec.register_connection(ccnd2, nsnode2)
 
+# Add DCE application to configure peer CCN faces between
+# nodes
+ccndc1 = ec.register_resource("ns3::LinuxCCNDceApplication")
+ec.set (ccndc1, "binary", "ccndc")
+ec.set (ccndc1, "arguments", "-v;add;ccnx:/;udp;10.0.0.2")
+ec.set (ccndc1, "stackSize", 1<<20)
+ec.set (ccndc1, "StartTime", "2s")
+ec.set (ccndc1, "StopTime", "120s")
+ec.register_connection(ccndc1, nsnode1)
+
 ccndc2 = ec.register_resource("ns3::LinuxCCNDceApplication")
 ec.set (ccndc2, "binary", "ccndc")
 ec.set (ccndc2, "arguments", "-v;add;ccnx:/;udp;10.0.0.1")
@@ -142,15 +152,7 @@ ec.set (ccndc2, "StartTime", "2s")
 ec.set (ccndc2, "StopTime", "120s")
 ec.register_connection(ccndc2, nsnode2)
 
-ccnpeek = ec.register_resource("ns3::LinuxCCNDceApplication")
-ec.set (ccnpeek, "binary", "ccnpeek")
-ec.set (ccnpeek, "arguments", "ccnx:/test/bunny.ts")
-ec.set (ccnpeek, "stdinFile", "")
-ec.set (ccnpeek, "stackSize", 1<<20)
-ec.set (ccnpeek, "StartTime", "4s")
-ec.set (ccnpeek, "StopTime", "120s")
-ec.register_connection(ccnpeek, nsnode2)
-
+# Add a DCE application to perform a ccncat and retrieve content
 ccncat = ec.register_resource("ns3::LinuxCCNDceApplication")
 ec.set (ccncat, "binary", "ccncat")
 ec.set (ccncat, "arguments", "ccnx:/test/bunny.ts")