diff options
author | Vincenzo Maffione <[email protected]> | 2017-04-07 19:40:12 +0200 |
---|---|---|
committer | Vincenzo Maffione <[email protected]> | 2017-04-07 19:40:12 +0200 |
commit | f1630941a0c47fdd025219340e5383cbaefcd85e (patch) | |
tree | 03da2fdb96d881e80905eb0557b24974c4e0e7fa | |
parent | 2666310aa2a25e5d66b669bde337711e7d22c904 (diff) | |
download | rumba-f1630941a0c47fdd025219340e5383cbaefcd85e.tar.gz rumba-f1630941a0c47fdd025219340e5383cbaefcd85e.zip |
rumba: simplify cooperation between prototype and testbed plugins
-rw-r--r-- | README | 10 | ||||
-rw-r--r-- | rumba/model.py | 26 | ||||
-rw-r--r-- | rumba/prototypes/irati.py | 3 | ||||
-rw-r--r-- | rumba/prototypes/ouroboros.py | 3 | ||||
-rw-r--r-- | rumba/prototypes/rlite.py | 3 | ||||
-rw-r--r-- | rumba/testbeds/emulab.py | 2 | ||||
-rw-r--r-- | rumba/testbeds/faketestbed.py | 2 | ||||
-rw-r--r-- | rumba/testbeds/jfed.py | 2 | ||||
-rw-r--r-- | rumba/testbeds/qemu.py | 4 |
9 files changed, 31 insertions, 24 deletions
@@ -16,15 +16,13 @@ Workflow, both external and internal: used by the plugins (4) user calls run() on the prototype.Experiment instance: - - First, run() calls Experiment.swap_in(), which - in turns calls Testbed.create_experiment(), passing the - nodes and links (?) - TODO: fix this interface: what should swap_in(), and - so create_experiment() return exactly? Current interface - seems broken + - First, run() calls Testbed.swap_in(), passing the + Experiment, and filling in the missing information - Second, run() calls a prototype-specific setup function, to create the required IPCPs, perform registrations, enrollments, etc. - Third, perform tests (TODO) + + - Fourth, run() calls Testbed.swap_out() diff --git a/rumba/model.py b/rumba/model.py index 25a1356..99bf5ed 100644 --- a/rumba/model.py +++ b/rumba/model.py @@ -37,8 +37,13 @@ class Testbed: self.exp_name = exp_name @abc.abstractmethod - def create_experiment(self, experiment): - raise Exception('create_experiment() not implemented') + def swap_in(self, experiment): + raise Exception('swap_in() not implemented') + + @abc.abstractmethod + def swap_out(self, experiment): + print("swap_out(): nothing to do") + # Base class for DIFs # @@ -605,10 +610,17 @@ class Experiment: self.compute_enrollments() self.compute_ipcps() - # Realize the experiment, using a testbed-specific setup - def swap_in(self): - self.testbed.create_experiment(self) - @abc.abstractmethod + def run_prototype(self): + raise Exception('run_prototype() method not implemented') + def run(self): - raise Exception('run() method not implemented') + # Realize the experiment testbed (testbed-specific) + self.testbed.swap_in(self) + + # Run the experiment using the prototype (prototype-specific) + self.run_prototype() + + # Undo the testbed (testbed-specific) + self.testbed.swap_out(self) + diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py index 1babd57..37a6fbe 100644 --- a/rumba/prototypes/irati.py +++ b/rumba/prototypes/irati.py @@ -41,9 +41,8 @@ class Experiment(mod.Experiment): ssh.execute_commands(self.testbed, node.full_name, cmds, time_out=None) - def run(self): + def run_prototype(self): print("[IRATI experiment] start") - self.swap_in() print("Setting up IRATI on the nodes...") self.setup() print("[IRATI experiment] end") diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py index 57358cf..4f78361 100644 --- a/rumba/prototypes/ouroboros.py +++ b/rumba/prototypes/ouroboros.py @@ -49,10 +49,9 @@ class Experiment(mod.Experiment): ssh.execute_commands(self.testbed, node.full_name, cmds, time_out=None) - def run(self): + def run_prototype(self): print("[Ouroboros experiment] start") print("Creating resources...") - self.swap_in() print("Setting up Ouroboros...") self.setup_ouroboros() print("Binding names...") diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py index b175e92..8cb45ec 100644 --- a/rumba/prototypes/rlite.py +++ b/rumba/prototypes/rlite.py @@ -42,9 +42,8 @@ class Experiment(mod.Experiment): ssh.execute_commands(self.testbed, node.full_name, cmds, time_out=None) - def run(self): + def run_prototype(self): print("[RLITE experiment] start") - self.swap_in() print("Setting up rlite on the nodes...") self.setup() print("[RLITE experiment] end") diff --git a/rumba/testbeds/emulab.py b/rumba/testbeds/emulab.py index 134d344..c4dbe36 100644 --- a/rumba/testbeds/emulab.py +++ b/rumba/testbeds/emulab.py @@ -235,7 +235,7 @@ class Testbed(mod.Testbed): ipcp.ifname = item[0] node.full_name = self.full_name(node.name) - def create_experiment(self, experiment): + def swap_in(self, experiment): self._create_experiment(experiment) self.swap_exp_in() self.wait_until_nodes_up() diff --git a/rumba/testbeds/faketestbed.py b/rumba/testbeds/faketestbed.py index 4821aa8..85110b8 100644 --- a/rumba/testbeds/faketestbed.py +++ b/rumba/testbeds/faketestbed.py @@ -25,5 +25,5 @@ class Testbed(mod.Testbed): def __init__(self, exp_name, username, proj_name="ARCFIRE", password=""): mod.Testbed.__init__(self, exp_name, username, password, proj_name) - def create_experiment(self, experiment): + def swap_in(self, experiment): print("[Fake testbed] experiment swapped in") diff --git a/rumba/testbeds/jfed.py b/rumba/testbeds/jfed.py index e606846..f56e5ba 100644 --- a/rumba/testbeds/jfed.py +++ b/rumba/testbeds/jfed.py @@ -106,7 +106,7 @@ class Testbed(mod.Testbed): file.write(doc.toprettyxml()) file.close() - def create_experiment(self, experiment): + def swap_in(self, experiment): self.create_rspec(experiment) for node in experiment.nodes: diff --git a/rumba/testbeds/qemu.py b/rumba/testbeds/qemu.py index 7dae921..49bfcc2 100644 --- a/rumba/testbeds/qemu.py +++ b/rumba/testbeds/qemu.py @@ -64,7 +64,7 @@ class Testbed(mod.Testbed): except CalledProcessError as e: error_queue.put(str(e)) - def create_experiment(self, experiment): + def swap_in(self, experiment): """ :type experiment mod.Experiment :param experiment: The experiment running @@ -227,7 +227,7 @@ class Testbed(mod.Testbed): vmid += 1 - def __del__(self): + def swap_out(self): """ :rtype str :return: The script to tear down the experiment |