pespin has uploaded this change for review.

View Change

WIP: IPA: Introduce new OSMO extension TCAP_ROUTING

As currently being developed in libosmo-sigtran.git branch "daniel/wip".

Related: SYS#5423
Change-Id: Ibfcf633f7bd8773f557901fdff7580f5879391a1
---
A library/IPA_EXT_TCAP_ROUTING.ttcn
M library/IPA_Emulation.ttcnpp
M library/IPA_Types.ttcn
3 files changed, 133 insertions(+), 1 deletion(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/35/41135/1
diff --git a/library/IPA_EXT_TCAP_ROUTING.ttcn b/library/IPA_EXT_TCAP_ROUTING.ttcn
new file mode 100644
index 0000000..82e1cdf
--- /dev/null
+++ b/library/IPA_EXT_TCAP_ROUTING.ttcn
@@ -0,0 +1,89 @@
+/* IPA Osmo Extension: TCAP_ROUTING, used to set up TCAP routes in osmo-stp.
+ * (C) 2025 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
+ * All rights reserved.
+ *
+ * Released under the terms of GNU General Public License, Version 2 or
+ * (at your option) any later version.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+module IPA_EXT_TCAP_ROUTING {
+
+import from General_Types all;
+import from Osmocom_Types all;
+import from Native_Functions all;
+
+type enumerated IPA_EXT_TCAP_ROUTING_MsgType {
+ IPA_EXT_TCAP_ROUTING_MSG_TID_ADD_RANGE ('01'O),
+ IPA_EXT_TCAP_ROUTING_MSG_TID_ACK ('02'O),
+ IPA_EXT_TCAP_ROUTING_MSG_TID_NACK ('03'O)
+} with { variant "FIELDLENGTH(8)" };
+
+type record IPA_EXT_TCAP_ROUTING_Hdr {
+ IPA_EXT_TCAP_ROUTING_MsgType msg_type,
+ uint32_t seq_nr
+} with { variant "" };
+
+type record IPA_EXT_TCAP_ROUTING_ADD_RANGE {
+ uint32_t tid_start,
+ uint32_t tid_end,
+ uint32_t pc,
+ uint8_t ssn
+} with { variant "" };
+
+type record IPA_EXT_TCAP_ROUTING_ACK {
+} with { variant "" };
+
+type record IPA_EXT_TCAP_ROUTING_NACK {
+ uint8_t cause
+} with { variant "" };
+
+type union IPA_EXT_TCAP_ROUTING_MsgUnion {
+ IPA_EXT_TCAP_ROUTING_ADD_RANGE add_range,
+ IPA_EXT_TCAP_ROUTING_ACK ack,
+ IPA_EXT_TCAP_ROUTING_NACK nack
+} with { variant "" };
+
+type record IPA_EXT_TCAP_ROUTING_Message {
+ IPA_EXT_TCAP_ROUTING_MsgType msg_type,
+ uint32_t seq_nr,
+ IPA_EXT_TCAP_ROUTING_MsgUnion u
+} with { variant (u) "CROSSTAG(add_range, msg_type = IPA_EXT_TCAP_ROUTING_MSG_TID_ADD_RANGE;
+ ack, msg_type = IPA_EXT_TCAP_ROUTING_MSG_TID_ACK;
+ nack, msg_type = IPA_EXT_TCAP_ROUTING_MSG_TID_NACK)"
+};
+
+external function enc_IPA_EXT_TCAP_ROUTING_Message(in IPA_EXT_TCAP_ROUTING_Message pdu) return octetstring
+ with { extension "prototype(convert) encode(RAW)" };
+external function dec_IPA_EXT_TCAP_ROUTING_Message(in octetstring stream) return IPA_EXT_TCAP_ROUTING_Message
+ with { extension "prototype(convert) decode(RAW)" };
+
+/* Generic template for matching messages by type and/or the BTS number */
+template (present) IPA_EXT_TCAP_ROUTING_Message
+tr_IPA_EXT_TCAP_ROUTING_Message(template IPA_EXT_TCAP_ROUTING_MsgType msg_type := ?) := {
+ msg_type := msg_type,
+ seq_nr := ?,
+ u := ?
+}
+
+template (value) IPA_EXT_TCAP_ROUTING_Message
+ts_IPA_EXT_TCAP_ROUTING_ADD_RANGE(template (value) uint32_t seq_nr,
+ template (value) uint32_t tid_start,
+ template (value) uint32_t tid_end,
+ template (value) uint32_t pc,
+ template (value) uint8_t ssn) := {
+ msg_type := IPA_EXT_TCAP_ROUTING_MSG_TID_ADD_RANGE,
+ seq_nr := seq_nr,
+ u := {
+ add_range := {
+ tid_start := tid_start,
+ tid_end := tid_end,
+ pc := pc,
+ ssn := ssn
+ }
+ }
+}
+
+
+} with { encode "RAW" };
diff --git a/library/IPA_Emulation.ttcnpp b/library/IPA_Emulation.ttcnpp
index 2df598a..9105f41 100644
--- a/library/IPA_Emulation.ttcnpp
+++ b/library/IPA_Emulation.ttcnpp
@@ -60,6 +60,10 @@
import from PCUIF_Types all;
#endif

+#ifdef IPA_EMULATION_TCAP_ROUTING
+import from IPA_EXT_TCAP_ROUTING all;
+#endif
+
modulepar {
/* Use Osmocom extended IPA mux header */
boolean mp_ipa_mgcp_uses_osmo_ext := true;
@@ -202,6 +206,12 @@
} with { extension "internal" }
#endif

+#ifdef IPA_EMULATION_TCAP_ROUTING
+/* Client port for Osmocom PCU extension inside IPA */
+type port IPA_TCAP_ROUTING_PT message {
+ inout IPA_EXT_TCAP_ROUTING_Message, ASP_IPA_Event;
+} with { extension "internal" }
+#endif


type component IPA_Emulation_CT {
@@ -242,6 +252,10 @@
/* up-facing port for RSPRO */
port IPA_OSMO_PCU_PT IPA_OSMO_PCU_PORT;
#endif
+#ifdef IPA_EMULATION_TCAP_ROUTING
+ /* up-facing port for RSPRO */
+ port IPA_TCAP_ROUTING_PT IPA_TCAP_ROUTING_PORT;
+#endif

/* up-facing port for other streams */
port IPA_SP_PT IPA_SP_PORT;
@@ -410,6 +424,11 @@
IPA_OSMO_PCU_PORT.send(evt);
}
#endif
+#ifdef IPA_EMULATION_TCAP_ROUTING
+ if (IPA_TCAP_ROUTING_PORT.checkstate("Connected")) {
+ IPA_TCAP_ROUTING_PORT.send(evt);
+ }
+#endif
/* FIXME: to other ports */
}

@@ -657,6 +676,13 @@
}
#endif

+#ifdef IPA_EMULATION_TCAP_ROUTING
+private function f_tcap_routing_to_user(octetstring msg) runs on IPA_Emulation_CT {
+ var IPA_EXT_TCAP_ROUTING_Message pcuif_msg := dec_IPA_EXT_TCAP_ROUTING_Message(msg);
+ IPA_TCAP_ROUTING_PORT.send(pcuif_msg);
+}
+#endif
+
#ifdef IPA_EMULATION_MGCP
private function f_mgcp_to_user(octetstring msg) runs on IPA_Emulation_CT {
var charstring msg_ch := oct2char(msg);
@@ -734,6 +760,9 @@
#ifdef IPA_EMULATION_OSMO_PCU
var PCUIF_Message pcu;
#endif
+#ifdef IPA_EMULATION_TCAP_ROUTING
+ var IPA_EXT_TCAP_ROUTING_Message tcap_routing;
+#endif

/* Set function for dissecting the binary */
var f_IPL4_getMsgLen vl_f := refers(f_IPL4_fixedMsgLen);
@@ -815,6 +844,11 @@
f_osmo_pcu_to_user(ipa_rx.msg);
}
#endif
+#ifdef IPA_EMULATION_TCAP_ROUTING
+ case (IPAC_PROTO_EXT_TCAP_ROUTING) {
+ f_tcap_routing_to_user(ipa_rx.msg);
+ }
+#endif
case else {
IPA_SP_PORT.send(f_to_asp(ipa_rx));
}
@@ -916,6 +950,14 @@
}
#endif

+#ifdef IPA_EMULATION_TCAP_ROUTING
+ [] IPA_TCAP_ROUTING_PORT.receive(IPA_EXT_TCAP_ROUTING_Message:?) -> value tcap_routing {
+ payload := enc_IPA_EXT_TCAP_ROUTING_Message(tcap_routing);
+ ipa_ud := valueof(t_ASP_IPA_UD(IPAC_PROTO_OSMO, payload, IPAC_PROTO_EXT_TCAP_ROUTING));
+ IPA_PORT.send(f_from_asp(f_ipa_conn_id(), ipa_ud));
+ }
+#endif
+
#ifdef IPA_EMULATION_RSL
/* Received RSL -> down into IPA */
[] IPA_RSL_PORT.receive(ASP_RSL_Unitdata:?) -> value rsl {
diff --git a/library/IPA_Types.ttcn b/library/IPA_Types.ttcn
index fc729fb..4329f00 100644
--- a/library/IPA_Types.ttcn
+++ b/library/IPA_Types.ttcn
@@ -36,7 +36,8 @@
IPAC_PROTO_EXT_GSUP ('05'H),
IPAC_PROTO_EXT_OAP ('06'H),
IPAC_PROTO_EXT_RSPRO ('07'H),
- IPAC_PROTO_EXT_OSMO_PCU ('08'H)
+ IPAC_PROTO_EXT_OSMO_PCU ('08'H),
+ IPAC_PROTO_EXT_TCAP_ROUTING ('09'H)
} with { variant "FIELDLENGTH(8)" }

external function enc_PDU_IPA(in PDU_IPA pdu) return octetstring

To view, visit change 41135. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ibfcf633f7bd8773f557901fdff7580f5879391a1
Gerrit-Change-Number: 41135
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>