Commit Graph

829 Commits

Author SHA1 Message Date
Vadim Yanitskiy 1f4486cfe3 library/GSM_RR_Types.ttcn: fix: IA Rest Octets may have optional padding
According to 3GPP TS 04.08 (version 7.21.0), section 10.5.2.16 and
table 10.5.45, IA Rest Octets IE may contain spare bits. Let's add
an optional field 'pad' to record 'IaRestOctets'.

NOTE: somehow this change crashes my TITAN runtime:

  dec_GsmRrMessage(): Stream before decoding: '2D063F100FE3673A096B0000C800300B2B2B2B2B2B2B2B'O
  *** Error in `././PCU_Tests': malloc(): memory corruption: 0x000000000074a790 ***

while the recent version works just fine.

Change-Id: Ifdcdcf50709fcc03195cb8ef6092977e26f910ec
2019-09-05 17:25:46 +02:00
Vadim Yanitskiy f10bb45899 library/GSM_RR_Types.ttcn: fix: IA Rest Octets is mandatory IE
According to 3GPP TS 04.08 (version 7.21.0), table 9.18, IA Rest
Octets (see 10.5.2.16) is a mandatory IE, not optional.

Change-Id: I403d2141536303a966be7ff51b06c3de202412e6
2019-09-05 17:25:40 +02:00
Vadim Yanitskiy dd6d5d1baa library/PCUIF_Types.ttcn: inform RAW codec about PADDING in PCUIF_data
PADDING is one of the TITAN specific language extensions [1], which
tells the RAW codec that an encoded payload shall end at a boundary
fixed by a multiple of 'padding' unit bits counted from the
beginning of the message.

Let's use it for record 'PCUIF_data', where the fixed-size buffer
is located in between the other fields, so padding will be ignored
by the RAW coding after decoding:

  $HOST: dec_PCUIF_Message(): Decoded @PCUIF_Types.PCUIF_Message: {
    msg_type := PCU_IF_MSG_DATA_REQ (0),
    bts_nr := 0, spare := '0000'O,
    u := {
      data_req := {
        sapi := PCU_IF_SAPI_AGCH (2),
	len := 23,
	data := '2D063F100FE3673A096B0000C800300B2B2B2B2B2B2B2B',
	...
      }
    }
  }

As a result, we don't have to deal with padding manually and
can safely use 'decmatch' statement in the receive templates.

[1] usrguide/referenceguide/4-ttcn3_language_extensions.adoc

Change-Id: I5808954b5c67c3239e795e43ae77035152d359ef
2019-09-05 16:18:59 +02:00
Harald Welte 09538f8bfd bsc: Test suite for CBSP (Cell Broadcast Service Protocol)
In this testsuite, we simulate BTS and CBC by attaching to RSL and CBSP
protocol interfaces of the BSC.  We then issue a variety of CBSP
commands to the BSC and check for corresponding action on both the BTS-
facing RSL as well as responses on the CBSP side.

Change-Id: Ia6ffac181f50586d06d2f29bca1c57285179e861
2019-09-05 13:13:35 +02:00
Harald Welte b522323cbb CBSP: Hack to make receive templates work
For some reason, the 'ifpresent' annotation doesn't work in lists
of templates.  This means we have to re-think the CBSP template
structure at some point.  However, this would be a significant detour
and I'd rather have working tests right now, so we can verify the
actual functionality merged into the BSC right now.

Change-Id: I3fa174b4352c17feaea4d33f773877104d4913c4
2019-09-05 12:44:13 +02:00
Harald Welte 908ce54531 bts: Add test for ETWS Primary Notification via P1 Rest Octets
Change-Id: I247ea0f336e4ae9eecb1e8166f2326bdd2c299f4
Related: OS#4047
2019-09-05 12:44:13 +02:00
Harald Welte cd451ef083 Add CBSP_CodecPort + CBSP_Adapter
Change-Id: I36b39b320c21502395f9d51d769d76adf5f5d602
2019-09-04 10:45:41 +00:00
Harald Welte ea260349de Add CBSP (Cell Broadcast Service Protocol) types + templates
Change-Id: Ida2e0af7d282fd7d5318110c05efa5a10114242c
2019-09-04 10:44:59 +00:00
Pau Espin ce0d615e12 sgsn: Proper shutdown of RAN_Adapter components
Otherwise TTCN3 errors sproadically during shutdown:
""""
SCCP_Emulation.ttcn:5661 Receive operation on port SCCP_SP_PORT succeeded, message from SGSN_Test_0-RAN(414)
...
SCCP_Emulation.ttcn:5293 Sent on MTP3_SCCP_PORT to SGSN_Test_0-M3UA(415) @SCCP_Types.ASP_MTP3_TRANSFERreq_sccp
SCCP_Emulation.ttcn:5293 Outgoing message was mapped to @MTP3asp_Types.ASP_MTP3_TRANSFERreq
SCCP_Emulation.ttcn:5293 Dynamic test case error: Sending data on the connection of port MTP3_SCCP_PORT to 415:MTP3_SP_PORT failed. (Broken pipe)
SCCP_Emulation.ttcn:5293 setverdict(error): none -> error
"""

Similar shutdown is already done in f_cleanup() of SCCP_Tests.ttcn.

Related: OS#4176
Change-Id: I471eb851e5d41de5d8d974ec81be27024d7d313a
2019-09-02 09:04:53 +00:00
Oliver Smith aac9b9ceca BSSGP_Emulation: add BssgpDecodeDepth
Make the decoding level (BSSGP, LLC, SNDCP, L3) configurable, so the
existing PCU tests, that expect messages only decoded to the BSSGP
level, can pass again. Move the SNDCP decoding in f_dec_bssgp above the
L3 decoding, so f_dec_bssgp goes through the layers in the reverse order
of f_send_bssgp_dec.

I have verified, that all testsuites using the BSSGP Emulation (SGSN,
PCU, PCU-SNS) are still working with this patch.

Related: OS#4180
Fixes: 955aa94504 ("BSSGP_Emulation: Abandon "BssgpDecoded" intermediate structure")
Change-Id: I8f76385528c1de98c557cee451c0e0dfd182b605
2019-09-02 09:15:33 +02:00
Oliver Smith a2cf8bd0d1 BSSGP_Emulation: as_unblocked: fix SIG broadcast
I am not aware that this caused breakage anywhere. But from reading the
patch, this is a regression that needs to be fixed.

Fixes: 955aa94504 ("BSSGP_Emulation: Abandon "BssgpDecoded" intermediate structure")
Change-Id: I36a9a4d61be52a4d86ac1cbf6e6976cf01cff7c6
2019-08-30 12:05:31 +02:00
Oliver Smith 0d7b7abb00 Revert "RAN_Adapter: invert check for RAN_ops == omit"
This reverts commit 5932cd3463. It caused
a lot of tests in the ttcn3-bsc-test, ttcn3-bsc-test-latest,
ttcn3-bsc-test-sccplite and ttcn3-bsc-test-sccplite-latest testsuites to
fail with:

RAN_Adapter.ttcnpp:179 Dynamic test case error: Text encoder: Encoding an unbound optional value.

Related: OS#4156
Change-Id: I441c701553eef8e9e018d11923359eb3f3b26826
2019-08-19 13:46:35 +02:00
Harald Welte 0e0380804a DIAMETER_Emulation: Remove unused dependency to MobileL3 and DNS
This is an artefact of copy+paste programming

Change-Id: I10d56ef9971149350812b1504844217195623bd8
2019-08-18 19:40:42 +02:00
Harald Welte 3286eb37c5 IPA_Emulation: Fix building without CTRL support
Back in JUne, Change-Id I4d1eca6b0008a395b7f7449e6ea3f9b6d41133c7
attempted to introduce compilation of IPA_Emulation without CTRL but
it failed to cover all references to CTRL with the correspondign
ifdef/endif blocks.  Let's fix this.

Change-Id: I68349b32f613aacced84011601121f2265243600
2019-08-18 19:40:42 +02:00
Harald Welte d27ab24dcb library: Add DIAMETER Templates, Emulation, CodecPort
Contrary to the DIAMETER_Types.ttcn, these files are not generated
but written by hand.

Change-Id: Iafbf55ab25bbaa40960eb1744cff36dcd7970c17
2019-08-18 17:14:20 +00:00
Harald Welte 5aadb0ef18 library: Add [generated] DIAMETER_Types.ttcn
The way how the TITAN support for DIAMETER works, is that there's
an awk-based shell script and lots of DIAMETER dictionaries in the
https://github.com/eclipse/titan.ProtocolModules.DIAMETER_ProtocolModule_Generator
repository.

I've used 'AVP.sh Base_IETF_RFC3588.ddf BaseTypes_IETF_RFC3588.ddf
AAAInterface_3GPP_TS29272_f10.ddf GxInterface_PCC_3GPP_TS29212_f10.ddf
S6Interfaces_3GPP_TS29336_f00.ddf MobileIPv6_HA_IETF_RFC5778.ddf
RxInterface_PCC_3GPP_TS29214_f20.ddf' to generate the DIAMETER_Types
file we use here.

DIAMETER is used as signaling protocol between the HSS and other core
element nodes in the EPC, such as the MME and S-GW.

Change-Id: I85834e98e238b7ff6058264a0f365d05c15cd669
2019-08-18 17:14:20 +00:00
Harald Welte 0f7d03a787 mme: Add GTPv2 support
this includes a GTPv2_CodecPort (for the usual transcoding)
as wella as an empty GTPv2_PrivateExtensions.ttcn without which
the TITAN GTPv2 ProtocolModule won't compile.

Change-Id: I1c1b8409077103dd4e64e467d21d33d8c9c4ac95
2019-08-18 17:14:20 +00:00
Harald Welte fc5f637505 library: Add initial set of LTE/EPC NAS templates
Change-Id: I53a598011041d642f03dcd9cca128f4e9da4adfd
2019-08-18 17:14:20 +00:00
Harald Welte 3549811565 library: Add S1AP CodecPort/Emulation
Change-Id: I9bfba3ab2a3830e590b203c44c03b9c9383fff99
2019-08-18 17:14:20 +00:00
Alexander Couzens 5932cd3463 RAN_Adapter: invert check for RAN_ops == omit
The SGSN_Tests.ttcn run into bugs when doing the isvalue() check on a const object.
Check explicit for "omit" to skip creation of the vc_RAN object

Change-Id: I639ab6d0586174c0f20b93a53169f0aa254970fa
2019-08-18 17:12:46 +00:00
Alexander Couzens d7b2950ac1 RAN_Adapter: protect RAN_EMULATION_CTRL with ifdef
Change-Id: I1ff98c933b00a90f54ceedf290121d61d35c6063
2019-08-18 17:12:46 +00:00
Harald Welte 717c730731 RAN_Emulation: Support for PS domain
So far, the RAN_Emulation only supported the CS domain, and not PS. Let's
change that so we can start having IuPS related tests.

Change-Id: I7ba4662e5a7ba31a2582b0c133b3140c8057678f
2019-08-18 17:12:46 +00:00
Harald Welte 955aa94504 BSSGP_Emulation: Abandon "BssgpDecoded" intermediate structure
It originally seemed like a great idea to define a custom record
which aggregates the decoded BSSGP, LLC, L3 and/or SNDCP and passes
it to the individual ConnHdlr.  However, particularly with testcase
interoperability for IuPS in mind, this seems bogus.  Also, we
never really took advantage of this.

Let's now decode as far as we can decode any PDU, and then send the
decoded version of that PDU via the ports between the BSSGP_Emulation
and the ConnHdlr component.

Change-Id: I8c1082880902dd9a04935945f0293895f4d0c53a
2019-08-18 17:12:46 +00:00
Harald Welte ce818da5b0 library: Add S1AP Templates
Change-Id: I148b33eb5074d3549e7cd533af2cbf90f1c6d23f
2019-08-15 09:49:18 +00:00
Harald Welte 799049cbd5 library: S1AP encoding/decoding using libfftranscode and ASN.1 from V15.5.0
This allows us to encode/decode 3GPP S1AP messages, as used on the S1
interface control plane between eNodeB and MME.

Change-Id: Ie019bef1f3ef9cc5f6c94a64c7f352c510fb5633
2019-08-15 09:49:18 +00:00
Harald Welte b8a4ac80a6 mme: initial skeleton for MME / SGsAP tetss
Change-Id: Idbd54838daaf12acccc3253dc4278de75eaaaf31
2019-08-15 09:49:11 +00: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
Oliver Smith af2f1f8d89 library: allow "?" in tr_ML3_MT_MM_ID_Req again
Fix MSC test TC_lu_by_imei, which uses tr_ML3_MT_MM_ID_Req with the
default "?" (AnyElement) parameter. It was failing with the following
runtime error:

Dynamic test case error: Performing a valueof or send operation on a non-specific template of enumerated type @L3_Templates.CmIdentityType.

Fixes: 3289845913 ("L3_Templates: add enum CmIdentityType")
Related: https://www.eclipse.org/forums/index.php/t/1099816/
Change-Id: Ie7fbe52ac3c0c8f233680dcc311febec77d2ed0b
2019-07-22 11:35:23 +02:00
Oliver Smith 1d118ff753 msc: add check IMEI tests
Extend BSC_ConnHdlr with new check IMEI related parameters. Add tests
for check IMEI and check IMEI early for multiple auth variations, as
well as variants where the HLR would respond with NOK or ERR.

Note that we can safely set "check-imei-rqd 0" in f_init(), because the
latest OsmoMSC version already suppors this VTY command.

Two tests do not always pass, sometimes the RAN connection breaks
before the test finishes (TC_lu_imsi_auth_tmsi_check_imei_err and
TC_lu_imsi_auth_tmsi_check_imei_nack). I have added them as expected
errors in the expected-results.xml.

Related: OS#2542
Change-Id: Ic34bb8dc8547cafb5a53df03884554dd4f72956d
2019-07-12 06:05:39 +00:00
Oliver Smith 3289845913 L3_Templates: add enum CmIdentityType
Change-Id: Ibe50669663e641cdfd6a88f22c5404e2d90323b7
2019-07-10 02:01:46 +00:00
Oliver Smith b4bf2b2438 Cosmetic: L3_Templates: fix comment: fro -> for
Change-Id: I239bbf21202300ac9883b5a0b5608d10db0fd721
2019-07-10 02:01:46 +00:00
Oliver Smith 745ed95c4c L3_Templates: fix IMEI length: 14 (not 15)
The right length is 14. The 15th additional checksum digit is not
intended for digital transmission.

A good overview of the IMEI/IMEISV structure is here:
https://en.wikipedia.org/wiki/International_Mobile_Equipment_Identity#Structure_of_the_IMEI_and_IMEISV_(IMEI_software_version)

Related: Iaf2569c099874b55acbd748b776394726cc5ce54 (osmo-msc)
Change-Id: I7121f29a90f19d92c7bf26f26e76f1978c648459
2019-07-09 11:25:40 +00:00
Vadim Yanitskiy f3cc649673 library/L1CTL_Types.ttcn: introduce TRAFFIC_{REQ|IND} templates
Change-Id: Ic9f412579da33d0c76b7dd616bd1b305aacf5884
Related: OS#1855
2019-07-07 08:14:10 +00:00
Vadim Yanitskiy 71136df433 library/TRXC_Types.ttcn: add FAKE_CI command for C/I simulation
Change-Id: Ibbab8df117a97a3dce160c67d1adbc67c31637e2
Depends: (OsmocomBB) I7080effbbc1022d1884c6d6f0cb580eba8e514ff
Related: OS#4006
2019-07-07 08:14:10 +00:00
Harald Welte f82985484b ggsn: Add TC_pdp4_act_deact_ipcp_pap_broken()
This test case reproduces a real-world PCO capture including a broken
PAP AuthenticationReq.  It triggers some weird behavior in OsmoGGSN
1.3.0 where it would send duplicate IPCP repsonses and no PAP response.

Change-Id: Ie89d984ed9e26fbbb2e4914bdb8623446d462a4c
Related: OS#3914
2019-07-03 16:24:19 +00:00
Oliver Smith 216019fdd0 RTP_Emulation: allow expecting connection refused
Prepare for upcoming connection timeout test, where we want to run into
connection refused.

Change-Id: Id6365bc59e19368a87b951367742a0b7cc5e9574
2019-06-26 16:15:13 +02:00
Pau Espin 1a026a52d3 lib/mgcp: Add new port with support to handle multiple MGCP sockets
* Some scenarios like MGW BSC-attached in SCCPlite require handling of
2 MGCP-over-UDP sockets in MGCP Emulation: 1 for regular
libosmomgcp-client from osmo-bsc and another one from the forward socket
from osmo-bsc (of MGCP-over-IPA messages communicated with MSC).

* Old port is kept for backward compatibility with other tests and
enabled by default. It's also interesting to keep it because it makes
tests without special needs (2 sockets) to use the old port/API which
produces simpler code to read and mantain.

* Users of the new port have to enable multi_conn_mode parameter and
expect to interact with port MGCP_CLIENT_MULTI instead of MGCP_CLIENT,
which will offer messages containing information about the UDP
connection being used by that message.

Change-Id: Ic0ba8c5cde068c07671512a83095d83e28b86746
2019-06-24 13:53:25 +00:00
Harald Welte aba42164fb BSSMAP_Templates: Provide complete set of CellID related rx/tx templates
Change-Id: I07c5fb9b621b09e11fec025b56f971fb61060839
2019-06-21 09:34:14 +00:00
Vadim Yanitskiy f2c3fa9144 library/RAN_Emulation.ttcnpp: fix: properly handle SAPI / DLCI for RANAP
Some of our SMS related test cases are failing. The problem is
that SMS related RAN messages shall be sent on SAPI 3, as per
GSM TS 04.11, section 2.3, while they actually being sent on
SAPI 0.

For the messages coming from the TCs towards OsmoMSC over RANAP,
we need to convert from DLCI to SAPI in f_xmit_raw_l3(). OsmoMSC
also needs to be patched, because it seems to ignore SAPI IE.

Change-Id: I6199fd5f26774fb1ec419bc1ef9e1caeca3a0d35
2019-06-20 22:25:50 +07:00
Vadim Yanitskiy e06f228be1 library/ranap: enrich both t(s|r)_RANAP_DirectTransfer templates
Instead of having two similar variants of RANAP_DirectTransfer:

  - t(s|r)_RANAP_DirectTransfer, and
  - t(s|r)_RANAP_DirectTransferSAPI,

let's make the first one more flexible, and drop the last one.
This is achieved by introducing two supplementary functions:

  - f_gen_ts_dt_ies(), and
  - f_gen_tr_dt_ies,

which dynamically compose DirectTransfer.protocolIEs.

Change-Id: I7333d08c4d5a72159bfbd50fe8e7b1084cd61b9e
2019-06-20 22:13:25 +07:00
Pau Espin 43021cbbf7 lib/bssmap: Introduce function f_bssmap_ie_cic_2_int()
Function will be re-used in forthcoming commits.

Change-Id: Ifc7444ecca1571959ed83b43d3c7461c637686ae
2019-06-19 10:52:11 +00:00
Eric Wild ae8f262651 BTS: BS power tests
osmo-bts does currently not use the signaled lchan BS power level, nor
does it update the BS power IE returned in the measurement results.

Change-Id: If91fb57b4070c60bb277d0b55d69ee3dde47ee48
2019-06-18 17:08:09 +02:00
Vadim Yanitskiy 6c9fafcead library/GSUP_Types.ttcn: refactor PROC_SS IEs generation
Both ts_GSUP_PROC_SS_ERR() and tr_GSUP_PROC_SS_ERR() templates
used to compose the set of GSUP IEs manually, while similar ones
were using both f_gen_ts_ss_ies() and f_gen_tr_ss_ies().

This led to the following problems:

  - tr_GSUP_PROC_SS_ERR was not tolerant to omitted
    message class IE, which was recently introduced;
  - code duplication.

Let's modify the both functions in order to accept an optional
Cause IE value, which is omitted by default, and use them in
the both templates.

Change-Id: I5cd6d2bc754bcedd1e721b3bd95ada9cdd44bcf0
2019-06-14 21:49:57 +00:00
Vadim Yanitskiy de8af3d2ac library/L1CTL_PortType.ttcn: clarify and unify timeout messages
It's way more cleaner when you see:

  Timeout waiting for L1CTL_RACH_CONF

instead of:

  Timeout in RACH.

Change-Id: I25e8230c2e4b29b2583bf8954d0dedaa18e5d6ae
2019-06-13 15:33:34 +00:00
Pau Espin acc5119bac lib/IPA_Emulation: Build IPA_CTRL conditionally based on define
Change-Id: I4d1eca6b0008a395b7f7449e6ea3f9b6d41133c7
2019-06-13 16:33:49 +02:00
Pau Espin 579cd7a406 lib/CTRL: Improve and add more helper templates and functions
Change-Id: Icc6ac860ebd6a719f9e0cb5c5345fb4d39a864ce
2019-06-13 09:39:14 +00:00
Pau Espin 5a2d743e5d bsc: Introduce test TC_ctrl_location
Related: OS#2012
Change-Id: I3640f6889e3b6adc3b4601082f948543c64a2fe3
2019-06-13 09:38:24 +00:00
Pau Espin 4d0e5e521b lib/RAN: Introduce CTRL_CLIENT port to access CTRL muxed in RAN IPA conn
This is the case for SCCPlite between BSC and MSC (or BSC-NAT). MGCP and
CTRL can be multiplexed over the same underlaying IPA conn.

Related: OS#2012
Change-Id: Id90c1609f0439b00379166fb9e4028d181fc023e
2019-06-13 09:38:05 +00:00
Pau Espin 76ba541efa bsc: Fix trailing whitespace
Change-Id: I97c6cc290d6cc23611ac38e7e370b5b0b88cca1d
2019-06-13 09:38:05 +00:00
Oliver Smith 936dbe64ee hlr: add Check IMEI tests
Create tests for most code paths of rx_check_imei_req() in hlr.c (except
for subscriber create on demand, this will be in an upcoming patch).

Add missing message types to GSUP_Types.ttcn, and adjust the IMEI and
IMEI_Result IEs for consistency with the existing IEs, and to make the
tests compile.

Related: OS#2541
Change-Id: I97c8462f0817149feadd0c4865e3df6c2af92a80
2019-06-13 09:35:17 +00:00
Eric Wild 61edb7e974 BTS: add some dynamic power control tests
Change-Id: I57489ba22542d859ced767e856634f9060c060f0
2019-06-12 20:16:44 +00:00
Pau Espin 6bf6313e15 CTRL_Types: Fix SET value not encoded in message
Change-Id: I9e0132429265d03caa97af2b2f44eed0327f3200
2019-06-07 15:37:36 +02:00
Pau Espin 955491872e bsc: Only append Osmux IEs in BSSAP AoIP
Previous to this commit, BSSAP Reset (Ack) messages contained Osmux
Support IE even if transport was SCCPLite, where those IEs are actually
meaningless.

Change-Id: If6cc0f65a0f273297a4523e5d6a7564d966f0aa6
2019-06-06 17:06:29 +02:00
Pau Espin c6b78ff2f9 Add and set transport field for RanOps structure
This will allow RAN_Emulation to have better knowledge on the protocol
stack in use, and behave differently based on that information.
For intance, forthcoming commit will append OsmuxSupport IE only if
transport is BSSAP AoIP.

Change-Id: Ife62e328af2d3f2475ff93249f2138820c7ddabb
2019-06-06 17:06:29 +02:00
Harald Welte a7d81f1761 RSL_Types: Fix definition of RLL ERROR INDICATION
This message uses the "RLM Cause IE" and not the "Cause IE"

Change-Id: If3b92ab475817922c05c9af691d9f79da33804ac
2019-06-04 09:12:03 +00:00
Harald Welte 9ea918c2a8 bts: Add TC_segm_concat to test segmentation+concatenation
Change-Id: I6a9ce3e27f4a01412186b3b5d8d2b86573b6f8ac
2019-06-04 09:12:03 +00:00
Harald Welte 2f2b2b7f95 bts: Extend LAPDm test suite with a number of new tests
This adds the following test cases to BTS_Tests_LAPDm.ttcn:
* TC_sabm_retransmit_bts()
* TC_sabm_invalid_resp()
* TC_sabm_dm()
* TC_establish_ign_first_sabm()
* TC_iframe_seq_and_ack()
* TC_iframe_timer_recovery()

Change-Id: I4e1136c0c0f10d5bc8d01e826ae5d92f17a0b2aa
2019-06-04 09:12:03 +00:00
Harald Welte 1365a4e7c5 LAPDm_RAW_PT: Fix handling of LAPDm on SACCH (L1 header)
The  existing implementation dind't account for the two-byte L1 header
preset on the SACCH in both uplink and downlink.

Change-Id: Iae97ad153e9d1688306b39b5fb43ade323dbe500
2019-06-02 23:29:05 +02:00
Harald Welte 66f07549b7 LAPDm_RAW_PT: Switch to dedicated channel without RACH+IMM.ASS
Change-Id: I07dd9191ca441bfd1e43e3521e98f88ad2d0489a
2019-06-02 22:36:15 +02:00
Vadim Yanitskiy 7c2c10cbf0 BTS_Tests.ttcn: introduce TC_ho_rach() for handover RACH
The idea of this test case (as can bee seen from its name) is to
verify handover RACH detection. What we basically do is:

1. Activate a logical channel on the BTS side (HO_SYNC for now);
2. Switch the MS (e.g. trxcon) to that channel without waiting
   for Immediate Assignment and sending Access Burst;
3. Send an Access Burst on that channel using RA = HO_REF;
4. Wait for RSL HANDOver DETected from the BTS;
5. Release a dedicated connection.

There is no way to verify if the Handover Reference received
from the MS matches the one that was sent to the BTS. We can
introduce a separate test case that would just send an Access
Burst with RA != HO_REF.

Change-Id: If2e8d9c9947823df62f4bcc9a7fcd20734ff7858
Depends on: (trxcon) Ia967820a536c99966ba2c60b63d2ea9edb093f46
2019-06-02 02:03:16 +07:00
Vadim Yanitskiy ab448a516a library/RSL_Types.ttcn: t(r|)s_RSL_CHAN_RQD: make chan_nr configurable
Change-Id: I89e9286e86b09ed54eb7749d107f5d8d57b93644
2019-06-01 14:03:42 +07:00
Vadim Yanitskiy e432ba9222 L1CTL_RACH_REQ: make both chan_nr and link_id configurable
Change-Id: Ica6b9551b11c20fa0b8f4a8dcdc91ca07601642c
2019-06-01 14:03:42 +07:00
Vadim Yanitskiy 0a8d6daa65 L1CTL_Types.ttcn: accept SacchL1Header in ts_L1CTL_DATA_REQ_SACCH
In BTS_Tests.ttcn we used to compose L1ctlDataReq manually. This
can be done by ts_L1CTL_DATA_REQ_SACCH() template itself, so
let's abstract BTS_Tests.ttcn from doing that.

Change-Id: I1ae948bd0314cdf15c21ce4b6346d5e32f1fcf95
2019-06-01 14:03:42 +07:00
Vadim Yanitskiy 2f01fbd040 ts_TRXC_FAKE_RSSI(): define RSSI range, allow signed values
Change-Id: I8944e690c0da648eae3005777f2487c77b66a17b
2019-05-31 20:41:57 +00:00
Harald Welte 9de7f64922 LAPDm_RAW_PT: Always pad MAC blocks to their size
If a LAPDm message is shorter than the MAC block size, we must pad
it before seding it to L1.  trxcon e.g. would ignore any frames with
the wrong length since Change-Id I258ee9f6d0124b183b1db23a73f1e523fcea89a8

Change-Id: I30bcce27f95974eaca4168a156d1548586c924d6
Related: OS#3415
2019-05-30 15:08:57 +02:00
Harald Welte bb9512e640 bts: move f_pad_oct() to Osmocom_Types as it's generally useful
Change-Id: I4df99e5612c67006eb2998529425956fb4a664af
2019-05-30 15:06:12 +02:00
Vadim Yanitskiy 2a92e2a75c L1CTL_Types.ttcn: do not restrict the length of L1ctlDataInd
In the existing TC_pcu_* test cases we use L1CTL_DATA_* messages
to send / receive (E)GPRS related MAC-blocks. The length of such
blocks can be greater than 23 octets (i.e. fixed MAC-block
length in GSM), up to 162 octets to be precise.

Change-Id: Iced78796882b757016d02a266d55bc2a98b62a3d
2019-05-28 21:04:39 +00:00
Eric Wild f1827a7baa Extend BTS_Tests.ttcn with test for RSL MODE MODIFY with encryption IE
This test will currently fail due to a MODE MODIFY NACK, even though the
channel mode is not modified.
Related: OS##3750

Change-Id: I4cbea499bb6a331d314e6573548a4540945208b5
2019-05-28 21:02:20 +00:00
Harald Welte c8effb7e0f bts: Verify PCU socket can disconnect + re-connect
Change-Id: Ic69c3f34405012d42319bd9752f875071aae2243
Related: OS#4023
2019-05-27 21:31:56 +00:00
Harald Welte 6b86b3471f Fix use of osmocom-extended RSL Channel Numbers
Bring our TTCN-3 view of how RSL channel numbers are defined in sync
with that of our other implementations (BTS, libosmocore, trxcon, ...)

Change-Id: I48908058ac2501a3b5ae7c74e4e8527cbaee1b01
Related: OS#4027
2019-05-27 21:31:56 +00:00
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
Pau Espin 20e16c1983 lib: GTP_Emulation: Allow receiving packets with TEID 0
Some GTP messages like Echo Request, Echo Reply and Ind Error don't use
the TEID value. According to 3GPP TS 29.060 sec 9.3.1 in those cases the TEID is
set to 0:

"""
- TEID: Contains the Tunnel Endpoint Identifier for the tunnel to which this T-PDU belongs. The TEID shall be
used by the receiving entity to find the PDP context, except for the following cases:
- The Echo Request/Response and Supported Extension Headers notification messages, where the Tunnel
Endpoint Identifier shall be set to all zeroes.
- The Error Indication message where the Tunnel Endpoint Identifier shall be set to all zeros.
"""

Change-Id: Ic702b78028e850ed961ef805f35e10a42da34e56
2018-07-11 20:16:34 +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
Philipp Maier 33e5261154 GGSN_Tests: test what happens when PCO contains only one DNS entry
When the protocol configuration options (PCO) contain an IPCP container
then lists only one one DNS server (normally there are two included, a
primary and a secondary). Than the parser in osmo-ggsn runs into an
endles loop. This testcase tries to provoke this behavior by sending
PDP CONTEXT ACTIVATE messages with PCO that contain only a single DNS
entry per IPCP container.

The hanging of osmo-ggsn is already fixed (see Depends). However when
Primary and Secondary DNS are in separate IPCP containers, then only
the first IPCP container is parsed (see also OS#3381)

Change-Id: I71761e1f9db7ceac3c3df43d2e539f8c8d53c4fc
Depends: osmo-msc Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5
Closes: OS#3288
Related: OS#3381
2018-07-05 15:40:43 +00:00
Harald Welte 15de8ba162 bts: Extend Osmocom-specific RSL "supplementary meas info IE"
In osmo-bts Change-Id Iea4a4781481f77c6163d82dcd71a844a5be87bf2
we introduce an Osmocom specific "supplementary measurement info IE"
into the RSL MEAS REP message.  This commit adds the related type
definitions and extends the related matching in BTS_Tests.ttcn.

Change-Id: I5d1114c73508c67ad7cd9864d7370367612b1241
2018-06-29 17:53:10 +00:00
Philipp Maier 2321ef92a3 MGCP_Test: add tests to verify actual RTP flows
The test coverage of the RTP aspects of the MGW is currently very
minima. Lets add a few more testcase to verify RTP behaves as
expected in various situations.

- Add testcase TC_one_crcx_receive_only_rtp:
  Test recvonly mode of the MGW. All packets must be absorbed by
  the MGW, no packets must come back.

- Add testcase TC_one_crcx_loopback_rtp:
  Test loopback mode of the MGW. All packet sent to the MGW must
  come back.

- Add testcase TC_two_crcx_and_rtp_bidir:
  We already test unidirectional transmissions. This test does
  the same as TC_two_crcx_and_rtp but for both directions.

- Add testcase TC_two_crcx_mdcx_and_rtp:
  Simulate a typical behaviour of a normal call. First create
  two half open connections and complete the connections later
  using MDCX.

- Add testcase TC_two_crcx_and_unsolicited_rtp:
  Test what happens when a RTP packets from rogue source are mixed
  into the RTP stream.

- Add testcase TC_two_crcx_and_one_mdcx_rtp_ho:
  Test a typical handover situation. An existing connection is
  handovered to another source on one end but the old source will
  keep transmitting for a while.

Change-Id: I556a6efff0e74aab897bd8165200eec36e46629f
Closes: OS#2703
2018-06-28 14:15:10 +02:00
Philipp Maier 11a5894165 BSC_Tests: use correct payload types and encoding names on MGCP
The test currently use a hardcoded payload type and encoding name.
This does mean in practice that even when an assignment with EFR
is happeining. The MGCP responses to the BSC tell that the codec
is AMR. This is not correct. The testcases should always pick a
suitable payload type / encoding name in the MGCP response

- Add constants for IANA/3GPP assigned payload types
- Add function to lookup the right encoding name for a payload type
- Initalize the encoding name and payload type in g_media according
  to the BSSAP PDU.

Change-Id: I2735267091059e2f2169da80bdcd30abc2b1554b
Realted: OS#2728
2018-06-25 19:55:09 +00:00
Vadim Yanitskiy 911257ebb2 library/GSUP_Types.ttcn: SS Info IE is optional for GSUP_PROC_SS_*
The 'SS Info' IE is optional for GSUP_PROC_SS_{REQ|RSP} messages,
and is not carried in some cases, e.g. when a subscriber aborts
an active transaction by pressing the 'red button'.

Change-Id: I20d9028acbe0c457d2a2cf72eff372b749d8dc30
2018-06-21 21:58:39 +07:00
Vadim Yanitskiy 52f8b6ee1d library/L3_Templates.ttcn: fix f_facility_or_wc(omit)
According to GSM TS 04.80, table 2.5, the Facility IE is optional
for RELEASE COMPLETE message. So, if this IE is omitted, then the
whole TVL shall be omitted. It's time to fix this.

Change-Id: I216195ef71c95997708dad8c31b172b6f6cdc461
2018-06-19 22:20:35 +07:00
Vadim Yanitskiy b59ae2dfcf library/SS_Templates.ttcn: add empty Return Result template
According to GSM TS 04.80, table 3.4, the Return Result component
may be empty, i.e. may not contain any results nor operation code.
It is used, for example, in responce to the network-originated
USSD notification.

Change-Id: Iaaff110c5f61cc87eda6143cd841f9832f6074bf
2018-06-19 22:20:35 +07:00
Neels Hofmeyr 378a49ce60 bsc: handover: actually send Handover Detect
Until now, the test went from RR Handover Command directly to RR Handover
Complete, and osmo-bsc didn't mind it. However, the normal handover procedure
requires an RSL Handover Detect to be sent in-between those. Send that.

Change-Id: I6e54edcc3a99e116d852eca8e48c7a5bc685e832
2018-06-18 17:54:33 +02:00
Alexander Couzens 2c15342ae7 lib/BSSGP_Emulation: fix removal of items in ClientList
Previous the old entries aren't removed. This only had an
impact if two different f_TC_* were using the same imsi.
When the second function tried to remove the Client again from
the ClientList, the BSSGP_Emulation failed.

Change-Id: I71103e8f8c5f18e8ebadc057cd62d85affd7ca8c
2018-06-13 15:43:24 +02:00
Alexander Couzens 1e6d990540 Osmocom_VTY_Functions: introduce f_vty_transceive_not_match()
fails when vty response match template.

Change-Id: I489d2a47cd4690dcfc3f1042c332014593d082a2
2018-06-12 13:51:14 +02:00
Alexander Couzens 98aa59e064 Osmocom_VTY_Functions: move f_vty_transceive_match from HLR to this library
f_vty_transceive_match will be used by future SGSN tests.

Change-Id: Ia69ab6d5639c2e10059f88c8cc97463820cb72e6
2018-06-12 13:51:14 +02:00
Harald Welte e8d750e668 bts: More complete AGCH / IMM.ASS testing
The existing test simply sent 1000 messages via RSL without checking
what actually arrived on the radio interface, or without
expecting/counting any RSL DELETE IND.

Let's fix this by introducing test sending IMM.ASS at three different
rates, with related expectations in terms of nubmer of IMM.ASS arriving
on Um vs. RSL DELETE IND arriving at BSC.

Change-Id: Ib6043b76ba1d7aaff107bb612f63b5a747d8720c
Related: OS#2990
Related: SYS#2695
2018-06-10 21:44:29 +02:00
Pau Espin 752ffd565a bts: Set L1CTL rxlev_exp as module parameter
Change-Id: If63e5c2d6abe1dd6dddd1a12e703ed069b940ab4
2018-06-07 17:15:27 +00:00
Philipp Maier 45635f4379 MGCP_Test: Test non LCO crcx
When a CRCX without an LCO option (codec) is sent, then older versions
of osmo-mgw will omit the port number in the SDP part of the response.
Also no default codec is selected and reported back. This testcase
pinpoints the problem.

Change-Id: Ie16cdab936ce468fe378d4ec9e1c61f81c07fb4e
Related: OS#2658
2018-06-06 17:16:21 +02:00
Alexander Couzens d8604ab9ae L3_Templates: tr_GMM_DET_REQ_MT: use * instead of omit for `cause`
The omit force this field to be not present, while a * allows to be present or not.
As user of this tr I would expect to ignore this field rather than an explicit omit.

Change-Id: Iae91f752789273934a6382bdd474594c3c50bbe9
2018-06-05 13:04:41 +00:00
Harald Welte cc0b014903 bsc: Add LCLS related test cases
This is an early WIP, we actually will need to establish two calls/legs
before the BSC is able to locally correlate them.

Related: OS#1602
Change-Id: Ie6d0b9c38027abf65c7c564fc79b889d013fa6a7
2018-06-03 10:33:41 +00:00
Vadim Yanitskiy b761d14e58 GSUP_Types.ttcn: add SS related messages and IEs
Recently we introduced a few new GSUP IEs, related to TCAP-like
session management and Supplementary Services in libosmocore.
Let's sync the TTCN-3 implementation and add the corresponding
templates for SS payloads.

Change-Id: I54767e49ae98db67f71dd28278b14435860313e0
2018-06-02 18:57:35 +00:00
Vadim Yanitskiy 4019ec9691 library: introduce Facility IE templates for SS/USSD
Change-Id: Ibc3e8f70230d656b2f0994ea0c63e6554b6165de
2018-06-02 04:55:18 +07:00
Vadim Yanitskiy 0319813c41 L3_Templates: add GSM 04.80 RELEASE_COMPLETE message
Change-Id: Iaf295aeb4ef475d41d0eeddcca5e864016fd91cc
2018-06-02 04:55:18 +07:00
Harald Welte 354722e252 BSSMAP_Templates: Fix LCLS related template definitions
They should all have been derived from the tr_BSSAP_BSSMAP /
ts_BSSAP_BSSMAP base templates.

Change-Id: Ib9ef03fe1c5f2eedde9e274a50dfedb2fb6b6a0f
2018-06-01 18:25:57 +02:00
Harald Welte 0b50aeda34 BSSMAP_Templates: Add templates for LCLS related IEs + messages
We will soon implement some LCLS related test cases, and hence
we need some templates for sending and matching received messages.

Change-Id: I5300418ae493f6c315248562938b47ae1931b452
2018-06-01 12:00:56 +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 53603961fe L3_Templates: Add templates related to Supplementaryt Services
Change-Id: I919fa542a2e037b3fcf8cd5b0b9d7599b8c09070
2018-05-31 13:30:18 +00: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 d5833a8dcc BSSAP_Adapter: Split f_bssap_start() from f_bssap_init()
In non-handler mode, the SCCP emulation is currently started before
there's a user registered to SCCP_SP_PORT.  If the first BSSMAP
package arrives from the network, then the SCCP_Emulation will crash
as it cannot deliver the resulting SCCP user primitive to the user.

Let's split start from initialization, so user code can still register
something to SCCP_SP_PORT before starting SCCP_Emulation.

Change-Id: I55c94f18531bb7e5369500dc90f4b0ff3a420774
2018-05-27 15:33:27 +00:00
Harald Welte 710ec2154f BSSAP_Adapter: cosmetic typo fix
Change-Id: I2aba2316f12c2f752d58e58687c1ef529b983b96
2018-05-27 15:33:27 +00:00
Harald Welte 4239918711 BSSAP_Adapter: Connect ConnHdlr:MGCP to IPA MGCP in SCCPlite case
Change-Id: Ic86dd023693df5ad593eec090af815c926f87d34
2018-05-27 15:33:27 +00:00
Alexander Couzens 4cfff3a2bf GSUP_Types.ttcn: allow other TLV appear in Cancel Location Errors
Change-Id: I21ee02556f0734dad871a6294b21ca6f2864dea0
2018-05-26 21:03:54 +00:00