Change in ...osmo-ttcn3-hacks[master]: bts: clean up old tests and make them work again

laforge gerrit-no-reply at lists.osmocom.org
Fri Jun 14 16:37:13 UTC 2019


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

Change subject: bts: clean up old tests and make them work again
......................................................................

bts: clean up old tests and make them work again

Change-Id: Ie9d73cd9777b6fdda5115ed5dc103979d79c8cd9
---
M bts/BTS_Tests_LAPDm.ttcn
1 file changed, 83 insertions(+), 133 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



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 @@
 	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_contention() runs on lapdm_test_CT {
+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_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 @@
 }
 
 control {
-	execute(TC_foo());
 	execute(TC_sabm_ua_dcch_sapi0());
 	execute(TC_sabm_ua_dcch_sapi0_nopayload());
 	execute(TC_sabm_ua_dcch_sapi3());

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14446
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: Ie9d73cd9777b6fdda5115ed5dc103979d79c8cd9
Gerrit-Change-Number: 14446
Gerrit-PatchSet: 2
Gerrit-Owner: Hoernchen <ewild at sysmocom.de>
Gerrit-Reviewer: Hoernchen <ewild at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190614/6506e66d/attachment.html>


More information about the gerrit-log mailing list