diff options
-rw-r--r-- | rumba/testbeds/dockertb.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/rumba/testbeds/dockertb.py b/rumba/testbeds/dockertb.py index 2ee4561..5dcbb16 100644 --- a/rumba/testbeds/dockertb.py +++ b/rumba/testbeds/dockertb.py @@ -39,8 +39,8 @@ class Testbed(mod.Testbed): """ Represents a docker testbed. """ - def __init__(self, base_image, exp_name='foo', pull_image=True, - use_ovs=False): + def __init__(self, base_image=None, exp_name='foo', + pull_image=True, use_ovs=False): """ Initializes the testbed class. @@ -48,14 +48,13 @@ class Testbed(mod.Testbed): :param base_image: The docker base image. :param pull_image: Retrieve the docker image from the Docker hub? :param use_ovs: Use the OVS switch instead of the Linux bridge? + + .. note:: In case no base image is provided, Rumba will automatically + download the latest version available from docker hub. """ mod.Testbed.__init__(self, exp_name, "", "", "") - img = base_image.rsplit(":", 1) - - self.base_image_repo = img[0] - self.base_image_tag = "latest" if len(img) == 1 else img[1] - self.base_image = "%s:%s" % (self.base_image_repo, self.base_image_tag) + self.base_image = base_image self.pull_image = pull_image self.use_ovs = use_ovs @@ -69,6 +68,18 @@ class Testbed(mod.Testbed): def _swap_in(self, experiment): docker_client = self.docker_client + if not self.base_image: + if experiment.prototype_name() == 'ouroboros': + self.base_image = 'arcfirerumba/ouroboros' + else: + raise Exception('Only Ouroboros supported for now.') + + img = self.base_image.rsplit(":", 1) + + self.base_image_repo = img[0] + self.base_image_tag = "latest" if len(img) == 1 else img[1] + self.base_image = "%s:%s" % (self.base_image_repo, self.base_image_tag) + # Pull image if self.pull_image: docker_client.images.pull(self.base_image_repo, |