aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/europe-vpns-small.py113
-rw-r--r--examples/europe-vpns.py217
-rw-r--r--examples/europe.py212
-rwxr-xr-xexamples/example.py3
-rw-r--r--examples/insane-stacking.py42
-rw-r--r--examples/resilient-square.py48
-rw-r--r--examples/seven.py61
-rw-r--r--examples/star.py40
-rw-r--r--examples/triangle.py42
-rwxr-xr-xexamples/two-layers.py3
-rw-r--r--rumba/model.py109
-rw-r--r--rumba/prototypes/irati.py2
-rw-r--r--rumba/prototypes/ouroboros.py10
-rw-r--r--rumba/prototypes/rlite.py25
-rw-r--r--rumba/ssh_support.py31
-rw-r--r--rumba/testbeds/emulab.py23
-rw-r--r--rumba/testbeds/jfed.py4
-rw-r--r--rumba/testbeds/qemu.py18
-rwxr-xr-xtools/democonf2rumba.py195
19 files changed, 211 insertions, 987 deletions
diff --git a/examples/europe-vpns-small.py b/examples/europe-vpns-small.py
deleted file mode 100644
index 062015f..0000000
--- a/examples/europe-vpns-small.py
+++ /dev/null
@@ -1,113 +0,0 @@
-#!/usr/bin/env/python
-
-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
-
-shimmilan-nice = ShimEthDIF("shimmilan-nice", link_speed=0))
-shimmilan-zurich = ShimEthDIF("shimmilan-zurich", link_speed=0))
-shimbarcelona-lyon = ShimEthDIF("shimbarcelona-lyon", link_speed=0))
-shimflorence-rome = ShimEthDIF("shimflorence-rome", link_speed=0))
-shimbarcelona-valencia = ShimEthDIF("shimbarcelona-valencia", link_speed=0))
-shimlyon-nice = ShimEthDIF("shimlyon-nice", link_speed=0))
-shimmilan-venice = ShimEthDIF("shimmilan-venice", link_speed=0))
-shimpisa-rome = ShimEthDIF("shimpisa-rome", link_speed=0))
-shimmadrid-valencia = ShimEthDIF("shimmadrid-valencia", link_speed=0))
-shimlyon-paris = ShimEthDIF("shimlyon-paris", link_speed=0))
-shimnaples-rome = ShimEthDIF("shimnaples-rome", link_speed=0))
-shimflorence-pisa = ShimEthDIF("shimflorence-pisa", link_speed=0))
-shimbarcelona-madrid = ShimEthDIF("shimbarcelona-madrid", link_speed=0))
-shimmunich-vienna = ShimEthDIF("shimmunich-vienna", link_speed=0))
-shimflorence-milan = ShimEthDIF("shimflorence-milan", link_speed=0))
-shimlisbon-madrid = ShimEthDIF("shimlisbon-madrid", link_speed=0))
-shimvenice-vienna = ShimEthDIF("shimvenice-vienna", link_speed=0))
-shimmunich-zurich = ShimEthDIF("shimmunich-zurich", link_speed=0))
-shimflorence-venice = ShimEthDIF("shimflorence-venice", link_speed=0))
-
-fravpn = NormalDIF("fravpn")
-ibervpn = NormalDIF("ibervpn")
-eu = NormalDIF("eu")
-itavpn = NormalDIF("itavpn")
-
-vienna = Node("vienna",
- difs=[venice-vienna, munich-vienna],
- dif_registrations={})
-
-milan = Node("milan",
- difs=[florence-milan, milan-venice, milan-zurich, milan-nice, eu, itavpn],
- dif_registrations={eu: [milan-venice, florence-milan, milan-zurich, milan-nice], itavpn: [eu]})
-
-zurich = Node("zurich",
- difs=[milan-zurich, munich-zurich],
- dif_registrations={})
-
-paris = Node("paris",
- difs=[lyon-paris, eu, fravpn],
- dif_registrations={fravpn: [eu], eu: [lyon-paris]})
-
-venice = Node("venice",
- difs=[florence-venice, milan-venice, venice-vienna, eu, itavpn],
- dif_registrations={eu: [milan-venice, florence-venice, venice-vienna], itavpn: [eu]})
-
-pisa = Node("pisa",
- difs=[pisa-rome, florence-pisa, eu, itavpn],
- dif_registrations={eu: [pisa-rome, florence-pisa], itavpn: [eu]})
-
-valencia = Node("valencia",
- difs=[barcelona-valencia, madrid-valencia, eu, ibervpn],
- dif_registrations={ibervpn: [eu], eu: [barcelona-valencia, madrid-valencia]})
-
-lisbon = Node("lisbon",
- difs=[lisbon-madrid, eu, ibervpn],
- dif_registrations={ibervpn: [eu], eu: [lisbon-madrid]})
-
-barcelona = Node("barcelona",
- difs=[barcelona-lyon, barcelona-madrid, barcelona-valencia, eu, ibervpn],
- dif_registrations={ibervpn: [eu], eu: [barcelona-lyon, barcelona-madrid, barcelona-valencia]})
-
-nice = Node("nice",
- difs=[milan-nice, lyon-nice, eu, fravpn],
- dif_registrations={fravpn: [eu], eu: [milan-nice, lyon-nice]})
-
-lyon = Node("lyon",
- difs=[lyon-nice, lyon-paris, barcelona-lyon, eu, fravpn],
- dif_registrations={fravpn: [eu], eu: [lyon-paris, lyon-nice, barcelona-lyon]})
-
-madrid = Node("madrid",
- difs=[barcelona-madrid, madrid-valencia, lisbon-madrid, eu, ibervpn],
- dif_registrations={ibervpn: [eu], eu: [barcelona-madrid, madrid-valencia, lisbon-madrid]})
-
-munich = Node("munich",
- difs=[munich-zurich, munich-vienna],
- dif_registrations={})
-
-florence = Node("florence",
- difs=[florence-rome, florence-pisa, florence-milan, florence-venice, eu, itavpn],
- dif_registrations={eu: [florence-pisa, florence-rome, florence-milan, florence-venice], itavpn: [eu]})
-
-naples = Node("naples",
- difs=[naples-rome, eu, itavpn],
- dif_registrations={eu: [naples-rome], itavpn: [eu]})
-
-rome = Node("rome",
- difs=[naples-rome, pisa-rome, florence-rome, eu, itavpn],
- dif_registrations={eu: [naples-rome, pisa-rome, florence-rome], itavpn: [eu]})
-
-tb = qemu.Testbed(exp_name = "europe-vpns-small",
- bzimage = "/home/mcapitani/RINA/checkouts/rlite/demo/buildroot/bzImage",
- initramfs = "/home/mcapitani/RINA/checkouts/rlite/demo/buildroot/rootfs.cpio")
-
-exp = rl.Experiment(tb, nodes = [a, b, c, d])
-
-print(exp)
-
-exp.run()
diff --git a/examples/europe-vpns.py b/examples/europe-vpns.py
deleted file mode 100644
index 859f0c3..0000000
--- a/examples/europe-vpns.py
+++ /dev/null
@@ -1,217 +0,0 @@
-#!/usr/bin/env/python
-
-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
-
-shimoslo-stockholm = ShimEthDIF("shimoslo-stockholm", link_speed=0))
-shimbarcelona-lyon = ShimEthDIF("shimbarcelona-lyon", link_speed=0))
-shimberlin-munich = ShimEthDIF("shimberlin-munich", link_speed=0))
-shimmunich-zurich = ShimEthDIF("shimmunich-zurich", link_speed=0))
-shimedimburgh-london = ShimEthDIF("shimedimburgh-london", link_speed=0))
-shimmunich-prague = ShimEthDIF("shimmunich-prague", link_speed=0))
-shimmilan-zurich = ShimEthDIF("shimmilan-zurich", link_speed=0))
-shimbucarest-sofia = ShimEthDIF("shimbucarest-sofia", link_speed=0))
-shimalgiers-naples = ShimEthDIF("shimalgiers-naples", link_speed=0))
-shimbudapest-varsaw = ShimEthDIF("shimbudapest-varsaw", link_speed=0))
-shimmunich-vienna = ShimEthDIF("shimmunich-vienna", link_speed=0))
-shimamsterdam-oslo = ShimEthDIF("shimamsterdam-oslo", link_speed=0))
-shimbelgrad-zagreb = ShimEthDIF("shimbelgrad-zagreb", link_speed=0))
-shimbudapest-prague = ShimEthDIF("shimbudapest-prague", link_speed=0))
-shimnaples-tunis = ShimEthDIF("shimnaples-tunis", link_speed=0))
-shimhelsinki-stockholm = ShimEthDIF("shimhelsinki-stockholm", link_speed=0))
-shimflorence-rome = ShimEthDIF("shimflorence-rome", link_speed=0))
-shimmadrid-valencia = ShimEthDIF("shimmadrid-valencia", link_speed=0))
-shimalgiers-tunis = ShimEthDIF("shimalgiers-tunis", link_speed=0))
-shimlyon-paris = ShimEthDIF("shimlyon-paris", link_speed=0))
-shimprague-vienna = ShimEthDIF("shimprague-vienna", link_speed=0))
-shimhelsinki-varsaw = ShimEthDIF("shimhelsinki-varsaw", link_speed=0))
-shimnaples-rome = ShimEthDIF("shimnaples-rome", link_speed=0))
-shimberlin-varsaw = ShimEthDIF("shimberlin-varsaw", link_speed=0))
-shimflorence-pisa = ShimEthDIF("shimflorence-pisa", link_speed=0))
-shimpisa-rome = ShimEthDIF("shimpisa-rome", link_speed=0))
-shimbelgrad-bucarest = ShimEthDIF("shimbelgrad-bucarest", link_speed=0))
-shimamsterdam-brussels = ShimEthDIF("shimamsterdam-brussels", link_speed=0))
-shimmilan-venice = ShimEthDIF("shimmilan-venice", link_speed=0))
-shimathens-naples = ShimEthDIF("shimathens-naples", link_speed=0))
-shimflorence-venice = ShimEthDIF("shimflorence-venice", link_speed=0))
-shimbelgrad-sofia = ShimEthDIF("shimbelgrad-sofia", link_speed=0))
-shimbarcelona-madrid = ShimEthDIF("shimbarcelona-madrid", link_speed=0))
-shimmilan-nice = ShimEthDIF("shimmilan-nice", link_speed=0))
-shimvenice-vienna = ShimEthDIF("shimvenice-vienna", link_speed=0))
-shimalgiers-valencia = ShimEthDIF("shimalgiers-valencia", link_speed=0))
-shimlyon-nice = ShimEthDIF("shimlyon-nice", link_speed=0))
-shimlisbon-madrid = ShimEthDIF("shimlisbon-madrid", link_speed=0))
-shimbarcelona-valencia = ShimEthDIF("shimbarcelona-valencia", link_speed=0))
-shimflorence-milan = ShimEthDIF("shimflorence-milan", link_speed=0))
-shimamsterdam-berlin = ShimEthDIF("shimamsterdam-berlin", link_speed=0))
-shimamsterdam-stockholm = ShimEthDIF("shimamsterdam-stockholm", link_speed=0))
-shimberlin-prague = ShimEthDIF("shimberlin-prague", link_speed=0))
-shimbudapest-zagreb = ShimEthDIF("shimbudapest-zagreb", link_speed=0))
-shimbrussels-london = ShimEthDIF("shimbrussels-london", link_speed=0))
-shimathens-sofia = ShimEthDIF("shimathens-sofia", link_speed=0))
-shimbrussels-paris = ShimEthDIF("shimbrussels-paris", link_speed=0))
-shimberlin-brussels = ShimEthDIF("shimberlin-brussels", link_speed=0))
-shimlondon-paris = ShimEthDIF("shimlondon-paris", link_speed=0))
-
-itavpn = NormalDIF("itavpn")
-cenvpn = NormalDIF("cenvpn")
-ibervpn = NormalDIF("ibervpn")
-nortvpn = NormalDIF("nortvpn")
-eu = NormalDIF("eu")
-eastvpn = NormalDIF("eastvpn")
-
-sofia = Node("sofia",
- difs=[athens-sofia, bucarest-sofia, belgrad-sofia, eu],
- dif_registrations={eu: [athens-sofia, belgrad-sofia, bucarest-sofia]})
-
-bucarest = Node("bucarest",
- difs=[bucarest-sofia, belgrad-bucarest, eu, eastvpn],
- dif_registrations={eu: [bucarest-sofia, belgrad-bucarest], eastvpn: [eu]})
-
-zagreb = Node("zagreb",
- difs=[belgrad-zagreb, budapest-zagreb, eu, eastvpn],
- dif_registrations={eu: [belgrad-zagreb, budapest-zagreb], eastvpn: [eu]})
-
-lisbon = Node("lisbon",
- difs=[lisbon-madrid, eu, ibervpn],
- dif_registrations={ibervpn: [eu], eu: [lisbon-madrid]})
-
-pisa = Node("pisa",
- difs=[pisa-rome, florence-pisa, eu, itavpn],
- dif_registrations={itavpn: [eu], eu: [pisa-rome, florence-pisa]})
-
-tunis = Node("tunis",
- difs=[algiers-tunis, naples-tunis, eu],
- dif_registrations={eu: [algiers-tunis, naples-tunis]})
-
-berlin = Node("berlin",
- difs=[berlin-prague, berlin-munich, berlin-varsaw, amsterdam-berlin, berlin-brussels, eu, cenvpn],
- dif_registrations={cenvpn: [eu], eu: [berlin-munich, berlin-prague, berlin-varsaw, amsterdam-berlin, berlin-brussels]})
-
-barcelona = Node("barcelona",
- difs=[barcelona-lyon, barcelona-madrid, barcelona-valencia, eu, ibervpn],
- dif_registrations={ibervpn: [eu], eu: [barcelona-lyon, barcelona-madrid, barcelona-valencia]})
-
-venice = Node("venice",
- difs=[florence-venice, milan-venice, venice-vienna, eu, itavpn],
- dif_registrations={itavpn: [eu], eu: [milan-venice, florence-venice, venice-vienna]})
-
-helsinki = Node("helsinki",
- difs=[helsinki-stockholm, helsinki-varsaw, eu, nortvpn],
- dif_registrations={nortvpn: [eu], eu: [helsinki-stockholm, helsinki-varsaw]})
-
-lyon = Node("lyon",
- difs=[lyon-nice, lyon-paris, barcelona-lyon, eu],
- dif_registrations={eu: [lyon-paris, lyon-nice, barcelona-lyon]})
-
-madrid = Node("madrid",
- difs=[barcelona-madrid, madrid-valencia, lisbon-madrid, eu, ibervpn],
- dif_registrations={ibervpn: [eu], eu: [barcelona-madrid, madrid-valencia, lisbon-madrid]})
-
-prague = Node("prague",
- difs=[budapest-prague, prague-vienna, munich-prague, berlin-prague, eu, cenvpn],
- dif_registrations={cenvpn: [eu], eu: [budapest-prague, prague-vienna, munich-prague, berlin-prague]})
-
-vienna = Node("vienna",
- difs=[venice-vienna, munich-vienna, prague-vienna, eu, cenvpn],
- dif_registrations={cenvpn: [eu], eu: [venice-vienna, prague-vienna, munich-vienna]})
-
-amsterdam = Node("amsterdam",
- difs=[amsterdam-berlin, amsterdam-brussels, amsterdam-oslo, amsterdam-stockholm, eu, cenvpn],
- dif_registrations={cenvpn: [eu], eu: [amsterdam-berlin, amsterdam-oslo, amsterdam-brussels, amsterdam-stockholm]})
-
-athens = Node("athens",
- difs=[athens-naples, athens-sofia, eu],
- dif_registrations={eu: [athens-naples, athens-sofia]})
-
-florence = Node("florence",
- difs=[florence-rome, florence-pisa, florence-milan, florence-venice, eu, itavpn],
- dif_registrations={itavpn: [eu], eu: [florence-pisa, florence-rome, florence-milan, florence-venice]})
-
-brussels = Node("brussels",
- difs=[berlin-brussels, amsterdam-brussels, brussels-paris, brussels-london, eu],
- dif_registrations={eu: [berlin-brussels, amsterdam-brussels, brussels-london, brussels-paris]})
-
-naples = Node("naples",
- difs=[naples-rome, algiers-naples, naples-tunis, athens-naples, eu, itavpn],
- dif_registrations={itavpn: [eu], eu: [naples-rome, athens-naples, algiers-naples, naples-tunis]})
-
-zurich = Node("zurich",
- difs=[milan-zurich, munich-zurich, eu],
- dif_registrations={eu: [munich-zurich, milan-zurich]})
-
-edimburgh = Node("edimburgh",
- difs=[edimburgh-london, eu],
- dif_registrations={eu: [edimburgh-london]})
-
-milan = Node("milan",
- difs=[florence-milan, milan-venice, milan-zurich, milan-nice, eu, itavpn],
- dif_registrations={itavpn: [eu], eu: [milan-venice, florence-milan, milan-zurich, milan-nice]})
-
-rome = Node("rome",
- difs=[naples-rome, pisa-rome, florence-rome, eu, itavpn],
- dif_registrations={itavpn: [eu], eu: [naples-rome, pisa-rome, florence-rome]})
-
-nice = Node("nice",
- difs=[milan-nice, lyon-nice, eu],
- dif_registrations={eu: [milan-nice, lyon-nice]})
-
-stockholm = Node("stockholm",
- difs=[oslo-stockholm, amsterdam-stockholm, helsinki-stockholm, eu, nortvpn],
- dif_registrations={nortvpn: [eu], eu: [helsinki-stockholm, oslo-stockholm, amsterdam-stockholm]})
-
-varsaw = Node("varsaw",
- difs=[budapest-varsaw, berlin-varsaw, helsinki-varsaw, eu, eastvpn],
- dif_registrations={eu: [budapest-varsaw, berlin-varsaw, helsinki-varsaw], eastvpn: [eu]})
-
-budapest = Node("budapest",
- difs=[budapest-zagreb, budapest-prague, budapest-varsaw, eu, eastvpn],
- dif_registrations={eu: [budapest-varsaw, budapest-zagreb, budapest-prague], eastvpn: [eu]})
-
-belgrad = Node("belgrad",
- difs=[belgrad-sofia, belgrad-bucarest, belgrad-zagreb, eu, eastvpn],
- dif_registrations={eu: [belgrad-sofia, belgrad-bucarest, belgrad-zagreb], eastvpn: [eu]})
-
-london = Node("london",
- difs=[london-paris, brussels-london, edimburgh-london, eu],
- dif_registrations={eu: [brussels-london, edimburgh-london, london-paris]})
-
-paris = Node("paris",
- difs=[lyon-paris, brussels-paris, london-paris, eu],
- dif_registrations={eu: [lyon-paris, london-paris, brussels-paris]})
-
-munich = Node("munich",
- difs=[munich-zurich, munich-vienna, munich-prague, berlin-munich, eu, cenvpn],
- dif_registrations={cenvpn: [eu], eu: [munich-vienna, munich-zurich, munich-prague, berlin-munich]})
-
-valencia = Node("valencia",
- difs=[barcelona-valencia, madrid-valencia, algiers-valencia, eu, ibervpn],
- dif_registrations={ibervpn: [eu], eu: [barcelona-valencia, madrid-valencia, algiers-valencia]})
-
-algiers = Node("algiers",
- difs=[algiers-valencia, algiers-tunis, algiers-naples, eu],
- dif_registrations={eu: [algiers-valencia, algiers-tunis, algiers-naples]})
-
-oslo = Node("oslo",
- difs=[amsterdam-oslo, oslo-stockholm, eu, nortvpn],
- dif_registrations={nortvpn: [eu], eu: [amsterdam-oslo, oslo-stockholm]})
-
-tb = qemu.Testbed(exp_name = "europe-vpns",
- bzimage = "/home/mcapitani/RINA/checkouts/rlite/demo/buildroot/bzImage",
- initramfs = "/home/mcapitani/RINA/checkouts/rlite/demo/buildroot/rootfs.cpio")
-
-exp = rl.Experiment(tb, nodes = [a, b, c, d])
-
-print(exp)
-
-exp.run()
diff --git a/examples/europe.py b/examples/europe.py
deleted file mode 100644
index 062d053..0000000
--- a/examples/europe.py
+++ /dev/null
@@ -1,212 +0,0 @@
-#!/usr/bin/env/python
-
-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
-
-shimvenice-vienna = ShimEthDIF("shimvenice-vienna", link_speed=0))
-shimbrussels-paris = ShimEthDIF("shimbrussels-paris", link_speed=0))
-shimmilan-venice = ShimEthDIF("shimmilan-venice", link_speed=0))
-shimberlin-brussels = ShimEthDIF("shimberlin-brussels", link_speed=0))
-shimlisbon-madrid = ShimEthDIF("shimlisbon-madrid", link_speed=0))
-shimbudapest-zagreb = ShimEthDIF("shimbudapest-zagreb", link_speed=0))
-shimprague-vienna = ShimEthDIF("shimprague-vienna", link_speed=0))
-shimbelgrad-bucarest = ShimEthDIF("shimbelgrad-bucarest", link_speed=0))
-shimathens-sofia = ShimEthDIF("shimathens-sofia", link_speed=0))
-shimmunich-zurich = ShimEthDIF("shimmunich-zurich", link_speed=0))
-shimhelsinki-stockholm = ShimEthDIF("shimhelsinki-stockholm", link_speed=0))
-shimbelgrad-zagreb = ShimEthDIF("shimbelgrad-zagreb", link_speed=0))
-shimmilan-zurich = ShimEthDIF("shimmilan-zurich", link_speed=0))
-shimbelgrad-sofia = ShimEthDIF("shimbelgrad-sofia", link_speed=0))
-shimamsterdam-stockholm = ShimEthDIF("shimamsterdam-stockholm", link_speed=0))
-shimbudapest-prague = ShimEthDIF("shimbudapest-prague", link_speed=0))
-shimnaples-tunis = ShimEthDIF("shimnaples-tunis", link_speed=0))
-shimflorence-pisa = ShimEthDIF("shimflorence-pisa", link_speed=0))
-shimflorence-rome = ShimEthDIF("shimflorence-rome", link_speed=0))
-shimmunich-prague = ShimEthDIF("shimmunich-prague", link_speed=0))
-shimedimburgh-london = ShimEthDIF("shimedimburgh-london", link_speed=0))
-shimbarcelona-valencia = ShimEthDIF("shimbarcelona-valencia", link_speed=0))
-shimlyon-nice = ShimEthDIF("shimlyon-nice", link_speed=0))
-shimbudapest-varsaw = ShimEthDIF("shimbudapest-varsaw", link_speed=0))
-shimberlin-varsaw = ShimEthDIF("shimberlin-varsaw", link_speed=0))
-shimlondon-paris = ShimEthDIF("shimlondon-paris", link_speed=0))
-shimmunich-vienna = ShimEthDIF("shimmunich-vienna", link_speed=0))
-shimoslo-stockholm = ShimEthDIF("shimoslo-stockholm", link_speed=0))
-shimbarcelona-madrid = ShimEthDIF("shimbarcelona-madrid", link_speed=0))
-shimmilan-nice = ShimEthDIF("shimmilan-nice", link_speed=0))
-shimlyon-paris = ShimEthDIF("shimlyon-paris", link_speed=0))
-shimflorence-venice = ShimEthDIF("shimflorence-venice", link_speed=0))
-shimhelsinki-varsaw = ShimEthDIF("shimhelsinki-varsaw", link_speed=0))
-shimalgiers-valencia = ShimEthDIF("shimalgiers-valencia", link_speed=0))
-shimberlin-munich = ShimEthDIF("shimberlin-munich", link_speed=0))
-shimamsterdam-oslo = ShimEthDIF("shimamsterdam-oslo", link_speed=0))
-shimnaples-rome = ShimEthDIF("shimnaples-rome", link_speed=0))
-shimalgiers-tunis = ShimEthDIF("shimalgiers-tunis", link_speed=0))
-shimberlin-prague = ShimEthDIF("shimberlin-prague", link_speed=0))
-shimathens-naples = ShimEthDIF("shimathens-naples", link_speed=0))
-shimmadrid-valencia = ShimEthDIF("shimmadrid-valencia", link_speed=0))
-shimbarcelona-lyon = ShimEthDIF("shimbarcelona-lyon", link_speed=0))
-shimbrussels-london = ShimEthDIF("shimbrussels-london", link_speed=0))
-shimamsterdam-berlin = ShimEthDIF("shimamsterdam-berlin", link_speed=0))
-shimamsterdam-brussels = ShimEthDIF("shimamsterdam-brussels", link_speed=0))
-shimalgiers-naples = ShimEthDIF("shimalgiers-naples", link_speed=0))
-shimflorence-milan = ShimEthDIF("shimflorence-milan", link_speed=0))
-shimbucarest-sofia = ShimEthDIF("shimbucarest-sofia", link_speed=0))
-shimpisa-rome = ShimEthDIF("shimpisa-rome", link_speed=0))
-
-eu = NormalDIF("eu")
-
-amsterdam = Node("amsterdam",
- difs=[amsterdam-berlin, amsterdam-brussels, amsterdam-oslo, amsterdam-stockholm, eu],
- dif_registrations={eu: [amsterdam-berlin, amsterdam-oslo, amsterdam-brussels, amsterdam-stockholm]})
-
-munich = Node("munich",
- difs=[munich-zurich, munich-vienna, munich-prague, berlin-munich, eu],
- dif_registrations={eu: [munich-vienna, munich-zurich, munich-prague, berlin-munich]})
-
-valencia = Node("valencia",
- difs=[barcelona-valencia, madrid-valencia, algiers-valencia, eu],
- dif_registrations={eu: [barcelona-valencia, madrid-valencia, algiers-valencia]})
-
-algiers = Node("algiers",
- difs=[algiers-valencia, algiers-tunis, algiers-naples, eu],
- dif_registrations={eu: [algiers-valencia, algiers-tunis, algiers-naples]})
-
-naples = Node("naples",
- difs=[naples-rome, algiers-naples, naples-tunis, athens-naples, eu],
- dif_registrations={eu: [naples-rome, athens-naples, algiers-naples, naples-tunis]})
-
-nice = Node("nice",
- difs=[milan-nice, lyon-nice, eu],
- dif_registrations={eu: [milan-nice, lyon-nice]})
-
-lisbon = Node("lisbon",
- difs=[lisbon-madrid, eu],
- dif_registrations={eu: [lisbon-madrid]})
-
-bucarest = Node("bucarest",
- difs=[bucarest-sofia, belgrad-bucarest, eu],
- dif_registrations={eu: [bucarest-sofia, belgrad-bucarest]})
-
-budapest = Node("budapest",
- difs=[budapest-zagreb, budapest-prague, budapest-varsaw, eu],
- dif_registrations={eu: [budapest-varsaw, budapest-zagreb, budapest-prague]})
-
-rome = Node("rome",
- difs=[naples-rome, pisa-rome, florence-rome, eu],
- dif_registrations={eu: [naples-rome, pisa-rome, florence-rome]})
-
-barcelona = Node("barcelona",
- difs=[barcelona-lyon, barcelona-madrid, barcelona-valencia, eu],
- dif_registrations={eu: [barcelona-lyon, barcelona-madrid, barcelona-valencia]})
-
-pisa = Node("pisa",
- difs=[pisa-rome, florence-pisa, eu],
- dif_registrations={eu: [pisa-rome, florence-pisa]})
-
-tunis = Node("tunis",
- difs=[algiers-tunis, naples-tunis, eu],
- dif_registrations={eu: [algiers-tunis, naples-tunis]})
-
-zurich = Node("zurich",
- difs=[milan-zurich, munich-zurich, eu],
- dif_registrations={eu: [munich-zurich, milan-zurich]})
-
-athens = Node("athens",
- difs=[athens-naples, athens-sofia, eu],
- dif_registrations={eu: [athens-naples, athens-sofia]})
-
-paris = Node("paris",
- difs=[lyon-paris, brussels-paris, london-paris, eu],
- dif_registrations={eu: [lyon-paris, london-paris, brussels-paris]})
-
-stockholm = Node("stockholm",
- difs=[oslo-stockholm, amsterdam-stockholm, helsinki-stockholm, eu],
- dif_registrations={eu: [helsinki-stockholm, oslo-stockholm, amsterdam-stockholm]})
-
-varsaw = Node("varsaw",
- difs=[budapest-varsaw, berlin-varsaw, helsinki-varsaw, eu],
- dif_registrations={eu: [budapest-varsaw, berlin-varsaw, helsinki-varsaw]})
-
-lyon = Node("lyon",
- difs=[lyon-nice, lyon-paris, barcelona-lyon, eu],
- dif_registrations={eu: [lyon-paris, lyon-nice, barcelona-lyon]})
-
-vienna = Node("vienna",
- difs=[venice-vienna, munich-vienna, prague-vienna, eu],
- dif_registrations={eu: [venice-vienna, prague-vienna, munich-vienna]})
-
-milan = Node("milan",
- difs=[florence-milan, milan-venice, milan-zurich, milan-nice, eu],
- dif_registrations={eu: [milan-venice, florence-milan, milan-zurich, milan-nice]})
-
-brussels = Node("brussels",
- difs=[berlin-brussels, amsterdam-brussels, brussels-paris, brussels-london, eu],
- dif_registrations={eu: [berlin-brussels, amsterdam-brussels, brussels-london, brussels-paris]})
-
-berlin = Node("berlin",
- difs=[berlin-prague, berlin-munich, berlin-varsaw, amsterdam-berlin, berlin-brussels, eu],
- dif_registrations={eu: [berlin-munich, berlin-prague, berlin-varsaw, amsterdam-berlin, berlin-brussels]})
-
-madrid = Node("madrid",
- difs=[barcelona-madrid, madrid-valencia, lisbon-madrid, eu],
- dif_registrations={eu: [barcelona-madrid, madrid-valencia, lisbon-madrid]})
-
-oslo = Node("oslo",
- difs=[amsterdam-oslo, oslo-stockholm, eu],
- dif_registrations={eu: [amsterdam-oslo, oslo-stockholm]})
-
-venice = Node("venice",
- difs=[florence-venice, milan-venice, venice-vienna, eu],
- dif_registrations={eu: [milan-venice, florence-venice, venice-vienna]})
-
-london = Node("london",
- difs=[london-paris, brussels-london, edimburgh-london, eu],
- dif_registrations={eu: [brussels-london, edimburgh-london, london-paris]})
-
-sofia = Node("sofia",
- difs=[athens-sofia, bucarest-sofia, belgrad-sofia, eu],
- dif_registrations={eu: [athens-sofia, belgrad-sofia, bucarest-sofia]})
-
-helsinki = Node("helsinki",
- difs=[helsinki-stockholm, helsinki-varsaw, eu],
- dif_registrations={eu: [helsinki-stockholm, helsinki-varsaw]})
-
-florence = Node("florence",
- difs=[florence-rome, florence-pisa, florence-milan, florence-venice, eu],
- dif_registrations={eu: [florence-pisa, florence-rome, florence-milan, florence-venice]})
-
-belgrad = Node("belgrad",
- difs=[belgrad-sofia, belgrad-bucarest, belgrad-zagreb, eu],
- dif_registrations={eu: [belgrad-sofia, belgrad-bucarest, belgrad-zagreb]})
-
-zagreb = Node("zagreb",
- difs=[belgrad-zagreb, budapest-zagreb, eu],
- dif_registrations={eu: [belgrad-zagreb, budapest-zagreb]})
-
-prague = Node("prague",
- difs=[budapest-prague, prague-vienna, munich-prague, berlin-prague, eu],
- dif_registrations={eu: [budapest-prague, prague-vienna, munich-prague, berlin-prague]})
-
-edimburgh = Node("edimburgh",
- difs=[edimburgh-london, eu],
- dif_registrations={eu: [edimburgh-london]})
-
-tb = qemu.Testbed(exp_name = "europe",
- bzimage = "/home/mcapitani/RINA/checkouts/rlite/demo/buildroot/bzImage",
- initramfs = "/home/mcapitani/RINA/checkouts/rlite/demo/buildroot/rootfs.cpio")
-
-exp = rl.Experiment(tb, nodes = [a, b, c, d])
-
-print(exp)
-
-exp.run()
diff --git a/examples/example.py b/examples/example.py
index 0d8fcd9..54ecd37 100755
--- a/examples/example.py
+++ b/examples/example.py
@@ -31,7 +31,8 @@ b = Node("b",
dif_registrations = {n1 : [e1]})
tb = qemu.Testbed(exp_name = "example1",
- username = "vmaffione",
+ username = "root",
+ password = "root",
bzimage = '/home/vmaffione/git/rlite/demo/buildroot/bzImage',
initramfs = '/home/vmaffione/git/rlite/demo/buildroot/rootfs.cpio')
diff --git a/examples/insane-stacking.py b/examples/insane-stacking.py
deleted file mode 100644
index 4a2f4e3..0000000
--- a/examples/insane-stacking.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env/python
-
-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
-
-shim300 = ShimEthDIF("shim300", link_speed=0))
-
-n1 = NormalDIF("n1")
-n2 = NormalDIF("n2")
-n3 = NormalDIF("n3")
-n5 = NormalDIF("n5")
-n7 = NormalDIF("n7")
-n4 = NormalDIF("n4")
-n6 = NormalDIF("n6")
-
-a = Node("a",
- difs=[300, n1, n2, n3, n4, n5, n6, n7],
- dif_registrations={n1: [300], n2: [n1], n3: [n2], n5: [n4], n7: [n6], n4: [n3], n6: [n5]})
-
-b = Node("b",
- difs=[300, n1, n2, n3, n4, n5, n6, n7],
- dif_registrations={n1: [300], n2: [n1], n3: [n2], n5: [n4], n7: [n6], n4: [n3], n6: [n5]})
-
-tb = qemu.Testbed(exp_name = "insane-stacking",
- bzimage = "/home/mcapitani/RINA/checkouts/rlite/demo/buildroot/bzImage",
- initramfs = "/home/mcapitani/RINA/checkouts/rlite/demo/buildroot/rootfs.cpio")
-
-exp = rl.Experiment(tb, nodes = [a, b, c, d])
-
-print(exp)
-
-exp.run()
diff --git a/examples/resilient-square.py b/examples/resilient-square.py
deleted file mode 100644
index 82d5389..0000000
--- a/examples/resilient-square.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env/python
-
-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
-
-shim700 = ShimEthDIF("shim700", link_speed=100))
-shim400 = ShimEthDIF("shim400", link_speed=100))
-shim500 = ShimEthDIF("shim500", link_speed=100))
-shim600 = ShimEthDIF("shim600", link_speed=1))
-shim300 = ShimEthDIF("shim300", link_speed=100))
-
-n1 = NormalDIF("n1")
-
-c = Node("c",
- difs=[400, 500, 700, n1],
- dif_registrations={n1: [400, 500, 700]})
-
-b = Node("b",
- difs=[300, 400, n1],
- dif_registrations={n1: [300, 400]})
-
-a = Node("a",
- difs=[300, 600, 700, n1],
- dif_registrations={n1: [300, 600, 700]})
-
-d = Node("d",
- difs=[500, 600, n1],
- dif_registrations={n1: [500, 600]})
-
-tb = qemu.Testbed(exp_name = "resilient-square",
- bzimage = "/home/mcapitani/RINA/checkouts/rlite/demo/buildroot/bzImage",
- initramfs = "/home/mcapitani/RINA/checkouts/rlite/demo/buildroot/rootfs.cpio")
-
-exp = rl.Experiment(tb, nodes = [a, b, c, d])
-
-print(exp)
-
-exp.run()
diff --git a/examples/seven.py b/examples/seven.py
deleted file mode 100644
index 42402a6..0000000
--- a/examples/seven.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env/python
-
-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
-
-shim500 = ShimEthDIF("shim500", link_speed=0))
-shim600 = ShimEthDIF("shim600", link_speed=0))
-shim700 = ShimEthDIF("shim700", link_speed=0))
-shim400 = ShimEthDIF("shim400", link_speed=0))
-shim300 = ShimEthDIF("shim300", link_speed=0))
-shim800 = ShimEthDIF("shim800", link_speed=0))
-
-n1 = NormalDIF("n1")
-
-b = Node("b",
- difs=[300, 400, n1],
- dif_registrations={n1: [300, 400]})
-
-g = Node("g",
- difs=[800, n1],
- dif_registrations={n1: [800]})
-
-c = Node("c",
- difs=[400, 500, 600, n1],
- dif_registrations={n1: [400, 500, 600]})
-
-f = Node("f",
- difs=[500, n1],
- dif_registrations={n1: [500]})
-
-a = Node("a",
- difs=[300, n1],
- dif_registrations={n1: [300]})
-
-d = Node("d",
- difs=[600, 700, n1],
- dif_registrations={n1: [600, 700]})
-
-e = Node("e",
- difs=[700, 800, n1],
- dif_registrations={n1: [700, 800]})
-
-tb = qemu.Testbed(exp_name = "seven",
- bzimage = "/home/mcapitani/RINA/checkouts/rlite/demo/buildroot/bzImage",
- initramfs = "/home/mcapitani/RINA/checkouts/rlite/demo/buildroot/rootfs.cpio")
-
-exp = rl.Experiment(tb, nodes = [a, b, c, d])
-
-print(exp)
-
-exp.run()
diff --git a/examples/star.py b/examples/star.py
deleted file mode 100644
index c00aab7..0000000
--- a/examples/star.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env/python
-
-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
-
-shim300 = ShimEthDIF("shim300", link_speed=0))
-
-n1 = NormalDIF("n1")
-
-a = Node("a",
- difs=[300, n1],
- dif_registrations={n1: [300]})
-
-b = Node("b",
- difs=[300, n1],
- dif_registrations={n1: [300]})
-
-c = Node("c",
- difs=[300, n1],
- dif_registrations={n1: [300]})
-
-tb = qemu.Testbed(exp_name = "star",
- bzimage = "/home/mcapitani/RINA/checkouts/rlite/demo/buildroot/bzImage",
- initramfs = "/home/mcapitani/RINA/checkouts/rlite/demo/buildroot/rootfs.cpio")
-
-exp = rl.Experiment(tb, nodes = [a, b, c, d])
-
-print(exp)
-
-exp.run()
diff --git a/examples/triangle.py b/examples/triangle.py
deleted file mode 100644
index 6be58a5..0000000
--- a/examples/triangle.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env/python
-
-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
-
-shim500 = ShimEthDIF("shim500", link_speed=30))
-shim400 = ShimEthDIF("shim400", link_speed=20))
-shim300 = ShimEthDIF("shim300", link_speed=10))
-
-n1 = NormalDIF("n1")
-
-a = Node("a",
- difs=[300, 500, n1],
- dif_registrations={n1: [300, 500]})
-
-b = Node("b",
- difs=[300, 400, n1],
- dif_registrations={n1: [300, 400]})
-
-c = Node("c",
- difs=[400, 500, n1],
- dif_registrations={n1: [400, 500]})
-
-tb = qemu.Testbed(exp_name = "triangle",
- bzimage = "/home/mcapitani/RINA/checkouts/rlite/demo/buildroot/bzImage",
- initramfs = "/home/mcapitani/RINA/checkouts/rlite/demo/buildroot/rootfs.cpio")
-
-exp = rl.Experiment(tb, nodes = [a, b, c, d])
-
-print(exp)
-
-exp.run()
diff --git a/examples/two-layers.py b/examples/two-layers.py
index 687c99f..9032588 100755
--- a/examples/two-layers.py
+++ b/examples/two-layers.py
@@ -43,7 +43,8 @@ d = Node("d",
dif_registrations = {n3: [n2], n2 : [e3]})
tb = qemu.Testbed(exp_name = "twolayers",
- username = "vmaffione",
+ username = "root",
+ password = "root",
bzimage = '/home/vmaffione/git/rlite/demo/buildroot/bzImage',
initramfs = '/home/vmaffione/git/rlite/demo/buildroot/rootfs.cpio')
diff --git a/rumba/model.py b/rumba/model.py
index faf353c..c2c4cfa 100644
--- a/rumba/model.py
+++ b/rumba/model.py
@@ -125,6 +125,13 @@ class NormalDIF(DIF):
s += "\n Component %s has policy %s" % (comp, pol)
return s
+# SSH Configuration
+#
+class SSHConfig:
+ def __init__(self, hostname, port=22):
+ self.hostname = hostname
+ self.port = port
+
# A node in the experiment
#
# @difs: DIFs the node will have an IPCP in
@@ -150,7 +157,7 @@ class Node:
if bindings is None:
bindings = dict()
self.bindings = bindings
- self.full_name = name
+ self.ssh_config = SSHConfig(name)
self.ipcps = []
self._validate()
@@ -310,105 +317,6 @@ class Experiment:
# Generate missing information
self.generate()
- @staticmethod
- def from_config_file(testbed, filename='demo.conf'):
- """
- :type testbed: Testbed
- :rtype: Experiment
- :param testbed: the testbed for the experiment
- :param filename: name of the .conf file
- :return: an Experiment object
- """
-
- shims = {}
- nodes = {}
- difs = {}
- with open(filename, 'r') as conf:
-
- line_cnt = 0
-
- while 1:
- line = conf.readline()
- if line == '':
- break
- line_cnt += 1
-
- line = line.replace('\n', '').strip()
-
- if line.startswith('#') or line == "":
- continue
-
- m = re.match(r'\s*eth\s+([\w-]+)\s+(\d+)([GMK])bps\s+(\w.*)$', line)
- if m:
- shim = m.group(1)
- speed = int(m.group(2))
- speed_unit = m.group(3).lower()
- vm_list = m.group(4).split()
-
- if shim in shims or shim in difs:
- print('Error: Line %d: shim %s already defined'
- % (line_cnt, shim))
- continue
-
- if speed_unit == 'K':
- speed = speed // 1000
- if speed_unit == 'G':
- speed = speed * 1000
-
- shims[shim] = {'name': shim, 'speed': speed, 'type': 'eth'}
-
- for vm in vm_list:
- nodes.setdefault(vm, {'name': vm, 'difs': [], 'dif_registrations': {}, 'registrations': {}})
- nodes[vm]['difs'].append(shim)
- continue
-
- m = re.match(r'\s*dif\s+([\w-]+)\s+([\w-]+)\s+(\w.*)$', line)
- if m:
- dif = m.group(1)
- vm = m.group(2)
- dif_list = m.group(3).split()
-
- if dif in shims:
- print('Error: Line %d: dif %s already defined as shim'
- % (line_cnt, dif))
- continue
-
- difs.setdefault(dif, {'name': dif}) # Other dict contents might be policies.
-
- if vm in nodes and dif in nodes[vm]['dif_registrations']:
- print('Error: Line %d: vm %s in dif %s already specified'
- % (line_cnt, vm, dif))
- continue
-
- nodes.setdefault(vm, {'name': vm, 'difs': [], 'dif_registrations': {}, 'registrations': {}})
- nodes[vm]['difs'].append(dif)
- nodes[vm]['dif_registrations'][dif] = dif_list # It is not defined yet, per check above.
-
- continue
-
- # No match, spit a warning
- print('Warning: Line %d unrecognized and ignored' % line_cnt)
-
- # File parsed
-
- parsed_difs = {}
-
- for shim_name, shim in shims.items():
- parsed_difs[shim_name] = (ShimEthDIF(shim_name, link_speed=shim['speed']))
-
- for dif_name, dif in difs.items():
- parsed_difs[dif_name] = (NormalDIF(dif_name))
-
- parsed_nodes = []
- for node, node_data in nodes.items():
- name = node_data['name']
- difs = [parsed_difs[x] for x in node_data['difs']]
- dif_registrations = {parsed_difs[x]: [parsed_difs[y] for y in l]
- for x, l in node_data['dif_registrations'].items()}
- parsed_nodes.append(Node(name, difs, dif_registrations))
-
- return Experiment(testbed=testbed, nodes=parsed_nodes)
-
def __repr__(self):
s = ""
for n in self.nodes:
@@ -624,4 +532,3 @@ class Experiment:
finally:
# No matter what happens, undo the testbed (testbed-specific)
self.testbed.swap_out(self)
-
diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py
index 37a6fbe..e8766da 100644
--- a/rumba/prototypes/irati.py
+++ b/rumba/prototypes/irati.py
@@ -38,7 +38,7 @@ class Experiment(mod.Experiment):
cmds.append("sudo nohup ipcm &> ipcm.log &")
for node in self.nodes:
- ssh.execute_commands(self.testbed, node.full_name,
+ ssh.execute_commands(self.testbed, node.ssh_config,
cmds, time_out=None)
def run_prototype(self):
diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py
index 00fdb6b..4fdacd6 100644
--- a/rumba/prototypes/ouroboros.py
+++ b/rumba/prototypes/ouroboros.py
@@ -37,7 +37,7 @@ class Experiment(mod.Experiment):
cmds.append("sudo nohup irmd > /dev/null &")
for node in self.nodes:
- ssh.execute_commands(self.testbed, node.full_name,
+ ssh.execute_commands(self.testbed, node.ssh_config,
cmds, time_out=None)
return
@@ -47,7 +47,7 @@ class Experiment(mod.Experiment):
for name, ap in node.bindings.items():
cmds.append("irm b ap " + ap + " n " + name)
- ssh.execute_commands(self.testbed, node.full_name,
+ ssh.execute_commands(self.testbed, node.ssh_config,
cmds, time_out = None)
def reg_names(self):
@@ -59,7 +59,7 @@ class Experiment(mod.Experiment):
cmd += " dif " + dif.name
cmds.append(cmd)
- ssh.execute_commands(self.testbed, node.full_name, cmds,
+ ssh.execute_commands(self.testbed, node.ssh_config, cmds,
time_out = None)
def create_ipcps(self):
@@ -104,7 +104,7 @@ class Experiment(mod.Experiment):
for cmd in cmds2:
cmds.append(cmd)
- ssh.execute_commands(self.testbed, node.full_name, cmds,
+ ssh.execute_commands(self.testbed, node.ssh_config, cmds,
time_out = None)
def enroll_ipcps(self):
@@ -127,7 +127,7 @@ class Experiment(mod.Experiment):
cmds.append(cmd)
ssh.execute_commands(self.testbed,
- e['enrollee'].full_name,
+ e['enrollee'].ssh_config,
cmds, time_out = None)
time.sleep(2)
diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py
index f4ff825..0ff680d 100644
--- a/rumba/prototypes/rlite.py
+++ b/rumba/prototypes/rlite.py
@@ -30,22 +30,27 @@ class Experiment(mod.Experiment):
def setup(self):
cmds = list()
- cmds.append("sudo apt-get update")
- cmds.append("sudo apt-get install g++ gcc cmake "
- "linux-headers-$(uname -r) "
- "protobuf-compiler libprotobuf-dev git --yes")
- cmds.append("sudo rm -rf ~/rlite")
- cmds.append("cd ~; git clone https://github.com/vmaffione/rlite")
- cmds.append("cd ~/rlite && ./configure && make && sudo make install")
- cmds.append("sudo nohup rlite-uipcps -v DBG -k 0 -U -A &> uipcp.log &")
+ if False: # ubuntu
+ cmds.append("apt-get update")
+ cmds.append("apt-get install g++ gcc cmake "
+ "linux-headers-$(uname -r) "
+ "protobuf-compiler libprotobuf-dev git --yes")
+ cmds.append("rm -rf ~/rlite")
+ cmds.append("cd ~; git clone https://github.com/vmaffione/rlite")
+ cmds.append("cd ~/rlite && ./configure && make && sudo make install")
+ cmds.append("modprobe rlite")
+ cmds.append("modprobe rlite-normal")
+ cmds.append("modprobe rlite-shim-eth")
+ cmds.append("modprobe rlite-shim-udp4")
+ cmds.append("modprobe rlite-shim-loopback")
+ cmds.append("nohup rlite-uipcps -v DBG -k 0 -U -A &> uipcp.log &")
for node in self.nodes:
- ssh.execute_commands(self.testbed, node.full_name,
+ ssh.execute_commands(self.testbed, node.ssh_config,
cmds, time_out=None)
def run_prototype(self):
print("[RLITE experiment] start")
print("Setting up rlite on the nodes...")
self.setup()
- time.sleep(20)
print("[RLITE experiment] end")
diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py
index 13ac1c6..eb32641 100644
--- a/rumba/ssh_support.py
+++ b/rumba/ssh_support.py
@@ -27,14 +27,14 @@ def get_ssh_client():
return ssh_client
-def execute_commands(testbed, hostname, commands, time_out=3):
+def execute_commands(testbed, ssh_config, commands, time_out=3):
'''
Remote execution of a list of shell command on hostname. By
default this function will exit (timeout) after 3 seconds.
@param testbed: testbed info
- @param hostname: host name or ip address of the node
- @param command: *nix shell command
+ @param ssh_config: ssh config of the node
+ @param commands: *nix shell command
@param time_out: time_out value in seconds, error will be generated if
no result received in given number of seconds, the value None can
be used when no timeout is needed
@@ -42,7 +42,9 @@ def execute_commands(testbed, hostname, commands, time_out=3):
ssh_client = get_ssh_client()
try:
- ssh_client.connect(hostname, 22,
+ #print("Connecting to %s@%s:%s (pwd=%s)" % (testbed.username,
+ # ssh_config.hostname, ssh_config.port, testbed.password))
+ ssh_client.connect(ssh_config.hostname, ssh_config.port,
testbed.username, testbed.password,
look_for_keys=True, timeout=time_out)
for command in commands:
@@ -59,13 +61,13 @@ def execute_commands(testbed, hostname, commands, time_out=3):
print(str(e))
return
-def execute_command(testbed, hostname, command, time_out=3):
+def execute_command(testbed, ssh_config, command, time_out=3):
'''
Remote execution of a list of shell command on hostname. By
default this function will exit (timeout) after 3 seconds.
@param testbed: testbed info
- @param hostname: host name or ip address of the node
+ @param ssh_config: ssh config of the node
@param command: *nix shell command
@param time_out: time_out value in seconds, error will be generated if
no result received in given number of seconds, the value None can
@@ -76,7 +78,7 @@ def execute_command(testbed, hostname, command, time_out=3):
ssh_client = get_ssh_client()
try:
- ssh_client.connect(hostname, 22,
+ ssh_client.connect(ssh_config.hostname, ssh_config.port,
testbed.username, testbed.password,
look_for_keys=True, timeout=time_out)
stdin, stdout, stderr = ssh_client.exec_command(command)
@@ -93,20 +95,20 @@ def execute_command(testbed, hostname, command, time_out=3):
print(str(e))
return
-def copy_file_to_testbed(testbed, hostname, text, file_name):
+def copy_file_to_testbed(testbed, ssh_config, text, file_name):
'''
Write a string to a given remote file.
Overwrite the complete file if it already exists!
@param testbed: testbed info
- @param hostname: host name or ip address of the node
+ @param ssh_config: ssh config of the node
@param text: string to be written in file
@param file_name: file name (including full path) on the host
'''
ssh_client = get_ssh_client()
try:
- ssh_client.connect(hostname, 22,
+ ssh_client.connect(ssh_config.hostname, ssh_config.port,
testbed.username,
testbed.password,
look_for_keys=True)
@@ -140,19 +142,20 @@ def setup_vlan(testbed, node, vlan_id, int_name):
'''
print("Setting up VLAN on node " + node.name)
+ cmds = list()
cmd = "sudo ip link add link " + \
str(int_name) + \
" name " + str(int_name) + \
"." + str(vlan_id) + \
" type vlan id " + str(vlan_id)
- execute_command(testbed, node.full_name, cmd)
+ cmds.append(cmd)
cmd = "sudo ifconfig " + \
str(int_name) + "." + \
str(vlan_id) + " up"
- execute_command(node.full_name, cmd, testbed)
+ cmds.append(cmd)
cmd = "sudo ethtool -K " + \
str(int_name) + " rxvlan off"
- execute_command(node.full_name, cmd, testbed)
+ cmds.append(cmd)
cmd = "sudo ethtool -K " + \
str(int_name) + " txvlan off"
- execute_command(node.full_name, cmd, testbed)
+ execute_commands(testbed, node.ssh_config, cmds)
diff --git a/rumba/testbeds/emulab.py b/rumba/testbeds/emulab.py
index c4dbe36..aee438e 100644
--- a/rumba/testbeds/emulab.py
+++ b/rumba/testbeds/emulab.py
@@ -43,6 +43,7 @@ class Testbed(mod.Testbed):
self.url = url
self.image = image
self.ip = dict()
+ self.ops_ssh_config = mod.SSHConfig(self.ops_server())
def ops_server(self):
'''
@@ -76,7 +77,7 @@ class Testbed(mod.Testbed):
@return: list of created experiments (strings)
'''
cmd = '/usr/testbed/bin/sslxmlrpc_client.py -m experiment getlist'
- out = ssh.execute_command(self, self.ops_server(), cmd)
+ out = ssh.execute_command(self, self.ops_ssh_config, cmd)
try:
if project_name != None:
@@ -98,7 +99,7 @@ class Testbed(mod.Testbed):
self.exp_name + \
' direction=in'
- output = ssh.execute_command(self, self.ops_server(), cmd)
+ output = ssh.execute_command(self, self.ops_ssh_config, cmd)
return output
@@ -131,8 +132,8 @@ class Testbed(mod.Testbed):
'" exp="' + exp_name + '" noswapin=true ' + \
'nsfilepath="' + dest_file_name + '"'
- ssh.execute_command(self, self.ops_server(), cmd, time_out=None)
- ssh.execute_command(self, self.ops_server(), 'rm ' + dest_file_name)
+ ssh.execute_command(self, self.ops_ssh_config, cmd, time_out=None)
+ ssh.execute_command(self, self.ops_ssh_config, 'rm ' + dest_file_name)
print("New experiment succesfully created.")
def generate_ns_script(self, experiment):
@@ -182,12 +183,12 @@ class Testbed(mod.Testbed):
self.exp_name + \
' -a | grep State | cut -f2,2 -d " "'
- res = ssh.execute_command(self, self.ops_server(), cmd)
+ res = ssh.execute_command(self, self.ops_ssh_config, cmd)
active = False
if res == "active":
active = True
while active != True:
- res = ssh.execute_command(self, self.ops_server(), cmd)
+ res = ssh.execute_command(self, self.ops_ssh_config, cmd)
if res == "active":
active = True
print("Still waiting")
@@ -201,9 +202,11 @@ class Testbed(mod.Testbed):
@param experiment: the experiment
'''
- node_full_name = self.full_name(experiment.nodes[0].name)
+ for node in experiment.nodes:
+ node.ssh_config.hostname = self.full_name(experiment.nodes[0].name)
+
cmd = 'cat /var/emulab/boot/topomap'
- topomap = ssh.execute_command(self, node_full_name, cmd)
+ topomap = ssh.execute_command(self, experiment.nodes[0].ssh_config, cmd)
# Almost as ugly as yo momma
index = topomap.rfind("# lans")
topo_array = topomap[:index].split('\\n')[1:-1]
@@ -224,8 +227,7 @@ class Testbed(mod.Testbed):
for node in experiment.nodes:
cmd = 'cat /var/emulab/boot/ifmap'
- node_full_name = self.full_name(node.name)
- output = ssh.execute_command(self, node_full_name, cmd)
+ output = ssh.execute_command(self, node.ssh_config, cmd)
output = re.split('\\\\n', output)
for item in output:
item = item.split()
@@ -233,7 +235,6 @@ class Testbed(mod.Testbed):
if isinstance(ipcp, mod.ShimEthIPCP):
if self.ip[ipcp] == item[1]:
ipcp.ifname = item[0]
- node.full_name = self.full_name(node.name)
def swap_in(self, experiment):
self._create_experiment(experiment)
diff --git a/rumba/testbeds/jfed.py b/rumba/testbeds/jfed.py
index f56e5ba..0dfc904 100644
--- a/rumba/testbeds/jfed.py
+++ b/rumba/testbeds/jfed.py
@@ -111,8 +111,8 @@ class Testbed(mod.Testbed):
for node in experiment.nodes:
auth_name_r = self.auth_name.replace(".", "-")
- node.full_name = node.name + "." + self.exp_name + "." + \
- auth_name_r + "." + self.auth_name
+ node.ssh_config.hostname = node.name + "." + self.exp_name + "." + \
+ auth_name_r + "." + self.auth_name
subprocess.call(["java", "-jar", self.jfed_jar, "create", "-S", \
self.proj_name, "--rspec", \
diff --git a/rumba/testbeds/qemu.py b/rumba/testbeds/qemu.py
index 1c5d486..3573554 100644
--- a/rumba/testbeds/qemu.py
+++ b/rumba/testbeds/qemu.py
@@ -157,21 +157,23 @@ class Testbed(mod.Testbed):
boot_batch_size = max(1, multiprocessing.cpu_count() // 2)
booting_budget = boot_batch_size
- boot_backoff = 12
+ boot_backoff = 12 # in seconds
base_port = 2222
- vm_memory = 164
+ vm_memory = 164 # in megabytes
vm_frontend = 'virtio-net-pci'
vmid = 1
for node in experiment.nodes:
- name = node.full_name
+ name = node.name
vm = self.vms.setdefault(name, {'vm': node, 'ports': []})
fwdp = base_port + vmid
fwdc = fwdp + 10000
mac = '00:0a:0a:0a:%02x:%02x' % (vmid, 99)
vm['ssh'] = fwdp
vm['id'] = vmid
+ node.ssh_config.hostname = "localhost"
+ node.ssh_config.port = fwdp
vars_dict = {'fwdp': fwdp, 'id': vmid, 'mac': mac,
'bzimage': self.bzimage,
@@ -218,7 +220,7 @@ class Testbed(mod.Testbed):
booting_budget -= 1
if booting_budget <= 0:
- print('Sleeping for %s seconds to give the machines time to boot up.' % boot_backoff)
+ print('Sleeping %s secs waiting for the VMs to boot' % boot_backoff)
time.sleep(boot_backoff)
booting_budget = boot_batch_size
@@ -229,6 +231,14 @@ class Testbed(mod.Testbed):
vmid += 1
+ # Wait for the last batch of VMs to start
+ if booting_budget < boot_backoff:
+ tsleep = boot_backoff * (boot_batch_size - booting_budget) / \
+ boot_batch_size
+ print('Sleeping %s secs waiting for the last VMs to boot' % tsleep)
+ time.sleep(tsleep)
+
+
def swap_out(self, experiment):
"""
:rtype str
diff --git a/tools/democonf2rumba.py b/tools/democonf2rumba.py
index 9a30174..549c540 100755
--- a/tools/democonf2rumba.py
+++ b/tools/democonf2rumba.py
@@ -3,23 +3,26 @@
import argparse
import re
+import rumba.model as mod
-def make_experiment(filename, bzImage, initramfs):
+
+def make_experiment(filename, experiment_class, experiment_kwargs,
+ testbed_class, testbed_kwargs):
"""
:type filename str
- :param filename: path to the .conf file
- :param bzImage: path to the bzImage file
- :param initramfs: path to the rootfs.cpio file
- :return:
+ :param filename: path to the .conf file
+ :param experiment_class: subclass of mod.Experiment
+ :param experiment_kwargs: args dict for experiment constructor
+ (nodes will be overwritten)
+ :param testbed_class: subclass of mod.Testbed
+ :param testbed_kwargs: args dict for experiment constructor
+ (nodes will be overwritten)
"""
-
shims = {}
nodes = {}
difs = {}
- ex_name = filename.split('/')[-1].split('.')[0]
-
- print('Reading file %s, under project name %s.' % (filename, ex_name))
+ print('Reading file %s.' % (filename,))
with open(filename, 'r') as conf:
@@ -53,9 +56,9 @@ def make_experiment(filename, bzImage, initramfs):
if speed_unit == 'G':
speed = speed * 1000
- shims['shim' + shim] = {'name': 'shim' + shim,
- 'speed': speed,
- 'type': 'eth'}
+ shims[shim] = {'name': shim,
+ 'speed': speed,
+ 'type': 'eth'}
for vm in vm_list:
nodes.setdefault(vm, {'name': vm, 'difs': [],
@@ -98,60 +101,30 @@ def make_experiment(filename, bzImage, initramfs):
# File parsed
- output = '#!/usr/bin/env/python\n\n'
- output += (
- "from rumba.model import *\n\n"
-
- "# import testbed plugins\n"
- "import rumba.testbeds.emulab as emulab\n"
- "import rumba.testbeds.jfed as jfed\n"
- "import rumba.testbeds.faketestbed as fake\n"
- "import rumba.testbeds.qemu as qemu\n\n"
-
- "# import prototype plugins\n"
- "import rumba.prototypes.ouroboros as our\n"
- "import rumba.prototypes.rlite as rl\n"
- "import rumba.prototypes.irati as irati\n\n"
- )
+ parsed_difs = {}
for shim_name, shim in shims.items():
- output += '%(n)s = ShimEthDIF("%(n)s", link_speed=%(speed)s))\n' \
- % {'n': shim_name, 'speed': shim["speed"]}
-
- output += '\n'
+ parsed_difs[shim_name] = (mod.ShimEthDIF(shim_name,
+ link_speed=shim['speed']))
for dif_name, dif in difs.items():
- output += '%(n)s = NormalDIF("%(n)s")\n' % {'n': dif_name}
+ parsed_difs[dif_name] = (mod.NormalDIF(dif_name))
- output += '\n'
+ parsed_nodes = []
+ for node, node_data in nodes.items():
+ name = node_data['name']
+ difs = [parsed_difs[x] for x in node_data['difs']]
+ dif_registrations = {parsed_difs[x]: [parsed_difs[y] for y in l]
+ for x, l in node_data['dif_registrations']
+ .items()}
+ parsed_nodes.append(mod.Node(name, difs, dif_registrations))
- def str_of_list(i):
- return '[' + ', '.join(i) + ']'
+ testbed = testbed_class(**testbed_kwargs)
- def str_of_dict(d):
- return '{' + ', '.join(['%s: %s' % (k, str_of_list(v))
- for (k, v) in d.items()]) + '}'
+ experiment_kwargs['testbed'] = testbed
+ experiment_kwargs['nodes'] = parsed_nodes
- for node, node_data in nodes.items():
- name = node_data['name']
- output += '%(n)s = Node("%(n)s",\n' % {'n': name}
- output += ' difs=%s,\n' \
- % (str_of_list(node_data['difs']))
- output += ' dif_registrations=%s)\n\n' \
- % (str_of_dict(node_data['dif_registrations']))
-
- output += ('tb = qemu.Testbed(exp_name = "%(ex_name)s",\n'
- ' bzimage = "%(bzImage)s",\n'
- ' initramfs = "%(initramfs)s")\n\n'
- 'exp = rl.Experiment(tb, nodes = [a, b, c, d])\n\n'
- 'print(exp)\n\n'
- 'exp.run()\n'
- % {'ex_name': ex_name,
- 'bzImage': bzImage,
- 'initramfs': initramfs})
-
- with open(ex_name + '.py', 'w') as out_file:
- out_file.write(output)
+ return experiment_class(**experiment_kwargs).run()
if __name__ == '__main__':
@@ -160,17 +133,115 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser(description=description,
epilog=epilog)
- parser.add_argument('config', metavar='CONFIG', type=str,
+
+ prototype = parser.add_mutually_exclusive_group(required=True)
+ prototype.add_argument('--irati', action='store_true', default=False)
+ prototype.add_argument('--ouroboros', action='store_true', default=False)
+ prototype.add_argument('--rlite', action='store_true', default=False)
+
+ parser.add_argument('--config', metavar='CONFIG', type=str,
+ required=True,
help='Path to the config file to parse')
- parser.add_argument('bz_image', metavar='BZIMAGE', type=str,
+
+ subparsers = parser.add_subparsers(dest='testbed')
+ emulab_p = subparsers.add_parser('emulab', help='Use emulab testbed')
+ jfed_p = subparsers.add_parser('jfed', help='Use jfed testbed')
+ qemu_p = subparsers.add_parser('qemu', help='Use qemu testbed')
+ fake_p = subparsers.add_parser('fake', help='Use fake testbed')
+
+ def setup_testbed_common_args(t_p):
+
+ t_p.add_argument('-E', '--exp_name', metavar='EXP_NAME', type=str,
+ required=True,
+ help='Experiment name')
+ t_p.add_argument('-U', '--username', metavar='USERNAME', type=str,
+ required=True,
+ help='Testbed user name')
+ t_p.add_argument('-P', '--proj_name', metavar='PROJECT_NAME', type=str,
+ help='Project name')
+ t_p.add_argument('-W', '--password', metavar='PASSWORD', type=str,
+ help='Testbed password')
+
+ for t in [emulab_p, jfed_p, qemu_p, fake_p]:
+ setup_testbed_common_args(t)
+
+ qemu_p.add_argument('-B', '--bzimage', metavar='BZIMAGE', type=str,
+ required=True,
help='path to the bzImage file to use')
- parser.add_argument('initramfs', metavar='INITRAMFS', type=str,
+ qemu_p.add_argument('-I', '--initramfs', metavar='INITRAMFS', type=str,
+ required=True,
help='path to the initramfs file to use')
+ qemu_p.add_argument('-V', '--use_vhost', action='store_true',
+ default=False, help='Use vhost')
+ qemu_p.add_argument('-Q', '--qemu_logs_dir', metavar='QEMU_LOGS', type=str,
+ default=None, help='path to the folder for qemu logs')
+
+ emulab_p.add_argument('-R', '--url', metavar='URL', type=str,
+ default="wall2.ilabt.iminds.be",
+ help='Url')
+ emulab_p.add_argument('-I', '--image', metavar='IMG', type=str,
+ default="UBUNTU14-64-STD",
+ help='Ubuntu image')
+
+ jfed_p.add_argument('-C', '--cert_file', metavar='CERT', type=str,
+ required=True,
+ help='Certificate file')
+ jfed_p.add_argument('-J', '--jar', metavar='JAR', type=str,
+ required=True,
+ help='Jfed jar')
+ jfed_p.add_argument('-H', '--exp_hours', metavar='HOURS', type=int,
+ default=2, help='Experiment hours')
+ jfed_p.add_argument('-A', '--authority', metavar='AUTH', type=str,
+ default="wall2.ilabt.iminds.be",
+ help='Authority')
args = parser.parse_args()
+ if args.testbed == 'emulab':
+ import rumba.testbeds.emulab as emulab
+ test_class = emulab.Testbed
+ testbed_args = {a.dest: getattr(args, a.dest)
+ for a in emulab_p._actions if a.dest != 'help'}
+ elif args.testbed == 'jfed':
+ import rumba.testbeds.jfed as jfed
+ test_class = jfed.Testbed
+ testbed_args = {a.dest: getattr(args, a.dest)
+ for a in jfed_p._actions if a.dest != 'help'}
+ elif args.testbed == 'qemu':
+ import rumba.testbeds.qemu as qemu
+ test_class = qemu.Testbed
+ testbed_args = {a.dest: getattr(args, a.dest)
+ for a in qemu_p._actions if a.dest != 'help'}
+ elif args.testbed == 'fake':
+ import rumba.testbeds.faketestbed as fake
+ test_class = fake.Testbed
+ testbed_args = {a.dest: getattr(args, a.dest)
+ for a in fake_p._actions if a.dest != 'help'}
+ else:
+ if args.testbed is None:
+ print('Testbed type must be specified!')
+ print(parser.format_help())
+ exit(1)
+ raise ValueError('Unexpected testbed: %s.' % args.testbed)
+
+ if args.irati:
+ import rumba.prototypes.irati as irati
+ exp_class = irati.Experiment
+ elif args.ouroboros:
+ import rumba.prototypes.ouroboros as ouroboros
+ exp_class = ouroboros.Experiment
+ elif args.rlite:
+ import rumba.prototypes.rlite as rlite
+ exp_class = rlite.Experiment
+ else:
+ raise ValueError('Unexpected prototype: %s.' % args.testbed)
+
try:
- make_experiment(args.config, args.bz_image, args.initramfs)
+ make_experiment(args.config,
+ experiment_class=exp_class,
+ experiment_kwargs={},
+ testbed_class=test_class,
+ testbed_kwargs=testbed_args)
except KeyboardInterrupt:
print("Interrupted. Closing down.")