aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2021-07-04 04:15:58 +0200
committerlaforge <laforge@osmocom.org>2021-07-16 16:05:52 +0000
commit18684881bd5cb6298dbfc08b37f32a9ec57bdaed (patch)
treeef92f4921b3897ed18d26b3401ec911c4737bc96
parentdd228c4324f19c8ac699073f70dd08578cc1dedb (diff)
BTS: add test cases for Downlink and Uplink speech frames
-rw-r--r--bts/BTS_Tests.ttcn101
1 files changed, 101 insertions, 0 deletions
diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 38490a0c..61c40d4a 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -40,6 +40,7 @@ import from Osmocom_CTRL_Adapter all;
import from Osmocom_CTRL_Functions all;
import from RSL_Types all;
+import from RTP_Types all;
import from IPA_Types all;
import from IPA_Emulation all;
import from IPA_Testing all;
@@ -7592,6 +7593,104 @@ testcase TC_speech_no_rtp_tchh() runs on test_CT {
vc_conn.done;
}
+/* Verify handling of Downlink and Uplink speech frames */
+private function f_TC_speech_rtp(charstring id) runs on ConnHdlr {
+ var L1ctlDlMessage l1_dl;
+ var PDU_RTP rtp_pdu;
+ var octetstring pl;
+ timer Td, Tu;
+
+ f_l1_tune(L1CTL);
+ f_est_dchan();
+
+ /* Activate the RTP emulation */
+ pl := f_rnd_octstring(6);
+ f_rtpem_activate(pl);
+
+ /* Give the scheduler some time to fill up the buffers */
+ f_sleep(2.0);
+ L1CTL.clear;
+ RSL.clear;
+
+ /* Make sure that Downlink frames are received at the UE */
+ Td.start(2.0);
+ alt {
+ [] L1CTL.receive(tr_L1CTL_TRAFFIC_IND(g_chan_nr, frame := pl)) -> value l1_dl {
+ log("TCH received: ", l1_dl.payload.traffic_ind.data);
+ L1CTL.send(ts_L1CTL_TRAFFIC_REQ(g_chan_nr, l1_dl.dl_info.link_id,
+ l1_dl.payload.traffic_ind.data));
+ setverdict(pass);
+ }
+ [] L1CTL.receive(tr_L1CTL_TRAFFIC_IND(g_chan_nr, frame := ?)) -> value l1_dl {
+ setverdict(fail, "Rx unexpected Downlink speech frame ",
+ "(", l1_dl.payload.traffic_ind.data, ") ",
+ "expected (", pl, ")");
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+ }
+ [] as_l1_sacch();
+ [] L1CTL.receive { repeat; }
+ [] Td.timeout {
+ setverdict(fail, "Timeout waiting for Downlink speech frames");
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+ }
+ }
+
+ /* Make sure that Uplink frames are received at the BTS */
+ RTPEM_DATA.clear;
+ Tu.start(2.0);
+ alt {
+ [] RTPEM_DATA.receive(PDU_RTP:?) -> value rtp_pdu {
+ if (rtp_pdu.data != pl)
+ { repeat; }
+ }
+ [] RTPEM_DATA.receive { repeat; }
+ [] Tu.timeout {
+ setverdict(fail, "Timeout waiting for Uplink speech frames");
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+ }
+ }
+
+ f_rtpem_mode(RTPEM_CTRL, RTPEM_MODE_NONE);
+ f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);
+ f_rsl_chan_deact();
+ f_rslem_unregister(0, g_chan_nr);
+}
+testcase TC_speech_rtp_tchf() runs on test_CT {
+ var ConnHdlr vc_conn;
+ var ConnHdlrPars pars;
+
+ f_init();
+
+ /* TS1, TCH/F, V1 (FR codec) */
+ pars := valueof(t_Pars(ts_RslChanNr_Bm(1), ts_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1)));
+ vc_conn := f_start_handler(refers(f_TC_speech_rtp), pars);
+ vc_conn.done;
+
+ /* TS1, TCH/F, V2 (EFR codec) */
+ pars := valueof(t_Pars(ts_RslChanNr_Bm(1), ts_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2)));
+ vc_conn := f_start_handler(refers(f_TC_speech_rtp), pars);
+ vc_conn.done;
+
+ /* TODO: also test V3 (AMR codec) */
+
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+}
+testcase TC_speech_rtp_tchh() runs on test_CT {
+ var ConnHdlr vc_conn;
+ var ConnHdlrPars pars;
+
+ f_init();
+
+ /* TS5, TCH/H0, V1 (HR codec) */
+ pars := valueof(t_Pars(ts_RslChanNr_Lm(5, 0), ts_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1)));
+ vc_conn := f_start_handler(refers(f_TC_speech_rtp), pars);
+ vc_conn.done;
+
+ /* TODO: also test V3 (AMR codec) */
+
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+}
+
/* test generation of RLL ERR IND based on Um errors (TS 48.058 3.9) */
/* protocol error as per 44.006 */
/* link layer failure (repetition of I-frame N200 times without ACK */
@@ -7788,6 +7887,8 @@ control {
execute( TC_speech_no_rtp_tchf() );
execute( TC_speech_no_rtp_tchh() );
+ execute( TC_speech_rtp_tchf() );
+ execute( TC_speech_rtp_tchh() );
}