summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-06-02 22:13:50 +0200
committerHarald Welte <laforge@gnumonks.org>2019-06-04 09:12:03 +0000
commitb2a3034826139b1fba494fb1c8d4a6d64d03b397 (patch)
treecc6ac17bfcb7dc0e6894122e1c6bd3ecfea213aa
parenta7d81f17619a2836528f503946f8eea029e4d601 (diff)
bts: Add test for expiring T200 N200+1 times
-rw-r--r--bts/BTS_Tests_LAPDm.ttcn91
1 files changed, 91 insertions, 0 deletions
diff --git a/bts/BTS_Tests_LAPDm.ttcn b/bts/BTS_Tests_LAPDm.ttcn
index 07b785e..ffa3aa9 100644
--- a/bts/BTS_Tests_LAPDm.ttcn
+++ b/bts/BTS_Tests_LAPDm.ttcn
@@ -845,7 +845,97 @@ testcase TC_segm_concat_sacch() runs on test_CT {
f_testmatrix_each_chan(pars, refers(f_TC_segm_concat_sacch));
}
+/* TS 04.06 Section 5.8.2.1 */
+private function f_n200_by_chan_nr(RslChannelNr chan_nr, RslLinkId link_id) return integer {
+ /* SACCH irrespective of physical channel type */
+ if (match(link_id, tr_RslLinkID_SACCH(?))) {
+ return 5;
+ }
+ /* DCCH below */
+ select (chan_nr) {
+ case (t_RslChanNr_SDCCH4(?, ?)) { return 23; }
+ case (t_RslChanNr_SDCCH8(?, ?)) { return 23; }
+ case (t_RslChanNr_Bm(?)) { return 34; }
+ case (t_RslChanNr_Lm(?, ?)) { return 29; }
+ }
+ setverdict(fail, "Unknown chan_nr ", chan_nr, " or link_id ", link_id);
+ return -1;
+}
+
+/* Test if there are exactly N200+1 transmissions of I frames; inspired by 25.2.4.1 */
+private function f_TC_t200_n200(charstring id) runs on ConnHdlr {
+ var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(0));
+ var integer sapi := link_id.sapi;
+ var boolean is_sacch := false;
+ if (link_id.c == SACCH) {
+ is_sacch := true;
+ }
+ var integer n200 := f_n200_by_chan_nr(g_chan_nr, link_id);
+ var integer num_retrans := 0;
+ timer T := 3.0;
+ var default d;
+
+ fp_common_init();
+
+ /* some common altstep for meas res and other background noise */
+ d := activate(as_ignore_background(true));
+ RSL.clear;
+ LAPDM.clear;
+
+ var octetstring l3_mo := f_rnd_octstring(20);
+ LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_SABM(sapi, c_r:=cr_MO_CMD, p:=true, l3:=l3_mo)));
+ RSL.receive(tr_RSL_EST_IND(g_chan_nr, link_id, l3_mo));
+ LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_UA(sapi, cr_MT_RSP, f:=true, l3:=l3_mo)));
+ var octetstring l3_mt := f_rnd_octstring(20);
+ RSL.send(ts_RSL_DATA_REQ(g_chan_nr, link_id, l3_mt));
+ /* first transmission, P = 0 */
+ LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_I(sapi, c_r:=cr_MT_CMD, p:=false,
+ nr:=0, ns:=0, l3:=l3_mt)));
+ deactivate(d);
+
+ alt {
+ /* re-transmission, P = 1 */
+ [] LAPDM.receive(t_PH_DATA(0, is_sacch,
+ tr_LAPDm_I(sapi, c_r:=cr_MT_CMD, p:=true, nr:=0, ns:=0, l3:=l3_mt))) {
+ num_retrans := num_retrans + 1;
+ if (num_retrans < n200) {
+ repeat;
+ } else if (num_retrans == n200) {
+ T.start; /* wait for some more time if there are more retransmissions */
+ repeat;
+ } else {
+ /* break */
+ }
+ }
+ [] LAPDM.receive(t_PH_DATA(0, false, tr_LAPDm_I(sapi, ?, ?, ?, ?, ?))) {
+ setverdict(fail, "Received unexpected I frame");
+ }
+ [not is_sacch] as_lapdm_acch();
+ [is_sacch] as_lapdm_dcch();
+ [] as_lapdm_idle();
+ [] as_rsl_meas_rep();
+ [num_retrans == n200] RSL.receive(tr_RSL_ERROR_IND(g_chan_nr, link_id, '01'O)) {
+ /* break */
+ }
+ [] T.timeout {
+ setverdict(fail, "Missing RSL RLL ERROR INDICATION");
+ }
+ }
+
+ if (num_retrans == n200) {
+ setverdict(pass, "Received ", num_retrans, " on channel ", g_chan_nr, " link ", link_id);
+ } else if (num_retrans < n200) {
+ setverdict(fail, "Too few retransmissions (", num_retrans, "); N200=", n200,
+ " on channel ", g_chan_nr, " link ", link_id);
+ }
+
+ fp_common_fini();
+}
+testcase TC_t200_n200() runs on test_CT {
+ var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN));
+ f_testmatrix_each_chan(pars, refers(f_TC_t200_n200));
+}
control {
execute(TC_foo());
@@ -863,6 +953,7 @@ control {
execute(TC_iframe_timer_recovery());
execute(TC_segm_concat_dcch());
execute(TC_segm_concat_sacch());
+ execute(TC_t200_n200());
}
}