-
Notifications
You must be signed in to change notification settings - Fork 21
/
run_message_simulation.py
executable file
·79 lines (53 loc) · 1.84 KB
/
run_message_simulation.py
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/python
# System Imports
import os, sys, json, inspect, uuid, argparse, datetime, logging, copy
from time import sleep
# Local Imports
from src.logger import Logger
from src.utils import *
from src.message_simulator import MessageSimulator
#####################################################################
#
# Start Arg Processing:
#
action = "Run Message Simulation"
parser = argparse.ArgumentParser(description="Parser for: " + str(action))
parser.add_argument('-f', '--simfile', required=True, dest='simfile', help='Run Test Simulation')
parser.add_argument('-d', '--debug', help='Debug Flag')
args = parser.parse_args()
path_to_test = "./NOTREAL"
debug = True
if args.simfile:
path_to_test = str(args.simfile)
if args.debug:
debug = True
#
# End Arg Processing
#
#####################################################################
if os.path.isfile(path_to_test) == False:
lg("\nERROR: Did not find Simulation File at Path(" + str(path_to_test) + ")\n", 0)
sys.exit(1)
else:
lg("", 6)
lg("Running Simulation(" + str(path_to_test) + ")", 5)
lg("", 6)
test_config = json.loads(open(path_to_test, "r").read())
exit_status = 1
summary_report = {}
debug = False
logger = None
logger = Logger("RSM", "/dev/log", logging.DEBUG)
server = MessageSimulator(test_config, logger, debug)
not_done = True
while not_done:
still_processing = server.run_states()
if still_processing:
not_done = False
else:
not_done = True
# now done
lg("Done Simulation(" + str(path_to_test) + ")", 6)
lg("", 6)
sys.exit(exit_status)
# end of processing