summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Wild <ewild@sysmocom.de>2019-06-14 11:44:29 +0200
committerlaforge <laforge@gnumonks.org>2019-06-14 16:37:02 +0000
commit74f25ae2c358a9ec798c5a0b8fb7c49cf9787d1f (patch)
treea84f14d07c01d01011031ea7c3700e6668ab4d75
parent211acc3d4593bb771a9c3a21d7c4be26e7c6e474 (diff)
bts: clean up old tests and make them work again
-rw-r--r--bts/BTS_Tests_LAPDm.ttcn216
1 files changed, 83 insertions, 133 deletions
diff --git a/bts/BTS_Tests_LAPDm.ttcn b/bts/BTS_Tests_LAPDm.ttcn
index ae87e6d..da78ccb 100644
--- a/bts/BTS_Tests_LAPDm.ttcn
+++ b/bts/BTS_Tests_LAPDm.ttcn
@@ -71,201 +71,152 @@ template LAPDm_ph_data t_PH_DATA(template GsmSapi sapi, template boolean sacch,
sapi := sapi,
lapdm := frame
}
-/* template for a valid SABM frame */
-template LapdmFrame LAPDm_B_SABM(template GsmSapi sapi, octetstring payload) := {
- ab := {
- addr := tr_LapdmAddr(sapi, false),
- ctrl := tr_LapdmCtrlSABM(true),
- len := lengthof(payload),
- m := false,
- el := 1,
- payload := payload
- }
-}
-
-/* template for a valid UA frame */
-template LapdmFrame tr_LAPDm_B_UA(template GsmSapi sapi, template octetstring payload) := {
- ab := {
- addr := tr_LapdmAddr(sapi, false),
- ctrl := tr_LapdmCtrlUA(true),
- len := ?,
- m := false,
- el := 1,
- payload := payload
- }
-}
-
-/* template for a valid UA frame */
-template LapdmFrame LAPDm_B_UA(template GsmSapi sapi, octetstring payload) := {
- ab := {
- addr := tr_LapdmAddr(sapi, false),
- ctrl := tr_LapdmCtrlUA(true),
- len := lengthof(payload),
- m := false,
- el := 1,
- payload := payload
- }
-}
-
-/* template for a valid UI frame */
-template LapdmFrame LAPDm_B_UI(template GsmSapi sapi, octetstring payload) := {
- ab := {
- addr := tr_LapdmAddr(sapi, true),
- ctrl := tr_LapdmCtrlUI(false),
- len := lengthof(payload),
- m := false,
- el := 1,
- payload := payload
- }
-}
-template LapdmFrame t_nopayload(template GsmSapi sapi) := {
- ab := {
- addr := tr_LapdmAddr(sapi, true),
- ctrl := ?,
- len := 0,
- m := false,
- el := 1,
- payload := ''O
- }
-}
-
-template LapdmFrame LAPDm_B_DISC(template GsmSapi sapi) modifies t_nopayload := {
- ab := {
- ctrl := tr_LapdmCtrlDISC(true)
- }
-}
-
-template LapdmFrame LAPDm_B_RR(template GsmSapi sapi, template uint3_t nr) modifies t_nopayload := {
- ab := {
- ctrl := tr_LapdmCtrlRR(nr, false)
- }
-}
-
-
-function f_test_sabm_results_in_ua(uint8_t sapi, boolean use_sacch, octetstring payload) runs on lapdm_test_CT return boolean {
+function f_test_sabm_results_in_ua(uint8_t sapi, boolean use_sacch, octetstring payload) runs on ConnHdlr return boolean {
var LAPDm_ph_data phd;
var boolean result := false;
timer T := 5.0;
- f_establish_dcch();
- LAPDM.send(t_PH_DATA(sapi, use_sacch, LAPDm_B_SABM(sapi, payload)));
- log("====> expecting ", t_PH_DATA(sapi, use_sacch, LAPDm_B_UA(sapi, payload)));
+ LAPDM.send(t_PH_DATA(sapi, use_sacch, ts_LAPDm_SABM(sapi, c_r:=cr_MO_CMD, p:=false, l3:=payload)));
T.start
alt {
- [] LAPDM.receive(t_PH_DATA(?, use_sacch, LAPDm_B_UA(sapi, payload))) { result := true; }
- [] LAPDM.receive(t_PH_DATA(?, use_sacch, ?)) -> value phd { log("Other msg on DCH: ", phd); repeat; }
- [] LAPDM.receive(t_PH_DATA(?, ?, ?)) -> value phd { log("Other PH-DATA: ", phd); repeat; }
+ [] LAPDM.receive(t_PH_DATA(?, use_sacch, tr_LAPDm_UA(sapi, cr_MT_RSP, f:=false, l3:=payload))) { result := true; }
+ [] RSL.receive {repeat;}
+ [] LAPDM.receive { repeat; }
[] T.timeout { }
}
- LAPDM.send(t_PH_DATA(sapi, use_sacch, LAPDm_B_RR(sapi, 0)));
- f_release_dcch();
+ LAPDM.send(t_PH_DATA(sapi, use_sacch, ts_LAPDm_RR(sapi, c_r:=cr_MT_CMD, p:=false, nr:=0)));
return result;
}
-testcase TC_sabm_ua_dcch_sapi0() runs on lapdm_test_CT {
- f_lapdm_init();
+function f_TC_sabm_ua_dcch_sapi0(charstring id) runs on ConnHdlr {
+ fp_common_init();
+ RSL.clear;
+ LAPDM.clear;
+ var default d := activate(as_ignore_background());
if (not f_test_sabm_results_in_ua(0, false, 'FEFE'O)) {
setverdict(fail);
}
setverdict(pass);
+ deactivate(d);
+ fp_common_fini();
}
-testcase TC_sabm_ua_dcch_sapi0_nopayload() runs on lapdm_test_CT {
- f_lapdm_init();
+function f_TC_sabm_ua_dcch_sapi0_nopayload(charstring id) runs on ConnHdlr {
+ fp_common_init();
+ RSL.clear;
+ LAPDM.clear;
+ var default d := activate(as_ignore_background());
if (f_test_sabm_results_in_ua(0, false, ''O)) {
setverdict(fail, "Initial SABM/UA must contain L3 payload but BTS accepts without");
}
setverdict(pass);
+ deactivate(d);
+ fp_common_fini();
}
-testcase TC_sabm_ua_dcch_sapi3() runs on lapdm_test_CT {
- f_lapdm_init();
+function f_TC_sabm_ua_dcch_sapi3(charstring id) runs on ConnHdlr {
+ fp_common_init();
+ RSL.clear;
+ LAPDM.clear;
+ var default d := activate(as_ignore_background());
if (f_test_sabm_results_in_ua(3, false, 'FEFE'O)) {
setverdict(fail, "Initial SABM/UA must be on SAPI0, but BTS accepts SAPI=3");
}
setverdict(pass);
+ deactivate(d);
+ fp_common_fini();
}
-testcase TC_sabm_ua_dcch_sapi4() runs on lapdm_test_CT {
- f_lapdm_init();
+function f_TC_sabm_ua_dcch_sapi4(charstring id) runs on ConnHdlr {
+ fp_common_init();
+ RSL.clear;
+ LAPDM.clear;
+ var default d := activate(as_ignore_background());
if (f_test_sabm_results_in_ua(4, false, 'FEFE'O)) {
setverdict(fail, "Initial SABM/UA must be on SAPI0, but BTS accepts SAPI=4");
}
setverdict(pass);
+ deactivate(d);
+ fp_common_fini();
+}
+
+testcase TC_sabm_ua_dcch_sapi0() 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_ua_dcch_sapi0));
+}
+
+testcase TC_sabm_ua_dcch_sapi0_nopayload() 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_ua_dcch_sapi0_nopayload));
+}
+
+testcase TC_sabm_ua_dcch_sapi3() 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_ua_dcch_sapi3));
}
-testcase TC_sabm_contention() runs on lapdm_test_CT {
+testcase TC_sabm_ua_dcch_sapi4() 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_ua_dcch_sapi4));
+}
+
+function f_TC_sabm_contention(charstring id) runs on ConnHdlr {
var LAPDm_ph_data phd;
const octetstring payload := '0102030405'O;
const GsmSapi sapi := 0;
const boolean use_sacch := false;
timer T := 5.0;
- f_lapdm_init();
+ fp_common_init();
+ RSL.clear;
+ LAPDM.clear;
- f_establish_dcch();
/* first frame is our real SABM */
- LAPDM.send(t_PH_DATA(sapi, use_sacch, LAPDm_B_SABM(sapi, payload)));
+ LAPDM.send(t_PH_DATA(sapi, use_sacch, ts_LAPDm_SABM(sapi, c_r:=cr_MO_CMD, p:=false, l3:=payload)));
/* second frame is a SABM with different payload, which BTS has to ignore according to 8.4.1.4 */
- LAPDM.send(t_PH_DATA(sapi, use_sacch, LAPDm_B_SABM(sapi, 'ABCDEF'O)));
- log("====> expecting ", t_PH_DATA(sapi, use_sacch, LAPDm_B_UA(sapi, payload)));
+ LAPDM.send(t_PH_DATA(sapi, use_sacch, ts_LAPDm_SABM(sapi, c_r:=cr_MO_CMD, p:=false, l3:='ABCDEF'O)));
T.start
alt {
- [] LAPDM.receive(t_PH_DATA(?, use_sacch, LAPDm_B_UA(sapi, payload))) { setverdict(pass); repeat; }
- [] LAPDM.receive(t_PH_DATA(?, use_sacch, tr_LAPDm_B_UA(sapi, ?))) {
+ [] LAPDM.receive(t_PH_DATA(?, use_sacch, tr_LAPDm_UA(sapi, cr_MT_RSP, f:=false, l3:=payload))) { setverdict(pass); repeat; }
+ [] LAPDM.receive(t_PH_DATA(?, use_sacch, tr_LAPDm_UA(sapi, cr_MT_RSP, f:=false, l3:=?))) {
setverdict(fail, "Second SABM was responded to during contention resolution");
- }
+ }
+ [] RSL.receive {repeat;}
[] LAPDM.receive { repeat };
[] T.timeout { }
}
- f_release_dcch();
+
+ fp_common_fini();
+}
+
+testcase TC_sabm_contention() 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_contention));
}
/* we test that a re-transmitted SABM with identical payload will result in the retransmission of a
* UA. This is required during the contention resolution procedure as specified in 8.4.1.4 */
-testcase TC_sabm_retransmit() runs on lapdm_test_CT {
+function f_TC_sabm_retransmit(charstring id) runs on ConnHdlr {
const octetstring payload := '00FEFEDEADBEEF'O;
- f_lapdm_init();
+ fp_common_init();
+ RSL.clear;
+ LAPDM.clear;
+ var default d := activate(as_ignore_background());
if (not f_test_sabm_results_in_ua(0, false, payload)) {
- setverdict(fail, "UA not received for first SABM");
+ setverdict(fail);
}
if (not f_test_sabm_results_in_ua(0, false, payload)) {
- setverdict(fail, "UA not received for second SABM");
+ setverdict(fail);
}
setverdict(pass);
+ deactivate(d);
+ fp_common_fini();
}
-testcase TC_foo() runs on lapdm_test_CT {
- var LapdmFrame lf;
-/*
- var LapdmFrame lf := valueof(LAPDm_B_UA(0, ''O));
- log("ENC UA: ", enc_LapdmFrame(lf));
- lf := valueof(LAPDm_B_UI(0, ''O));
- log("ENC UI B: ", enc_LapdmFrame(lf));
- log("ENC UI B: ", enc_LapdmFrameB(lf.b));
-
- log("DEC UI AF: ", dec_LapdmAddressField('03'O));
-*/
-
- lf := valueof(LAPDm_B_RR(0, 0));
- log("ENC RR: ", enc_LapdmFrame(lf));
-
- lf := valueof(LAPDm_B_UA(0, ''O));
- log("ENC UA: ", enc_LapdmFrame(lf));
-
- lf := valueof(LAPDm_B_UI(0, ''O));
- log("ENC UI: ", enc_LapdmFrame(lf));
-
- log("DEC UI CU: ", dec_LapdmCtrlU('03'O));
- log("DEC UI CT: ", dec_LapdmCtrl('03'O));
-
- log("DEC UA: ", dec_LapdmFrameAB('017301'O));
- log("DEC UI: ", dec_LapdmFrameAB('030301'O));
- log("DEC I: ", dec_LapdmFrameAB('030001'O));
- log("DEC S: ", dec_LapdmFrameAB('030101'O));
- log("DEC: ", dec_LapdmFrameAB('030301'O));
- log("DEC: ", dec_LapdmFrameAB('0303012B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B'O));
+testcase TC_sabm_retransmit() 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_retransmit));
}
/*********************************************************************************
@@ -1363,7 +1314,6 @@ testcase TC_sabm_incorrect_c() runs on test_CT {
}
control {
- execute(TC_foo());
execute(TC_sabm_ua_dcch_sapi0());
execute(TC_sabm_ua_dcch_sapi0_nopayload());
execute(TC_sabm_ua_dcch_sapi3());