summaryrefslogtreecommitdiffstats
path: root/src/target/trx_toolkit/ctrl_cmd.py
AgeCommit message (Collapse)AuthorFilesLines
2018-12-08trx_toolkit: merge copyright.py into app_common.pyVadim Yanitskiy1-3/+2
Since we have introduced ApplicationBase class, that are used by all existing applications, let's merge the copyright printing helper into it. Change-Id: I8b70ec2dd08cb2ffed733d2c4e1215b094f8d3d5
2018-12-08trx_toolkit: introduce logging configuration argumentsVadim Yanitskiy1-3/+6
Before this change, it was impossible to configure logging parameters from command line, such as log level and format. This change introduces the following optional arguments: --log-level - logging level for stderr (by default, DEBUG); --log-format - logging message format for stderr; --log-file-name - enable logging to a given file; --log-file-level - logging level for file (by default, DEBUG); --log-file-format - logging message format for file; which are defined in a new class called ApplicationBase, so all existing applications should inherit them now. Change-Id: Ic3b0440cd73946ad444bd7e48feb7a92d45f6488
2018-12-07trx_toolkit/ctrl_cmd.py: migrate from getopt to argparseVadim Yanitskiy1-59/+27
Change-Id: Ib9bf5ed7384c4f34478975cefe03880eb2fc8069
2018-12-07trx_toolkit: use generic logging module instead of print()Vadim Yanitskiy1-2/+7
There are multiple advantages of using Python's logging module: - advanced message formatting (file name, line number, etc.), - multiple logging targets (e.g. stderr, file, socket), - logging levels (e.g. DEBUG, INFO, ERROR), - the pythonic way ;) so, let's replace multiple print() calls by logging calls, add use the following logging message format by default: [%(levelname)s] %(filename)s:%(lineno)d %(message)s Examples: [INFO] ctrl_if_bts.py:57 Starting transceiver... [DEBUG] clck_gen.py:87 IND CLOCK 26826 [DEBUG] ctrl_if_bts.py:71 Recv POWEROFF cmd [INFO] ctrl_if_bts.py:73 Stopping transceiver... [INFO] fake_trx.py:127 Shutting down... Please note that there is no way to filter messages by logging level yet. This is to be introduced soon, together with argparse. Change-Id: I7fcafabafe8323b58990997a47afdd48b6d1f357
2018-04-04trx_toolkit: Add cmdline arg to set bind addrPau Espin Pedrol1-4/+9
Previous hardcoded default of 0.0.0.0 was inappropiate in some scenarios, as it sets the SRC addr of the packets sent through the socket based on the routing. For instance, if iface IF1 has assigned two IP addresses A and B, A being the first addr of the interface, and osmo-bts-trx is configured with "osmotrx ip local A" and "osmotrx ip remote B", the following happens: CMD POWER OFF src=A:5801 dst=B:5701 RSP POWER OFF src=A:5701 dst=A:5701 <-- A is assigned as src addr. But osmo-bts-trx is waiting for packets from B:5701, and the packet is dropped with ICMP Unreachable. If addr binding is forced in fake_trx to B, then everthing's fine. Let's extend the UDPLink in order to allow manual, but optional setting of bind address, and add a corresponding cmdline argument to all executables. Change-Id: I7be18fef40967fb7551f4115f22cbbd9cdb0840d
2018-03-13Rename 'fake_trx' to 'trx_toolkit'Vadim Yanitskiy1-0/+142
This toolkit has branched out into several different tools for TRX interface hacking, and creating a virtual Um-interface (FakeTRX) is only one of its potential applications. Change-Id: I56bcbc76b9c273d6b469a2bb68ddc46f3980e835