[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r32492 - in eclectic/gplmt: . gplmt
From: |
gnunet |
Subject: |
[GNUnet-SVN] r32492 - in eclectic/gplmt: . gplmt |
Date: |
Fri, 28 Feb 2014 22:11:29 +0100 |
Author: otarabai
Date: 2014-02-28 22:11:28 +0100 (Fri, 28 Feb 2014)
New Revision: 32492
Modified:
eclectic/gplmt/gplmt.conf
eclectic/gplmt/gplmt.py
eclectic/gplmt/gplmt/Configuration.py
eclectic/gplmt/gplmt/Targets.py
eclectic/gplmt/gplmt/Worker.py
Log:
Support for HEN testbed
Modified: eclectic/gplmt/gplmt/Configuration.py
===================================================================
--- eclectic/gplmt/gplmt/Configuration.py 2014-02-28 05:26:46 UTC (rev
32491)
+++ eclectic/gplmt/gplmt/Configuration.py 2014-02-28 21:11:28 UTC (rev
32492)
@@ -46,6 +46,13 @@
self.gplmt_taskfile = None
self.gplmt_nodesfile = None
self.gplmt_userdir = ""
+ self.hen_gw = None
+ self.hen_gw_username = None
+ self.hen_gw_keyfile = None
+ self.hen_gw_keyfile_password = None
+ self.hen_node_username = None
+ self.hen_node_keyfile = None
+ self.hen_node_password = None
self.pl_slicename = ""
self.pl_api_url = ""
self.pl_username = None
@@ -117,6 +124,38 @@
pass
except ConfigParser.NoSectionError:
pass
+
+ try:
+ try:
+ self.hen_gw = config.get("hen", "hen_gw")
+ except ConfigParser.NoOptionError as e:
+ pass
+ try:
+ self.hen_gw_username = config.get("hen", "hen_gw_username")
+ except ConfigParser.NoOptionError as e:
+ pass
+ try:
+ self.hen_gw_keyfile = config.get("hen", "hen_gw_keyfile")
+ except ConfigParser.NoOptionError as e:
+ pass
+ try:
+ self.hen_gw_keyfile_password = config.get("hen",
"hen_gw_keyfile_password")
+ except ConfigParser.NoOptionError as e:
+ pass
+ try:
+ self.hen_node_username = config.get("hen", "hen_node_username")
+ except ConfigParser.NoOptionError as e:
+ pass
+ try:
+ self.hen_node_keyfile = config.get("hen", "hen_node_keyfile")
+ except ConfigParser.NoOptionError as e:
+ pass
+ try:
+ self.hen_node_password = config.get("hen", "hen_node_password")
+ except ConfigParser.NoOptionError as e:
+ pass
+ except ConfigParser.NoSectionError:
+ pass
try:
try:
Modified: eclectic/gplmt/gplmt/Targets.py
===================================================================
--- eclectic/gplmt/gplmt/Targets.py 2014-02-28 05:26:46 UTC (rev 32491)
+++ eclectic/gplmt/gplmt/Targets.py 2014-02-28 21:11:28 UTC (rev 32492)
@@ -30,6 +30,7 @@
local = 2
remote_ssh = 3
planetlab = 4
+ hen = 5
def __init__(self, Type = undefined):
self.value = Type
def __str__(self):
@@ -41,6 +42,8 @@
return 'remote_ssh'
if self.value == Target.planetlab:
return 'planetlab'
+ if self.value == Target.hen:
+ return 'hen'
else:
return "undefined"
def __ne__(self,y):
@@ -68,11 +71,13 @@
return Target (Target.remote_ssh)
elif (str.lower(source_str) == str (Target (Target.planetlab))):
return Target (Target.planetlab)
+ elif (str.lower(source_str) == str (Target (Target.hen))):
+ return Target (Target.hen)
else:
return Target (Target.undefined)
if __name__ == "__main__":
- for s in ["local", "remote_ssh", "planetlab"]:
+ for s in ["local", "remote_ssh", "planetlab", "hen"]:
print s
sys.exit(0)
-
\ No newline at end of file
+
Modified: eclectic/gplmt/gplmt/Worker.py
===================================================================
--- eclectic/gplmt/gplmt/Worker.py 2014-02-28 05:26:46 UTC (rev 32491)
+++ eclectic/gplmt/gplmt/Worker.py 2014-02-28 21:11:28 UTC (rev 32492)
@@ -586,7 +586,71 @@
def interrupt_task (self):
g_logger.log (self.node.hostname + " : Task interrupted by timeout")
self.task_interrupted = True
+
+class HenWorker (RemoteSSHWorker):
+ def connect(self):
+ self.transport = None
+ if (interrupt):
+ return TaskExecutionResult(Tasks.Taskresult.user_interrupt,
"interrupted by user", "")
+
+ try:
+ # Connect to gateway
+ g_logger.log('Connecting to hen gateway %s' %
g_configuration.hen_gw)
+ sshgw = paramiko.SSHClient()
+ sshgw.load_system_host_keys()
+ sshgw.set_missing_host_key_policy(paramiko.AutoAddPolicy())
+
+ sshgw.connect(g_configuration.hen_gw,
+ 22,
+ username=g_configuration.hen_gw_username,
+ timeout=10,
+ key_filename=g_configuration.hen_gw_keyfile,
+ password=g_configuration.hen_gw_keyfile_password)
+
+ # Create a new channel from gateway to node
+ g_logger.log('Connecting to node %s through hen gateway' %
self.node.hostname)
+
+ port = 22 if self.node.port is None else self.node.port
+ transgw = sshgw.get_transport()
+ nodechannel = transgw.open_channel('direct-tcpip',
(self.node.hostname, port), ('127.0.0.1', 0))
+ self.transport = paramiko.Transport(nodechannel)
+ self.transport.start_client()
+
+ # Node authentication
+ if self.node.username is not None: # username/password supplied in
node file
+ self.transport.auth_password(self.node.username,
self.node.password)
+
+ elif g_configuration.hen_node_keyfile is not None: # Private key
supplied in config
+ for pkey_class in (paramiko.RSAKey, paramiko.DSSKey):
+ try:
+ key =
pkey_class.from_private_key_file(g_configuration.hen_node_keyfile,
g_configuration.hen_node_password)
+ break
+ except paramiko.SSHException, e:
+ pass
+
self.transport.auth_publickey(g_configuration.hen_node_username, key)
+
+ else:
+
self.transport.auth_password(g_configuration.hen_node_username,
g_configuration.hen_node_password)
+
+ self.sshgw = sshgw # not needed later but to avoid gc
disconnecting us
+
+ except (IOError,
+ paramiko.SSHException,
+ paramiko.BadHostKeyException,
+ paramiko.AuthenticationException,
+ socket.error) as e:
+ g_logger.log (self.node.hostname + " : Error while trying to
connect: " + str(e))
+ return TaskExecutionResult (Tasks.Taskresult.fail, str(e), "")
+
+ g_logger.log (self.node.hostname + " : Connected!")
+ return TaskExecutionResult (Tasks.Taskresult.success, "", "")
+ def disconnect(self):
+ if (None == self.transport):
+ return TaskExecutionResult (Tasks.Taskresult.fail, "", "")
+ self.transport.close()
+ return TaskExecutionResult (Tasks.Taskresult.success, "", "")
+
class PlanetLabWorker (RemoteSSHWorker):
def connect (self):
self.ssh = None
@@ -648,7 +712,9 @@
elif (self.target == Targets.Target (Targets.Target.remote_ssh)):
self.thread = RemoteSSHWorker (1, self.node, self.tasks);
elif (self.target == Targets.Target (Targets.Target.planetlab)):
- self.thread = PlanetLabWorker (1, self.node, self.tasks);
+ self.thread = PlanetLabWorker (1, self.node, self.tasks);
+ elif (self.target == Targets.Target (Targets.Target.hen)):
+ self.thread = HenWorker (1, self.node, self.tasks);
return
def start (self):
g_logger.log ("Starting execution for node " + self.node.hostname)
Modified: eclectic/gplmt/gplmt.conf
===================================================================
--- eclectic/gplmt/gplmt.conf 2014-02-28 05:26:46 UTC (rev 32491)
+++ eclectic/gplmt/gplmt.conf 2014-02-28 21:11:28 UTC (rev 32492)
@@ -12,7 +12,24 @@
# Default target to execute experiment on [local|planetlab|remote_ssh]
# target = planetlab
+[hen]
+# Gateway server
+hen_gw = cockerel.cs.ucl.ac.uk
+#hen_gw = hen.cs.ucl.ac.uk
+
+# Gateway authentication
+hen_gw_username = <gw-username>
+hen_gw_keyfile = <gw-keyfile-path>
+hen_gw_keyfile_password = <gw-password>
+
+# Node authentication
+hen_node_username = <node-username>
+hen_node_keyfile = <node-keyfile-path>
+# Password is used for private key if specified
+# otherwise, used for password auth
+hen_node_password = <node-password>
+
[planetlab]
slice = tumple_gnunet
# Configuration for Planetlab API
Modified: eclectic/gplmt/gplmt.py
===================================================================
--- eclectic/gplmt/gplmt.py 2014-02-28 05:26:46 UTC (rev 32491)
+++ eclectic/gplmt/gplmt.py 2014-02-28 21:11:28 UTC (rev 32492)
@@ -235,7 +235,7 @@
-c, --config=FILENAME use configuration file FILENAME\n\
-n, --nodes=FILENAME use node file FILENAME\n\
-l, --tasks=FILENAME use tasks file FILENAME\n\
- -t, --target=TARGET TARGET={local|remote_ssh|planetlab}\n\
+ -t, --target=TARGET TARGET={local|remote_ssh|planetlab|hen}\n\
-C, --command= run single commandgplmt_taskfile of taskfile,
print output using -v\n\
-a, --all use all nodes assigned to PlanetLab slice instead
of nodes file\n\
-p, --password password to access PlanetLab API\n\
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r32492 - in eclectic/gplmt: . gplmt,
gnunet <=