Commit Graph

65 Commits

Author SHA1 Message Date
Philipp Maier 122a66da2e trau_pcu_ericsson: add testvectors for MCS1-MCS8
The testvectors were obtained manually from the uplink of an
Ericsson RBS RUS 02 B3. The TRAU frames were selected so that they
contain valid MAC blocks from live GPRS traffic.

Change-Id: I7e7e35930a373c9db74faef24f6c404eb5516278
Related: OS#5198
2023-02-27 10:32:43 +01:00
arehbein ac85f6069f Transition to use of 'telnet_init_default'
Related: OS#5809
Change-Id: Icc57c68337d55c6594c1c36e9bf41624d11dab0a
2023-02-25 17:48:58 +01:00
Philipp Maier 5c9d45407f trau_pcu_ericsson_test: fix comment, CS2 blocks are not CRC protected
Change-Id: Ifeed7bc961266e0fcfb1a837257b83fca2a69da1
2023-02-23 10:16:14 +01:00
Philipp Maier ebb2cad4ae trau_pcu_ericsson_test: replace 64K CS1/CS2 testvectors
The CS1/CS2 testvectors for the 64K TRAU frame decoder are valid but the
contained MAC block consits of noise. At the time when the test data was
sampled it was not possible to get TRAU frames with valid content from
the CCU. This has changed, so lets update the testvectors with ones that
contain valid data.

Change-Id: I0b8aef1ce1eca5b10601a0a655f7e3b00915d3cc
Related: OS#5198
2023-02-21 16:19:03 +01:00
Philipp Maier b057535512 GPRS Trau frame encoder/decoder for Ericsson RBS
The Ericsson RBS BTS family is using a propritary TRAU frame dialect to
communicate with the GPRS/EGPRS part of their CCU. There are essentially
two implementations available:

- GPRS over 16kbps I.460 subslots (very limited, supports only CS1 and CS4)
- GPRS/EGPRS over full 64kbps timeslots (supports CS1-4 and MCS1-9)

Change-Id: Ib2b232a76588c32cde75b987a7e5fdfddf099cd7
Related: OS#5198
2023-01-03 12:24:29 +01:00
Keith Whyte bbff304e2e Log TRAU FSM at INFO not NOTICE
During normal operations, osmo-mgw floods the log/vty at level NOTICE with:

 Received Event RX_BITS (trau_sync.c:525)

Change-Id: Ib4c5ac130e766906361c63090b30111970343075
2021-05-04 15:43:06 -05:00
Pau Espin 97cae17ffd tests: trau_sync: Explicitly drop category from log
Let's disable hex category here since we don't care about its formatting here.

In any case, every test relying on logging output validation should
always explicitly state the config to avoid issues in the future if
default values change.

Related: OS#5034
Change-Id: I332d1215fc7784a6647b90e2eb8b1efcd644002e
2021-02-19 12:50:03 +01:00
Harald Welte 6e831b72d7 Use osmo_fd_setup() wherever applicable
Change-Id: I5b369343cf708ddfcde347f218a10d5f72303aaa
2020-12-21 17:58:06 +01:00
Harald Welte de3959e62c Use OSMO_FD_* instead of deprecated BSC_FD_*
Change-Id: Ib676eda521f0e89a1f4d8f9eac810598a3c813b9
2020-10-18 22:30:07 +02:00
Pau Espin 7766e6dc15 tests: Disable stderr log color in trau_sync_test
Change-Id: Ibe8e2d580848a41dd25e0ae2d95f83233be6ed9a
2020-09-09 15:52:03 +02:00
Harald Welte 78861c0aef Add new TRAU frame sync code
This code is able to detect and sync against a variety of TRAU
frame sync patterns.  Focus is so far on those patterns present on
16k sub-slots, but 8k sub-slots are expected to be supported soon,
too.

A new codebase for this is required as the old OsmoNITB code had
conflated a 16k sub-slot multiplexer with TRAU frame synchronization,
so there was no way to separate those two parts and hence no way to
support 8k sub-slots.

Change-Id: Ia6fe6228b0b8b9a27999f37ce1115ed5558881ea
2020-08-03 02:29:21 +02:00
Pau Espin 3b9bebfa24 tests: Use API e1inp_line_put2 instead of deprecated e1inp_line_put
Change-Id: If3fb68fda1c109f6aa15aa68c5bce285054efda7
2020-07-15 15:49:44 +02:00
Harald Welte 4119e5124d Fix subchan_demux_test compiler warning on some gcc versions
In commit Ia082b9fddf03d02afd007825a1588a3ef0dbedae we switched
from 'uint8_t *' to 'const ubit_t *' - change the test case
accordingly.

Change-Id: I7d24b891a21e6e485738ddf4a302583579b012d5
2020-05-13 18:52:25 +02:00
Harald Welte 54c919ec48 ortp: disable SO_REUSEADDR + SO_REUSEPORT
ortp >= 0.24.0 doesn't differentiate between SO_REUSEADDR and
SO_REUSEPORT, and has both enabled by default.  The latter means that
we can end up with non-unique port bindings as we will not fail to
bind the same port twice.

This should have caused visible problems not only when operating multiple
osmo-bts on one machine (rare), but also with a single osmo-bts. Once the range
(default 16384-17407 ) wraps, there is a risk of new sockets (for new cals)
colliding with old ones. As two ports (RTP+RTCP) are used per call, this means
every 512 voice calls we expect the BTS to wrap. And from that point onwards
there's a risk of overlapping with previously allocated sockets.

Change-Id: I4fc9eee561c7958c70c63b4ffdc6cb700b795e28
Closes: OS#4444
2020-03-09 11:24:45 +01:00
Harald Welte 9104597d76 Add rtp_test to show the double-bind bug of OS#4444
Change-Id: I6742e5504cfb827031031e4d8d49a616ab203a94
2020-03-09 11:24:38 +01:00
Oliver Smith c674e9fcdf tests: use -no-install libtool flag to avoid ./lt-* scripts
This ensures that the rpath of the generated binaries is set to use only
the just-compiled so-files and not any system-wide installed libraries
while avoiding the ugly shell script wrapper.

Change-Id: Idd458471069ef8912704cc7602c6e8c71c0b62be
2019-03-19 13:46:08 +01:00
Pau Espin b5cfc6b019 ipaccess: Simplify handling of ipaccess e1line ts
Handle encoding specifics behind a macro to make code easier to
understand and follow.

Change-Id: Ibf251673bff95b7a0b066b19ef4dc6c0f94fff6b
2018-10-03 12:10:43 +02:00
Pau Espin c04d8d2274 use osmo_init_logging2
Change-Id: Iab9d111aba8f9b423e6a541e928f68b38d561067
2018-04-17 14:43:08 +02:00
Harald Welte 323d39d784 Add SPDX-License-Identifier to all source files
Change-Id: I9f2bc8c5d8a2c0bb0dd6caa4de5e2cb11be210e7
2017-11-13 01:09:21 +09:00
Holger Hans Peter Freyther e6ad794cad test: Fix the compilation of the test
This test didn't compile as it called the wrong method. It is a
manual test anyway and tend to bitrot. I didn't execute the
resulting test binary. Hmm, now I did and it segfaults on something
that appears to have been introduced a long time ago. Manual
tests are as good as no tests (besides they take more time than
writing no test). ;)
2014-08-29 09:08:01 +02:00
Andreas Eversberg f422a753a7 Support for multiple RSL connections with ABIS/ipaccess (BTS side)
In order to support multiple TRX, multiple RSL connections can be
establised. e1inp_ipa_bts_rsl_connect() requires an additional parameter
to set the TRX number.

The ts[] array (member of struct e1inp_line) refers to OML and RSL.
ts[0] refers to OML link, ts[1] to RSL link of first TRX, ts[2] to
RSL link of second TRX (if exists) and so on.

The code was successfully tested with osmobts-trx and UmTRX with two
transceivers.

The user of e1inp_ipa_bts_rsl_connect() (which is osmo-bts) can use
the new function like this (backwards compatibility function provided):

src/common/oml.c
-	rc = e1inp_ipa_bts_rsl_connect(oml_link->ts->line, inet_ntoa(in), port);
+	rc = e1inp_ipa_bts_rsl_connect_n(oml_link->ts->line, inet_ntoa(in), port,
+		trx->nr);
2014-08-28 12:50:29 +02:00
Harald Welte b65f58f6f9 move various generic IPA related functions to libosmocore
libosmo-abis is about forming A-bis interfaces/lines by means
of E1 or the IPA multiplex (or possibly other link layers).

The IPA multiplex is used in other contexts, such as the Control
interface, or the A interface.  In that context, it makes sense to have
generic IPA related functions in libosmocore.
2014-08-20 23:41:07 +02:00
Jacob Erlbeck 98af3c3a6d ipa: Change ipa_msg_recv() to support partial receive
Currently ipa_msg_recv() fails, when messages are received partially.

This patch provides a new function ipa_msg_recv_buffered() that uses
an additional ** to a message buffer to store partial data.  When
this happens, -EAGAIN is returned. If NULL is used, the function
behaves similar to ipa_msg_recv() and fails on partial read.
In addition in case of errors the return value is now always -EXXX
and the contents of errno is undefined.

Note that this feature needs support by the calling code insofar that
*tmp_msg must be set to NULL initially and it must be freed and
set to NULL manually when the socket is closed.

Note also that ipa_msg_recv() is then a wrapper around
ipa_msg_recv_buffered() which mimics the old error behaviour by
setting errno explicitely to -rc and returning -1 when an error has
happened.

Ticket: OW#728
Sponsored-by: On-Waves ehf
2014-03-31 14:33:18 +02:00
Jacob Erlbeck 36106ae244 ipa/test: Add test program for IPA message reception
This patch adds tests for ipa_msg_recv(), where messages are sent
either complete or partitioned.

Sponsored-by: On-Waves ehf
2014-03-24 11:05:10 +01:00
Jacob Erlbeck 3ea52e4f4c ipa-proxy/vty: Removed enable/ipa node
This was basically a link to configure/ipa which is not cleanly
supported by the current VTY framework.

The test program uses the default implementation for
go_parent_cb/vty_go_parent() and is_config_node, since config-ipa is
a top level config node which is assumed by default.
2013-11-11 14:54:53 +01:00
Harald Welte 84f67b2832 Don't establish RSL at same time as OML link on IPA type lines
If we have a BTS-side e1inp_line, we can only establish OML at the
time of line_update.  We have to wait with RSL until the BTS explicitly
tells us the RSL destination IP and port (received via OML from BSC).

This is now handled in a new function called
e1inp_ipa_bts_rsl_connect().
2013-10-06 11:54:38 +02:00
Holger Hans Peter Freyther 9d4fe51424 hsl: Remove the input handling for the HSL BTS
I have removed HSL support from OpenBSC, the E1/Abis code is now
unused and can be removed.

Fixes: Coverity CID 1040693
2013-07-04 19:50:09 +02:00
Alexander Huemer 3eed8a115a Makefile.am: Use AM_CPPFLAGS
Since automake 1.13 INCLUDES is depricates and causes a warning
2013-06-12 07:51:41 +02:00
Daniel Willmann bd3f854f3c tests: Don't delete atconfig in clean
This file is created in ./configure so we shouldn't remove it with make.

Otherwise ./configure && make clean && make check fails
with:

make[3]: *** No rule to make target `atconfig', needed by `check-local'.
Stop.
2012-12-26 11:21:38 +01:00
Tobias Engel bcb9531366 Test parsing of GSM 08.60 frame sync header
Tests if the frame synchronization header is correctly recognized.

The problem tested for is the following:
The sync header consists of 16 zero-bits followed by 1 one-bit. Before,
subchan_demux only tested for the 16 zero-bits. But if the previous
frame ended in one or more zero-bits these were then already counted as
belonging to the sync header, leading to a frame that was shifted by one
or more bits.
2012-10-12 16:24:00 +02:00
Holger Hans Peter Freyther bc5dcb11a7 tests: Add a test stub for the subchan_demux tests
Tobias has worked on CSD support and Dieter has helped with a CSD
trau fix. This is a stub that should allow to easily write a test
case for the syncing issue observed by Tobias.

Run the tests:
$ make check

In case of failure:
$ vi tests/testsuite.dir/1/testsuite.log

Add the actual content:
$ edit tests/subchan_demux/subchan_demux_test.c

Update the test result:
$ ./tests/subchan_demux/subchan_demux_test > tests/subchan_demux/subchan_demux_test.ok
2012-10-12 16:23:31 +02:00
Holger Hans Peter Freyther 5c65e79edc tests: Add boilerplate to be able to have tests in libosmo-abis 2012-10-11 08:18:43 +02:00
Pablo Neira Ayuso 7251604cce tests: e1inp_ipa_*_test: fix leak of msgb in ->sign_link path
Fix a leak in the tests: The ->sign_link callback is reponsible
for releasing the msgb.
2012-08-30 21:50:32 +02:00
Pablo Neira Ayuso 1fd93bbc6e tests: e1inp_ipa_*_test: add signal handling for process termination
This patch adds signal handling to release memory in the exit
path of the tests. This is good to check what memory we are
leaking in the exist path of the tests.
2012-08-30 21:50:32 +02:00
Pablo Neira Ayuso 7723b4e9a3 tests: fix CPU suckup e1inp_ipa_bts_test after test finish
We have to read from the eventfd, otherwise select keeps returning
the file descriptor as ready to read.
2012-08-30 21:50:32 +02:00
Pablo Neira Ayuso 18d6294efe tests: e1inp_ipa_bts_test: fix compilation warnings
CC     e1inp_ipa_bts_test.o
e1inp_ipa_bts_test.c: In function ‘sign_link_up’:
e1inp_ipa_bts_test.c:47:8: warning: variable ‘dst’ set but not used [-Wunused-but-set-variable]
e1inp_ipa_bts_test.c: In function ‘test_bts_gsm_12_21_cb’:
e1inp_ipa_bts_test.c:211:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
  CCLD   e1inp_ipa_bts_test
2012-08-30 21:50:30 +02:00
Pablo Neira Ayuso 5a8cca3a1c tests: e1inp_ipa_bsc_test: fix crash
The sequence to trigger the crash was:

1) establish a full A-bis IPA link (both OML and RSL correctly established
and ID_RESP received from BTS).
2) nc 127.0.0.1 3002 # establish OML link only

I forgot to set to NULL the oml and rsl links we're using. Otherwise,
the test calls e1inp_sign_link_destroy(rsl) which does not exists.
2012-08-30 21:50:30 +02:00
Diego Elio Pettenò 3dfe8bf80c build: only build tests during make check
Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
2012-07-01 07:40:36 +02:00
Holger Hans Peter Freyther 25c83611be misc: Linker fix for Ubuntu 11.10
--as-needed was default in Natty and somehow got more strict in
this version of Ubuntu. Link to osmo vty.
2011-10-16 17:19:13 +02:00
Pablo Neira Ayuso 8fc277b777 tests: remove reference to internal headers in ipa_proxy_test
This example has to compile out of the tree, including internal.h
is not required and using PACKAGE_VERSION here, which is internal
to the library, does not seem to me like a good idea.
2011-09-09 02:35:38 +02:00
Pablo Neira Ayuso 4e862cbf4b e1_input: rework configuration of virtual E1 line operations
struct e1inp_line_ops {
-       enum e1inp_line_role    role;
-       char                    *addr;
-       void                    *data;
+       union {
+               struct {
+                       enum e1inp_line_role role;      /* BSC or BTS mode. */
+                       const char *addr;               /* IP address .*/
+                       void *dev;                      /* device parameters. */
+               } ipa;
+               struct {
+                       const char *port;       /* e.g. /dev/ttyUSB0 */
+                       unsigned int delay;
+               } rs232;
+       } cfg;

Now this structure contains the configuration details for the
virtual E1 line, instead of using a pointer.

This also get the line_update callback to its original layout:

+       int (*line_update)(struct e1inp_line *line);
2011-08-19 18:43:38 +02:00
Pablo Neira Ayuso 6268416851 test: use site_id 1801 in ipa BTS example
Thus we can use it with the example file for openBSC under
doc/examples/nanobts/openbsc.cfg.
2011-08-17 23:25:38 +02:00
Harald Welte cc2241bf1c update to comply with libosmocore namespace fixes
This updates the code and brings it in sync to
libosmocore git commit 892e621fec571c7cba3573caa0d328ed1b25d8ee
2011-07-19 16:06:06 +02:00
Harald Welte 71d87b2597 talloc: revert to use talloc inside libosmocore
It's not a good idea to confuse the two changes with each other.  Moving the
Abis part into a separate library is independent from the question whether we
have talloc inside libosmocore or use a stand-alone talloc library.
2011-07-18 14:51:16 +02:00
Pablo Neira Ayuso ad1ca98ff8 tests: add missing hsl examples
Hm, it seems I forgot to git add them :-(.
2011-07-08 20:31:43 +02:00
Pablo Neira Ayuso 2ad22b8699 tests: convert IPA BTS example to use event-oriented approach
Like the HSL BTS example. We use an event file descriptor
which is used to call the GSM 12.21 based function for
handling.
2011-07-08 18:35:45 +02:00
Pablo Neira Ayuso 88136fc6dd hsl: BTS support
This patch adds the BTS support for the hsl driver.

It includes two examples under the tests/ directory.
2011-07-08 16:21:55 +02:00
Pablo Neira Ayuso 49bc872b48 tests: close OML and RSL if set for the BSC example
We only close the OML and RSL links if they are indeed up.
2011-07-08 15:25:44 +02:00
Pablo Neira Ayuso 009573aa5b tests: example BTS now sends an OML SW ACT REQ
This allows to test that the write path works and it allows
you to get an idea on how to implement the BTS side by means
of libosmo-abis.
2011-07-08 15:10:33 +02:00
Pablo Neira Ayuso 1ca98b9e9d tests: use the virtual E1 line used by OML for RSL link
The ipaccess driver is tricky. Since it uses two ports for OML
and RSL links, the link for RSL needs to be done in the same
line that the OML link.

Now the BSC examples uses the virtual E1 line where the OML
link is for the RSL one.

This patch also verifies that the OML link is up before the
someone tries to get the RSL link up.
2011-07-08 15:05:42 +02:00