aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xexamples/two-layers.py6
-rw-r--r--rumba/model.py8
-rw-r--r--rumba/prototypes/irati.py3
-rw-r--r--rumba/prototypes/ouroboros.py3
-rw-r--r--rumba/prototypes/rlite.py3
-rw-r--r--rumba/testbeds/qemu.py24
6 files changed, 38 insertions, 9 deletions
diff --git a/examples/two-layers.py b/examples/two-layers.py
index b4e4e64..b3622fd 100755
--- a/examples/two-layers.py
+++ b/examples/two-layers.py
@@ -48,11 +48,9 @@ d = Node("d",
tb = qemu.Testbed(exp_name = "twolayers",
username = "root",
- password = "root",
- bzimage = '/home/vmaffione/git/rlite/demo/buildroot/bzImage',
- initramfs = '/home/vmaffione/git/rlite/demo/buildroot/rootfs.cpio')
+ password = "root")
-exp = rl.Experiment(tb, nodes = [a, b, c, d])
+exp = irati.Experiment(tb, nodes = [a, b, c, d])
print(exp)
diff --git a/rumba/model.py b/rumba/model.py
index 7f65098..ccd60df 100644
--- a/rumba/model.py
+++ b/rumba/model.py
@@ -520,11 +520,15 @@ class Experiment:
@abc.abstractmethod
def install_prototype(self):
- raise Exception('run_prototype() method not implemented')
+ raise Exception('install_prototype() method not implemented')
@abc.abstractmethod
def bootstrap_prototype(self):
- raise Exception('run_prototype() method not implemented')
+ raise Exception('bootstrap_prototype() method not implemented')
+
+ @abc.abstractmethod
+ def prototype_name(self):
+ raise Exception('prototype_name() method not implemented')
def swap_in(self):
# Realize the experiment testbed (testbed-specific)
diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py
index eaca03a..3669320 100644
--- a/rumba/prototypes/irati.py
+++ b/rumba/prototypes/irati.py
@@ -38,6 +38,9 @@ logger = log.get_logger(__name__)
# An experiment over the IRATI implementation
class Experiment(mod.Experiment):
+ def prototype_name(self):
+ return 'irati'
+
@staticmethod
def real_sudo(s):
return 'sudo ' + s
diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py
index 01b8b72..9ac1425 100644
--- a/rumba/prototypes/ouroboros.py
+++ b/rumba/prototypes/ouroboros.py
@@ -32,6 +32,9 @@ class Experiment(mod.Experiment):
def __init__(self, testbed, nodes=None):
mod.Experiment.__init__(self, testbed, nodes)
+ def prototype_name(self):
+ return 'ouroboros'
+
def setup_ouroboros(self):
for node in self.nodes:
ssh.execute_command(self.testbed, node.ssh_config,
diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py
index de2ba52..cc38255 100644
--- a/rumba/prototypes/rlite.py
+++ b/rumba/prototypes/rlite.py
@@ -34,6 +34,9 @@ class Experiment(mod.Experiment):
def __init__(self, testbed, nodes=None):
mod.Experiment.__init__(self, testbed, nodes)
+ def prototype_name(self):
+ return 'rlite'
+
def execute_commands(self, node, cmds):
ssh.execute_commands(self.testbed, node.ssh_config,
cmds, time_out=None)
diff --git a/rumba/testbeds/qemu.py b/rumba/testbeds/qemu.py
index a916525..b7ebef9 100644
--- a/rumba/testbeds/qemu.py
+++ b/rumba/testbeds/qemu.py
@@ -26,24 +26,25 @@ import os
import rumba.model as mod
import rumba.log as log
import rumba.ssh_support as ssh_support
+import wget
logger = log.get_logger(__name__)
class Testbed(mod.Testbed):
- def __init__(self, exp_name, bzimage, initramfs, proj_name="ARCFIRE",
+ def __init__(self, exp_name, bzimage=None, initramfs=None, proj_name="ARCFIRE",
password="root", username="root",
use_vhost=True, qemu_logs_dir=None):
mod.Testbed.__init__(self, exp_name, username, password, proj_name)
self.vms = {}
self.shims = []
- self.bzimage = bzimage
- self.initramfs = initramfs
self.vhost = use_vhost
self.qemu_logs_dir = os.getcwd() if qemu_logs_dir is None \
else qemu_logs_dir
self.boot_processes = []
+ self.bzimage = bzimage
+ self.initramfs = initramfs
@staticmethod
def _run_command_chain(commands, results_queue,
@@ -114,6 +115,23 @@ class Testbed(mod.Testbed):
raise Exception('Not authenticated')
logger.info("swapping in")
+
+ # Download the proper buildroot images, if the user did not specify
+ # local images
+ url_prefix = "https://bitbucket.org/vmaffione/rina-images/downloads/"
+ if not self.bzimage:
+ self.bzimage = '%s.bzImage' % (experiment.prototype_name())
+ if not os.path.exists(self.bzimage):
+ logger.info("Downloading %s" % (url_prefix + self.bzimage))
+ wget.download(url_prefix + self.bzimage)
+ print("\n")
+ if not self.initramfs:
+ self.initramfs = '%s.rootfs.cpio' % (experiment.prototype_name())
+ if not os.path.exists(self.initramfs):
+ logger.info("Downloading %s" % (url_prefix + self.initramfs))
+ wget.download(url_prefix + self.initramfs)
+ print("\n")
+
logger.info('Setting up interfaces.')
# Building bridges and taps