From a08e4f5ff3809eec923dbe9441bf433cef8b6dd4 Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Thu, 13 Apr 2017 09:45:51 +0200 Subject: Tester finishing touches: code cleanup and used choices. --- tools/democonf2rumba.py | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'tools') diff --git a/tools/democonf2rumba.py b/tools/democonf2rumba.py index 549c540..383268c 100755 --- a/tools/democonf2rumba.py +++ b/tools/democonf2rumba.py @@ -127,6 +127,20 @@ def make_experiment(filename, experiment_class, experiment_kwargs, return experiment_class(**experiment_kwargs).run() +def setup_testbed_common_args(t_p): + + t_p.add_argument('-E', '--exp_name', metavar='EXP_NAME', type=str, + required=True, + help='Experiment name') + t_p.add_argument('-U', '--username', metavar='USERNAME', type=str, + required=True, + help='Testbed user name') + t_p.add_argument('-P', '--proj_name', metavar='PROJECT_NAME', type=str, + help='Project name') + t_p.add_argument('-W', '--password', metavar='PASSWORD', type=str, + help='Testbed password') + + if __name__ == '__main__': description = "Demonstrator config file to rumba script converter" epilog = "2017 Marco Capitani " @@ -134,10 +148,10 @@ if __name__ == '__main__': parser = argparse.ArgumentParser(description=description, epilog=epilog) - prototype = parser.add_mutually_exclusive_group(required=True) - prototype.add_argument('--irati', action='store_true', default=False) - prototype.add_argument('--ouroboros', action='store_true', default=False) - prototype.add_argument('--rlite', action='store_true', default=False) + parser.add_argument('-P', '--prototype', type=str, required=True, + choices=['irati', 'ouroboros', 'rlite'], + help='The kind of prototype plugin to use to run' + ' the experiment.') parser.add_argument('--config', metavar='CONFIG', type=str, required=True, @@ -149,19 +163,6 @@ if __name__ == '__main__': qemu_p = subparsers.add_parser('qemu', help='Use qemu testbed') fake_p = subparsers.add_parser('fake', help='Use fake testbed') - def setup_testbed_common_args(t_p): - - t_p.add_argument('-E', '--exp_name', metavar='EXP_NAME', type=str, - required=True, - help='Experiment name') - t_p.add_argument('-U', '--username', metavar='USERNAME', type=str, - required=True, - help='Testbed user name') - t_p.add_argument('-P', '--proj_name', metavar='PROJECT_NAME', type=str, - help='Project name') - t_p.add_argument('-W', '--password', metavar='PASSWORD', type=str, - help='Testbed password') - for t in [emulab_p, jfed_p, qemu_p, fake_p]: setup_testbed_common_args(t) -- cgit v1.2.3