Commit Graph

2848 Commits

Author SHA1 Message Date
Vadim Yanitskiy 8b3d49bd34 trx_toolkit/data_msg.py: use struct API for fn and toa256 coding
The built-in struct module is already used for toa256 decoding,
so let's use it for toa256 encoding, and TDMA frame number
coding too - no need to (re)implement the wheel!

Change-Id: I10d2e15ac57a0524e9bc1c80ed6a0f6f5a263436
2018-12-18 05:47:11 +07:00
Vadim Yanitskiy 016361cda1 trx_toolkit/ctrl_if_bb.py: drop meaningless warnings
A timeslot can be reconfigured at runtime, this is normal.
We should neither complain nor reject such commands.

Change-Id: I0a69ebceed5aa724093e6d1b23faad8c16705055
2018-12-16 07:14:11 +07:00
Vadim Yanitskiy 2e32260040 trx_toolkit/burst_send.py: exit if DATA dump parsing failed
False is not iterable, so we should properly handle the case
when parsing of the whole DATA dump was failed (e.g. due to
incorrect offset specified).

Change-Id: I5443efb39bb9d3377290ce7ec5e34016cae0edb2
2018-12-16 07:14:11 +07:00
Vadim Yanitskiy 7dacdcbd09 trx_toolkit/burst_send.py: fix: use proper argparse group
Found using Flake8, F841 "local variable 'pf_group' is assigned
to but never used". The filtering related options should be
defined in 'pf_group' group, not in 'cnt_group'.

Change-Id: I15d17c134cbbbd54d761113a56c1f83910ab6407
2018-12-16 07:14:11 +07:00
Vadim Yanitskiy 1bea8faa7d trx_toolkit: fix missing / useless imports
Found using Flake8:

  - data_if.py:57:4: F405 'log' may be undefined, or defined
                     from star imports: data_msg
  - clck_gen.py:29:1: F401 'time' imported but unused
  - clck_gen.py:30:1: F401 'sys' imported but unused
  - trx_sniff.py:28:1: F401 'signal' imported but unused

Change-Id: Id0c42319b445db218b77fd5e99a9a0a89724281d
2018-12-16 07:14:11 +07:00
Oliver Smith 60e402d13a contrib/jenkins.sh: build and publish manuals
Add new environment variables WITH_MANUALS and PUBLISH to control if
the manuals should be built and uploaded. Describe all environment vars
on top of the file.

Related: OS#3385
Change-Id: I856e4bc71e1b648de5f27d4044aa60bd0b45e0f5
2018-12-12 14:07:39 +01:00
Vadim Yanitskiy 810b696b8d trx_toolkit/data_if.py: add message parsing methods
This change extends DATAInterface class with new methods:

  - recv_raw_data() - read raw data from socket;
  - recv_l12trx_msg() - read raw data and parse as L12TRX;
  - recv_trx2l1_msg() - read raw data and parse as TRX2L1;

which would simplify the further usage of this class.

Change-Id: I761c4e63864622d3882b8f9c80ea43b58f092cb1
2018-12-12 00:43:18 +07:00
Vadim Yanitskiy 1dcc45beff trx_toolkit/ctrl_if.py: read data from socket in handle_rx()
It makes much more sense to read data from socket in handle_rx(),
instead of expecting a buffer with received data from caller.

Change-Id: I83479c60c54e36a2a7582714a6043090585957ae
2018-12-11 23:58:18 +07:00
Vadim Yanitskiy 7e9821f289 trx_toolkit/ctrl_if_*.py: transparently pass UDPLink arguments
There is no need to (re)define the arguments of UDPLink's constructor.
Let's use non-keyworded variable length argument list (*args).

Change-Id: Ia312a5e15ce88d5f7e8d76c4ea8c93c59d91be5a
2018-12-11 23:47:13 +07:00
Vadim Yanitskiy 63be9da190 trx_toolkit/ctrl_if_bb.py: fix SETTA command handling
Since I8fd2a2ab7784b38bde5ebcfd0359b7e2cb53f5a7, SETTA command
handling was broken, because the range limitation was removed
together with argument parsing. Let's fix this.

Change-Id: If582af3849359866de129504cc5b2dc6d64edbd5
2018-12-10 05:57:46 +07:00
Vadim Yanitskiy 59debdcd07 trx_toolkit: merge copyright.py into app_common.py
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-08 02:10:50 +07:00
Vadim Yanitskiy cdf349bc64 trx_toolkit: introduce logging configuration arguments
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-08 02:10:20 +07:00
Vadim Yanitskiy 5cb7e287ed trx_toolkit/fake_trx.py: migrate from getopt to argparse
Change-Id: I0218a328671c591b20b0666dc7c39ba865892acc
2018-12-07 08:20:37 +07:00
Vadim Yanitskiy 060b2729d1 trx_toolkit/trx_sniff.py: migrate from getopt to argparse
Change-Id: Id1dacaa32134bfa68344e6c48310390cdd85cdc9
2018-12-07 08:08:49 +07:00
Vadim Yanitskiy 66b7e78eb1 trx_toolkit/ctrl_cmd.py: migrate from getopt to argparse
Change-Id: Ib9bf5ed7384c4f34478975cefe03880eb2fc8069
2018-12-07 08:08:45 +07:00
Vadim Yanitskiy 3fee14b5a3 trx_toolkit/burst_send.py: migrate from getopt to argparse
Change-Id: I1be66aa022a79aa1683f0e6cfebaed568b1736b1
2018-12-07 07:15:45 +07:00
Vadim Yanitskiy 51dd1dc703 trx_toolkit/burst_gen.py: migrate from getopt to argparse
Change-Id: I7eb3f2e2713f1f97293bd47a2eae3b140f63fb59
2018-12-07 06:52:59 +07:00
Vadim Yanitskiy 54a8c02a80 trx_toolkit/burst_gen.py: fix short version of --burst-type
Both '--bind-addr' and '--burst-type' had the same short '-b'.
Let's use the upper case version for '--burst-type'.

Change-Id: Ib8a46e25cbc6266c3e147582f9e8045362270151
2018-12-07 05:54:26 +07:00
Vadim Yanitskiy 6bab6acee6 trx_toolkit: use generic logging module instead of print()
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-12-07 05:36:20 +07:00
Vadim Yanitskiy 72c8296bfe trx_toolkit/fake_trx.py: drop randomization related cmd options
The randomization of both UL/DL RSSI and ToA values is optional,
and can be configured from the control interface (see both
FAKE_RSSI and FAKE_TOA commands).

The command line options for enabling / disabling the randomization
were redundant, so let's get rid of them and check if the
corresponding treshold value is set.

Change-Id: I6adc13b8989ade2fab895673525c0ca17bf9b3f2
2018-12-07 03:06:54 +07:00
Vadim Yanitskiy 6c4d9b6284 trx_toolkit/burst_fwd.py: also pass-filter UL bursts by time-slot
For some reason, the time-slot pass-filtering was only done for
DL bursts, but not for UL bursts. BurstForwarder shall not pass
UL bursts for unconfigured time-slots too.

Let's also print a warning if an UL burst is sent on a not
configured time-slot, i.e. before sending SETSLOT command.

Change-Id: Idb7f5b212e5814aeff8ca8bc875ad066674267cd
2018-12-07 03:06:54 +07:00
Vadim Yanitskiy cadbce066b trx_toolkit/burst_fwd.py: properly pass-filter multiple time-slots
Previously it was only possible to configure a single time-slot
that would be pass-filtered by a BurstForwarder instance. In some
applications it would be useful to configure multiple time-slots,
so let's refactor the time-slot pass-filtering algorithm.

Change-Id: Ie1490adaf7a7c62c966aeb60c1898eaf3b5a1e84
2018-12-07 03:06:49 +07:00
Vadim Yanitskiy 8d70f9d9fe trx_toolkit/burst_fwd.py: document and refactor BurstForwarder
Instead of having all configuration variables of BurstForwarder
initialized in the class heading, let's introduce two functions
for initialization (resetting to defaults) of both UL/DL params.
This would allow to reset a BurstForwarder instance from the
control interface in follow-up patches.

Let's also introduce some basic documentation for the class
fields, which were defined in the heading previously.

Change-Id: I6b1bf41cf22f01a7e7ecc91c625fb0d2bf4bfeac
2018-12-06 07:42:07 +07:00
Oliver Smith 9fd173b179 doc/manuals: integrate into this repository
Update .gitignore and make the manuals build without a toplevel
configure.ac file from autotools:

$ cd doc/manuals
$ make

Related: OS#3385
Change-Id: Ifc2349bc2855b55cc1e603b79dc769c55a110aa1
2018-12-04 12:14:59 +00:00
Vadim Yanitskiy 43fb867c78 trxcon/l1ctl.c: handle hopping channels from L1CTL_DM_EST_REQ
Change-Id: I8617b5808748bc4df3d7cc9862ed8cf12613f270
2018-11-29 16:11:27 +00:00
Vadim Yanitskiy db9198d236 trxcon/trx_if.c: add SETFH CTRL command support
The idea of SETFH command is to instruct transceiver to enable
frequency hopping mode using the following parameters:

  CMD SETFH <HSN> <MAIO> <CH1> <CH2> [... <CHN>]

Note: since the length of a CTRL command is limited to 128
symbols (BTW: why?), the amount of channels is also limited.

Change-Id: Id3d44e6a2796f1ce8523a49dedd5d484052a5c7f
2018-11-29 16:11:27 +00:00
Oliver Smith e5c385fbc0 build manuals moved here from osmo-gsm-manuals.git
Moved to doc/manuals/, with full commit history, in preceding merge commit.
Now incorporate in the build system.

Build with:

$ autoreconf -fi
$ ./configure --enable-manuals
$ make

Shared files from osmo-gsm-manuals.git are found automatically if
- the repository is checked out in ../osmo-gsm-manuals; or
- if it osmo-gsm-manuals was installed with "make install"; or
- OSMO_GSM_MANUALS_DIR is set.

Related: OS#3385
Change-Id: I7d1226d3865da9595b730b716a8d4ba07be1e0d5
2018-11-28 17:05:15 +01:00
Neels Hofmeyr 959c1e6862 Merge history from osmo-gsm-manuals.git 2018-11-28 17:04:58 +01:00
Holger Hans Peter Freyther ce39d03a66 osmocomBB: Begin with a manual for the "mobile" application
Begin with manual for the layer23 ("mobile") application but focus
on the scripting code first.

Change-Id: I736f2d61650feac70b6d960811b478639aa71737
2018-11-28 17:04:49 +01:00
Neels Hofmeyr bcd13f4d27 Importing history from osmo-gsm-manuals 2018-11-28 17:04:20 +01:00
Vadim Yanitskiy d72aeb8e41 trxcon/l1ctl.c: fix deprecated gsm_band_name() usage
Change-Id: I99bb935b7cd529c885bf10dc209b6016df8095d8
2018-11-22 15:20:05 +07:00
Vadim Yanitskiy da96b3c0ae mobile: use VTY bind addr from config, deprecate cmd line options
This change revives the main idea of:

  Change-Id: I32517567847fd5c54b1742f18bf409ff81e316fa

to stop ignoring the VTY bind address from the config file.

Furthermore, it deprecates (and disables) both 'u' and 'v'
command line options, because they are redundant.

Change-Id: I99e0ec1717edd29b3be231be86616cc7effe5d95
2018-11-21 10:36:57 +07:00
Vadim Yanitskiy 65110d2d99 mobile: abort in case of argv handling errors
The process should be aborted if a non-existing command line
option or an incorrect parameter value is passed.

Change-Id: Ib656ad12f12429ed15dc2a1554901ffa51148ff6
2018-11-21 10:22:52 +07:00
Vadim Yanitskiy 0e8f447c4d mobile/app_mobile.c: use LOGP() instead of printf()/fprintf()
Change-Id: I6af76afbaa34dde5ddfc31a65700030862442dba
2018-11-21 10:02:42 +07:00
Vadim Yanitskiy d21f22c128 mobile/app_mobile.c: drop redundant printf() call
The VTY requisites are always being printed by libosmovty,
there is no need to duplicate this information.

Change-Id: I688f66175ea67d4c6a46819bee7d300ad9ce7cc7
2018-11-21 09:42:31 +07:00
Vadim Yanitskiy d7e2337361 Revert "mobile: fix vty bind ip override"
This reverts commit c8de8cb1e1
(Change-Id I32517567847fd5c54b1742f18bf409ff81e316fa by Max),
because several problems were introduced, in particular:

  a) Help message of mobile application is broken:

      "The VTY IP to telnet to. (default (null))",
      "The VTY port number to telnet to. (default 127.0.0.1)".

  b) Default VTY bind addres != parsed from the config file.

  c) The (vty_ip == NULL) is resolved only when an external
     MNCC handler is used, otherwise NULL is passed to
     l23_app_init().

Change-Id: Ic63a4eb828ff32d3744886b4f5f6f5019c798620
2018-11-21 09:35:21 +07:00
Max c8de8cb1e1 mobile: fix vty bind ip override
Previously the vty bind config parameter was always ignored. Fix this by using proper
default value from the config unless it's explicitly set via command-line parameter.

Change-Id: I32517567847fd5c54b1742f18bf409ff81e316fa
2018-11-19 17:20:11 +01:00
Max dcc7e6074a Fix build with latest libosmocore
Remove locally defined function which conflicts with the one in
libosmocore.

Change-Id: I1be1d39f7c93c959ca33f6296ecda71996865cca
2018-11-19 10:26:19 +01:00
Max bfa7b3335b l1l2 interface: use LOGP for socket errors
Log via LOGP() like the rest of the file instead of fprintf() for
consistency. While at it, also print error cause.

Change-Id: Id205bcd9bdb7c3e4b96493d50be8381a6fa80ac6
2018-11-19 09:17:09 +00:00
Max a4c22ba00d osmocon: log error cause for socket opening
Change-Id: I2f871cb16e5e1033e42863a9e12459057004782c
2018-11-19 09:17:09 +00:00
Max 264378a867 mobile: log socket path on error
Change-Id: I18eb46743e4c0e4e8f8032883f39fec355f03c78
2018-11-19 09:17:09 +00:00
Max d44503337d mobile: use proper type for boolean flags
This makes reading code easier and simplifies further modifications.

Change-Id: I7eff2a61495ff167dc19fc9a41882a7a11fbf32d
2018-11-16 21:37:55 +01:00
Max aa4dbe2b8e mobile: add header for MS' MNCC functions
This simplifies adding new functions and re-using them from other parts
of the code.

Change-Id: Ibad400a99afe052f011f54fc706836b6bf89f4b9
2018-11-16 21:37:55 +01:00
Pau Espin 927d030ae8 layer23: Avoid mempcy with NULL src
Fixes following ASan warning:
git/osmocom-bb/src/host/layer23/src/misc/../common/main.c:146:2: runtime error: null pointer passed as argument 2, which is declared to never be null

The warning however is harmless since in that case, app_len = 0 and thus
size to copy is 0.

Change-Id: I009a5b53f1e5be72ce347d64d3a7cb1d95d37ea3
2018-11-08 15:46:50 +01:00
Pau Espin 4f85fb30bc layer23: Fix build against gpsd >= 3.18
Change-Id: I0e97d3e8c3688064c959ea60ecef50cfbbc1bcd6
2018-11-05 20:22:45 +01:00
Pau Espin 9cdee8f66a cosmetic: fix trailing whitespace
Change-Id: I5c1a6d98079ad846d114584a17ba9d80d95e0595
2018-11-05 20:21:58 +01:00
Vadim Yanitskiy 219ed20cb5 l1ctl_proto.h: use flexible array member for traffic messages
Unlike the DATA messages, traffic frames may have different length.
Instead of having fixed payload (i.e. TCH frame) length, let's
introduce a flexible array member. This would allow one to
calculate the frame length using the MSGB API.

Change-Id: I119fa36c84e95c3003d57c19e25f8146ed45c3c6
2018-11-05 05:13:57 +00:00
Vadim Yanitskiy d350e9f30c layer23/l1ctl.c: fix: use host byte order for TDMA fn
Change-Id: Iad00eebf03b38b9c4fc2d7ed66697d23a953d8b2
2018-10-27 05:54:25 +07:00
Vadim Yanitskiy f8edc45506 layer23/common: move SIM APDU caching from l1ctl.c
L1CTL implementation (i.e. l1ctl.c) is not a good place for the
SIM specific stuff. Let's move it to the proper place (i.e. sim.c).

As a bonus, this change fixes a possible problem of loosing the
cached APDUs if two or more L2&3 applications are using a single
LAPDm connection. The APDU buffer is dedicated per MS now.

Change-Id: I564c610e45aa3b630ca5d1ec6bc1cace0dc9c566
2018-10-27 05:49:45 +07:00
Vadim Yanitskiy d464fe5388 trxcon: make TRX bind address configurable
Previously the wildcard address (i.e. '0.0.0.0') was hard-coded
as the bind address of TRX interface. Let's make it configurable
by introducing a command line option.

Note that the '--trx-ip' option was deprecated by '--trx-remote',
because it isn't clean whether it is remore or local address. It
still can be used, but was removed from help message.

Change-Id: Ic2f43632cc57bb6f722eba05219e438f97fecb95
2018-10-26 17:52:47 +00:00