Commit Graph

659 Commits

Author SHA1 Message Date
Harald Welte 990a36138b L1CTL: Add support for CCCH_MODE_COMBINED_CBCH
In OsmocomBB/trxcon Change-Id Ia94ebf22a2ec439dfe1f31d703b832ae57b48ef2
we introduced a new mode CCCH_MODE_COMBINED_CBCH to indicate that the
channel combination is a CCCH+SDCCH/4 with one SDCCH stolen for CBCH.

Let's make sure we actually use that mode in our CBCH related tests

Change-Id: I27ee2c81bec7175c1ea09d4f3f6037f2866fe242
2019-05-27 21:31:56 +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
Harald Welte eaa9a86e0a bts: Add TC_pcu_rr_suspend() to test forwarding of RR SUSPEND via PCU socket
This test opens a SDCCH and sends a RR SUSPEND message from the
simulated MS.  It then expects the BTS to pick that up and forward
it to the PCU socket rather than via RSL to the BSC.

Change-Id: I4da6e9d7c5dfbd0e017d2a63c6474da700c38e52
Related: OS#2249
Related: OS#4023
2019-05-27 10:00:06 +00:00
Pau Espin a65697dba0 msc: Introduce Osmux infra and one test for osmo-msc
Change-Id: Ibcb82d1a2d570c6c0ad0c3b6504bffe2244eccd9
2019-05-27 09:56:51 +00:00
Pau Espin c6a53dbb2a bsc: Introduce Osmux infra and one test for osmo-bsc
Test verifies once osmux is enabled in osmo-bsc, BSSMAP RESET (ACK)
contains Osmux Support IE and that it correctly handles BSSMAP ASsign
Req with Osmux CID.

Related: OS#2551
Depends: osmo-bsc 6de754cdde5319af3059d8fc6abf85037ec7eacc
Depends: titan.ProtocolModules.BSSMAP Iaf1e137269c0da20b2c96fd104b57edf336693af
Change-Id: If69c716dc06d61d810c32d1720a237c7535baca8
2019-05-27 09:56:51 +00:00
Pau Espin b2c6b38f3f Add Osmux support and tests for MGW
Depends: osmo-mgw.git Iac073f1db46569b46eddeaecc9934a2986bd50f1
Change-Id: Ibb58b2a4e08d6f30cfe347c217794d0d1310954f
2019-05-27 09:56:51 +00:00
Pau Espin 5eff975b23 BSSMAP_templates: Update templates to set Osmux fields
After new fields (osmux osmocom extensions) were added to BSSMAP Reset
and BSSMAP AssignReq/AssignCompl in titan.ProtocolModules.BSSMAP, we
need to set them in ts_* templates, otherwise TTCN3 runtimes fails with:
"""
BSC_Tests.ttcn:143 Dynamic test case error: Performing a valueof or send
operation on a non-specific template of type @BSSAP_Types.BSSMAP_IE_Osmo_OsmuxSupport.
"""

Fixes: fe0c6083bd
Depends: titan.ProtocolModules.BSSMAP Iaf1e137269c0da20b2c96fd104b57edf336693af
Change-Id: I568100376cf8a47c01a33bada97bf8eaa7c07fcd
2019-05-23 15:03:57 +02:00
Harald Welte 4a129f83ce bts: Add tests for CBCH LOAD IND (underflow, overflow)
Change-Id: Ia0a82771ba2912ef06fb0d9ee0816e8150701005
Related: OS#4011
2019-05-21 16:40:57 +02:00
Harald Welte a3ff670c5f bts: Refactor code to support mixed DEFAULT + NORMAL and EXTENDED CBCH
The existing code structure could only test for normal messages with a
NULL default, but didn't handle situations where normal and/or schedule
messages were superimposed on top of DEFAULT messages.

Also, prepare the infrastructure for testing both CBCH BASIC and CBCH
EXTENDED.

No new tests are introduced, the code should behave identical before
and after this patch.

Change-Id: I144c7d833b79c648b1ac69a6155f3603025ede5c
Related: OS#4011
2019-05-21 16:36:50 +02:00
Pau Espin e38bfe0683 RTP_Emulation: Avoid failure if T_transmit triggers between bind and connect
During MGCP_Test's f_flow_modify, an RTP socket may be Tx-enabled, and
f_flow_modify first calls bind, then connect, with MDCX transaction in
the middle (which can take some time).

If T_transmit from RTP_Emulation triggers (RTP packet to be send),
during that time, TTCN3 will fail to send the packet:
RTP_Emulation.ttcn:312 Message enqueued on RTP from system @Socket_API_Definitions.PortEvent : { result := { errorCode := ERROR_SOCKET (4), connId := 2, os_error_code := 89, os_error_text := "Destination address required" } } id 1

Change-Id: I20e7aed35bb28200e30ee5efc718f77e036d8262
2019-05-21 10:25:42 +00:00
Harald Welte 1028017e14 RSL_Types: Add ts_RSL_IE_MS_Power() template for MS Power IE
Change-Id: I646208c3c6e755978162e207a4f2030be117883d
2019-05-20 00:15:09 +02:00
Harald Welte 921f9e0732 RSL_Types: Add dissected RSL_IE_ActivationType and related templates
This is required for supporting normal and handover assignments.

Change-Id: I116d589d0ec4aa6bffba4da6e3bfe1974dd04db2
2019-05-20 00:15:09 +02:00
Harald Welte b05fd2d294 L1CTL: Add f_L1CTL_DM_EST_REQ() for activation without IMM.ASS
In any normal or handover related assignments, we don't have an
ImmediateAssignment that we can hand to f_L1CTL_DM_EST_REQ_IA(),
so let's intrduce a version that works with arfcn, chan_nr and TSC
directly.

Change-Id: Ie5b85d3bac57032f4762ea9cdc21fdcd70fd5c2a
2019-05-20 00:15:09 +02:00
Harald Welte c8d363cd3c bts: Add TC_sacch_chan_act() to test SACCH INFO at RSL CHAN ACT
According to 3GPP Ts 48.058, every logical channel can receive some
specific SACCH filling at the time of RSL channel activation.  This
overrides the global SACCH FILLING.

Related: OS#3750
Change-Id: I8adb371a7e0b80792dd2fa35e5204802068df5ba
2019-05-19 20:43:51 +02:00
Harald Welte a670615e5a RSL_Types: Add support for RSL_IE_MSG_ID as used in ERROR REPORT
Change-Id: I5f971dc7ec797a311841ac5b947c5c493780786f
2019-05-19 20:41:28 +02:00
Vadim Yanitskiy c78ea26f21 library/PCUIF_Types.ttcn: add explicit ALIGN(left) attribute
In the documentation of Eclipse Titan compiler before [1] it was clearly
stated that if the length of the actual value can be determined and it
is less than the specified FIELDLENGTH, the remaining bits / bytes will
be padded with zeros. The attribute ALIGN specifies the sequence of the
actual value and the padding within the encoded field:

  Attribute syntax: ALIGN(<parameter>);
  Parameters allowed: left, right;
  Default value: 'right'.

Since [1], the default value is:

  'left' for octetstrings, 'right' for all other types.

[1] 3cbafbd31d

In the most 'BTS_Tests.TC_pcu_*', including both 'TC_pcu_data_req_agch'
and 'TC_pcu_data_req_imm_ass_pch' we do pass the payload of length 23
bytes to ts_PCUIF_DATA_REQ(), what is less than the actual field length
(162 bytes). Thus when using titan.core <= 6.5.3, the payload appears
at the end of the buffer on the BTS side, so it reads 23 zero-bytes
from the beginning and does transmit them.

Let's explicitly add ALIGN(left) to field 'data' of 'PCUIF_data', so
the alignment would be done correctly, as expected by the BTS. Let's
also drop 'OCT162' type, as it doesn't make sense outside the
message definition.

This change makes the following test cases pass:

  - 'TC_pcu_data_req_agch' and
  - 'TC_pcu_data_req_imm_ass_pch'.

Change-Id: Ic4f358e5053e30e0dd7be8b6ac9c1d86cf9d8065
2019-05-17 01:08:22 +07:00
Stefan Sperling a2d59c6e6e add three tests for CIPHER MODE COMPLETE without algo
Add three tests which exercise MSC behaviour when a CIPHER MODE
COMPLETE command lacks the optional chosenEncryptionAlgorithm IE.
Check for behaviour with A5/1, A5/3, and A5/1 + A5/3 configured
in the network, and expect the location update to succeed.

These tests pass on master, but they should somehow verify the
cipher the MSC ends up using. I am not quite sure how to do that.
Would inspecting the MSC's VTY be a reasonable approach? How
could his be done by code which runs on BSC_ConnectionHandler?

Change-Id: I1a2a126795c544613a7a87e238e1fc8c4e943885
Related: OS#2872
2019-05-11 12:26:49 +02:00
Harald Welte d29a64c6d3 Fix regression in tr_GSUP_PROC_SS_ERR during inter-MSC-ho
In Change-Id I7d76c982ad4e198534fa488609c41e8892b268ab we merged
various changes to GSUP_Templates.ttcn, mostly related to adding
the tr_GSUP_IE_Message_Class IE.

In most caes, the specified MessageClass is correct.  However in
tr_GSUP_PROC_SS_ERR we accidentially used OSMO_GSUP_MESSAGE_CLASS_SMS
instead of OSMO_GSUP_MESSAGE_CLASS_USSD.

This makes TC_lu_and_ss_session_timeout pass again.

Change-Id: I04fa1be24ec63ed1eb767a33de0297722b4366f1
2019-05-11 12:26:49 +02:00
Harald Welte 0622a9f7b6 Make f_gen_tr_ss_ies() work for both 'latest' and 'master'
This fixes the partial revert of c43c8cd275
to work for both situtions:  Messages that have the OSMO_GSUP_MESSAGE_CLASS_USSD
and messages that don't.

The particular implementation is rather ugly, but we're waiting for
a response to https://www.eclipse.org/forums/index.php/t/1098847/
on how to solve this kind of problem in a more elegant way.  Meanwile,
we make it work first.

Change-Id: Ibf137de6a41aaa43894cc0b6da8341ceb88b0756
2019-05-11 11:09:09 +02:00
Harald Welte 1e5a02d766 BSSGP_Emulation: More/improved comments
Change-Id: I04250667a498f3f00d4fbb4cd22a4f7b71e2bba1
2019-05-11 06:03:12 +00:00
Alexander Couzens c43c8cd275 Revert partial of 0ac6315212 ("msc: add inter-BSC and inter-MSC Handover tests")
Commit 0ac6315212 breaks all related GSUP SS tests because it require
all GSUP SS packages to have a OSMO_GSUP_MESSAGE_CLASS_USSD IE.

Change-Id: Iadbc37105fa67cf6383fb63b86ed653ccc7bddf7
2019-05-10 23:23:52 +00:00
Harald Welte 1b85bf3a3d BSSGP_Emulation: Implement LLC sending also for SGSN-role
We used to support sending of LLC messages only for the MS role,
where we generated BSSGP UL UNITDATA.  Let's also support the
SGSN role, where we have to generate BSSGP DL UNITDATA

Change-Id: If86f4b7c9e7c3c799c274f37a350dec4a788f124
2019-05-10 22:39:02 +00:00
Harald Welte 425f782d25 BSSGP_Emulation: Pass uplink L3 to BSSGP Uplink Unitdata
Change-Id: I71c19cd0f11927eb70667210a4ba1ee5873fd534
2019-05-10 22:39:02 +00:00
Harald Welte 8d1d893e7f BSSGP_Emulation: Fix transmission of MT L3 in LLC/BSSGP
it seems that some part of the code was commented out, breaking
the path where a ConnHdlr is sending a L3 MT message.

Change-Id: Ie652598292f2fbd2e1e0c4aa679ff0d68d78c88c
2019-05-10 22:39:02 +00:00
Harald Welte 9b06488116 library: Add PAP_Types for PPP Authentication Protocol (RFC 1334)
Change-Id: I31cb766bb701b8107df5de978d2b0b085977045a
2019-05-10 10:46:26 +00:00
Harald Welte 03d4e2b8f2 RAN_Emulation: Fix IMSI table lookup on RANAP paging
We need to check explicitly for '== null'.  isvalue() is of no help
here, as 'null' apparently is a value in TTCN-3.

Change-Id: I4b2793937a201c5535051092d871ded6cb053f5f
2019-05-10 00:45:40 +02:00
Neels Hofmeyr 0ac6315212 msc: add inter-BSC and inter-MSC Handover tests
Change-Id: I7d76c982ad4e198534fa488609c41e8892b268ab
2019-05-09 00:55:11 +02:00
Neels Hofmeyr 2ca1ab492a msc: mo and mt voice call tests: add lots of missing parts
Both f_mo_call_establish() and f_mt_call_establish() were testing barely half a
voice call setup.  For example, f_mo_call_establish() used to be satisfied with
just two CRCX, but no actual RTP connections being made.

Add numerous MNCC and MGCP messages more closely resembling an actual call.

The main reason is to achieve a state that passes both current osmo-msc master
as well as the upcoming inter-MSC Handover refactoring.

Add log markers to f_*_call_*(): often when a test halts, it is not at all
clear why. With these log markers it is saner to figure out what has happened
and what hasn't.

Change-Id: I162985045bb5e129977a3a797b656e30220990df
2019-05-07 01:20:09 +02:00
Harald Welte 475a2c1d2c move as_iu_release_compl_disc from BSC_ConnHdlr to RAN_Emulation
... this way other tests beyond MSC_Tests.ttcn can use it.

Change-Id: If6d4bbbd09c6261bd665aa66e0d4d027aeaa4d16
2019-05-02 19:11:14 +02:00
Harald Welte bc04327e28 RAN_Adapter: More verbose logging
Change-Id: I16a2c4858d8cac65f39e37d23051fa77c15d4c6f
2019-05-02 18:35:43 +02:00
Harald Welte 07d99c8e7b move imsi_hex2oct to Osmocom_Types.ttcn
This function is required not only for the MSC_Tests, but also for
the upcoming Iu related SGSN tests

Change-Id: Ic23669671ce79151046f2330726bb68542faeb0e
2019-05-02 18:35:43 +02:00
Harald Welte d21f6a2005 LLC_Templates: Add XID related templates
Change-Id: I383e8761f91fac18625a442088e865ad6a9b472b
2019-05-02 10:03:32 +02:00
Harald Welte 5b02762adf RAN_Emulation: Add RANAP support
So far, RAN_Emulation only handled BSSAP and hence could be used
to emulate BSCs towards the MSC.  Let's extend it with RANAP support
so we can also emulate RNCs towards the MSC.

We try to share as much code and logic as possible betweeb the two.

Related: OS#2856, OS#2857
Change-Id: Ie79bda764162e5c5a42608bde5c5f486ea531f33
2019-04-25 20:07:11 +00:00
Harald Welte a013e68fc9 HNBAP, RUA and RANAP protocol codecs
This patch introduces protocol codecs for the HNBAP, RUA and RANAP
protocols, which is mandatory for testing IuCS, IuPS or Iuh in
the future.

As Eclipse TITAN ASN.1 only supports the BER codec and the above
protocols all use APER, we need to use an external transcoder from
APER to BER and vice-versa.  This was implemented using a proprietary
ASN.1 compiler / trnaslator which sysmocom is packaging as
libfftranscode, which is made available as binary package
for Debian 9 at https://ftp.osmocom.org/binaries/libfftranscode/

Related: OS#2856, OS#2857, OS#2858
Change-Id: If4a72de9bc54d6e6a7daaca78a4d4aa5684203a5
2019-04-25 20:07:11 +00:00
Harald Welte 3e16b4d2f3 RAN_Adapter: Support build without IPA / BSSAP support
Change-Id: I5370f0ea6f2f6cfdc3370a6f3d3bf2e6c32af4d2
2019-04-25 20:07:11 +00:00
Harald Welte 3ca0ce13b2 RAN_Adapter: Rename functions from f_bssap_* to f_ran_adapter_*
Change-Id: I73818247f1dfc71c8ece11660e6c18f5f153d186
2019-04-25 20:07:11 +00:00
Harald Welte 2fce7887f4 RAN_Emulation: Modularize protocol support
The RAN_Emulation currently unconditionally provides BSSAP and MGCP support.
Let's re-structure the code so that support for those protocols is now
possible to enable/disable at compile time.

This patch is in preparation of introducing RANAP support in RAN_Emulation.

Change-Id: Id53ba3ff05f9946230e0e4a759245de14a0f9fbd
Related: OS#2856
2019-04-25 20:07:11 +00:00
Harald Welte ceaff26682 LLC_Templates: Add templates for NULL and DISC
Change-Id: Ia5b350990379bba1677a0c1c99cf37e6651ba84d
2019-04-25 20:06:15 +00:00
Harald Welte f7a5c3ca02 LLC_Templates: Add SABM, UA, FRMR, DM templates
Related: OS#3953
Change-Id: Idb40dcd53310b76ea9df6c0090e31175a4382460
2019-04-25 20:06:15 +00:00
Vadim Yanitskiy 51cbc104c6 BTS_Tests.ttcn: add TC_pcu_ext_rach_content() for 11-bit RACH
According to 3GPP TS 04.60, section 11.2.5a, the extended (11-bit)
Access Burst on RACH/PRACH is used by the MS to indicate its EGPRS
capability. One of the alternative synch. sequences (see 3GPP TS
05.02, TS1 and TS2) shall be used.

Add a test case to verify extended (11-bit) RACH decoding.

Depends: (OsmocomBB) I36fd20cd5502ce33c52f644ee4c22abb83350df8
Change-Id: I8fe156aeac9de3dc1e71a4950821d4942ba9a253
Related: OS#1854
2019-04-23 14:49:36 +00:00
Vadim Yanitskiy 5c83679e39 library/L1CTL_Types.ttcn: add L1CTL_EXT_RACH_REQ message
According to 3GPP TS 04.60, section 11.2.5a, the extended (11-bit)
Access Burst on RACH/PRACH is used by the MS to indicate its EGPRS
capability. One of the alternative synch. sequences (see 3GPP TS
05.02, TS1 and TS2) shall be used.

Change-Id: If037cb2f2687697f168d10a033eeb20d20183328
Related: OS#1854
2019-04-23 14:49:36 +00:00
Vadim Yanitskiy 4e79ff5eac library/L1CTL_Types.ttcn: fix: add missing L1CTL_BURST_IND message
Change-Id: Ibf75792be70f694bca9222ec6568371475d193bb
2019-04-23 14:49:36 +00:00
Harald Welte 6811d10af7 Rename BSSMAP_Emulation -> RAN_Emulation
So far, BSSMAP_Emulation supported only a transport over BSSMAP.
However, we soon intend to merge support for RANAP in order to
simulate RANAP/Iu connections as well as BSSMAP.  Let's start
by renaming some of the existing types/functions/ports/modules
without introducing any functional changes just yet.

Related: OS#2857, OS#2856
Change-Id: Iecbcb0c6c136baad9460eca40606bb4010d8882d
2019-04-21 17:44:59 +02:00
Daniel Willmann abc73e1291 BSSMAP_Emulation: Check for ==/!= null instead of isvalue()
Related: OS#3932
Change-Id: I2434c776c6a4ee83e97bc04e7cbbaf1b546731c0
2019-04-15 17:28:06 +02:00
Alexander Couzens c7dddbd7d0 Ensure BcdMccMnc is encoded as 24.008 10.5.5.15
PCU is using BcdMccMnc as it's encoded as 24.008.
But SGSN code is using it as it would be byte by byte
sorted.

Fixes: OS#3878
Change-Id: Ie8f67f16f18e4c5090bc5a4c46a866a7e7e00206
2019-04-12 15:10:24 +00:00
Philipp Maier d3e0bfa737 SGsAP_Templates: Remove invalid template.
The Template tr_SGsAP_RESET_IND is invalid since it requires vlr and mme
name at once, which is not a valid constellation in the real world. Lets
have two separate templates, one for MME and VLR, just like we have it
already with the ts_ versions of the templates.

Change-Id: Ifdf6030bb42ebd99c2030d600e87127e3619d7ad
Related: OS#3859
2019-04-09 15:37:44 +02:00
Harald Welte 4bff40ad04 PCUIF: Add templates for PCU_IF_MSG_SUSP_REQ
Change-Id: Ib7661790b9531be829ee550ce889151ebe1885ac
2019-03-27 11:17:49 +00:00
Harald Welte 797ab3a91c pcu: Fix MCC/MNC handling: use 'F' between MCC and MNC in 2-digit case
Change-Id: Ifdb64c501095839e86894716769adb53e3c17382
2019-03-27 11:17:49 +00:00
Harald Welte 23989a64da Osmocom_Gb_Types: Add more templates for BSSGP SUSPEND/RESUME
Change-Id: Ife25401043d565e52a73206c562bbb68bcfdbafa
2019-03-27 11:17:49 +00:00
Harald Welte b16516c0af GSM_RR_Types: Add enc_RoutingAreaIdentification()
This allows us to encode a stand-alone RAID as needed in some places.

Change-Id: I28222304b2bac893b216c47e6dc002886fab6406
2019-03-27 11:17:49 +00:00
Harald Welte 001b0dad5f BSSGP_Emulation: Handle incoming BVCI=0 messages
Like BVCI=PTP, the BVCI=0 messages must be dispatched by their
TLLI, but using the BSSGP_SP_SIG port instead of BSSGP_SP.

Change-Id: Ic456d43ec07600162991698ec3d75d36785b2fb8
2019-03-27 11:17:49 +00:00
Harald Welte f12b5a412d pcu: Ensure we're always using the same defaults for the CGI
Not all parts of the code explicitly specify each and every parameter
of the Cell Gobal Identifier (particularly we don't do that for the PCU
INFO IND), and hence multiple parts only interoperate if the same
defaults are used in all locations.

Change-Id: Iac9be9a8d4ccb4d01cc343d763d2e35873e3844f
2019-03-27 11:17:49 +00:00
Harald Welte e81d84edd2 NS_Emulation: Disable sending NS-RESET from SGSN to BSS
Change-Id: I2a5775fcaf63ac008adecaf2c602c82e9e4ccb5a
2019-03-27 11:17:49 +00:00
Harald Welte 5e514fa3db NS_Emulation: Add minimal support for SGSN-side SNS handling
Change-Id: I1edf739d6fd39478f662a28a7d9334ca51c270a3
2019-03-27 11:17:49 +00:00
Philipp Maier d0e64b07dd BSC_Tests: add testcases to verify S15-S0 handling
The handling of the AMR rate configuration bits S15-S0 is currently only
superficially checked. Lets add more some more elaborated testcases to
check through varios different situations. Also make sure that the
resulting mr configuration IE is verified

Change-Id: Ica323deb9836deea72982e093c9cb31deb5a216b
Related: SYS#4470
2019-03-19 13:29:31 +00:00
Philipp Maier c8c0b40e1b MGCP_Test: allow setting of fmtp parameters
When creating an RTP flow, there is currently no way to set SDP fmtp
parameters. Lets add a template and a parameter in order to be able to
set those parameters.

Change-Id: Ic1840d5023cb3888a17980f4ed08c19175864896
Related: SYS#4470
2019-03-19 13:29:31 +00:00
Max 68b4743c7d Log PCU socket path on errors
Change-Id: I5a4a7c9dc630ecd6fc0ca7a21d4b528d811edd06
2019-03-15 11:43:32 +00:00
Oliver Smith ee6a088f37 ggsn: add tests to validate IPv4v6 pdp ctx
Add related templates based on 3GPP TS 29.060 Figure 37A and create
tests based on existing IPv4 and v6 ones.

Related: OS#2900
Change-Id: I3bab7df5caddc5c8b973c81544f954d5473ac234
2019-03-14 09:10:45 +00:00
Neels Hofmeyr 82fd04b13b msc: add codec to all Assignment Complete messages
So far we omit a Speech Codec (Chosen) from Assignment Complete messages, which
is actually a mandatory parameter. osmo-msc seems to carry on nevertheless, but
it actually shouldn't be able to.

Always send a Speech Codec (Chosen).

Change-Id: Ib35f019383db8ace05a9dc349648e2da7ba58bfa
2019-03-14 03:43:52 +00:00
Max b7aae8b957 IPA: log host:port on listen errors
Change-Id: I0e25961698ab70a2822e2b2be5b514c3603981ca
2019-03-11 15:22:02 +01:00
Oliver Smith c574829208 library/GSUP_Types.ttcn: add CHECK-IMEI message
Implement necessary messages for Procedure Check_IMEI_VLR (TS 23.018
Chapter 7.1.2.9). This lets the VLR ask the EIR to check if an IMEI
is valid. In the Osmocom stack, we don't have an EIR and this request
is handled by the HLR. We are able to store the IMEI in the HLR as
side-effect (OS#2541).

This is roughly based on TS 29.002 8.7.1 MAP_CHECK_IMEI service, but
only implements the bare minimum required IEs (imei and imei_result).

Related: OS#3733
Change-Id: Ie1ae5c66ad3f9b42b345020de62a0c276cd8d709
2019-03-04 16:24:28 +00:00
Harald Welte a321981987 PCUIF: Add send + receive templates for TIME_IND
Change-Id: I57d776d8d2d8300805b8b8e724c288ba29c4b284
2019-03-02 00:04:52 +01:00
Harald Welte 0a3d63f683 PCUIF: Accept any ARFCN in tr_PCUIF_DATA_REQ
Change-Id: Ic334d8809baea86ea93f429b200204861b989030
2019-03-02 00:04:52 +01:00
Harald Welte 913bbf6908 PCUIF_Types: Add enumerated PCUIF_BurstType
Change-Id: Ib2e2effb818da5d259032ee5b8b25788ebc646c0
2019-03-02 00:04:51 +01:00
Harald Welte 72099557a5 PCU: Add test for SNS Change Weight procedure
Change-Id: Ia63865139f63969ccde010b01ddb8fb073209f3a
2019-02-26 11:28:28 +01:00
Harald Welte 630d0e6523 PCU: Add tests for SNS with separate signalling/data NS-VC, ADD, DEL
Change-Id: Ie1d14a901b354daa4e3796fe66e7390d87c7e778
Related: OS#3617
2019-02-26 11:28:28 +01:00
Philipp Maier a071ee467c RTP_Emulation: check received RTP packets
The configuration of the RTP Emulation (RtpemConfig) allows to set a
fixed RTP payload that is then used when RTP packets are transmitted.
However, when packets are received, then the payload is not checked.
Lets check the received data against some user configurable rx payload,
that is by default set to the tx payload.

Change-Id: Id0b125aaf915497d0a4f051af890fc34e09da61d
Related: OS#3807
2019-02-26 09:10:35 +00:00
Harald Welte 4c422b76ff MSC: Verify CSFB INDICATOR is present in CLEAR COMMAND
When a CSFB voice call is cleared by the MSC, it must include the
CSFB INDICATOR in order to trigger the BSC to perform actions
required for Fast Return to LTE.

This patch changes TC_sgsap_lu_and_mt_call() and
TC_bssap_lu_sgsap_lu_and_mt_call() to ensure the CSFB INDICATOR IE
is present as expected.

Change-Id: I6ce3a34f85aca7143cf7925cb9319bc679e8d395
2019-02-22 21:24:11 +00:00
Harald Welte 07e8dde671 PCUIF: Use OCT4 for IP address, not uint32_t
In TTCN-3, a 4-byte octetstring is the more usual representation for
IP addresses, not an integer type.  This is also what functions like
f_inet_addr() etc. are using as types, and we may want to use them
in combination with the PCUIF.

Change-Id: Ia08e1bb8a9bfbd5bf5b63922c77bb221ce1a12f5
2019-02-18 20:42:16 +01:00
Harald Welte e1fd916b21 PCUIF: Prepare for simulating BTS side of PCU Interface
Our TTCN-3 PCUIF code so far was only used to simulate the PCU side
of the interface: connecting to the socket as a client.  However,
it's also useful to emulate the BTS side of the interface: Listening
for a connection as a server.

Also, the send/receive templates are prepared for the inverse role.

Change-Id: I779ff2903cab8c13ffb8fe10a4cacd996bafe69a
2019-02-18 20:25:00 +01:00
Harald Welte f4bf131eca Osocom_Gb_Types: Add send/receive templates for SNS-SIZE and SNS-CONFIG procedure
Change-Id: Iaa12c468a9e665d2050945cfc0a60dab4024071c
2019-02-18 20:25:00 +01:00
Harald Welte 387ab37dfd Osmocom_Gb_Types: Differentiate send (value) and receive templates
Change-Id: I90400c42d3dff0a1de0022320d76f10ac748a206
2019-02-18 20:25:00 +01:00
Harald Welte a7377d8c74 General_Types: Add BIT13, BIT28, BIT29, BIT30
... required by USB CCID.

Change-Id: Idf4f54b2d57d7b29c39c4b6f9bfa1022745cba89
2019-02-17 20:51:54 +01:00
Harald Welte c682666fea IPA_Emulation: Integrate OML decoding/encoding; add OML port
Change-Id: Id0dabe7eca4f81d22a60b346ac598be81533f53c
2019-02-17 14:29:21 +01:00
Harald Welte 0aa0abc36d Add TTCN-3 definition of GSM Abis OML protocol (TS 12.21)
Change-Id: I65f71bf7f54cbe3290757e810b1df1e54929bdd1
2019-02-17 14:29:17 +01:00
Harald Welte 9978710c4b bsc: Test CSFB "Fast Return" in new TC_chan_rel_hard_clear_csfb
When a MSC releases a connection using the BSSMAP CLEAR CMD, it can
specify that this call was part of CSFB.

The BSC is then supposed to add a special IE to the RR RELEASE
message which will help the phone to switch back to LTE as soon
as possible.

This commit adds a new test case testing for exactly that behavior.

The test does *not* verify if the EARFCN information contained is
actually correct, only that the IE is present in the RR RELEASE.

Change-Id: I7501fb25578412c882ff92da5d388f3079bbce7f
Requires: osmo-bsc Ibfbb87e2e16b05032ad1cb91c11fad1b2f76d755
Related: OS#3777
2019-02-05 17:45:29 +01:00
Harald Welte 924b6ea17b bsc: replace octet string with decmatch when matching RR RELEASE
The 'decmatch' keyword allows us to match the decoded version of some
octetstring, which is very useful in the situations where we have
the L3 message only as octetstring but want to check if it matches
some L3 template.

Change-Id: I0a91e067f7e8062bf991fef8b0d4d8da740bfafc
2019-02-05 17:45:29 +01:00
Harald Welte 4263c52bd4 WIP: MSC_Tests: Add SGs testcases
This extens MSC_Tests.ttcn with an initial set of SGs interface test
cases for RESET, LU, DETACH, PAGING, SMS and CSFB procedures

In particular the following testcases are added:

- TC_sgsap_reset: isolated reset procedure test
- TC_sgsap_lu: isolated location update with TMSI realloc
- TC_sgsap_lu_imsi_reject: location update, reject case
- TC_sgsap_lu_and_nothing: location update with failed TMSI realloc
- TC_sgsap_expl_imsi_det_eps: detach from EPS serveces
- TC_sgsap_expl_imsi_det_noneps: detach from non-EPS services
- TC_sgsap_paging_rej: isolated paging, reject case
- TC_sgsap_paging_subscr_rej: isolated paging, subscr rejects call
- TC_sgsap_paging_ue_unr: isolated paging, ue is unreachable
- TC_sgsap_paging_and_nothing: page, but don't respond
- TC_sgsap_paging_and_lu: check paging followed by an LU
- TC_sgsap_mt_sms: mobile terminated SMS through SGs Interface
- TC_sgsap_mo_sms: mobile originated SMS through SGs Interface
- TC_sgsap_mt_sms_and_nothing: trigger SMS, but don't respond to paging
- TC_sgsap_mt_sms_and_reject: trigger SMS, but reject paging
- TC_sgsap_unexp_ud: Send unexpected unitdata (SGs Association: NULL)
- TC_sgsap_unsol_ud: Send unsolicited unitdata (subscriber not in VLR)
- TC_bssap_lu_sgsap_lu_and_mt_call: LU on 2G, LU on SGs and CSFB call
- TC_sgsap_lu_and_mt_call: LU on SGs, and CSFB call

Change-Id: I38543c35a9e74cea276e58d1d7ef01ef07ffe858
Depends: osmo-msc I73359925fc1ca72b33a1466e6ac41307f2f0b11d
Related: OS#3645
2019-01-07 15:48:28 +00:00
Philipp Maier 4d1e9c9254 BTS_Tests: Verify RSL MS POWER CONTROL and SACCH MS POWER LEVEL
Usually the MS power is controlled by the BTS and there is no continous
supervison by the BSC needed. However, a scheme where the BSC takes care
of the power control loop exists. The power is then set via RSL using an
RSL MS POWER CONTROL message.

This tests establishes a dchan and then sends MS POWER CONTROL messages
with differen power levels and then checks the presence of the power
level set in the MS POWER LEVEL field of the SACCH L1 header.

Change-Id: I82b04a3bf94d355175f7f6ff3fdc43672e8080a2
Related: OS#1622
2018-12-23 10:36:58 +00:00
Philipp Maier 9b690e42e1 MSC_ConnectionHandler: Optionally check MM Info
The MM Info message is an optional message that is set to the MS usually
after the location update. It contains the full network name and time
information. At the moment the presence of this message is not checked
or expected since sending of MM-Info is explicitly disabled in the
osmo-msc configu.

This patch adds an optional check of MM Info that is disabled by
default.

Change-Id: I431f50c2ff3536f87f0c7c3caf23b7a38d501904
Related: OS#3615
2018-12-21 17:52:35 +01:00
Vadim Yanitskiy f1f39bd28d library/GSUP_Types.ttcn: actualize both GSUP_SM_RP_{DA|OA}
Both GSUP_SM_RP_{DA|OA} IE definitions have been merged before
the reference implementation in libosmocore. Recently it was
decided to use the following structure:

  IEI | IE length | ID type | ID encoded data (optional)

instead of:

  IEI | IE length | ID type | ID length | ID encoded data (optional)

so, let's remove ID length from both definitions.

Change-Id: I001cec53a80028ff153db3d8b0318b298f2bd8c2
2018-12-19 12:20:34 +00:00
Philipp Maier 1f581b4c49 Osmocom_CTRL_Adapter: Let the OS decide over the local port number
At the moment the function f_ipa_ctrl_start() is starting the IPA
emulation client with parameter -1 for local port. This is internally
translated to port number 9999, which is a fixed number. This makes
it impossible to have two control interfaces at the same time.

Lets use 0 as local port, so that the OS is selecting a free port
number automatically.

Change-Id: Ie6648f8f4c1e065c174868c35eb64ee034ace3ce
Related: OS#3645
2018-12-18 17:14:19 +01:00
Max 4426598c7b MGCP: remove commented variants
It's unclear why those variants were commented - looks like artifact
from initial development. Let's drop them to avoid confusion.

Change-Id: I3f11a93634fc50243a7210edcd501bd4b90d6dcd
2018-12-11 21:07:40 +00:00
Vadim Yanitskiy 88e23234a3 library/GSUP_Types.ttcn: add READY-FOR-SM message
According to 3GPP TS 29.002, section 12.4, MAP-READY-FOR-SM is
used between the MSC and VLR as well as between the VLR and the
HLR to indicate that a subscriber has memory available for SMS.

This change replicates this service in GSUP as READY_FOR_SM_*.
The only mandatory IE for this service (excluding Invoke ID) is
'Alert Reason' that is replicated by OSMO_GSUP_SM_ALERT_RSN_IE.

Change-Id: If2256607527ecfcb10285583332fb8b0515d7c78
Related: OS#3587
2018-12-03 03:13:36 +07:00
Vadim Yanitskiy 8a1d4b6c4f library/GSUP_Types.ttcn: add MO-/MT-FORWARD-SM messages
According to 3GPP TS 29.002, there are two services:

 - MAP-MO-FORWARD-SHORT-MESSAGE (see 12.2),
 - MAP-MT-FORWARD-SHORT-MESSAGE (see 12.9),

which are used to forward MO/MT short messages.

This change replicates both services as GSUP messages:

 - OSMO_GSUP_MSGT_MO_FORWARD_SM_*,
 - OSMO_GSUP_MSGT_MT_FORWARD_SM_*.

Please note, that only the 'must-have' IEs are introduced
by this change, in particular the following:

 - OSMO_GSUP_SM_RP_MR_IE (see note below),
 - OSMO_GSUP_SM_RP_DA_IE (see 7.6.8.1),
 - OSMO_GSUP_SM_RP_OA_IE (see 7.6.8.2),
 - OSMO_GSUP_SM_RP_UI_IE (see 7.6.8.4),
 - OSMO_GSUP_SM_RP_MMS_IE (see 7.6.8.7),
 - OSMO_GSUP_SM_RP_CAUSE_IE (see GSM TS 04.11, 8.2.5.4),

where both SM_RP_DA and SM_RP_OA IEs basically contain
a single nested TLV of the following format:

 - T: identity type (see 'GSUP_SM_RP_ODA_IdType'),
 - L: identity length,
 - V: encoded identity itself.

According to GSM TS 04.11, every single message on the SM-RL has
an unique message reference (see 8.2.3), that is used to link
an RP-ACK or RP-ERROR message to the associated (preceding)
RP-DATA or RP-SMMA message transfer attempt.

In case of TCAP/MAP, this message reference is being mapped to the
Invoke ID. But since GSUP has no 'Invoke ID' IE, and it is not
required for other applications (other than SMS), this change
introduces a special 'SM_RP_MR' IE that doesn't exist in MAP.

Change-Id: Ibf49474a81235096c032ea21f217170f523bd94e
Related: OS#3587
2018-12-02 05:32:50 +07:00
Vadim Yanitskiy 772a84592b library/GSUP_Types.ttcn: fix IE order in PROC_SS_ERROR templates
In general, the order of IEs in a GSUP message doesn't matter.
Despite libosmocore's GSUP API encodes IEs in a fixed order,
it is capable to decode them in any arbitary order.

Meanwhile, in the current TTCN-3 definitions (i.e. templates)
the order makes a difference, because the 'GSUP_IEs' type is
a record, that according to the TTCN-3 documentation represents
an *ordered* sequence of elements.

Let's reorder the IEs of both t{r|s}_GSUP_PROC_SS_ERR templates
in a way that is used by the libosmocore's GSUP encoder.

This correction doesn't affect successful test case executions,
because we don't test possible problematic situations yet. But
if something went wrong on the HLR side (i.e. SUT), the matching
statements wouldn't match the PROC_SS_ERR message correctly
and continue to wait until the guard timer is expired.

Change-Id: I5eb2314f6a9ab0e9fc5e836390414cec6e1a12db
2018-11-29 21:42:49 +07:00
Vadim Yanitskiy 21c423353c library/GSUP_Types.ttcn: fix missing session state IE in PROC_SS_ERR
Both session state and session ID IEs are always being encoded
together by libosmocore's GSUP implementation. So, if a message
contains a session ID IE, session state IE shall also be there.

For some reason, the session state IE was missing in both
ts_GSUP_PROC_SS_ERR and tr_GSUP_PROC_SS_ERR templates. This
could led to incorrect matching in our test cases.

This change fixes both templates by adding the missing IE. Since
tr_GSUP_PROC_SS_ERR templete is used in HLR_Tests.ttcn, all the
affected matching statements were also corrected.

This correction doesn't affect successful test case executions,
because we don't test possible problematic situations yet. But
if something went wrong on the HLR side (i.e. SUT), the matching
statements wouldn't match the PROC_SS_ERR message correctly
and continue to wait until the guard timer is expired.

Change-Id: I44070396ce7119eab4608d9f9fb090bb223dfaa2
2018-11-29 21:42:17 +07:00
Vadim Yanitskiy bc18afab58 library/SS_Templates.ttcn: add SS_USSD_FACILITY_INVOKE templates
Change-Id: Ic561b6b2eee7315d42fcd5ec5fef182ae097d3b7
2018-11-28 06:00:52 +07:00
Philipp Maier 8d33a13b21 BSSMAP_Templates: do not match on omit in tr_BSSMAP_HandoverPerformed template
tr_BSSMAP_HandoverPerformed matches all optional fields on "omit". This
does not make much sense as a safe default. Lets match on "*" instead.
(See also other tr_ templates)

Related OS#3645
Change-Id: Icd55afdaebdda8ba98431f358148035f7d220b8a
2018-11-19 12:20:07 +01:00
Stefan Sperling 4c32b952dd start implementing the TC_paging() PCU test
Implement a basic paging test for the PCU, which is passing for paging
via TMSI (but only if osmo-pcu is started after the test is started).

Previously, this test code amounted to a debugging loop which
never terminated.

Change-Id: Id0384e0742ab91983615e4f1c883bb044c1c8b18
Related: OS#2404
2018-11-19 11:10:22 +00:00
Philipp Maier a0cacc7d5b BSSMAP_Templates: Add missing field in tr_BSSMAP_HandoverPerformed template
tr_BSSMAP_HandoverPerformed lacks the field speechVersion, lets add it
to make the template complete.

Change-Id: Id73c0aef5caa0936aa44308faf2aae1c20c7446c
Related OS#3645
2018-11-18 20:33:57 +00:00
Stefan Sperling 26d57be102 support odd-length calling MSISDN in MSC tests
MSC tests were unable to match odd-length digit strings in
a CallingPartyBCD_Number template created by tr_Calling().
This happens because the raw encoder for CallingPartyBCD_Number
pads odd-length digits with 1-bits ('F'H). Do the same when
constructing such a template in our own code to ensure that
we'll match the actual data received.

Change-Id: I34439c8750f588802a5403375e2a3d6e74dae70c
Related: OS#2930
2018-11-18 20:27:53 +00:00
Stefan Sperling cff13563cf attempt to fix a race condition in BSC test's f_ts_dyn_mode_get
Add two helper functions which retry a VTY command until the
result matches a regular expression or a configurable timeout
expires.

Use these functions in BSC test's f_ts_dyn_mode_get, which has
seen sporadic failures due to a race condition during channel
reconfiguration, in order to hopefully close this race.

Change-Id: I308ddb06e440c165fe1e73fe2c1fb78be2e1d510
Related: OS#3690
2018-11-15 13:02:20 +00:00
Philipp Maier aee6039600 BSSMAP_Templates: Add missing tr_BSSMAP_HandoverPerformed template
The receive template for the BSSMAP HANDOVER PERFORMED MESSAGE is
missing, lets add one.

Related OS#3645

Change-Id: I527913203b2d5bfa26c181c4bb79481a9cd283ae
2018-11-07 11:37:27 +00:00
Max 39e6cae97c NS: print ip:port on error
Change-Id: I2f558021b7754db9593934888d12f9c879dc2988
2018-11-06 22:13:30 +00:00
Max 51abfbc47c cosmetic: fix compilation warnings
Drop 'return' statements after 'mtc.stop' as they cause following
warning from TTCN-3 compiler:
warning: Control never reaches this statement

Change-Id: I6210ecf5fcb39f751116ad63a69d2ae8651a60c5
2018-11-06 19:11:34 +01: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
Vadim Yanitskiy e0bb4f0cee library/MNCC_Types.ttcn: add MS-side related messages
Change-Id: Icc41074e80da7115cfbd5075f88a14fedaf73489
2018-11-01 03:40:38 +07:00
Harald Welte 0cedf2c5db L3_Templates; add tr_ML3_MT_MM_AUTH_REQ_3G()
this allows us to match on specifically 3G MM AUTH REQ, whereas
so far we only had a generic template that matched the 2G and 3G
auth req.

Change-Id: I392d61d1348bee9c88abe4bb938e99b2c3702a94
2018-10-29 00:19:00 +01:00
Vadim Yanitskiy e01691df50 L1CTL_Types.ttcn: drop length limitation for traffic messages
There is no any reason to limit payload length.

Change-Id: I1782856affe427b087fa3f7ef1c02a865d136372
2018-10-28 22:32:36 +00:00
Vadim Yanitskiy ea247d5ceb library/VTY: fix CONFIG prompt matching in f_vty_wait_for_prompt()
Matching the CONFIG prompt using implicit '\w+(*)' pattern is
a bad idea, because it can actually match almost anything:

  - 'OsmoBlaBla(config)# ',
  - 'OsmoBlaBla(config) ',
  - 'OsmoBlaBla> ',
  - 'Mahlzeit'!

One problem is that the parentheses are interpreted as a matching
operator (which is used to group an expression), so they should
have been escaped by '\'. Another problem is that this pattern
is not complete, because '\# ' is missing. Let's fix this!

Change-Id: I8a0e3fcfb0c4e5854b7b1e39296052e679c63c73
Related: OS#3675
2018-10-28 23:03:44 +07:00
Harald Welte 9a5dd54350 SGsAP_Emulation: Add functions to send MME or VLR reset
... including encoding/decoding of names between string and binary labels

Change-Id: I981c7c1d34f0db60031b5436739cd924e5a09407
2018-10-28 09:52:34 +00:00
Harald Welte 1fd461a936 SGsAP: Switch over to osmocom branch/repo to avoid bugs in official one
The VLR and MME name are octetstring with dns-style labels and not
character strings.

Change-Id: I31a8ea04ef508beba9014aac5479693c47b7b956
2018-10-28 09:52:34 +00:00
Harald Welte af5bce4f97 Add SGsAP_CodecPort + SGsAP_Emulation module
Change-Id: I530f8f444d1c7ea0bf11d510da7b97f64a2039f5
2018-10-28 09:52:34 +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 d93047434b Add Misc_Helpers.ttcn to centralize TTCN3 shutdown handling
This function can now be called from anywhere to try and safely shutdown
a testcase. It is not optimal as we can't call "all component.stop" from
outside the mtc, but without any proper and orderly shutdown handling of
all our emulation components I believe this is the best we can do.

To use it:

import from Misc_Helpers all;

in your module and then call

Misc_Helpers.f_shutdown(__BFILE__, __LINE__);

You can also pass the function a verdict and a message and it will take care
of calling setverdict, but beware of the following:

While setverdict would accept any number of arguments as log message
and convert them to a log string f_shutdown expects one charstring.
It's possible to use the log2str function to use the log arguments in
setverdict for f_shutdown, for example

setverdict(fail, "Template didn't match: ", tmpl_foo);
would become
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Template didn't match: ", tmpl_foo));

Change-Id: I84d1aa6732f6b748d2bfdeac8f6309023717f267
2018-10-24 15:10:13 +02:00
Vadim Yanitskiy a201b97200 library/TRXC_Types.ttcn: correct FAKE_RSSI command template
Absolute form of FAKE_RSSI command shall contain an optional
threshold value. Otherwise it's interpreted as relative form.

Change-Id: Ief89b2601277488bb1782b981aff1061ddaa6637
2018-10-23 10:43:15 +00:00
Stefan Sperling aa1e60f584 add an IPA test which sends a chopped payload
Add another IPA test to the BTS and BSC test suites.
This new test sends the header in one burst, followed by the
payload which is transmitted byte-per-byte.

The test uses an ID REQ message. If acting as a server, the test
can expect an ID RESP message. However, if acting as a client, the
server will close the connection when it receives the ID REQ.
The CTRL interface port on the BSC does not close the connection in
this case, so that particular port is skipped by the test for now.

Change-Id: If75cb90841bb25619b414f0cabe008a2428a9fdf
Related: OS#2010
Depends: I4804ccabd342b82d44e69dbc6eaaae220ec7d4e4
2018-10-15 16:41:16 +02:00
Stefan Sperling 0ec1c26808 add chopped IPA ping test to BTS tests
Run the chopped IPA ping test from the IPA_Testing module
as part of the BTS test suite. Contrary to the BSC version
of this test, this test listens for an IPA connection rather
than connecting to an IPA server. Make code in the IPA_Testing
module for accepting connections actually work.

Change-Id: I4804ccabd342b82d44e69dbc6eaaae220ec7d4e4
Related: OS#2010
2018-10-15 15:19:32 +02:00
Neels Hofmeyr 61ebb8b7da bsc: add 3 tests for inter-BSC HO outgoing failures
Add
* TC_ho_out_fail_no_msc_response()
* TC_ho_out_fail_rr_ho_failure()
* TC_ho_out_fail_no_ho_detect()

Depends: I0980cacb9713e41a1eef3a0a7f6cc892e8a20da5 (osmo-bsc)
Change-Id: If772dbbc5f9790d3f911465e1303dd0a99811154
2018-10-11 17:21:47 +02:00
Harald Welte 7460a728fc IPA_Types/Emulation: Add RSPRO support
RSPRO is the protocol used by osmo-remsim.  It is embedded into an IPA
multiplex, and hence the TTCN-3 IPA code needs some extension to cover
support for it.

Change-Id: I536d6843b3e65b3ee35fbbcd6353e0fb0ce21c8e
2018-10-10 20:42:44 +00:00
Harald Welte 18314435e9 Add SGsAP_Templates for SGsAP on the MME<->MSC interface
Change-Id: I435dab312fc4965c69ffb9cc22917539ebab93e7
2018-10-10 20:33:21 +00:00
Stefan Sperling 59c15d67ca resolve ambiguity of MobileIdentityLV type name
There are two distinct types defined for a Mobile Identity LV IE.

One type definition lives in GSM_RR_Types and defines the "canonical"
IE form, with a full octet for the length.

Another one lives in RLCMAC_CSN1_Types which defines how a mobile
identity appears in paging requests. In this case, the length field
is only 4 bits in size. Rename this latter type from MobileIdentityLV to
MobileIdentityLV_Paging and add a comment to highlight this distinction.
TS 144 060 Table 11.2.10.2 explicitly states that only the value
part of this IE matches the definition of the canonical IE as
"defined in 3GPP TS 44.018" (actually, TS 44.018 further redirects
the reader to TS 124 008; see section 10.5.1.4 there).

As an aside, a third definition of the MobileIdentityLV type exists
in MobileL3_CommonIE_Types, which matches the "canonical" form.

Change-Id: I990316cd5ef5aaf079b03c344e3185ae6ab8ba6d
Related: OS#2404
2018-10-10 11:09:25 +02:00
Stefan Sperling 0796a82c86 Add a TTCN3 module for IPA protocol testing
This new module allows us to test IPA code in libosmocore
and libosmo-netif. Currently only one test is implemented,
which sends a chopped IPA ping message and expects to receive
an IPA pong.

The system under test is any IPA speaker on any TCP port.
Any test suite may call parametrized functions to create
an IPA testing component and run a particular test.
So far, one such test has been added to the BSC_Tests suite.

Change-Id: I246a405414e36a44dc1e308692faab8bf04da0e6
Related: OS#2010
2018-10-08 17:56:36 +02:00
Pau Espin 0aad596264 L1CTL_Types: Add support to set L1 Header params during SACCH tx
Change-Id: Id014f790ee2ede8ae796c37b1c6b25c4af9034d2
2018-10-03 21:39:10 +00:00
Vadim Yanitskiy 8f98d3fcc4 library/RSL_Types.ttcn: expect any l3_info for 'tr_RSL_UNITDATA_*' by default
This is quite useful when one needs to expect an RSL UNITDATA
message with any payload. Let's set 'l3_info' to '?' by default,
like it's already done for 'ts_RSL_DATA_*'.

Change-Id: I45260343b34d8d054e7efa72de11dd4cb510a8cc
2018-10-03 21:37:40 +00:00
Vadim Yanitskiy fabe0f202a library/RSL_Types.ttcn: fix inadequate template restriction
The 'tr_RSL_UNITDATA_IND' is a 'response' template, so there
is no reason to restrict 'link_id' to any obvious value.

Change-Id: I29ac0a2828b565baa1d2f3ac0a922bc441378f94
2018-10-03 21:37:40 +00:00
Neels Hofmeyr bd0ef93d4f bsc: inter-BSC HO: add TC_ho_out_of_this_bsc, TC_ho_into_this_bsc
Add f_gen_handover_req() like f_gen_ass_req(), to match AoIP or SCCPlite
requirements.

For incoming HO, MSC_ConnHdlr needs to know the SCCP addresses to expect the
incoming SCCP Connection from MSC to BSC. Add 'handover' section to
TestHdlrParams, and pass in the addresses from test_CT via that.

In osmo-bsc.cfg, add a remote neighbor config, so that the VTY command
'handover any to arfcn 123 bsic any' can trigger an outgoing inter-BSC HO.

Add various BSSMAP handover templates to BSSMAP_Templates.ttcn.
Add RR Ho Command template to L3_Templates.ttcn.

Move ts_BSSAP_Conn_Req() from msc/BSC_ConnectionHandler.ttcn to
library/BSSMAP_Emulation.ttcn, so we can also model an SCCP Connection Request
in BSC_Tests.ttcn (this time from MSC to BSC).

Add the two new tests to bsc/expected-results.xml.

Related: OS#2283
Change-Id: Id22852d4be7f127d827e7a8beeec55db27c07f03
2018-09-26 07:27:24 +00:00
Daniel Willmann 52918e5fcf MSC_Tests: Reply to Classmark Req in TC_lu_imsi_auth_tmsi_encr_3_1_no_cm
After osmo-msc I73c7cb6a86624695bd9c0f59abb72e2fdc655131, osmo-msc
sends a BSSMAP Classmark Request if encounters a missing Classmark,
which is the case during LU when A5/3 is enabled.

Fix this test by answering the Classmark Request, if any.

Change-Id: I25578c050b7e105ed71b064891d4cd418ee30fcf
2018-09-25 12:45:46 +00:00
Neels Hofmeyr 92b12b748c bsc: test Classmark Enquiry
Enhance TC_classmark to also include the BSSMAP Classmark Request -> RR
Classmark Enquiry part. So far it was only testing the return path of RR
Classmark Change -> BSSMAP Classmark Update.

This test will thus fail with current osmo-bsc master, and will succeed as soon
as osmo-bsc If5db638fd6e8d9c2ef9e139e99f0fabe1ef16ddf is merged.

Add:

* ts_BSSMAP_ClassmarkRequest in BSSMAP_Templates.ttcn
* tr_RRM_CM_ENQUIRY in L3_Templates.ttcn

Change-Id: Idaab4d568cf986b4897ba008f6262c839d1592fb
2018-09-18 14:33:42 +02:00
Harald Welte f097a8b94e GSM_Types: Add CBCH_Block definition of TS 04.12
Change-Id: Ib034aba11a0219959c4224238e559ba36e95cacf
2018-09-16 18:12:17 +02:00
Harald Welte 42ca6b1c31 GSM_Types: Add support for Osmocom RSL ChannelNr CBCH
Osmocom uses 0xC8 as channel number for CBCH, this is an extension
to the 08.58 definitions.

Change-Id: I2203f4a9012c154c12ac9d8f9c448a9ed0f49197
2018-09-16 12:41:11 +02:00
Harald Welte cc373205ad rsl: Add SMSCB related RSL types / templates
Change-Id: I203e72a203ffa7538aadc7b96e1ae7e21956c160
2018-09-16 12:41:11 +02:00
Harald Welte a266325929 Osmocom_VTY_Functions: Generalize to handle multiple VTY ports
The existing Osmocom_VTY_Functions code was centered around a global
module parameter specifying the prompt prefix.  This prevented a
single test to use multiple VTY connections to different Osmocom
programs.

This patch generalize the code by widening the prompt matching
in f_vty_wait_for_prompt() and by allowing the caller to specify
the prompt prefix to override the modulepar.

Change-Id: I574b56c42fe95540af44a2c43d0fb469938c0e65
2018-09-16 12:41:11 +02:00
Alexander Couzens 4786b3f5ed library/GSUP_Types: correct value of the GSUP_CancelType
The comment in the c header of OSMO_GSUP_CANCEL_TYPE_UPDATE says:
1 = /* 0 on the wire */,
2 = /* 1 on the wire */

Change-Id: I4d22af9fee19e6036dbb555422759e3c1285416a
2018-09-16 03:33:30 +02:00
Alexander Couzens d24973deb1 GSUP_Types.ttcn: add tr_GSUP_SAI_REQ_UMTS_AKA_RESYNC
Match only on AKA RESYNC packages

Change-Id: Ibab8a76fde78db6e7a84794e0b641bcb7b1fd1a7
2018-09-11 16:20:28 +00:00
Alexander Couzens 387f7f37b1 L3_Common: extend the AuthVector to contain AUTS
AUTS is used in the UMTS AKA resync procedure.

Change-Id: Id1afa47778e6220cab375ae4b54b251801724fdb
2018-09-11 18:04:14 +02:00
Alexander Couzens 15faf92611 L3_Template: add template ts_GMM_AUTH_FAIL_UMTS_AKA_RESYNC
ts_GMM_AUTH_FAIL_UMTS_AKA_RESYNC send a Authentication & Ciphering failure
to resync the USIM with the HLR.

Change-Id: Ia58dc1483757887ca14cfae19e30f9c91fef5874
2018-09-04 17:15:03 +00:00
Stefan Sperling 6a90be4bae improve connection failure message in IPA emulation
Show addresses and ports which were attempted in the IPA
connection failure message.

Example output:
Verdict: fail reason: Could not connect IPA socket from "" port -1 \
	to "127.0.0.1" port 4238; check your configuration

Change-Id: I828fe67d66bcd668aa14922b89a2feac56dc2d9a
2018-08-31 15:07:40 +02:00
Stefan Sperling 02585905fb show return code when sending L1CTL_FBSB_REQ fails
Provide a little bit more information when a BTS test fails
due to L1CTL FBSB failure.

Example output:
Test case TC_si_sched_default finished. Verdict: fail reason: \
  FBSB Failed with non-zero return code 255

Change-Id: I5e8f23a2615b64bdf3167d486ba808c93f0f4b23
2018-08-30 17:06:48 +02:00
Neels Hofmeyr 3bf31d216a fix SCCPlite BSC tests: send IPA ID ACK, not GET
From libosmo-sccp.git Icffda98579e676ab6ca63c9c22cf5d151c4fe95f on, we expect
an IPA ID ACK upon first connecting, not an IPA ID GET. This might be specific
to the one MSC tested so far, but it's the status quo.

Make the IPA server in IPA_Emulation configurable, to conform and send the IPA
ID ACK upon connecting.  This fixes the ttcn3-bsc-tests,SCCPlite suite, broken
by above libosmo-sccp commit.

For other IPA clients, it is so far required to send the IPA ID GET, so only
configure the SCCPlite server in BSSAP_Adapter.ttcn to send IPA ID ACK, and
leave the others unchanged.

Related: OS#3500 OS#3498
Related: Icffda98579e676ab6ca63c9c22cf5d151c4fe95f (libosmo-sccp)
Change-Id: I34b6296a1a408729802a9659c6524c0f67a2f4fe
2018-08-24 18:29:48 +02:00
Alexander Couzens 56101c935e BSSGP_Emulation: dont fail when removing a non-exitent client
On multiple BSSGP tests the IMSI might not anymore registered to the first BSSGP

Change-Id: Ibad8971e5acc2691da29cf7fa394d1d58eea79a4
2018-08-14 13:26:47 +00:00
Alexander Couzens 7eb5b85f39 BSSGP_Emulation: remove unused BSSGP_SP.receive(PDU_L3_MS_SGSN)
As the llc is handled outside, this function is not anymore needed

Change-Id: Ib910dec4a54e155573c162a70731f20cbf1e9c5d
2018-08-14 13:26:47 +00:00
Alexander Couzens cdfb7515ba BSSGP_Emulation: move LLC layer out of BSSGP
The LLC layer needs to be accessed by the SGSN tests
in order to do multi-BSSGP tests.
Otherwise the sgsn will see LLC frame with wrong sequence
numbers and drop them.

Change-Id: Ie9e9d7da0a78a96f4f431c9085b9e273a39535f1
2018-08-14 13:26:47 +00:00
Alexander Couzens 6b449fbf84 BSSGP_Emulation: add type record LLC_Entities
In prepartion of moving the LLC layer out of the BSSGP

Change-Id: I1a8c6a608c84a984e542510482bbfc5394ae6658
2018-08-14 13:26:47 +00:00
Alexander Couzens 0e510e693d BSSGP_Emulation.ttcn: extend BSSGP_Client_CT to hold 3 instances of BSSGP
Change-Id: Ibd7abba826a08b582361e9c255e9c44185e14067
2018-08-14 13:26:47 +00:00
Alexander Couzens 2c12b24a47 NS_Emulation: support multiple instances at the same time
The NS_Emulation has configuration values hardcoded or bound
to module parameters which prevents multiple instances.
Replace the module parameter based configuration with configuration
given when starting the NS_Emaulation.

Change-Id: I9128f9ad5c372779c38799269393137ba52576cd
2018-08-13 16:23:50 +00:00
Stefan Sperling 4880be4385 add DTX fill frame BTS tests
Add tests TC_tch_sign_l2_fill_frame and TC_tch_sign_l2_fill_frame_dtxd.

TC_tch_sign_l2_fill_frame is already passing and verifies that fill
frames are sent if there is nothing else to transmit on a SDCCH4/SDCCH8,
TCH/H, or TCH/F signalling channel where DTX is disabled for downlink.

TC_tch_sign_l2_fill_frame_dtxd is currently failing. It verifies that
only specific fill frames are sent, as required by GSM 05.08 for TCHF
signalling channels with DTX enabled for downlink. At present, our
implementation generates no fill frames in this case, which is one
piece of the problem described in issue OS#1950.

Change-Id: Id4e0de6e78b62cd408f600a57a28617d91da64af
Related: OS#1950
2018-08-09 11:08:44 +00:00
Harald Welte f9d449edd6 HLR: Add HLR_EUSE.ttcn to implement minimal external USSD Entity
As OsmoHLR is getting support for external USSD Entities (EUSEs),
we have to implement this function in the test logic in order to
test it.

Change-Id: Ibab210b06abfd5a21e81c7f7fbe574c4f67414a0
2018-08-08 11:06:31 +02:00
Harald Welte b409ff2819 move USSD_Helpers.ttcn to library
We want to use those also from the HLR_Tests, not just from MSC_Tests.

Change-Id: I22be6c03d85dc6d6a8266b5ebce5d0c69c0551ed
2018-08-07 23:32:32 +02:00
Harald Welte 95686e0bd7 IPA_Emulation: Add missing zero byte to strings in IPA CCM ID RESP
Change-Id: I3fdc0f47381d5ba1763197d5f264696f04d0396f
2018-08-02 15:14:03 +02:00
Stefan Sperling 23b45974ce detect VTY TELNET port connection failures (attempt #2)
Pass the CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT parameter to
the TELNET port by default. This allows tests to make progress
into an error handling path if they are started while the osmo-*
program they want to connect on VTY is not running.

Observed with osmo-ggsn tests, where if the one test runs
into a VTY connection failure the subsequent test would get
stuck forever in a map() call on the VTY TELNET port.

Teach the function f_vty_wait_for_prompt() about connection
reports by the TELNET module. We may now receive an integer which
represents the socket file descriptor for the telnet connection.
This case was not handled by the previous change made in
commit cb111b21ab. As a result,
BSC tests started failing with "VTY Timeout for prompt" because
the alt-statement in f_vty_wait_for_prompt() would not progress
past the integer sitting on the VTY port's receive queue.

Change-Id: I56925f93af6c55e93f3f417099db135744da6a40
Related: OS#3149
2018-07-27 17:20:38 +02:00
Philipp Maier 3629139790 MGCP_Test: add function to check for RTP err counters
At the moment we check the error counters of the RTP statistics in
the testcases. However, in most situations we will do the check to
make sure that no errors occurred (all counters == 0). Rather than
having a long tail of if statements in the testcases we should have
a function for this. This also makes it much easier in case we add
more error countes lateron.

- add and use function f_rtpem_stats_err_check()

Change-Id: I69e5f80b0765284ec99056ce62c315461967d2a1
Related: OS#3384
2018-07-25 18:44:54 +00:00
Stefan Sperling c307e689b4 introduce a TTCN3 test suite for SCCP
This test suite acts as an SCCP server on top of M3UA.

SCCP tests are run against the sccp_demo_user program which
can be found in libosmo-sccp/examples. This program must be
started in client mode: sccp_demo_user -c
The SCCP test suite should then work out of the box with
the provided SCCP_Tests.cfg file and this additional change
to sccp_demo_user default point codes:
https://gerrit.osmocom.org/#/c/libosmo-sccp/+/9652/

There is currently only one test, for the libosmo-sccp crash
reported as issue OS#2666. The implementation of this test
is currently using an ugly workaround due to shortcomings of
the M3UA Emulation layer (see source code comments). Whether
a better solution is feasible is still to be determined.

The test requires a patch to the SCCP Protocol Emulation which
has been submitted upstream: https://git.eclipse.org/r/#/c/124552/

Change-Id: I03f5e8b282a7396b45417495c88d8fb81b26cda8
Related: OS#2666
2018-07-24 19:05:10 +00:00
Philipp Maier c290d7292e MGCP_Test: check payload type of received RTP packets
When an RTP packet is received, the payload type is not checked,
so we will not detect if the MGW emits packets with a wrong payload
type for some reason.

- Introduce a statistics counter that counts packets with wrong PT
- Update testcases so that they check for the statistics for wrong
  PT count.

Change-Id: I83d4b04656a16ced624024245a2fcb7a0ad48a8a
Related: OS#3384
2018-07-24 19:01:27 +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
Pau Espin f3e25384d7 lib: gtp: Add templates to send ErrorIndiciation
Change-Id: I7c20bc3b62a953efe57eb05a8ba89f9f0830a816
2018-07-21 17:54:35 +00:00
Pau Espin 940134537a sgsn: Add Test to verify Recovery procedure during CreatePdpResp
Change-Id: Ic81b854967492194367b7ce8a667c29c777791bf
2018-07-21 17:54:35 +00:00
Pau Espin 67e47dd328 lib: L3_Templates: Fix DEACT PDP REQ msg type and make tearDownInd optional
Specs state in 3GPP TS 24.008 that TearDownInd IE is optional, so allow
possibility to omit it.

Also fix protocolConfigOpts being passed as parameter but not being used
in template tr_SM_DEACT_PDP_REQ_MT.

Change-Id: I006d64f51c17a22a42a225ddfa4119933e48a022
2018-07-13 19:16:22 +02:00