aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/converged-operator-network.py2
-rwxr-xr-xexamples/docker-ouroboros.py65
-rwxr-xr-xexamples/example.py2
-rwxr-xr-xexamples/mouse.py2
-rwxr-xr-xexamples/snake.py2
-rwxr-xr-xexamples/two-layers.py6
-rwxr-xr-xexamples/vpn.py2
7 files changed, 73 insertions, 8 deletions
diff --git a/examples/converged-operator-network.py b/examples/converged-operator-network.py
index 3b80746..8ed79ed 100755
--- a/examples/converged-operator-network.py
+++ b/examples/converged-operator-network.py
@@ -10,7 +10,7 @@ from rumba.utils import *
# import testbed plugins
import rumba.testbeds.emulab as emulab
import rumba.testbeds.jfed as jfed
-import rumba.testbeds.faketestbed as fake
+import rumba.testbeds.local as local
import rumba.testbeds.qemu as qemu
# import prototype plugins
diff --git a/examples/docker-ouroboros.py b/examples/docker-ouroboros.py
new file mode 100755
index 0000000..1c6009c
--- /dev/null
+++ b/examples/docker-ouroboros.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+
+# An example script using the rumba package
+
+from rumba.model import *
+from rumba.utils import ExperimentManager
+
+# import testbed plugins
+import rumba.testbeds.dockertb as docker
+
+# import prototype plugins
+import rumba.prototypes.ouroboros as our
+
+import argparse
+import sys
+
+
+description = "Script to create an ouroboros"
+
+argparser = argparse.ArgumentParser(description = description)
+argparser.add_argument('-n', '--nodes', type = int, default = '10',
+ help = "Total number of nodes")
+
+args = argparser.parse_args()
+
+log.set_logging_level('DEBUG')
+
+n01 = NormalDIF("n01")
+
+if (args.nodes < 3):
+ print("The ouroboros must be longer than 2 nodes")
+ sys.exit(-1)
+
+nodes = []
+
+shim_prev = None
+for i in range(0, args.nodes):
+ shim = ShimEthDIF("e" + str(i))
+
+ if shim_prev == None and shim != None:
+ node = Node("node" + str(i), difs = [n01, shim],
+ dif_registrations = {n01 : [shim]})
+ elif shim_prev != None and shim != None:
+ node = Node("node" + str(i), difs = [n01, shim, shim_prev],
+ dif_registrations = {n01 : [shim, shim_prev]})
+ else:
+ node = Node("node" + str(i), difs = [n01, shim_prev],
+ dif_registrations = {n01 : [shim_prev]})
+
+ shim_prev = shim
+ nodes.append(node)
+
+nodes[0].add_dif(shim_prev)
+nodes[0].add_dif_registration(n01, shim_prev)
+
+tb = docker.Testbed(exp_name = "ouroboros",
+ base_image = "ouroborosrumba/prototype")
+
+exp = our.Experiment(tb, nodes = nodes)
+
+print(exp)
+
+with ExperimentManager(exp):
+ exp.swap_in()
+ exp.bootstrap_prototype()
diff --git a/examples/example.py b/examples/example.py
index eee966b..62d5a53 100755
--- a/examples/example.py
+++ b/examples/example.py
@@ -9,7 +9,7 @@ from rumba.storyboard import *
# import testbed plugins
import rumba.testbeds.emulab as emulab
import rumba.testbeds.jfed as jfed
-import rumba.testbeds.faketestbed as fake
+import rumba.testbeds.local as local
import rumba.testbeds.qemu as qemu
# import prototype plugins
diff --git a/examples/mouse.py b/examples/mouse.py
index 026b3bc..16fdf49 100755
--- a/examples/mouse.py
+++ b/examples/mouse.py
@@ -8,7 +8,7 @@ from rumba.utils import ExperimentManager
# import testbed plugins
import rumba.testbeds.emulab as emulab
import rumba.testbeds.jfed as jfed
-import rumba.testbeds.faketestbed as fake
+import rumba.testbeds.local as local
import rumba.testbeds.qemu as qemu
# import prototype plugins
diff --git a/examples/snake.py b/examples/snake.py
index 6f9c48d..3d76797 100755
--- a/examples/snake.py
+++ b/examples/snake.py
@@ -8,7 +8,7 @@ from rumba.utils import ExperimentManager
# import testbed plugins
import rumba.testbeds.emulab as emulab
import rumba.testbeds.jfed as jfed
-import rumba.testbeds.faketestbed as fake
+import rumba.testbeds.local as local
import rumba.testbeds.qemu as qemu
# import prototype plugins
diff --git a/examples/two-layers.py b/examples/two-layers.py
index c375088..3f50037 100755
--- a/examples/two-layers.py
+++ b/examples/two-layers.py
@@ -8,7 +8,7 @@ from rumba.storyboard import *
# import testbed plugins
import rumba.testbeds.emulab as emulab
import rumba.testbeds.jfed as jfed
-import rumba.testbeds.faketestbed as fake
+import rumba.testbeds.local as local
import rumba.testbeds.qemu as qemu
# import prototype plugins
@@ -59,6 +59,6 @@ with ExperimentManager(exp):
exp.swap_in()
exp.bootstrap_prototype()
sb = StoryBoard(experiment=exp, duration=15, servers=[])
- sb.run_command(7.5, a, 'echo "7.5 secs in. We are at $(hostname)"')
- sb.run_command(12, b, 'echo "12 secs in. We are at $(hostname)"')
+ sb.schedule_command(7.5, a, 'echo "7.5 secs in. We are at $(hostname)"')
+ sb.schedule_command(12, b, 'echo "12 secs in. We are at $(hostname)"')
sb.start()
diff --git a/examples/vpn.py b/examples/vpn.py
index 28de09e..6aa8db6 100755
--- a/examples/vpn.py
+++ b/examples/vpn.py
@@ -8,7 +8,7 @@ from rumba.utils import ExperimentManager
# import testbed plugins
import rumba.testbeds.emulab as emulab
import rumba.testbeds.jfed as jfed
-import rumba.testbeds.faketestbed as fake
+import rumba.testbeds.local as local
import rumba.testbeds.qemu as qemu
# import prototype plugins