summaryrefslogtreecommitdiffstats
path: root/bts/BTS_Tests.ttcn
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-02-26 08:31:31 +0100
committerHarald Welte <laforge@gnumonks.org>2018-02-27 22:32:54 +0100
commit8c24c2b7d270272a858451783131d4e5eadd3861 (patch)
tree36526bbc1fb23ae2ca18d014b8b8a1021d3da725 /bts/BTS_Tests.ttcn
parent6fc784e3c8d35dc952f0e92adc2bf29327a8a4b1 (diff)
bts: Add TC_rach_content and TC_rach_count
Diffstat (limited to 'bts/BTS_Tests.ttcn')
-rw-r--r--bts/BTS_Tests.ttcn97
1 files changed, 86 insertions, 11 deletions
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,22 +465,96 @@ testcase TC_chan_act_wrong_nr() runs on test_CT {
* 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 @@ control {
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() );