-
Notifications
You must be signed in to change notification settings - Fork 0
/
GSMWSControl2
executable file
·68 lines (58 loc) · 3.52 KB
/
GSMWSControl2
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
#!/usr/bin/python
if __name__ == "__main__":
import argparse
import logging
import sys
from os.path import expanduser
from gsmws import controller, bts, gsm
parser = argparse.ArgumentParser(description="GSMWS Controller for two BTS units.")
parser.add_argument('--openbtsdb1', type=str, action='store', default='/etc/OpenBTS/OpenBTS.db', help="OpenBTS.db location")
parser.add_argument('--openbts1', type=str, action='store', default='OpenBTS', help="OpenBTS process name")
parser.add_argument('--transceiver1', type=str, action='store', default='transceiver', help="transceiver process name")
parser.add_argument('--cmd1', type=str, action='store', default="tshark -V -n -i any udp dst port 4729 and ip dst 127.0.0.1", help="command stream")
parser.add_argument('--openbtsdb2', type=str, action='store', default='/etc/OpenBTS/OpenBTS2.db', help="OpenBTS.db location")
parser.add_argument('--openbts2', type=str, action='store', default='OpenBTS', help="OpenBTS process name")
parser.add_argument('--transceiver2', type=str, action='store', default='transceiver', help="transceiver process name")
parser.add_argument('--cmd2', type=str, action='store', default="tshark -V -n -i any udp dst port 4729 and ip dst 127.0.0.2", help="command stream")
parser.add_argument('--delta', '-d', type=int, action='store', default=10, help="Different in signal strengths between BTS to determine interference (RSSI).")
parser.add_argument('--cycle', '-c', type=int, action='store', default=14400, help="Time before switching to new set of neighbors to scan (seconds).")
parser.add_argument('--sleep', '-s', type=int, action='store', default=10, help="Time to sleep between RSSI checks (seconds)")
parser.add_argument('--gsmwsdb', type=str, action='store', default=expanduser("~") + "/gsmws.db", help="Where to store the gsmws.db file")
parser.add_argument('--nyan', action='store_true', help="Read from (non)standard nyan cat")
parser.add_argument('--oldskool', action='store_true', help="Use the old-style BTS (really just for Desa)")
parser.add_argument('--debug', action='store_true', help="Enable debug logging")
args = parser.parse_args()
if args.oldskool:
BTS_CLASS = bts.OldBTS
else:
BTS_CLASS = bts.BTS
if args.debug:
loglvl = logging.DEBUG
else:
loglvl = logging.INFO
if args.nyan:
stream1 = gsm.command_stream("python nyan.py bts1.out")
stream2 = gsm.command_stream("python nyan.py bts2.out")
else:
stream1 = gsm.command_stream(args.cmd1)
stream2 = gsm.command_stream(args.cmd2)
bts1_conf = {'db_loc': args.openbtsdb1,
'openbts_proc': args.openbts1,
'trans_proc': args.transceiver1,
'bts_class': BTS_CLASS,
'stream': stream1,
'start_cmd': None # unused right now... TODO
}
bts2_conf = {'db_loc': args.openbtsdb2,
'openbts_proc': args.openbts2,
'trans_proc': args.transceiver2,
'bts_class': BTS_CLASS,
'stream': stream2,
'start_cmd': None # unused right now... TODO
}
NEIGHBOR_CYCLE_TIME = args.cycle # seconds to wait before switching up the neighbor list
SLEEP_TIME = args.sleep # seconds between rssi checks
MAX_DELTA = args.delta
GSMWS_DB = args.gsmwsdb
c = controller.DualController(bts1_conf, bts2_conf, NEIGHBOR_CYCLE_TIME, SLEEP_TIME, MAX_DELTA, GSMWS_DB, loglvl=loglvl)
c.main()