From 09b79152023e41ea1a864f854dfcbe2875c532e4 Mon Sep 17 00:00:00 2001 From: Lucia Guevgeozian Odizzio Date: Fri, 21 Mar 2014 12:08:00 +0100 Subject: [PATCH] oops --- Makefile | 4 +++ .../linux/ccn/two_nodes_file_retrieval.py | 30 +++++++------------ src/nepi/resources/linux/ccn/ccnd.py | 4 --- src/nepi/resources/linux/ccn/ccnr.py | 1 - src/nepi/resources/linux/node.py | 2 +- test/resources/linux/node.py | 5 ++-- 6 files changed, 17 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index 039820b2..24e5b158 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,11 @@ SUBBUILDDIR = $(shell python -c 'import distutils.util, sys; \ PYTHON25 := $(shell python -c 'import sys; v = sys.version_info; \ print (1 if v[0] <= 2 and v[1] <= 5 else 0)') +ifeq ($(PYTHON25),0) +BUILDDIR := $(BUILDDIR)/$(SUBBUILDDIR) +else BUILDDIR := $(BUILDDIR)/lib +endif PYPATH = $(BUILDDIR):$(TESTLIB):$(PYTHONPATH) COVERAGE = $(or $(shell which coverage), $(shell which python-coverage), \ diff --git a/examples/linux/ccn/two_nodes_file_retrieval.py b/examples/linux/ccn/two_nodes_file_retrieval.py index 1d406d29..8e40c3bd 100755 --- a/examples/linux/ccn/two_nodes_file_retrieval.py +++ b/examples/linux/ccn/two_nodes_file_retrieval.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # # NEPI, a framework to manage network experiments # Copyright (C) 2014 INRIA @@ -32,9 +31,8 @@ from nepi.execution.ec import ExperimentController import os -#ssh_key = ####### <<< ASSING the absolute path to the private SSH key to login into the remote host >>> -#ssh_user = ####### <<< ASSING the SSH username >>> -ssh_user = "icnuser" +ssh_key = ####### <<< ASSING the absolute path to the private SSH key to login into the remote host >>> +ssh_user = ####### <<< ASSING the SSH username >>> ## Create the experiment controller ec = ExperimentController(exp_id = "demo_CCN") @@ -42,32 +40,28 @@ ec = ExperimentController(exp_id = "demo_CCN") ## Register node 1 node1 = ec.register_resource("LinuxNode") # Set the hostname of the first node to use for the experiment -#hostname1 = "peeramidion.irisa.fr" ##### <<< ASSIGN the hostname of a host you have SSSH access to >>> -hostname1 = "133.69.33.148" +hostname1 = "peeramidion.irisa.fr" ##### <<< ASSIGN the hostname of a host you have SSSH access to >>> ec.set(node1, "hostname", hostname1) # username should be your SSH user ec.set(node1, "username", ssh_user) # Absolute path to the SSH private key -#ec.set(node1, "identity", ssh_key) +ec.set(node1, "identity", ssh_key) # Clean all files, results, etc, from previous experiments wit the same exp_id -#ec.set(node1, "cleanExperiment", True) -ec.set(node1, "cleanHome", True) +ec.set(node1, "cleanExperiment", True) # Kill all running processes in the node before running the experiment ec.set(node1, "cleanProcesses", True) ## Register node 2 node2 = ec.register_resource("LinuxNode") # Set the hostname of the first node to use for the experiment -#hostname2 = "planetlab2.upc.es" ##### <<< ASSIGN the hostname of a host you have SSSH access to >>> -hostname2 = "133.69.33.149" +hostname2 = "planetlab2.upc.es" ##### <<< ASSIGN the hostname of a host you have SSSH access to >>> ec.set(node2, "hostname", hostname2) # username should be your SSH user ec.set(node2, "username", ssh_user) # Absolute path to the SSH private key -#ec.set(node2, "identity", ssh_key) +ec.set(node2, "identity", ssh_key) # Clean all files, results, etc, from previous experiments wit the same exp_id -#ec.set(node2, "cleanExperiment", True) -ec.set(node2, "cleanHome", True) +ec.set(node2, "cleanExperiment", True) # Kill all running processes in the node before running the experiment ec.set(node2, "cleanProcesses", True) @@ -75,14 +69,12 @@ ec.set(node2, "cleanProcesses", True) ccnd1 = ec.register_resource("LinuxCCND") # Set ccnd log level to 7 ec.set(ccnd1, "debug", 7) -ec.set(ccnd1, "port", 9597) 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.set(ccnd2, "port", 9597) ec.register_connection(ccnd2, node2) ## Register a repository in node 1 @@ -105,14 +97,12 @@ ec.register_connection(co, ccnr1) # Register a FIB entry from node 1 to node 2 entry1 = ec.register_resource("LinuxFIBEntry") -ec.set(entry1, "host", "10.0.32.2") -ec.set(entry1, "port", 9597) +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") -ec.set(entry2, "host", "10.0.0.2") -ec.set(entry2, "port", 9597) +ec.set(entry2, "host", hostname1) ec.register_connection(entry2, ccnd2) ## Retrieve the file stored in node 1 from node 2 diff --git a/src/nepi/resources/linux/ccn/ccnd.py b/src/nepi/resources/linux/ccn/ccnd.py index 44bc2761..ffaee508 100644 --- a/src/nepi/resources/linux/ccn/ccnd.py +++ b/src/nepi/resources/linux/ccn/ccnd.py @@ -136,10 +136,6 @@ class LinuxCCND(LinuxApplication): def path(self): return "PATH=$PATH:${BIN}/%s/" % self.version - @property - def environment(self): - return self._environment() - def do_deploy(self): if not self.node or self.node.state < ResourceState.READY: self.debug("---- RESCHEDULING DEPLOY ---- node state %s " % self.node.state ) diff --git a/src/nepi/resources/linux/ccn/ccnr.py b/src/nepi/resources/linux/ccn/ccnr.py index e839a56a..9ac5cce0 100644 --- a/src/nepi/resources/linux/ccn/ccnr.py +++ b/src/nepi/resources/linux/ccn/ccnr.py @@ -296,7 +296,6 @@ class LinuxCCNR(LinuxApplication): }) env = self.ccnd.path - #env = self.ccnd.path + self.ccnd.environment env += " ".join(map(lambda k: "%s=%s" % (envs.get(k), self.get(k)) \ if self.get(k) else "", envs.keys())) diff --git a/src/nepi/resources/linux/node.py b/src/nepi/resources/linux/node.py index 13cf0767..8ad69f32 100644 --- a/src/nepi/resources/linux/node.py +++ b/src/nepi/resources/linux/node.py @@ -681,7 +681,7 @@ class LinuxNode(ResourceManager): # If dst files should not be overwritten, check that the files do not # exits already if isinstance(src, str): - src = map(os.path.expanduser, map(str.strip, src.split(";"))) + src = map(str.strip, src.split(";")) if overwrite == False: src = self.filter_existing_files(src, dst) diff --git a/test/resources/linux/node.py b/test/resources/linux/node.py index 27b7817e..e46f6673 100755 --- a/test/resources/linux/node.py +++ b/test/resources/linux/node.py @@ -298,7 +298,7 @@ main (void) dirpath = tempfile.mkdtemp() f = tempfile.NamedTemporaryFile(dir=dirpath, delete=False) f.close() - + f1 = tempfile.NamedTemporaryFile(delete=False) f1.close() f1.name @@ -310,8 +310,7 @@ main (void) node.copy(source, dest) command = "ls %s" % destdir - - import pdb;pdb.set_trace() + (out, err), proc = node.execute(command) os.remove(f1.name) -- 2.43.0