aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2022-10-26 14:13:53 +0200
committerosmith <osmith@sysmocom.de>2022-10-27 09:19:52 +0000
commit63f4171f50be42c947eff649bd5ad5018f6419b4 (patch)
tree688df74351c8bc40456acdae59a4d4f9141ab40c /tests
parent69db1e9498ad657ecce60f7ec87dd95cda552718 (diff)
tests: add test_meas_rep_multi_band.ho_vty
Add a test that shows that the ARFCN of neighbors from the measurement report is not parsed correctly for multi-band BSS. A follow-up patch fixes it. Related: OS#5717 Change-Id: Ie18e341f236bab5cf60d3a342c15c96cc848a7c2
Diffstat (limited to 'tests')
-rw-r--r--tests/handover/handover_test.c56
-rw-r--r--tests/handover/handover_tests.ok1
-rw-r--r--tests/handover/test_meas_rep_multi_band.ho_vty51
3 files changed, 108 insertions, 0 deletions
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index 6830b48be..1e91e6608 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
+#include <inttypes.h>
#include <assert.h>
@@ -1433,6 +1434,59 @@ DEFUN(codec_h, codec_h_cmd,
return CMD_SUCCESS;
}
+DEFUN(set_arfcn, set_arfcn_cmd,
+ "set-arfcn trx <0-255> <0-255> <0-1023>",
+ "Set the ARFCN for a BTS' TRX\n"
+ "Indicate a BTS and TRX\n" "BTS nr\n" "TRX nr\n"
+ "Absolute Radio Frequency Channel Number\n")
+{
+ enum gsm_band unused;
+ struct gsm_bts *bts = bts_by_num_str(argv[0]);
+ struct gsm_bts_trx *trx = trx_by_num_str(bts, argv[1]);
+ int arfcn = atoi(argv[2]);
+ VTY_ECHO();
+
+ if (gsm_arfcn2band_rc(arfcn, &unused) < 0) {
+ vty_out(vty, "%% Invalid arfcn %" PRIu16 " detected%s", arfcn, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ trx->arfcn = arfcn;
+
+ if (generate_cell_chan_alloc(trx->bts) != 0) {
+ vty_out(vty, "%% Failed to re-generate Cell Allocation%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ for (int i = 0; i < bsc_gsmnet->num_bts; i++) {
+ if (gsm_generate_si(gsm_bts_num(bsc_gsmnet, i), SYSINFO_TYPE_2) <= 0)
+ fprintf(stderr, "Error generating SI2\n");
+ }
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(set_band, set_band_cmd,
+ "set-band bts <0-255> BAND",
+ "Set the frequency band for a BTS\n"
+ "Indicate a BTS\n" "BTS nr\n"
+ "Frequency band\n")
+{
+ struct gsm_bts *bts = bts_by_num_str(argv[0]);
+ int band = gsm_band_parse(argv[1]);
+ VTY_ECHO();
+
+ if (band < 0) {
+ vty_out(vty, "%% BAND %d is not a valid GSM band%s",
+ band, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ bts->band = band;
+
+ return CMD_SUCCESS;
+}
+
DEFUN(set_ts_use, set_ts_use_cmd,
"set-ts-use trx <0-255> <0-255> states" TS_USE TS_USE TS_USE TS_USE TS_USE TS_USE TS_USE TS_USE,
"Put timeslots of a BTS' TRX into a specific state\n"
@@ -1490,6 +1544,8 @@ static void ho_test_vty_init()
install_element(CONFIG_NODE, &expect_ts_use_cmd);
install_element(CONFIG_NODE, &codec_f_cmd);
install_element(CONFIG_NODE, &codec_h_cmd);
+ install_element(CONFIG_NODE, &set_arfcn_cmd);
+ install_element(CONFIG_NODE, &set_band_cmd);
install_element(CONFIG_NODE, &set_ts_use_cmd);
install_element(CONFIG_NODE, &wait_cmd);
}
diff --git a/tests/handover/handover_tests.ok b/tests/handover/handover_tests.ok
index 168ebd672..04241811c 100644
--- a/tests/handover/handover_tests.ok
+++ b/tests/handover/handover_tests.ok
@@ -42,6 +42,7 @@ pass test_keep_fr_codec.ho_vty
pass test_keep_hr_codec.ho_vty
pass test_max_handovers.ho_vty
pass test_max_ta.ho_vty
+pass test_meas_rep_multi_band.ho_vty
pass test_min_rxlev_vs_congestion.ho_vty
pass test_min_rxlev_vs_hysteresis.ho_vty
pass test_neighbor_congested.ho_vty
diff --git a/tests/handover/test_meas_rep_multi_band.ho_vty b/tests/handover/test_meas_rep_multi_band.ho_vty
new file mode 100644
index 000000000..45bcfa3b7
--- /dev/null
+++ b/tests/handover/test_meas_rep_multi_band.ho_vty
@@ -0,0 +1,51 @@
+# Test ARFCN parsing from measurement report in multi-band BSS (OS#5717)
+
+create-n-bts 5
+
+set-band bts 0 1800
+set-arfcn trx 0 0 600
+
+set-band bts 1 900
+set-arfcn trx 1 0 1000
+
+set-band bts 2 850
+set-arfcn trx 2 0 200
+
+set-band bts 3 900
+set-arfcn trx 3 0 0
+
+set-band bts 4 1800
+set-arfcn trx 4 0 800
+
+# Attach MS to BTS 0, BTS 1-4 are neighbors
+create-ms bts 0 TCH/F AMR
+
+expect-ts-use trx 0 0 states * TCH/F - - - - - -
+expect-ts-use trx 1 0 states * - - - - - - -
+expect-ts-use trx 2 0 states * - - - - - - -
+expect-ts-use trx 3 0 states * - - - - - - -
+expect-ts-use trx 4 0 states * - - - - - - -
+
+# Send a measurement report where TRX with ARFCN=800 has the best rxqual. If
+# the BSC resolved the indexes in the measurement report correctly according to
+# 3GPP TS 04.08 ยง 10.5.2.20, then the neighbors are the following:
+# Sub list 1 (band == 1800, same band as the TRX where MS is attached):
+# IDX=0 ARFCN=800 BSIC=63 RXLEV=-75dBm (BTS 4)
+# Sub list 2 (other bands):
+# IDX=1 ARFCN=200 BSIC=63 RXLEV=-110dBm (BTS 2)
+# IDX=2 ARFCN=1000 BSIC=63 RXLEV=-110dBm (BTS 1)
+# IDX=3 ARFCN=0 BSIC=63 RXLEV=-110dBm (BTS 3; at the end because ARFCN=0)
+meas-rep lchan 0 0 1 0 rxlev 20 rxqual 0 ta 0 neighbors 35 0 0 0
+
+# If the BSC parsed the list correctly, it will request a handover to BTS 4.
+# expect-ho from lchan 0 0 1 0 to lchan 4 0 1 0
+
+# FIXME: parses IDX=0 as ARFCN=0 instead of ARFCN=800, no handover is done
+expect-no-chan
+
+# FIXME: should be on TRX 4 after handover
+expect-ts-use trx 0 0 states * TCH/F - - - - - -
+expect-ts-use trx 1 0 states * - - - - - - -
+expect-ts-use trx 2 0 states * - - - - - - -
+expect-ts-use trx 3 0 states * - - - - - - -
+expect-ts-use trx 4 0 states * - - - - - - -