Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14346 )

Change subject: bts: Add test for expiring T200 N200+1 times
......................................................................

bts: Add test for expiring T200 N200+1 times

Change-Id: I9e1dbc889575f8952a4581551076829825b3b1cd
---
M bts/BTS_Tests_LAPDm.ttcn
1 file changed, 91 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



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 @@
        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 @@
        execute(TC_iframe_timer_recovery());
        execute(TC_segm_concat_dcch());
        execute(TC_segm_concat_sacch());
+       execute(TC_t200_n200());
 }

 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14346
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I9e1dbc889575f8952a4581551076829825b3b1cd
Gerrit-Change-Number: 14346
Gerrit-PatchSet: 5
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: merged

Reply via email to