Attention is currently required from: daniel, fixeria, laforge, osmith.
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/40003?usp=email )
Change subject: ipa: Try picking unused asp_id in AS to use as SLS
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
This should fix sporadic failure in STP_Tests_IPA.TC_unknown_client_dynamic_tmt_loadshare seen in https://jenkins.osmocom.org/jenkins/view/TTCN3/job/ttcn3-stp-test-asan/306/
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/40003?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I723eac25e59002630dca87a738c8eb7c62edec75
Gerrit-Change-Number: 40003
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-CC: Jenkins Builder
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 10 Apr 2025 16:48:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/40003?usp=email )
Change subject: ipa: Try picking unused asp_id in AS to use as SLS
......................................................................
ipa: Try picking unused asp_id in AS to use as SLS
Initially (b93e1d01205cdd7bd7a65e15945f664f31fb4bcb), incoming traffic
from IPA sockets was tagged with SLS using the LSB of the socket file
descriptor. that did however not achieve sufficient entropy in real
world use cases.
Later on (2c9ba16c2c0210a189c72064eafad5ef336254cd), SLS tagging was
changed to pseudo-random generation.
Still it has been found too that it may create bad entropy under certain
condtions, with eg. havig only 2 incoming ASPs and both ending up with
the same asp_id/SLS, which won't allow for proper load sharing towards
other peers.
This commit changes the previous method by delaying SLS assignment
decision of the socket until the ASP becomes assigned to an AS
(basically during IPA handshake, when we receive IPA IDENTITY RESPONSE
with the Unit-Name, or when we receive the IPA IDENTITY ACK for it).
It is fine delaying SLS assignment to that point, since it's impossible
to receive any userplane data before that handhsake ocurrs.
Once the ASP is assigned to the AS (IPA ASPs can only be part of one
AS), we lookup the other ASPs in the AS to try to allocate an unused
4-bit asp_id which will end up being used as SLS.
Related: SYS#6543
Related: SYS#6802
Change-Id: I723eac25e59002630dca87a738c8eb7c62edec75
---
M src/osmo_ss7_asp.c
M src/osmo_ss7_xua_srv.c
M src/xua_asp_fsm.c
3 files changed, 41 insertions(+), 12 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/03/40003/1
diff --git a/src/osmo_ss7_asp.c b/src/osmo_ss7_asp.c
index f785264..7e444b4 100644
--- a/src/osmo_ss7_asp.c
+++ b/src/osmo_ss7_asp.c
@@ -979,12 +979,6 @@
if (asp->cfg.trans_proto == IPPROTO_SCTP) {
rc = ss7_asp_apply_peer_primary_address(asp);
rc = ss7_asp_apply_primary_address(asp);
- } else {
- if (asp->cfg.proto == OSMO_SS7_ASP_PROT_IPA) {
- /* we use the lower 4 bits of the asp_id field as SLS;
- * let's initialize it here from a pseudo-random value */
- asp->asp_id = rand() & 0xf;
- }
}
if (asp->lm && asp->lm->prim_cb) {
diff --git a/src/osmo_ss7_xua_srv.c b/src/osmo_ss7_xua_srv.c
index 35e360f..52a3508 100644
--- a/src/osmo_ss7_xua_srv.c
+++ b/src/osmo_ss7_xua_srv.c
@@ -180,12 +180,6 @@
if (asp->cfg.trans_proto == IPPROTO_SCTP) {
rc = ss7_asp_apply_peer_primary_address(asp);
rc = ss7_asp_apply_primary_address(asp);
- } else {
- if (asp->cfg.proto == OSMO_SS7_ASP_PROT_IPA) {
- /* we use the lower 4 bits of the asp_id field as SLS;
- * let's initialize it here from a pseudo-random value */
- asp->asp_id = rand() & 0xf;
- }
}
/* send M-SCTP_ESTABLISH.ind to Layer Manager */
diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index ec149d1..0c5159f 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -1104,6 +1104,41 @@
}
}
+static bool _ipa_asp_fsm_handshake_done(struct osmo_ss7_asp *asp)
+{
+ if (!asp->fi)
+ return false;
+ return asp->fi->state == XUA_ASP_S_INACTIVE || asp->fi->state == XUA_ASP_S_ACTIVE;
+}
+
+/* Assign a 4 bit asp_id (as unqiue as possible) which will be used as SLS for incoming IPA PDUs.*/
+static void _ss7_asp_pick_unused_asp_id_as_sls(struct osmo_ss7_asp *asp, const struct osmo_ss7_as *as)
+{
+ for (unsigned int asp_id = 0; asp_id <= 0x0f; asp_id++) {
+ bool used = false;
+ for (unsigned i = 0; i < ARRAY_SIZE(as->cfg.asps); i++) {
+ if (!as->cfg.asps[i])
+ continue;
+ if (as->cfg.asps[i] == asp)
+ continue;
+ if (!_ipa_asp_fsm_handshake_done(as->cfg.asps[i]))
+ continue;
+ if (as->cfg.asps[i]->asp_id == asp_id) {
+ used = true;
+ break;
+ }
+ }
+ if (used)
+ continue;
+ /* Found an unused asp_id, use it: */
+ asp->asp_id = asp_id;
+ LOGPASP(asp, DLSS7, LOGL_DEBUG, "Assigned unsued asp_id = %u to be used as SLS\n", asp_id);
+ return;
+ }
+ LOGPASP(asp, DLSS7, LOGL_INFO, "All asp_ids in IPA AS picked, unique SLS not possible, picking random one\n");
+ asp->asp_id = rand() & 0x0f;
+}
+
static void ipa_asp_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *data)
{
struct ipa_asp_fsm_priv *iafp = fi->priv;
@@ -1130,6 +1165,12 @@
case XUA_ASP_E_AS_ASSIGNED:
as = data;
osmo_talloc_replace_string(iafp->ipa_unit, &iafp->ipa_unit->unit_name, as->cfg.name);
+ /* In IPA, asp_id is not really used on the wire, and we
+ * actually use it internally the lower 4 bits of the field to
+ * fill in a potentailly unique SLS to apply to PDUs received from the IPA socket.
+ * Now that AS is known, try picking an unused asp_id inside the AS.
+ * we use the lower 4 bits of the asp_id field as SLS; */
+ _ss7_asp_pick_unused_asp_id_as_sls(iafp->asp, as);
/* Now that the AS is known, start the client side: */
if (iafp->role == OSMO_SS7_ASP_ROLE_ASP && fi->state == IPA_ASP_S_DOWN) {
LOGPFSML(fi, LOGL_NOTICE, "Bringing up ASP now once it has been assigned to an AS\n");
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/40003?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I723eac25e59002630dca87a738c8eb7c62edec75
Gerrit-Change-Number: 40003
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40002?usp=email )
Change subject: stp: Fix typo in comment
......................................................................
stp: Fix typo in comment
Change-Id: I9f4a1e5ec0b0d2614b3cec0768e8847fce3e3cdf
---
M stp/STP_Tests_IPA.ttcn
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/02/40002/1
diff --git a/stp/STP_Tests_IPA.ttcn b/stp/STP_Tests_IPA.ttcn
index 66e7262..ae7e1da 100644
--- a/stp/STP_Tests_IPA.ttcn
+++ b/stp/STP_Tests_IPA.ttcn
@@ -309,8 +309,8 @@
}
}
- /* All traffic should not still be sent to the same receiver, since
- * OPC+SLS cannot change in IPA ASPs.
+ /* All traffic should still be sent to the same receiver, since
+ * OPC+DPC+SLS cannot change in IPA ASPs.
* However, depending on how the SLS seed tables were allocated, it can
* be that STP was routing through Alternative Route and now that the
* 2nd receiver is up it is now routing to it (Normal Route). Account
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40002?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I9f4a1e5ec0b0d2614b3cec0768e8847fce3e3cdf
Gerrit-Change-Number: 40002
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/40001?usp=email )
Change subject: ipa: Use pseudo-random number for SLS in TCP-client too
......................................................................
ipa: Use pseudo-random number for SLS in TCP-client too
Previous commit (see below) replaced the SLS generation from using
the LSB of the file descriptor to a pseudo-random SLS since the former
didn't really achieve enough entropy in real world use cases.
However, that commit only applied it for TCP-server conns, but forgot to
update TCP-client ones.
Present commit fixes that missing part. asp->asp_id is already being set
using a pseudo-randome number in xua_cli_connect_cb().
Fixes: 2c9ba16c2c0210a189c72064eafad5ef336254cd
Related: SYS#6543
Related: SYS#6802
Change-Id: I837505868b608ac5ed658a7e98bb3eeebe3e852c
---
M src/osmo_ss7_asp.c
1 file changed, 3 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/01/40001/1
diff --git a/src/osmo_ss7_asp.c b/src/osmo_ss7_asp.c
index 3f6500c..f785264 100644
--- a/src/osmo_ss7_asp.c
+++ b/src/osmo_ss7_asp.c
@@ -1027,7 +1027,6 @@
/* read call-back for IPA/SCCPlite socket */
static int ipa_cli_read_cb(struct osmo_stream_cli *conn, int res, struct msgb *msg)
{
- int fd = osmo_stream_cli_get_fd(conn);
struct osmo_ss7_asp *asp = osmo_stream_cli_get_data(conn);
if (res <= 0) {
@@ -1042,9 +1041,9 @@
msg->dst = asp;
rate_ctr_inc2(asp->ctrg, SS7_ASP_CTR_PKT_RX_TOTAL);
- /* we can use the 'fd' return value of osmo_stream_srv_get_fd() here unverified as all we do
- * is 'roll the dice' to obtain a 4-bit SLS value. */
- return ipa_rx_msg(asp, msg, fd & 0xf);
+ /* we simply use the lower 4 bits of the asp_id, which is initialized to a pseudo-random value upon
+ * connect */
+ return ipa_rx_msg(asp, msg, asp->asp_id & 0xf);
}
/* read call-back for M3UA-over-TCP socket */
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/40001?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I837505868b608ac5ed658a7e98bb3eeebe3e852c
Gerrit-Change-Number: 40001
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
pespin has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/40000?usp=email )
Change subject: AS loadsharing: Pick 1st ASP upon 1st roundrobin assignment
......................................................................
AS loadsharing: Pick 1st ASP upon 1st roundrobin assignment
Before this patch, the AS started filling it's loadsharing tables with
the 2nd ASP in the list, which is actually fine too but a bit
unexpected when debugging.
Change-Id: I9ac08d371dde2cfd433be22f1fb6cd01d6ef12be
---
M src/osmo_ss7_as.c
1 file changed, 5 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/00/40000/2
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/40000?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I9ac08d371dde2cfd433be22f1fb6cd01d6ef12be
Gerrit-Change-Number: 40000
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-CC: Jenkins Builder
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/40000?usp=email )
Change subject: AS loadsharing: Pick 1st ASP upon 1st roundrobin assignment
......................................................................
AS loadsharing: Pick 1st ASP upon 1st roundrobin assignment
Before this patch, the AS started filling it's loadsharing tables with
the 2nd ASP in the list, which is actually fine too but a bit
unexpected when debugging.
Change-Id: I9ac08d371dde2cfd433be22f1fb6cd01d6ef12be
---
M src/osmo_ss7_as.c
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/00/40000/1
diff --git a/src/osmo_ss7_as.c b/src/osmo_ss7_as.c
index e84a36d..c568d8e 100644
--- a/src/osmo_ss7_as.c
+++ b/src/osmo_ss7_as.c
@@ -127,6 +127,7 @@
as->cfg.mode = OSMO_SS7_AS_TMOD_OVERRIDE;
as->cfg.recovery_timeout_msec = 2000;
as->cfg.routing_key.l_rk_id = ss7_find_free_l_rk_id(inst);
+ as->cfg.last_asp_idx_assigned = 0xff; /* Pick 1st ASP upon 1st roundrobin assignment. */
as->fi = xua_as_fsm_start(as, LOGL_DEBUG);
llist_add_tail(&as->list, &inst->as_list);
@@ -356,7 +357,7 @@
void ss7_as_loadshare_binding_table_reset(struct osmo_ss7_as *as)
{
memset(&as->aesls_table[0], 0, sizeof(as->aesls_table));
- as->cfg.last_asp_idx_assigned = 0;
+ as->cfg.last_asp_idx_assigned = 0xff;
}
static as_ext_sls_t osmo_ss7_instance_calc_itu_as_ext_sls(const struct osmo_ss7_as *as, uint32_t opc, uint8_t sls)
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/40000?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I9ac08d371dde2cfd433be22f1fb6cd01d6ef12be
Gerrit-Change-Number: 40000
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/39978?usp=email )
Change subject: Set 'hnbap-allow-tmsi 1' by default
......................................................................
Set 'hnbap-allow-tmsi 1' by default
Due to historical reasons [0], we didn't allow UE Registration with
(P)TMSI by default, only with IMSI. The historical reasons were fixed a
long time ago, and hence why virtually every osmo-hnbgw you can find
nowadays (see doc/examples/ dir) contained an explicit "hnbap-allow-tmsi
1" to override the default behavior.
However, the fact that this was not the default behavior causes some
problems on production network which didn't have this config set
explicitly. Hence, enable it by default.
[0] Original osmo-hnbgw code in osmo-iuh.git
12181a937ff5658af49e12c57cb08ecba859e1f1 where this feature was added
explains with more detail the problem. If UE registered with TMSI, then
the HNBGW at the time didn't have information about its IMSI and hence
could not page the UE from IMSI. Since ~5.5 years ago (Sep 2019 in
osmo-sgsn.git 10b3d70fea9628eecb58f07e1bce31f63823edfb), osmo-sgsn
already sends a Common Id to the HNBGW containing the UE IMSI when it
registers, so the HNBGW has no related problem anymore.
The VTY command is left available in the event somebody wants to operate
osmo-hnbgw with a broken MSC/SGSN (like older mentioned osmo-sgsn).
We also removed tons of ue-context related logic from osmo-hnbgw in
osmo-hnbgw.git 15e552f2321979ecedb438792d507c55669e4b14, and we have
plenty of ttcn3 tests validating paging scenarios, so it doesn't seem we
have problems anymore with current code base.
Related: SYS#7430
Change-Id: I3c4c0decf34959fc2d5683b02224f27d204aa5e9
---
M doc/examples/osmo-hnbgw/osmo-hnbgw-cs7.cfg
M doc/examples/osmo-hnbgw/osmo-hnbgw-pfcp.cfg
M doc/examples/osmo-hnbgw/osmo-hnbgw.cfg
M src/osmo-hnbgw/hnbgw.c
M src/osmo-hnbgw/hnbgw_vty.c
M tests/osmo-hnbgw-vty-test.cfg
6 files changed, 4 insertions(+), 7 deletions(-)
Approvals:
pespin: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/doc/examples/osmo-hnbgw/osmo-hnbgw-cs7.cfg b/doc/examples/osmo-hnbgw/osmo-hnbgw-cs7.cfg
index 671d790..ee9c89e 100644
--- a/doc/examples/osmo-hnbgw/osmo-hnbgw-cs7.cfg
+++ b/doc/examples/osmo-hnbgw/osmo-hnbgw-cs7.cfg
@@ -13,7 +13,6 @@
plmn 001 01
iuh
local-ip 0.0.0.0
- hnbap-allow-tmsi 1
msc 0
remote-addr my-msc
sgsn 0
diff --git a/doc/examples/osmo-hnbgw/osmo-hnbgw-pfcp.cfg b/doc/examples/osmo-hnbgw/osmo-hnbgw-pfcp.cfg
index 7599427..13835ad 100644
--- a/doc/examples/osmo-hnbgw/osmo-hnbgw-pfcp.cfg
+++ b/doc/examples/osmo-hnbgw/osmo-hnbgw-pfcp.cfg
@@ -11,7 +11,6 @@
plmn 001 01
iuh
local-ip 0.0.0.0
- hnbap-allow-tmsi 1
mgw 0
remote-ip 127.0.0.1
local-port 2729
diff --git a/doc/examples/osmo-hnbgw/osmo-hnbgw.cfg b/doc/examples/osmo-hnbgw/osmo-hnbgw.cfg
index 996a3ae..dd82788 100644
--- a/doc/examples/osmo-hnbgw/osmo-hnbgw.cfg
+++ b/doc/examples/osmo-hnbgw/osmo-hnbgw.cfg
@@ -11,7 +11,6 @@
plmn 001 01
iuh
local-ip 0.0.0.0
- hnbap-allow-tmsi 1
mgw 0
remote-ip 127.0.0.1
local-port 2729
diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c
index 0a2f670..c5ee2c1 100644
--- a/src/osmo-hnbgw/hnbgw.c
+++ b/src/osmo-hnbgw/hnbgw.c
@@ -978,6 +978,7 @@
/* strdup so we can easily talloc_free in the VTY code */
g_hnbgw->config.iuh_local_ip = talloc_strdup(g_hnbgw, HNBGW_LOCAL_IP_DEFAULT);
g_hnbgw->config.iuh_local_port = IUH_DEFAULT_SCTP_PORT;
+ g_hnbgw->config.hnbap_allow_tmsi = true;
g_hnbgw->config.log_prefix_hnb_id = true;
g_hnbgw->config.accept_all_hnb = true;
diff --git a/src/osmo-hnbgw/hnbgw_vty.c b/src/osmo-hnbgw/hnbgw_vty.c
index 68d4b1f..d99a998 100644
--- a/src/osmo-hnbgw/hnbgw_vty.c
+++ b/src/osmo-hnbgw/hnbgw_vty.c
@@ -334,7 +334,7 @@
"hnbap-allow-tmsi (0|1)",
"Allow HNBAP UE Register messages with TMSI or PTMSI identity\n"
"Only accept IMSI identity, reject TMSI or PTMSI\n"
- "Accept IMSI, TMSI or PTMSI as UE identity\n")
+ "Accept IMSI, TMSI or PTMSI as UE identity (default)\n")
{
g_hnbgw->config.hnbap_allow_tmsi = (*argv[0] == '1');
return CMD_SUCCESS;
@@ -1039,8 +1039,8 @@
if (port && port != IUH_DEFAULT_SCTP_PORT)
vty_out(vty, " local-port %u%s", port, VTY_NEWLINE);
- if (g_hnbgw->config.hnbap_allow_tmsi)
- vty_out(vty, " hnbap-allow-tmsi 1%s", VTY_NEWLINE);
+ if (!g_hnbgw->config.hnbap_allow_tmsi)
+ vty_out(vty, " hnbap-allow-tmsi 0%s", VTY_NEWLINE);
return CMD_SUCCESS;
}
diff --git a/tests/osmo-hnbgw-vty-test.cfg b/tests/osmo-hnbgw-vty-test.cfg
index 6f9c0b6..11327a3 100644
--- a/tests/osmo-hnbgw-vty-test.cfg
+++ b/tests/osmo-hnbgw-vty-test.cfg
@@ -32,7 +32,6 @@
hnbgw
iuh
local-ip 0.0.0.0
- hnbap-allow-tmsi 1
mgw 0
remote-ip 127.0.0.1
local-port 2729
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/39978?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I3c4c0decf34959fc2d5683b02224f27d204aa5e9
Gerrit-Change-Number: 39978
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39997?usp=email )
Change subject: hnbgw: Test paging with PAge Area ID IE
......................................................................
hnbgw: Test paging with PAge Area ID IE
Change-Id: I313aadae08f187b413e894a93faa29ce771ef7fe
---
M hnbgw/HNBGW_Tests.ttcn
M hnbgw/expected-results.xml
M library/ranap/RANAP_Templates.ttcn
3 files changed, 170 insertions(+), 2 deletions(-)
Approvals:
fixeria: Looks good to me, approved
laforge: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/hnbgw/HNBGW_Tests.ttcn b/hnbgw/HNBGW_Tests.ttcn
index a261264..862bff9 100644
--- a/hnbgw/HNBGW_Tests.ttcn
+++ b/hnbgw/HNBGW_Tests.ttcn
@@ -2185,6 +2185,108 @@
f_shutdown_helper();
}
+/* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by IMSI, which would be
+ * round-robined to another MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */
+friend function f_tc_mscpool_paging_imsi_lai_registered(charstring id) runs on ConnHdlr {
+ var hexstring imsi := '001010000000123'H;
+ var RANAP_IEs.CN_DomainIndicator domain_ind;
+ var template (value) RANAP_IEs.LAI lai := ts_RANAP_LAI(hex2oct(g_pars.hnb.lai.mcc_mnc),
+ int2oct(g_pars.hnb.lai.lac, 2));
+ var template (value) RANAP_IEs.PagingAreaID pag_area_id := ts_RANAP_PagingAreaID_LAI(lai);
+ if (g_pars.ps_domain) {
+ domain_ind := ps_domain;
+ } else {
+ domain_ind := cs_domain;
+ }
+ var template (value) RANAP_PDU paging := ts_RANAP_Paging_pag_area_id(domain_ind, imsi_hex2oct(imsi), pag_area_id);
+ BSSAP.send(ts_RANAP_UNITDATA_req(g_pars.sccp_addr_hnbgw, g_pars.sccp_addr_msc, paging));
+ /* TODO: Expect RUA ConnectionlessTransfer Paging (on subset of HNB).
+ * We could verify the Paging sent from osmo-hnbgw to RUA with some effort,
+ * but, this test does not care whether the Paging was forwarded to RUA or not, only that osmo-hnbgw *received*
+ * the Paging. In the CN pool decisions, osmo-hnbgw should match up Paging Response to an earlier Paging.
+ */
+
+ f_sleep(1.0);
+
+ /* Despite the round robin pointing at the second MSC ('roundrobin next msc 1'), the earlier Paging for the same IMSI
+ * causes this Paging Response to go to the first MSC ('msc 0'). */
+ f_perform_compl_l3(f_gen_one_compl_l3(PAGRESP, ts_MI_IMSI_LV(imsi)));
+ f_sleep(1.0);
+}
+
+/* Test CN sending a RANAP Paging Command with Paging Area ID IE (LAI) present requesting a registered HNB: */
+testcase TC_mscpool_paging_imsi_lai_registered() runs on test_CT {
+ f_init(nr_msc := 3);
+ f_sleep(1.0);
+
+ var boolean ps_domain := false;
+
+ /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the
+ * second MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */
+ f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 0);
+
+ f_ctrs_cn_init(ps_domain := ps_domain);
+
+ var ConnHdlr vc_conn1;
+ var template (value) TestHdlrParams pars1 := f_TestHdlrParams(0, ps_domain := ps_domain, cn_nr := 0);
+ vc_conn1 := f_start_handler_with_pars(refers(f_tc_mscpool_paging_imsi_lai_registered), pars1);
+ vc_conn1.done;
+ f_ctrs_cn_expect(0, "cnpool:subscr:paged");
+ f_shutdown_helper();
+}
+
+/* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by IMSI, which would be
+ * round-robined to another MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */
+friend function f_tc_mscpool_paging_imsi_rai_registered(charstring id) runs on ConnHdlr {
+ var hexstring imsi := '001010000000123'H;
+ var RANAP_IEs.CN_DomainIndicator domain_ind;
+ var template (value) RANAP_IEs.LAI lai := ts_RANAP_LAI(hex2oct(g_pars.hnb.lai.mcc_mnc),
+ int2oct(g_pars.hnb.lai.lac, 2));
+ var template (value) RANAP_IEs.RAI rai := ts_RANAP_RAI(lai,
+ int2oct(g_pars.hnb.rac, 1));
+ var template (value) RANAP_IEs.PagingAreaID pag_area_id := ts_RANAP_PagingAreaID_RAI(rai);
+ if (g_pars.ps_domain) {
+ domain_ind := ps_domain;
+ } else {
+ domain_ind := cs_domain;
+ }
+ var template (value) RANAP_PDU paging := ts_RANAP_Paging_pag_area_id(domain_ind, imsi_hex2oct(imsi), pag_area_id);
+ BSSAP.send(ts_RANAP_UNITDATA_req(g_pars.sccp_addr_hnbgw, g_pars.sccp_addr_msc, paging));
+ /* TODO: Expect RUA ConnectionlessTransfer Paging (on subset of HNB).
+ * We could verify the Paging sent from osmo-hnbgw to RUA with some effort,
+ * but, this test does not care whether the Paging was forwarded to RUA or not, only that osmo-hnbgw *received*
+ * the Paging. In the CN pool decisions, osmo-hnbgw should match up Paging Response to an earlier Paging.
+ */
+
+ f_sleep(1.0);
+
+ /* Despite the round robin pointing at the second MSC ('roundrobin next msc 1'), the earlier Paging for the same IMSI
+ * causes this Paging Response to go to the first MSC ('msc 0'). */
+ f_perform_compl_l3(f_gen_one_compl_l3(PAGRESP, ts_MI_IMSI_LV(imsi)));
+ f_sleep(1.0);
+}
+
+/* Test CN sending a RANAP Paging Command with Paging Area ID IE (LAI) present requesting a registered HNB: */
+testcase TC_mscpool_paging_imsi_rai_registered() runs on test_CT {
+ f_init(nr_msc := 3);
+ f_sleep(1.0);
+
+ var boolean ps_domain := true;
+
+ /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the
+ * second MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */
+ f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 0);
+
+ f_ctrs_cn_init(ps_domain := ps_domain);
+
+ var ConnHdlr vc_conn1;
+ var template (value) TestHdlrParams pars1 := f_TestHdlrParams(0, ps_domain := ps_domain, cn_nr := 0);
+ vc_conn1 := f_start_handler_with_pars(refers(f_tc_mscpool_paging_imsi_rai_registered), pars1);
+ vc_conn1.done;
+ f_ctrs_cn_expect(0, "cnpool:subscr:paged");
+ f_shutdown_helper();
+}
+
/* For round-robin, skip a CN link that has 'no allow-attach' set. */
testcase TC_mscpool_no_allow_attach_round_robin() runs on test_CT {
@@ -2501,6 +2603,8 @@
execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() );
execute( TC_mscpool_paging_imsi() );
execute( TC_mscpool_paging_tmsi() );
+ execute( TC_mscpool_paging_imsi_lai_registered() );
+ execute( TC_mscpool_paging_imsi_rai_registered() );
execute( TC_mscpool_no_allow_attach_round_robin() );
execute( TC_mscpool_no_allow_attach_valid_nri() );
execute( TC_mscpool_sccp_n_pcstate_detaches_cnlink() );
diff --git a/hnbgw/expected-results.xml b/hnbgw/expected-results.xml
index 655db84..3fca542 100644
--- a/hnbgw/expected-results.xml
+++ b/hnbgw/expected-results.xml
@@ -43,6 +43,8 @@
<testcase classname='HNBGW_Tests' name='TC_mscpool_LU_by_tmsi_from_other_PLMN' time='MASKED'/>
<testcase classname='HNBGW_Tests' name='TC_mscpool_paging_imsi' time='MASKED'/>
<testcase classname='HNBGW_Tests' name='TC_mscpool_paging_tmsi' time='MASKED'/>
+ <testcase classname='HNBGW_Tests' name='TC_mscpool_paging_imsi_lai_registered' time='MASKED'/>
+ <testcase classname='HNBGW_Tests' name='TC_mscpool_paging_imsi_rai_registered' time='MASKED'/>
<testcase classname='HNBGW_Tests' name='TC_mscpool_no_allow_attach_round_robin' time='MASKED'/>
<testcase classname='HNBGW_Tests' name='TC_mscpool_no_allow_attach_valid_nri' time='MASKED'/>
<testcase classname='HNBGW_Tests' name='TC_mscpool_sccp_n_pcstate_detaches_cnlink' time='MASKED'/>
diff --git a/library/ranap/RANAP_Templates.ttcn b/library/ranap/RANAP_Templates.ttcn
index b09d23e..c328171 100644
--- a/library/ranap/RANAP_Templates.ttcn
+++ b/library/ranap/RANAP_Templates.ttcn
@@ -760,7 +760,8 @@
*****************************************************************************************************/
template (value) RANAP_PDU
-ts_RANAP_Paging(template (value) CN_DomainIndicator dom, template (value) IMSI imsi,
+ts_RANAP_Paging(template (value) CN_DomainIndicator dom,
+ template (value) IMSI imsi,
template (omit) Paging.protocolExtensions exts := omit) := {
initiatingMessage := {
procedureCode := id_Paging,
@@ -790,7 +791,8 @@
}
}
template RANAP_PDU
-tr_RANAP_Paging(template CN_DomainIndicator dom, template IMSI imsi,
+tr_RANAP_Paging(template (present) CN_DomainIndicator dom,
+ template (present) IMSI imsi,
template Paging.protocolExtensions exts := *) := {
initiatingMessage := {
procedureCode := id_Paging,
@@ -820,6 +822,7 @@
}
}
+
template (value) TemporaryUE_ID ts_RANAP_TemporaryUE_ID_TMSI(octetstring tmsi) := {
tMSI := tmsi
}
@@ -862,6 +865,65 @@
}
}
+template (value) LAI ts_RANAP_LAI(template (value) OCT3 pLMNidentity,
+ template (value) OCT2 lac) := {
+ pLMNidentity := pLMNidentity,
+ lAC := lac,
+ iE_Extensions := omit
+};
+
+template (value) RAI ts_RANAP_RAI(template (value) LAI lai,
+ template (value) OCT1 rac) := {
+ lAI := lai,
+ rAC := rac,
+ iE_Extensions := omit
+};
+
+template (value) PagingAreaID ts_RANAP_PagingAreaID_LAI(template (value) LAI lai) := {
+ lAI := lai
+};
+
+template (value) PagingAreaID ts_RANAP_PagingAreaID_RAI(template (value) RAI rai) := {
+ rAI := rai
+};
+
+template (value) RANAP_PDU
+ts_RANAP_Paging_pag_area_id(template (value) CN_DomainIndicator dom, template (value) IMSI imsi,
+ template (value) PagingAreaID pag_area_id,
+ template (omit) Paging.protocolExtensions exts := omit) := {
+ initiatingMessage := {
+ procedureCode := id_Paging,
+ criticality := ignore,
+ value_ := {
+ paging := {
+ protocolIEs := {
+ {
+ id := id_CN_DomainIndicator,
+ criticality := ignore,
+ value_ := {
+ cN_DomainIndicator := dom
+ }
+ }, {
+ id := id_PermanentNAS_UE_ID,
+ criticality := ignore,
+ value_ := {
+ permanentNAS_UE_ID := {
+ iMSI := imsi
+ }
+ }
+ }, {
+ id := id_PagingAreaID,
+ criticality := ignore,
+ value_ := {
+ pagingAreaID := pag_area_id
+ }
+ }
+ },
+ protocolExtensions := exts
+ }
+ }
+ }
+}
/*****************************************************************************************************
* Common ID
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39997?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I313aadae08f187b413e894a93faa29ce771ef7fe
Gerrit-Change-Number: 39997
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>