aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/mass-pnf-sim/mass-pnf-sim.py
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-05-11 06:00:00 -0700
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-05-12 05:50:41 +0000
commit950cbadbcc2376acc44af5595c8f60b68fc26c5c (patch)
treefedf43f91827ababc788585fcf197755ae01c6ae /test/mocks/mass-pnf-sim/mass-pnf-sim.py
parentc85faa46e105c7710bd89032c47ccad43b95d5c6 (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-xtest/mocks/mass-pnf-sim/mass-pnf-sim.py17
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()