pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41136?usp=email )


Change subject: WIP: stp: Introduce STP_Tests_TCAP
......................................................................

WIP: stp: Introduce STP_Tests_TCAP

The network topology and test infrastructure already allows testing TCAP 
forwarding
at STP over IPA<->IPA, M3UA<->IPA and M3UA<->M3UA.

TODO:
* Currently f_asp_tx_tcap_full_transaction() is tweak to pass based on
  regular M3UA OPC+DPC+SLS loadsharing routing, see the functions
  f_asp*_any() being used instead of expecting Rx on a specific ASP.
* There's some initial IPA extension TCAP_ROUTING in place and sending
  data properly to the STP, but it hasn't yet really been clarified how
  is that supposed to work at the STP...
* Currently there's no route range setup for M3UA since it hasn't been
  clarified yet how is that supposed to work.

Related: SYS#5423
Change-Id: I4340bdf126118c66af861f5a447e90883783920e
---
M stp/STP_Tests_Common.ttcn
A stp/STP_Tests_TCAP.cfg
A stp/STP_Tests_TCAP.ttcn
M stp/expected-results.xml
M stp/gen_links.sh
A stp/osmo-stp-tcap.confmerge
M stp/regen_makefile.sh
A stp/testenv_tcap.cfg
8 files changed, 744 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/36/41136/1

diff --git a/stp/STP_Tests_Common.ttcn b/stp/STP_Tests_Common.ttcn
index 557fa29..0a0a436 100644
--- a/stp/STP_Tests_Common.ttcn
+++ b/stp/STP_Tests_Common.ttcn
@@ -13,6 +13,7 @@
 friend module STP_Tests_M3UA;
 friend module STP_Tests_IPA;
 friend module STP_Tests_IPA_M3UA;
+friend module STP_Tests_TCAP;

 import from General_Types all;
 import from Osmocom_Types all;
diff --git a/stp/STP_Tests_TCAP.cfg b/stp/STP_Tests_TCAP.cfg
new file mode 100644
index 0000000..4527377
--- /dev/null
+++ b/stp/STP_Tests_TCAP.cfg
@@ -0,0 +1,266 @@
+[ORDERED_INCLUDE]
+# Common configuration, shared between test suites
+"../Common.cfg"
+# testsuite specific configuration, not expected to change
+"./STP_Tests.default"
+
+# Local configuration below
+
+[LOGGING]
+
+[TESTPORT_PARAMETERS]
+
+[MODULE_PARAMETERS]
+STP_Tests_TCAP.mp_tcap_configs := {
+       # AS "as-m3ua-loadshare-0"
+       {
+               asp_name := "asp-m3ua-loadshare-0-0",
+               as_name := "as-m3ua-loadshare-0",
+               cfg := {
+                       transport := SCCP_TRANSPORT_SIGTRAN,
+                       tpars := {
+                               sigtran := {
+                                       sctp_addr := { 9900, "127.0.0.1", 2905, 
"127.0.0.1" }
+                               }
+                       },
+                       sccp_service_type := "mtp3_itu",
+                       own_pc := 23,
+                       own_ssn := 8, /* MSC (MAP) */
+                       peer_pc := 5,
+                       peer_ssn := 6, /* HLR (MAP) */
+                       sio := '83'O,
+                       rctx := 1000
+               }
+       },
+       {
+               asp_name := "asp-m3ua-loadshare-0-1",
+               as_name := "as-m3ua-loadshare-0",
+               cfg := {
+                       transport := SCCP_TRANSPORT_SIGTRAN,
+                       tpars := {
+                               sigtran := {
+                                       sctp_addr := { 9901, "127.0.0.1", 2905, 
"127.0.0.1" }
+                               }
+                       },
+                       sccp_service_type := "mtp3_itu",
+                       own_pc := 23,
+                       own_ssn := 8, /* MSC (MAP) */
+                       peer_pc := 5,
+                       peer_ssn := 6, /* HLR (MAP) */
+                       sio := '83'O,
+                       rctx := 1000
+               }
+       },
+       # AS "as-m3ua-loadshare-1"
+       {
+               asp_name := "asp-m3ua-loadshare-1-0",
+               as_name := "as-m3ua-loadshare-1",
+               cfg := {
+                       transport := SCCP_TRANSPORT_SIGTRAN,
+                       tpars := {
+                               sigtran := {
+                                       sctp_addr := { 9910, "127.0.0.1", 2905, 
"127.0.0.1" }
+                               }
+                       },
+                       sccp_service_type := "mtp3_itu",
+                       own_pc := 24,
+                       own_ssn := 8, /* MSC (MAP) */
+                       peer_pc := 25,
+                       peer_ssn := 6, /* HLR (MAP) */
+                       sio := '83'O,
+                       rctx := 1001
+               }
+       },
+       {
+               asp_name := "asp-m3ua-loadshare-1-1",
+               as_name := "as-m3ua-loadshare-1",
+               cfg := {
+                       transport := SCCP_TRANSPORT_SIGTRAN,
+                       tpars := {
+                               sigtran := {
+                                       sctp_addr := { 9911, "127.0.0.1", 2905, 
"127.0.0.1" }
+                               }
+                       },
+                       sccp_service_type := "mtp3_itu",
+                       own_pc := 24,
+                       own_ssn := 8, /* MSC (MAP) */
+                       peer_pc := 25,
+                       peer_ssn := 6, /* HLR (MAP) */
+                       sio := '83'O,
+                       rctx := 1001
+               }
+       },
+       # AS "as-m3ua-loadshare-2"
+       {
+               asp_name := "asp-m3ua-loadshare-2-0",
+               as_name := "as-m3ua-loadshare-2",
+               cfg := {
+                       transport := SCCP_TRANSPORT_SIGTRAN,
+                       tpars := {
+                               sigtran := {
+                                       sctp_addr := { 9920, "127.0.0.1", 2905, 
"127.0.0.1" }
+                               }
+                       },
+                       sccp_service_type := "mtp3_itu",
+                       own_pc := 25,
+                       own_ssn := 8, /* MSC (MAP) */
+                       peer_pc := 24,
+                       peer_ssn := 6, /* HLR (MAP) */
+                       sio := '83'O,
+                       rctx := 1002
+               }
+       },
+       {
+               asp_name := "asp-m3ua-loadshare-2-1",
+               as_name := "as-m3ua-loadshare-2",
+               cfg := {
+                       transport := SCCP_TRANSPORT_SIGTRAN,
+                       tpars := {
+                               sigtran := {
+                                       sctp_addr := { 9921, "127.0.0.1", 2905, 
"127.0.0.1" }
+                               }
+                       },
+                       sccp_service_type := "mtp3_itu",
+                       own_pc := 25,
+                       own_ssn := 8, /* MSC (MAP) */
+                       peer_pc := 24,
+                       peer_ssn := 6, /* HLR (MAP) */
+                       sio := '83'O,
+                       rctx := 1002
+               }
+       },
+       # AS "as-ipa-loadshare-0"
+       {
+               asp_name := "asp-ipa-loadshare-0-0",
+               as_name := "as-ipa-loadshare-0",
+               cfg := {
+                       transport := SCCP_TRANSPORT_SCCPlite,
+                       tpars := {
+                               sccplite := {
+                                       tcp_addr := { 8800, "127.0.0.1", 5000, 
"127.0.0.1" },
+                                       tcp_is_server := false,
+                                       ipa_ccm_pars := omit
+                               }
+                       },
+                       sccp_service_type := "mtp3_itu",
+                       own_pc := 5,
+                       own_ssn := 6, /* HLR (MAP) */
+                       peer_pc := 23,
+                       peer_ssn := 8, /* MSC (MAP) */
+                       sio := '83'O,
+                       rctx := 0
+               }
+       },
+       {
+               asp_name := "asp-ipa-loadshare-0-1",
+               as_name := "as-ipa-loadshare-0",
+               cfg := {
+                       transport := SCCP_TRANSPORT_SCCPlite,
+                       tpars := {
+                               sccplite := {
+                                       tcp_addr := { 8801, "127.0.0.1", 5000, 
"127.0.0.1" },
+                                       tcp_is_server := false,
+                                       ipa_ccm_pars := omit
+                               }
+                       },
+                       sccp_service_type := "mtp3_itu",
+                       own_pc := 5,
+                       own_ssn := 6, /* HLR (MAP) */
+                       peer_pc := 23,
+                       peer_ssn := 8, /* MSC (MAP) */
+                       sio := '83'O,
+                       rctx := 0
+               }
+       },
+       # AS "as-ipa-loadshare-1"
+       {
+               asp_name := "asp-ipa-loadshare-1-0",
+               as_name := "as-ipa-loadshare-1",
+               cfg := {
+                       transport := SCCP_TRANSPORT_SCCPlite,
+                       tpars := {
+                               sccplite := {
+                                       tcp_addr := { 8810, "127.0.0.1", 5000, 
"127.0.0.1" },
+                                       tcp_is_server := false,
+                                       ipa_ccm_pars := omit
+                               }
+                       },
+                       sccp_service_type := "mtp3_itu",
+                       own_pc := 6,
+                       own_ssn := 6, /* HLR (MAP) */
+                       peer_pc := 7,
+                       peer_ssn := 8, /* MSC (MAP) */
+                       sio := '83'O,
+                       rctx := 0
+               }
+       },
+       {
+               asp_name := "asp-ipa-loadshare-1-1",
+               as_name := "as-ipa-loadshare-1",
+               cfg := {
+                       transport := SCCP_TRANSPORT_SCCPlite,
+                       tpars := {
+                               sccplite := {
+                                       tcp_addr := { 8811, "127.0.0.1", 5000, 
"127.0.0.1" },
+                                       tcp_is_server := false,
+                                       ipa_ccm_pars := omit
+                               }
+                       },
+                       sccp_service_type := "mtp3_itu",
+                       own_pc := 6,
+                       own_ssn := 6, /* HLR (MAP) */
+                       peer_pc := 7,
+                       peer_ssn := 8, /* MSC (MAP) */
+                       sio := '83'O,
+                       rctx := 0
+               }
+       },
+       # AS "as-ipa-loadshare-2"
+       {
+               asp_name := "asp-ipa-loadshare-2-0",
+               as_name := "as-ipa-loadshare-2",
+               cfg := {
+                       transport := SCCP_TRANSPORT_SCCPlite,
+                       tpars := {
+                               sccplite := {
+                                       tcp_addr := { 8820, "127.0.0.1", 5000, 
"127.0.0.1" },
+                                       tcp_is_server := false,
+                                       ipa_ccm_pars := omit
+                               }
+                       },
+                       sccp_service_type := "mtp3_itu",
+                       own_pc := 7,
+                       own_ssn := 6, /* HLR (MAP) */
+                       peer_pc := 6,
+                       peer_ssn := 8, /* MSC (MAP) */
+                       sio := '83'O,
+                       rctx := 0
+               }
+       },
+       {
+               asp_name := "asp-ipa-loadshare-2-1",
+               as_name := "as-ipa-loadshare-2",
+               cfg := {
+                       transport := SCCP_TRANSPORT_SCCPlite,
+                       tpars := {
+                               sccplite := {
+                                       tcp_addr := { 8821, "127.0.0.1", 5000, 
"127.0.0.1" },
+                                       tcp_is_server := false,
+                                       ipa_ccm_pars := omit
+                               }
+                       },
+                       sccp_service_type := "mtp3_itu",
+                       own_pc := 7,
+                       own_ssn := 6, /* HLR (MAP) */
+                       peer_pc := 6,
+                       peer_ssn := 8, /* MSC (MAP) */
+                       sio := '83'O,
+                       rctx := 0
+               }
+       }
+}
+
+[MAIN_CONTROLLER]
+
+[EXECUTE]
+STP_Tests_TCAP.control
diff --git a/stp/STP_Tests_TCAP.ttcn b/stp/STP_Tests_TCAP.ttcn
new file mode 100644
index 0000000..b38edba
--- /dev/null
+++ b/stp/STP_Tests_TCAP.ttcn
@@ -0,0 +1,312 @@
+module STP_Tests_TCAP {
+
+/* Osmocom STP test suite in in TTCN-3, TCAP routing (TCAP: ITU Q.771-774)
+ * (C) 2025 by sysmocom - s.f.m.c. GmbH <[email protected]>
+ * Author: Pau Espin Pedrol <[email protected]>
+ * 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
+ */
+
+import from General_Types all;
+import from Osmocom_Types all;
+import from IPL4asp_Types all;
+import from Misc_Helpers all;
+
+import from Osmocom_VTY_Functions all;
+
+import from M3UA_Types all;
+import from M3UA_Templates all;
+import from M3UA_CodecPort all;
+import from M3UA_CodecPort_CtrlFunct all;
+
+import from M3UA_Emulation all;
+import from MTP3asp_Types all;
+import from MTP3asp_PortType all;
+
+import from SCCP_Types all;
+import from SCCP_Templates all;
+import from SCCPasp_Types all;
+import from SCCP_Emulation all;
+import from SCCP_Adapter all;
+
+import from IPA_Emulation all;
+import from IPA_EXT_TCAP_ROUTING all;
+
+import from STP_Tests_Common all;
+import from STP_Tests_IPA all;
+import from STP_Tests_M3UA all;
+
+import from TCAPMessages language "ASN.1:1997" all;
+import from TCAP_Types all;
+import from TCAP_Templates all;
+import from TCAP_CodecPort all;
+
+import from STP_Tests_Common all;
+
+const integer MAX_NUM_ASP := 4;
+const OCT1 c_M3UA_SI_SCCP := '03'O;
+
+type record TCAP_CT_Configuration {
+       /* Name of the ASP in the STP, (eg. to access it over VTY) */
+       charstring asp_name,
+       /* Name of the AS in the STP, (eg. to access it over VTY) */
+       charstring as_name,
+       SCCP_Adapter_Config cfg
+}
+type record of TCAP_CT_Configuration TCAP_CT_Configurations;
+
+modulepar {
+       /* local ASPs. Set in .cfg file: */
+       TCAP_CT_Configurations mp_tcap_configs := {}
+}
+
+type component TCAP_CT extends Test_CT {
+       var SCCP_Adapter g_tcap[MAX_NUM_ASP];
+       port TCAP_CODEC_PT SCCP_TCAP[MAX_NUM_ASP];
+       /* Port for IPA Extension TCAP_ROUTING */
+       port IPA_TCAP_ROUTING_PT IPA_TCAP_ROUTING[MAX_NUM_ASP];
+};
+
+private function tcap_build_configs(template (omit) Misc_Helpers.ro_charstring 
asps := omit)
+runs on TCAP_CT return TCAP_CT_Configurations
+{
+       if (not isvalue(asps)) {
+               return mp_tcap_configs;
+       }
+
+       var TCAP_CT_Configurations tcap_configs := {};
+       for (var integer i := 0; i < lengthof(asps); i := i + 1) {
+               var boolean found := false;
+               for (var integer j := 0; j < lengthof(mp_tcap_configs); j := j 
+ 1) {
+                       if (mp_tcap_configs[j].asp_name == valueof(asps[i])) {
+                               found := true;
+                               tcap_configs := tcap_configs & 
{mp_tcap_configs[j]};
+                               break;
+                       }
+               }
+               if (not found) {
+                       Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+                                               log2str("Could not find ASP ", 
asps[i], ", check your configuration"));
+               }
+       }
+       return tcap_configs;
+}
+
+
+private function f_init_tcap(TCAP_CT_Configurations tcap_configs) runs on 
TCAP_CT {
+       f_init_common();
+
+       for (var integer i := 0; i < lengthof(tcap_configs); i := i + 1) {
+               if (tcap_configs[i].cfg.transport == SCCP_TRANSPORT_SCCPlite) {
+                       tcap_configs[i].cfg.tpars.sccplite.ipa_ccm_pars := 
c_IPA_default_ccm_pars;
+                       tcap_configs[i].cfg.tpars.sccplite.ipa_ccm_pars.name := 
tcap_configs[i].as_name;
+               }
+               f_sccp_adapter_init(g_tcap[i], tcap_configs[i].cfg, "STP_TCAP_" 
& int2str(i));
+               connect(self:SCCP_TCAP[i], g_tcap[i].vc_SCCP:SCCP_SP_PORT);
+               if (tcap_configs[i].cfg.transport == SCCP_TRANSPORT_SCCPlite) {
+                       connect(self:IPA_TCAP_ROUTING[i], 
g_tcap[i].vc_IPA:IPA_TCAP_ROUTING_PORT);
+               }
+       }
+
+       for (var integer i := 0; i < lengthof(tcap_configs); i := i + 1) {
+               f_sccp_adapter_start(g_tcap[i]);
+       }
+
+       /* M3UA Emulation doesn't yet signal events up the stack, so it's
+       impossible to know exactly when the ASP becomes active. Hence, wait for
+       a while here to do ASPUP+ASPAC procedures: */
+       f_sleep(3.0);
+}
+
+private function f_asp_tx_ipa_ext_tcap_routing(template (value) 
IPA_EXT_TCAP_ROUTING_Message tcap_rt_msg, integer asp_idx := 0)
+runs on TCAP_CT
+{
+       IPA_TCAP_ROUTING[asp_idx].send(tcap_rt_msg);
+}
+
+private function f_asp_tx_tcap(template (value) TCMessage tcap_msg,
+                              integer asp_idx := 0)
+runs on TCAP_CT
+{
+       var template (value) TCAP_N_UNITDATA_req sccp_unitdata_req :=
+               ts_TCAP_UNITDATA_req(g_tcap[asp_idx].sccp_addr_peer,
+                                    g_tcap[asp_idx].sccp_addr_own,
+                                    tcap_msg)
+       SCCP_TCAP[asp_idx].send(sccp_unitdata_req);
+}
+
+
+private altstep as_asp_rx_tcap_any(template (present) TCMessage tcap_msg := ?,
+                                  integer tx_asp_idx := 0)
+runs on TCAP_CT
+{
+       var template (present) TCAP_N_UNITDATA_ind exp_sccp_unitdata_ind :=
+               tr_TCAP_UNITDATA_ind(g_tcap[tx_asp_idx].sccp_addr_peer,
+                                    g_tcap[tx_asp_idx].sccp_addr_own,
+                                    tcap_msg);
+       [] any from SCCP_TCAP.receive(exp_sccp_unitdata_ind) {
+               setverdict(pass);
+       }
+}
+
+private altstep as_asp_rx_tcap(template (present) TCMessage tcap_msg := ?,
+                              integer tx_asp_idx := 0,
+                              integer rx_asp_idx := 0, boolean fail_rx_others 
:= true)
+runs on TCAP_CT
+{
+       var template (present) TCAP_N_UNITDATA_ind exp_sccp_unitdata_ind :=
+               tr_TCAP_UNITDATA_ind(g_tcap[tx_asp_idx].sccp_addr_peer,
+                                    g_tcap[tx_asp_idx].sccp_addr_own,
+                                    tcap_msg);
+
+       [] SCCP_TCAP[rx_asp_idx].receive(exp_sccp_unitdata_ind) {
+               setverdict(pass);
+       }
+       [fail_rx_others] any from SCCP_TCAP.receive(exp_sccp_unitdata_ind) {
+               Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+                                       log2str("Rx TCAP at unexpected ASP with 
idx != ", rx_asp_idx));
+       }
+}
+
+private function f_asp_tx_tcap_exp(template (value) TCMessage tcap_msg,
+                                  integer tx_asp_idx,
+                                  integer rx_asp_idx)
+runs on TCAP_CT
+{
+       f_asp_tx_tcap(tcap_msg, tx_asp_idx);
+       as_asp_rx_tcap(tcap_msg, tx_asp_idx, rx_asp_idx);
+}
+
+private function f_asp_tx_tcap_exp_any(template (value) TCMessage tcap_msg,
+                                      integer tx_asp_idx)
+runs on TCAP_CT
+{
+       f_asp_tx_tcap(tcap_msg, tx_asp_idx);
+       as_asp_rx_tcap_any(tcap_msg, tx_asp_idx);
+}
+
+private function f_asp_tx_tcap_full_transaction(integer o_asp_idx,
+                                               integer t_asp_idx,
+                                               OCT4 o_tid,
+                                               OCT4 t_tid)
+runs on TCAP_CT
+{
+       var template (value) TCMessage tcap_msg;
+
+       /* TCAP Being: O -> T */
+       tcap_msg := ts_TCAP_Begin(o_tid);
+       f_asp_tx_tcap_exp(tcap_msg, o_asp_idx, t_asp_idx);
+
+       /* TCAP Continue: O <- T */
+       tcap_msg := ts_TCAP_Continue(t_tid, o_tid);
+       // FIXME: enable this one instead when TCAP routing is implemented...
+       //f_asp_tx_tcap_exp(tcap_msg, t_asp_idx, o_asp_idx);
+       f_asp_tx_tcap_exp_any(tcap_msg, t_asp_idx);
+
+       /* TCAP Continue: O -> T */
+       tcap_msg := ts_TCAP_Continue(o_tid, t_tid);
+       f_asp_tx_tcap_exp(tcap_msg, o_asp_idx, t_asp_idx);
+
+       /* TCAP End O <- T */
+       tcap_msg := ts_TCAP_End(o_tid);
+       // FIXME: enable this one instead when TCAP routing is implemented...
+       //f_asp_tx_tcap_exp(tcap_msg, t_asp_idx, o_asp_idx);
+       f_asp_tx_tcap_exp_any(tcap_msg, t_asp_idx);
+}
+
+/* test routing TCAP traffic from M3UA AS to M3UA AS */
+testcase TC_tcap_loadshare_m3ua_to_m3ua() runs on TCAP_CT {
+       var Misc_Helpers.ro_charstring tcap_asps := { "asp-m3ua-loadshare-1-0",
+                                                     "asp-m3ua-loadshare-1-1",
+                                                     "asp-m3ua-loadshare-2-0",
+                                                     "asp-m3ua-loadshare-2-1" 
};
+       var TCAP_CT_Configurations tcap_configs := 
tcap_build_configs(tcap_asps);
+
+       f_init_tcap(tcap_configs);
+
+       /* TODO: there is currently no way to configure TCAP routing on M3UA 
AS!!!! */
+
+       f_asp_tx_tcap_full_transaction(0, 3, int2oct(77, 4), int2oct(177, 4));
+
+       setverdict(pass);
+}
+
+/* test routing TCAP traffic from IPA AS to M3UA AS */
+testcase TC_tcap_loadshare_ipa_to_ipa() runs on TCAP_CT {
+       var template (value) IPA_EXT_TCAP_ROUTING_Message tcap_rt_msg;
+       var Misc_Helpers.ro_charstring tcap_asps := { "asp-ipa-loadshare-1-0",
+                                                     "asp-ipa-loadshare-1-1",
+                                                     "asp-ipa-loadshare-2-0",
+                                                     "asp-ipa-loadshare-2-1" };
+       var TCAP_CT_Configurations tcap_configs := 
tcap_build_configs(tcap_asps);
+
+       f_init_tcap(tcap_configs);
+
+       /* Configure TCAP routing on ASP "asp-ipa-loadshare-1-0": */
+       tcap_rt_msg := ts_IPA_EXT_TCAP_ROUTING_ADD_RANGE(seq_nr := 0,
+                                                         tid_start := 0,
+                                                         tid_end := 99,
+                                                         pc := 
tcap_configs[2].cfg.own_pc,
+                                                         ssn := 
tcap_configs[2].cfg.own_ssn);
+       f_asp_tx_ipa_ext_tcap_routing(tcap_rt_msg, 0);
+       /* Configure TCAP routing on ASP "asp-ipa-loadshare-2-0": */
+       f_asp_tx_ipa_ext_tcap_routing(tcap_rt_msg, 2);
+
+       /* Configure TCAP routing on ASP "asp-ipa-loadshare-1-1": */
+       tcap_rt_msg.u.add_range.tid_start := 100;
+       tcap_rt_msg.u.add_range.tid_end := 199;
+       f_asp_tx_ipa_ext_tcap_routing(tcap_rt_msg, 1);
+       /* Configure TCAP routing on ASP "asp-ipa-loadshare-2-1": */
+       f_asp_tx_ipa_ext_tcap_routing(tcap_rt_msg, 3);
+
+       f_asp_tx_tcap_full_transaction(0, 3, int2oct(77, 4), int2oct(177, 4));
+
+       setverdict(pass);
+}
+
+/* test routing TCAP traffic from IPA AS to M3UA AS */
+testcase TC_tcap_loadshare_m3ua_to_ipa() runs on TCAP_CT {
+       var template (value) IPA_EXT_TCAP_ROUTING_Message tcap_rt_msg;
+       var Misc_Helpers.ro_charstring tcap_asps := { "asp-m3ua-loadshare-0-0",
+                                                     "asp-m3ua-loadshare-0-1",
+                                                     "asp-ipa-loadshare-0-0",
+                                                     "asp-ipa-loadshare-0-1" };
+       var TCAP_CT_Configurations tcap_configs := 
tcap_build_configs(tcap_asps);
+
+       f_init_tcap(tcap_configs);
+
+       /* Configure TCAP routing on ASP "asp-ipa-loadshare-0-0": */
+       tcap_rt_msg := ts_IPA_EXT_TCAP_ROUTING_ADD_RANGE(seq_nr := 0,
+                                                         tid_start := 0,
+                                                         tid_end := 99,
+                                                         pc := 
tcap_configs[2].cfg.own_pc,
+                                                         ssn := 
tcap_configs[2].cfg.own_ssn);
+       f_asp_tx_ipa_ext_tcap_routing(tcap_rt_msg, 2);
+
+       /* Configure TCAP routing on ASP "asp-ipa-loadshare-0-1": */
+       tcap_rt_msg.u.add_range.tid_start := 100;
+       tcap_rt_msg.u.add_range.tid_end := 199;
+       f_asp_tx_ipa_ext_tcap_routing(tcap_rt_msg, 3);
+
+       f_asp_tx_tcap_full_transaction(0, 3, int2oct(77, 4), int2oct(177, 4));
+
+       setverdict(pass);
+}
+
+/* TODO: do some testing where TCAP Abort message is used.
+ * TODO: do some testing where only TCAP Begin+End message is used.
+ */
+
+control {
+       execute( TC_tcap_loadshare_m3ua_to_m3ua() );
+       execute( TC_tcap_loadshare_ipa_to_ipa() );
+       execute( TC_tcap_loadshare_m3ua_to_ipa() );
+}
+
+
+
+}
diff --git a/stp/expected-results.xml b/stp/expected-results.xml
index 91115d9..50d1379 100644
--- a/stp/expected-results.xml
+++ b/stp/expected-results.xml
@@ -68,4 +68,7 @@
   <testcase classname='STP_Tests_IPA_M3UA' name='TC_ipa_to_m3ua' 
time='MASKED'/>
   <testcase classname='STP_Tests_IPA_M3UA' name='TC_ipa_to_m3ua_ni' 
time='MASKED'/>
   <testcase classname='STP_Tests_IPA_M3UA' name='TC_ipa_to_m3ua_patch_sccp' 
time='MASKED'/>
+  <testcase classname='STP_Tests_TCAP' name='TC_tcap_loadshare_m3ua_to_m3ua' 
time='MASKED'/>
+  <testcase classname='STP_Tests_TCAP' name='TC_tcap_loadshare_ipa_to_ipa' 
time='MASKED'/>
+  <testcase classname='STP_Tests_TCAP' name='TC_tcap_loadshare_m3ua_to_ipa' 
time='MASKED'/>
 </testsuite>
diff --git a/stp/gen_links.sh b/stp/gen_links.sh
index 625a3de..febef3d 100755
--- a/stp/gen_links.sh
+++ b/stp/gen_links.sh
@@ -46,11 +46,17 @@
 FILES="TELNETasp_PT.cc  TELNETasp_PT.hh  TELNETasp_PortType.ttcn"
 gen_links $DIR $FILES

+DIR=../library/tcap
+FILES="TCAPMessages.asn TCAP_DialoguePDUs.asn TCAP_UnidialoguePDUs.asn "
+FILES+="TCAP_EncDec.cc TCAP_CodecPort.ttcn TCAP_Types.ttcn TCAP_Templates.ttcn 
"
+gen_links $DIR $FILES
+
 DIR=../library
 FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn 
Osmocom_VTY_Functions.ttcn Native_Functions.ttcn Native_FunctionDefs.cc "
+FILES+="IPA_EXT_TCAP_ROUTING.ttcn "
 FILES+="IPA_Types.ttcn IPA_Emulation.ttcnpp IPA_CodecPort.ttcn 
IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc "
 FILES+="Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn 
Osmocom_CTRL_Adapter.ttcn "
-FILES+="SCCP_Templates.ttcn "
+FILES+="SCCP_Templates.ttcn SCCP_Adapter.ttcnpp "
 FILES+="M3UA_Templates.ttcn M3UA_CodecPort.ttcn M3UA_CodecPort_CtrlFunct.ttcn 
M3UA_CodecPort_CtrlFunctDef.cc "
 FILES+="SCTP_Templates.ttcn "
 gen_links $DIR $FILES
diff --git a/stp/osmo-stp-tcap.confmerge b/stp/osmo-stp-tcap.confmerge
new file mode 100644
index 0000000..3b417ac
--- /dev/null
+++ b/stp/osmo-stp-tcap.confmerge
@@ -0,0 +1,140 @@
+cs7 instance 0
+ !
+ !M3UA AS/ASP as(p)-m3ua-loadshare-0:
+ !
+ asp asp-m3ua-loadshare-0-0 9900 2905 m3ua
+  local-ip 127.0.0.1
+  local-ip ::1
+  remote-ip 127.0.0.1
+  remote-ip ::1
+  role sg
+  sctp-role server
+ asp asp-m3ua-loadshare-0-1 9901 2905 m3ua
+  local-ip 127.0.0.1
+  local-ip ::1
+  remote-ip 127.0.0.1
+  remote-ip ::1
+  role sg
+  sctp-role server
+ as as-m3ua-loadshare-0 m3ua
+  routing-key 1000 23
+  asp asp-m3ua-loadshare-0-0
+  asp asp-m3ua-loadshare-0-1
+ !
+ !M3UA AS/ASP as(p)-m3ua-loadshare-1:
+ !
+ asp asp-m3ua-loadshare-1-0 9910 2905 m3ua
+  local-ip 127.0.0.1
+  local-ip ::1
+  remote-ip 127.0.0.1
+  remote-ip ::1
+  role sg
+  sctp-role server
+ asp asp-m3ua-loadshare-1-1 9911 2905 m3ua
+  local-ip 127.0.0.1
+  local-ip ::1
+  remote-ip 127.0.0.1
+  remote-ip ::1
+  role sg
+  sctp-role server
+ as as-m3ua-loadshare-1 m3ua
+  routing-key 1001 24
+  asp asp-m3ua-loadshare-1-0
+  asp asp-m3ua-loadshare-1-1
+ !
+ !M3UA AS/ASP as(p)-m3ua-loadshare-2:
+ !
+ asp asp-m3ua-loadshare-2-0 9920 2905 m3ua
+  local-ip 127.0.0.1
+  local-ip ::1
+  remote-ip 127.0.0.1
+  remote-ip ::1
+  role sg
+  sctp-role server
+ asp asp-m3ua-loadshare-2-1 9921 2905 m3ua
+  local-ip 127.0.0.1
+  local-ip ::1
+  remote-ip 127.0.0.1
+  remote-ip ::1
+  role sg
+  sctp-role server
+ as as-m3ua-loadshare-2 m3ua
+  routing-key 1002 25
+  asp asp-m3ua-loadshare-2-0
+  asp asp-m3ua-loadshare-2-1
+ !
+ ! IPA AS as(p)-ipa-loadshare-0:
+ ! Hardcoded forward towards as-m3ua-loadshare-0 (PC=23)
+ !
+ asp asp-ipa-loadshare-0-0 8800 5000 ipa
+  local-ip 127.0.0.1
+  remote-ip 127.0.0.1
+  role sg
+  transport-role server
+ asp asp-ipa-loadshare-0-1 8801 5000 ipa
+  local-ip 127.0.0.1
+  remote-ip 127.0.0.1
+  role sg
+  transport-role server
+ as as-ipa-loadshare-0 ipa
+  routing-key 0 5
+  point-code override dpc 23
+  asp asp-ipa-loadshare-0-0
+  asp asp-ipa-loadshare-0-1
+ !
+ ! IPA AS as(p)-ipa-loadshare-1:
+ ! Hardcoded forward towards as-ipa-loadshare-2 (PC=7)
+ !
+ asp asp-ipa-loadshare-1-0 8810 5000 ipa
+  local-ip 127.0.0.1
+  remote-ip 127.0.0.1
+  role sg
+  transport-role server
+ asp asp-ipa-loadshare-1-1 8811 5000 ipa
+  local-ip 127.0.0.1
+  remote-ip 127.0.0.1
+  role sg
+  transport-role server
+ as as-ipa-loadshare-1 ipa
+  routing-key 0 6
+  point-code override dpc 7
+  asp asp-ipa-loadshare-1-0
+  asp asp-ipa-loadshare-1-1
+ !
+ ! IPA AS as(p)-ipa-loadshare-2:
+ ! Hardcoded forward towards as-ipa-loadshare-1 (PC=6)
+ !
+ asp asp-ipa-loadshare-2-0 8820 5000 ipa
+  local-ip 127.0.0.1
+  remote-ip 127.0.0.1
+  role sg
+  transport-role server
+ asp asp-ipa-loadshare-2-1 8821 5000 ipa
+  local-ip 127.0.0.1
+  remote-ip 127.0.0.1
+  role sg
+  transport-role server
+ as as-ipa-loadshare-2 ipa
+  routing-key 0 7
+  point-code override dpc 6
+  asp asp-ipa-loadshare-2-0
+  asp asp-ipa-loadshare-2-1
+ !
+ ! ROUTING TABLE:
+ !
+ route-table system
+  update route 23 16777215 linkset as-m3ua-loadshare-0
+  update route 24 16777215 linkset as-m3ua-loadshare-1
+  update route 25 16777215 linkset as-m3ua-loadshare-2
+  update route 5  16777215 linkset as-ipa-loadshare-0
+  update route 6  16777215 linkset as-ipa-loadshare-1
+  update route 7  16777215 linkset as-ipa-loadshare-2
+ !
+ !SERVERS:
+ !
+ listen m3ua 2905
+  local-ip 127.0.0.1
+  local-ip ::1
+  accept-asp-connections pre-configured
+ listen ipa 5000
+  accept-asp-connections pre-configured
diff --git a/stp/regen_makefile.sh b/stp/regen_makefile.sh
index 0d7fa48..2dab963 100755
--- a/stp/regen_makefile.sh
+++ b/stp/regen_makefile.sh
@@ -3,6 +3,7 @@
 NAME=STP_Tests

 FILES="
+       *.asn
        *.ttcn
        *.ttcnpp
        SCCP_EncDec.cc
@@ -16,11 +17,13 @@
        Native_FunctionDefs.cc
        TCCEncoding.cc
        M3UA_CodecPort_CtrlFunctDef.cc
+       TCAP_EncDec.cc
 "

 CPPFLAGS_TTCN3="
        -DIPA_EMULATION_CTRL
        -DIPA_EMULATION_SCCP
+       -DIPA_EMULATION_TCAP_ROUTING
        -DUSE_MTP3_DISTRIBUTOR
 "

diff --git a/stp/testenv_tcap.cfg b/stp/testenv_tcap.cfg
new file mode 100644
index 0000000..d9816e2
--- /dev/null
+++ b/stp/testenv_tcap.cfg
@@ -0,0 +1,12 @@
+[testsuite]
+titan_min=11.1.0
+program=STP_Tests
+config=STP_Tests_TCAP.cfg
+
+[stp]
+prepare=osmo-config-merge osmo-stp.cfg osmo-stp-tcap.confmerge > 
osmo-stp-tcap.cfg
+program=osmo-stp -c osmo-stp-tcap.cfg
+make=libosmo-sigtran
+package=osmo-stp libosmocore-utils
+copy=osmo-stp.cfg osmo-stp-tcap.confmerge
+vty_port=4239

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41136?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: I4340bdf126118c66af861f5a447e90883783920e
Gerrit-Change-Number: 41136
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to