aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-04-13 16:33:26 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2017-04-13 16:33:26 +0200
commit81ca2217d34b70e6a3ef7385261be38958cb4a42 (patch)
tree8732620d1d9c8fb84bf1573d6bbededf2fb9dbb2
parenta766f2d202eaf586b8da5f678e9a8a21b31448d7 (diff)
downloadrumba-81ca2217d34b70e6a3ef7385261be38958cb4a42.tar.gz
rumba-81ca2217d34b70e6a3ef7385261be38958cb4a42.zip
rumba: Add ProxyCommand for jFed
This adds a proxy command for the jFed testbed so that it can be accessed when someone does not have IPv6.
-rw-r--r--rumba/model.py3
-rw-r--r--rumba/ssh_support.py16
-rw-r--r--rumba/testbeds/jfed.py5
3 files changed, 21 insertions, 3 deletions
diff --git a/rumba/model.py b/rumba/model.py
index c2c4cfa..4ada554 100644
--- a/rumba/model.py
+++ b/rumba/model.py
@@ -128,9 +128,10 @@ class NormalDIF(DIF):
# SSH Configuration
#
class SSHConfig:
- def __init__(self, hostname, port=22):
+ def __init__(self, hostname, port=22, proxycommand=None):
self.hostname = hostname
self.port = port
+ self.proxycommand = proxycommand
# A node in the experiment
#
diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py
index c6615c3..2c9d6d0 100644
--- a/rumba/ssh_support.py
+++ b/rumba/ssh_support.py
@@ -49,10 +49,16 @@ def execute_commands(testbed, ssh_config, commands, time_out=3):
'''
ssh_client = get_ssh_client()
+ if ssh_config.proxycommand != None:
+ proxy = paramiko.ProxyCommand(ssh_config.proxycommand)
+ else:
+ proxy = None
+
try:
ssh_client.connect(ssh_config.hostname, ssh_config.port,
testbed.username, testbed.password,
- look_for_keys=True, timeout=time_out)
+ look_for_keys=True, timeout=time_out,
+ sock=proxy)
for command in commands:
print("%s@%s:%s >> %s" % (testbed.username,
ssh_config.hostname, ssh_config.port, command))
@@ -98,11 +104,17 @@ def copy_file_to_testbed(testbed, ssh_config, text, file_name):
'''
ssh_client = get_ssh_client()
+ if ssh_config.proxycommand != None:
+ proxy = paramiko.ProxyCommand(ssh_config.proxycommand)
+ else:
+ proxy = None
+
try:
ssh_client.connect(ssh_config.hostname, ssh_config.port,
testbed.username,
testbed.password,
- look_for_keys=True)
+ look_for_keys=True,
+ sock=proxy)
cmd = "touch " + file_name + \
"; chmod a+rwx " + file_name
diff --git a/rumba/testbeds/jfed.py b/rumba/testbeds/jfed.py
index 0dfc904..f09bb4e 100644
--- a/rumba/testbeds/jfed.py
+++ b/rumba/testbeds/jfed.py
@@ -113,6 +113,11 @@ class Testbed(mod.Testbed):
auth_name_r = self.auth_name.replace(".", "-")
node.ssh_config.hostname = node.name + "." + self.exp_name + "." + \
auth_name_r + "." + self.auth_name
+ node.ssh_config.proxycommand = "ssh -i '" + self.cert_file + \
+ "' -o StrictHostKeyChecking=no " + \
+ self.username + \
+ "@bastion.test.iminds.be nc " + \
+ node.ssh_config.hostname + " 22"
subprocess.call(["java", "-jar", self.jfed_jar, "create", "-S", \
self.proj_name, "--rspec", \