Commit Graph

129 Commits

Author SHA1 Message Date
Harald Welte 9b461a94a3 sgsn+pcu: Port suspend/resume cases to new BSSGP_CT:GLOBAL port
For 12+ days, suspend/resume related SGSN + PCU TTCN3 tets have been failing.

It was the introduction of the BSSGP_CT:GLOBAL test port in
I40d973d80709f5d56f59247e8647b52754f09bc8 +
I805372f3024a0ec2491a24422e02c0bc6dc669d2 which caused the related PDUs
now to no longer show up where they used to.

Change-Id: I1977302fef4868dc1c330bc6f48f6a6608949393
Closes: OS#4902
2020-12-10 23:42:03 +01:00
Harald Welte 4d112c926c BSSGP_Emulation: Allow a "CreateCb" to handle unknown inbound TLLI
The existing BSSGP Code assumed that the TLLIs were always known "a
priori" by the test case.  With the newly-introduced create_cb,
the user can provide a function to handle any incoming messages for an
unknown TLLL.  The default handler behaves like before: fail +
terminate.

Change-Id: Ice0e145f5a6518ff79547dd851042b7965f38e00
2020-11-16 19:13:26 +00:00
Harald Welte 90f1974fb0 NS_Emulation: Support multiple NS-VC within one NSE (NS-VCG)
This is something we need to simulate more complex scenarios,
particularly in the context of frame relay.

Change-Id: If1220852785853f8a5d8de183d5053ddd6ccb958
2020-11-12 20:02:07 +00:00
Harald Welte 5339b2e372 BSSGP_Emulation: Support multiple PTP-BVC within one Entity
The existing BSSGP_Emulation is built around the assumption that every
instance of BSSGP_Emulation only servers one signaling-BVC and one
PTP-BVC.  While this is true for osmo-pcu at this point (BTS-colocated
PCU), other BSS/PCU implementations differ.

In general, there can always be any number of PTP BVC (one per cell)
next to the signaling BVC (one per BSS).  Let's represent this in
BSSGP_Emulation so we can create more comprehensive tests.

Change-Id: I7e30b4c4e188518a574e082962fba457b3a97ce3
2020-10-09 12:27:11 +02:00
Harald Welte 5e8573e9b7 NS_Emulation: Prepare NSConfiguration for non-IP providers
NSConfiguration currently contains parameters relevant only for IP
based transport.  Move IP/UDP parameters into a sub-structure in
anticipation of Frame Relay support.

Change-Id: I6904520d8c2f546327029777d68b1907611a8cf5
2020-09-27 09:15:32 +00:00
Alexander Couzens 8e1dfd0d0f SGSN: introduce NS tests
Similiar to the PCU_Tests_NS introduce SGSN_Tests_NS.

Change-Id: Ib2bffbb110961474928f35d212cb492d4b6fdee0
2020-09-25 01:31:44 +02:00
Alexander Couzens e0f7c543b7 NS_Emulation: remove dependency on PCUIF_Types
The dependency of PCUIF_Types creates also a dependency on

Replace the PCU_AddrType by an unix like address family defined
in the Osmocom_Types to reduce the dependency.

Change-Id: I0b4fda96accef401ffc009010f9f5621583fd6dd
2020-09-17 23:29:16 +02:00
Harald Welte 60408e3f57 Don't map NS_Emulation_CT:NSCP anymore
NS_Emulation_CT:NSCP used to be a NS_CODEC_PT, which is a translation
port on top of the IPL4asp.  Such ports need to be mapped to a system
port at start-up.

However, in I4d0b7ad0ed9447a038dd3eeee2b975146d10fba0 we introduced
a new underlying component called NS_Provider.  Hence, NSCP is actually
connected to that underlying component, and no longer mapped.

The corresponding change in pcu/SGSN_Components.ttcn and sgsn/SGSN_Tests.ttcn
has unfortunately been missed in the above-mentioned change.  Fix that.

Change-Id: I4c085210e6021e38a38ebc052ec3d9b345638cd2
2020-09-17 20:32:37 +02:00
Harald Welte 557c9f8cb8 move some key types from GSM_RR_Types to GSM_Types
This in turn means Osmocom_Gb_Types doesn't need to depend on
GSM_RR_Types anymore, which is particularly ugly as the latter
now depends on RLCMAC_*, creating a long chain of dependencies.

Change-Id: I8c8da7709695ff0023f71b3999291e2515b22e46
2020-09-13 10:18:41 +02:00
Harald Welte 8e5932e563 sgsn: Add series of tests on suspend/resume and paging behavior
Let's test whether paging is triggered after T3314 expiration, as well
as suspend and explicit and implicit resume work as expected

Change-Id: I83b7a453958e30dfc727ba3140168217c209833f
Related: OS#4616
2020-06-18 13:36:18 +02:00
Harald Welte a5c71cdefe sgsn: Allow f_gtpu_xceive_mt() to verify non-forwarding case
In some scenarios we do not expect a PDU from GTP to show up on
the Gb side.  Let's add support for this.

Change-Id: Ia9fde1d433657c920ee1ec4d41004f4544ceb346
Related: OS#4616
2020-06-18 13:33:43 +02:00
Harald Welte f2f3c9bf79 sgsn: Add functions for BSSGP suspend + resume procedure
Change-Id: Ib1e370e2c5fe774029f459ef991fb9ac777f5631
Related: OS#4616
2020-06-18 13:32:53 +02:00
Harald Welte 15fbaa4748 sgsn: Add BSSGP_SIG port to ConnHdlr
So far, the ConnHdlr components were only able to exchange BSSGP PDUs
on the PTP BVC, but not on the SIGNALING BVC.  For this, we need to
actually connect to the BSSGP_SP_SIG that BSSGP_Emulation provides.

Change-Id: I4482a24e4808ac2fe04401224f628606d8207416
Related: OS#4616
2020-06-18 11:28:42 +00:00
Harald Welte 64d6b51818 sgsn: Fix comment [cosmetic]
Change-Id: I320bce9af64edf0cfb6f600d9a4c19b73153c805
2020-06-18 11:28:42 +00:00
Vadim Yanitskiy 61564be045 library/IPA: split t_ASP_IPA_EVT_UD into send / receive templates
Change-Id: Ib5494bff3f9aa0ac396b729c326e7b4a64c5a5dd
2020-05-18 20:47:14 +07:00
Vadim Yanitskiy 98bb2d5eea library/GSM_RR_Types: do not duplicate Mobile Identity records
All the records related to Mobile Identity IE (see 3GPP TS 24.008,
section 10.5.1.4) are defined in [1], so there is no real need to
dumplicate them. Moreover, most of the related templates in
library/L3_Templates.ttcn are based on these records.

[1] titan.ProtocolModules.MobileL3_v13.4.0/src/MobileL3_CommonIE_Types.ttcn

Change-Id: I27c2743c59db770d6f7e9447dc8c1f539b228ced
2020-03-28 03:29:22 +07:00
Daniel Willmann 1c1161119d SGSN_Tests: Wait for RAU Accept after receiving SecurityModeCmd
We don't want to pass the test or return from this function before
receiving a RAU accept. With Iu we expect a Security Mode
Command/Complete before the routing area is updated, but we do want to
wait for the actual RAU Accept or fail when receiving a RAU Reject.

Change-Id: Id89e2c6dae8cbdb5e8dee1c92960dc3346590a95
Related: OS#3727
2020-01-28 14:41:57 +01:00
Daniel Willmann 1c2ff0fa93 SGSN_Tests: Only call f_bssgp_client_llgmm_assign for Gb RAN
Calling this function with Iu RAN (ran_index > 2) does not work because
BSSGP_PROC[ran_index] doesn't exist.

Change-Id: Ieef654e3886759a40763ece3903de9127ba8d9c6
Related: OS#3727
2020-01-28 14:39:25 +01:00
Pau Espin ce571b5cc4 sgsn: Introduce test TC_attach_req_id_req_ra_update
The scenario in this test triggers a crash in osmo-sgsn fixed by
osmo-sgsn.git I64fa5cf1b427d3abb99e553e584897261a827ce6.

With that osmo-sgsn patch applied, the process doesn't crash anymore but
the test still fails due to an XID message being sent with a new
yet-not-seen-by-ttcn3 TLLI and as a result TTCN3 BSSGP_Emulation fails:
BSSGP_Emulation.ttcn:390 setverdict(fail): none -> fail reason: "Couldn't find Component for TLLI 'FE791757'O", new component reason: "Couldn't find Component for TLLI 'FE791757'O"

Other than that, the test runs fine. It still needs to be clarified
whether the new TLLI sent by osmo-sgsn is expected and test needs to be
fixed, or whether it's an sgsn bug.

Related: OS#3957, OS#4245
Change-Id: Id5554a91a8bda712e282c5a3e9e30fb0ca1ec0e8
2019-11-23 08:00:46 +00:00
Alexander Couzens 42d3cadb05 sgsn: delay f_gmm_attach() by 50ms
Packets sent by f_gmm_attach() might take too long via layers to reach
the SGSN. The GMM_ATTACH_COMPL in f_gmm_attach() took soo long,
that it arrived after packets, which has been sent after calling f_gmm_attach().
This behaviour was found in TC hlr_location_cancel_request_update().

Change-Id: I0209c86e16fe616284d753e9e003f2e4d9ec9ea5
2019-10-08 23:12:01 +00:00
Alexander Couzens ed61ae81e2 Require to receive RANAP_CommonId after RANAP_SecurityModeComplete
The SGSN will send a CommonId after it has sent SecurityModeComplete
to support paging coordination in the RNC.

Change-Id: I82a05cab2aeea25eec699f726b2f5c4b3eef7560
2019-09-16 17:54:37 +00:00
Alexander Couzens be76d9cd79 sgsn: replace variable bssgp with ran_index
Since bssgp also been used for Iu connection,
rename the variable to ran_index.
Be consistent and use the same variable name everywhere.

Change-Id: Ib278410bc49f07387873740ed8b411a815d940a8
2019-09-16 13:57:01 +00:00
Alexander Couzens b1ce118daa sgsn: replace variable gb_idx with ran_index
Since gb_idx also been used for Iu connection,
rename the variable to ran_index.
Be consistent and use the same variable name everywhere.

Change-Id: Ia119feee6a442c76dc337e75c07f4a385cd5e1df
2019-09-16 13:57:01 +00:00
Alexander Couzens 0507ec3f70 sgsn: replace variable gb_index with ran_index
Since gb_index also been used for Iu connection,
rename the variable to ran_index.
Be consistent and use the same variable name everywhere.

Change-Id: I06b0c6184daeb886e8bd28d50bf18909d9244dc6
2019-09-16 13:57:01 +00:00
Alexander Couzens b22e8cee77 sgsn: replace variable bssgp_index with ran_index
Since bssgp_index also been used for Iu connection,
rename the variable to ran_index.

Change-Id: Iec2e8510b749602f0ebb9b4976957c9c5ce3f307
2019-09-16 13:57:01 +00:00
Pau Espin 4b290a2e3a sgsn: TC_attach_check_complete_resend: Expect LU sent to HLR
SGSN is expected to submit an LU after initial GMM Auth

Change-Id: Ie2e8f5b9740c7429f5f0bf28e35707a61f23b565
2019-09-16 08:30:36 +00: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 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
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
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 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
Harald Welte 26fbb6e017 sgsn: Integrate RANAP
Integrate RANAP support to SGSN_Tests.ttcn.

Related: OS#2857
Change-Id: Ib62fc4c6007f6f4c47db7ca096a8d629bc72bb22
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
Alexander Couzens 4630e74bb8 SGSN_Tests: f_detach_mo(): fail when receiving any unhandled layer 3 message for normal detach
Merge the case with the fail when doing a power-off detach.

Change-Id: I957994376583959758417dccf419a55c43a0c61b
2019-06-11 14:53:46 +00:00
Pau Espin e6f071fe57 sgsn: Add tests to check GTP retransmit queue
Change-Id: I3c4a3573482bb1fa1549c732a0f78c2d00eadd86
2019-06-04 08:38:13 +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
Alexander Couzens 6bee087573 SGSN_Tests: add test case TC_attach_pdp_act_gmm_detach
MS  -> SGSN: Attach Request
MS <-> SGSN: [..]
MS  -> SGSN: Attach Complete
MS  -> SGSN: PDP Activate Request
MS <-  SGSN: PDP Activate Accept
MS  -> SGSN: GMM Detach Request
MS <-  SGSN: GMM Detach Accept

Related-to: OS#1881
Change-Id: Ibafbbb8ed99357d1e2e13d576b2624939388e85b
2019-05-11 06:00:43 +00:00
Alexander Couzens 44aa077bbd SGSN_Tests: fail when receiving any layer 3 package for a power off station
Change-Id: I27d798c1866ed7ae9b03b9c0ffdd7400431551f9
2019-05-11 06:00:01 +00:00
Alexander Couzens 8e0fd46a27 SGSN_Tests: correct verdict failure message in f_detach_mo()
Change-Id: I5c03ef7dd7486025d35d4482a7fe150dd36de907
2019-05-11 05:58:59 +00:00
Alexander Couzens ad35222d3a SGSN_Tests: fix regression in f_send_l3_gmm_llc() which breaks TC_attach_rau_a_b
The gb_index was forgotten to given to the new function f_send_l3().
All testcases which only used the default BSSGB connection #0 continued
to work, but the TC_attach_rau_a_b is the only testcase which uses #0
and #1 at the same time.

Fixes: a05b807922 ("sgsn: Add TC_llc_null to test if SGSN survives a LLC NULL packet")
Change-Id: Ie3dd8c613d3b3440447a282dc4545078cb927274
2019-05-11 05:57:39 +00:00
Harald Welte 2fa771f90d SGSN_Tests: Introduce NUM_GB to avoid '3' as magic value
Change-Id: I28b7dd26c5c129ec41c6349de9ddc9ef0ffee8ac
2019-05-10 22:38:17 +00:00
Harald Welte f7191679aa SGSN_Tests: Make more helper functions gb_index aware
The gb_index indicates through which Gb link (simulated
RAN/PCU) a given message shall be sent.

Change-Id: I3825634f581897f6951d9673984f138e977cc7ac
2019-05-10 22:38:17 +00:00
Harald Welte ca36246737 SGSN_Tests: Make f_gmm_attach() and f_gmm_auth() work on gb_idx != 0
Let's make sure the related functions can be used on other gb_idx,
i.e. via another Gb interface (and hence simulated RAN/PCU) than
the first one.

Change-Id: Ie88cbf0c70269cc3e2c2fd2a0c65c8f2130ec2b1
2019-05-10 22:38:17 +00:00
Harald Welte 2aaac1b1d1 sgsn: Add initial XID handshake related tests
Change-Id: I5d4b3cba2fe05dffe10c843f16cfec343bc67b5f
2019-05-02 10:03:32 +02:00
Harald Welte 645a151f69 sgsn: Add test cases to verify SABM handling on LLGMM + LL5
As OsmoSGSN doesn't implement ABM, the correct resposne to any SABM
is DM.

RelateD: OS#3953
Change-Id: Ib0d371a3356d6cb481b794945476ab40f5e0f02a
2019-04-25 20:06:15 +00:00
Harald Welte a05b807922 sgsn: Add TC_llc_null to test if SGSN survives a LLC NULL packet
This test case reproduces a bug in OsmoSGSN where it would crash
as a result to sending LLC NULL frames.

Change-Id: I38326f2ebaaff009d4357edad9511ce2ce7736fd
Related: OS#3952
2019-04-25 20:06:15 +00: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