Commit Graph

2641 Commits

Author SHA1 Message Date
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
Max 8bda1c2f52 Report socket path on errors
Change-Id: Ib63e1205d7b845c8779eb511635f26bae3a18085
2018-10-26 11:11:41 +02:00
Pau Espin 5516f2cad3 fake_trx: introduce CTRL commands for RSSI simulation
Since FakeTRX is a proxy, it basically emulates transceiver for
both osmo-bts-trx and trxcon, hence there are two separate and
independent control interfaces (usually, ports 6701 and 5701).

All simulation commands (see 'FAKE_*') are usually implemented
on both interfaces separately:

  - ctrl_if_bb.py - simulation commands affecting Uplink,
  - ctrl_if_bts.py - simulation commands affecting Downlink.

This change introduces the 'FAKE_RSSI' command for both CTRL
interfaces in two variations:

  - absolute: CMD FAKE_RSSI <BASE> <THRESH>
  - relative: CMD FAKE_RSSI <+-BASE_DELTA>

where 'THRESH' affects optional value randomization.

Change-Id: Ic01c31fb0304345dd7337c3ee1c7ee3c2d3e8460
2018-10-23 00:00:13 +02:00
Pau Espin f6e1429f80 firmware: set corret shebang in solve_envs.py python2 script
Change-Id: I64582568f7390b7f4e3253508209a59eb78ee4dd
2018-10-22 10:00:31 +02:00
Vadim Yanitskiy 0a1da46869 trxcon/scheduler: add PDTCH channel support
Change-Id: I1176576f54c1d68e79cc6ac37d61a9033f7018dd
2018-10-20 22:42:59 +02:00
Vadim Yanitskiy 1a892eeb2a layer23/l1ctl.c: clean up & fix message length checking
Almost all handlers for received L1CTL messages are also affected
by the bug fixed in I7fe2e00bb45ba07c9bb7438445eededfa09c96f3. In
short, they do verify the length of 'msg->l2h' or 'msg->l3h', but
not the 'msg->l1h'. Let's fix this, and also add missing checks.

Change-Id: I866bb5d97a1cc1b6cb887877bb444b9e3dca977a
2018-10-03 19:46:25 +07:00
Vadim Yanitskiy 7bf8aea33a layer23/l1ctl.c: avoid confusion between L1CTL / L1 headers
As we assign the payload following L1CTL header to 'msg->l1h',
it makes sense to avoid possible naming confusion.

Change-Id: I5d21ca8664b3445f472d3ffde90d0e11805dcb16
2018-10-03 19:40:19 +07:00
Vadim Yanitskiy d02927b036 layer23/l1ctl.c: fix: verify msg length using l1h, not l2h
The actual L1CTL header is pointed by 'msg->l1h', not 'l2h'!
Since msg->l2h is NULL (because nobody set it), the result of
msgb_l2len() would always be bigger than size of L1CTL header,
as it is calculated in the following way:

  return msgb->tail - (uint8_t *)msgb_l2(msgb);

So, in case if 'msg->l2h' is NULL, it turns into:

  return msgb->tail - 0;

Change-Id: I7fe2e00bb45ba07c9bb7438445eededfa09c96f3
2018-10-03 19:21:58 +07:00