blob: 1a57cbe04d6a5753fd3a89154da3ce560d04c455 [file] [log] [blame]
TamasBakaid38feb62019-02-28 09:06:19 +00001#!/usr/bin/env python3
TamasBakaid38feb62019-02-28 09:06:19 +00002import sys
Bartek Grzybowski1f762342020-05-05 08:54:37 -07003import logging
Bartek Grzybowskic85faa42020-05-11 05:38:08 -07004from MassPnfSim import MassPnfSim, get_parser
TamasBakaid38feb62019-02-28 09:06:19 +00005
Bartek Grzybowski8feb3f52020-05-08 06:26:02 -07006if __name__ == '__main__':
7 parser = get_parser()
8 args = parser.parse_args()
Bartek Grzybowskifeb93cd2020-05-11 04:51:37 -07009 log_lvl = getattr(logging, args.verbose.upper())
Bartek Grzybowski6a09dd62020-05-08 04:39:22 -070010
Bartek Grzybowskic85faa42020-05-11 05:38:08 -070011 if sys.stdout.isatty():
12 logging.basicConfig(level=logging.INFO, format='\033[92m[%(levelname)s]\033[0m %(message)s')
13 else:
14 logging.basicConfig(level=logging.INFO, format='[%(levelname)s] %(message)s')
15
Bartek Grzybowski8feb3f52020-05-08 06:26:02 -070016 logger = logging.getLogger(__name__)
Bartek Grzybowskifeb93cd2020-05-11 04:51:37 -070017 logger.setLevel(log_lvl)
18 MassPnfSim.log_lvl = log_lvl
TamasBakaid38feb62019-02-28 09:06:19 +000019
Bartek Grzybowskifeb93cd2020-05-11 04:51:37 -070020 if args.subcommand is not None:
21 sim = MassPnfSim(args)
22 if args.subcommand == 'bootstrap' :
23 sim.bootstrap()
24 if args.subcommand == 'clean':
25 sim.clean()
26 if args.subcommand == 'start':
27 sim.start()
28 if args.subcommand == 'status':
29 sim.status()
30 if args.subcommand == 'stop':
31 sim.stop()
32 if args.subcommand == 'trigger':
33 sim.trigger()
34 if args.subcommand == 'trigger-custom':
35 sim.trigger_custom()
36 else:
Bartek Grzybowski8feb3f52020-05-08 06:26:02 -070037 parser.print_usage()