diff options
author | Marco Capitani <m.capitani@nextworks.it> | 2017-09-26 16:45:39 +0200 |
---|---|---|
committer | Marco Capitani <m.capitani@nextworks.it> | 2017-09-26 16:45:39 +0200 |
commit | bf416fb66f0daa93fcbf8111d392cb3d1b119601 (patch) | |
tree | cae1be12426491d04ad459579856bba3c3986295 | |
parent | 23e32cf4593cdefe05f8c092604836a6c07917da (diff) | |
parent | 257ac48837755f2d48e2b99e9462da9fa17c05d7 (diff) | |
download | rumba-bf416fb66f0daa93fcbf8111d392cb3d1b119601.tar.gz rumba-bf416fb66f0daa93fcbf8111d392cb3d1b119601.zip |
Merge branch 'master' into README-dep-qemu
-rwxr-xr-x | examples/snake.py | 69 | ||||
-rw-r--r-- | rumba/ssh_support.py | 2 |
2 files changed, 70 insertions, 1 deletions
diff --git a/examples/snake.py b/examples/snake.py new file mode 100755 index 0000000..c6b67b3 --- /dev/null +++ b/examples/snake.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python + +# An example script using the rumba package + +from rumba.model import * + +# import testbed plugins +import rumba.testbeds.emulab as emulab +import rumba.testbeds.jfed as jfed +import rumba.testbeds.faketestbed as fake +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 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 = NormalDIF("n01") + +if (args.nodes < 2): + print("Snake must be longer than 2 nodes") + sys.exit(-1) + +nodes = [] + +shim_prev = None +for i in range(0, args.nodes): + if i is not (args.nodes - 1): + shim = ShimEthDIF("e" + str(i)) + else: + shim = None + + if shim_prev == None and shim != None: + node = Node("node" + str(i), difs = [n01, shim], + dif_registrations = {n01 : [shim]}) + elif shim_prev != None and shim != None: + node = Node("node" + str(i), difs = [n01, shim, shim_prev], + dif_registrations = {n01 : [shim, shim_prev]}) + else: + node = Node("node" + str(i), difs = [n01, shim_prev], + dif_registrations = {n01 : [shim_prev]}) + + shim_prev = shim + nodes.append(node) + +tb = qemu.Testbed(exp_name = "snake") + +exp = rl.Experiment(tb, nodes = nodes) + +print(exp) + +try: + exp.swap_in() + exp.bootstrap_prototype() +finally: + exp.swap_out() diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py index 23e1e49..8ceee55 100644 --- a/rumba/ssh_support.py +++ b/rumba/ssh_support.py @@ -60,7 +60,7 @@ def _print_stream(stream): def ssh_connect(ssh_client, hostname, port, username, password, time_out, proxy): retry = 0 - max_retries = 12 + max_retries = 10 while retry < max_retries: time.sleep(retry * 5) try: |