pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39641?usp=email )
Change subject: stp: Allow setting up different m3ua_config list by test
......................................................................
stp: Allow setting up different m3ua_config list by test
This is useful, for instance, for tests willing to test dynamic ASPs.
Change-Id: I0a875bac5e9506be9140d5afa28da25bdc99a5a6
---
M stp/STP_Tests_M3UA.ttcn
1 file changed, 101 insertions(+), 71 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/41/39641/1
diff --git a/stp/STP_Tests_M3UA.ttcn b/stp/STP_Tests_M3UA.ttcn
index 0ae854b..195ce81 100644
--- a/stp/STP_Tests_M3UA.ttcn
+++ b/stp/STP_Tests_M3UA.ttcn
@@ -37,14 +37,14 @@
import from STP_Tests_Common all;
-private const integer NR_M3UA := 4; /* number of M3UA clients in ATS */
-private const integer NR_M3UA_SRV := 4; /* number of M3UA servres in ATS */
+private const integer MAX_NR_M3UA := 8; /* Maximum number of M3UA clients+servers in ATS */
modulepar {
/* STP-side IP addresses */
HostList mp_stp_m3ua_ip := { "127.0.0.1", "::1" };
/* local IP addresses */
HostList mp_local_m3ua_ip := { "127.0.0.1", "::1" };
+ /* Clients first, servers afterwards, match mp_m3ua_num_{clients,servers} */
M3uaConfigs mp_m3ua_configs := {
/* as-sender: One ASP within AS */
{
@@ -109,6 +109,10 @@
routing_ctx := 1155
}
};
+ /* number of M3UA clients in ATS */
+ integer mp_m3ua_num_clients := 4;
+ /* number of M3UA servers in ATS */
+ integer mp_m3ua_num_servers := 4;
integer mp_recovery_timeout_msec := 2000;
charstring mp_sccp_service_type := "mtp3_itu";
}
@@ -125,29 +129,32 @@
/* associated routing context */
integer routing_ctx
};
-type record length (NR_M3UA+NR_M3UA_SRV) of M3uaConfig M3uaConfigs;
+type record of M3uaConfig M3uaConfigs;
-private function M3UA_SRV(integer idx) return integer {
- return NR_M3UA+idx;
+private function M3UA_SRV(integer idx) runs on RAW_M3UA_CT return integer {
+ return g_m3ua_num_clients + idx;
}
-private function f_m3ua_cli_config(integer idx) return M3uaConfig {
- if (idx < 0 or idx >= NR_M3UA) {
+private function f_m3ua_cli_config(integer idx) runs on RAW_M3UA_CT return M3uaConfig {
+ if (idx < 0 or idx >= g_m3ua_num_clients) {
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "f_m3ua_cli_config(): unexpected idx");
}
- return mp_m3ua_configs[idx];
+ return g_m3ua_configs[idx];
}
-private function f_m3ua_srv_config(integer idx) return M3uaConfig {
- if (idx < 0 or idx >= NR_M3UA_SRV) {
+private function f_m3ua_srv_config(integer idx) runs on RAW_M3UA_CT return M3uaConfig {
+ if (idx < 0 or idx >= g_m3ua_num_servers) {
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "f_m3ua_srv_config(): unexpected idx");
}
- return mp_m3ua_configs[M3UA_SRV(idx)];
+ return g_m3ua_configs[M3UA_SRV(idx)];
}
type component RAW_M3UA_CT extends Test_CT {
- port M3UA_CODEC_PT M3UA[NR_M3UA+NR_M3UA_SRV];
- var integer g_m3ua_conn_id[NR_M3UA+NR_M3UA_SRV];
+ port M3UA_CODEC_PT M3UA[MAX_NR_M3UA];
+ var M3uaConfigs g_m3ua_configs;
+ var integer g_m3ua_num_clients;
+ var integer g_m3ua_num_servers;
+ var integer g_m3ua_conn_id[MAX_NR_M3UA];
}
private template PortEvent tr_ConnOpened := {
@@ -170,7 +177,7 @@
friend function f_M3UA_send(integer idx, template (present) PDU_M3UA msg, integer stream := 0)
runs on RAW_M3UA_CT {
- if (mp_m3ua_configs[idx].use_tcp) {
+ if (g_m3ua_configs[idx].use_tcp) {
M3UA[idx].send(t_M3UA_Send(g_m3ua_conn_id[idx], msg, omit));
} else {
M3UA[idx].send(t_M3UA_Send(g_m3ua_conn_id[idx], msg, stream));
@@ -232,7 +239,7 @@
var Option opt_add_local_addrs;
var OptionList opt_list := {};
var template SocketList opt_add_remote_addrs;
- var M3uaConfig m3cfg := mp_m3ua_configs[i];
+ var M3uaConfig m3cfg := g_m3ua_configs[i];
if (lengthof(mp_local_m3ua_ip) == 0 or lengthof(mp_stp_m3ua_ip) == 0) {
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
@@ -266,7 +273,7 @@
}
friend function f_M3UA_connect_tcp(integer i) runs on RAW_M3UA_CT {
- var M3uaConfig m3cfg := mp_m3ua_configs[i];
+ var M3uaConfig m3cfg := g_m3ua_configs[i];
var Result res;
if (lengthof(mp_local_m3ua_ip) == 0 or lengthof(mp_stp_m3ua_ip) == 0) {
@@ -288,11 +295,11 @@
friend function f_M3UA_close(integer i) runs on RAW_M3UA_CT {
var Result res;
if (g_m3ua_conn_id[i] < 0) {
- log("Not close()ing m3cfg := ", mp_m3ua_configs[i], " (not connected)");
+ log("Not close()ing m3cfg := ", g_m3ua_configs[i], " (not connected)");
/* not connected */
return;
}
- if (mp_m3ua_configs[i].use_tcp) {
+ if (g_m3ua_configs[i].use_tcp) {
res := M3UA_CodecPort_CtrlFunct.f_IPL4_close(M3UA[i], g_m3ua_conn_id[i], {tcp:={}});
} else {
res := M3UA_CodecPort_CtrlFunct.f_IPL4_close(M3UA[i], g_m3ua_conn_id[i], {sctp:=valueof(ts_SCTP)});
@@ -304,7 +311,7 @@
var Result res;
var Option opt_add_local_addrs;
var OptionList opt_list := {};
- var M3uaConfig m3cfg := mp_m3ua_configs[i];
+ var M3uaConfig m3cfg := g_m3ua_configs[i];
if (lengthof(mp_local_m3ua_ip) == 0 ) {
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
@@ -332,12 +339,26 @@
}
}
-friend function f_init_m3ua(boolean ignore_ssnm := true) runs on RAW_M3UA_CT {
+friend function f_init_m3ua(boolean ignore_ssnm := true,
+ template (omit) M3uaConfigs m3ua_configs := omit,
+ integer m3ua_num_clients := 0,
+ integer m3ua_num_servers := 0) runs on RAW_M3UA_CT {
var integer i;
f_init_common();
- for (i := 0; i < NR_M3UA; i:=i+1) {
+ if (isvalue(m3ua_configs)) {
+ g_m3ua_configs := valueof(m3ua_configs);
+ g_m3ua_num_clients := m3ua_num_clients;
+ g_m3ua_num_servers := m3ua_num_servers
+ } else {
+ g_m3ua_configs := mp_m3ua_configs;
+ g_m3ua_num_clients := mp_m3ua_num_clients;
+ g_m3ua_num_servers := mp_m3ua_num_servers;
+ }
+
+
+ for (i := 0; i < g_m3ua_num_clients; i:=i+1) {
map(self:M3UA[i], system:M3UA_CODEC_PT);
}
@@ -346,8 +367,8 @@
activate(as_m3ua_ssnm_ignore());
}
- for (i := 0; i < NR_M3UA; i:=i+1) {
- if (mp_m3ua_configs[i].use_tcp) {
+ for (i := 0; i < g_m3ua_num_clients; i:=i+1) {
+ if (g_m3ua_configs[i].use_tcp) {
f_M3UA_connect_tcp(i);
} else {
f_M3UA_connect_sctp(i);
@@ -360,7 +381,7 @@
log("Clearing M3UA...");
- for (i := 0; i < NR_M3UA; i:=i+1) {
+ for (i := 0; i < g_m3ua_num_clients; i:=i+1) {
f_M3UA_close(i);
}
/* Wait for recovery timer to trigger and shutdown all AS: */
@@ -372,14 +393,14 @@
var integer i;
var PortEvent port_evt;
- for (i := NR_M3UA; i < NR_M3UA+NR_M3UA_SRV; i:=i+1) {
+ for (i := g_m3ua_num_clients; i < lengthof(g_m3ua_configs); i:=i+1) {
map(self:M3UA[i], system:M3UA_CODEC_PT);
}
- for (i := NR_M3UA; i < NR_M3UA+NR_M3UA_SRV; i:=i+1) {
+ for (i := g_m3ua_num_clients; i < lengthof(g_m3ua_configs); i:=i+1) {
/* bind + listen */
f_M3UA_listen(i);
}
- for (i := NR_M3UA; i < NR_M3UA+NR_M3UA_SRV; i:=i+1) {
+ for (i := g_m3ua_num_clients; i < lengthof(g_m3ua_configs); i:=i+1) {
/* wait for accept() */
M3UA[i].receive(tr_ConnOpened) -> value port_evt {
g_m3ua_conn_id[i] := port_evt.connOpened.connId;
@@ -495,12 +516,11 @@
/* test whether the STP accepts M3UA DATA without Routing Context IE */
testcase TC_act_rctx_data_no_rctx() runs on RAW_M3UA_CT {
+ f_init_m3ua();
var OCT4 rctx_sender := int2oct(f_m3ua_cli_config(0).routing_ctx, 4);
var OCT4 pc_sender := int2oct(f_m3ua_cli_config(0).point_code, 4);
var OCT4 rctx_receiver := int2oct(f_m3ua_cli_config(1).routing_ctx, 4);
var OCT4 pc_receiver := int2oct(f_m3ua_cli_config(1).point_code, 4);
-
- f_init_m3ua();
/* bring up the sender specifying a routing context */
f_M3UA_asp_up_act(0, rctx := rctx_sender);
@@ -527,13 +547,14 @@
/* test "traffic-mode override" behavior */
testcase TC_tmt_override() runs on RAW_M3UA_CT {
+
+ f_init_m3ua();
+
var OCT4 rctx_sender := int2oct(f_m3ua_cli_config(0).routing_ctx, 4);
var OCT4 pc_sender := int2oct(f_m3ua_cli_config(0).point_code, 4);
var OCT4 rctx_receiver := int2oct(f_m3ua_cli_config(1).routing_ctx, 4);
var OCT4 pc_receiver := int2oct(f_m3ua_cli_config(1).point_code, 4);
- f_init_m3ua();
-
/* bring up the 'sender' side (single ASP in AS) */
f_M3UA_asp_up_act(0, omit, omit);
@@ -564,13 +585,14 @@
/* test "traffic-mode load-share" behavior */
testcase TC_tmt_loadshare() runs on RAW_M3UA_CT {
+ var integer i;
+
+ f_init_m3ua();
+
var OCT4 rctx_sender := int2oct(f_m3ua_cli_config(0).routing_ctx, 4);
var OCT4 pc_sender := int2oct(f_m3ua_cli_config(0).point_code, 4);
var OCT4 rctx_receiver := int2oct(f_m3ua_cli_config(1).routing_ctx, 4);
var OCT4 pc_receiver := int2oct(f_m3ua_cli_config(1).point_code, 4);
- var integer i;
-
- f_init_m3ua();
/* FIXME: configure the STP via VTY to set traffic-mode */
@@ -590,7 +612,10 @@
/* verify traffic is routed from sender to new receiver */
const integer iter_per_asp := 5;
- var integer num_rx[NR_M3UA] := { 0, 0, 0, 0 };
+ var Integers num_rx := {};
+ for (i := 0; i < g_m3ua_num_clients; i := i + 1) {
+ num_rx := num_rx & {0};
+ }
for (i := 0; i < 2*iter_per_asp; i := i+1) {
var octetstring data := f_rnd_octstring_rnd_len(100);
var template (value) M3UA_Protocol_Data tx_pd;
@@ -617,13 +642,14 @@
/* test "traffic-mode broadcast" behavior */
testcase TC_tmt_broadcast() runs on RAW_M3UA_CT {
+ var integer i;
+
+ f_init_m3ua();
+
var OCT4 rctx_sender := int2oct(f_m3ua_cli_config(0).routing_ctx, 4);
var OCT4 pc_sender := int2oct(f_m3ua_cli_config(0).point_code, 4);
var OCT4 rctx_receiver := int2oct(f_m3ua_cli_config(1).routing_ctx, 4);
var OCT4 pc_receiver := int2oct(f_m3ua_cli_config(1).point_code, 4);
- var integer i;
-
- f_init_m3ua();
/* FIXME: configure the STP via VTY to set traffic-mode */
@@ -679,11 +705,11 @@
/* Send RKM registration; expect OK as RCTX does match config */
testcase TC_rkm_reg_static_permitted() runs on RAW_M3UA_CT {
+ f_init_m3ua();
+
var OCT3 dpc := int2oct(f_m3ua_cli_config(0).point_code, 3); // must match config
var OCT4 rctx := int2oct(f_m3ua_cli_config(0).routing_ctx, 4); // must match config
- f_init_m3ua();
-
f_M3UA_send(0, ts_M3UA_REG_REQ({ts_M3UA_rkey(id:='10000099'O, dpc:=dpc, rctx:=rctx)}));
f_M3UA_exp(0, tr_M3UA_REG_RSP({tr_M3UA_reg_res(id:='10000099'O, status:=c_M3UA_REGSTS_SUCCESS,
rctx:=rctx)}));
@@ -850,14 +876,14 @@
/* Test traffic being routed through "server" side STP (M3UA SG), coming back in "client"
* side STP (M3UA ASP) */
testcase TC_clnt_sg_to_asp() runs on RAW_M3UA_CT {
+ f_init_m3ua();
+ f_M3UA_asp_up_act(0);
+
var OCT4 rctx_sender := int2oct(f_m3ua_cli_config(0).routing_ctx, 4);
var OCT4 pc_sender := int2oct(f_m3ua_cli_config(0).point_code, 4);
var OCT4 rctx_receiver := int2oct(f_m3ua_srv_config(0).routing_ctx, 4);
var OCT4 pc_receiver := int2oct(f_m3ua_srv_config(0).point_code, 4);
- f_init_m3ua();
- f_M3UA_asp_up_act(0);
-
f_init_m3ua_srv();
f_M3UA_CLNT_asp_up_act(M3UA_SRV(0), rctx := rctx_receiver);
@@ -872,14 +898,14 @@
/* Test traffic being routed through "client" side STP (M3UA ASP), coming back in "server"
* side STP (M3UA SG) */
testcase TC_clnt_asp_to_sg() runs on RAW_M3UA_CT {
+ f_init_m3ua();
+ f_M3UA_asp_up_act(0);
+
var OCT4 rctx_sender := int2oct(f_m3ua_srv_config(0).routing_ctx, 4);
var OCT4 pc_sender := int2oct(f_m3ua_srv_config(0).point_code, 4);
var OCT4 rctx_receiver := int2oct(f_m3ua_cli_config(0).routing_ctx, 4);
var OCT4 pc_receiver := int2oct(f_m3ua_cli_config(0).point_code, 4);
- f_init_m3ua();
- f_M3UA_asp_up_act(0);
-
f_init_m3ua_srv();
f_M3UA_CLNT_asp_up_act(M3UA_SRV(0), rctx := rctx_sender);
@@ -893,15 +919,15 @@
/* Test traffic being routed through "server" side STP (M3UA SG), coming back in "client"
* side STP (M3UA ASP) which has no routing context set */
testcase TC_clnt_sg_to_asp_norctx() runs on RAW_M3UA_CT {
+ /* activate the sender side (ATS is client to STP in SG role) */
+ f_init_m3ua();
+ f_M3UA_asp_up_act(0);
+
var OCT4 rctx_sender := int2oct(f_m3ua_cli_config(0).routing_ctx, 4);
var OCT4 pc_sender := int2oct(f_m3ua_cli_config(0).point_code, 4);
var OCT4 pc_receiver := int2oct(f_m3ua_srv_config(1).point_code, 4);
var OCT4 pc_receiver2 := int2oct(f_m3ua_srv_config(2).point_code, 4);
- /* activate the sender side (ATS is client to STP in SG role) */
- f_init_m3ua();
- f_M3UA_asp_up_act(0);
-
/* activate the receiver side (ATS is server to STP in ASP role) */
f_init_m3ua_srv();
f_M3UA_CLNT_asp_up_act(M3UA_SRV(1), rctx := omit);
@@ -920,15 +946,15 @@
/* Test traffic being routed through "server" side STP (M3UA SG), coming back in "client"
* side STP (M3UA ASP) which has no routing context set */
testcase TC_clnt_asp_to_sg_norctx() runs on RAW_M3UA_CT {
+ /* activate the sender side (ATS is client to STP in SG role) */
+ f_init_m3ua();
+ f_M3UA_asp_up_act(0);
+
var OCT4 rctx_receiver := int2oct(f_m3ua_cli_config(0).routing_ctx, 4);
var OCT4 pc_receiver := int2oct(f_m3ua_cli_config(0).point_code, 4);
var OCT4 pc_sender := int2oct(f_m3ua_srv_config(1).point_code, 4);
var OCT4 pc_sender2 := int2oct(f_m3ua_srv_config(2).point_code, 4);
- /* activate the sender side (ATS is client to STP in SG role) */
- f_init_m3ua();
- f_M3UA_asp_up_act(0);
-
/* activate the receiver side (ATS is server to STP in ASP role) */
f_init_m3ua_srv();
f_M3UA_CLNT_asp_up_act(M3UA_SRV(1), rctx := omit);
@@ -946,13 +972,13 @@
/* Test if ASPAC / ASPIA of one ASP generates DAVA / DUNA on other ASP */
testcase TC_ssnm_aspac_dava_aspia_duna() runs on RAW_M3UA_CT {
- var OCT4 rctx0 := int2oct(f_m3ua_cli_config(0).routing_ctx, 4);
- var integer pc0 := f_m3ua_cli_config(1).point_code;
-
f_init_m3ua(ignore_ssnm := false);
/* activate the first ASP */
f_M3UA_asp_up_act(0);
+ var OCT4 rctx0 := int2oct(f_m3ua_cli_config(0).routing_ctx, 4);
+ var integer pc0 := f_m3ua_cli_config(1).point_code;
+
/* activate the second ASP */
f_M3UA_asp_up_act(1, c_M3UA_TMT_override, omit);
/* expect DAVA for PC of second ASP on first ASP */
@@ -970,8 +996,6 @@
/* Test if DAVA/DUNA sent from SG to ASP-role STP gets forwarded to other ASP */
testcase TC_ssnm_distribution_dava_duna() runs on RAW_M3UA_CT {
- var OCT4 rctx0 := int2oct(f_m3ua_cli_config(0).routing_ctx, 4);
- var OCT4 rctxS0 := int2oct(f_m3ua_srv_config(0).routing_ctx, 4);
/* some random point code whose availability we advertise */
var template (value) M3UA_Point_Code adv_pc := ts_M3UA_PC(1234, 0);
@@ -980,6 +1004,9 @@
/* activate the first ASP */
f_M3UA_asp_up_act(0);
+ var OCT4 rctx0 := int2oct(f_m3ua_cli_config(0).routing_ctx, 4);
+ var OCT4 rctxS0 := int2oct(f_m3ua_srv_config(0).routing_ctx, 4);
+
/* activate SG-role ASP (ASP on STP) */
f_init_m3ua_srv();
f_M3UA_CLNT_asp_up_act(M3UA_SRV(0), rctx := rctxS0);
@@ -997,8 +1024,6 @@
/* Test if DAVA/DUNA sent from SG to ASP-role STP gets forwarded to other ASP */
testcase TC_ssnm_distribution_dava_duna_multipc() runs on RAW_M3UA_CT {
- var OCT4 rctx0 := int2oct(f_m3ua_cli_config(0).routing_ctx, 4);
- var OCT4 rctxS0 := int2oct(f_m3ua_srv_config(0).routing_ctx, 4);
/* some random point code whose availability we advertise */
var template (value) M3UA_Point_Codes adv_pcs := { ts_M3UA_PC(1234, 0), ts_M3UA_PC(5678, 0) };
@@ -1007,6 +1032,9 @@
/* activate the first ASP */
f_M3UA_asp_up_act(0);
+ var OCT4 rctx0 := int2oct(f_m3ua_cli_config(0).routing_ctx, 4);
+ var OCT4 rctxS0 := int2oct(f_m3ua_srv_config(0).routing_ctx, 4);
+
/* activate SG-role ASP (ASP on STP) */
f_init_m3ua_srv();
f_M3UA_CLNT_asp_up_act(M3UA_SRV(0), rctx := rctxS0);
@@ -1024,8 +1052,6 @@
/* Test if DUPU sent from SG to ASP-role STP gets forwarded to other ASP */
testcase TC_ssnm_distribution_dupu() runs on RAW_M3UA_CT {
- var OCT4 rctx0 := int2oct(f_m3ua_cli_config(0).routing_ctx, 4);
- var OCT4 rctxS0 := int2oct(f_m3ua_srv_config(0).routing_ctx, 4);
/* some random point code whose availability we advertise */
var template (value) M3UA_Point_Code adv_pc := ts_M3UA_PC(1234, 0);
@@ -1034,6 +1060,9 @@
/* activate the first ASP */
f_M3UA_asp_up_act(0);
+ var OCT4 rctx0 := int2oct(f_m3ua_cli_config(0).routing_ctx, 4);
+ var OCT4 rctxS0 := int2oct(f_m3ua_srv_config(0).routing_ctx, 4);
+
/* activate SG-role ASP (ASP on STP) */
f_init_m3ua_srv();
f_M3UA_CLNT_asp_up_act(M3UA_SRV(0), rctx := rctxS0);
@@ -1046,8 +1075,6 @@
/* Test if SCON sent from SG to ASP-role STP gets forwarded to other ASP */
testcase TC_ssnm_distribution_scon() runs on RAW_M3UA_CT {
- var OCT4 rctx0 := int2oct(f_m3ua_cli_config(0).routing_ctx, 4);
- var OCT4 rctxS0 := int2oct(f_m3ua_srv_config(0).routing_ctx, 4);
/* some random point code whose availability we advertise */
var template (value) M3UA_Point_Code adv_pc := ts_M3UA_PC(1234, 0);
@@ -1056,6 +1083,9 @@
/* activate the first ASP */
f_M3UA_asp_up_act(0);
+ var OCT4 rctx0 := int2oct(f_m3ua_cli_config(0).routing_ctx, 4);
+ var OCT4 rctxS0 := int2oct(f_m3ua_srv_config(0).routing_ctx, 4);
+
/* activate SG-role ASP (ASP on STP) */
f_init_m3ua_srv();
f_M3UA_CLNT_asp_up_act(M3UA_SRV(0), rctx := rctxS0);
@@ -1189,30 +1219,30 @@
}
private function f_TC_m3ua_tcp(integer idx_a, integer idx_b) runs on RAW_M3UA_CT {
- var M3uaConfig cfg_a := mp_m3ua_configs[idx_a];
- var M3uaConfig cfg_b := mp_m3ua_configs[idx_b];
+ 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 < NR_M3UA) {
+ 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 < NR_M3UA) {
+ 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 >= NR_M3UA), 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
+ * 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
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39641?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: I0a875bac5e9506be9140d5afa28da25bdc99a5a6
Gerrit-Change-Number: 39641
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Attention is currently required from: laforge.
falconia has posted comments on this change by falconia. ( https://gerrit.osmocom.org/c/libosmo-abis/+/39623?usp=email )
Change subject: rtp2trau HR: remove broken TRAU-16k-UL support
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
> Since you originally wrote this TRAU<->RTP code in 2020 and since you chose back then to implement H […]
Upon further thought, I can produce a blind (no testing) patch that would bring HR-16k in line with HR-8k, for both DL and UL. But I am not going to implement unit tests for HR-16k format if there are no actual BTS that use it. Basically, either have code present (but untested) for HR-16k that matches the actually used (exercised, tested) HR-8k logic, or remove it - I am fine either way, and since I am not the project owner here, I'll follow those who are.
I am going to mark the present patch as WIP, then submit an alternative patch that brings HR-16k in line with HR-8k. Then both patches will be here in Gerrit, and you higher-ups can decide which one you would rather merge.
Unless someone shows me a counterexample, I am going to *assume* that the 16 kbit/s option in GSM 08.61 is a paper-only spec that was *never* implemented in physical reality by any GSM BSS vendor.
--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/39623?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: If50036c4de9a11db524abffcd87d053878104982
Gerrit-Change-Number: 39623
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Thu, 27 Feb 2025 18:32:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: falconia <falcon(a)freecalypso.org>
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Attention is currently required from: pespin.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmo-sigtran/+/39638?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Verified-1 by Jenkins Builder
Change subject: m3ua: Log Tx NOTIFY msg
......................................................................
m3ua: Log Tx NOTIFY msg
Change-Id: Iae3f0922bd924e1472d551c8a3144b203da21f79
---
M src/m3ua.c
M src/xua_as_fsm.c
M src/xua_internal.h
3 files changed, 24 insertions(+), 14 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/38/39638/2
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/39638?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: Iae3f0922bd924e1472d551c8a3144b203da21f79
Gerrit-Change-Number: 39638
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/39639?usp=email )
Change subject: xua_rkm: Make sure existing AS gets added in list to receive ASP-INACTIVE.ind event
......................................................................
xua_rkm: Make sure existing AS gets added in list to receive ASP-INACTIVE.ind event
Eg. if a 2nd ASP tries to register against a given AS (RFC 4666 5.1.3),
it should still update the AS to tell it the ASP is in ASP-INACTIVE
state. This way depending on traffic mode, the AS state may change as
well.
Change-Id: I85948ab98623a8a53521eb2d2e84244011b39a93
---
M src/xua_rkm.c
1 file changed, 18 insertions(+), 11 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/39/39639/1
diff --git a/src/xua_rkm.c b/src/xua_rkm.c
index dd07db2..f616a3a 100644
--- a/src/xua_rkm.c
+++ b/src/xua_rkm.c
@@ -221,6 +221,14 @@
as = osmo_ss7_as_find_by_rctx(asp->inst, rctx);
if (as) {
LOGPASP(asp, DLSS7, LOGL_NOTICE, "RKM: Found existing AS for RCTX %u\n", rctx);
+ /* Early return before allocating stuff if no space left: */
+ if (*nas_idx >= max_nas_idx) {
+ LOGPASP(asp, DLSS7, LOGL_ERROR, "RKM: not enough room for newly assigned AS (max %u AS)\n",
+ max_nas_idx+1);
+ msgb_append_reg_res(resp, rk_id, M3UA_RKM_REG_ERR_INSUFF_RESRC, 0);
+ return -1;
+ }
+
if (as->cfg.routing_key.pc != dpc) {
LOGPASP(asp, DLSS7, LOGL_ERROR, "RKM: DPC doesn't match, rejecting AS (%u != %u)\n",
as->cfg.routing_key.pc, dpc);
@@ -244,6 +252,14 @@
as->cfg.mode_set_by_peer = true;
}
} else if (asp->inst->cfg.permit_dyn_rkm_alloc) {
+ /* Early return before allocating stuff if no space left: */
+ if (*nas_idx >= max_nas_idx) {
+ LOGPASP(asp, DLSS7, LOGL_ERROR, "RKM: not enough room for newly assigned AS (max %u AS)\n",
+ max_nas_idx+1);
+ msgb_append_reg_res(resp, rk_id, M3UA_RKM_REG_ERR_INSUFF_RESRC, 0);
+ return -1;
+ }
+
/* Create an AS for this routing key */
snprintf(namebuf, sizeof(namebuf), "as-rkm-%u", rctx);
as = osmo_ss7_as_find_or_create(asp->inst, namebuf, OSMO_SS7_ASP_PROT_M3UA);
@@ -272,17 +288,6 @@
msgb_append_reg_res(resp, rk_id, M3UA_RKM_REG_ERR_CANT_SUPP_UNQ_RT, 0);
return -1;
}
-
- /* append to list of newly assigned as */
- if (*nas_idx >= max_nas_idx) {
- ss7_route_destroy(rt);
- osmo_ss7_as_destroy(as);
- LOGPASP(asp, DLSS7, LOGL_ERROR, "RKM: not enough room for newly assigned AS (max %u AS)\n",
- max_nas_idx+1);
- msgb_append_reg_res(resp, rk_id, M3UA_RKM_REG_ERR_INSUFF_RESRC, 0);
- return -1;
- }
- newly_assigned_as[(*nas_idx)++] = as;
} else {
/* not permitted to create dynamic RKM entries */
LOGPASP(asp, DLSS7, LOGL_NOTICE, "RKM: RCTX %u not found in configuration, and "
@@ -294,6 +299,8 @@
/* Success: Add just-create AS to connected ASP + report success */
osmo_ss7_as_add_asp(as, asp->cfg.name);
msgb_append_reg_res(resp, rk_id, M3UA_RKM_REG_SUCCESS, rctx);
+ /* append to list of newly assigned as */
+ newly_assigned_as[(*nas_idx)++] = as;
return 0;
}
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/39639?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: I85948ab98623a8a53521eb2d2e84244011b39a93
Gerrit-Change-Number: 39639
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
falconia has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/39622?usp=email )
Change subject: rtp2trau HR: add support for TRAU-8k-UL frame output
......................................................................
rtp2trau HR: add support for TRAU-8k-UL frame output
When osmo_rtp2trau() function is used to pass traffic to an E1 BTS,
it only needs to generate TRAU-DL frames, not TRAU-UL. OTOH,
ability to generate TRAU-UL frames is needed for TFO, i.e., for
software implementation of TFO-capable speech transcoders.
osmo_rtp2trau() already supports TRAU-UL frame output for FR and
EFR codecs, but not for HR codec in TRAU-8k framing - add the
missing support. (Out of the two possible TRAU frame formats for
GSM-HR codec, TFO always uses TRAU-8k format.)
Change-Id: I288cfa7d467125f7732ef1d0ef83b933e41da536
---
M src/trau/trau_rtp_conv.c
M tests/Makefile.am
M tests/testsuite.at
A tests/trau_conv/hr_speech_invsid_bits.hex
A tests/trau_conv/hr_speech_twts002.hex
A tests/trau_conv/rtp2trau_hr_ul1.ok
A tests/trau_conv/rtp2trau_hr_ul2.ok
A tests/trau_conv/rtp2trau_hr_ul3.ok
8 files changed, 241 insertions(+), 11 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
falconia: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/src/trau/trau_rtp_conv.c b/src/trau/trau_rtp_conv.c
index 328221e..d5ac1fa 100644
--- a/src/trau/trau_rtp_conv.c
+++ b/src/trau/trau_rtp_conv.c
@@ -756,7 +756,7 @@
return 0;
}
-static int rtp2trau_hr8(struct osmo_trau_frame *tf, const uint8_t *data, size_t data_len)
+static int rtp2trau_hr8_dl(struct osmo_trau_frame *tf, const uint8_t *data, size_t data_len)
{
/* accept both TS 101 318 and RFC 5993 payloads */
switch (data_len) {
@@ -773,12 +773,6 @@
return -EINVAL;
}
- /* FIXME: implement TRAU-UL frame generation if and when
- * someone actually needs it in a program that uses
- * this library. */
- if (tf->dir != OSMO_TRAU_DIR_DL)
- return -ENOTSUP;
-
tf->type = OSMO_TRAU8_SPEECH;
/* C1..C5 */
@@ -819,6 +813,130 @@
return 0;
}
+/* compute the odd parity bit of the given input bit sequence */
+static ubit_t compute_odd_parity(const ubit_t *in, unsigned int num_bits)
+{
+ int i;
+ unsigned int sum = 0;
+
+ for (i = 0; i < num_bits; i++) {
+ if (in[i])
+ sum++;
+ }
+ return !(sum & 1);
+}
+
+static int rtp2trau_hr8_ul(struct osmo_trau_frame *tf, const uint8_t *data, size_t data_len)
+{
+ uint8_t ft, xc1_4;
+ bool data_bits_req, have_taf;
+
+ /* In TRAU-UL direction we require/expect TW-TS-002 RTP payload format;
+ * RFC 5993 is also accepted because it is a subset of TW-TS-002.
+ * TS 101 318 input is not supported for TRAU-UL output! */
+ if (data_len < 1)
+ return -EINVAL;
+ ft = data[0] >> 4;
+ switch (ft) {
+ case FT_GOOD_SPEECH:
+ xc1_4 = 0;
+ data_bits_req = true;
+ have_taf = false;
+ break;
+ case FT_INVALID_SID:
+ xc1_4 = 4;
+ data_bits_req = false;
+ have_taf = true;
+ break;
+ case FT_GOOD_SID:
+ xc1_4 = 1;
+ data_bits_req = true;
+ have_taf = false;
+ break;
+ case FT_BFI_WITH_DATA:
+ xc1_4 = 6;
+ data_bits_req = true;
+ have_taf = true;
+ break;
+ case FT_NO_DATA:
+ xc1_4 = 6;
+ data_bits_req = false;
+ have_taf = true;
+ break;
+ default:
+ return -EINVAL;
+ }
+ /* If the frame type is one that includes data bits, the payload length
+ * per RFC 5993 and TW-TS-002 is 15 bytes. If the frame type is one
+ * that does not include data bits, then the payload length per the
+ * same specs is only 1 byte - but we also accept 15-byte payloads
+ * in this case to make life easier for applications that pass the
+ * content of a buffer.
+ *
+ * When we make a TRAU-UL frame from FT=1 or FT=7, we fill all Dn bits
+ * with zeros if we got a short (1 byte) payload. However, if the
+ * application passed us a long (15 byte) payload despite FT being
+ * 1 or 7, we fill Dn bits with application-provided payload.
+ */
+ switch (data_len) {
+ case GSM_HR_BYTES_RTP_RFC5993:
+ break;
+ case 1:
+ if (data_bits_req)
+ return -EINVAL;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ tf->type = OSMO_TRAU8_SPEECH;
+
+ /* C1..C5 */
+ tf->c_bits[0] = 0;
+ tf->c_bits[1] = 0;
+ tf->c_bits[2] = 0;
+ tf->c_bits[3] = 1;
+ tf->c_bits[4] = 0;
+ /* C6..C8: spare bits */
+ memset(tf->c_bits + 5, 1, 3);
+ /* C9 is DTXd */
+ tf->c_bits[8] = (data[0] & 0x08) >> 3;
+
+ /* XC1..XC6 */
+ tf->xc_bits[0] = (xc1_4 >> 3) & 1;
+ tf->xc_bits[1] = (xc1_4 >> 2) & 1;
+ tf->xc_bits[2] = (xc1_4 >> 1) & 1;
+ if (have_taf)
+ tf->xc_bits[3] = (data[0] & 0x01) >> 0;
+ else
+ tf->xc_bits[3] = (xc1_4 >> 0) & 1;
+ tf->xc_bits[4] = (data[0] & 0x02) >> 1; /* UFI */
+ tf->xc_bits[5] = compute_odd_parity(tf->xc_bits, 5);
+
+ memset(&tf->t_bits[0], 1, 2);
+
+ if (data_len > 1)
+ osmo_pbit2ubit(tf->d_bits, data + 1, GSM_HR_BYTES * 8);
+ else
+ memset(tf->d_bits, 0, GSM_HR_BYTES * 8);
+ /* CRC is *not* computed by TRAU frame encoder - we have to do it */
+ osmo_crc8gen_set_bits(&gsm0860_efr_crc3, tf->d_bits, 44, tf->crc_bits);
+
+ return 0;
+}
+
+static int rtp2trau_hr8(struct osmo_trau_frame *tf, const uint8_t *data, size_t data_len)
+{
+ switch (tf->dir) {
+ case OSMO_TRAU_DIR_DL:
+ return rtp2trau_hr8_dl(tf, data, data_len);
+ case OSMO_TRAU_DIR_UL:
+ return rtp2trau_hr8_ul(tf, data, data_len);
+ default:
+ return -EINVAL;
+ }
+}
+
/* TS 48.060 Section 5.5.1.1.2 */
static int rtp2trau_efr(struct osmo_trau_frame *tf, const uint8_t *data, size_t data_len)
{
@@ -1571,9 +1689,9 @@
* TRAU-UL (TFO) is TW-TS-001 - the basic RTP format of TS 101 318 or
* RFC 3551 lacks the necessary metadata flags.
*
- * - TRAU-UL output for HR codec is not currently implemented; when we do
- * implement it in the future, TW-TS-002 will be required in this path
- * for the same reason as above.
+ * - For HRv1 codec, for the same reason as above, the only correct RTP
+ * format for conversion to TRAU-UL is TW-TS-002. RFC 5993 payloads are
+ * also accepted (because it is a subset of TW-TS-002), but not TS 101 318.
*
* - TRAU-UL output for CSD 14.4 kbit/s mode is not currently implemented
* (C-bits are always set according to the rules for TRAU-DL) - but the
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4645b7e..73341a2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -99,13 +99,15 @@
trau_conv/fr_speech_basic.hex trau_conv/fr_speech_twts001_good.hex \
trau_conv/fr_speech_twts001_mix.hex \
trau_conv/hr_speech_rfc5993.hex trau_conv/hr_speech_ts101318.hex \
+ trau_conv/hr_speech_twts002.hex trau_conv/hr_speech_invsid_bits.hex \
trau_conv/rtp2trau_efr_dl1.ok trau_conv/rtp2trau_efr_dl2.ok \
trau_conv/rtp2trau_efr_ul1.ok trau_conv/rtp2trau_efr_ul2.ok \
trau_conv/rtp2trau_efr_ul3.ok \
trau_conv/rtp2trau_fr_dl1.ok trau_conv/rtp2trau_fr_dl2.ok \
trau_conv/rtp2trau_fr_ul1.ok trau_conv/rtp2trau_fr_ul2.ok \
trau_conv/rtp2trau_fr_ul3.ok \
- trau_conv/rtp2trau_hr_dl.ok \
+ trau_conv/rtp2trau_hr_dl.ok trau_conv/rtp2trau_hr_ul1.ok \
+ trau_conv/rtp2trau_hr_ul2.ok trau_conv/rtp2trau_hr_ul3.ok \
trau_conv/trau16_efr.in trau_conv/trau16_efr_std.ok \
trau_conv/trau16_efr_twts001.ok \
trau_conv/trau16_fr.in trau_conv/trau16_fr_std.ok \
diff --git a/tests/testsuite.at b/tests/testsuite.at
index a5cf070..b3c2764 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -162,3 +162,21 @@
cat $abs_srcdir/trau_conv/rtp2trau_hr_dl.ok > expout
AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/hr_speech_rfc5993.hex hr dl], [0], [expout], [ignore])
AT_CLEANUP
+
+AT_SETUP([rtp2trau_hr_ul1])
+AT_KEYWORDS([rtp2trau_hr_ul1])
+cat $abs_srcdir/trau_conv/rtp2trau_hr_ul1.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/hr_speech_rfc5993.hex hr ul], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_hr_ul2])
+AT_KEYWORDS([rtp2trau_hr_ul2])
+cat $abs_srcdir/trau_conv/rtp2trau_hr_ul2.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/hr_speech_twts002.hex hr ul], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_hr_ul3])
+AT_KEYWORDS([rtp2trau_hr_ul3])
+cat $abs_srcdir/trau_conv/rtp2trau_hr_ul3.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/hr_speech_invsid_bits.hex hr ul], [0], [expout], [ignore])
+AT_CLEANUP
diff --git a/tests/trau_conv/hr_speech_invsid_bits.hex b/tests/trau_conv/hr_speech_invsid_bits.hex
new file mode 100644
index 0000000..3ac5172
--- /dev/null
+++ b/tests/trau_conv/hr_speech_invsid_bits.hex
@@ -0,0 +1,14 @@
+# This TW-TS-005 hex file contains an input to osmo_rtp2trau() for GSM-HR
+# codec that is *not* a valid RTP payload per TW-TS-002: an invalid SID
+# frame for conversion to TRAU-UL that begins as defined in TW-TS-002
+# (FT=1 to signify invalid SID), but then contrary to the spec, does
+# include the payload data bits. Such concoction is not valid in RTP
+# flight between network elements, but osmo_rtp2trau() supports such
+# extended usage in order to allow TFO applications to set the fill bit
+# pattern in the TRAU-UL frame to something other than all zeros.
+#
+# In the present example, this fill bit pattern consists of R0+LPC
+# parameters (33 bits) from a valid SID frame, followed by alternating
+# 1s and 0s in the 79-bit SID field.
+
+1000D9EA65D5555555555555555555
diff --git a/tests/trau_conv/hr_speech_twts002.hex b/tests/trau_conv/hr_speech_twts002.hex
new file mode 100644
index 0000000..e0e6321
--- /dev/null
+++ b/tests/trau_conv/hr_speech_twts002.hex
@@ -0,0 +1,43 @@
+# This hex file (TW-TS-005 Annex B format) contains some RTP payloads for
+# GSM-HR codec, using the super-5993 RTP payload format of TW-TS-002,
+# semantically corresponding to the uplink direction of a GSM call leg.
+#
+# The present example contains a mix of good and bad frames, the same kind
+# of mix that can be represented in a TRAU-UL frame stream. This example
+# has been constructed by hand: some frames were taken from GSM 06.07 test
+# sequences and then tweaked, other are outright concoctions. The setting
+# of DTXd bit is also exercised.
+
+# good speech frame (DHF)
+000371AF61C8F2802531C000000000
+
+# good speech frame (regular)
+00B77916FC7D902F9372B569F5D17F
+# same with TAF
+01B77916FC7D902F9372B569F5D17F
+# same with UFI
+02B77916FC7D902F9372B569F5D17F
+
+# valid SID frame (first SID from dtx06.cod)
+2000D9EA65FFFFFFFFFFFFFFFFFFFF
+# same with TAF
+2100D9EA65FFFFFFFFFFFFFFFFFFFF
+# same with UFI
+2200D9EA65FFFFFFFFFFFFFFFFFFFF
+
+# BFI with data
+608FE9B77000000000000000000000
+# same with TAF
+618FE9B77000000000000000000000
+
+# short TW-TS-002 payloads (ToC octet only)
+10 # invalid SID frame
+11 # same with TAF
+13 # TAF+UFI
+70 # BFI-no-data
+71 # same with TAF
+
+# some of these same frames with DTXd=1
+08B77916FC7D902F9372B569F5D17F
+2800D9EA65FFFFFFFFFFFFFFFFFFFF
+688FE9B77000000000000000000000
diff --git a/tests/trau_conv/rtp2trau_hr_ul1.ok b/tests/trau_conv/rtp2trau_hr_ul1.ok
new file mode 100644
index 0000000..1fd3f3b
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_hr_ul1.ok
@@ -0,0 +1,17 @@
+00884486f1d7d8b98ff2c089a69c8080808080bb
+00884486f1d7d8b98ff2c089a69c8080808080bb
+0088469fe9dbdc8080d0808080808080808080bb
+0088469fe3eedf90dd9c9dddc7f193a9e5c587bb
+008845fef4fd9ba986ddabfceac589d38ab3febb
+008846bfe3eedab7e4aed7eb88b4a4a4f997ccfb
+008846eef98bbf8fd9a097e4eeababa7ebd1bffb
+00884486f1d7d8b98ff2c089a69c8080808080bb
+00884486f1d7d8b98ff2c089a69c8080808080bb
+00884481d9f599b9c9cce0b8ccb6c099e9f1f6fb
+00884481d9f599b18c9df0b0cdb68099d9f5f6fb
+00884481d9f599b18c9df0b2cdb28099d9f5f6fb
+00884481d9f599b18c9df0b2cdb28099d9f5f6fb
+00884481d9f599b18c9df0b2cdb28099d9f5f6fb
+00884481d9f599b18c9df0b2cdb28099d9f5f6fb
+00884481d9f599b18c9df0b2cdb28099d9f5f6fb
+00885081d9f599bffffffffffffffffffffffffb
diff --git a/tests/trau_conv/rtp2trau_hr_ul2.ok b/tests/trau_conv/rtp2trau_hr_ul2.ok
new file mode 100644
index 0000000..01ba3e4
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_hr_ul2.ok
@@ -0,0 +1,17 @@
+00884486f1d7d8b98ff2c089a69c8080808080bb
+008846eef98bbf8fd9a097e4eeababa7ebd1bffb
+008846eef98bbf8fd9a097e4eeababa7ebd1bffb
+00884aeef98bbf8fd9a097e4eeababa7ebd1bffb
+00885081d9f599bffffffffffffffffffffffffb
+00885081d9f599bffffffffffffffffffffffffb
+00885c81d9f599bffffffffffffffffffffffffb
+0089669fe9dbdc8080d0808080808080808080bb
+0089729fe9dbdc8080d0808080808080808080bb
+008940808080808080f0808080808080808080bb
+008954808080808080f0808080808080808080bb
+008958808080808080f0808080808080808080bb
+008964808080808080f0808080808080808080bb
+008970808080808080f0808080808080808080bb
+008846eef98bbf8fd9a097e4eeababa7ebd1bfff
+00885081d9f599bfffffffffffffffffffffffff
+0089669fe9dbdc8080d0808080808080808080bf
diff --git a/tests/trau_conv/rtp2trau_hr_ul3.ok b/tests/trau_conv/rtp2trau_hr_ul3.ok
new file mode 100644
index 0000000..a6d657c
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_hr_ul3.ok
@@ -0,0 +1 @@
+00894081d9f599bad5a5aad5aad5aad5aad5aafb
--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/39622?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I288cfa7d467125f7732ef1d0ef83b933e41da536
Gerrit-Change-Number: 39622
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
falconia has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/39621?usp=email )
Change subject: tests: add unit tests for osmo_rtp2trau()
......................................................................
tests: add unit tests for osmo_rtp2trau()
The suite of unit tests added in this patch exercises osmo_rtp2trau()
followed by osmo_trau_frame_encode() for the following combinations
of speech codec and TRAU frame type:
* FR and EFR codecs, TRAU-16k frames, both DL and UL
* HRv1 codec, TRAU-8k format, DL only
(RTP->TRAU conversion for HRv1 does not currenty support TRAU-UL
output.)
All output TRAU frames contained in rtp2trau_*.ok files (expected
output for unit tests) have been manually checked with Themyscira
decoding utilities trau-parse-hex (16k) and trau-hr-dump-hex (8k);
these utilities in turn were developed to analyze TRAU frame streams
captured from historical BTS and TRAU equipment, hence the chain of
truth reference comparison is traceable to pre-existing historical
hardware implementations of GSM 08.60 and 08.61 specs.
Change-Id: Ia5ca8af6bd3a899253bbcc718b70e43f2265b495
---
M .gitignore
M tests/Makefile.am
M tests/testsuite.at
A tests/trau_conv/efr_speech_basic.hex
A tests/trau_conv/efr_speech_twts001_good.hex
A tests/trau_conv/efr_speech_twts001_mix.hex
A tests/trau_conv/fr_speech_basic.hex
A tests/trau_conv/fr_speech_twts001_good.hex
A tests/trau_conv/fr_speech_twts001_mix.hex
A tests/trau_conv/hr_speech_rfc5993.hex
A tests/trau_conv/hr_speech_ts101318.hex
A tests/trau_conv/rtp2trau_efr_dl1.ok
A tests/trau_conv/rtp2trau_efr_dl2.ok
A tests/trau_conv/rtp2trau_efr_ul1.ok
A tests/trau_conv/rtp2trau_efr_ul2.ok
A tests/trau_conv/rtp2trau_efr_ul3.ok
A tests/trau_conv/rtp2trau_fr_dl1.ok
A tests/trau_conv/rtp2trau_fr_dl2.ok
A tests/trau_conv/rtp2trau_fr_ul1.ok
A tests/trau_conv/rtp2trau_fr_ul2.ok
A tests/trau_conv/rtp2trau_fr_ul3.ok
A tests/trau_conv/rtp2trau_gen.c
A tests/trau_conv/rtp2trau_hr_dl.ok
A tests/trau_conv/tw5reader.c
A tests/trau_conv/tw5reader.h
25 files changed, 735 insertions(+), 0 deletions(-)
Approvals:
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
falconia: Looks good to me, approved
diff --git a/.gitignore b/.gitignore
index dbe50db..80e6834 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,6 +43,7 @@
tests/raa_prime/test_dec
tests/raa_prime/test_enc
tests/trau_pcu_ericsson/trau_pcu_ericsson_test
+tests/trau_conv/rtp2trau_gen
tests/trau_conv/trau16_to_rtp
tests/trau_conv/trau2rtp_gen
tests/trau_sync/trau_sync_test
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4abfc4a..4645b7e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -8,6 +8,7 @@
ipa_recv/ipa_recv_test \
raa_prime/test_dec \
raa_prime/test_enc \
+ trau_conv/rtp2trau_gen \
trau_conv/trau16_to_rtp \
trau_conv/trau2rtp_gen \
trau_sync/trau_sync_test \
@@ -52,6 +53,9 @@
rtp_test_rtp_test_SOURCES = rtp_test/rtp_test.c
rtp_test_rtp_test_LDADD = $(TRAU_LA_LIBS)
+trau_conv_rtp2trau_gen_SOURCES = trau_conv/rtp2trau_gen.c trau_conv/tw5reader.c
+trau_conv_rtp2trau_gen_LDADD = $(TRAU_LA_LIBS)
+
trau_conv_trau16_to_rtp_SOURCES = trau_conv/trau16_to_rtp.c
trau_conv_trau16_to_rtp_LDADD = $(TRAU_LA_LIBS)
@@ -64,6 +68,8 @@
trau_pcu_ericsson_trau_pcu_ericsson_test_SOURCES = trau_pcu_ericsson/trau_pcu_ericsson_test.c
trau_pcu_ericsson_trau_pcu_ericsson_test_LDADD = $(TRAU_LA_LIBS)
+noinst_HEADERS = trau_conv/tw5reader.h
+
# boilerplate for the tests
# The `:;' works around a Bash 3.2 bug when the output is not writeable.
$(srcdir)/package.m4: $(top_srcdir)/configure.ac
@@ -88,6 +94,18 @@
ipa_recv/ipa_recv_test.ok \
raa_prime/d144-ul-input.asc raa_prime/nokia-tcsm2-atrau.hex \
rtp_test/rtp_test.ok \
+ trau_conv/efr_speech_basic.hex trau_conv/efr_speech_twts001_good.hex \
+ trau_conv/efr_speech_twts001_mix.hex \
+ trau_conv/fr_speech_basic.hex trau_conv/fr_speech_twts001_good.hex \
+ trau_conv/fr_speech_twts001_mix.hex \
+ trau_conv/hr_speech_rfc5993.hex trau_conv/hr_speech_ts101318.hex \
+ trau_conv/rtp2trau_efr_dl1.ok trau_conv/rtp2trau_efr_dl2.ok \
+ trau_conv/rtp2trau_efr_ul1.ok trau_conv/rtp2trau_efr_ul2.ok \
+ trau_conv/rtp2trau_efr_ul3.ok \
+ trau_conv/rtp2trau_fr_dl1.ok trau_conv/rtp2trau_fr_dl2.ok \
+ trau_conv/rtp2trau_fr_ul1.ok trau_conv/rtp2trau_fr_ul2.ok \
+ trau_conv/rtp2trau_fr_ul3.ok \
+ trau_conv/rtp2trau_hr_dl.ok \
trau_conv/trau16_efr.in trau_conv/trau16_efr_std.ok \
trau_conv/trau16_efr_twts001.ok \
trau_conv/trau16_fr.in trau_conv/trau16_fr_std.ok \
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 291d47d..a5cf070 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -90,3 +90,75 @@
cat $abs_srcdir/trau_conv/trau2rtp_hr_twts002.ok > expout
AT_CHECK([$abs_top_builddir/tests/trau_conv/trau2rtp_gen -8 -x $abs_srcdir/trau_conv/trau2rtp_hr.in], [0], [expout], [ignore])
AT_CLEANUP
+
+AT_SETUP([rtp2trau_fr_dl1])
+AT_KEYWORDS([rtp2trau_fr_dl1])
+cat $abs_srcdir/trau_conv/rtp2trau_fr_dl1.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/fr_speech_basic.hex fr dl], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_fr_dl2])
+AT_KEYWORDS([rtp2trau_fr_dl2])
+cat $abs_srcdir/trau_conv/rtp2trau_fr_dl2.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/fr_speech_twts001_good.hex fr dl], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_fr_ul1])
+AT_KEYWORDS([rtp2trau_fr_ul1])
+cat $abs_srcdir/trau_conv/rtp2trau_fr_ul1.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/fr_speech_basic.hex fr ul], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_fr_ul2])
+AT_KEYWORDS([rtp2trau_fr_ul2])
+cat $abs_srcdir/trau_conv/rtp2trau_fr_ul2.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/fr_speech_twts001_good.hex fr ul], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_fr_ul3])
+AT_KEYWORDS([rtp2trau_fr_ul3])
+cat $abs_srcdir/trau_conv/rtp2trau_fr_ul3.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/fr_speech_twts001_mix.hex fr ul], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_efr_dl1])
+AT_KEYWORDS([rtp2trau_efr_dl1])
+cat $abs_srcdir/trau_conv/rtp2trau_efr_dl1.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/efr_speech_basic.hex efr dl], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_efr_dl2])
+AT_KEYWORDS([rtp2trau_efr_dl2])
+cat $abs_srcdir/trau_conv/rtp2trau_efr_dl2.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/efr_speech_twts001_good.hex efr dl], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_efr_ul1])
+AT_KEYWORDS([rtp2trau_efr_ul1])
+cat $abs_srcdir/trau_conv/rtp2trau_efr_ul1.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/efr_speech_basic.hex efr ul], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_efr_ul2])
+AT_KEYWORDS([rtp2trau_efr_ul2])
+cat $abs_srcdir/trau_conv/rtp2trau_efr_ul2.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/efr_speech_twts001_good.hex efr ul], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_efr_ul3])
+AT_KEYWORDS([rtp2trau_efr_ul3])
+cat $abs_srcdir/trau_conv/rtp2trau_efr_ul3.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/efr_speech_twts001_mix.hex efr ul], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_hr_dl1])
+AT_KEYWORDS([rtp2trau_hr_dl1])
+cat $abs_srcdir/trau_conv/rtp2trau_hr_dl.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/hr_speech_ts101318.hex hr dl], [0], [expout], [ignore])
+AT_CLEANUP
+
+AT_SETUP([rtp2trau_hr_dl2])
+AT_KEYWORDS([rtp2trau_hr_dl2])
+cat $abs_srcdir/trau_conv/rtp2trau_hr_dl.ok > expout
+AT_CHECK([$abs_top_builddir/tests/trau_conv/rtp2trau_gen $abs_srcdir/trau_conv/hr_speech_rfc5993.hex hr dl], [0], [expout], [ignore])
+AT_CLEANUP
diff --git a/tests/trau_conv/efr_speech_basic.hex b/tests/trau_conv/efr_speech_basic.hex
new file mode 100644
index 0000000..b1dc98a
--- /dev/null
+++ b/tests/trau_conv/efr_speech_basic.hex
@@ -0,0 +1,15 @@
+# This hex file (TW-TS-005 Annex A format) contains some RTP payloads for
+# GSM-EFR codec, using the basic RTP payload format of RFC 3551. The only
+# semantics allowed by this basic RTP payload format are good speech and
+# valid SID frames; the present test sequence exercises both.
+
+# first 5 frames from GSM 06.54 test0.cod: good speech frames,
+# two DHFs followed by 3 regular speech frames
+C085EB490FAAD603E3A18607B0C42C080480558000000000036B0000000000
+C085EB490FAAD603E3A18607B0C42C080480558000000000036B0000000000
+C7D32592D041B69F4C5775FE5FFFB94A89B6823DF4BB5374AC6FD35A26A92D
+C46F83F969C09E106324A86026E8F1B2002A0136F4FF12FDC45A3561608D70
+C6CF4F49D64E98BEE99B42DF0ECF48E02C1801EC92322FE4C07CD56A97C0D0
+
+# frame #71 (0-based numbering) from GSM 06.54 dtx01.cod: valid SID frame
+C286DD29B5806FFFFF80001E3BFFFFE0000800FFFFFF000040FFFCFFC00010
diff --git a/tests/trau_conv/efr_speech_twts001_good.hex b/tests/trau_conv/efr_speech_twts001_good.hex
new file mode 100644
index 0000000..9146be3
--- /dev/null
+++ b/tests/trau_conv/efr_speech_twts001_good.hex
@@ -0,0 +1,34 @@
+# This hex file (TW-TS-005 Annex A format) contains some RTP payloads for
+# GSM-EFR codec, using the extended RTP payload format of TW-TS-001,
+# semantically corresponding to the uplink direction of a GSM call leg.
+#
+# The present example has been synthetically constructed from GSM 06.54
+# test sequence test0.cod (first 24 frames, enough to exercise TAF),
+# exhibiting the scenario of how GSM TCH/EFS UL would look with this
+# sequence in it under conditions of 100% error-free transmission,
+# i.e., no bad, corrupted or FACCH-stolen frames.
+
+E0C085EB490FAAD603E3A18607B0C42C080480558000000000036B0000000000
+E0C085EB490FAAD603E3A18607B0C42C080480558000000000036B0000000000
+E0C7D32592D041B69F4C5775FE5FFFB94A89B6823DF4BB5374AC6FD35A26A92D
+E0C46F83F969C09E106324A86026E8F1B2002A0136F4FF12FDC45A3561608D70
+E0C6CF4F49D64E98BEE99B42DF0ECF48E02C1801EC92322FE4C07CD56A97C0D0
+E0C46F43F93781183456EB245E4D074736045882A8A9FEC728C0ACB4090E3B6D
+E0C6AF4E83A50175B45688815E5D38E258B5F9206D64CEEDE4B62B9D0E6A6D8E
+E0C56ECF6364C1B564A43648227571484D0CE603ECDA8E996034FBB4E64B5CB3
+E0C6AECBB36382156125752CD88D59CDC26E97A32ECDAD5B243A1B75DD6AD88F
+E0C56F510999C278B23386B76AA713CFD60D070530DE0152A4C55CC93032854F
+E0C6AF4F63A502B7560FFB36A2B5D10BFE8C3785EC5026496FC17C1E4C8D248F
+E0C56F4F69375336549EF23661157859F7D6D806B28BDCCE43BDAA9697FCC04C
+E0C6AECF63550376301D108824DD2B1E1C9267072E6CA14017ADDB84A09202AC
+E0C56FC4F935D4963DA918A5250D0C0243B69887F2278593343A0B97F30BB094
+E0C6AF5069E8041AFE322B00E10E4C24538A1788720271A9E24A2C16F52ED90F
+E0C56F4F69464476DE1F957C5D1DB657F45118AC6D32464375422A8F71E2C28E
+E0C6AF4F697584B9316DF2EDA30659669A023809F360299E422E1B9FA699B6D0
+E0C48ECF63850517CA1634951F1DB71144A2672EECF09024ABC21BF3645EDF2F
+E0C6AF4E83850574103F7B4C9CFD1418E16A480B2CFC63CAE0361AA38E02916D
+E0C56F83F90685D665DBCDEDED15F9D9D601088BF302165EAFBA3C5939E5FB72
+E0C56F4F6A37D938405A8056E115FA97AAE0188CAE24EF5B1B420B091B56B90D
+E0C56F4F69458677D6764D8DA30D6F1EC260588D2D0A05C06B363C91F5C64110
+E0C56ECF63A65A7749EEDFAC990D0E91C1678A0DEAC6B0630931FB0C805B6D30
+E1C56FC4F404C7152210F2655D0D98C8C2E5F80E6F19BA804BBE2B1B5D7B7F93
diff --git a/tests/trau_conv/efr_speech_twts001_mix.hex b/tests/trau_conv/efr_speech_twts001_mix.hex
new file mode 100644
index 0000000..ff8bcec
--- /dev/null
+++ b/tests/trau_conv/efr_speech_twts001_mix.hex
@@ -0,0 +1,25 @@
+# This hex file (TW-TS-005 Annex A format) contains some RTP payloads for
+# GSM-EFR codec, using the extended RTP payload format of TW-TS-001,
+# semantically corresponding to the uplink direction of a GSM call leg.
+#
+# The present example contains a mix of good and bad frames, the same
+# kind of mix that can be represented in a TRAU-UL frame stream.
+# This example has been constructed by taking a few frames out of
+# efr_speech_twts001_good.hex and corrupting some of them, turning them
+# into BFIs. The setting of DTXd bit is also exercised.
+
+# DTXd=0
+E0C56F510999C278B23386B76AA713CFD60D070530DE0152A4C55CC93032854F
+E0C6AF4F63A502B7560FFB36A2B5D10BFE8C3785EC5026496FC17C1E4C8D248F
+E2C56F4F69375336549EF23661157859F7D6D806B28BDCCE43BDAA9697FFFFFF
+E0C6AECF63550376301D108824DD2B1E1C9267072E6CA14017ADDB84A09202AC
+E2C56FC4F935D4963DA918A5250D0C0243B69887F2278593343A0B97F3000000
+E2C6AF5069E8041AFE322B00E10E4C24538AAAAAA20271A9E24A2C16F52ED90F
+
+# DTXd=1
+E8C56F510999C278B23386B76AA713CFD60D070530DE0152A4C55CC93032854F
+E8C6AF4F63A502B7560FFB36A2B5D10BFE8C3785EC5026496FC17C1E4C8D248F
+EAC56F4F69375336549EF23661157859F7D6D806B28BDCCE43BDAA9697FFFFFF
+E8C6AECF63550376301D108824DD2B1E1C9267072E6CA14017ADDB84A09202AC
+EAC56FC4F935D4963DA918A5250D0C0243B69887F2278593343A0B97F3000000
+EAC6AF5069E8041AFE322B00E10E4C24538AAAAAA20271A9E24A2C16F52ED90F
diff --git a/tests/trau_conv/fr_speech_basic.hex b/tests/trau_conv/fr_speech_basic.hex
new file mode 100644
index 0000000..d6ee569
--- /dev/null
+++ b/tests/trau_conv/fr_speech_basic.hex
@@ -0,0 +1,19 @@
+# This hex file (TW-TS-005 Annex A format) contains some RTP payloads for
+# GSM-FR codec, using the basic RTP payload format of RFC 3551. The only
+# semantics allowed by this basic RTP payload format are good speech and
+# valid SID frames; the present test sequence exercises both.
+
+# first 4 frames from GSM 06.10 Seq01.cod: good speech frames
+D760A2E177503E681BD129615AB83E5C9CB52BB6B706F9CA56D4F037F7837A86BC
+D96292A5577FB8B75C10E8535D19FB4399B73299398CF96AE516D9D8D5258638C6
+D9E39269CF5FF3F318AF44285FF9469AB5C1DF7F78E35770BB30D91850EDA24E1C
+D8638B28E75F392A23B04AE29D365728A74C63BD36C694A9AE5D59FBD7D4315765
+
+# frame #41 (0-based numbering) from GSM 06.32 good_sp.cod: valid SID frame
+DAE6DB659B00010000000000000100000000000001000000000000010000000000
+
+# fixed silence frame of GSM 06.11
+DAA7AAA51A502038E46DB91B502038E46DB91B502038E46DB91B502038E46DB91B
+
+# decoder homing frame introduced in later versions of GSM 06.10
+D2577A1CDA50004924924924500049249249245000492492492450004923924924
diff --git a/tests/trau_conv/fr_speech_twts001_good.hex b/tests/trau_conv/fr_speech_twts001_good.hex
new file mode 100644
index 0000000..8aa5467
--- /dev/null
+++ b/tests/trau_conv/fr_speech_twts001_good.hex
@@ -0,0 +1,34 @@
+# This hex file (TW-TS-005 Annex A format) contains some RTP payloads for
+# GSM-FR codec, using the extended RTP payload format of TW-TS-001,
+# semantically corresponding to the uplink direction of a GSM call leg.
+#
+# The present example has been synthetically constructed from GSM 06.10
+# test sequence Seq01.cod (first 24 frames, enough to exercise TAF),
+# exhibiting the scenario of how GSM TCH/FS UL would look with this
+# sequence in it under conditions of 100% error-free transmission,
+# i.e., no bad, corrupted or FACCH-stolen frames.
+
+E0D760A2E177503E681BD129615AB83E5C9CB52BB6B706F9CA56D4F037F7837A86BC
+E0D96292A5577FB8B75C10E8535D19FB4399B73299398CF96AE516D9D8D5258638C6
+E0D9E39269CF5FF3F318AF44285FF9469AB5C1DF7F78E35770BB30D91850EDA24E1C
+E0D8638B28E75F392A23B04AE29D365728A74C63BD36C694A9AE5D59FBD7D4315765
+E0D7A0A2E16FB9950C6AF5D56661FA37244DC8D8DD5767D738B35E7D39C6E64E4904
+E0D81FA2E19F79D7F7149226757FD98AEB6DB8DB9FF44AD49148E761FD48E492355F
+E0D85F9AE5A7B9178F48EE199BB7F80CEA6DD45C5FB4F4B8A29CDB7F16AD206B4507
+E0DA208AA60F5BD836EAE64945E17B569DA8AEE057FAAB2A3374265F59B12589ACE1
+E0D8E48AE8D79D1943E44F14ECDD56C3DD0E4C29B938DA84B286BD5DFB41A56B38DF
+E0D89F9AE96760BB2A1BB1B5657F5734B1A2CA8FB93B4E9391C90C9956F98A5B18AF
+E0D81EA2E5E761957644764873DF59594C90E5D57DF946DB8DC3A779170C23A93AE9
+E0D99E92E657B9B6259996510F7FB6F30F6637149F78694B9455DDB8F894F6465A5F
+E0D8E292A91F97F828DDC9ACF85F37B7E42F4C267F58D11689BB215B589F3887C4E5
+E0D91E9AE1DFBBB81A8791C54ED7168E94EA063D7D3888EC6F3A207FD34CDD5EE5C6
+E0D8A38AE91FDDFB38DCCA0F32B919669F8D3D22D916AF6136E09F7DB70CDC4D3724
+E0D82292E8E7DB76EC50F1991DB91A0A73CAB8A499958AEB75BAA9D975F7447AA07C
+E0D8A09AE997BD39569775590CBDF66B10F231595B98F0CC7238E399B6495D155538
+E0DA1E8AE6CF619957DC6D58E25F382C9F715746BCF74F20F207F5D75762E451FA20
+E0D8628AE8DFD7F8B8DD7C45257FF93C9C7DC165BF18A65EAD2EA07B37B9589640E5
+E0D92092A997B759E11D4D69119DF6E760AFB32F7F98F31C71A7237FF9B532824A99
+E0D81FA2E5A7B939BAE0AAC8D4D9757495CD0DEA9DB62317516555DDB47C13E2AB54
+E0D8609AE92779191CF98DA9A4B991E9A1A7A6DD5FD5BE618ACAE39FFAB91B8E38FA
+E0D92192A9575D97236551CD045936CFD08B947F9B59976C2E5A18D9DA26DC7531A6
+E1D9DD8AE6979F1706B48CE55D9AB83517505754D6F93B619308BAD7DA48E38D57C5
diff --git a/tests/trau_conv/fr_speech_twts001_mix.hex b/tests/trau_conv/fr_speech_twts001_mix.hex
new file mode 100644
index 0000000..e6360ff
--- /dev/null
+++ b/tests/trau_conv/fr_speech_twts001_mix.hex
@@ -0,0 +1,25 @@
+# This hex file (TW-TS-005 Annex A format) contains some RTP payloads for
+# GSM-FR codec, using the extended RTP payload format of TW-TS-001,
+# semantically corresponding to the uplink direction of a GSM call leg.
+#
+# The present example contains a mix of good and bad frames, the same kind
+# of mix that can be represented in a TRAU-UL frame stream. This example
+# has been constructed by taking a few frames out of fr_speech_twts001_good.hex
+# and corrupting some of them, turning them into BFIs. The setting of DTXd bit
+# is also exercised.
+
+# DTXd=0
+E0D81FA2E19F79D7F7149226757FD98AEB6DB8DB9FF44AD49148E761FD48E492355F
+E0D85F9AE5A7B9178F48EE199BB7F80CEA6DD45C5FB4F4B8A29CDB7F16AD206B4507
+E2DA208AA60F5BD836EFFF0005E17B569DA8AEEAAAAAAB2A3374265F59B12589ACE1
+E0D8E48AE8D79D1943E44F14ECDD56C3DD0E4C29B938DA84B286BD5DFB41A56B38DF
+E2D89F9AE96760BB2A1BB1B5657F5734B1777777793B4E9391C90C9956F98A5B18AF
+E2D81EA2E5E7619576447641111119594C90E5D57DF946DB8DC3A779170C23A93AE9
+
+# DTXd=1
+E8D81FA2E19F79D7F7149226757FD98AEB6DB8DB9FF44AD49148E761FD48E492355F
+E8D85F9AE5A7B9178F48EE199BB7F80CEA6DD45C5FB4F4B8A29CDB7F16AD206B4507
+EADA208AA60F5BD836EFFF0005E17B569DA8AEEAAAAAAB2A3374265F59B12589ACE1
+E8D8E48AE8D79D1943E44F14ECDD56C3DD0E4C29B938DA84B286BD5DFB41A56B38DF
+EAD89F9AE96760BB2A1BB1B5657F5734B1777777793B4E9391C90C9956F98A5B18AF
+EAD81EA2E5E7619576447641111119594C90E5D57DF946DB8DC3A779170C23A93AE9
diff --git a/tests/trau_conv/hr_speech_rfc5993.hex b/tests/trau_conv/hr_speech_rfc5993.hex
new file mode 100644
index 0000000..1aa4549
--- /dev/null
+++ b/tests/trau_conv/hr_speech_rfc5993.hex
@@ -0,0 +1,28 @@
+# This hex file (TW-TS-005 Annex B format) contains some RTP payloads for
+# GSM-HR codec, using the slightly extended RTP payload format of
+# IETF RFC 5993.
+#
+# The only semantics allowed by TS 101 318 and RFC 5993 RTP payload formats
+# are good speech and valid SID frames; the present test sequence exercises
+# both, using fragments from the official test sequences of GSM 06.07.
+
+# first 7 frames of seq01.cod, converted to RFC 5993 format
+000371AF61C8F2802531C000000000
+000371AF61C8F2802531C000000000
+008FE9B77000000000000000000000
+008FE3DD7C85DC3B763F126A72C50E
+007F74FA6D486D57F3545134C533FC
+009FE3DD69BE4EAFAC4344893C9799
+00B77916FC7D902F9372B569F5D17F
+
+# first 10 frames of dtx06.cod, converted to RFC 5993 format
+000371AF61C8F2802531C000000000
+000371AF61C8F2802531C000000000
+0000D9EA65CC9CC0E263680674F1ED
+0000D9EA6588CDE0C26B60066CF5ED
+0000D9EA6588CDE0CA6B20066CF5ED
+0000D9EA6588CDE0CA6B20066CF5ED
+0000D9EA6588CDE0CA6B20066CF5ED
+0000D9EA6588CDE0CA6B20066CF5ED
+0000D9EA6588CDE0CA6B20066CF5ED
+2000D9EA65FFFFFFFFFFFFFFFFFFFF
diff --git a/tests/trau_conv/hr_speech_ts101318.hex b/tests/trau_conv/hr_speech_ts101318.hex
new file mode 100644
index 0000000..59c87da
--- /dev/null
+++ b/tests/trau_conv/hr_speech_ts101318.hex
@@ -0,0 +1,28 @@
+# This hex file (TW-TS-005 Annex B format) contains some RTP payloads for
+# GSM-HR codec, using the minimal (no metadata) RTP payload format of
+# ETSI TS 101 318.
+#
+# The only semantics allowed by TS 101 318 and RFC 5993 RTP payload formats
+# are good speech and valid SID frames; the present test sequence exercises
+# both, using fragments from the official test sequences of GSM 06.07.
+
+# first 7 frames of seq01.cod, converted to TS 101 318 format
+0371AF61C8F2802531C000000000
+0371AF61C8F2802531C000000000
+8FE9B77000000000000000000000
+8FE3DD7C85DC3B763F126A72C50E
+7F74FA6D486D57F3545134C533FC
+9FE3DD69BE4EAFAC4344893C9799
+B77916FC7D902F9372B569F5D17F
+
+# first 10 frames of dtx06.cod, converted to TS 101 318 format
+0371AF61C8F2802531C000000000
+0371AF61C8F2802531C000000000
+00D9EA65CC9CC0E263680674F1ED
+00D9EA6588CDE0C26B60066CF5ED
+00D9EA6588CDE0CA6B20066CF5ED
+00D9EA6588CDE0CA6B20066CF5ED
+00D9EA6588CDE0CA6B20066CF5ED
+00D9EA6588CDE0CA6B20066CF5ED
+00D9EA6588CDE0CA6B20066CF5ED
+00D9EA65FFFFFFFFFFFFFFFFFFFF
diff --git a/tests/trau_conv/rtp2trau_efr_dl1.ok b/tests/trau_conv/rtp2trau_efr_dl1.ok
new file mode 100644
index 0000000..4cbf398
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_efr_dl1.ok
@@ -0,0 +1,6 @@
+0000e80fc217d6928f95ad609f1d86188f6c9885c080a402aac080008000800eeb00800080008fff
+0000e80fc217d6928f95ad609f1d86188f6c9885c080a402aac080008000800eeb00800080008fff
+0000e80fdf4ccb25d0409b69fa62ddd7ff17fff794a8cdb6811efd2eea6ecaf8efd3ad13aa4bbfff
+0000e80fd1be87f2e9c089e1831992a1c209dd1e9b208153c09bbd3fe25fdc60da35b0b0a35c9fff
+0000e80fdb3d9e93d649e98bf74ced0bbdc3d9e98e02e0c2c0f6a48cc5fccc00fcd5b54bf0348bff
+0000e80fca1bba53b5b086fffffc8000bc0efffffe008042c07fffffe0008411fffcffe0800481ff
diff --git a/tests/trau_conv/rtp2trau_efr_dl2.ok b/tests/trau_conv/rtp2trau_efr_dl2.ok
new file mode 100644
index 0000000..8a77ee1
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_efr_dl2.ok
@@ -0,0 +1,24 @@
+0000e80fc217d6928f95ad609f1d86188f6c9885c080a402aac080008000800eeb00800080008fff
+0000e80fc217d6928f95ad609f1d86188f6c9885c080a402aac080008000800eeb00800080008fff
+0000e80fdf4ccb25d0409b69fa62ddd7ff17fff794a8cdb6811efd2eea6ecaf8efd3ad13aa4bbfff
+0000e80fd1be87f2e9c089e1831992a1c209dd1e9b208153c09bbd3fe25fdc60da35b0b0a35c9fff
+0000e80fdb3d9e93d649e98bf74ced0bbdc3d9e98e02e0c2c0f6a48cc5fccc00fcd5b54bf0348bff
+0000e80fd1bd87f2b7989183a2b7ac91bf93a0e8f360a2c68154aa7fd8e58c19acb484878edbb3ff
+0000e80fdabd9d07a530975ba2b4a205bd97a71ca58bafc8d036d933ddbccb5cab9d87359b63d7ff
+0000e80fd5bb9ec6e4c09b56a521d920c69dae2984d0e732c1f6b6a3d32c8349fbb4f325d72ce3ff
+0000e80fdabb9766e3a0a156892bd4b3b023ab39dc26f4bfd197b36bab64c3849b75eeb5b623e3ff
+0000e80fd5bda21399f8a78b919c9addd4a9e279fd60e83b8298b780aa54cc7adcc99819a153fbff
+0000e80fdabd9ec7a528ab75b07fecdac52dba21bfe8e1bdc2f69409c92dfc1afc1ea646c923efff
+0000e80fd5bd9ed2b74ab365a4f7c8d9c0c5af0b9f7db6c08359a2f799c8bbebaa96cbfeb01383ff
+0000e80fdabb9ec6d518b76380e8c220cab7a563e1c9933883979b28a802faf3db84d04980ab93ff
+0000e80fd5bf89f2b5fac963ed48e294cbc3a180a43bb4c6c3f989e1b266c3948b97f985ec2597ff
+0000e80fdabda0d3e830c1aff191ac03c043c984c538d0bc8439809cb53ca4acac16fa97b643f7ff
+0000e80fd5bd9ed2c648c76df0fcd5f1b8c7b6caff4588c49636cc91c86ed41caa8fb8f1b0a3d7ff
+0000e80fdabd9ed2f590cb938b6fcbb6c7c1cb2ce9a091c2c4f9d80ab3c8a2dc9b9fd34cedb497ff
+0000e80fd23b9ec78520d17cd0b1d254bcc7b6e2944a933ad776bc248495bc349bf3b22fb7cbe3ff
+0000e80fdabd9d078530d74181fbed32babfa2838e16d2428596bf18f95c835c9aa3c701a45ba3ff
+0000e80fd5be87f28698dd66aedeb7b7dbc5bf3b9d60884485f9c085cbd5fbbcbc599cf2fedcc3ff
+0000e80fd5bd9ed4b7d3938482d4815bc2c5bf52faae80c48657893beb63b4148b098dabae43a3ff
+0000e80fd5bd9ed2c588e77db3b2b636c7c3ade3ec2682c6c696c281b80db364bc91fae3904483ff
+0000e80fd5bb9ec7a643a774cf76feb2b343a1d29c16bc52c6f5b1ac8c619303fb0cc02ddb4c93ff
+0000e80fd5bf89e884e8f1529087c995b943b3198c2eafc2c737c66ed009bbfcab1baebddfe4e3ff
diff --git a/tests/trau_conv/rtp2trau_efr_ul1.ok b/tests/trau_conv/rtp2trau_efr_ul1.ok
new file mode 100644
index 0000000..f456ddb
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_efr_ul1.ok
@@ -0,0 +1,6 @@
+0000e800c217d6928f95ad609f1d86188f6c9885c080a402aac080008000800eeb00800080008eff
+0000e800c217d6928f95ad609f1d86188f6c9885c080a402aac080008000800eeb00800080008eff
+0000e800df4ccb25d0409b69fa62ddd7ff17fff794a8cdb6811efd2eea6ecaf8efd3ad13aa4bbeff
+0000e800d1be87f2e9c089e1831992a1c209dd1e9b208153c09bbd3fe25fdc60da35b0b0a35c9eff
+0000e800db3d9e93d649e98bf74ced0bbdc3d9e98e02e0c2c0f6a48cc5fccc00fcd5b54bf0348aff
+0000e804ca1bba53b5b086fffffc8000bc0efffffe008042c07fffffe0008411fffcffe0800482ff
diff --git a/tests/trau_conv/rtp2trau_efr_ul2.ok b/tests/trau_conv/rtp2trau_efr_ul2.ok
new file mode 100644
index 0000000..6430b9c
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_efr_ul2.ok
@@ -0,0 +1,24 @@
+0000e800c217d6928f95ad609f1d86188f6c9885c080a402aac080008000800eeb00800080008eff
+0000e800c217d6928f95ad609f1d86188f6c9885c080a402aac080008000800eeb00800080008eff
+0000e800df4ccb25d0409b69fa62ddd7ff17fff794a8cdb6811efd2eea6ecaf8efd3ad13aa4bbeff
+0000e800d1be87f2e9c089e1831992a1c209dd1e9b208153c09bbd3fe25fdc60da35b0b0a35c9eff
+0000e800db3d9e93d649e98bf74ced0bbdc3d9e98e02e0c2c0f6a48cc5fccc00fcd5b54bf0348aff
+0000e800d1bd87f2b7989183a2b7ac91bf93a0e8f360a2c68154aa7fd8e58c19acb484878edbb2ff
+0000e800dabd9d07a530975ba2b4a205bd97a71ca58bafc8d036d933ddbccb5cab9d87359b63d6ff
+0000e800d5bb9ec6e4c09b56a521d920c69dae2984d0e732c1f6b6a3d32c8349fbb4f325d72ce2ff
+0000e800dabb9766e3a0a156892bd4b3b023ab39dc26f4bfd197b36bab64c3849b75eeb5b623e2ff
+0000e800d5bda21399f8a78b919c9addd4a9e279fd60e83b8298b780aa54cc7adcc99819a153faff
+0000e800dabd9ec7a528ab75b07fecdac52dba21bfe8e1bdc2f69409c92dfc1afc1ea646c923eeff
+0000e800d5bd9ed2b74ab365a4f7c8d9c0c5af0b9f7db6c08359a2f799c8bbebaa96cbfeb01382ff
+0000e800dabb9ec6d518b76380e8c220cab7a563e1c9933883979b28a802faf3db84d04980ab92ff
+0000e800d5bf89f2b5fac963ed48e294cbc3a180a43bb4c6c3f989e1b266c3948b97f985ec2596ff
+0000e800dabda0d3e830c1aff191ac03c043c984c538d0bc8439809cb53ca4acac16fa97b643f6ff
+0000e800d5bd9ed2c648c76df0fcd5f1b8c7b6caff4588c49636cc91c86ed41caa8fb8f1b0a3d6ff
+0000e800dabd9ed2f590cb938b6fcbb6c7c1cb2ce9a091c2c4f9d80ab3c8a2dc9b9fd34cedb496ff
+0000e800d23b9ec78520d17cd0b1d254bcc7b6e2944a933ad776bc248495bc349bf3b22fb7cbe2ff
+0000e800dabd9d078530d74181fbed32babfa2838e16d2428596bf18f95c835c9aa3c701a45ba2ff
+0000e800d5be87f28698dd66aedeb7b7dbc5bf3b9d60884485f9c085cbd5fbbcbc599cf2fedcc2ff
+0000e800d5bd9ed4b7d3938482d4815bc2c5bf52faae80c48657893beb63b4148b098dabae43a2ff
+0000e800d5bd9ed2c588e77db3b2b636c7c3ade3ec2682c6c696c281b80db364bc91fae3904482ff
+0000e800d5bb9ec7a643a774cf76feb2b343a1d29c16bc52c6f5b1ac8c619303fb0cc02ddb4c92ff
+0000e801d5bf89e884e8f1529087c995b943b3198c2eafc2c737c66ed009bbfcab1baebddfe4e2ff
diff --git a/tests/trau_conv/rtp2trau_efr_ul3.ok b/tests/trau_conv/rtp2trau_efr_ul3.ok
new file mode 100644
index 0000000..4495e4a
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_efr_ul3.ok
@@ -0,0 +1,12 @@
+0000e800d5bda21399f8a78b919c9addd4a9e279fd60e83b8298b780aa54cc7adcc99819a153faff
+0000e800dabd9ec7a528ab75b07fecdac52dba21bfe8e1bdc2f69409c92dfc1afc1ea646c923eeff
+0000e808d5bd9ed2b74ab365a4f7c8d9c0c5af0b9f7db6c08359a2f799c8bbebaa96cbfffffffaff
+0000e800dabb9ec6d518b76380e8c220cab7a563e1c9933883979b28a802faf3db84d04980ab92ff
+0000e808d5bf89f2b5fac963ed48e294cbc3a180a43bb4c6c3f989e1b266c3948b97f98080008eff
+0000e808dabda0d3e830c1aff191ac03c043c984c538d556d551809cb53ca484ac16fa97b643f6ff
+0000e800d5bda21399f8a78b919c9addd4a9e279fd60e83b8298b780aa54cc7adcc99819a153fbff
+0000e800dabd9ec7a528ab75b07fecdac52dba21bfe8e1bdc2f69409c92dfc1afc1ea646c923efff
+0000e808d5bd9ed2b74ab365a4f7c8d9c0c5af0b9f7db6c08359a2f799c8bbebaa96cbfffffffbff
+0000e800dabb9ec6d518b76380e8c220cab7a563e1c9933883979b28a802faf3db84d04980ab93ff
+0000e808d5bf89f2b5fac963ed48e294cbc3a180a43bb4c6c3f989e1b266c3948b97f98080008fff
+0000e808dabda0d3e830c1aff191ac03c043c984c538d556d551809cb53ca484ac16fa97b643f7ff
diff --git a/tests/trau_conv/rtp2trau_fr_dl1.ok b/tests/trau_conv/rtp2trau_fr_dl1.ok
new file mode 100644
index 0000000..af8308c
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_fr_dl1.ok
@@ -0,0 +1,7 @@
+0000f00fdc09ba1abe28c7b29b32c8d396a89ef389f391bbb69d8dbcb46ee447cbdfcc6cf465e7ff
+0000f00fd28aaa9aaffbd1edb8838cc5ce939fb4b17bb168e5b387bce55a94cdf63ac4d3871c8fff
+0000f00ff38ab25ecfebfcf8b85ce50a9ebd99cb95b8c7dff9e3b957e335960dd03a9ada84f1c7ff
+0000f00fc38ca65c9fe9c9aa875286e2ce58edc6c58cdc39f5ad9c91d597cd4dbfbbdd18aaeab7ff
+0000f00feacef696ec008800800080008001800080008000801080008000800081008000800081ff
+0000f00fabcdaa92e428c063c4edd89dc2888638cedb89d8a880e389edb19d85880cb89ddb13dbff
+0000f00fc9d7c2ece4288012a492a492a2808124c924c924a8009249924992458002a4e2a492a7ff
diff --git a/tests/trau_conv/rtp2trau_fr_dl2.ok b/tests/trau_conv/rtp2trau_fr_dl2.ok
new file mode 100644
index 0000000..149c1e7
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_fr_dl2.ok
@@ -0,0 +1,24 @@
+0000f00fdc09ba1abe28c7b29b32c8d396a89ef389f391bbb69d8dbcb46ee447cbdfcc6cf465e7ff
+0000f00fd28aaa9aaffbd1edb8838cc5ce939fb4b17bb168e5b387bce55a94cdf63ac4d3871c8fff
+0000f00ff38ab25ecfebfcf8b85ce50a9ebd99cb95b8c7dff9e3b957e335960dd03a9ada84f1c7ff
+0000f00fc38ca65c9fe9c9aa875286e2ce58edc6c58cdc39f5ad9c91d597cd4dbfbbdd18aaeab7ff
+0000f00fbc09ba1ade778a87957bd552e1bcdec4cad8cec1ed5dbdd7c734dcdf9b33d8b5c49287ff
+0000f00f83f1ba16ee7bbefca892ab47bfb798baf6db8edbe7c59b919289e3c3bd72b892a72bdfff
+0000f00fc3f6ba969e759e8fb07cb0bddb7c987ad6dad4c7eba5f4b8d163edbf92d4e48ccca29fff
+0000f00f8a0caa91cf6ba1edd578a4d1a1ddddcbad51be23abebaa6ac2fa82fd973c84d2d93cb3ff
+0000f00fe24cba5caee58999e4acf16aaed6e99fa8c4d8b0f5a3da81d346af5dbdb28cdccf1ddfff
+0000f00fa3f6ba5a9e1acdaa9b53d953bf95ee49e514ea9cf59b9e969389984cd6deae24ee15bfff
+0000f00f82f1ba9e9e1b8afd80eaa4c7ded59d368931d755fbd39db69d8cb3cf91d0e0eacb5db3ff
+0000f00fb2f2ba99ae77c6a4fa1ab419ffbaef86be87b147e5c3b3669a2afd4eee38d9b586d9dfff
+0000f00fe28aaa52efa7e1a3dab5c9ee9e9beedcccccd82ff963d05395b5932d9639e7839cacb7ff
+0000f00f92f6ba1eef77c1cac393c558fad2e8e98f44b0f5f9a383a9ecf5823fb592fb55f5ae8fff
+0000f00fa38cba52eeefede3d8b4a396c7519bcbb9cb9928ed2daf4ccb58addfb9d0fb15cb62a7ff
+0000f00f828aba5c9f6df6b78873d09da750d8b1f3578a24e7358baeebb5ab0ddf5fd41cf509e7ff
+0000f00fa20eba56aef5c9dccbead498af7ceba5872785d2eb23f1a1e271e38cf8d2b751aaa3e3ff
+0000f00f8af4ba9dce1b89ddf8ecd4e2de989a6bbe2af50df6dd9e48f246f775d5d79894bbd0a3ff
+0000f00fc28cba5cefaff1e3daee8513bfbd9e6b8ef8c537f523ad33dc97a22f9bdcb703a48cb7ff
+0000f00f920aaa56afb5b9b0baaccc958e7eebd4c5dfa1bffb23f871e39693bfbf3cc5a284d5d3ff
+0000f00f83f1ba969e75d9ebc455a4e4a6ddaf49abc89fa9e78da857a29ad55df85ee16e955ac7ff
+0000f00fc20eba529e7989c7de1dc8b2a7738b2ce59db6d7eb75ef0c954de3bcfebca763c71debff
+0000f00f930aaa5aaeeb8ea9a6a3c590a69ae9fd815e94fee573cd69cc6d8c0df4b5db1dab06afff
+0000f00ff374ba95afe58e8ccc9d8d5db6689e45ba22f547aed3eb4c92c1aeb5f4b2b8e3caee97ff
diff --git a/tests/trau_conv/rtp2trau_fr_ul1.ok b/tests/trau_conv/rtp2trau_fr_ul1.ok
new file mode 100644
index 0000000..96ef731
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_fr_ul1.ok
@@ -0,0 +1,7 @@
+00008800dc09ba1abe28c7b29b32c8d396a89ef389f391bbb69d8dbcb46ee447cbdfcc6cf465e6ff
+00008800d28aaa9aaffbd1edb8838cc5ce939fb4b17bb168e5b387bce55a94cdf63ac4d3871c8eff
+00008800f38ab25ecfebfcf8b85ce50a9ebd99cb95b8c7dff9e3b957e335960dd03a9ada84f1c6ff
+00008800c38ca65c9fe9c9aa875286e2ce58edc6c58cdc39f5ad9c91d597cd4dbfbbdd18aaeab6ff
+00008804eacef696ec008800800080008001800080008000801080008000800081008000800082ff
+00008800abcdaa92e428c063c4edd89dc2888638cedb89d8a880e389edb19d85880cb89ddb13daff
+00008800c9d7c2ece4288012a492a492a2808124c924c924a8009249924992458002a4e2a492a6ff
diff --git a/tests/trau_conv/rtp2trau_fr_ul2.ok b/tests/trau_conv/rtp2trau_fr_ul2.ok
new file mode 100644
index 0000000..7abb1db
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_fr_ul2.ok
@@ -0,0 +1,24 @@
+00008800dc09ba1abe28c7b29b32c8d396a89ef389f391bbb69d8dbcb46ee447cbdfcc6cf465e6ff
+00008800d28aaa9aaffbd1edb8838cc5ce939fb4b17bb168e5b387bce55a94cdf63ac4d3871c8eff
+00008800f38ab25ecfebfcf8b85ce50a9ebd99cb95b8c7dff9e3b957e335960dd03a9ada84f1c6ff
+00008800c38ca65c9fe9c9aa875286e2ce58edc6c58cdc39f5ad9c91d597cd4dbfbbdd18aaeab6ff
+00008800bc09ba1ade778a87957bd552e1bcdec4cad8cec1ed5dbdd7c734dcdf9b33d8b5c49286ff
+0000880083f1ba16ee7bbefca892ab47bfb798baf6db8edbe7c59b919289e3c3bd72b892a72bdeff
+00008800c3f6ba969e759e8fb07cb0bddb7c987ad6dad4c7eba5f4b8d163edbf92d4e48ccca29eff
+000088008a0caa91cf6ba1edd578a4d1a1ddddcbad51be23abebaa6ac2fa82fd973c84d2d93cb2ff
+00008800e24cba5caee58999e4acf16aaed6e99fa8c4d8b0f5a3da81d346af5dbdb28cdccf1ddeff
+00008800a3f6ba5a9e1acdaa9b53d953bf95ee49e514ea9cf59b9e969389984cd6deae24ee15beff
+0000880082f1ba9e9e1b8afd80eaa4c7ded59d368931d755fbd39db69d8cb3cf91d0e0eacb5db2ff
+00008800b2f2ba99ae77c6a4fa1ab419ffbaef86be87b147e5c3b3669a2afd4eee38d9b586d9deff
+00008800e28aaa52efa7e1a3dab5c9ee9e9beedcccccd82ff963d05395b5932d9639e7839cacb6ff
+0000880092f6ba1eef77c1cac393c558fad2e8e98f44b0f5f9a383a9ecf5823fb592fb55f5ae8eff
+00008800a38cba52eeefede3d8b4a396c7519bcbb9cb9928ed2daf4ccb58addfb9d0fb15cb62a6ff
+00008800828aba5c9f6df6b78873d09da750d8b1f3578a24e7358baeebb5ab0ddf5fd41cf509e6ff
+00008800a20eba56aef5c9dccbead498af7ceba5872785d2eb23f1a1e271e38cf8d2b751aaa3e2ff
+000088008af4ba9dce1b89ddf8ecd4e2de989a6bbe2af50df6dd9e48f246f775d5d79894bbd0a2ff
+00008800c28cba5cefaff1e3daee8513bfbd9e6b8ef8c537f523ad33dc97a22f9bdcb703a48cb6ff
+00008800920aaa56afb5b9b0baaccc958e7eebd4c5dfa1bffb23f871e39693bfbf3cc5a284d5d2ff
+0000880083f1ba969e75d9ebc455a4e4a6ddaf49abc89fa9e78da857a29ad55df85ee16e955ac6ff
+00008800c20eba529e7989c7de1dc8b2a7738b2ce59db6d7eb75ef0c954de3bcfebca763c71deaff
+00008800930aaa5aaeeb8ea9a6a3c590a69ae9fd815e94fee573cd69cc6d8c0df4b5db1dab06aeff
+00008801f374ba95afe58e8ccc9d8d5db6689e45ba22f547aed3eb4c92c1aeb5f4b2b8e3caee96ff
diff --git a/tests/trau_conv/rtp2trau_fr_ul3.ok b/tests/trau_conv/rtp2trau_fr_ul3.ok
new file mode 100644
index 0000000..925c455
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_fr_ul3.ok
@@ -0,0 +1,12 @@
+0000880083f1ba16ee7bbefca892ab47bfb798baf6db8edbe7c59b919289e3c3bd72b892a72bdeff
+00008800c3f6ba969e759e8fb07cb0bddb7c987ad6dad4c7eba5f4b8d163edbf92d4e48ccca29eff
+000088088a0caa91cf6ba1edd7fee001a1ddddcbad51beaad6aaaa6ac2fa82fd973c84d2d93cb2ff
+00008800e24cba5caee58999e4acf16aaed6e99fa8c4d8b0f5a3da81d346af5dbdb28cdccf1ddeff
+00008808a3f6ba5a9e1acdaa9b53d953bf95ee49e6aff57cf99b9e969389984cd6deae24ee15beff
+0000880882f1ba9e9e1b8afd80eaa41582119d368931d755fbd39db69d8cb3cf91d0e0eacb5db2ff
+0000880083f1ba16ee7bbefca892ab47bfb798baf6db8edbe7c59b919289e3c3bd72b892a72bdfff
+00008800c3f6ba969e759e8fb07cb0bddb7c987ad6dad4c7eba5f4b8d163edbf92d4e48ccca29fff
+000088088a0caa91cf6ba1edd7fee001a1ddddcbad51beaad6aaaa6ac2fa82fd973c84d2d93cb3ff
+00008800e24cba5caee58999e4acf16aaed6e99fa8c4d8b0f5a3da81d346af5dbdb28cdccf1ddfff
+00008808a3f6ba5a9e1acdaa9b53d953bf95ee49e6aff57cf99b9e969389984cd6deae24ee15bfff
+0000880882f1ba9e9e1b8afd80eaa41582119d368931d755fbd39db69d8cb3cf91d0e0eacb5db3ff
diff --git a/tests/trau_conv/rtp2trau_gen.c b/tests/trau_conv/rtp2trau_gen.c
new file mode 100644
index 0000000..3a5eb8d
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_gen.c
@@ -0,0 +1,170 @@
+/*
+ * This program reads RTP payloads for FR/HR/EFR speech from a TW-TS-005
+ * hex file and converts them to either TRAU-DL or TRAU-UL frames
+ * as specified on the command line, exercising osmo_rtp2trau() and
+ * osmo_trau_frame_encode() functions in the process.
+ *
+ * Author: Mychaela N. Falconia <falcon(a)freecalypso.org>, 2025 - however,
+ * Mother Mychaela's contributions are NOT subject to copyright.
+ * No rights reserved, all rights relinquished.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <osmocom/core/bits.h>
+#include <osmocom/core/utils.h>
+#include <osmocom/trau/trau_frame.h>
+#include <osmocom/trau/trau_rtp.h>
+
+#include "tw5reader.h"
+
+static enum osmo_trau_frame_direction direction;
+static struct osmo_trau2rtp_state trau2rtp_st;
+static FILE *out_file;
+
+static void emit_hex_frame(const uint8_t *frame, unsigned nbytes)
+{
+ unsigned n;
+
+ for (n = 0; n < nbytes; n++)
+ fprintf(out_file, "%02x", frame[n]);
+ putc('\n', out_file);
+}
+
+static void emit_hex_trau_frame_16k(const ubit_t *tf_bits)
+{
+ uint8_t tf_bytes[40];
+
+ osmo_ubit2pbit(tf_bytes, tf_bits, sizeof(tf_bytes) * 8);
+ emit_hex_frame(tf_bytes, sizeof(tf_bytes));
+}
+
+static void emit_hex_trau_frame_8k(const ubit_t *tf_bits)
+{
+ uint8_t tf_bytes[20];
+
+ osmo_ubit2pbit(tf_bytes, tf_bits, sizeof(tf_bytes) * 8);
+ emit_hex_frame(tf_bytes, sizeof(tf_bytes));
+}
+
+static void process_record(const uint8_t *rtp_pl, unsigned rtp_pl_len,
+ const char *filename, unsigned lineno)
+{
+ struct osmo_trau_frame tf;
+ ubit_t tf_bits[640]; /* 2x space required by osmo_trau_frame_encode() */
+ int rc;
+
+ tf.dir = direction;
+ rc = osmo_rtp2trau(&tf, rtp_pl, rtp_pl_len, &trau2rtp_st);
+ if (rc < 0) {
+ fprintf(stderr, "%s line %u: not valid for osmo_rtp2trau()\n",
+ filename, lineno);
+ exit(1);
+ }
+ tf.dl_ta_usec = 0;
+ rc = osmo_trau_frame_encode(tf_bits, sizeof(tf_bits), &tf);
+ switch (rc) {
+ case 320:
+ emit_hex_trau_frame_16k(tf_bits);
+ break;
+ case 160:
+ emit_hex_trau_frame_8k(tf_bits);
+ break;
+ default:
+ fprintf(stderr,
+ "%s line %u: osmo_trau_frame_encode() returned %d\n",
+ filename, lineno, rc);
+ exit(1);
+ }
+}
+
+static void process_file(const char *infname, const char *outfname)
+{
+ FILE *inf;
+ unsigned lineno;
+ uint8_t frame[TWTS005_MAX_FRAME];
+ unsigned frame_len;
+ int rc;
+
+ inf = fopen(infname, "r");
+ if (!inf) {
+ perror(infname);
+ exit(1);
+ }
+ if (outfname) {
+ out_file = fopen(outfname, "w");
+ if (!out_file) {
+ perror(outfname);
+ exit(1);
+ }
+ } else {
+ out_file = stdout;
+ }
+
+ lineno = 0;
+ for (;;) {
+ rc = twts005_read_frame(inf, &lineno, frame, &frame_len);
+ if (rc < 0) {
+ fprintf(stderr, "%s line %u: not valid TW-TS-005\n",
+ infname, lineno);
+ exit(1);
+ }
+ if (!rc)
+ break;
+ process_record(frame, frame_len, infname, lineno);
+ }
+
+ fclose(inf);
+ if (outfname) {
+ fclose(out_file);
+ out_file = NULL;
+ }
+}
+
+int main(int argc, char **argv)
+{
+ char *infname, *outfname;
+
+ if (argc < 4 || argc > 5)
+ goto usage;
+ infname = argv[1];
+ if (!strcmp(argv[2], "fr"))
+ trau2rtp_st.type = OSMO_TRAU16_FT_FR;
+ else if (!strcmp(argv[2], "hr"))
+ trau2rtp_st.type = OSMO_TRAU8_SPEECH;
+ else if (!strcmp(argv[2], "hr16"))
+ trau2rtp_st.type = OSMO_TRAU16_FT_HR;
+ else if (!strcmp(argv[2], "efr"))
+ trau2rtp_st.type = OSMO_TRAU16_FT_EFR;
+ else
+ goto usage;
+ if (!strcmp(argv[3], "dl"))
+ direction = OSMO_TRAU_DIR_DL;
+ else if (!strcmp(argv[3], "ul"))
+ direction = OSMO_TRAU_DIR_UL;
+ else
+ goto usage;
+ outfname = argv[4];
+
+ process_file(infname, outfname);
+ exit(0);
+
+usage: fprintf(stderr,
+ "usage: %s input-file fr|hr|hr16|efr dl|ul [output-file]\n",
+ argv[0]);
+ exit(1);
+}
diff --git a/tests/trau_conv/rtp2trau_hr_dl.ok b/tests/trau_conv/rtp2trau_hr_dl.ok
new file mode 100644
index 0000000..18e7cf2
--- /dev/null
+++ b/tests/trau_conv/rtp2trau_hr_dl.ok
@@ -0,0 +1,17 @@
+00884486f1d7d8b98ff2c089a69c8080808080bf
+00884486f1d7d8b98ff2c089a69c8080808080bf
+0088469fe9dbdc8080d0808080808080808080bf
+0088469fe3eedf90dd9c9dddc7f193a9e5c587bf
+008845fef4fd9ba986ddabfceac589d38ab3febf
+008846bfe3eedab7e4aed7eb88b4a4a4f997ccff
+008846eef98bbf8fd9a097e4eeababa7ebd1bfff
+00884486f1d7d8b98ff2c089a69c8080808080bf
+00884486f1d7d8b98ff2c089a69c8080808080bf
+00884481d9f599b9c9cce0b8ccb6c099e9f1f6ff
+00884481d9f599b18c9df0b0cdb68099d9f5f6ff
+00884481d9f599b18c9df0b2cdb28099d9f5f6ff
+00884481d9f599b18c9df0b2cdb28099d9f5f6ff
+00884481d9f599b18c9df0b2cdb28099d9f5f6ff
+00884481d9f599b18c9df0b2cdb28099d9f5f6ff
+00884481d9f599b18c9df0b2cdb28099d9f5f6ff
+00885081d9f599bfffffffffffffffffffffffff
diff --git a/tests/trau_conv/tw5reader.c b/tests/trau_conv/tw5reader.c
new file mode 100644
index 0000000..104258b
--- /dev/null
+++ b/tests/trau_conv/tw5reader.c
@@ -0,0 +1,80 @@
+/*
+ * This C module has been adapted from Themyscira Wireless GSM codec libraries
+ * and utilities suite. It implements a function that reads RTP payloads
+ * from hex files in TW-TS-005 format.
+ *
+ * Author: Mychaela N. Falconia <falcon(a)freecalypso.org>, 2025 - however,
+ * Mother Mychaela's contributions are NOT subject to copyright.
+ * No rights reserved, all rights relinquished.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include "tw5reader.h"
+
+static int decode_hex_digit(char c)
+{
+ if (isdigit(c))
+ return c - '0';
+ else if (isupper(c))
+ return c - 'A' + 10;
+ else
+ return c - 'a' + 10;
+}
+
+int twts005_read_frame(FILE *hexf, unsigned *lineno, uint8_t *frame,
+ unsigned *lenp)
+{
+ char linebuf[82];
+ char *cp, *np;
+ uint8_t *dp;
+ unsigned len;
+
+ for (;;) {
+ if (!fgets(linebuf, sizeof(linebuf), hexf))
+ return 0;
+ (*lineno)++;
+ if (!strchr(linebuf, '\n'))
+ return -2;
+ for (cp = linebuf; isspace(*cp); cp++)
+ ;
+ if (*cp != '\0' && *cp != '#')
+ break;
+ }
+ for (np = cp; *cp && !isspace(*cp); cp++)
+ ;
+ if (*cp)
+ *cp++ = '\0';
+ while (isspace(*cp))
+ cp++;
+ if (*cp != '\0' && *cp != '#')
+ return -1;
+ if (!strcasecmp(np, "NULL")) {
+ *lenp = 0;
+ return 1;
+ }
+
+ dp = frame;
+ len = 0;
+ for (cp = np; *cp; cp += 2) {
+ if (!isxdigit(cp[0]) || !isxdigit(cp[1]))
+ return -1;
+ *dp++ = (decode_hex_digit(cp[0]) << 4) |
+ decode_hex_digit(cp[1]);
+ len++;
+ }
+ *lenp = len;
+ return 1;
+}
diff --git a/tests/trau_conv/tw5reader.h b/tests/trau_conv/tw5reader.h
new file mode 100644
index 0000000..dd4d8a4
--- /dev/null
+++ b/tests/trau_conv/tw5reader.h
@@ -0,0 +1,23 @@
+/*
+ * This header file defines the interface to our reader function for
+ * hexadecimal RTP frame sequence files in TW-TS-005 format.
+ *
+ * twts005_read_frame() return values are:
+ * 1 = successfully read valid frame
+ * 0 = normal EOF
+ * -1 = read line with invalid content
+ * -2 = line too long or missing newline
+ *
+ * The reader function skips blank, whitespace-only and comment lines,
+ * returning only actual frames. lineno variable must be initialized to 0
+ * by the application program, but not touched otherwise. In case of an
+ * error, this variable will hold the line number at which the error was
+ * encountered.
+ */
+
+#pragma once
+
+#define TWTS005_MAX_FRAME 40
+
+int twts005_read_frame(FILE *hexf, unsigned *lineno, uint8_t *frame,
+ unsigned *lenp);
--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/39621?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: Ia5ca8af6bd3a899253bbcc718b70e43f2265b495
Gerrit-Change-Number: 39621
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Attention is currently required from: pespin.
falconia has posted comments on this change by falconia. ( https://gerrit.osmocom.org/c/libosmo-abis/+/39621?usp=email )
Change subject: tests: add unit tests for osmo_rtp2trau()
......................................................................
Patch Set 1: Code-Review+2
(1 comment)
File tests/trau_conv/tw5reader.c:
https://gerrit.osmocom.org/c/libosmo-abis/+/39621/comment/0de18423_4e2aa500… :
PS1, Line 37: int twts005_read_frame(FILE *hexf, unsigned *lineno, uint8_t *frame,
> I am aware of that libosmocore function and have used it in other similar unit tests. […]
Done
--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/39621?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: Ia5ca8af6bd3a899253bbcc718b70e43f2265b495
Gerrit-Change-Number: 39621
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 27 Feb 2025 14:42:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: falconia <falcon(a)freecalypso.org>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>