blob: 265444779da1f8c6b843f073fd4fd56416358198 [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);
Harald Welte (local)7b37d972009-12-27 20:56:38 +0100269 vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200270 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200271 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
272 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte67ce0732009-08-06 19:06:46 +0200273
274 for (i = 0; i < TRX_NR_TS; i++)
275 config_write_ts_single(vty, &trx->ts[i]);
276}
277
278static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
279{
280 struct gsm_bts_trx *trx;
281
Harald Welte5013b2a2009-08-07 13:29:14 +0200282 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
283 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
284 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freytherf926ed62009-11-19 16:38:49 +0100285 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200286 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte67ce0732009-08-06 19:06:46 +0200287 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200288 vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE);
289 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)0e451d02009-08-13 10:14:26 +0200290 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100291 vty_out(vty, " cell reselection hysteresis %u%s",
292 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
293 vty_out(vty, " rxlev access min %u%s",
294 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Harald Weltea43f7892009-12-01 18:04:30 +0530295 if (bts->si_common.chan_desc.t3212)
Harald Welte (local)efc92312009-08-14 23:09:25 +0200296 vty_out(vty, " periodic location update %u%s",
Harald Weltea43f7892009-12-01 18:04:30 +0530297 bts->si_common.chan_desc.t3212 * 10, VTY_NEWLINE);
Harald Welte7a8fa412009-08-10 13:48:16 +0200298 vty_out(vty, " channel allocator %s%s",
299 bts->chan_alloc_reverse ? "descending" : "ascending",
300 VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100301 vty_out(vty, " rach tx integer %u%s",
302 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
303 vty_out(vty, " rach max transmission %u%s",
304 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
305 VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100306 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200307 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200308 if (is_ipaccess_bts(bts)) {
Harald Welte5013b2a2009-08-07 13:29:14 +0200309 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Weltea6fd58e2009-08-07 00:25:23 +0200310 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200311 vty_out(vty, " oml ip.access stream_id %u%s", bts->oml_tei, VTY_NEWLINE);
312 } else {
Harald Welte42581822009-08-08 16:12:58 +0200313 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
314 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
315 }
Harald Welte67ce0732009-08-06 19:06:46 +0200316
317 llist_for_each_entry(trx, &bts->trx_list, list)
318 config_write_trx_single(vty, trx);
319}
320
321static int config_write_bts(struct vty *v)
322{
323 struct gsm_bts *bts;
324
325 llist_for_each_entry(bts, &gsmnet->bts_list, list)
326 config_write_bts_single(v, bts);
327
328 return CMD_SUCCESS;
329}
330
Harald Welte5013b2a2009-08-07 13:29:14 +0200331static int config_write_net(struct vty *vty)
332{
333 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200334 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200335 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200336 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
337 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200338 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100339 vty_out(vty, " location updating reject cause %u%s",
340 gsmnet->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900341 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freytherd54c3372009-11-19 16:37:48 +0100342 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100343 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
344 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100345 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100346 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Welteb720bd32009-12-21 16:51:50 +0100347 vty_out(vty, " handover window rxlev averaging %u%s",
348 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
349 vty_out(vty, " handover window rxqual averaging %u%s",
350 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
351 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
352 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
353 vty_out(vty, " handover power budget interval %u%s",
354 gsmnet->handover.pwr_interval, VTY_NEWLINE);
355 vty_out(vty, " handover power budget hysteresis %u%s",
356 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
357 vty_out(vty, " handover maximum distance %u%s",
358 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +0100359 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100360 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
361 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
362 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
363 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
364 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
365 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
366 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
367 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
368 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
369 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200370
371 return CMD_SUCCESS;
372}
Harald Welte67ce0732009-08-06 19:06:46 +0200373
Harald Welte68628e82009-03-10 12:17:57 +0000374static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
375{
376 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
377 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Weltefcd24452009-06-20 18:15:19 +0200378 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte42581822009-08-08 16:12:58 +0200379 "resulting BS power: %d dBm%s",
Harald Weltefcd24452009-06-20 18:15:19 +0200380 trx->nominal_power, trx->max_power_red,
Harald Welte42581822009-08-08 16:12:58 +0200381 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000382 vty_out(vty, " NM State: ");
383 net_dump_nmstate(vty, &trx->nm_state);
384 vty_out(vty, " Baseband Transceiver NM State: ");
385 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte8175e952009-10-20 00:22:00 +0200386 if (is_ipaccess_bts(trx->bts)) {
387 vty_out(vty, " ip.access stream ID: 0x%02x%s",
388 trx->rsl_tei, VTY_NEWLINE);
389 } else {
390 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
391 e1isl_dump_vty(vty, trx->rsl_link);
392 }
Harald Welte68628e82009-03-10 12:17:57 +0000393}
394
395DEFUN(show_trx,
396 show_trx_cmd,
397 "show trx [bts_nr] [trx_nr]",
398 SHOW_STR "Display information about a TRX\n")
399{
400 struct gsm_network *net = gsmnet;
401 struct gsm_bts *bts = NULL;
402 struct gsm_bts_trx *trx;
403 int bts_nr, trx_nr;
404
405 if (argc >= 1) {
406 /* use the BTS number that the user has specified */
407 bts_nr = atoi(argv[0]);
408 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000409 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000410 VTY_NEWLINE);
411 return CMD_WARNING;
412 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200413 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000414 }
415 if (argc >= 2) {
416 trx_nr = atoi(argv[1]);
417 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000418 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000419 VTY_NEWLINE);
420 return CMD_WARNING;
421 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200422 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000423 trx_dump_vty(vty, trx);
424 return CMD_SUCCESS;
425 }
426 if (bts) {
427 /* print all TRX in this BTS */
428 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200429 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000430 trx_dump_vty(vty, trx);
431 }
432 return CMD_SUCCESS;
433 }
434
435 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200436 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000437 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200438 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000439 trx_dump_vty(vty, trx);
440 }
441 }
442
443 return CMD_SUCCESS;
444}
445
Harald Welte67ce0732009-08-06 19:06:46 +0200446
Harald Welte68628e82009-03-10 12:17:57 +0000447static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
448{
Harald Welte68628e82009-03-10 12:17:57 +0000449 vty_out(vty, "Timeslot %u of TRX %u in BTS %u, phys cfg %s%s",
450 ts->nr, ts->trx->nr, ts->trx->bts->nr,
451 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
452 vty_out(vty, " NM State: ");
453 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte2c828992009-12-02 01:56:49 +0530454 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welteef235b52009-03-10 12:34:02 +0000455 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
456 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
457 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000458}
459
460DEFUN(show_ts,
461 show_ts_cmd,
Harald Welte1bc77352009-03-10 19:47:51 +0000462 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
Harald Welte68628e82009-03-10 12:17:57 +0000463 SHOW_STR "Display information about a TS\n")
464{
465 struct gsm_network *net = gsmnet;
466 struct gsm_bts *bts;
467 struct gsm_bts_trx *trx;
468 struct gsm_bts_trx_ts *ts;
469 int bts_nr, trx_nr, ts_nr;
470
471 if (argc >= 1) {
472 /* use the BTS number that the user has specified */
473 bts_nr = atoi(argv[0]);
474 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000475 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000476 VTY_NEWLINE);
477 return CMD_WARNING;
478 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200479 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000480 }
481 if (argc >= 2) {
482 trx_nr = atoi(argv[1]);
483 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000484 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000485 VTY_NEWLINE);
486 return CMD_WARNING;
487 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200488 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000489 }
490 if (argc >= 3) {
491 ts_nr = atoi(argv[2]);
492 if (ts_nr >= TRX_NR_TS) {
Harald Welte1bc77352009-03-10 19:47:51 +0000493 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
Harald Welte68628e82009-03-10 12:17:57 +0000494 VTY_NEWLINE);
495 return CMD_WARNING;
496 }
497 ts = &trx->ts[ts_nr];
498 ts_dump_vty(vty, ts);
499 return CMD_SUCCESS;
500 }
501 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200502 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000503 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200504 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000505 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
506 ts = &trx->ts[ts_nr];
507 ts_dump_vty(vty, ts);
508 }
509 }
510 }
511
512 return CMD_SUCCESS;
513}
514
Holger Hans Peter Freyther424c4f02010-01-06 06:00:40 +0100515static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte68628e82009-03-10 12:17:57 +0000516{
Sylvain Munautaf292642009-12-27 19:29:28 +0100517 int rc;
518 struct gsm_auth_info ainfo;
519 struct gsm_auth_tuple atuple;
520
Harald Weltefcd24452009-06-20 18:15:19 +0200521 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte40f82892009-05-23 17:31:39 +0000522 subscr->authorized, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000523 if (subscr->name)
Harald Welte1bc77352009-03-10 19:47:51 +0000524 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000525 if (subscr->extension)
526 vty_out(vty, " Extension: %s%s", subscr->extension,
527 VTY_NEWLINE);
528 if (subscr->imsi)
529 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freyther22230252009-08-19 12:53:57 +0200530 if (subscr->tmsi != GSM_RESERVED_TMSI)
531 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte731fd912009-08-15 03:24:51 +0200532 VTY_NEWLINE);
Sylvain Munautaf292642009-12-27 19:29:28 +0100533
Harald Welte (local)15920de2009-08-14 20:27:16 +0200534 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000535}
536
Harald Welte8387a492009-12-22 21:43:14 +0100537static void meas_rep_dump_uni_vty(struct vty *vty,
538 struct gsm_meas_rep_unidir *mru,
539 const char *prefix,
540 const char *dir)
541{
542 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
543 prefix, dir, rxlev2dbm(mru->full.rx_lev),
544 dir, rxlev2dbm(mru->sub.rx_lev));
545 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
546 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
547 VTY_NEWLINE);
548}
549
550static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
551 const char *prefix)
552{
553 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
554 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
555 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
556 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
557 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
558 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
559 VTY_NEWLINE);
560 if (mr->flags & MEAS_REP_F_MS_TO)
561 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
562 mr->ms_timing_offset, VTY_NEWLINE);
563 if (mr->flags & MEAS_REP_F_MS_L1)
564 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
565 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
566 if (mr->flags & MEAS_REP_F_DL_VALID)
567 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
568 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
569}
570
Harald Welte68628e82009-03-10 12:17:57 +0000571static void lchan_dump_vty(struct vty *vty, struct gsm_lchan *lchan)
572{
Harald Welte8387a492009-12-22 21:43:14 +0100573 int idx;
574
Harald Welte68628e82009-03-10 12:17:57 +0000575 vty_out(vty, "Lchan %u in Timeslot %u of TRX %u in BTS %u, Type %s%s",
576 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
Harald Welte (local)ccd88452009-12-27 18:05:25 +0100577 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Harald Welte68628e82009-03-10 12:17:57 +0000578 VTY_NEWLINE);
Harald Welte1887f9d2009-12-29 10:52:38 +0100579 vty_out(vty, " Use Count: %u, State: %s%s", lchan->use_count,
580 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100581 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
582 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
583 - lchan->bs_power*2,
584 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
585 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000586 if (lchan->subscr) {
587 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
588 subscr_dump_vty(vty, lchan->subscr);
589 } else
590 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte2c828992009-12-02 01:56:49 +0530591 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
592 struct in_addr ia;
593 ia.s_addr = lchan->abis_ip.bound_ip;
594 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
595 inet_ntoa(ia), lchan->abis_ip.bound_port,
596 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
597 VTY_NEWLINE);
598 }
Harald Welte8387a492009-12-22 21:43:14 +0100599
600 /* we want to report the last measurement report */
601 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
602 lchan->meas_rep_idx, 1);
603 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte68628e82009-03-10 12:17:57 +0000604}
605
Harald Welte4bfdfe72009-06-10 23:11:52 +0800606#if 0
607TODO: callref and remote callref of call must be resolved to get gsm_trans object
Harald Welte68628e82009-03-10 12:17:57 +0000608static void call_dump_vty(struct vty *vty, struct gsm_call *call)
609{
610 vty_out(vty, "Call Type %u, State %u, Transaction ID %u%s",
611 call->type, call->state, call->transaction_id, VTY_NEWLINE);
612
613 if (call->local_lchan) {
614 vty_out(vty, "Call Local Channel:%s", VTY_NEWLINE);
615 lchan_dump_vty(vty, call->local_lchan);
616 } else
617 vty_out(vty, "Call has no Local Channel%s", VTY_NEWLINE);
618
619 if (call->remote_lchan) {
620 vty_out(vty, "Call Remote Channel:%s", VTY_NEWLINE);
621 lchan_dump_vty(vty, call->remote_lchan);
622 } else
623 vty_out(vty, "Call has no Remote Channel%s", VTY_NEWLINE);
624
625 if (call->called_subscr) {
626 vty_out(vty, "Called Subscriber:%s", VTY_NEWLINE);
627 subscr_dump_vty(vty, call->called_subscr);
628 } else
629 vty_out(vty, "Call has no Called Subscriber%s", VTY_NEWLINE);
630}
Harald Welte4bfdfe72009-06-10 23:11:52 +0800631#endif
Harald Welte68628e82009-03-10 12:17:57 +0000632
633DEFUN(show_lchan,
634 show_lchan_cmd,
635 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
636 SHOW_STR "Display information about a logical channel\n")
637{
638 struct gsm_network *net = gsmnet;
639 struct gsm_bts *bts;
640 struct gsm_bts_trx *trx;
641 struct gsm_bts_trx_ts *ts;
642 struct gsm_lchan *lchan;
643 int bts_nr, trx_nr, ts_nr, lchan_nr;
644
645 if (argc >= 1) {
646 /* use the BTS number that the user has specified */
647 bts_nr = atoi(argv[0]);
648 if (bts_nr >= net->num_bts) {
649 vty_out(vty, "%% can't find BTS %s%s", argv[0],
650 VTY_NEWLINE);
651 return CMD_WARNING;
652 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200653 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000654 }
655 if (argc >= 2) {
656 trx_nr = atoi(argv[1]);
657 if (trx_nr >= bts->num_trx) {
658 vty_out(vty, "%% can't find TRX %s%s", argv[1],
659 VTY_NEWLINE);
660 return CMD_WARNING;
661 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200662 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000663 }
664 if (argc >= 3) {
665 ts_nr = atoi(argv[2]);
666 if (ts_nr >= TRX_NR_TS) {
667 vty_out(vty, "%% can't find TS %s%s", argv[2],
668 VTY_NEWLINE);
669 return CMD_WARNING;
670 }
671 ts = &trx->ts[ts_nr];
672 }
673 if (argc >= 4) {
674 lchan_nr = atoi(argv[3]);
675 if (lchan_nr >= TS_MAX_LCHAN) {
676 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
677 VTY_NEWLINE);
678 return CMD_WARNING;
679 }
680 lchan = &ts->lchan[lchan_nr];
681 lchan_dump_vty(vty, lchan);
682 return CMD_SUCCESS;
683 }
684 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200685 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000686 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200687 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000688 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
689 ts = &trx->ts[ts_nr];
690 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
691 lchan_nr++) {
692 lchan = &ts->lchan[lchan_nr];
Harald Welteef235b52009-03-10 12:34:02 +0000693 if (lchan->type == GSM_LCHAN_NONE)
694 continue;
Harald Welte68628e82009-03-10 12:17:57 +0000695 lchan_dump_vty(vty, lchan);
696 }
697 }
698 }
699 }
700
701 return CMD_SUCCESS;
702}
703
Harald Welte1bc77352009-03-10 19:47:51 +0000704static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
705{
706 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
707}
708
709DEFUN(show_e1drv,
710 show_e1drv_cmd,
711 "show e1_driver",
712 SHOW_STR "Display information about available E1 drivers\n")
713{
714 struct e1inp_driver *drv;
715
716 llist_for_each_entry(drv, &e1inp_driver_list, list)
717 e1drv_dump_vty(vty, drv);
718
719 return CMD_SUCCESS;
720}
721
Harald Welte68628e82009-03-10 12:17:57 +0000722static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
723{
724 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
725 line->num, line->name ? line->name : "",
726 line->driver->name, VTY_NEWLINE);
727}
728
729DEFUN(show_e1line,
730 show_e1line_cmd,
731 "show e1_line [line_nr]",
732 SHOW_STR "Display information about a E1 line\n")
733{
Harald Welte1bc77352009-03-10 19:47:51 +0000734 struct e1inp_line *line;
735
736 if (argc >= 1) {
737 int num = atoi(argv[0]);
738 llist_for_each_entry(line, &e1inp_line_list, list) {
739 if (line->num == num) {
740 e1line_dump_vty(vty, line);
741 return CMD_SUCCESS;
742 }
743 }
744 return CMD_WARNING;
745 }
746
747 llist_for_each_entry(line, &e1inp_line_list, list)
748 e1line_dump_vty(vty, line);
749
750 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000751}
752
753static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
754{
Harald Welte42581822009-08-08 16:12:58 +0200755 if (ts->type == E1INP_TS_TYPE_NONE)
756 return;
Harald Welte1bc77352009-03-10 19:47:51 +0000757 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
758 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
759 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000760}
761
762DEFUN(show_e1ts,
763 show_e1ts_cmd,
764 "show e1_timeslot [line_nr] [ts_nr]",
765 SHOW_STR "Display information about a E1 timeslot\n")
766{
Harald Welte986c3d72009-11-17 06:12:16 +0100767 struct e1inp_line *line = NULL;
Harald Welte1bc77352009-03-10 19:47:51 +0000768 struct e1inp_ts *ts;
769 int ts_nr;
Harald Welte68628e82009-03-10 12:17:57 +0000770
Harald Welte1bc77352009-03-10 19:47:51 +0000771 if (argc == 0) {
772 llist_for_each_entry(line, &e1inp_line_list, list) {
773 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
774 ts = &line->ts[ts_nr];
775 e1ts_dump_vty(vty, ts);
776 }
777 }
778 return CMD_SUCCESS;
779 }
780 if (argc >= 1) {
781 int num = atoi(argv[0]);
782 llist_for_each_entry(line, &e1inp_line_list, list) {
783 if (line->num == num)
784 break;
785 }
786 if (!line || line->num != num) {
787 vty_out(vty, "E1 line %s is invalid%s",
788 argv[0], VTY_NEWLINE);
789 return CMD_WARNING;
790 }
791 }
792 if (argc >= 2) {
793 ts_nr = atoi(argv[1]);
794 if (ts_nr > NUM_E1_TS) {
795 vty_out(vty, "E1 timeslot %s is invalid%s",
796 argv[1], VTY_NEWLINE);
797 return CMD_WARNING;
798 }
799 ts = &line->ts[ts_nr];
800 e1ts_dump_vty(vty, ts);
801 return CMD_SUCCESS;
802 } else {
803 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
804 ts = &line->ts[ts_nr];
805 e1ts_dump_vty(vty, ts);
806 }
807 return CMD_SUCCESS;
808 }
809 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000810}
811
Harald Weltebe4b7302009-05-23 16:59:33 +0000812static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
Harald Weltef5025b62009-03-28 16:55:11 +0000813{
814 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
815 subscr_dump_vty(vty, pag->subscr);
816}
817
Harald Weltebe4b7302009-05-23 16:59:33 +0000818static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
Harald Weltef5025b62009-03-28 16:55:11 +0000819{
820 struct gsm_paging_request *pag;
821
822 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
823 paging_dump_vty(vty, pag);
824}
825
826DEFUN(show_paging,
827 show_paging_cmd,
828 "show paging [bts_nr]",
Harald Weltebe4b7302009-05-23 16:59:33 +0000829 SHOW_STR "Display information about paging reuqests of a BTS\n")
Harald Weltef5025b62009-03-28 16:55:11 +0000830{
831 struct gsm_network *net = gsmnet;
832 struct gsm_bts *bts;
833 int bts_nr;
834
835 if (argc >= 1) {
836 /* use the BTS number that the user has specified */
837 bts_nr = atoi(argv[0]);
838 if (bts_nr >= net->num_bts) {
839 vty_out(vty, "%% can't find BTS %s%s", argv[0],
840 VTY_NEWLINE);
841 return CMD_WARNING;
842 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200843 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +0000844 bts_paging_dump_vty(vty, bts);
845
846 return CMD_SUCCESS;
847 }
848 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200849 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +0000850 bts_paging_dump_vty(vty, bts);
851 }
852
853 return CMD_SUCCESS;
854}
855
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +0100856static void _vty_output(struct debug_target *tgt, const char *line)
857{
858 struct vty *vty = tgt->tgt_vty.vty;
859 vty_out(vty, "%s", line);
860 /* This is an ugly hack, but there is no easy way... */
861 if (strchr(line, '\n'))
862 vty_out(vty, "\r");
863}
864
865struct debug_target *debug_target_create_vty(struct vty *vty)
866{
867 struct debug_target *target;
868
869 target = debug_target_create();
870 if (!target)
871 return NULL;
872
873 target->tgt_vty.vty = vty;
874 target->output = _vty_output;
875 return target;
876}
877
878DEFUN(enable_logging,
879 enable_logging_cmd,
880 "logging enable",
881 "Enables logging to this vty\n")
882{
883 struct telnet_connection *conn;
884
885 conn = (struct telnet_connection *) vty->priv;
886 if (conn->dbg) {
887 vty_out(vty, "Logging already enabled.%s", VTY_NEWLINE);
888 return CMD_WARNING;
889 }
890
891 conn->dbg = debug_target_create_vty(vty);
892 if (!conn->dbg)
893 return CMD_WARNING;
894
895 debug_add_target(conn->dbg);
896 return CMD_SUCCESS;
897}
898
899DEFUN(logging_fltr_imsi,
900 logging_fltr_imsi_cmd,
901 "logging filter imsi IMSI",
902 "Print all messages related to a IMSI\n")
903{
904 struct telnet_connection *conn;
905
906 conn = (struct telnet_connection *) vty->priv;
907 if (!conn->dbg) {
908 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
909 return CMD_WARNING;
910 }
911
912 debug_set_imsi_filter(conn->dbg, argv[0]);
913 return CMD_SUCCESS;
914}
915
916DEFUN(logging_fltr_all,
917 logging_fltr_all_cmd,
918 "logging filter all <0-1>",
919 "Print all messages to the console\n")
920{
921 struct telnet_connection *conn;
922
923 conn = (struct telnet_connection *) vty->priv;
924 if (!conn->dbg) {
925 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
926 return CMD_WARNING;
927 }
928
929 debug_set_all_filter(conn->dbg, atoi(argv[0]));
930 return CMD_SUCCESS;
931}
932
933DEFUN(logging_use_clr,
934 logging_use_clr_cmd,
Harald Welte (local)b79bdd92009-12-26 19:45:22 +0100935 "logging color <0-1>",
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +0100936 "Use color for printing messages\n")
937{
938 struct telnet_connection *conn;
939
940 conn = (struct telnet_connection *) vty->priv;
941 if (!conn->dbg) {
942 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
943 return CMD_WARNING;
944 }
945
946 debug_set_use_color(conn->dbg, atoi(argv[0]));
947 return CMD_SUCCESS;
948}
949
950DEFUN(logging_prnt_timestamp,
951 logging_prnt_timestamp_cmd,
Harald Welte (local)b79bdd92009-12-26 19:45:22 +0100952 "logging timestamp <0-1>",
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +0100953 "Print the timestamp of each message\n")
954{
955 struct telnet_connection *conn;
956
957 conn = (struct telnet_connection *) vty->priv;
958 if (!conn->dbg) {
959 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
960 return CMD_WARNING;
961 }
962
963 debug_set_print_timestamp(conn->dbg, atoi(argv[0]));
964 return CMD_SUCCESS;
965}
966
Harald Welte (local)66169152009-12-27 21:02:20 +0100967/* FIXME: those have to be kept in sync with the log levels and categories */
Harald Welte (local)b79bdd92009-12-26 19:45:22 +0100968#define VTY_DEBUG_CATEGORIES "(rll|cc|mm|rr|rsl|nm|sms|pag|mncc|inp|mi|mib|mux|meas|sccp|msc|mgcp|ho|db|ref)"
Harald Welte (local)66169152009-12-27 21:02:20 +0100969#define VTY_DEBUG_LEVELS "(everything|debug|info|notice|error|fatal)"
Harald Welte (local)b79bdd92009-12-26 19:45:22 +0100970DEFUN(logging_level,
971 logging_level_cmd,
Harald Welte (local)66169152009-12-27 21:02:20 +0100972 "logging level " VTY_DEBUG_CATEGORIES " " VTY_DEBUG_LEVELS,
Harald Welte (local)b79bdd92009-12-26 19:45:22 +0100973 "Set the log level for a specified category\n")
974{
975 struct telnet_connection *conn;
976 int category = debug_parse_category(argv[0]);
Harald Welte (local)66169152009-12-27 21:02:20 +0100977 int level = debug_parse_level(argv[1]);
Harald Welte (local)b79bdd92009-12-26 19:45:22 +0100978
979 conn = (struct telnet_connection *) vty->priv;
980 if (!conn->dbg) {
981 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
982 return CMD_WARNING;
983 }
984
985 if (category < 0) {
986 vty_out(vty, "Invalid category `%s'%s", argv[0], VTY_NEWLINE);
987 return CMD_WARNING;
988 }
989
Harald Welte (local)66169152009-12-27 21:02:20 +0100990 if (level < 0) {
991 vty_out(vty, "Invalid level `%s'%s", argv[1], VTY_NEWLINE);
992 return CMD_WARNING;
993 }
994
Harald Welte (local)b79bdd92009-12-26 19:45:22 +0100995 conn->dbg->categories[category].enabled = 1;
Harald Welte (local)66169152009-12-27 21:02:20 +0100996 conn->dbg->categories[category].loglevel = level;
Harald Welte (local)b79bdd92009-12-26 19:45:22 +0100997
998 return CMD_SUCCESS;
999}
1000
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +01001001DEFUN(logging_set_category_mask,
1002 logging_set_category_mask_cmd,
1003 "logging set debug mask MASK",
1004 "Decide which categories to output.\n")
1005{
1006 struct telnet_connection *conn;
1007
1008 conn = (struct telnet_connection *) vty->priv;
1009 if (!conn->dbg) {
1010 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
1011 return CMD_WARNING;
1012 }
1013
1014 debug_parse_category_mask(conn->dbg, argv[0]);
1015 return CMD_SUCCESS;
1016}
1017
1018DEFUN(logging_set_log_level,
1019 logging_set_log_level_cmd,
1020 "logging set log level <0-8>",
1021 "Set the global log level. The value 0 implies no filtering.\n")
1022{
1023 struct telnet_connection *conn;
1024
1025 conn = (struct telnet_connection *) vty->priv;
1026 if (!conn->dbg) {
1027 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
1028 return CMD_WARNING;
1029 }
1030
1031 debug_set_log_level(conn->dbg, atoi(argv[0]));
1032 return CMD_SUCCESS;
1033}
1034
1035DEFUN(diable_logging,
1036 disable_logging_cmd,
1037 "logging disable",
1038 "Disables logging to this vty\n")
1039{
1040 struct telnet_connection *conn;
1041
1042 conn = (struct telnet_connection *) vty->priv;
1043 if (!conn->dbg) {
1044 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
1045 return CMD_WARNING;
1046 }
1047
1048 debug_del_target(conn->dbg);
1049 talloc_free(conn->dbg);
1050 conn->dbg = NULL;
1051 return CMD_SUCCESS;
1052}
1053
Harald Welte24ff6ee2009-12-22 00:41:05 +01001054DEFUN(show_stats,
1055 show_stats_cmd,
1056 "show statistics",
1057 SHOW_STR "Display network statistics\n")
1058{
1059 struct gsm_network *net = gsmnet;
1060
Harald Weltee2b8ece2009-12-22 21:47:48 +01001061 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
Harald Welteffa55a42009-12-22 19:07:32 +01001062 counter_get(net->stats.chreq.total),
1063 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
Harald Weltee2b8ece2009-12-22 21:47:48 +01001064 vty_out(vty, "Location Update : %lu attach, %lu normal, %lu periodic%s",
Harald Welteffa55a42009-12-22 19:07:32 +01001065 counter_get(net->stats.loc_upd_type.attach),
1066 counter_get(net->stats.loc_upd_type.normal),
1067 counter_get(net->stats.loc_upd_type.periodic), VTY_NEWLINE);
Harald Weltee2b8ece2009-12-22 21:47:48 +01001068 vty_out(vty, "IMSI Detach Indications : %lu%s",
Harald Welteffa55a42009-12-22 19:07:32 +01001069 counter_get(net->stats.loc_upd_type.detach), VTY_NEWLINE);
Harald Welte24ff6ee2009-12-22 00:41:05 +01001070 vty_out(vty, "Location Update Response: %lu accept, %lu reject%s",
Harald Welteffa55a42009-12-22 19:07:32 +01001071 counter_get(net->stats.loc_upd_resp.accept),
1072 counter_get(net->stats.loc_upd_resp.reject), VTY_NEWLINE);
Harald Weltee2b8ece2009-12-22 21:47:48 +01001073 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
Harald Welteffa55a42009-12-22 19:07:32 +01001074 counter_get(net->stats.paging.attempted),
1075 counter_get(net->stats.paging.completed),
1076 counter_get(net->stats.paging.expired), VTY_NEWLINE);
Harald Weltee2b8ece2009-12-22 21:47:48 +01001077 vty_out(vty, "Handover : %lu attempted, %lu no_channel, %lu timeout, "
Harald Welteffa55a42009-12-22 19:07:32 +01001078 "%lu completed, %lu failed%s",
1079 counter_get(net->stats.handover.attempted),
1080 counter_get(net->stats.handover.no_channel),
1081 counter_get(net->stats.handover.timeout),
1082 counter_get(net->stats.handover.completed),
1083 counter_get(net->stats.handover.failed), VTY_NEWLINE);
Harald Weltee2b8ece2009-12-22 21:47:48 +01001084 vty_out(vty, "SMS MO : %lu submitted, %lu no receiver%s",
Harald Welteffa55a42009-12-22 19:07:32 +01001085 counter_get(net->stats.sms.submitted),
1086 counter_get(net->stats.sms.no_receiver), VTY_NEWLINE);
Harald Weltee2b8ece2009-12-22 21:47:48 +01001087 vty_out(vty, "SMS MT : %lu delivered, %lu no memory, %lu other error%s",
Harald Welteffa55a42009-12-22 19:07:32 +01001088 counter_get(net->stats.sms.delivered),
1089 counter_get(net->stats.sms.rp_err_mem),
1090 counter_get(net->stats.sms.rp_err_other), VTY_NEWLINE);
Harald Welte24ff6ee2009-12-22 00:41:05 +01001091 return CMD_SUCCESS;
1092}
1093
Harald Welte5013b2a2009-08-07 13:29:14 +02001094DEFUN(cfg_net,
1095 cfg_net_cmd,
1096 "network",
1097 "Configure the GSM network")
1098{
1099 vty->index = gsmnet;
1100 vty->node = GSMNET_NODE;
1101
1102 return CMD_SUCCESS;
1103}
1104
1105
1106DEFUN(cfg_net_ncc,
1107 cfg_net_ncc_cmd,
1108 "network country code <1-999>",
1109 "Set the GSM network country code")
1110{
1111 gsmnet->country_code = atoi(argv[0]);
1112
1113 return CMD_SUCCESS;
1114}
1115
1116DEFUN(cfg_net_mnc,
1117 cfg_net_mnc_cmd,
1118 "mobile network code <1-999>",
1119 "Set the GSM mobile network code")
1120{
1121 gsmnet->network_code = atoi(argv[0]);
1122
1123 return CMD_SUCCESS;
1124}
1125
1126DEFUN(cfg_net_name_short,
1127 cfg_net_name_short_cmd,
1128 "short name NAME",
1129 "Set the short GSM network name")
1130{
1131 if (gsmnet->name_short)
1132 talloc_free(gsmnet->name_short);
1133
1134 gsmnet->name_short = talloc_strdup(gsmnet, argv[0]);
1135
1136 return CMD_SUCCESS;
1137}
1138
1139DEFUN(cfg_net_name_long,
1140 cfg_net_name_long_cmd,
1141 "long name NAME",
1142 "Set the long GSM network name")
1143{
1144 if (gsmnet->name_long)
1145 talloc_free(gsmnet->name_long);
1146
1147 gsmnet->name_long = talloc_strdup(gsmnet, argv[0]);
1148
1149 return CMD_SUCCESS;
1150}
Harald Welte40f82892009-05-23 17:31:39 +00001151
Harald Welte (local)69de3972009-08-12 14:42:23 +02001152DEFUN(cfg_net_auth_policy,
1153 cfg_net_auth_policy_cmd,
1154 "auth policy (closed|accept-all|token)",
1155 "Set the GSM network authentication policy\n")
1156{
1157 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
1158
1159 gsmnet->auth_policy = policy;
1160
1161 return CMD_SUCCESS;
1162}
1163
Harald Welte1085c092009-11-18 20:33:19 +01001164DEFUN(cfg_net_reject_cause,
1165 cfg_net_reject_cause_cmd,
1166 "location updating reject cause <2-111>",
1167 "Set the reject cause of location updating reject\n")
1168{
1169 gsmnet->reject_cause = atoi(argv[0]);
1170
1171 return CMD_SUCCESS;
1172}
1173
Harald Welte4381cfe2009-08-30 15:47:06 +09001174DEFUN(cfg_net_encryption,
1175 cfg_net_encryption_cmd,
1176 "encryption a5 (0|1|2)",
1177 "Enable or disable encryption (A5) for this network\n")
1178{
Andreas.Eversberg1059deb2009-11-17 09:55:26 +01001179 gsmnet->a5_encryption= atoi(argv[0]);
Harald Welte4381cfe2009-08-30 15:47:06 +09001180
1181 return CMD_SUCCESS;
1182}
1183
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001184DEFUN(cfg_net_neci,
1185 cfg_net_neci_cmd,
1186 "neci (0|1)",
1187 "Set if NECI of cell selection is to be set")
1188{
1189 gsmnet->neci = atoi(argv[0]);
1190 return CMD_SUCCESS;
1191}
1192
Harald Welteeab84a12009-12-13 10:53:12 +01001193DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1194 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
1195 "Set the Radio Resource Location Protocol Mode")
1196{
1197 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1198
1199 return CMD_SUCCESS;
1200}
1201
Harald Welte648b6ce2009-12-14 09:00:24 +01001202DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1203 "mm info (0|1)",
1204 "Whether to send MM INFO after LOC UPD ACCEPT")
1205{
1206 gsmnet->send_mm_info = atoi(argv[0]);
1207
1208 return CMD_SUCCESS;
1209}
1210
Harald Weltebc814502009-12-19 21:41:52 +01001211DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1212 "handover (0|1)",
1213 "Whether or not to use in-call handover")
1214{
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001215 int enable = atoi(argv[0]);
1216
1217 if (enable && ipacc_rtp_direct) {
Harald Weltefe03f0d2009-12-20 13:51:01 +01001218 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1219 "is enabled by using the -P command line option%s",
1220 VTY_NEWLINE);
1221 return CMD_WARNING;
1222 }
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001223 gsmnet->handover.active = enable;
Harald Weltebc814502009-12-19 21:41:52 +01001224
1225 return CMD_SUCCESS;
1226}
1227
Harald Welteb720bd32009-12-21 16:51:50 +01001228DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1229 "handover window rxlev averaging <1-10>",
1230 "How many RxLev measurements are used for averaging")
1231{
1232 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1233 return CMD_SUCCESS;
1234}
1235
1236DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1237 "handover window rxqual averaging <1-10>",
1238 "How many RxQual measurements are used for averaging")
1239{
1240 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1241 return CMD_SUCCESS;
1242}
1243
1244DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1245 "handover window rxlev neighbor averaging <1-10>",
1246 "How many RxQual measurements are used for averaging")
1247{
1248 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1249 return CMD_SUCCESS;
1250}
1251
1252DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1253 "handover power budget interval <1-99>",
1254 "How often to check if we have a better cell (SACCH frames)")
1255{
1256 gsmnet->handover.pwr_interval = atoi(argv[0]);
1257 return CMD_SUCCESS;
1258}
1259
1260DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1261 "handover power budget hysteresis <0-999>",
1262 "How many dB does a neighbor to be stronger to become a HO candidate")
1263{
1264 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1265 return CMD_SUCCESS;
1266}
1267
1268DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1269 "handover maximum distance <0-9999>",
1270 "How big is the maximum timing advance before HO is forced")
1271{
1272 gsmnet->handover.max_distance = atoi(argv[0]);
1273 return CMD_SUCCESS;
1274}
Harald Weltebc814502009-12-19 21:41:52 +01001275
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001276#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001277 DEFUN(cfg_net_T##number, \
1278 cfg_net_T##number##_cmd, \
1279 "timer t" #number " <0-65535>", \
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001280 doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001281{ \
1282 int value = atoi(argv[0]); \
1283 \
1284 if (value < 0 || value > 65535) { \
1285 vty_out(vty, "Timer value %s out of range.%s", \
1286 argv[0], VTY_NEWLINE); \
1287 return CMD_WARNING; \
1288 } \
1289 \
1290 gsmnet->T##number = value; \
1291 return CMD_SUCCESS; \
1292}
1293
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001294DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1295DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1296DECLARE_TIMER(3105, "Currently not used.")
1297DECLARE_TIMER(3107, "Currently not used.")
1298DECLARE_TIMER(3109, "Currently not used.")
1299DECLARE_TIMER(3111, "Currently not used.")
1300DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1301DECLARE_TIMER(3115, "Currently not used.")
1302DECLARE_TIMER(3117, "Currently not used.")
1303DECLARE_TIMER(3119, "Currently not used.")
1304DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001305
1306
Harald Welte5258fc42009-03-28 19:07:53 +00001307/* per-BTS configuration */
1308DEFUN(cfg_bts,
1309 cfg_bts_cmd,
1310 "bts BTS_NR",
1311 "Select a BTS to configure\n")
1312{
1313 int bts_nr = atoi(argv[0]);
1314 struct gsm_bts *bts;
1315
Harald Weltee441d9c2009-06-21 16:17:15 +02001316 if (bts_nr > gsmnet->num_bts) {
1317 vty_out(vty, "%% The next unused BTS number is %u%s",
1318 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001319 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001320 } else if (bts_nr == gsmnet->num_bts) {
1321 /* allocate a new one */
1322 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1323 HARDCODED_TSC, HARDCODED_BSIC);
1324 } else
1325 bts = gsm_bts_num(gsmnet, bts_nr);
1326
1327 if (!bts)
1328 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +00001329
1330 vty->index = bts;
1331 vty->node = BTS_NODE;
1332
1333 return CMD_SUCCESS;
1334}
1335
1336DEFUN(cfg_bts_type,
1337 cfg_bts_type_cmd,
1338 "type TYPE",
1339 "Set the BTS type\n")
1340{
1341 struct gsm_bts *bts = vty->index;
Harald Welte39315c42010-01-10 18:01:52 +01001342 int rc;
Harald Welte5258fc42009-03-28 19:07:53 +00001343
Harald Welte39315c42010-01-10 18:01:52 +01001344 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1345 if (rc < 0)
1346 return CMD_WARNING;
Harald Welte8175e952009-10-20 00:22:00 +02001347
Harald Welte5258fc42009-03-28 19:07:53 +00001348 return CMD_SUCCESS;
1349}
1350
Harald Weltefcd24452009-06-20 18:15:19 +02001351DEFUN(cfg_bts_band,
1352 cfg_bts_band_cmd,
1353 "band BAND",
1354 "Set the frequency band of this BTS\n")
1355{
1356 struct gsm_bts *bts = vty->index;
Harald Welte42581822009-08-08 16:12:58 +02001357 int band = gsm_band_parse(argv[0]);
Harald Weltefcd24452009-06-20 18:15:19 +02001358
1359 if (band < 0) {
1360 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1361 band, VTY_NEWLINE);
1362 return CMD_WARNING;
1363 }
1364
1365 bts->band = band;
1366
1367 return CMD_SUCCESS;
1368}
1369
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001370DEFUN(cfg_bts_ci,
1371 cfg_bts_ci_cmd,
1372 "cell_identity <0-65535>",
1373 "Set the Cell identity of this BTS\n")
1374{
1375 struct gsm_bts *bts = vty->index;
1376 int ci = atoi(argv[0]);
1377
1378 if (ci < 0 || ci > 0xffff) {
1379 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1380 ci, VTY_NEWLINE);
1381 return CMD_WARNING;
1382 }
1383 bts->cell_identity = ci;
1384
1385 return CMD_SUCCESS;
1386}
1387
Harald Welte5258fc42009-03-28 19:07:53 +00001388DEFUN(cfg_bts_lac,
1389 cfg_bts_lac_cmd,
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001390 "location_area_code <0-65535>",
Harald Welte5258fc42009-03-28 19:07:53 +00001391 "Set the Location Area Code (LAC) of this BTS\n")
1392{
1393 struct gsm_bts *bts = vty->index;
1394 int lac = atoi(argv[0]);
1395
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001396 if (lac < 0 || lac > 0xffff) {
1397 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte5258fc42009-03-28 19:07:53 +00001398 lac, VTY_NEWLINE);
1399 return CMD_WARNING;
1400 }
Holger Hans Peter Freythere48b9562009-10-01 04:07:15 +02001401
1402 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1403 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1404 lac, VTY_NEWLINE);
1405 return CMD_WARNING;
1406 }
1407
Harald Welte5258fc42009-03-28 19:07:53 +00001408 bts->location_area_code = lac;
1409
1410 return CMD_SUCCESS;
1411}
1412
Harald Weltea43f7892009-12-01 18:04:30 +05301413
Harald Welte5258fc42009-03-28 19:07:53 +00001414DEFUN(cfg_bts_tsc,
1415 cfg_bts_tsc_cmd,
1416 "training_sequence_code <0-255>",
1417 "Set the Training Sequence Code (TSC) of this BTS\n")
1418{
1419 struct gsm_bts *bts = vty->index;
1420 int tsc = atoi(argv[0]);
1421
1422 if (tsc < 0 || tsc > 0xff) {
1423 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1424 tsc, VTY_NEWLINE);
1425 return CMD_WARNING;
1426 }
1427 bts->tsc = tsc;
1428
1429 return CMD_SUCCESS;
1430}
1431
Harald Welte78f2f502009-05-23 16:56:52 +00001432DEFUN(cfg_bts_bsic,
1433 cfg_bts_bsic_cmd,
1434 "base_station_id_code <0-63>",
1435 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1436{
1437 struct gsm_bts *bts = vty->index;
1438 int bsic = atoi(argv[0]);
1439
1440 if (bsic < 0 || bsic > 0x3f) {
Harald Welte42581822009-08-08 16:12:58 +02001441 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte78f2f502009-05-23 16:56:52 +00001442 bsic, VTY_NEWLINE);
1443 return CMD_WARNING;
1444 }
1445 bts->bsic = bsic;
1446
1447 return CMD_SUCCESS;
1448}
1449
1450
Harald Welte4cc34222009-05-01 15:12:31 +00001451DEFUN(cfg_bts_unit_id,
1452 cfg_bts_unit_id_cmd,
Harald Welte07dc73d2009-08-07 13:27:09 +02001453 "ip.access unit_id <0-65534> <0-255>",
1454 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte4cc34222009-05-01 15:12:31 +00001455{
1456 struct gsm_bts *bts = vty->index;
1457 int site_id = atoi(argv[0]);
1458 int bts_id = atoi(argv[1]);
1459
Harald Welte07dc73d2009-08-07 13:27:09 +02001460 if (!is_ipaccess_bts(bts)) {
1461 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1462 return CMD_WARNING;
1463 }
1464
Harald Welte4cc34222009-05-01 15:12:31 +00001465 bts->ip_access.site_id = site_id;
1466 bts->ip_access.bts_id = bts_id;
1467
1468 return CMD_SUCCESS;
1469}
1470
Harald Welte8175e952009-10-20 00:22:00 +02001471DEFUN(cfg_bts_stream_id,
1472 cfg_bts_stream_id_cmd,
1473 "oml ip.access stream_id <0-255>",
1474 "Set the ip.access Stream ID of the OML link of this BTS\n")
1475{
1476 struct gsm_bts *bts = vty->index;
1477 int stream_id = atoi(argv[0]);
1478
1479 if (!is_ipaccess_bts(bts)) {
1480 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1481 return CMD_WARNING;
1482 }
1483
1484 bts->oml_tei = stream_id;
1485
1486 return CMD_SUCCESS;
1487}
1488
1489
Harald Welte42581822009-08-08 16:12:58 +02001490DEFUN(cfg_bts_oml_e1,
1491 cfg_bts_oml_e1_cmd,
1492 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
1493 "E1 interface to be used for OML\n")
1494{
1495 struct gsm_bts *bts = vty->index;
1496
1497 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1498
1499 return CMD_SUCCESS;
1500}
1501
1502
1503DEFUN(cfg_bts_oml_e1_tei,
1504 cfg_bts_oml_e1_tei_cmd,
1505 "oml e1 tei <0-63>",
1506 "Set the TEI to be used for OML")
1507{
1508 struct gsm_bts *bts = vty->index;
1509
1510 bts->oml_tei = atoi(argv[0]);
1511
1512 return CMD_SUCCESS;
1513}
1514
Harald Welte7a8fa412009-08-10 13:48:16 +02001515DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1516 "channel allocator (ascending|descending)",
1517 "Should the channel allocator allocate in reverse TRX order?")
1518{
1519 struct gsm_bts *bts = vty->index;
1520
1521 if (!strcmp(argv[0], "ascending"))
1522 bts->chan_alloc_reverse = 0;
1523 else
1524 bts->chan_alloc_reverse = 1;
1525
1526 return CMD_SUCCESS;
1527}
1528
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001529DEFUN(cfg_bts_rach_tx_integer,
1530 cfg_bts_rach_tx_integer_cmd,
1531 "rach tx integer <0-15>",
1532 "Set the raw tx integer value in RACH Control parameters IE")
1533{
1534 struct gsm_bts *bts = vty->index;
1535 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1536 return CMD_SUCCESS;
1537}
1538
1539DEFUN(cfg_bts_rach_max_trans,
1540 cfg_bts_rach_max_trans_cmd,
1541 "rach max transmission (1|2|4|7)",
1542 "Set the maximum number of RACH burst transmissions")
1543{
1544 struct gsm_bts *bts = vty->index;
1545 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1546 return CMD_SUCCESS;
1547}
1548
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001549DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1550 "cell barred (0|1)",
1551 "Should this cell be barred from access?")
1552{
1553 struct gsm_bts *bts = vty->index;
1554
Harald Welte71355012009-12-21 23:08:18 +01001555 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001556
1557 return CMD_SUCCESS;
1558}
1559
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001560DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1561 "ms max power <0-40>",
1562 "Maximum transmit power of the MS")
1563{
1564 struct gsm_bts *bts = vty->index;
1565
1566 bts->ms_max_power = atoi(argv[0]);
1567
1568 return CMD_SUCCESS;
1569}
1570
Harald Welte73225282009-12-12 18:17:25 +01001571DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1572 "cell reselection hysteresis <0-14>",
1573 "Cell Re-Selection Hysteresis in dB")
1574{
1575 struct gsm_bts *bts = vty->index;
1576
1577 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1578
1579 return CMD_SUCCESS;
1580}
1581
1582DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1583 "rxlev access min <0-63>",
1584 "Minimum RxLev needed for cell access (better than -110dBm)")
1585{
1586 struct gsm_bts *bts = vty->index;
1587
1588 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1589
1590 return CMD_SUCCESS;
1591}
1592
Harald Welte (local)efc92312009-08-14 23:09:25 +02001593DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1594 "periodic location update <0-1530>",
1595 "Periodic Location Updating Interval in Minutes")
1596{
1597 struct gsm_bts *bts = vty->index;
1598
Harald Weltea43f7892009-12-01 18:04:30 +05301599 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 10;
Harald Welte (local)efc92312009-08-14 23:09:25 +02001600
1601 return CMD_SUCCESS;
1602}
1603
Harald Welte7a8fa412009-08-10 13:48:16 +02001604
Harald Welte5258fc42009-03-28 19:07:53 +00001605/* per TRX configuration */
1606DEFUN(cfg_trx,
1607 cfg_trx_cmd,
1608 "trx TRX_NR",
1609 "Select a TRX to configure")
1610{
1611 int trx_nr = atoi(argv[0]);
1612 struct gsm_bts *bts = vty->index;
1613 struct gsm_bts_trx *trx;
1614
Harald Weltee441d9c2009-06-21 16:17:15 +02001615 if (trx_nr > bts->num_trx) {
1616 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
1617 bts->num_trx, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001618 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001619 } else if (trx_nr == bts->num_trx) {
1620 /* we need to allocate a new one */
1621 trx = gsm_bts_trx_alloc(bts);
1622 } else
1623 trx = gsm_bts_trx_num(bts, trx_nr);
1624
1625 if (!trx)
1626 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +00001627
1628 vty->index = trx;
1629 vty->node = TRX_NODE;
1630
1631 return CMD_SUCCESS;
1632}
1633
1634DEFUN(cfg_trx_arfcn,
1635 cfg_trx_arfcn_cmd,
1636 "arfcn <1-1024>",
1637 "Set the ARFCN for this TRX\n")
1638{
1639 int arfcn = atoi(argv[0]);
1640 struct gsm_bts_trx *trx = vty->index;
1641
1642 /* FIXME: check if this ARFCN is supported by this TRX */
1643
1644 trx->arfcn = arfcn;
1645
1646 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
1647 /* FIXME: use OML layer to update the ARFCN */
1648 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
1649
1650 return CMD_SUCCESS;
1651}
1652
Harald Welte (local)7b37d972009-12-27 20:56:38 +01001653DEFUN(cfg_trx_nominal_power,
1654 cfg_trx_nominal_power_cmd,
1655 "nominal power <0-100>",
1656 "Nominal TRX RF Power in dB\n")
1657{
1658 struct gsm_bts_trx *trx = vty->index;
1659
1660 trx->nominal_power = atoi(argv[0]);
1661
1662 return CMD_SUCCESS;
1663}
1664
Harald Weltefcd24452009-06-20 18:15:19 +02001665DEFUN(cfg_trx_max_power_red,
1666 cfg_trx_max_power_red_cmd,
1667 "max_power_red <0-100>",
1668 "Reduction of maximum BS RF Power in dB\n")
1669{
1670 int maxpwr_r = atoi(argv[0]);
1671 struct gsm_bts_trx *trx = vty->index;
Harald Welte61a83b22009-11-18 09:20:22 +01001672 int upper_limit = 24; /* default 12.21 max power red. */
Harald Weltefcd24452009-06-20 18:15:19 +02001673
1674 /* FIXME: check if our BTS type supports more than 12 */
1675 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
1676 vty_out(vty, "%% Power %d dB is not in the valid range%s",
1677 maxpwr_r, VTY_NEWLINE);
1678 return CMD_WARNING;
1679 }
1680 if (maxpwr_r & 1) {
1681 vty_out(vty, "%% Power %d dB is not an even value%s",
1682 maxpwr_r, VTY_NEWLINE);
1683 return CMD_WARNING;
1684 }
1685
1686 trx->max_power_red = maxpwr_r;
1687
1688 /* FIXME: make sure we update this using OML */
1689
1690 return CMD_SUCCESS;
1691}
1692
Harald Welte42581822009-08-08 16:12:58 +02001693DEFUN(cfg_trx_rsl_e1,
1694 cfg_trx_rsl_e1_cmd,
1695 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
1696 "E1 interface to be used for RSL\n")
1697{
1698 struct gsm_bts_trx *trx = vty->index;
1699
1700 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
1701
1702 return CMD_SUCCESS;
1703}
1704
1705DEFUN(cfg_trx_rsl_e1_tei,
1706 cfg_trx_rsl_e1_tei_cmd,
1707 "rsl e1 tei <0-63>",
1708 "Set the TEI to be used for RSL")
1709{
1710 struct gsm_bts_trx *trx = vty->index;
1711
1712 trx->rsl_tei = atoi(argv[0]);
1713
1714 return CMD_SUCCESS;
1715}
1716
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01001717DEFUN(cfg_trx_rf_locked,
1718 cfg_trx_rf_locked_cmd,
1719 "rf_locked (0|1)",
1720 "Turn off RF of the TRX.\n")
1721{
1722 int locked = atoi(argv[0]);
1723 struct gsm_bts_trx *trx = vty->index;
1724
1725 gsm_trx_lock_rf(trx, locked);
1726 return CMD_SUCCESS;
1727}
Harald Welte42581822009-08-08 16:12:58 +02001728
Harald Welte5258fc42009-03-28 19:07:53 +00001729/* per TS configuration */
1730DEFUN(cfg_ts,
1731 cfg_ts_cmd,
Harald Welte42581822009-08-08 16:12:58 +02001732 "timeslot <0-7>",
Harald Welte5258fc42009-03-28 19:07:53 +00001733 "Select a Timeslot to configure")
1734{
1735 int ts_nr = atoi(argv[0]);
1736 struct gsm_bts_trx *trx = vty->index;
1737 struct gsm_bts_trx_ts *ts;
1738
1739 if (ts_nr >= TRX_NR_TS) {
1740 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
1741 TRX_NR_TS, VTY_NEWLINE);
1742 return CMD_WARNING;
1743 }
1744
1745 ts = &trx->ts[ts_nr];
1746
1747 vty->index = ts;
1748 vty->node = TS_NODE;
1749
1750 return CMD_SUCCESS;
1751}
1752
Harald Weltea6fd58e2009-08-07 00:25:23 +02001753DEFUN(cfg_ts_pchan,
1754 cfg_ts_pchan_cmd,
1755 "phys_chan_config PCHAN",
1756 "Physical Channel configuration (TCH/SDCCH/...)")
1757{
1758 struct gsm_bts_trx_ts *ts = vty->index;
1759 int pchanc;
1760
1761 pchanc = gsm_pchan_parse(argv[0]);
1762 if (pchanc < 0)
1763 return CMD_WARNING;
1764
1765 ts->pchan = pchanc;
1766
1767 return CMD_SUCCESS;
1768}
1769
1770DEFUN(cfg_ts_e1_subslot,
1771 cfg_ts_e1_subslot_cmd,
Harald Welte42581822009-08-08 16:12:58 +02001772 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltea6fd58e2009-08-07 00:25:23 +02001773 "E1 sub-slot connected to this on-air timeslot")
1774{
1775 struct gsm_bts_trx_ts *ts = vty->index;
1776
Harald Welte42581822009-08-08 16:12:58 +02001777 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Weltea6fd58e2009-08-07 00:25:23 +02001778
1779 return CMD_SUCCESS;
1780}
Harald Welte5258fc42009-03-28 19:07:53 +00001781
Harald Welte68628e82009-03-10 12:17:57 +00001782int bsc_vty_init(struct gsm_network *net)
1783{
1784 gsmnet = net;
1785
1786 cmd_init(1);
1787 vty_init();
1788
1789 install_element(VIEW_NODE, &show_net_cmd);
1790 install_element(VIEW_NODE, &show_bts_cmd);
1791 install_element(VIEW_NODE, &show_trx_cmd);
1792 install_element(VIEW_NODE, &show_ts_cmd);
1793 install_element(VIEW_NODE, &show_lchan_cmd);
Harald Welte1bc77352009-03-10 19:47:51 +00001794
1795 install_element(VIEW_NODE, &show_e1drv_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001796 install_element(VIEW_NODE, &show_e1line_cmd);
1797 install_element(VIEW_NODE, &show_e1ts_cmd);
1798
Harald Weltef5025b62009-03-28 16:55:11 +00001799 install_element(VIEW_NODE, &show_paging_cmd);
Harald Welte24ff6ee2009-12-22 00:41:05 +01001800 install_element(VIEW_NODE, &show_stats_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00001801
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +01001802 install_element(VIEW_NODE, &enable_logging_cmd);
1803 install_element(VIEW_NODE, &disable_logging_cmd);
1804 install_element(VIEW_NODE, &logging_fltr_imsi_cmd);
1805 install_element(VIEW_NODE, &logging_fltr_all_cmd);
1806 install_element(VIEW_NODE, &logging_use_clr_cmd);
1807 install_element(VIEW_NODE, &logging_prnt_timestamp_cmd);
1808 install_element(VIEW_NODE, &logging_set_category_mask_cmd);
Harald Welte (local)b79bdd92009-12-26 19:45:22 +01001809 install_element(VIEW_NODE, &logging_level_cmd);
Sylvain Munautb6c273e2009-12-24 16:48:33 +01001810 install_element(VIEW_NODE, &logging_set_log_level_cmd);
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +01001811
Harald Welte5013b2a2009-08-07 13:29:14 +02001812 install_element(CONFIG_NODE, &cfg_net_cmd);
1813 install_node(&net_node, config_write_net);
1814 install_default(GSMNET_NODE);
Harald Welte42581822009-08-08 16:12:58 +02001815 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02001816 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
1817 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
1818 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)69de3972009-08-12 14:42:23 +02001819 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte1085c092009-11-18 20:33:19 +01001820 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Welte4381cfe2009-08-30 15:47:06 +09001821 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001822 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welteeab84a12009-12-13 10:53:12 +01001823 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte3d23db42009-12-14 17:49:15 +01001824 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Weltebc814502009-12-19 21:41:52 +01001825 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Welteb720bd32009-12-21 16:51:50 +01001826 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
1827 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
1828 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
1829 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
1830 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
1831 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001832 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01001833 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
1834 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
1835 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
1836 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
1837 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
1838 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
1839 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
1840 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
1841 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
1842 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02001843
1844 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte67ce0732009-08-06 19:06:46 +02001845 install_node(&bts_node, config_write_bts);
Harald Welte68628e82009-03-10 12:17:57 +00001846 install_default(BTS_NODE);
Harald Welte5258fc42009-03-28 19:07:53 +00001847 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Weltefcd24452009-06-20 18:15:19 +02001848 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001849 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00001850 install_element(BTS_NODE, &cfg_bts_lac_cmd);
1851 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte42581822009-08-08 16:12:58 +02001852 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte4cc34222009-05-01 15:12:31 +00001853 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte8175e952009-10-20 00:22:00 +02001854 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte42581822009-08-08 16:12:58 +02001855 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
1856 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02001857 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001858 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
1859 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001860 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001861 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)efc92312009-08-14 23:09:25 +02001862 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welte73225282009-12-12 18:17:25 +01001863 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
1864 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02001865
Harald Welte68628e82009-03-10 12:17:57 +00001866
Harald Welte5258fc42009-03-28 19:07:53 +00001867 install_element(BTS_NODE, &cfg_trx_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001868 install_node(&trx_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00001869 install_default(TRX_NODE);
Harald Welte5258fc42009-03-28 19:07:53 +00001870 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte (local)7b37d972009-12-27 20:56:38 +01001871 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte879dc972009-06-20 22:36:12 +02001872 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte42581822009-08-08 16:12:58 +02001873 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
1874 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01001875 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001876
Harald Welte5258fc42009-03-28 19:07:53 +00001877 install_element(TRX_NODE, &cfg_ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001878 install_node(&ts_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00001879 install_default(TS_NODE);
Harald Weltea6fd58e2009-08-07 00:25:23 +02001880 install_element(TS_NODE, &cfg_ts_pchan_cmd);
1881 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001882
Holger Hans Peter Freythercfa90d42009-08-10 10:17:50 +02001883 bsc_vty_init_extra(net);
Harald Welte40f82892009-05-23 17:31:39 +00001884
Harald Welte68628e82009-03-10 12:17:57 +00001885 return 0;
1886}