blob: 9645af23abb523df2d597620fa47a2abc77ec655 [file] [log] [blame]
Harald Welte68628e82009-03-10 12:17:57 +00001/* OpenBSC interface to quagga VTY */
2/* (C) 2009 by Harald Welte <laforge@gnumonks.org>
3 * All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#include <stdlib.h>
22#include <unistd.h>
23#include <sys/types.h>
24
25#include <vty/command.h>
Harald Weltef9daefd2009-08-09 15:13:54 +020026#include <vty/buffer.h>
Harald Welte68628e82009-03-10 12:17:57 +000027#include <vty/vty.h>
28
29#include <arpa/inet.h>
30
Harald Welte1bc77352009-03-10 19:47:51 +000031#include <openbsc/linuxlist.h>
Harald Welte68628e82009-03-10 12:17:57 +000032#include <openbsc/gsm_data.h>
Harald Welte68628e82009-03-10 12:17:57 +000033#include <openbsc/e1_input.h>
Harald Welte1bc77352009-03-10 19:47:51 +000034#include <openbsc/abis_nm.h>
Harald Weltef9daefd2009-08-09 15:13:54 +020035#include <openbsc/gsm_utils.h>
Harald Welteb908cb72009-12-22 13:09:29 +010036#include <openbsc/chan_alloc.h>
Harald Welte8387a492009-12-22 21:43:14 +010037#include <openbsc/meas_rep.h>
Harald Welte40f82892009-05-23 17:31:39 +000038#include <openbsc/db.h>
Harald Welte5013b2a2009-08-07 13:29:14 +020039#include <openbsc/talloc.h>
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +010040#include <openbsc/telnet_interface.h>
Harald Welte68628e82009-03-10 12:17:57 +000041
42static struct gsm_network *gsmnet;
43
Harald Welte5013b2a2009-08-07 13:29:14 +020044struct cmd_node net_node = {
45 GSMNET_NODE,
46 "%s(network)#",
47 1,
48};
49
Harald Welte68628e82009-03-10 12:17:57 +000050struct cmd_node bts_node = {
51 BTS_NODE,
52 "%s(bts)#",
53 1,
54};
55
56struct cmd_node trx_node = {
57 TRX_NODE,
58 "%s(trx)#",
59 1,
60};
61
62struct cmd_node ts_node = {
63 TS_NODE,
64 "%s(ts)#",
65 1,
66};
67
68static int dummy_config_write(struct vty *v)
69{
70 return CMD_SUCCESS;
71}
72
73static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
74{
Harald Welte1bc77352009-03-10 19:47:51 +000075 vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s",
76 nm_opstate_name(nms->operational), nms->administrative,
77 nm_avail_name(nms->availability), VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +000078}
79
Harald Welteb908cb72009-12-22 13:09:29 +010080static void dump_pchan_load_vty(struct vty *vty, char *prefix,
81 const struct pchan_load *pl)
82{
83 int i;
84
85 for (i = 0; i < ARRAY_SIZE(pl->pchan); i++) {
86 const struct load_counter *lc = &pl->pchan[i];
87 unsigned int percent;
88
89 if (lc->total == 0)
90 continue;
91
92 percent = (lc->used * 100) / lc->total;
93
94 vty_out(vty, "%s%20s: %3u%% (%u/%u)%s", prefix,
95 gsm_pchan_name(i), percent, lc->used, lc->total,
96 VTY_NEWLINE);
97 }
98}
99
Harald Welte68628e82009-03-10 12:17:57 +0000100static void net_dump_vty(struct vty *vty, struct gsm_network *net)
101{
Harald Welteb908cb72009-12-22 13:09:29 +0100102 struct pchan_load pl;
103
Harald Welteef235b52009-03-10 12:34:02 +0000104 vty_out(vty, "BSC is on Country Code %u, Network Code %u "
105 "and has %u BTS%s", net->country_code, net->network_code,
106 net->num_bts, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000107 vty_out(vty, " Long network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000108 net->name_long, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000109 vty_out(vty, " Short network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000110 net->name_short, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200111 vty_out(vty, " Authentication policy: %s%s",
112 gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100113 vty_out(vty, " Location updating reject cause: %u%s",
114 net->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900115 vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption,
116 VTY_NEWLINE);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +0100117 vty_out(vty, " NECI (TCH/H): %u%s", net->neci,
118 VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100119 vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode),
120 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100121 vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off",
122 VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100123 vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off",
124 VTY_NEWLINE);
Harald Welteb908cb72009-12-22 13:09:29 +0100125 network_chan_load(&pl, net);
126 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
127 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000128}
129
130DEFUN(show_net, show_net_cmd, "show network",
131 SHOW_STR "Display information about a GSM NETWORK\n")
132{
133 struct gsm_network *net = gsmnet;
134 net_dump_vty(vty, net);
135
136 return CMD_SUCCESS;
137}
138
139static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l)
140{
Harald Welteedb37782009-05-01 14:59:07 +0000141 struct e1inp_line *line;
142
143 if (!e1l) {
144 vty_out(vty, " None%s", VTY_NEWLINE);
145 return;
146 }
147
148 line = e1l->ts->line;
149
150 vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s",
151 line->num, line->driver->name, e1l->ts->num,
Harald Welte1bc77352009-03-10 19:47:51 +0000152 e1inp_signtype_name(e1l->type), VTY_NEWLINE);
Harald Welteedb37782009-05-01 14:59:07 +0000153 vty_out(vty, " E1 TEI %u, SAPI %u%s",
Harald Welte68628e82009-03-10 12:17:57 +0000154 e1l->tei, e1l->sapi, VTY_NEWLINE);
155}
156
157static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
158{
Harald Welteb908cb72009-12-22 13:09:29 +0100159 struct pchan_load pl;
160
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200161 vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
Harald Weltefcd24452009-06-20 18:15:19 +0200162 "BSIC %u, TSC %u and %u TRX%s",
163 bts->nr, btstype2str(bts->type), gsm_band_name(bts->band),
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200164 bts->cell_identity,
Harald Weltefcd24452009-06-20 18:15:19 +0200165 bts->location_area_code, bts->bsic, bts->tsc,
166 bts->num_trx, VTY_NEWLINE);
Harald Welte1d8dbc42009-12-12 15:38:16 +0100167 vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100168 vty_out(vty, "Minimum Rx Level for Access: %i dBm%s",
Harald Welte1d8dbc42009-12-12 15:38:16 +0100169 rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min),
170 VTY_NEWLINE);
171 vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s",
Harald Welte73225282009-12-12 18:17:25 +0100172 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100173 vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer,
174 VTY_NEWLINE);
175 vty_out(vty, "RACH Max transmissions: %u%s",
176 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
177 VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100178 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200179 vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE);
Harald Welte4cc34222009-05-01 15:12:31 +0000180 if (is_ipaccess_bts(bts))
Harald Welte8175e952009-10-20 00:22:00 +0200181 vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
Harald Welte4cc34222009-05-01 15:12:31 +0000182 bts->ip_access.site_id, bts->ip_access.bts_id,
Harald Welte8175e952009-10-20 00:22:00 +0200183 bts->oml_tei, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000184 vty_out(vty, " NM State: ");
185 net_dump_nmstate(vty, &bts->nm_state);
186 vty_out(vty, " Site Mgr NM State: ");
187 net_dump_nmstate(vty, &bts->site_mgr.nm_state);
188 vty_out(vty, " Paging: FIXME pending requests, %u free slots%s",
189 bts->paging.available_slots, VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200190 if (!is_ipaccess_bts(bts)) {
191 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
192 e1isl_dump_vty(vty, bts->oml_link);
193 }
Harald Welte68628e82009-03-10 12:17:57 +0000194 /* FIXME: oml_link, chan_desc */
Harald Welteb908cb72009-12-22 13:09:29 +0100195 memset(&pl, 0, sizeof(pl));
196 bts_chan_load(&pl, bts);
197 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
198 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000199}
200
201DEFUN(show_bts, show_bts_cmd, "show bts [number]",
202 SHOW_STR "Display information about a BTS\n"
203 "BTS number")
204{
205 struct gsm_network *net = gsmnet;
206 int bts_nr;
207
208 if (argc != 0) {
209 /* use the BTS number that the user has specified */
210 bts_nr = atoi(argv[0]);
211 if (bts_nr > net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000212 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000213 VTY_NEWLINE);
214 return CMD_WARNING;
215 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200216 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000217 return CMD_SUCCESS;
218 }
219 /* print all BTS's */
220 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee441d9c2009-06-21 16:17:15 +0200221 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000222
223 return CMD_SUCCESS;
224}
225
Harald Welte42581822009-08-08 16:12:58 +0200226/* utility functions */
227static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
228 const char *ts, const char *ss)
229{
230 e1_link->e1_nr = atoi(line);
231 e1_link->e1_ts = atoi(ts);
232 if (!strcmp(ss, "full"))
233 e1_link->e1_ts_ss = 255;
234 else
235 e1_link->e1_ts_ss = atoi(ss);
236}
237
238static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,
239 const char *prefix)
240{
241 if (!e1_link->e1_ts)
242 return;
243
244 if (e1_link->e1_ts_ss == 255)
245 vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s",
246 prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE);
247 else
248 vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s",
249 prefix, e1_link->e1_nr, e1_link->e1_ts,
250 e1_link->e1_ts_ss, VTY_NEWLINE);
251}
252
253
Harald Welte67ce0732009-08-06 19:06:46 +0200254static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
255{
Harald Welte42581822009-08-08 16:12:58 +0200256 vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
257 if (ts->pchan != GSM_PCHAN_NONE)
258 vty_out(vty, " phys_chan_config %s%s",
259 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
260 config_write_e1_link(vty, &ts->e1_link, " ");
Harald Welte67ce0732009-08-06 19:06:46 +0200261}
262
263static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
264{
265 int i;
266
Harald Welte5013b2a2009-08-07 13:29:14 +0200267 vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE);
268 vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
269 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200270 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
271 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte67ce0732009-08-06 19:06:46 +0200272
273 for (i = 0; i < TRX_NR_TS; i++)
274 config_write_ts_single(vty, &trx->ts[i]);
275}
276
277static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
278{
279 struct gsm_bts_trx *trx;
280
Harald Welte5013b2a2009-08-07 13:29:14 +0200281 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
282 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
283 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freytherf926ed62009-11-19 16:38:49 +0100284 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200285 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte67ce0732009-08-06 19:06:46 +0200286 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200287 vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE);
288 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)0e451d02009-08-13 10:14:26 +0200289 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100290 vty_out(vty, " cell reselection hysteresis %u%s",
291 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
292 vty_out(vty, " rxlev access min %u%s",
293 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Harald Weltea43f7892009-12-01 18:04:30 +0530294 if (bts->si_common.chan_desc.t3212)
Harald Welte (local)efc92312009-08-14 23:09:25 +0200295 vty_out(vty, " periodic location update %u%s",
Harald Weltea43f7892009-12-01 18:04:30 +0530296 bts->si_common.chan_desc.t3212 * 10, VTY_NEWLINE);
Harald Welte7a8fa412009-08-10 13:48:16 +0200297 vty_out(vty, " channel allocator %s%s",
298 bts->chan_alloc_reverse ? "descending" : "ascending",
299 VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100300 vty_out(vty, " rach tx integer %u%s",
301 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
302 vty_out(vty, " rach max transmission %u%s",
303 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
304 VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100305 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200306 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200307 if (is_ipaccess_bts(bts)) {
Harald Welte5013b2a2009-08-07 13:29:14 +0200308 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Weltea6fd58e2009-08-07 00:25:23 +0200309 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200310 vty_out(vty, " oml ip.access stream_id %u%s", bts->oml_tei, VTY_NEWLINE);
311 } else {
Harald Welte42581822009-08-08 16:12:58 +0200312 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
313 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
314 }
Harald Welte67ce0732009-08-06 19:06:46 +0200315
316 llist_for_each_entry(trx, &bts->trx_list, list)
317 config_write_trx_single(vty, trx);
318}
319
320static int config_write_bts(struct vty *v)
321{
322 struct gsm_bts *bts;
323
324 llist_for_each_entry(bts, &gsmnet->bts_list, list)
325 config_write_bts_single(v, bts);
326
327 return CMD_SUCCESS;
328}
329
Harald Welte5013b2a2009-08-07 13:29:14 +0200330static int config_write_net(struct vty *vty)
331{
332 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200333 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200334 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200335 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
336 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200337 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100338 vty_out(vty, " location updating reject cause %u%s",
339 gsmnet->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900340 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freytherd54c3372009-11-19 16:37:48 +0100341 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100342 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
343 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100344 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100345 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Welteb720bd32009-12-21 16:51:50 +0100346 vty_out(vty, " handover window rxlev averaging %u%s",
347 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
348 vty_out(vty, " handover window rxqual averaging %u%s",
349 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
350 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
351 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
352 vty_out(vty, " handover power budget interval %u%s",
353 gsmnet->handover.pwr_interval, VTY_NEWLINE);
354 vty_out(vty, " handover power budget hysteresis %u%s",
355 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
356 vty_out(vty, " handover maximum distance %u%s",
357 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +0100358 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100359 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
360 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
361 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
362 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
363 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
364 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
365 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
366 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
367 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
368 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200369
370 return CMD_SUCCESS;
371}
Harald Welte67ce0732009-08-06 19:06:46 +0200372
Harald Welte68628e82009-03-10 12:17:57 +0000373static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
374{
375 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
376 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Weltefcd24452009-06-20 18:15:19 +0200377 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte42581822009-08-08 16:12:58 +0200378 "resulting BS power: %d dBm%s",
Harald Weltefcd24452009-06-20 18:15:19 +0200379 trx->nominal_power, trx->max_power_red,
Harald Welte42581822009-08-08 16:12:58 +0200380 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000381 vty_out(vty, " NM State: ");
382 net_dump_nmstate(vty, &trx->nm_state);
383 vty_out(vty, " Baseband Transceiver NM State: ");
384 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte8175e952009-10-20 00:22:00 +0200385 if (is_ipaccess_bts(trx->bts)) {
386 vty_out(vty, " ip.access stream ID: 0x%02x%s",
387 trx->rsl_tei, VTY_NEWLINE);
388 } else {
389 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
390 e1isl_dump_vty(vty, trx->rsl_link);
391 }
Harald Welte68628e82009-03-10 12:17:57 +0000392}
393
394DEFUN(show_trx,
395 show_trx_cmd,
396 "show trx [bts_nr] [trx_nr]",
397 SHOW_STR "Display information about a TRX\n")
398{
399 struct gsm_network *net = gsmnet;
400 struct gsm_bts *bts = NULL;
401 struct gsm_bts_trx *trx;
402 int bts_nr, trx_nr;
403
404 if (argc >= 1) {
405 /* use the BTS number that the user has specified */
406 bts_nr = atoi(argv[0]);
407 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000408 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000409 VTY_NEWLINE);
410 return CMD_WARNING;
411 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200412 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000413 }
414 if (argc >= 2) {
415 trx_nr = atoi(argv[1]);
416 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000417 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000418 VTY_NEWLINE);
419 return CMD_WARNING;
420 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200421 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000422 trx_dump_vty(vty, trx);
423 return CMD_SUCCESS;
424 }
425 if (bts) {
426 /* print all TRX in this BTS */
427 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200428 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000429 trx_dump_vty(vty, trx);
430 }
431 return CMD_SUCCESS;
432 }
433
434 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200435 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000436 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200437 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000438 trx_dump_vty(vty, trx);
439 }
440 }
441
442 return CMD_SUCCESS;
443}
444
Harald Welte67ce0732009-08-06 19:06:46 +0200445
Harald Welte68628e82009-03-10 12:17:57 +0000446static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
447{
Harald Welte68628e82009-03-10 12:17:57 +0000448 vty_out(vty, "Timeslot %u of TRX %u in BTS %u, phys cfg %s%s",
449 ts->nr, ts->trx->nr, ts->trx->bts->nr,
450 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
451 vty_out(vty, " NM State: ");
452 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte2c828992009-12-02 01:56:49 +0530453 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welteef235b52009-03-10 12:34:02 +0000454 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
455 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
456 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000457}
458
459DEFUN(show_ts,
460 show_ts_cmd,
Harald Welte1bc77352009-03-10 19:47:51 +0000461 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
Harald Welte68628e82009-03-10 12:17:57 +0000462 SHOW_STR "Display information about a TS\n")
463{
464 struct gsm_network *net = gsmnet;
465 struct gsm_bts *bts;
466 struct gsm_bts_trx *trx;
467 struct gsm_bts_trx_ts *ts;
468 int bts_nr, trx_nr, ts_nr;
469
470 if (argc >= 1) {
471 /* use the BTS number that the user has specified */
472 bts_nr = atoi(argv[0]);
473 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000474 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000475 VTY_NEWLINE);
476 return CMD_WARNING;
477 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200478 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000479 }
480 if (argc >= 2) {
481 trx_nr = atoi(argv[1]);
482 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000483 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000484 VTY_NEWLINE);
485 return CMD_WARNING;
486 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200487 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000488 }
489 if (argc >= 3) {
490 ts_nr = atoi(argv[2]);
491 if (ts_nr >= TRX_NR_TS) {
Harald Welte1bc77352009-03-10 19:47:51 +0000492 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
Harald Welte68628e82009-03-10 12:17:57 +0000493 VTY_NEWLINE);
494 return CMD_WARNING;
495 }
496 ts = &trx->ts[ts_nr];
497 ts_dump_vty(vty, ts);
498 return CMD_SUCCESS;
499 }
500 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200501 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000502 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200503 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000504 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
505 ts = &trx->ts[ts_nr];
506 ts_dump_vty(vty, ts);
507 }
508 }
509 }
510
511 return CMD_SUCCESS;
512}
513
Holger Hans Peter Freythercfa90d42009-08-10 10:17:50 +0200514void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte68628e82009-03-10 12:17:57 +0000515{
Harald Weltefcd24452009-06-20 18:15:19 +0200516 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte40f82892009-05-23 17:31:39 +0000517 subscr->authorized, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000518 if (subscr->name)
Harald Welte1bc77352009-03-10 19:47:51 +0000519 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000520 if (subscr->extension)
521 vty_out(vty, " Extension: %s%s", subscr->extension,
522 VTY_NEWLINE);
523 if (subscr->imsi)
524 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freyther22230252009-08-19 12:53:57 +0200525 if (subscr->tmsi != GSM_RESERVED_TMSI)
526 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte731fd912009-08-15 03:24:51 +0200527 VTY_NEWLINE);
Harald Welte (local)15920de2009-08-14 20:27:16 +0200528 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000529}
530
Harald Welte8387a492009-12-22 21:43:14 +0100531static void meas_rep_dump_uni_vty(struct vty *vty,
532 struct gsm_meas_rep_unidir *mru,
533 const char *prefix,
534 const char *dir)
535{
536 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
537 prefix, dir, rxlev2dbm(mru->full.rx_lev),
538 dir, rxlev2dbm(mru->sub.rx_lev));
539 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
540 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
541 VTY_NEWLINE);
542}
543
544static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
545 const char *prefix)
546{
547 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
548 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
549 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
550 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
551 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
552 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
553 VTY_NEWLINE);
554 if (mr->flags & MEAS_REP_F_MS_TO)
555 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
556 mr->ms_timing_offset, VTY_NEWLINE);
557 if (mr->flags & MEAS_REP_F_MS_L1)
558 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
559 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
560 if (mr->flags & MEAS_REP_F_DL_VALID)
561 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
562 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
563}
564
Harald Welte68628e82009-03-10 12:17:57 +0000565static void lchan_dump_vty(struct vty *vty, struct gsm_lchan *lchan)
566{
Harald Welte8387a492009-12-22 21:43:14 +0100567 int idx;
568
Harald Welte68628e82009-03-10 12:17:57 +0000569 vty_out(vty, "Lchan %u in Timeslot %u of TRX %u in BTS %u, Type %s%s",
570 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
571 lchan->ts->trx->bts->nr, gsm_lchan_name(lchan->type),
572 VTY_NEWLINE);
573 vty_out(vty, " Use Count: %u%s", lchan->use_count, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100574 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
575 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
576 - lchan->bs_power*2,
577 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
578 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000579 if (lchan->subscr) {
580 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
581 subscr_dump_vty(vty, lchan->subscr);
582 } else
583 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte2c828992009-12-02 01:56:49 +0530584 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
585 struct in_addr ia;
586 ia.s_addr = lchan->abis_ip.bound_ip;
587 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
588 inet_ntoa(ia), lchan->abis_ip.bound_port,
589 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
590 VTY_NEWLINE);
591 }
Harald Welte8387a492009-12-22 21:43:14 +0100592
593 /* we want to report the last measurement report */
594 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
595 lchan->meas_rep_idx, 1);
596 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte68628e82009-03-10 12:17:57 +0000597}
598
Harald Welte4bfdfe72009-06-10 23:11:52 +0800599#if 0
600TODO: callref and remote callref of call must be resolved to get gsm_trans object
Harald Welte68628e82009-03-10 12:17:57 +0000601static void call_dump_vty(struct vty *vty, struct gsm_call *call)
602{
603 vty_out(vty, "Call Type %u, State %u, Transaction ID %u%s",
604 call->type, call->state, call->transaction_id, VTY_NEWLINE);
605
606 if (call->local_lchan) {
607 vty_out(vty, "Call Local Channel:%s", VTY_NEWLINE);
608 lchan_dump_vty(vty, call->local_lchan);
609 } else
610 vty_out(vty, "Call has no Local Channel%s", VTY_NEWLINE);
611
612 if (call->remote_lchan) {
613 vty_out(vty, "Call Remote Channel:%s", VTY_NEWLINE);
614 lchan_dump_vty(vty, call->remote_lchan);
615 } else
616 vty_out(vty, "Call has no Remote Channel%s", VTY_NEWLINE);
617
618 if (call->called_subscr) {
619 vty_out(vty, "Called Subscriber:%s", VTY_NEWLINE);
620 subscr_dump_vty(vty, call->called_subscr);
621 } else
622 vty_out(vty, "Call has no Called Subscriber%s", VTY_NEWLINE);
623}
Harald Welte4bfdfe72009-06-10 23:11:52 +0800624#endif
Harald Welte68628e82009-03-10 12:17:57 +0000625
626DEFUN(show_lchan,
627 show_lchan_cmd,
628 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
629 SHOW_STR "Display information about a logical channel\n")
630{
631 struct gsm_network *net = gsmnet;
632 struct gsm_bts *bts;
633 struct gsm_bts_trx *trx;
634 struct gsm_bts_trx_ts *ts;
635 struct gsm_lchan *lchan;
636 int bts_nr, trx_nr, ts_nr, lchan_nr;
637
638 if (argc >= 1) {
639 /* use the BTS number that the user has specified */
640 bts_nr = atoi(argv[0]);
641 if (bts_nr >= net->num_bts) {
642 vty_out(vty, "%% can't find BTS %s%s", argv[0],
643 VTY_NEWLINE);
644 return CMD_WARNING;
645 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200646 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000647 }
648 if (argc >= 2) {
649 trx_nr = atoi(argv[1]);
650 if (trx_nr >= bts->num_trx) {
651 vty_out(vty, "%% can't find TRX %s%s", argv[1],
652 VTY_NEWLINE);
653 return CMD_WARNING;
654 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200655 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000656 }
657 if (argc >= 3) {
658 ts_nr = atoi(argv[2]);
659 if (ts_nr >= TRX_NR_TS) {
660 vty_out(vty, "%% can't find TS %s%s", argv[2],
661 VTY_NEWLINE);
662 return CMD_WARNING;
663 }
664 ts = &trx->ts[ts_nr];
665 }
666 if (argc >= 4) {
667 lchan_nr = atoi(argv[3]);
668 if (lchan_nr >= TS_MAX_LCHAN) {
669 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
670 VTY_NEWLINE);
671 return CMD_WARNING;
672 }
673 lchan = &ts->lchan[lchan_nr];
674 lchan_dump_vty(vty, lchan);
675 return CMD_SUCCESS;
676 }
677 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200678 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000679 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200680 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000681 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
682 ts = &trx->ts[ts_nr];
683 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
684 lchan_nr++) {
685 lchan = &ts->lchan[lchan_nr];
Harald Welteef235b52009-03-10 12:34:02 +0000686 if (lchan->type == GSM_LCHAN_NONE)
687 continue;
Harald Welte68628e82009-03-10 12:17:57 +0000688 lchan_dump_vty(vty, lchan);
689 }
690 }
691 }
692 }
693
694 return CMD_SUCCESS;
695}
696
Harald Welte1bc77352009-03-10 19:47:51 +0000697static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
698{
699 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
700}
701
702DEFUN(show_e1drv,
703 show_e1drv_cmd,
704 "show e1_driver",
705 SHOW_STR "Display information about available E1 drivers\n")
706{
707 struct e1inp_driver *drv;
708
709 llist_for_each_entry(drv, &e1inp_driver_list, list)
710 e1drv_dump_vty(vty, drv);
711
712 return CMD_SUCCESS;
713}
714
Harald Welte68628e82009-03-10 12:17:57 +0000715static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
716{
717 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
718 line->num, line->name ? line->name : "",
719 line->driver->name, VTY_NEWLINE);
720}
721
722DEFUN(show_e1line,
723 show_e1line_cmd,
724 "show e1_line [line_nr]",
725 SHOW_STR "Display information about a E1 line\n")
726{
Harald Welte1bc77352009-03-10 19:47:51 +0000727 struct e1inp_line *line;
728
729 if (argc >= 1) {
730 int num = atoi(argv[0]);
731 llist_for_each_entry(line, &e1inp_line_list, list) {
732 if (line->num == num) {
733 e1line_dump_vty(vty, line);
734 return CMD_SUCCESS;
735 }
736 }
737 return CMD_WARNING;
738 }
739
740 llist_for_each_entry(line, &e1inp_line_list, list)
741 e1line_dump_vty(vty, line);
742
743 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000744}
745
746static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
747{
Harald Welte42581822009-08-08 16:12:58 +0200748 if (ts->type == E1INP_TS_TYPE_NONE)
749 return;
Harald Welte1bc77352009-03-10 19:47:51 +0000750 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
751 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
752 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000753}
754
755DEFUN(show_e1ts,
756 show_e1ts_cmd,
757 "show e1_timeslot [line_nr] [ts_nr]",
758 SHOW_STR "Display information about a E1 timeslot\n")
759{
Harald Welte986c3d72009-11-17 06:12:16 +0100760 struct e1inp_line *line = NULL;
Harald Welte1bc77352009-03-10 19:47:51 +0000761 struct e1inp_ts *ts;
762 int ts_nr;
Harald Welte68628e82009-03-10 12:17:57 +0000763
Harald Welte1bc77352009-03-10 19:47:51 +0000764 if (argc == 0) {
765 llist_for_each_entry(line, &e1inp_line_list, list) {
766 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
767 ts = &line->ts[ts_nr];
768 e1ts_dump_vty(vty, ts);
769 }
770 }
771 return CMD_SUCCESS;
772 }
773 if (argc >= 1) {
774 int num = atoi(argv[0]);
775 llist_for_each_entry(line, &e1inp_line_list, list) {
776 if (line->num == num)
777 break;
778 }
779 if (!line || line->num != num) {
780 vty_out(vty, "E1 line %s is invalid%s",
781 argv[0], VTY_NEWLINE);
782 return CMD_WARNING;
783 }
784 }
785 if (argc >= 2) {
786 ts_nr = atoi(argv[1]);
787 if (ts_nr > NUM_E1_TS) {
788 vty_out(vty, "E1 timeslot %s is invalid%s",
789 argv[1], VTY_NEWLINE);
790 return CMD_WARNING;
791 }
792 ts = &line->ts[ts_nr];
793 e1ts_dump_vty(vty, ts);
794 return CMD_SUCCESS;
795 } else {
796 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
797 ts = &line->ts[ts_nr];
798 e1ts_dump_vty(vty, ts);
799 }
800 return CMD_SUCCESS;
801 }
802 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000803}
804
Harald Weltebe4b7302009-05-23 16:59:33 +0000805static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
Harald Weltef5025b62009-03-28 16:55:11 +0000806{
807 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
808 subscr_dump_vty(vty, pag->subscr);
809}
810
Harald Weltebe4b7302009-05-23 16:59:33 +0000811static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
Harald Weltef5025b62009-03-28 16:55:11 +0000812{
813 struct gsm_paging_request *pag;
814
815 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
816 paging_dump_vty(vty, pag);
817}
818
819DEFUN(show_paging,
820 show_paging_cmd,
821 "show paging [bts_nr]",
Harald Weltebe4b7302009-05-23 16:59:33 +0000822 SHOW_STR "Display information about paging reuqests of a BTS\n")
Harald Weltef5025b62009-03-28 16:55:11 +0000823{
824 struct gsm_network *net = gsmnet;
825 struct gsm_bts *bts;
826 int bts_nr;
827
828 if (argc >= 1) {
829 /* use the BTS number that the user has specified */
830 bts_nr = atoi(argv[0]);
831 if (bts_nr >= net->num_bts) {
832 vty_out(vty, "%% can't find BTS %s%s", argv[0],
833 VTY_NEWLINE);
834 return CMD_WARNING;
835 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200836 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +0000837 bts_paging_dump_vty(vty, bts);
838
839 return CMD_SUCCESS;
840 }
841 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200842 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +0000843 bts_paging_dump_vty(vty, bts);
844 }
845
846 return CMD_SUCCESS;
847}
848
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +0100849static void _vty_output(struct debug_target *tgt, const char *line)
850{
851 struct vty *vty = tgt->tgt_vty.vty;
852 vty_out(vty, "%s", line);
853 /* This is an ugly hack, but there is no easy way... */
854 if (strchr(line, '\n'))
855 vty_out(vty, "\r");
856}
857
858struct debug_target *debug_target_create_vty(struct vty *vty)
859{
860 struct debug_target *target;
861
862 target = debug_target_create();
863 if (!target)
864 return NULL;
865
866 target->tgt_vty.vty = vty;
867 target->output = _vty_output;
868 return target;
869}
870
871DEFUN(enable_logging,
872 enable_logging_cmd,
873 "logging enable",
874 "Enables logging to this vty\n")
875{
876 struct telnet_connection *conn;
877
878 conn = (struct telnet_connection *) vty->priv;
879 if (conn->dbg) {
880 vty_out(vty, "Logging already enabled.%s", VTY_NEWLINE);
881 return CMD_WARNING;
882 }
883
884 conn->dbg = debug_target_create_vty(vty);
885 if (!conn->dbg)
886 return CMD_WARNING;
887
888 debug_add_target(conn->dbg);
889 return CMD_SUCCESS;
890}
891
892DEFUN(logging_fltr_imsi,
893 logging_fltr_imsi_cmd,
894 "logging filter imsi IMSI",
895 "Print all messages related to a IMSI\n")
896{
897 struct telnet_connection *conn;
898
899 conn = (struct telnet_connection *) vty->priv;
900 if (!conn->dbg) {
901 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
902 return CMD_WARNING;
903 }
904
905 debug_set_imsi_filter(conn->dbg, argv[0]);
906 return CMD_SUCCESS;
907}
908
909DEFUN(logging_fltr_all,
910 logging_fltr_all_cmd,
911 "logging filter all <0-1>",
912 "Print all messages to the console\n")
913{
914 struct telnet_connection *conn;
915
916 conn = (struct telnet_connection *) vty->priv;
917 if (!conn->dbg) {
918 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
919 return CMD_WARNING;
920 }
921
922 debug_set_all_filter(conn->dbg, atoi(argv[0]));
923 return CMD_SUCCESS;
924}
925
926DEFUN(logging_use_clr,
927 logging_use_clr_cmd,
928 "logging use color <0-1>",
929 "Use color for printing messages\n")
930{
931 struct telnet_connection *conn;
932
933 conn = (struct telnet_connection *) vty->priv;
934 if (!conn->dbg) {
935 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
936 return CMD_WARNING;
937 }
938
939 debug_set_use_color(conn->dbg, atoi(argv[0]));
940 return CMD_SUCCESS;
941}
942
943DEFUN(logging_prnt_timestamp,
944 logging_prnt_timestamp_cmd,
945 "logging print timestamp <0-1>",
946 "Print the timestamp of each message\n")
947{
948 struct telnet_connection *conn;
949
950 conn = (struct telnet_connection *) vty->priv;
951 if (!conn->dbg) {
952 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
953 return CMD_WARNING;
954 }
955
956 debug_set_print_timestamp(conn->dbg, atoi(argv[0]));
957 return CMD_SUCCESS;
958}
959
960DEFUN(logging_set_category_mask,
961 logging_set_category_mask_cmd,
962 "logging set debug mask MASK",
963 "Decide which categories to output.\n")
964{
965 struct telnet_connection *conn;
966
967 conn = (struct telnet_connection *) vty->priv;
968 if (!conn->dbg) {
969 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
970 return CMD_WARNING;
971 }
972
973 debug_parse_category_mask(conn->dbg, argv[0]);
974 return CMD_SUCCESS;
975}
976
977DEFUN(logging_set_log_level,
978 logging_set_log_level_cmd,
979 "logging set log level <0-8>",
980 "Set the global log level. The value 0 implies no filtering.\n")
981{
982 struct telnet_connection *conn;
983
984 conn = (struct telnet_connection *) vty->priv;
985 if (!conn->dbg) {
986 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
987 return CMD_WARNING;
988 }
989
990 debug_set_log_level(conn->dbg, atoi(argv[0]));
991 return CMD_SUCCESS;
992}
993
994DEFUN(diable_logging,
995 disable_logging_cmd,
996 "logging disable",
997 "Disables logging to this vty\n")
998{
999 struct telnet_connection *conn;
1000
1001 conn = (struct telnet_connection *) vty->priv;
1002 if (!conn->dbg) {
1003 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
1004 return CMD_WARNING;
1005 }
1006
1007 debug_del_target(conn->dbg);
1008 talloc_free(conn->dbg);
1009 conn->dbg = NULL;
1010 return CMD_SUCCESS;
1011}
1012
Harald Welte24ff6ee2009-12-22 00:41:05 +01001013DEFUN(show_stats,
1014 show_stats_cmd,
1015 "show statistics",
1016 SHOW_STR "Display network statistics\n")
1017{
1018 struct gsm_network *net = gsmnet;
1019
Harald Weltee2b8ece2009-12-22 21:47:48 +01001020 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
Harald Welteffa55a42009-12-22 19:07:32 +01001021 counter_get(net->stats.chreq.total),
1022 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
Harald Weltee2b8ece2009-12-22 21:47:48 +01001023 vty_out(vty, "Location Update : %lu attach, %lu normal, %lu periodic%s",
Harald Welteffa55a42009-12-22 19:07:32 +01001024 counter_get(net->stats.loc_upd_type.attach),
1025 counter_get(net->stats.loc_upd_type.normal),
1026 counter_get(net->stats.loc_upd_type.periodic), VTY_NEWLINE);
Harald Weltee2b8ece2009-12-22 21:47:48 +01001027 vty_out(vty, "IMSI Detach Indications : %lu%s",
Harald Welteffa55a42009-12-22 19:07:32 +01001028 counter_get(net->stats.loc_upd_type.detach), VTY_NEWLINE);
Harald Welte24ff6ee2009-12-22 00:41:05 +01001029 vty_out(vty, "Location Update Response: %lu accept, %lu reject%s",
Harald Welteffa55a42009-12-22 19:07:32 +01001030 counter_get(net->stats.loc_upd_resp.accept),
1031 counter_get(net->stats.loc_upd_resp.reject), VTY_NEWLINE);
Harald Weltee2b8ece2009-12-22 21:47:48 +01001032 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
Harald Welteffa55a42009-12-22 19:07:32 +01001033 counter_get(net->stats.paging.attempted),
1034 counter_get(net->stats.paging.completed),
1035 counter_get(net->stats.paging.expired), VTY_NEWLINE);
Harald Weltee2b8ece2009-12-22 21:47:48 +01001036 vty_out(vty, "Handover : %lu attempted, %lu no_channel, %lu timeout, "
Harald Welteffa55a42009-12-22 19:07:32 +01001037 "%lu completed, %lu failed%s",
1038 counter_get(net->stats.handover.attempted),
1039 counter_get(net->stats.handover.no_channel),
1040 counter_get(net->stats.handover.timeout),
1041 counter_get(net->stats.handover.completed),
1042 counter_get(net->stats.handover.failed), VTY_NEWLINE);
Harald Weltee2b8ece2009-12-22 21:47:48 +01001043 vty_out(vty, "SMS MO : %lu submitted, %lu no receiver%s",
Harald Welteffa55a42009-12-22 19:07:32 +01001044 counter_get(net->stats.sms.submitted),
1045 counter_get(net->stats.sms.no_receiver), VTY_NEWLINE);
Harald Weltee2b8ece2009-12-22 21:47:48 +01001046 vty_out(vty, "SMS MT : %lu delivered, %lu no memory, %lu other error%s",
Harald Welteffa55a42009-12-22 19:07:32 +01001047 counter_get(net->stats.sms.delivered),
1048 counter_get(net->stats.sms.rp_err_mem),
1049 counter_get(net->stats.sms.rp_err_other), VTY_NEWLINE);
Harald Welte24ff6ee2009-12-22 00:41:05 +01001050 return CMD_SUCCESS;
1051}
1052
Harald Welte5013b2a2009-08-07 13:29:14 +02001053DEFUN(cfg_net,
1054 cfg_net_cmd,
1055 "network",
1056 "Configure the GSM network")
1057{
1058 vty->index = gsmnet;
1059 vty->node = GSMNET_NODE;
1060
1061 return CMD_SUCCESS;
1062}
1063
1064
1065DEFUN(cfg_net_ncc,
1066 cfg_net_ncc_cmd,
1067 "network country code <1-999>",
1068 "Set the GSM network country code")
1069{
1070 gsmnet->country_code = atoi(argv[0]);
1071
1072 return CMD_SUCCESS;
1073}
1074
1075DEFUN(cfg_net_mnc,
1076 cfg_net_mnc_cmd,
1077 "mobile network code <1-999>",
1078 "Set the GSM mobile network code")
1079{
1080 gsmnet->network_code = atoi(argv[0]);
1081
1082 return CMD_SUCCESS;
1083}
1084
1085DEFUN(cfg_net_name_short,
1086 cfg_net_name_short_cmd,
1087 "short name NAME",
1088 "Set the short GSM network name")
1089{
1090 if (gsmnet->name_short)
1091 talloc_free(gsmnet->name_short);
1092
1093 gsmnet->name_short = talloc_strdup(gsmnet, argv[0]);
1094
1095 return CMD_SUCCESS;
1096}
1097
1098DEFUN(cfg_net_name_long,
1099 cfg_net_name_long_cmd,
1100 "long name NAME",
1101 "Set the long GSM network name")
1102{
1103 if (gsmnet->name_long)
1104 talloc_free(gsmnet->name_long);
1105
1106 gsmnet->name_long = talloc_strdup(gsmnet, argv[0]);
1107
1108 return CMD_SUCCESS;
1109}
Harald Welte40f82892009-05-23 17:31:39 +00001110
Harald Welte (local)69de3972009-08-12 14:42:23 +02001111DEFUN(cfg_net_auth_policy,
1112 cfg_net_auth_policy_cmd,
1113 "auth policy (closed|accept-all|token)",
1114 "Set the GSM network authentication policy\n")
1115{
1116 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
1117
1118 gsmnet->auth_policy = policy;
1119
1120 return CMD_SUCCESS;
1121}
1122
Harald Welte1085c092009-11-18 20:33:19 +01001123DEFUN(cfg_net_reject_cause,
1124 cfg_net_reject_cause_cmd,
1125 "location updating reject cause <2-111>",
1126 "Set the reject cause of location updating reject\n")
1127{
1128 gsmnet->reject_cause = atoi(argv[0]);
1129
1130 return CMD_SUCCESS;
1131}
1132
Harald Welte4381cfe2009-08-30 15:47:06 +09001133DEFUN(cfg_net_encryption,
1134 cfg_net_encryption_cmd,
1135 "encryption a5 (0|1|2)",
1136 "Enable or disable encryption (A5) for this network\n")
1137{
Andreas.Eversberg1059deb2009-11-17 09:55:26 +01001138 gsmnet->a5_encryption= atoi(argv[0]);
Harald Welte4381cfe2009-08-30 15:47:06 +09001139
1140 return CMD_SUCCESS;
1141}
1142
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001143DEFUN(cfg_net_neci,
1144 cfg_net_neci_cmd,
1145 "neci (0|1)",
1146 "Set if NECI of cell selection is to be set")
1147{
1148 gsmnet->neci = atoi(argv[0]);
1149 return CMD_SUCCESS;
1150}
1151
Harald Welteeab84a12009-12-13 10:53:12 +01001152DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1153 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
1154 "Set the Radio Resource Location Protocol Mode")
1155{
1156 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1157
1158 return CMD_SUCCESS;
1159}
1160
Harald Welte648b6ce2009-12-14 09:00:24 +01001161DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1162 "mm info (0|1)",
1163 "Whether to send MM INFO after LOC UPD ACCEPT")
1164{
1165 gsmnet->send_mm_info = atoi(argv[0]);
1166
1167 return CMD_SUCCESS;
1168}
1169
Harald Weltebc814502009-12-19 21:41:52 +01001170DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1171 "handover (0|1)",
1172 "Whether or not to use in-call handover")
1173{
Harald Weltefe03f0d2009-12-20 13:51:01 +01001174 if (ipacc_rtp_direct) {
1175 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1176 "is enabled by using the -P command line option%s",
1177 VTY_NEWLINE);
1178 return CMD_WARNING;
1179 }
Harald Weltebc814502009-12-19 21:41:52 +01001180 gsmnet->handover.active = atoi(argv[0]);
1181
1182 return CMD_SUCCESS;
1183}
1184
Harald Welteb720bd32009-12-21 16:51:50 +01001185DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1186 "handover window rxlev averaging <1-10>",
1187 "How many RxLev measurements are used for averaging")
1188{
1189 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1190 return CMD_SUCCESS;
1191}
1192
1193DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1194 "handover window rxqual averaging <1-10>",
1195 "How many RxQual measurements are used for averaging")
1196{
1197 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1198 return CMD_SUCCESS;
1199}
1200
1201DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1202 "handover window rxlev neighbor averaging <1-10>",
1203 "How many RxQual measurements are used for averaging")
1204{
1205 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1206 return CMD_SUCCESS;
1207}
1208
1209DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1210 "handover power budget interval <1-99>",
1211 "How often to check if we have a better cell (SACCH frames)")
1212{
1213 gsmnet->handover.pwr_interval = atoi(argv[0]);
1214 return CMD_SUCCESS;
1215}
1216
1217DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1218 "handover power budget hysteresis <0-999>",
1219 "How many dB does a neighbor to be stronger to become a HO candidate")
1220{
1221 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1222 return CMD_SUCCESS;
1223}
1224
1225DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1226 "handover maximum distance <0-9999>",
1227 "How big is the maximum timing advance before HO is forced")
1228{
1229 gsmnet->handover.max_distance = atoi(argv[0]);
1230 return CMD_SUCCESS;
1231}
Harald Weltebc814502009-12-19 21:41:52 +01001232
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001233#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001234 DEFUN(cfg_net_T##number, \
1235 cfg_net_T##number##_cmd, \
1236 "timer t" #number " <0-65535>", \
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001237 doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001238{ \
1239 int value = atoi(argv[0]); \
1240 \
1241 if (value < 0 || value > 65535) { \
1242 vty_out(vty, "Timer value %s out of range.%s", \
1243 argv[0], VTY_NEWLINE); \
1244 return CMD_WARNING; \
1245 } \
1246 \
1247 gsmnet->T##number = value; \
1248 return CMD_SUCCESS; \
1249}
1250
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001251DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1252DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1253DECLARE_TIMER(3105, "Currently not used.")
1254DECLARE_TIMER(3107, "Currently not used.")
1255DECLARE_TIMER(3109, "Currently not used.")
1256DECLARE_TIMER(3111, "Currently not used.")
1257DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1258DECLARE_TIMER(3115, "Currently not used.")
1259DECLARE_TIMER(3117, "Currently not used.")
1260DECLARE_TIMER(3119, "Currently not used.")
1261DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001262
1263
Harald Welte5258fc42009-03-28 19:07:53 +00001264/* per-BTS configuration */
1265DEFUN(cfg_bts,
1266 cfg_bts_cmd,
1267 "bts BTS_NR",
1268 "Select a BTS to configure\n")
1269{
1270 int bts_nr = atoi(argv[0]);
1271 struct gsm_bts *bts;
1272
Harald Weltee441d9c2009-06-21 16:17:15 +02001273 if (bts_nr > gsmnet->num_bts) {
1274 vty_out(vty, "%% The next unused BTS number is %u%s",
1275 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001276 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001277 } else if (bts_nr == gsmnet->num_bts) {
1278 /* allocate a new one */
1279 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1280 HARDCODED_TSC, HARDCODED_BSIC);
1281 } else
1282 bts = gsm_bts_num(gsmnet, bts_nr);
1283
1284 if (!bts)
1285 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +00001286
1287 vty->index = bts;
1288 vty->node = BTS_NODE;
1289
1290 return CMD_SUCCESS;
1291}
1292
1293DEFUN(cfg_bts_type,
1294 cfg_bts_type_cmd,
1295 "type TYPE",
1296 "Set the BTS type\n")
1297{
1298 struct gsm_bts *bts = vty->index;
1299
Harald Weltea6fd58e2009-08-07 00:25:23 +02001300 bts->type = parse_btstype(argv[0]);
1301
Harald Welte8175e952009-10-20 00:22:00 +02001302 if (is_ipaccess_bts(bts)) {
1303 /* Set the default OML Stream ID to 0xff */
1304 bts->oml_tei = 0xff;
1305 }
1306
Harald Welte5258fc42009-03-28 19:07:53 +00001307 return CMD_SUCCESS;
1308}
1309
Harald Weltefcd24452009-06-20 18:15:19 +02001310DEFUN(cfg_bts_band,
1311 cfg_bts_band_cmd,
1312 "band BAND",
1313 "Set the frequency band of this BTS\n")
1314{
1315 struct gsm_bts *bts = vty->index;
Harald Welte42581822009-08-08 16:12:58 +02001316 int band = gsm_band_parse(argv[0]);
Harald Weltefcd24452009-06-20 18:15:19 +02001317
1318 if (band < 0) {
1319 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1320 band, VTY_NEWLINE);
1321 return CMD_WARNING;
1322 }
1323
1324 bts->band = band;
1325
1326 return CMD_SUCCESS;
1327}
1328
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001329DEFUN(cfg_bts_ci,
1330 cfg_bts_ci_cmd,
1331 "cell_identity <0-65535>",
1332 "Set the Cell identity of this BTS\n")
1333{
1334 struct gsm_bts *bts = vty->index;
1335 int ci = atoi(argv[0]);
1336
1337 if (ci < 0 || ci > 0xffff) {
1338 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1339 ci, VTY_NEWLINE);
1340 return CMD_WARNING;
1341 }
1342 bts->cell_identity = ci;
1343
1344 return CMD_SUCCESS;
1345}
1346
Harald Welte5258fc42009-03-28 19:07:53 +00001347DEFUN(cfg_bts_lac,
1348 cfg_bts_lac_cmd,
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001349 "location_area_code <0-65535>",
Harald Welte5258fc42009-03-28 19:07:53 +00001350 "Set the Location Area Code (LAC) of this BTS\n")
1351{
1352 struct gsm_bts *bts = vty->index;
1353 int lac = atoi(argv[0]);
1354
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001355 if (lac < 0 || lac > 0xffff) {
1356 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte5258fc42009-03-28 19:07:53 +00001357 lac, VTY_NEWLINE);
1358 return CMD_WARNING;
1359 }
Holger Hans Peter Freythere48b9562009-10-01 04:07:15 +02001360
1361 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1362 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1363 lac, VTY_NEWLINE);
1364 return CMD_WARNING;
1365 }
1366
Harald Welte5258fc42009-03-28 19:07:53 +00001367 bts->location_area_code = lac;
1368
1369 return CMD_SUCCESS;
1370}
1371
Harald Weltea43f7892009-12-01 18:04:30 +05301372
Harald Welte5258fc42009-03-28 19:07:53 +00001373DEFUN(cfg_bts_tsc,
1374 cfg_bts_tsc_cmd,
1375 "training_sequence_code <0-255>",
1376 "Set the Training Sequence Code (TSC) of this BTS\n")
1377{
1378 struct gsm_bts *bts = vty->index;
1379 int tsc = atoi(argv[0]);
1380
1381 if (tsc < 0 || tsc > 0xff) {
1382 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1383 tsc, VTY_NEWLINE);
1384 return CMD_WARNING;
1385 }
1386 bts->tsc = tsc;
1387
1388 return CMD_SUCCESS;
1389}
1390
Harald Welte78f2f502009-05-23 16:56:52 +00001391DEFUN(cfg_bts_bsic,
1392 cfg_bts_bsic_cmd,
1393 "base_station_id_code <0-63>",
1394 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1395{
1396 struct gsm_bts *bts = vty->index;
1397 int bsic = atoi(argv[0]);
1398
1399 if (bsic < 0 || bsic > 0x3f) {
Harald Welte42581822009-08-08 16:12:58 +02001400 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte78f2f502009-05-23 16:56:52 +00001401 bsic, VTY_NEWLINE);
1402 return CMD_WARNING;
1403 }
1404 bts->bsic = bsic;
1405
1406 return CMD_SUCCESS;
1407}
1408
1409
Harald Welte4cc34222009-05-01 15:12:31 +00001410DEFUN(cfg_bts_unit_id,
1411 cfg_bts_unit_id_cmd,
Harald Welte07dc73d2009-08-07 13:27:09 +02001412 "ip.access unit_id <0-65534> <0-255>",
1413 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte4cc34222009-05-01 15:12:31 +00001414{
1415 struct gsm_bts *bts = vty->index;
1416 int site_id = atoi(argv[0]);
1417 int bts_id = atoi(argv[1]);
1418
Harald Welte07dc73d2009-08-07 13:27:09 +02001419 if (!is_ipaccess_bts(bts)) {
1420 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1421 return CMD_WARNING;
1422 }
1423
Harald Welte4cc34222009-05-01 15:12:31 +00001424 bts->ip_access.site_id = site_id;
1425 bts->ip_access.bts_id = bts_id;
1426
1427 return CMD_SUCCESS;
1428}
1429
Harald Welte8175e952009-10-20 00:22:00 +02001430DEFUN(cfg_bts_stream_id,
1431 cfg_bts_stream_id_cmd,
1432 "oml ip.access stream_id <0-255>",
1433 "Set the ip.access Stream ID of the OML link of this BTS\n")
1434{
1435 struct gsm_bts *bts = vty->index;
1436 int stream_id = atoi(argv[0]);
1437
1438 if (!is_ipaccess_bts(bts)) {
1439 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1440 return CMD_WARNING;
1441 }
1442
1443 bts->oml_tei = stream_id;
1444
1445 return CMD_SUCCESS;
1446}
1447
1448
Harald Welte42581822009-08-08 16:12:58 +02001449DEFUN(cfg_bts_oml_e1,
1450 cfg_bts_oml_e1_cmd,
1451 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
1452 "E1 interface to be used for OML\n")
1453{
1454 struct gsm_bts *bts = vty->index;
1455
1456 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1457
1458 return CMD_SUCCESS;
1459}
1460
1461
1462DEFUN(cfg_bts_oml_e1_tei,
1463 cfg_bts_oml_e1_tei_cmd,
1464 "oml e1 tei <0-63>",
1465 "Set the TEI to be used for OML")
1466{
1467 struct gsm_bts *bts = vty->index;
1468
1469 bts->oml_tei = atoi(argv[0]);
1470
1471 return CMD_SUCCESS;
1472}
1473
Harald Welte7a8fa412009-08-10 13:48:16 +02001474DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1475 "channel allocator (ascending|descending)",
1476 "Should the channel allocator allocate in reverse TRX order?")
1477{
1478 struct gsm_bts *bts = vty->index;
1479
1480 if (!strcmp(argv[0], "ascending"))
1481 bts->chan_alloc_reverse = 0;
1482 else
1483 bts->chan_alloc_reverse = 1;
1484
1485 return CMD_SUCCESS;
1486}
1487
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001488DEFUN(cfg_bts_rach_tx_integer,
1489 cfg_bts_rach_tx_integer_cmd,
1490 "rach tx integer <0-15>",
1491 "Set the raw tx integer value in RACH Control parameters IE")
1492{
1493 struct gsm_bts *bts = vty->index;
1494 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1495 return CMD_SUCCESS;
1496}
1497
1498DEFUN(cfg_bts_rach_max_trans,
1499 cfg_bts_rach_max_trans_cmd,
1500 "rach max transmission (1|2|4|7)",
1501 "Set the maximum number of RACH burst transmissions")
1502{
1503 struct gsm_bts *bts = vty->index;
1504 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1505 return CMD_SUCCESS;
1506}
1507
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001508DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1509 "cell barred (0|1)",
1510 "Should this cell be barred from access?")
1511{
1512 struct gsm_bts *bts = vty->index;
1513
Harald Welte71355012009-12-21 23:08:18 +01001514 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001515
1516 return CMD_SUCCESS;
1517}
1518
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001519DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1520 "ms max power <0-40>",
1521 "Maximum transmit power of the MS")
1522{
1523 struct gsm_bts *bts = vty->index;
1524
1525 bts->ms_max_power = atoi(argv[0]);
1526
1527 return CMD_SUCCESS;
1528}
1529
Harald Welte73225282009-12-12 18:17:25 +01001530DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1531 "cell reselection hysteresis <0-14>",
1532 "Cell Re-Selection Hysteresis in dB")
1533{
1534 struct gsm_bts *bts = vty->index;
1535
1536 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1537
1538 return CMD_SUCCESS;
1539}
1540
1541DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1542 "rxlev access min <0-63>",
1543 "Minimum RxLev needed for cell access (better than -110dBm)")
1544{
1545 struct gsm_bts *bts = vty->index;
1546
1547 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1548
1549 return CMD_SUCCESS;
1550}
1551
Harald Welte (local)efc92312009-08-14 23:09:25 +02001552DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1553 "periodic location update <0-1530>",
1554 "Periodic Location Updating Interval in Minutes")
1555{
1556 struct gsm_bts *bts = vty->index;
1557
Harald Weltea43f7892009-12-01 18:04:30 +05301558 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 10;
Harald Welte (local)efc92312009-08-14 23:09:25 +02001559
1560 return CMD_SUCCESS;
1561}
1562
Harald Welte7a8fa412009-08-10 13:48:16 +02001563
Harald Welte5258fc42009-03-28 19:07:53 +00001564/* per TRX configuration */
1565DEFUN(cfg_trx,
1566 cfg_trx_cmd,
1567 "trx TRX_NR",
1568 "Select a TRX to configure")
1569{
1570 int trx_nr = atoi(argv[0]);
1571 struct gsm_bts *bts = vty->index;
1572 struct gsm_bts_trx *trx;
1573
Harald Weltee441d9c2009-06-21 16:17:15 +02001574 if (trx_nr > bts->num_trx) {
1575 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
1576 bts->num_trx, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001577 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001578 } else if (trx_nr == bts->num_trx) {
1579 /* we need to allocate a new one */
1580 trx = gsm_bts_trx_alloc(bts);
1581 } else
1582 trx = gsm_bts_trx_num(bts, trx_nr);
1583
1584 if (!trx)
1585 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +00001586
1587 vty->index = trx;
1588 vty->node = TRX_NODE;
1589
1590 return CMD_SUCCESS;
1591}
1592
1593DEFUN(cfg_trx_arfcn,
1594 cfg_trx_arfcn_cmd,
1595 "arfcn <1-1024>",
1596 "Set the ARFCN for this TRX\n")
1597{
1598 int arfcn = atoi(argv[0]);
1599 struct gsm_bts_trx *trx = vty->index;
1600
1601 /* FIXME: check if this ARFCN is supported by this TRX */
1602
1603 trx->arfcn = arfcn;
1604
1605 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
1606 /* FIXME: use OML layer to update the ARFCN */
1607 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
1608
1609 return CMD_SUCCESS;
1610}
1611
Harald Weltefcd24452009-06-20 18:15:19 +02001612DEFUN(cfg_trx_max_power_red,
1613 cfg_trx_max_power_red_cmd,
1614 "max_power_red <0-100>",
1615 "Reduction of maximum BS RF Power in dB\n")
1616{
1617 int maxpwr_r = atoi(argv[0]);
1618 struct gsm_bts_trx *trx = vty->index;
Harald Welte61a83b22009-11-18 09:20:22 +01001619 int upper_limit = 24; /* default 12.21 max power red. */
Harald Weltefcd24452009-06-20 18:15:19 +02001620
1621 /* FIXME: check if our BTS type supports more than 12 */
1622 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
1623 vty_out(vty, "%% Power %d dB is not in the valid range%s",
1624 maxpwr_r, VTY_NEWLINE);
1625 return CMD_WARNING;
1626 }
1627 if (maxpwr_r & 1) {
1628 vty_out(vty, "%% Power %d dB is not an even value%s",
1629 maxpwr_r, VTY_NEWLINE);
1630 return CMD_WARNING;
1631 }
1632
1633 trx->max_power_red = maxpwr_r;
1634
1635 /* FIXME: make sure we update this using OML */
1636
1637 return CMD_SUCCESS;
1638}
1639
Harald Welte42581822009-08-08 16:12:58 +02001640DEFUN(cfg_trx_rsl_e1,
1641 cfg_trx_rsl_e1_cmd,
1642 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
1643 "E1 interface to be used for RSL\n")
1644{
1645 struct gsm_bts_trx *trx = vty->index;
1646
1647 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
1648
1649 return CMD_SUCCESS;
1650}
1651
1652DEFUN(cfg_trx_rsl_e1_tei,
1653 cfg_trx_rsl_e1_tei_cmd,
1654 "rsl e1 tei <0-63>",
1655 "Set the TEI to be used for RSL")
1656{
1657 struct gsm_bts_trx *trx = vty->index;
1658
1659 trx->rsl_tei = atoi(argv[0]);
1660
1661 return CMD_SUCCESS;
1662}
1663
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01001664DEFUN(cfg_trx_rf_locked,
1665 cfg_trx_rf_locked_cmd,
1666 "rf_locked (0|1)",
1667 "Turn off RF of the TRX.\n")
1668{
1669 int locked = atoi(argv[0]);
1670 struct gsm_bts_trx *trx = vty->index;
1671
1672 gsm_trx_lock_rf(trx, locked);
1673 return CMD_SUCCESS;
1674}
Harald Welte42581822009-08-08 16:12:58 +02001675
Harald Welte5258fc42009-03-28 19:07:53 +00001676/* per TS configuration */
1677DEFUN(cfg_ts,
1678 cfg_ts_cmd,
Harald Welte42581822009-08-08 16:12:58 +02001679 "timeslot <0-7>",
Harald Welte5258fc42009-03-28 19:07:53 +00001680 "Select a Timeslot to configure")
1681{
1682 int ts_nr = atoi(argv[0]);
1683 struct gsm_bts_trx *trx = vty->index;
1684 struct gsm_bts_trx_ts *ts;
1685
1686 if (ts_nr >= TRX_NR_TS) {
1687 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
1688 TRX_NR_TS, VTY_NEWLINE);
1689 return CMD_WARNING;
1690 }
1691
1692 ts = &trx->ts[ts_nr];
1693
1694 vty->index = ts;
1695 vty->node = TS_NODE;
1696
1697 return CMD_SUCCESS;
1698}
1699
Harald Weltea6fd58e2009-08-07 00:25:23 +02001700DEFUN(cfg_ts_pchan,
1701 cfg_ts_pchan_cmd,
1702 "phys_chan_config PCHAN",
1703 "Physical Channel configuration (TCH/SDCCH/...)")
1704{
1705 struct gsm_bts_trx_ts *ts = vty->index;
1706 int pchanc;
1707
1708 pchanc = gsm_pchan_parse(argv[0]);
1709 if (pchanc < 0)
1710 return CMD_WARNING;
1711
1712 ts->pchan = pchanc;
1713
1714 return CMD_SUCCESS;
1715}
1716
1717DEFUN(cfg_ts_e1_subslot,
1718 cfg_ts_e1_subslot_cmd,
Harald Welte42581822009-08-08 16:12:58 +02001719 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltea6fd58e2009-08-07 00:25:23 +02001720 "E1 sub-slot connected to this on-air timeslot")
1721{
1722 struct gsm_bts_trx_ts *ts = vty->index;
1723
Harald Welte42581822009-08-08 16:12:58 +02001724 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Weltea6fd58e2009-08-07 00:25:23 +02001725
1726 return CMD_SUCCESS;
1727}
Harald Welte5258fc42009-03-28 19:07:53 +00001728
Harald Welte68628e82009-03-10 12:17:57 +00001729int bsc_vty_init(struct gsm_network *net)
1730{
1731 gsmnet = net;
1732
1733 cmd_init(1);
1734 vty_init();
1735
1736 install_element(VIEW_NODE, &show_net_cmd);
1737 install_element(VIEW_NODE, &show_bts_cmd);
1738 install_element(VIEW_NODE, &show_trx_cmd);
1739 install_element(VIEW_NODE, &show_ts_cmd);
1740 install_element(VIEW_NODE, &show_lchan_cmd);
Harald Welte1bc77352009-03-10 19:47:51 +00001741
1742 install_element(VIEW_NODE, &show_e1drv_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001743 install_element(VIEW_NODE, &show_e1line_cmd);
1744 install_element(VIEW_NODE, &show_e1ts_cmd);
1745
Harald Weltef5025b62009-03-28 16:55:11 +00001746 install_element(VIEW_NODE, &show_paging_cmd);
Harald Welte24ff6ee2009-12-22 00:41:05 +01001747 install_element(VIEW_NODE, &show_stats_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00001748
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +01001749 install_element(VIEW_NODE, &enable_logging_cmd);
1750 install_element(VIEW_NODE, &disable_logging_cmd);
1751 install_element(VIEW_NODE, &logging_fltr_imsi_cmd);
1752 install_element(VIEW_NODE, &logging_fltr_all_cmd);
1753 install_element(VIEW_NODE, &logging_use_clr_cmd);
1754 install_element(VIEW_NODE, &logging_prnt_timestamp_cmd);
1755 install_element(VIEW_NODE, &logging_set_category_mask_cmd);
1756
Harald Welte5013b2a2009-08-07 13:29:14 +02001757 install_element(CONFIG_NODE, &cfg_net_cmd);
1758 install_node(&net_node, config_write_net);
1759 install_default(GSMNET_NODE);
Harald Welte42581822009-08-08 16:12:58 +02001760 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02001761 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
1762 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
1763 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)69de3972009-08-12 14:42:23 +02001764 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte1085c092009-11-18 20:33:19 +01001765 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Welte4381cfe2009-08-30 15:47:06 +09001766 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001767 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welteeab84a12009-12-13 10:53:12 +01001768 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte3d23db42009-12-14 17:49:15 +01001769 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Weltebc814502009-12-19 21:41:52 +01001770 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Welteb720bd32009-12-21 16:51:50 +01001771 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
1772 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
1773 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
1774 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
1775 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
1776 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001777 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01001778 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
1779 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
1780 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
1781 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
1782 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
1783 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
1784 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
1785 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
1786 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
1787 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02001788
1789 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte67ce0732009-08-06 19:06:46 +02001790 install_node(&bts_node, config_write_bts);
Harald Welte68628e82009-03-10 12:17:57 +00001791 install_default(BTS_NODE);
Harald Welte5258fc42009-03-28 19:07:53 +00001792 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Weltefcd24452009-06-20 18:15:19 +02001793 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001794 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00001795 install_element(BTS_NODE, &cfg_bts_lac_cmd);
1796 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte42581822009-08-08 16:12:58 +02001797 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte4cc34222009-05-01 15:12:31 +00001798 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte8175e952009-10-20 00:22:00 +02001799 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte42581822009-08-08 16:12:58 +02001800 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
1801 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02001802 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001803 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
1804 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001805 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001806 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)efc92312009-08-14 23:09:25 +02001807 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welte73225282009-12-12 18:17:25 +01001808 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
1809 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02001810
Harald Welte68628e82009-03-10 12:17:57 +00001811
Harald Welte5258fc42009-03-28 19:07:53 +00001812 install_element(BTS_NODE, &cfg_trx_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001813 install_node(&trx_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00001814 install_default(TRX_NODE);
Harald Welte5258fc42009-03-28 19:07:53 +00001815 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte879dc972009-06-20 22:36:12 +02001816 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte42581822009-08-08 16:12:58 +02001817 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
1818 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01001819 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001820
Harald Welte5258fc42009-03-28 19:07:53 +00001821 install_element(TRX_NODE, &cfg_ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001822 install_node(&ts_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00001823 install_default(TS_NODE);
Harald Weltea6fd58e2009-08-07 00:25:23 +02001824 install_element(TS_NODE, &cfg_ts_pchan_cmd);
1825 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001826
Holger Hans Peter Freythercfa90d42009-08-10 10:17:50 +02001827 bsc_vty_init_extra(net);
Harald Welte40f82892009-05-23 17:31:39 +00001828
Harald Welte68628e82009-03-10 12:17:57 +00001829 return 0;
1830}