aboutsummaryrefslogtreecommitdiff
path: root/examples/test.py
blob: e17670a773c6014ac3efe9db241755b4641e0e78 (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
53
54
55
56
57
#!/usr/bin/env python

# An example script using the rumba package

from rumba.model import *
from rumba.utils import ExperimentManager
from rumba.storyboard import *


# import testbed plugins
import rumba.testbeds.jfed as jfed

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

import rumba.log as log

log.set_logging_level('DEBUG')


n1 = UnicastLayer("n1")
e1 = EthDixLayer("e1")
e2 = EthDixLayer("e2")

clientNode = Node("client",
         layers = [e1, n1],
         registrations = {n1 : [e1]})

routerNode = Node("router",
         layers = [e1, e2, n1],
         registrations = {n1 : [e1, e2]})

serverNode = Node("server",
         layers = [e2, n1],
         registrations = {n1 : [e2]})

tb = jfed.Testbed(exp_name = 'example',
                  cert_file = '/path/to/cert.pem',
                  authority = 'wall1.ilabt.iminds.be',
                  username = 'username',
                  exp_hours = '5',
                  proj_name='ouroboros')

exp = our.Experiment(tb, nodes=[clientNode, routerNode, serverNode],
                     git_repo="https://codeberg.org/o7s/ouroboros",
                     git_branch="be-fix")

with ExperimentManager(exp, swap_out_strategy=PAUSE_SWAPOUT):
    exp.swap_in()
    exp.install_prototype()
    exp.bootstrap_prototype()
    sb = StoryBoard(experiment=exp, duration=15, servers=[])
    sb.schedule_command(7.5, clientNode,
                        'echo "7.5 secs in. We are at $(hostname)"')
    sb.schedule_command(12, serverNode,
                        'echo "12 secs in. We are at $(hostname)"')
    sb.start()