aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/mass-pnf-sim/mass-pnf-sim.py
blob: 1a57cbe04d6a5753fd3a89154da3ce560d04c455 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python3
import sys
import logging
from MassPnfSim import MassPnfSim, get_parser

if __name__ == '__main__':
    parser = get_parser()
    args = parser.parse_args()
    log_lvl = getattr(logging, args.verbose.upper())

    if sys.stdout.isatty():
        logging.basicConfig(level=logging.INFO, format='\033[92m[%(levelname)s]\033[0m %(message)s')
    else:
        logging.basicConfig(level=logging.INFO, format='[%(levelname)s] %(message)s')

    logger = logging.getLogger(__name__)
    logger.setLevel(log_lvl)
    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()
    else:
        parser.print_usage()