Commit Graph

43 Commits

Author SHA1 Message Date
Harald Welte 7ec5cb7280 Introduce concept of per-HNB persistent data structure
This allows us to add a new "hnb-policy closed", which means we do not
accept any random HNB connection anymore, but only those whose identity
is pre-configured explicitly using administrative means.

Furthermore, this new data structure will allow us (in future patches)
to keep persistent data like uptime / downtime of each HNB.

Related: SYS#6773
Change-Id: Ife89a7a206836bd89334d19d3cf8c92969dd74de
2024-03-12 08:18:12 +00:00
Neels Hofmeyr eba9cbf9d1 pfcp: implement sending Network Instance IEs
Allow configuring specific Network Instance names for the Core and
Access sides, to send to the UPF, to allow the UPF to pick the proper
network interface to create GTP tunnels on.

Add VTY cfg 'hnbgw' / 'pfcp' / 'netinst (access|core) NAME' to allow
configuring Network Interface values to send in PFCP. These are "dotted"
domain name strings, as in APN.

Add these Network Interface names to the PFCP messages' detection as
well as forwarding rules, each one indicating the side that it is
detecting on or forwarding to.

This helps lift osmo-hnbgw's PFCP support out of lab situations to a
proper production scenario, where the core and access networks are in
separate subnets, with osmo-hnbgw + UPF as the gateway.

For example, in osmo-hnbgw, configure

  hnbgw
   pfcp
    netinst access my-ran
    netinst core my-core

and in osmo-upf, configure

  netinst
   add my-ran 10.9.8.7
   add my-core 1.2.3.4

In effect, all GTP tunnel endpoints towards the Access side will be
bound on 10.9.8.7, and all GTP tunnel endpoints towards the Core side
will be bound on 1.2.3.4.

Related: SYS#5895
Change-Id: Ief53dbfacf1645c32a07847d590c4884d4c8ca56
2024-01-21 02:48:38 +01:00
Neels Hofmeyr 5fd2aa5dc4 pfcp: fix missing vty_write of pfcp local-port
Change-Id: I180e67b8abdd3c0d91b30f1e7668b02f1a323809
2024-01-21 02:29:45 +01:00
Neels Hofmeyr 4ec1c77f9c add tests/pfcp_cfg.vty.with_pfcp
So far, we had no pfcp.vty test, because PFCP support is built
conditionally, and the pfcp.vty test would always fail without PFCP
support.

Add a pfcp test for the VTY, conditionally: use suffix .vty.with_pfcp to
identify tests that need PFCP support, and run those only when
configured with --enable-pfcp.

Related: SYS#5895
Change-Id: Ibb1797bb43a18f26fc693e0c8920cfd1f5fb9ede
2024-01-21 02:29:31 +01:00
Harald Welte 67f9de4148 Display RANAP state during 'show cnlink'
This adds a line to the output showing DISCONNECTED or CONNNECTED
state for each cnlink during the 'show cnlink' VTY command.

Closes: SYS#6741
Change-Id: I6ab7d08fcd0631d31a12418f950c5901a93db43a
2024-01-15 13:56:38 +01:00
Pau Espin cd09569bc8 tests/ranap_rab_ass: Test RAB-Ass.req with X.213 IPv4 address len=7
It was found in the field that some peers sends an X.213 IP address
consisting of 7 bytes (1byte IDP/AFI, 2byte ICP, 4 byte IPv4 address) insetad
of 20 bytes. This was until recently failing in osmo-hnbgw due to
missing decoding functionalitit in osmo-iuh.git. Cover it here.

Related: SYS#6623
Depends: osmo-iuh.git I507fb1605d976bd8573162e4fa81721245330184
Change-Id: I71323018d79a4f5778dc6e49488d75ae7c2c4cdc
2023-11-27 14:51:13 +00:00
Philipp Maier b77d944961 ranap_rab_ass: do not free never allocated FieldItems
When we check for an assignment failure in a RAB AssignmnetResponse, we
use decode_rab_flitms_from_resp_ies to search through the list of RAB
FailedItemsIEs for the RAB id we want to check. In case of failure, we
get a positive index back from this function. We then know that the RAB
that we checked for has failed bcause it was in the FailedItemsList.

In that case, we also must free the RAB FailedItemsIEs that
decode_rab_flitms_from_resp_ies has decoded. At the moment we also free
the RAB FailedItemsIEs also when decode_rab_flitms_from_resp_ies returns
with a negative return code, which may mean that the RAB was not found
or some other error occured. In this case we must not free since then
no valid RAB FailedItemsIEs are allocated.

Related: OS#6062
Change-Id: I755ba6599079810a048bf5b6d8947b5a9ffa622d
2023-06-23 13:11:05 +00:00
Neels Hofmeyr d482f8666c cfg: add 'hnbgw' / 'plmn MCC MNC'
According to 3GPP TS 25.413 8.26.2.2, "The RNC shall include the Global
RNC-ID IE in the RESET message." To be able to do that, osmo-hnbgw needs
to know the local PLMN.

Introduce explicit knowledge of the local PLMN by config, and use this
configured local PLMN in places where the local PLMN was so far derived
otherwise.

Subsequent patches will separately add the RNC-ID to the RANAP RESET
messages.

Since the PLMN is required to send correct RESET and RESET ACK, include
the new 'plmn' config item in all example configurations.

Related: SYS#6441
Change-Id: If404c3859acdfba274c719c7cb7d16f97d831a2a
2023-06-21 04:16:13 +02:00
Neels Hofmeyr e14d3bd6fe detect in/active CN links by RANAP RESET
Implement cnlink FSM. This is a copy of osmo-bsc/bssmap_reset.c, except
for the connection success/failure counting.

The reason to exclude the CONN_CFM_FAILURE/_SUCCESS: it is a rather
experimental feature and should probably rather be covered by PCSTATE
notifications and protocol layer timeout tuning (e.g. SCCP ia timers).

Related: SYS#6412
Change-Id: Id3eefdea889a736fd5957b80280fa45b9547b792
2023-06-21 04:16:13 +02:00
Neels Hofmeyr 72f0884ee0 ctrl test: also test msc 1
Change-Id: I957dca863b6cdc8b077f2ec2b2894cebe7613736
2023-06-16 04:25:31 +02:00
Neels Hofmeyr 685c276ce1 add CTRL transcript tests for cnpool rate ctrs
Related: SYS#6412
Change-Id: I5a9a23c10e3ac85dabbb1d367351bb7c5dfe2526
2023-06-16 04:07:24 +02:00
Neels Hofmeyr a0321315e1 startup config tests: show default 'msc 0', 'sgsn 0'
Even when the config file did not configure any, the 'show
running-config' shows the default 'msc 0' and 'sgsn 0' that were
created. Let's also show that in the vty scripts.

Change-Id: Ia4e43fa9b5d9fda1ae374d3d31965aafe85d493d
2023-06-16 04:05:45 +02:00
Pau Espin d6b0217c33 tests: Update *.vty after libosmo-sccp VTY improvements
After recent change, libosmo-sccp is always printing the "role" config.

Depends: libosmo-sccp.git Change-Id Ie81987265118e48173211f88b27a006115dc62d4
Change-Id: I316cd26ceb97f2ccfd1065d65177e7d3926625b0
2023-06-08 19:31:42 +02:00
Neels Hofmeyr 9ee468f5b2 cnpool: make NRI mappings VTY configurable
Implement only the VTY configuration part, applying NRI to select CN
links follows in I66fba27cfbe6e2b27ee3443718846ecfbbd8a974.

Use the osmo_nri_ranges API to manage each cnlink's NRI ranges by VTY
configuration.

Analogous to osmo-bsc
 MSC pooling: make NRI mappings VTY configurable
 4099f1db504c401e3d7211d9761b034d62d15f7c
 I6c251f2744d7be26fc4ad74adefc96a6a3fe08b0
plus
 vty: fix doc: default value for 'nri bitlen'
 f15d236e3eee8e7cbdc184d401f33b062d1b1aac
 I8af840a4589f47eaca6bf10e37e0859f9ae53dfa

Related: SYS#6412
Change-Id: Ifb87e01e5971962e5cfe5e127871af4a67806de1
2023-06-02 17:11:25 +02:00
Neels Hofmeyr a49b265226 cnpool: examples and config tests: use 'msc 0'/'sgsn 0' syntax
After recent introduction of multiple 'msc' and 'sgsn' nodes in the
VTY config, switch cfg files to the new syntax:
- in doc/examples
- for 'make config-tests'
  - have one test in old config syntax to test backwards compat:
    'legacy', an exact copy of 'one_cs7_with_addrs'.

Related: SYS#6412
Change-Id: If999b71a8a8237699f6ccfcaa31d1885e66c0518
2023-06-02 17:11:25 +02:00
Neels Hofmeyr 9901316371 cnpool: add multiple 'msc' and 'sgsn' cfg (use only the first)
Allow configuring multiple MSCs and SGSNs. Show this in new transcript
test cnpool.vty and in sccp.dot chart.

Still use only the first CN link; actual CN link selection from the pool
follows in I66fba27cfbe6e2b27ee3443718846ecfbbd8a974.

Config examples and VTY tests cfg files will be adjusted to the new cfg
syntax in patch If999b71a8a8237699f6ccfcaa31d1885e66c0518. Only the VTY
write() changes are visible here, to pass all transcript tests.

Related: SYS#6412
Change-Id: I5479eded786ec26062d49403a8be12967f113cdb
2023-06-02 17:11:22 +02:00
Neels Hofmeyr f3caea850b cnpool: allow separate cs7 for IuPS and IuCS
Prepare for CN pooling; allow using separate SS7 instances for IuCS and
IuPS.

New struct hnbgw_sccp_user describes a RANAP SCCP user, one per cs7.
Limit struct hnbgw_cnlink to describing a CN peer, using whichever SCCP
instance that is indicated by hnbgw_sccp_user.

Chart sccp.dot shows the changes made.

Related: SYS#6412
Change-Id: Iea1824f1c586723d989c80a909bae16bd2866e08
2023-06-01 01:41:35 +02:00
Neels Hofmeyr 28cb20e1be add startup config tests
Get a handle on how osmo-hnbgw currently auto-configures itself, by
running vty tests with a couple of config files that have various levels
of omitted config items that are to be auto-configured.

These tests serve to ensure continuity and compatibility by upcoming
cnpool patches. They will show how the configuration changes / doesn't
change in all the right ways.

Uncover one bug in osmo-hnbgw: local point-code setting is discarded by
osmo-hnbgw startup when there are no SCCP address book entries in use.
The error is fixed as side effect of an upcoming patch:
Iea1824f1c586723d989c80a909bae16bd2866e08

Related: SYS#6412
Change-Id: Ic8bb30e1dd73753c2ff255566382e241918414f7
2023-05-31 03:44:15 +02:00
Neels Hofmeyr 7e5ea9d40e add separate cfg file only for VTY tests
Instead of doc/examples/osmo-hnbgw.cfg, use a separate location
tests/osmo-hnbgw-vty-test.cfg for VTY transcript tests, and add a bunch
of SCCP address book entries that upcoming VTY tests will use.

Declaring address book entries within transcript tests is possible, but
cluttered with node 'exit' and VTY prompts -- these addresses are much
easier to read and maintain in form of a cfg file.

First user of these address book entries will be cnpool.vty in
I5479eded786ec26062d49403a8be12967f113cdb

Related: SYS#6412
Change-Id: Idcdf0e8660e8180fbe02282bc94e623ff89e848a
2023-05-26 23:23:21 +02:00
Neels Hofmeyr 07c8b72455 fix missing write-back of rnc-id
Change-Id: Ide006379b26949e34371bd316a22c130ea09da82
2023-05-17 21:21:18 +02:00
Neels Hofmeyr 54c4c66c59 vty test: show missing write-back of 'rnc-id'
Change-Id: I9eecda8678c32abbeaf39344ccdb14ed5a0828ce
2023-05-16 13:55:17 +02:00
Neels Hofmeyr 63f3abf54c add non-installed libhnbgw.la for test linkage
To ease linking C tests, introduce a libhnbgw.la that contains all of
osmo-hnbgw except the main() and friends.

(I wrote a test that I was going to add, but it turned out to be
obsolete -- now at least we may keep this preparation to add C tests
more easily.)

Change-Id: Id2a706a30fb459005c676bb29c196cf3a582fa01
2023-05-08 15:29:03 +02:00
Neels Hofmeyr d12aecf33d ranap_rab_ass_test.c: clarify talloc contexts
Change-Id: I4256e0d94a7e7fbba236aa92c44229c12cf17313
2023-05-07 00:19:17 +02:00
Neels Hofmeyr 6639eb910a drop ctrl_test_runner.py
Unused and contains no actual tests.

Change-Id: If3d6614334b692e49efcc45d1e4fb29a00c68602
2023-05-07 00:08:18 +02:00
Neels Hofmeyr c204f7e809 actually run vty-tests: osmotestconfig.py
Change-Id: Id60e5dfb22b7cea33c53388d339838add101de44
2023-05-06 05:56:02 +02:00
Neels Hofmeyr fc800ca49b actually run vty-tests: osmotestvty.py
Change-Id: Iab84af37488b5ec1000162d945f909f9ab05dad8
2023-05-05 02:23:11 +02:00
Neels Hofmeyr ece0f81e30 actually run vty-tests: VTY transcript tests
There have been VTY transcript tests around for a long time, but we are
not running them.

Change-Id: Ie9fc8f29b84e1dffea000fea11e0afe285c1df39
2023-05-05 02:23:11 +02:00
Vadim Yanitskiy 612d3255b8 tests: do not depend on undefined $(BUILT_SOURCES)
Change-Id: I7536be8aa3f0ab39f183e00cf4382636038db4b7
2023-03-30 02:55:06 +07:00
Vadim Yanitskiy 3ebdd301c9 tests: make 'vty-test' target depend on osmo-hnbgw binary
Change-Id: Iaaa1dd622fde460a250c11eb97cf0b25469e55c4
2023-03-30 02:53:41 +07:00
Vadim Yanitskiy a973a93527 tests: use -no-install libtool flag to avoid ./lt-* scripts
This option should be used for any executables which are used only
for testing, or for generating other files and are consequently never
installed.  By specifying this option, we are telling Libtool that
the executable it links will only ever be executed from where it is
built in the build tree.  Libtool is usually able to considerably
speed up the link process for such executables.

Change-Id: Id5f88c331cf1dfd3f38120b4ef59ced9a563d4f0
2023-03-30 02:51:40 +07:00
Vadim Yanitskiy a65c57a159 tests: use check_PROGRAMS for tests, not noinst_PROGRAMS
Change-Id: I616ed6920af98502424e4eab6cffde5d39d9698e
2023-03-30 02:50:26 +07:00
Neels Hofmeyr 1e277db2cc fix deprecation: use ranap_cn_rx_co_decode2()
Change-Id: I867cbf174beab1eefddc682c1420737e49f9e50d
2023-02-23 01:17:11 +01:00
Pau Espin e62af4d46a Introduce support for libosmo-mgcp-client MGW pooling
Large RAN installations may benefit from distributing the RTP voice
stream load over multiple media gateways.

libosmo-mgcp-client supports MGW pooling since version 1.8.0 (more than
one year ago). OsmoBSC has already been making use of it since then (see
osmo-bsc.git 8d22e6870637ed6d392a8a77aeaebc51b23a8a50); lets use this
feature in osmo-hngw too.

This commit is also part of a series of patches cleaning up
libosmo-mgcp-client and slowly getting rid of the old non-mgw-pooled VTY
configuration, in order to keep only 1 way to configure
libosmo-mgcp-client through VTY.

Related: SYS#5091
Related: SYS#5987
Change-Id: I371dc773b58788ee21037dc25d77f556c89c6b61
2022-10-20 17:03:06 +02:00
Vadim Yanitskiy b7ff03e5be tests/ranap_rab_ass: fix potential NULL pointer dereferences
Change-Id: I16fea7b2a8cb1d693e01c91d7633550e2e599ceb
Related: CID#275345
2022-07-30 05:48:41 +07:00
Neels Hofmeyr 223aeda282 ranap_rab_ass_req_encode(): return msgb
ranap_rab_ass_req_encode() forms a msgb, then copies the data to a
buffer provided by the caller. Instead, just return the msgb. This
removes one unnecessary memcpy() and simplifies some code.

In ranap_rab_ass_test.c, actually ensure the correct size of the
returned data. See also the fix of expected test data in patch
Ifb98a52e56db1227a834c0d7b7a260314d9f547e

Related: SYS#5895
Change-Id: I85e715326e1d8f4f301f82f78da109f1a7a92f30
2022-07-27 15:45:18 +02:00
Neels Hofmeyr a82c8d2425 fix test_ranap_rab_ass_resp_decode_encode
There is an extra zero octet at the end of the test data, which does not
get encoded back. The test currently does not detect this, but will in
upcoming patch I85e715326e1d8f4f301f82f78da109f1a7a92f30.

Related: SYS#5895
Change-Id: Ifb98a52e56db1227a834c0d7b7a260314d9f547e
2022-07-27 15:45:16 +02:00
Philipp Maier be9ed71631 ranap_rab_ass: check for more than one RAB assignment req
The spec permits RAB AssignmentRequests with multiple RABs at a time.
Even though one voice call is assigned only one RAB in practice. Since
the current FSM implementation only supports a 1:1 scenario, lets check
if the MSC really assigns only one RAB and block RAB Assignments that do
not fit in this scheme.

Change-Id: I0f1d868fd0b4dc413533d6fcc5482862825181be
Related: OS#5152
2022-02-28 10:22:16 +01:00
Philipp Maier e7c66defc2 ranap_rab_ass_test: cosmetic: correct test function names
The test function naming follows an older scheme, lets use the current
scheme.

Change-Id: Ib9db9d86e01551c8d9d8f8c4933025ca20ce5624
Related: OS#5152
2022-02-23 15:50:43 +01:00
Philipp Maier f5742a3bed ranap_rab_ass: add function to check if RAB is in ReleaseList
A RANAP RAB-AssignmentRelease may contain a ReleaseList. In order to
detect that a RAB is about to be released we need to be able to check if
the RAB we are dealing with is contained in such a ReleaseList.

Change-Id: I5b67cc2d35d11de7a09e66c181a1fdd5a58c75bb
Related: OS#5152
2022-02-23 15:50:43 +01:00
Philipp Maier efe4850e75 ranap_rab_ass: add function to check if RAB is in FailureList
A RANAP RAB-AssignmentResponse may contain a FailedList. In order to
detect that a RAB Assignment failed at the HNB we need to be able to
check if the RAB we are dealing with is contained an such a FailedList.

Change-Id: I4319f7caa45ea758ccd792cc8570521df075cf45
Related: OS#5152
2022-02-23 15:38:17 +01:00
Philipp Maier 0c465b0f68 ranap_rab_ass: ensure specific rab_id
The parser functions currently ignore the rab_id. An exception is
ranap_rab_ass_req_ies_extract_inet_addr, which extracts the rab_id
of the first RAB. To make the handling of the RAB assignment parsing
more robust lets add a rab_id parameter to the other functions. This
parameter can then be used to ensure thet the correct RAB is handled.

Change-Id: I2259ffce9f4b508c555d60618c5983ac6294e0ae
Related: OS#5152
2022-02-11 11:00:35 +01:00
Philipp Maier 7daa502a2d ranap_rab_ass: add decoder and rewrite functions for RAB-AssignmentRequest/Response
The RANAP RAB AssignmentRequest and AssignmentResponse contains the
IP-Address and the IP-Port for the RTP voice stream. In the comming MGCP
implementation we will have to extract and replace this information.
Lets add functions that do that in a convinient way.

Change-Id: I58b542bf23ff5e1db2ccf6833fec91d9ba332837
Related: OS#5152
2022-02-02 10:51:38 +01:00
Pau Espin dce3870429 Initial structure + import code from osmo-iuh.git
Imported from osmo-iuh.git 9b4de3f401c890fc2c0dfae9e827daaaadd80db0.

Change-Id: I569d221aeb83d352c1621c44c013a0e4c82fc8a8
2022-01-04 19:48:52 +01:00