blob: ad49bd580be848bca9818c481f49bcd6e3a024fe [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
Harald Weltebd9591f2010-05-19 19:45:32 +020025#include <osmocom/vty/command.h>
26#include <osmocom/vty/buffer.h>
27#include <osmocom/vty/vty.h>
28#include <osmocom/vty/logging.h>
29#include <osmocom/vty/telnet_interface.h>
Harald Welte59b04682009-06-10 05:40:52 +080030
31#include <arpa/inet.h>
32
Harald Weltef4625b12010-02-20 16:24:02 +010033#include <osmocore/linuxlist.h>
Harald Welte59b04682009-06-10 05:40:52 +080034#include <openbsc/gsm_data.h>
Harald Welte59b04682009-06-10 05:40:52 +080035#include <openbsc/e1_input.h>
36#include <openbsc/abis_nm.h>
Harald Weltef4625b12010-02-20 16:24:02 +010037#include <osmocore/gsm_utils.h>
Harald Weltefe96f382009-12-22 13:09:29 +010038#include <openbsc/chan_alloc.h>
Harald Welte44007742009-12-22 21:43:14 +010039#include <openbsc/meas_rep.h>
Harald Welte59b04682009-06-10 05:40:52 +080040#include <openbsc/db.h>
Harald Weltef4625b12010-02-20 16:24:02 +010041#include <osmocore/talloc.h>
Holger Hans Peter Freytherb70d45b2010-04-06 11:55:37 +020042#include <openbsc/vty.h>
Harald Weltef45981f2010-05-12 20:28:04 +020043#include <openbsc/gprs_ns.h>
Harald Welte682ee5f2010-05-16 22:02:16 +020044#include <openbsc/debug.h>
Harald Welte59b04682009-06-10 05:40:52 +080045
Harald Welte10c29f62010-05-16 19:20:24 +020046#include "../bscconfig.h"
47
Harald Welted6b62e32010-05-12 17:19:53 +000048/* FIXME: this should go to some common file */
49static const struct value_string gprs_ns_timer_strs[] = {
Harald Weltea9251762010-05-11 23:50:21 +020050 { 0, "tns-block" },
51 { 1, "tns-block-retries" },
52 { 2, "tns-reset" },
53 { 3, "tns-reset-retries" },
54 { 4, "tns-test" },
55 { 5, "tns-alive" },
56 { 6, "tns-alive-retries" },
57 { 0, NULL }
58};
59
Harald Welted6b62e32010-05-12 17:19:53 +000060static const struct value_string gprs_bssgp_cfg_strs[] = {
Harald Weltea9251762010-05-11 23:50:21 +020061 { 0, "blocking-timer" },
62 { 1, "blocking-retries" },
63 { 2, "unblocking-retries" },
64 { 3, "reset-timer" },
65 { 4, "reset-retries" },
66 { 5, "suspend-timer" },
67 { 6, "suspend-retries" },
68 { 7, "resume-timer" },
69 { 8, "resume-retries" },
70 { 9, "capability-update-timer" },
71 { 10, "capability-update-retries" },
72 { 0, NULL }
73};
74
Harald Weltee87eb462009-08-07 13:29:14 +020075struct cmd_node net_node = {
76 GSMNET_NODE,
77 "%s(network)#",
78 1,
79};
80
Harald Welte59b04682009-06-10 05:40:52 +080081struct cmd_node bts_node = {
82 BTS_NODE,
83 "%s(bts)#",
84 1,
85};
86
87struct cmd_node trx_node = {
88 TRX_NODE,
89 "%s(trx)#",
90 1,
91};
92
93struct cmd_node ts_node = {
94 TS_NODE,
95 "%s(ts)#",
96 1,
97};
98
Harald Welte40152872010-05-16 20:52:23 +020099struct gsm_network *gsmnet_from_vty(struct vty *v)
100{
101 struct telnet_connection *conn = v->priv;
102 return (struct gsm_network *) conn->priv;
103}
104
Harald Welte59b04682009-06-10 05:40:52 +0800105static int dummy_config_write(struct vty *v)
106{
107 return CMD_SUCCESS;
108}
109
110static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
111{
112 vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s",
113 nm_opstate_name(nms->operational), nms->administrative,
114 nm_avail_name(nms->availability), VTY_NEWLINE);
115}
116
Harald Weltefe96f382009-12-22 13:09:29 +0100117static void dump_pchan_load_vty(struct vty *vty, char *prefix,
118 const struct pchan_load *pl)
119{
120 int i;
121
122 for (i = 0; i < ARRAY_SIZE(pl->pchan); i++) {
123 const struct load_counter *lc = &pl->pchan[i];
124 unsigned int percent;
125
126 if (lc->total == 0)
127 continue;
128
129 percent = (lc->used * 100) / lc->total;
130
131 vty_out(vty, "%s%20s: %3u%% (%u/%u)%s", prefix,
132 gsm_pchan_name(i), percent, lc->used, lc->total,
133 VTY_NEWLINE);
134 }
135}
136
Harald Welte59b04682009-06-10 05:40:52 +0800137static void net_dump_vty(struct vty *vty, struct gsm_network *net)
138{
Harald Weltefe96f382009-12-22 13:09:29 +0100139 struct pchan_load pl;
140
Harald Welte59b04682009-06-10 05:40:52 +0800141 vty_out(vty, "BSC is on Country Code %u, Network Code %u "
142 "and has %u BTS%s", net->country_code, net->network_code,
143 net->num_bts, VTY_NEWLINE);
144 vty_out(vty, " Long network name: '%s'%s",
145 net->name_long, VTY_NEWLINE);
146 vty_out(vty, " Short network name: '%s'%s",
147 net->name_short, VTY_NEWLINE);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +0200148 vty_out(vty, " Authentication policy: %s%s",
149 gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE);
Harald Welte59936d72009-11-18 20:33:19 +0100150 vty_out(vty, " Location updating reject cause: %u%s",
151 net->reject_cause, VTY_NEWLINE);
Harald Weltecca253a2009-08-30 15:47:06 +0900152 vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption,
153 VTY_NEWLINE);
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +0100154 vty_out(vty, " NECI (TCH/H): %u%s", net->neci,
155 VTY_NEWLINE);
Harald Welte52af1952009-12-13 10:53:12 +0100156 vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode),
157 VTY_NEWLINE);
Harald Weltea310f3e2009-12-14 09:00:24 +0100158 vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off",
159 VTY_NEWLINE);
Harald Welte0af9c9f2009-12-19 21:41:52 +0100160 vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off",
161 VTY_NEWLINE);
Harald Weltefe96f382009-12-22 13:09:29 +0100162 network_chan_load(&pl, net);
163 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
164 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte59b04682009-06-10 05:40:52 +0800165}
166
167DEFUN(show_net, show_net_cmd, "show network",
168 SHOW_STR "Display information about a GSM NETWORK\n")
169{
Harald Welte40152872010-05-16 20:52:23 +0200170 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800171 net_dump_vty(vty, net);
172
173 return CMD_SUCCESS;
174}
175
176static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l)
177{
178 struct e1inp_line *line;
179
180 if (!e1l) {
181 vty_out(vty, " None%s", VTY_NEWLINE);
182 return;
183 }
184
185 line = e1l->ts->line;
186
187 vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s",
188 line->num, line->driver->name, e1l->ts->num,
189 e1inp_signtype_name(e1l->type), VTY_NEWLINE);
190 vty_out(vty, " E1 TEI %u, SAPI %u%s",
191 e1l->tei, e1l->sapi, VTY_NEWLINE);
192}
193
194static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
195{
Harald Weltefe96f382009-12-22 13:09:29 +0100196 struct pchan_load pl;
197
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +0200198 vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
Harald Welte91afe4c2009-06-20 18:15:19 +0200199 "BSIC %u, TSC %u and %u TRX%s",
200 bts->nr, btstype2str(bts->type), gsm_band_name(bts->band),
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +0200201 bts->cell_identity,
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +0200202 bts->location_area_code, bts->bsic, bts->tsc,
Harald Welte91afe4c2009-06-20 18:15:19 +0200203 bts->num_trx, VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200204 vty_out(vty, "Description: %s%s",
205 bts->description ? bts->description : "(null)", VTY_NEWLINE);
Harald Welte8e9d1792009-12-12 15:38:16 +0100206 vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100207 vty_out(vty, "Minimum Rx Level for Access: %i dBm%s",
Harald Welte8e9d1792009-12-12 15:38:16 +0100208 rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min),
209 VTY_NEWLINE);
210 vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s",
Harald Welteb761bf82009-12-12 18:17:25 +0100211 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +0100212 vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer,
213 VTY_NEWLINE);
214 vty_out(vty, "RACH Max transmissions: %u%s",
215 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
216 VTY_NEWLINE);
Harald Welte8c973ba2009-12-21 23:08:18 +0100217 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)e19be3f2009-08-12 13:28:23 +0200218 vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800219 if (is_ipaccess_bts(bts))
Harald Welte25572872009-10-20 00:22:00 +0200220 vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
Harald Welte59b04682009-06-10 05:40:52 +0800221 bts->ip_access.site_id, bts->ip_access.bts_id,
Harald Welte25572872009-10-20 00:22:00 +0200222 bts->oml_tei, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800223 vty_out(vty, " NM State: ");
224 net_dump_nmstate(vty, &bts->nm_state);
225 vty_out(vty, " Site Mgr NM State: ");
226 net_dump_nmstate(vty, &bts->site_mgr.nm_state);
227 vty_out(vty, " Paging: FIXME pending requests, %u free slots%s",
228 bts->paging.available_slots, VTY_NEWLINE);
Harald Welte25572872009-10-20 00:22:00 +0200229 if (!is_ipaccess_bts(bts)) {
230 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
231 e1isl_dump_vty(vty, bts->oml_link);
232 }
Harald Welte59b04682009-06-10 05:40:52 +0800233 /* FIXME: oml_link, chan_desc */
Harald Weltefe96f382009-12-22 13:09:29 +0100234 memset(&pl, 0, sizeof(pl));
235 bts_chan_load(&pl, bts);
236 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
237 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte59b04682009-06-10 05:40:52 +0800238}
239
240DEFUN(show_bts, show_bts_cmd, "show bts [number]",
241 SHOW_STR "Display information about a BTS\n"
242 "BTS number")
243{
Harald Welte40152872010-05-16 20:52:23 +0200244 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800245 int bts_nr;
246
247 if (argc != 0) {
248 /* use the BTS number that the user has specified */
249 bts_nr = atoi(argv[0]);
250 if (bts_nr > net->num_bts) {
251 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
252 VTY_NEWLINE);
253 return CMD_WARNING;
254 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200255 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte59b04682009-06-10 05:40:52 +0800256 return CMD_SUCCESS;
257 }
258 /* print all BTS's */
259 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee712a5f2009-06-21 16:17:15 +0200260 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte59b04682009-06-10 05:40:52 +0800261
262 return CMD_SUCCESS;
263}
264
Harald Welte62868882009-08-08 16:12:58 +0200265/* utility functions */
266static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
267 const char *ts, const char *ss)
268{
269 e1_link->e1_nr = atoi(line);
270 e1_link->e1_ts = atoi(ts);
271 if (!strcmp(ss, "full"))
272 e1_link->e1_ts_ss = 255;
273 else
274 e1_link->e1_ts_ss = atoi(ss);
275}
276
277static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,
278 const char *prefix)
279{
280 if (!e1_link->e1_ts)
281 return;
282
283 if (e1_link->e1_ts_ss == 255)
284 vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s",
285 prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE);
286 else
287 vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s",
288 prefix, e1_link->e1_nr, e1_link->e1_ts,
289 e1_link->e1_ts_ss, VTY_NEWLINE);
290}
291
292
Harald Welte97ceef92009-08-06 19:06:46 +0200293static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
294{
Harald Welte62868882009-08-08 16:12:58 +0200295 vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
296 if (ts->pchan != GSM_PCHAN_NONE)
297 vty_out(vty, " phys_chan_config %s%s",
298 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
299 config_write_e1_link(vty, &ts->e1_link, " ");
Harald Welte97ceef92009-08-06 19:06:46 +0200300}
301
302static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
303{
304 int i;
305
Harald Weltee87eb462009-08-07 13:29:14 +0200306 vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200307 if (trx->description)
308 vty_out(vty, " description %s%s", trx->description,
309 VTY_NEWLINE);
Holger Hans Peter Freyther32be2aa2010-04-17 06:42:07 +0200310 vty_out(vty, " rf_locked %u%s",
311 trx->nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
312 VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200313 vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
Harald Welte (local)b709bfe2009-12-27 20:56:38 +0100314 vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200315 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200316 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
317 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte97ceef92009-08-06 19:06:46 +0200318
319 for (i = 0; i < TRX_NR_TS; i++)
320 config_write_ts_single(vty, &trx->ts[i]);
321}
322
Harald Weltea9251762010-05-11 23:50:21 +0200323static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
324{
325 unsigned int i;
326 vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode),
327 VTY_NEWLINE);
328 if (bts->gprs.mode == BTS_GPRS_NONE)
329 return;
330
331 vty_out(vty, " gprs routing area %u%s", bts->gprs.rac,
332 VTY_NEWLINE);
333 vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
334 VTY_NEWLINE);
335 for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++)
336 vty_out(vty, " gprs cell timer %s %u%s",
337 get_value_string(gprs_bssgp_cfg_strs, i),
338 bts->gprs.cell.timer[i], VTY_NEWLINE);
339 vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei,
340 VTY_NEWLINE);
341 for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++)
342 vty_out(vty, " gprs ns timer %s %u%s",
343 get_value_string(gprs_ns_timer_strs, i),
344 bts->gprs.nse.timer[i], VTY_NEWLINE);
345 for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
346 struct gsm_bts_gprs_nsvc *nsvc =
347 &bts->gprs.nsvc[i];
348 struct in_addr ia;
349
350 ia.s_addr = htonl(nsvc->remote_ip);
351 vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
352 nsvc->nsvci, VTY_NEWLINE);
353 vty_out(vty, " gprs nsvc %u local udp port %u%s", i,
354 nsvc->local_port, VTY_NEWLINE);
355 vty_out(vty, " gprs nsvc %u remote udp port %u%s", i,
356 nsvc->remote_port, VTY_NEWLINE);
357 vty_out(vty, " gprs nsvc %u remote ip %s%s", i,
358 inet_ntoa(ia), VTY_NEWLINE);
359 }
360}
361
Harald Welte97ceef92009-08-06 19:06:46 +0200362static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
363{
364 struct gsm_bts_trx *trx;
365
Harald Weltee87eb462009-08-07 13:29:14 +0200366 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
367 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200368 if (bts->description)
369 vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200370 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freyther6d82b7c2009-11-19 16:38:49 +0100371 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200372 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte97ceef92009-08-06 19:06:46 +0200373 VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200374 vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE);
375 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)cbd46102009-08-13 10:14:26 +0200376 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100377 vty_out(vty, " cell reselection hysteresis %u%s",
378 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
379 vty_out(vty, " rxlev access min %u%s",
380 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Harald Weltea54a2bb2009-12-01 18:04:30 +0530381 if (bts->si_common.chan_desc.t3212)
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +0200382 vty_out(vty, " periodic location update %u%s",
Harald Weltea54a2bb2009-12-01 18:04:30 +0530383 bts->si_common.chan_desc.t3212 * 10, VTY_NEWLINE);
Harald Welte3e774612009-08-10 13:48:16 +0200384 vty_out(vty, " channel allocator %s%s",
385 bts->chan_alloc_reverse ? "descending" : "ascending",
386 VTY_NEWLINE);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +0100387 vty_out(vty, " rach tx integer %u%s",
388 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
389 vty_out(vty, " rach max transmission %u%s",
390 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
391 VTY_NEWLINE);
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +0800392
393 if (bts->rach_b_thresh != -1)
394 vty_out(vty, " rach nm busy threshold %u%s",
395 bts->rach_b_thresh, VTY_NEWLINE);
396 if (bts->rach_ldavg_slots != -1)
397 vty_out(vty, " rach nm load average %u%s",
398 bts->rach_ldavg_slots, VTY_NEWLINE);
Harald Welte8c973ba2009-12-21 23:08:18 +0100399 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)e19be3f2009-08-12 13:28:23 +0200400 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Holger Hans Peter Freyther440984b2010-05-14 00:39:19 +0800401 if ((bts->si_common.rach_control.t2 & 0x4) == 0)
402 vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE);
Harald Welte25572872009-10-20 00:22:00 +0200403 if (is_ipaccess_bts(bts)) {
Harald Weltee87eb462009-08-07 13:29:14 +0200404 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Welte3ffe1b32009-08-07 00:25:23 +0200405 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte25572872009-10-20 00:22:00 +0200406 vty_out(vty, " oml ip.access stream_id %u%s", bts->oml_tei, VTY_NEWLINE);
407 } else {
Harald Welte62868882009-08-08 16:12:58 +0200408 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
409 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
410 }
Harald Weltea9251762010-05-11 23:50:21 +0200411 config_write_bts_gprs(vty, bts);
Harald Welte97ceef92009-08-06 19:06:46 +0200412
413 llist_for_each_entry(trx, &bts->trx_list, list)
414 config_write_trx_single(vty, trx);
415}
416
417static int config_write_bts(struct vty *v)
418{
Harald Welte40152872010-05-16 20:52:23 +0200419 struct gsm_network *gsmnet = gsmnet_from_vty(v);
Harald Welte97ceef92009-08-06 19:06:46 +0200420 struct gsm_bts *bts;
421
422 llist_for_each_entry(bts, &gsmnet->bts_list, list)
423 config_write_bts_single(v, bts);
424
425 return CMD_SUCCESS;
426}
427
Harald Weltee87eb462009-08-07 13:29:14 +0200428static int config_write_net(struct vty *vty)
429{
Harald Welte40152872010-05-16 20:52:23 +0200430 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
431
Harald Weltee87eb462009-08-07 13:29:14 +0200432 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200433 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200434 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200435 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
436 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +0200437 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Harald Welte59936d72009-11-18 20:33:19 +0100438 vty_out(vty, " location updating reject cause %u%s",
439 gsmnet->reject_cause, VTY_NEWLINE);
Harald Weltecca253a2009-08-30 15:47:06 +0900440 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freyther6b4f5462009-11-19 16:37:48 +0100441 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Harald Welte52af1952009-12-13 10:53:12 +0100442 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
443 VTY_NEWLINE);
Harald Weltea310f3e2009-12-14 09:00:24 +0100444 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Welte0af9c9f2009-12-19 21:41:52 +0100445 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Weltea8062f12009-12-21 16:51:50 +0100446 vty_out(vty, " handover window rxlev averaging %u%s",
447 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
448 vty_out(vty, " handover window rxqual averaging %u%s",
449 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
450 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
451 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
452 vty_out(vty, " handover power budget interval %u%s",
453 gsmnet->handover.pwr_interval, VTY_NEWLINE);
454 vty_out(vty, " handover power budget hysteresis %u%s",
455 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
456 vty_out(vty, " handover maximum distance %u%s",
457 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +0100458 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +0100459 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
460 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
461 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
462 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
463 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
464 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
465 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
466 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
467 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
468 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200469
470 return CMD_SUCCESS;
471}
Harald Welte97ceef92009-08-06 19:06:46 +0200472
Harald Welte59b04682009-06-10 05:40:52 +0800473static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
474{
475 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
476 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200477 vty_out(vty, "Description: %s%s",
478 trx->description ? trx->description : "(null)", VTY_NEWLINE);
Harald Welte91afe4c2009-06-20 18:15:19 +0200479 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte62868882009-08-08 16:12:58 +0200480 "resulting BS power: %d dBm%s",
Harald Welte91afe4c2009-06-20 18:15:19 +0200481 trx->nominal_power, trx->max_power_red,
Harald Welte62868882009-08-08 16:12:58 +0200482 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800483 vty_out(vty, " NM State: ");
484 net_dump_nmstate(vty, &trx->nm_state);
485 vty_out(vty, " Baseband Transceiver NM State: ");
486 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte25572872009-10-20 00:22:00 +0200487 if (is_ipaccess_bts(trx->bts)) {
488 vty_out(vty, " ip.access stream ID: 0x%02x%s",
489 trx->rsl_tei, VTY_NEWLINE);
490 } else {
491 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
492 e1isl_dump_vty(vty, trx->rsl_link);
493 }
Harald Welte59b04682009-06-10 05:40:52 +0800494}
495
496DEFUN(show_trx,
497 show_trx_cmd,
498 "show trx [bts_nr] [trx_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200499 SHOW_STR "Display information about a TRX\n"
500 "BTS Number\n"
501 "TRX Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800502{
Harald Welte40152872010-05-16 20:52:23 +0200503 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800504 struct gsm_bts *bts = NULL;
505 struct gsm_bts_trx *trx;
506 int bts_nr, trx_nr;
507
508 if (argc >= 1) {
509 /* use the BTS number that the user has specified */
510 bts_nr = atoi(argv[0]);
511 if (bts_nr >= net->num_bts) {
512 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
513 VTY_NEWLINE);
514 return CMD_WARNING;
515 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200516 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800517 }
518 if (argc >= 2) {
519 trx_nr = atoi(argv[1]);
520 if (trx_nr >= bts->num_trx) {
521 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
522 VTY_NEWLINE);
523 return CMD_WARNING;
524 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200525 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800526 trx_dump_vty(vty, trx);
527 return CMD_SUCCESS;
528 }
529 if (bts) {
530 /* print all TRX in this BTS */
531 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200532 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800533 trx_dump_vty(vty, trx);
534 }
535 return CMD_SUCCESS;
536 }
537
538 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200539 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800540 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200541 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800542 trx_dump_vty(vty, trx);
543 }
544 }
545
546 return CMD_SUCCESS;
547}
548
Harald Welte97ceef92009-08-06 19:06:46 +0200549
Harald Welte59b04682009-06-10 05:40:52 +0800550static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
551{
Harald Welte59b04682009-06-10 05:40:52 +0800552 vty_out(vty, "Timeslot %u of TRX %u in BTS %u, phys cfg %s%s",
553 ts->nr, ts->trx->nr, ts->trx->bts->nr,
554 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
555 vty_out(vty, " NM State: ");
556 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte87504212009-12-02 01:56:49 +0530557 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welte59b04682009-06-10 05:40:52 +0800558 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
559 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
560 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800561}
562
563DEFUN(show_ts,
564 show_ts_cmd,
565 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200566 SHOW_STR "Display information about a TS\n"
567 "BTS Number\n" "TRX Number\n" "Timeslot Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800568{
Harald Welte40152872010-05-16 20:52:23 +0200569 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800570 struct gsm_bts *bts;
571 struct gsm_bts_trx *trx;
572 struct gsm_bts_trx_ts *ts;
573 int bts_nr, trx_nr, ts_nr;
574
575 if (argc >= 1) {
576 /* use the BTS number that the user has specified */
577 bts_nr = atoi(argv[0]);
578 if (bts_nr >= net->num_bts) {
579 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
580 VTY_NEWLINE);
581 return CMD_WARNING;
582 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200583 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800584 }
585 if (argc >= 2) {
586 trx_nr = atoi(argv[1]);
587 if (trx_nr >= bts->num_trx) {
588 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
589 VTY_NEWLINE);
590 return CMD_WARNING;
591 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200592 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800593 }
594 if (argc >= 3) {
595 ts_nr = atoi(argv[2]);
596 if (ts_nr >= TRX_NR_TS) {
597 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
598 VTY_NEWLINE);
599 return CMD_WARNING;
600 }
601 ts = &trx->ts[ts_nr];
602 ts_dump_vty(vty, ts);
603 return CMD_SUCCESS;
604 }
605 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200606 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800607 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200608 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800609 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
610 ts = &trx->ts[ts_nr];
611 ts_dump_vty(vty, ts);
612 }
613 }
614 }
615
616 return CMD_SUCCESS;
617}
618
Holger Hans Peter Freyther1dd0a1b2010-01-06 06:00:40 +0100619static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte59b04682009-06-10 05:40:52 +0800620{
Harald Welte91afe4c2009-06-20 18:15:19 +0200621 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte59b04682009-06-10 05:40:52 +0800622 subscr->authorized, VTY_NEWLINE);
623 if (subscr->name)
624 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
625 if (subscr->extension)
626 vty_out(vty, " Extension: %s%s", subscr->extension,
627 VTY_NEWLINE);
628 if (subscr->imsi)
629 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freythercd8bacf2009-08-19 12:53:57 +0200630 if (subscr->tmsi != GSM_RESERVED_TMSI)
631 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte270c06c2009-08-15 03:24:51 +0200632 VTY_NEWLINE);
Sylvain Munaute5863a22009-12-27 19:29:28 +0100633
Harald Welte (local)02d5efa2009-08-14 20:27:16 +0200634 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800635}
636
Harald Welte44007742009-12-22 21:43:14 +0100637static void meas_rep_dump_uni_vty(struct vty *vty,
638 struct gsm_meas_rep_unidir *mru,
639 const char *prefix,
640 const char *dir)
641{
642 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
643 prefix, dir, rxlev2dbm(mru->full.rx_lev),
644 dir, rxlev2dbm(mru->sub.rx_lev));
645 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
646 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
647 VTY_NEWLINE);
648}
649
650static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
651 const char *prefix)
652{
653 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
654 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
655 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
656 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
657 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
658 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
659 VTY_NEWLINE);
660 if (mr->flags & MEAS_REP_F_MS_TO)
661 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
662 mr->ms_timing_offset, VTY_NEWLINE);
663 if (mr->flags & MEAS_REP_F_MS_L1)
664 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
665 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
666 if (mr->flags & MEAS_REP_F_DL_VALID)
667 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
668 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
669}
670
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800671static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
Harald Welte59b04682009-06-10 05:40:52 +0800672{
Harald Welte44007742009-12-22 21:43:14 +0100673 int idx;
674
Harald Welte59b04682009-06-10 05:40:52 +0800675 vty_out(vty, "Lchan %u in Timeslot %u of TRX %u in BTS %u, Type %s%s",
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +0200676 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
Harald Welte (local)02204d02009-12-27 18:05:25 +0100677 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Harald Welte59b04682009-06-10 05:40:52 +0800678 VTY_NEWLINE);
Holger Hans Peter Freyther065b8112010-03-23 06:41:45 +0100679 vty_out(vty, " Use Count: %u, State: %s%s", lchan->conn.use_count,
Harald Welteab2534c2009-12-29 10:52:38 +0100680 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100681 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
682 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
683 - lchan->bs_power*2,
684 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
685 VTY_NEWLINE);
Holger Hans Peter Freyther065b8112010-03-23 06:41:45 +0100686 if (lchan->conn.subscr) {
Harald Welte59b04682009-06-10 05:40:52 +0800687 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther065b8112010-03-23 06:41:45 +0100688 subscr_dump_vty(vty, lchan->conn.subscr);
Harald Welte59b04682009-06-10 05:40:52 +0800689 } else
690 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte87504212009-12-02 01:56:49 +0530691 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
692 struct in_addr ia;
Holger Hans Peter Freythercec1ec52010-04-07 15:39:16 +0200693 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte87504212009-12-02 01:56:49 +0530694 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
695 inet_ntoa(ia), lchan->abis_ip.bound_port,
696 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
697 VTY_NEWLINE);
698 }
Harald Welte44007742009-12-22 21:43:14 +0100699
700 /* we want to report the last measurement report */
701 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
702 lchan->meas_rep_idx, 1);
703 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte59b04682009-06-10 05:40:52 +0800704}
705
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +0800706static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
707{
Holger Hans Peter Freythercf13a922010-05-14 01:57:02 +0800708 struct gsm_meas_rep *mr;
709 int idx;
710
711 /* we want to report the last measurement report */
712 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
713 lchan->meas_rep_idx, 1);
714 mr = &lchan->meas_rep[idx];
715
716 vty_out(vty, "Lchan: %u Timeslot: %u TRX: %u BTS: %u Type: %s - L1 MS Power: %u dBm "
717 "RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +0800718 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
719 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Holger Hans Peter Freythercf13a922010-05-14 01:57:02 +0800720 mr->ms_l1.pwr,
721 rxlev2dbm(mr->dl.full.rx_lev),
722 rxlev2dbm(mr->ul.full.rx_lev),
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +0800723 VTY_NEWLINE);
724}
725
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800726static int lchan_summary(struct vty *vty, int argc, const char **argv,
727 void (*dump_cb)(struct vty *, struct gsm_lchan *))
Harald Welte59b04682009-06-10 05:40:52 +0800728{
Harald Welte40152872010-05-16 20:52:23 +0200729 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800730 struct gsm_bts *bts;
731 struct gsm_bts_trx *trx;
732 struct gsm_bts_trx_ts *ts;
733 struct gsm_lchan *lchan;
734 int bts_nr, trx_nr, ts_nr, lchan_nr;
735
736 if (argc >= 1) {
737 /* use the BTS number that the user has specified */
738 bts_nr = atoi(argv[0]);
739 if (bts_nr >= net->num_bts) {
740 vty_out(vty, "%% can't find BTS %s%s", argv[0],
741 VTY_NEWLINE);
742 return CMD_WARNING;
743 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200744 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800745 }
746 if (argc >= 2) {
747 trx_nr = atoi(argv[1]);
748 if (trx_nr >= bts->num_trx) {
749 vty_out(vty, "%% can't find TRX %s%s", argv[1],
750 VTY_NEWLINE);
751 return CMD_WARNING;
752 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200753 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800754 }
755 if (argc >= 3) {
756 ts_nr = atoi(argv[2]);
757 if (ts_nr >= TRX_NR_TS) {
758 vty_out(vty, "%% can't find TS %s%s", argv[2],
759 VTY_NEWLINE);
760 return CMD_WARNING;
761 }
762 ts = &trx->ts[ts_nr];
763 }
764 if (argc >= 4) {
765 lchan_nr = atoi(argv[3]);
766 if (lchan_nr >= TS_MAX_LCHAN) {
767 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
768 VTY_NEWLINE);
769 return CMD_WARNING;
770 }
771 lchan = &ts->lchan[lchan_nr];
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800772 dump_cb(vty, lchan);
Harald Welte59b04682009-06-10 05:40:52 +0800773 return CMD_SUCCESS;
774 }
775 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200776 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800777 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200778 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800779 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
780 ts = &trx->ts[ts_nr];
781 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
782 lchan_nr++) {
783 lchan = &ts->lchan[lchan_nr];
784 if (lchan->type == GSM_LCHAN_NONE)
785 continue;
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800786 dump_cb(vty, lchan);
Harald Welte59b04682009-06-10 05:40:52 +0800787 }
788 }
789 }
790 }
791
792 return CMD_SUCCESS;
793}
794
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800795
796DEFUN(show_lchan,
797 show_lchan_cmd,
798 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
799 SHOW_STR "Display information about a logical channel\n"
800 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
801 "Logical Channel Number\n")
802
803{
804 return lchan_summary(vty, argc, argv, lchan_dump_full_vty);
805}
806
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +0800807DEFUN(show_lchan_summary,
808 show_lchan_summary_cmd,
809 "show lchan summary [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
810 SHOW_STR "Display information about a logical channel\n"
811 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
812 "Logical Channel Number\n")
813{
814 return lchan_summary(vty, argc, argv, lchan_dump_short_vty);
815}
816
Harald Welte59b04682009-06-10 05:40:52 +0800817static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
818{
819 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
820}
821
822DEFUN(show_e1drv,
823 show_e1drv_cmd,
824 "show e1_driver",
825 SHOW_STR "Display information about available E1 drivers\n")
826{
827 struct e1inp_driver *drv;
828
829 llist_for_each_entry(drv, &e1inp_driver_list, list)
830 e1drv_dump_vty(vty, drv);
831
832 return CMD_SUCCESS;
833}
834
835static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
836{
837 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
838 line->num, line->name ? line->name : "",
839 line->driver->name, VTY_NEWLINE);
840}
841
842DEFUN(show_e1line,
843 show_e1line_cmd,
844 "show e1_line [line_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200845 SHOW_STR "Display information about a E1 line\n"
846 "E1 Line Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800847{
848 struct e1inp_line *line;
849
850 if (argc >= 1) {
851 int num = atoi(argv[0]);
852 llist_for_each_entry(line, &e1inp_line_list, list) {
853 if (line->num == num) {
854 e1line_dump_vty(vty, line);
855 return CMD_SUCCESS;
856 }
857 }
858 return CMD_WARNING;
859 }
860
861 llist_for_each_entry(line, &e1inp_line_list, list)
862 e1line_dump_vty(vty, line);
863
864 return CMD_SUCCESS;
865}
866
867static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
868{
Harald Welte62868882009-08-08 16:12:58 +0200869 if (ts->type == E1INP_TS_TYPE_NONE)
870 return;
Harald Welte59b04682009-06-10 05:40:52 +0800871 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
872 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
873 VTY_NEWLINE);
874}
875
876DEFUN(show_e1ts,
877 show_e1ts_cmd,
878 "show e1_timeslot [line_nr] [ts_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200879 SHOW_STR "Display information about a E1 timeslot\n"
880 "E1 Line Number\n" "E1 Timeslot Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800881{
Harald Welte49c79562009-11-17 06:12:16 +0100882 struct e1inp_line *line = NULL;
Harald Welte59b04682009-06-10 05:40:52 +0800883 struct e1inp_ts *ts;
884 int ts_nr;
885
886 if (argc == 0) {
887 llist_for_each_entry(line, &e1inp_line_list, list) {
888 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
889 ts = &line->ts[ts_nr];
890 e1ts_dump_vty(vty, ts);
891 }
892 }
893 return CMD_SUCCESS;
894 }
895 if (argc >= 1) {
896 int num = atoi(argv[0]);
897 llist_for_each_entry(line, &e1inp_line_list, list) {
898 if (line->num == num)
899 break;
900 }
901 if (!line || line->num != num) {
902 vty_out(vty, "E1 line %s is invalid%s",
903 argv[0], VTY_NEWLINE);
904 return CMD_WARNING;
905 }
906 }
907 if (argc >= 2) {
908 ts_nr = atoi(argv[1]);
909 if (ts_nr > NUM_E1_TS) {
910 vty_out(vty, "E1 timeslot %s is invalid%s",
911 argv[1], VTY_NEWLINE);
912 return CMD_WARNING;
913 }
914 ts = &line->ts[ts_nr];
915 e1ts_dump_vty(vty, ts);
916 return CMD_SUCCESS;
917 } else {
918 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
919 ts = &line->ts[ts_nr];
920 e1ts_dump_vty(vty, ts);
921 }
922 return CMD_SUCCESS;
923 }
924 return CMD_SUCCESS;
925}
926
927static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
928{
929 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
930 subscr_dump_vty(vty, pag->subscr);
931}
932
933static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
934{
935 struct gsm_paging_request *pag;
936
937 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
938 paging_dump_vty(vty, pag);
939}
940
941DEFUN(show_paging,
942 show_paging_cmd,
943 "show paging [bts_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200944 SHOW_STR "Display information about paging reuqests of a BTS\n"
945 "BTS Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800946{
Harald Welte40152872010-05-16 20:52:23 +0200947 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800948 struct gsm_bts *bts;
949 int bts_nr;
950
951 if (argc >= 1) {
952 /* use the BTS number that the user has specified */
953 bts_nr = atoi(argv[0]);
954 if (bts_nr >= net->num_bts) {
955 vty_out(vty, "%% can't find BTS %s%s", argv[0],
956 VTY_NEWLINE);
957 return CMD_WARNING;
958 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200959 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800960 bts_paging_dump_vty(vty, bts);
961
962 return CMD_SUCCESS;
963 }
964 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200965 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800966 bts_paging_dump_vty(vty, bts);
967 }
968
969 return CMD_SUCCESS;
970}
971
Harald Welte9e002452010-05-11 21:53:49 +0200972#define NETWORK_STR "Configure the GSM network\n"
973
Harald Weltee87eb462009-08-07 13:29:14 +0200974DEFUN(cfg_net,
975 cfg_net_cmd,
Harald Welte9e002452010-05-11 21:53:49 +0200976 "network", NETWORK_STR)
Harald Weltee87eb462009-08-07 13:29:14 +0200977{
Harald Welte40152872010-05-16 20:52:23 +0200978 vty->index = gsmnet_from_vty(vty);
Harald Weltee87eb462009-08-07 13:29:14 +0200979 vty->node = GSMNET_NODE;
980
981 return CMD_SUCCESS;
982}
983
984
985DEFUN(cfg_net_ncc,
986 cfg_net_ncc_cmd,
987 "network country code <1-999>",
988 "Set the GSM network country code")
989{
Harald Welte40152872010-05-16 20:52:23 +0200990 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
991
Harald Weltee87eb462009-08-07 13:29:14 +0200992 gsmnet->country_code = atoi(argv[0]);
993
994 return CMD_SUCCESS;
995}
996
997DEFUN(cfg_net_mnc,
998 cfg_net_mnc_cmd,
999 "mobile network code <1-999>",
1000 "Set the GSM mobile network code")
1001{
Harald Welte40152872010-05-16 20:52:23 +02001002 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1003
Harald Weltee87eb462009-08-07 13:29:14 +02001004 gsmnet->network_code = atoi(argv[0]);
1005
1006 return CMD_SUCCESS;
1007}
1008
1009DEFUN(cfg_net_name_short,
1010 cfg_net_name_short_cmd,
1011 "short name NAME",
1012 "Set the short GSM network name")
1013{
Harald Welte40152872010-05-16 20:52:23 +02001014 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1015
Harald Weltee87eb462009-08-07 13:29:14 +02001016 if (gsmnet->name_short)
1017 talloc_free(gsmnet->name_short);
1018
1019 gsmnet->name_short = talloc_strdup(gsmnet, argv[0]);
1020
1021 return CMD_SUCCESS;
1022}
1023
1024DEFUN(cfg_net_name_long,
1025 cfg_net_name_long_cmd,
1026 "long name NAME",
1027 "Set the long GSM network name")
1028{
Harald Welte40152872010-05-16 20:52:23 +02001029 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1030
Harald Weltee87eb462009-08-07 13:29:14 +02001031 if (gsmnet->name_long)
1032 talloc_free(gsmnet->name_long);
1033
1034 gsmnet->name_long = talloc_strdup(gsmnet, argv[0]);
1035
1036 return CMD_SUCCESS;
1037}
Harald Welte59b04682009-06-10 05:40:52 +08001038
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02001039DEFUN(cfg_net_auth_policy,
1040 cfg_net_auth_policy_cmd,
1041 "auth policy (closed|accept-all|token)",
Harald Welte9e002452010-05-11 21:53:49 +02001042 "Authentication (not cryptographic)\n"
1043 "Set the GSM network authentication policy\n"
1044 "Require the MS to be activated in HLR\n"
1045 "Accept all MS, whether in HLR or not\n"
1046 "Use SMS-token based authentication\n")
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02001047{
1048 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
Harald Welte40152872010-05-16 20:52:23 +02001049 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02001050
1051 gsmnet->auth_policy = policy;
1052
1053 return CMD_SUCCESS;
1054}
1055
Harald Welte59936d72009-11-18 20:33:19 +01001056DEFUN(cfg_net_reject_cause,
1057 cfg_net_reject_cause_cmd,
1058 "location updating reject cause <2-111>",
1059 "Set the reject cause of location updating reject\n")
1060{
Harald Welte40152872010-05-16 20:52:23 +02001061 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1062
Harald Welte59936d72009-11-18 20:33:19 +01001063 gsmnet->reject_cause = atoi(argv[0]);
1064
1065 return CMD_SUCCESS;
1066}
1067
Harald Weltecca253a2009-08-30 15:47:06 +09001068DEFUN(cfg_net_encryption,
1069 cfg_net_encryption_cmd,
1070 "encryption a5 (0|1|2)",
Harald Welte18ce31c2010-05-14 20:05:17 +02001071 "Encryption options\n"
1072 "A5 encryption\n" "A5/0: No encryption\n"
1073 "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n")
Harald Weltecca253a2009-08-30 15:47:06 +09001074{
Harald Welte40152872010-05-16 20:52:23 +02001075 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1076
Andreas.Eversberg53293292009-11-17 09:55:26 +01001077 gsmnet->a5_encryption= atoi(argv[0]);
Harald Weltecca253a2009-08-30 15:47:06 +09001078
1079 return CMD_SUCCESS;
1080}
1081
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001082DEFUN(cfg_net_neci,
1083 cfg_net_neci_cmd,
1084 "neci (0|1)",
Harald Welte18ce31c2010-05-14 20:05:17 +02001085 "New Establish Cause Indication\n"
1086 "Don't set the NECI bit\n" "Set the NECI bit\n")
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001087{
Harald Welte40152872010-05-16 20:52:23 +02001088 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1089
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001090 gsmnet->neci = atoi(argv[0]);
1091 return CMD_SUCCESS;
1092}
1093
Harald Welte52af1952009-12-13 10:53:12 +01001094DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1095 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
Harald Welte9e002452010-05-11 21:53:49 +02001096 "Radio Resource Location Protocol\n"
1097 "Set the Radio Resource Location Protocol Mode\n"
1098 "Don't send RRLP request\n"
1099 "Request MS-based location\n"
1100 "Request any location, prefer MS-based\n"
1101 "Request any location, prefer MS-assisted\n")
Harald Welte52af1952009-12-13 10:53:12 +01001102{
Harald Welte40152872010-05-16 20:52:23 +02001103 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1104
Harald Welte52af1952009-12-13 10:53:12 +01001105 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1106
1107 return CMD_SUCCESS;
1108}
1109
Harald Weltea310f3e2009-12-14 09:00:24 +01001110DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1111 "mm info (0|1)",
1112 "Whether to send MM INFO after LOC UPD ACCEPT")
1113{
Harald Welte40152872010-05-16 20:52:23 +02001114 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1115
Harald Weltea310f3e2009-12-14 09:00:24 +01001116 gsmnet->send_mm_info = atoi(argv[0]);
1117
1118 return CMD_SUCCESS;
1119}
1120
Harald Welte9e002452010-05-11 21:53:49 +02001121#define HANDOVER_STR "Handover Options\n"
1122
Harald Welte0af9c9f2009-12-19 21:41:52 +01001123DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1124 "handover (0|1)",
Harald Welte9e002452010-05-11 21:53:49 +02001125 HANDOVER_STR
1126 "Don't perform in-call handover\n"
1127 "Perform in-call handover\n")
Harald Welte0af9c9f2009-12-19 21:41:52 +01001128{
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001129 int enable = atoi(argv[0]);
Harald Welte40152872010-05-16 20:52:23 +02001130 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001131
1132 if (enable && ipacc_rtp_direct) {
Harald Welteaa2c3032009-12-20 13:51:01 +01001133 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1134 "is enabled by using the -P command line option%s",
1135 VTY_NEWLINE);
1136 return CMD_WARNING;
1137 }
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001138 gsmnet->handover.active = enable;
Harald Welte0af9c9f2009-12-19 21:41:52 +01001139
1140 return CMD_SUCCESS;
1141}
1142
Harald Welte9e002452010-05-11 21:53:49 +02001143#define HO_WIN_STR HANDOVER_STR "Measurement Window\n"
1144#define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n"
1145#define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n"
1146#define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n"
1147
Harald Weltea8062f12009-12-21 16:51:50 +01001148DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1149 "handover window rxlev averaging <1-10>",
Harald Welte9e002452010-05-11 21:53:49 +02001150 HO_WIN_RXLEV_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001151 "How many RxLev measurements are used for averaging")
1152{
Harald Welte40152872010-05-16 20:52:23 +02001153 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001154 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1155 return CMD_SUCCESS;
1156}
1157
1158DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1159 "handover window rxqual averaging <1-10>",
Harald Welte9e002452010-05-11 21:53:49 +02001160 HO_WIN_RXQUAL_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001161 "How many RxQual measurements are used for averaging")
1162{
Harald Welte40152872010-05-16 20:52:23 +02001163 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001164 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1165 return CMD_SUCCESS;
1166}
1167
1168DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1169 "handover window rxlev neighbor averaging <1-10>",
Harald Welte9e002452010-05-11 21:53:49 +02001170 HO_WIN_RXLEV_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001171 "How many RxQual measurements are used for averaging")
1172{
Harald Welte40152872010-05-16 20:52:23 +02001173 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001174 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1175 return CMD_SUCCESS;
1176}
1177
1178DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1179 "handover power budget interval <1-99>",
Harald Welte9e002452010-05-11 21:53:49 +02001180 HO_PBUDGET_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001181 "How often to check if we have a better cell (SACCH frames)")
1182{
Harald Welte40152872010-05-16 20:52:23 +02001183 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001184 gsmnet->handover.pwr_interval = atoi(argv[0]);
1185 return CMD_SUCCESS;
1186}
1187
1188DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1189 "handover power budget hysteresis <0-999>",
Harald Welte9e002452010-05-11 21:53:49 +02001190 HO_PBUDGET_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001191 "How many dB does a neighbor to be stronger to become a HO candidate")
1192{
Harald Welte40152872010-05-16 20:52:23 +02001193 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001194 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1195 return CMD_SUCCESS;
1196}
1197
1198DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1199 "handover maximum distance <0-9999>",
Harald Welte9e002452010-05-11 21:53:49 +02001200 HANDOVER_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001201 "How big is the maximum timing advance before HO is forced")
1202{
Harald Welte40152872010-05-16 20:52:23 +02001203 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001204 gsmnet->handover.max_distance = atoi(argv[0]);
1205 return CMD_SUCCESS;
1206}
Harald Welte0af9c9f2009-12-19 21:41:52 +01001207
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001208#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001209 DEFUN(cfg_net_T##number, \
1210 cfg_net_T##number##_cmd, \
1211 "timer t" #number " <0-65535>", \
Harald Welte9e002452010-05-11 21:53:49 +02001212 "Configure GSM Timers\n" \
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001213 doc) \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001214{ \
Harald Welte40152872010-05-16 20:52:23 +02001215 struct gsm_network *gsmnet = gsmnet_from_vty(vty); \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001216 int value = atoi(argv[0]); \
1217 \
1218 if (value < 0 || value > 65535) { \
1219 vty_out(vty, "Timer value %s out of range.%s", \
1220 argv[0], VTY_NEWLINE); \
1221 return CMD_WARNING; \
1222 } \
1223 \
1224 gsmnet->T##number = value; \
1225 return CMD_SUCCESS; \
1226}
1227
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001228DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1229DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1230DECLARE_TIMER(3105, "Currently not used.")
1231DECLARE_TIMER(3107, "Currently not used.")
1232DECLARE_TIMER(3109, "Currently not used.")
1233DECLARE_TIMER(3111, "Currently not used.")
1234DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1235DECLARE_TIMER(3115, "Currently not used.")
1236DECLARE_TIMER(3117, "Currently not used.")
1237DECLARE_TIMER(3119, "Currently not used.")
1238DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001239
1240
Harald Welte59b04682009-06-10 05:40:52 +08001241/* per-BTS configuration */
1242DEFUN(cfg_bts,
1243 cfg_bts_cmd,
1244 "bts BTS_NR",
Harald Welte9e002452010-05-11 21:53:49 +02001245 "Select a BTS to configure\n"
1246 "BTS Number\n")
Harald Welte59b04682009-06-10 05:40:52 +08001247{
Harald Welte40152872010-05-16 20:52:23 +02001248 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +08001249 int bts_nr = atoi(argv[0]);
1250 struct gsm_bts *bts;
1251
Harald Weltee712a5f2009-06-21 16:17:15 +02001252 if (bts_nr > gsmnet->num_bts) {
1253 vty_out(vty, "%% The next unused BTS number is %u%s",
1254 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +08001255 return CMD_WARNING;
Harald Weltee712a5f2009-06-21 16:17:15 +02001256 } else if (bts_nr == gsmnet->num_bts) {
1257 /* allocate a new one */
1258 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1259 HARDCODED_TSC, HARDCODED_BSIC);
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +02001260 } else
Harald Weltee712a5f2009-06-21 16:17:15 +02001261 bts = gsm_bts_num(gsmnet, bts_nr);
1262
Daniel Willmann580085f2010-01-11 13:43:07 +01001263 if (!bts) {
1264 vty_out(vty, "%% Unable to allocate BTS %u%s",
1265 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee712a5f2009-06-21 16:17:15 +02001266 return CMD_WARNING;
Daniel Willmann580085f2010-01-11 13:43:07 +01001267 }
Harald Welte59b04682009-06-10 05:40:52 +08001268
1269 vty->index = bts;
Harald Welte8791dac2010-05-14 17:59:53 +02001270 vty->index_sub = &bts->description;
Harald Welte59b04682009-06-10 05:40:52 +08001271 vty->node = BTS_NODE;
1272
1273 return CMD_SUCCESS;
1274}
1275
1276DEFUN(cfg_bts_type,
1277 cfg_bts_type_cmd,
1278 "type TYPE",
1279 "Set the BTS type\n")
1280{
1281 struct gsm_bts *bts = vty->index;
Harald Welte59698fb2010-01-10 18:01:52 +01001282 int rc;
Harald Welte59b04682009-06-10 05:40:52 +08001283
Harald Welte59698fb2010-01-10 18:01:52 +01001284 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1285 if (rc < 0)
1286 return CMD_WARNING;
Harald Welte25572872009-10-20 00:22:00 +02001287
Harald Welte59b04682009-06-10 05:40:52 +08001288 return CMD_SUCCESS;
1289}
1290
Harald Welte91afe4c2009-06-20 18:15:19 +02001291DEFUN(cfg_bts_band,
1292 cfg_bts_band_cmd,
1293 "band BAND",
1294 "Set the frequency band of this BTS\n")
1295{
1296 struct gsm_bts *bts = vty->index;
Harald Welte62868882009-08-08 16:12:58 +02001297 int band = gsm_band_parse(argv[0]);
Harald Welte91afe4c2009-06-20 18:15:19 +02001298
1299 if (band < 0) {
1300 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1301 band, VTY_NEWLINE);
1302 return CMD_WARNING;
1303 }
1304
1305 bts->band = band;
1306
1307 return CMD_SUCCESS;
1308}
1309
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +02001310DEFUN(cfg_bts_ci,
1311 cfg_bts_ci_cmd,
1312 "cell_identity <0-65535>",
1313 "Set the Cell identity of this BTS\n")
1314{
1315 struct gsm_bts *bts = vty->index;
1316 int ci = atoi(argv[0]);
1317
1318 if (ci < 0 || ci > 0xffff) {
1319 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1320 ci, VTY_NEWLINE);
1321 return CMD_WARNING;
1322 }
1323 bts->cell_identity = ci;
1324
1325 return CMD_SUCCESS;
1326}
1327
Harald Welte59b04682009-06-10 05:40:52 +08001328DEFUN(cfg_bts_lac,
1329 cfg_bts_lac_cmd,
Holger Hans Peter Freyther54a22832009-09-29 14:02:33 +02001330 "location_area_code <0-65535>",
Harald Welte59b04682009-06-10 05:40:52 +08001331 "Set the Location Area Code (LAC) of this BTS\n")
1332{
1333 struct gsm_bts *bts = vty->index;
1334 int lac = atoi(argv[0]);
1335
Holger Hans Peter Freyther54a22832009-09-29 14:02:33 +02001336 if (lac < 0 || lac > 0xffff) {
1337 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte59b04682009-06-10 05:40:52 +08001338 lac, VTY_NEWLINE);
1339 return CMD_WARNING;
1340 }
Holger Hans Peter Freyther6c6ab862009-10-01 04:07:15 +02001341
1342 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1343 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1344 lac, VTY_NEWLINE);
1345 return CMD_WARNING;
1346 }
1347
Harald Welte59b04682009-06-10 05:40:52 +08001348 bts->location_area_code = lac;
1349
1350 return CMD_SUCCESS;
1351}
1352
Harald Weltea54a2bb2009-12-01 18:04:30 +05301353
Harald Welte59b04682009-06-10 05:40:52 +08001354DEFUN(cfg_bts_tsc,
1355 cfg_bts_tsc_cmd,
1356 "training_sequence_code <0-255>",
1357 "Set the Training Sequence Code (TSC) of this BTS\n")
1358{
1359 struct gsm_bts *bts = vty->index;
1360 int tsc = atoi(argv[0]);
1361
1362 if (tsc < 0 || tsc > 0xff) {
1363 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1364 tsc, VTY_NEWLINE);
1365 return CMD_WARNING;
1366 }
1367 bts->tsc = tsc;
1368
1369 return CMD_SUCCESS;
1370}
1371
1372DEFUN(cfg_bts_bsic,
1373 cfg_bts_bsic_cmd,
1374 "base_station_id_code <0-63>",
1375 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1376{
1377 struct gsm_bts *bts = vty->index;
1378 int bsic = atoi(argv[0]);
1379
1380 if (bsic < 0 || bsic > 0x3f) {
Harald Welte62868882009-08-08 16:12:58 +02001381 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte59b04682009-06-10 05:40:52 +08001382 bsic, VTY_NEWLINE);
1383 return CMD_WARNING;
1384 }
1385 bts->bsic = bsic;
1386
1387 return CMD_SUCCESS;
1388}
1389
1390
1391DEFUN(cfg_bts_unit_id,
1392 cfg_bts_unit_id_cmd,
Harald Weltef515aa02009-08-07 13:27:09 +02001393 "ip.access unit_id <0-65534> <0-255>",
1394 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte59b04682009-06-10 05:40:52 +08001395{
1396 struct gsm_bts *bts = vty->index;
1397 int site_id = atoi(argv[0]);
1398 int bts_id = atoi(argv[1]);
1399
Harald Weltef515aa02009-08-07 13:27:09 +02001400 if (!is_ipaccess_bts(bts)) {
1401 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1402 return CMD_WARNING;
1403 }
1404
Harald Welte59b04682009-06-10 05:40:52 +08001405 bts->ip_access.site_id = site_id;
1406 bts->ip_access.bts_id = bts_id;
1407
1408 return CMD_SUCCESS;
1409}
1410
Harald Welte9e002452010-05-11 21:53:49 +02001411#define OML_STR "Organization & Maintenance Link\n"
1412#define IPA_STR "ip.access Specific Options\n"
1413
Harald Welte25572872009-10-20 00:22:00 +02001414DEFUN(cfg_bts_stream_id,
1415 cfg_bts_stream_id_cmd,
1416 "oml ip.access stream_id <0-255>",
Harald Welte9e002452010-05-11 21:53:49 +02001417 OML_STR IPA_STR
Harald Welte25572872009-10-20 00:22:00 +02001418 "Set the ip.access Stream ID of the OML link of this BTS\n")
1419{
1420 struct gsm_bts *bts = vty->index;
1421 int stream_id = atoi(argv[0]);
1422
1423 if (!is_ipaccess_bts(bts)) {
1424 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1425 return CMD_WARNING;
1426 }
1427
1428 bts->oml_tei = stream_id;
1429
1430 return CMD_SUCCESS;
1431}
1432
Harald Welte9e002452010-05-11 21:53:49 +02001433#define OML_E1_STR OML_STR "E1 Line\n"
Harald Welte25572872009-10-20 00:22:00 +02001434
Harald Welte62868882009-08-08 16:12:58 +02001435DEFUN(cfg_bts_oml_e1,
1436 cfg_bts_oml_e1_cmd,
1437 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte9e002452010-05-11 21:53:49 +02001438 OML_E1_STR
Harald Welte62868882009-08-08 16:12:58 +02001439 "E1 interface to be used for OML\n")
1440{
1441 struct gsm_bts *bts = vty->index;
1442
1443 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1444
1445 return CMD_SUCCESS;
1446}
1447
1448
1449DEFUN(cfg_bts_oml_e1_tei,
1450 cfg_bts_oml_e1_tei_cmd,
1451 "oml e1 tei <0-63>",
Harald Welte9e002452010-05-11 21:53:49 +02001452 OML_E1_STR
Harald Welte62868882009-08-08 16:12:58 +02001453 "Set the TEI to be used for OML")
1454{
1455 struct gsm_bts *bts = vty->index;
1456
1457 bts->oml_tei = atoi(argv[0]);
1458
1459 return CMD_SUCCESS;
1460}
1461
Harald Welte3e774612009-08-10 13:48:16 +02001462DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1463 "channel allocator (ascending|descending)",
Harald Welte9e002452010-05-11 21:53:49 +02001464 "Channnel Allocator\n" "Channel Allocator\n"
1465 "Allocate Timeslots and Transceivers in ascending order\n"
1466 "Allocate Timeslots and Transceivers in descending order\n")
Harald Welte3e774612009-08-10 13:48:16 +02001467{
1468 struct gsm_bts *bts = vty->index;
1469
1470 if (!strcmp(argv[0], "ascending"))
1471 bts->chan_alloc_reverse = 0;
1472 else
1473 bts->chan_alloc_reverse = 1;
1474
1475 return CMD_SUCCESS;
1476}
1477
Harald Welte9e002452010-05-11 21:53:49 +02001478#define RACH_STR "Random Access Control Channel\n"
1479
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001480DEFUN(cfg_bts_rach_tx_integer,
1481 cfg_bts_rach_tx_integer_cmd,
1482 "rach tx integer <0-15>",
Harald Welte9e002452010-05-11 21:53:49 +02001483 RACH_STR
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001484 "Set the raw tx integer value in RACH Control parameters IE")
1485{
1486 struct gsm_bts *bts = vty->index;
1487 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1488 return CMD_SUCCESS;
1489}
1490
1491DEFUN(cfg_bts_rach_max_trans,
1492 cfg_bts_rach_max_trans_cmd,
1493 "rach max transmission (1|2|4|7)",
Harald Welte9e002452010-05-11 21:53:49 +02001494 RACH_STR
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001495 "Set the maximum number of RACH burst transmissions")
1496{
1497 struct gsm_bts *bts = vty->index;
1498 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1499 return CMD_SUCCESS;
1500}
1501
Harald Welte9e002452010-05-11 21:53:49 +02001502#define NM_STR "Network Management\n"
1503
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08001504DEFUN(cfg_bts_rach_nm_b_thresh,
1505 cfg_bts_rach_nm_b_thresh_cmd,
1506 "rach nm busy threshold <0-255>",
Harald Welte9e002452010-05-11 21:53:49 +02001507 RACH_STR NM_STR
1508 "Set the NM Busy Threshold in dB")
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08001509{
1510 struct gsm_bts *bts = vty->index;
1511 bts->rach_b_thresh = atoi(argv[0]);
1512 return CMD_SUCCESS;
1513}
1514
1515DEFUN(cfg_bts_rach_nm_ldavg,
1516 cfg_bts_rach_nm_ldavg_cmd,
1517 "rach nm load average <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001518 RACH_STR NM_STR
1519 "Set the NM Loadaverage Slots value")
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08001520{
1521 struct gsm_bts *bts = vty->index;
1522 bts->rach_ldavg_slots = atoi(argv[0]);
1523 return CMD_SUCCESS;
1524}
1525
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02001526DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1527 "cell barred (0|1)",
1528 "Should this cell be barred from access?")
1529{
1530 struct gsm_bts *bts = vty->index;
1531
Harald Welte8c973ba2009-12-21 23:08:18 +01001532 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02001533
1534 return CMD_SUCCESS;
1535}
1536
Holger Hans Peter Freyther440984b2010-05-14 00:39:19 +08001537DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd,
1538 "rach emergency call allowed (0|1)",
1539 "Should this cell allow emergency calls?")
1540{
1541 struct gsm_bts *bts = vty->index;
1542
1543 if (atoi(argv[0]) == 0)
1544 bts->si_common.rach_control.t2 |= 0x4;
1545 else
1546 bts->si_common.rach_control.t2 &= ~0x4;
1547
1548 return CMD_SUCCESS;
1549}
1550
Harald Welte (local)cbd46102009-08-13 10:14:26 +02001551DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1552 "ms max power <0-40>",
1553 "Maximum transmit power of the MS")
1554{
1555 struct gsm_bts *bts = vty->index;
1556
1557 bts->ms_max_power = atoi(argv[0]);
1558
1559 return CMD_SUCCESS;
1560}
1561
Harald Welteb761bf82009-12-12 18:17:25 +01001562DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1563 "cell reselection hysteresis <0-14>",
1564 "Cell Re-Selection Hysteresis in dB")
1565{
1566 struct gsm_bts *bts = vty->index;
1567
1568 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1569
1570 return CMD_SUCCESS;
1571}
1572
1573DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1574 "rxlev access min <0-63>",
1575 "Minimum RxLev needed for cell access (better than -110dBm)")
1576{
1577 struct gsm_bts *bts = vty->index;
1578
1579 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1580
1581 return CMD_SUCCESS;
1582}
1583
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02001584DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1585 "periodic location update <0-1530>",
1586 "Periodic Location Updating Interval in Minutes")
1587{
1588 struct gsm_bts *bts = vty->index;
1589
Harald Weltea54a2bb2009-12-01 18:04:30 +05301590 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 10;
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02001591
1592 return CMD_SUCCESS;
1593}
1594
Harald Welte9e002452010-05-11 21:53:49 +02001595#define GPRS_TEXT "GPRS Packet Network\n"
1596
Harald Welte410575a2010-03-14 23:30:30 +08001597DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welteb42fe342010-04-18 14:00:26 +02001598 "gprs cell bvci <2-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001599 GPRS_TEXT
1600 "GPRS Cell Settings\n"
Harald Welte3055e332010-03-14 15:37:43 +08001601 "GPRS BSSGP VC Identifier")
1602{
1603 struct gsm_bts *bts = vty->index;
1604
Harald Weltecb20b7a2010-04-18 15:51:20 +02001605 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001606 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1607 return CMD_WARNING;
1608 }
1609
Harald Welte3055e332010-03-14 15:37:43 +08001610 bts->gprs.cell.bvci = atoi(argv[0]);
1611
1612 return CMD_SUCCESS;
1613}
1614
Harald Welte4a048c52010-03-22 11:48:36 +08001615DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
1616 "gprs nsei <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001617 GPRS_TEXT
Harald Welte4a048c52010-03-22 11:48:36 +08001618 "GPRS NS Entity Identifier")
1619{
1620 struct gsm_bts *bts = vty->index;
1621
Harald Weltecb20b7a2010-04-18 15:51:20 +02001622 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte4a048c52010-03-22 11:48:36 +08001623 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1624 return CMD_WARNING;
1625 }
1626
1627 bts->gprs.nse.nsei = atoi(argv[0]);
1628
1629 return CMD_SUCCESS;
1630}
1631
Harald Welte9e002452010-05-11 21:53:49 +02001632#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
1633 "NSVC Logical Number\n"
Harald Welte4a048c52010-03-22 11:48:36 +08001634
Harald Welte3055e332010-03-14 15:37:43 +08001635DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
1636 "gprs nsvc <0-1> nsvci <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001637 GPRS_TEXT NSVC_TEXT
1638 "NS Virtual Connection Identifier\n"
Harald Welte3055e332010-03-14 15:37:43 +08001639 "GPRS NS VC Identifier")
1640{
1641 struct gsm_bts *bts = vty->index;
1642 int idx = atoi(argv[0]);
1643
Harald Weltecb20b7a2010-04-18 15:51:20 +02001644 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001645 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1646 return CMD_WARNING;
1647 }
1648
Harald Welte3055e332010-03-14 15:37:43 +08001649 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
1650
1651 return CMD_SUCCESS;
1652}
1653
Harald Welte410575a2010-03-14 23:30:30 +08001654DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
1655 "gprs nsvc <0-1> local udp port <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001656 GPRS_TEXT NSVC_TEXT
Harald Welte410575a2010-03-14 23:30:30 +08001657 "GPRS NS Local UDP Port")
1658{
1659 struct gsm_bts *bts = vty->index;
1660 int idx = atoi(argv[0]);
1661
Harald Weltecb20b7a2010-04-18 15:51:20 +02001662 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001663 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1664 return CMD_WARNING;
1665 }
1666
Harald Welte410575a2010-03-14 23:30:30 +08001667 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
1668
1669 return CMD_SUCCESS;
1670}
1671
1672DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
1673 "gprs nsvc <0-1> remote udp port <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001674 GPRS_TEXT NSVC_TEXT
Harald Welte410575a2010-03-14 23:30:30 +08001675 "GPRS NS Remote UDP Port")
1676{
1677 struct gsm_bts *bts = vty->index;
1678 int idx = atoi(argv[0]);
1679
Harald Weltecb20b7a2010-04-18 15:51:20 +02001680 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001681 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1682 return CMD_WARNING;
1683 }
1684
Harald Welte410575a2010-03-14 23:30:30 +08001685 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
1686
1687 return CMD_SUCCESS;
1688}
1689
1690DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
1691 "gprs nsvc <0-1> remote ip A.B.C.D",
Harald Welte9e002452010-05-11 21:53:49 +02001692 GPRS_TEXT NSVC_TEXT
Harald Welte410575a2010-03-14 23:30:30 +08001693 "GPRS NS Remote IP Address")
1694{
1695 struct gsm_bts *bts = vty->index;
1696 int idx = atoi(argv[0]);
1697 struct in_addr ia;
1698
Harald Weltecb20b7a2010-04-18 15:51:20 +02001699 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001700 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1701 return CMD_WARNING;
1702 }
1703
Harald Welte410575a2010-03-14 23:30:30 +08001704 inet_aton(argv[1], &ia);
1705 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
1706
1707 return CMD_SUCCESS;
1708}
1709
Harald Weltea9251762010-05-11 23:50:21 +02001710DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd,
1711 "gprs ns timer " NS_TIMERS " <0-255>",
1712 GPRS_TEXT "Network Service\n"
1713 "Network Service Timer\n"
1714 NS_TIMERS_HELP "Timer Value\n")
1715{
1716 struct gsm_bts *bts = vty->index;
1717 int idx = get_string_value(gprs_ns_timer_strs, argv[0]);
1718 int val = atoi(argv[1]);
1719
1720 if (bts->gprs.mode == BTS_GPRS_NONE) {
1721 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1722 return CMD_WARNING;
1723 }
1724
1725 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
1726 return CMD_WARNING;
1727
1728 bts->gprs.nse.timer[idx] = val;
1729
1730 return CMD_SUCCESS;
1731}
1732
1733#define BSSGP_TIMERS "(blocking-timer|blocking-retries|unblocking-retries|reset-timer|reset-retries|suspend-timer|suspend-retries|resume-timer|resume-retries|capability-update-timer|capability-update-retries)"
Harald Welte18ce31c2010-05-14 20:05:17 +02001734#define BSSGP_TIMERS_HELP \
1735 "Tbvc-block timeout\n" \
1736 "Tbvc-block retries\n" \
1737 "Tbvc-unblock retries\n" \
1738 "Tbvcc-reset timeout\n" \
1739 "Tbvc-reset retries\n" \
1740 "Tbvc-suspend timeout\n" \
1741 "Tbvc-suspend retries\n" \
1742 "Tbvc-resume timeout\n" \
1743 "Tbvc-resume retries\n" \
1744 "Tbvc-capa-update timeout\n" \
1745 "Tbvc-capa-update retries\n"
Harald Weltea9251762010-05-11 23:50:21 +02001746
1747DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd,
1748 "gprs cell timer " BSSGP_TIMERS " <0-255>",
1749 GPRS_TEXT "Cell / BSSGP\n"
1750 "Cell/BSSGP Timer\n"
1751 BSSGP_TIMERS_HELP "Timer Value\n")
1752{
1753 struct gsm_bts *bts = vty->index;
1754 int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
1755 int val = atoi(argv[1]);
1756
1757 if (bts->gprs.mode == BTS_GPRS_NONE) {
1758 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1759 return CMD_WARNING;
1760 }
1761
1762 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer))
1763 return CMD_WARNING;
1764
1765 bts->gprs.cell.timer[idx] = val;
1766
1767 return CMD_SUCCESS;
1768}
1769
Harald Welte3055e332010-03-14 15:37:43 +08001770DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
1771 "gprs routing area <0-255>",
Harald Welte9e002452010-05-11 21:53:49 +02001772 GPRS_TEXT
Harald Welte3055e332010-03-14 15:37:43 +08001773 "GPRS Routing Area Code")
1774{
1775 struct gsm_bts *bts = vty->index;
1776
Harald Weltecb20b7a2010-04-18 15:51:20 +02001777 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001778 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1779 return CMD_WARNING;
1780 }
1781
Harald Welte3055e332010-03-14 15:37:43 +08001782 bts->gprs.rac = atoi(argv[0]);
1783
1784 return CMD_SUCCESS;
1785}
1786
Harald Weltecb20b7a2010-04-18 15:51:20 +02001787DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
1788 "gprs mode (none|gprs|egprs)",
Harald Welte9e002452010-05-11 21:53:49 +02001789 GPRS_TEXT
1790 "GPRS Mode for this BTS\n"
1791 "GPRS Disabled on this BTS\n"
1792 "GPRS Enabled on this BTS\n"
1793 "EGPRS (EDGE) Enabled on this BTS\n")
Harald Welte410575a2010-03-14 23:30:30 +08001794{
1795 struct gsm_bts *bts = vty->index;
1796
Harald Weltecb20b7a2010-04-18 15:51:20 +02001797 bts->gprs.mode = bts_gprs_mode_parse(argv[0]);
Harald Welte410575a2010-03-14 23:30:30 +08001798
1799 return CMD_SUCCESS;
1800}
1801
Harald Welte9e002452010-05-11 21:53:49 +02001802#define TRX_TEXT "Radio Transceiver\n"
Harald Welte3e774612009-08-10 13:48:16 +02001803
Harald Welte59b04682009-06-10 05:40:52 +08001804/* per TRX configuration */
1805DEFUN(cfg_trx,
1806 cfg_trx_cmd,
1807 "trx TRX_NR",
Harald Welte9e002452010-05-11 21:53:49 +02001808 TRX_TEXT
Harald Welte59b04682009-06-10 05:40:52 +08001809 "Select a TRX to configure")
1810{
1811 int trx_nr = atoi(argv[0]);
1812 struct gsm_bts *bts = vty->index;
1813 struct gsm_bts_trx *trx;
1814
Harald Weltee712a5f2009-06-21 16:17:15 +02001815 if (trx_nr > bts->num_trx) {
1816 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
1817 bts->num_trx, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +08001818 return CMD_WARNING;
Harald Weltee712a5f2009-06-21 16:17:15 +02001819 } else if (trx_nr == bts->num_trx) {
1820 /* we need to allocate a new one */
1821 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +02001822 } else
Harald Weltee712a5f2009-06-21 16:17:15 +02001823 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +02001824
Harald Weltee712a5f2009-06-21 16:17:15 +02001825 if (!trx)
1826 return CMD_WARNING;
Harald Welte59b04682009-06-10 05:40:52 +08001827
1828 vty->index = trx;
Harald Welte8791dac2010-05-14 17:59:53 +02001829 vty->index_sub = &trx->description;
Harald Welte59b04682009-06-10 05:40:52 +08001830 vty->node = TRX_NODE;
1831
1832 return CMD_SUCCESS;
1833}
1834
1835DEFUN(cfg_trx_arfcn,
1836 cfg_trx_arfcn_cmd,
Harald Welte00044592010-05-14 19:00:52 +02001837 "arfcn <0-1024>",
Harald Welte59b04682009-06-10 05:40:52 +08001838 "Set the ARFCN for this TRX\n")
1839{
1840 int arfcn = atoi(argv[0]);
1841 struct gsm_bts_trx *trx = vty->index;
1842
1843 /* FIXME: check if this ARFCN is supported by this TRX */
1844
1845 trx->arfcn = arfcn;
1846
1847 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
1848 /* FIXME: use OML layer to update the ARFCN */
1849 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
1850
1851 return CMD_SUCCESS;
1852}
1853
Harald Welte (local)b709bfe2009-12-27 20:56:38 +01001854DEFUN(cfg_trx_nominal_power,
1855 cfg_trx_nominal_power_cmd,
1856 "nominal power <0-100>",
1857 "Nominal TRX RF Power in dB\n")
1858{
1859 struct gsm_bts_trx *trx = vty->index;
1860
1861 trx->nominal_power = atoi(argv[0]);
1862
1863 return CMD_SUCCESS;
1864}
1865
Harald Welte91afe4c2009-06-20 18:15:19 +02001866DEFUN(cfg_trx_max_power_red,
1867 cfg_trx_max_power_red_cmd,
1868 "max_power_red <0-100>",
1869 "Reduction of maximum BS RF Power in dB\n")
1870{
1871 int maxpwr_r = atoi(argv[0]);
1872 struct gsm_bts_trx *trx = vty->index;
Harald Welte01acd742009-11-18 09:20:22 +01001873 int upper_limit = 24; /* default 12.21 max power red. */
Harald Welte91afe4c2009-06-20 18:15:19 +02001874
1875 /* FIXME: check if our BTS type supports more than 12 */
1876 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
1877 vty_out(vty, "%% Power %d dB is not in the valid range%s",
1878 maxpwr_r, VTY_NEWLINE);
1879 return CMD_WARNING;
1880 }
1881 if (maxpwr_r & 1) {
1882 vty_out(vty, "%% Power %d dB is not an even value%s",
1883 maxpwr_r, VTY_NEWLINE);
1884 return CMD_WARNING;
1885 }
1886
1887 trx->max_power_red = maxpwr_r;
1888
1889 /* FIXME: make sure we update this using OML */
1890
1891 return CMD_SUCCESS;
1892}
1893
Harald Welte62868882009-08-08 16:12:58 +02001894DEFUN(cfg_trx_rsl_e1,
1895 cfg_trx_rsl_e1_cmd,
1896 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
1897 "E1 interface to be used for RSL\n")
1898{
1899 struct gsm_bts_trx *trx = vty->index;
1900
1901 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
1902
1903 return CMD_SUCCESS;
1904}
1905
1906DEFUN(cfg_trx_rsl_e1_tei,
1907 cfg_trx_rsl_e1_tei_cmd,
1908 "rsl e1 tei <0-63>",
1909 "Set the TEI to be used for RSL")
1910{
1911 struct gsm_bts_trx *trx = vty->index;
1912
1913 trx->rsl_tei = atoi(argv[0]);
1914
1915 return CMD_SUCCESS;
1916}
1917
Holger Hans Peter Freyther1c8b4802009-11-11 11:54:24 +01001918DEFUN(cfg_trx_rf_locked,
1919 cfg_trx_rf_locked_cmd,
1920 "rf_locked (0|1)",
1921 "Turn off RF of the TRX.\n")
1922{
1923 int locked = atoi(argv[0]);
1924 struct gsm_bts_trx *trx = vty->index;
1925
1926 gsm_trx_lock_rf(trx, locked);
1927 return CMD_SUCCESS;
1928}
Harald Welte62868882009-08-08 16:12:58 +02001929
Harald Welte59b04682009-06-10 05:40:52 +08001930/* per TS configuration */
1931DEFUN(cfg_ts,
1932 cfg_ts_cmd,
Harald Welte62868882009-08-08 16:12:58 +02001933 "timeslot <0-7>",
Harald Welte59b04682009-06-10 05:40:52 +08001934 "Select a Timeslot to configure")
1935{
1936 int ts_nr = atoi(argv[0]);
1937 struct gsm_bts_trx *trx = vty->index;
1938 struct gsm_bts_trx_ts *ts;
1939
1940 if (ts_nr >= TRX_NR_TS) {
1941 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
1942 TRX_NR_TS, VTY_NEWLINE);
1943 return CMD_WARNING;
1944 }
1945
1946 ts = &trx->ts[ts_nr];
1947
1948 vty->index = ts;
1949 vty->node = TS_NODE;
1950
1951 return CMD_SUCCESS;
1952}
1953
Harald Welte3ffe1b32009-08-07 00:25:23 +02001954DEFUN(cfg_ts_pchan,
1955 cfg_ts_pchan_cmd,
1956 "phys_chan_config PCHAN",
1957 "Physical Channel configuration (TCH/SDCCH/...)")
1958{
1959 struct gsm_bts_trx_ts *ts = vty->index;
1960 int pchanc;
1961
1962 pchanc = gsm_pchan_parse(argv[0]);
1963 if (pchanc < 0)
1964 return CMD_WARNING;
1965
1966 ts->pchan = pchanc;
1967
1968 return CMD_SUCCESS;
1969}
1970
1971DEFUN(cfg_ts_e1_subslot,
1972 cfg_ts_e1_subslot_cmd,
Harald Welte62868882009-08-08 16:12:58 +02001973 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte3ffe1b32009-08-07 00:25:23 +02001974 "E1 sub-slot connected to this on-air timeslot")
1975{
1976 struct gsm_bts_trx_ts *ts = vty->index;
1977
Harald Welte62868882009-08-08 16:12:58 +02001978 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Welte3ffe1b32009-08-07 00:25:23 +02001979
1980 return CMD_SUCCESS;
1981}
Harald Welte59b04682009-06-10 05:40:52 +08001982
Harald Weltea5b1dae2010-05-16 21:47:13 +02001983void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
1984{
1985 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
1986 counter_get(net->stats.chreq.total),
1987 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
1988 vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
1989 counter_get(net->stats.chan.rf_fail),
1990 counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
1991 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
1992 counter_get(net->stats.paging.attempted),
1993 counter_get(net->stats.paging.completed),
1994 counter_get(net->stats.paging.expired), VTY_NEWLINE);
1995 vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
1996 counter_get(net->stats.bts.oml_fail),
1997 counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
1998}
1999
Harald Welte682ee5f2010-05-16 22:02:16 +02002000DEFUN(logging_fltr_imsi,
2001 logging_fltr_imsi_cmd,
2002 "logging filter imsi IMSI",
2003 LOGGING_STR FILTER_STR
2004 "Filter log messages by IMSI\n" "IMSI to be used as filter\n")
2005{
2006 struct telnet_connection *conn;
2007
2008 conn = (struct telnet_connection *) vty->priv;
2009 if (!conn->dbg) {
2010 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
2011 return CMD_WARNING;
2012 }
2013
2014 log_set_imsi_filter(conn->dbg, argv[0]);
2015 return CMD_SUCCESS;
2016}
2017
Harald Welte40152872010-05-16 20:52:23 +02002018extern int bsc_vty_init_extra(void);
Harald Welte10c29f62010-05-16 19:20:24 +02002019extern const char *openbsc_copyright;
Holger Hans Peter Freytherc48a2a12010-04-10 00:08:28 +02002020
Harald Welte40152872010-05-16 20:52:23 +02002021int bsc_vty_init(void)
Harald Welte59b04682009-06-10 05:40:52 +08002022{
Harald Welte7bc28f62010-05-12 16:10:35 +00002023 install_element_ve(&show_net_cmd);
2024 install_element_ve(&show_bts_cmd);
2025 install_element_ve(&show_trx_cmd);
2026 install_element_ve(&show_ts_cmd);
2027 install_element_ve(&show_lchan_cmd);
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +08002028 install_element_ve(&show_lchan_summary_cmd);
Harald Welte682ee5f2010-05-16 22:02:16 +02002029 install_element_ve(&logging_fltr_imsi_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002030
Harald Welte7bc28f62010-05-12 16:10:35 +00002031 install_element_ve(&show_e1drv_cmd);
2032 install_element_ve(&show_e1line_cmd);
2033 install_element_ve(&show_e1ts_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002034
Harald Welte7bc28f62010-05-12 16:10:35 +00002035 install_element_ve(&show_paging_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002036
Harald Welte682ee5f2010-05-16 22:02:16 +02002037 logging_vty_add_cmds();
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +01002038
Harald Weltee87eb462009-08-07 13:29:14 +02002039 install_element(CONFIG_NODE, &cfg_net_cmd);
2040 install_node(&net_node, config_write_net);
2041 install_default(GSMNET_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002042 install_element(GSMNET_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002043 install_element(GSMNET_NODE, &ournode_end_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002044 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Weltee87eb462009-08-07 13:29:14 +02002045 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
2046 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
2047 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02002048 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte59936d72009-11-18 20:33:19 +01002049 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Weltecca253a2009-08-30 15:47:06 +09002050 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01002051 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welte52af1952009-12-13 10:53:12 +01002052 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte284ddba2009-12-14 17:49:15 +01002053 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Welte0af9c9f2009-12-19 21:41:52 +01002054 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Weltea8062f12009-12-21 16:51:50 +01002055 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
2056 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
2057 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
2058 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
2059 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
2060 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01002061 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +01002062 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
2063 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
2064 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
2065 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
2066 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
2067 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
2068 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
2069 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
2070 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
2071 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Harald Weltee87eb462009-08-07 13:29:14 +02002072
2073 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte97ceef92009-08-06 19:06:46 +02002074 install_node(&bts_node, config_write_bts);
Harald Welte59b04682009-06-10 05:40:52 +08002075 install_default(BTS_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002076 install_element(BTS_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002077 install_element(BTS_NODE, &ournode_end_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002078 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte8791dac2010-05-14 17:59:53 +02002079 install_element(BTS_NODE, &cfg_description_cmd);
2080 install_element(BTS_NODE, &cfg_no_description_cmd);
Harald Welte91afe4c2009-06-20 18:15:19 +02002081 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +02002082 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002083 install_element(BTS_NODE, &cfg_bts_lac_cmd);
2084 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002085 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002086 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte25572872009-10-20 00:22:00 +02002087 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002088 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
2089 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte3e774612009-08-10 13:48:16 +02002090 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01002091 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
2092 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08002093 install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd);
2094 install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd);
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02002095 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Holger Hans Peter Freyther440984b2010-05-14 00:39:19 +08002096 install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd);
Harald Welte (local)cbd46102009-08-13 10:14:26 +02002097 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02002098 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welteb761bf82009-12-12 18:17:25 +01002099 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
2100 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Harald Weltecb20b7a2010-04-18 15:51:20 +02002101 install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
Harald Weltea9251762010-05-11 23:50:21 +02002102 install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd);
Harald Welte3055e332010-03-14 15:37:43 +08002103 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
2104 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Weltea9251762010-05-11 23:50:21 +02002105 install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
Harald Welte4a048c52010-03-22 11:48:36 +08002106 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte3055e332010-03-14 15:37:43 +08002107 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welte410575a2010-03-14 23:30:30 +08002108 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
2109 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
2110 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002111
2112 install_element(BTS_NODE, &cfg_trx_cmd);
2113 install_node(&trx_node, dummy_config_write);
2114 install_default(TRX_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002115 install_element(TRX_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002116 install_element(TRX_NODE, &ournode_end_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002117 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte8791dac2010-05-14 17:59:53 +02002118 install_element(TRX_NODE, &cfg_description_cmd);
2119 install_element(TRX_NODE, &cfg_no_description_cmd);
Harald Welte (local)b709bfe2009-12-27 20:56:38 +01002120 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte7f597bc2009-06-20 22:36:12 +02002121 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002122 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
2123 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther1c8b4802009-11-11 11:54:24 +01002124 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002125
2126 install_element(TRX_NODE, &cfg_ts_cmd);
2127 install_node(&ts_node, dummy_config_write);
2128 install_default(TS_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002129 install_element(TS_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002130 install_element(TS_NODE, &ournode_end_cmd);
Harald Welte3ffe1b32009-08-07 00:25:23 +02002131 install_element(TS_NODE, &cfg_ts_pchan_cmd);
2132 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002133
Harald Welte40152872010-05-16 20:52:23 +02002134 bsc_vty_init_extra();
Harald Welte59b04682009-06-10 05:40:52 +08002135
2136 return 0;
2137}