Commit Graph

39 Commits

Author SHA1 Message Date
Harald Welte b75bbf89c4 RSL_Emulation: Fix compiler warning about dead code
RSL_Emulation.ttcn: In TTCN-3 module `RSL_Emulation':
 RSL_Emulation.ttcn:478.1-713.1: In function definition `main':
  RSL_Emulation.ttcn:500.2-712.2: In while statement:
   RSL_Emulation.ttcn:501.3-711.3: In alt construct:
    RSL_Emulation.ttcn:695.4-28: In function instance:
     RSL_Emulation.ttcn:725.9-744.1: In function definition `f_WaitingQueue_dispatch':
      RSL_Emulation.ttcn:729.2-740.2: In for statement:
       RSL_Emulation.ttcn:732.3-736.3: In if statement:
        RSL_Emulation.ttcn:735.4-8: warning: Control never reaches this statement

Change-Id: I1e080a8543a9f26b45b345e47881b6f6d4c9b362
2020-08-21 12:39:40 +02:00
Pau Espin abcdf78892 library/RSL: pass lost link event to upper layers instead of failing
Some tests may expect that behavior so let the test decide what to do
with it.

Change-Id: Idd4bdfc99514f4c439837f0ce4a20ec5ff45e86c
2020-06-25 09:25:20 +00:00
Pau Espin 709650980a library/RSL: fix trailing whitespace
Change-Id: I84b23fef3a75dcd6d86855408adcb41142da3407
2020-06-23 14:30:13 +02:00
Vadim Yanitskiy e9c0635dae library/RSL_Emulation: implement waiting queue for DChan messages
Since change [1] has been merged, we see multiple regressions in
ttcn3-bsc-test (all LCLS test cases) and ttcn3-bsc-test-sccplite
(sporadic failures). In all failed cases, the reason is similar:

  RSL for unknown Dchan
      BSC_Tests.ttcn:4501 BSC_Tests control part
      BSC_Tests.ttcn:2176 TC_assignment_codec_fr testcase

The mentioned change enables TCP_NODELAY option for all IPA based
connections, including both OML and RSL. This option disables
Nagle's algorithm [2], so we get less delays on IPA based links.

It took me a lot of time to investigate, and finally, I figured
out what is actually causing those regressions. The TCP_NODELAY
itself is not a problem, of course. As it turned out, the
problem is here, in our TTCN-3 test case framework.

Each test case involves several components (actors) running in parallel.
One of them is RSL_Emulation_CT, which is responsible for handling and
routing of RSL messages between the connected components.

A test case may register dedicated channel handlers by calling
f_rslem_register(), so DCHAN/RLL/IPACCESS messages will be matched
by RslChannelNr/TrxNr and routed to the corresponding one.

If no handler is found for a given RSL message, the RSL_Emulation_CT
would abort the test case execution. And that's where the problem is.

Given that all components are running in parallel, it may happen
that a received RSL message would be processed by the RSL emulation
component faster than the test case would call f_rslem_register().
The test case would be aborted due to "RSL for unknown Dchan".

Speaking in context of the failing BSC test cases, a test case
calls f_rslem_register() on receipt of an Assignment Command as
it contains all the assignment parameters. After that we expect
to receive an RSL ip.access CRCX for that channel.

The problem is that both Assignment Command and ip.access CRCX
messages are sent by the BSC simultaneously, so the later may
be handled faster than the first one. Race condition!

Let's work this around by maintaining a waiting queue, where the
messages, for which no handler was found, will be kept until the
corresponding dedicated channel is registered.

This is an optional feature that needs to be enabled explicitly
by calling f_rslem_dchan_queue_enable(), and then explicitly
disabled by calling f_rslem_dchan_queue_disable().

If at the moment of calling f_rslem_dchan_queue_disable() the
waiting queue is not empty, e.g. because the IUT sent us more
messages than we expected, test execution will be terminated.

The actial fix for the LCLS test cases will be submitted next.

[1] Ia3d4c41bf0659e682f0b7ae5f3d58ed0f28edb58
[2] https://en.wikipedia.org/wiki/Nagle%27s_algorithm

Change-Id: I25e10e28de174337233e6a3bb32cc16f2d7d614e
Related: OS#4619
2020-06-21 20:46:49 +00:00
Vadim Yanitskiy a38c26595f library/RSL_Emulation: fix comment near f_rslem_suspend()
Change-Id: If6487065329a4fc44275999de1972f76ded06562
2020-06-21 20:46:49 +00:00
Neels Hofmeyr d7eabd6ce6 RSL_Emulation: fix rx of tr_RSL_PAGING_CMD()
For tr_RSL_PAGING_CMD, also check comp_ref against null.

Upon receiving a tr_RSL_PAGING_CMD, the code tries to dispatch the Paging
Command to all valid clients. However, the ConnectionTable[*].comp_ref is
*always* present, and actually null for unconnected clients.
So, before this patch, a Paging Command from osmo-bsc gets sent to a null
client, which disconnects the RSL emulation and aborts the test.

There is currently no test using this, but the upcoming MSC pool tests will:
see I21cbab193cd0de2e5692665442eae113d5f61904.

Change-Id: Iaf7730153a3a19e448a33298c3e12212a55929d5
2020-06-17 01:01:13 +02:00
Vadim Yanitskiy 82af0b53d4 library/RSL_Emulation: optional IPA stream ID patching
Unfortunately, the latest release of osmo-bts still has a bug,
that has been fixed [1] in the recent master. Because of that,
most of the test cases in ttcn3-bts-test-latest currently fail.

The problem is that all transceivers use IPAC_PROTO_RSL_TRX0,
regardless of what the BSC tells them to use. Let's work this
around by patching IPA stream ID in ASP_RSL_Unitdata messages
coming from the IPA emulation.

[1] I5927f59a49724170a63e87be604973f7c9d5d8be

Change-Id: I66cecc9ea24ba79e1a03492e3fda2874951d37a0
2020-06-09 20:28:44 +07:00
Vadim Yanitskiy f79d936b9a library/RSL_Emulation: cosmetic: improve logging messages
Change-Id: Iefb6bc96e57822e216f8d8480337e6b4afc4d892
2020-06-05 21:06:27 +07:00
Vadim Yanitskiy 6de2fcbfe9 library/RSL_Emulation: server mode: handle multiple transceivers
Since change [1], the IPA emulation component allows us to handle
multiple IPA connections, thus multiple RSL connections. The idea
is to attach a TCP/IP connection identifier to each message.

On top of that, this change implements mapping between TCP/IP
connection identifiers and RSL stream identifiers, so we can
finally talk to any of connected transceivers (up to 4 for now),
not only the last connected one (as it was before). The actual
mapping is done during the IPA identification procedure.

Instead of forwarding ASP_IPA_EVENT_UP to a test case, the RSL
emulation component now sends a new event - RSLEM_EV_TRX_UP,
with transceiver number (actually, IPA stream-id) attached.

[1] I93c58c08cf296e5cea81d811650caa1a09b8a579

Change-Id: I86afb55ecc6703ce7a229aaa626223f9331a4778
Related: OS#4546
2020-05-26 20:57:00 +07:00
Vadim Yanitskiy a60e5cffa4 library/RSL_Emulation: fixup: handle RSL messages from any TRX
As a side effect of change [1], the RSL emulation component has
stopped to handle RSL messages from transceivers other than
TRX#0. Let's fix this by using template '?' for stream ID.

[1] I4c4a98458cfa33512db661b5435f484a38e2ef4f

Change-Id: I5ff05bbd985ddc5e39a390e4b775a16f066a53ea
2020-05-26 17:51:19 +07:00
Vadim Yanitskiy efc9413afc library/RSL_Emulation: fix comments near f_cid_{create,delete}_cnr()
Change-Id: I0fde6ea9c7e549d9cf9f6ce2a8e4e702df313b27
2020-05-25 22:14:04 +07:00
Vadim Yanitskiy a2c12c9c4e library/RSL_Emulation: use existing tr_ASP_RSL_UD template
Change-Id: I4c4a98458cfa33512db661b5435f484a38e2ef4f
2020-05-25 22:14:04 +07:00
Vadim Yanitskiy 9b4e356886 library/IPA_Emulation: assume TRX#0 in ASP_RSL_Unitdata templates
Change-Id: I93297680a2644516870222c2bb8eee03c6b575a9
2020-05-25 22:14:04 +07:00
Vadim Yanitskiy a2afacc905 library/IPA: use tr_ASP_IPA_EV instead of inline templates
This way we can easily add new parameters to ASP_IPA_Event.

Change-Id: Icc37286fcb4d43836d56a26424ecb9dcba58d1f1
2020-05-18 21:16:35 +07:00
Neels Hofmeyr 9140101cb0 bsc: add TC_ho_neighbor_config_1 thru _7
Add tests to play through various neighbor configurations.
Tests will pass as soon as osmo-bsc I29bca59ab232eddc74e0d4698efb9c9992443983
is merged.

Add RSL2 to allow triggering handover to BTS 2.

Adjust osmo-bsc.cfg to match the new tests. Also applied in docker-playground
I1c57a04747f5ec004ccf4657954dcb0b003c24fc.
    - Actually enable handover.
    - Add bts 3

Depends: osmo-bsc I8623ab581639e9f8af6a9ff1eca990518d1b1211 ('no neighbors')
Related: OS#4056
Change-Id: Ia4ba0e75abd3d45a3422b2525e5f938cdc5a04cc
2019-08-13 21:54:55 +00:00
Harald Welte 34b5a95d09 cosmetic: Update copyright statement, license notice and SPDX
Some of our files didn't have a copyright notice at all, let's add
it.  Also, update the notices in other files and ensure a SPDX
identifier is present in all but the most trivial files.

Change-Id: If7fa19ce484b415bc645e39b3d0d666b44b5f0fd
2019-05-27 10:00:06 +00:00
Pau Espin 6451b04aed bts: f_est_dchan: verify Chan Rqd originated by RACH arrives on RSL
We cannot notify RSL Emulation layer about expecting a specific FN
(during ts_RSLDC_ChanRqd) because we only know the FN after sending the
RACH request, and since notification to RSL Emulation happens async, it
can happen (verified) that ChanRqd message from BTS arrives and is
handled before we register the RACH req into the ConnectionTable.

Change-Id: I438fd3ee82d88498d928dbcc89ce9bd80d37ab64
2018-11-06 16:22:57 +00:00
Pau Espin a07cfd909c RSL_Emulation: Fail explicitly on ASP_IPA_EVENT_DOWN
Otherwise RSL layer fails this way when this event is received:

RSL_Emulation.ttcn:429 Receive operation on port IPA_PT succeeded, message from TC_chan_act_a51-RSL-IPA(3): @IPA_Emulation.ASP_IPA_Event: { up_down := ASP_IPA_EVENT_DOWN (0) } id 9
- Function main_client was stopped. PTC terminates.
RSL_Emulation.ttcn:429 Message with id 9 was extracted from the queue of IPA_PT.
RSL_Emulation.ttcn:430 setverdict(fail): none -> fail reason: "Received unknown primitive from IPA", new component reason: "Received unknown primitive from IPA"

We now fail with a clearer message "Lost IPA connection!". These
failures seem to happen under high load when the BTS doesn't get a
steady clock from osmo-trx.

Change-Id: Idc6565c9de72d98015d56a41e5616c46051c8a8d
2018-10-24 16:34:05 +02:00
Daniel Willmann a6ea2ef867 Fail if f_streamId_by_trx() can't find a stream id
Change-Id: Ie58278edf7050254d7cdced48b4b7870e0e8d577
2018-07-24 14:19:42 +02:00
Daniel Willmann e4ff537f9b library: Ensure setverdict(fail) is followed by mtc.stop
This will prevent subsequent failures from overwriting the verdict so we
can easily see the root cause of the test failure.

Using testcase.stop instead for errors internal to our test
infrastructure to mark them as test errors instead of failed.

Change-Id: Idc6819aaf0b01e70c38fad828dd44dcec6bdd778
2018-07-24 09:54:18 +00:00
Daniel Willmann 8273fb9ceb RSL_Emulation: Stop with error verdict if conn table runs out of space
Change-Id: If1a002da97cf1b66855f2e7a0fe2a54a6428bc81
2018-07-06 18:04:52 +02:00
Harald Welte e32ad992af *_Emulation.ttcn: Specify destination when replying on procedure ports
procedure ports (like message ports) require us to specify the
destination of a message ("reply") in case it is connected 1:N and not
just 1:1.  This didn't show up as a problem so far, as we typically only
had one component talking to those procedure ports at any given point
in time.

Change-Id: I696ec67080815348bb95e43ecbbf262e533e39a3
2018-06-01 12:00:56 +02:00
Harald Welte d879e2ff9a RSL_Emulation: Handle ID_ACK event in BSC role
In I483ddd45c1cf631a5a9d8f862b6ca728b38bdc14 we introduced code
that makes the IPA_Emulation code to emut an ASP_IPA_EVENT_ID_ACK
[also] to the RSL port, irrespective of client/server status.

However, RSL_Emulation only handled this event in the BTS role
for BSC testing, but not in in the BSC role for BTS testing.

Change-Id: I99a5c58ea8d1e74b2ad51aed23009af6322a1007
2018-05-27 20:24:07 +02:00
Harald Welte 80f7687f18 RSL_Emulation: Less verbose logging
Don't use explicit log() statements for normal message forwarding
between ports.  This will be visible in the automatically-generated log
statements anyway...

Change-Id: Idcfb1897dd00df1839cf1a0182a5a030bf71c0cb
2018-04-15 11:21:55 +02:00
Harald Welte 930d0a70e3 bsc: Fix tons of TTCN3 compiler warnings
Change-Id: I60dc054d19a249d46d44585c17626746c34f4b09
2018-03-23 12:32:00 +00:00
Harald Welte ad2647b1b5 RSL_Emulation: Introduce LastActTable
The LastActTable stores a copy of the decoded RSL CHAN_ACT for
each channel number.  This can be used by a RSL_DchanHandler to
learn parameters of its own activation.

Change-Id: I629d66e27cbe4c8b02e704a7181b3bff843e9aa4
2018-03-22 21:16:33 +01:00
Harald Welte 34252c56c7 RSL_Emulation: Make CCHAN_PT bi-directional
So far we only dispatched received Common Channel messages from the
wire / IUT into the CCHAN_PT. Now the tester can also send Common
Channel messages back to the wire / IUT.

Change-Id: If3d5516c14ea3fbbd8c3de35eaa8ea5f18a00933
2018-02-24 04:51:50 +01:00
Harald Welte bb6aed387e RSL_Emulation: Pass ASP_IPA_EVENT_UP to RSL_CCHAN port
When emulating the BSC side of RSL, this can be used by a test case
to wait for the RSL connection to be established.

Change-Id: Iad2f6e4cb6a8f3b77e452f36a83ec11e7554e6c7
2018-02-21 12:20:30 +01:00
Harald Welte 1c02fd1ad5 RSL_Emulation: Introduce notion of 'bts_role'
So far we assumed we emulate the BTS side and talk to a BSC.

Let's make this configurable and disable the BTS-side spcific code
paths by means of a 'bts_role' boolean type.

Change-Id: I0d0460cbb633b470f6117d07643f68aefb1530eb
2018-02-21 12:20:30 +01:00
Harald Welte 70b52c9d4b RSL_Emulation: Add procedure calls to suspend/resume dchan handling
We introduce a procedure by which any DchanHandler can globally
disable all receiving/processing of DChan related messages.  This is
required in upcoming handover code, as we need to block handling
of messages such as RSL IPAC CRCX on the new Dchan before we have
processed the RR HANDOVER CMD and raised an associated expect here in
the RSL emulation code.

Change-Id: Ibef65f87d0d481accbc0e019874dd43b3f9a5dbc
2018-02-13 08:15:33 +01:00
Harald Welte 421e4d4eee RSL_Emulation: Add second RSL/RSL_PROC port for hand-over cases
Also, extend RSLEM_{register,unregister}() with an optional third
argiment, so the RSL_DchanHdlr can register 'expect' also for
that secondary BTS/port during hand-over

Change-Id: Ic22778f17dc4b93ef54837cf400ddd7d1732ae7e
2018-02-13 08:15:33 +01:00
Harald Welte 1909f464af bsc: Unregister old RSL channel number after assignment
Change-Id: I27d113391094f938ff92c4d6514172ee634f695c
2018-01-29 22:35:41 +01:00
Harald Welte f70df65570 RSL_Emulation: Permit registration of explicit Channel Number
During assignment or hand-over, a given TTCN-3 component may be
interested in registering more than one channel number.  Add an explicit
procedure port with associated registration procedure, similar to what
we already do in GSUP, MNCC and others.

Change-Id: Iba37bf9541c779b79e179f995cdfa677633fadeb
2018-01-29 21:35:13 +00:00
Daniel Willmann 17f970fc65 RSL_Emulation: Initialize the ConnectionTable
By default all the elements in the conn table seem to be considered
<unbound>.
f_cid_create() manages to set ra, ra_fn and comp_ref in the
ConnectionData element, but checking for
ispresent(ConnectionTable[i].ra) still returns false while
log(ConnectionTable[i].ra) returns 23. Setting every optional element to
omit as f_cid_clear() does before using the connection table seems to
solve this issue.

The assignment_fr_* tests now continue after receiving the Immediate
Assignment, but still fail after receiving the CM Service Request.

Change-Id: I24205425c5b6ae5b8a0f6288ba89ea5a1dc4669d
2018-01-17 13:11:57 +01:00
Harald Welte 35bb716610 Add comments with short module description on top of each file
Change-Id: Id934d7a763b619d52cbec7de439b3708225b81f3
2018-01-03 21:09:29 +01:00
Harald Welte 624f963393 BSC_Tests: Prepare for tests based on {RSL,BSSMAP}_Emulation
The existing tests were implemented directly on top of the BSSMAP
and RSL CodecPorts.  If we loop in the RSL_Emulation and
BSSMAP_Emulation components, we can properly multiplex/demultiplex
multiple MS (radio channels) on both the RSL and the MSC (SCCP
connection) side.

In order to have a single component that handles both the RSL and the
BSSAP side of a given channel/subscriber/call, we introduce the concept
of BSSMAP "Expects", where the test csse can register the L3 INFO that
it sends in the RLL ESTablish INDication on the RSL side, so the BSSMAP
handler cna route the BSC-originated SCCP connection with that L3 INFO
back to the same component.  This is a bit inspired "in spirit" of the
"expect" mechanism of netfilter connection tracking.

Change-Id: I71f777cd4f290422fa68897952b6505875e35f0e
2017-12-17 13:24:35 +01:00
Harald Welte bc330beab7 RSL_Emulation: Move templates into RSL_Types 2017-12-09 00:56:36 +01:00
Harald Welte 7ae019e1a0 IPA_Emulation: split t_ASP_RSL_UD in send and receive template 2017-12-09 00:54:15 +01:00
Harald Welte 714ded9e75 library: Add RSL_Emulation.ttcn
This emulates the RSL part of a BTS towards a BSC
2017-12-08 14:00:22 +01:00