From 67ce073110b390997fd08c69b44c6b5d9f6a3cef Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 6 Aug 2009 19:06:46 +0200 Subject: add code to save BTS/TRX/TS config to config file we don't yet have the parser to fully re-read it. So this has not mcuh use so far. --- openbsc/src/vty_interface.c | 53 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) (limited to 'openbsc') diff --git a/openbsc/src/vty_interface.c b/openbsc/src/vty_interface.c index 11b2ff60b..b480c3d63 100644 --- a/openbsc/src/vty_interface.c +++ b/openbsc/src/vty_interface.c @@ -157,6 +157,56 @@ DEFUN(show_bts, show_bts_cmd, "show bts [number]", return CMD_SUCCESS; } +static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts) +{ + vty_out(vty, "\t\tts %u%s", ts->nr, VTY_NEWLINE); + vty_out(vty, "\t\t\tphys_chan_config %s%s", gsm_pchan_name(ts->pchan), + VTY_NEWLINE); + vty_out(vty, "\t\t\te1_subslot %u %u %u%s", ts->e1_link.e1_nr, + ts->e1_link.e1_ts, ts->e1_link.e1_ts_ss, VTY_NEWLINE); +} + +static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx) +{ + int i; + + vty_out(vty, "\ttrx %u%s", trx->nr, VTY_NEWLINE); + vty_out(vty, "\t\tarfcn %u%s", trx->arfcn, VTY_NEWLINE); + vty_out(vty, "\t\tmax_power_red %u%s", trx->max_power_red, VTY_NEWLINE); + + for (i = 0; i < TRX_NR_TS; i++) + config_write_ts_single(vty, &trx->ts[i]); +} + +static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) +{ + struct gsm_bts_trx *trx; + + vty_out(vty, "bts %u%s", bts->nr, VTY_NEWLINE); + vty_out(vty, "\ttype %s%s", btstype2str(bts->type), VTY_NEWLINE); + vty_out(vty, "\tband %s%s", gsm_band_name(bts->band), VTY_NEWLINE); + vty_out(vty, "\tlocation_area_code %u%s", bts->location_area_code, + VTY_NEWLINE); + vty_out(vty, "\ttraining_sequence_code %u%s", bts->tsc, VTY_NEWLINE); + vty_out(vty, "\tbase_station_id_code %u%s", bts->bsic, VTY_NEWLINE); + vty_out(vty, "\tunit_id %u %u%s", + bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE); + + llist_for_each_entry(trx, &bts->trx_list, list) + config_write_trx_single(vty, trx); +} + +static int config_write_bts(struct vty *v) +{ + struct gsm_bts *bts; + + llist_for_each_entry(bts, &gsmnet->bts_list, list) + config_write_bts_single(v, bts); + + return CMD_SUCCESS; +} + + static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx) { vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s", @@ -224,6 +274,7 @@ DEFUN(show_trx, return CMD_SUCCESS; } + static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts) { struct in_addr ia; @@ -942,7 +993,7 @@ int bsc_vty_init(struct gsm_network *net) install_element(VIEW_NODE, &show_subscr_cmd); install_element(CONFIG_NODE, &cfg_bts_cmd); - install_node(&bts_node, dummy_config_write); + install_node(&bts_node, config_write_bts); install_default(BTS_NODE); install_element(BTS_NODE, &cfg_bts_type_cmd); install_element(BTS_NODE, &cfg_bts_band_cmd); -- cgit v1.2.3