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.
diff --git a/openbsc/src/vty_interface.c b/openbsc/src/vty_interface.c
index 11b2ff6..b480c3d 100644
--- a/openbsc/src/vty_interface.c
+++ b/openbsc/src/vty_interface.c
@@ -157,6 +157,56 @@
 	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 @@
 	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 @@
 	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);