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/ouroboros.py2
-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
-rwxr-xr-xtools/bw_graph.py14
-rwxr-xr-xtools/subtract.py48
10 files changed, 92 insertions, 82 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/ouroboros.py b/rumba/prototypes/ouroboros.py
index 1ca5e6d..5556d42 100644
--- a/rumba/prototypes/ouroboros.py
+++ b/rumba/prototypes/ouroboros.py
@@ -300,7 +300,7 @@ class Experiment(mod.Experiment):
def _terminate_prototype(self, force=False):
cmds = list()
- if force:
+ if force is True:
kill = 'killall -9 '
cmds.append(kill + 'irmd')
cmds.append(kill + 'ipcpd-normal')
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,
diff --git a/tools/bw_graph.py b/tools/bw_graph.py
index ab772d4..d283713 100755
--- a/tools/bw_graph.py
+++ b/tools/bw_graph.py
@@ -26,6 +26,9 @@ def get_color(value, max):
else:
val = math.floor(multiplier - 1)
+ if value < 0:
+ val = math.floor(multiplier - 1)
+
color = color_range[val]
return color.get_hex()
@@ -34,7 +37,7 @@ def get_penwidth(value, max):
if max == 0:
return "1.0"
- r = (4.0 * float(value) / (0.5 * max)) + 1
+ r = (4.0 * float(abs(value)) / (0.5 * max)) + 1
return str(r)
description = "CSV to bandwidth graph script"
@@ -63,10 +66,8 @@ bandwidth = {}
nodes = set()
for row in reader:
nodes.add(row[0])
- if (row[1], row[0]) in bandwidth:
- bandwidth[row[1], row[0]] += int(row[2])
- else:
- bandwidth[row[0], row[1]] = int(row[2])
+ nodes.add(row[1])
+ bandwidth[row[0], row[1]] = int(row[2])
node_bandwidth = {}
for key, value in bandwidth.items():
@@ -103,7 +104,8 @@ for key, value in bandwidth.items():
pw = get_penwidth(value, max_b)
edge = pydot.Edge(key[0], key[1],
color = color,
- penwidth=pw)
+ penwidth=pw,
+ label=round(value * 8 / 1000000, 2))
gvizg.add_edge(edge)
except Exception as e:
print('Failed to create pydot Edge: ' + str(e))
diff --git a/tools/subtract.py b/tools/subtract.py
new file mode 100755
index 0000000..6929b61
--- /dev/null
+++ b/tools/subtract.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+
+import argparse
+import csv
+import math
+
+description = "Subtracts two CSV from each other"
+epilog = "2018 Sander Vrijders <sander.vrijders@ugent.be>"
+
+parser = argparse.ArgumentParser(description=description,
+ epilog=epilog)
+
+parser.add_argument('-o', '--output', type=str, required=True,
+ help='Output CSV filename.')
+
+parser.add_argument('-f', '--first', type=str, required=True,
+ help='First input CSV filename.')
+
+parser.add_argument('-s', '--second', type=str, required=True,
+ help='Second input CSV filename.')
+
+args = parser.parse_args()
+
+csvfile = open(args.second, 'r')
+reader = csv.reader(csvfile, delimiter=';', quotechar='|')
+
+# Set second measurement
+bandwidth = {}
+for row in reader:
+ if (row[1], row[0]) in bandwidth:
+ bandwidth[row[1], row[0]] += int(row[2])
+ else:
+ bandwidth[row[0], row[1]] = int(row[2])
+
+# Subtract first measurement
+csvfile2 = open(args.first, 'r')
+reader2 = csv.reader(csvfile2, delimiter=';', quotechar='|')
+for row in reader2:
+ if (row[1], row[0]) in bandwidth:
+ bandwidth[row[1], row[0]] -= int(row[2])
+ else:
+ bandwidth[row[0], row[1]] -= int(row[2])
+
+
+csvfile3 = open(args.output, 'w')
+writer = csv.writer(csvfile3, delimiter=';', quotechar='|')
+for key, value in bandwidth.items():
+ writer.writerow([key[0], key[1], value])