Commit Graph

3245 Commits

Author SHA1 Message Date
Daniel Willmann dd7c075040 Makefile: Include hnbgw in SUBDIRS
Change-Id: I04616434cf8b5e67b67803040c3a03e4a0e3d182
2022-02-17 16:09:41 +00:00
Neels Hofmeyr 1951be2272 bsc: add TC_ho_into_this_bsc_a5_1_3_no_chosen_enc_alg
Report: in inter-BSC incoming handover, when the MSC omits the Chosen
Encryption Algorithm IE in the Handover Request message, then osmo-bsc
starts an unencrypted lchan even if A5/0 is not permitted.

This test verifies that the Encryption Information is present in the
Channel Activation when the Chosen Enc Alg is omitted.

Related: SYS#5839
Change-Id: Ia94cc29bf66339ed782cb5101f3640f69cf73131
2022-02-17 02:16:40 +01:00
Neels Hofmeyr d23e8a0a76 bsc: improve encryption testing config TestHdlrEncrParams
Clean up: absorb pars.encr_exp_enc_alg into TestHdlrEncrParams as
pars.encr.alg_expect.

Remove the automagic encr alg choice from test procedures, instead put
all magic in the pars.encr configuration setup; like this all encr alg
values remain fixed through the tests, less confusing.

Add separate alg_chosen for BSSMAP: So far, we have only one algorithm
field for both the mask of permitted algorithms in the Encryption
Information IS and the Chosen Encryption Algorithm IE. However, in the
Chosen Enc Alg there must be only one bit set. Thus we cannot easily run
a test where more than one alg is permitted and where the BSSMAP Chosen
Enc Alg IE is involved.

We've recently come to realize that the Chosen Encryption Algorithm IE
may also be omitted from BSSMAP messages, in which case osmo-bsc should
still work. To be able to test BSSMAP messages with omitted Chosen
Encryption Algorithm, allow to set alg_chosen == omit.

Keep t_EncrParams() in a way that all current tests (that set only one
bit in alg_permitted) still run the same as they always did.

Add t_EncrParams2() for a proper template.
Add a convenience function to configure encryption testing.

Related: SYS#5839
Change-Id: I6590ecf4a146dbed494d9d72f5a79441877e9010
2022-02-17 02:14:27 +01:00
Pau Espin cd326c5a59 ggsn: Introduce test TC_pdp4_act_update_teid/teic
This test validates that changing the local TEID through UpdatePDPContext
is correctly followed by the GGSN.

Change-Id: Ic6af25866bf7efc2cabf029e49abaf15d5857592
2022-02-16 17:21:49 +01:00
Pau Espin 3ede4f65d7 ggsn: Configure GTP_CodecPort to decode proper UpdatePDPContextRequest/Response
From GTPC_Types.ttcn:
"""
// determines SUT, needed for decoding updatePDPContextRequest
// and updatePDPContextResponse messages
type enumerated SystemUnderTest{SGSN(0),GGSN(1),CGW(2),MME(3)};
"""

Otherwise decoded UpdatePDPContextResponse is decoded taking choise
UpdatePDPContextResponseSGSN.

Change-Id: I52a27222d0e37ed2170972af3fd0e07da49a8c61
2022-02-16 15:47:15 +00:00
Daniel Willmann 95263ca618 ranap: Add present constraint to rab_id receive templates
Change-Id: I0006c57b4879ae9678aeca58b8b025bdbe9cb022
2022-02-16 13:13:43 +00:00
Daniel Willmann 19b8d909e5 Add hnbgw tests
Some tests for osmo-hnbgw with mgw support:
* hnb register
* ranap connect/disconnect
* rab assignment/release

Change-Id: I0a2fb795aec83337eda8d9972e6ff264ead61076
2022-02-16 13:13:43 +00:00
Pau Espin c6ac6950c2 ggsn: Rework tests validating wrong ipv6 saddr on IPv4v6 APNs
The existing test TC_pdp46_act_deact_gtpu_access_wrong_global_saddr_ipv6
was wrong, because the global address was being finally encoded as a
link local address by f_gen_icmpv6_router_solicitation().
Let's rewrite the test and add a new one for source link local addresses
simlar to the ones used to test IPv6-only APNs.

Change-Id: I3d0790104abea7acb4fa5e33109fe93cc51d94ea
2022-02-15 17:13:00 +00:00
Pau Espin 5760421255 ggsn: Support IPv4v6 PDP contexts in helper icmpv6 functions
Change-Id: I564d51e02ea4b3cb5fedb79dfc1903c04619bd61
2022-02-15 17:13:00 +00:00
Daniel Willmann 1f2d740c1a ranap: Add templates for RAB Assignment ReleaseRequest
Change-Id: Ie22253c84651119c4da91053eb4d79ad8f4abe7d
2022-02-14 16:44:59 +01:00
Daniel Willmann fdb48680ba MGCP_Templates: Add receive templates for SDP and use those in {CR,MD}CX
Change-Id: Ibc46888b1b7913d399c79ab735841844ff0487ad
2022-02-14 16:44:59 +01:00
Daniel Willmann fc5e17adab ranap: Add more RAB-related templates
Change-Id: I363428ab4af869bb1aa4470b33fa52366cbda8b4
2022-02-14 16:44:59 +01:00
Vadim Yanitskiy 04ef7d82ab library/Native_Functions: add f_inet6_ntoa()
We have f_inet_ntoa() for converting IPv4 addresses to strings,
but so far there was no similar function for IPv6 addresses.

Change-Id: I0858cf8cb44a6673e19f3496c362d68fcdd7b18d
2022-02-11 15:05:46 +00:00
Harald Welte 1e3bbbeac2 RAN_Emulation: Add f_ran_register_exp()
For some reason this helper function was misssing; we only had
the version to register an imsi.

Change-Id: I9d38dbdf589ed0f5999a5aeeb31b10ca5d07de16
2022-02-11 15:27:11 +01:00
Harald Welte 0af7615981 RAN_Emulation: Don't decode L3 if g_ran_ops.decode_dtap == false
We must respect this flag not only in "normal" PDUs but also
in the code path processing the "expect" handling.

Change-Id: I04a9197ac0b68c2dcb7542d035dc70c9f2b90473
2022-02-11 15:27:11 +01:00
Harald Welte cb3e2d75b8 Iuh_Emulation: Introduce Iuh_ConnHdlr component type
Like RAN_ConnHdlr, this contains the ports required for
a ConnHdlr attaching to Iuh_Emulaiton

Change-Id: Icbffedceb65f791306fde74f3bc5b8fe964148b9
2022-02-11 15:27:11 +01:00
Pau Espin c8c0341b16 ggsn: Split gtpu_access tests into several separated tests
Those tests validated several different scenarios, let's better handle
them separately one at a time, it makes it easier to understand the
behavior of the SUT and see what needs to be fixed.

Change-Id: I39342fcf2366030ce743dd4b4773f0fff5d61b9f
2022-02-11 13:39:29 +01:00
Pau Espin 480e67f00d ggsn: Test GTP-U Echo Request/Response
Change-Id: Id92180be948ee3f5246c7befec666698a1b074f3
2022-02-11 13:10:20 +01:00
Vadim Yanitskiy 134aea932d Makefile: run $(nproc) parallel jobs for target 'deps'
Change-Id: I53112a20d78d12bcc2764c1fc5567eb26bfa46cc
2022-02-10 00:47:52 +06:00
Vadim Yanitskiy d344b4af03 GGSN_Tests: fix DTE due to passing out-of-bound values to int2oct()
This patch fixes the following DTE happening sporadically:

  04:09:29.373271 mtc GGSN_Tests.ttcn:1478 Dynamic test case error:
    The first argument of function int2oct(), which is 256, does not fit in 1 octet.

Change-Id: I517b8e5d5872c36f7c759433a1cde338c90f16da
2022-02-09 18:28:23 +06:00
Neels Hofmeyr 52b2b26c52 bsc vamos: ensure lchan state in some places
Change-Id: I5979516cf2b2e1adf5269acd0b8e7adb5e6a1ac5
2022-02-08 16:35:34 +00:00
Vadim Yanitskiy 5f14d34642 BSC_Tests_VAMOS: fix TC_vamos_multiplex_tch_h_tch_h_tch_h_tch_h
Properly clean up conns in the end. Use COORD and new COORD2 ports to
daisy-chain coordination between the four components.

Related: OS#5444
Change-Id: I3b1dfc3b11e990893cbf182fb9f8840e198eb8aa
2022-02-08 16:35:34 +00:00
Vadim Yanitskiy 7bd04e4169 BSC_Tests_VAMOS: fix TC_vamos_multiplex_tch_f_tch_f
Properly clean up conns. To know when the multiplex is ready, use the
COORD port to tell the other component.

Related: OS#5444
Change-Id: I82b7eccd2ae30fdc3794ea9dad5d2d8f875d702d
2022-02-08 16:35:34 +00:00
Pau Espin b63d85f6a2 ggsn: Expect no linklocal-addr forwarding when testing open5gs
It's not really clear whether GTP should really be forwarding packets
with link-local address outside the tunnel. In theory the link-local
address should be used to communicate with the GGSN in order to get the
global link address, that's it. Running against open5gs it can be
observed that they are not forwarded, while osmo-ggsn forwards them
correctly.
Since it seems more like an implementation dependent detail, let's
accept any and adapt expectancies depending on what are we testing, this
way it ends up documented the current situation in case it ever changes
in the future.

Change-Id: Ieafd24c059b9341c702311c78caad3312db5f1f3
2022-02-08 15:34:09 +01:00
Vadim Yanitskiy 41b702febc BSC_Tests_VAMOS: fix f_TC_mode_modify_to_vamos(): clean up lchan
This change makes the following test cases pass:

  * TC_mode_modify_to_vamos_fr
  * TC_mode_modify_to_vamos_hr

Change-Id: Icb47e39a5466a1232cda03e1e04b0c88f3927659
Related: OS#5444
2022-02-07 14:53:48 +06:00
Vadim Yanitskiy ce8eb85b00 BSC_Tests_VAMOS: fix TC_chan_act_to_vamos: deactivate lchan
Keeping the logical channel active may affect test cases executed
after TC_chan_act_to_vamos.  Clean up after the test to avoid that.

Change-Id: Id0e3fb6a2f7e97ef854bff95adbc715d6f41f069
Related: OS#5444
2022-02-07 14:53:43 +06:00
Pau Espin 0bcfd9de8f ggsn: Set up diameter for open5gs
Change-Id: Iedadb98be2a2e851b75e4e67c22bca7047191fec
2022-02-05 20:12:53 +00:00
Vadim Yanitskiy 6e06801a07 BSC_Tests: add module parameter 'mp_verify_talloc_count'
This parameter allows to enable/disable checking of the IUT's talloc
report in f_shutdown_helper().  This may be useful when running the
test suite against '-latest' with unfixed memory leaks.

Change-Id: Ic7bf8d9def21083ebda1b94659d72dde2bb5e664
2022-02-05 21:41:19 +06:00
Pau Espin c1b1ddff61 ggsn: Add module parameter to run tests against open5gs
Change-Id: I4ebb3ed73f0f9a20c14d73891ba8b8051f823ab8
2022-02-03 13:58:56 +01:00
Vadim Yanitskiy 284c68e735 PGW_Tests: f_start_prog(): redirect stdout/stderr to files
This would allow us to see the output of a program being executed.

Change-Id: I04ab92c13fcd893d39dbb6a8a8af5ff41d207e36
Related: SYS#5602
2022-02-03 12:07:24 +00:00
Pau Espin ca587f154c ggsn: Submit User Location Information in CreatePDPContextReq
According to TS 29.060, sec 7.3.1 Create PDP Context Request:
"""
The SGSN shall include the User Location Information IE in the PDP
Context Activation procedure. The SGSN shall include the CGI or SAI
in the "Geographic Location" field of the User Location Information
IE depending on whether the MS is in a cell or a service area
respectively.
"""

Change-Id: Iaea95e5779d4f878023ce3f160ac69f092452056
2022-02-02 10:46:17 +01:00
Pau Espin 38aeffb9be ggsn: Submit RATType in CreatePDPContextReq
According to TS 29.060, sec 7.3.1 Create PDP Context Request:
"The SGSN shall include the RAT Type IE during Primary PDP Context
Activation procedure."

Change-Id: Ibc57798e50ccd08ef6126f75f7c8134e56d2778a
2022-02-02 10:46:17 +01:00
Vadim Yanitskiy 36ab797d46 PGW_Tests: f_start_prog_wait(): print more debugging info
Change-Id: I73314ccfdabd3860e15c732260b024f4c984bebf
Related: SYS#5602
2022-02-01 21:57:50 +06:00
Vadim Yanitskiy b46f01e130 library/DIAMETER_Emulation: implement 'raw' mode of operation
This patch implements a new mode of operation, which allows to
have direct communication between the emulation component and
the other component connected via the 'DIAMETER_UNIT' port.
This eliminates the need to have dedicated components for each
IMSI, what is not necessarily needed in some specific cases.

Change-Id: I52e22ac70cc85be5b0436b68c77356aabc4f05e1
Related: SYS#5602
2022-01-31 09:56:51 +00:00
Neels Hofmeyr c3c6ee6c63 bsc: fixup for conn cleanup, fixing three failing tests
Three tests fail after recent patch
"bsc: properly clean up conn after each test"
I9396efcabc085d2850244c6468b83c5f3a3ff3a2

In TC_assignment_emerg_setup_deny_bts(), do not expect an RR Rel.

In TC_assignment_emerg_setup_deny_msc() and TC_cm_reestablishment(),
drop the additional f_expect_dlcx_conns().

Related: OS#5337
Change-Id: I1d1d27f0927e640a430b24c6dc3d5d851a5c4cb9
2022-01-26 01:23:06 +01:00
Neels Hofmeyr 9c0f9c8871 bsc: logp("start") also for handler_mode := false
Change-Id: I4421a674055cd7013d21c52e9de6e369d1a72b6b
2022-01-23 01:21:12 +01:00
Neels Hofmeyr 4d4cd7e7e5 bsc: properly clean up conn after each test
Make all tests clean up BSSAP conn and RSL link. Now all
f_verify_talloc_count() in f_shutdown_helper() should pass, verifying no
conn or bsc_subscr leaks.

Related: OS#5337
Change-Id: I9396efcabc085d2850244c6468b83c5f3a3ff3a2
2022-01-23 00:13:53 +01:00
Neels Hofmeyr 6289af1197 bsc: f_perform_clear: ack all DLCX and RSL REL REQ
ACK any MGCP DLCX or RLL REL REQ during f_perform_clear(), which makes
it more universally applicable to invoke at the end of a test.

Related: OS#5337
Change-Id: Ie5b77c266a5d8f47edd187c474df281a799a81de
2022-01-23 00:13:51 +01:00
Neels Hofmeyr 189974920d bsc: detect subscr and conn leaks during f_shutdown_helper()
Invoke f_verify_talloc_count() for bsc_subscr and
gsm_subscriber_connection, expecting none to remain after each test.

This makes numerous tests fail, where the test does not properly release
the RSL and BSSAP connections. An upcoming patch fixes all of those
cases: I9396efcabc085d2850244c6468b83c5f3a3ff3a2

Related: OS#5337
Change-Id: I69d4c5c6f8d499bb7f0b96a48af045361433c57b
2022-01-23 00:13:07 +01:00
Neels Hofmeyr e23496ad23 vty: add f_verify_talloc_count()
Counts talloc objects via VTY and waits for a specific object count.
Useful to test against leaks.

The intended use is to check against leakage of bsc_subscr and
gsm_subscriber_connection after each BSC_Tests.*, see patch in 'Related'
below.

Related: OS#5337
Related: I69d4c5c6f8d499bb7f0b96a48af045361433c57b (osmo-ttcn3-hacks)
Change-Id: Iafe720a4931270e868f40c4f623d10bb9c14dc80
2022-01-23 00:13:07 +01:00
Neels Hofmeyr 8bdafe5be6 bsc: make perform_clear() work when VTY is not initialized
To be able to invoke perform_clear() also in tests where the VTY isn't
used, in f_logp() only access the VTY when it is actually ready.
Otherwise this causes an error and a failed test, for no good reason.

Related: OS#5337
Change-Id: I8116075f32937bd06ba14b426010bf6fec2ef402
2022-01-23 00:12:17 +01:00
Vadim Yanitskiy 589972fead PGW_Tests: update default values for mp_pgw_hostname/mp_pcrf_local_ip
The old values are not valid anymore when running against open5gs
version 2.4.2.  Most likely, the default addresses got changed
during the PGW split-up (now it's open5gs-smfd and open5gs-upfd).

Change-Id: I3dd7d1f0d4aebb94b8859e8d12e952917de35071
Related: SYS#5602
2022-01-20 19:38:36 +06:00
Vadim Yanitskiy bada3c927d PGW_Tests: fix f_create_session(): add missing Serving Network IE
open5gs-smfd version 2.4.2 requires this IE to be present:

[smf] INFO: [Added] Number of SMF-UEs is now 1 (../src/smf/context.c:820)
[smf] INFO: [Added] Number of SMF-Sessions is now 1 (../src/smf/context.c:2610)
[smf] ERROR: No Serving Network (../src/smf/s5c-handler.c:101)
[smf] ERROR: No Data in Serving Network (../src/smf/s5c-handler.c:105)
[smf] ERROR: Invalid Len[0] in Serving Network (../src/smf/s5c-handler.c:110)

Change-Id: Idf6d147cc4a37996ee4ae6de18158b0e140d9db6
Related: SYS#5602
2022-01-20 19:33:43 +06:00
Vadim Yanitskiy 5313af9c40 library/GTPv2_Emulation: fix timer not being started in f_uecups_xceive()
This change fixes the following error:

  Dynamic test case error: None of the branches can be chosen in
                           the alt statement in file GTPv2_Emulation.ttcn
                           between lines 362 and 370.

which may happen when osmo-uecups-daemon fails to create a tunnel
due to insufficient permissions.

Change-Id: Icb229aed7fa9dedcf999837ec6ad249ab4fdebb7
Related: SYS#5602
2022-01-20 19:33:30 +06:00
Pau Espin 2803cd3d7d mgw: Introduce test TC_two_crcx_mdcx_and_iuup_rtp
This test validates we can connect 3G to 2G AMR calls fine.

Change-Id: I3627711d80c5e42d56e478c1c4ff3fb5b27adfdf
2022-01-17 09:11:21 +00:00
Pau Espin 121f27ff32 bsc: Fix test TC_rll_sapi_n_reject_dlci_cc expectancies
Cause GSM0808_CAUSE_MS_NOT_EQUIPPED is to be transmitted only in the case
BSC receives a RelInd from the MS/BTS. In this test, an ErrorInd is
sent, as in TC_rll_err_ind_sapi_n_reject, so it is expected that the
BSC will send the N_Reject message with cause
GSM0808_CAUSE_BSS_NOT_EQUIPPED.

Related: OS#4728
Related: SYS#5047
Fixes: 999ceb6637
Change-Id: Ieebe3465b31d98fcae0e2c1993477c5021c99b3b
2022-01-12 13:22:09 +01:00
Pau Espin af0c61e06d bsc: Fix TC_rsl_drop_counter due to IPA_Emulation component being alive-type
IPA_Emulation component was marked with the "alive" type recently, in
order to avoid race conditions leading to errors during tear down of the
test.

It turns out, the way "alive" keeps the component alive is by means of
not closing the sockets when the component is stopped. As a result,
TC_rsl_drop_counter test stopped working properly because it was
specting a TCP FIN to be sent to osmo-bsc when the component was
stopped.

In order to fix it, add a new CFG port to the IPA_Emulation component on
which one can operate. Add a a new method to tell the component to close
the socket.

Then, put that in BSC_Tests into a function which was actually unsued
until now, and use it in the test in order to have the specific logic
enclosed in a function helper.

Fixes: 7138913d66
Change-Id: I68163b053313d9907ba8e40954a5933d14cb7db6
2022-01-12 11:15:24 +01:00
Daniel Willmann 095b3e0a23 deps: Use upstream IPL4asp after SCTP-related patches were merged
Change-Id: I073afe64741dd8149349da9e2494aaa86b9ab4aa
2022-01-11 15:56:30 +01:00
Pau Espin 5c50503e87 RTP_Emulation: Fix race condition where Init is answered while connect is in progress
HNB test connects the RTP socket on the HNBGW side once it receives the
Audio-CONN_ESTABLISH.cnf with the ip+port info. However, while doing so,
osmo-hnodeb is already sending an Init which then the RTP_Emulation
(connection in progress) tries to answer with an Init-ACK.

RTP_Emulation.ttcn:201 Called on RTPEM_CTRL to TC_cs_mo_call-RTPEM(6) @RTP_Emulation.RTPEM_connect : { remote_host := "172.18.33.20", remote_port := 16384 }
...
IuUP_Emulation.ttcn:76 dec_IuUP_PDU(): Decoded @IuUP_Types.IuUP_PDU: { type_14 := { pdu_type := 14, ack_nack := IuUP_ACKNACK_CTRL (0), frame_nr := 0, iuup_version := 0, procedure_ind := IuUP_PRI_INITIALIZATION (0), header_crc := 55, payload_crc := 637, u := { proc_sending := { payload := '060051673C0127000082000000000300'O } } } }
...
RTP_Emulation.ttcn:355 Sent on RTP to system @RTP_CodecPort.RTP_Send : { connId := 1, msg := { rtp := { version := 2, padding_ind := '0'B, extension_ind := '0'B, CSRC_count := 0, marker_bit := '0'B, payload_type := 96, sequence_number := 0, time_stamp := '00000000000000000000000000000000'B, SSRC_id := '11011110101011011011111011101111'B, CSRCs := omit, ext_header := omit, data := 'E4002400'O } } }
...
RTP_Emulation.ttcn:355 Message enqueued on RTP from system @Socket_API_Definitions.PortEvent : { result := { errorCode := ERROR_SOCKET (4), connId := 1, os_error_code := 89, os_error_text := "Destination address required" } } id 2

Change-Id: I61200ddb035b310eced871a9954dfcbf1dc49360
2022-01-07 14:48:25 +01:00
Pau Espin a6b9c4ced5 mgw: Introduce test TC_two_crcx_mdcx_and_iuup
Related: OS#1937
Change-Id: I0866fb499c6d426386d9811d075a7fe8386c5cb1
2022-01-05 11:27:16 +01:00