git://git.onelab.eu
/
nepi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use print() - import print_function - should be fine for both py2 and py3
[nepi.git]
/
examples
/
dce
/
wrapped_local_p2p_ccncat.py
diff --git
a/examples/dce/wrapped_local_p2p_ccncat.py
b/examples/dce/wrapped_local_p2p_ccncat.py
index
94f69c2
..
b85bdff
100644
(file)
--- a/
examples/dce/wrapped_local_p2p_ccncat.py
+++ b/
examples/dce/wrapped_local_p2p_ccncat.py
@@
-4,9
+4,8
@@
# Copyright (C) 2013 INRIA
#
# This program is free software: you can redistribute it and/or modify
# 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
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-18,6
+17,8
@@
#
# Author: Alina Quereilhac <alina.quereilhac@inria.fr>
#
# Author: Alina Quereilhac <alina.quereilhac@inria.fr>
+from __future__ import print_function
+
from nepi.execution.ec import ExperimentController
import os
from nepi.execution.ec import ExperimentController
import os
@@
-56,11
+57,11
@@
def add_device(ec, node, ip, prefix):
ec = ExperimentController(exp_id = "dce-ccncat")
ec = ExperimentController(exp_id = "dce-ccncat")
-node = ec.register_resource("
Linux
Node")
+node = ec.register_resource("
linux::
Node")
ec.set(node, "hostname", "localhost")
ec.set(node, "cleanProcesses", True)
ec.set(node, "hostname", "localhost")
ec.set(node, "cleanProcesses", True)
-simu = ec.register_resource("
LinuxNS3
Simulation")
+simu = ec.register_resource("
linux::ns3::
Simulation")
ec.register_connection(simu, node)
nsnode1 = add_ns3_node(ec, simu)
ec.register_connection(simu, node)
nsnode1 = add_ns3_node(ec, simu)
@@
-80,7
+81,7
@@
ec.register_connection(chan, dev2)
### create applications
# Add ccnd to ns-3 node1
### create applications
# Add ccnd to ns-3 node1
-ccnd1 = ec.register_resource("
ns3::LinuxDce
CCND")
+ccnd1 = ec.register_resource("
linux::ns3::dce::
CCND")
ec.set (ccnd1, "stackSize", 1<<20)
ec.set (ccnd1, "debug", 7)
ec.set (ccnd1, "capacity", 50000)
ec.set (ccnd1, "stackSize", 1<<20)
ec.set (ccnd1, "debug", 7)
ec.set (ccnd1, "capacity", 50000)
@@
-94,7
+95,7
@@
repofile = os.path.join(
"..", "..", "test", "resources", "linux",
"ns3", "ccn", "repoFile1")
"..", "..", "test", "resources", "linux",
"ns3", "ccn", "repoFile1")
-ccnr = ec.register_resource("
ns3::LinuxDce
CCNR")
+ccnr = ec.register_resource("
linux::ns3::dce::
CCNR")
ec.set (ccnr, "repoFile1", repofile)
ec.set (ccnr, "stackSize", 1<<20)
ec.set (ccnr, "StartTime", "2s")
ec.set (ccnr, "repoFile1", repofile)
ec.set (ccnr, "stackSize", 1<<20)
ec.set (ccnr, "StartTime", "2s")
@@
-102,7
+103,7
@@
ec.set (ccnr, "StopTime", "120s")
ec.register_connection(ccnr, nsnode1)
# Add CCN repository with content to ns-3 node2
ec.register_connection(ccnr, nsnode1)
# Add CCN repository with content to ns-3 node2
-ccnd2 = ec.register_resource("
ns3::LinuxDce
CCND")
+ccnd2 = ec.register_resource("
linux::ns3::dce::
CCND")
ec.set (ccnd2, "stackSize", 1<<20)
ec.set (ccnd2, "debug", 7)
ec.set (ccnd2, "capacity", 50000)
ec.set (ccnd2, "stackSize", 1<<20)
ec.set (ccnd2, "debug", 7)
ec.set (ccnd2, "capacity", 50000)
@@
-111,7
+112,7
@@
ec.set (ccnd2, "StopTime", "20s")
ec.register_connection(ccnd2, nsnode2)
# Add face from ns-3 node1 to ns-3 node2
ec.register_connection(ccnd2, nsnode2)
# Add face from ns-3 node1 to ns-3 node2
-ccndc1 = ec.register_resource("
ns3::LinuxDce
FIBEntry")
+ccndc1 = ec.register_resource("
linux::ns3::dce::
FIBEntry")
ec.set (ccndc1, "protocol", "udp")
ec.set (ccndc1, "uri", "ccnx:/")
ec.set (ccndc1, "host", "10.0.0.2")
ec.set (ccndc1, "protocol", "udp")
ec.set (ccndc1, "uri", "ccnx:/")
ec.set (ccndc1, "host", "10.0.0.2")
@@
-121,7
+122,7
@@
ec.set (ccndc1, "StopTime", "120s")
ec.register_connection(ccndc1, nsnode1)
# Add face from ns-3 node2 to ns-3 node1
ec.register_connection(ccndc1, nsnode1)
# Add face from ns-3 node2 to ns-3 node1
-ccndc2 = ec.register_resource("
ns3::LinuxDce
FIBEntry")
+ccndc2 = ec.register_resource("
linux::ns3::dce::
FIBEntry")
ec.set (ccndc2, "protocol", "udp")
ec.set (ccndc2, "uri", "ccnx:/")
ec.set (ccndc2, "host", "10.0.0.1")
ec.set (ccndc2, "protocol", "udp")
ec.set (ccndc2, "uri", "ccnx:/")
ec.set (ccndc2, "host", "10.0.0.1")
@@
-131,7
+132,7
@@
ec.set (ccndc2, "StopTime", "120s")
ec.register_connection(ccndc2, nsnode2)
# Add a ccncat to node2 to retrieve content
ec.register_connection(ccndc2, nsnode2)
# Add a ccncat to node2 to retrieve content
-ccncat = ec.register_resource("
ns3::LinuxDce
CCNCat")
+ccncat = ec.register_resource("
linux::ns3::dce::
CCNCat")
ec.set (ccncat, "contentName", "ccnx:/test/bunny.ts")
ec.set (ccncat, "stackSize", 1<<20)
ec.set (ccncat, "StartTime", "4s")
ec.set (ccncat, "contentName", "ccnx:/test/bunny.ts")
ec.set (ccncat, "stackSize", 1<<20)
ec.set (ccncat, "StartTime", "4s")
@@
-144,7
+145,6
@@
ec.wait_finished([ccncat])
stdout = ec.trace(ccncat, "stdout")
# convert from bytes to MB
stdout = ec.trace(ccncat, "stdout")
# convert from bytes to MB
-print
"%0.2f MBytes received" % (len(stdout) / 1024.0 / 1024.0
)
+print
("%0.2f MBytes received" % (len(stdout) / 1024.0 / 1024.0 )
)
ec.shutdown()
ec.shutdown()
-