Commit Graph

1661 Commits

Author SHA1 Message Date
Alexander Couzens 6da25e36e6 sgsn: add TC_geran_attach_iu_rau
MS <-> SGSN: Successful Attach over Geran
MS <-> SGSN: Routing Area Update over Iu

The test case will crash the SGSN and is not included
in the default run.

Change-Id: Id23244aa6ca329579300b66b73ce238bd4d01eef
2019-09-12 20:57:03 +00:00
Vadim Yanitskiy d8f28e6d19 Revert "library/PCUIF_Types.ttcn: inform RAW codec about PADDING in PCUIF_data"
This reverts commit dd6d5d1baa.

The PADDING seems to be a very experimental feature of TITAN. It works
very well for decoding of messages, so the padding bytes are getting
recognized as expected, but encoding is broken. Not only the data
buffer and its length are encoded in a wrong way, but other fields too.

Change-Id: Ieefa61232eb215a19a02e490255332e28e23b8f8
2019-09-11 14:04:07 +02:00
Alexander Couzens e5f4a91576 sgsn: add TC_iu_attach_geran_rau
MS <-> SGSN: Attach over Iu
MS <-> SGSN: Routing Area Update over Geran

The tess case will crash the SGSN and is not included
in the default run.

Change-Id: Ie043639638a640a2041324fc910964385a41c77d
2019-09-11 12:18:32 +02:00
Alexander Couzens 5d56f5251b sgsn: extend f_routing_area_update() to support Iu
Allow Iu tests to use f_routing_area_update()

Change-Id: Ic03952a04c00a4fc437ef39c5ee046549c122c8b
2019-09-11 12:18:32 +02:00
Alexander Couzens 1552e79637 sgsn: make the ranap interface optional
Allows to use the test cases without STP

Change-Id: I43df456c2d5aa3ba3ea9e34da3f0f96b55f7c9a1
2019-09-11 12:18:32 +02:00
Harald Welte 900d01ad34 sgsn: add Iu Attach Request
MS -> SGSN: Attach Request IMSI
MS <- SGSN: Identity Request IMEI
MS -> SGSN: Identity Response IMEI
MS <- SGSN: Auth Request
MS -> SGSN: Auth Response
MS <- SGSN: Attach Accept
MS -> SGSN: Attach Complete

Change-Id: I66069e31c30d33934ad57cc2b8794f56ffd5c7d6
2019-09-11 06:19:10 +00:00
Alexander Couzens bfcb320be5 L3 Templates: PDU_L3_MS_SGSN: export ptmsi in template signature
Iu packets needs to contain an ptmsi as tlv in difference to Gb.

Change-Id: I7ba51a28524261dd1c7f4f2586ee6ebc970ea944
2019-09-11 06:19:10 +00:00
Alexander Couzens 4444b5a7f6 sgsn: introduce f_send_l3() to allow one function for Gb & Iu
f_send_l3() replaces f_send_l3_gmm_llc() to have one function
which sends L3 messages for Iu and Gb at the same time.
This allows to share most of the tests between Iu & Gb.

Change-Id: If47ad2be459ca7b87d9071d9ff020a51821e4433
2019-09-11 06:19:10 +00:00
Vadim Yanitskiy c9b2ba25c5 library/LAPDm_RAW_PT.ttcn: use templates from GSM_RR_Types
Get rid of t_IMM_ASS_TBF_UL_DYN, use tr_IMM_TBF_ASS instead. Also,
use both tr_PacketUlDynAssign and tr_PacketUlSglAssign for matching
UL TBF assignment.

Change-Id: Icb7dab04a1e2a833c14754d872bd4b85af3d58a5
2019-09-09 16:30:47 +02:00
Vadim Yanitskiy 6edd4f5a06 library/GSM_RR_Types.ttcn: introduce generic tr_IMM_TBF_ASS
Both 't_IMM_ASS_TBF_DL' and 't_RR_IMM_ASS_TBF_DL' templates were
introduced for a specific task - matching Packet Immediate
Assignment (Downlink TBF) by TLLI.

In the upcoming changes we will also need to match Uplink TBF
assignment, and more generic fields such as Timing Advance.
Let's add a generic template for Packet Immediate Assignment
and allow passing IaRestOctets as a parameter.

Change-Id: I492cf990820ba153ea71469b8b623e56e031e549
2019-09-09 16:30:47 +02:00
Vadim Yanitskiy 7091e8de88 library/GSM_RR_Types.ttcn: refactor IaRestOctHH coding
According to 3GPP TS 44.018, section 10.5.2.16, IA Rest Octets IE
starting with 'HH' bits may contain one of the following CSN.1
encoded components:

  7 6 5 4 3 2 1 0  Bit Numbers
  H H 0 0 . . . .  Packet Uplink Assignment
  H H 0 1 . . . .  Packet Downlink Assignment
  H H 1 . . . . .  Second Part Packet Assignment

We already have (partial) support for the first two, while the
last type has not been supported so far. Let's add it.

Also, this change introduces several templates for IA Rest Octets
IE and some of its components mentioned above. This would allow
us to abstract the API users from dealing with further changes,
e.g. adding a coding attribute 'CSN.1 L/H' and missing fields.

Change-Id: Ib3a21e7c5fa1cad4466e3a09fa70540de7f6ecc5
2019-09-09 16:30:47 +02:00
Vadim Yanitskiy a4aacc2179 library/GSM_RR_Types.ttcn: fix: apply '2B'O padding to GsmRrMessage
For some reason TITAN starts padding not from the beginning of
record ImmediateAssignment, but from it's wrapper GsmRrMessage.
As a result, dec_GsmRrMessage() warns about undecoded octets:

  Data remained at the end of the stream after successful decoding '2B2B2B'O

Similarly enc_GsmRrMessage() generates a shorter payload. Let's
work this around by applying PADDING attribute to GsmRrMessage.

Change-Id: I5fe327383402956213c20a68b18b8a48381156b5
2019-09-09 16:30:21 +02:00
Vadim Yanitskiy d4205c3da0 library/GSM_RR_Types.ttcn: fix hard-coded L2 pseudo length in tr_IMM_ASS
Change-Id: I1d3b0fbd01875cdb94b923a1521b1387a33adcd8
2019-09-09 16:18:04 +02:00
Vadim Yanitskiy 9b2a3e8cb8 library/GSM_RR_Types.ttcn: fix ImmediateAssignment coding regressions
Since I403d2141536303a966be7ff51b06c3de202412e6, IA Rest Octets is
a mandatory IE. When changing the definition of ts_IMM_ASS, I forgot
to mark its optional 'lh', 'hl', and 'hh' as omitted explicitly.

As a result, many of our TTCN-3 test cases were broken:

  Dynamic test case error: Using an unbound optional field.

Also, in Ifdcdcf50709fcc03195cb8ef6092977e26f910ec I added an
optional field 'pad' to record 'IaRestOctets'. That was not the
best solution, because padding should be handled transparently.

Let's get rid of that dummy field and equip both 'ImmediateAssignment'
and 'IaRestOctets' records with proper padding attributes. The later
one needs to be marked with 'CSN.1 L/H' attribute in the future, but
for now we should keep it octet-aligned.

Change-Id: I69d5fbd8e3388e287bfa54f02454d207e62ee640
2019-09-08 19:21:27 +00:00
Harald Welte 0b5e0f9146 bsc: Test that ETWS Primary Notification is passed via RSL to PCH
The BSC must not only pass the ETWS Primary Notification from CBSP
down every dedicated channel, but it must also send it via an
Osmocom-specific RSL message to enable the BTS to brodcast it via
the PCH (P1 Rest Octets) and pass it to the PCU for PACCH.

Change-Id: Ia418095844aaa418a4e2ff6fd75d8a4b3c8bb9c0
Related: #4046
2019-09-07 12:07:13 +02:00
Harald Welte 187f7a99c1 bsc: Test that ETWS Primary Notification are sent via dedicated channels
When the BSC receives an ETWS PN via CBSP, it must send it through all
established dedicated channels of the matching BTSs.

Related: OS#4046

Change-Id: Ib057bd251604e9bae968e71de245b3bbf737a356
2019-09-07 08:38:00 +02:00
Harald Welte 25a6075044 CBSP: Fix receive templates if channel_ind == omit
Change-Id: I6e15a7499b5da6f63a517f303576a877ea038788
2019-09-06 23:09:05 +02:00
Harald Welte 11b734cb10 bts: Test if BTS forwards ETWS Primary Notification to PCU
All MS/UE must be notified of ETWS Primary Notifiations.

Depending on their state, the notification goes different paths:
* CS dedicated mode: BSC sends it as L3 message over LAPDm / DCCH
* CS/PS idle mode: BTS sends paging messages on PCH
* PS TBF active: PCU send Packet Application Info

This tests the last of the three methods by checking that a  ETWS Primary
Notification sent on RSL to the BTS is received by the PCU socket.

Change-Id: I2661df7f7d870a0ac1c89bb8a85df81644b00b0a
Related: OS#4047, OS#4048
Depends: osmo-bts Ic0b3f38b400a0ca7e4089061ceb6548b0695faa6
2019-09-06 09:59:31 +00:00
Oliver Smith e1c00f022d Revert "bts: f_init_pcu: sleep before connect"
This reverts commit c089b415f5. The
additional sleep caused other tests to break, probably because it
triggered race conditions:
* TC_pcu_socket_connect_multi
* TC_pcu_socket_connect_si3gprs
* TC_si_sched_13_2bis_2ter_2quater

Adjust TC_pcu_socket_verify_info_ind test case error message to mention
OS#4179. This test is flapping now, most of the time the BTS sends a
CellID 0 because it did not receive the real CellID from the BSC yet.

Related: OS#4179
Change-Id: I2115c337f4601a4614b140715323c42803b003ee
2019-09-06 07:24:49 +00:00
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 bb2bb061e5 ggsn: Delete previously activated pdp ctx in *_interact()
This change fixes some GGSN_Tests failing lately since osmo-ggsn
correctly sends DeleteCtxReq for dangling pdp ctx upon increased
Recovery counter received, and tests are not expecting that (because
they don't expectect dangling pdp ctx from previous tests).

Change-Id: I232298e2bfd8bfc99d82cbf5803d11db7eb1786a
2019-09-03 13:19:29 +02: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 0167c2aecf sgsn: update configs for running without docker
Base on docker-playground.git's ttcn3-sgsn-test/*.cfg files, change IPs
to 127.0.0.* (keep last octet), log to stderr. The reasoning behind the
IP change is, that using almost the same IP as in the docker configs
makes it easier to compare the configs.

Change-Id: I15b5a943e9c665dfd4eb6b30bff84afc8adeb4a2
2019-08-30 13:23:34 +02:00
Oliver Smith aa6278dd8f pcu: add configs for running without docker
Base on docker-playground.git's ttcn3-pcu-test/*.cfg files, change IPs
to 127.0.0.1, log to stderr, adjust pcu-socket path.

Change-Id: Iff3e5e6cf0c608680c8c5f9f83e8bc1032274ea9
2019-08-30 13:21:54 +02:00
Oliver Smith 00d7bc4a93 pcu/GPRS_TBF.ttcn: less verbose logging
Reduce the formatted log size of TC_ul_tbf from ~140 MB to ~8 MB.

Related: OS#3925
Change-Id: Ibccfc399a6e8b50e4f01b5f167c47fbbde4533ed
2019-08-30 12:05:39 +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 7bdf87bf9f bts: add configs for running without docker
Base on docker-playground.git's ttcn3-bts-test/*.cfg files, change IPs
from 172.18.9.* to 127.0.0.* (last octet unchanged).

Change-Id: I9eb2bb4599a4e874424f73483d9658a4467b8b8c
2019-08-29 19:46:49 +00:00
Oliver Smith f5239c7055 bts: add test TC_pcu_socket_verify_info_ind
Verify that the CellID of SI3 (TS 04.08 9.1.35) and other values are
passed properly to the PCU socket. A bug in OsmoBTS is currently causing
it to send a byte-swapped CellID, related fix is in [1].

[1] I68faf4558f0686fb2a3db24077dceaae05bf0262 (osmo-bts)
Related: OS#3854
Change-Id: I6516808f4b9e9a2301f9ccc1e55ded14e7334c33
2019-08-29 19:46:49 +00:00
Oliver Smith c089b415f5 bts: f_init_pcu: sleep before connect
Give the emulated BSC side some time to send the various SI via RSL.
This workaround makes OsmoBTS send the correct CellID and other
information instead of empty values to the PCU socket. The next commit
tests these values.

Related: OS#4179
Change-Id: I547f2b8e0796b6976506c28b1b493b1f5bce28f8
2019-08-29 19:46:49 +00:00
Pau Espin fcec914a8e sgsn: Introduce test TC_attach_echo_timeout
This test verifies sgsn drops all GGSN related pdp context when that
GGSN stops answering echo requests.

Change-Id: Ic31748924e7bf05ea2ccf2b1be0c460eefed5782
2019-08-28 19:16:50 +02:00
Pau Espin fa1ca02d34 ggsn: Introduce test TC_pdp_act2_recovery
Some code is moved out of f_pdp_ctx_act() into f_handle_create_req() in
order to re-use it in the test.

Related: OS#4165
Change-Id: I48c1bc9287ce8b820e5ea672dffbc5a8503f16d7
2019-08-23 19:13:34 +02:00
Pau Espin 6916ec4648 ggsn: Introduce test TC_pdp_act_restart_ctr_echo
VTY functionalities to enable and disable echo requests in osmo-ggsn are
added too as part of the test.

Depends: osmo-ggsn.git Id2c84165dc59dff495106758146a701ca488834f
Related: OS#4165
Change-Id: Ia37e48e7ff9ad063f9eabf447f8a6a0a3fc380d9
2019-08-23 18:32:49 +02:00
Pau Espin 2a3302a0cd sgsn: Add test to verify duplicate DeactPDPCtx crashing osmo-sgsn
osmo-sgsn sends 2 DeletePdpCtxReq on gtp, Confirmation received on first
one frees cbp associatd to pdp and the second one accesses the already
freed cbp.

Related: OS#3956
Change-Id: Ie1cc9fdf91b18b0b7fb3d5fb33b6dcf6f46a393f
2019-08-23 16:16:29 +02:00
Pau Espin 22d597ff94 ggsn: Introduce test TC_pdp46_act_deact_apn4
Related osmo-ggsn.git libgtp fix: I6c6215a4ce478afabc78ffaf5ffb0cf829e41226

Related: OS#4154
Change-Id: Ia1893e0c181307ac1ceb07ee5f496507f7a603c8
2019-08-21 16:31:35 +02:00
Pau Espin b7f01781d9 ggsn: Update test xfail->pass in expected-results.xml
Commit below fixed the test but forgot to update this file.

Fixes: 8e7a396656
Change-Id: Ia5006c9258de9b442b32ae92ae75ef08670de7cf
2019-08-21 16:31:17 +02:00
Pau Espin 2302341275 ggsn: Add missing v4v6 tests in expected-results.xml
Change-Id: I80598fad57b8e7172ac073ebe2b3445e5ab132f0
2019-08-21 16:13:30 +02:00
Oliver Smith 92c2bdb00f bsc: f_ipa_unknown_unit_id: use different id
Change the unit_id value, that is supposed to be unknown at BTS, from
0/0/0 to 99/0/0 to make TC_oml_unknown_unit_id pass again. The test was
failing, because a new bts that matches 0/0/0 was added to osmo-bsc.cfg
in [1], [2] and [3].

[1] Ia4ba0e75abd3d45a3422b2525e5f938cdc5a04cc
[2] I1c57a04747f5ec004ccf4657954dcb0b003c24fc (docker-playground)
[3] I00547dccf8908d46df4730cb513fe577956d7683 (docker-playground)

Related: OS#4156
Change-Id: I585ff825c7b6bca17e5c6fb6d670a649965a1653
2019-08-20 15:30:41 +02:00
Oliver Smith 75aa020da5 BSC_Tests: update number-of-bts to 4
Fix failing TC_ctrl test for ttcn3-bsc-test and -latest.

Depends: I00547dccf8908d46df4730cb513fe577956d7683 (docker-playground)
Related: OS#4156
Change-Id: Ie2c664ba0f845da644e20e2c919c12d8fc2af6ba
2019-08-19 14:30:50 +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 c4148dac35 NAS_EPS: fix 'make deps' (no commit specified)
Change-Id: I790c54568e745ea07afeed35b4d09a45b785711f
2019-08-18 19:42:23 +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