diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2018-10-31 02:04:01 +0100 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2018-11-01 01:15:03 +0100 |
commit | 63a79404ebc3409fe270b1723330119c7642bfc6 (patch) | |
tree | 1efbce300d64f63bb1c2fed4249324389093ff19 /src | |
parent | 8e5b8def075c064093b3deae16af57b7b9b27c80 (diff) |
add 'show bts N neighbor-si', test SI ARFCNsneels/legacy_neighbors
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
Diffstat (limited to 'src')
-rw-r--r-- | src/osmo-bsc/bsc_vty.c | 78 | ||||
-rw-r--r-- | src/osmo-bsc/system_information.c | 2 |
2 files changed, 79 insertions, 1 deletions
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 <osmocom/bsc/lchan_select.h> #include <osmocom/bsc/gsm_timers.h> #include <osmocom/bsc/mgw_endpoint_fsm.h> +#include <osmocom/gsm/gsm48_ie.h> #include <inttypes.h> @@ -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; |