blob: 72a5eae9f49e2134408756b7230201f031f939d5 [file] [log] [blame]
Harald Welte59b04682009-06-10 05:40:52 +08001/* OpenBSC interface to quagga VTY */
Harald Welte410575a2010-03-14 23:30:30 +08002/* (C) 2009-2010 by Harald Welte <laforge@gnumonks.org>
Harald Welte59b04682009-06-10 05:40:52 +08003 * 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 Welte410575a2010-03-14 23:30:30 +0800317 vty_out(vty, " gprs enabled %u%s", bts->gprs.enabled, VTY_NEWLINE);
318 if (bts->gprs.enabled) {
319 vty_out(vty, " gprs routing area %u%s", bts->gprs.rac,
320 VTY_NEWLINE);
321 vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
322 VTY_NEWLINE);
323 for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
324 struct gsm_bts_gprs_nsvc *nsvc =
325 &bts->gprs.nsvc[i];
326 struct in_addr ia;
327
328 ia.s_addr = htonl(nsvc->remote_ip);
329 vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
330 nsvc->nsvci, VTY_NEWLINE);
331 vty_out(vty, " gprs nsvc %u local udp port %u%s", i,
332 nsvc->local_port, VTY_NEWLINE);
333 vty_out(vty, " gprs nsvc %u remote udp port %u%s", i,
334 nsvc->remote_port, VTY_NEWLINE);
335 vty_out(vty, " gprs nsvc %u remote ip %s%s", i,
336 inet_ntoa(ia), VTY_NEWLINE);
337 }
338 }
Harald Welte97ceef92009-08-06 19:06:46 +0200339
340 llist_for_each_entry(trx, &bts->trx_list, list)
341 config_write_trx_single(vty, trx);
342}
343
344static int config_write_bts(struct vty *v)
345{
346 struct gsm_bts *bts;
347
348 llist_for_each_entry(bts, &gsmnet->bts_list, list)
349 config_write_bts_single(v, bts);
350
351 return CMD_SUCCESS;
352}
353
Harald Weltee87eb462009-08-07 13:29:14 +0200354static int config_write_net(struct vty *vty)
355{
356 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200357 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200358 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200359 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
360 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +0200361 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Harald Welte59936d72009-11-18 20:33:19 +0100362 vty_out(vty, " location updating reject cause %u%s",
363 gsmnet->reject_cause, VTY_NEWLINE);
Harald Weltecca253a2009-08-30 15:47:06 +0900364 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freyther6b4f5462009-11-19 16:37:48 +0100365 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Harald Welte52af1952009-12-13 10:53:12 +0100366 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
367 VTY_NEWLINE);
Harald Weltea310f3e2009-12-14 09:00:24 +0100368 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Welte0af9c9f2009-12-19 21:41:52 +0100369 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Weltea8062f12009-12-21 16:51:50 +0100370 vty_out(vty, " handover window rxlev averaging %u%s",
371 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
372 vty_out(vty, " handover window rxqual averaging %u%s",
373 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
374 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
375 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
376 vty_out(vty, " handover power budget interval %u%s",
377 gsmnet->handover.pwr_interval, VTY_NEWLINE);
378 vty_out(vty, " handover power budget hysteresis %u%s",
379 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
380 vty_out(vty, " handover maximum distance %u%s",
381 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +0100382 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +0100383 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
384 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
385 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
386 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
387 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
388 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
389 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
390 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
391 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
392 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200393
394 return CMD_SUCCESS;
395}
Harald Welte97ceef92009-08-06 19:06:46 +0200396
Harald Welte59b04682009-06-10 05:40:52 +0800397static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
398{
399 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
400 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Welte91afe4c2009-06-20 18:15:19 +0200401 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte62868882009-08-08 16:12:58 +0200402 "resulting BS power: %d dBm%s",
Harald Welte91afe4c2009-06-20 18:15:19 +0200403 trx->nominal_power, trx->max_power_red,
Harald Welte62868882009-08-08 16:12:58 +0200404 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800405 vty_out(vty, " NM State: ");
406 net_dump_nmstate(vty, &trx->nm_state);
407 vty_out(vty, " Baseband Transceiver NM State: ");
408 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte25572872009-10-20 00:22:00 +0200409 if (is_ipaccess_bts(trx->bts)) {
410 vty_out(vty, " ip.access stream ID: 0x%02x%s",
411 trx->rsl_tei, VTY_NEWLINE);
412 } else {
413 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
414 e1isl_dump_vty(vty, trx->rsl_link);
415 }
Harald Welte59b04682009-06-10 05:40:52 +0800416}
417
418DEFUN(show_trx,
419 show_trx_cmd,
420 "show trx [bts_nr] [trx_nr]",
421 SHOW_STR "Display information about a TRX\n")
422{
423 struct gsm_network *net = gsmnet;
424 struct gsm_bts *bts = NULL;
425 struct gsm_bts_trx *trx;
426 int bts_nr, trx_nr;
427
428 if (argc >= 1) {
429 /* use the BTS number that the user has specified */
430 bts_nr = atoi(argv[0]);
431 if (bts_nr >= net->num_bts) {
432 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
433 VTY_NEWLINE);
434 return CMD_WARNING;
435 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200436 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800437 }
438 if (argc >= 2) {
439 trx_nr = atoi(argv[1]);
440 if (trx_nr >= bts->num_trx) {
441 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
442 VTY_NEWLINE);
443 return CMD_WARNING;
444 }
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 return CMD_SUCCESS;
448 }
449 if (bts) {
450 /* print all TRX in this BTS */
451 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200452 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800453 trx_dump_vty(vty, trx);
454 }
455 return CMD_SUCCESS;
456 }
457
458 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200459 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800460 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200461 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800462 trx_dump_vty(vty, trx);
463 }
464 }
465
466 return CMD_SUCCESS;
467}
468
Harald Welte97ceef92009-08-06 19:06:46 +0200469
Harald Welte59b04682009-06-10 05:40:52 +0800470static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
471{
Harald Welte59b04682009-06-10 05:40:52 +0800472 vty_out(vty, "Timeslot %u of TRX %u in BTS %u, phys cfg %s%s",
473 ts->nr, ts->trx->nr, ts->trx->bts->nr,
474 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
475 vty_out(vty, " NM State: ");
476 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte87504212009-12-02 01:56:49 +0530477 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welte59b04682009-06-10 05:40:52 +0800478 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
479 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
480 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800481}
482
483DEFUN(show_ts,
484 show_ts_cmd,
485 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
486 SHOW_STR "Display information about a TS\n")
487{
488 struct gsm_network *net = gsmnet;
489 struct gsm_bts *bts;
490 struct gsm_bts_trx *trx;
491 struct gsm_bts_trx_ts *ts;
492 int bts_nr, trx_nr, ts_nr;
493
494 if (argc >= 1) {
495 /* use the BTS number that the user has specified */
496 bts_nr = atoi(argv[0]);
497 if (bts_nr >= net->num_bts) {
498 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
499 VTY_NEWLINE);
500 return CMD_WARNING;
501 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200502 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800503 }
504 if (argc >= 2) {
505 trx_nr = atoi(argv[1]);
506 if (trx_nr >= bts->num_trx) {
507 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
508 VTY_NEWLINE);
509 return CMD_WARNING;
510 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200511 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800512 }
513 if (argc >= 3) {
514 ts_nr = atoi(argv[2]);
515 if (ts_nr >= TRX_NR_TS) {
516 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
517 VTY_NEWLINE);
518 return CMD_WARNING;
519 }
520 ts = &trx->ts[ts_nr];
521 ts_dump_vty(vty, ts);
522 return CMD_SUCCESS;
523 }
524 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200525 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800526 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200527 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800528 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
529 ts = &trx->ts[ts_nr];
530 ts_dump_vty(vty, ts);
531 }
532 }
533 }
534
535 return CMD_SUCCESS;
536}
537
Holger Hans Peter Freyther1dd0a1b2010-01-06 06:00:40 +0100538static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte59b04682009-06-10 05:40:52 +0800539{
Sylvain Munaute5863a22009-12-27 19:29:28 +0100540 int rc;
541 struct gsm_auth_info ainfo;
542 struct gsm_auth_tuple atuple;
543
Harald Welte91afe4c2009-06-20 18:15:19 +0200544 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte59b04682009-06-10 05:40:52 +0800545 subscr->authorized, VTY_NEWLINE);
546 if (subscr->name)
547 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
548 if (subscr->extension)
549 vty_out(vty, " Extension: %s%s", subscr->extension,
550 VTY_NEWLINE);
551 if (subscr->imsi)
552 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freythercd8bacf2009-08-19 12:53:57 +0200553 if (subscr->tmsi != GSM_RESERVED_TMSI)
554 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte270c06c2009-08-15 03:24:51 +0200555 VTY_NEWLINE);
Sylvain Munaute5863a22009-12-27 19:29:28 +0100556
Harald Welte (local)02d5efa2009-08-14 20:27:16 +0200557 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800558}
559
Harald Welte44007742009-12-22 21:43:14 +0100560static void meas_rep_dump_uni_vty(struct vty *vty,
561 struct gsm_meas_rep_unidir *mru,
562 const char *prefix,
563 const char *dir)
564{
565 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
566 prefix, dir, rxlev2dbm(mru->full.rx_lev),
567 dir, rxlev2dbm(mru->sub.rx_lev));
568 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
569 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
570 VTY_NEWLINE);
571}
572
573static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
574 const char *prefix)
575{
576 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
577 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
578 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
579 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
580 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
581 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
582 VTY_NEWLINE);
583 if (mr->flags & MEAS_REP_F_MS_TO)
584 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
585 mr->ms_timing_offset, VTY_NEWLINE);
586 if (mr->flags & MEAS_REP_F_MS_L1)
587 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
588 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
589 if (mr->flags & MEAS_REP_F_DL_VALID)
590 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
591 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
592}
593
Harald Welte59b04682009-06-10 05:40:52 +0800594static void lchan_dump_vty(struct vty *vty, struct gsm_lchan *lchan)
595{
Harald Welte44007742009-12-22 21:43:14 +0100596 int idx;
597
Harald Welte59b04682009-06-10 05:40:52 +0800598 vty_out(vty, "Lchan %u in Timeslot %u of TRX %u in BTS %u, Type %s%s",
599 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
Harald Welte (local)02204d02009-12-27 18:05:25 +0100600 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Harald Welte59b04682009-06-10 05:40:52 +0800601 VTY_NEWLINE);
Harald Welteab2534c2009-12-29 10:52:38 +0100602 vty_out(vty, " Use Count: %u, State: %s%s", lchan->use_count,
603 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100604 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
605 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
606 - lchan->bs_power*2,
607 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
608 VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800609 if (lchan->subscr) {
610 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
611 subscr_dump_vty(vty, lchan->subscr);
612 } else
613 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte87504212009-12-02 01:56:49 +0530614 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
615 struct in_addr ia;
616 ia.s_addr = lchan->abis_ip.bound_ip;
617 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
618 inet_ntoa(ia), lchan->abis_ip.bound_port,
619 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
620 VTY_NEWLINE);
621 }
Harald Welte44007742009-12-22 21:43:14 +0100622
623 /* we want to report the last measurement report */
624 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
625 lchan->meas_rep_idx, 1);
626 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte59b04682009-06-10 05:40:52 +0800627}
628
Harald Welte03740842009-06-10 23:11:52 +0800629#if 0
630TODO: callref and remote callref of call must be resolved to get gsm_trans object
Harald Welte59b04682009-06-10 05:40:52 +0800631static void call_dump_vty(struct vty *vty, struct gsm_call *call)
632{
633 vty_out(vty, "Call Type %u, State %u, Transaction ID %u%s",
634 call->type, call->state, call->transaction_id, VTY_NEWLINE);
635
636 if (call->local_lchan) {
637 vty_out(vty, "Call Local Channel:%s", VTY_NEWLINE);
638 lchan_dump_vty(vty, call->local_lchan);
639 } else
640 vty_out(vty, "Call has no Local Channel%s", VTY_NEWLINE);
641
642 if (call->remote_lchan) {
643 vty_out(vty, "Call Remote Channel:%s", VTY_NEWLINE);
644 lchan_dump_vty(vty, call->remote_lchan);
645 } else
646 vty_out(vty, "Call has no Remote Channel%s", VTY_NEWLINE);
647
648 if (call->called_subscr) {
649 vty_out(vty, "Called Subscriber:%s", VTY_NEWLINE);
650 subscr_dump_vty(vty, call->called_subscr);
651 } else
652 vty_out(vty, "Call has no Called Subscriber%s", VTY_NEWLINE);
653}
Harald Welte03740842009-06-10 23:11:52 +0800654#endif
Harald Welte59b04682009-06-10 05:40:52 +0800655
656DEFUN(show_lchan,
657 show_lchan_cmd,
658 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
659 SHOW_STR "Display information about a logical channel\n")
660{
661 struct gsm_network *net = gsmnet;
662 struct gsm_bts *bts;
663 struct gsm_bts_trx *trx;
664 struct gsm_bts_trx_ts *ts;
665 struct gsm_lchan *lchan;
666 int bts_nr, trx_nr, ts_nr, lchan_nr;
667
668 if (argc >= 1) {
669 /* use the BTS number that the user has specified */
670 bts_nr = atoi(argv[0]);
671 if (bts_nr >= net->num_bts) {
672 vty_out(vty, "%% can't find BTS %s%s", argv[0],
673 VTY_NEWLINE);
674 return CMD_WARNING;
675 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200676 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800677 }
678 if (argc >= 2) {
679 trx_nr = atoi(argv[1]);
680 if (trx_nr >= bts->num_trx) {
681 vty_out(vty, "%% can't find TRX %s%s", argv[1],
682 VTY_NEWLINE);
683 return CMD_WARNING;
684 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200685 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800686 }
687 if (argc >= 3) {
688 ts_nr = atoi(argv[2]);
689 if (ts_nr >= TRX_NR_TS) {
690 vty_out(vty, "%% can't find TS %s%s", argv[2],
691 VTY_NEWLINE);
692 return CMD_WARNING;
693 }
694 ts = &trx->ts[ts_nr];
695 }
696 if (argc >= 4) {
697 lchan_nr = atoi(argv[3]);
698 if (lchan_nr >= TS_MAX_LCHAN) {
699 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
700 VTY_NEWLINE);
701 return CMD_WARNING;
702 }
703 lchan = &ts->lchan[lchan_nr];
704 lchan_dump_vty(vty, lchan);
705 return CMD_SUCCESS;
706 }
707 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200708 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800709 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200710 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800711 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
712 ts = &trx->ts[ts_nr];
713 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
714 lchan_nr++) {
715 lchan = &ts->lchan[lchan_nr];
716 if (lchan->type == GSM_LCHAN_NONE)
717 continue;
718 lchan_dump_vty(vty, lchan);
719 }
720 }
721 }
722 }
723
724 return CMD_SUCCESS;
725}
726
727static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
728{
729 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
730}
731
732DEFUN(show_e1drv,
733 show_e1drv_cmd,
734 "show e1_driver",
735 SHOW_STR "Display information about available E1 drivers\n")
736{
737 struct e1inp_driver *drv;
738
739 llist_for_each_entry(drv, &e1inp_driver_list, list)
740 e1drv_dump_vty(vty, drv);
741
742 return CMD_SUCCESS;
743}
744
745static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
746{
747 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
748 line->num, line->name ? line->name : "",
749 line->driver->name, VTY_NEWLINE);
750}
751
752DEFUN(show_e1line,
753 show_e1line_cmd,
754 "show e1_line [line_nr]",
755 SHOW_STR "Display information about a E1 line\n")
756{
757 struct e1inp_line *line;
758
759 if (argc >= 1) {
760 int num = atoi(argv[0]);
761 llist_for_each_entry(line, &e1inp_line_list, list) {
762 if (line->num == num) {
763 e1line_dump_vty(vty, line);
764 return CMD_SUCCESS;
765 }
766 }
767 return CMD_WARNING;
768 }
769
770 llist_for_each_entry(line, &e1inp_line_list, list)
771 e1line_dump_vty(vty, line);
772
773 return CMD_SUCCESS;
774}
775
776static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
777{
Harald Welte62868882009-08-08 16:12:58 +0200778 if (ts->type == E1INP_TS_TYPE_NONE)
779 return;
Harald Welte59b04682009-06-10 05:40:52 +0800780 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
781 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
782 VTY_NEWLINE);
783}
784
785DEFUN(show_e1ts,
786 show_e1ts_cmd,
787 "show e1_timeslot [line_nr] [ts_nr]",
788 SHOW_STR "Display information about a E1 timeslot\n")
789{
Harald Welte49c79562009-11-17 06:12:16 +0100790 struct e1inp_line *line = NULL;
Harald Welte59b04682009-06-10 05:40:52 +0800791 struct e1inp_ts *ts;
792 int ts_nr;
793
794 if (argc == 0) {
795 llist_for_each_entry(line, &e1inp_line_list, list) {
796 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
797 ts = &line->ts[ts_nr];
798 e1ts_dump_vty(vty, ts);
799 }
800 }
801 return CMD_SUCCESS;
802 }
803 if (argc >= 1) {
804 int num = atoi(argv[0]);
805 llist_for_each_entry(line, &e1inp_line_list, list) {
806 if (line->num == num)
807 break;
808 }
809 if (!line || line->num != num) {
810 vty_out(vty, "E1 line %s is invalid%s",
811 argv[0], VTY_NEWLINE);
812 return CMD_WARNING;
813 }
814 }
815 if (argc >= 2) {
816 ts_nr = atoi(argv[1]);
817 if (ts_nr > NUM_E1_TS) {
818 vty_out(vty, "E1 timeslot %s is invalid%s",
819 argv[1], VTY_NEWLINE);
820 return CMD_WARNING;
821 }
822 ts = &line->ts[ts_nr];
823 e1ts_dump_vty(vty, ts);
824 return CMD_SUCCESS;
825 } else {
826 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
827 ts = &line->ts[ts_nr];
828 e1ts_dump_vty(vty, ts);
829 }
830 return CMD_SUCCESS;
831 }
832 return CMD_SUCCESS;
833}
834
835static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
836{
837 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
838 subscr_dump_vty(vty, pag->subscr);
839}
840
841static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
842{
843 struct gsm_paging_request *pag;
844
845 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
846 paging_dump_vty(vty, pag);
847}
848
849DEFUN(show_paging,
850 show_paging_cmd,
851 "show paging [bts_nr]",
852 SHOW_STR "Display information about paging reuqests of a BTS\n")
853{
854 struct gsm_network *net = gsmnet;
855 struct gsm_bts *bts;
856 int bts_nr;
857
858 if (argc >= 1) {
859 /* use the BTS number that the user has specified */
860 bts_nr = atoi(argv[0]);
861 if (bts_nr >= net->num_bts) {
862 vty_out(vty, "%% can't find BTS %s%s", argv[0],
863 VTY_NEWLINE);
864 return CMD_WARNING;
865 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200866 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800867 bts_paging_dump_vty(vty, bts);
868
869 return CMD_SUCCESS;
870 }
871 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200872 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800873 bts_paging_dump_vty(vty, bts);
874 }
875
876 return CMD_SUCCESS;
877}
878
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +0100879static void _vty_output(struct debug_target *tgt, const char *line)
880{
881 struct vty *vty = tgt->tgt_vty.vty;
882 vty_out(vty, "%s", line);
883 /* This is an ugly hack, but there is no easy way... */
884 if (strchr(line, '\n'))
885 vty_out(vty, "\r");
886}
887
888struct debug_target *debug_target_create_vty(struct vty *vty)
889{
890 struct debug_target *target;
891
892 target = debug_target_create();
893 if (!target)
894 return NULL;
895
896 target->tgt_vty.vty = vty;
897 target->output = _vty_output;
898 return target;
899}
900
901DEFUN(enable_logging,
902 enable_logging_cmd,
903 "logging enable",
904 "Enables logging to this vty\n")
905{
906 struct telnet_connection *conn;
907
908 conn = (struct telnet_connection *) vty->priv;
909 if (conn->dbg) {
910 vty_out(vty, "Logging already enabled.%s", VTY_NEWLINE);
911 return CMD_WARNING;
912 }
913
914 conn->dbg = debug_target_create_vty(vty);
915 if (!conn->dbg)
916 return CMD_WARNING;
917
918 debug_add_target(conn->dbg);
919 return CMD_SUCCESS;
920}
921
922DEFUN(logging_fltr_imsi,
923 logging_fltr_imsi_cmd,
924 "logging filter imsi IMSI",
925 "Print all messages related to a IMSI\n")
926{
927 struct telnet_connection *conn;
928
929 conn = (struct telnet_connection *) vty->priv;
930 if (!conn->dbg) {
931 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
932 return CMD_WARNING;
933 }
934
935 debug_set_imsi_filter(conn->dbg, argv[0]);
936 return CMD_SUCCESS;
937}
938
939DEFUN(logging_fltr_all,
940 logging_fltr_all_cmd,
941 "logging filter all <0-1>",
942 "Print all messages to the console\n")
943{
944 struct telnet_connection *conn;
945
946 conn = (struct telnet_connection *) vty->priv;
947 if (!conn->dbg) {
948 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
949 return CMD_WARNING;
950 }
951
952 debug_set_all_filter(conn->dbg, atoi(argv[0]));
953 return CMD_SUCCESS;
954}
955
956DEFUN(logging_use_clr,
957 logging_use_clr_cmd,
Harald Welte (local)0bb88162009-12-26 19:45:22 +0100958 "logging color <0-1>",
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +0100959 "Use color for printing messages\n")
960{
961 struct telnet_connection *conn;
962
963 conn = (struct telnet_connection *) vty->priv;
964 if (!conn->dbg) {
965 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
966 return CMD_WARNING;
967 }
968
969 debug_set_use_color(conn->dbg, atoi(argv[0]));
970 return CMD_SUCCESS;
971}
972
973DEFUN(logging_prnt_timestamp,
974 logging_prnt_timestamp_cmd,
Harald Welte (local)0bb88162009-12-26 19:45:22 +0100975 "logging timestamp <0-1>",
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +0100976 "Print the timestamp of each message\n")
977{
978 struct telnet_connection *conn;
979
980 conn = (struct telnet_connection *) vty->priv;
981 if (!conn->dbg) {
982 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
983 return CMD_WARNING;
984 }
985
986 debug_set_print_timestamp(conn->dbg, atoi(argv[0]));
987 return CMD_SUCCESS;
988}
989
Harald Welte (local)d2a81892009-12-27 21:02:20 +0100990/* FIXME: those have to be kept in sync with the log levels and categories */
Harald Welte (local)0bb88162009-12-26 19:45:22 +0100991#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 +0100992#define VTY_DEBUG_LEVELS "(everything|debug|info|notice|error|fatal)"
Harald Welte (local)0bb88162009-12-26 19:45:22 +0100993DEFUN(logging_level,
994 logging_level_cmd,
Harald Welte (local)d2a81892009-12-27 21:02:20 +0100995 "logging level " VTY_DEBUG_CATEGORIES " " VTY_DEBUG_LEVELS,
Harald Welte (local)0bb88162009-12-26 19:45:22 +0100996 "Set the log level for a specified category\n")
997{
998 struct telnet_connection *conn;
999 int category = debug_parse_category(argv[0]);
Harald Welte (local)d2a81892009-12-27 21:02:20 +01001000 int level = debug_parse_level(argv[1]);
Harald Welte (local)0bb88162009-12-26 19:45:22 +01001001
1002 conn = (struct telnet_connection *) vty->priv;
1003 if (!conn->dbg) {
1004 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
1005 return CMD_WARNING;
1006 }
1007
1008 if (category < 0) {
1009 vty_out(vty, "Invalid category `%s'%s", argv[0], VTY_NEWLINE);
1010 return CMD_WARNING;
1011 }
1012
Harald Welte (local)d2a81892009-12-27 21:02:20 +01001013 if (level < 0) {
1014 vty_out(vty, "Invalid level `%s'%s", argv[1], VTY_NEWLINE);
1015 return CMD_WARNING;
1016 }
1017
Harald Welte (local)0bb88162009-12-26 19:45:22 +01001018 conn->dbg->categories[category].enabled = 1;
Harald Welte (local)d2a81892009-12-27 21:02:20 +01001019 conn->dbg->categories[category].loglevel = level;
Harald Welte (local)0bb88162009-12-26 19:45:22 +01001020
1021 return CMD_SUCCESS;
1022}
1023
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +01001024DEFUN(logging_set_category_mask,
1025 logging_set_category_mask_cmd,
1026 "logging set debug mask MASK",
1027 "Decide which categories to output.\n")
1028{
1029 struct telnet_connection *conn;
1030
1031 conn = (struct telnet_connection *) vty->priv;
1032 if (!conn->dbg) {
1033 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
1034 return CMD_WARNING;
1035 }
1036
1037 debug_parse_category_mask(conn->dbg, argv[0]);
1038 return CMD_SUCCESS;
1039}
1040
1041DEFUN(logging_set_log_level,
1042 logging_set_log_level_cmd,
1043 "logging set log level <0-8>",
1044 "Set the global log level. The value 0 implies no filtering.\n")
1045{
1046 struct telnet_connection *conn;
1047
1048 conn = (struct telnet_connection *) vty->priv;
1049 if (!conn->dbg) {
1050 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
1051 return CMD_WARNING;
1052 }
1053
1054 debug_set_log_level(conn->dbg, atoi(argv[0]));
1055 return CMD_SUCCESS;
1056}
1057
1058DEFUN(diable_logging,
1059 disable_logging_cmd,
1060 "logging disable",
1061 "Disables logging to this vty\n")
1062{
1063 struct telnet_connection *conn;
1064
1065 conn = (struct telnet_connection *) vty->priv;
1066 if (!conn->dbg) {
1067 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
1068 return CMD_WARNING;
1069 }
1070
1071 debug_del_target(conn->dbg);
1072 talloc_free(conn->dbg);
1073 conn->dbg = NULL;
1074 return CMD_SUCCESS;
1075}
1076
Harald Welte3edc5a92009-12-22 00:41:05 +01001077DEFUN(show_stats,
1078 show_stats_cmd,
1079 "show statistics",
1080 SHOW_STR "Display network statistics\n")
1081{
1082 struct gsm_network *net = gsmnet;
1083
Harald Welte2f404622009-12-22 21:47:48 +01001084 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
Harald Weltebdbb7442009-12-22 19:07:32 +01001085 counter_get(net->stats.chreq.total),
1086 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
Harald Welte2f404622009-12-22 21:47:48 +01001087 vty_out(vty, "Location Update : %lu attach, %lu normal, %lu periodic%s",
Harald Weltebdbb7442009-12-22 19:07:32 +01001088 counter_get(net->stats.loc_upd_type.attach),
1089 counter_get(net->stats.loc_upd_type.normal),
1090 counter_get(net->stats.loc_upd_type.periodic), VTY_NEWLINE);
Harald Welte2f404622009-12-22 21:47:48 +01001091 vty_out(vty, "IMSI Detach Indications : %lu%s",
Harald Weltebdbb7442009-12-22 19:07:32 +01001092 counter_get(net->stats.loc_upd_type.detach), VTY_NEWLINE);
Harald Welte3edc5a92009-12-22 00:41:05 +01001093 vty_out(vty, "Location Update Response: %lu accept, %lu reject%s",
Harald Weltebdbb7442009-12-22 19:07:32 +01001094 counter_get(net->stats.loc_upd_resp.accept),
1095 counter_get(net->stats.loc_upd_resp.reject), VTY_NEWLINE);
Harald Welte2f404622009-12-22 21:47:48 +01001096 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
Harald Weltebdbb7442009-12-22 19:07:32 +01001097 counter_get(net->stats.paging.attempted),
1098 counter_get(net->stats.paging.completed),
1099 counter_get(net->stats.paging.expired), VTY_NEWLINE);
Harald Welte2f404622009-12-22 21:47:48 +01001100 vty_out(vty, "Handover : %lu attempted, %lu no_channel, %lu timeout, "
Harald Weltebdbb7442009-12-22 19:07:32 +01001101 "%lu completed, %lu failed%s",
1102 counter_get(net->stats.handover.attempted),
1103 counter_get(net->stats.handover.no_channel),
1104 counter_get(net->stats.handover.timeout),
1105 counter_get(net->stats.handover.completed),
1106 counter_get(net->stats.handover.failed), VTY_NEWLINE);
Harald Welte2f404622009-12-22 21:47:48 +01001107 vty_out(vty, "SMS MO : %lu submitted, %lu no receiver%s",
Harald Weltebdbb7442009-12-22 19:07:32 +01001108 counter_get(net->stats.sms.submitted),
1109 counter_get(net->stats.sms.no_receiver), VTY_NEWLINE);
Harald Welte2f404622009-12-22 21:47:48 +01001110 vty_out(vty, "SMS MT : %lu delivered, %lu no memory, %lu other error%s",
Harald Weltebdbb7442009-12-22 19:07:32 +01001111 counter_get(net->stats.sms.delivered),
1112 counter_get(net->stats.sms.rp_err_mem),
1113 counter_get(net->stats.sms.rp_err_other), VTY_NEWLINE);
Harald Welte3edc5a92009-12-22 00:41:05 +01001114 return CMD_SUCCESS;
1115}
1116
Harald Weltee87eb462009-08-07 13:29:14 +02001117DEFUN(cfg_net,
1118 cfg_net_cmd,
1119 "network",
1120 "Configure the GSM network")
1121{
1122 vty->index = gsmnet;
1123 vty->node = GSMNET_NODE;
1124
1125 return CMD_SUCCESS;
1126}
1127
1128
1129DEFUN(cfg_net_ncc,
1130 cfg_net_ncc_cmd,
1131 "network country code <1-999>",
1132 "Set the GSM network country code")
1133{
1134 gsmnet->country_code = atoi(argv[0]);
1135
1136 return CMD_SUCCESS;
1137}
1138
1139DEFUN(cfg_net_mnc,
1140 cfg_net_mnc_cmd,
1141 "mobile network code <1-999>",
1142 "Set the GSM mobile network code")
1143{
1144 gsmnet->network_code = atoi(argv[0]);
1145
1146 return CMD_SUCCESS;
1147}
1148
1149DEFUN(cfg_net_name_short,
1150 cfg_net_name_short_cmd,
1151 "short name NAME",
1152 "Set the short GSM network name")
1153{
1154 if (gsmnet->name_short)
1155 talloc_free(gsmnet->name_short);
1156
1157 gsmnet->name_short = talloc_strdup(gsmnet, argv[0]);
1158
1159 return CMD_SUCCESS;
1160}
1161
1162DEFUN(cfg_net_name_long,
1163 cfg_net_name_long_cmd,
1164 "long name NAME",
1165 "Set the long GSM network name")
1166{
1167 if (gsmnet->name_long)
1168 talloc_free(gsmnet->name_long);
1169
1170 gsmnet->name_long = talloc_strdup(gsmnet, argv[0]);
1171
1172 return CMD_SUCCESS;
1173}
Harald Welte59b04682009-06-10 05:40:52 +08001174
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02001175DEFUN(cfg_net_auth_policy,
1176 cfg_net_auth_policy_cmd,
1177 "auth policy (closed|accept-all|token)",
1178 "Set the GSM network authentication policy\n")
1179{
1180 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
1181
1182 gsmnet->auth_policy = policy;
1183
1184 return CMD_SUCCESS;
1185}
1186
Harald Welte59936d72009-11-18 20:33:19 +01001187DEFUN(cfg_net_reject_cause,
1188 cfg_net_reject_cause_cmd,
1189 "location updating reject cause <2-111>",
1190 "Set the reject cause of location updating reject\n")
1191{
1192 gsmnet->reject_cause = atoi(argv[0]);
1193
1194 return CMD_SUCCESS;
1195}
1196
Harald Weltecca253a2009-08-30 15:47:06 +09001197DEFUN(cfg_net_encryption,
1198 cfg_net_encryption_cmd,
1199 "encryption a5 (0|1|2)",
1200 "Enable or disable encryption (A5) for this network\n")
1201{
Andreas.Eversberg53293292009-11-17 09:55:26 +01001202 gsmnet->a5_encryption= atoi(argv[0]);
Harald Weltecca253a2009-08-30 15:47:06 +09001203
1204 return CMD_SUCCESS;
1205}
1206
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001207DEFUN(cfg_net_neci,
1208 cfg_net_neci_cmd,
1209 "neci (0|1)",
1210 "Set if NECI of cell selection is to be set")
1211{
1212 gsmnet->neci = atoi(argv[0]);
1213 return CMD_SUCCESS;
1214}
1215
Harald Welte52af1952009-12-13 10:53:12 +01001216DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1217 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
1218 "Set the Radio Resource Location Protocol Mode")
1219{
1220 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1221
1222 return CMD_SUCCESS;
1223}
1224
Harald Weltea310f3e2009-12-14 09:00:24 +01001225DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1226 "mm info (0|1)",
1227 "Whether to send MM INFO after LOC UPD ACCEPT")
1228{
1229 gsmnet->send_mm_info = atoi(argv[0]);
1230
1231 return CMD_SUCCESS;
1232}
1233
Harald Welte0af9c9f2009-12-19 21:41:52 +01001234DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1235 "handover (0|1)",
1236 "Whether or not to use in-call handover")
1237{
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001238 int enable = atoi(argv[0]);
1239
1240 if (enable && ipacc_rtp_direct) {
Harald Welteaa2c3032009-12-20 13:51:01 +01001241 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1242 "is enabled by using the -P command line option%s",
1243 VTY_NEWLINE);
1244 return CMD_WARNING;
1245 }
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001246 gsmnet->handover.active = enable;
Harald Welte0af9c9f2009-12-19 21:41:52 +01001247
1248 return CMD_SUCCESS;
1249}
1250
Harald Weltea8062f12009-12-21 16:51:50 +01001251DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1252 "handover window rxlev averaging <1-10>",
1253 "How many RxLev measurements are used for averaging")
1254{
1255 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1256 return CMD_SUCCESS;
1257}
1258
1259DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1260 "handover window rxqual averaging <1-10>",
1261 "How many RxQual measurements are used for averaging")
1262{
1263 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1264 return CMD_SUCCESS;
1265}
1266
1267DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1268 "handover window rxlev neighbor averaging <1-10>",
1269 "How many RxQual measurements are used for averaging")
1270{
1271 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1272 return CMD_SUCCESS;
1273}
1274
1275DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1276 "handover power budget interval <1-99>",
1277 "How often to check if we have a better cell (SACCH frames)")
1278{
1279 gsmnet->handover.pwr_interval = atoi(argv[0]);
1280 return CMD_SUCCESS;
1281}
1282
1283DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1284 "handover power budget hysteresis <0-999>",
1285 "How many dB does a neighbor to be stronger to become a HO candidate")
1286{
1287 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1288 return CMD_SUCCESS;
1289}
1290
1291DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1292 "handover maximum distance <0-9999>",
1293 "How big is the maximum timing advance before HO is forced")
1294{
1295 gsmnet->handover.max_distance = atoi(argv[0]);
1296 return CMD_SUCCESS;
1297}
Harald Welte0af9c9f2009-12-19 21:41:52 +01001298
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001299#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001300 DEFUN(cfg_net_T##number, \
1301 cfg_net_T##number##_cmd, \
1302 "timer t" #number " <0-65535>", \
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001303 doc) \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001304{ \
1305 int value = atoi(argv[0]); \
1306 \
1307 if (value < 0 || value > 65535) { \
1308 vty_out(vty, "Timer value %s out of range.%s", \
1309 argv[0], VTY_NEWLINE); \
1310 return CMD_WARNING; \
1311 } \
1312 \
1313 gsmnet->T##number = value; \
1314 return CMD_SUCCESS; \
1315}
1316
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001317DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1318DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1319DECLARE_TIMER(3105, "Currently not used.")
1320DECLARE_TIMER(3107, "Currently not used.")
1321DECLARE_TIMER(3109, "Currently not used.")
1322DECLARE_TIMER(3111, "Currently not used.")
1323DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1324DECLARE_TIMER(3115, "Currently not used.")
1325DECLARE_TIMER(3117, "Currently not used.")
1326DECLARE_TIMER(3119, "Currently not used.")
1327DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001328
1329
Harald Welte59b04682009-06-10 05:40:52 +08001330/* per-BTS configuration */
1331DEFUN(cfg_bts,
1332 cfg_bts_cmd,
1333 "bts BTS_NR",
1334 "Select a BTS to configure\n")
1335{
1336 int bts_nr = atoi(argv[0]);
1337 struct gsm_bts *bts;
1338
Harald Weltee712a5f2009-06-21 16:17:15 +02001339 if (bts_nr > gsmnet->num_bts) {
1340 vty_out(vty, "%% The next unused BTS number is %u%s",
1341 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +08001342 return CMD_WARNING;
Harald Weltee712a5f2009-06-21 16:17:15 +02001343 } else if (bts_nr == gsmnet->num_bts) {
1344 /* allocate a new one */
1345 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1346 HARDCODED_TSC, HARDCODED_BSIC);
1347 } else
1348 bts = gsm_bts_num(gsmnet, bts_nr);
1349
Daniel Willmann580085f2010-01-11 13:43:07 +01001350 if (!bts) {
1351 vty_out(vty, "%% Unable to allocate BTS %u%s",
1352 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee712a5f2009-06-21 16:17:15 +02001353 return CMD_WARNING;
Daniel Willmann580085f2010-01-11 13:43:07 +01001354 }
Harald Welte59b04682009-06-10 05:40:52 +08001355
1356 vty->index = bts;
1357 vty->node = BTS_NODE;
1358
1359 return CMD_SUCCESS;
1360}
1361
1362DEFUN(cfg_bts_type,
1363 cfg_bts_type_cmd,
1364 "type TYPE",
1365 "Set the BTS type\n")
1366{
1367 struct gsm_bts *bts = vty->index;
Harald Welte59698fb2010-01-10 18:01:52 +01001368 int rc;
Harald Welte59b04682009-06-10 05:40:52 +08001369
Harald Welte59698fb2010-01-10 18:01:52 +01001370 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1371 if (rc < 0)
1372 return CMD_WARNING;
Harald Welte25572872009-10-20 00:22:00 +02001373
Harald Welte59b04682009-06-10 05:40:52 +08001374 return CMD_SUCCESS;
1375}
1376
Harald Welte91afe4c2009-06-20 18:15:19 +02001377DEFUN(cfg_bts_band,
1378 cfg_bts_band_cmd,
1379 "band BAND",
1380 "Set the frequency band of this BTS\n")
1381{
1382 struct gsm_bts *bts = vty->index;
Harald Welte62868882009-08-08 16:12:58 +02001383 int band = gsm_band_parse(argv[0]);
Harald Welte91afe4c2009-06-20 18:15:19 +02001384
1385 if (band < 0) {
1386 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1387 band, VTY_NEWLINE);
1388 return CMD_WARNING;
1389 }
1390
1391 bts->band = band;
1392
1393 return CMD_SUCCESS;
1394}
1395
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +02001396DEFUN(cfg_bts_ci,
1397 cfg_bts_ci_cmd,
1398 "cell_identity <0-65535>",
1399 "Set the Cell identity of this BTS\n")
1400{
1401 struct gsm_bts *bts = vty->index;
1402 int ci = atoi(argv[0]);
1403
1404 if (ci < 0 || ci > 0xffff) {
1405 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1406 ci, VTY_NEWLINE);
1407 return CMD_WARNING;
1408 }
1409 bts->cell_identity = ci;
1410
1411 return CMD_SUCCESS;
1412}
1413
Harald Welte59b04682009-06-10 05:40:52 +08001414DEFUN(cfg_bts_lac,
1415 cfg_bts_lac_cmd,
Holger Hans Peter Freyther54a22832009-09-29 14:02:33 +02001416 "location_area_code <0-65535>",
Harald Welte59b04682009-06-10 05:40:52 +08001417 "Set the Location Area Code (LAC) of this BTS\n")
1418{
1419 struct gsm_bts *bts = vty->index;
1420 int lac = atoi(argv[0]);
1421
Holger Hans Peter Freyther54a22832009-09-29 14:02:33 +02001422 if (lac < 0 || lac > 0xffff) {
1423 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte59b04682009-06-10 05:40:52 +08001424 lac, VTY_NEWLINE);
1425 return CMD_WARNING;
1426 }
Holger Hans Peter Freyther6c6ab862009-10-01 04:07:15 +02001427
1428 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1429 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1430 lac, VTY_NEWLINE);
1431 return CMD_WARNING;
1432 }
1433
Harald Welte59b04682009-06-10 05:40:52 +08001434 bts->location_area_code = lac;
1435
1436 return CMD_SUCCESS;
1437}
1438
Harald Weltea54a2bb2009-12-01 18:04:30 +05301439
Harald Welte59b04682009-06-10 05:40:52 +08001440DEFUN(cfg_bts_tsc,
1441 cfg_bts_tsc_cmd,
1442 "training_sequence_code <0-255>",
1443 "Set the Training Sequence Code (TSC) of this BTS\n")
1444{
1445 struct gsm_bts *bts = vty->index;
1446 int tsc = atoi(argv[0]);
1447
1448 if (tsc < 0 || tsc > 0xff) {
1449 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1450 tsc, VTY_NEWLINE);
1451 return CMD_WARNING;
1452 }
1453 bts->tsc = tsc;
1454
1455 return CMD_SUCCESS;
1456}
1457
1458DEFUN(cfg_bts_bsic,
1459 cfg_bts_bsic_cmd,
1460 "base_station_id_code <0-63>",
1461 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1462{
1463 struct gsm_bts *bts = vty->index;
1464 int bsic = atoi(argv[0]);
1465
1466 if (bsic < 0 || bsic > 0x3f) {
Harald Welte62868882009-08-08 16:12:58 +02001467 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte59b04682009-06-10 05:40:52 +08001468 bsic, VTY_NEWLINE);
1469 return CMD_WARNING;
1470 }
1471 bts->bsic = bsic;
1472
1473 return CMD_SUCCESS;
1474}
1475
1476
1477DEFUN(cfg_bts_unit_id,
1478 cfg_bts_unit_id_cmd,
Harald Weltef515aa02009-08-07 13:27:09 +02001479 "ip.access unit_id <0-65534> <0-255>",
1480 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte59b04682009-06-10 05:40:52 +08001481{
1482 struct gsm_bts *bts = vty->index;
1483 int site_id = atoi(argv[0]);
1484 int bts_id = atoi(argv[1]);
1485
Harald Weltef515aa02009-08-07 13:27:09 +02001486 if (!is_ipaccess_bts(bts)) {
1487 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1488 return CMD_WARNING;
1489 }
1490
Harald Welte59b04682009-06-10 05:40:52 +08001491 bts->ip_access.site_id = site_id;
1492 bts->ip_access.bts_id = bts_id;
1493
1494 return CMD_SUCCESS;
1495}
1496
Harald Welte25572872009-10-20 00:22:00 +02001497DEFUN(cfg_bts_stream_id,
1498 cfg_bts_stream_id_cmd,
1499 "oml ip.access stream_id <0-255>",
1500 "Set the ip.access Stream ID of the OML link of this BTS\n")
1501{
1502 struct gsm_bts *bts = vty->index;
1503 int stream_id = atoi(argv[0]);
1504
1505 if (!is_ipaccess_bts(bts)) {
1506 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1507 return CMD_WARNING;
1508 }
1509
1510 bts->oml_tei = stream_id;
1511
1512 return CMD_SUCCESS;
1513}
1514
1515
Harald Welte62868882009-08-08 16:12:58 +02001516DEFUN(cfg_bts_oml_e1,
1517 cfg_bts_oml_e1_cmd,
1518 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
1519 "E1 interface to be used for OML\n")
1520{
1521 struct gsm_bts *bts = vty->index;
1522
1523 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1524
1525 return CMD_SUCCESS;
1526}
1527
1528
1529DEFUN(cfg_bts_oml_e1_tei,
1530 cfg_bts_oml_e1_tei_cmd,
1531 "oml e1 tei <0-63>",
1532 "Set the TEI to be used for OML")
1533{
1534 struct gsm_bts *bts = vty->index;
1535
1536 bts->oml_tei = atoi(argv[0]);
1537
1538 return CMD_SUCCESS;
1539}
1540
Harald Welte3e774612009-08-10 13:48:16 +02001541DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1542 "channel allocator (ascending|descending)",
1543 "Should the channel allocator allocate in reverse TRX order?")
1544{
1545 struct gsm_bts *bts = vty->index;
1546
1547 if (!strcmp(argv[0], "ascending"))
1548 bts->chan_alloc_reverse = 0;
1549 else
1550 bts->chan_alloc_reverse = 1;
1551
1552 return CMD_SUCCESS;
1553}
1554
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001555DEFUN(cfg_bts_rach_tx_integer,
1556 cfg_bts_rach_tx_integer_cmd,
1557 "rach tx integer <0-15>",
1558 "Set the raw tx integer value in RACH Control parameters IE")
1559{
1560 struct gsm_bts *bts = vty->index;
1561 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1562 return CMD_SUCCESS;
1563}
1564
1565DEFUN(cfg_bts_rach_max_trans,
1566 cfg_bts_rach_max_trans_cmd,
1567 "rach max transmission (1|2|4|7)",
1568 "Set the maximum number of RACH burst transmissions")
1569{
1570 struct gsm_bts *bts = vty->index;
1571 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1572 return CMD_SUCCESS;
1573}
1574
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02001575DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1576 "cell barred (0|1)",
1577 "Should this cell be barred from access?")
1578{
1579 struct gsm_bts *bts = vty->index;
1580
Harald Welte8c973ba2009-12-21 23:08:18 +01001581 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02001582
1583 return CMD_SUCCESS;
1584}
1585
Harald Welte (local)cbd46102009-08-13 10:14:26 +02001586DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1587 "ms max power <0-40>",
1588 "Maximum transmit power of the MS")
1589{
1590 struct gsm_bts *bts = vty->index;
1591
1592 bts->ms_max_power = atoi(argv[0]);
1593
1594 return CMD_SUCCESS;
1595}
1596
Harald Welteb761bf82009-12-12 18:17:25 +01001597DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1598 "cell reselection hysteresis <0-14>",
1599 "Cell Re-Selection Hysteresis in dB")
1600{
1601 struct gsm_bts *bts = vty->index;
1602
1603 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1604
1605 return CMD_SUCCESS;
1606}
1607
1608DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1609 "rxlev access min <0-63>",
1610 "Minimum RxLev needed for cell access (better than -110dBm)")
1611{
1612 struct gsm_bts *bts = vty->index;
1613
1614 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1615
1616 return CMD_SUCCESS;
1617}
1618
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02001619DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1620 "periodic location update <0-1530>",
1621 "Periodic Location Updating Interval in Minutes")
1622{
1623 struct gsm_bts *bts = vty->index;
1624
Harald Weltea54a2bb2009-12-01 18:04:30 +05301625 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 10;
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02001626
1627 return CMD_SUCCESS;
1628}
1629
Harald Welte410575a2010-03-14 23:30:30 +08001630DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welte3055e332010-03-14 15:37:43 +08001631 "gprs cell bvci <0-65535>",
1632 "GPRS BSSGP VC Identifier")
1633{
1634 struct gsm_bts *bts = vty->index;
1635
1636 bts->gprs.cell.bvci = atoi(argv[0]);
1637
1638 return CMD_SUCCESS;
1639}
1640
1641DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
1642 "gprs nsvc <0-1> nsvci <0-65535>",
1643 "GPRS NS VC Identifier")
1644{
1645 struct gsm_bts *bts = vty->index;
1646 int idx = atoi(argv[0]);
1647
1648 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
1649
1650 return CMD_SUCCESS;
1651}
1652
Harald Welte410575a2010-03-14 23:30:30 +08001653DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
1654 "gprs nsvc <0-1> local udp port <0-65535>",
1655 "GPRS NS Local UDP Port")
1656{
1657 struct gsm_bts *bts = vty->index;
1658 int idx = atoi(argv[0]);
1659
1660 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
1661
1662 return CMD_SUCCESS;
1663}
1664
1665DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
1666 "gprs nsvc <0-1> remote udp port <0-65535>",
1667 "GPRS NS Remote UDP Port")
1668{
1669 struct gsm_bts *bts = vty->index;
1670 int idx = atoi(argv[0]);
1671
1672 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
1673
1674 return CMD_SUCCESS;
1675}
1676
1677DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
1678 "gprs nsvc <0-1> remote ip A.B.C.D",
1679 "GPRS NS Remote IP Address")
1680{
1681 struct gsm_bts *bts = vty->index;
1682 int idx = atoi(argv[0]);
1683 struct in_addr ia;
1684
1685 inet_aton(argv[1], &ia);
1686 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
1687
1688 return CMD_SUCCESS;
1689}
1690
Harald Welte3055e332010-03-14 15:37:43 +08001691DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
1692 "gprs routing area <0-255>",
1693 "GPRS Routing Area Code")
1694{
1695 struct gsm_bts *bts = vty->index;
1696
1697 bts->gprs.rac = atoi(argv[0]);
1698
1699 return CMD_SUCCESS;
1700}
1701
Harald Welte410575a2010-03-14 23:30:30 +08001702DEFUN(cfg_bts_gprs_enabled, cfg_bts_gprs_enabled_cmd,
1703 "gprs enabled <0-1>",
1704 "GPRS Enabled on this BTS")
1705{
1706 struct gsm_bts *bts = vty->index;
1707
1708 bts->gprs.enabled = atoi(argv[0]);
1709
1710 return CMD_SUCCESS;
1711}
1712
Harald Welte3e774612009-08-10 13:48:16 +02001713
Harald Welte59b04682009-06-10 05:40:52 +08001714/* per TRX configuration */
1715DEFUN(cfg_trx,
1716 cfg_trx_cmd,
1717 "trx TRX_NR",
1718 "Select a TRX to configure")
1719{
1720 int trx_nr = atoi(argv[0]);
1721 struct gsm_bts *bts = vty->index;
1722 struct gsm_bts_trx *trx;
1723
Harald Weltee712a5f2009-06-21 16:17:15 +02001724 if (trx_nr > bts->num_trx) {
1725 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
1726 bts->num_trx, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +08001727 return CMD_WARNING;
Harald Weltee712a5f2009-06-21 16:17:15 +02001728 } else if (trx_nr == bts->num_trx) {
1729 /* we need to allocate a new one */
1730 trx = gsm_bts_trx_alloc(bts);
1731 } else
1732 trx = gsm_bts_trx_num(bts, trx_nr);
1733
1734 if (!trx)
1735 return CMD_WARNING;
Harald Welte59b04682009-06-10 05:40:52 +08001736
1737 vty->index = trx;
1738 vty->node = TRX_NODE;
1739
1740 return CMD_SUCCESS;
1741}
1742
1743DEFUN(cfg_trx_arfcn,
1744 cfg_trx_arfcn_cmd,
1745 "arfcn <1-1024>",
1746 "Set the ARFCN for this TRX\n")
1747{
1748 int arfcn = atoi(argv[0]);
1749 struct gsm_bts_trx *trx = vty->index;
1750
1751 /* FIXME: check if this ARFCN is supported by this TRX */
1752
1753 trx->arfcn = arfcn;
1754
1755 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
1756 /* FIXME: use OML layer to update the ARFCN */
1757 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
1758
1759 return CMD_SUCCESS;
1760}
1761
Harald Welte (local)b709bfe2009-12-27 20:56:38 +01001762DEFUN(cfg_trx_nominal_power,
1763 cfg_trx_nominal_power_cmd,
1764 "nominal power <0-100>",
1765 "Nominal TRX RF Power in dB\n")
1766{
1767 struct gsm_bts_trx *trx = vty->index;
1768
1769 trx->nominal_power = atoi(argv[0]);
1770
1771 return CMD_SUCCESS;
1772}
1773
Harald Welte91afe4c2009-06-20 18:15:19 +02001774DEFUN(cfg_trx_max_power_red,
1775 cfg_trx_max_power_red_cmd,
1776 "max_power_red <0-100>",
1777 "Reduction of maximum BS RF Power in dB\n")
1778{
1779 int maxpwr_r = atoi(argv[0]);
1780 struct gsm_bts_trx *trx = vty->index;
Harald Welte01acd742009-11-18 09:20:22 +01001781 int upper_limit = 24; /* default 12.21 max power red. */
Harald Welte91afe4c2009-06-20 18:15:19 +02001782
1783 /* FIXME: check if our BTS type supports more than 12 */
1784 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
1785 vty_out(vty, "%% Power %d dB is not in the valid range%s",
1786 maxpwr_r, VTY_NEWLINE);
1787 return CMD_WARNING;
1788 }
1789 if (maxpwr_r & 1) {
1790 vty_out(vty, "%% Power %d dB is not an even value%s",
1791 maxpwr_r, VTY_NEWLINE);
1792 return CMD_WARNING;
1793 }
1794
1795 trx->max_power_red = maxpwr_r;
1796
1797 /* FIXME: make sure we update this using OML */
1798
1799 return CMD_SUCCESS;
1800}
1801
Harald Welte62868882009-08-08 16:12:58 +02001802DEFUN(cfg_trx_rsl_e1,
1803 cfg_trx_rsl_e1_cmd,
1804 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
1805 "E1 interface to be used for RSL\n")
1806{
1807 struct gsm_bts_trx *trx = vty->index;
1808
1809 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
1810
1811 return CMD_SUCCESS;
1812}
1813
1814DEFUN(cfg_trx_rsl_e1_tei,
1815 cfg_trx_rsl_e1_tei_cmd,
1816 "rsl e1 tei <0-63>",
1817 "Set the TEI to be used for RSL")
1818{
1819 struct gsm_bts_trx *trx = vty->index;
1820
1821 trx->rsl_tei = atoi(argv[0]);
1822
1823 return CMD_SUCCESS;
1824}
1825
Holger Hans Peter Freyther1c8b4802009-11-11 11:54:24 +01001826DEFUN(cfg_trx_rf_locked,
1827 cfg_trx_rf_locked_cmd,
1828 "rf_locked (0|1)",
1829 "Turn off RF of the TRX.\n")
1830{
1831 int locked = atoi(argv[0]);
1832 struct gsm_bts_trx *trx = vty->index;
1833
1834 gsm_trx_lock_rf(trx, locked);
1835 return CMD_SUCCESS;
1836}
Harald Welte62868882009-08-08 16:12:58 +02001837
Harald Welte59b04682009-06-10 05:40:52 +08001838/* per TS configuration */
1839DEFUN(cfg_ts,
1840 cfg_ts_cmd,
Harald Welte62868882009-08-08 16:12:58 +02001841 "timeslot <0-7>",
Harald Welte59b04682009-06-10 05:40:52 +08001842 "Select a Timeslot to configure")
1843{
1844 int ts_nr = atoi(argv[0]);
1845 struct gsm_bts_trx *trx = vty->index;
1846 struct gsm_bts_trx_ts *ts;
1847
1848 if (ts_nr >= TRX_NR_TS) {
1849 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
1850 TRX_NR_TS, VTY_NEWLINE);
1851 return CMD_WARNING;
1852 }
1853
1854 ts = &trx->ts[ts_nr];
1855
1856 vty->index = ts;
1857 vty->node = TS_NODE;
1858
1859 return CMD_SUCCESS;
1860}
1861
Harald Welte3ffe1b32009-08-07 00:25:23 +02001862DEFUN(cfg_ts_pchan,
1863 cfg_ts_pchan_cmd,
1864 "phys_chan_config PCHAN",
1865 "Physical Channel configuration (TCH/SDCCH/...)")
1866{
1867 struct gsm_bts_trx_ts *ts = vty->index;
1868 int pchanc;
1869
1870 pchanc = gsm_pchan_parse(argv[0]);
1871 if (pchanc < 0)
1872 return CMD_WARNING;
1873
1874 ts->pchan = pchanc;
1875
1876 return CMD_SUCCESS;
1877}
1878
1879DEFUN(cfg_ts_e1_subslot,
1880 cfg_ts_e1_subslot_cmd,
Harald Welte62868882009-08-08 16:12:58 +02001881 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte3ffe1b32009-08-07 00:25:23 +02001882 "E1 sub-slot connected to this on-air timeslot")
1883{
1884 struct gsm_bts_trx_ts *ts = vty->index;
1885
Harald Welte62868882009-08-08 16:12:58 +02001886 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Welte3ffe1b32009-08-07 00:25:23 +02001887
1888 return CMD_SUCCESS;
1889}
Harald Welte59b04682009-06-10 05:40:52 +08001890
Harald Welte59b04682009-06-10 05:40:52 +08001891int bsc_vty_init(struct gsm_network *net)
1892{
1893 gsmnet = net;
1894
1895 cmd_init(1);
1896 vty_init();
1897
1898 install_element(VIEW_NODE, &show_net_cmd);
1899 install_element(VIEW_NODE, &show_bts_cmd);
1900 install_element(VIEW_NODE, &show_trx_cmd);
1901 install_element(VIEW_NODE, &show_ts_cmd);
1902 install_element(VIEW_NODE, &show_lchan_cmd);
1903
1904 install_element(VIEW_NODE, &show_e1drv_cmd);
1905 install_element(VIEW_NODE, &show_e1line_cmd);
1906 install_element(VIEW_NODE, &show_e1ts_cmd);
1907
1908 install_element(VIEW_NODE, &show_paging_cmd);
Harald Welte3edc5a92009-12-22 00:41:05 +01001909 install_element(VIEW_NODE, &show_stats_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08001910
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +01001911 install_element(VIEW_NODE, &enable_logging_cmd);
1912 install_element(VIEW_NODE, &disable_logging_cmd);
1913 install_element(VIEW_NODE, &logging_fltr_imsi_cmd);
1914 install_element(VIEW_NODE, &logging_fltr_all_cmd);
1915 install_element(VIEW_NODE, &logging_use_clr_cmd);
1916 install_element(VIEW_NODE, &logging_prnt_timestamp_cmd);
1917 install_element(VIEW_NODE, &logging_set_category_mask_cmd);
Harald Welte (local)0bb88162009-12-26 19:45:22 +01001918 install_element(VIEW_NODE, &logging_level_cmd);
Sylvain Munautd1800752009-12-24 16:48:33 +01001919 install_element(VIEW_NODE, &logging_set_log_level_cmd);
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +01001920
Harald Weltee87eb462009-08-07 13:29:14 +02001921 install_element(CONFIG_NODE, &cfg_net_cmd);
1922 install_node(&net_node, config_write_net);
1923 install_default(GSMNET_NODE);
Harald Welte62868882009-08-08 16:12:58 +02001924 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Weltee87eb462009-08-07 13:29:14 +02001925 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
1926 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
1927 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02001928 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte59936d72009-11-18 20:33:19 +01001929 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Weltecca253a2009-08-30 15:47:06 +09001930 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001931 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welte52af1952009-12-13 10:53:12 +01001932 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte284ddba2009-12-14 17:49:15 +01001933 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Welte0af9c9f2009-12-19 21:41:52 +01001934 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Weltea8062f12009-12-21 16:51:50 +01001935 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
1936 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
1937 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
1938 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
1939 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
1940 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001941 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +01001942 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
1943 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
1944 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
1945 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
1946 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
1947 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
1948 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
1949 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
1950 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
1951 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Harald Weltee87eb462009-08-07 13:29:14 +02001952
1953 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte97ceef92009-08-06 19:06:46 +02001954 install_node(&bts_node, config_write_bts);
Harald Welte59b04682009-06-10 05:40:52 +08001955 install_default(BTS_NODE);
1956 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte91afe4c2009-06-20 18:15:19 +02001957 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +02001958 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08001959 install_element(BTS_NODE, &cfg_bts_lac_cmd);
1960 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte62868882009-08-08 16:12:58 +02001961 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08001962 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte25572872009-10-20 00:22:00 +02001963 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte62868882009-08-08 16:12:58 +02001964 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
1965 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte3e774612009-08-10 13:48:16 +02001966 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001967 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
1968 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02001969 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Harald Welte (local)cbd46102009-08-13 10:14:26 +02001970 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02001971 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welteb761bf82009-12-12 18:17:25 +01001972 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
1973 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Harald Welte410575a2010-03-14 23:30:30 +08001974 install_element(BTS_NODE, &cfg_bts_gprs_enabled_cmd);
Harald Welte3055e332010-03-14 15:37:43 +08001975 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
1976 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
1977 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welte410575a2010-03-14 23:30:30 +08001978 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
1979 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
1980 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08001981
1982 install_element(BTS_NODE, &cfg_trx_cmd);
1983 install_node(&trx_node, dummy_config_write);
1984 install_default(TRX_NODE);
1985 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte (local)b709bfe2009-12-27 20:56:38 +01001986 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte7f597bc2009-06-20 22:36:12 +02001987 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte62868882009-08-08 16:12:58 +02001988 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
1989 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther1c8b4802009-11-11 11:54:24 +01001990 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08001991
1992 install_element(TRX_NODE, &cfg_ts_cmd);
1993 install_node(&ts_node, dummy_config_write);
1994 install_default(TS_NODE);
Harald Welte3ffe1b32009-08-07 00:25:23 +02001995 install_element(TS_NODE, &cfg_ts_pchan_cmd);
1996 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08001997
Holger Hans Peter Freytherbdae6f92009-08-10 10:17:50 +02001998 bsc_vty_init_extra(net);
Harald Welte59b04682009-06-10 05:40:52 +08001999
2000 return 0;
2001}