aboutsummaryrefslogtreecommitdiff
path: root/rhumba.py
diff options
context:
space:
mode:
authorVincenzo Maffione <v.maffione@gmail.com>2017-02-06 18:06:41 +0100
committerVincenzo Maffione <v.maffione@gmail.com>2017-02-06 18:07:07 +0100
commitcc5ad5953f29e3e9374827b0e63f12a67b3a7d7d (patch)
tree7a1b1f13b88608f1ab3278a2a5516dcfb02d034e /rhumba.py
parent06f455b9b47d9a902b67f06ba85af071e68e06ce (diff)
downloadrumba-cc5ad5953f29e3e9374827b0e63f12a67b3a7d7d.tar.gz
rumba-cc5ad5953f29e3e9374827b0e63f12a67b3a7d7d.zip
Experiment: make run() an abstract method, while realize() swaps in experiments
Diffstat (limited to 'rhumba.py')
-rwxr-xr-xrhumba.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/rhumba.py b/rhumba.py
index fbcfc8f..535b650 100755
--- a/rhumba.py
+++ b/rhumba.py
@@ -280,10 +280,16 @@ class Experiment:
def add_node(self, node):
self.nodes.remove(node)
- def run(self):
+ # Realize the experiment topology, using a testbed-specific setup
+ def realize(self):
self.links = get_links(self.nodes)
self.testbed.create_experiment(self.nodes, self.links)
+ @abc.abstractmethod
+ def run(self):
+ raise Exception('run() method not implemented')
+
+
# An experiment over the IRATI implementation
class IRATIExperiment(Experiment):
def __init__(self, testbed, nodes = list()):
@@ -291,7 +297,7 @@ class IRATIExperiment(Experiment):
def run(self):
print("[IRATI experiment] start")
- Experiment.run(self)
+ self.realize()
print("[IRATI experiment] end")
@@ -302,7 +308,7 @@ class RLITEExperiment(Experiment):
def run(self):
print("[RLITE experiment] start")
- Experiment.run(self)
+ self.realize()
print("[RLITE experiment] end")
@@ -314,7 +320,7 @@ class OuroborosExperiment(Experiment):
def run(self):
print("[Ouroboros experiment] start")
print("Creating resources...")
- Experiment.run(self)
+ self.realize()
print("Setting up Ouroboros...")
our.setup_ouroboros(self.testbed, self.nodes)
print("Binding names...")