diff options
author | 2020-05-11 06:00:00 -0700 | |
---|---|---|
committer | 2020-05-12 05:50:41 +0000 | |
commit | 950cbadbcc2376acc44af5595c8f60b68fc26c5c (patch) | |
tree | fedf43f91827ababc788585fcf197755ae01c6ae /test/mocks/mass-pnf-sim/mass-pnf-sim.py | |
parent | c85faa46e105c7710bd89032c47ccad43b95d5c6 (diff) |
Get the routine name to call with getattr
Each subcommand has a corresponding method in
MassPnfSim class hence it can be called directly
by it's name.
Change-Id: Id7139a5f96cceac89559bd68d89085130703f4bd
Issue-ID: INT-1577
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'test/mocks/mass-pnf-sim/mass-pnf-sim.py')
-rwxr-xr-x | test/mocks/mass-pnf-sim/mass-pnf-sim.py | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/test/mocks/mass-pnf-sim/mass-pnf-sim.py b/test/mocks/mass-pnf-sim/mass-pnf-sim.py index 1a57cbe04..fe6062637 100755 --- a/test/mocks/mass-pnf-sim/mass-pnf-sim.py +++ b/test/mocks/mass-pnf-sim/mass-pnf-sim.py @@ -18,20 +18,7 @@ if __name__ == '__main__': MassPnfSim.log_lvl = log_lvl if args.subcommand is not None: - sim = MassPnfSim(args) - if args.subcommand == 'bootstrap' : - sim.bootstrap() - if args.subcommand == 'clean': - sim.clean() - if args.subcommand == 'start': - sim.start() - if args.subcommand == 'status': - sim.status() - if args.subcommand == 'stop': - sim.stop() - if args.subcommand == 'trigger': - sim.trigger() - if args.subcommand == 'trigger-custom': - sim.trigger_custom() + sim_routine = getattr(MassPnfSim(args), args.subcommand) + sim_routine() else: parser.print_usage() |