diff options
Diffstat (limited to 'bts/BTS_Tests_LAPDm.ttcn')
-rw-r--r-- | bts/BTS_Tests_LAPDm.ttcn | 168 |
1 files changed, 155 insertions, 13 deletions
diff --git a/bts/BTS_Tests_LAPDm.ttcn b/bts/BTS_Tests_LAPDm.ttcn index d16aa110..7dda8b88 100644 --- a/bts/BTS_Tests_LAPDm.ttcn +++ b/bts/BTS_Tests_LAPDm.ttcn @@ -43,15 +43,21 @@ function f_lapdm_exit() runs on lapdm_test_CT { /* master function switching to a dedicated radio channel */ function f_switch_dcch() runs on ConnHdlr { - var BCCH_tune_req tune_req := { arfcn := { false, mp_trx0_arfcn }, combined_ccch := true }; + var TrxParsItem trx_pars := mp_trx_pars[g_pars.trx_nr]; + var GsmBandArfcn arfcn := valueof(ts_GsmBandArfcn(trx_pars.arfcn)); + var BCCH_tune_req tune_req := { arfcn := arfcn, combined_ccch := true }; var DCCH_switch_req sw_req; /* Craft channel description (with or without frequency hopping parameters) */ if (g_pars.fhp.enabled) { - sw_req.chan_desc := valueof(ts_ChanDescH1(g_pars.chan_nr, g_pars.fhp.maio_hsn)); + sw_req.chan_desc := valueof(ts_ChanDescH1(g_pars.chan_nr, + g_pars.fhp.maio_hsn, + g_pars.tsc)); sw_req.ma := g_pars.fhp.ma; } else { - sw_req.chan_desc := valueof(ts_ChanDescH0(g_pars.chan_nr, mp_trx0_arfcn)); + sw_req.chan_desc := valueof(ts_ChanDescH0(g_pars.chan_nr, + trx_pars.arfcn, + g_pars.tsc)); sw_req.ma := omit; } @@ -281,7 +287,7 @@ private function f_TC_sabm_retransmit_bts(charstring id) runs on ConnHdlr { LAPDM.clear; RSL.send(ts_RSL_EST_REQ(g_chan_nr, ts_RslLinkID_DCCH(sapi))); - timer T := 8.0; + timer T := 20.0; var integer sabm_received := 0; T.start; alt { @@ -305,6 +311,7 @@ private function f_TC_sabm_retransmit_bts(charstring id) runs on ConnHdlr { } testcase TC_sabm_retransmit_bts() runs on test_CT { var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); + pars.t_guard := 30.0; f_testmatrix_each_chan(pars, refers(f_TC_sabm_retransmit_bts)); } @@ -795,6 +802,11 @@ private function f_TC_nr_seq_error(charstring id) runs on ConnHdlr { /* SAPI = 0, C = 1, P = 0, M = 0, L = N201, N(S) = 0, N(R) = 1. * */ LAPDM.send(t_PH_DATA(0, false, ts_LAPDm_I(sapi, c_r:=cr_MO_CMD, p:=false, nr:=1, ns:=0, l3:=l3_mo))); + /* LAPD indicates the data and then indicates error with sequence error cause. */ + RSL.receive(tr_RSL_DATA_IND(g_chan_nr, link_id, l3_mo)); + RSL.receive(tr_RSL_ERROR_IND(g_chan_nr, link_id, '07'O)); + /* Release RSL link. */ + RSL.send(ts_RSL_REL_REQ(g_chan_nr, link_id)); /* The BTS may: a) send a DISC frame within N200×T200; */ /* DISC SAPI = 0, C = 0, P = 1, M = 0, L = 0. */ @@ -1008,12 +1020,11 @@ runs on ConnHdlr { p:=false, nr:=(dls.v_s) mod 8))); [] as_ignore_background(not is_sacch); [] LAPDM.receive(t_PH_DATA(0, is_sacch, ?)) -> value pd { - setverdict(fail, "received unexpected LAPDm ", pd); - repeat; + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("received unexpected LAPDm ", pd)); } [] LAPDM.receive(t_PH_DATA(0, ?, ?)) { repeat; } [offset < lengthof(l3)] RSL.receive(tr_RSL_DATA_IND(g_chan_nr, link_id, ?)) { - setverdict(fail, "received RSL DATA IND before message complete"); + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "received RSL DATA IND before message complete"); } } } @@ -1025,10 +1036,10 @@ runs on ConnHdlr { setverdict(pass); } [] RSL.receive(tr_RSL_DATA_IND(g_chan_nr, link_id, ?)) { - setverdict(fail, "Received RSL DATA IND with wrong payload"); + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received RSL DATA IND with wrong payload"); } [] T.timeout { - setverdict(fail, "Timeout waiting for RSL DATA IND of de-segmented message"); + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for RSL DATA IND of de-segmented message"); } } } @@ -1101,7 +1112,7 @@ private function f_n200_by_chan_nr(RslChannelNr chan_nr, RslLinkId link_id) retu /* 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 RslLinkId link_id := valueof(ts_RslLinkID_SACCH(0)); var integer sapi := link_id.sapi; var boolean is_sacch := false; if (link_id.c == SACCH) { @@ -1115,13 +1126,13 @@ private function f_TC_t200_n200(charstring id) runs on ConnHdlr { fp_common_init(); /* some common altstep for meas res and other background noise */ - d := activate(as_ignore_background(true)); + d := activate(as_ignore_background(not is_sacch)); RSL.clear; LAPDM.clear; f_establish_mo(link_id); - var octetstring l3_mt := f_rnd_octstring(20); + var octetstring l3_mt := f_rnd_octstring(18); 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, @@ -1142,7 +1153,7 @@ private function f_TC_t200_n200(charstring id) runs on ConnHdlr { /* break */ } } - [] LAPDM.receive(t_PH_DATA(0, false, tr_LAPDm_I(sapi, ?, ?, ?, ?, ?))) { + [] LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_I(sapi, ?, ?, ?, ?, ?))) { setverdict(fail, "Received unexpected I frame"); } [not is_sacch] as_lapdm_acch(); @@ -1330,6 +1341,135 @@ testcase TC_sabm_incorrect_c() runs on test_CT { f_testmatrix_each_chan(pars, refers(f_TC_sabm_incorrect_c)); } +/* Test procedure for normal reestablishment, as per: + * OS#4819 + * 3GPP TS 44.006 8.4.1.2 "Normal establishment procedure" + * 3GPP TS 44.006 8.4.2.1 "General requirements" + * 3GPP TS 44.006 8.6.3 "Procedures for re-establishment" + * */ +private function f_TC_normal_reestablishment(charstring id) runs on ConnHdlr { + var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(0)) + var octetstring l3_mo := f_rnd_octstring(c_TS0406_MAX_L3_OCTETS); + var default d; + timer T := 3.0; + var boolean use_sacch := false; + var boolean received_estind := false; + var boolean received_ua := false; + + 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); + + deactivate(d); + + var LapdmDlState dls := valueof(t_init_LapdmDlState); + f_lapdm_transceive_mo(dls, link_id, l3_mo); + + LAPDM.send(t_PH_DATA(link_id.sapi, use_sacch, ts_LAPDm_SABM(link_id.sapi, c_r:=cr_MO_CMD, p:=true, l3:=''O))); + T.start + alt { + [] LAPDM.receive(t_PH_DATA(?, use_sacch, tr_LAPDm_UA(link_id.sapi, cr_MT_RSP, f:=true, l3:=''O))) { + received_ua := true; + if (not received_estind) { + repeat; + } + } + [] RSL.receive(tr_RSL_EST_IND_NOL3(g_chan_nr, link_id)) { + received_estind := true; + if (not received_ua) { + repeat; + } + } + [] RSL.receive { repeat; } + [] LAPDM.receive { repeat; } + [] T.timeout { setverdict(fail, "Timeout waiting for UA"); } + } + + /* Test we can still send data afterwards */ + l3_mo := f_rnd_octstring(c_TS0406_MAX_L3_OCTETS); + dls := valueof(t_init_LapdmDlState); + f_lapdm_transceive_mo(dls, link_id, l3_mo); + + + fp_common_fini(); +} +testcase TC_normal_reestablishment() 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_normal_reestablishment)); +} + +/* Test procedure for normal reestablishment in state LAPD_STATE_TIMER_RECOV (after T200, waiting for Ack), as per: + * OS#4819 + * 3GPP TS 44.006 8.4.1.2 "Normal establishment procedure" + * 3GPP TS 44.006 8.4.2.1 "General requirements" + * 3GPP TS 44.006 8.6.3 "Procedures for re-establishment" + * */ +private function f_TC_normal_reestablishment_state_unacked(charstring id) runs on ConnHdlr { + var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(0)) + var octetstring l3_mo := f_rnd_octstring(c_TS0406_MAX_L3_OCTETS); + var octetstring l3_mt := f_rnd_octstring(20); + var LapdmDlState dls; + var default d; + timer T := 3.0; + var boolean use_sacch := false; + var boolean received_estind := false; + var boolean received_ua := false; + + 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); + RSL.send(ts_RSL_DATA_REQ(g_chan_nr, link_id, l3_mt)); + /* first transmission, P = 0 */ + LAPDM.receive(t_PH_DATA(0, use_sacch, tr_LAPDm_I(link_id.sapi, c_r:=cr_MT_CMD, p:=false, + nr:=0, ns:=0, l3:=l3_mt))); + /* re-transmission, P = 1 */ + LAPDM.receive(t_PH_DATA(0, use_sacch, tr_LAPDm_I(link_id.sapi, c_r:=cr_MT_CMD, p:=true, + nr:=0, ns:=0, l3:=l3_mt))); + deactivate(d); + + /* We received one retrans, so peer is in LAPD_STATE_TIMER_RECOV state. Now send SABM: */ + LAPDM.send(t_PH_DATA(link_id.sapi, use_sacch, ts_LAPDm_SABM(link_id.sapi, c_r:=cr_MO_CMD, p:=true, l3:=''O))); + T.start + alt { + [] LAPDM.receive(t_PH_DATA(?, use_sacch, tr_LAPDm_UA(link_id.sapi, cr_MT_RSP, f:=true, l3:=''O))) { + received_ua := true; + if (not received_estind) { + repeat; + } + } + [] RSL.receive(tr_RSL_EST_IND_NOL3(g_chan_nr, link_id)) { + received_estind := true; + if (not received_ua) { + repeat; + } + } + [] RSL.receive { repeat; } + [] LAPDM.receive { repeat; } + [] T.timeout { setverdict(fail, "Timeout waiting for UA"); } + } + + /* Test we can still send data afterwards */ + l3_mo := f_rnd_octstring(c_TS0406_MAX_L3_OCTETS); + dls := valueof(t_init_LapdmDlState); + f_lapdm_transceive_mo(dls, link_id, l3_mo); + + fp_common_fini(); +} +testcase TC_normal_reestablishment_state_unacked() 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_normal_reestablishment_state_unacked)); +} + control { execute(TC_sabm_ua_dcch_sapi0()); execute(TC_sabm_ua_dcch_sapi0_nopayload()); @@ -1352,6 +1492,8 @@ control { execute(TC_rr_response_frame_loss()); execute(TC_incorrect_cr()); execute(TC_sabm_incorrect_c()); + execute(TC_normal_reestablishment()); + execute(TC_normal_reestablishment_state_unacked()); } } |