blob: f74a041b6260b379d5223fde2bf4f68ea066277c [file] [log] [blame]
Harald Welte68628e82009-03-10 12:17:57 +00001/* OpenBSC interface to quagga VTY */
Harald Welteaf387632010-03-14 23:30:30 +08002/* (C) 2009-2010 by Harald Welte <laforge@gnumonks.org>
Harald Welte68628e82009-03-10 12:17:57 +00003 * All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#include <stdlib.h>
22#include <unistd.h>
23#include <sys/types.h>
24
25#include <vty/command.h>
Harald Weltef9daefd2009-08-09 15:13:54 +020026#include <vty/buffer.h>
Harald Welte68628e82009-03-10 12:17:57 +000027#include <vty/vty.h>
28
29#include <arpa/inet.h>
30
Harald Weltedfe6c7d2010-02-20 16:24:02 +010031#include <osmocore/linuxlist.h>
Harald Welte68628e82009-03-10 12:17:57 +000032#include <openbsc/gsm_data.h>
Harald Welte68628e82009-03-10 12:17:57 +000033#include <openbsc/e1_input.h>
Harald Welte1bc77352009-03-10 19:47:51 +000034#include <openbsc/abis_nm.h>
Harald Weltedfe6c7d2010-02-20 16:24:02 +010035#include <osmocore/gsm_utils.h>
Harald Welteb908cb72009-12-22 13:09:29 +010036#include <openbsc/chan_alloc.h>
Harald Welte8387a492009-12-22 21:43:14 +010037#include <openbsc/meas_rep.h>
Harald Welte40f82892009-05-23 17:31:39 +000038#include <openbsc/db.h>
Harald Weltedfe6c7d2010-02-20 16:24:02 +010039#include <osmocore/talloc.h>
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +010040#include <openbsc/telnet_interface.h>
Holger Hans Peter Freyther3c712322010-04-06 11:55:37 +020041#include <openbsc/vty.h>
Harald Welte68628e82009-03-10 12:17:57 +000042
43static struct gsm_network *gsmnet;
44
Harald Welte5013b2a2009-08-07 13:29:14 +020045struct cmd_node net_node = {
46 GSMNET_NODE,
47 "%s(network)#",
48 1,
49};
50
Harald Welte68628e82009-03-10 12:17:57 +000051struct cmd_node bts_node = {
52 BTS_NODE,
53 "%s(bts)#",
54 1,
55};
56
57struct cmd_node trx_node = {
58 TRX_NODE,
59 "%s(trx)#",
60 1,
61};
62
63struct cmd_node ts_node = {
64 TS_NODE,
65 "%s(ts)#",
66 1,
67};
68
69static int dummy_config_write(struct vty *v)
70{
71 return CMD_SUCCESS;
72}
73
74static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
75{
Harald Welte1bc77352009-03-10 19:47:51 +000076 vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s",
77 nm_opstate_name(nms->operational), nms->administrative,
78 nm_avail_name(nms->availability), VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +000079}
80
Harald Welteb908cb72009-12-22 13:09:29 +010081static void dump_pchan_load_vty(struct vty *vty, char *prefix,
82 const struct pchan_load *pl)
83{
84 int i;
85
86 for (i = 0; i < ARRAY_SIZE(pl->pchan); i++) {
87 const struct load_counter *lc = &pl->pchan[i];
88 unsigned int percent;
89
90 if (lc->total == 0)
91 continue;
92
93 percent = (lc->used * 100) / lc->total;
94
95 vty_out(vty, "%s%20s: %3u%% (%u/%u)%s", prefix,
96 gsm_pchan_name(i), percent, lc->used, lc->total,
97 VTY_NEWLINE);
98 }
99}
100
Harald Welte68628e82009-03-10 12:17:57 +0000101static void net_dump_vty(struct vty *vty, struct gsm_network *net)
102{
Harald Welteb908cb72009-12-22 13:09:29 +0100103 struct pchan_load pl;
104
Harald Welteef235b52009-03-10 12:34:02 +0000105 vty_out(vty, "BSC is on Country Code %u, Network Code %u "
106 "and has %u BTS%s", net->country_code, net->network_code,
107 net->num_bts, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000108 vty_out(vty, " Long network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000109 net->name_long, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000110 vty_out(vty, " Short network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000111 net->name_short, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200112 vty_out(vty, " Authentication policy: %s%s",
113 gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100114 vty_out(vty, " Location updating reject cause: %u%s",
115 net->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900116 vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption,
117 VTY_NEWLINE);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +0100118 vty_out(vty, " NECI (TCH/H): %u%s", net->neci,
119 VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100120 vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode),
121 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100122 vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off",
123 VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100124 vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off",
125 VTY_NEWLINE);
Harald Welteb908cb72009-12-22 13:09:29 +0100126 network_chan_load(&pl, net);
127 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
128 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000129}
130
131DEFUN(show_net, show_net_cmd, "show network",
132 SHOW_STR "Display information about a GSM NETWORK\n")
133{
134 struct gsm_network *net = gsmnet;
135 net_dump_vty(vty, net);
136
137 return CMD_SUCCESS;
138}
139
140static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l)
141{
Harald Welteedb37782009-05-01 14:59:07 +0000142 struct e1inp_line *line;
143
144 if (!e1l) {
145 vty_out(vty, " None%s", VTY_NEWLINE);
146 return;
147 }
148
149 line = e1l->ts->line;
150
151 vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s",
152 line->num, line->driver->name, e1l->ts->num,
Harald Welte1bc77352009-03-10 19:47:51 +0000153 e1inp_signtype_name(e1l->type), VTY_NEWLINE);
Harald Welteedb37782009-05-01 14:59:07 +0000154 vty_out(vty, " E1 TEI %u, SAPI %u%s",
Harald Welte68628e82009-03-10 12:17:57 +0000155 e1l->tei, e1l->sapi, VTY_NEWLINE);
156}
157
158static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
159{
Harald Welteb908cb72009-12-22 13:09:29 +0100160 struct pchan_load pl;
161
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200162 vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
Harald Weltefcd24452009-06-20 18:15:19 +0200163 "BSIC %u, TSC %u and %u TRX%s",
164 bts->nr, btstype2str(bts->type), gsm_band_name(bts->band),
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200165 bts->cell_identity,
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +0200166 bts->location_area_code, bts->bsic, bts->tsc,
Harald Weltefcd24452009-06-20 18:15:19 +0200167 bts->num_trx, VTY_NEWLINE);
Harald Welte1d8dbc42009-12-12 15:38:16 +0100168 vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100169 vty_out(vty, "Minimum Rx Level for Access: %i dBm%s",
Harald Welte1d8dbc42009-12-12 15:38:16 +0100170 rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min),
171 VTY_NEWLINE);
172 vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s",
Harald Welte73225282009-12-12 18:17:25 +0100173 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100174 vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer,
175 VTY_NEWLINE);
176 vty_out(vty, "RACH Max transmissions: %u%s",
177 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
178 VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100179 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200180 vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE);
Harald Welte4cc34222009-05-01 15:12:31 +0000181 if (is_ipaccess_bts(bts))
Harald Welte8175e952009-10-20 00:22:00 +0200182 vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
Harald Welte4cc34222009-05-01 15:12:31 +0000183 bts->ip_access.site_id, bts->ip_access.bts_id,
Harald Welte8175e952009-10-20 00:22:00 +0200184 bts->oml_tei, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000185 vty_out(vty, " NM State: ");
186 net_dump_nmstate(vty, &bts->nm_state);
187 vty_out(vty, " Site Mgr NM State: ");
188 net_dump_nmstate(vty, &bts->site_mgr.nm_state);
189 vty_out(vty, " Paging: FIXME pending requests, %u free slots%s",
190 bts->paging.available_slots, VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200191 if (!is_ipaccess_bts(bts)) {
192 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
193 e1isl_dump_vty(vty, bts->oml_link);
194 }
Harald Welte68628e82009-03-10 12:17:57 +0000195 /* FIXME: oml_link, chan_desc */
Harald Welteb908cb72009-12-22 13:09:29 +0100196 memset(&pl, 0, sizeof(pl));
197 bts_chan_load(&pl, bts);
198 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
199 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000200}
201
202DEFUN(show_bts, show_bts_cmd, "show bts [number]",
203 SHOW_STR "Display information about a BTS\n"
204 "BTS number")
205{
206 struct gsm_network *net = gsmnet;
207 int bts_nr;
208
209 if (argc != 0) {
210 /* use the BTS number that the user has specified */
211 bts_nr = atoi(argv[0]);
212 if (bts_nr > net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000213 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000214 VTY_NEWLINE);
215 return CMD_WARNING;
216 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200217 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000218 return CMD_SUCCESS;
219 }
220 /* print all BTS's */
221 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee441d9c2009-06-21 16:17:15 +0200222 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000223
224 return CMD_SUCCESS;
225}
226
Harald Welte42581822009-08-08 16:12:58 +0200227/* utility functions */
228static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
229 const char *ts, const char *ss)
230{
231 e1_link->e1_nr = atoi(line);
232 e1_link->e1_ts = atoi(ts);
233 if (!strcmp(ss, "full"))
234 e1_link->e1_ts_ss = 255;
235 else
236 e1_link->e1_ts_ss = atoi(ss);
237}
238
239static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,
240 const char *prefix)
241{
242 if (!e1_link->e1_ts)
243 return;
244
245 if (e1_link->e1_ts_ss == 255)
246 vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s",
247 prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE);
248 else
249 vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s",
250 prefix, e1_link->e1_nr, e1_link->e1_ts,
251 e1_link->e1_ts_ss, VTY_NEWLINE);
252}
253
254
Harald Welte67ce0732009-08-06 19:06:46 +0200255static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
256{
Harald Welte42581822009-08-08 16:12:58 +0200257 vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
258 if (ts->pchan != GSM_PCHAN_NONE)
259 vty_out(vty, " phys_chan_config %s%s",
260 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
261 config_write_e1_link(vty, &ts->e1_link, " ");
Harald Welte67ce0732009-08-06 19:06:46 +0200262}
263
264static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
265{
266 int i;
267
Harald Welte5013b2a2009-08-07 13:29:14 +0200268 vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE);
269 vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
Harald Welte (local)7b37d972009-12-27 20:56:38 +0100270 vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200271 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200272 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
273 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte67ce0732009-08-06 19:06:46 +0200274
275 for (i = 0; i < TRX_NR_TS; i++)
276 config_write_ts_single(vty, &trx->ts[i]);
277}
278
279static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
280{
281 struct gsm_bts_trx *trx;
Harald Welte97a282b2010-03-14 15:37:43 +0800282 int i;
Harald Welte67ce0732009-08-06 19:06:46 +0200283
Harald Welte5013b2a2009-08-07 13:29:14 +0200284 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
285 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
286 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freytherf926ed62009-11-19 16:38:49 +0100287 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200288 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte67ce0732009-08-06 19:06:46 +0200289 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200290 vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE);
291 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)0e451d02009-08-13 10:14:26 +0200292 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100293 vty_out(vty, " cell reselection hysteresis %u%s",
294 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
295 vty_out(vty, " rxlev access min %u%s",
296 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Harald Weltea43f7892009-12-01 18:04:30 +0530297 if (bts->si_common.chan_desc.t3212)
Harald Welte (local)efc92312009-08-14 23:09:25 +0200298 vty_out(vty, " periodic location update %u%s",
Harald Weltea43f7892009-12-01 18:04:30 +0530299 bts->si_common.chan_desc.t3212 * 10, VTY_NEWLINE);
Harald Welte7a8fa412009-08-10 13:48:16 +0200300 vty_out(vty, " channel allocator %s%s",
301 bts->chan_alloc_reverse ? "descending" : "ascending",
302 VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100303 vty_out(vty, " rach tx integer %u%s",
304 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
305 vty_out(vty, " rach max transmission %u%s",
306 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
307 VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100308 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200309 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200310 if (is_ipaccess_bts(bts)) {
Harald Welte5013b2a2009-08-07 13:29:14 +0200311 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Weltea6fd58e2009-08-07 00:25:23 +0200312 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200313 vty_out(vty, " oml ip.access stream_id %u%s", bts->oml_tei, VTY_NEWLINE);
314 } else {
Harald Welte42581822009-08-08 16:12:58 +0200315 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
316 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
317 }
Harald Welteaf387632010-03-14 23:30:30 +0800318 vty_out(vty, " gprs enabled %u%s", bts->gprs.enabled, VTY_NEWLINE);
319 if (bts->gprs.enabled) {
320 vty_out(vty, " gprs routing area %u%s", bts->gprs.rac,
321 VTY_NEWLINE);
322 vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
323 VTY_NEWLINE);
Harald Weltea5731cf2010-03-22 11:48:36 +0800324 vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei,
325 VTY_NEWLINE);
Harald Welteaf387632010-03-14 23:30:30 +0800326 for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
327 struct gsm_bts_gprs_nsvc *nsvc =
328 &bts->gprs.nsvc[i];
329 struct in_addr ia;
330
331 ia.s_addr = htonl(nsvc->remote_ip);
332 vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
333 nsvc->nsvci, VTY_NEWLINE);
334 vty_out(vty, " gprs nsvc %u local udp port %u%s", i,
335 nsvc->local_port, VTY_NEWLINE);
336 vty_out(vty, " gprs nsvc %u remote udp port %u%s", i,
337 nsvc->remote_port, VTY_NEWLINE);
338 vty_out(vty, " gprs nsvc %u remote ip %s%s", i,
339 inet_ntoa(ia), VTY_NEWLINE);
340 }
341 }
Harald Welte67ce0732009-08-06 19:06:46 +0200342
343 llist_for_each_entry(trx, &bts->trx_list, list)
344 config_write_trx_single(vty, trx);
345}
346
347static int config_write_bts(struct vty *v)
348{
349 struct gsm_bts *bts;
350
351 llist_for_each_entry(bts, &gsmnet->bts_list, list)
352 config_write_bts_single(v, bts);
353
354 return CMD_SUCCESS;
355}
356
Harald Welte5013b2a2009-08-07 13:29:14 +0200357static int config_write_net(struct vty *vty)
358{
359 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200360 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200361 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200362 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
363 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200364 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100365 vty_out(vty, " location updating reject cause %u%s",
366 gsmnet->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900367 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freytherd54c3372009-11-19 16:37:48 +0100368 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100369 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
370 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100371 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100372 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Welteb720bd32009-12-21 16:51:50 +0100373 vty_out(vty, " handover window rxlev averaging %u%s",
374 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
375 vty_out(vty, " handover window rxqual averaging %u%s",
376 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
377 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
378 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
379 vty_out(vty, " handover power budget interval %u%s",
380 gsmnet->handover.pwr_interval, VTY_NEWLINE);
381 vty_out(vty, " handover power budget hysteresis %u%s",
382 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
383 vty_out(vty, " handover maximum distance %u%s",
384 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +0100385 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100386 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
387 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
388 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
389 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
390 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
391 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
392 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
393 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
394 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
395 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200396
397 return CMD_SUCCESS;
398}
Harald Welte67ce0732009-08-06 19:06:46 +0200399
Harald Welte68628e82009-03-10 12:17:57 +0000400static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
401{
402 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
403 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Weltefcd24452009-06-20 18:15:19 +0200404 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte42581822009-08-08 16:12:58 +0200405 "resulting BS power: %d dBm%s",
Harald Weltefcd24452009-06-20 18:15:19 +0200406 trx->nominal_power, trx->max_power_red,
Harald Welte42581822009-08-08 16:12:58 +0200407 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000408 vty_out(vty, " NM State: ");
409 net_dump_nmstate(vty, &trx->nm_state);
410 vty_out(vty, " Baseband Transceiver NM State: ");
411 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte8175e952009-10-20 00:22:00 +0200412 if (is_ipaccess_bts(trx->bts)) {
413 vty_out(vty, " ip.access stream ID: 0x%02x%s",
414 trx->rsl_tei, VTY_NEWLINE);
415 } else {
416 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
417 e1isl_dump_vty(vty, trx->rsl_link);
418 }
Harald Welte68628e82009-03-10 12:17:57 +0000419}
420
421DEFUN(show_trx,
422 show_trx_cmd,
423 "show trx [bts_nr] [trx_nr]",
424 SHOW_STR "Display information about a TRX\n")
425{
426 struct gsm_network *net = gsmnet;
427 struct gsm_bts *bts = NULL;
428 struct gsm_bts_trx *trx;
429 int bts_nr, trx_nr;
430
431 if (argc >= 1) {
432 /* use the BTS number that the user has specified */
433 bts_nr = atoi(argv[0]);
434 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000435 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000436 VTY_NEWLINE);
437 return CMD_WARNING;
438 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200439 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000440 }
441 if (argc >= 2) {
442 trx_nr = atoi(argv[1]);
443 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000444 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000445 VTY_NEWLINE);
446 return CMD_WARNING;
447 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200448 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000449 trx_dump_vty(vty, trx);
450 return CMD_SUCCESS;
451 }
452 if (bts) {
453 /* print all TRX in this BTS */
454 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200455 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000456 trx_dump_vty(vty, trx);
457 }
458 return CMD_SUCCESS;
459 }
460
461 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200462 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000463 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200464 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000465 trx_dump_vty(vty, trx);
466 }
467 }
468
469 return CMD_SUCCESS;
470}
471
Harald Welte67ce0732009-08-06 19:06:46 +0200472
Harald Welte68628e82009-03-10 12:17:57 +0000473static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
474{
Harald Welte68628e82009-03-10 12:17:57 +0000475 vty_out(vty, "Timeslot %u of TRX %u in BTS %u, phys cfg %s%s",
476 ts->nr, ts->trx->nr, ts->trx->bts->nr,
477 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
478 vty_out(vty, " NM State: ");
479 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte2c828992009-12-02 01:56:49 +0530480 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welteef235b52009-03-10 12:34:02 +0000481 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
482 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
483 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000484}
485
486DEFUN(show_ts,
487 show_ts_cmd,
Harald Welte1bc77352009-03-10 19:47:51 +0000488 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
Harald Welte68628e82009-03-10 12:17:57 +0000489 SHOW_STR "Display information about a TS\n")
490{
491 struct gsm_network *net = gsmnet;
492 struct gsm_bts *bts;
493 struct gsm_bts_trx *trx;
494 struct gsm_bts_trx_ts *ts;
495 int bts_nr, trx_nr, ts_nr;
496
497 if (argc >= 1) {
498 /* use the BTS number that the user has specified */
499 bts_nr = atoi(argv[0]);
500 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000501 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000502 VTY_NEWLINE);
503 return CMD_WARNING;
504 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200505 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000506 }
507 if (argc >= 2) {
508 trx_nr = atoi(argv[1]);
509 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000510 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000511 VTY_NEWLINE);
512 return CMD_WARNING;
513 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200514 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000515 }
516 if (argc >= 3) {
517 ts_nr = atoi(argv[2]);
518 if (ts_nr >= TRX_NR_TS) {
Harald Welte1bc77352009-03-10 19:47:51 +0000519 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
Harald Welte68628e82009-03-10 12:17:57 +0000520 VTY_NEWLINE);
521 return CMD_WARNING;
522 }
523 ts = &trx->ts[ts_nr];
524 ts_dump_vty(vty, ts);
525 return CMD_SUCCESS;
526 }
527 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200528 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000529 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200530 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000531 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
532 ts = &trx->ts[ts_nr];
533 ts_dump_vty(vty, ts);
534 }
535 }
536 }
537
538 return CMD_SUCCESS;
539}
540
Holger Hans Peter Freyther424c4f02010-01-06 06:00:40 +0100541static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte68628e82009-03-10 12:17:57 +0000542{
Harald Weltefcd24452009-06-20 18:15:19 +0200543 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte40f82892009-05-23 17:31:39 +0000544 subscr->authorized, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000545 if (subscr->name)
Harald Welte1bc77352009-03-10 19:47:51 +0000546 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000547 if (subscr->extension)
548 vty_out(vty, " Extension: %s%s", subscr->extension,
549 VTY_NEWLINE);
550 if (subscr->imsi)
551 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freyther22230252009-08-19 12:53:57 +0200552 if (subscr->tmsi != GSM_RESERVED_TMSI)
553 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte731fd912009-08-15 03:24:51 +0200554 VTY_NEWLINE);
Sylvain Munautaf292642009-12-27 19:29:28 +0100555
Harald Welte (local)15920de2009-08-14 20:27:16 +0200556 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000557}
558
Harald Welte8387a492009-12-22 21:43:14 +0100559static void meas_rep_dump_uni_vty(struct vty *vty,
560 struct gsm_meas_rep_unidir *mru,
561 const char *prefix,
562 const char *dir)
563{
564 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
565 prefix, dir, rxlev2dbm(mru->full.rx_lev),
566 dir, rxlev2dbm(mru->sub.rx_lev));
567 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
568 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
569 VTY_NEWLINE);
570}
571
572static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
573 const char *prefix)
574{
575 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
576 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
577 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
578 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
579 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
580 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
581 VTY_NEWLINE);
582 if (mr->flags & MEAS_REP_F_MS_TO)
583 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
584 mr->ms_timing_offset, VTY_NEWLINE);
585 if (mr->flags & MEAS_REP_F_MS_L1)
586 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
587 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
588 if (mr->flags & MEAS_REP_F_DL_VALID)
589 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
590 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
591}
592
Harald Welte68628e82009-03-10 12:17:57 +0000593static void lchan_dump_vty(struct vty *vty, struct gsm_lchan *lchan)
594{
Harald Welte8387a492009-12-22 21:43:14 +0100595 int idx;
596
Harald Welte68628e82009-03-10 12:17:57 +0000597 vty_out(vty, "Lchan %u in Timeslot %u of TRX %u in BTS %u, Type %s%s",
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +0200598 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
Harald Welte (local)ccd88452009-12-27 18:05:25 +0100599 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Harald Welte68628e82009-03-10 12:17:57 +0000600 VTY_NEWLINE);
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100601 vty_out(vty, " Use Count: %u, State: %s%s", lchan->conn.use_count,
Harald Welte1887f9d2009-12-29 10:52:38 +0100602 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100603 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
604 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
605 - lchan->bs_power*2,
606 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
607 VTY_NEWLINE);
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100608 if (lchan->conn.subscr) {
Harald Welte68628e82009-03-10 12:17:57 +0000609 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100610 subscr_dump_vty(vty, lchan->conn.subscr);
Harald Welte68628e82009-03-10 12:17:57 +0000611 } else
612 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte2c828992009-12-02 01:56:49 +0530613 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
614 struct in_addr ia;
Holger Hans Peter Freyther54fa7992010-04-07 15:39:16 +0200615 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte2c828992009-12-02 01:56:49 +0530616 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
617 inet_ntoa(ia), lchan->abis_ip.bound_port,
618 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
619 VTY_NEWLINE);
620 }
Harald Welte8387a492009-12-22 21:43:14 +0100621
622 /* we want to report the last measurement report */
623 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
624 lchan->meas_rep_idx, 1);
625 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte68628e82009-03-10 12:17:57 +0000626}
627
Harald Welte4bfdfe72009-06-10 23:11:52 +0800628#if 0
629TODO: callref and remote callref of call must be resolved to get gsm_trans object
Harald Welte68628e82009-03-10 12:17:57 +0000630static void call_dump_vty(struct vty *vty, struct gsm_call *call)
631{
632 vty_out(vty, "Call Type %u, State %u, Transaction ID %u%s",
633 call->type, call->state, call->transaction_id, VTY_NEWLINE);
634
635 if (call->local_lchan) {
636 vty_out(vty, "Call Local Channel:%s", VTY_NEWLINE);
637 lchan_dump_vty(vty, call->local_lchan);
638 } else
639 vty_out(vty, "Call has no Local Channel%s", VTY_NEWLINE);
640
641 if (call->remote_lchan) {
642 vty_out(vty, "Call Remote Channel:%s", VTY_NEWLINE);
643 lchan_dump_vty(vty, call->remote_lchan);
644 } else
645 vty_out(vty, "Call has no Remote Channel%s", VTY_NEWLINE);
646
647 if (call->called_subscr) {
648 vty_out(vty, "Called Subscriber:%s", VTY_NEWLINE);
649 subscr_dump_vty(vty, call->called_subscr);
650 } else
651 vty_out(vty, "Call has no Called Subscriber%s", VTY_NEWLINE);
652}
Harald Welte4bfdfe72009-06-10 23:11:52 +0800653#endif
Harald Welte68628e82009-03-10 12:17:57 +0000654
655DEFUN(show_lchan,
656 show_lchan_cmd,
657 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
658 SHOW_STR "Display information about a logical channel\n")
659{
660 struct gsm_network *net = gsmnet;
661 struct gsm_bts *bts;
662 struct gsm_bts_trx *trx;
663 struct gsm_bts_trx_ts *ts;
664 struct gsm_lchan *lchan;
665 int bts_nr, trx_nr, ts_nr, lchan_nr;
666
667 if (argc >= 1) {
668 /* use the BTS number that the user has specified */
669 bts_nr = atoi(argv[0]);
670 if (bts_nr >= net->num_bts) {
671 vty_out(vty, "%% can't find BTS %s%s", argv[0],
672 VTY_NEWLINE);
673 return CMD_WARNING;
674 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200675 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000676 }
677 if (argc >= 2) {
678 trx_nr = atoi(argv[1]);
679 if (trx_nr >= bts->num_trx) {
680 vty_out(vty, "%% can't find TRX %s%s", argv[1],
681 VTY_NEWLINE);
682 return CMD_WARNING;
683 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200684 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000685 }
686 if (argc >= 3) {
687 ts_nr = atoi(argv[2]);
688 if (ts_nr >= TRX_NR_TS) {
689 vty_out(vty, "%% can't find TS %s%s", argv[2],
690 VTY_NEWLINE);
691 return CMD_WARNING;
692 }
693 ts = &trx->ts[ts_nr];
694 }
695 if (argc >= 4) {
696 lchan_nr = atoi(argv[3]);
697 if (lchan_nr >= TS_MAX_LCHAN) {
698 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
699 VTY_NEWLINE);
700 return CMD_WARNING;
701 }
702 lchan = &ts->lchan[lchan_nr];
703 lchan_dump_vty(vty, lchan);
704 return CMD_SUCCESS;
705 }
706 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200707 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000708 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200709 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000710 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
711 ts = &trx->ts[ts_nr];
712 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
713 lchan_nr++) {
714 lchan = &ts->lchan[lchan_nr];
Harald Welteef235b52009-03-10 12:34:02 +0000715 if (lchan->type == GSM_LCHAN_NONE)
716 continue;
Harald Welte68628e82009-03-10 12:17:57 +0000717 lchan_dump_vty(vty, lchan);
718 }
719 }
720 }
721 }
722
723 return CMD_SUCCESS;
724}
725
Harald Welte1bc77352009-03-10 19:47:51 +0000726static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
727{
728 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
729}
730
731DEFUN(show_e1drv,
732 show_e1drv_cmd,
733 "show e1_driver",
734 SHOW_STR "Display information about available E1 drivers\n")
735{
736 struct e1inp_driver *drv;
737
738 llist_for_each_entry(drv, &e1inp_driver_list, list)
739 e1drv_dump_vty(vty, drv);
740
741 return CMD_SUCCESS;
742}
743
Harald Welte68628e82009-03-10 12:17:57 +0000744static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
745{
746 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
747 line->num, line->name ? line->name : "",
748 line->driver->name, VTY_NEWLINE);
749}
750
751DEFUN(show_e1line,
752 show_e1line_cmd,
753 "show e1_line [line_nr]",
754 SHOW_STR "Display information about a E1 line\n")
755{
Harald Welte1bc77352009-03-10 19:47:51 +0000756 struct e1inp_line *line;
757
758 if (argc >= 1) {
759 int num = atoi(argv[0]);
760 llist_for_each_entry(line, &e1inp_line_list, list) {
761 if (line->num == num) {
762 e1line_dump_vty(vty, line);
763 return CMD_SUCCESS;
764 }
765 }
766 return CMD_WARNING;
767 }
768
769 llist_for_each_entry(line, &e1inp_line_list, list)
770 e1line_dump_vty(vty, line);
771
772 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000773}
774
775static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
776{
Harald Welte42581822009-08-08 16:12:58 +0200777 if (ts->type == E1INP_TS_TYPE_NONE)
778 return;
Harald Welte1bc77352009-03-10 19:47:51 +0000779 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
780 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
781 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000782}
783
784DEFUN(show_e1ts,
785 show_e1ts_cmd,
786 "show e1_timeslot [line_nr] [ts_nr]",
787 SHOW_STR "Display information about a E1 timeslot\n")
788{
Harald Welte986c3d72009-11-17 06:12:16 +0100789 struct e1inp_line *line = NULL;
Harald Welte1bc77352009-03-10 19:47:51 +0000790 struct e1inp_ts *ts;
791 int ts_nr;
Harald Welte68628e82009-03-10 12:17:57 +0000792
Harald Welte1bc77352009-03-10 19:47:51 +0000793 if (argc == 0) {
794 llist_for_each_entry(line, &e1inp_line_list, list) {
795 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
796 ts = &line->ts[ts_nr];
797 e1ts_dump_vty(vty, ts);
798 }
799 }
800 return CMD_SUCCESS;
801 }
802 if (argc >= 1) {
803 int num = atoi(argv[0]);
804 llist_for_each_entry(line, &e1inp_line_list, list) {
805 if (line->num == num)
806 break;
807 }
808 if (!line || line->num != num) {
809 vty_out(vty, "E1 line %s is invalid%s",
810 argv[0], VTY_NEWLINE);
811 return CMD_WARNING;
812 }
813 }
814 if (argc >= 2) {
815 ts_nr = atoi(argv[1]);
816 if (ts_nr > NUM_E1_TS) {
817 vty_out(vty, "E1 timeslot %s is invalid%s",
818 argv[1], VTY_NEWLINE);
819 return CMD_WARNING;
820 }
821 ts = &line->ts[ts_nr];
822 e1ts_dump_vty(vty, ts);
823 return CMD_SUCCESS;
824 } else {
825 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
826 ts = &line->ts[ts_nr];
827 e1ts_dump_vty(vty, ts);
828 }
829 return CMD_SUCCESS;
830 }
831 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000832}
833
Harald Weltebe4b7302009-05-23 16:59:33 +0000834static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
Harald Weltef5025b62009-03-28 16:55:11 +0000835{
836 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
837 subscr_dump_vty(vty, pag->subscr);
838}
839
Harald Weltebe4b7302009-05-23 16:59:33 +0000840static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
Harald Weltef5025b62009-03-28 16:55:11 +0000841{
842 struct gsm_paging_request *pag;
843
844 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
845 paging_dump_vty(vty, pag);
846}
847
848DEFUN(show_paging,
849 show_paging_cmd,
850 "show paging [bts_nr]",
Harald Weltebe4b7302009-05-23 16:59:33 +0000851 SHOW_STR "Display information about paging reuqests of a BTS\n")
Harald Weltef5025b62009-03-28 16:55:11 +0000852{
853 struct gsm_network *net = gsmnet;
854 struct gsm_bts *bts;
855 int bts_nr;
856
857 if (argc >= 1) {
858 /* use the BTS number that the user has specified */
859 bts_nr = atoi(argv[0]);
860 if (bts_nr >= net->num_bts) {
861 vty_out(vty, "%% can't find BTS %s%s", argv[0],
862 VTY_NEWLINE);
863 return CMD_WARNING;
864 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200865 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +0000866 bts_paging_dump_vty(vty, bts);
867
868 return CMD_SUCCESS;
869 }
870 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200871 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +0000872 bts_paging_dump_vty(vty, bts);
873 }
874
875 return CMD_SUCCESS;
876}
877
Harald Welte24ff6ee2009-12-22 00:41:05 +0100878DEFUN(show_stats,
879 show_stats_cmd,
880 "show statistics",
881 SHOW_STR "Display network statistics\n")
882{
883 struct gsm_network *net = gsmnet;
884
Harald Weltee2b8ece2009-12-22 21:47:48 +0100885 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
Harald Welteffa55a42009-12-22 19:07:32 +0100886 counter_get(net->stats.chreq.total),
887 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
Harald Weltee2b8ece2009-12-22 21:47:48 +0100888 vty_out(vty, "Location Update : %lu attach, %lu normal, %lu periodic%s",
Harald Welteffa55a42009-12-22 19:07:32 +0100889 counter_get(net->stats.loc_upd_type.attach),
890 counter_get(net->stats.loc_upd_type.normal),
891 counter_get(net->stats.loc_upd_type.periodic), VTY_NEWLINE);
Harald Weltee2b8ece2009-12-22 21:47:48 +0100892 vty_out(vty, "IMSI Detach Indications : %lu%s",
Harald Welteffa55a42009-12-22 19:07:32 +0100893 counter_get(net->stats.loc_upd_type.detach), VTY_NEWLINE);
Harald Welte24ff6ee2009-12-22 00:41:05 +0100894 vty_out(vty, "Location Update Response: %lu accept, %lu reject%s",
Harald Welteffa55a42009-12-22 19:07:32 +0100895 counter_get(net->stats.loc_upd_resp.accept),
896 counter_get(net->stats.loc_upd_resp.reject), VTY_NEWLINE);
Harald Weltee2b8ece2009-12-22 21:47:48 +0100897 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
Harald Welteffa55a42009-12-22 19:07:32 +0100898 counter_get(net->stats.paging.attempted),
899 counter_get(net->stats.paging.completed),
900 counter_get(net->stats.paging.expired), VTY_NEWLINE);
Harald Weltee2b8ece2009-12-22 21:47:48 +0100901 vty_out(vty, "Handover : %lu attempted, %lu no_channel, %lu timeout, "
Harald Welteffa55a42009-12-22 19:07:32 +0100902 "%lu completed, %lu failed%s",
903 counter_get(net->stats.handover.attempted),
904 counter_get(net->stats.handover.no_channel),
905 counter_get(net->stats.handover.timeout),
906 counter_get(net->stats.handover.completed),
907 counter_get(net->stats.handover.failed), VTY_NEWLINE);
Harald Weltee2b8ece2009-12-22 21:47:48 +0100908 vty_out(vty, "SMS MO : %lu submitted, %lu no receiver%s",
Harald Welteffa55a42009-12-22 19:07:32 +0100909 counter_get(net->stats.sms.submitted),
910 counter_get(net->stats.sms.no_receiver), VTY_NEWLINE);
Harald Weltee2b8ece2009-12-22 21:47:48 +0100911 vty_out(vty, "SMS MT : %lu delivered, %lu no memory, %lu other error%s",
Harald Welteffa55a42009-12-22 19:07:32 +0100912 counter_get(net->stats.sms.delivered),
913 counter_get(net->stats.sms.rp_err_mem),
914 counter_get(net->stats.sms.rp_err_other), VTY_NEWLINE);
Harald Welte24ff6ee2009-12-22 00:41:05 +0100915 return CMD_SUCCESS;
916}
917
Harald Welte5013b2a2009-08-07 13:29:14 +0200918DEFUN(cfg_net,
919 cfg_net_cmd,
920 "network",
921 "Configure the GSM network")
922{
923 vty->index = gsmnet;
924 vty->node = GSMNET_NODE;
925
926 return CMD_SUCCESS;
927}
928
929
930DEFUN(cfg_net_ncc,
931 cfg_net_ncc_cmd,
932 "network country code <1-999>",
933 "Set the GSM network country code")
934{
935 gsmnet->country_code = atoi(argv[0]);
936
937 return CMD_SUCCESS;
938}
939
940DEFUN(cfg_net_mnc,
941 cfg_net_mnc_cmd,
942 "mobile network code <1-999>",
943 "Set the GSM mobile network code")
944{
945 gsmnet->network_code = atoi(argv[0]);
946
947 return CMD_SUCCESS;
948}
949
950DEFUN(cfg_net_name_short,
951 cfg_net_name_short_cmd,
952 "short name NAME",
953 "Set the short GSM network name")
954{
955 if (gsmnet->name_short)
956 talloc_free(gsmnet->name_short);
957
958 gsmnet->name_short = talloc_strdup(gsmnet, argv[0]);
959
960 return CMD_SUCCESS;
961}
962
963DEFUN(cfg_net_name_long,
964 cfg_net_name_long_cmd,
965 "long name NAME",
966 "Set the long GSM network name")
967{
968 if (gsmnet->name_long)
969 talloc_free(gsmnet->name_long);
970
971 gsmnet->name_long = talloc_strdup(gsmnet, argv[0]);
972
973 return CMD_SUCCESS;
974}
Harald Welte40f82892009-05-23 17:31:39 +0000975
Harald Welte (local)69de3972009-08-12 14:42:23 +0200976DEFUN(cfg_net_auth_policy,
977 cfg_net_auth_policy_cmd,
978 "auth policy (closed|accept-all|token)",
979 "Set the GSM network authentication policy\n")
980{
981 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
982
983 gsmnet->auth_policy = policy;
984
985 return CMD_SUCCESS;
986}
987
Harald Welte1085c092009-11-18 20:33:19 +0100988DEFUN(cfg_net_reject_cause,
989 cfg_net_reject_cause_cmd,
990 "location updating reject cause <2-111>",
991 "Set the reject cause of location updating reject\n")
992{
993 gsmnet->reject_cause = atoi(argv[0]);
994
995 return CMD_SUCCESS;
996}
997
Harald Welte4381cfe2009-08-30 15:47:06 +0900998DEFUN(cfg_net_encryption,
999 cfg_net_encryption_cmd,
1000 "encryption a5 (0|1|2)",
1001 "Enable or disable encryption (A5) for this network\n")
1002{
Andreas.Eversberg1059deb2009-11-17 09:55:26 +01001003 gsmnet->a5_encryption= atoi(argv[0]);
Harald Welte4381cfe2009-08-30 15:47:06 +09001004
1005 return CMD_SUCCESS;
1006}
1007
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001008DEFUN(cfg_net_neci,
1009 cfg_net_neci_cmd,
1010 "neci (0|1)",
1011 "Set if NECI of cell selection is to be set")
1012{
1013 gsmnet->neci = atoi(argv[0]);
1014 return CMD_SUCCESS;
1015}
1016
Harald Welteeab84a12009-12-13 10:53:12 +01001017DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1018 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
1019 "Set the Radio Resource Location Protocol Mode")
1020{
1021 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1022
1023 return CMD_SUCCESS;
1024}
1025
Harald Welte648b6ce2009-12-14 09:00:24 +01001026DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1027 "mm info (0|1)",
1028 "Whether to send MM INFO after LOC UPD ACCEPT")
1029{
1030 gsmnet->send_mm_info = atoi(argv[0]);
1031
1032 return CMD_SUCCESS;
1033}
1034
Harald Weltebc814502009-12-19 21:41:52 +01001035DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1036 "handover (0|1)",
1037 "Whether or not to use in-call handover")
1038{
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001039 int enable = atoi(argv[0]);
1040
1041 if (enable && ipacc_rtp_direct) {
Harald Weltefe03f0d2009-12-20 13:51:01 +01001042 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1043 "is enabled by using the -P command line option%s",
1044 VTY_NEWLINE);
1045 return CMD_WARNING;
1046 }
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001047 gsmnet->handover.active = enable;
Harald Weltebc814502009-12-19 21:41:52 +01001048
1049 return CMD_SUCCESS;
1050}
1051
Harald Welteb720bd32009-12-21 16:51:50 +01001052DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1053 "handover window rxlev averaging <1-10>",
1054 "How many RxLev measurements are used for averaging")
1055{
1056 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1057 return CMD_SUCCESS;
1058}
1059
1060DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1061 "handover window rxqual averaging <1-10>",
1062 "How many RxQual measurements are used for averaging")
1063{
1064 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1065 return CMD_SUCCESS;
1066}
1067
1068DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1069 "handover window rxlev neighbor averaging <1-10>",
1070 "How many RxQual measurements are used for averaging")
1071{
1072 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1073 return CMD_SUCCESS;
1074}
1075
1076DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1077 "handover power budget interval <1-99>",
1078 "How often to check if we have a better cell (SACCH frames)")
1079{
1080 gsmnet->handover.pwr_interval = atoi(argv[0]);
1081 return CMD_SUCCESS;
1082}
1083
1084DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1085 "handover power budget hysteresis <0-999>",
1086 "How many dB does a neighbor to be stronger to become a HO candidate")
1087{
1088 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1089 return CMD_SUCCESS;
1090}
1091
1092DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1093 "handover maximum distance <0-9999>",
1094 "How big is the maximum timing advance before HO is forced")
1095{
1096 gsmnet->handover.max_distance = atoi(argv[0]);
1097 return CMD_SUCCESS;
1098}
Harald Weltebc814502009-12-19 21:41:52 +01001099
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001100#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001101 DEFUN(cfg_net_T##number, \
1102 cfg_net_T##number##_cmd, \
1103 "timer t" #number " <0-65535>", \
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001104 doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001105{ \
1106 int value = atoi(argv[0]); \
1107 \
1108 if (value < 0 || value > 65535) { \
1109 vty_out(vty, "Timer value %s out of range.%s", \
1110 argv[0], VTY_NEWLINE); \
1111 return CMD_WARNING; \
1112 } \
1113 \
1114 gsmnet->T##number = value; \
1115 return CMD_SUCCESS; \
1116}
1117
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001118DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1119DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1120DECLARE_TIMER(3105, "Currently not used.")
1121DECLARE_TIMER(3107, "Currently not used.")
1122DECLARE_TIMER(3109, "Currently not used.")
1123DECLARE_TIMER(3111, "Currently not used.")
1124DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1125DECLARE_TIMER(3115, "Currently not used.")
1126DECLARE_TIMER(3117, "Currently not used.")
1127DECLARE_TIMER(3119, "Currently not used.")
1128DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001129
1130
Harald Welte5258fc42009-03-28 19:07:53 +00001131/* per-BTS configuration */
1132DEFUN(cfg_bts,
1133 cfg_bts_cmd,
1134 "bts BTS_NR",
1135 "Select a BTS to configure\n")
1136{
1137 int bts_nr = atoi(argv[0]);
1138 struct gsm_bts *bts;
1139
Harald Weltee441d9c2009-06-21 16:17:15 +02001140 if (bts_nr > gsmnet->num_bts) {
1141 vty_out(vty, "%% The next unused BTS number is %u%s",
1142 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001143 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001144 } else if (bts_nr == gsmnet->num_bts) {
1145 /* allocate a new one */
1146 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1147 HARDCODED_TSC, HARDCODED_BSIC);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001148 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02001149 bts = gsm_bts_num(gsmnet, bts_nr);
1150
Daniel Willmannf15c2762010-01-11 13:43:07 +01001151 if (!bts) {
1152 vty_out(vty, "%% Unable to allocate BTS %u%s",
1153 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee441d9c2009-06-21 16:17:15 +02001154 return CMD_WARNING;
Daniel Willmannf15c2762010-01-11 13:43:07 +01001155 }
Harald Welte5258fc42009-03-28 19:07:53 +00001156
1157 vty->index = bts;
1158 vty->node = BTS_NODE;
1159
1160 return CMD_SUCCESS;
1161}
1162
1163DEFUN(cfg_bts_type,
1164 cfg_bts_type_cmd,
1165 "type TYPE",
1166 "Set the BTS type\n")
1167{
1168 struct gsm_bts *bts = vty->index;
Harald Welte39315c42010-01-10 18:01:52 +01001169 int rc;
Harald Welte5258fc42009-03-28 19:07:53 +00001170
Harald Welte39315c42010-01-10 18:01:52 +01001171 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1172 if (rc < 0)
1173 return CMD_WARNING;
Harald Welte8175e952009-10-20 00:22:00 +02001174
Harald Welte5258fc42009-03-28 19:07:53 +00001175 return CMD_SUCCESS;
1176}
1177
Harald Weltefcd24452009-06-20 18:15:19 +02001178DEFUN(cfg_bts_band,
1179 cfg_bts_band_cmd,
1180 "band BAND",
1181 "Set the frequency band of this BTS\n")
1182{
1183 struct gsm_bts *bts = vty->index;
Harald Welte42581822009-08-08 16:12:58 +02001184 int band = gsm_band_parse(argv[0]);
Harald Weltefcd24452009-06-20 18:15:19 +02001185
1186 if (band < 0) {
1187 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1188 band, VTY_NEWLINE);
1189 return CMD_WARNING;
1190 }
1191
1192 bts->band = band;
1193
1194 return CMD_SUCCESS;
1195}
1196
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001197DEFUN(cfg_bts_ci,
1198 cfg_bts_ci_cmd,
1199 "cell_identity <0-65535>",
1200 "Set the Cell identity of this BTS\n")
1201{
1202 struct gsm_bts *bts = vty->index;
1203 int ci = atoi(argv[0]);
1204
1205 if (ci < 0 || ci > 0xffff) {
1206 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1207 ci, VTY_NEWLINE);
1208 return CMD_WARNING;
1209 }
1210 bts->cell_identity = ci;
1211
1212 return CMD_SUCCESS;
1213}
1214
Harald Welte5258fc42009-03-28 19:07:53 +00001215DEFUN(cfg_bts_lac,
1216 cfg_bts_lac_cmd,
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001217 "location_area_code <0-65535>",
Harald Welte5258fc42009-03-28 19:07:53 +00001218 "Set the Location Area Code (LAC) of this BTS\n")
1219{
1220 struct gsm_bts *bts = vty->index;
1221 int lac = atoi(argv[0]);
1222
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001223 if (lac < 0 || lac > 0xffff) {
1224 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte5258fc42009-03-28 19:07:53 +00001225 lac, VTY_NEWLINE);
1226 return CMD_WARNING;
1227 }
Holger Hans Peter Freythere48b9562009-10-01 04:07:15 +02001228
1229 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1230 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1231 lac, VTY_NEWLINE);
1232 return CMD_WARNING;
1233 }
1234
Harald Welte5258fc42009-03-28 19:07:53 +00001235 bts->location_area_code = lac;
1236
1237 return CMD_SUCCESS;
1238}
1239
Harald Weltea43f7892009-12-01 18:04:30 +05301240
Harald Welte5258fc42009-03-28 19:07:53 +00001241DEFUN(cfg_bts_tsc,
1242 cfg_bts_tsc_cmd,
1243 "training_sequence_code <0-255>",
1244 "Set the Training Sequence Code (TSC) of this BTS\n")
1245{
1246 struct gsm_bts *bts = vty->index;
1247 int tsc = atoi(argv[0]);
1248
1249 if (tsc < 0 || tsc > 0xff) {
1250 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1251 tsc, VTY_NEWLINE);
1252 return CMD_WARNING;
1253 }
1254 bts->tsc = tsc;
1255
1256 return CMD_SUCCESS;
1257}
1258
Harald Welte78f2f502009-05-23 16:56:52 +00001259DEFUN(cfg_bts_bsic,
1260 cfg_bts_bsic_cmd,
1261 "base_station_id_code <0-63>",
1262 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1263{
1264 struct gsm_bts *bts = vty->index;
1265 int bsic = atoi(argv[0]);
1266
1267 if (bsic < 0 || bsic > 0x3f) {
Harald Welte42581822009-08-08 16:12:58 +02001268 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte78f2f502009-05-23 16:56:52 +00001269 bsic, VTY_NEWLINE);
1270 return CMD_WARNING;
1271 }
1272 bts->bsic = bsic;
1273
1274 return CMD_SUCCESS;
1275}
1276
1277
Harald Welte4cc34222009-05-01 15:12:31 +00001278DEFUN(cfg_bts_unit_id,
1279 cfg_bts_unit_id_cmd,
Harald Welte07dc73d2009-08-07 13:27:09 +02001280 "ip.access unit_id <0-65534> <0-255>",
1281 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte4cc34222009-05-01 15:12:31 +00001282{
1283 struct gsm_bts *bts = vty->index;
1284 int site_id = atoi(argv[0]);
1285 int bts_id = atoi(argv[1]);
1286
Harald Welte07dc73d2009-08-07 13:27:09 +02001287 if (!is_ipaccess_bts(bts)) {
1288 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1289 return CMD_WARNING;
1290 }
1291
Harald Welte4cc34222009-05-01 15:12:31 +00001292 bts->ip_access.site_id = site_id;
1293 bts->ip_access.bts_id = bts_id;
1294
1295 return CMD_SUCCESS;
1296}
1297
Harald Welte8175e952009-10-20 00:22:00 +02001298DEFUN(cfg_bts_stream_id,
1299 cfg_bts_stream_id_cmd,
1300 "oml ip.access stream_id <0-255>",
1301 "Set the ip.access Stream ID of the OML link of this BTS\n")
1302{
1303 struct gsm_bts *bts = vty->index;
1304 int stream_id = atoi(argv[0]);
1305
1306 if (!is_ipaccess_bts(bts)) {
1307 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1308 return CMD_WARNING;
1309 }
1310
1311 bts->oml_tei = stream_id;
1312
1313 return CMD_SUCCESS;
1314}
1315
1316
Harald Welte42581822009-08-08 16:12:58 +02001317DEFUN(cfg_bts_oml_e1,
1318 cfg_bts_oml_e1_cmd,
1319 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
1320 "E1 interface to be used for OML\n")
1321{
1322 struct gsm_bts *bts = vty->index;
1323
1324 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1325
1326 return CMD_SUCCESS;
1327}
1328
1329
1330DEFUN(cfg_bts_oml_e1_tei,
1331 cfg_bts_oml_e1_tei_cmd,
1332 "oml e1 tei <0-63>",
1333 "Set the TEI to be used for OML")
1334{
1335 struct gsm_bts *bts = vty->index;
1336
1337 bts->oml_tei = atoi(argv[0]);
1338
1339 return CMD_SUCCESS;
1340}
1341
Harald Welte7a8fa412009-08-10 13:48:16 +02001342DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1343 "channel allocator (ascending|descending)",
1344 "Should the channel allocator allocate in reverse TRX order?")
1345{
1346 struct gsm_bts *bts = vty->index;
1347
1348 if (!strcmp(argv[0], "ascending"))
1349 bts->chan_alloc_reverse = 0;
1350 else
1351 bts->chan_alloc_reverse = 1;
1352
1353 return CMD_SUCCESS;
1354}
1355
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001356DEFUN(cfg_bts_rach_tx_integer,
1357 cfg_bts_rach_tx_integer_cmd,
1358 "rach tx integer <0-15>",
1359 "Set the raw tx integer value in RACH Control parameters IE")
1360{
1361 struct gsm_bts *bts = vty->index;
1362 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1363 return CMD_SUCCESS;
1364}
1365
1366DEFUN(cfg_bts_rach_max_trans,
1367 cfg_bts_rach_max_trans_cmd,
1368 "rach max transmission (1|2|4|7)",
1369 "Set the maximum number of RACH burst transmissions")
1370{
1371 struct gsm_bts *bts = vty->index;
1372 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1373 return CMD_SUCCESS;
1374}
1375
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001376DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1377 "cell barred (0|1)",
1378 "Should this cell be barred from access?")
1379{
1380 struct gsm_bts *bts = vty->index;
1381
Harald Welte71355012009-12-21 23:08:18 +01001382 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001383
1384 return CMD_SUCCESS;
1385}
1386
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001387DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1388 "ms max power <0-40>",
1389 "Maximum transmit power of the MS")
1390{
1391 struct gsm_bts *bts = vty->index;
1392
1393 bts->ms_max_power = atoi(argv[0]);
1394
1395 return CMD_SUCCESS;
1396}
1397
Harald Welte73225282009-12-12 18:17:25 +01001398DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1399 "cell reselection hysteresis <0-14>",
1400 "Cell Re-Selection Hysteresis in dB")
1401{
1402 struct gsm_bts *bts = vty->index;
1403
1404 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1405
1406 return CMD_SUCCESS;
1407}
1408
1409DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1410 "rxlev access min <0-63>",
1411 "Minimum RxLev needed for cell access (better than -110dBm)")
1412{
1413 struct gsm_bts *bts = vty->index;
1414
1415 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1416
1417 return CMD_SUCCESS;
1418}
1419
Harald Welte (local)efc92312009-08-14 23:09:25 +02001420DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1421 "periodic location update <0-1530>",
1422 "Periodic Location Updating Interval in Minutes")
1423{
1424 struct gsm_bts *bts = vty->index;
1425
Harald Weltea43f7892009-12-01 18:04:30 +05301426 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 10;
Harald Welte (local)efc92312009-08-14 23:09:25 +02001427
1428 return CMD_SUCCESS;
1429}
1430
Harald Welteaf387632010-03-14 23:30:30 +08001431DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welte97a282b2010-03-14 15:37:43 +08001432 "gprs cell bvci <0-65535>",
1433 "GPRS BSSGP VC Identifier")
1434{
1435 struct gsm_bts *bts = vty->index;
1436
Harald Welte94036702010-03-14 23:56:56 +08001437 if (!bts->gprs.enabled) {
1438 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1439 return CMD_WARNING;
1440 }
1441
Harald Welte97a282b2010-03-14 15:37:43 +08001442 bts->gprs.cell.bvci = atoi(argv[0]);
1443
1444 return CMD_SUCCESS;
1445}
1446
Harald Weltea5731cf2010-03-22 11:48:36 +08001447DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
1448 "gprs nsei <0-65535>",
1449 "GPRS NS Entity Identifier")
1450{
1451 struct gsm_bts *bts = vty->index;
1452
1453 if (!bts->gprs.enabled) {
1454 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1455 return CMD_WARNING;
1456 }
1457
1458 bts->gprs.nse.nsei = atoi(argv[0]);
1459
1460 return CMD_SUCCESS;
1461}
1462
1463
Harald Welte97a282b2010-03-14 15:37:43 +08001464DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
1465 "gprs nsvc <0-1> nsvci <0-65535>",
1466 "GPRS NS VC Identifier")
1467{
1468 struct gsm_bts *bts = vty->index;
1469 int idx = atoi(argv[0]);
1470
Harald Welte94036702010-03-14 23:56:56 +08001471 if (!bts->gprs.enabled) {
1472 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1473 return CMD_WARNING;
1474 }
1475
Harald Welte97a282b2010-03-14 15:37:43 +08001476 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
1477
1478 return CMD_SUCCESS;
1479}
1480
Harald Welteaf387632010-03-14 23:30:30 +08001481DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
1482 "gprs nsvc <0-1> local udp port <0-65535>",
1483 "GPRS NS Local UDP Port")
1484{
1485 struct gsm_bts *bts = vty->index;
1486 int idx = atoi(argv[0]);
1487
Harald Welte94036702010-03-14 23:56:56 +08001488 if (!bts->gprs.enabled) {
1489 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1490 return CMD_WARNING;
1491 }
1492
Harald Welteaf387632010-03-14 23:30:30 +08001493 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
1494
1495 return CMD_SUCCESS;
1496}
1497
1498DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
1499 "gprs nsvc <0-1> remote udp port <0-65535>",
1500 "GPRS NS Remote UDP Port")
1501{
1502 struct gsm_bts *bts = vty->index;
1503 int idx = atoi(argv[0]);
1504
Harald Welte94036702010-03-14 23:56:56 +08001505 if (!bts->gprs.enabled) {
1506 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1507 return CMD_WARNING;
1508 }
1509
Harald Welteaf387632010-03-14 23:30:30 +08001510 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
1511
1512 return CMD_SUCCESS;
1513}
1514
1515DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
1516 "gprs nsvc <0-1> remote ip A.B.C.D",
1517 "GPRS NS Remote IP Address")
1518{
1519 struct gsm_bts *bts = vty->index;
1520 int idx = atoi(argv[0]);
1521 struct in_addr ia;
1522
Harald Welte94036702010-03-14 23:56:56 +08001523 if (!bts->gprs.enabled) {
1524 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1525 return CMD_WARNING;
1526 }
1527
Harald Welteaf387632010-03-14 23:30:30 +08001528 inet_aton(argv[1], &ia);
1529 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
1530
1531 return CMD_SUCCESS;
1532}
1533
Harald Welte97a282b2010-03-14 15:37:43 +08001534DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
1535 "gprs routing area <0-255>",
1536 "GPRS Routing Area Code")
1537{
1538 struct gsm_bts *bts = vty->index;
1539
Harald Welte94036702010-03-14 23:56:56 +08001540 if (!bts->gprs.enabled) {
1541 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1542 return CMD_WARNING;
1543 }
1544
Harald Welte97a282b2010-03-14 15:37:43 +08001545 bts->gprs.rac = atoi(argv[0]);
1546
1547 return CMD_SUCCESS;
1548}
1549
Harald Welteaf387632010-03-14 23:30:30 +08001550DEFUN(cfg_bts_gprs_enabled, cfg_bts_gprs_enabled_cmd,
1551 "gprs enabled <0-1>",
1552 "GPRS Enabled on this BTS")
1553{
1554 struct gsm_bts *bts = vty->index;
1555
1556 bts->gprs.enabled = atoi(argv[0]);
1557
1558 return CMD_SUCCESS;
1559}
1560
Harald Welte7a8fa412009-08-10 13:48:16 +02001561
Harald Welte5258fc42009-03-28 19:07:53 +00001562/* per TRX configuration */
1563DEFUN(cfg_trx,
1564 cfg_trx_cmd,
1565 "trx TRX_NR",
1566 "Select a TRX to configure")
1567{
1568 int trx_nr = atoi(argv[0]);
1569 struct gsm_bts *bts = vty->index;
1570 struct gsm_bts_trx *trx;
1571
Harald Weltee441d9c2009-06-21 16:17:15 +02001572 if (trx_nr > bts->num_trx) {
1573 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
1574 bts->num_trx, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001575 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001576 } else if (trx_nr == bts->num_trx) {
1577 /* we need to allocate a new one */
1578 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001579 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02001580 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001581
Harald Weltee441d9c2009-06-21 16:17:15 +02001582 if (!trx)
1583 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +00001584
1585 vty->index = trx;
1586 vty->node = TRX_NODE;
1587
1588 return CMD_SUCCESS;
1589}
1590
1591DEFUN(cfg_trx_arfcn,
1592 cfg_trx_arfcn_cmd,
1593 "arfcn <1-1024>",
1594 "Set the ARFCN for this TRX\n")
1595{
1596 int arfcn = atoi(argv[0]);
1597 struct gsm_bts_trx *trx = vty->index;
1598
1599 /* FIXME: check if this ARFCN is supported by this TRX */
1600
1601 trx->arfcn = arfcn;
1602
1603 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
1604 /* FIXME: use OML layer to update the ARFCN */
1605 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
1606
1607 return CMD_SUCCESS;
1608}
1609
Harald Welte (local)7b37d972009-12-27 20:56:38 +01001610DEFUN(cfg_trx_nominal_power,
1611 cfg_trx_nominal_power_cmd,
1612 "nominal power <0-100>",
1613 "Nominal TRX RF Power in dB\n")
1614{
1615 struct gsm_bts_trx *trx = vty->index;
1616
1617 trx->nominal_power = atoi(argv[0]);
1618
1619 return CMD_SUCCESS;
1620}
1621
Harald Weltefcd24452009-06-20 18:15:19 +02001622DEFUN(cfg_trx_max_power_red,
1623 cfg_trx_max_power_red_cmd,
1624 "max_power_red <0-100>",
1625 "Reduction of maximum BS RF Power in dB\n")
1626{
1627 int maxpwr_r = atoi(argv[0]);
1628 struct gsm_bts_trx *trx = vty->index;
Harald Welte61a83b22009-11-18 09:20:22 +01001629 int upper_limit = 24; /* default 12.21 max power red. */
Harald Weltefcd24452009-06-20 18:15:19 +02001630
1631 /* FIXME: check if our BTS type supports more than 12 */
1632 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
1633 vty_out(vty, "%% Power %d dB is not in the valid range%s",
1634 maxpwr_r, VTY_NEWLINE);
1635 return CMD_WARNING;
1636 }
1637 if (maxpwr_r & 1) {
1638 vty_out(vty, "%% Power %d dB is not an even value%s",
1639 maxpwr_r, VTY_NEWLINE);
1640 return CMD_WARNING;
1641 }
1642
1643 trx->max_power_red = maxpwr_r;
1644
1645 /* FIXME: make sure we update this using OML */
1646
1647 return CMD_SUCCESS;
1648}
1649
Harald Welte42581822009-08-08 16:12:58 +02001650DEFUN(cfg_trx_rsl_e1,
1651 cfg_trx_rsl_e1_cmd,
1652 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
1653 "E1 interface to be used for RSL\n")
1654{
1655 struct gsm_bts_trx *trx = vty->index;
1656
1657 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
1658
1659 return CMD_SUCCESS;
1660}
1661
1662DEFUN(cfg_trx_rsl_e1_tei,
1663 cfg_trx_rsl_e1_tei_cmd,
1664 "rsl e1 tei <0-63>",
1665 "Set the TEI to be used for RSL")
1666{
1667 struct gsm_bts_trx *trx = vty->index;
1668
1669 trx->rsl_tei = atoi(argv[0]);
1670
1671 return CMD_SUCCESS;
1672}
1673
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01001674DEFUN(cfg_trx_rf_locked,
1675 cfg_trx_rf_locked_cmd,
1676 "rf_locked (0|1)",
1677 "Turn off RF of the TRX.\n")
1678{
1679 int locked = atoi(argv[0]);
1680 struct gsm_bts_trx *trx = vty->index;
1681
1682 gsm_trx_lock_rf(trx, locked);
1683 return CMD_SUCCESS;
1684}
Harald Welte42581822009-08-08 16:12:58 +02001685
Harald Welte5258fc42009-03-28 19:07:53 +00001686/* per TS configuration */
1687DEFUN(cfg_ts,
1688 cfg_ts_cmd,
Harald Welte42581822009-08-08 16:12:58 +02001689 "timeslot <0-7>",
Harald Welte5258fc42009-03-28 19:07:53 +00001690 "Select a Timeslot to configure")
1691{
1692 int ts_nr = atoi(argv[0]);
1693 struct gsm_bts_trx *trx = vty->index;
1694 struct gsm_bts_trx_ts *ts;
1695
1696 if (ts_nr >= TRX_NR_TS) {
1697 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
1698 TRX_NR_TS, VTY_NEWLINE);
1699 return CMD_WARNING;
1700 }
1701
1702 ts = &trx->ts[ts_nr];
1703
1704 vty->index = ts;
1705 vty->node = TS_NODE;
1706
1707 return CMD_SUCCESS;
1708}
1709
Harald Weltea6fd58e2009-08-07 00:25:23 +02001710DEFUN(cfg_ts_pchan,
1711 cfg_ts_pchan_cmd,
1712 "phys_chan_config PCHAN",
1713 "Physical Channel configuration (TCH/SDCCH/...)")
1714{
1715 struct gsm_bts_trx_ts *ts = vty->index;
1716 int pchanc;
1717
1718 pchanc = gsm_pchan_parse(argv[0]);
1719 if (pchanc < 0)
1720 return CMD_WARNING;
1721
1722 ts->pchan = pchanc;
1723
1724 return CMD_SUCCESS;
1725}
1726
1727DEFUN(cfg_ts_e1_subslot,
1728 cfg_ts_e1_subslot_cmd,
Harald Welte42581822009-08-08 16:12:58 +02001729 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltea6fd58e2009-08-07 00:25:23 +02001730 "E1 sub-slot connected to this on-air timeslot")
1731{
1732 struct gsm_bts_trx_ts *ts = vty->index;
1733
Harald Welte42581822009-08-08 16:12:58 +02001734 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Weltea6fd58e2009-08-07 00:25:23 +02001735
1736 return CMD_SUCCESS;
1737}
Harald Welte5258fc42009-03-28 19:07:53 +00001738
Holger Hans Peter Freythere1ffc082010-04-10 00:08:28 +02001739extern int bsc_vty_init_extra(struct gsm_network *net);
1740
Harald Welte68628e82009-03-10 12:17:57 +00001741int bsc_vty_init(struct gsm_network *net)
1742{
1743 gsmnet = net;
1744
1745 cmd_init(1);
1746 vty_init();
1747
1748 install_element(VIEW_NODE, &show_net_cmd);
1749 install_element(VIEW_NODE, &show_bts_cmd);
1750 install_element(VIEW_NODE, &show_trx_cmd);
1751 install_element(VIEW_NODE, &show_ts_cmd);
1752 install_element(VIEW_NODE, &show_lchan_cmd);
Harald Welte1bc77352009-03-10 19:47:51 +00001753
1754 install_element(VIEW_NODE, &show_e1drv_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001755 install_element(VIEW_NODE, &show_e1line_cmd);
1756 install_element(VIEW_NODE, &show_e1ts_cmd);
1757
Harald Weltef5025b62009-03-28 16:55:11 +00001758 install_element(VIEW_NODE, &show_paging_cmd);
Harald Welte24ff6ee2009-12-22 00:41:05 +01001759 install_element(VIEW_NODE, &show_stats_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00001760
Holger Hans Peter Freyther3c712322010-04-06 11:55:37 +02001761 openbsc_vty_add_cmds();
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +01001762
Harald Welte5013b2a2009-08-07 13:29:14 +02001763 install_element(CONFIG_NODE, &cfg_net_cmd);
1764 install_node(&net_node, config_write_net);
1765 install_default(GSMNET_NODE);
Harald Welte42581822009-08-08 16:12:58 +02001766 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02001767 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
1768 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
1769 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)69de3972009-08-12 14:42:23 +02001770 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte1085c092009-11-18 20:33:19 +01001771 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Welte4381cfe2009-08-30 15:47:06 +09001772 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001773 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welteeab84a12009-12-13 10:53:12 +01001774 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte3d23db42009-12-14 17:49:15 +01001775 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Weltebc814502009-12-19 21:41:52 +01001776 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Welteb720bd32009-12-21 16:51:50 +01001777 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
1778 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
1779 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
1780 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
1781 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
1782 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001783 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01001784 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
1785 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
1786 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
1787 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
1788 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
1789 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
1790 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
1791 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
1792 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
1793 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02001794
1795 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte67ce0732009-08-06 19:06:46 +02001796 install_node(&bts_node, config_write_bts);
Harald Welte68628e82009-03-10 12:17:57 +00001797 install_default(BTS_NODE);
Harald Welte5258fc42009-03-28 19:07:53 +00001798 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Weltefcd24452009-06-20 18:15:19 +02001799 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001800 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00001801 install_element(BTS_NODE, &cfg_bts_lac_cmd);
1802 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte42581822009-08-08 16:12:58 +02001803 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte4cc34222009-05-01 15:12:31 +00001804 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte8175e952009-10-20 00:22:00 +02001805 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte42581822009-08-08 16:12:58 +02001806 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
1807 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02001808 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001809 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
1810 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001811 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001812 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)efc92312009-08-14 23:09:25 +02001813 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welte73225282009-12-12 18:17:25 +01001814 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
1815 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Harald Welteaf387632010-03-14 23:30:30 +08001816 install_element(BTS_NODE, &cfg_bts_gprs_enabled_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08001817 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
1818 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Weltea5731cf2010-03-22 11:48:36 +08001819 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08001820 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welteaf387632010-03-14 23:30:30 +08001821 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
1822 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
1823 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001824
Harald Welte5258fc42009-03-28 19:07:53 +00001825 install_element(BTS_NODE, &cfg_trx_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001826 install_node(&trx_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00001827 install_default(TRX_NODE);
Harald Welte5258fc42009-03-28 19:07:53 +00001828 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte (local)7b37d972009-12-27 20:56:38 +01001829 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte879dc972009-06-20 22:36:12 +02001830 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte42581822009-08-08 16:12:58 +02001831 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
1832 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01001833 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001834
Harald Welte5258fc42009-03-28 19:07:53 +00001835 install_element(TRX_NODE, &cfg_ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001836 install_node(&ts_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00001837 install_default(TS_NODE);
Harald Weltea6fd58e2009-08-07 00:25:23 +02001838 install_element(TS_NODE, &cfg_ts_pchan_cmd);
1839 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001840
Holger Hans Peter Freythercfa90d42009-08-10 10:17:50 +02001841 bsc_vty_init_extra(net);
Harald Welte40f82892009-05-23 17:31:39 +00001842
Harald Welte68628e82009-03-10 12:17:57 +00001843 return 0;
1844}