aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rumba/elements/experimentation.py3
-rw-r--r--rumba/elements/topology.py4
-rw-r--r--rumba/executors/ssh.py14
-rw-r--r--rumba/prototypes/rlite.py4
-rw-r--r--rumba/ssh_support.py65
-rw-r--r--rumba/testbeds/emulab.py9
-rw-r--r--rumba/testbeds/jfed.py11
7 files changed, 35 insertions, 75 deletions
diff --git a/rumba/elements/experimentation.py b/rumba/elements/experimentation.py
index d0910a6..5a86b6f 100644
--- a/rumba/elements/experimentation.py
+++ b/rumba/elements/experimentation.py
@@ -47,14 +47,12 @@ class Testbed(object):
username,
password,
proj_name,
- http_proxy=None,
system_logs=None):
"""
:param exp_name: The experiment name.
:param username: The username.
:param password: The password.
:param proj_name: The project name.
- :param http_proxy: HTTP proxy used by the testbed.
:param system_logs: Location of the system logs of
images of the testbed.
"""
@@ -62,7 +60,6 @@ class Testbed(object):
self.password = password
self.proj_name = proj_name
self.exp_name = exp_name
- self.http_proxy = http_proxy
self.flags = {'no_vlan_offload': False}
self.executor = None
if system_logs is None:
diff --git a/rumba/elements/topology.py b/rumba/elements/topology.py
index 46f24c2..5a3ad17 100644
--- a/rumba/elements/topology.py
+++ b/rumba/elements/topology.py
@@ -550,7 +550,6 @@ class SSHConfig(object):
self.proxy_server = proxy_server
self.client = None
self.proxy_client = None
- self.http_proxy = None
def set_username(self, username):
self.username = username
@@ -558,9 +557,6 @@ class SSHConfig(object):
def set_password(self, password):
self.password = password
- def set_http_proxy(self, proxy):
- self.http_proxy = proxy
-
class Node(object):
"""
diff --git a/rumba/executors/ssh.py b/rumba/executors/ssh.py
index 6876204..a53b978 100644
--- a/rumba/executors/ssh.py
+++ b/rumba/executors/ssh.py
@@ -26,14 +26,12 @@
from rumba.model import Executor
from rumba.ssh_support import execute_command, execute_commands, \
- copy_file_to_testbed, copy_file_from_testbed, execute_proxy_command, \
- execute_proxy_commands
+ copy_file_to_testbed, copy_file_from_testbed
class SSHExecutor(Executor):
- def __init__(self, testbed, use_proxy=False):
+ def __init__(self, testbed):
self.testbed = testbed
- self.use_proxy = use_proxy
def execute_command(self, node, command, as_root=False, time_out=3):
return self.execute_commands(node, [command], as_root, time_out)
@@ -43,12 +41,8 @@ class SSHExecutor(Executor):
if node.ssh_config.username != 'root':
commands = list(map(lambda c: "sudo %s" % (c,), commands))
- if self.use_proxy:
- return execute_proxy_commands(self, node.ssh_config, commands,
- time_out)
- else:
- return execute_commands(self.testbed, node.ssh_config, commands,
- time_out)
+ return execute_commands(self.testbed, node.ssh_config, commands,
+ time_out)
def fetch_file(self, node, path, destination, sudo=False):
copy_file_from_testbed(self.testbed, node.ssh_config, path,
diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py
index 4d0d453..e67e539 100644
--- a/rumba/prototypes/rlite.py
+++ b/rumba/prototypes/rlite.py
@@ -70,10 +70,6 @@ class Experiment(mod.Experiment):
ssh.execute_commands(self.testbed, node.ssh_config,
cmds, time_out=None)
- def execute_proxy_commands(self, node, cmds):
- ssh.execute_proxy_commands(self.testbed, node.ssh_config,
- cmds, time_out=None)
-
# Prepend sudo to all commands if the user is not 'root'
def may_sudo(self, cmds):
if self.testbed.username != 'root':
diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py
index cfe8c26..5d62b81 100644
--- a/rumba/ssh_support.py
+++ b/rumba/ssh_support.py
@@ -156,51 +156,6 @@ def ssh_sftp(ssh_config, testbed):
chan.invoke_subsystem("sftp")
return paramiko.sftp_client.SFTPClient(chan)
-def execute_proxy_commands(testbed, ssh_config, commands, time_out=3):
- """
- Remote execution of a list of shell command on hostname, using the
- http and https proxy specified by the testbed. By
- default this function will exit (timeout) after 3 seconds.
-
- @param testbed: testbed info
- @param ssh_config: ssh config of the node
- @param commands: *nix shell command
- @param time_out: time_out value in seconds, error will be generated if
- no result received in given number of seconds, the value None can
- be used when no timeout is needed
- """
- new_commands = []
- for command in commands:
- proxy = testbed.http_proxy
- if proxy is not None:
- proxy_command = 'export http_proxy=' + proxy + '; ' \
- + 'export https_proxy=' + proxy + ';'
- new_commands.append(proxy_command + ' ' + command)
- else:
- new_commands.append(command)
- return execute_commands(testbed, ssh_config, new_commands, time_out)
-
-
-def execute_proxy_command(testbed, ssh_config, command, time_out=3):
- """
- Remote execution of a list of shell command on hostname, using
- a proxy http and https.
- By default this function will exit (timeout) after 3 seconds.
-
- @param testbed: testbed info
- @param ssh_config: ssh config of the node
- @param command: *nix shell command
- @param time_out: time_out value in seconds, error will be generated if
- no result received in given number of seconds, the value None can
- be used when no timeout is needed
-
- @return: stdout resulting from the command
- """
- o = execute_proxy_commands(testbed, ssh_config, [command], time_out)
- if o is not None:
- return o
-
-
def execute_commands(testbed, ssh_config, commands, time_out=3):
"""
Remote execution of a list of shell command on hostname. By
@@ -457,4 +412,22 @@ def aptitude_install(testbed, node, packages):
"while ! " + sudo("apt-get update") + "; do sleep 1; done",
"while ! " + sudo(package_install) + "; do sleep 1; done"]
- execute_proxy_commands(testbed, node.ssh_config, cmds, time_out=None)
+ execute_commands(testbed, node.ssh_config, cmds, time_out=None)
+
+def set_http_proxy(testbed, node, proxy):
+ """
+ Sets a system-wide HTTP proxy for a node.
+
+ @param testbed: testbed info
+ @param node: the node
+ """
+
+ proxies = []
+ proxies.append('export http_proxy="' + proxy + '"')
+ proxies.append('export https_proxy="' + proxy + '"')
+
+ cmds = []
+ for line in proxies:
+ cmds.append('echo \''+ line + '\' | sudo tee --append /etc/profile')
+
+ execute_commands(testbed, node.ssh_config, cmds, time_out=None)
diff --git a/rumba/testbeds/emulab.py b/rumba/testbeds/emulab.py
index f0c0350..664b4ff 100644
--- a/rumba/testbeds/emulab.py
+++ b/rumba/testbeds/emulab.py
@@ -67,9 +67,6 @@ class Testbed(mod.Testbed):
self.executor = SSHExecutor
- if "wall" in url:
- self.http_proxy="https://proxy.atlantis.ugent.be:8080"
-
def _ops_server(self):
"""
Return server name of the ops-server (is testbed specific).
@@ -276,6 +273,12 @@ class Testbed(mod.Testbed):
self._wait_until_nodes_up()
self._complete_experiment_graph(experiment)
+ if "wall" in self.url:
+ for node in experiment.nodes:
+ ssh_support.set_http_proxy(self, node_n,
+ "https://proxy.atlantis."
+ "ugent.be:8080")
+
def _swap_out(self, experiment):
"""
Swaps experiment out
diff --git a/rumba/testbeds/jfed.py b/rumba/testbeds/jfed.py
index 924da8f..530d9f0 100644
--- a/rumba/testbeds/jfed.py
+++ b/rumba/testbeds/jfed.py
@@ -76,8 +76,7 @@ class Testbed(mod.Testbed):
exp_name,
username,
passwd,
- proj_name,
- http_proxy=None)
+ proj_name)
self.auth_name = authority
self.cert_file = cert_file
self.exp_hours = exp_hours
@@ -92,7 +91,6 @@ class Testbed(mod.Testbed):
self.authority = "urn:publicid:IDN+" + authority + "+authority+am"
elif "wall" in authority:
self.authority = "urn:publicid:IDN+" + authority + "+authority+cm"
- self.http_proxy="https://proxy.atlantis.ugent.be:8080"
elif "cloudlab" or "geniracks" in authority:
self.authority = "urn:publicid:IDN+" + authority + "+authority+cm"
else:
@@ -245,8 +243,6 @@ class Testbed(mod.Testbed):
:param experiment: The experiment.
"""
- for node in experiment.nodes:
- node.ssh_config.set_http_proxy(self.http_proxy)
self._create_rspec(experiment)
auth_name_r = self.auth_name.replace(".", "-")
@@ -305,6 +301,11 @@ class Testbed(mod.Testbed):
node_n.ssh_config.hostname = l_node.getAttribute("hostname")
+ if "wall" in self.auth_name:
+ ssh_support.set_http_proxy(self, node_n,
+ "https://proxy.atlantis.ugent."
+ "be:8080")
+
ssh_support.execute_command(
self,
node_n.ssh_config,