diff options
Diffstat (limited to 'examples/mouse.py')
| -rwxr-xr-x | examples/mouse.py | 109 |
1 files changed, 54 insertions, 55 deletions
diff --git a/examples/mouse.py b/examples/mouse.py index d80da28..38be6e0 100755 --- a/examples/mouse.py +++ b/examples/mouse.py @@ -3,107 +3,106 @@ # An example script using the rumba package from rumba.model import * -from rumba.utils import ExperimentManager +from rumba.utils import ExperimentManager, PROMPT_SWAPOUT # import testbed plugins -import rumba.testbeds.emulab as emulab -import rumba.testbeds.jfed as jfed import rumba.testbeds.local as local -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 import rumba.log as log +from rumba.visualizer import draw_network, get_network_from_rumba_experiment + log.set_logging_level('DEBUG') -n01 = NormalDIF("n01") +n01 = UnicastLayer("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") +e01 = EthDixLayer("e01") +e02 = EthDixLayer("e02") +e03 = EthDixLayer("e03") +e04 = EthDixLayer("e04") +e05 = EthDixLayer("e05") +e06 = EthDixLayer("e06") +e07 = EthDixLayer("e07") +e08 = EthDixLayer("e08") +e09 = EthDixLayer("e09") +e10 = EthDixLayer("e10") +e11 = EthDixLayer("e11") +e12 = EthDixLayer("e12") +e13 = EthDixLayer("e13") +e14 = EthDixLayer("e14") +e15 = EthDixLayer("e15") +e16 = EthDixLayer("e16") +e17 = EthDixLayer("e17") a = Node("a", - difs = [n01, e01, e06, e13 ], - dif_registrations = {n01 : [e01, e06, e13]}) + layers = [n01, e01, e06, e13 ], + registrations = {n01 : [e01, e06, e13]}) b = Node("b", - difs = [n01, e01, e02, e04], - dif_registrations = {n01 : [e01, e02, e04]}) + layers = [n01, e01, e02, e04], + registrations = {n01 : [e01, e02, e04]}) c = Node("c", - difs = [n01, e02, e03], - dif_registrations = {n01 : [e02, e03]}) + layers = [n01, e02, e03], + registrations = {n01 : [e02, e03]}) d = Node("d", - difs = [n01, e03, e04, e05], - dif_registrations = {n01 : [e03, e04, e05]}) + layers = [n01, e03, e04, e05], + registrations = {n01 : [e03, e04, e05]}) e = Node("e", - difs = [n01, e05, e06, e07], - dif_registrations = {n01 : [e05, e06, e07]}) + layers = [n01, e05, e06, e07], + registrations = {n01 : [e05, e06, e07]}) f = Node("f", - difs = [n01, e07, e08], - dif_registrations = {n01 : [e07, e08]}) + layers = [n01, e07, e08], + registrations = {n01 : [e07, e08]}) g = Node("g", - difs = [n01, e08, e09, e14], - dif_registrations = {n01 : [e08, e09, e14]}) + layers = [n01, e08, e09, e14], + registrations = {n01 : [e08, e09, e14]}) h = Node("h", - difs = [n01, e09, e10, e15], - dif_registrations = {n01 : [e09, e10, e15]}) + layers = [n01, e09, e10, e15], + registrations = {n01 : [e09, e10, e15]}) i = Node("i", - difs = [n01, e10, e11, e16], - dif_registrations = {n01 : [e10, e11, e16]}) + layers = [n01, e10, e11, e16], + registrations = {n01 : [e10, e11, e16]}) j = Node("j", - difs = [n01, e11, e12], - dif_registrations = {n01 : [e11, e12]}) + layers = [n01, e11, e12], + registrations = {n01 : [e11, e12]}) k = Node("k", - difs = [n01, e12, e13], - dif_registrations = {n01 : [e12, e13]}) + layers = [n01, e12, e13], + registrations = {n01 : [e12, e13]}) l = Node("l", - difs = [n01, e14, e15], - dif_registrations = {n01 : [e14, e15]}) + layers = [n01, e14, e15], + registrations = {n01 : [e14, e15]}) m = Node("m", - difs = [n01, e16, e17], - dif_registrations = {n01 : [e16, e17]}) + layers = [n01, e16, e17], + registrations = {n01 : [e16, e17]}) n = Node("n", - difs = [n01, e17], - dif_registrations = {n01 : [e17]}) + layers = [n01, e17], + registrations = {n01 : [e17]}) -tb = qemu.Testbed(exp_name = "mouse2") +tb = local.Testbed(exp_name = "mouse2") -exp = rl.Experiment(tb, nodes = [a, b, c, d, e, f, g, h, i, j, k, l, m, n]) +exp = our.Experiment(tb, nodes = [a, b, c, d, e, f, g, h, i, j, k, l, m, n]) print(exp) -with ExperimentManager(exp): +with ExperimentManager(exp, swap_out_strategy=PROMPT_SWAPOUT): + nw = get_network_from_rumba_experiment(exp) + draw_network(nw) exp.swap_in() exp.bootstrap_prototype() |
