From cc5ad5953f29e3e9374827b0e63f12a67b3a7d7d Mon Sep 17 00:00:00 2001 From: Vincenzo Maffione Date: Mon, 6 Feb 2017 18:06:41 +0100 Subject: Experiment: make run() an abstract method, while realize() swaps in experiments --- rhumba.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'rhumba.py') 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...") -- cgit v1.2.3