aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMarco Capitani <m.capitani@nextworks.it>2017-06-13 10:09:54 +0200
committerMarco Capitani <m.capitani@nextworks.it>2017-06-13 10:09:54 +0200
commit457977f337a47caddf8788e1d4e1d1736f2a6ccb (patch)
tree12fa2a2be0f57be3ea2acd3623b01f55c8de1092 /examples
parent3081d070cda223afd548645143142e1104b07d83 (diff)
parent53602860e17d650f9ab850cf9a206de6a8712c15 (diff)
downloadrumba-457977f337a47caddf8788e1d4e1d1736f2a6ccb.tar.gz
rumba-457977f337a47caddf8788e1d4e1d1736f2a6ccb.zip
Merge branch 'master' into policies
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/example.py20
-rwxr-xr-xexamples/jfed-rlite.py54
-rw-r--r--examples/mouse.py105
-rwxr-xr-xexamples/two-layers.py10
4 files changed, 172 insertions, 17 deletions
diff --git a/examples/example.py b/examples/example.py
index c884f3e..8a68aab 100755
--- a/examples/example.py
+++ b/examples/example.py
@@ -17,7 +17,6 @@ import rumba.prototypes.irati as irati
import rumba.log as log
-
log.set_logging_level('DEBUG')
@@ -28,19 +27,16 @@ e1 = ShimEthDIF("e1")
a = Node("a",
difs = [n1, e1],
- dif_registrations = {n1 : [e1]},
- registrations = {"a.thing" : [n1]},
- bindings = {"a.thing" : "/usr/bin/thing"})
+ dif_registrations = {n1 : [e1]})
b = Node("b",
difs = [e1, n1],
- dif_registrations = {n1 : [e1]})
+ dif_registrations = {n1 : [e1]},
+ client = True)
-tb = qemu.Testbed(exp_name = "example1",
- username = "root",
- password = "root",
- bzimage = '/home/vmaffione/git/rlite/demo/buildroot/bzImage',
- initramfs = '/home/vmaffione/git/rlite/demo/buildroot/rootfs.cpio')
+tb = jfed.Testbed(exp_name = "example1",
+ username = "user1",
+ cert_file = "/home/user1/cert.pem")
exp = rl.Experiment(tb, nodes = [a, b])
@@ -49,5 +45,9 @@ print(exp)
try:
exp.swap_in()
exp.bootstrap_prototype()
+ c1 = Client("rinaperf", options ="-t perf -s 1000 -c 10000")
+ s1 = Server("rinaperf", arrival_rate=2, mean_duration=5, options = "-l", nodes = [a], clients = [c1])
+ sb = StoryBoard(exp, 3600, servers = [s1])
+ sb.start()
finally:
exp.swap_out()
diff --git a/examples/jfed-rlite.py b/examples/jfed-rlite.py
new file mode 100755
index 0000000..d80b56e
--- /dev/null
+++ b/examples/jfed-rlite.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+
+from rumba.model import *
+
+import rumba.testbeds.jfed as jfed
+import rumba.prototypes.rlite as rlite
+
+import rumba.log as log
+
+import argparse
+
+
+description = "Script to run rlite on jfed"
+epilog = "2017 H2020 ARCFIRE"
+
+argparser = argparse.ArgumentParser(description = description,
+ epilog = epilog)
+argparser.add_argument('--user', type = str, default = 'vmaffio',
+ help = "jFed username")
+argparser.add_argument('--cert', type = str,
+ help = "Absolute path to certificate (.pem) file"
+ " to be used with jFed",
+ default = '/home/vmaffione/Downloads/vmaffio-jfed.pem')
+argparser.add_argument('--expname', type = str, default = 'pinocchio',
+ help = "Name of the experiment within the jFed testbed")
+
+args = argparser.parse_args()
+
+log.set_logging_level('DEBUG')
+
+n1 = NormalDIF("n1")
+
+e1 = ShimEthDIF("e1")
+
+a = Node("a",
+ difs = [n1, e1],
+ dif_registrations = {n1 : [e1]})
+
+b = Node("b",
+ difs = [e1, n1],
+ dif_registrations = {n1 : [e1]})
+
+tb = jfed.Testbed(exp_name = args.expname,
+ cert_file = args.cert,
+ username = args.user)
+
+exp = rlite.Experiment(tb, nodes = [a, b])
+
+try:
+ exp.swap_in()
+ exp.install_prototype()
+ exp.bootstrap_prototype()
+finally:
+ exp.swap_out()
diff --git a/examples/mouse.py b/examples/mouse.py
new file mode 100644
index 0000000..25e2487
--- /dev/null
+++ b/examples/mouse.py
@@ -0,0 +1,105 @@
+#!/usr/bin/env python
+
+# An example script using the rumba package
+
+from rumba.model 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.qemu as qemu
+
+# import prototype plugins
+import rumba.prototypes.ouroboros as our
+import rumba.prototypes.rlite as rl
+import rumba.prototypes.irati as irati
+
+n01 = NormalDIF("n01")
+
+e01 = ShimEthDIF("e01")
+e02 = ShimEthDIF("e02")
+e03 = ShimEthDIF("e03")
+e04 = ShimEthDIF("e04")
+e05 = ShimEthDIF("e05")
+e06 = ShimEthDIF("e06")
+e07 = ShimEthDIF("e07")
+e08 = ShimEthDIF("e08")
+e09 = ShimEthDIF("e09")
+e10 = ShimEthDIF("e10")
+e11 = ShimEthDIF("e11")
+e12 = ShimEthDIF("e12")
+e13 = ShimEthDIF("e13")
+e14 = ShimEthDIF("e14")
+e15 = ShimEthDIF("e15")
+e16 = ShimEthDIF("e16")
+e17 = ShimEthDIF("e17")
+
+
+a = Node("a",
+ difs = [n01, e01, e06, e13 ],
+ dif_registrations = {n01 : [e01, e06, e13]})
+
+b = Node("b",
+ difs = [n01, e01, e02, e04],
+ dif_registrations = {n01 : [e01, e02, e04]})
+
+c = Node("c",
+ difs = [n01, e02, e03],
+ dif_registrations = {n01 : [e02, e03]})
+
+d = Node("d",
+ difs = [n01, e03, e04, e05],
+ dif_registrations = {n01 : [e03, e04, e05]})
+
+e = Node("e",
+ difs = [n01, e05, e06, e07],
+ dif_registrations = {n01 : [e05, e06, e07]})
+
+f = Node("f",
+ difs = [n01, e07, e08],
+ dif_registrations = {n01 : [e07, e08]})
+
+g = Node("g",
+ difs = [n01, e08, e09, e14],
+ dif_registrations = {n01 : [e08, e09, e14]})
+
+h = Node("h",
+ difs = [n01, e09, e10, e15],
+ dif_registrations = {n01 : [e09, e10, e15]})
+
+i = Node("i",
+ difs = [n01, e10, e11, e16],
+ dif_registrations = {n01 : [e10, e11, e16]})
+
+j = Node("j",
+ difs = [n01, e11, e12],
+ dif_registrations = {n01 : [e11, e12]})
+
+k = Node("k",
+ difs = [n01, e12, e13],
+ dif_registrations = {n01 : [e12, e13]})
+
+l = Node("l",
+ difs = [n01, e14, e15],
+ dif_registrations = {n01 : [e14, e15]})
+
+m = Node("m",
+ difs = [n01, e16, e17],
+ dif_registrations = {n01 : [e16, e17]})
+
+n = Node("n",
+ difs = [n01, e17],
+ dif_registrations = {n01 : [e17]})
+
+tb = jfed.Testbed(exp_name = "mouse2",
+ cert_file = "/home/sander/cert.pem",
+ username = "sander")
+
+exp = rl.Experiment(tb, nodes = [a, b, c, d, e, f, g, h, i, j, k, l, m, n])
+
+print(exp)
+
+exp.swap_in()
+exp.install_prototype()
+exp.bootstrap_prototype()
diff --git a/examples/two-layers.py b/examples/two-layers.py
index 9d1a6b3..b3622fd 100755
--- a/examples/two-layers.py
+++ b/examples/two-layers.py
@@ -32,9 +32,7 @@ e3 = ShimEthDIF("e3")
a = Node("a",
difs = [n3, n4, n1, e1],
- dif_registrations = {n4: [n1], n3: [n1], n1 : [e1]},
- registrations = {"rinaperf.server" : [n3]},
- bindings = {"rinaperf.server" : "/usr/bin/rinaperf"})
+ dif_registrations = {n4: [n1], n3: [n1], n1 : [e1]})
b = Node("b",
difs = [n1, e1, e2],
@@ -50,11 +48,9 @@ d = Node("d",
tb = qemu.Testbed(exp_name = "twolayers",
username = "root",
- password = "root",
- bzimage = '/home/vmaffione/git/rlite/demo/buildroot/bzImage',
- initramfs = '/home/vmaffione/git/rlite/demo/buildroot/rootfs.cpio')
+ password = "root")
-exp = rl.Experiment(tb, nodes = [a, b, c, d])
+exp = irati.Experiment(tb, nodes = [a, b, c, d])
print(exp)