pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40324?usp=email )
Change subject: stp: Split M3UA TCP tests into its own testenv config ......................................................................
stp: Split M3UA TCP tests into its own testenv config
That group of tests explicitly tests operation of m3ua-tcp AS(P)s and interaction with m3ua(-sctp) ones. Hence, create a new config to test those, where we keep the TCP related configuration in osmo-stp.
Change-Id: I8123887755aa3253830b43407b4cc6b21142233c --- M stp/STP_Tests_M3UA.cfg M stp/STP_Tests_M3UA.ttcn A stp/STP_Tests_M3UA_TCP.cfg A stp/STP_Tests_M3UA_TCP.ttcn A stp/osmo-stp-m3ua-tcp.confmerge M stp/osmo-stp-m3ua.confmerge A stp/testenv_m3ua-tcp.cfg 7 files changed, 258 insertions(+), 127 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/24/40324/1
diff --git a/stp/STP_Tests_M3UA.cfg b/stp/STP_Tests_M3UA.cfg index d5894a1..994314a 100644 --- a/stp/STP_Tests_M3UA.cfg +++ b/stp/STP_Tests_M3UA.cfg @@ -38,15 +38,6 @@ point_code := 42, routing_ctx := 1042 }, - /* as-sender-tcp: One ASP within AS */ - { - asp_name := "asp-sender-tcp", - use_tcp := true, - remote_port := 2905, - local_port := 9999, - point_code := 123, - routing_ctx := 1123 - }, /* as-client: One ASP within AS */ { asp_name := "asp-client0", @@ -73,21 +64,12 @@ local_port := 11061, point_code := 61, routing_ctx := - - }, - /* as-client-tcp: One ASP within AS */ - { - asp_name := "asp-client0-tcp", - use_tcp := true, - remote_port := 2906, - local_port := 10002, - point_code := 155, - routing_ctx := 1155 } }; /* number of M3UA clients in ATS */ -STP_Tests_M3UA.mp_m3ua_num_clients := 4; +STP_Tests_M3UA.mp_m3ua_num_clients := 3; /* number of M3UA servers in ATS */ -STP_Tests_M3UA.mp_m3ua_num_servers := 4; +STP_Tests_M3UA.mp_m3ua_num_servers := 3;
[MAIN_CONTROLLER]
diff --git a/stp/STP_Tests_M3UA.ttcn b/stp/STP_Tests_M3UA.ttcn index a78dec5..64153ab 100644 --- a/stp/STP_Tests_M3UA.ttcn +++ b/stp/STP_Tests_M3UA.ttcn @@ -12,6 +12,7 @@ */
friend module STP_Tests_IPA_M3UA; +friend module STP_Tests_M3UA_TCP;
import from General_Types all; import from Osmocom_Types all; @@ -70,7 +71,7 @@ }; type record of M3uaConfig M3uaConfigs;
-private function M3UA_SRV(integer idx) runs on RAW_M3UA_CT return integer { +friend function M3UA_SRV(integer idx) runs on RAW_M3UA_CT return integer { return g_m3ua_num_clients + idx; }
@@ -515,7 +516,7 @@ }
/* Test if traffic is routed from idx_tx/pc_tx to idx_rx/pc_rx */ -private function f_test_traffic(integer idx_tx, template (omit) OCT4 rctx_sender, OCT4 pc_tx, +friend function f_test_traffic(integer idx_tx, template (omit) OCT4 rctx_sender, OCT4 pc_tx, integer idx_rx, template (omit) OCT4 rctx_receiver, OCT4 pc_rx, OCT1 si := '23'O, OCT1 ni := '00'O, OCT1 mp := '00'O, OCT1 sls := '00'O) runs on RAW_M3UA_CT { @@ -1456,76 +1457,6 @@ f_clear_m3ua(); }
-private function f_TC_m3ua_tcp(integer idx_a, integer idx_b) runs on RAW_M3UA_CT { - var M3uaConfig cfg_a := g_m3ua_configs[idx_a]; - var M3uaConfig cfg_b := g_m3ua_configs[idx_b]; - var OCT4 rctx_a := int2oct(cfg_a.routing_ctx, 4); - var OCT4 rctx_b := int2oct(cfg_b.routing_ctx, 4); - var OCT4 pc_a := int2oct(cfg_a.point_code, 4); - var OCT4 pc_b := int2oct(cfg_b.point_code, 4); - - /* establish connection with ASP 'A' */ - if (idx_a < g_m3ua_num_clients) { - f_M3UA_asp_up_act(idx_a, rctx := rctx_a); - } else { - f_M3UA_CLNT_asp_up_act(idx_a, rctx := rctx_a); - } - - /* establish connection with ASP 'B' */ - if (idx_b < g_m3ua_num_clients) { - f_M3UA_asp_up_act(idx_b, rctx := rctx_b); - } else { - f_M3UA_CLNT_asp_up_act(idx_b, rctx := rctx_b); - } - - /* In the case when ASP[idx_b] is configured as the client (i.e. osmo-stp connects to - * the testsuite; idx_b >= g_m3ua_num_clients), in f_M3UA_CLNT_asp_up_act() we're expecting - * to receive ASPACT and then sending ASPACT_ACK to it. Right after that, we're sending - * some random data via ASP[idx_a], which we then expect to receive via ASP[idx_b]. - * - * There is a chance that the random data sent via ASP[idx_a] would reach osmo-stp - * earlier than the ASPUP_ACK we sent for ASP[idx_b]. This is happening most of the - * times when running TC_m3ua_tcp_cli_srv. Using f_sleep() helps to avoid this. */ - f_sleep(1.0); - - /* M3UA/A -> M3UA/B */ - f_test_traffic(idx_a, rctx_a, pc_a, - idx_b, rctx_b, pc_b); - /* M3UA/B -> M3UA/A */ - f_test_traffic(idx_b, rctx_b, pc_b, - idx_a, rctx_a, pc_a); - - f_clear_m3ua(); -} - -/* test routing between M3UA/SCTP (client) and M3UA/TCP (client) */ -testcase TC_m3ua_tcp_cli() runs on RAW_M3UA_CT { - f_init_m3ua(); - f_TC_m3ua_tcp(0, 3); /* 'asp-sender' <-> 'asp-sender-tcp' */ -} - -/* test routing between M3UA/SCTP (client) and M3UA/TCP (server) */ -testcase TC_m3ua_tcp_cli_srv() runs on RAW_M3UA_CT { - f_init_m3ua(); - f_init_m3ua_srv(); - f_TC_m3ua_tcp(0, M3UA_SRV(3)); /* 'asp-sender' <-> 'asp-client-tcp' */ -} - -/* test routing between M3UA/SCTP (server) and M3UA/TCP (server) */ -testcase TC_m3ua_tcp_srv() runs on RAW_M3UA_CT { - f_init_m3ua(); - f_init_m3ua_srv(); - f_TC_m3ua_tcp(M3UA_SRV(0), M3UA_SRV(3)); /* 'asp-client' <-> 'asp-client-tcp' */ -} - -/* test routing between M3UA/SCTP (server) and M3UA/TCP (client) */ -testcase TC_m3ua_tcp_srv_cli() runs on RAW_M3UA_CT { - f_init_m3ua(); - f_init_m3ua_srv(); - f_TC_m3ua_tcp(M3UA_SRV(0), 3); /* 'asp-client' <-> 'asp-sender-tcp' */ -} - - control { /* M3UA Tests */ execute( TC_connect_asp_up() ); @@ -1542,11 +1473,6 @@ execute( TC_act_rctx_data_no_rctx() ); execute( TC_m3ua_sctp_srv_adm_shutdown() );
- execute( TC_m3ua_tcp_cli() ); - execute( TC_m3ua_tcp_cli_srv() ); - execute( TC_m3ua_tcp_srv() ); - execute( TC_m3ua_tcp_srv_cli() ); - /* M3UA RKM tests */ execute( TC_rkm_reg_static_notpermitted() ); execute( TC_rkm_reg_static_permitted() ); diff --git a/stp/STP_Tests_M3UA_TCP.cfg b/stp/STP_Tests_M3UA_TCP.cfg new file mode 100644 index 0000000..7113e97 --- /dev/null +++ b/stp/STP_Tests_M3UA_TCP.cfg @@ -0,0 +1,61 @@ +[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] +/* Clients first, servers afterwards, match mp_m3ua_num_{clients,servers} */ +STP_Tests_M3UA.mp_m3ua_configs := { + /* as-sender: One ASP within AS */ + { + asp_name := "asp-sender", + use_tcp := false, + remote_port := 2905, + local_port := 9999, + point_code := 23, + routing_ctx := 1023 + }, + /* as-sender-tcp: One ASP within AS */ + { + asp_name := "asp-sender-tcp", + use_tcp := true, + remote_port := 2905, + local_port := 9999, + point_code := 123, + routing_ctx := 1123 + }, + /* as-client: One ASP within AS */ + { + asp_name := "asp-client0", + use_tcp := false, + remote_port := 2906, + local_port := 10002, + point_code := 55, + routing_ctx := 1055 + }, + /* as-client-tcp: One ASP within AS */ + { + asp_name := "asp-client0-tcp", + use_tcp := true, + remote_port := 2906, + local_port := 10002, + point_code := 155, + routing_ctx := 1155 + } + }; +/* number of M3UA clients in ATS */ +STP_Tests_M3UA.mp_m3ua_num_clients := 2; +/* number of M3UA servers in ATS */ +STP_Tests_M3UA.mp_m3ua_num_servers := 2; + +[MAIN_CONTROLLER] + +[EXECUTE] +STP_Tests_M3UA_TCP.control diff --git a/stp/STP_Tests_M3UA_TCP.ttcn b/stp/STP_Tests_M3UA_TCP.ttcn new file mode 100644 index 0000000..15361ef --- /dev/null +++ b/stp/STP_Tests_M3UA_TCP.ttcn @@ -0,0 +1,114 @@ +module STP_Tests_M3UA_TCP { + +/* Osmocom STP test suite in in TTCN-3 + * (C) 2019 Harald Welte laforge@gnumonks.org + * (C) 2024-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 + */ + +import from General_Types all; +import from Osmocom_Types all; +import from IPL4asp_Types 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 STP_Tests_Common all; +import from STP_Tests_M3UA all; + +private function f_TC_m3ua_tcp(integer idx_a, integer idx_b) runs on RAW_M3UA_CT { + var M3uaConfig cfg_a := g_m3ua_configs[idx_a]; + var M3uaConfig cfg_b := g_m3ua_configs[idx_b]; + var OCT4 rctx_a := int2oct(cfg_a.routing_ctx, 4); + var OCT4 rctx_b := int2oct(cfg_b.routing_ctx, 4); + var OCT4 pc_a := int2oct(cfg_a.point_code, 4); + var OCT4 pc_b := int2oct(cfg_b.point_code, 4); + + /* establish connection with ASP 'A' */ + if (idx_a < g_m3ua_num_clients) { + f_M3UA_asp_up_act(idx_a, rctx := rctx_a); + } else { + f_M3UA_CLNT_asp_up_act(idx_a, rctx := rctx_a); + } + + /* establish connection with ASP 'B' */ + if (idx_b < g_m3ua_num_clients) { + f_M3UA_asp_up_act(idx_b, rctx := rctx_b); + } else { + f_M3UA_CLNT_asp_up_act(idx_b, rctx := rctx_b); + } + + /* In the case when ASP[idx_b] is configured as the client (i.e. osmo-stp connects to + * the testsuite; idx_b >= g_m3ua_num_clients), in f_M3UA_CLNT_asp_up_act() we're expecting + * to receive ASPACT and then sending ASPACT_ACK to it. Right after that, we're sending + * some random data via ASP[idx_a], which we then expect to receive via ASP[idx_b]. + * + * There is a chance that the random data sent via ASP[idx_a] would reach osmo-stp + * earlier than the ASPUP_ACK we sent for ASP[idx_b]. This is happening most of the + * times when running TC_m3ua_tcp_cli_srv. Using f_sleep() helps to avoid this. */ + f_sleep(1.0); + + /* M3UA/A -> M3UA/B */ + f_test_traffic(idx_a, rctx_a, pc_a, + idx_b, rctx_b, pc_b); + /* M3UA/B -> M3UA/A */ + f_test_traffic(idx_b, rctx_b, pc_b, + idx_a, rctx_a, pc_a); + + f_clear_m3ua(); +} + +/* test routing between M3UA/SCTP (client) and M3UA/TCP (client) */ +testcase TC_m3ua_tcp_cli() runs on RAW_M3UA_CT { + f_init_m3ua(); + f_TC_m3ua_tcp(0, 1); /* 'asp-sender' <-> 'asp-sender-tcp' */ +} + +/* test routing between M3UA/SCTP (client) and M3UA/TCP (server) */ +testcase TC_m3ua_tcp_cli_srv() runs on RAW_M3UA_CT { + f_init_m3ua(); + f_init_m3ua_srv(); + f_TC_m3ua_tcp(0, M3UA_SRV(1)); /* 'asp-sender' <-> 'asp-client-tcp' */ +} + +/* test routing between M3UA/SCTP (server) and M3UA/TCP (server) */ +testcase TC_m3ua_tcp_srv() runs on RAW_M3UA_CT { + f_init_m3ua(); + f_init_m3ua_srv(); + f_TC_m3ua_tcp(M3UA_SRV(0), M3UA_SRV(1)); /* 'asp-client' <-> 'asp-client-tcp' */ +} + +/* test routing between M3UA/SCTP (server) and M3UA/TCP (client) */ +testcase TC_m3ua_tcp_srv_cli() runs on RAW_M3UA_CT { + f_init_m3ua(); + f_init_m3ua_srv(); + f_TC_m3ua_tcp(M3UA_SRV(0), 1); /* 'asp-client' <-> 'asp-sender-tcp' */ +} + +control { + /* M3UA TCP Tests */ + execute( TC_m3ua_tcp_cli() ); + execute( TC_m3ua_tcp_cli_srv() ); + execute( TC_m3ua_tcp_srv() ); + execute( TC_m3ua_tcp_srv_cli() ); +} + +} \ No newline at end of file diff --git a/stp/osmo-stp-m3ua-tcp.confmerge b/stp/osmo-stp-m3ua-tcp.confmerge new file mode 100644 index 0000000..7c77b05 --- /dev/null +++ b/stp/osmo-stp-m3ua-tcp.confmerge @@ -0,0 +1,67 @@ +cs7 instance 0 + ! + ! M3UA-TCP AS/ASP: + ! + asp asp-sender-tcp 9999 2905 m3ua tcp + local-ip 127.0.0.1 + local-ip ::1 + remote-ip 127.0.0.1 + remote-ip ::1 + role sg + transport-role server + asp asp-client0-tcp 10002 2906 m3ua tcp + local-ip 127.0.0.1 + local-ip ::1 + remote-ip 127.0.0.1 + remote-ip ::1 + role asp + transport-role client + as as-sender-tcp m3ua + asp asp-sender-tcp + routing-key 1123 123 + as as-client-tcp m3ua + routing-key 1155 155 + asp asp-client0-tcp + ! + !M3UA AS/ASP: + ! + asp asp-sender 9999 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-client0 10002 2906 m3ua + local-ip 127.0.0.1 + local-ip ::1 + remote-ip 127.0.0.1 + remote-ip ::1 + role asp + sctp-role client + as as-sender m3ua + asp asp-sender + routing-key 1023 23 + as as-client m3ua + routing-key 1055 55 + asp asp-client0 + ! + ! ROUTING TABLE: + ! + route-table system + update route 123 16777215 linkset as-sender-tcp + update route 155 16777215 linkset as-client-tcp + route-table system + update route 23 16777215 linkset as-sender + update route 55 16777215 linkset as-client + ! + !SERVERS: + ! + listen m3ua 2905 tcp + local-ip 127.0.0.1 + local-ip ::1 + accept-asp-connections dynamic-permitted + listen m3ua 2905 + local-ip 127.0.0.1 + local-ip ::1 + accept-asp-connections dynamic-permitted diff --git a/stp/osmo-stp-m3ua.confmerge b/stp/osmo-stp-m3ua.confmerge index 2140553..65e2fa2 100644 --- a/stp/osmo-stp-m3ua.confmerge +++ b/stp/osmo-stp-m3ua.confmerge @@ -1,28 +1,5 @@ cs7 instance 0 ! - ! M3UA-TCP AS/ASP: - ! - asp asp-sender-tcp 9999 2905 m3ua tcp - local-ip 127.0.0.1 - local-ip ::1 - remote-ip 127.0.0.1 - remote-ip ::1 - role sg - transport-role server - asp asp-client0-tcp 10002 2906 m3ua tcp - local-ip 127.0.0.1 - local-ip ::1 - remote-ip 127.0.0.1 - remote-ip ::1 - role asp - transport-role client - as as-sender-tcp m3ua - asp asp-sender-tcp - routing-key 1123 123 - as as-client-tcp m3ua - routing-key 1155 155 - asp asp-client0-tcp - ! !M3UA AS/ASP: ! asp asp-sender 9999 2905 m3ua @@ -87,9 +64,6 @@ ! ROUTING TABLE: ! route-table system - update route 123 16777215 linkset as-sender-tcp - update route 155 16777215 linkset as-client-tcp - route-table system update route 23 16777215 linkset as-sender update route 42 16777215 linkset as-receiver update route 55 16777215 linkset as-client @@ -98,10 +72,6 @@ ! !SERVERS: ! - listen m3ua 2905 tcp - local-ip 127.0.0.1 - local-ip ::1 - accept-asp-connections dynamic-permitted listen m3ua 2905 local-ip 127.0.0.1 local-ip ::1 diff --git a/stp/testenv_m3ua-tcp.cfg b/stp/testenv_m3ua-tcp.cfg new file mode 100644 index 0000000..37b2338 --- /dev/null +++ b/stp/testenv_m3ua-tcp.cfg @@ -0,0 +1,11 @@ +[testsuite] +program=STP_Tests +config=STP_Tests_M3UA_TCP.cfg + +[stp] +prepare=osmo-config-merge osmo-stp.cfg osmo-stp-m3ua-tcp.confmerge > osmo-stp-m3ua-tcp.cfg +program=osmo-stp -c osmo-stp-m3ua-tcp.cfg +make=libosmo-sigtran +package=osmo-stp libosmocore-utils +copy=osmo-stp.cfg osmo-stp-m3ua-tcp.confmerge +vty_port=4239