Commit Graph

14 Commits

Author SHA1 Message Date
Pau Espin 1562225332 Introduce dynamic log category for libosmo-rua/hnbap
Same as already done for libosmo-ranap.
This allows applications setting the cateogy dynamically, and will allow
untangling library tests using hnbgw log categories in this repo.

Change-Id: I5d09b67b115ad8938e5162a23accfcbafab139d4
2022-01-04 18:57:22 +01:00
Pau Espin 53052963c1 tests/tests_common.c: Add missing header
The header is probably indirectly added by osmocom/iuh/hnbgw.h, but once
that's dropped, really weird stuff happens, like talloc crashing in
talloc_total_blocks() because the compiled code incorrectly fills
msgb_ctx variable in return of msgb_talloc_ctx_init.

Change-Id: I7dab8d18d316632989406a9f22917e00a7fd68bf
2022-01-04 18:51:51 +01:00
Pau Espin a94752e684 tests: Replace deprecated API log_set_print_filename
Change-Id: Ic53a0a9afb8038759bb3ab1d4c5970f23632e84e
2021-02-19 13:19:01 +01:00
Pau Espin 2c6aed38bd tests: Explicitly drop category from log
Let's disable 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.

Change-Id: Ia633cae0a26f294e276b431a82256abb1b57ebba
Related: OS#5034
2021-02-19 13:18:42 +01:00
Pau Espin 4f35665b9f Fix OneDefinitionRule Asan violation in tests and osmo-hnbgw
With new gcc 10.1.0, tests failed at runtime when built with ASAN
enabled, since some global variables where defined multiple times.
See OS#4556 for a sample Asan error.

Fixes: OS#4556
Change-Id: I12a667ea8a9f16404c13c9218b246d2e3acfe3e8
2020-05-19 20:32:58 +00:00
Martin Hauke c593da5d45 tests: Missing return statement
Change-Id: I4fae9f84a83af280846b07eaa139ff4a05784a2e
2020-02-15 23:01:39 +01:00
Neels Hofmeyr c6ed1c3ae8 test_common: fix compiler warning: include ranap_common.h
test_common.c:85:2: warning: implicit declaration of function ‘ranap_set_log_area’

Change-Id: Ice192e1f7f1bdafe0941160f43e573349aaceb75
2017-11-22 03:11:40 +01:00
Neels Hofmeyr d9cb19a8fb tests: sanitize: fix mem leaks, clean after tests
Fix various mem leaks in the testing code.

Add test_common_cleanup() in test_common.c, to free talloc contexts; call in
test-{helpers,hnbap,ranap}.c. Upon talloc ctx cleanup, ensure that they are
actually empty, in order to catch newly introduced mem leaks.

If non-empty, print talloc context reports.

Change-Id: Ic66c005f2a264774e18bb54e58b87bef5944511c
2017-11-22 03:11:40 +01:00
Neels Hofmeyr 0f88c11009 migrate osmo-hnbgw to libosmo-sigtran's SCCP/M3UA
libosmo-sigtran now has a "proper" SCCP/M3UA stack, so we can make our hnb-gw
3GPP compliant by switching from the old SUA code to the new universal SCCP
user API with support for (currently) M3UA and SUA.

Main changes:

Use one cn_link to STP: We will connect to the core network using an (Osmo)STP
instance that routes to MSC and SGSN, so we want one SCCP link instead of two.
The only difference between IuCS and IuPS is a different remote osmo_sccp_addr.

This has various effects through the messaging code; the patch is a bit larger
than I would like, but it is hard to separate out truly independent smaller
changes.

CS or PS domain was previously flagged in the separate cn_link, as ctx pointer
for two separate sccp_sap_up()s. Now there's just one such ctx, so determine
is_ps from the RANAP Domain Indicator, or from the conn's hnbgw_context_map:

- Add is_ps to context_map_alloc_by_hnb().
- To find a matching context, the RUA ID alone is no longer sufficient, also
  match is_ps (possible optimization todo: separate lists).

We would send separate CS or PS Reset messages based on the cn_link, instead
send both CS and PS Reset at the same time for the single cn_link. This could
be adjusted to detect presence of MSC or SGSN instead.

Pending: adjust the VTY config to reflect that there is only one remote
address. Place a TODO comment for that.

Smaller changes:

rua_to_scu(): populate called and calling addresses for N_CONNECT and
N_UNITDATA.

Remove DSUA.

Don't build dummy_cn, which is still implemented on SUA. Mark todo to maybe
re-include it based on M3UA later.

In hnbgw_cnlink, place sccp related items in a separate sub-struct.

Do not keep an llist of cn_links, just have the one. Remove iteration and list
management.

Change jenkins script to build libosmo-sccp master.

Patch-by: hwelte, nhofmeyr
Change-Id: I8ac15fa2fd25bedb26297177e416976a5389b573
2017-07-05 13:04:15 +02:00
Neels Hofmeyr 4ff1a5a957 fix msgb talloc context initialization
Properly initialize msgb talloc context in hnbgw and all tests, using the new
msgb_talloc_ctx_init().

test-ranap.c: since msgb talloc ctx is now in test_common_init(), remove msgb
talloc init here.

Change-Id: I807c799aff1239184728551ed77fdafa73bd683f
2016-10-13 04:17:40 +02:00
Neels Hofmeyr df63de2e37 build: move headers to include/osmocom/*
This came up while fixing 'make distcheck'; this is certainly not the easiest
way but it makes sense to have the headers in include/, like we do in openbsc.

The easy alternative might be to add -I$(top_srcdir)/src to src/Makefile.am.

Remove -I$(top_srcdir)/src from src/tests/Makefile.am, no longer needed.

Change-Id: I5a82e029dcdc4df0a60a31271a4883393fe59234
2016-09-09 06:43:32 +00:00
Neels Hofmeyr 52c6ae25be tests: don't log filename nor color in unit tests
In experr, we had line numbers in log output, which might change. Also, for
make distcheck, the path of the source file might have some '../../' added in
the log output (to indicate the src dir as seen from the build dir).

Fix both by dropping source file and line.

Also drop color while at it.

Change-Id: Ie76384c4176ce0a7d89d093f2efb848fe3f19400
2016-09-09 06:43:30 +00:00
Harald Welte bdf3fd1dc4 don't include hnbgw.h from ranap header files
To use libosmo-ranap from outside of this repository, we need to
eliminated all dependencies to local header files
2016-01-03 17:25:51 +01:00
Harald Welte 87ffeb91dc factor out some common shared test init code 2015-12-25 15:34:22 +01:00