aboutsummaryrefslogtreecommitdiff
path: root/rumba
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-04-20 17:12:34 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2017-04-21 11:28:35 +0200
commit009c8ff7570105a79278559202fdd46616b83a92 (patch)
tree06fc2bafc26683c82795db750187ff7cefdcc43e /rumba
parent06b3694633bd8315d55b5d75a2ca6c20afc54651 (diff)
downloadrumba-009c8ff7570105a79278559202fdd46616b83a92.tar.gz
rumba-009c8ff7570105a79278559202fdd46616b83a92.zip
model: Split experiment run()
This splits experiment.run() into 4 different operations: swap_in, install_prototype, bootstrap_prototype and swap_out.
Diffstat (limited to 'rumba')
-rw-r--r--rumba/model.py21
-rw-r--r--rumba/prototypes/irati.py46
-rw-r--r--rumba/prototypes/ouroboros.py17
-rw-r--r--rumba/prototypes/rlite.py30
4 files changed, 71 insertions, 43 deletions
diff --git a/rumba/model.py b/rumba/model.py
index 0d93fcd..d219edb 100644
--- a/rumba/model.py
+++ b/rumba/model.py
@@ -529,16 +529,17 @@ class Experiment:
self.compute_ipcps()
@abc.abstractmethod
- def run_prototype(self):
+ def install_prototype(self):
raise Exception('run_prototype() method not implemented')
- def run(self):
- try:
- # Realize the experiment testbed (testbed-specific)
- self.testbed.swap_in(self)
+ @abc.abstractmethod
+ def bootstrap_prototype(self):
+ raise Exception('run_prototype() method not implemented')
+
+ def swap_in(self):
+ # Realize the experiment testbed (testbed-specific)
+ self.testbed.swap_in(self)
- # Run the experiment using the prototype (prototype-specific)
- self.run_prototype()
- finally:
- # No matter what happens, undo the testbed (testbed-specific)
- self.testbed.swap_out(self)
+ def swap_out(self):
+ # Undo the testbed (testbed-specific)
+ self.testbed.swap_out(self)
diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py
index 0d40580..f012512 100644
--- a/rumba/prototypes/irati.py
+++ b/rumba/prototypes/irati.py
@@ -65,23 +65,26 @@ class Experiment(mod.Experiment):
def conf_dir(self, path):
return os.path.join(self._conf_dir, path)
+ def install(self):
+ """Installs IRATI on the nodes."""
+ cmds = list()
+
+ cmds.append("sudo apt-get update")
+ cmds.append("sudo apt-get install g++ gcc "
+ "protobuf-compiler libprotobuf-dev git --yes")
+ cmds.append("sudo rm -rf ~/irati")
+ cmds.append("cd && git clone https://github.com/IRATI/stack irati")
+ cmds.append("cd ~/irati && sudo ./install-from-scratch")
+
+ for node in self.nodes:
+ ssh.execute_commands(self.testbed, node.ssh_config,
+ cmds, time_out=None)
+
def setup(self):
- """Installs IRATI on the vms."""
- setup_irati = False
- if setup_irati:
- cmds = list()
-
- cmds.append("sudo apt-get update")
- cmds.append("sudo apt-get install g++ gcc "
- "protobuf-compiler libprotobuf-dev git --yes")
- cmds.append("sudo rm -rf ~/irati")
- cmds.append("cd && git clone https://github.com/IRATI/stack irati")
- cmds.append("cd ~/irati && sudo ./install-from-scratch")
- cmds.append("sudo nohup ipcm &> ipcm.log &")
-
- for node in self.nodes:
- ssh.execute_commands(self.testbed, node.ssh_config,
- cmds, time_out=None)
+ for node in self.nodes:
+ ssh.execute_command(self.testbed, node.ssh_config,
+ "sudo nohup ipcm &> ipcm.log &",
+ time_out=None)
def bootstrap_network(self):
"""Creates the network by enrolling and configuring the nodes"""
@@ -89,7 +92,12 @@ class Experiment(mod.Experiment):
self.process_node(node)
self.enroll_nodes()
- def run_prototype(self):
+ def install_prototype(self):
+ print("irati: installing")
+ self.install()
+ print("irati: done installing")
+
+ def bootstrap_prototype(self):
print("irati: setting up")
self.setup()
print("irati: software initialized on all nodes")
@@ -102,8 +110,8 @@ class Experiment(mod.Experiment):
"""
Installs the configuration and boots up rina on a node
:type node: mod.Node
- :param node:
- :return:
+ :param node:
+ :return:
"""
name = node.name
diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py
index 4fdacd6..4ebeea8 100644
--- a/rumba/prototypes/ouroboros.py
+++ b/rumba/prototypes/ouroboros.py
@@ -28,18 +28,22 @@ class Experiment(mod.Experiment):
mod.Experiment.__init__(self, testbed, nodes)
def setup_ouroboros(self):
+ for node in self.nodes:
+ ssh.execute_command(self.testbed, node.ssh_config,
+ "sudo nohup irmd > /dev/null &",
+ time_out=None)
+
+ def install_ouroboros(self):
cmds = list()
cmds.append("sudo apt-get update")
cmds.append("sudo apt-get install cmake protobuf-c-compiler git --yes")
cmds.append("sudo rm -r ~/ouroboros/build")
cmds.append("cd ~/ouroboros; sudo ./install_debug.sh /")
- cmds.append("sudo nohup irmd > /dev/null &")
for node in self.nodes:
ssh.execute_commands(self.testbed, node.ssh_config,
cmds, time_out=None)
- return
def bind_names(self):
for node in self.nodes:
@@ -131,8 +135,13 @@ class Experiment(mod.Experiment):
cmds, time_out = None)
time.sleep(2)
- def run_prototype(self):
- print("Setting up Ouroboros...")
+ def install_prototype(self):
+ print("Installing Ouroboros...")
+ self.install_ouroboros()
+ print("Installed on all nodes...")
+
+ def bootstrap_prototype(self):
+ print("Starting IRMd on all nodes...")
self.setup_ouroboros()
print("Binding names...")
self.bind_names()
diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py
index 9568d7e..4221f2a 100644
--- a/rumba/prototypes/rlite.py
+++ b/rumba/prototypes/rlite.py
@@ -35,15 +35,6 @@ class Experiment(mod.Experiment):
def init(self):
cmds = []
- if False: # ubuntu
- cmds.append("apt-get update")
- cmds.append("apt-get install g++ gcc cmake "
- "linux-headers-$(uname -r) "
- "protobuf-compiler libprotobuf-dev git --yes")
- cmds.append("rm -rf ~/rlite")
- cmds.append("cd ~; git clone https://github.com/vmaffione/rlite")
- cmds.append("cd ~/rlite && ./configure && make && sudo make install")
-
# Load kernel modules
cmds.append("modprobe rlite")
cmds.append("modprobe rlite-normal")
@@ -57,6 +48,20 @@ class Experiment(mod.Experiment):
for node in self.nodes:
self.execute_commands(node, cmds)
+ def install(self):
+ cmds = []
+
+ cmds.append("apt-get update")
+ cmds.append("apt-get install g++ gcc cmake "
+ "linux-headers-$(uname -r) "
+ "protobuf-compiler libprotobuf-dev git --yes")
+ cmds.append("rm -rf ~/rlite")
+ cmds.append("cd ~; git clone https://github.com/vmaffione/rlite")
+ cmds.append("cd ~/rlite && ./configure && make && sudo make install")
+
+ for node in self.nodes:
+ self.execute_commands(node, cmds)
+
def create_ipcps(self):
for node in self.nodes:
cmds = []
@@ -109,7 +114,12 @@ class Experiment(mod.Experiment):
"%(lower_dif)s %(enroller)s" % d
self.execute_commands(e['enrollee'], [cmd])
- def run_prototype(self):
+ def install_prototype(self):
+ print("rlite: installing")
+ self.install()
+ print("rlite: installed")
+
+ def bootstrap_prototype(self):
print("rlite: setting up")
self.init()
print("rlite: software initialized on all nodes")