aboutsummaryrefslogtreecommitdiff
path: root/examples/square.py
blob: ce5cc419c97403c40c4730b91a9739da6297aaca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/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.local as local

# import prototype plugins
import rumba.prototypes.ouroboros as our

import rumba.log as log

log.set_logging_level('DEBUG')


n01 = UnicastLayer("n01")
n01.add_policy("routing", "ecmp")

e01 = EthDixLayer("e01")
e02 = EthDixLayer("e02")
e03 = EthDixLayer("e03")
e04 = EthDixLayer("e04")


a = Node("a",
         layers = [n01, e01, e02],
         registrations = {n01 : [e01, e02]})

b = Node("b",
         layers = [n01, e02, e03],
         registrations = {n01 : [e02, e03]})

c = Node("c",
         layers = [n01, e03, e04],
         registrations = {n01 : [e03, e04]})

d = Node("d",
         layers = [n01, e01, e04],
         registrations = {n01 : [e01, e04]})

tb = local.Testbed(exp_name = "square")

exp = our.Experiment(tb, nodes = [a, b, c, d])

print(exp)

with ExperimentManager(exp, swap_out_strategy=PROMPT_SWAPOUT):
    exp.swap_in()
    exp.bootstrap_prototype()