From a7cd88d752b72ea85ccefa5e1f3dceba13fb1fc2 Mon Sep 17 00:00:00 2001 From: Nick Aerts Date: Sat, 24 Feb 2018 12:27:36 +0100 Subject: 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. --- rumba/testbeds/qemu.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'rumba/testbeds/qemu.py') 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"]) -- cgit v1.2.3