aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincenzo Maffione <v.maffione@gmail.com>2017-02-06 18:24:50 +0100
committerVincenzo Maffione <v.maffione@gmail.com>2017-02-06 18:24:50 +0100
commit4bfc9fee5365f2a1aa13c8f8669e2fa3e6264b92 (patch)
treead688e408ae8d298e6b345ec195e6338d6ad582c
parent38268b9218270ef57402e3c306d8b3bfdcd5103a (diff)
downloadrumba-4bfc9fee5365f2a1aa13c8f8669e2fa3e6264b92.tar.gz
rumba-4bfc9fee5365f2a1aa13c8f8669e2fa3e6264b92.zip
move OuroborosExperiment class in its own file
-rw-r--r--example.py1
-rw-r--r--ouroboros_support.py50
-rwxr-xr-xrhumba.py16
3 files changed, 35 insertions, 32 deletions
diff --git a/example.py b/example.py
index 931eb73..aa45da5 100644
--- a/example.py
+++ b/example.py
@@ -3,6 +3,7 @@
# An example script using rhumba.py
from rhumba import *
+import ouroboros_support as our
n1 = NormalDIF("n1", policies = {"rmt.pff": "lfa",
"security-manager": "passwd"})
diff --git a/ouroboros_support.py b/ouroboros_support.py
index 061c097..8631ad0 100644
--- a/ouroboros_support.py
+++ b/ouroboros_support.py
@@ -19,24 +19,42 @@
# MA 02110-1301 USA
import ssh_support as ssh
+import rhumba
-def setup_ouroboros(testbed, nodes):
- 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_release.sh")
- cmds.append("sudo nohup irmd > /dev/null &")
+# An experiment over the Ouroboros implementation
+class OuroborosExperiment(rhumba.Experiment):
+ def __init__(self, testbed, nodes = list()):
+ rhumba.Experiment.__init__(self, testbed, nodes)
- for node in nodes:
- ssh.execute_commands(testbed, node.full_name, cmds, time_out = None)
- return
-
-def bind_names(testbed, nodes):
- for node in nodes:
+ def setup_ouroboros(self):
cmds = list()
- for name, ap in node.bindings.items():
- cmds.append("irm b ap " + ap + " n " + name)
- ssh.execute_commands(testbed, node.full_name, cmds, time_out = None)
+ 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_release.sh")
+ cmds.append("sudo nohup irmd > /dev/null &")
+
+ for node in self.nodes:
+ ssh.execute_commands(self.testbed, node.full_name, cmds, time_out = None)
+ return
+
+ def bind_names(self):
+ for node in self.nodes:
+ cmds = list()
+ for name, ap in node.bindings.items():
+ cmds.append("irm b ap " + ap + " n " + name)
+
+ ssh.execute_commands(self.testbed, node.full_name, cmds, time_out = None)
+
+ def run(self):
+ print("[Ouroboros experiment] start")
+ print("Creating resources...")
+ self.realize()
+ print("Setting up Ouroboros...")
+ self.setup_ouroboros()
+ print("Binding names...")
+ self.bind_names()
+ print("[Ouroboros experiment] end")
+
diff --git a/rhumba.py b/rhumba.py
index 5940da0..1bd33a6 100755
--- a/rhumba.py
+++ b/rhumba.py
@@ -23,7 +23,6 @@ import emulab_support as es
import jfed_support as js
import abc
import getpass
-import ouroboros_support as our
# Represents generic testbed info
#
@@ -324,18 +323,3 @@ class RLITEExperiment(Experiment):
self.realize()
print("[RLITE experiment] end")
-
-# An experiment over the Ouroboros implementation
-class OuroborosExperiment(Experiment):
- def __init__(self, testbed, nodes = list()):
- Experiment.__init__(self, testbed, nodes)
-
- def run(self):
- print("[Ouroboros experiment] start")
- print("Creating resources...")
- self.realize()
- print("Setting up Ouroboros...")
- our.setup_ouroboros(self.testbed, self.nodes)
- print("Binding names...")
- our.bind_names(self.testbed, self.nodes)
- print("[Ouroboros experiment] end")