Commit Graph

1318 Commits

Author SHA1 Message Date
Pau Espin 5b4f2c691f IuUP: Improve enc/dec of PDU Type 14
Related: SYS#5969
Change-Id: I33e8a82e654b5afef8bc468cf6b1fff8fa9637ce
2022-05-26 18:27:39 +00:00
Pau Espin 52562c9ca1 ggsn: test Gy Volume-Quote-Threshold feature
Change-Id: If10171589e915db8e78278d2d802e38c66b37687
2022-05-25 16:13:56 +02:00
Pau Espin cba0f6d292 ggsn/pgw: Fix Gy CCR Reporting-Reason expectancies
The Reporting-Reason can be in different places depending on its values.
In the case of TERMINATION, we expect it to be FINAL so we know its
location.

Change-Id: Id33b9bb2f7b469e03a0761dc8807770cfdf77fcc
2022-05-25 14:13:02 +00:00
Pau Espin 8fa2284189 ggsn: Validate charging reported values
Change-Id: I497309bb0b30c61bdb00e0c08f18294ecd4dd485
2022-05-23 11:35:37 +02:00
Pau Espin a2af578a1a ggsn: Improve checks around Gy messages
Change-Id: I702796f2f941b78da904faa2ffdba4185333bc0d
2022-05-19 14:13:07 +02:00
Pau Espin 837ed5092f DIAMETER_Templates: Drop unused param
Change-Id: Ic806f7d23f6e3b23365f4d45874b0bc3b3ec91d1
2022-05-18 20:14:41 +02:00
Pau Espin b8cd34a248 library/DIAMETER: Rename template to follow naming style
Change-Id: I1c7cfbea25a2da99813aa3c4f8a5760c4185ee26
2022-05-18 20:14:30 +02:00
Pau Espin 35e308a26c DIAMETER_Types_ttcn: Generate types for TS 32.299 (Gy)
Change-Id: I8413781a28362816a1f93790951c125defbbaf6b
2022-05-18 12:09:58 +00:00
Pau Espin c24a18c594 Add script to regen library/DIAMETER_Types.ttcn
This way we have a reproducible way to generate the same
library/DIAMETER_Types.ttcn file.

Change-Id: Ie6fdb8003a0faf25a5bf4027b672da73f788988e
2022-05-18 12:09:58 +00:00
Harald Welte ee4d70c025 RAN_Emulation: f_ran_unregister_imsi complement for f_ran_register_imsi
We have a function to register an IMSI but we're missing a function
to unregister it from RAN_Emulation.  This will cause resource leaks
and eventually an overflow of the ImsiTable.  We don't notice this yet
as we don't have long enough running tests in the test suite yet.

Change-Id: I1f5d86c999d4495d661166f98183dfbc48f05f47
2022-05-17 19:48:15 +02:00
Harald Welte 130110c895 GSUP: add f_unregister_imsi() to unregister an imsi/connhdlr
Change-Id: I13f6784533fe0e1f42d9595f028861d4645ec1a9
2022-05-17 19:48:15 +02:00
Harald Welte 17f3208195 GSUP: Add function to unregister expect; clarify naming
Change-Id: I4f2eb3c2b48c8626eb2da633579a874d089be73a
2022-05-17 19:48:15 +02:00
Pau Espin 535ca2658b ggsn: Append MS TimeZone IE to CreatePDPCtxReq
TS 29.060 states that it shall be included for primary PDP context
activation if the information is available, so let's add it by default.

Change-Id: I8c7e491a07cadfe09403504a82d34e412673a531
2022-05-16 17:11:08 +02:00
Pau Espin 38968e9ba9 ggsn: Append IMEISV IE to CreatePdpCtxReq
Change-Id: I00975328e94afd116e59c88fd96c5b0154810a1e
2022-05-13 17:41:15 +02:00
Pau Espin 0e127870fb ggsn: Append ChargingCharacteristics IE to CreatePdpCtxReq
This IE is conditionally added if the HLR provides it to the SGSN.
Let's add it by default so that we test code paths where GGSN parses it.

Related: SYS#5925
Change-Id: Ia0f74041d2107afeaa36b94e33474370b7b07c0e
2022-05-13 11:54:27 +02:00
Vadim Yanitskiy 1567bac64c library/RSL_Types: allow omitting IEs in ts_RSL_IPA_CRCX
Change-Id: I7c36c3de1716968bccb07b03d2141d9abb3c175f
Related: OS#5242
2022-05-03 12:52:58 +00:00
Pau Espin 189bf1b8c1 bsc: Introduce test TC_paging_450req_no_paging_load_ind
Change-Id: I787cba895f1cb6c5bfef95259bcf69b4291a9237
2022-05-02 20:43:48 +02:00
Harald Welte 4a788a0812 bsc: Increase test coverage for CBSP emergency broadcasts
This adds new tests:
* TC_cbsp_emerg_write_bts_cgi_noreplace
* TC_cbsp_emerg_write_bts_cgi_replace
* TC_cbsp_emerg_write_bts_cgi_kill

All of the above relate to improved / fixed handling of emergency
broadcasts in some corner cases.

Related: SYS#5906
Related: OS#5539, OS#5540
Change-Id: Ic0f0b3d620f3ca73bab3d45997d0c1b9433ac1f7
2022-04-27 18:39:56 +02:00
Harald Welte d686941aa8 CBSP: tr_CBSP_REPLACE_CBS_COMPL: num_compl_list is optional
The list might be empty because either there were no broadcasts
completed in case of a CBS message, or because it was an emergency
message where this IE is never used.

Change-Id: I2b24ac7e5857bdd50a821399b3c383cea9d408ad
2022-04-27 18:39:26 +02:00
Harald Welte 67881aef23 Avoid generating zero-length packets
I used the construct like f_rnd_octstring(f_rnd_int(100)) in a number
of places to generate random-length packets with randomized length.

The problem I didn't realize is that f_rnd_int() of course can also
return '0', which would generate zero-length packets.  This may be
permitted in some protocols, but it leads to problems e.g. when trying
to send a UDP packet of zero length (which the kernel will not do).

So let's introduce
* f_rnd_int_nonzero() for returning non-zero randomized integers
* f_rnd_octstring_rnd_len() for returning a random-length random payload
  octet string
* replace all f_rnd_octstring(f_rnd_int()) call sites with the new
  function.

Change-Id: I818a113ff8d2a2f7cab2ec7d9c8661607c6331d6
Closes: OS#5528
2022-04-12 22:52:47 +02:00
Pau Espin 12c4aa8bb7 GTPv2_Emulation: Increase reset_all_stats timeout
Release of 256 tuns + threads takes quite a reasonable amount of time.
Let's increase the timeout since reset_all_state can take around 10
seconds sometimes.

Related: OS#5523
Change-Id: Ie01e07bd698cb5c386f757f4ec315f4892ad61cb
2022-04-12 09:44:52 +00:00
Pau Espin b335f01ef2 DIAMETER_Emulation: Allow up to 256 IMSI Diameter components
TC_createSession_ping4_256 requries 256 concurrent connections.

Change-Id: Idc305a868f827dee63a476979fc9de9fc12580c5
2022-04-11 12:04:55 +00:00
Pau Espin 69730a29a4 DIAMETER_Emulation: Fix typo in comment
Change-Id: I6163fc9153082598c7211b16a7c18fb95cf3d08a
2022-04-11 12:04:55 +00:00
Pau Espin e4361705c1 DIAMETER_Emulation: Rename association table
The table has no direct relation to SGSAP, it tracks IMSI connections in
a generic way.

Change-Id: I12399465549739fb99af193e7071fff8bc452b0b
2022-04-11 12:04:55 +00:00
Pau Espin 77fdd0b5aa ggsn: Initial testing of open5gs Gy interface
Related: SYS#5276
Change-Id: I10027d4f8adc6b47ce97b90514d1f13e9aa3d40d
2022-04-11 12:04:55 +00:00
Neels Hofmeyr a47a8c60ee bsc: add TC_emerg_call_and_lcs_loc_req
An emergency call often comes with a Location Request. Make sure
osmo-bsc handles it well.

Related: SYS#5916
Change-Id: I95037374c45943cb14401bc48f16a39c2fcbe1f5
2022-04-07 14:18:28 +00:00
Pau Espin 5a778ae426 Diameter_Templates.ttcn: Avoid sending AuthAppId Relay in CEA
We don't really act as rely agents in the emulation, so let's not
announce it.

Furthermore, this aids libfreediameter selecting proper routes, since it
seems to only underscore peers not matching the AppId if they are not
rely agents (see dont_send_if_no_common_app() in freeDiameter.git)

Change-Id: I0a9daf094f4c27c0b4de5581ddd56feced8e5732
2022-04-06 13:41:03 +02:00
Pau Espin b8b1c0d626 RLCMAC_EncDec: Fix bug decoding LI[0]=0
Change-Id: I86c1b48c922f50013257c8dce405cbad1d77d868
2022-04-05 10:22:14 +00:00
Eric Wild 49888a65dc ran emulation: allow multiple reset attempts
bsc-nat introduces a delay that will lead to failed tests, since the
reset attempt happens too early and times out, and the tests do not
retry.

Change-Id: I9f6db2a24e984eef31e76f9d42a80eb6a1bb6928
2022-03-31 17:49:10 +00:00
Harald Welte 562d28e305 bsc: Add tests for CBSP MESSAGE STATUS QUERY procedure
Change-Id: I124a69c515d634bc054ed35e430af6b3c11ad46e
Related: SYS#5909
2022-03-28 21:29:04 +02:00
Harald Welte f42c787ce6 CBSP_Types: Fix typo num_bcats_compl -> num_bcast_compl
Change-Id: Ic51b3071ea9233a053cb1ee837b910d9250010d2
2022-03-28 21:28:42 +02:00
Vadim Yanitskiy dcbdb820ea library/BSSMAP_Templates: add missing LCS {Priority,QoS} IEs
According to 3GPP TS 48.008, section 3.2.1.71, the LCS QoS IE shall
be present if location of the target MS is requested and is optional
otherwise.  Since [1], osmo-bsc started to check presence of this IE,
so let's add it to ts_BSSMAP_Perform_Location_Request.

Taking a chance, let's also add LCS Priority IE.

Change-Id: If2bd6e636d3ee695abab9ed40417dc53ec68fd12
Related: [1] osmo-bsc.git Ifeb359b0468845da0b4fed9e2e4b79256067fa81
Related: SYS#5891
2022-03-23 16:27:57 +03:00
Vadim Yanitskiy 2ae269b9ac library/BSSMAP_Templates: add missing LCS Client Type IE
According to 3GPP TS 48.008, section 3.2.1.71, the LCS Client Type
IE shall be present if the location type indicates a request for a
location estimate and is optional otherwise.  Since [1], osmo-bsc
started to check presence of this IE, so let's make sure that
it's present in ts_BSSMAP_Perform_Location_Request by default.

Change-Id: I5c8d6962e957d587dc4b65d08bf56bd4ef2f0d6e
Related: [1] osmo-bsc.git Id3262e67c3dc25cb93fbd52a40689c5529ca2d41
Related: SYS#5891
2022-03-23 16:27:57 +03:00
Vadim Yanitskiy 00bfcb548d library/BSSAP_LE_Types: fix wrong IEI in record BSSMAP_LE_IE_LcsClientType
Change-Id: Ifae1efa1717a5dbc7ecd4b5ba83e3866ff803390
Related: SYS#5891
2022-03-23 16:27:53 +03:00
Vadim Yanitskiy 9e55abdfb1 library/BSSLAP_Types: fix receive template used in ts_BSSLAP_Reset
Change-Id: I6ed967c18346263b05b624b0bb5698f23ee842f7
2022-03-16 20:33:51 +03:00
Pau Espin 33b4749fcf lib/DIAMETER: Allow sending CEA with AuthAppId
The new message is to be used by Gy interface emulation, which according
to RFC4006 uses AppId 4 "Credit Control Application". The application
is apparently not 3GPP vendor specific.

Change-Id: I0e33673d65140aad34d2efcae3c7f49154ceb99f
2022-03-14 12:05:37 +01:00
Vadim Yanitskiy 443891b773 library/L1CTL_Types: fix t_RslChanNr_RACH used in send templates
Change-Id: Id7570df09bea04c60475d91519c6aac63bf6f749
2022-03-13 21:59:07 +00:00
Vadim Yanitskiy a4254e7a79 library/L3_Templates: add templates for RR Physical Information
Change-Id: Icc0f9d0987e77a714e9eaffaedd851a982063582
Related: SYS#5838
2022-03-13 14:04:18 +00:00
Vadim Yanitskiy 16e2991bf1 library/LAPDm_Types: add 'padding' field to the LapdmFrameAB record
TTCN-3 offers a very convinient way of matching an octetstring
against a record template (decoding target) on the fly, so that
there is no need to attempt decoding it manually beforehand.
This can be done by using the 'decmatch' keyword (see B.1.2.9).

Unfortunately, decmatch fails if an octetstring is longer than
the encoded variant of the decoding target (e.g. has padding).
Let's work this around by adding a 'padding' field, so during
decoding all remaining octets will be stored in it.

Change-Id: I0151adf7790127617f7cb57c9a9ec6c28721e95a
Related: SYS#5838
2022-03-13 14:04:18 +00:00
Vadim Yanitskiy dbd2f61e37 library/GSM_RestOctets: add partial definition of SI 6 Rest Octets
Change-Id: I5aeed4986820a71f761f21b57c87782d3000293f
2022-03-10 17:34:21 +03:00
Neels Hofmeyr 9fe1320a78 bsc: add missing codec list in AoIP Handover Request
So far, osmo-bsc ignored the Codec List (MSC Preferred) in inter-BSC
incoming HO Request messages. Starting with osmo-bsc
I117cc29d6d11db77d160de654f43f5993db6ee21, a missing codec list on AoIP
causes incoming inter-BSC HO to fail, as it should (3GPP TS 48.008
indicates that a codec list shall be included on AoIP). To avoid test
fallout when merging above osmo-bsc patch, add a codec list to HO
Request on AoIP.

Related: OS#5839
Change-Id: If06de9c9b43d79f749447a4e2a340176eef75c79
2022-03-07 14:38:11 +01:00
Neels Hofmeyr a23f3b1ecb bsc: inter-BSC incoming HO in with empty SCCP CR
Test inter-BSC incoming HO where the Handover Request message is not
included in the initial SCCP N-Connect, but follows in a separate DT1.

Related: SYS#5864
Depends: I535c791fa01e99a2226392eb05f676ba6c3cc16e (osmo-bsc)
Change-Id: I6732153cdd0d529bfaf0925387e765f3403a756b
2022-03-03 04:58:20 +01:00
Harald Welte 97c7197bb0 simtrace: Add support for slot_mux_nr to CardEmu_BD_Config
This catches up with a recent change in simtrace2.git
(Change-Id I4cdb250d2e1dbc5b8b0169f8b7c21e288b492e1d) adding
a new optional field to CardEmu_BD_Config

Change-Id: Id29584764a2f27b9de5fa9ff67fd0ae3e912f02e
2022-02-25 19:02:01 +00:00
Harald Welte 73018522f4 move SIMTRACE_{Types,Templates,Emulation}.ttcn to library
this will allow us to us SIMTRACE as part of a test suite testing
e.g. CCID readers.

Change-Id: I4349019e2deac114f4c040f1441b70663a521ec2
2022-02-25 16:56:16 +01:00
Pau Espin 001b3e8767 GTP_Templates: Fix runtime error in tr_EuaIPv*() templates
Doing this when receiving an IPv4 EUA thwos an error:
"if (not match(cpr.endUserAddress, tr_EuaIPv4(?)) and not match(cpr.endUserAddress, tr_EuaIPv6(?)))"

Dynamic test case error: Performing lengthof() operation on an octetstring template with no exact length.

This happens if for instance received spare bits are set to '0000'.

Change-Id: I70ad3c10e2ecfed8f733ff906272a9597b2ab9bd
2022-02-24 13:35:28 +00:00
Pau Espin ee57d1cd68 BSSGP_Emulation: usse alive-type for internal BVC created components
Otherwise, during shutdown of all components we may end up in a
situation where the BVC is already killed and BSSGP Emulation receives
a packet which tries to forward to BVC and fails.

This can be seen quite a lot in PCU_Tests.TC_pcuif_suspend:
"""
PCU_Tests.ttcn:394 setverdict(pass): none -> pass
...
PCUIF_Components.ttcn:246 Stopping test component execution.
...
GPRS_Components.ttcn:222 Connection of port BSSGP[0] to TC_pcuif_suspend-BVCI1234(6):BSSGP_SP was closed unexpectedly by the peer.
...
GPRS_Components.ttcn:222 Port BSSGP[0] was disconnected from TC_pcuif_suspend-BVCI1234(6):BSSGP_SP.
...
Component type BSSGP_Emulation.BSSGP_BVC_CT was shut down inside testcase TC_pcuif_suspend
...
BSSGP_Emulation.ttcnpp:317 Dynamic test case error: Sending data on the connection of port BVC to 6:BVC failed. (Broken pipe)
"""

Change-Id: Ib0adcf64eb5ca876cd9e9b91f2b597804c03bdc2
2022-02-24 11:47:43 +00:00
Pau Espin 8afdee10b3 BSSGP_Emulation: Fix ttcn3 runtime warning
Should fix following TTCN3 warning during runtime of
PCU_Tests.TC_pcuif_suspend:
"""
BSSGP_Emulation.ttcnpp:462 Timeout operation on timer g_T2 failed: The timer is not started.
"""

Change-Id: Ic74572a21b5abee8e530741466360ff7e16a357d
2022-02-24 11:47:43 +00:00
Daniel Willmann 9e789bec1b ranap: Allow RAB ReleaseList inside RabAssReq template
Related: OS#5152
Change-Id: If5dabf24ab410ef95f92be1cb865ac06330b495e
2022-02-22 17:22:54 +01:00
Daniel Willmann cd8b71c4fa ranap: Fix criticality in IuReleaseRequest
Change-Id: Ib636f5d5ca02962b1592f64d0af30b4b3c9f0053
Related: OS#5152
2022-02-22 17:22:54 +01:00
Philipp Maier 6289ea86c6 RANAP_Templates: add sending of RAB_FailedList to tx_RANAP_RabAssResp
The templates ts_RANAP_RabAssResp and tr_RANAP_RabAssResp miss the
option to send a RAB_FailedList. This is needed to simulate a RAB
assignment that fails at the HNB

Change-Id: I95c7c51587981d9f478b9d31fcde139f228fa87f
Related: OS#5152
2022-02-22 16:45:14 +01:00
Pau Espin 67f23547d2 GTP_Codec_Port: Check length field of GTPV1C received packets
Change-Id: Ie9447b7ec7f7f5ee35cd0393265f5edb5578bdaf
2022-02-21 16:01:52 +01:00
Daniel Willmann 7af5a2a5c1 hnbgw: Fix encoding of AssignmentRequest with RABs to be released
Also change the name to avoid mistaking it for a RABReleaseRequest

Change-Id: Ifb52ed9e5559e9566b0d7a02246fdf29ff0b6dce
2022-02-18 17:12:07 +01:00
Pau Espin a8ef3bea24 bsc: Introduce test TC_srvcc_eutran_to_geran_src_sai
Related: SYS#5838
Change-Id: I186b9b9436bf82bcd54ca348df1e5e4b6424ca6e
2022-02-17 19:34:51 +00: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
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 480e67f00d ggsn: Test GTP-U Echo Request/Response
Change-Id: Id92180be948ee3f5246c7befec666698a1b074f3
2022-02-11 13:10:20 +01: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 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 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
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 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
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 735ba7aa53 RTP_Emulation: Several fixes and improvements for IuUP streams
* Immediate tx of IuUP (N)ACK control packets. Without this, INIT ACK
is delayed until the TX side of the RTP endpoint is enabled.

* Allow and handle IuUP control messages even if g_rx_enabled is false.

* Properly validate user data payload if IuUP is in use.

Change-Id: Id4f8b02a8123bb30b659c40148c8ab4c7c2078a1
2022-01-05 11:27:16 +01:00
Pau Espin b204a4e322 RTP IuUP Emulation: Avoid spamming with retransmitted Init
Until now, an Init was sent on each RTP transmit period, clogging the
pcap files. Moreover, this is break by design, since transmitting
another Init so close the the previous one would give no time to the
transmitter to receive the Init ACk and move state, which means the
other end would potentially be reconfigured each time (for each Init).

Change-Id: I8e299a3fe49f9d31cae182f7ed4dc0ea3fc22ba2
2022-01-05 09:48:26 +00:00
Daniel Willmann aa9220aeac IPL4asp: Fix ppid always shows 0, remove Iuh workaround
Change-Id: I941a794849c347ed61ca5170bca32f5329818d92
2022-01-05 09:25:07 +01:00
Daniel Willmann a79e9bbccc hnbap: Add tr_HNBAP_HNBRegisterAccept template
Change-Id: Iae35653e337acffc9190d2e4dc68f25f00bd6812
2022-01-05 09:25:07 +01:00
Daniel Willmann 645b888db5 library/rua: Add missing templates (ts_/tr_)
Change-Id: Iad6525f4a337ac2399bec71d2e16f8540f78b247
2022-01-05 09:10:08 +01:00
Pau Espin 58a69df9a5 hnodeb: Updates in HNBLLIF and HNBGW_COnnectioNHandler to support and test IuUP
Depends: osmo-hnodeb.git Change-Id Ibe356fa7b1abaca0091e368db8478e79c09c6cb0
Related: SYS#5516
Change-Id: I19612fce8190dfe14f98d346adb5db4e1c2a08d9
2021-12-23 15:12:47 +01:00
Pau Espin 066f46f9d6 Iuh_Emulation: Avoid sending events to HNBAP if socket is not connected
This should hopefully fix HNB_Tests errors showing up in jenkins after
the test finishes:
Iuh_Emulation.ttcn:203 Dynamic test case error: Port HNBAP has neither connections nor mappings. Message cannot be sent on it.

Change-Id: Ide201425e81dcfe2fd395d820bdcbd74f5415ef5
2021-12-23 15:12:47 +01:00
Pau Espin 64fd02b80d IuUP_Emulation: Fix frame number wrap-around
As seen when running a test:
IuUP_Emulation.ttcn:150 Dynamic test case error: While RAW-encoding type '@IuUP_Types.IuUP_PDU': There are insufficient bits to encode '@IuUP_Types.IuUP_PDU_Type_0.frame_nr'

Change-Id: Ic9e69115c49545a7b9797d8f85568d5e91dfb329
2021-12-22 15:03:17 +00:00
Vadim Yanitskiy 58b165383f library/RSL_Types: fix CHAN ACT templates for dynamic timeslots
* t_RSL_IE_ActType_PDCH is actually a constant, not a template.
* tr_RSL_CHAN_ACT_PDCH makes no use of parameter 'mode'.
* Accomplish tr_RSL_CHAN_ACT_PDCH with a send template.
* Use 'present' qualifier for receive template parameters.

Change-Id: Ie62a92daaacf4de5f05dd1f3f5b4a2a5e4ee6dd6
2021-12-20 14:55:00 +00:00
Pau Espin 2514245bbd hnodeb: Adapt HNBLIF to latest changes
Change-Id: I50a1b9be579ace9f0f85c6c68b5648d504f5f51c
2021-12-16 16:39:36 +00:00
Harald Welte 7138913d66 Use alive-type components for "infrastructure" components
According to feedback received from TITAN developers in
https://www.eclipse.org/forums/index.php?t=msg&th=1106652&goto=1848616&#msg_1848616
the use of alive-type components has the following advantage:

> Also the DTE during the shutdown can be avoided to use alive type
> components.  The test ports of the alive components are not
> disconnected/unmapped when the component finished only when killed or
> the MTC terminated.

So the idea of this patch is to use alive-type components for all the
underlying infrastructure, such as the *_Emulation_CT starting from M3UA
to SCCP and further up the stack.  This way, only the MTC and the
highest level of components (such as ConnHdlr) remain as normal
components.

The hope is that using more alive-type components in the lower protocol
layer emulations will reduce the probability of DTE during shutdown if
some message is received during the component shutdown after the MTC
has completed.

Change-Id: I61d791d6d1bfe9226aabbe223baafc5f8f6d4f04
2021-12-15 20:20:30 +00:00
Pau Espin 9e18372690 hnodeb: Add gtp SAPI
Change-Id: Ie4de00641089abbd03273ce5a2d9325659ac7d42
2021-12-15 14:23:23 +00:00
Pau Espin 32fb54e610 hnodeb: Add audio SAPI
Change-Id: I20544f67c2450bc3cd4bcb3ee638de1958bf5783
2021-12-15 14:23:23 +00:00
Pau Espin a6bbb8c45d hnodeb: Add initial infra to emulate HNB LL socket iface
Change-Id: Ia864a672643a0e42f5afea6fd901e621478c87c0
2021-12-15 14:23:23 +00:00
Vadim Yanitskiy 3f7a6dc297 library/DIAMETER_Emulation: handle DWR/DWA ping-pong
Change-Id: I0291eccd0467f8fe15ddcb88259618365c33befd
Related: SYS#5602
2021-12-15 05:42:49 +03:00
Vadim Yanitskiy b57ef873e0 library/DIAMETER_Templates: add missing AVPs to AIR
Change-Id: I948072dbfa05d158483a727fb708f853741ab23f
Related: SYS#5602
2021-12-15 05:42:49 +03:00
Vadim Yanitskiy 463d826cca library/DIAMETER_Templates: fix missing app_id in ts_DIA_AIR
Change-Id: I7b06d9cad09f1fd7858bd745d0aaa2fbcb1983dd
Related: SYS#5602
2021-12-15 05:42:49 +03:00
Vadim Yanitskiy 21fd7db556 library/DIAMETER_Templates: fix flags in AIR templates
According to RFC 6733, section 3 "Diameter Header", if the 'R' bit
is set, the message is a request.  If the 'P' bit is set, the
message may be proxied, relayed, or redirected.

ts_DIA_AIR is a template for Authentication Information *Request*,
so the 'R' bit must be set.  Also, let's allow this message to be
proxied, relayed, or redirected by setting the 'P' bit by default.

In tr_DIA_AIR, do not match all command flags, just ensure that
the message is a request.  Other flags do not matter.

Change-Id: I7db3b632189eed09c1bdf98f9d588491d928e2f5
Related: SYS#5602
2021-12-15 05:29:47 +03:00
Vadim Yanitskiy 446edae4bc library/DIAMETER_Templates: add receive template for AIA
Change-Id: Ie4aca42c3024aa7f46123b2df4a42c5d43f5b9da
Related: SYS#5602
2021-12-15 05:28:41 +03:00
Vadim Yanitskiy 2dba494201 library/DIAMETER_Templates: prettify & enrich AIR/AIA templates
* Make both {hbh,ete}_id parameters last among the others;
* Use more elegant and consistent template formatting;
* Make DestinationRealm value configurable;
* Make SessionId value configurable.

Change-Id: Iaf6472fecbadd58e86b78c59348d9924ab57f97d
Related: SYS#5602
2021-12-15 05:12:13 +03:00
Vadim Yanitskiy 5e1bdc04d1 library/DIAMETER_Templates: add missing templates for ULR/ULA
Change-Id: If0b8daf5717eb4c26da231489118e200faeee9a2
Related: SYS#5602
2021-12-15 05:06:24 +03:00
Vadim Yanitskiy 0e8f516d22 library/DIAMETER_Templates: rework existing ULR/ULA templates
* Make both {hbh,ete}_id parameters last among the others;
* Use more elegant and consistent template formatting;
* Make Origin{Host,Realm} values configurable;
* Make DestinationRealm value configurable;
* Make SessionId value configurable.

Change-Id: I0585e306a87453c212c6b5ac5635181c47b34b4f
Related: SYS#5602
2021-12-15 05:00:54 +03:00
Vadim Yanitskiy f28b2550f2 library/DIAMETER_Templates: add templates for DWR/DWA
Change-Id: I2abe33a3ac08c8855342f4277288cacb3545771b
Related: SYS#5602
2021-12-15 04:59:03 +03:00
Vadim Yanitskiy 00720bd851 library/DIAMETER_Templates: set default {hbh,ete}_id in ts_DIAMETER
Having default values for these parameters allows omitting them
in subsequent send template definitions based on ts_DIAMETER.

Change-Id: I714b18bbe77949593803e999d25e4ef8e1827917
Related: SYS#5602
2021-12-15 04:54:21 +03:00
Pau Espin ecd1225858 library/rua: Add some more templates
Change-Id: Iab2afbc6ebaa8a41d3e951155609d4c0a2d6866b
2021-12-13 18:58:31 +01:00
Vadim Yanitskiy c041e9902f library/Osmocom_Types: use f_rnd_bitstring() in f_rnd_ra11_ps()
Change-Id: I122d386b0c8ce320687016b6cab883b8a36bdffc
2021-12-11 02:11:35 +03:00
Vadim Yanitskiy 6a2a11ff4c library/Osmocom_Types: fix maximum values passed to f_rnd_int()
It's clearly stated in a comment to this function that the returned
value is 0 <= x < max, so it's always less than the maximum.

Change-Id: If127fc6a2feeddbdd3ea636b56dadf8957941758
2021-12-11 02:08:46 +03:00