Commit Graph

4317 Commits

Author SHA1 Message Date
Vadim Yanitskiy e42f8d634d sgsn: reset encryption in SGSN_Tests_Iu.f_vty_config()
Ensure the expected default UEA configuration, which is always
reset properly even if one of the testcases aborts due to a DTE.

Change-Id: Ic2c5a11e86e4349796fa7508076ac27ef22815cd
2024-05-15 00:55:30 +05:00
Vadim Yanitskiy b5a002edbf sgsn: fix TC_iu_attach failing for recent -master
Since recently, osmo-sgsn is requesting encryption (UEA1 + UEA2)
in RANAP Security Mode Command by default [1].  The testcase
TC_iu_attach is assuming no encryption (UEA0) and thus failing.

Fix this by explicitly setting UEA0 via the VTY, similarly to
what testcase TC_iu_attach_encr does.

Change-Id: Ibaf83db1ab0f82f7e934e89ae3f6c19d014be197
Related: [1] osmo-sgsn.git I4eb9451b4267fc1436ed90a55ff200cf36f16bf6
2024-05-15 00:55:30 +05:00
Vadim Yanitskiy f0bbadc13b sgsn: add Iu specific, module local f_init()
Change-Id: Iea23b847b363da518a8dc121405522df9e4e0f77
2024-05-15 00:55:30 +05:00
Pau Espin 73f6a314df SIP_Templates: Allow passing Require,Security-client,Supported fields to REGISTER templates
These fields are used in IMS.

Change-Id: I20a0df5633db8c0e7732659c1316b85e63317afc
2024-05-10 20:31:41 +02:00
Pau Espin 89d8c952b9 SIP_Templates: Allow passing WwwAuthenticate to ts_SIP_msgh_std
The field could already be passed to its tr_* counterpart, but not the
the ts_* one.

Change-Id: Ibc6cc5320f24ce82165c1b2140bad30cb356f8ae
2024-05-10 20:28:25 +02:00
Pau Espin 2a8333733a SIP_Templates: Allow setting transport in Via templates
This is needed when using IMS, since TCP is used.

Change-Id: Id45491615bcb5c074ef4fc298cbb24b2e034972d
2024-05-10 20:23:23 +02:00
Pau Espin 77976a6b15 asterisk: Use ActionID field in Action Login
It's a good practice to tag Actions with an ActionID to do proper
matching of the response once it comes back. It also helps reading a
dump of the conversation if there were events in between.

Change-Id: Iec320762ff0cca86319f7374b53c642f08a6e6df
2024-05-10 16:22:46 +02:00
Pau Espin 941ca3caa1 AMI_Functions: Tx ActionID instead of ActionId
The AMI documentation webpage mentions "ActionId", but Asterisk is
always returning "ActionID" in all response messages.
Any of the 2 is parsed fine by Asterisk since the keys are case
insensitive, but anyway let's use same case as what Asterisk is actually
transmitting to make reading of output easier.

Change-Id: I8097e461fd0cadfa780d52ab1666e41b9d2b8a0e
2024-05-10 16:22:46 +02:00
Pau Espin 21c084f6ce AMI_Function: Match field keys in case insensitive way
As per [1], "Keys are case insensitive".

[1] https://docs.asterisk.org/Configuration/Interfaces/Asterisk-Manager-Interface-AMI/AMI-v2-Specification/

Change-Id: I9080f617c4e7272b9dd67d616069ac9350411f3c
2024-05-10 16:22:46 +02:00
Pau Espin 4757be713f SIP_Emulation: Handle SIP REGISTER from peer
This is needed when emulating an IMS core.

Change-Id: I49dfe54434113eb8b75306a3a8ddda940fa14743
2024-05-10 16:22:46 +02:00
Pau Espin 01f1df8ef8 asterisk: Implement AMI_Adapter using IPL4 instead of TELNET
Change Telnet_PT to a regular TCP socket for the AMI interface.

I started using Telnet_PT port since initial use of the interface
was done through telnet, but it's not really a telnet interface and
stuff starts becoming difficult to maintain properly when events
(generated by Asterisk at any time) arrive.

The current TEXT decoder/encoder from Titan seems to be struggling in 2
scenarios, so for now we are adding some workarounds in
dec_AMI_Msg_ext() before calling it in order to be able to go forward
and avoid errors:
1- Fields of format "MyFieldName: \r\n" (empty value). I tried changing
the "value" field in record AMI_Field to "optional", but then apparently
the TEXT decoder fails to decode values consisting of several words.
Ideally, I'd expect the TEXT decoder to put an empty "" string in the
"value" field in that case if "optional" is not flagged in the record.
2- Fields of format "MyFieldName: foobar: hey there \r\n" containing a
": " token in the value. I'd expect TEXT decoder to put all subsequent
strings in the last field "value" if no more fields are described in the
record.

Change-Id: Icaf2860c1dd4befa4498f0d176cfadf26cfa8d1d
2024-05-10 16:22:17 +02:00
Pau Espin bcb4e82d16 asterisk: Introduce AMI_Adapter_CT
This allows to keep string handling totally internal to the AMI_Adapter
component, which also means now the CLIENT port acts asynchronously on
full AMI messages.
This allows for instance using activated altsteps to ignore events or
answer to them.

Change-Id: Ibf230d2302fecf443f34e1c4d4acfd4802f4cc79
2024-05-09 17:54:29 +02:00
Pau Espin 9c83471a5b Misc_Helpers.ttcn: Add some more string handling API helpers
These are currently used by code in AMI_Functions doing some workaround
for TEXT decoder limitations.

They can be merged independently now since anyway they are totally
generic and may be useful for future users.

Change-Id: I3d6da125a10807b7a2f3ecad8145a046a322c7d6
2024-05-09 17:54:29 +02:00
Pau Espin 4362dbd088 asterisk/AMI_Functions: improvements to implement PJSIPRegister
Change-Id: Ibc4ff6eaad84f67d33c1211dc5e39294ce1c8fac
2024-05-09 15:25:52 +00:00
Pau Espin f0862ed483 Misc_Helpers: f_str_split(): Fix parse with len(delimiter) > 1
Change-Id: I1ac53635deea82a501f2a8c7a94faf501ddf7afd
2024-05-09 15:25:52 +00:00
Oliver Smith a4b72ce8f4 hnbgw: skip f_statsd_expect for latest
Fix that 6 tests started failing on ttcn3-hnbgw-test-latest with e.g.:
  Timeout waiting for metrics
        HNBGW_Tests.ttcn:2885 HNBGW_Tests control part
        HNBGW_Tests.ttcn:1536 TC_rab_assign_fail testcase

Fixes: 904b5f1a ("hnbgw: Implement validation of [some] counters")
Change-Id: I0cd47728308757fe6eaaaed1581fbbec03a09cf7
2024-05-09 08:29:38 +00:00
Philipp Maier 2cb1251360 HTTP_Adapter: fix request sending in f_http_tx_request
The function f_http_tx_request has two parameters to spcifiy the body
part of the HTTP request (body and binary_body). The function only
sends a request when either body or binary_body is populated, but not
when none of the two is populated. This means requests without body
part (e.g. a GET request) can not be sent.

There is also no proper interlocking between body and binary_body. We
should make sure that this situation does not occur.

Related: SYS#6824
Change-Id: I258ee6209c35d0601f5a4d82423d2f5c6fbb03cc
2024-05-08 15:50:07 +00:00
Pau Espin 0dd3f269f5 SIP_Templates: tr_SIP_REGISTER(): Pass via field directly as a param
Similar to other templates which already required it.
There's no user of this template (yet).

Change-Id: I9fe477370e028543b04dee35a3285ddae6bb2c59
2024-05-07 14:48:59 +00:00
Pau Espin ac8a05432f asterisk: Initial steps to emulate IMS core
Add the initial infrastructure to manage 2 SIPmsg_PT ports, one for the
local SIP UAs and one for the IMS core.
Still missing:
* Trigger Asterisk (through AMI) to do the initial connect + register to it
* Configure ipsec after Unauthorized response from IMS core

Change-Id: Ibbbadd54b7facf4ef7384499704e742f482a1252
2024-05-07 14:48:59 +00:00
Pau Espin 1a77134664 SIP_Emulation: Rename component id
Remove the dash character, since it makes it impossible to reference the
component name under TESTPORT_PARAMETERS in .default/.cfg files.

While at it, actually, allow the test to provide a full id instead of
always appending the suffix to it. This provides more freedom on the
testsuite to provide a fitting component name.

Change-Id: Iecefe7d98a5842872f1efc55e013f672186ef1a8
2024-05-07 14:48:59 +00:00
Harald Welte 0266017299 Revert "hnbgw: osmo-hnbgw.cfg: Update file to make it similar to the one in docker-playground"
This reverts commit e9c6c7b97e which
breaks all of the test cases reliably.  I'm surprised how it got
submitted in the first place, as it can never have worked.  It uses
127.0.0.1:2905 on both the STP and the HNBGW side.

Change-Id: Ia7d9a743e0359ce7220c42597ded670967d562a9
2024-05-06 18:57:39 +00:00
Philipp Maier 916b5fa8ec SGP32Definitions: add ts template for authenticateClientRequestEsipa
The template ts_authenticateClientRequestEsipa is still missing, let's
add one.

Related: SYS#6824
Change-Id: I9490a2ee59a89511876bb1055a056a43fbf172bb
2024-04-30 12:03:17 +02:00
Philipp Maier 3583475784 RSPDefinitions: add defaults values to ts_authenticateClientResponseEs9
The template ts_authenticateClientResponseEs9 has no default values,
let's add some default values to make it easier to use

Related: SYS#6824
Change-Id: I07d942a58a3c1c29c37fcaa50d3a274ce8b026bc
2024-04-30 12:03:17 +02:00
Philipp Maier d7ccd01432 RSPDefinitions: add separate template for CtxParams1
Fields of type CtxParams1 are used in other messages too, so it might be
helpful to add a separate template for them.

Related: SYS#6824
Change-Id: Iba6c3780f9f3aec5742d53b3bd7b0c0392b25761
2024-04-30 12:03:17 +02:00
Philipp Maier b1e2fe4842 RSPDefinitions: add defaults for initiateAuthenticationResponse/Request
Related: SYS#6824
Change-Id: I3842569f36dfb94e61afffaa03353b552e001c72
2024-04-30 12:03:17 +02:00
Philipp Maier 746f43e371 RSPDefinitions: add separate template for serverSigned1
The field serverSigned1 is used in many messages, so it might be helpful
to add a separate template for it.

Change-Id: Ic50676ac2863173b72765afc44794a56d03413a5
Related: SYS#6824
2024-04-30 12:03:17 +02:00
Philipp Maier 0957b1b22c HTTP_Adaptor: allow keeping an HTTP client connection
At the moment the HTTP_Adaptor automatically creates a new connection,
performs the HTTP request and closes the connection again. This means
the connection lives only for a single request. Let's add some
flexibility so that we can perform multiple consecutive requests
through the same connection.

Change-Id: Ic6994c504143820dde498c1a2bad2ad6a523dd70
Related: SYS#6824
2024-04-30 12:03:17 +02:00
Philipp Maier 28e7ad3721 HTTP_Adapter: add support for binary messages
The HTTP_Adapter currently only supports text only HTTP messages. However,
the HTTPmsg testport API also has a way to deal with binary HTTP messages.

Related: SYS#6824
Change-Id: I18340f19ed462bf80af683dc9f2831b602f4bdf7
2024-04-30 12:03:17 +02:00
Philipp Maier bb169b224c IPAd_Tests: add testsuite for an IPAd
With this patch we add a testsuite that can be used to test an IPAd
implementation.

The testsuite emulates the ESipa and the ES10x (pcsc cardreader)
interface and is capable of testing a direct profile download and other
ESipa features like the execution of an eIM package (eCO, PSMO).

Change-Id: Ic9ea8c69e56a2e8ddf0f506861ece6d40cbcb06d
Related: SYS#6564
2024-04-30 12:03:17 +02:00
Philipp Maier e73a6a3fab SGP32Definitions_Templates: improve ts_initiateAuthenticationRequestEsipa
The template ts_initiateAuthenticationRequestEsipa has a field for smdpAddress and
euiccInfo1. Those fields are optional fields, but they still play a central role in
the protocol, so that they are effectively mandatory. Let's make the fields available
to the template user and populate them with meaningful default values.

Related: SYS#6824
Change-Id: I97aa039810ad9fffea4226254fa675fd24647de1
2024-04-30 12:03:17 +02:00
Vadim Yanitskiy 7ed7bd6e6d bsc: make use of IpaUnitId codec
Change-Id: Iaf38fdb0a1c3ada5af6f1a05c7a9008e4eae0727
2024-04-30 08:50:17 +00:00
Vadim Yanitskiy 73468c8bc7 library/RSL_Emulation: make use of IpaUnitId codec
Change-Id: I20e1ac35707affc6aab60397a22e33fe2bd1106e
2024-04-30 08:50:11 +00:00
Vadim Yanitskiy 89be8e2037 library/IPA_Types: add codec for IPA UnitID
Change-Id: I68eb0d9e28bbf5d2d8ffe916aae5a66a0fdb9bd0
2024-04-30 08:50:04 +00:00
Pau Espin 74f5350824 epdg: Add README.md
Change-Id: I6326b6c35f66d30787758d83e96e8a070375b0c0
2024-04-26 22:25:41 +00:00
Pau Espin 2ed9f5f398 SIP_Emulation: Remove duplicated map()
The map() is already done before the component is started, f_init_sip().
It's better doing it there because then it's up to the creator of the
SIP_Emulation component to establish the name of the system port, hence
allowing multiple instances which can be configured differently (eg.
different bind ip+port).

Change-Id: I5632c94d03a9dce0d04d94766ce72e6700b6116b
2024-04-25 13:14:15 +02:00
Vadim Yanitskiy 11f8ac8761 {cbc,remsim}: fix unbound 'use_ssl' field in HTTP_Adapter_Params
A recent commit added a new field to record HTTP_Adapter_Params, but
forgot to update the callers f_http_init() to actually set this field.

Change-Id: I534d087b71cefd683a0c7411a415049c5e1ee519
Fixes: 832b1efe "HTTP_Adapter: Allow API users to enable/disable SSL"
2024-04-25 09:18:54 +00:00
Pau Espin de7a48529a asterisk: Use Titan TEXT encoder to implement AMI record enc/dec
f_ami_wait_for_prompt_str had to be fixed since it was returning content
like this:
"Response: Success\nMessage: Authentication accepted"
Instead, the TEXT encoding expects:
"Response: Success\nMessage: Authentication accepted\n"
which is actually more in line with proper expectancies.

Change-Id: If179e45307a7e42b81b28db6ee4b7bf5eeb8b5f1
2024-04-25 09:15:31 +00:00
Philipp Maier 4a24fb0632 SGP32Definitions_Templates: add new set of templates to support rollback
This patch adds a number of templates that are needed to test profile
rollback.

Related: SYS#6563
Change-Id: I6db76afb102bf011655b7dbca9cff07b8116eb8d
2024-04-24 12:47:57 +02:00
Philipp Maier e4de06eb40 SGP32Definitions_Templates: add template tr_provideEimPackageResult_ePRAndNotif
Add a new template to verify the provideEimPackageResult request (ESipa)
from the IPAd

Related: SYS#6563
Change-Id: I86231f0e9dcef90abf60757cc55895863ad2b1b3
2024-04-24 12:47:57 +02:00
Philipp Maier 88f2481e17 SGP32Definitions_Templates: rename tx_provideEimPackageResultResponse
The template tr_provideEimPackageResultResponse and ts_provideEimPackageResultResponse
should be renamed to tr_provideEimPackageResultResponse_eimAck and
ts_provideEimPackageResultResponse_eimAck as the TODO message says.

Related: SYS#6563
Change-Id: I68536eec6d04364efdbbbd5205788cf5c8ab3028
2024-04-24 12:47:57 +02:00
Philipp Maier ac10ceed6b SGP32Definitions_Templates: use enable instead of configureAutoEnable PSMO
The "enable" psmo is a more common example than the configureAutoEnable
PSMO.

Related: SYS#6563
Change-Id: Ia364d5f6d510545988dc88cacdd15a2c03cc5d8b
2024-04-24 12:47:57 +02:00
Philipp Maier 978ab44492 SGP32Definitions_Templates: add missing new line at the end of file
Related: SYS#6563
Change-Id: I0e7c3b514ba6569c3707ae20ed213591ca7d0e1c
2024-04-24 12:47:57 +02:00
Philipp Maier 832b1efe9b HTTP_Adapter: Allow API users to enable/disable SSL
At the moment HTTP_Adapter has no option to enable SSL

Related: SYS#6824
Change-Id: I6487deea50cd9b4ed4905d9a3a78e00def8ea319
2024-04-24 12:47:57 +02:00
Philipp Maier 260f7087ba HTTP_Adapter: put HTTP config options into a record
The function f_http_init currently takes only two config options. For the
moment this is not a problem, but the amount of additional options may grow
in the future. So let's put the options in a record to have them separate.

Change-Id: I4c1c204ea38d76d5fdd7e539d56ca2bf9f693d7d
Related: SYS#6824
2024-04-24 12:47:57 +02:00
Philipp Maier ef20fa083b HTTP_Adapter: allow body to be "omit"
In HTTP not all requests have a body. At the moment we describe a
missing body with body := "". This is not 100% correct since the rest of
the code interprets this as a present body with zero length and will put
a content_length = 0 header line into the HTTP header, even in the GET
request. This will most likely be ignored by any HTTP server, but it is
still not 100% spec compliant.

Related: SYS#6824
Change-Id: Ifedc8c2a590835663d1ba0b08b1fe4d54bdd0fff
2024-04-24 12:47:57 +02:00
Philipp Maier 6406e6d9db HTTP_Adapter: allow API users to specifiy custom header
At the moment HTTP_Adapter can only make requests with a fixed
pre-defined HTTP header. However, some application may require
additional custom header lines or different values than the ones
specified in the pre-defined HTTP header.

Related: SYS#6824
Change-Id: I115fd14254e0957c0955649aeb47059dc180bf57
2024-04-24 12:47:57 +02:00
Philipp Maier d9887d364d SGP32Definitions_Templates: remove unrelated template parameter
The template parameter eimFqdn is not relevant for this kind of
template.

Change-Id: I365fe15a22a98ced5c6a5d13b2700df1df13014b
Related: SYS#6563
2024-04-22 13:04:42 +02:00
Vadim Yanitskiy aaf7ce4ae8 fixup: sgsn: fix unused param in f_routing_area_update()
In 1ee1edd2 I changed f_routing_area_update() to actually use the
given RAI as Old RAI in the Routing Area Update Request.  Not only
this broke the testcase scenario (Old RAI shall remain unchanged!),
but also started triggering a use-after-free bug in osmo-sgsn.

Passing 'ran_index := 1' is enough for the second Routing Area Update
Request to show up with a different RAI (at BSSGP level), however the
Old RAI IE shall obviously indicate the *old* RAI, not the new one.

A follow-up commit will add a separate testcase to reproduce the
use-after-free problem in osmo-sgsn.

Change-Id: Ib16985cb08834a238ca4f7a747c43097f430ed6f
Fixes: 1ee1edd2 "sgsn: fix unused param in f_routing_area_update()"
Related: OS#6439
2024-04-21 20:49:15 +07:00
Vadim Yanitskiy 74b12c7592 sgsn: TC_sgsn_context_req_in: match MM Context & GSN Address IEs
Change-Id: Ie68794c309e548279381d044a3e34dcdf405084f
Related: SYS#6603, OS#6294
2024-04-19 17:34:18 +07:00
Vadim Yanitskiy acd0b39f79 sgsn: add testcases for SGSN Context Request procedure
Change-Id: If71de10897a8a9f6612cd46c760cd89c0299ac2c
Related: SYS#6603, OS#6294
2024-04-19 17:34:15 +07:00