[PATCH] osmo-ttcn3-hacks[master]: bts: Add TC_rach_content and TC_rach_count

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Feb 26 08:14:40 UTC 2018


Review at  https://gerrit.osmocom.org/6923

bts: Add TC_rach_content and TC_rach_count

Change-Id: I87abd7172b52aaaaf59bb079de1df99a9edd7381
---
M bts/BTS_Tests.ttcn
1 file changed, 86 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/23/6923/1

diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 0679df7..dc43cd1 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -465,21 +465,95 @@
  * RACH Handling
  ***********************************************************************/
 
-function f_TC_chan_req(charstring id) runs on ConnHdlr {
+/* like L1SAP_IS_PACKET_RACH */
+private function ra_is_ps(OCT1 ra) return boolean {
+	if (ra and4b 'F0'O == '70'O) {
+		return true;
+	} else if (ra and4b '0F'O == '0F'O) {
+		return true;
+	}
+	return false;
+}
+
+/* generate a random RACH for circuit-switched */
+private function f_rnd_ra_cs() return OCT1 {
+	var OCT1 ra;
+	do {
+		ra := f_rnd_octstring(1);
+	} while (ra_is_ps(ra));
+	return ra;
+}
+
+/* Send 1000 RACH requests and check their RA+FN on the RSL side */
+testcase TC_rach_content() runs on test_CT {
+	f_init(testcasename());
+	f_init_l1ctl();
 	f_l1_tune(L1CTL);
 
-	RSL.clear;
-	//L1.send(DCCH_establish_req:{ra := 23});
-	/* This arrives on CCHAN, so we cannot test here */
-	//RSL.receive(tr_RSL_CHAN_RQD(int2oct(23,1)));
+	var GsmFrameNumber fn_last := 0;
+	for (var integer i := 0; i < 1000; i := i+1) {
+		var OCT1 ra := f_rnd_ra_cs();
+		var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra));
+		if (fn == fn_last) {
+			setverdict(fail, "Two RACH in same FN?!?");
+			self.stop;
+		}
+		fn_last := fn;
+
+		timer T := 5.0;
+		alt {
+		[] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(ra, fn, ?))) {
+			T.stop;
+			}
+		[] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(?, ?, ?))) {
+			setverdict(fail, "Unexpected CHAN RQD");
+			self.stop;
+			}
+		[] RSL_CCHAN.receive { repeat; }
+		[] T.timeout {
+			setverdict(fail, "Timeout waiting for CHAN RQD");
+			self.stop;
+			}
+		}
+	}
+	setverdict(pass);
 }
-testcase TC_chan_req() runs on test_CT {
-	var ConnHdlr vc_conn;
-	var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN));
+
+/* Send 1000 RACH Requests (flood ~ 89/s) and count if count(Abis) == count(Um) */
+testcase TC_rach_count() runs on test_CT {
 	f_init(testcasename());
-	vc_conn := f_start_handler(refers(f_TC_chan_req), pars);
-	vc_conn.done;
+	f_init_l1ctl();
+	f_l1_tune(L1CTL);
+
+	var GsmFrameNumber fn_last := 0;
+	for (var integer i := 0; i < 1000; i := i+1) {
+		var OCT1 ra := f_rnd_ra_cs();
+		var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra));
+		if (fn == fn_last) {
+			setverdict(fail, "Two RACH in same FN?!?");
+			self.stop;
+		}
+		fn_last := fn;
+	}
+	var integer rsl_chrqd := 0;
+	timer T := 3.0;
+	alt {
+	[] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(?,?))) {
+		rsl_chrqd := rsl_chrqd + 1;
+		T.stop;
+		T.start;
+		repeat;
+		}
+	[] RSL_CCHAN.receive { repeat; }
+	[] T.timeout { }
+	}
+	if (rsl_chrqd == 1000) {
+		setverdict(pass);
+	} else {
+		setverdict(fail, "Received only ", rsl_chrqd, " out of 1000 RACH");
+	}
 }
+
 
 /***********************************************************************
  * Measurement Processing / Reporting
@@ -1655,7 +1729,8 @@
 	execute( TC_chan_act_react() );
 	execute( TC_chan_deact_not_active() );
 	execute( TC_chan_act_wrong_nr() );
-	execute( TC_chan_req() );
+	execute( TC_rach_content() );
+	execute( TC_rach_count() );
 	execute( TC_meas_res_sign_tchf() );
 	execute( TC_meas_res_sign_tchh() );
 	execute( TC_meas_res_sign_sdcch4() );

-- 
To view, visit https://gerrit.osmocom.org/6923
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I87abd7172b52aaaaf59bb079de1df99a9edd7381
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>


More information about the gerrit-log mailing list