aboutsummaryrefslogtreecommitdiff
path: root/examples/snake.py
blob: ac5573fef1403f13e2522985a92ce422ea5e8f8b (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
#!/usr/bin/env python

# An example script using the rumba package

from rumba.model import *
from rumba.utils import *
from rumba.storyboard import *
from rumba.topologies import build_chain

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

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

import argparse
import sys


description = "Script to create a snake"

argparser = argparse.ArgumentParser(description = description)
argparser.add_argument('-n', '--nodes', type = int, default = '10',
                       help = "Total number of nodes")

args = argparser.parse_args()

log.set_logging_level('DEBUG')

n01 = UnicastLayer("n01")

if (args.nodes < 2):
    print("Snake must be longer than 2 nodes")
    sys.exit(-1)

nodes = build_chain(args.nodes, n01)

tb = jfed.Testbed(exp_name = "snake2",
                  cert_file = '/path/to/cert.pem',
                  authority = 'wall1.ilabt.iminds.be',
                  username = 'username',
                  exp_hours = '1',
                  proj_name='ouroborosrocks')

exp = our.Experiment(tb, nodes=nodes,
                     git_repo='https://codeberg.org/o7s/ouroboros',
                     git_branch='be',
                     build_options='-DCMAKE_BUILD_TYPE=Debug')

print(exp)

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