From 63a79404ebc3409fe270b1723330119c7642bfc6 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Wed, 31 Oct 2018 02:04:01 +0100 Subject: add 'show bts N neighbor-si', test SI ARFCNs How the new way of indicating neighbor cells interacts with the various System Information coding and manual SI modes is yet badly under-tested. - Add vty command 'show bts N neighbor-si' to generate the frequency lists as would be sent out via OML in the System Information IEs. - Add neighbor_si.vty VTY transcript test to verify the various neighbor configurations and what SI frequency lists they produce. Change-Id: I7acc46c6299b48eb10356d89d896a2d1f1cc4978 --- include/osmocom/bsc/system_information.h | 3 + src/osmo-bsc/bsc_vty.c | 78 +++++++++++++++ src/osmo-bsc/system_information.c | 2 +- tests/neighbor_si.vty | 161 +++++++++++++++++++++++++++++++ 4 files changed, 243 insertions(+), 1 deletion(-) create mode 100644 tests/neighbor_si.vty diff --git a/include/osmocom/bsc/system_information.h b/include/osmocom/bsc/system_information.h index 29f639dca..41e41dda4 100644 --- a/include/osmocom/bsc/system_information.h +++ b/include/osmocom/bsc/system_information.h @@ -19,4 +19,7 @@ int bts_earfcn_add(struct gsm_bts *bts, uint16_t earfcn, uint8_t thresh_hi, uint int bts_uarfcn_del(struct gsm_bts *bts, uint16_t arfcn, uint16_t scramble); int bts_uarfcn_add(struct gsm_bts *bts, uint16_t arfcn, uint16_t scramble, bool diversity); + +int generate_bcch_chan_list(uint8_t *chan_list, struct gsm_bts *bts, + bool si5, bool bis, bool ter); #endif diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index 410cdac15..e1d30ede3 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -72,6 +72,7 @@ #include #include #include +#include #include @@ -4347,6 +4348,82 @@ DEFUN(bts_resend, bts_resend_cmd, } +static void vty_dump_freq_list(struct vty *vty, uint8_t *freq_list, size_t freq_list_len) +{ + int arfcn; + struct gsm_sysinfo_freq f[1024] = {}; + int count = 0; + + gsm48_decode_freq_list(f, freq_list, freq_list_len, 0xff, 1); + + for (arfcn = 0; arfcn < 1024; arfcn++) { + if (!f[arfcn].mask) + continue; + vty_out(vty, " %d", arfcn); + count ++; + } + + if (!count) + vty_out(vty, " -"); +} + +DEFUN(show_bts_neighbor_si, show_bts_neighbor_si_cmd, + "show bts <0-255> neighbor-si", + SHOW_STR "Display information about a BTS\n" "BTS number\n" + "List neighbor cells' ARFCN+BSIC as would be sent via System Information\n") +{ + struct gsm_network *net; + struct gsm_bts *bts; + uint8_t bts_nr; + int rc; + uint8_t frequency_list[16] = {}; + int i; + + net = gsmnet_from_vty(vty); + + bts_nr = atoi(argv[0]); + + bts = gsm_bts_num(net, bts_nr); + if (!bts) { + vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE); + return CMD_WARNING; + } + + /* Actually invoke the SI frequency list composition code and then decode the bits, to make sure + * we list exactly what will be sent out to the BTS with all special conditions taken into + * account. */ + + vty_out(vty, "neighbor-list mode %s%s", + get_value_string(bts_neigh_mode_strs, bts->neigh_list_manual_mode), VTY_NEWLINE); + + struct { + char *si_label; + bool si5; + bool bis; + bool ter; + } si[] = { + { .si_label="SI2", .si5=false, .bis=false, .ter=false, }, + { .si_label="SI2bis", .si5=false, .bis=true, .ter=false, }, + { .si_label="SI2ter", .si5=false, .bis=false, .ter=true, }, + { .si_label="SI5", .si5=true, .bis=false, .ter=false, }, + { .si_label="SI5bis", .si5=true, .bis=true, .ter=false, }, + }; + + vty_out(vty, "ARFCNs to be sent on System Information IEs:%s", VTY_NEWLINE); + for (i = 0; i < ARRAY_SIZE(si); i++) { + vty_out(vty, " %6s ", si[i].si_label); + rc = generate_bcch_chan_list(frequency_list, bts, si[i].si5, si[i].bis, si[i].ter); + if (rc) { + vty_out(vty, "Failed to generate frequency list%s", VTY_NEWLINE); + return CMD_WARNING; + } + vty_dump_freq_list(vty, frequency_list, sizeof(frequency_list)); + vty_out(vty, "%s", VTY_NEWLINE); + } + + return CMD_SUCCESS; +} + DEFUN(smscb_cmd, smscb_cmd_cmd, "bts <0-255> smscb-command <1-4> HEXSTRING", "BTS related commands\n" BTS_NR_STR @@ -4894,6 +4971,7 @@ int bsc_vty_init(struct gsm_network *network) install_element_ve(&bsc_show_net_cmd); install_element_ve(&show_bts_cmd); + install_element_ve(&show_bts_neighbor_si_cmd); install_element_ve(&show_rejected_bts_cmd); install_element_ve(&show_trx_cmd); install_element_ve(&show_ts_cmd); diff --git a/src/osmo-bsc/system_information.c b/src/osmo-bsc/system_information.c index e0c83aeb7..71d315592 100644 --- a/src/osmo-bsc/system_information.c +++ b/src/osmo-bsc/system_information.c @@ -619,7 +619,7 @@ static bool generate_bcch_chan_list__ni_iter_cb(const struct neighbor_ident_key * \param[in] bis Are we generating SIXbis (true) or not (false) * \param[in] ter Are we generating SIXter (true) or not (false) */ -static int generate_bcch_chan_list(uint8_t *chan_list, struct gsm_bts *bts, +int generate_bcch_chan_list(uint8_t *chan_list, struct gsm_bts *bts, bool si5, bool bis, bool ter) { struct gsm_bts *cur_bts; diff --git a/tests/neighbor_si.vty b/tests/neighbor_si.vty new file mode 100644 index 000000000..09eac0bff --- /dev/null +++ b/tests/neighbor_si.vty @@ -0,0 +1,161 @@ +OsmoBSC> ### Verify Neighbor frequency lists in System Information + +OsmoBSC> enable +OsmoBSC# configure terminal + +OsmoBSC(config)# log stderr +OsmoBSC(config-log)# logging level rr debug +OsmoBSC(config-log)# logging filter all 1 +OsmoBSC(config-log)# exit +OsmoBSC(config)# network + +OsmoBSC(config-net)# bts 0 +OsmoBSC(config-net-bts)# type sysmobts +OsmoBSC(config-net-bts)# band 900 +OsmoBSC(config-net-bts)# base_station_id_code 10 +OsmoBSC(config-net-bts)# location_area_code 20 +OsmoBSC(config-net-bts)# cell_identity 30 +OsmoBSC(config-net-bts)# trx 0 +OsmoBSC(config-net-bts-trx)# arfcn 40 +OsmoBSC(config-net-bts-trx)# exit +OsmoBSC(config-net-bts)# exit + +OsmoBSC(config-net)# bts 1 +OsmoBSC(config-net-bts)# type sysmobts +OsmoBSC(config-net-bts)# band 900 +OsmoBSC(config-net-bts)# base_station_id_code 11 +OsmoBSC(config-net-bts)# location_area_code 21 +OsmoBSC(config-net-bts)# cell_identity 31 +OsmoBSC(config-net-bts)# trx 0 +OsmoBSC(config-net-bts-trx)# arfcn 41 +OsmoBSC(config-net-bts-trx)# exit +OsmoBSC(config-net-bts)# exit + +OsmoBSC(config-net)# bts 2 +OsmoBSC(config-net-bts)# type sysmobts +OsmoBSC(config-net-bts)# band 900 +OsmoBSC(config-net-bts)# base_station_id_code 12 +OsmoBSC(config-net-bts)# location_area_code 22 +OsmoBSC(config-net-bts)# cell_identity 65535 +OsmoBSC(config-net-bts)# trx 0 +OsmoBSC(config-net-bts-trx)# arfcn 42 +OsmoBSC(config-net-bts-trx)# exit +OsmoBSC(config-net-bts)# exit + +OsmoBSC(config-net)# do show bts 0 neighbor-si +neighbor-list mode automatic +ARFCNs to be sent on System Information IEs: + SI2 41 42 + SI2bis - + SI2ter - + SI5 41 42 + SI5bis - +OsmoBSC(config-net)# do show bts 1 neighbor-si +neighbor-list mode automatic +ARFCNs to be sent on System Information IEs: + SI2 40 42 + SI2bis - + SI2ter - + SI5 40 42 + SI5bis - +OsmoBSC(config-net)# do show bts 2 neighbor-si +neighbor-list mode automatic +ARFCNs to be sent on System Information IEs: + SI2 40 41 + SI2bis - + SI2ter - + SI5 40 41 + SI5bis - + +OsmoBSC(config-net)# bts 0 +OsmoBSC(config-net-bts)# neighbor bts 1 +% BTS 0 now has local neighbor BTS 1 with LAC 21 CI 31 and ARFCN 41 BSIC 11 +OsmoBSC(config-net-bts)# exit +OsmoBSC(config-net)# bts 1 +OsmoBSC(config-net-bts)# neighbor bts 0 +% BTS 1 now has local neighbor BTS 0 with LAC 20 CI 30 and ARFCN 40 BSIC 10 +OsmoBSC(config-net-bts)# exit + +OsmoBSC(config-net)# do show bts 0 neighbor-si +neighbor-list mode automatic +ARFCNs to be sent on System Information IEs: + SI2 41 + SI2bis - + SI2ter - + SI5 41 + SI5bis - +OsmoBSC(config-net)# do show bts 1 neighbor-si +neighbor-list mode automatic +ARFCNs to be sent on System Information IEs: + SI2 40 + SI2bis - + SI2ter - + SI5 40 + SI5bis - +OsmoBSC(config-net)# do show bts 2 neighbor-si +neighbor-list mode automatic +ARFCNs to be sent on System Information IEs: + SI2 40 41 + SI2bis - + SI2ter - + SI5 40 41 + SI5bis - + +OsmoBSC(config-net)# bts 2 +OsmoBSC(config-net-bts)# neighbor-list mode manual-si5 +OsmoBSC(config-net-bts)# neighbor-list add arfcn 23 +OsmoBSC(config-net-bts)# neighbor-list add arfcn 24 +OsmoBSC(config-net-bts)# neighbor-list add arfcn 25 +OsmoBSC(config-net-bts)# si5 neighbor-list add arfcn 51 +OsmoBSC(config-net-bts)# si5 neighbor-list add arfcn 52 +OsmoBSC(config-net-bts)# exit + +OsmoBSC(config-net)# do show bts 2 neighbor-si +neighbor-list mode manual-si5 +ARFCNs to be sent on System Information IEs: + SI2 23 24 25 + SI2bis - + SI2ter - + SI5 51 52 + SI5bis - + +OsmoBSC(config-net)# bts 2 +OsmoBSC(config-net-bts)# neighbor-list mode manual +OsmoBSC(config-net-bts)# exit + +OsmoBSC(config-net)# do show bts 2 neighbor-si +neighbor-list mode manual +ARFCNs to be sent on System Information IEs: + SI2 23 24 25 + SI2bis - + SI2ter - + SI5 23 24 25 + SI5bis - + +OsmoBSC(config-net)# ### Configuring an explicit neighbor mapping, but mode is still manual +OsmoBSC(config-net)# bts 2 +OsmoBSC(config-net-bts)# neighbor bts 1 +% BTS 2 now has local neighbor BTS 1 with LAC 21 CI 31 and ARFCN 41 BSIC 11 +OsmoBSC(config-net-bts)# exit + +OsmoBSC(config-net)# do show bts 2 neighbor-si +neighbor-list mode manual +ARFCNs to be sent on System Information IEs: + SI2 23 24 25 + SI2bis - + SI2ter - + SI5 23 24 25 + SI5bis - + +OsmoBSC(config-net)# bts 2 +OsmoBSC(config-net-bts)# neighbor-list mode automatic +OsmoBSC(config-net-bts)# exit + +OsmoBSC(config-net)# do show bts 2 neighbor-si +neighbor-list mode automatic +ARFCNs to be sent on System Information IEs: + SI2 41 + SI2bis - + SI2ter - + SI5 41 + SI5bis - -- cgit v1.2.3