blob: 5a89af0bfc2fb2c820c1e997ae75eb7f5f9d393c [file] [log] [blame]
Harald Welte59b04682009-06-10 05:40:52 +08001/* OpenBSC interface to quagga VTY */
Harald Welte410575a2010-03-14 23:30:30 +08002/* (C) 2009-2010 by Harald Welte <laforge@gnumonks.org>
Harald Welte59b04682009-06-10 05:40:52 +08003 * All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#include <stdlib.h>
22#include <unistd.h>
23#include <sys/types.h>
24
25#include <vty/command.h>
Harald Welte684b9752009-08-09 15:13:54 +020026#include <vty/buffer.h>
Harald Welte59b04682009-06-10 05:40:52 +080027#include <vty/vty.h>
28
29#include <arpa/inet.h>
30
Harald Weltef4625b12010-02-20 16:24:02 +010031#include <osmocore/linuxlist.h>
Harald Welte59b04682009-06-10 05:40:52 +080032#include <openbsc/gsm_data.h>
Harald Welte59b04682009-06-10 05:40:52 +080033#include <openbsc/e1_input.h>
34#include <openbsc/abis_nm.h>
Harald Weltef4625b12010-02-20 16:24:02 +010035#include <osmocore/gsm_utils.h>
Harald Weltefe96f382009-12-22 13:09:29 +010036#include <openbsc/chan_alloc.h>
Harald Welte44007742009-12-22 21:43:14 +010037#include <openbsc/meas_rep.h>
Harald Welte59b04682009-06-10 05:40:52 +080038#include <openbsc/db.h>
Harald Weltef4625b12010-02-20 16:24:02 +010039#include <osmocore/talloc.h>
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +010040#include <openbsc/telnet_interface.h>
Holger Hans Peter Freytherb70d45b2010-04-06 11:55:37 +020041#include <openbsc/vty.h>
Harald Weltef45981f2010-05-12 20:28:04 +020042#include <openbsc/gprs_ns.h>
Harald Welte682ee5f2010-05-16 22:02:16 +020043#include <openbsc/debug.h>
Harald Welte59b04682009-06-10 05:40:52 +080044
Harald Welte10c29f62010-05-16 19:20:24 +020045#include "../bscconfig.h"
46
Harald Welted6b62e32010-05-12 17:19:53 +000047/* FIXME: this should go to some common file */
48static const struct value_string gprs_ns_timer_strs[] = {
Harald Weltea9251762010-05-11 23:50:21 +020049 { 0, "tns-block" },
50 { 1, "tns-block-retries" },
51 { 2, "tns-reset" },
52 { 3, "tns-reset-retries" },
53 { 4, "tns-test" },
54 { 5, "tns-alive" },
55 { 6, "tns-alive-retries" },
56 { 0, NULL }
57};
58
Harald Welted6b62e32010-05-12 17:19:53 +000059static const struct value_string gprs_bssgp_cfg_strs[] = {
Harald Weltea9251762010-05-11 23:50:21 +020060 { 0, "blocking-timer" },
61 { 1, "blocking-retries" },
62 { 2, "unblocking-retries" },
63 { 3, "reset-timer" },
64 { 4, "reset-retries" },
65 { 5, "suspend-timer" },
66 { 6, "suspend-retries" },
67 { 7, "resume-timer" },
68 { 8, "resume-retries" },
69 { 9, "capability-update-timer" },
70 { 10, "capability-update-retries" },
71 { 0, NULL }
72};
73
Harald Weltee87eb462009-08-07 13:29:14 +020074struct cmd_node net_node = {
75 GSMNET_NODE,
76 "%s(network)#",
77 1,
78};
79
Harald Welte59b04682009-06-10 05:40:52 +080080struct cmd_node bts_node = {
81 BTS_NODE,
82 "%s(bts)#",
83 1,
84};
85
86struct cmd_node trx_node = {
87 TRX_NODE,
88 "%s(trx)#",
89 1,
90};
91
92struct cmd_node ts_node = {
93 TS_NODE,
94 "%s(ts)#",
95 1,
96};
97
Harald Welte40152872010-05-16 20:52:23 +020098struct gsm_network *gsmnet_from_vty(struct vty *v)
99{
100 struct telnet_connection *conn = v->priv;
101 return (struct gsm_network *) conn->priv;
102}
103
Harald Welte59b04682009-06-10 05:40:52 +0800104static int dummy_config_write(struct vty *v)
105{
106 return CMD_SUCCESS;
107}
108
109static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
110{
111 vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s",
112 nm_opstate_name(nms->operational), nms->administrative,
113 nm_avail_name(nms->availability), VTY_NEWLINE);
114}
115
Harald Weltefe96f382009-12-22 13:09:29 +0100116static void dump_pchan_load_vty(struct vty *vty, char *prefix,
117 const struct pchan_load *pl)
118{
119 int i;
120
121 for (i = 0; i < ARRAY_SIZE(pl->pchan); i++) {
122 const struct load_counter *lc = &pl->pchan[i];
123 unsigned int percent;
124
125 if (lc->total == 0)
126 continue;
127
128 percent = (lc->used * 100) / lc->total;
129
130 vty_out(vty, "%s%20s: %3u%% (%u/%u)%s", prefix,
131 gsm_pchan_name(i), percent, lc->used, lc->total,
132 VTY_NEWLINE);
133 }
134}
135
Harald Welte59b04682009-06-10 05:40:52 +0800136static void net_dump_vty(struct vty *vty, struct gsm_network *net)
137{
Harald Weltefe96f382009-12-22 13:09:29 +0100138 struct pchan_load pl;
139
Harald Welte59b04682009-06-10 05:40:52 +0800140 vty_out(vty, "BSC is on Country Code %u, Network Code %u "
141 "and has %u BTS%s", net->country_code, net->network_code,
142 net->num_bts, VTY_NEWLINE);
143 vty_out(vty, " Long network name: '%s'%s",
144 net->name_long, VTY_NEWLINE);
145 vty_out(vty, " Short network name: '%s'%s",
146 net->name_short, VTY_NEWLINE);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +0200147 vty_out(vty, " Authentication policy: %s%s",
148 gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE);
Harald Welte59936d72009-11-18 20:33:19 +0100149 vty_out(vty, " Location updating reject cause: %u%s",
150 net->reject_cause, VTY_NEWLINE);
Harald Weltecca253a2009-08-30 15:47:06 +0900151 vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption,
152 VTY_NEWLINE);
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +0100153 vty_out(vty, " NECI (TCH/H): %u%s", net->neci,
154 VTY_NEWLINE);
Harald Welte52af1952009-12-13 10:53:12 +0100155 vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode),
156 VTY_NEWLINE);
Harald Weltea310f3e2009-12-14 09:00:24 +0100157 vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off",
158 VTY_NEWLINE);
Harald Welte0af9c9f2009-12-19 21:41:52 +0100159 vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off",
160 VTY_NEWLINE);
Harald Weltefe96f382009-12-22 13:09:29 +0100161 network_chan_load(&pl, net);
162 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
163 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte59b04682009-06-10 05:40:52 +0800164}
165
166DEFUN(show_net, show_net_cmd, "show network",
167 SHOW_STR "Display information about a GSM NETWORK\n")
168{
Harald Welte40152872010-05-16 20:52:23 +0200169 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800170 net_dump_vty(vty, net);
171
172 return CMD_SUCCESS;
173}
174
175static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l)
176{
177 struct e1inp_line *line;
178
179 if (!e1l) {
180 vty_out(vty, " None%s", VTY_NEWLINE);
181 return;
182 }
183
184 line = e1l->ts->line;
185
186 vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s",
187 line->num, line->driver->name, e1l->ts->num,
188 e1inp_signtype_name(e1l->type), VTY_NEWLINE);
189 vty_out(vty, " E1 TEI %u, SAPI %u%s",
190 e1l->tei, e1l->sapi, VTY_NEWLINE);
191}
192
193static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
194{
Harald Weltefe96f382009-12-22 13:09:29 +0100195 struct pchan_load pl;
196
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +0200197 vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
Harald Welte91afe4c2009-06-20 18:15:19 +0200198 "BSIC %u, TSC %u and %u TRX%s",
199 bts->nr, btstype2str(bts->type), gsm_band_name(bts->band),
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +0200200 bts->cell_identity,
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +0200201 bts->location_area_code, bts->bsic, bts->tsc,
Harald Welte91afe4c2009-06-20 18:15:19 +0200202 bts->num_trx, VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200203 vty_out(vty, "Description: %s%s",
204 bts->description ? bts->description : "(null)", VTY_NEWLINE);
Harald Welte8e9d1792009-12-12 15:38:16 +0100205 vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100206 vty_out(vty, "Minimum Rx Level for Access: %i dBm%s",
Harald Welte8e9d1792009-12-12 15:38:16 +0100207 rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min),
208 VTY_NEWLINE);
209 vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s",
Harald Welteb761bf82009-12-12 18:17:25 +0100210 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +0100211 vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer,
212 VTY_NEWLINE);
213 vty_out(vty, "RACH Max transmissions: %u%s",
214 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
215 VTY_NEWLINE);
Harald Welte8c973ba2009-12-21 23:08:18 +0100216 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)e19be3f2009-08-12 13:28:23 +0200217 vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800218 if (is_ipaccess_bts(bts))
Harald Welte25572872009-10-20 00:22:00 +0200219 vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
Harald Welte59b04682009-06-10 05:40:52 +0800220 bts->ip_access.site_id, bts->ip_access.bts_id,
Harald Welte25572872009-10-20 00:22:00 +0200221 bts->oml_tei, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800222 vty_out(vty, " NM State: ");
223 net_dump_nmstate(vty, &bts->nm_state);
224 vty_out(vty, " Site Mgr NM State: ");
225 net_dump_nmstate(vty, &bts->site_mgr.nm_state);
226 vty_out(vty, " Paging: FIXME pending requests, %u free slots%s",
227 bts->paging.available_slots, VTY_NEWLINE);
Harald Welte25572872009-10-20 00:22:00 +0200228 if (!is_ipaccess_bts(bts)) {
229 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
230 e1isl_dump_vty(vty, bts->oml_link);
231 }
Harald Welte59b04682009-06-10 05:40:52 +0800232 /* FIXME: oml_link, chan_desc */
Harald Weltefe96f382009-12-22 13:09:29 +0100233 memset(&pl, 0, sizeof(pl));
234 bts_chan_load(&pl, bts);
235 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
236 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte59b04682009-06-10 05:40:52 +0800237}
238
239DEFUN(show_bts, show_bts_cmd, "show bts [number]",
240 SHOW_STR "Display information about a BTS\n"
241 "BTS number")
242{
Harald Welte40152872010-05-16 20:52:23 +0200243 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800244 int bts_nr;
245
246 if (argc != 0) {
247 /* use the BTS number that the user has specified */
248 bts_nr = atoi(argv[0]);
249 if (bts_nr > net->num_bts) {
250 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
251 VTY_NEWLINE);
252 return CMD_WARNING;
253 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200254 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte59b04682009-06-10 05:40:52 +0800255 return CMD_SUCCESS;
256 }
257 /* print all BTS's */
258 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee712a5f2009-06-21 16:17:15 +0200259 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte59b04682009-06-10 05:40:52 +0800260
261 return CMD_SUCCESS;
262}
263
Harald Welte62868882009-08-08 16:12:58 +0200264/* utility functions */
265static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
266 const char *ts, const char *ss)
267{
268 e1_link->e1_nr = atoi(line);
269 e1_link->e1_ts = atoi(ts);
270 if (!strcmp(ss, "full"))
271 e1_link->e1_ts_ss = 255;
272 else
273 e1_link->e1_ts_ss = atoi(ss);
274}
275
276static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,
277 const char *prefix)
278{
279 if (!e1_link->e1_ts)
280 return;
281
282 if (e1_link->e1_ts_ss == 255)
283 vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s",
284 prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE);
285 else
286 vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s",
287 prefix, e1_link->e1_nr, e1_link->e1_ts,
288 e1_link->e1_ts_ss, VTY_NEWLINE);
289}
290
291
Harald Welte97ceef92009-08-06 19:06:46 +0200292static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
293{
Harald Welte62868882009-08-08 16:12:58 +0200294 vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
295 if (ts->pchan != GSM_PCHAN_NONE)
296 vty_out(vty, " phys_chan_config %s%s",
297 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
298 config_write_e1_link(vty, &ts->e1_link, " ");
Harald Welte97ceef92009-08-06 19:06:46 +0200299}
300
301static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
302{
303 int i;
304
Harald Weltee87eb462009-08-07 13:29:14 +0200305 vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200306 if (trx->description)
307 vty_out(vty, " description %s%s", trx->description,
308 VTY_NEWLINE);
Holger Hans Peter Freyther32be2aa2010-04-17 06:42:07 +0200309 vty_out(vty, " rf_locked %u%s",
310 trx->nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
311 VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200312 vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
Harald Welte (local)b709bfe2009-12-27 20:56:38 +0100313 vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200314 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200315 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
316 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte97ceef92009-08-06 19:06:46 +0200317
318 for (i = 0; i < TRX_NR_TS; i++)
319 config_write_ts_single(vty, &trx->ts[i]);
320}
321
Harald Weltea9251762010-05-11 23:50:21 +0200322static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
323{
324 unsigned int i;
325 vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode),
326 VTY_NEWLINE);
327 if (bts->gprs.mode == BTS_GPRS_NONE)
328 return;
329
330 vty_out(vty, " gprs routing area %u%s", bts->gprs.rac,
331 VTY_NEWLINE);
332 vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
333 VTY_NEWLINE);
334 for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++)
335 vty_out(vty, " gprs cell timer %s %u%s",
336 get_value_string(gprs_bssgp_cfg_strs, i),
337 bts->gprs.cell.timer[i], VTY_NEWLINE);
338 vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei,
339 VTY_NEWLINE);
340 for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++)
341 vty_out(vty, " gprs ns timer %s %u%s",
342 get_value_string(gprs_ns_timer_strs, i),
343 bts->gprs.nse.timer[i], VTY_NEWLINE);
344 for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
345 struct gsm_bts_gprs_nsvc *nsvc =
346 &bts->gprs.nsvc[i];
347 struct in_addr ia;
348
349 ia.s_addr = htonl(nsvc->remote_ip);
350 vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
351 nsvc->nsvci, VTY_NEWLINE);
352 vty_out(vty, " gprs nsvc %u local udp port %u%s", i,
353 nsvc->local_port, VTY_NEWLINE);
354 vty_out(vty, " gprs nsvc %u remote udp port %u%s", i,
355 nsvc->remote_port, VTY_NEWLINE);
356 vty_out(vty, " gprs nsvc %u remote ip %s%s", i,
357 inet_ntoa(ia), VTY_NEWLINE);
358 }
359}
360
Harald Welte97ceef92009-08-06 19:06:46 +0200361static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
362{
363 struct gsm_bts_trx *trx;
364
Harald Weltee87eb462009-08-07 13:29:14 +0200365 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
366 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200367 if (bts->description)
368 vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200369 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freyther6d82b7c2009-11-19 16:38:49 +0100370 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200371 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte97ceef92009-08-06 19:06:46 +0200372 VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200373 vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE);
374 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)cbd46102009-08-13 10:14:26 +0200375 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100376 vty_out(vty, " cell reselection hysteresis %u%s",
377 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
378 vty_out(vty, " rxlev access min %u%s",
379 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Harald Weltea54a2bb2009-12-01 18:04:30 +0530380 if (bts->si_common.chan_desc.t3212)
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +0200381 vty_out(vty, " periodic location update %u%s",
Harald Weltea54a2bb2009-12-01 18:04:30 +0530382 bts->si_common.chan_desc.t3212 * 10, VTY_NEWLINE);
Harald Welte3e774612009-08-10 13:48:16 +0200383 vty_out(vty, " channel allocator %s%s",
384 bts->chan_alloc_reverse ? "descending" : "ascending",
385 VTY_NEWLINE);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +0100386 vty_out(vty, " rach tx integer %u%s",
387 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
388 vty_out(vty, " rach max transmission %u%s",
389 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
390 VTY_NEWLINE);
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +0800391
392 if (bts->rach_b_thresh != -1)
393 vty_out(vty, " rach nm busy threshold %u%s",
394 bts->rach_b_thresh, VTY_NEWLINE);
395 if (bts->rach_ldavg_slots != -1)
396 vty_out(vty, " rach nm load average %u%s",
397 bts->rach_ldavg_slots, VTY_NEWLINE);
Harald Welte8c973ba2009-12-21 23:08:18 +0100398 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)e19be3f2009-08-12 13:28:23 +0200399 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Holger Hans Peter Freyther440984b2010-05-14 00:39:19 +0800400 if ((bts->si_common.rach_control.t2 & 0x4) == 0)
401 vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE);
Harald Welte25572872009-10-20 00:22:00 +0200402 if (is_ipaccess_bts(bts)) {
Harald Weltee87eb462009-08-07 13:29:14 +0200403 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Welte3ffe1b32009-08-07 00:25:23 +0200404 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte25572872009-10-20 00:22:00 +0200405 vty_out(vty, " oml ip.access stream_id %u%s", bts->oml_tei, VTY_NEWLINE);
406 } else {
Harald Welte62868882009-08-08 16:12:58 +0200407 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
408 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
409 }
Harald Weltea9251762010-05-11 23:50:21 +0200410 config_write_bts_gprs(vty, bts);
Harald Welte97ceef92009-08-06 19:06:46 +0200411
412 llist_for_each_entry(trx, &bts->trx_list, list)
413 config_write_trx_single(vty, trx);
414}
415
416static int config_write_bts(struct vty *v)
417{
Harald Welte40152872010-05-16 20:52:23 +0200418 struct gsm_network *gsmnet = gsmnet_from_vty(v);
Harald Welte97ceef92009-08-06 19:06:46 +0200419 struct gsm_bts *bts;
420
421 llist_for_each_entry(bts, &gsmnet->bts_list, list)
422 config_write_bts_single(v, bts);
423
424 return CMD_SUCCESS;
425}
426
Harald Weltee87eb462009-08-07 13:29:14 +0200427static int config_write_net(struct vty *vty)
428{
Harald Welte40152872010-05-16 20:52:23 +0200429 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
430
Harald Weltee87eb462009-08-07 13:29:14 +0200431 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200432 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200433 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200434 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
435 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +0200436 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Harald Welte59936d72009-11-18 20:33:19 +0100437 vty_out(vty, " location updating reject cause %u%s",
438 gsmnet->reject_cause, VTY_NEWLINE);
Harald Weltecca253a2009-08-30 15:47:06 +0900439 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freyther6b4f5462009-11-19 16:37:48 +0100440 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Harald Welte52af1952009-12-13 10:53:12 +0100441 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
442 VTY_NEWLINE);
Harald Weltea310f3e2009-12-14 09:00:24 +0100443 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Welte0af9c9f2009-12-19 21:41:52 +0100444 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Weltea8062f12009-12-21 16:51:50 +0100445 vty_out(vty, " handover window rxlev averaging %u%s",
446 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
447 vty_out(vty, " handover window rxqual averaging %u%s",
448 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
449 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
450 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
451 vty_out(vty, " handover power budget interval %u%s",
452 gsmnet->handover.pwr_interval, VTY_NEWLINE);
453 vty_out(vty, " handover power budget hysteresis %u%s",
454 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
455 vty_out(vty, " handover maximum distance %u%s",
456 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +0100457 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +0100458 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
459 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
460 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
461 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
462 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
463 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
464 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
465 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
466 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
467 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200468
469 return CMD_SUCCESS;
470}
Harald Welte97ceef92009-08-06 19:06:46 +0200471
Harald Welte59b04682009-06-10 05:40:52 +0800472static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
473{
474 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
475 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200476 vty_out(vty, "Description: %s%s",
477 trx->description ? trx->description : "(null)", VTY_NEWLINE);
Harald Welte91afe4c2009-06-20 18:15:19 +0200478 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte62868882009-08-08 16:12:58 +0200479 "resulting BS power: %d dBm%s",
Harald Welte91afe4c2009-06-20 18:15:19 +0200480 trx->nominal_power, trx->max_power_red,
Harald Welte62868882009-08-08 16:12:58 +0200481 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800482 vty_out(vty, " NM State: ");
483 net_dump_nmstate(vty, &trx->nm_state);
484 vty_out(vty, " Baseband Transceiver NM State: ");
485 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte25572872009-10-20 00:22:00 +0200486 if (is_ipaccess_bts(trx->bts)) {
487 vty_out(vty, " ip.access stream ID: 0x%02x%s",
488 trx->rsl_tei, VTY_NEWLINE);
489 } else {
490 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
491 e1isl_dump_vty(vty, trx->rsl_link);
492 }
Harald Welte59b04682009-06-10 05:40:52 +0800493}
494
495DEFUN(show_trx,
496 show_trx_cmd,
497 "show trx [bts_nr] [trx_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200498 SHOW_STR "Display information about a TRX\n"
499 "BTS Number\n"
500 "TRX Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800501{
Harald Welte40152872010-05-16 20:52:23 +0200502 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800503 struct gsm_bts *bts = NULL;
504 struct gsm_bts_trx *trx;
505 int bts_nr, trx_nr;
506
507 if (argc >= 1) {
508 /* use the BTS number that the user has specified */
509 bts_nr = atoi(argv[0]);
510 if (bts_nr >= net->num_bts) {
511 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
512 VTY_NEWLINE);
513 return CMD_WARNING;
514 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200515 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800516 }
517 if (argc >= 2) {
518 trx_nr = atoi(argv[1]);
519 if (trx_nr >= bts->num_trx) {
520 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
521 VTY_NEWLINE);
522 return CMD_WARNING;
523 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200524 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800525 trx_dump_vty(vty, trx);
526 return CMD_SUCCESS;
527 }
528 if (bts) {
529 /* print all TRX in this BTS */
530 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200531 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800532 trx_dump_vty(vty, trx);
533 }
534 return CMD_SUCCESS;
535 }
536
537 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200538 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800539 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200540 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800541 trx_dump_vty(vty, trx);
542 }
543 }
544
545 return CMD_SUCCESS;
546}
547
Harald Welte97ceef92009-08-06 19:06:46 +0200548
Harald Welte59b04682009-06-10 05:40:52 +0800549static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
550{
Harald Welte59b04682009-06-10 05:40:52 +0800551 vty_out(vty, "Timeslot %u of TRX %u in BTS %u, phys cfg %s%s",
552 ts->nr, ts->trx->nr, ts->trx->bts->nr,
553 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
554 vty_out(vty, " NM State: ");
555 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte87504212009-12-02 01:56:49 +0530556 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welte59b04682009-06-10 05:40:52 +0800557 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
558 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
559 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800560}
561
562DEFUN(show_ts,
563 show_ts_cmd,
564 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200565 SHOW_STR "Display information about a TS\n"
566 "BTS Number\n" "TRX Number\n" "Timeslot Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800567{
Harald Welte40152872010-05-16 20:52:23 +0200568 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800569 struct gsm_bts *bts;
570 struct gsm_bts_trx *trx;
571 struct gsm_bts_trx_ts *ts;
572 int bts_nr, trx_nr, ts_nr;
573
574 if (argc >= 1) {
575 /* use the BTS number that the user has specified */
576 bts_nr = atoi(argv[0]);
577 if (bts_nr >= net->num_bts) {
578 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
579 VTY_NEWLINE);
580 return CMD_WARNING;
581 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200582 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800583 }
584 if (argc >= 2) {
585 trx_nr = atoi(argv[1]);
586 if (trx_nr >= bts->num_trx) {
587 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
588 VTY_NEWLINE);
589 return CMD_WARNING;
590 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200591 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800592 }
593 if (argc >= 3) {
594 ts_nr = atoi(argv[2]);
595 if (ts_nr >= TRX_NR_TS) {
596 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
597 VTY_NEWLINE);
598 return CMD_WARNING;
599 }
600 ts = &trx->ts[ts_nr];
601 ts_dump_vty(vty, ts);
602 return CMD_SUCCESS;
603 }
604 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200605 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800606 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200607 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800608 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
609 ts = &trx->ts[ts_nr];
610 ts_dump_vty(vty, ts);
611 }
612 }
613 }
614
615 return CMD_SUCCESS;
616}
617
Holger Hans Peter Freyther1dd0a1b2010-01-06 06:00:40 +0100618static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte59b04682009-06-10 05:40:52 +0800619{
Harald Welte91afe4c2009-06-20 18:15:19 +0200620 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte59b04682009-06-10 05:40:52 +0800621 subscr->authorized, VTY_NEWLINE);
622 if (subscr->name)
623 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
624 if (subscr->extension)
625 vty_out(vty, " Extension: %s%s", subscr->extension,
626 VTY_NEWLINE);
627 if (subscr->imsi)
628 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freythercd8bacf2009-08-19 12:53:57 +0200629 if (subscr->tmsi != GSM_RESERVED_TMSI)
630 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte270c06c2009-08-15 03:24:51 +0200631 VTY_NEWLINE);
Sylvain Munaute5863a22009-12-27 19:29:28 +0100632
Harald Welte (local)02d5efa2009-08-14 20:27:16 +0200633 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800634}
635
Harald Welte44007742009-12-22 21:43:14 +0100636static void meas_rep_dump_uni_vty(struct vty *vty,
637 struct gsm_meas_rep_unidir *mru,
638 const char *prefix,
639 const char *dir)
640{
641 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
642 prefix, dir, rxlev2dbm(mru->full.rx_lev),
643 dir, rxlev2dbm(mru->sub.rx_lev));
644 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
645 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
646 VTY_NEWLINE);
647}
648
649static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
650 const char *prefix)
651{
652 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
653 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
654 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
655 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
656 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
657 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
658 VTY_NEWLINE);
659 if (mr->flags & MEAS_REP_F_MS_TO)
660 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
661 mr->ms_timing_offset, VTY_NEWLINE);
662 if (mr->flags & MEAS_REP_F_MS_L1)
663 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
664 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
665 if (mr->flags & MEAS_REP_F_DL_VALID)
666 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
667 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
668}
669
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800670static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
Harald Welte59b04682009-06-10 05:40:52 +0800671{
Harald Welte44007742009-12-22 21:43:14 +0100672 int idx;
673
Harald Welte59b04682009-06-10 05:40:52 +0800674 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 +0200675 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
Harald Welte (local)02204d02009-12-27 18:05:25 +0100676 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Harald Welte59b04682009-06-10 05:40:52 +0800677 VTY_NEWLINE);
Holger Hans Peter Freyther065b8112010-03-23 06:41:45 +0100678 vty_out(vty, " Use Count: %u, State: %s%s", lchan->conn.use_count,
Harald Welteab2534c2009-12-29 10:52:38 +0100679 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100680 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
681 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
682 - lchan->bs_power*2,
683 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
684 VTY_NEWLINE);
Holger Hans Peter Freyther065b8112010-03-23 06:41:45 +0100685 if (lchan->conn.subscr) {
Harald Welte59b04682009-06-10 05:40:52 +0800686 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther065b8112010-03-23 06:41:45 +0100687 subscr_dump_vty(vty, lchan->conn.subscr);
Harald Welte59b04682009-06-10 05:40:52 +0800688 } else
689 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte87504212009-12-02 01:56:49 +0530690 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
691 struct in_addr ia;
Holger Hans Peter Freythercec1ec52010-04-07 15:39:16 +0200692 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte87504212009-12-02 01:56:49 +0530693 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
694 inet_ntoa(ia), lchan->abis_ip.bound_port,
695 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
696 VTY_NEWLINE);
697 }
Harald Welte44007742009-12-22 21:43:14 +0100698
699 /* we want to report the last measurement report */
700 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
701 lchan->meas_rep_idx, 1);
702 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte59b04682009-06-10 05:40:52 +0800703}
704
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +0800705static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
706{
Holger Hans Peter Freythercf13a922010-05-14 01:57:02 +0800707 struct gsm_meas_rep *mr;
708 int idx;
709
710 /* we want to report the last measurement report */
711 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
712 lchan->meas_rep_idx, 1);
713 mr = &lchan->meas_rep[idx];
714
715 vty_out(vty, "Lchan: %u Timeslot: %u TRX: %u BTS: %u Type: %s - L1 MS Power: %u dBm "
716 "RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +0800717 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
718 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Holger Hans Peter Freythercf13a922010-05-14 01:57:02 +0800719 mr->ms_l1.pwr,
720 rxlev2dbm(mr->dl.full.rx_lev),
721 rxlev2dbm(mr->ul.full.rx_lev),
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +0800722 VTY_NEWLINE);
723}
724
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800725static int lchan_summary(struct vty *vty, int argc, const char **argv,
726 void (*dump_cb)(struct vty *, struct gsm_lchan *))
Harald Welte59b04682009-06-10 05:40:52 +0800727{
Harald Welte40152872010-05-16 20:52:23 +0200728 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800729 struct gsm_bts *bts;
730 struct gsm_bts_trx *trx;
731 struct gsm_bts_trx_ts *ts;
732 struct gsm_lchan *lchan;
733 int bts_nr, trx_nr, ts_nr, lchan_nr;
734
735 if (argc >= 1) {
736 /* use the BTS number that the user has specified */
737 bts_nr = atoi(argv[0]);
738 if (bts_nr >= net->num_bts) {
739 vty_out(vty, "%% can't find BTS %s%s", argv[0],
740 VTY_NEWLINE);
741 return CMD_WARNING;
742 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200743 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800744 }
745 if (argc >= 2) {
746 trx_nr = atoi(argv[1]);
747 if (trx_nr >= bts->num_trx) {
748 vty_out(vty, "%% can't find TRX %s%s", argv[1],
749 VTY_NEWLINE);
750 return CMD_WARNING;
751 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200752 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800753 }
754 if (argc >= 3) {
755 ts_nr = atoi(argv[2]);
756 if (ts_nr >= TRX_NR_TS) {
757 vty_out(vty, "%% can't find TS %s%s", argv[2],
758 VTY_NEWLINE);
759 return CMD_WARNING;
760 }
761 ts = &trx->ts[ts_nr];
762 }
763 if (argc >= 4) {
764 lchan_nr = atoi(argv[3]);
765 if (lchan_nr >= TS_MAX_LCHAN) {
766 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
767 VTY_NEWLINE);
768 return CMD_WARNING;
769 }
770 lchan = &ts->lchan[lchan_nr];
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800771 dump_cb(vty, lchan);
Harald Welte59b04682009-06-10 05:40:52 +0800772 return CMD_SUCCESS;
773 }
774 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200775 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800776 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200777 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800778 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
779 ts = &trx->ts[ts_nr];
780 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
781 lchan_nr++) {
782 lchan = &ts->lchan[lchan_nr];
783 if (lchan->type == GSM_LCHAN_NONE)
784 continue;
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800785 dump_cb(vty, lchan);
Harald Welte59b04682009-06-10 05:40:52 +0800786 }
787 }
788 }
789 }
790
791 return CMD_SUCCESS;
792}
793
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800794
795DEFUN(show_lchan,
796 show_lchan_cmd,
797 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
798 SHOW_STR "Display information about a logical channel\n"
799 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
800 "Logical Channel Number\n")
801
802{
803 return lchan_summary(vty, argc, argv, lchan_dump_full_vty);
804}
805
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +0800806DEFUN(show_lchan_summary,
807 show_lchan_summary_cmd,
808 "show lchan summary [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
809 SHOW_STR "Display information about a logical channel\n"
810 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
811 "Logical Channel Number\n")
812{
813 return lchan_summary(vty, argc, argv, lchan_dump_short_vty);
814}
815
Harald Welte59b04682009-06-10 05:40:52 +0800816static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
817{
818 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
819}
820
821DEFUN(show_e1drv,
822 show_e1drv_cmd,
823 "show e1_driver",
824 SHOW_STR "Display information about available E1 drivers\n")
825{
826 struct e1inp_driver *drv;
827
828 llist_for_each_entry(drv, &e1inp_driver_list, list)
829 e1drv_dump_vty(vty, drv);
830
831 return CMD_SUCCESS;
832}
833
834static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
835{
836 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
837 line->num, line->name ? line->name : "",
838 line->driver->name, VTY_NEWLINE);
839}
840
841DEFUN(show_e1line,
842 show_e1line_cmd,
843 "show e1_line [line_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200844 SHOW_STR "Display information about a E1 line\n"
845 "E1 Line Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800846{
847 struct e1inp_line *line;
848
849 if (argc >= 1) {
850 int num = atoi(argv[0]);
851 llist_for_each_entry(line, &e1inp_line_list, list) {
852 if (line->num == num) {
853 e1line_dump_vty(vty, line);
854 return CMD_SUCCESS;
855 }
856 }
857 return CMD_WARNING;
858 }
859
860 llist_for_each_entry(line, &e1inp_line_list, list)
861 e1line_dump_vty(vty, line);
862
863 return CMD_SUCCESS;
864}
865
866static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
867{
Harald Welte62868882009-08-08 16:12:58 +0200868 if (ts->type == E1INP_TS_TYPE_NONE)
869 return;
Harald Welte59b04682009-06-10 05:40:52 +0800870 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
871 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
872 VTY_NEWLINE);
873}
874
875DEFUN(show_e1ts,
876 show_e1ts_cmd,
877 "show e1_timeslot [line_nr] [ts_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200878 SHOW_STR "Display information about a E1 timeslot\n"
879 "E1 Line Number\n" "E1 Timeslot Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800880{
Harald Welte49c79562009-11-17 06:12:16 +0100881 struct e1inp_line *line = NULL;
Harald Welte59b04682009-06-10 05:40:52 +0800882 struct e1inp_ts *ts;
883 int ts_nr;
884
885 if (argc == 0) {
886 llist_for_each_entry(line, &e1inp_line_list, list) {
887 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
888 ts = &line->ts[ts_nr];
889 e1ts_dump_vty(vty, ts);
890 }
891 }
892 return CMD_SUCCESS;
893 }
894 if (argc >= 1) {
895 int num = atoi(argv[0]);
896 llist_for_each_entry(line, &e1inp_line_list, list) {
897 if (line->num == num)
898 break;
899 }
900 if (!line || line->num != num) {
901 vty_out(vty, "E1 line %s is invalid%s",
902 argv[0], VTY_NEWLINE);
903 return CMD_WARNING;
904 }
905 }
906 if (argc >= 2) {
907 ts_nr = atoi(argv[1]);
908 if (ts_nr > NUM_E1_TS) {
909 vty_out(vty, "E1 timeslot %s is invalid%s",
910 argv[1], VTY_NEWLINE);
911 return CMD_WARNING;
912 }
913 ts = &line->ts[ts_nr];
914 e1ts_dump_vty(vty, ts);
915 return CMD_SUCCESS;
916 } else {
917 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
918 ts = &line->ts[ts_nr];
919 e1ts_dump_vty(vty, ts);
920 }
921 return CMD_SUCCESS;
922 }
923 return CMD_SUCCESS;
924}
925
926static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
927{
928 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
929 subscr_dump_vty(vty, pag->subscr);
930}
931
932static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
933{
934 struct gsm_paging_request *pag;
935
936 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
937 paging_dump_vty(vty, pag);
938}
939
940DEFUN(show_paging,
941 show_paging_cmd,
942 "show paging [bts_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200943 SHOW_STR "Display information about paging reuqests of a BTS\n"
944 "BTS Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800945{
Harald Welte40152872010-05-16 20:52:23 +0200946 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800947 struct gsm_bts *bts;
948 int bts_nr;
949
950 if (argc >= 1) {
951 /* use the BTS number that the user has specified */
952 bts_nr = atoi(argv[0]);
953 if (bts_nr >= net->num_bts) {
954 vty_out(vty, "%% can't find BTS %s%s", argv[0],
955 VTY_NEWLINE);
956 return CMD_WARNING;
957 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200958 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800959 bts_paging_dump_vty(vty, bts);
960
961 return CMD_SUCCESS;
962 }
963 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200964 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800965 bts_paging_dump_vty(vty, bts);
966 }
967
968 return CMD_SUCCESS;
969}
970
Harald Welte9e002452010-05-11 21:53:49 +0200971#define NETWORK_STR "Configure the GSM network\n"
972
Harald Weltee87eb462009-08-07 13:29:14 +0200973DEFUN(cfg_net,
974 cfg_net_cmd,
Harald Welte9e002452010-05-11 21:53:49 +0200975 "network", NETWORK_STR)
Harald Weltee87eb462009-08-07 13:29:14 +0200976{
Harald Welte40152872010-05-16 20:52:23 +0200977 vty->index = gsmnet_from_vty(vty);
Harald Weltee87eb462009-08-07 13:29:14 +0200978 vty->node = GSMNET_NODE;
979
980 return CMD_SUCCESS;
981}
982
983
984DEFUN(cfg_net_ncc,
985 cfg_net_ncc_cmd,
986 "network country code <1-999>",
987 "Set the GSM network country code")
988{
Harald Welte40152872010-05-16 20:52:23 +0200989 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
990
Harald Weltee87eb462009-08-07 13:29:14 +0200991 gsmnet->country_code = atoi(argv[0]);
992
993 return CMD_SUCCESS;
994}
995
996DEFUN(cfg_net_mnc,
997 cfg_net_mnc_cmd,
998 "mobile network code <1-999>",
999 "Set the GSM mobile network code")
1000{
Harald Welte40152872010-05-16 20:52:23 +02001001 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1002
Harald Weltee87eb462009-08-07 13:29:14 +02001003 gsmnet->network_code = atoi(argv[0]);
1004
1005 return CMD_SUCCESS;
1006}
1007
1008DEFUN(cfg_net_name_short,
1009 cfg_net_name_short_cmd,
1010 "short name NAME",
1011 "Set the short GSM network name")
1012{
Harald Welte40152872010-05-16 20:52:23 +02001013 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1014
Harald Weltee87eb462009-08-07 13:29:14 +02001015 if (gsmnet->name_short)
1016 talloc_free(gsmnet->name_short);
1017
1018 gsmnet->name_short = talloc_strdup(gsmnet, argv[0]);
1019
1020 return CMD_SUCCESS;
1021}
1022
1023DEFUN(cfg_net_name_long,
1024 cfg_net_name_long_cmd,
1025 "long name NAME",
1026 "Set the long GSM network name")
1027{
Harald Welte40152872010-05-16 20:52:23 +02001028 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1029
Harald Weltee87eb462009-08-07 13:29:14 +02001030 if (gsmnet->name_long)
1031 talloc_free(gsmnet->name_long);
1032
1033 gsmnet->name_long = talloc_strdup(gsmnet, argv[0]);
1034
1035 return CMD_SUCCESS;
1036}
Harald Welte59b04682009-06-10 05:40:52 +08001037
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02001038DEFUN(cfg_net_auth_policy,
1039 cfg_net_auth_policy_cmd,
1040 "auth policy (closed|accept-all|token)",
Harald Welte9e002452010-05-11 21:53:49 +02001041 "Authentication (not cryptographic)\n"
1042 "Set the GSM network authentication policy\n"
1043 "Require the MS to be activated in HLR\n"
1044 "Accept all MS, whether in HLR or not\n"
1045 "Use SMS-token based authentication\n")
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02001046{
1047 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
Harald Welte40152872010-05-16 20:52:23 +02001048 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02001049
1050 gsmnet->auth_policy = policy;
1051
1052 return CMD_SUCCESS;
1053}
1054
Harald Welte59936d72009-11-18 20:33:19 +01001055DEFUN(cfg_net_reject_cause,
1056 cfg_net_reject_cause_cmd,
1057 "location updating reject cause <2-111>",
1058 "Set the reject cause of location updating reject\n")
1059{
Harald Welte40152872010-05-16 20:52:23 +02001060 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1061
Harald Welte59936d72009-11-18 20:33:19 +01001062 gsmnet->reject_cause = atoi(argv[0]);
1063
1064 return CMD_SUCCESS;
1065}
1066
Harald Weltecca253a2009-08-30 15:47:06 +09001067DEFUN(cfg_net_encryption,
1068 cfg_net_encryption_cmd,
1069 "encryption a5 (0|1|2)",
Harald Welte18ce31c2010-05-14 20:05:17 +02001070 "Encryption options\n"
1071 "A5 encryption\n" "A5/0: No encryption\n"
1072 "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n")
Harald Weltecca253a2009-08-30 15:47:06 +09001073{
Harald Welte40152872010-05-16 20:52:23 +02001074 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1075
Andreas.Eversberg53293292009-11-17 09:55:26 +01001076 gsmnet->a5_encryption= atoi(argv[0]);
Harald Weltecca253a2009-08-30 15:47:06 +09001077
1078 return CMD_SUCCESS;
1079}
1080
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001081DEFUN(cfg_net_neci,
1082 cfg_net_neci_cmd,
1083 "neci (0|1)",
Harald Welte18ce31c2010-05-14 20:05:17 +02001084 "New Establish Cause Indication\n"
1085 "Don't set the NECI bit\n" "Set the NECI bit\n")
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001086{
Harald Welte40152872010-05-16 20:52:23 +02001087 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1088
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001089 gsmnet->neci = atoi(argv[0]);
1090 return CMD_SUCCESS;
1091}
1092
Harald Welte52af1952009-12-13 10:53:12 +01001093DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1094 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
Harald Welte9e002452010-05-11 21:53:49 +02001095 "Radio Resource Location Protocol\n"
1096 "Set the Radio Resource Location Protocol Mode\n"
1097 "Don't send RRLP request\n"
1098 "Request MS-based location\n"
1099 "Request any location, prefer MS-based\n"
1100 "Request any location, prefer MS-assisted\n")
Harald Welte52af1952009-12-13 10:53:12 +01001101{
Harald Welte40152872010-05-16 20:52:23 +02001102 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1103
Harald Welte52af1952009-12-13 10:53:12 +01001104 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1105
1106 return CMD_SUCCESS;
1107}
1108
Harald Weltea310f3e2009-12-14 09:00:24 +01001109DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1110 "mm info (0|1)",
1111 "Whether to send MM INFO after LOC UPD ACCEPT")
1112{
Harald Welte40152872010-05-16 20:52:23 +02001113 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1114
Harald Weltea310f3e2009-12-14 09:00:24 +01001115 gsmnet->send_mm_info = atoi(argv[0]);
1116
1117 return CMD_SUCCESS;
1118}
1119
Harald Welte9e002452010-05-11 21:53:49 +02001120#define HANDOVER_STR "Handover Options\n"
1121
Harald Welte0af9c9f2009-12-19 21:41:52 +01001122DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1123 "handover (0|1)",
Harald Welte9e002452010-05-11 21:53:49 +02001124 HANDOVER_STR
1125 "Don't perform in-call handover\n"
1126 "Perform in-call handover\n")
Harald Welte0af9c9f2009-12-19 21:41:52 +01001127{
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001128 int enable = atoi(argv[0]);
Harald Welte40152872010-05-16 20:52:23 +02001129 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001130
1131 if (enable && ipacc_rtp_direct) {
Harald Welteaa2c3032009-12-20 13:51:01 +01001132 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1133 "is enabled by using the -P command line option%s",
1134 VTY_NEWLINE);
1135 return CMD_WARNING;
1136 }
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001137 gsmnet->handover.active = enable;
Harald Welte0af9c9f2009-12-19 21:41:52 +01001138
1139 return CMD_SUCCESS;
1140}
1141
Harald Welte9e002452010-05-11 21:53:49 +02001142#define HO_WIN_STR HANDOVER_STR "Measurement Window\n"
1143#define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n"
1144#define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n"
1145#define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n"
1146
Harald Weltea8062f12009-12-21 16:51:50 +01001147DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1148 "handover window rxlev averaging <1-10>",
Harald Welte9e002452010-05-11 21:53:49 +02001149 HO_WIN_RXLEV_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001150 "How many RxLev measurements are used for averaging")
1151{
Harald Welte40152872010-05-16 20:52:23 +02001152 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001153 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1154 return CMD_SUCCESS;
1155}
1156
1157DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1158 "handover window rxqual averaging <1-10>",
Harald Welte9e002452010-05-11 21:53:49 +02001159 HO_WIN_RXQUAL_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001160 "How many RxQual measurements are used for averaging")
1161{
Harald Welte40152872010-05-16 20:52:23 +02001162 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001163 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1164 return CMD_SUCCESS;
1165}
1166
1167DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1168 "handover window rxlev neighbor averaging <1-10>",
Harald Welte9e002452010-05-11 21:53:49 +02001169 HO_WIN_RXLEV_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001170 "How many RxQual measurements are used for averaging")
1171{
Harald Welte40152872010-05-16 20:52:23 +02001172 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001173 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1174 return CMD_SUCCESS;
1175}
1176
1177DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1178 "handover power budget interval <1-99>",
Harald Welte9e002452010-05-11 21:53:49 +02001179 HO_PBUDGET_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001180 "How often to check if we have a better cell (SACCH frames)")
1181{
Harald Welte40152872010-05-16 20:52:23 +02001182 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001183 gsmnet->handover.pwr_interval = atoi(argv[0]);
1184 return CMD_SUCCESS;
1185}
1186
1187DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1188 "handover power budget hysteresis <0-999>",
Harald Welte9e002452010-05-11 21:53:49 +02001189 HO_PBUDGET_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001190 "How many dB does a neighbor to be stronger to become a HO candidate")
1191{
Harald Welte40152872010-05-16 20:52:23 +02001192 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001193 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1194 return CMD_SUCCESS;
1195}
1196
1197DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1198 "handover maximum distance <0-9999>",
Harald Welte9e002452010-05-11 21:53:49 +02001199 HANDOVER_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001200 "How big is the maximum timing advance before HO is forced")
1201{
Harald Welte40152872010-05-16 20:52:23 +02001202 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001203 gsmnet->handover.max_distance = atoi(argv[0]);
1204 return CMD_SUCCESS;
1205}
Harald Welte0af9c9f2009-12-19 21:41:52 +01001206
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001207#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001208 DEFUN(cfg_net_T##number, \
1209 cfg_net_T##number##_cmd, \
1210 "timer t" #number " <0-65535>", \
Harald Welte9e002452010-05-11 21:53:49 +02001211 "Configure GSM Timers\n" \
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001212 doc) \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001213{ \
Harald Welte40152872010-05-16 20:52:23 +02001214 struct gsm_network *gsmnet = gsmnet_from_vty(vty); \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001215 int value = atoi(argv[0]); \
1216 \
1217 if (value < 0 || value > 65535) { \
1218 vty_out(vty, "Timer value %s out of range.%s", \
1219 argv[0], VTY_NEWLINE); \
1220 return CMD_WARNING; \
1221 } \
1222 \
1223 gsmnet->T##number = value; \
1224 return CMD_SUCCESS; \
1225}
1226
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001227DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1228DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1229DECLARE_TIMER(3105, "Currently not used.")
1230DECLARE_TIMER(3107, "Currently not used.")
1231DECLARE_TIMER(3109, "Currently not used.")
1232DECLARE_TIMER(3111, "Currently not used.")
1233DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1234DECLARE_TIMER(3115, "Currently not used.")
1235DECLARE_TIMER(3117, "Currently not used.")
1236DECLARE_TIMER(3119, "Currently not used.")
1237DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001238
1239
Harald Welte59b04682009-06-10 05:40:52 +08001240/* per-BTS configuration */
1241DEFUN(cfg_bts,
1242 cfg_bts_cmd,
1243 "bts BTS_NR",
Harald Welte9e002452010-05-11 21:53:49 +02001244 "Select a BTS to configure\n"
1245 "BTS Number\n")
Harald Welte59b04682009-06-10 05:40:52 +08001246{
Harald Welte40152872010-05-16 20:52:23 +02001247 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +08001248 int bts_nr = atoi(argv[0]);
1249 struct gsm_bts *bts;
1250
Harald Weltee712a5f2009-06-21 16:17:15 +02001251 if (bts_nr > gsmnet->num_bts) {
1252 vty_out(vty, "%% The next unused BTS number is %u%s",
1253 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +08001254 return CMD_WARNING;
Harald Weltee712a5f2009-06-21 16:17:15 +02001255 } else if (bts_nr == gsmnet->num_bts) {
1256 /* allocate a new one */
1257 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1258 HARDCODED_TSC, HARDCODED_BSIC);
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +02001259 } else
Harald Weltee712a5f2009-06-21 16:17:15 +02001260 bts = gsm_bts_num(gsmnet, bts_nr);
1261
Daniel Willmann580085f2010-01-11 13:43:07 +01001262 if (!bts) {
1263 vty_out(vty, "%% Unable to allocate BTS %u%s",
1264 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee712a5f2009-06-21 16:17:15 +02001265 return CMD_WARNING;
Daniel Willmann580085f2010-01-11 13:43:07 +01001266 }
Harald Welte59b04682009-06-10 05:40:52 +08001267
1268 vty->index = bts;
Harald Welte8791dac2010-05-14 17:59:53 +02001269 vty->index_sub = &bts->description;
Harald Welte59b04682009-06-10 05:40:52 +08001270 vty->node = BTS_NODE;
1271
1272 return CMD_SUCCESS;
1273}
1274
1275DEFUN(cfg_bts_type,
1276 cfg_bts_type_cmd,
1277 "type TYPE",
1278 "Set the BTS type\n")
1279{
1280 struct gsm_bts *bts = vty->index;
Harald Welte59698fb2010-01-10 18:01:52 +01001281 int rc;
Harald Welte59b04682009-06-10 05:40:52 +08001282
Harald Welte59698fb2010-01-10 18:01:52 +01001283 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1284 if (rc < 0)
1285 return CMD_WARNING;
Harald Welte25572872009-10-20 00:22:00 +02001286
Harald Welte59b04682009-06-10 05:40:52 +08001287 return CMD_SUCCESS;
1288}
1289
Harald Welte91afe4c2009-06-20 18:15:19 +02001290DEFUN(cfg_bts_band,
1291 cfg_bts_band_cmd,
1292 "band BAND",
1293 "Set the frequency band of this BTS\n")
1294{
1295 struct gsm_bts *bts = vty->index;
Harald Welte62868882009-08-08 16:12:58 +02001296 int band = gsm_band_parse(argv[0]);
Harald Welte91afe4c2009-06-20 18:15:19 +02001297
1298 if (band < 0) {
1299 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1300 band, VTY_NEWLINE);
1301 return CMD_WARNING;
1302 }
1303
1304 bts->band = band;
1305
1306 return CMD_SUCCESS;
1307}
1308
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +02001309DEFUN(cfg_bts_ci,
1310 cfg_bts_ci_cmd,
1311 "cell_identity <0-65535>",
1312 "Set the Cell identity of this BTS\n")
1313{
1314 struct gsm_bts *bts = vty->index;
1315 int ci = atoi(argv[0]);
1316
1317 if (ci < 0 || ci > 0xffff) {
1318 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1319 ci, VTY_NEWLINE);
1320 return CMD_WARNING;
1321 }
1322 bts->cell_identity = ci;
1323
1324 return CMD_SUCCESS;
1325}
1326
Harald Welte59b04682009-06-10 05:40:52 +08001327DEFUN(cfg_bts_lac,
1328 cfg_bts_lac_cmd,
Holger Hans Peter Freyther54a22832009-09-29 14:02:33 +02001329 "location_area_code <0-65535>",
Harald Welte59b04682009-06-10 05:40:52 +08001330 "Set the Location Area Code (LAC) of this BTS\n")
1331{
1332 struct gsm_bts *bts = vty->index;
1333 int lac = atoi(argv[0]);
1334
Holger Hans Peter Freyther54a22832009-09-29 14:02:33 +02001335 if (lac < 0 || lac > 0xffff) {
1336 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte59b04682009-06-10 05:40:52 +08001337 lac, VTY_NEWLINE);
1338 return CMD_WARNING;
1339 }
Holger Hans Peter Freyther6c6ab862009-10-01 04:07:15 +02001340
1341 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1342 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1343 lac, VTY_NEWLINE);
1344 return CMD_WARNING;
1345 }
1346
Harald Welte59b04682009-06-10 05:40:52 +08001347 bts->location_area_code = lac;
1348
1349 return CMD_SUCCESS;
1350}
1351
Harald Weltea54a2bb2009-12-01 18:04:30 +05301352
Harald Welte59b04682009-06-10 05:40:52 +08001353DEFUN(cfg_bts_tsc,
1354 cfg_bts_tsc_cmd,
1355 "training_sequence_code <0-255>",
1356 "Set the Training Sequence Code (TSC) of this BTS\n")
1357{
1358 struct gsm_bts *bts = vty->index;
1359 int tsc = atoi(argv[0]);
1360
1361 if (tsc < 0 || tsc > 0xff) {
1362 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1363 tsc, VTY_NEWLINE);
1364 return CMD_WARNING;
1365 }
1366 bts->tsc = tsc;
1367
1368 return CMD_SUCCESS;
1369}
1370
1371DEFUN(cfg_bts_bsic,
1372 cfg_bts_bsic_cmd,
1373 "base_station_id_code <0-63>",
1374 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1375{
1376 struct gsm_bts *bts = vty->index;
1377 int bsic = atoi(argv[0]);
1378
1379 if (bsic < 0 || bsic > 0x3f) {
Harald Welte62868882009-08-08 16:12:58 +02001380 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte59b04682009-06-10 05:40:52 +08001381 bsic, VTY_NEWLINE);
1382 return CMD_WARNING;
1383 }
1384 bts->bsic = bsic;
1385
1386 return CMD_SUCCESS;
1387}
1388
1389
1390DEFUN(cfg_bts_unit_id,
1391 cfg_bts_unit_id_cmd,
Harald Weltef515aa02009-08-07 13:27:09 +02001392 "ip.access unit_id <0-65534> <0-255>",
1393 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte59b04682009-06-10 05:40:52 +08001394{
1395 struct gsm_bts *bts = vty->index;
1396 int site_id = atoi(argv[0]);
1397 int bts_id = atoi(argv[1]);
1398
Harald Weltef515aa02009-08-07 13:27:09 +02001399 if (!is_ipaccess_bts(bts)) {
1400 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1401 return CMD_WARNING;
1402 }
1403
Harald Welte59b04682009-06-10 05:40:52 +08001404 bts->ip_access.site_id = site_id;
1405 bts->ip_access.bts_id = bts_id;
1406
1407 return CMD_SUCCESS;
1408}
1409
Harald Welte9e002452010-05-11 21:53:49 +02001410#define OML_STR "Organization & Maintenance Link\n"
1411#define IPA_STR "ip.access Specific Options\n"
1412
Harald Welte25572872009-10-20 00:22:00 +02001413DEFUN(cfg_bts_stream_id,
1414 cfg_bts_stream_id_cmd,
1415 "oml ip.access stream_id <0-255>",
Harald Welte9e002452010-05-11 21:53:49 +02001416 OML_STR IPA_STR
Harald Welte25572872009-10-20 00:22:00 +02001417 "Set the ip.access Stream ID of the OML link of this BTS\n")
1418{
1419 struct gsm_bts *bts = vty->index;
1420 int stream_id = atoi(argv[0]);
1421
1422 if (!is_ipaccess_bts(bts)) {
1423 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1424 return CMD_WARNING;
1425 }
1426
1427 bts->oml_tei = stream_id;
1428
1429 return CMD_SUCCESS;
1430}
1431
Harald Welte9e002452010-05-11 21:53:49 +02001432#define OML_E1_STR OML_STR "E1 Line\n"
Harald Welte25572872009-10-20 00:22:00 +02001433
Harald Welte62868882009-08-08 16:12:58 +02001434DEFUN(cfg_bts_oml_e1,
1435 cfg_bts_oml_e1_cmd,
1436 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte9e002452010-05-11 21:53:49 +02001437 OML_E1_STR
Harald Welte62868882009-08-08 16:12:58 +02001438 "E1 interface to be used for OML\n")
1439{
1440 struct gsm_bts *bts = vty->index;
1441
1442 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1443
1444 return CMD_SUCCESS;
1445}
1446
1447
1448DEFUN(cfg_bts_oml_e1_tei,
1449 cfg_bts_oml_e1_tei_cmd,
1450 "oml e1 tei <0-63>",
Harald Welte9e002452010-05-11 21:53:49 +02001451 OML_E1_STR
Harald Welte62868882009-08-08 16:12:58 +02001452 "Set the TEI to be used for OML")
1453{
1454 struct gsm_bts *bts = vty->index;
1455
1456 bts->oml_tei = atoi(argv[0]);
1457
1458 return CMD_SUCCESS;
1459}
1460
Harald Welte3e774612009-08-10 13:48:16 +02001461DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1462 "channel allocator (ascending|descending)",
Harald Welte9e002452010-05-11 21:53:49 +02001463 "Channnel Allocator\n" "Channel Allocator\n"
1464 "Allocate Timeslots and Transceivers in ascending order\n"
1465 "Allocate Timeslots and Transceivers in descending order\n")
Harald Welte3e774612009-08-10 13:48:16 +02001466{
1467 struct gsm_bts *bts = vty->index;
1468
1469 if (!strcmp(argv[0], "ascending"))
1470 bts->chan_alloc_reverse = 0;
1471 else
1472 bts->chan_alloc_reverse = 1;
1473
1474 return CMD_SUCCESS;
1475}
1476
Harald Welte9e002452010-05-11 21:53:49 +02001477#define RACH_STR "Random Access Control Channel\n"
1478
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001479DEFUN(cfg_bts_rach_tx_integer,
1480 cfg_bts_rach_tx_integer_cmd,
1481 "rach tx integer <0-15>",
Harald Welte9e002452010-05-11 21:53:49 +02001482 RACH_STR
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001483 "Set the raw tx integer value in RACH Control parameters IE")
1484{
1485 struct gsm_bts *bts = vty->index;
1486 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1487 return CMD_SUCCESS;
1488}
1489
1490DEFUN(cfg_bts_rach_max_trans,
1491 cfg_bts_rach_max_trans_cmd,
1492 "rach max transmission (1|2|4|7)",
Harald Welte9e002452010-05-11 21:53:49 +02001493 RACH_STR
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001494 "Set the maximum number of RACH burst transmissions")
1495{
1496 struct gsm_bts *bts = vty->index;
1497 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1498 return CMD_SUCCESS;
1499}
1500
Harald Welte9e002452010-05-11 21:53:49 +02001501#define NM_STR "Network Management\n"
1502
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08001503DEFUN(cfg_bts_rach_nm_b_thresh,
1504 cfg_bts_rach_nm_b_thresh_cmd,
1505 "rach nm busy threshold <0-255>",
Harald Welte9e002452010-05-11 21:53:49 +02001506 RACH_STR NM_STR
1507 "Set the NM Busy Threshold in dB")
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08001508{
1509 struct gsm_bts *bts = vty->index;
1510 bts->rach_b_thresh = atoi(argv[0]);
1511 return CMD_SUCCESS;
1512}
1513
1514DEFUN(cfg_bts_rach_nm_ldavg,
1515 cfg_bts_rach_nm_ldavg_cmd,
1516 "rach nm load average <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001517 RACH_STR NM_STR
1518 "Set the NM Loadaverage Slots value")
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08001519{
1520 struct gsm_bts *bts = vty->index;
1521 bts->rach_ldavg_slots = atoi(argv[0]);
1522 return CMD_SUCCESS;
1523}
1524
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02001525DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1526 "cell barred (0|1)",
1527 "Should this cell be barred from access?")
1528{
1529 struct gsm_bts *bts = vty->index;
1530
Harald Welte8c973ba2009-12-21 23:08:18 +01001531 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02001532
1533 return CMD_SUCCESS;
1534}
1535
Holger Hans Peter Freyther440984b2010-05-14 00:39:19 +08001536DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd,
1537 "rach emergency call allowed (0|1)",
1538 "Should this cell allow emergency calls?")
1539{
1540 struct gsm_bts *bts = vty->index;
1541
1542 if (atoi(argv[0]) == 0)
1543 bts->si_common.rach_control.t2 |= 0x4;
1544 else
1545 bts->si_common.rach_control.t2 &= ~0x4;
1546
1547 return CMD_SUCCESS;
1548}
1549
Harald Welte (local)cbd46102009-08-13 10:14:26 +02001550DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1551 "ms max power <0-40>",
1552 "Maximum transmit power of the MS")
1553{
1554 struct gsm_bts *bts = vty->index;
1555
1556 bts->ms_max_power = atoi(argv[0]);
1557
1558 return CMD_SUCCESS;
1559}
1560
Harald Welteb761bf82009-12-12 18:17:25 +01001561DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1562 "cell reselection hysteresis <0-14>",
1563 "Cell Re-Selection Hysteresis in dB")
1564{
1565 struct gsm_bts *bts = vty->index;
1566
1567 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1568
1569 return CMD_SUCCESS;
1570}
1571
1572DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1573 "rxlev access min <0-63>",
1574 "Minimum RxLev needed for cell access (better than -110dBm)")
1575{
1576 struct gsm_bts *bts = vty->index;
1577
1578 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1579
1580 return CMD_SUCCESS;
1581}
1582
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02001583DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1584 "periodic location update <0-1530>",
1585 "Periodic Location Updating Interval in Minutes")
1586{
1587 struct gsm_bts *bts = vty->index;
1588
Harald Weltea54a2bb2009-12-01 18:04:30 +05301589 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 10;
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02001590
1591 return CMD_SUCCESS;
1592}
1593
Harald Welte9e002452010-05-11 21:53:49 +02001594#define GPRS_TEXT "GPRS Packet Network\n"
1595
Harald Welte410575a2010-03-14 23:30:30 +08001596DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welteb42fe342010-04-18 14:00:26 +02001597 "gprs cell bvci <2-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001598 GPRS_TEXT
1599 "GPRS Cell Settings\n"
Harald Welte3055e332010-03-14 15:37:43 +08001600 "GPRS BSSGP VC Identifier")
1601{
1602 struct gsm_bts *bts = vty->index;
1603
Harald Weltecb20b7a2010-04-18 15:51:20 +02001604 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001605 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1606 return CMD_WARNING;
1607 }
1608
Harald Welte3055e332010-03-14 15:37:43 +08001609 bts->gprs.cell.bvci = atoi(argv[0]);
1610
1611 return CMD_SUCCESS;
1612}
1613
Harald Welte4a048c52010-03-22 11:48:36 +08001614DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
1615 "gprs nsei <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001616 GPRS_TEXT
Harald Welte4a048c52010-03-22 11:48:36 +08001617 "GPRS NS Entity Identifier")
1618{
1619 struct gsm_bts *bts = vty->index;
1620
Harald Weltecb20b7a2010-04-18 15:51:20 +02001621 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte4a048c52010-03-22 11:48:36 +08001622 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1623 return CMD_WARNING;
1624 }
1625
1626 bts->gprs.nse.nsei = atoi(argv[0]);
1627
1628 return CMD_SUCCESS;
1629}
1630
Harald Welte9e002452010-05-11 21:53:49 +02001631#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
1632 "NSVC Logical Number\n"
Harald Welte4a048c52010-03-22 11:48:36 +08001633
Harald Welte3055e332010-03-14 15:37:43 +08001634DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
1635 "gprs nsvc <0-1> nsvci <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001636 GPRS_TEXT NSVC_TEXT
1637 "NS Virtual Connection Identifier\n"
Harald Welte3055e332010-03-14 15:37:43 +08001638 "GPRS NS VC Identifier")
1639{
1640 struct gsm_bts *bts = vty->index;
1641 int idx = atoi(argv[0]);
1642
Harald Weltecb20b7a2010-04-18 15:51:20 +02001643 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001644 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1645 return CMD_WARNING;
1646 }
1647
Harald Welte3055e332010-03-14 15:37:43 +08001648 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
1649
1650 return CMD_SUCCESS;
1651}
1652
Harald Welte410575a2010-03-14 23:30:30 +08001653DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
1654 "gprs nsvc <0-1> local udp port <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001655 GPRS_TEXT NSVC_TEXT
Harald Welte410575a2010-03-14 23:30:30 +08001656 "GPRS NS Local UDP Port")
1657{
1658 struct gsm_bts *bts = vty->index;
1659 int idx = atoi(argv[0]);
1660
Harald Weltecb20b7a2010-04-18 15:51:20 +02001661 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001662 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1663 return CMD_WARNING;
1664 }
1665
Harald Welte410575a2010-03-14 23:30:30 +08001666 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
1667
1668 return CMD_SUCCESS;
1669}
1670
1671DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
1672 "gprs nsvc <0-1> remote udp port <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001673 GPRS_TEXT NSVC_TEXT
Harald Welte410575a2010-03-14 23:30:30 +08001674 "GPRS NS Remote UDP Port")
1675{
1676 struct gsm_bts *bts = vty->index;
1677 int idx = atoi(argv[0]);
1678
Harald Weltecb20b7a2010-04-18 15:51:20 +02001679 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001680 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1681 return CMD_WARNING;
1682 }
1683
Harald Welte410575a2010-03-14 23:30:30 +08001684 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
1685
1686 return CMD_SUCCESS;
1687}
1688
1689DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
1690 "gprs nsvc <0-1> remote ip A.B.C.D",
Harald Welte9e002452010-05-11 21:53:49 +02001691 GPRS_TEXT NSVC_TEXT
Harald Welte410575a2010-03-14 23:30:30 +08001692 "GPRS NS Remote IP Address")
1693{
1694 struct gsm_bts *bts = vty->index;
1695 int idx = atoi(argv[0]);
1696 struct in_addr ia;
1697
Harald Weltecb20b7a2010-04-18 15:51:20 +02001698 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001699 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1700 return CMD_WARNING;
1701 }
1702
Harald Welte410575a2010-03-14 23:30:30 +08001703 inet_aton(argv[1], &ia);
1704 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
1705
1706 return CMD_SUCCESS;
1707}
1708
Harald Weltea9251762010-05-11 23:50:21 +02001709DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd,
1710 "gprs ns timer " NS_TIMERS " <0-255>",
1711 GPRS_TEXT "Network Service\n"
1712 "Network Service Timer\n"
1713 NS_TIMERS_HELP "Timer Value\n")
1714{
1715 struct gsm_bts *bts = vty->index;
1716 int idx = get_string_value(gprs_ns_timer_strs, argv[0]);
1717 int val = atoi(argv[1]);
1718
1719 if (bts->gprs.mode == BTS_GPRS_NONE) {
1720 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1721 return CMD_WARNING;
1722 }
1723
1724 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
1725 return CMD_WARNING;
1726
1727 bts->gprs.nse.timer[idx] = val;
1728
1729 return CMD_SUCCESS;
1730}
1731
1732#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 +02001733#define BSSGP_TIMERS_HELP \
1734 "Tbvc-block timeout\n" \
1735 "Tbvc-block retries\n" \
1736 "Tbvc-unblock retries\n" \
1737 "Tbvcc-reset timeout\n" \
1738 "Tbvc-reset retries\n" \
1739 "Tbvc-suspend timeout\n" \
1740 "Tbvc-suspend retries\n" \
1741 "Tbvc-resume timeout\n" \
1742 "Tbvc-resume retries\n" \
1743 "Tbvc-capa-update timeout\n" \
1744 "Tbvc-capa-update retries\n"
Harald Weltea9251762010-05-11 23:50:21 +02001745
1746DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd,
1747 "gprs cell timer " BSSGP_TIMERS " <0-255>",
1748 GPRS_TEXT "Cell / BSSGP\n"
1749 "Cell/BSSGP Timer\n"
1750 BSSGP_TIMERS_HELP "Timer Value\n")
1751{
1752 struct gsm_bts *bts = vty->index;
1753 int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
1754 int val = atoi(argv[1]);
1755
1756 if (bts->gprs.mode == BTS_GPRS_NONE) {
1757 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1758 return CMD_WARNING;
1759 }
1760
1761 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer))
1762 return CMD_WARNING;
1763
1764 bts->gprs.cell.timer[idx] = val;
1765
1766 return CMD_SUCCESS;
1767}
1768
Harald Welte3055e332010-03-14 15:37:43 +08001769DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
1770 "gprs routing area <0-255>",
Harald Welte9e002452010-05-11 21:53:49 +02001771 GPRS_TEXT
Harald Welte3055e332010-03-14 15:37:43 +08001772 "GPRS Routing Area Code")
1773{
1774 struct gsm_bts *bts = vty->index;
1775
Harald Weltecb20b7a2010-04-18 15:51:20 +02001776 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001777 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1778 return CMD_WARNING;
1779 }
1780
Harald Welte3055e332010-03-14 15:37:43 +08001781 bts->gprs.rac = atoi(argv[0]);
1782
1783 return CMD_SUCCESS;
1784}
1785
Harald Weltecb20b7a2010-04-18 15:51:20 +02001786DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
1787 "gprs mode (none|gprs|egprs)",
Harald Welte9e002452010-05-11 21:53:49 +02001788 GPRS_TEXT
1789 "GPRS Mode for this BTS\n"
1790 "GPRS Disabled on this BTS\n"
1791 "GPRS Enabled on this BTS\n"
1792 "EGPRS (EDGE) Enabled on this BTS\n")
Harald Welte410575a2010-03-14 23:30:30 +08001793{
1794 struct gsm_bts *bts = vty->index;
1795
Harald Weltecb20b7a2010-04-18 15:51:20 +02001796 bts->gprs.mode = bts_gprs_mode_parse(argv[0]);
Harald Welte410575a2010-03-14 23:30:30 +08001797
1798 return CMD_SUCCESS;
1799}
1800
Harald Welte9e002452010-05-11 21:53:49 +02001801#define TRX_TEXT "Radio Transceiver\n"
Harald Welte3e774612009-08-10 13:48:16 +02001802
Harald Welte59b04682009-06-10 05:40:52 +08001803/* per TRX configuration */
1804DEFUN(cfg_trx,
1805 cfg_trx_cmd,
1806 "trx TRX_NR",
Harald Welte9e002452010-05-11 21:53:49 +02001807 TRX_TEXT
Harald Welte59b04682009-06-10 05:40:52 +08001808 "Select a TRX to configure")
1809{
1810 int trx_nr = atoi(argv[0]);
1811 struct gsm_bts *bts = vty->index;
1812 struct gsm_bts_trx *trx;
1813
Harald Weltee712a5f2009-06-21 16:17:15 +02001814 if (trx_nr > bts->num_trx) {
1815 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
1816 bts->num_trx, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +08001817 return CMD_WARNING;
Harald Weltee712a5f2009-06-21 16:17:15 +02001818 } else if (trx_nr == bts->num_trx) {
1819 /* we need to allocate a new one */
1820 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +02001821 } else
Harald Weltee712a5f2009-06-21 16:17:15 +02001822 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +02001823
Harald Weltee712a5f2009-06-21 16:17:15 +02001824 if (!trx)
1825 return CMD_WARNING;
Harald Welte59b04682009-06-10 05:40:52 +08001826
1827 vty->index = trx;
Harald Welte8791dac2010-05-14 17:59:53 +02001828 vty->index_sub = &trx->description;
Harald Welte59b04682009-06-10 05:40:52 +08001829 vty->node = TRX_NODE;
1830
1831 return CMD_SUCCESS;
1832}
1833
1834DEFUN(cfg_trx_arfcn,
1835 cfg_trx_arfcn_cmd,
Harald Welte00044592010-05-14 19:00:52 +02001836 "arfcn <0-1024>",
Harald Welte59b04682009-06-10 05:40:52 +08001837 "Set the ARFCN for this TRX\n")
1838{
1839 int arfcn = atoi(argv[0]);
1840 struct gsm_bts_trx *trx = vty->index;
1841
1842 /* FIXME: check if this ARFCN is supported by this TRX */
1843
1844 trx->arfcn = arfcn;
1845
1846 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
1847 /* FIXME: use OML layer to update the ARFCN */
1848 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
1849
1850 return CMD_SUCCESS;
1851}
1852
Harald Welte (local)b709bfe2009-12-27 20:56:38 +01001853DEFUN(cfg_trx_nominal_power,
1854 cfg_trx_nominal_power_cmd,
1855 "nominal power <0-100>",
1856 "Nominal TRX RF Power in dB\n")
1857{
1858 struct gsm_bts_trx *trx = vty->index;
1859
1860 trx->nominal_power = atoi(argv[0]);
1861
1862 return CMD_SUCCESS;
1863}
1864
Harald Welte91afe4c2009-06-20 18:15:19 +02001865DEFUN(cfg_trx_max_power_red,
1866 cfg_trx_max_power_red_cmd,
1867 "max_power_red <0-100>",
1868 "Reduction of maximum BS RF Power in dB\n")
1869{
1870 int maxpwr_r = atoi(argv[0]);
1871 struct gsm_bts_trx *trx = vty->index;
Harald Welte01acd742009-11-18 09:20:22 +01001872 int upper_limit = 24; /* default 12.21 max power red. */
Harald Welte91afe4c2009-06-20 18:15:19 +02001873
1874 /* FIXME: check if our BTS type supports more than 12 */
1875 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
1876 vty_out(vty, "%% Power %d dB is not in the valid range%s",
1877 maxpwr_r, VTY_NEWLINE);
1878 return CMD_WARNING;
1879 }
1880 if (maxpwr_r & 1) {
1881 vty_out(vty, "%% Power %d dB is not an even value%s",
1882 maxpwr_r, VTY_NEWLINE);
1883 return CMD_WARNING;
1884 }
1885
1886 trx->max_power_red = maxpwr_r;
1887
1888 /* FIXME: make sure we update this using OML */
1889
1890 return CMD_SUCCESS;
1891}
1892
Harald Welte62868882009-08-08 16:12:58 +02001893DEFUN(cfg_trx_rsl_e1,
1894 cfg_trx_rsl_e1_cmd,
1895 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
1896 "E1 interface to be used for RSL\n")
1897{
1898 struct gsm_bts_trx *trx = vty->index;
1899
1900 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
1901
1902 return CMD_SUCCESS;
1903}
1904
1905DEFUN(cfg_trx_rsl_e1_tei,
1906 cfg_trx_rsl_e1_tei_cmd,
1907 "rsl e1 tei <0-63>",
1908 "Set the TEI to be used for RSL")
1909{
1910 struct gsm_bts_trx *trx = vty->index;
1911
1912 trx->rsl_tei = atoi(argv[0]);
1913
1914 return CMD_SUCCESS;
1915}
1916
Holger Hans Peter Freyther1c8b4802009-11-11 11:54:24 +01001917DEFUN(cfg_trx_rf_locked,
1918 cfg_trx_rf_locked_cmd,
1919 "rf_locked (0|1)",
1920 "Turn off RF of the TRX.\n")
1921{
1922 int locked = atoi(argv[0]);
1923 struct gsm_bts_trx *trx = vty->index;
1924
1925 gsm_trx_lock_rf(trx, locked);
1926 return CMD_SUCCESS;
1927}
Harald Welte62868882009-08-08 16:12:58 +02001928
Harald Welte59b04682009-06-10 05:40:52 +08001929/* per TS configuration */
1930DEFUN(cfg_ts,
1931 cfg_ts_cmd,
Harald Welte62868882009-08-08 16:12:58 +02001932 "timeslot <0-7>",
Harald Welte59b04682009-06-10 05:40:52 +08001933 "Select a Timeslot to configure")
1934{
1935 int ts_nr = atoi(argv[0]);
1936 struct gsm_bts_trx *trx = vty->index;
1937 struct gsm_bts_trx_ts *ts;
1938
1939 if (ts_nr >= TRX_NR_TS) {
1940 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
1941 TRX_NR_TS, VTY_NEWLINE);
1942 return CMD_WARNING;
1943 }
1944
1945 ts = &trx->ts[ts_nr];
1946
1947 vty->index = ts;
1948 vty->node = TS_NODE;
1949
1950 return CMD_SUCCESS;
1951}
1952
Harald Welte3ffe1b32009-08-07 00:25:23 +02001953DEFUN(cfg_ts_pchan,
1954 cfg_ts_pchan_cmd,
1955 "phys_chan_config PCHAN",
1956 "Physical Channel configuration (TCH/SDCCH/...)")
1957{
1958 struct gsm_bts_trx_ts *ts = vty->index;
1959 int pchanc;
1960
1961 pchanc = gsm_pchan_parse(argv[0]);
1962 if (pchanc < 0)
1963 return CMD_WARNING;
1964
1965 ts->pchan = pchanc;
1966
1967 return CMD_SUCCESS;
1968}
1969
1970DEFUN(cfg_ts_e1_subslot,
1971 cfg_ts_e1_subslot_cmd,
Harald Welte62868882009-08-08 16:12:58 +02001972 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte3ffe1b32009-08-07 00:25:23 +02001973 "E1 sub-slot connected to this on-air timeslot")
1974{
1975 struct gsm_bts_trx_ts *ts = vty->index;
1976
Harald Welte62868882009-08-08 16:12:58 +02001977 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Welte3ffe1b32009-08-07 00:25:23 +02001978
1979 return CMD_SUCCESS;
1980}
Harald Welte59b04682009-06-10 05:40:52 +08001981
Harald Weltea5b1dae2010-05-16 21:47:13 +02001982void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
1983{
1984 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
1985 counter_get(net->stats.chreq.total),
1986 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
1987 vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
1988 counter_get(net->stats.chan.rf_fail),
1989 counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
1990 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
1991 counter_get(net->stats.paging.attempted),
1992 counter_get(net->stats.paging.completed),
1993 counter_get(net->stats.paging.expired), VTY_NEWLINE);
1994 vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
1995 counter_get(net->stats.bts.oml_fail),
1996 counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
1997}
1998
Harald Welte682ee5f2010-05-16 22:02:16 +02001999DEFUN(logging_fltr_imsi,
2000 logging_fltr_imsi_cmd,
2001 "logging filter imsi IMSI",
2002 LOGGING_STR FILTER_STR
2003 "Filter log messages by IMSI\n" "IMSI to be used as filter\n")
2004{
2005 struct telnet_connection *conn;
2006
2007 conn = (struct telnet_connection *) vty->priv;
2008 if (!conn->dbg) {
2009 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
2010 return CMD_WARNING;
2011 }
2012
2013 log_set_imsi_filter(conn->dbg, argv[0]);
2014 return CMD_SUCCESS;
2015}
2016
Harald Welte40152872010-05-16 20:52:23 +02002017extern int bsc_vty_init_extra(void);
Harald Welte10c29f62010-05-16 19:20:24 +02002018extern const char *openbsc_copyright;
Holger Hans Peter Freytherc48a2a12010-04-10 00:08:28 +02002019
Harald Welte40152872010-05-16 20:52:23 +02002020int bsc_vty_init(void)
Harald Welte59b04682009-06-10 05:40:52 +08002021{
Harald Welte7bc28f62010-05-12 16:10:35 +00002022 install_element_ve(&show_net_cmd);
2023 install_element_ve(&show_bts_cmd);
2024 install_element_ve(&show_trx_cmd);
2025 install_element_ve(&show_ts_cmd);
2026 install_element_ve(&show_lchan_cmd);
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +08002027 install_element_ve(&show_lchan_summary_cmd);
Harald Welte682ee5f2010-05-16 22:02:16 +02002028 install_element_ve(&logging_fltr_imsi_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002029
Harald Welte7bc28f62010-05-12 16:10:35 +00002030 install_element_ve(&show_e1drv_cmd);
2031 install_element_ve(&show_e1line_cmd);
2032 install_element_ve(&show_e1ts_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002033
Harald Welte7bc28f62010-05-12 16:10:35 +00002034 install_element_ve(&show_paging_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002035
Harald Welte682ee5f2010-05-16 22:02:16 +02002036 logging_vty_add_cmds();
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +01002037
Harald Weltee87eb462009-08-07 13:29:14 +02002038 install_element(CONFIG_NODE, &cfg_net_cmd);
2039 install_node(&net_node, config_write_net);
2040 install_default(GSMNET_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002041 install_element(GSMNET_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002042 install_element(GSMNET_NODE, &ournode_end_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002043 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Weltee87eb462009-08-07 13:29:14 +02002044 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
2045 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
2046 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02002047 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte59936d72009-11-18 20:33:19 +01002048 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Weltecca253a2009-08-30 15:47:06 +09002049 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01002050 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welte52af1952009-12-13 10:53:12 +01002051 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte284ddba2009-12-14 17:49:15 +01002052 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Welte0af9c9f2009-12-19 21:41:52 +01002053 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Weltea8062f12009-12-21 16:51:50 +01002054 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
2055 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
2056 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
2057 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
2058 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
2059 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01002060 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +01002061 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
2062 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
2063 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
2064 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
2065 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
2066 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
2067 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
2068 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
2069 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
2070 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Harald Weltee87eb462009-08-07 13:29:14 +02002071
2072 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte97ceef92009-08-06 19:06:46 +02002073 install_node(&bts_node, config_write_bts);
Harald Welte59b04682009-06-10 05:40:52 +08002074 install_default(BTS_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002075 install_element(BTS_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002076 install_element(BTS_NODE, &ournode_end_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002077 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte8791dac2010-05-14 17:59:53 +02002078 install_element(BTS_NODE, &cfg_description_cmd);
2079 install_element(BTS_NODE, &cfg_no_description_cmd);
Harald Welte91afe4c2009-06-20 18:15:19 +02002080 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +02002081 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002082 install_element(BTS_NODE, &cfg_bts_lac_cmd);
2083 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002084 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002085 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte25572872009-10-20 00:22:00 +02002086 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002087 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
2088 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte3e774612009-08-10 13:48:16 +02002089 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01002090 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
2091 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08002092 install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd);
2093 install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd);
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02002094 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Holger Hans Peter Freyther440984b2010-05-14 00:39:19 +08002095 install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd);
Harald Welte (local)cbd46102009-08-13 10:14:26 +02002096 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02002097 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welteb761bf82009-12-12 18:17:25 +01002098 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
2099 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Harald Weltecb20b7a2010-04-18 15:51:20 +02002100 install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
Harald Weltea9251762010-05-11 23:50:21 +02002101 install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd);
Harald Welte3055e332010-03-14 15:37:43 +08002102 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
2103 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Weltea9251762010-05-11 23:50:21 +02002104 install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
Harald Welte4a048c52010-03-22 11:48:36 +08002105 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte3055e332010-03-14 15:37:43 +08002106 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welte410575a2010-03-14 23:30:30 +08002107 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
2108 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
2109 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002110
2111 install_element(BTS_NODE, &cfg_trx_cmd);
2112 install_node(&trx_node, dummy_config_write);
2113 install_default(TRX_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002114 install_element(TRX_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002115 install_element(TRX_NODE, &ournode_end_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002116 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte8791dac2010-05-14 17:59:53 +02002117 install_element(TRX_NODE, &cfg_description_cmd);
2118 install_element(TRX_NODE, &cfg_no_description_cmd);
Harald Welte (local)b709bfe2009-12-27 20:56:38 +01002119 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte7f597bc2009-06-20 22:36:12 +02002120 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002121 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
2122 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther1c8b4802009-11-11 11:54:24 +01002123 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002124
2125 install_element(TRX_NODE, &cfg_ts_cmd);
2126 install_node(&ts_node, dummy_config_write);
2127 install_default(TS_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002128 install_element(TS_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002129 install_element(TS_NODE, &ournode_end_cmd);
Harald Welte3ffe1b32009-08-07 00:25:23 +02002130 install_element(TS_NODE, &cfg_ts_pchan_cmd);
2131 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002132
Harald Welte40152872010-05-16 20:52:23 +02002133 bsc_vty_init_extra();
Harald Welte59b04682009-06-10 05:40:52 +08002134
2135 return 0;
2136}