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
/
ccn_emu_live
/
planetlab.py
diff --git
a/examples/ccn_emu_live/planetlab.py
b/examples/ccn_emu_live/planetlab.py
index
3fd8361
..
b2548f3
100644
(file)
--- a/
examples/ccn_emu_live/planetlab.py
+++ b/
examples/ccn_emu_live/planetlab.py
@@
-1,13
+1,11
@@
#!/usr/bin/env python
#!/usr/bin/env python
-
-###############################################################################
#
# NEPI, a framework to manage network experiments
#
# NEPI, a framework to manage network experiments
+# Copyright (C) 2013 INRIA
#
# This program is free software: you can redistribute it and/or modify
#
# 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,8
+16,8
@@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Author: Alina Quereilhac <alina.quereilhac@inria.fr>
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Author: Alina Quereilhac <alina.quereilhac@inria.fr>
-#
-###############################################################################
+
+from __future__ import print_function
from nepi.execution.ec import ExperimentController
from nepi.execution.runner import ExperimentRunner
from nepi.execution.ec import ExperimentController
from nepi.execution.runner import ExperimentRunner
@@
-76,7
+74,7
@@
def add_pl_host(ec, nid):
hostname = PL_NODES[nid]
# Add a planetlab host to the experiment description
hostname = PL_NODES[nid]
# Add a planetlab host to the experiment description
- host = ec.register_resource("
Planetlab
Node")
+ host = ec.register_resource("
planetlab::
Node")
ec.set(host, "hostname", hostname)
ec.set(host, "username", pl_slice)
ec.set(host, "identity", pl_ssh_key)
ec.set(host, "hostname", hostname)
ec.set(host, "username", pl_slice)
ec.set(host, "identity", pl_ssh_key)
@@
-100,7
+98,7
@@
def add_pl_ccnd(ec, nid):
host = ec.netgraph.node_annotation(nid, "host")
# Add a CCN daemon to the planetlab node
host = ec.netgraph.node_annotation(nid, "host")
# Add a CCN daemon to the planetlab node
- ccnd = ec.register_resource("
Linux
CCND")
+ ccnd = ec.register_resource("
linux::
CCND")
ec.set(ccnd, "debug", 7)
ec.register_connection(ccnd, host)
ec.set(ccnd, "debug", 7)
ec.register_connection(ccnd, host)
@@
-116,7
+114,7
@@
def add_pl_ccnr(ec, nid):
ccnd = ec.netgraph.node_annotation(nid, "ccnd")
# Add a CCN content repository to the planetlab node
ccnd = ec.netgraph.node_annotation(nid, "ccnd")
# Add a CCN content repository to the planetlab node
- ccnr = ec.register_resource("
Linux
CCNR")
+ ccnr = ec.register_resource("
linux::
CCNR")
ec.set(ccnr, "repoFile1", repofile)
ec.register_connection(ccnr, ccnd)
ec.set(ccnr, "repoFile1", repofile)
ec.register_connection(ccnr, ccnd)
@@
-126,7
+124,7
@@
def add_pl_ccncat(ec, nid):
ccnd = ec.netgraph.node_annotation(nid, "ccnd")
# Add a CCN cat application to the planetlab node
ccnd = ec.netgraph.node_annotation(nid, "ccnd")
# Add a CCN cat application to the planetlab node
- ccncat = ec.register_resource("
Linux
CCNCat")
+ ccncat = ec.register_resource("
linux::
CCNCat")
ec.set(ccncat, "pipeline", pipeline)
ec.set(ccncat, "contentName", content_name)
ec.register_connection(ccncat, ccnd)
ec.set(ccncat, "pipeline", pipeline)
ec.set(ccncat, "contentName", content_name)
ec.register_connection(ccncat, ccnd)
@@
-137,7
+135,7
@@
def add_pl_fib_entry(ec, nid1, nid2):
hostname2 = ec.netgraph.node_annotation(nid2, "hostname")
# Add a FIB entry between one planetlab node and its peer
hostname2 = ec.netgraph.node_annotation(nid2, "hostname")
# Add a FIB entry between one planetlab node and its peer
- entry = ec.register_resource("
Linux
FIBEntry")
+ entry = ec.register_resource("
linux::
FIBEntry")
ec.set(entry, "host", hostname2)
ec.register_connection(entry, ccnd1)
ec.set(entry, "host", hostname2)
ec.register_connection(entry, ccnd1)
@@
-177,7
+175,7
@@
def avg_interests(ec, run):
f = open("/tmp/metric", "a+")
f.write("%.2f\n" % metric)
f.close()
f = open("/tmp/metric", "a+")
f.write("%.2f\n" % metric)
f.close()
- print
" METRIC", metric
+ print
(" METRIC", metric)
return metric
return metric
@@
-208,10
+206,10
@@
if __name__ == '__main__':
add_node_callback = add_pl_node,
add_edge_callback = add_pl_edge)
add_node_callback = add_pl_node,
add_edge_callback = add_pl_edge)
- print
"Results stored at", ec.exp_dir
+ print
("Results stored at", ec.exp_dir)
#### Retrieve the content producing resource to wait for ot to finish
#### Retrieve the content producing resource to wait for ot to finish
- ccncat = ec.filter_resources("
Linux
CCNCat")
+ ccncat = ec.filter_resources("
linux::
CCNCat")
#### Run experiment until metric convergences
rnr = ExperimentRunner()
#### Run experiment until metric convergences
rnr = ExperimentRunner()