X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=examples%2Flinux%2Fccn_simple_transfer.py;h=39ea8f0a133a716e63d2cb7070d0d1be883a0f15;hb=039fbd9629d7570d4c175a5448d24badcd0f3aba;hp=7e06207f10905abf01dc71553100ca490c52e2ec;hpb=a55b5cf0818ced6ab8dc3e88fad7f6616675e826;p=nepi.git diff --git a/examples/linux/ccn_simple_transfer.py b/examples/linux/ccn_simple_transfer.py index 7e06207f..39ea8f0a 100644 --- a/examples/linux/ccn_simple_transfer.py +++ b/examples/linux/ccn_simple_transfer.py @@ -3,9 +3,8 @@ # Copyright (C) 2014 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 @@ -32,12 +31,14 @@ # 0 ------- network -------- 1 # +from __future__ import print_function + from nepi.execution.ec import ExperimentController -from optparse import OptionParser, SUPPRESS_HELP +from optparse import OptionParser import os -usage = ("usage: %prog -a -b -u -i ") +usage = ("usage: %prog -a -b -u -i ") parser = OptionParser(usage = usage) parser.add_option("-a", "--hostname1", dest="hostname1", @@ -62,7 +63,7 @@ ec = ExperimentController(exp_id = "ccn_simple_transfer") ##### CONFIGURING NODE 1 ## Register node 1 -node1 = ec.register_resource("LinuxNode") +node1 = ec.register_resource("linux::Node") # Set the hostname of the first node to use for the experiment ec.set(node1, "hostname", hostname1) # username should be your SSH user @@ -75,13 +76,13 @@ ec.set(node1, "cleanExperiment", True) ec.set(node1, "cleanProcesses", True) ## Register a CCN daemon in node 1 -ccnd1 = ec.register_resource("LinuxCCND") +ccnd1 = ec.register_resource("linux::CCND") # 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") +ccnr1 = ec.register_resource("linux::CCNR") ec.register_connection(ccnr1, ccnd1) ## Push the file into the repository @@ -92,7 +93,7 @@ local_path_to_content = os.path.join( content_name = "ccnx:/test/FILE" # Add a content to the repository -co = ec.register_resource("LinuxCCNContent") +co = ec.register_resource("linux::CCNContent") ec.set(co, "contentName", content_name) # NEPI will upload the specified file to the remote node and write it # into the CCN repository @@ -102,7 +103,7 @@ ec.register_connection(co, ccnr1) ##### CONFIGURING NODE 2 ## Register node 2 -node2 = ec.register_resource("LinuxNode") +node2 = ec.register_resource("linux::Node") # Set the hostname of the first node to use for the experiment ec.set(node2, "hostname", hostname2) # username should be your SSH user @@ -115,25 +116,25 @@ ec.set(node2, "cleanExperiment", True) ec.set(node2, "cleanProcesses", True) ## Register a CCN daemon in node 2 -ccnd2 = ec.register_resource("LinuxCCND") +ccnd2 = ec.register_resource("linux::CCND") # Set ccnd log level to 7 ec.set(ccnd2, "debug", 7) ec.register_connection(ccnd2, node2) ## Retrieve the file stored in node 1 from node 2 -ccncat = ec.register_resource("LinuxCCNCat") +ccncat = ec.register_resource("linux::CCNCat") ec.set(ccncat, "contentName", content_name) ec.register_connection(ccncat, ccnd2) ##### INTERCONNECTING CCN NODES ... # Register a FIB entry from node 1 to node 2 -entry1 = ec.register_resource("LinuxFIBEntry") +entry1 = ec.register_resource("linux::FIBEntry") ec.set(entry1, "host", hostname2) ec.register_connection(entry1, ccnd1) # Register a FIB entry from node 2 to node 1 -entry2 = ec.register_resource("LinuxFIBEntry") +entry2 = ec.register_resource("linux::FIBEntry") ec.set(entry2, "host", hostname1) ec.register_connection(entry2, ccnd2) @@ -152,4 +153,4 @@ f.close() ec.shutdown() -print "Transfered FILE stored localy at video.ts" +print("Transfered FILE stored localy at video.ts")