Commit Graph

108 Commits

Author SHA1 Message Date
Neels Hofmeyr 1d7473cf02 handover_test: explicitly wrap abis_rsl_sendmsg()
Until now, handover_test simply defines an abis_rsl_sendmsg() function to
override the one from libosmo-babis. To me this amounts to implicit linker
magic (aka luck).

The common pattern we're using for this scenario is to explicitly wrap an
existing function by instructing the linker. Also do this for
abis_rsl_sendmsg() in handover_test.c to clarify.

Change-Id: I05ce33a4e42bc82b9ce5060e2f811033f5a1f8d8
2018-03-08 20:21:55 +00:00
Neels Hofmeyr f93970b167 implement support for 3-digit MNC with leading zeros
Add 3-digit flags and use the new RAI and LAI API from libosmocore throughout
the code base to be able to handle an MNC < 100 that has three digits (leading
zeros).

The changes to abis_test and gsm0408_test show that this code now handles
3-digit MNC correctly, by not dropping the leading zero as 0xf in the encoded
PLMN.

Re-implement CTRL commands 'mcc', 'mnc' and 'mcc-mnc-apply' to preserve the
presence of the third digit of the MNC. Always reply with all leading zeros.
Adjust the expected results in ctrl_test_runner.py, to show that it works.

In VTY and CTRL, the parsing of MCC and MNC is inherently made stricter by use
of osmo_{mcc,mnc}_from_str() -- they will no longer allow surplus characters
and detect errno returned by strtol() (in contrast to atoi()).

Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore),
	 Ib7176b1d65a03b76f41f94bc9d3293a8a07d24c6 (libosmocore),
	 I020a4f11791c61742a3d795f782805f7b7e8733e (libosmocore)
Change-Id: I8e722103344186fde118b26d8353db95a4581daa
2018-03-07 15:34:48 +00:00
Neels Hofmeyr f7a6329bbd cosmetic: bsc_network_init(): imply default 001-01 PLMN
All callers pass mcc=1, mnc=1, so just have it as default.
(Prepare for net->country_code etc to be replaced by net->plmn)

Change-Id: Ic16bc0bab3f2d4721e86a1a04f9d9f988d777df2
2018-03-05 05:37:54 +01:00
Neels Hofmeyr 4d358c00e1 gsm48_ra_id_by_bts(): struct gsm48_ra_id* instead of buf
Move from using deprecated gsm48_construct_ra(), which uses a buf, to
gsm48_encode_ra(), which uses a gsm48_ra_id argument. Pass struct gsm48_ra_id
around instead of a buf.

struct gsm48_ra_id is the "encoded" representation of the bytes in a typical
MCC-MNC-LAC-RAC (04.08 Routing Area Id IE, 3GPP TS 24.008 § 10.5.5.15). Using
the struct spares using magic numbers for byte offsets.

In the process, fix a sanitizer warning for unaligned access by using memcpy()
instead of pointer assignment:

  osmo-bsc/src/libbsc/abis_nm.c:2857:27: runtime error: store to misaligned address 0x7ffe8e0d6695 for type 'uint16_t', which requires 2 byte alignment

Note that (besides removing a now unnecessary cast) the gsm0408_test and
abis_test tests of RAI / CGI encoding remain stable, which indicates that the
new code is still correct.

Change-Id: I0d3908fb8ca1e2e669d257b5d59b40675fa85d06
2018-03-05 05:35:54 +01:00
Neels Hofmeyr 7cdd069b7a ctrl_test_runner: add tests for 3-digit MNC
Expand MCC-MNC test cases: show that the CTRL interface currently does not
preserve the third digit of the MNC if it is zero. These will be fixed by
I8e722103344186fde118b26d8353db95a4581daa

Change-Id: I5b097dbb6329f284e3b4914a744d5c3ad628f715
2018-03-05 05:32:23 +01:00
Neels Hofmeyr 27dd53df8f add test for abis_nm_ipaccess_cgi()
Change-Id: I90fefd5073ee07fc975a810859a32142b8b27904
2018-03-05 00:59:44 +01:00
Neels Hofmeyr a05360c9e1 add test for gsm48_ra_id_by_bts()
Change-Id: I7bd55126848ed2c246d64cf672e1e6772da64be7
2018-03-05 00:59:44 +01:00
Harald Welte 5d22458169 osmo-bts/nanobts: Set RACH_Busy Threshold to -90 dBm
In the past we used to set this to "-10 dBm" which means that basically
no RACH ever passed that treshold and in the associated CCCH LOAD IND
the number of busy slots was always zero.

Let's set the default to -90dBm.  The user can of course always
configure a different value in the VTY.

This means that now any RACH slot signal level >= 90 dBm counts as
"busy" in those CCCH LOAD IND (RACH).

Change-Id: Ib9cbb786d19acc74f0951930b0dc9284854c6000
Closes: OS#3004
Related: OS#3003
2018-02-27 10:09:43 +01:00
Neels Hofmeyr 00727558a9 HO: fix minor issues found by coverity
handover_decision_2:
- lchan->conn should never be NULL, but if it is, don't crash in LOGPHO*
  macros.
- make certain to avoid modulo-zero. It's cosmetic since that config item is
  not allowed to be zero.

handover_test:
- check return value of gsm_generate_si().
- safer evaluation of main()'s argv.

Fixes: CID#182929, CID#182928, CID#182927, CID#182926
Change-Id: I68e8ed3a1e8659edb47ac3e8a10508f17a3f5670
2018-02-21 14:40:16 +01:00
Stefan Sperling fd7b51eac7 fix handover_test link error
Fix undefined references during link stage when building handover_test.
The archive libbsc.a needs to be listed before the various .so files.

Change-Id: Ie7e1d4815d72b8e0bbc6ccd68078a78de19d73b0
2018-02-20 14:37:13 +01:00
Neels Hofmeyr bedbef4ba2 HO: vty: clearly mark 'handover foo' as legacy alias for 'handover1 foo'
The ALIAS_DEPRECATED causes the legacy commands to no longer show up in the
command listing, hence making it more clear which commands are general and
which are for hodec1 only:

== BEFORE: ==

OsmoBSC(config-net)# list
  ...
  handover (0|1|default)
  handover algorithm (1|2|default)
  handover1 window rxlev averaging (<1-10>|default)
  ...
  handover2 window rxlev averaging (<1-10>|default)
  ...
  handover2 retries (<0-9>|default)
  handover window rxlev averaging (<1-10>|default)          <-- legacy
  handover window rxqual averaging (<1-10>|default)
  handover window rxlev neighbor averaging (<1-10>|default)
  handover power budget interval (<1-99>|default)
  handover power budget hysteresis (<0-999>|default)
  handover maximum distance (<0-9999>|default)
  handover2 congestion-check (disabled|<1-999>|now)

OsmoBSC(config-net)# handover ?
  0          Disable in-call handover
  1          Enable in-call handover
  default    Enable/disable handover: Use default (0), remove explicit setting on this node
  algorithm  Choose algorithm for handover decision
  window     Measurement averaging settings                 <-- legacy
  power      Neighbor cell power triggering
  maximum    Maximum Timing-Advance value (i.e. MS distance) before triggering HO

OsmoBSC(config-net)# handover?
  handover  Handover general config                         <-- unchanged

== AFTER: ==

OsmoBSC(config-net)# list
  ...
  handover (0|1|default)
  handover algorithm (1|2|default)
  handover1 window rxlev averaging (<1-10>|default)
  ...
  handover2 window rxlev averaging (<1-10>|default)
  ...
  handover2 retries (<0-9>|default)
  handover2 congestion-check (disabled|<1-999>|now)      <-- no more legacy

OsmoBSC(config-net)# handover ?
  0          Disable in-call handover
  1          Enable in-call handover
  default    Enable/disable handover: Use default (0), remove explicit setting on this node
  algorithm  Choose algorithm for handover decision
                                                         <-- no more legacy

OsmoBSC(config-net)# handover?
  handover  Handover general config                      <-- unchanged

The "Legacy" doc string actually never shows on the VTY console, but it will
show in the reference manual.

(Even with ALIAS(), a 'handover?' would only show the "Handover general config"
doc string, so no loss there from using ALIAS_DEPRECATED().)

Change-Id: I86be674d82242f9ca73a4d0040015c1c79f2422d
2018-02-19 19:01:13 +01:00
Neels Hofmeyr 444f9e2bb0 HO: vty: rename ho decision 1 vty to 'handover1' with 'handover' alias
Handover decision 2 arguments are now configured by 'handover2 foo'. To match
that scheme, rename the previously 'handover foo' args for handover decision 1
to 'handover1 foo'.

For backwards compatibility, still provide aliases of the original VTY
commands. Writing back the config will result in 'handover1' though.

Change-Id: I7305ae7c04cc70082cd80d42b2ba32ffa399f51a
2018-02-19 17:11:47 +01:00
Neels Hofmeyr 909e972787 HO: Implement load based handover, as handover_decision_2.c
Change-Id: Ie597eae82722baf32546331e443dd9d94f1f25e6
2018-02-19 17:11:47 +01:00
Neels Hofmeyr dd42eb9f90 HO: cfg: separate hodec1 from hodec2 parameters
Do not share config items between the current handover decision and the
upcoming handover_decision_2.

Rename current handover config items to hodec2_* and duplicate the ones
relevant to handover decision algorithm 1 with name prefix of hodec1_*.

I considered moving hodec2 parameters to an entirely separate .c file and
struct, but that causes considerable code bloat. Rather use the nice
handover_cfg net/bts level mechanism as-is, and simply prefix the names.

In the VTY, the hodec1 parameters are configurable by 'handover foo 23'
commands, while the hodec2 parameters are by 'handover2 foo 23'. The generic
VTY commands to enable/disable handover and to choose the algorithm are still
'handover (0|1)' and 'handover algorithm (1|2)'.

(Note, a subsequent commit will rename the 'handover foo' for hodec1 to
'handover1 foo' and add backwards-compat aliases.)

For example, the 'window rxlev averaging 5' command now exists both for
handover decision 1 and handover decision 2, and its values are independent.
This is valid config:

    network
     # set up handover decision algorithm 1
     # (pending rename of these items to 'handover1 ...')
     handover window rxlev averaging 5
     handover window rxlev neighbor averaging 5

     # set up handover decision algorithm 2
     handover2 window rxlev averaging 7
     handover2 window rxlev neighbor averaging 7
     handover2 penalty-time max-distance 10

     # enable handover
     handover 1

     bts 0
      handover algorithm 1
     bts 1
      handover algorithm 2

In this example, bts 0 uses algo 1 with rxlev averaging of 5, while bts 1 uses
algorithm 2 where rxlev averaging of 7 is in effect.

Change-Id: I6475b2543b18d21710a6d774b214cb484f36ec8e
2018-02-19 15:51:17 +00:00
Harald Welte 86a8031e9c logging: Remove obsolete log categories
About half of our log categories/subsystems were inherited from
OsmoNITB, and are no longer used but may confuse the user.

Change-Id: I8b39429f71c0faefdf8158a82093cfb19f44809e
2018-02-19 10:47:50 +01:00
Harald Welte 519c7e1d42 Structural reform: Get rid of osmo_bsc_sccp_con
There was always a 1:1 correspondence between gsm_subscriber_connection
and osmo_bsc_sccp_con, so there's really no point in having two separate
dynamically allocated data structures with pointers back and forth and
another linked list around.

Let's merge osmo_bsc_sccp_con into gsm_subscriber_connection for
simplicity.

The resulting code might not be elegant in places, but I've tried to
do only the most simple changes in this patch, while further
simplifications can be done in later subsequent patches.

As a side-effect, this patch also fixes lchan clearing if the MSC
(or the local SCCP provider) hard-disconnects the SCCP connection.

Change-Id: Idd2b733477ee90d24dec369755a00f1c39c93f39
2018-02-19 08:20:35 +00:00
Neels Hofmeyr d23ce86c25 drop libcommon-cs completely
Change-Id: I07d4a48af3154ee4d904686f230a51b8b8a94ff9
2018-02-14 12:55:45 +01:00
Neels Hofmeyr 421059a2c0 drop libcommon completely, move remaining files to libbsc
Move gsm_data.c and handover_cfg.c to libbsc, where they belong.

This leaves libcommon utterly empty, drop it.

Change-Id: I6178061fa30c7e1a4c22c29d3c8f508b1033569f
2018-02-14 12:54:38 +01:00
Neels Hofmeyr 104851632d libcommon: join gsm_data_shared.* into gsm_data.*
The separation of gsm_data_shared.* from gsm_data.* historically allowed
compiling parts of it into osmo-bts, which we have dropped since (osmo-bts has
its own copy now). Even though gsm_data.* now becomes rather large by it,
remove the legacy separation to get rid of the "shared" naming, which is no
longer meaningful. A future patch might separate into meaningful smaller bits,
if we get the time.

Change-Id: Ie247bc492efb331871d970c56700595ad3f7e201
2018-02-14 12:15:40 +01:00
Neels Hofmeyr 7997bf4bed libcommon: eliminate debug.c
Provide concise log categories for each main scope.

Move the complete log categories 1:1 to osmo_bsc_main.c.

In bsc_nat.c, omit obviously unused log categories.

In tests, omit almost all log categories, except for those explicitly tested as
the expected output.

Note: should any logging occur for a log category that is omitted by accident,
such will end up being logged as DLGLOBAL, so it will show up and we can fix
it, and it will not get lost silently.

Change-Id: Ib524e49ec211662e0dfde8161495a72aa8ad76cf
2018-02-14 12:15:40 +01:00
Stefan Sperling 6cee893a0f Make "waiting indicator" of IMMEDIATE ASSIGN REJECT dynamic.
The IMMEDIATE ASSIGN REJECT message contains a wait indicator which
tells an MS requesting a channel to wait for a specified amount of
time before trying to request a channel again, i.e. the wait indicator
controls the T3122 timeout value in the MS.

Previously, the wait indicator was fixed to 10 seconds.
This is not sufficient if there are a lot of MS requesting channels
because the MS will retry too soon. Instead of using a fixed value,
maintain a dynamic wait indicator value based on average channel load.

The load (used vs. available channels on a BTS) is sampled once per
second, and once 8 samples have been collected we update a BTS-specific
T3122 wait indicator based on the measured load.

While the wait indicator could go up to 255 seconds, this initial
implementation keeps it in the range from 10 to 128 seconds.

Further experimentation and testing will show whether higher wait
indicator values are desirable, if the sampling rate needs to change,
or if the function mapping the load measurement to a wait indicator
value should change (currently we map the load average linearly into
the range [10, 128] inclusive).

Change-Id: I57e38f6d6ba3b23cc6e1f9520b90261dbb1f1cec
Related: OS#2592
2018-02-05 13:58:17 +01:00
Harald Welte b794887cab remove obsolete gsm_subscriber_connection.bts member
This member was merely a cache for conn->lchan->ts->trx->bts,
so let's avoid having to keep copies of the same data (which needs
to be kept up to date).

Change-Id: Id3bff8b18425ef5d45eb460ac9eb620023013ba0
2018-01-28 03:23:00 +01:00
Stefan Sperling 56dd9815eb Improve an error message in page_lai_and_lac()
This error message is now contained in a loop, and the current iteration
does not know whether paging will fail entirely or if later iterations
will succeed. Update the error message accordingly.
This also makes the error message consistent with the one in page_cgi().

Change-Id: I8ec229702343343dedcbb242b6d0ed170c858511
2018-01-26 02:29:32 +00:00
Neels Hofmeyr 87b5eb667b HO: add handover algo 2 parameters; skip HO 1 if HO 2 is configured
Change-Id: I8811ee8a75be09048042b511ee4bd9bc1de63976
2018-01-19 16:03:16 +01:00
Andreas Eversberg 30b6df607e Correctly set T3105 for ipaccess BTS type
The given value is 10 * ms, so 13 is used instead of 128.

If T3105 is set at config to something greater 0, it is used instead of
the default value.

Adjusst nanobts_omlattr_test.c accordingly.

Change-Id: I3d9687619ba4de35f5d2eff3026d903534b2bbd4
2018-01-19 16:03:16 +01:00
Neels Hofmeyr e25018b8c1 HO prep: introduce per-BTS handover config, with defaults on net node
It is desirable to allow configuring handover for each individual network cell.
At the same time, it is desirable to set global defaults.

Treat the 'network' node handover parameters as global defaults, add another
set of parameters for each individual BTS.

This raises questions on how the 'network' node should affect the individual
BTS. The simplistic solution would have been: on creating a BTS in the config,
just copy the current defaults; with serious drawbacks:
- tweaking any parameter in the telnet VTY on network node will never affect
  any running BTS.
- network node defaults *must* be issued before the bts sections in the config
  file.
- when writing a config back to file, we would copy all net node defaults to
  each BTS node, making the network node configs pointless.

Instead, add a handover_cfg API that tracks whether a given node has a value
set or not. A bts node ho_cfg gets a pointer to the network node config and
returns those values if locally unset. If no value is set on any node, use the
"factory" defaults, which are hardcoded in the API. Only write back exactly
those config items that were actually issued in a config file / on the telnet
VTY. (ho_cfg API wise, we could trivially add another ho_cfg level per TRX if
we so desire in the future.)

Implement ho parameters as an opaque config struct with getters and setters to
ensure the tracking is always heeded. Opaqueness dictates allocating instead of
direct embedding in gsm_network and gsm_bts structs, ctx is gsm_net / bts.

This is 100% backwards compatible to
old configs.
- No VTY command syntax changes (only the online help).
- If a 'bts' sets nothing, it will use the 'network' defaults.
- The 'show network' output only changes in presence of individual BTS configs.

On 'show network', say "Handover: On|Off" as before, iff all BTS reflect
identical behavior. Otherwise, output BTS counts of handover being enabled or
not.

Use the same set of VTY commands (same VTY cmd syntax as before) on network and
BTS nodes, i.e. don't duplicate VTY code. From the current vty->node, figure
out which ho_cfg to modify.

For linking, add handover_cfg.c (the value API) in libcommon, while the
handover_vty.c is in libbsc. This is mainly because some utility programs use
gsm_network and hence suck in the ho stuff, but don't need the VTY commands.

Review the VTY online help strings.

Add VTY transcript test for handover options, testing config propagation from
network to bts nodes, 'show network' output and VTY online help strings.
(Needs recent addition of '... !' wildcard to osmo_interact_common.py.)

I considered leaving parts of this more readable, but in the end decided for
heavy use of macros to define and declare the API, because more values will be
added in upcoming patches and I want to prevent myself from messing them up.

Inspired-by: jolly/new_handover branch, which moves the config to 'bts' level
Depends: I7c1ebb2e7f059047903a53de26a0ec1ce7fa9b98 (osmo-python-tests)
Change-Id: I79d35f6d3c0fbee67904378ad7f216df34fde79a
2018-01-19 16:03:16 +01:00
Stefan Sperling 714c2f9552 Move BTS selection for paging from osmo_bsc_grace.c into osmo_bsc_bssap.c.
We can now either page an invidual BTS directly or page several BTS in a
given location area. This decision is taken based on the contents of the
cell identifier list in the paging request. Select a set of BTS for paging
while processing the cell identifier list, rather than requiring the
paging layer to loop over all BTS in the MSC.

This change requires some adjustment in bssap_test. In particular,
this test must now add a BTS to its network in order to pass.

The purpose of this change is to make the layering a bit cleaner.
There is one functional change: We no longer abort paging if paging fails
for a particular BTS. Instead, we keep trying to page on other BTS.

Change-Id: Ic1c72c7f83e53988eb9fedf314b1dc459836833d
Suggested-by: Harald Welte
Depends: Ic7772e75c3d7fb0df6e17e118bb33b3248352d4d
Related: OS#2753
2018-01-16 14:14:01 +01:00
Harald Welte 74b8cdb8e9 Make libcommon, libcommon-cs, libfilter, utils depend on mgcp/sigtran
The stow-enabled jenkins builds are currently failing like below:

make[3]: Entering directory '/build/src/libcommon'
  CC       bsc_version.o
  CC       common_vty.o
  CC       debug.o
  CC       gsm_data.o
In file included from debug.c:34:0:
../../include/osmocom/bsc/gsm_data.h:15:38: fatal error: osmocom/sigtran/sccp_sap.h: No such file or directory
 #include <osmocom/sigtran/sccp_sap.h>
                                      ^
compilation terminated.
In file included from common_vty.c:27:0:
../../include/osmocom/bsc/gsm_data.h:15:38: fatal error: osmocom/sigtran/sccp_sap.h: No such file or directory
 #include <osmocom/sigtran/sccp_sap.h>
                                      ^
compilation terminated.
In file included from gsm_data.c:37:0:
../../include/osmocom/bsc/gsm_data.h:15:38: fatal error: osmocom/sigtran/sccp_sap.h: No such file or directory
 #include <osmocom/sigtran/sccp_sap.h>
                                      ^
compilation terminated.

Let's make sure the common gsm_data.h have all required CFLAGS to compile.

Change-Id: I30b75db6ffba227b05b5413b84b15f69e0c213f2
2018-01-15 20:14:01 +01:00
Stefan Sperling 33e9009003 Implement support for paging by LAI.
Also, parse the complete cell identifier list for both LAC and LAI.

Change-Id: Ic3c62ff0fccea586794ea4b3c275a0685cc9326e
Related: OS#2751
2018-01-11 12:50:07 +00:00
Max ad1e3cdd6c Migrate from OpenSSL to osmo_get_rand_id()
This avoids potential licensing incompatibility and makes integration of
Debian packaging patches easier.

The libosmocore version requirements are fine already but for jenkins
tests to pass we have to have Ic77866ce65acf524b768882c751a4f9c0635740b
merged into libosmocore master.

Change-Id: Ia57bf1300525cf3c247284fe966b1c415c2d53e2
Related: OS#1694
2017-12-27 11:10:59 +00:00
Harald Welte 9f7b1955d1 bsc_test.c: Use proper network/bts/lchan structures
don't mock them, simply call the respective functions to get
a gsm_network and a gsm_bts with all its subordinate members.

Change-Id: I8bdf009d3c7e2473dd42da02762039a19430d6ce
2017-12-23 00:14:53 +01:00
Harald Welte e94d7d1bdf remove libosmo-sccp dependency for osmo-bsc
libosmo-sccp is the old sccp-lite-focused SCCP implementation that we
used before libosmo-sigtran was created.  The new osmo-bsc in this
repository is using libosmo-sigtran and shouldn't be using parts of
libosmo-sccp anymore.

We only keep it around in configure.ac and Makefile.am for osmo-bsc_nat,
which is not even built in this repository anymore (or 'again yet'?)

Change-Id: I8f274be7d196cd7a5b1ec9ada949130fb06e984d
2017-12-19 17:53:14 +00:00
Harald Welte d9956d91ba Remove dead code left over from NITB split
There still is a lot of dead code that we inherited from the NITB
days, let's remove more of it.

libtrau will be re-introduced as part of osmo-mgw later.

Change-Id: I8e0af56a158f25a4f1384d667c03eb20e72df5b8
2017-12-19 17:53:13 +00:00
Max f8dc526207 Remove unneeded .py scripts
The ipa.py has been moved to osmo-python-tests as osmo_ipa - use it for
vty and ctrl tests instead of local copy. The soap.py and twisted_ipa.py
are not BSC-specific: leftovers from repository split which are now
available in osmo-python-tests as well.

Change-Id: Ia4285b18b152b070c148228604d1e61a8adedba1
2017-12-19 18:08:46 +01:00
Max 4ab7268a90 Fix tests after rate_ctr change
Recent change lin libosmocore disallow registering rate_ctr with the
same name and indexing multiple times. To accommodate to this:

* allocate network struct once and use it for all tests
* deregister rate_ctr group after each test
* free bts struct after each test

Related: OS#2757
Change-Id: Ie1537a1ee9ee812eaaf9f58dc4bc86d4add8c31f
2017-12-18 22:13:36 +01:00
Max 61b0c30cca Generate SI2bis Rest Octets
According to the spec it's an empty 1-byte element reserved for future
extension but we still have to generate padding properly. Add stub
function similar to the used for SI2ter and adjust test output
accordingly.

Related: OS#2711
Change-Id: I3c278c57880a173df3c4648c9724339d23ce94fd
2017-12-12 18:00:56 +00:00
Max 4bd710d107 Generate SI2ter Rest Octets
Previously we simply omitted SI2ter Rest Octets which is spec violation
which lead to 'Malformed Packet' error in Wireshark RSL dissector. Fix
this by generating empty 'no rest octets' with proper padding. Adjust
test output accordingly.

Change-Id: Ie4419aaaf93a462f501f8d8f7bf2677d37c58f94
Fixes: OS#2711
2017-12-11 12:27:49 +01:00
Max 115e2672fe OML: expand status reporting checks
* check GPRS state: if GPRS is enabled for the BTS but NSE, CELL or both
  NSVC are locked than report it as degraded
* check TRX usability: use already available function to check that TRX
  is actually usable when reporting OML status via CTRL
* fix tests linking: libbsc is using gsm48_create_mm_serv_rej() which is
  defined in libcommon-cs but neither libbsc itself nor tests using it
  are actually linked against libcommon-cs

Related: OS#2486
Change-Id: I9dce1d3b0cabe149a90cfca58a3fe55f8d6a72bc
2017-12-10 14:18:41 +00:00
Pau Espin 7e78681f0f tests: Fix selection of python version
According to documentation (and personal experience), AM_PATH_PYTHON
selects the highest version of python, no matter if major version is
different, which means if both python2 and 3 are available, 3 will be
chosen an PYTHON will point to "/.../python" which is python3. Apparently,
the macro cannot be easily used to pick highest python2 version.

As {vty,ctrl}_test_runner.py require python2 and are incompatible with
python3, let's instead rely on the system having a "python2" binary
available, which is the case in most distros.

Change-Id: Id22e157d1bee453babdfa7ed04c506390b0f17bb
2017-11-24 12:55:15 +01:00
Neels Hofmeyr 6a12c76196 fix build: bssap test broke by undefined references
After the bssap test in Ie934c5d229140a89763bf2efff86d6a3766cd351, the
subsequent commit Ia2882b7ca31a3219c676986e85045fa08a425d7a was not tested
against the latest head, and its breaking bssap_test was not caught.

Fix current master of osmo-bsc's 'make check' target: add osmo_bsc_mgcp.c and
libosmo-mgcp-client dependencies to bssap_test linkage.

Change-Id: I28719d267452f66d65581c43433e24a9f46cf7dc
2017-11-07 23:02:08 +01:00
Neels Hofmeyr 9eb208fcfb bssap: paging: page entire BSS for unimplemented cell id list
3GPP TS § 08.08 defines various types of Cell Identifier List IEs, but we only
implement "entire BSS" and "one LAC". If the MSC sends a Cell Identifier List
that we don't implement, it is best for interoperability to page the entire BSS
and post a log message instead of rejecting the paging altogether. Apart from
resource management, it is not harmful to page more than the MSC requested; if
use of resources becomes an issue, the log message will guide towards the
solution of providing an actually implemented Cell Identifier List IE.

Upon IE length that is other than we expect, log the error, but also fall back
to paging the entire BSS. Overall message length correctness has been checked
earlier.

The particular case observed is that a Huwaei MSC sends a LAI for Cell
Identifier List (MCC+MNC in bcd, followed by a LAC), parsing of which we may
want to add later.

Improve logging: identify the subscriber that is being paged.

Coding style: use a switch() statement to clarify flow and provide a place to
add more implementations later.

Add regression test bssap_test.c: fabricates BSSAP Paging messages with the two
implemented Cell Identifier List IEs as well as the unimplemented LAI
identifier, verify the resulting paging LAC in wrapped function and stderr.

Change-Id: Ie934c5d229140a89763bf2efff86d6a3766cd351
2017-11-07 04:08:44 +01:00
Harald Welte f2b04c65f4 nanobts_omlattra_test: Initialize logging before executing tests
... the library code we call could want to log something, after all.

Change-Id: Ic01e9bfb63d7b6def9432103e744c23c90f0f6b9
2017-10-24 18:10:33 +02:00
Harald Welte 824b27452f Fix nanobts_omlattr unit test
The test clearly fails unless bts->network is set correctly.  Not sure
why this hasn't shown up before?

Change-Id: I47786ed06ff610213d7a0b56d0ebf1c537cd7568
2017-10-24 18:10:33 +02:00
Max 39999a7dcf SI1q: fix EARFCN appender
Previously if we ran out of space while adding EARFCN, we simply return
which might result in malformed SI2q. Fix it by proper rollback of
entire EARFCN. While at it, let's be paranoid and introduce extra checks
against integer overflow in budget calculations.

Change-Id: I4b2aa3825e9affb6dfeadecdf24dd1a43a92b7b7
Related: OS#2357
2017-10-11 01:28:50 +00:00
Max 7d73cc797a SI2q: fix generation for multiple UARFCNs
* fix insert routine to keep the list sorted by UARFCN
* fix rest octets generator to properly account for offset
* adjust test results accordingly

Change-Id: I443c5c5f937b490578354f3c8a0c5b92629f2794
Related: OS#2357
2017-10-10 11:39:31 +00:00
Max 918cfeb787 Fix repo split aftermath
* remove checks for non-existent tests
* always enable bsc and nat-trie tests because both are built
  unconditionally
* enable gsm0408 test which was removed by mistake
* adjust gsm0408 test output to remove SMS-related results

Change-Id: I73ad079a6333ba56e73b7c4d1d0e9c8255c2a03b
Related: OS#2257
2017-10-02 08:38:34 +00:00
Harald Welte 14f9772f14 gsm0408_test: Verify that BA-IND is 0 in SI2xxx and 1 in SI5xxx
This adds a test case to explicitly verify the BA-IND is as expected
by the behaviour introduced in Change-Id I1cd0dc51026dcd0e508e63eea4e333e6b184787a

Related: OS#2525
Change-Id: I3e5b260af97ce96a221e4d51f6c1b41d58817a59
2017-10-01 11:27:38 +08:00
Harald Welte aa70d9d828 Make sure BA-IND in all SI2xxx is '0' and in all SI5xxx is '1'
In masurement reports sent by the MS, this can then be used to correlate
if a given measurement report was in response to a BCCH/neighbor list
received on BCCH (SI2xxx) or on dowlink SACCH (SI5xxx).

Closes: OS#2525
Change-Id: I1cd0dc51026dcd0e508e63eea4e333e6b184787a
2017-10-01 11:26:28 +08:00
Pau Espin 00c22464a0 Remove unneeded dbi dependency
Most probably a leftover from openbsc git

Change-Id: I230564b6a6ad244ec6328a99a1c3dbd9bc5521ae
2017-09-26 16:10:22 +02:00
Max 9cc704424a Further cleanup leftovers from BSC/MSC split
* drop unused header
* fix name of jenkins test
* remove dead code

Change-Id: I986904864741995910b6ba92173b9f7b1b03e2f1
2017-09-25 08:25:15 +00:00