aboutsummaryrefslogtreecommitdiff
path: root/rumba/testbeds/qemu.py
diff options
context:
space:
mode:
authorNick Aerts <nick.aerts@ugent.be>2018-02-24 12:27:36 +0100
committerNick Aerts <nick.aerts@ugent.be>2018-03-20 11:30:07 +0100
commita7cd88d752b72ea85ccefa5e1f3dceba13fb1fc2 (patch)
tree9c29f08693d577c81959c3194aec04e9bc1ba195 /rumba/testbeds/qemu.py
parent24bed306b5a67fc682b04cae017b0d0f3ac55a00 (diff)
downloadrumba-a7cd88d752b72ea85ccefa5e1f3dceba13fb1fc2.tar.gz
rumba-a7cd88d752b72ea85ccefa5e1f3dceba13fb1fc2.zip
testbeds: Add docker testbed
This adds support for a testbed based on Docker containers running on the local host. Bridging the containers can be done using built-in Linux bridging or using OpenVSwitch bridges. A new resource 'executor' has been added to abstract away command execution on nodes on the testbed. Executors have been created for local command execution, docker exec based command execution and SSH-based command execution. This has also been changed in the prototypes to execute using the correct executor.
Diffstat (limited to 'rumba/testbeds/qemu.py')
-rw-r--r--rumba/testbeds/qemu.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/rumba/testbeds/qemu.py b/rumba/testbeds/qemu.py
index 4321fc8..f3daefd 100644
--- a/rumba/testbeds/qemu.py
+++ b/rumba/testbeds/qemu.py
@@ -32,9 +32,10 @@ from subprocess import CalledProcessError
import rumba.model as mod
import rumba.log as log
-import rumba.ssh_support as ssh_support
import rumba.multiprocess as m_processing
+from rumba.executors.ssh import SSHExecutor
+
if sys.version_info[0] >= 3:
from urllib.request import urlretrieve
else:
@@ -59,6 +60,8 @@ class Testbed(mod.Testbed):
self.initramfs_path = initramfs_path
self.multiproc_manager = None
+ self.executor = SSHExecutor(self);
+
# Prepend sudo to all commands if the user is not 'root'
def may_sudo(self, cmds):
if os.geteuid() != 0:
@@ -116,13 +119,9 @@ class Testbed(mod.Testbed):
mac = '00:0a:0a:0a:%02x:%02x' % (vm_id, port_id)
logger.info('Recovering ifname for port: %s.',
port['tap_id'])
- output = ssh_support.execute_command(
- self,
- node.ssh_config,
- 'mac2ifname ' + mac)
+ output = node.execute_command('mac2ifname ' + mac)
ipcp.ifname = output
- ssh_support.execute_command(
- self, node.ssh_config,
+ node.execute_command(
"ip link set dev %(ifname)s up"
% {'ifname': ipcp.ifname})
@@ -131,6 +130,9 @@ class Testbed(mod.Testbed):
:type experiment mod.Experiment
:param experiment: The experiment running
"""
+
+ mod.Testbed.swap_in(self, experiment)
+
if os.geteuid() != 0:
try:
subprocess.check_call(["sudo", "-v"])