Commit Graph

4058 Commits

Author SHA1 Message Date
Pau Espin 20f3514d70 mme: Fix seq_nr=0 being used everytime in Tx SGSNContextReq
Change-Id: I9a1a2dbceb4c4f30a8408c6f58bf645656e900bc
2024-01-15 18:47:39 +01:00
Pau Espin 3be4d92cb2 mme: Add code to derive NAS token from NAS ul_count
NAS Token is derived from kasme and NAS ul_count as specified in 3GPP TS
33.401 A.9, and its LSB 16 bits passed to the network when mapping the GUTI to
RAI+PTMSI+PTIMSI_SIG.

Take the chance to move guti2rai_ptmsi() up to before the place it is
used.
Change-Id: I5e6003a2fe3e74cc93cfe4a288e6c114aa288d0b
2024-01-15 15:30:35 +01:00
Pau Espin bddba3aa10 pgw: Expect EchoResp in CLIENT port of component who sent EchoReq
A recent commit in GTPv2_Emulation improved the routing of incoming
messages from network towards clients.
After that change, the GTPv2_Emulation properly matches the originating
component of the procedure and forwards the reply to it.
Hence, TC_tx_echo() needs to be adapter to expect the reply on its
CLIENT port.
TEID0 is now left for incoming initiating messages which have no seqnr
match.

Change-Id: I1764fdf81192597e393d79d34cb8f221aa79bbd9
Fixes: 1d2cc67036
2024-01-15 10:38:27 +01:00
Pau Espin 167bca418f GTPv2_Emulation: routing improvements: Prioritize response, fallback to TEID
First try forwarding to component transmitting the originating request,
since this is the most fine-grained match.
Finally, if no specific match was found and if messages belongs to
TEID0, send it over that port as a fallback.

Fixes: 1d2cc67036
Change-Id: Ie96d65085fb352489150183415dbd6cc8237a47c
2024-01-15 10:38:27 +01:00
Pau Espin 9411082cc5 GTPv2_Templates: Fix tEID field optional tr_PDU_GTP2C_msgtypes()
The TEID field is optional, based on t_Bit. Hence, we also want to
match by type if there's no TEID.

Change-Id: I65044b8758046704e22f9057f34ce5fdbb7aabfe
2024-01-15 10:38:27 +01:00
Pau Espin e016346359 S1AP_Emulation: Add port message to reset NAS count values
It is sometimes needed to reset them to zero as per spec, like when
moving GERAN/UTRAN->EUTRAN.
This will be used by a follow-up patch.

Change-Id: I61d7b919aba8f58a020c18ae9b9bba4108d59010
2024-01-15 10:38:27 +01:00
Pau Espin b5ad4aef27 NAS_Templates: Introduce template tr_PDU_NAS_EPS_TrackingAreaUpdateAccept
Change-Id: Iba19ac8293fecfe0b150155cebe50cbe4d32fe4d
2024-01-15 10:38:27 +01:00
Pau Espin a94e823416 NAS_Templates: Allow passing old_guti and ptmsi_sig to TAU Req template
Change-Id: I5e0204e772edefc49a63b73fc4aad2fed5c14cac
2024-01-15 10:38:14 +01:00
Andreas Eversberg a8aa16e1eb ASCI: Correctly confirm talker, so originator can be identified
Fix the issue that MSC rejects call termination, because talker can't
be identified as originator of the call.

Fixes: OS#6325
Change-Id: I0381e25e15624e6b7577910c95700a355ed3f811
2024-01-10 16:06:13 +00:00
Pau Espin f95460b55b GTP_Templates: Add templates for some GTPv1C IEs
Change-Id: I84aac34ca40a2707dc9da28e112fd7684e706c8e
2024-01-09 15:55:25 +00:00
Vadim Yanitskiy 5389e3a625 library/GSUP_Types: add Source Name IE to receive templates for SMS
Old osmo-msc versions do not include the Source Name IE in SMS related
GSUP messages, unless it's set explicitly in the config file ('hlr' /
'ipa-name').  Recent osmo-msc versions (see the related osmo-msc patch)
do include this IE even if it's not set explicitly ('unnamed-MSC').

Because of this, some testcases in ttcn3-msc-test are currently
failing for osmo-msc master, but still passing for the -latest.

Let's set the 'ipa-name' explicitly in osmo-msc.cfg, and expect the
Source Name IE to be present in SMS related receive templates.

Change-Id: Ic24d3082fe3dce08e43e8f3ecb6d6132503c55c6
Related: docker-playground.git I7757aae1d01b679f530b5c0a6c95b224cb9f204f
Related: osmo-msc.git I7bacd001b81326c32bc262c7d0c0491ded822fa8
Related: OS#6135
2024-01-09 19:34:49 +07:00
Vadim Yanitskiy 6eb7ac6db8 library/GSUP_Types: set Message Class IE in send templates for SMS
We do expect it in receive templates for SMS, so let's also
indluce it in the send templates.

Change-Id: I6468d8606eb85c811d86e4a1407ee60c8a36fbea
Related: OS#6135
2024-01-09 19:19:07 +07:00
Vadim Yanitskiy 286b042b53 MSC_Tests: indicate the failure reason in setverdict()
... so that there is no need to check logs to see why a test failed.

Change-Id: I159bc54f6f4561d42aeabe825e16fa77e60c2dae
2024-01-09 18:11:27 +07:00
Pau Espin 41f4d90829 LTE_CryptoFunctions: Fix rx_count increment
The previous logic was wrong, since it was increasing the rx_count at
the time where the msg is received and before checking it. Instead, it
should be increased after having validated and accepted it.
This fixes the case where rx_count will have to be reset (to zero) when
doing mobility GERAN->EUTRAN.

Change-Id: I712d95f7784a6a9855fe36300b0ebfcd4c6ef377
2024-01-08 20:49:42 +01:00
Pau Espin 60b5e18691 Update titan.ProtocolModules.GTP_v13.5.0 to current master
Current master contains a fix for missing mandatory field in MM Context IE.

Change-Id: I36c87ed98c752a54650e4453ccdff45463d0bc96
2024-01-08 16:03:44 +01:00
Pau Espin a88e51d7ad mme: TC_s1ap_tau_unknown_guti: expect UeContextReleaseCmd
The MME is sending the message after TAU Reject, and it may be forwarded
through TTCN3 components while some of them are already being torn down
since the test is finished.

Change-Id: I6b915d0e32a46fa9546b3b1b96aa69ad43baae9e
2024-01-08 15:52:31 +01:00
Pau Espin 1d2cc67036 GTPv2_Emulation: Improve routing messages to client
Before this patch, for instance, registering an IMSI would not
necessarily mean the messaged ended up in the client registering it, due
to how the code paths were being handled.

Ideally the code should create a CLIENT candidate list based on all
registered matches, and then remove duplicates and finally send message
to each CLIENT in the resulting list. That's really not needed as of now
though.

Change-Id: If253a2b8991f0caf685058238df9a7c997983e27
2024-01-05 22:38:52 +01:00
Pau Espin 9f07e3b6b9 regen-makefile.sh: Increase file Code splitting to decrease mem use
Building MME_Tests with an 8core host with 16GB of RAM sometimes
exhausts the whole available RAM, triggering the OOM killer.
Let's increase the variable to generate 8 C++ files for each TTCN3
files, in order to avoid consuming so much memory.

Change-Id: If5f54e18384f8a26b281d057e9d9f5c450566422
2024-01-03 13:15:13 +01:00
Pau Espin 12cf40abb9 GTP_Emulation: SGSN_ContextRequest: Fix unconditional access to optional field IMSI
Change-Id: I0721f25deeae822150a39e52916b8bf272de21ee
2024-01-03 13:15:13 +01:00
Pau Espin 209d0a4ce1 mme: Use LAC from SGSN with most significat bit set to 0
According to 3GPP TS 23.003 sec 2.8.2.2.2, LACs from GERAN are
configured with MSB 0 in order to differentiate it from EUTRAN ones.
This is used by MMEs to figure out if the peer is an SGSN, based on
the the LAC mapped into MME group ID in GUTI .

Change-Id: Iaf89228f6f026e04d5f583211959025e6d8d4a1d
2024-01-03 13:15:13 +01:00
Pau Espin 11625856eb mme: Parametrize RAI+CI used by emulated SGSN
This will be used further in subsequent tests, plus it is configured in
the sgsn peer list of open5gs-mmed.cfg, so it knows how to route/find
SGSN peers.

Change-Id: Ia7d807bb5d75d711be7d4f6fbccd8fd123da171f
2024-01-03 13:15:13 +01:00
Pau Espin 78c5e4128d mme: TC_ue_cell_reselect_eutran_to_geran: Make sure oI flag is not set in DeleteSessionReq
Make sure Operation Indication is set to 0, to tell the SGW to keep the Session up at the PGW.

Change-Id: If863f260a274fec5921ed888216c1688ff115ade
2024-01-03 13:15:13 +01:00
Pau Espin 35c0cc2d2a mme: Trigger last parts of procedure TC_ue_cell_reselect_eutran_to_geran
Some later parts of the 4G->2G cell reselection where missing, mostly
related to tear down after MS has successfuly moved to the new SGSN. mainly:
- S6a Diameter Cancel Location Req + Answer initiated by HSS.
- Handle UeReleaseContextCommand and answer with
  UeReleaseContextComplete, emulating the ENB.
- handle S11 GTPv2C Delete Session Request and answer with Delete
  Session Response, emulating the SGW.

Change-Id: Ic0263a3aec922194aad22b031b2c82a99954354d
2024-01-03 13:15:03 +01:00
Pau Espin 278f543102 mme: expect EMM Information received after attach
open5gs-mmed transmits it after attach  complete.
Read it so that it's not kept queued in the port and follow-up uses of
the port don't provide unexpected results.

Change-Id: I6f19a18cced7acd2b831c943e8b3a1f462378435
2023-12-21 19:21:31 +01:00
Pau Espin 6cf7fde4f6 S1AP_Emulation: Fix UeContextReleaseCmd not forwarded to users
We still want to forward it to the user so that it can:
1- validate the IUT sent the message
2- answer with a UeContextReleaseComplete

The f_assoc_id_by_s1ap_ids() function is modified to avoir a Dynamic
test error if the enb_ue_id is omit, which can happen if
UeContextRleaseCmd used choice "MME UE S1AP ID".

Change-Id: Iaf6a775d1cbc4f85f185bb26a0da1e5c9a4167a2
2023-12-21 19:18:10 +01:00
Pau Espin a5bb8076a0 S1AP_Emulation: Allow retrieving {MME,ENB}_UE_ID from UeContextReleaseCmd
It's not true that it can contain several IDs. The only difference is
that it has a choice IE which can hold a pair containing both MME/ENB UE
IDs, or only MME_UE_ID.

Change-Id: I4fb51f3f50fa10400184b65d272530ea26a2bc8e
2023-12-21 19:15:33 +01:00
Pau Espin 2f32707d9b GTPv2_Templates: Make tr_GTP2C_DeleteSessionReq() easier to use by default
There's currently no user of this template, but there will be one in a
follow-up patch in MME_Tests.

- Set generic templates as default parameters, so it can match
  everything.
- Reorder parameters to follow the message fields more closely.
- Change/fix some template types in parameters which were not correct.

Change-Id: I38b6c51b78772bc01e7be916ba382cb78934864c
2023-12-21 19:12:13 +01:00
Pau Espin 53aa61daf0 NAS_Templates: Add missing template tr_NAS_EMMInformation
Change-Id: Ie71480d44d9674e2dff3ae31cab262bc3e0a261e
2023-12-21 19:10:45 +01:00
Pau Espin e6e2460a8d DIAMETER_ts29_272_Templates: Add missing templates for CLR and CLA messages
Change-Id: I9366b434e856828c5d441cbc7b0d952060cdc71b
2023-12-21 19:09:52 +01:00
Pau Espin 3f19ce7f41 DIAMETER_Templates: Add missing ts_AVP_DestinationHost
Change-Id: Ifcbd68c48b273fe7b0753c5b31c33d4e51493de9
2023-12-21 19:09:12 +01:00
Pau Espin 117a94f333 Split Diameter TS 29.272 templates into its own file
This allows more easily finding, understanding and using the tons of
templates coming from different specs.

Change-Id: I2e6b813a9e4ff98eef575aaaf46dbcf9f1a5d2d4
2023-12-21 16:16:17 +01:00
Pau Espin ae747ac46f mme: Fix tests reusing IMSI suffix
Use value 0 to indicate that the test is not really using the generated
imsi, to easily increment it for tests requiring it.

Change-Id: Ia9d70c125b92352f50adfa80a6cb916bfc8acf99
2023-12-20 20:55:34 +01:00
Pau Espin ca651b54ad mme: Fix TEID values used in test
Related: OS#6294
Change-Id: I5a32491a00eb6bad505e4bcf9a88017382073138
2023-12-20 18:54:44 +01:00
Pau Espin 408e0ae554 mme: Introduce test TC_ue_cell_reselect_eutran_to_geran
Initial bits to be able to test SGSN Context Request+Response emulating
an UE doing cell reselection from 4G to 2G.

Related: OS#6294
Change-Id: I707cb8c6b39c1440db5ccc2f02d08337b38fb564
2023-12-19 13:35:22 +01:00
Pau Espin 2edec462b9 S1AP_Emulation: Fix NAS_PDU decoding of InitialContextSetupRequest msg
The InitialContextSetupRequest message contains a NAS_PDU deep inside
(in E-RABToBeSetupListCtxtSUReq), and it was not being rx_counted nor
decoded by the S1AP_Emulation.
Since we also care about the lower layer contents from the emulation
user point of view, first send the S1AP_PDU and later the decoded NAS_PDU.
This way the user can wait to receive the related low level S1AP_PDU,
and then read again from the port to get the decoded NAS_PDU.

Change-Id: Ibff5a38b92deafa8d104801f107ca1b8b82bbce0
2023-12-15 19:18:50 +01:00
Pau Espin acb5b8f28d LTE_CryptoFunctions.ttcn: Increment nus.rx_count on each pkt read
Before this patch, the rx_count field was never set to anything other
than zero.

There's still a problem with counter not being incremented when a
S1AP_IntialCtxSetupReq message containing a NAS_PDU is received. This
will be fixed ina follow-up patch.

Change-Id: I1ee25fd8fde6fbce95444ee4b73918ce1f61b427
2023-12-15 19:09:42 +01:00
Pau Espin 22a65e6bc8 GTP_Emulation: SGSN_ContextRequest: Fix unconditional access to optional field IMSI
Change-Id: I254f790aeb7c491200b86bec3c22ae56c452c2df
2023-12-15 18:57:07 +01:00
Pau Espin ecfc7d61e6 mme: Implement missing UE attach steps
Related: OS#6294
Change-Id: Ib4a69aef40bf9dd17d640f650e459668f8415aaa
2023-12-15 15:05:31 +01:00
Pau Espin 9ad1980774 LTE_CryptoFunctions.ttcn: Log NAS_UE_State on failure
Change-Id: Ib95d496f06f07f4c28d9b08b6a8059d8453e8acd
2023-12-15 13:18:09 +00:00
Pau Espin 4976217518 LTE_CryptoFunctions.ttcn: Immediate termination upon failure
Change-Id: I09170c17c5cbb552a8aeef31b4b8fa5c89a00887
2023-12-15 13:18:09 +00:00
Vadim Yanitskiy 17953b8347 library/RLCMAC_EncDec: fix segfault in encode_trailing_padding_spb()
Change-Id: Ib0992a50026f0e0deebb959788ed6e79c5286fec
Related: OS#6310
2023-12-15 13:15:30 +00:00
Vadim Yanitskiy 8f86bbee5a library/PCUIF_Types: clean up, drop remains of PCUIFv10
Change-Id: Ibfe8558cb9f335d8c29348063b0ff02b138dd4c7
Related: osmo-pcu.git I68a3f59d5c960ae3a4fbd74f9d4a894295cb9ed8
Related: docker-playground.git If0b2209af645f391817f65b4227736b52ca59e2e
Related: docker-playground.git I70f0c30d6c514614095dcbbcac5d025001861fbc
Related: OS#6191
2023-12-15 13:15:30 +00:00
Vadim Yanitskiy 284387a865 library/PCUIF_Types: fix padding attribute for PCUIF_Message
This fixes tons of warnings like this one:

  dec_PCUIF_Message(): Data remained at the end of the stream
                       after successful decoding: '00'O

Change-Id: If34da75c21b023222c44504d561cd6f658a401cf
Fixes: e0666ea5 "PCUIF: upgrade to PCUIF v12"
Related: OS#6191
2023-12-15 13:15:30 +00:00
Vadim Yanitskiy 9f40dc586a library/L1CTL_Types: add missing L1CTL_GPRS_RTS_IND message
This commit fixes the following warnings:

  While RAW-decoding type '@L1CTL_Types.L1ctlMessageLV':
    Invalid enum value '37' for '@L1CTL_Types.L1ctlMsgType':

Change-Id: I0772f5273ecc2fb0c3def1fd645828b216e3032f
Related: osmocom-bb.git I1494e0aac7555f6e01b4b435b77140afc42c098e
2023-12-15 13:15:30 +00:00
Andreas Eversberg 2e7d39878c Fix TC_rll_est_ind (contention resolution on DCCH SAPI 0)
The BTS rejects establishment without contention resolution on DCCH SAPI
0. This only applies if channel activation type is for immediate
assignment. The Test expects the establishment on DCCH SAPI 0 to fail,
if channel activation type is for immediate assignment and to pass, if
the channel activation type is for normal assignment.

Related: OS#6309
Change-Id: I8143c6e9448a663fee2111a91415cc58fbcb2133
2023-12-14 15:04:57 +00:00
Pau Espin d7ae2c4eb2 library/GTPv2_Emulation: Patch SeqNr only on outbound initial messages
Change-Id: I0f13074ccee2bf2d00d2dc2af491b9effc142f22
2023-12-13 19:18:58 +01:00
Pau Espin fa2b384f2a GTPv2: set TEID and SeqNr in ts_GTP2C_CreateSessionResp
Change-Id: I83f1f4f78adb9cd85758513420479327ea73187a
2023-12-13 18:49:19 +01:00
Pau Espin 2e9988dc17 library/GTPv2_Templates: Fix seq nr not set in ts_GTP2C_DeleteSessionResp
Change-Id: I8409eb35fc2f0bda6c5e11ae5c3d7628503bb2cd
2023-12-13 18:48:33 +01:00
Pau Espin ae04c793b1 ggsn: Allow receiving MTU ICMPv6 Option in RouterAdv
This Option is not mandatory, but open5gs-smfd started transmitting it
recently (ab64ff9514d8da121500be7b92c9d793ef20b894). Allow it.

Change-Id: Icf3e10dc599d41fb65051670fc3aec5ff0c67510
2023-12-06 14:11:45 +00:00
Pau Espin 229ceed4ef ggsn: Fix restriction type on several template definitions
Change-Id: I47a0c3fbf1b4078c2d8157b148330f7750cc3266
2023-12-06 14:11:45 +00:00