From f075b0b6f69f1bae3735eb8560b8f571c708aafd Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Mon, 12 Feb 2018 18:36:07 +0100 Subject: prototypes: Add option to choose git repo and branch This adds two extra parameters to the Experiment class, so that users can specify their custom repositories and branches for testing new features. --- rumba/model.py | 4 +++- rumba/prototypes/irati.py | 8 +++++--- rumba/prototypes/ouroboros.py | 16 ++++++++++------ rumba/prototypes/rlite.py | 8 +++++--- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/rumba/model.py b/rumba/model.py index 14b856a..b877209 100644 --- a/rumba/model.py +++ b/rumba/model.py @@ -526,10 +526,12 @@ class Policy(object): class Experiment(object): __metaclass__ = abc.ABCMeta - def __init__(self, testbed, nodes=None): + def __init__(self, testbed, nodes=None, git_repo=None, git_branch=None): if nodes is None: nodes = list() self.nodes = nodes + self.git_repo = git_repo + self.git_branch = git_branch self.testbed = testbed # the strategy employed for completing the enrollment phase in # the different DIFs diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py index e8da727..50b8d89 100644 --- a/rumba/prototypes/irati.py +++ b/rumba/prototypes/irati.py @@ -59,8 +59,10 @@ class Experiment(mod.Experiment): def fake_sudo(s): return s - def __init__(self, testbed, nodes=None, installpath=None, varpath=None): - mod.Experiment.__init__(self, testbed, nodes) + def __init__(self, testbed, nodes=None, + git_repo='https://github.com/IRATI/stack', + git_branch='arcfire', installpath=None, varpath=None): + mod.Experiment.__init__(self, testbed, nodes, git_repo, git_branch) if installpath is None: installpath = '/usr' if varpath is None: @@ -94,7 +96,7 @@ class Experiment(mod.Experiment): "libprotobuf-dev", "git", "pkg-config", "libssl-dev"] cmds = [self.sudo("rm -rf ~/stack"), - "cd ~; git clone -b arcfire https://github.com/IRATI/stack", + "cd ~; git clone -b " + self.git_branch + " " + self.git_repo, "cd ~/stack && " + self.sudo("./configure && ") + self.sudo("make install")] names = [] diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py index 653c486..fd94f77 100644 --- a/rumba/prototypes/ouroboros.py +++ b/rumba/prototypes/ouroboros.py @@ -37,8 +37,10 @@ logger = log.get_logger(__name__) # An experiment over the Ouroboros implementation class Experiment(mod.Experiment): - def __init__(self, testbed, nodes=None): - mod.Experiment.__init__(self, testbed, nodes) + def __init__(self, testbed, nodes=None, + git_repo='git://ouroboros.ilabt.imec.be/ouroboros', + git_branch='master'): + mod.Experiment.__init__(self, testbed, nodes, git_repo, git_branch) self.r_ipcps = dict() @staticmethod @@ -61,11 +63,13 @@ class Experiment(mod.Experiment): packages = ["cmake", "protobuf-c-compiler", "git", "libfuse-dev", "libgcrypt20-dev", "libssl-dev"] + fs_loc = '/tmp/prototype' + cmds = ["sudo apt-get install libprotobuf-c-dev --yes || true", - "sudo rm -r ~/ouroboros || true", - "git clone -b be git://ouroboros.ilabt.imec.be/ouroboros " + - "~/ouroboros", - "cd ~/ouroboros && mkdir build && cd build && " + + "sudo rm -r " + fs_loc + " || true", + "git clone -b " + self.git_branch + " " + self.git_repo + \ + " " + fs_loc, + "cd " + fs_loc + " && mkdir build && cd build && " + "cmake -DCMAKE_BUILD_TYPE=Debug -DCONNECT_TIMEOUT=60000 " + \ "-DREG_TIMEOUT=60000 -DQUERY_TIMEOUT=4000 .. && " + \ "sudo make install -j$(nproc)"] diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py index d55b253..3268ef5 100644 --- a/rumba/prototypes/rlite.py +++ b/rumba/prototypes/rlite.py @@ -38,8 +38,10 @@ logger = log.get_logger(__name__) # An experiment over the rlite implementation class Experiment(mod.Experiment): - def __init__(self, testbed, nodes=None): - mod.Experiment.__init__(self, testbed, nodes) + def __init__(self, testbed, nodes=None, + git_repo='https://github.com/vmaffione/rlite', + git_branch='master'): + mod.Experiment.__init__(self, testbed, nodes, git_repo, git_branch) @staticmethod def make_executor(node, packages, testbed): @@ -147,7 +149,7 @@ class Experiment(mod.Experiment): "protobuf-compiler", "libprotobuf-dev", "git"] cmds = ["rm -rf ~/rlite", - "cd ~; git clone https://github.com/vmaffione/rlite", + "cd ~; git clone -b " + self.git_branch + " " + self.git_repo, "cd ~/rlite && ./configure && make && sudo make install", "cd ~/rlite && sudo make depmod"] -- cgit v1.2.3