From a39ac756d3c4bebe8719e5c70c45b3b594ff5d74 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 4 Jun 2019 21:46:07 +0200 Subject: bts: Add LAPDm test for SABM with wrong C/R bit Test that the BTS will take no action when it receives an SABM frame with the C bit set wrong (R); Inspired by TS 51.010-1 25.2.5.2 Implemented as TC_sabm_incorrect_c(). Related: OS#4032 Change-Id: I4fbe7e708c9b1a2c04e5d24a205b5b5af20ff8c7 --- bts/BTS_Tests_LAPDm.ttcn | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/bts/BTS_Tests_LAPDm.ttcn b/bts/BTS_Tests_LAPDm.ttcn index 12f24eba..edbd37b8 100644 --- a/bts/BTS_Tests_LAPDm.ttcn +++ b/bts/BTS_Tests_LAPDm.ttcn @@ -1052,6 +1052,55 @@ testcase TC_incorrect_cr() 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_incorrect_cr)); } + +/* test that the BTS will take no action when it receives an SABM frame with the C bit set wrong (R) + Inspired by TS 51.010-1 25.2.5.2 */ +private function f_TC_sabm_incorrect_c(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; + } + 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; + + f_establish_mo(link_id); + + /* Send I-frame SAPI = 0, C = 1, P = 0, M = 0, L = 3, N(S) = 0, N(R) = 0 */ + var octetstring l3_mo := '010203'O; + LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_I(sapi, c_r:=cr_MO_CMD, p:=false, nr:=0, ns:=0, + l3:=l3_mo))); + /* Expect RR SAPI = 0, R = 1, F = 0, M = 0, L = 0, N(R) = 1 */ + LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_RR(sapi, c_r:=cr_MT_RSP, p:=false, nr:=1))); + RSL.receive(tr_RSL_DATA_IND(g_chan_nr, link_id, l3_mo)); + /* Send SABM SAPI = 0, C = 0, P = 1, M = 0, L = 0 */ + LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_SABM(sapi, c_r:=cr_MO_RSP, p:=true, l3:=''O))); + /* Expect RSL ERR IND */ + RSL.receive(tr_RSL_ERROR_IND(g_chan_nr, link_id, '0C'O)); + /* Expect fill frame C = 0, P = 0, M = 0, L = 0 */ + LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_UI(0, ?, ''O))); + /* Send RR command (P=1) SAPI = 0, C = 1, P = 1, M = 0, L = 0, N(R) = 0 */ + LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_RR(sapi, c_r:=cr_MO_CMD, p:=true, nr:=0))); + /* Expect RR response (F=1) SAPI = 0, R = 1, F = 1, M = 0, L = 0, N(R) = 1 */ + LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_RR(sapi, c_r:=cr_MT_RSP, p:=true, nr:=1))); + + deactivate(d); + + fp_common_fini(); +} +testcase TC_sabm_incorrect_c() 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_sabm_incorrect_c)); +} + control { execute(TC_foo()); execute(TC_sabm_ua_dcch_sapi0()); @@ -1071,6 +1120,7 @@ control { execute(TC_t200_n200()); execute(TC_rr_response_frame_loss()); execute(TC_incorrect_cr()); + execute(TC_sabm_incorrect_c()); } } -- cgit v1.2.3