blob: c789a154e6bc30d22621f868fad0e9dbadafe24d [file] [log] [blame]
Harald Welte59b04682009-06-10 05:40:52 +08001/* 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 Welte684b9752009-08-09 15:13:54 +020026#include <vty/buffer.h>
Harald Welte59b04682009-06-10 05:40:52 +080027#include <vty/vty.h>
28
29#include <arpa/inet.h>
30
Harald Weltef4625b12010-02-20 16:24:02 +010031#include <osmocore/linuxlist.h>
Harald Welte59b04682009-06-10 05:40:52 +080032#include <openbsc/gsm_data.h>
Harald Welte59b04682009-06-10 05:40:52 +080033#include <openbsc/e1_input.h>
34#include <openbsc/abis_nm.h>
Harald Weltef4625b12010-02-20 16:24:02 +010035#include <osmocore/gsm_utils.h>
Harald Weltefe96f382009-12-22 13:09:29 +010036#include <openbsc/chan_alloc.h>
Harald Welte44007742009-12-22 21:43:14 +010037#include <openbsc/meas_rep.h>
Harald Welte59b04682009-06-10 05:40:52 +080038#include <openbsc/db.h>
Harald Weltef4625b12010-02-20 16:24:02 +010039#include <osmocore/talloc.h>
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +010040#include <openbsc/telnet_interface.h>
Harald Welte59b04682009-06-10 05:40:52 +080041
42static struct gsm_network *gsmnet;
43
Harald Weltee87eb462009-08-07 13:29:14 +020044struct cmd_node net_node = {
45 GSMNET_NODE,
46 "%s(network)#",
47 1,
48};
49
Harald Welte59b04682009-06-10 05:40:52 +080050struct 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
Harald Welte59b04682009-06-10 05:40:52 +080068static 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{
75 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);
78}
79
Harald Weltefe96f382009-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 Welte59b04682009-06-10 05:40:52 +0800100static void net_dump_vty(struct vty *vty, struct gsm_network *net)
101{
Harald Weltefe96f382009-12-22 13:09:29 +0100102 struct pchan_load pl;
103
Harald Welte59b04682009-06-10 05:40:52 +0800104 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);
107 vty_out(vty, " Long network name: '%s'%s",
108 net->name_long, VTY_NEWLINE);
109 vty_out(vty, " Short network name: '%s'%s",
110 net->name_short, VTY_NEWLINE);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +0200111 vty_out(vty, " Authentication policy: %s%s",
112 gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE);
Harald Welte59936d72009-11-18 20:33:19 +0100113 vty_out(vty, " Location updating reject cause: %u%s",
114 net->reject_cause, VTY_NEWLINE);
Harald Weltecca253a2009-08-30 15:47:06 +0900115 vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption,
116 VTY_NEWLINE);
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +0100117 vty_out(vty, " NECI (TCH/H): %u%s", net->neci,
118 VTY_NEWLINE);
Harald Welte52af1952009-12-13 10:53:12 +0100119 vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode),
120 VTY_NEWLINE);
Harald Weltea310f3e2009-12-14 09:00:24 +0100121 vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off",
122 VTY_NEWLINE);
Harald Welte0af9c9f2009-12-19 21:41:52 +0100123 vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off",
124 VTY_NEWLINE);
Harald Weltefe96f382009-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 Welte59b04682009-06-10 05:40:52 +0800128}
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{
141 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,
152 e1inp_signtype_name(e1l->type), VTY_NEWLINE);
153 vty_out(vty, " E1 TEI %u, SAPI %u%s",
154 e1l->tei, e1l->sapi, VTY_NEWLINE);
155}
156
157static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
158{
Harald Weltefe96f382009-12-22 13:09:29 +0100159 struct pchan_load pl;
160
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +0200161 vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
Harald Welte91afe4c2009-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 Freythera098dfb2009-08-21 14:44:12 +0200164 bts->cell_identity,
Harald Welte91afe4c2009-06-20 18:15:19 +0200165 bts->location_area_code, bts->bsic, bts->tsc,
166 bts->num_trx, VTY_NEWLINE);
Harald Welte8e9d1792009-12-12 15:38:16 +0100167 vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100168 vty_out(vty, "Minimum Rx Level for Access: %i dBm%s",
Harald Welte8e9d1792009-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 Welteb761bf82009-12-12 18:17:25 +0100172 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
Sylvain Munaut8e2d8de2009-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 Welte8c973ba2009-12-21 23:08:18 +0100178 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)e19be3f2009-08-12 13:28:23 +0200179 vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800180 if (is_ipaccess_bts(bts))
Harald Welte25572872009-10-20 00:22:00 +0200181 vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
Harald Welte59b04682009-06-10 05:40:52 +0800182 bts->ip_access.site_id, bts->ip_access.bts_id,
Harald Welte25572872009-10-20 00:22:00 +0200183 bts->oml_tei, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800184 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 Welte25572872009-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 Welte59b04682009-06-10 05:40:52 +0800194 /* FIXME: oml_link, chan_desc */
Harald Weltefe96f382009-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 Welte59b04682009-06-10 05:40:52 +0800199}
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) {
212 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
213 VTY_NEWLINE);
214 return CMD_WARNING;
215 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200216 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte59b04682009-06-10 05:40:52 +0800217 return CMD_SUCCESS;
218 }
219 /* print all BTS's */
220 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee712a5f2009-06-21 16:17:15 +0200221 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte59b04682009-06-10 05:40:52 +0800222
223 return CMD_SUCCESS;
224}
225
Harald Welte62868882009-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 Welte97ceef92009-08-06 19:06:46 +0200254static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
255{
Harald Welte62868882009-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 Welte97ceef92009-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 Weltee87eb462009-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)b709bfe2009-12-27 20:56:38 +0100269 vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200270 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte62868882009-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 Welte97ceef92009-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;
Harald Welte3055e332010-03-14 15:37:43 +0800281 int i;
Harald Welte97ceef92009-08-06 19:06:46 +0200282
Harald Weltee87eb462009-08-07 13:29:14 +0200283 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
284 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
285 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freyther6d82b7c2009-11-19 16:38:49 +0100286 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200287 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte97ceef92009-08-06 19:06:46 +0200288 VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200289 vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE);
290 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)cbd46102009-08-13 10:14:26 +0200291 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100292 vty_out(vty, " cell reselection hysteresis %u%s",
293 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
294 vty_out(vty, " rxlev access min %u%s",
295 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Harald Weltea54a2bb2009-12-01 18:04:30 +0530296 if (bts->si_common.chan_desc.t3212)
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +0200297 vty_out(vty, " periodic location update %u%s",
Harald Weltea54a2bb2009-12-01 18:04:30 +0530298 bts->si_common.chan_desc.t3212 * 10, VTY_NEWLINE);
Harald Welte3e774612009-08-10 13:48:16 +0200299 vty_out(vty, " channel allocator %s%s",
300 bts->chan_alloc_reverse ? "descending" : "ascending",
301 VTY_NEWLINE);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +0100302 vty_out(vty, " rach tx integer %u%s",
303 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
304 vty_out(vty, " rach max transmission %u%s",
305 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
306 VTY_NEWLINE);
Harald Welte8c973ba2009-12-21 23:08:18 +0100307 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)e19be3f2009-08-12 13:28:23 +0200308 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Harald Welte25572872009-10-20 00:22:00 +0200309 if (is_ipaccess_bts(bts)) {
Harald Weltee87eb462009-08-07 13:29:14 +0200310 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Welte3ffe1b32009-08-07 00:25:23 +0200311 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte25572872009-10-20 00:22:00 +0200312 vty_out(vty, " oml ip.access stream_id %u%s", bts->oml_tei, VTY_NEWLINE);
313 } else {
Harald Welte62868882009-08-08 16:12:58 +0200314 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
315 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
316 }
Harald Welte3055e332010-03-14 15:37:43 +0800317 vty_out(vty, " gprs routing area %u%s", bts->gprs.rac, VTY_NEWLINE);
318 vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
319 VTY_NEWLINE);
320 for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++)
321 vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
322 bts->gprs.cell.bvci, VTY_NEWLINE);
Harald Welte97ceef92009-08-06 19:06:46 +0200323
324 llist_for_each_entry(trx, &bts->trx_list, list)
325 config_write_trx_single(vty, trx);
326}
327
328static int config_write_bts(struct vty *v)
329{
330 struct gsm_bts *bts;
331
332 llist_for_each_entry(bts, &gsmnet->bts_list, list)
333 config_write_bts_single(v, bts);
334
335 return CMD_SUCCESS;
336}
337
Harald Weltee87eb462009-08-07 13:29:14 +0200338static int config_write_net(struct vty *vty)
339{
340 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200341 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200342 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200343 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
344 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +0200345 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Harald Welte59936d72009-11-18 20:33:19 +0100346 vty_out(vty, " location updating reject cause %u%s",
347 gsmnet->reject_cause, VTY_NEWLINE);
Harald Weltecca253a2009-08-30 15:47:06 +0900348 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freyther6b4f5462009-11-19 16:37:48 +0100349 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Harald Welte52af1952009-12-13 10:53:12 +0100350 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
351 VTY_NEWLINE);
Harald Weltea310f3e2009-12-14 09:00:24 +0100352 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Welte0af9c9f2009-12-19 21:41:52 +0100353 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Weltea8062f12009-12-21 16:51:50 +0100354 vty_out(vty, " handover window rxlev averaging %u%s",
355 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
356 vty_out(vty, " handover window rxqual averaging %u%s",
357 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
358 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
359 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
360 vty_out(vty, " handover power budget interval %u%s",
361 gsmnet->handover.pwr_interval, VTY_NEWLINE);
362 vty_out(vty, " handover power budget hysteresis %u%s",
363 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
364 vty_out(vty, " handover maximum distance %u%s",
365 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +0100366 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +0100367 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
368 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
369 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
370 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
371 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
372 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
373 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
374 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
375 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
376 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200377
378 return CMD_SUCCESS;
379}
Harald Welte97ceef92009-08-06 19:06:46 +0200380
Harald Welte59b04682009-06-10 05:40:52 +0800381static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
382{
383 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
384 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Welte91afe4c2009-06-20 18:15:19 +0200385 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte62868882009-08-08 16:12:58 +0200386 "resulting BS power: %d dBm%s",
Harald Welte91afe4c2009-06-20 18:15:19 +0200387 trx->nominal_power, trx->max_power_red,
Harald Welte62868882009-08-08 16:12:58 +0200388 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800389 vty_out(vty, " NM State: ");
390 net_dump_nmstate(vty, &trx->nm_state);
391 vty_out(vty, " Baseband Transceiver NM State: ");
392 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte25572872009-10-20 00:22:00 +0200393 if (is_ipaccess_bts(trx->bts)) {
394 vty_out(vty, " ip.access stream ID: 0x%02x%s",
395 trx->rsl_tei, VTY_NEWLINE);
396 } else {
397 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
398 e1isl_dump_vty(vty, trx->rsl_link);
399 }
Harald Welte59b04682009-06-10 05:40:52 +0800400}
401
402DEFUN(show_trx,
403 show_trx_cmd,
404 "show trx [bts_nr] [trx_nr]",
405 SHOW_STR "Display information about a TRX\n")
406{
407 struct gsm_network *net = gsmnet;
408 struct gsm_bts *bts = NULL;
409 struct gsm_bts_trx *trx;
410 int bts_nr, trx_nr;
411
412 if (argc >= 1) {
413 /* use the BTS number that the user has specified */
414 bts_nr = atoi(argv[0]);
415 if (bts_nr >= net->num_bts) {
416 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
417 VTY_NEWLINE);
418 return CMD_WARNING;
419 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200420 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800421 }
422 if (argc >= 2) {
423 trx_nr = atoi(argv[1]);
424 if (trx_nr >= bts->num_trx) {
425 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
426 VTY_NEWLINE);
427 return CMD_WARNING;
428 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200429 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800430 trx_dump_vty(vty, trx);
431 return CMD_SUCCESS;
432 }
433 if (bts) {
434 /* print all TRX in this BTS */
435 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200436 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800437 trx_dump_vty(vty, trx);
438 }
439 return CMD_SUCCESS;
440 }
441
442 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200443 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800444 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200445 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800446 trx_dump_vty(vty, trx);
447 }
448 }
449
450 return CMD_SUCCESS;
451}
452
Harald Welte97ceef92009-08-06 19:06:46 +0200453
Harald Welte59b04682009-06-10 05:40:52 +0800454static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
455{
Harald Welte59b04682009-06-10 05:40:52 +0800456 vty_out(vty, "Timeslot %u of TRX %u in BTS %u, phys cfg %s%s",
457 ts->nr, ts->trx->nr, ts->trx->bts->nr,
458 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
459 vty_out(vty, " NM State: ");
460 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte87504212009-12-02 01:56:49 +0530461 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welte59b04682009-06-10 05:40:52 +0800462 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
463 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
464 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800465}
466
467DEFUN(show_ts,
468 show_ts_cmd,
469 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
470 SHOW_STR "Display information about a TS\n")
471{
472 struct gsm_network *net = gsmnet;
473 struct gsm_bts *bts;
474 struct gsm_bts_trx *trx;
475 struct gsm_bts_trx_ts *ts;
476 int bts_nr, trx_nr, ts_nr;
477
478 if (argc >= 1) {
479 /* use the BTS number that the user has specified */
480 bts_nr = atoi(argv[0]);
481 if (bts_nr >= net->num_bts) {
482 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
483 VTY_NEWLINE);
484 return CMD_WARNING;
485 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200486 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800487 }
488 if (argc >= 2) {
489 trx_nr = atoi(argv[1]);
490 if (trx_nr >= bts->num_trx) {
491 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
492 VTY_NEWLINE);
493 return CMD_WARNING;
494 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200495 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800496 }
497 if (argc >= 3) {
498 ts_nr = atoi(argv[2]);
499 if (ts_nr >= TRX_NR_TS) {
500 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
501 VTY_NEWLINE);
502 return CMD_WARNING;
503 }
504 ts = &trx->ts[ts_nr];
505 ts_dump_vty(vty, ts);
506 return CMD_SUCCESS;
507 }
508 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200509 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800510 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200511 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800512 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
513 ts = &trx->ts[ts_nr];
514 ts_dump_vty(vty, ts);
515 }
516 }
517 }
518
519 return CMD_SUCCESS;
520}
521
Holger Hans Peter Freyther1dd0a1b2010-01-06 06:00:40 +0100522static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte59b04682009-06-10 05:40:52 +0800523{
Sylvain Munaute5863a22009-12-27 19:29:28 +0100524 int rc;
525 struct gsm_auth_info ainfo;
526 struct gsm_auth_tuple atuple;
527
Harald Welte91afe4c2009-06-20 18:15:19 +0200528 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte59b04682009-06-10 05:40:52 +0800529 subscr->authorized, VTY_NEWLINE);
530 if (subscr->name)
531 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
532 if (subscr->extension)
533 vty_out(vty, " Extension: %s%s", subscr->extension,
534 VTY_NEWLINE);
535 if (subscr->imsi)
536 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freythercd8bacf2009-08-19 12:53:57 +0200537 if (subscr->tmsi != GSM_RESERVED_TMSI)
538 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte270c06c2009-08-15 03:24:51 +0200539 VTY_NEWLINE);
Sylvain Munaute5863a22009-12-27 19:29:28 +0100540
Harald Welte (local)02d5efa2009-08-14 20:27:16 +0200541 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800542}
543
Harald Welte44007742009-12-22 21:43:14 +0100544static void meas_rep_dump_uni_vty(struct vty *vty,
545 struct gsm_meas_rep_unidir *mru,
546 const char *prefix,
547 const char *dir)
548{
549 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
550 prefix, dir, rxlev2dbm(mru->full.rx_lev),
551 dir, rxlev2dbm(mru->sub.rx_lev));
552 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
553 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
554 VTY_NEWLINE);
555}
556
557static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
558 const char *prefix)
559{
560 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
561 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
562 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
563 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
564 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
565 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
566 VTY_NEWLINE);
567 if (mr->flags & MEAS_REP_F_MS_TO)
568 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
569 mr->ms_timing_offset, VTY_NEWLINE);
570 if (mr->flags & MEAS_REP_F_MS_L1)
571 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
572 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
573 if (mr->flags & MEAS_REP_F_DL_VALID)
574 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
575 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
576}
577
Harald Welte59b04682009-06-10 05:40:52 +0800578static void lchan_dump_vty(struct vty *vty, struct gsm_lchan *lchan)
579{
Harald Welte44007742009-12-22 21:43:14 +0100580 int idx;
581
Harald Welte59b04682009-06-10 05:40:52 +0800582 vty_out(vty, "Lchan %u in Timeslot %u of TRX %u in BTS %u, Type %s%s",
583 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
Harald Welte (local)02204d02009-12-27 18:05:25 +0100584 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Harald Welte59b04682009-06-10 05:40:52 +0800585 VTY_NEWLINE);
Harald Welteab2534c2009-12-29 10:52:38 +0100586 vty_out(vty, " Use Count: %u, State: %s%s", lchan->use_count,
587 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100588 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
589 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
590 - lchan->bs_power*2,
591 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
592 VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800593 if (lchan->subscr) {
594 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
595 subscr_dump_vty(vty, lchan->subscr);
596 } else
597 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte87504212009-12-02 01:56:49 +0530598 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
599 struct in_addr ia;
600 ia.s_addr = lchan->abis_ip.bound_ip;
601 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
602 inet_ntoa(ia), lchan->abis_ip.bound_port,
603 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
604 VTY_NEWLINE);
605 }
Harald Welte44007742009-12-22 21:43:14 +0100606
607 /* we want to report the last measurement report */
608 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
609 lchan->meas_rep_idx, 1);
610 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte59b04682009-06-10 05:40:52 +0800611}
612
Harald Welte03740842009-06-10 23:11:52 +0800613#if 0
614TODO: callref and remote callref of call must be resolved to get gsm_trans object
Harald Welte59b04682009-06-10 05:40:52 +0800615static void call_dump_vty(struct vty *vty, struct gsm_call *call)
616{
617 vty_out(vty, "Call Type %u, State %u, Transaction ID %u%s",
618 call->type, call->state, call->transaction_id, VTY_NEWLINE);
619
620 if (call->local_lchan) {
621 vty_out(vty, "Call Local Channel:%s", VTY_NEWLINE);
622 lchan_dump_vty(vty, call->local_lchan);
623 } else
624 vty_out(vty, "Call has no Local Channel%s", VTY_NEWLINE);
625
626 if (call->remote_lchan) {
627 vty_out(vty, "Call Remote Channel:%s", VTY_NEWLINE);
628 lchan_dump_vty(vty, call->remote_lchan);
629 } else
630 vty_out(vty, "Call has no Remote Channel%s", VTY_NEWLINE);
631
632 if (call->called_subscr) {
633 vty_out(vty, "Called Subscriber:%s", VTY_NEWLINE);
634 subscr_dump_vty(vty, call->called_subscr);
635 } else
636 vty_out(vty, "Call has no Called Subscriber%s", VTY_NEWLINE);
637}
Harald Welte03740842009-06-10 23:11:52 +0800638#endif
Harald Welte59b04682009-06-10 05:40:52 +0800639
640DEFUN(show_lchan,
641 show_lchan_cmd,
642 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
643 SHOW_STR "Display information about a logical channel\n")
644{
645 struct gsm_network *net = gsmnet;
646 struct gsm_bts *bts;
647 struct gsm_bts_trx *trx;
648 struct gsm_bts_trx_ts *ts;
649 struct gsm_lchan *lchan;
650 int bts_nr, trx_nr, ts_nr, lchan_nr;
651
652 if (argc >= 1) {
653 /* use the BTS number that the user has specified */
654 bts_nr = atoi(argv[0]);
655 if (bts_nr >= net->num_bts) {
656 vty_out(vty, "%% can't find BTS %s%s", argv[0],
657 VTY_NEWLINE);
658 return CMD_WARNING;
659 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200660 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800661 }
662 if (argc >= 2) {
663 trx_nr = atoi(argv[1]);
664 if (trx_nr >= bts->num_trx) {
665 vty_out(vty, "%% can't find TRX %s%s", argv[1],
666 VTY_NEWLINE);
667 return CMD_WARNING;
668 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200669 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800670 }
671 if (argc >= 3) {
672 ts_nr = atoi(argv[2]);
673 if (ts_nr >= TRX_NR_TS) {
674 vty_out(vty, "%% can't find TS %s%s", argv[2],
675 VTY_NEWLINE);
676 return CMD_WARNING;
677 }
678 ts = &trx->ts[ts_nr];
679 }
680 if (argc >= 4) {
681 lchan_nr = atoi(argv[3]);
682 if (lchan_nr >= TS_MAX_LCHAN) {
683 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
684 VTY_NEWLINE);
685 return CMD_WARNING;
686 }
687 lchan = &ts->lchan[lchan_nr];
688 lchan_dump_vty(vty, lchan);
689 return CMD_SUCCESS;
690 }
691 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200692 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800693 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200694 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800695 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
696 ts = &trx->ts[ts_nr];
697 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
698 lchan_nr++) {
699 lchan = &ts->lchan[lchan_nr];
700 if (lchan->type == GSM_LCHAN_NONE)
701 continue;
702 lchan_dump_vty(vty, lchan);
703 }
704 }
705 }
706 }
707
708 return CMD_SUCCESS;
709}
710
711static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
712{
713 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
714}
715
716DEFUN(show_e1drv,
717 show_e1drv_cmd,
718 "show e1_driver",
719 SHOW_STR "Display information about available E1 drivers\n")
720{
721 struct e1inp_driver *drv;
722
723 llist_for_each_entry(drv, &e1inp_driver_list, list)
724 e1drv_dump_vty(vty, drv);
725
726 return CMD_SUCCESS;
727}
728
729static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
730{
731 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
732 line->num, line->name ? line->name : "",
733 line->driver->name, VTY_NEWLINE);
734}
735
736DEFUN(show_e1line,
737 show_e1line_cmd,
738 "show e1_line [line_nr]",
739 SHOW_STR "Display information about a E1 line\n")
740{
741 struct e1inp_line *line;
742
743 if (argc >= 1) {
744 int num = atoi(argv[0]);
745 llist_for_each_entry(line, &e1inp_line_list, list) {
746 if (line->num == num) {
747 e1line_dump_vty(vty, line);
748 return CMD_SUCCESS;
749 }
750 }
751 return CMD_WARNING;
752 }
753
754 llist_for_each_entry(line, &e1inp_line_list, list)
755 e1line_dump_vty(vty, line);
756
757 return CMD_SUCCESS;
758}
759
760static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
761{
Harald Welte62868882009-08-08 16:12:58 +0200762 if (ts->type == E1INP_TS_TYPE_NONE)
763 return;
Harald Welte59b04682009-06-10 05:40:52 +0800764 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
765 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
766 VTY_NEWLINE);
767}
768
769DEFUN(show_e1ts,
770 show_e1ts_cmd,
771 "show e1_timeslot [line_nr] [ts_nr]",
772 SHOW_STR "Display information about a E1 timeslot\n")
773{
Harald Welte49c79562009-11-17 06:12:16 +0100774 struct e1inp_line *line = NULL;
Harald Welte59b04682009-06-10 05:40:52 +0800775 struct e1inp_ts *ts;
776 int ts_nr;
777
778 if (argc == 0) {
779 llist_for_each_entry(line, &e1inp_line_list, list) {
780 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
781 ts = &line->ts[ts_nr];
782 e1ts_dump_vty(vty, ts);
783 }
784 }
785 return CMD_SUCCESS;
786 }
787 if (argc >= 1) {
788 int num = atoi(argv[0]);
789 llist_for_each_entry(line, &e1inp_line_list, list) {
790 if (line->num == num)
791 break;
792 }
793 if (!line || line->num != num) {
794 vty_out(vty, "E1 line %s is invalid%s",
795 argv[0], VTY_NEWLINE);
796 return CMD_WARNING;
797 }
798 }
799 if (argc >= 2) {
800 ts_nr = atoi(argv[1]);
801 if (ts_nr > NUM_E1_TS) {
802 vty_out(vty, "E1 timeslot %s is invalid%s",
803 argv[1], VTY_NEWLINE);
804 return CMD_WARNING;
805 }
806 ts = &line->ts[ts_nr];
807 e1ts_dump_vty(vty, ts);
808 return CMD_SUCCESS;
809 } else {
810 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
811 ts = &line->ts[ts_nr];
812 e1ts_dump_vty(vty, ts);
813 }
814 return CMD_SUCCESS;
815 }
816 return CMD_SUCCESS;
817}
818
819static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
820{
821 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
822 subscr_dump_vty(vty, pag->subscr);
823}
824
825static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
826{
827 struct gsm_paging_request *pag;
828
829 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
830 paging_dump_vty(vty, pag);
831}
832
833DEFUN(show_paging,
834 show_paging_cmd,
835 "show paging [bts_nr]",
836 SHOW_STR "Display information about paging reuqests of a BTS\n")
837{
838 struct gsm_network *net = gsmnet;
839 struct gsm_bts *bts;
840 int bts_nr;
841
842 if (argc >= 1) {
843 /* use the BTS number that the user has specified */
844 bts_nr = atoi(argv[0]);
845 if (bts_nr >= net->num_bts) {
846 vty_out(vty, "%% can't find BTS %s%s", argv[0],
847 VTY_NEWLINE);
848 return CMD_WARNING;
849 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200850 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800851 bts_paging_dump_vty(vty, bts);
852
853 return CMD_SUCCESS;
854 }
855 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200856 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800857 bts_paging_dump_vty(vty, bts);
858 }
859
860 return CMD_SUCCESS;
861}
862
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +0100863static void _vty_output(struct debug_target *tgt, const char *line)
864{
865 struct vty *vty = tgt->tgt_vty.vty;
866 vty_out(vty, "%s", line);
867 /* This is an ugly hack, but there is no easy way... */
868 if (strchr(line, '\n'))
869 vty_out(vty, "\r");
870}
871
872struct debug_target *debug_target_create_vty(struct vty *vty)
873{
874 struct debug_target *target;
875
876 target = debug_target_create();
877 if (!target)
878 return NULL;
879
880 target->tgt_vty.vty = vty;
881 target->output = _vty_output;
882 return target;
883}
884
885DEFUN(enable_logging,
886 enable_logging_cmd,
887 "logging enable",
888 "Enables logging to this vty\n")
889{
890 struct telnet_connection *conn;
891
892 conn = (struct telnet_connection *) vty->priv;
893 if (conn->dbg) {
894 vty_out(vty, "Logging already enabled.%s", VTY_NEWLINE);
895 return CMD_WARNING;
896 }
897
898 conn->dbg = debug_target_create_vty(vty);
899 if (!conn->dbg)
900 return CMD_WARNING;
901
902 debug_add_target(conn->dbg);
903 return CMD_SUCCESS;
904}
905
906DEFUN(logging_fltr_imsi,
907 logging_fltr_imsi_cmd,
908 "logging filter imsi IMSI",
909 "Print all messages related to a IMSI\n")
910{
911 struct telnet_connection *conn;
912
913 conn = (struct telnet_connection *) vty->priv;
914 if (!conn->dbg) {
915 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
916 return CMD_WARNING;
917 }
918
919 debug_set_imsi_filter(conn->dbg, argv[0]);
920 return CMD_SUCCESS;
921}
922
923DEFUN(logging_fltr_all,
924 logging_fltr_all_cmd,
925 "logging filter all <0-1>",
926 "Print all messages to the console\n")
927{
928 struct telnet_connection *conn;
929
930 conn = (struct telnet_connection *) vty->priv;
931 if (!conn->dbg) {
932 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
933 return CMD_WARNING;
934 }
935
936 debug_set_all_filter(conn->dbg, atoi(argv[0]));
937 return CMD_SUCCESS;
938}
939
940DEFUN(logging_use_clr,
941 logging_use_clr_cmd,
Harald Welte (local)0bb88162009-12-26 19:45:22 +0100942 "logging color <0-1>",
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +0100943 "Use color for printing messages\n")
944{
945 struct telnet_connection *conn;
946
947 conn = (struct telnet_connection *) vty->priv;
948 if (!conn->dbg) {
949 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
950 return CMD_WARNING;
951 }
952
953 debug_set_use_color(conn->dbg, atoi(argv[0]));
954 return CMD_SUCCESS;
955}
956
957DEFUN(logging_prnt_timestamp,
958 logging_prnt_timestamp_cmd,
Harald Welte (local)0bb88162009-12-26 19:45:22 +0100959 "logging timestamp <0-1>",
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +0100960 "Print the timestamp of each message\n")
961{
962 struct telnet_connection *conn;
963
964 conn = (struct telnet_connection *) vty->priv;
965 if (!conn->dbg) {
966 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
967 return CMD_WARNING;
968 }
969
970 debug_set_print_timestamp(conn->dbg, atoi(argv[0]));
971 return CMD_SUCCESS;
972}
973
Harald Welte (local)d2a81892009-12-27 21:02:20 +0100974/* FIXME: those have to be kept in sync with the log levels and categories */
Harald Welte (local)0bb88162009-12-26 19:45:22 +0100975#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)d2a81892009-12-27 21:02:20 +0100976#define VTY_DEBUG_LEVELS "(everything|debug|info|notice|error|fatal)"
Harald Welte (local)0bb88162009-12-26 19:45:22 +0100977DEFUN(logging_level,
978 logging_level_cmd,
Harald Welte (local)d2a81892009-12-27 21:02:20 +0100979 "logging level " VTY_DEBUG_CATEGORIES " " VTY_DEBUG_LEVELS,
Harald Welte (local)0bb88162009-12-26 19:45:22 +0100980 "Set the log level for a specified category\n")
981{
982 struct telnet_connection *conn;
983 int category = debug_parse_category(argv[0]);
Harald Welte (local)d2a81892009-12-27 21:02:20 +0100984 int level = debug_parse_level(argv[1]);
Harald Welte (local)0bb88162009-12-26 19:45:22 +0100985
986 conn = (struct telnet_connection *) vty->priv;
987 if (!conn->dbg) {
988 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
989 return CMD_WARNING;
990 }
991
992 if (category < 0) {
993 vty_out(vty, "Invalid category `%s'%s", argv[0], VTY_NEWLINE);
994 return CMD_WARNING;
995 }
996
Harald Welte (local)d2a81892009-12-27 21:02:20 +0100997 if (level < 0) {
998 vty_out(vty, "Invalid level `%s'%s", argv[1], VTY_NEWLINE);
999 return CMD_WARNING;
1000 }
1001
Harald Welte (local)0bb88162009-12-26 19:45:22 +01001002 conn->dbg->categories[category].enabled = 1;
Harald Welte (local)d2a81892009-12-27 21:02:20 +01001003 conn->dbg->categories[category].loglevel = level;
Harald Welte (local)0bb88162009-12-26 19:45:22 +01001004
1005 return CMD_SUCCESS;
1006}
1007
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +01001008DEFUN(logging_set_category_mask,
1009 logging_set_category_mask_cmd,
1010 "logging set debug mask MASK",
1011 "Decide which categories to output.\n")
1012{
1013 struct telnet_connection *conn;
1014
1015 conn = (struct telnet_connection *) vty->priv;
1016 if (!conn->dbg) {
1017 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
1018 return CMD_WARNING;
1019 }
1020
1021 debug_parse_category_mask(conn->dbg, argv[0]);
1022 return CMD_SUCCESS;
1023}
1024
1025DEFUN(logging_set_log_level,
1026 logging_set_log_level_cmd,
1027 "logging set log level <0-8>",
1028 "Set the global log level. The value 0 implies no filtering.\n")
1029{
1030 struct telnet_connection *conn;
1031
1032 conn = (struct telnet_connection *) vty->priv;
1033 if (!conn->dbg) {
1034 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
1035 return CMD_WARNING;
1036 }
1037
1038 debug_set_log_level(conn->dbg, atoi(argv[0]));
1039 return CMD_SUCCESS;
1040}
1041
1042DEFUN(diable_logging,
1043 disable_logging_cmd,
1044 "logging disable",
1045 "Disables logging to this vty\n")
1046{
1047 struct telnet_connection *conn;
1048
1049 conn = (struct telnet_connection *) vty->priv;
1050 if (!conn->dbg) {
1051 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
1052 return CMD_WARNING;
1053 }
1054
1055 debug_del_target(conn->dbg);
1056 talloc_free(conn->dbg);
1057 conn->dbg = NULL;
1058 return CMD_SUCCESS;
1059}
1060
Harald Welte3edc5a92009-12-22 00:41:05 +01001061DEFUN(show_stats,
1062 show_stats_cmd,
1063 "show statistics",
1064 SHOW_STR "Display network statistics\n")
1065{
1066 struct gsm_network *net = gsmnet;
1067
Harald Welte2f404622009-12-22 21:47:48 +01001068 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
Harald Weltebdbb7442009-12-22 19:07:32 +01001069 counter_get(net->stats.chreq.total),
1070 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
Harald Welte2f404622009-12-22 21:47:48 +01001071 vty_out(vty, "Location Update : %lu attach, %lu normal, %lu periodic%s",
Harald Weltebdbb7442009-12-22 19:07:32 +01001072 counter_get(net->stats.loc_upd_type.attach),
1073 counter_get(net->stats.loc_upd_type.normal),
1074 counter_get(net->stats.loc_upd_type.periodic), VTY_NEWLINE);
Harald Welte2f404622009-12-22 21:47:48 +01001075 vty_out(vty, "IMSI Detach Indications : %lu%s",
Harald Weltebdbb7442009-12-22 19:07:32 +01001076 counter_get(net->stats.loc_upd_type.detach), VTY_NEWLINE);
Harald Welte3edc5a92009-12-22 00:41:05 +01001077 vty_out(vty, "Location Update Response: %lu accept, %lu reject%s",
Harald Weltebdbb7442009-12-22 19:07:32 +01001078 counter_get(net->stats.loc_upd_resp.accept),
1079 counter_get(net->stats.loc_upd_resp.reject), VTY_NEWLINE);
Harald Welte2f404622009-12-22 21:47:48 +01001080 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
Harald Weltebdbb7442009-12-22 19:07:32 +01001081 counter_get(net->stats.paging.attempted),
1082 counter_get(net->stats.paging.completed),
1083 counter_get(net->stats.paging.expired), VTY_NEWLINE);
Harald Welte2f404622009-12-22 21:47:48 +01001084 vty_out(vty, "Handover : %lu attempted, %lu no_channel, %lu timeout, "
Harald Weltebdbb7442009-12-22 19:07:32 +01001085 "%lu completed, %lu failed%s",
1086 counter_get(net->stats.handover.attempted),
1087 counter_get(net->stats.handover.no_channel),
1088 counter_get(net->stats.handover.timeout),
1089 counter_get(net->stats.handover.completed),
1090 counter_get(net->stats.handover.failed), VTY_NEWLINE);
Harald Welte2f404622009-12-22 21:47:48 +01001091 vty_out(vty, "SMS MO : %lu submitted, %lu no receiver%s",
Harald Weltebdbb7442009-12-22 19:07:32 +01001092 counter_get(net->stats.sms.submitted),
1093 counter_get(net->stats.sms.no_receiver), VTY_NEWLINE);
Harald Welte2f404622009-12-22 21:47:48 +01001094 vty_out(vty, "SMS MT : %lu delivered, %lu no memory, %lu other error%s",
Harald Weltebdbb7442009-12-22 19:07:32 +01001095 counter_get(net->stats.sms.delivered),
1096 counter_get(net->stats.sms.rp_err_mem),
1097 counter_get(net->stats.sms.rp_err_other), VTY_NEWLINE);
Harald Welte3edc5a92009-12-22 00:41:05 +01001098 return CMD_SUCCESS;
1099}
1100
Harald Weltee87eb462009-08-07 13:29:14 +02001101DEFUN(cfg_net,
1102 cfg_net_cmd,
1103 "network",
1104 "Configure the GSM network")
1105{
1106 vty->index = gsmnet;
1107 vty->node = GSMNET_NODE;
1108
1109 return CMD_SUCCESS;
1110}
1111
1112
1113DEFUN(cfg_net_ncc,
1114 cfg_net_ncc_cmd,
1115 "network country code <1-999>",
1116 "Set the GSM network country code")
1117{
1118 gsmnet->country_code = atoi(argv[0]);
1119
1120 return CMD_SUCCESS;
1121}
1122
1123DEFUN(cfg_net_mnc,
1124 cfg_net_mnc_cmd,
1125 "mobile network code <1-999>",
1126 "Set the GSM mobile network code")
1127{
1128 gsmnet->network_code = atoi(argv[0]);
1129
1130 return CMD_SUCCESS;
1131}
1132
1133DEFUN(cfg_net_name_short,
1134 cfg_net_name_short_cmd,
1135 "short name NAME",
1136 "Set the short GSM network name")
1137{
1138 if (gsmnet->name_short)
1139 talloc_free(gsmnet->name_short);
1140
1141 gsmnet->name_short = talloc_strdup(gsmnet, argv[0]);
1142
1143 return CMD_SUCCESS;
1144}
1145
1146DEFUN(cfg_net_name_long,
1147 cfg_net_name_long_cmd,
1148 "long name NAME",
1149 "Set the long GSM network name")
1150{
1151 if (gsmnet->name_long)
1152 talloc_free(gsmnet->name_long);
1153
1154 gsmnet->name_long = talloc_strdup(gsmnet, argv[0]);
1155
1156 return CMD_SUCCESS;
1157}
Harald Welte59b04682009-06-10 05:40:52 +08001158
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02001159DEFUN(cfg_net_auth_policy,
1160 cfg_net_auth_policy_cmd,
1161 "auth policy (closed|accept-all|token)",
1162 "Set the GSM network authentication policy\n")
1163{
1164 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
1165
1166 gsmnet->auth_policy = policy;
1167
1168 return CMD_SUCCESS;
1169}
1170
Harald Welte59936d72009-11-18 20:33:19 +01001171DEFUN(cfg_net_reject_cause,
1172 cfg_net_reject_cause_cmd,
1173 "location updating reject cause <2-111>",
1174 "Set the reject cause of location updating reject\n")
1175{
1176 gsmnet->reject_cause = atoi(argv[0]);
1177
1178 return CMD_SUCCESS;
1179}
1180
Harald Weltecca253a2009-08-30 15:47:06 +09001181DEFUN(cfg_net_encryption,
1182 cfg_net_encryption_cmd,
1183 "encryption a5 (0|1|2)",
1184 "Enable or disable encryption (A5) for this network\n")
1185{
Andreas.Eversberg53293292009-11-17 09:55:26 +01001186 gsmnet->a5_encryption= atoi(argv[0]);
Harald Weltecca253a2009-08-30 15:47:06 +09001187
1188 return CMD_SUCCESS;
1189}
1190
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001191DEFUN(cfg_net_neci,
1192 cfg_net_neci_cmd,
1193 "neci (0|1)",
1194 "Set if NECI of cell selection is to be set")
1195{
1196 gsmnet->neci = atoi(argv[0]);
1197 return CMD_SUCCESS;
1198}
1199
Harald Welte52af1952009-12-13 10:53:12 +01001200DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1201 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
1202 "Set the Radio Resource Location Protocol Mode")
1203{
1204 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1205
1206 return CMD_SUCCESS;
1207}
1208
Harald Weltea310f3e2009-12-14 09:00:24 +01001209DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1210 "mm info (0|1)",
1211 "Whether to send MM INFO after LOC UPD ACCEPT")
1212{
1213 gsmnet->send_mm_info = atoi(argv[0]);
1214
1215 return CMD_SUCCESS;
1216}
1217
Harald Welte0af9c9f2009-12-19 21:41:52 +01001218DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1219 "handover (0|1)",
1220 "Whether or not to use in-call handover")
1221{
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001222 int enable = atoi(argv[0]);
1223
1224 if (enable && ipacc_rtp_direct) {
Harald Welteaa2c3032009-12-20 13:51:01 +01001225 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1226 "is enabled by using the -P command line option%s",
1227 VTY_NEWLINE);
1228 return CMD_WARNING;
1229 }
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001230 gsmnet->handover.active = enable;
Harald Welte0af9c9f2009-12-19 21:41:52 +01001231
1232 return CMD_SUCCESS;
1233}
1234
Harald Weltea8062f12009-12-21 16:51:50 +01001235DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1236 "handover window rxlev averaging <1-10>",
1237 "How many RxLev measurements are used for averaging")
1238{
1239 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1240 return CMD_SUCCESS;
1241}
1242
1243DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1244 "handover window rxqual averaging <1-10>",
1245 "How many RxQual measurements are used for averaging")
1246{
1247 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1248 return CMD_SUCCESS;
1249}
1250
1251DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1252 "handover window rxlev neighbor averaging <1-10>",
1253 "How many RxQual measurements are used for averaging")
1254{
1255 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1256 return CMD_SUCCESS;
1257}
1258
1259DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1260 "handover power budget interval <1-99>",
1261 "How often to check if we have a better cell (SACCH frames)")
1262{
1263 gsmnet->handover.pwr_interval = atoi(argv[0]);
1264 return CMD_SUCCESS;
1265}
1266
1267DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1268 "handover power budget hysteresis <0-999>",
1269 "How many dB does a neighbor to be stronger to become a HO candidate")
1270{
1271 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1272 return CMD_SUCCESS;
1273}
1274
1275DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1276 "handover maximum distance <0-9999>",
1277 "How big is the maximum timing advance before HO is forced")
1278{
1279 gsmnet->handover.max_distance = atoi(argv[0]);
1280 return CMD_SUCCESS;
1281}
Harald Welte0af9c9f2009-12-19 21:41:52 +01001282
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001283#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001284 DEFUN(cfg_net_T##number, \
1285 cfg_net_T##number##_cmd, \
1286 "timer t" #number " <0-65535>", \
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001287 doc) \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001288{ \
1289 int value = atoi(argv[0]); \
1290 \
1291 if (value < 0 || value > 65535) { \
1292 vty_out(vty, "Timer value %s out of range.%s", \
1293 argv[0], VTY_NEWLINE); \
1294 return CMD_WARNING; \
1295 } \
1296 \
1297 gsmnet->T##number = value; \
1298 return CMD_SUCCESS; \
1299}
1300
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001301DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1302DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1303DECLARE_TIMER(3105, "Currently not used.")
1304DECLARE_TIMER(3107, "Currently not used.")
1305DECLARE_TIMER(3109, "Currently not used.")
1306DECLARE_TIMER(3111, "Currently not used.")
1307DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1308DECLARE_TIMER(3115, "Currently not used.")
1309DECLARE_TIMER(3117, "Currently not used.")
1310DECLARE_TIMER(3119, "Currently not used.")
1311DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001312
1313
Harald Welte59b04682009-06-10 05:40:52 +08001314/* per-BTS configuration */
1315DEFUN(cfg_bts,
1316 cfg_bts_cmd,
1317 "bts BTS_NR",
1318 "Select a BTS to configure\n")
1319{
1320 int bts_nr = atoi(argv[0]);
1321 struct gsm_bts *bts;
1322
Harald Weltee712a5f2009-06-21 16:17:15 +02001323 if (bts_nr > gsmnet->num_bts) {
1324 vty_out(vty, "%% The next unused BTS number is %u%s",
1325 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +08001326 return CMD_WARNING;
Harald Weltee712a5f2009-06-21 16:17:15 +02001327 } else if (bts_nr == gsmnet->num_bts) {
1328 /* allocate a new one */
1329 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1330 HARDCODED_TSC, HARDCODED_BSIC);
1331 } else
1332 bts = gsm_bts_num(gsmnet, bts_nr);
1333
Daniel Willmann580085f2010-01-11 13:43:07 +01001334 if (!bts) {
1335 vty_out(vty, "%% Unable to allocate BTS %u%s",
1336 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee712a5f2009-06-21 16:17:15 +02001337 return CMD_WARNING;
Daniel Willmann580085f2010-01-11 13:43:07 +01001338 }
Harald Welte59b04682009-06-10 05:40:52 +08001339
1340 vty->index = bts;
1341 vty->node = BTS_NODE;
1342
1343 return CMD_SUCCESS;
1344}
1345
1346DEFUN(cfg_bts_type,
1347 cfg_bts_type_cmd,
1348 "type TYPE",
1349 "Set the BTS type\n")
1350{
1351 struct gsm_bts *bts = vty->index;
Harald Welte59698fb2010-01-10 18:01:52 +01001352 int rc;
Harald Welte59b04682009-06-10 05:40:52 +08001353
Harald Welte59698fb2010-01-10 18:01:52 +01001354 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1355 if (rc < 0)
1356 return CMD_WARNING;
Harald Welte25572872009-10-20 00:22:00 +02001357
Harald Welte59b04682009-06-10 05:40:52 +08001358 return CMD_SUCCESS;
1359}
1360
Harald Welte91afe4c2009-06-20 18:15:19 +02001361DEFUN(cfg_bts_band,
1362 cfg_bts_band_cmd,
1363 "band BAND",
1364 "Set the frequency band of this BTS\n")
1365{
1366 struct gsm_bts *bts = vty->index;
Harald Welte62868882009-08-08 16:12:58 +02001367 int band = gsm_band_parse(argv[0]);
Harald Welte91afe4c2009-06-20 18:15:19 +02001368
1369 if (band < 0) {
1370 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1371 band, VTY_NEWLINE);
1372 return CMD_WARNING;
1373 }
1374
1375 bts->band = band;
1376
1377 return CMD_SUCCESS;
1378}
1379
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +02001380DEFUN(cfg_bts_ci,
1381 cfg_bts_ci_cmd,
1382 "cell_identity <0-65535>",
1383 "Set the Cell identity of this BTS\n")
1384{
1385 struct gsm_bts *bts = vty->index;
1386 int ci = atoi(argv[0]);
1387
1388 if (ci < 0 || ci > 0xffff) {
1389 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1390 ci, VTY_NEWLINE);
1391 return CMD_WARNING;
1392 }
1393 bts->cell_identity = ci;
1394
1395 return CMD_SUCCESS;
1396}
1397
Harald Welte59b04682009-06-10 05:40:52 +08001398DEFUN(cfg_bts_lac,
1399 cfg_bts_lac_cmd,
Holger Hans Peter Freyther54a22832009-09-29 14:02:33 +02001400 "location_area_code <0-65535>",
Harald Welte59b04682009-06-10 05:40:52 +08001401 "Set the Location Area Code (LAC) of this BTS\n")
1402{
1403 struct gsm_bts *bts = vty->index;
1404 int lac = atoi(argv[0]);
1405
Holger Hans Peter Freyther54a22832009-09-29 14:02:33 +02001406 if (lac < 0 || lac > 0xffff) {
1407 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte59b04682009-06-10 05:40:52 +08001408 lac, VTY_NEWLINE);
1409 return CMD_WARNING;
1410 }
Holger Hans Peter Freyther6c6ab862009-10-01 04:07:15 +02001411
1412 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1413 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1414 lac, VTY_NEWLINE);
1415 return CMD_WARNING;
1416 }
1417
Harald Welte59b04682009-06-10 05:40:52 +08001418 bts->location_area_code = lac;
1419
1420 return CMD_SUCCESS;
1421}
1422
Harald Weltea54a2bb2009-12-01 18:04:30 +05301423
Harald Welte59b04682009-06-10 05:40:52 +08001424DEFUN(cfg_bts_tsc,
1425 cfg_bts_tsc_cmd,
1426 "training_sequence_code <0-255>",
1427 "Set the Training Sequence Code (TSC) of this BTS\n")
1428{
1429 struct gsm_bts *bts = vty->index;
1430 int tsc = atoi(argv[0]);
1431
1432 if (tsc < 0 || tsc > 0xff) {
1433 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1434 tsc, VTY_NEWLINE);
1435 return CMD_WARNING;
1436 }
1437 bts->tsc = tsc;
1438
1439 return CMD_SUCCESS;
1440}
1441
1442DEFUN(cfg_bts_bsic,
1443 cfg_bts_bsic_cmd,
1444 "base_station_id_code <0-63>",
1445 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1446{
1447 struct gsm_bts *bts = vty->index;
1448 int bsic = atoi(argv[0]);
1449
1450 if (bsic < 0 || bsic > 0x3f) {
Harald Welte62868882009-08-08 16:12:58 +02001451 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte59b04682009-06-10 05:40:52 +08001452 bsic, VTY_NEWLINE);
1453 return CMD_WARNING;
1454 }
1455 bts->bsic = bsic;
1456
1457 return CMD_SUCCESS;
1458}
1459
1460
1461DEFUN(cfg_bts_unit_id,
1462 cfg_bts_unit_id_cmd,
Harald Weltef515aa02009-08-07 13:27:09 +02001463 "ip.access unit_id <0-65534> <0-255>",
1464 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte59b04682009-06-10 05:40:52 +08001465{
1466 struct gsm_bts *bts = vty->index;
1467 int site_id = atoi(argv[0]);
1468 int bts_id = atoi(argv[1]);
1469
Harald Weltef515aa02009-08-07 13:27:09 +02001470 if (!is_ipaccess_bts(bts)) {
1471 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1472 return CMD_WARNING;
1473 }
1474
Harald Welte59b04682009-06-10 05:40:52 +08001475 bts->ip_access.site_id = site_id;
1476 bts->ip_access.bts_id = bts_id;
1477
1478 return CMD_SUCCESS;
1479}
1480
Harald Welte25572872009-10-20 00:22:00 +02001481DEFUN(cfg_bts_stream_id,
1482 cfg_bts_stream_id_cmd,
1483 "oml ip.access stream_id <0-255>",
1484 "Set the ip.access Stream ID of the OML link of this BTS\n")
1485{
1486 struct gsm_bts *bts = vty->index;
1487 int stream_id = atoi(argv[0]);
1488
1489 if (!is_ipaccess_bts(bts)) {
1490 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1491 return CMD_WARNING;
1492 }
1493
1494 bts->oml_tei = stream_id;
1495
1496 return CMD_SUCCESS;
1497}
1498
1499
Harald Welte62868882009-08-08 16:12:58 +02001500DEFUN(cfg_bts_oml_e1,
1501 cfg_bts_oml_e1_cmd,
1502 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
1503 "E1 interface to be used for OML\n")
1504{
1505 struct gsm_bts *bts = vty->index;
1506
1507 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1508
1509 return CMD_SUCCESS;
1510}
1511
1512
1513DEFUN(cfg_bts_oml_e1_tei,
1514 cfg_bts_oml_e1_tei_cmd,
1515 "oml e1 tei <0-63>",
1516 "Set the TEI to be used for OML")
1517{
1518 struct gsm_bts *bts = vty->index;
1519
1520 bts->oml_tei = atoi(argv[0]);
1521
1522 return CMD_SUCCESS;
1523}
1524
Harald Welte3e774612009-08-10 13:48:16 +02001525DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1526 "channel allocator (ascending|descending)",
1527 "Should the channel allocator allocate in reverse TRX order?")
1528{
1529 struct gsm_bts *bts = vty->index;
1530
1531 if (!strcmp(argv[0], "ascending"))
1532 bts->chan_alloc_reverse = 0;
1533 else
1534 bts->chan_alloc_reverse = 1;
1535
1536 return CMD_SUCCESS;
1537}
1538
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001539DEFUN(cfg_bts_rach_tx_integer,
1540 cfg_bts_rach_tx_integer_cmd,
1541 "rach tx integer <0-15>",
1542 "Set the raw tx integer value in RACH Control parameters IE")
1543{
1544 struct gsm_bts *bts = vty->index;
1545 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1546 return CMD_SUCCESS;
1547}
1548
1549DEFUN(cfg_bts_rach_max_trans,
1550 cfg_bts_rach_max_trans_cmd,
1551 "rach max transmission (1|2|4|7)",
1552 "Set the maximum number of RACH burst transmissions")
1553{
1554 struct gsm_bts *bts = vty->index;
1555 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1556 return CMD_SUCCESS;
1557}
1558
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02001559DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1560 "cell barred (0|1)",
1561 "Should this cell be barred from access?")
1562{
1563 struct gsm_bts *bts = vty->index;
1564
Harald Welte8c973ba2009-12-21 23:08:18 +01001565 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02001566
1567 return CMD_SUCCESS;
1568}
1569
Harald Welte (local)cbd46102009-08-13 10:14:26 +02001570DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1571 "ms max power <0-40>",
1572 "Maximum transmit power of the MS")
1573{
1574 struct gsm_bts *bts = vty->index;
1575
1576 bts->ms_max_power = atoi(argv[0]);
1577
1578 return CMD_SUCCESS;
1579}
1580
Harald Welteb761bf82009-12-12 18:17:25 +01001581DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1582 "cell reselection hysteresis <0-14>",
1583 "Cell Re-Selection Hysteresis in dB")
1584{
1585 struct gsm_bts *bts = vty->index;
1586
1587 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1588
1589 return CMD_SUCCESS;
1590}
1591
1592DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1593 "rxlev access min <0-63>",
1594 "Minimum RxLev needed for cell access (better than -110dBm)")
1595{
1596 struct gsm_bts *bts = vty->index;
1597
1598 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1599
1600 return CMD_SUCCESS;
1601}
1602
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02001603DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1604 "periodic location update <0-1530>",
1605 "Periodic Location Updating Interval in Minutes")
1606{
1607 struct gsm_bts *bts = vty->index;
1608
Harald Weltea54a2bb2009-12-01 18:04:30 +05301609 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 10;
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02001610
1611 return CMD_SUCCESS;
1612}
1613
Harald Welte3055e332010-03-14 15:37:43 +08001614DEFUN(cfg_bts_gprs_bvci, cfg_bts_gprs_bvci_cmd,
1615 "gprs cell bvci <0-65535>",
1616 "GPRS BSSGP VC Identifier")
1617{
1618 struct gsm_bts *bts = vty->index;
1619
1620 bts->gprs.cell.bvci = atoi(argv[0]);
1621
1622 return CMD_SUCCESS;
1623}
1624
1625DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
1626 "gprs nsvc <0-1> nsvci <0-65535>",
1627 "GPRS NS VC Identifier")
1628{
1629 struct gsm_bts *bts = vty->index;
1630 int idx = atoi(argv[0]);
1631
1632 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
1633
1634 return CMD_SUCCESS;
1635}
1636
1637DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
1638 "gprs routing area <0-255>",
1639 "GPRS Routing Area Code")
1640{
1641 struct gsm_bts *bts = vty->index;
1642
1643 bts->gprs.rac = atoi(argv[0]);
1644
1645 return CMD_SUCCESS;
1646}
1647
Harald Welte3e774612009-08-10 13:48:16 +02001648
Harald Welte59b04682009-06-10 05:40:52 +08001649/* per TRX configuration */
1650DEFUN(cfg_trx,
1651 cfg_trx_cmd,
1652 "trx TRX_NR",
1653 "Select a TRX to configure")
1654{
1655 int trx_nr = atoi(argv[0]);
1656 struct gsm_bts *bts = vty->index;
1657 struct gsm_bts_trx *trx;
1658
Harald Weltee712a5f2009-06-21 16:17:15 +02001659 if (trx_nr > bts->num_trx) {
1660 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
1661 bts->num_trx, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +08001662 return CMD_WARNING;
Harald Weltee712a5f2009-06-21 16:17:15 +02001663 } else if (trx_nr == bts->num_trx) {
1664 /* we need to allocate a new one */
1665 trx = gsm_bts_trx_alloc(bts);
1666 } else
1667 trx = gsm_bts_trx_num(bts, trx_nr);
1668
1669 if (!trx)
1670 return CMD_WARNING;
Harald Welte59b04682009-06-10 05:40:52 +08001671
1672 vty->index = trx;
1673 vty->node = TRX_NODE;
1674
1675 return CMD_SUCCESS;
1676}
1677
1678DEFUN(cfg_trx_arfcn,
1679 cfg_trx_arfcn_cmd,
1680 "arfcn <1-1024>",
1681 "Set the ARFCN for this TRX\n")
1682{
1683 int arfcn = atoi(argv[0]);
1684 struct gsm_bts_trx *trx = vty->index;
1685
1686 /* FIXME: check if this ARFCN is supported by this TRX */
1687
1688 trx->arfcn = arfcn;
1689
1690 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
1691 /* FIXME: use OML layer to update the ARFCN */
1692 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
1693
1694 return CMD_SUCCESS;
1695}
1696
Harald Welte (local)b709bfe2009-12-27 20:56:38 +01001697DEFUN(cfg_trx_nominal_power,
1698 cfg_trx_nominal_power_cmd,
1699 "nominal power <0-100>",
1700 "Nominal TRX RF Power in dB\n")
1701{
1702 struct gsm_bts_trx *trx = vty->index;
1703
1704 trx->nominal_power = atoi(argv[0]);
1705
1706 return CMD_SUCCESS;
1707}
1708
Harald Welte91afe4c2009-06-20 18:15:19 +02001709DEFUN(cfg_trx_max_power_red,
1710 cfg_trx_max_power_red_cmd,
1711 "max_power_red <0-100>",
1712 "Reduction of maximum BS RF Power in dB\n")
1713{
1714 int maxpwr_r = atoi(argv[0]);
1715 struct gsm_bts_trx *trx = vty->index;
Harald Welte01acd742009-11-18 09:20:22 +01001716 int upper_limit = 24; /* default 12.21 max power red. */
Harald Welte91afe4c2009-06-20 18:15:19 +02001717
1718 /* FIXME: check if our BTS type supports more than 12 */
1719 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
1720 vty_out(vty, "%% Power %d dB is not in the valid range%s",
1721 maxpwr_r, VTY_NEWLINE);
1722 return CMD_WARNING;
1723 }
1724 if (maxpwr_r & 1) {
1725 vty_out(vty, "%% Power %d dB is not an even value%s",
1726 maxpwr_r, VTY_NEWLINE);
1727 return CMD_WARNING;
1728 }
1729
1730 trx->max_power_red = maxpwr_r;
1731
1732 /* FIXME: make sure we update this using OML */
1733
1734 return CMD_SUCCESS;
1735}
1736
Harald Welte62868882009-08-08 16:12:58 +02001737DEFUN(cfg_trx_rsl_e1,
1738 cfg_trx_rsl_e1_cmd,
1739 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
1740 "E1 interface to be used for RSL\n")
1741{
1742 struct gsm_bts_trx *trx = vty->index;
1743
1744 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
1745
1746 return CMD_SUCCESS;
1747}
1748
1749DEFUN(cfg_trx_rsl_e1_tei,
1750 cfg_trx_rsl_e1_tei_cmd,
1751 "rsl e1 tei <0-63>",
1752 "Set the TEI to be used for RSL")
1753{
1754 struct gsm_bts_trx *trx = vty->index;
1755
1756 trx->rsl_tei = atoi(argv[0]);
1757
1758 return CMD_SUCCESS;
1759}
1760
Holger Hans Peter Freyther1c8b4802009-11-11 11:54:24 +01001761DEFUN(cfg_trx_rf_locked,
1762 cfg_trx_rf_locked_cmd,
1763 "rf_locked (0|1)",
1764 "Turn off RF of the TRX.\n")
1765{
1766 int locked = atoi(argv[0]);
1767 struct gsm_bts_trx *trx = vty->index;
1768
1769 gsm_trx_lock_rf(trx, locked);
1770 return CMD_SUCCESS;
1771}
Harald Welte62868882009-08-08 16:12:58 +02001772
Harald Welte59b04682009-06-10 05:40:52 +08001773/* per TS configuration */
1774DEFUN(cfg_ts,
1775 cfg_ts_cmd,
Harald Welte62868882009-08-08 16:12:58 +02001776 "timeslot <0-7>",
Harald Welte59b04682009-06-10 05:40:52 +08001777 "Select a Timeslot to configure")
1778{
1779 int ts_nr = atoi(argv[0]);
1780 struct gsm_bts_trx *trx = vty->index;
1781 struct gsm_bts_trx_ts *ts;
1782
1783 if (ts_nr >= TRX_NR_TS) {
1784 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
1785 TRX_NR_TS, VTY_NEWLINE);
1786 return CMD_WARNING;
1787 }
1788
1789 ts = &trx->ts[ts_nr];
1790
1791 vty->index = ts;
1792 vty->node = TS_NODE;
1793
1794 return CMD_SUCCESS;
1795}
1796
Harald Welte3ffe1b32009-08-07 00:25:23 +02001797DEFUN(cfg_ts_pchan,
1798 cfg_ts_pchan_cmd,
1799 "phys_chan_config PCHAN",
1800 "Physical Channel configuration (TCH/SDCCH/...)")
1801{
1802 struct gsm_bts_trx_ts *ts = vty->index;
1803 int pchanc;
1804
1805 pchanc = gsm_pchan_parse(argv[0]);
1806 if (pchanc < 0)
1807 return CMD_WARNING;
1808
1809 ts->pchan = pchanc;
1810
1811 return CMD_SUCCESS;
1812}
1813
1814DEFUN(cfg_ts_e1_subslot,
1815 cfg_ts_e1_subslot_cmd,
Harald Welte62868882009-08-08 16:12:58 +02001816 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte3ffe1b32009-08-07 00:25:23 +02001817 "E1 sub-slot connected to this on-air timeslot")
1818{
1819 struct gsm_bts_trx_ts *ts = vty->index;
1820
Harald Welte62868882009-08-08 16:12:58 +02001821 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Welte3ffe1b32009-08-07 00:25:23 +02001822
1823 return CMD_SUCCESS;
1824}
Harald Welte59b04682009-06-10 05:40:52 +08001825
Harald Welte59b04682009-06-10 05:40:52 +08001826int bsc_vty_init(struct gsm_network *net)
1827{
1828 gsmnet = net;
1829
1830 cmd_init(1);
1831 vty_init();
1832
1833 install_element(VIEW_NODE, &show_net_cmd);
1834 install_element(VIEW_NODE, &show_bts_cmd);
1835 install_element(VIEW_NODE, &show_trx_cmd);
1836 install_element(VIEW_NODE, &show_ts_cmd);
1837 install_element(VIEW_NODE, &show_lchan_cmd);
1838
1839 install_element(VIEW_NODE, &show_e1drv_cmd);
1840 install_element(VIEW_NODE, &show_e1line_cmd);
1841 install_element(VIEW_NODE, &show_e1ts_cmd);
1842
1843 install_element(VIEW_NODE, &show_paging_cmd);
Harald Welte3edc5a92009-12-22 00:41:05 +01001844 install_element(VIEW_NODE, &show_stats_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08001845
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +01001846 install_element(VIEW_NODE, &enable_logging_cmd);
1847 install_element(VIEW_NODE, &disable_logging_cmd);
1848 install_element(VIEW_NODE, &logging_fltr_imsi_cmd);
1849 install_element(VIEW_NODE, &logging_fltr_all_cmd);
1850 install_element(VIEW_NODE, &logging_use_clr_cmd);
1851 install_element(VIEW_NODE, &logging_prnt_timestamp_cmd);
1852 install_element(VIEW_NODE, &logging_set_category_mask_cmd);
Harald Welte (local)0bb88162009-12-26 19:45:22 +01001853 install_element(VIEW_NODE, &logging_level_cmd);
Sylvain Munautd1800752009-12-24 16:48:33 +01001854 install_element(VIEW_NODE, &logging_set_log_level_cmd);
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +01001855
Harald Weltee87eb462009-08-07 13:29:14 +02001856 install_element(CONFIG_NODE, &cfg_net_cmd);
1857 install_node(&net_node, config_write_net);
1858 install_default(GSMNET_NODE);
Harald Welte62868882009-08-08 16:12:58 +02001859 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Weltee87eb462009-08-07 13:29:14 +02001860 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
1861 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
1862 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02001863 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte59936d72009-11-18 20:33:19 +01001864 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Weltecca253a2009-08-30 15:47:06 +09001865 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001866 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welte52af1952009-12-13 10:53:12 +01001867 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte284ddba2009-12-14 17:49:15 +01001868 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Welte0af9c9f2009-12-19 21:41:52 +01001869 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Weltea8062f12009-12-21 16:51:50 +01001870 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
1871 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
1872 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
1873 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
1874 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
1875 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001876 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +01001877 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
1878 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
1879 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
1880 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
1881 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
1882 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
1883 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
1884 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
1885 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
1886 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Harald Weltee87eb462009-08-07 13:29:14 +02001887
1888 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte97ceef92009-08-06 19:06:46 +02001889 install_node(&bts_node, config_write_bts);
Harald Welte59b04682009-06-10 05:40:52 +08001890 install_default(BTS_NODE);
1891 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte91afe4c2009-06-20 18:15:19 +02001892 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +02001893 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08001894 install_element(BTS_NODE, &cfg_bts_lac_cmd);
1895 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte62868882009-08-08 16:12:58 +02001896 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08001897 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte25572872009-10-20 00:22:00 +02001898 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte62868882009-08-08 16:12:58 +02001899 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
1900 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte3e774612009-08-10 13:48:16 +02001901 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001902 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
1903 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02001904 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Harald Welte (local)cbd46102009-08-13 10:14:26 +02001905 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02001906 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welteb761bf82009-12-12 18:17:25 +01001907 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
1908 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Harald Welte3055e332010-03-14 15:37:43 +08001909 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
1910 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
1911 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08001912
1913 install_element(BTS_NODE, &cfg_trx_cmd);
1914 install_node(&trx_node, dummy_config_write);
1915 install_default(TRX_NODE);
1916 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte (local)b709bfe2009-12-27 20:56:38 +01001917 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte7f597bc2009-06-20 22:36:12 +02001918 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte62868882009-08-08 16:12:58 +02001919 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
1920 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther1c8b4802009-11-11 11:54:24 +01001921 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08001922
1923 install_element(TRX_NODE, &cfg_ts_cmd);
1924 install_node(&ts_node, dummy_config_write);
1925 install_default(TS_NODE);
Harald Welte3ffe1b32009-08-07 00:25:23 +02001926 install_element(TS_NODE, &cfg_ts_pchan_cmd);
1927 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08001928
Holger Hans Peter Freytherbdae6f92009-08-10 10:17:50 +02001929 bsc_vty_init_extra(net);
Harald Welte59b04682009-06-10 05:40:52 +08001930
1931 return 0;
1932}