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

# An example script using the rumba package

from rumba.model import *
from rumba.utils import ExperimentManager
from rumba.topologies import build_ring

# import testbed plugins
import rumba.testbeds.dockertb as docker

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

import argparse
import sys


description = "Script to create an ouroboros"

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 < 3):
    print("The ouroboros must be longer than 2 nodes")
    sys.exit(-1)

nodes = build_ring(args.nodes, n01)

tb = docker.Testbed(exp_name = "ouroboros")

exp = our.Experiment(tb, nodes = nodes)

print(exp)

with ExperimentManager(exp):
    exp.swap_in()
    exp.bootstrap_prototype()