summaryrefslogtreecommitdiffstats
path: root/bts/BTS_Tests.ttcn
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-03-10 18:22:04 +0100
committerHarald Welte <laforge@gnumonks.org>2018-03-12 16:04:38 +0100
commitd5684396e5806bbc2a693c2e9c7ffef5a1119d91 (patch)
treefa5430d7997f967bb7a34aed3e5ddd5f1e214cd1 /bts/BTS_Tests.ttcn
parent84271629d715e008ab108ce2eca88ad50846d4b9 (diff)
bts: Introduce RxLev/RxQual tolerance values
In real-world measurements there's always some tolerance. Use templates for integer ranges of rxlev + rxqual and add some module parameters to make them configurable. Change-Id: I41396ad081706a0dbd6cc992b81d9bba266b6d6d
Diffstat (limited to 'bts/BTS_Tests.ttcn')
-rw-r--r--bts/BTS_Tests.ttcn47
1 files changed, 43 insertions, 4 deletions
diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 931c9ab..a50d3f6 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -48,6 +48,8 @@ modulepar {
charstring mp_bb_trxc_ip := "127.0.0.1";
integer mp_bb_trxc_port := 6701;
charstring mp_pcu_socket := PCU_SOCK_DEFAULT;
+ integer mp_tolerance_rxqual := 1;
+ integer mp_tolerance_rxlev := 3;
}
type component test_CT extends CTRL_Adapter_CT {
@@ -766,6 +768,43 @@ private function toffs256s_to_rsl(int16_t toffs256s) return uint8_t {
return 63 + (toffs256s/256);
}
+private function f_max(integer a, integer b) return integer {
+ if (a > b) {
+ return a;
+ } else {
+ return b;
+ }
+}
+
+private function f_min(integer a, integer b) return integer {
+ if (a < b) {
+ return a;
+ } else {
+ return b;
+ }
+}
+
+/* compute negative tolerance val-tolerance, ensure >= min */
+private function f_tolerance_neg(integer val, integer min, integer tolerance) return integer {
+ val := val - tolerance;
+ return f_max(val, min);
+}
+
+/* compute positive tolerance val+tolerance, ensure <= max */
+private function f_tolerance_pos(integer val, integer max, integer tolerance) return integer {
+ val := val + tolerance;
+ return f_min(val, max);
+}
+
+/* return a template of (val-tolerance .. val+tolerance) ensuring it is within (min .. max) */
+private function f_tolerance(integer val, integer min, integer max, integer tolerance)
+return template integer {
+ var template integer ret;
+ ret := (f_tolerance_neg(val, min, tolerance) .. f_tolerance_pos(val, max, tolerance));
+ return ret;
+}
+
+
/* build a template for matching measurement results against */
private function f_build_meas_res_tmpl() runs on ConnHdlr return template RSL_Message {
var ConnL1Pars l1p := g_pars.l1_pars;
@@ -773,12 +812,12 @@ private function f_build_meas_res_tmpl() runs on ConnHdlr return template RSL_Me
len := 3,
rfu := '0'B,
dtx_d := l1p.dtx_enabled,
- rxlev_f_u := l1p.meas_ul.full.rxlev,
+ rxlev_f_u := f_tolerance(l1p.meas_ul.full.rxlev, 0, 63, mp_tolerance_rxlev),
reserved1 := '00'B,
- rxlev_s_u := l1p.meas_ul.sub.rxlev,
+ rxlev_s_u := f_tolerance(l1p.meas_ul.sub.rxlev, 0, 63, mp_tolerance_rxlev),
reserved2 := '00'B,
- rxq_f_u := l1p.meas_ul.full.rxqual,
- rxq_s_u := l1p.meas_ul.sub.rxqual,
+ rxq_f_u := f_tolerance(l1p.meas_ul.full.rxqual, 0, 7, mp_tolerance_rxqual),
+ rxq_s_u := f_tolerance(l1p.meas_ul.sub.rxqual, 0, 7, mp_tolerance_rxqual),
supp_meas_info := omit
};
if (l1p.toa256_enabled) {