Commit Graph

75 Commits

Author SHA1 Message Date
Pau Espin a16a6b667b Move f_addrstr2addr() to library/Misc_Helpers.ttcn
This function can easily be reused in other testsuites supporting both
IPv4 and IPv6 addresses.

Change-Id: I4243ec5551f128629b6504ccc59efeb456a6855d
2024-03-22 11:27:19 +01:00
Harald Welte 556e4d2dbc various: update expected-results.xml
Change-Id: I21052636bf892e5da86ef736d16035ec324aedbe
2024-03-04 19:09:58 +00:00
Pau Espin ce1d3cb08c gsup: Add PCO IE
This commit adds a new file PCO_Types.ttcn which allows generically
encoding decoding PCOs.

Change-Id: I9a1ae74712d6e8e0cd524ccd7fc2529b1a15dd97
2024-02-21 20:00:24 +01:00
Pau Espin 8f1403a471 Move templates from GSUP_Types.ttcn to GSUP_Templates.ttcn
Follow similar structure that we have for other protocols.

Change-Id: I54cc8c99d1e91d57c3d5a92f6529ef2055e9d4ed
2024-01-18 20:22:34 +01:00
Alexander Couzens 9e3c233c7a hlr: add imsi unknown cause test case
Check if the reject-cause is correct implement when the subscriber
couldn't found.

Depends-on: Icea39020c23fbbea9e92847df76af8986fdbf48a (osmo-hlr)
Change-Id: I87c3a2d7304b81cfc11a364d933567e1a080b99a
2023-11-16 13:30:21 +00:00
Alexander Couzens 25d284995d HLR_Tests: add testcase for multiple APNs in subscriber data
With a new HLR version there are multiple APN possible in the
Subscriber Data (PDP Info).

Related: SYS#6391
Change-Id: I8d0c08272bc239370e800d6014ab9c68087b8989
2023-09-05 18:44:00 +00:00
Alexander Couzens 4cbd207a09 hlr: implement str2apn() to convert an apn as string into octetstring
APN are encoded by splitting each domain part by the dot and prefix
each element by a 8bit length.
E.g. internet -> \x08internet and internet.foo -> \x08internet\x03foo

Change-Id: I607969cd58110d4d5ff1b828e64cf2b5031868ac
2023-09-05 18:44:00 +00:00
Oliver Smith f8fe1329e2 regen_makefile.sh: set executable name explicitly
Set the executable name in each regen_makefile.sh explicitly with -e,
instead of having it set indirectly from the first .ttcn file. Make it
consistent by placing the name on top of each of these files.

Fix for warning:
ttcn3_makefilegen: warning: File `BSC_Tests.ttcn' was given more than once for the Makefile.

Related: OS#5252
Change-Id: I5ed03f8f3ed905483620dc7bae33b617bbb8507f
2021-10-13 11:12:22 +02:00
Oliver Smith 2e0e624060 regen_makefile.sh: files/flags in separate lines
Make all regen_makefile.sh more readable and diff friendly by moving
each entry in FILES and CPPFLAGS_TTCN3 into separate lines. Order
entries alphabetically.

Related: OS#5252
Change-Id: I6b6866eb9f6ec6232e4ae434517457a4c8c1c050
2021-10-12 16:35:01 +02:00
Pau Espin 0055a29ea9 hlr: Get rid of module param mp_hlr_supports_dgsm
This param is not needed anymore since new releases used in -latest don't
need to disable it.

Change-Id: I484267c169646310564bd6d9cd13a196b61400e4
Related: OS#5042
2021-02-26 13:21:39 +01:00
Pau Espin 9a5b8ffc5b CTRL: Introduce support to run osmocom CTRL server
Change-Id: I37db9962f51baf2c63bd58ec47ec89f773d7a255
2021-01-07 15:06:39 +01:00
Neels Hofmeyr 929b406940 update expected results
Change-Id: Icb534a2b00fc48c3ead009a620e6061e595cb581
2020-10-01 06:48:55 +02:00
Neels Hofmeyr a4d2100431 update expected results
Change-Id: I37014274ee97f09985c31966e7cc9122fe11a856
2020-05-19 19:25:35 +00:00
Vadim Yanitskiy a2afacc905 library/IPA: use tr_ASP_IPA_EV instead of inline templates
This way we can easily add new parameters to ASP_IPA_Event.

Change-Id: Icc37286fcb4d43836d56a26424ecb9dcba58d1f1
2020-05-18 21:16:35 +07: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
Neels Hofmeyr b2168516f3 hlr: add tests for GSUP proxy routing
GSUP proxy routing, as it is implemented in an upcoming osmo-hlr patch,
requires that osmo-hlr returns a received Source Name IE back as Destination
Name IE. Add tests for these, for various situations.

These tests pass since GSUP request handling with request->response association
was introduced to osmo-hlr in I179ebb0385b5b355f4740e14d43be97bf93622e3.

Implement this by adding a source_name to the g_pars, which should be sent out
in ts_GSUP_* to osmo-hlr, and expected back as destination_name in returned
messages.

Add source_name and destination_name to various templates, with default :=
omit.

Add f_gen_ts_ies() and f_gen_tr_ies() to compose expected IEs more generically.

Change-Id: I3728776d862c5e5fa7628ca28d74c1ef247459fa
2020-05-11 17:31:57 +00:00
Oliver Smith 421ea89aab hlr: add TC_MSLookup_mDNS_service_other_proxy
Ask proxy HLR about configured sip.voice service, and expect result.

Related: OS#4380
Change-Id: I2c956119783972b5e6828bed7554a8a79984d8a2
2020-02-06 16:21:47 +00:00
Oliver Smith da83c8307c hlr: add TC_MSLookup_mDNS_service_GSUP_HLR_proxy
Ask proxy HLR about gsup.hlr service, and expect no answer.

Related: OS#4380
Change-Id: Ic42c909e6540b2294b1109dc19c1df348224457b
2020-02-06 16:21:47 +00:00
Oliver Smith 18b48081fe hlr: add TC_MSLookup_mDNS_service_GSUP_HLR_home
Request "gsup.hlr" service right after creating subscriber from the home
HLR. "TC_MSLookup_mDNS_service_other_home" is similar, but does not query
the "gsup.hlr" service. The "gsup.hlr" service has a different code path
in OsmoHLR:
- it exists without being explicitly configured and returns the IP and
  port of the HLR's own GSUP server
- the request is answered, even if the subscriber is not attached to the
  HLR (for Location Update via proxy)

Related: OS#4380
Change-Id: Id567989e4be7ac2d3857d3ea61a1ca3a2401a8dc
2020-02-06 16:21:47 +00:00
Oliver Smith b51a53fdfa hlr: add TC_MSLookup_GSUP_proxy
Let OsmoHLR act as proxy between MSC and home HLR during Location
update.

Related: OS#4380
Change-Id: I945e651f1346e56dbe3c02d9d08ccd95cc8d6626
2020-02-06 16:21:47 +00:00
Oliver Smith 6e81f7e940 hlr: add emulated GSUP server (second HLR)
Prepare for upcoming D-GSM test, which needs to emulate a GSUP server.

Related: OS#4380
Change-Id: Idbfe8a145c90a524145089a06d9bbefac4d7edd8
2020-02-06 16:21:47 +00:00
Oliver Smith deb80a6a82 hlr: add TC_MSLookup_mDNS_service_other_home
Send an mslookup mDNS request to the home HLR, asking about a service
that is not "gsup.hlr". Hence the "_other" in the test name, service
"gsup.hlr" has different code paths, and related tests will be added in
follow-up patches.

This is the first test using MSLookup_mDNS_Emulation, so add related
test infrastructure.

Related: OS#4380
Depends: osmo-hlr I2fe453553c90e6ee527ed13a13089900efd488aa
Change-Id: Ia7f92d33691f910549353b16a7b0efc18e521719
2020-02-06 16:21:47 +00:00
Oliver Smith 62a1c63436 hlr: f_perform_UL: add CnDomain parameter
Make it possible to do CS location update, not only PS. This is needed
for upcoming D-GSM related tests.

Related: SYS#4618
Change-Id: Idd699f054c9242614b9bea066428293f8b2da9c2
2020-01-20 07:31:45 +00:00
Alexander Couzens 9269644b70 hlr: add TC_gsup_sai_num_auth_vectors
TC_gsup_sai_num_auth_vectors tests the GSUP IE
GSUP_IE_NUM_VECTORS_REQ which allows the client to
ask for a specific amount of auth tuples in a
Send Auth Info request.

Change-Id: I10a523cbaf08fe42924ffd0dc498496fdc76395f
2020-01-15 15:57:46 +00:00
Harald Welte 4b61204e85 hlr: Don't attempt to find AUTN in 2G-only tuple
In Change-Id I40c6cf7e28ad9331e6c27fe7acafa3f9e277eedf we introduced
a patch that verifies the AMF separation bit for 3G/3G vs 4G
authentication.  However, the test ignored the fact that AUTN cannot
be present in pure 2G tuples.

This makes TC_gsup_sai pass again.

Change-Id: I9b61e62a58b583461dd5e67dd12119be282cae21
2019-12-03 20:08:57 +01:00
Harald Welte af7c318489 HLR: Add test for generating EPS (LTE) tuples with separation bit == 1
Depends: osmo-hlr Ic766bc40f6126bb479bd0a05b0e96bec3e240008
Change-Id: I40c6cf7e28ad9331e6c27fe7acafa3f9e277eedf
2019-12-02 08:42:22 +00:00
Neels Hofmeyr c0c1aca92e hlr: stop on various failures
I found some of the tests hard to analyse when geting failures, because they
don't stop the test on failure. Spread some 'mtc.stop' so that the test stops
at the failed message instead of carrying on.

Change-Id: I804aca84d0ccf4767a5c097cf6c882ccbd87c4e1
2019-11-25 20:08:02 +00:00
Oliver Smith e1def665c3 hlr: update expected-results.xml
Add check imei, create-subscriber-on-demand tests.

Change-Id: I8ea4a90d5da8367f369522cfd9133e2c6061dd5c
2019-07-08 12:25:57 +00:00
Oliver Smith 1b257806a1 hlr: add create-subscriber-on-demand tests
Test all possible code paths where a subscriber on demand can be
created:
* Check IMEI early
* Location Update
* Send Auth Info

Related: OS#2542
Change-Id: Id544fa906ad442c2bbbccff437c18d04ddccde2e
2019-06-18 12:50:37 +00:00
Oliver Smith 936dbe64ee hlr: add Check IMEI tests
Create tests for most code paths of rx_check_imei_req() in hlr.c (except
for subscriber create on demand, this will be in an upcoming patch).

Add missing message types to GSUP_Types.ttcn, and adjust the IMEI and
IMEI_Result IEs for consistency with the existing IEs, and to make the
tests compile.

Related: OS#2541
Change-Id: I97c8462f0817149feadd0c4865e3df6c2af92a80
2019-06-13 09:35:17 +00:00
Oliver Smith 141620d343 hlr: add f_vty_subscr_show_nomatch()
Allow to check if a certain pattern does not match the "show subscriber"
output. This will be used by upcoming tests for the check IMEI GSUP
message type, to check if the IMEI was not stored, depending on the
OsmoHLR configuration.

Change-Id: I176d8fd2ee74e1eb7ac797f931cd6005d398740f
2019-06-13 09:35:05 +00:00
Oliver Smith 49a8746ca5 hlr: add osmo-hlr.cfg
Copy osmo-hlr.cfg from docker-playground.git, but replace all IPs with
127.0.0.1.

Change-Id: I73f673523dab8765ca87851175fafdec9fc20e1b
2019-06-09 06:52:18 +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
Vadim Yanitskiy 06e53c5999 HLR_Tests.ttcn: suspend some compilation warnings
In the most use cases of f_SS_expect() we are not interested in
GSUP_PDU returned by this function. Calling it without storing
the returned value causes TTCN-3 compiler to complain:

  warning: The value returned by function
           `@HLR_Tests.f_SS_expect' is not used

Let's make use of previously unused variable 'res', and save
the returned GSUP_PDU to make the TTCN-3 compiler happy.

Change-Id: Ifda42aa18af8076013b436364513296b2b008731
2019-03-29 16:44:11 +00:00
Neels Hofmeyr 2caf349752 update expected results
Change-Id: Idacaf8343bed4a37878eacdf338c4d5eb46bf7a7
2019-01-23 12:44:42 +01:00
Vadim Yanitskiy 21c423353c library/GSUP_Types.ttcn: fix missing session state IE in PROC_SS_ERR
Both session state and session ID IEs are always being encoded
together by libosmocore's GSUP implementation. So, if a message
contains a session ID IE, session state IE shall also be there.

For some reason, the session state IE was missing in both
ts_GSUP_PROC_SS_ERR and tr_GSUP_PROC_SS_ERR templates. This
could led to incorrect matching in our test cases.

This change fixes both templates by adding the missing IE. Since
tr_GSUP_PROC_SS_ERR templete is used in HLR_Tests.ttcn, all the
affected matching statements were also corrected.

This correction doesn't affect successful test case executions,
because we don't test possible problematic situations yet. But
if something went wrong on the HLR side (i.e. SUT), the matching
statements wouldn't match the PROC_SS_ERR message correctly
and continue to wait until the guard timer is expired.

Change-Id: I44070396ce7119eab4608d9f9fb090bb223dfaa2
2018-11-29 21:42:17 +07:00
Vadim Yanitskiy effab7cfd1 HLR_Tests.ttcn: introduce TC_mo_sss_reject
As at the moment, OsmoHLR doesn't support "structured" SS, such
requests are being rejected. This test case aims to verify that.

Change-Id: I147b919d0242b3b44e39a4587bf1b4660fa58bd2
Related: OS#3651
2018-11-28 06:02:36 +07:00
Daniel Willmann e2bd04ad6b hlr: Fix DTE by requesting the correct type
Previous commit d686a8a548 from Vadim
introduced a copy and paste error.

Change-Id: I5075b17a810762651e0c7d638cc4c35c58436cd9
2018-11-12 16:17:42 +00:00
Vadim Yanitskiy d686a8a548 hlr/HLR_EUSE.ttcn: remove redundant code from f_main_mo()
There is no need to pass session state from f_main_mo() to a
choosen EUSE handler (e.g. f_ss_echo), because a handler
itself is capable to extract the session state IE.

Change-Id: I1054baf3e7dafd05b797610b586e6202740f07b6
2018-11-04 17:36:47 +07:00
Daniel Willmann d93047434b Add Misc_Helpers.ttcn to centralize TTCN3 shutdown handling
This function can now be called from anywhere to try and safely shutdown
a testcase. It is not optimal as we can't call "all component.stop" from
outside the mtc, but without any proper and orderly shutdown handling of
all our emulation components I believe this is the best we can do.

To use it:

import from Misc_Helpers all;

in your module and then call

Misc_Helpers.f_shutdown(__BFILE__, __LINE__);

You can also pass the function a verdict and a message and it will take care
of calling setverdict, but beware of the following:

While setverdict would accept any number of arguments as log message
and convert them to a log string f_shutdown expects one charstring.
It's possible to use the log2str function to use the log arguments in
setverdict for f_shutdown, for example

setverdict(fail, "Template didn't match: ", tmpl_foo);
would become
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Template didn't match: ", tmpl_foo));

Change-Id: I84d1aa6732f6b748d2bfdeac8f6309023717f267
2018-10-24 15:10:13 +02:00
Neels Hofmeyr 873ae201bd update expected results
Change-Id: I32c29e62ca317937db771f8fb1540bb1fe9da2ab
2018-09-06 14:13:34 +02:00
Harald Welte 4ea1f8a114 HLR: Actual USSD test cases
Change-Id: I74a3419140179b1625e82d1298864e424fb81398
2018-08-08 11:06:34 +02:00
Harald Welte 4a3242ebb2 hlr: actually register simulated MSC as "MSC" identity to HLR
Change-Id: I3b6dc719318db8aef960f3249c16c20deb5793a7
2018-08-08 11:06:34 +02:00
Harald Welte f9d449edd6 HLR: Add HLR_EUSE.ttcn to implement minimal external USSD Entity
As OsmoHLR is getting support for external USSD Entities (EUSEs),
we have to implement this function in the test logic in order to
test it.

Change-Id: Ibab210b06abfd5a21e81c7f7fbe574c4f67414a0
2018-08-08 11:06:31 +02:00
Harald Welte e490438672 hlr: Link required libraries for USSD / SS messages
Change-Id: I4501a4843b412dc06051c5e037764e581de1977a
2018-08-07 23:32:32 +02:00
Stefan Sperling 23b45974ce detect VTY TELNET port connection failures (attempt #2)
Pass the CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT parameter to
the TELNET port by default. This allows tests to make progress
into an error handling path if they are started while the osmo-*
program they want to connect on VTY is not running.

Observed with osmo-ggsn tests, where if the one test runs
into a VTY connection failure the subsequent test would get
stuck forever in a map() call on the VTY TELNET port.

Teach the function f_vty_wait_for_prompt() about connection
reports by the TELNET module. We may now receive an integer which
represents the socket file descriptor for the telnet connection.
This case was not handled by the previous change made in
commit cb111b21ab. As a result,
BSC tests started failing with "VTY Timeout for prompt" because
the alt-statement in f_vty_wait_for_prompt() would not progress
past the integer sitting on the VTY port's receive queue.

Change-Id: I56925f93af6c55e93f3f417099db135744da6a40
Related: OS#3149
2018-07-27 17:20:38 +02:00
Neels Hofmeyr bf3cf5c8bc Revert "detect VTY TELNET port connection failures in TTCN3 tests"
With this patch, I see all ttcn3-bsc-tests failing with
"Verdict: fail reason: VTY Timeout for prompt"

This reverts commit cb111b21ab.

Change-Id: I215d7ab5eee75cf6d3afaac760af64356c943140
2018-07-27 13:01:26 +00:00
Stefan Sperling cb111b21ab detect VTY TELNET port connection failures in TTCN3 tests
Pass the CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT parameter to
the TELNET port by default. This allows tests to make progress
into an error handling path if they are started while the osmo-*
program they want to connect on VTY is not running.

Observed with osmo-ggsn tests, where if the one test runs
into a VTY connection failure the subsequent test would get
stuck forever in a map() call on the VTY TELNET port.

Change-Id: I9acf7793d5d68aec6d087cff254a10d8b673dab1
Related: OS#3149
2018-07-27 07:40:10 +00:00
Daniel Willmann afce86630c Stop tests after failures
Call mtc.stop after setverdict(fail), add reasons to most failures and
fail with verdict error for internal errors.

Change-Id: I9b618235939fa41160b9be6677b121963d3ec857
2018-07-24 14:19:42 +02:00
Harald Welte ed380d135d hlr: Port HLR tests to use GSUP_Emulation
Going via GSUP_Emulation (rather than using GSUP_CodecPort directly)
adds many benefits, such as:
* ability to have multiple transactions in parallel
* no silent discard/ignore of unexpected GSUP messages, like those
  for IMSIs we don't expect.

Change-Id: Id2ddd6b81c374ad6350b62fcc5442436757d66cd
2018-06-15 17:59:40 +02:00