blob: 51db0b14cd71a198b616e60b54a654b881109e25 [file] [log] [blame]
Harald Welte68628e82009-03-10 12:17:57 +00001/* OpenBSC interface to quagga VTY */
Harald Welteaf387632010-03-14 23:30:30 +08002/* (C) 2009-2010 by Harald Welte <laforge@gnumonks.org>
Harald Welte68628e82009-03-10 12:17:57 +00003 * All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#include <stdlib.h>
22#include <unistd.h>
23#include <sys/types.h>
24
Harald Welte4b037e42010-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 Welte68628e82009-03-10 12:17:57 +000030
31#include <arpa/inet.h>
32
Harald Weltedfe6c7d2010-02-20 16:24:02 +010033#include <osmocore/linuxlist.h>
Harald Welte68628e82009-03-10 12:17:57 +000034#include <openbsc/gsm_data.h>
Harald Welte68628e82009-03-10 12:17:57 +000035#include <openbsc/e1_input.h>
Harald Welte1bc77352009-03-10 19:47:51 +000036#include <openbsc/abis_nm.h>
Harald Weltedfe6c7d2010-02-20 16:24:02 +010037#include <osmocore/gsm_utils.h>
Harald Welteb908cb72009-12-22 13:09:29 +010038#include <openbsc/chan_alloc.h>
Harald Welte8387a492009-12-22 21:43:14 +010039#include <openbsc/meas_rep.h>
Harald Welte40f82892009-05-23 17:31:39 +000040#include <openbsc/db.h>
Harald Weltedfe6c7d2010-02-20 16:24:02 +010041#include <osmocore/talloc.h>
Holger Hans Peter Freyther3c712322010-04-06 11:55:37 +020042#include <openbsc/vty.h>
Harald Welte22229d62010-05-12 20:28:04 +020043#include <openbsc/gprs_ns.h>
Harald Welte5bc61dc2010-05-16 22:02:16 +020044#include <openbsc/debug.h>
Harald Welte68628e82009-03-10 12:17:57 +000045
Harald Welte1353f962010-05-16 19:20:24 +020046#include "../bscconfig.h"
47
Harald Welteea4647d2010-05-12 17:19:53 +000048/* FIXME: this should go to some common file */
49static const struct value_string gprs_ns_timer_strs[] = {
Harald Welte615e9562010-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 Welteea4647d2010-05-12 17:19:53 +000060static const struct value_string gprs_bssgp_cfg_strs[] = {
Harald Welte615e9562010-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 Welte5013b2a2009-08-07 13:29:14 +020075struct cmd_node net_node = {
76 GSMNET_NODE,
77 "%s(network)#",
78 1,
79};
80
Harald Welte68628e82009-03-10 12:17:57 +000081struct 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 Welte39231152010-05-27 13:39:40 +020099extern struct gsm_network *bsc_gsmnet;
100
Harald Weltedcccb182010-05-16 20:52:23 +0200101struct gsm_network *gsmnet_from_vty(struct vty *v)
102{
Harald Welte39231152010-05-27 13:39:40 +0200103 /* In case we read from the config file, the vty->priv cannot
104 * point to a struct telnet_connection, and thus conn->priv
105 * will not point to the gsm_network structure */
106#if 0
Harald Weltedcccb182010-05-16 20:52:23 +0200107 struct telnet_connection *conn = v->priv;
108 return (struct gsm_network *) conn->priv;
Harald Welte39231152010-05-27 13:39:40 +0200109#else
110 return bsc_gsmnet;
111#endif
Harald Weltedcccb182010-05-16 20:52:23 +0200112}
113
Harald Welte68628e82009-03-10 12:17:57 +0000114static int dummy_config_write(struct vty *v)
115{
116 return CMD_SUCCESS;
117}
118
119static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
120{
Harald Welte1bc77352009-03-10 19:47:51 +0000121 vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s",
122 nm_opstate_name(nms->operational), nms->administrative,
123 nm_avail_name(nms->availability), VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000124}
125
Harald Welteb908cb72009-12-22 13:09:29 +0100126static void dump_pchan_load_vty(struct vty *vty, char *prefix,
127 const struct pchan_load *pl)
128{
129 int i;
130
131 for (i = 0; i < ARRAY_SIZE(pl->pchan); i++) {
132 const struct load_counter *lc = &pl->pchan[i];
133 unsigned int percent;
134
135 if (lc->total == 0)
136 continue;
137
138 percent = (lc->used * 100) / lc->total;
139
140 vty_out(vty, "%s%20s: %3u%% (%u/%u)%s", prefix,
141 gsm_pchan_name(i), percent, lc->used, lc->total,
142 VTY_NEWLINE);
143 }
144}
145
Harald Welte68628e82009-03-10 12:17:57 +0000146static void net_dump_vty(struct vty *vty, struct gsm_network *net)
147{
Harald Welteb908cb72009-12-22 13:09:29 +0100148 struct pchan_load pl;
149
Harald Welteef235b52009-03-10 12:34:02 +0000150 vty_out(vty, "BSC is on Country Code %u, Network Code %u "
151 "and has %u BTS%s", net->country_code, net->network_code,
152 net->num_bts, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000153 vty_out(vty, " Long network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000154 net->name_long, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000155 vty_out(vty, " Short network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000156 net->name_short, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200157 vty_out(vty, " Authentication policy: %s%s",
158 gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100159 vty_out(vty, " Location updating reject cause: %u%s",
160 net->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900161 vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption,
162 VTY_NEWLINE);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +0100163 vty_out(vty, " NECI (TCH/H): %u%s", net->neci,
164 VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100165 vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode),
166 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100167 vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off",
168 VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100169 vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off",
170 VTY_NEWLINE);
Harald Welteb908cb72009-12-22 13:09:29 +0100171 network_chan_load(&pl, net);
172 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
173 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000174}
175
176DEFUN(show_net, show_net_cmd, "show network",
177 SHOW_STR "Display information about a GSM NETWORK\n")
178{
Harald Weltedcccb182010-05-16 20:52:23 +0200179 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000180 net_dump_vty(vty, net);
181
182 return CMD_SUCCESS;
183}
184
185static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l)
186{
Harald Welteedb37782009-05-01 14:59:07 +0000187 struct e1inp_line *line;
188
189 if (!e1l) {
190 vty_out(vty, " None%s", VTY_NEWLINE);
191 return;
192 }
193
194 line = e1l->ts->line;
195
196 vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s",
197 line->num, line->driver->name, e1l->ts->num,
Harald Welte1bc77352009-03-10 19:47:51 +0000198 e1inp_signtype_name(e1l->type), VTY_NEWLINE);
Harald Welteedb37782009-05-01 14:59:07 +0000199 vty_out(vty, " E1 TEI %u, SAPI %u%s",
Harald Welte68628e82009-03-10 12:17:57 +0000200 e1l->tei, e1l->sapi, VTY_NEWLINE);
201}
202
203static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
204{
Harald Welteb908cb72009-12-22 13:09:29 +0100205 struct pchan_load pl;
206
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200207 vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
Harald Weltefcd24452009-06-20 18:15:19 +0200208 "BSIC %u, TSC %u and %u TRX%s",
209 bts->nr, btstype2str(bts->type), gsm_band_name(bts->band),
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200210 bts->cell_identity,
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +0200211 bts->location_area_code, bts->bsic, bts->tsc,
Harald Weltefcd24452009-06-20 18:15:19 +0200212 bts->num_trx, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200213 vty_out(vty, "Description: %s%s",
214 bts->description ? bts->description : "(null)", VTY_NEWLINE);
Harald Welte1d8dbc42009-12-12 15:38:16 +0100215 vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100216 vty_out(vty, "Minimum Rx Level for Access: %i dBm%s",
Harald Welte1d8dbc42009-12-12 15:38:16 +0100217 rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min),
218 VTY_NEWLINE);
219 vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s",
Harald Welte73225282009-12-12 18:17:25 +0100220 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100221 vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer,
222 VTY_NEWLINE);
223 vty_out(vty, "RACH Max transmissions: %u%s",
224 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
225 VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100226 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200227 vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE);
Harald Welte4cc34222009-05-01 15:12:31 +0000228 if (is_ipaccess_bts(bts))
Harald Welte8175e952009-10-20 00:22:00 +0200229 vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
Harald Welte4cc34222009-05-01 15:12:31 +0000230 bts->ip_access.site_id, bts->ip_access.bts_id,
Harald Welte8175e952009-10-20 00:22:00 +0200231 bts->oml_tei, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000232 vty_out(vty, " NM State: ");
233 net_dump_nmstate(vty, &bts->nm_state);
234 vty_out(vty, " Site Mgr NM State: ");
235 net_dump_nmstate(vty, &bts->site_mgr.nm_state);
236 vty_out(vty, " Paging: FIXME pending requests, %u free slots%s",
237 bts->paging.available_slots, VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200238 if (!is_ipaccess_bts(bts)) {
239 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
240 e1isl_dump_vty(vty, bts->oml_link);
241 }
Harald Welte68628e82009-03-10 12:17:57 +0000242 /* FIXME: oml_link, chan_desc */
Harald Welteb908cb72009-12-22 13:09:29 +0100243 memset(&pl, 0, sizeof(pl));
244 bts_chan_load(&pl, bts);
245 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
246 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000247}
248
249DEFUN(show_bts, show_bts_cmd, "show bts [number]",
250 SHOW_STR "Display information about a BTS\n"
251 "BTS number")
252{
Harald Weltedcccb182010-05-16 20:52:23 +0200253 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000254 int bts_nr;
255
256 if (argc != 0) {
257 /* use the BTS number that the user has specified */
258 bts_nr = atoi(argv[0]);
259 if (bts_nr > net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000260 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000261 VTY_NEWLINE);
262 return CMD_WARNING;
263 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200264 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000265 return CMD_SUCCESS;
266 }
267 /* print all BTS's */
268 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee441d9c2009-06-21 16:17:15 +0200269 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000270
271 return CMD_SUCCESS;
272}
273
Harald Welte42581822009-08-08 16:12:58 +0200274/* utility functions */
275static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
276 const char *ts, const char *ss)
277{
278 e1_link->e1_nr = atoi(line);
279 e1_link->e1_ts = atoi(ts);
280 if (!strcmp(ss, "full"))
281 e1_link->e1_ts_ss = 255;
282 else
283 e1_link->e1_ts_ss = atoi(ss);
284}
285
286static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,
287 const char *prefix)
288{
289 if (!e1_link->e1_ts)
290 return;
291
292 if (e1_link->e1_ts_ss == 255)
293 vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s",
294 prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE);
295 else
296 vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s",
297 prefix, e1_link->e1_nr, e1_link->e1_ts,
298 e1_link->e1_ts_ss, VTY_NEWLINE);
299}
300
301
Harald Welte67ce0732009-08-06 19:06:46 +0200302static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
303{
Harald Welte42581822009-08-08 16:12:58 +0200304 vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
305 if (ts->pchan != GSM_PCHAN_NONE)
306 vty_out(vty, " phys_chan_config %s%s",
307 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
Harald Welte6e0cd042009-09-12 13:05:33 +0200308 if (ts->hopping.hsn) {
309 vty_out(vty, " hopping sequence number %u%s",
310 ts->hopping.hsn, VTY_NEWLINE);
311 vty_out(vty, " hopping maio %u%s",
312 ts->hopping.maio, VTY_NEWLINE);
313 /* FIXME: ARFCN list */
314 }
Harald Welte42581822009-08-08 16:12:58 +0200315 config_write_e1_link(vty, &ts->e1_link, " ");
Harald Welte67ce0732009-08-06 19:06:46 +0200316}
317
318static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
319{
320 int i;
321
Harald Welte5013b2a2009-08-07 13:29:14 +0200322 vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200323 if (trx->description)
324 vty_out(vty, " description %s%s", trx->description,
325 VTY_NEWLINE);
Holger Hans Peter Freyther2ba40af2010-04-17 06:42:07 +0200326 vty_out(vty, " rf_locked %u%s",
327 trx->nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
328 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200329 vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
Harald Welte (local)7b37d972009-12-27 20:56:38 +0100330 vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200331 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200332 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
333 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte67ce0732009-08-06 19:06:46 +0200334
335 for (i = 0; i < TRX_NR_TS; i++)
336 config_write_ts_single(vty, &trx->ts[i]);
337}
338
Harald Welte615e9562010-05-11 23:50:21 +0200339static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
340{
341 unsigned int i;
342 vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode),
343 VTY_NEWLINE);
344 if (bts->gprs.mode == BTS_GPRS_NONE)
345 return;
346
347 vty_out(vty, " gprs routing area %u%s", bts->gprs.rac,
348 VTY_NEWLINE);
349 vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
350 VTY_NEWLINE);
351 for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++)
352 vty_out(vty, " gprs cell timer %s %u%s",
353 get_value_string(gprs_bssgp_cfg_strs, i),
354 bts->gprs.cell.timer[i], VTY_NEWLINE);
355 vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei,
356 VTY_NEWLINE);
357 for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++)
358 vty_out(vty, " gprs ns timer %s %u%s",
359 get_value_string(gprs_ns_timer_strs, i),
360 bts->gprs.nse.timer[i], VTY_NEWLINE);
361 for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
362 struct gsm_bts_gprs_nsvc *nsvc =
363 &bts->gprs.nsvc[i];
364 struct in_addr ia;
365
366 ia.s_addr = htonl(nsvc->remote_ip);
367 vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
368 nsvc->nsvci, VTY_NEWLINE);
369 vty_out(vty, " gprs nsvc %u local udp port %u%s", i,
370 nsvc->local_port, VTY_NEWLINE);
371 vty_out(vty, " gprs nsvc %u remote udp port %u%s", i,
372 nsvc->remote_port, VTY_NEWLINE);
373 vty_out(vty, " gprs nsvc %u remote ip %s%s", i,
374 inet_ntoa(ia), VTY_NEWLINE);
375 }
376}
377
Harald Welte67ce0732009-08-06 19:06:46 +0200378static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
379{
380 struct gsm_bts_trx *trx;
381
Harald Welte5013b2a2009-08-07 13:29:14 +0200382 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
383 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200384 if (bts->description)
385 vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200386 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freytherf926ed62009-11-19 16:38:49 +0100387 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200388 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte67ce0732009-08-06 19:06:46 +0200389 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200390 vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE);
391 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)0e451d02009-08-13 10:14:26 +0200392 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100393 vty_out(vty, " cell reselection hysteresis %u%s",
394 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
395 vty_out(vty, " rxlev access min %u%s",
396 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Harald Weltea43f7892009-12-01 18:04:30 +0530397 if (bts->si_common.chan_desc.t3212)
Harald Welte (local)efc92312009-08-14 23:09:25 +0200398 vty_out(vty, " periodic location update %u%s",
Harald Weltea43f7892009-12-01 18:04:30 +0530399 bts->si_common.chan_desc.t3212 * 10, VTY_NEWLINE);
Harald Welte7a8fa412009-08-10 13:48:16 +0200400 vty_out(vty, " channel allocator %s%s",
401 bts->chan_alloc_reverse ? "descending" : "ascending",
402 VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100403 vty_out(vty, " rach tx integer %u%s",
404 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
405 vty_out(vty, " rach max transmission %u%s",
406 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
407 VTY_NEWLINE);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +0800408
409 if (bts->rach_b_thresh != -1)
410 vty_out(vty, " rach nm busy threshold %u%s",
411 bts->rach_b_thresh, VTY_NEWLINE);
412 if (bts->rach_ldavg_slots != -1)
413 vty_out(vty, " rach nm load average %u%s",
414 bts->rach_ldavg_slots, VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100415 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200416 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +0800417 if ((bts->si_common.rach_control.t2 & 0x4) == 0)
418 vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200419 if (is_ipaccess_bts(bts)) {
Harald Welte5013b2a2009-08-07 13:29:14 +0200420 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Weltea6fd58e2009-08-07 00:25:23 +0200421 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200422 vty_out(vty, " oml ip.access stream_id %u%s", bts->oml_tei, VTY_NEWLINE);
423 } else {
Harald Welte42581822009-08-08 16:12:58 +0200424 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
425 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
426 }
Harald Welte615e9562010-05-11 23:50:21 +0200427 config_write_bts_gprs(vty, bts);
Harald Welte67ce0732009-08-06 19:06:46 +0200428
429 llist_for_each_entry(trx, &bts->trx_list, list)
430 config_write_trx_single(vty, trx);
431}
432
433static int config_write_bts(struct vty *v)
434{
Harald Weltedcccb182010-05-16 20:52:23 +0200435 struct gsm_network *gsmnet = gsmnet_from_vty(v);
Harald Welte67ce0732009-08-06 19:06:46 +0200436 struct gsm_bts *bts;
437
438 llist_for_each_entry(bts, &gsmnet->bts_list, list)
439 config_write_bts_single(v, bts);
440
441 return CMD_SUCCESS;
442}
443
Harald Welte5013b2a2009-08-07 13:29:14 +0200444static int config_write_net(struct vty *vty)
445{
Harald Weltedcccb182010-05-16 20:52:23 +0200446 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
447
Harald Welte5013b2a2009-08-07 13:29:14 +0200448 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200449 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200450 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200451 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
452 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200453 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100454 vty_out(vty, " location updating reject cause %u%s",
455 gsmnet->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900456 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freytherd54c3372009-11-19 16:37:48 +0100457 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100458 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
459 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100460 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100461 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Welteb720bd32009-12-21 16:51:50 +0100462 vty_out(vty, " handover window rxlev averaging %u%s",
463 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
464 vty_out(vty, " handover window rxqual averaging %u%s",
465 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
466 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
467 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
468 vty_out(vty, " handover power budget interval %u%s",
469 gsmnet->handover.pwr_interval, VTY_NEWLINE);
470 vty_out(vty, " handover power budget hysteresis %u%s",
471 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
472 vty_out(vty, " handover maximum distance %u%s",
473 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +0100474 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100475 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
476 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
477 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
478 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
479 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
480 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
481 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
482 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
483 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
484 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200485
486 return CMD_SUCCESS;
487}
Harald Welte67ce0732009-08-06 19:06:46 +0200488
Harald Welte68628e82009-03-10 12:17:57 +0000489static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
490{
491 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
492 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200493 vty_out(vty, "Description: %s%s",
494 trx->description ? trx->description : "(null)", VTY_NEWLINE);
Harald Weltefcd24452009-06-20 18:15:19 +0200495 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte42581822009-08-08 16:12:58 +0200496 "resulting BS power: %d dBm%s",
Harald Weltefcd24452009-06-20 18:15:19 +0200497 trx->nominal_power, trx->max_power_red,
Harald Welte42581822009-08-08 16:12:58 +0200498 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000499 vty_out(vty, " NM State: ");
500 net_dump_nmstate(vty, &trx->nm_state);
501 vty_out(vty, " Baseband Transceiver NM State: ");
502 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte8175e952009-10-20 00:22:00 +0200503 if (is_ipaccess_bts(trx->bts)) {
504 vty_out(vty, " ip.access stream ID: 0x%02x%s",
505 trx->rsl_tei, VTY_NEWLINE);
506 } else {
507 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
508 e1isl_dump_vty(vty, trx->rsl_link);
509 }
Harald Welte68628e82009-03-10 12:17:57 +0000510}
511
512DEFUN(show_trx,
513 show_trx_cmd,
514 "show trx [bts_nr] [trx_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200515 SHOW_STR "Display information about a TRX\n"
516 "BTS Number\n"
517 "TRX Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000518{
Harald Weltedcccb182010-05-16 20:52:23 +0200519 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000520 struct gsm_bts *bts = NULL;
521 struct gsm_bts_trx *trx;
522 int bts_nr, trx_nr;
523
524 if (argc >= 1) {
525 /* use the BTS number that the user has specified */
526 bts_nr = atoi(argv[0]);
527 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000528 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000529 VTY_NEWLINE);
530 return CMD_WARNING;
531 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200532 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000533 }
534 if (argc >= 2) {
535 trx_nr = atoi(argv[1]);
536 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000537 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000538 VTY_NEWLINE);
539 return CMD_WARNING;
540 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200541 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000542 trx_dump_vty(vty, trx);
543 return CMD_SUCCESS;
544 }
545 if (bts) {
546 /* print all TRX in this BTS */
547 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200548 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000549 trx_dump_vty(vty, trx);
550 }
551 return CMD_SUCCESS;
552 }
553
554 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200555 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000556 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200557 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000558 trx_dump_vty(vty, trx);
559 }
560 }
561
562 return CMD_SUCCESS;
563}
564
Harald Welte67ce0732009-08-06 19:06:46 +0200565
Harald Welte68628e82009-03-10 12:17:57 +0000566static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
567{
Harald Welte68628e82009-03-10 12:17:57 +0000568 vty_out(vty, "Timeslot %u of TRX %u in BTS %u, phys cfg %s%s",
569 ts->nr, ts->trx->nr, ts->trx->bts->nr,
570 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
571 vty_out(vty, " NM State: ");
572 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte2c828992009-12-02 01:56:49 +0530573 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welteef235b52009-03-10 12:34:02 +0000574 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
575 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
576 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000577}
578
579DEFUN(show_ts,
580 show_ts_cmd,
Harald Welte1bc77352009-03-10 19:47:51 +0000581 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200582 SHOW_STR "Display information about a TS\n"
583 "BTS Number\n" "TRX Number\n" "Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000584{
Harald Weltedcccb182010-05-16 20:52:23 +0200585 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000586 struct gsm_bts *bts;
587 struct gsm_bts_trx *trx;
588 struct gsm_bts_trx_ts *ts;
589 int bts_nr, trx_nr, ts_nr;
590
591 if (argc >= 1) {
592 /* use the BTS number that the user has specified */
593 bts_nr = atoi(argv[0]);
594 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000595 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000596 VTY_NEWLINE);
597 return CMD_WARNING;
598 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200599 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000600 }
601 if (argc >= 2) {
602 trx_nr = atoi(argv[1]);
603 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000604 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000605 VTY_NEWLINE);
606 return CMD_WARNING;
607 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200608 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000609 }
610 if (argc >= 3) {
611 ts_nr = atoi(argv[2]);
612 if (ts_nr >= TRX_NR_TS) {
Harald Welte1bc77352009-03-10 19:47:51 +0000613 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
Harald Welte68628e82009-03-10 12:17:57 +0000614 VTY_NEWLINE);
615 return CMD_WARNING;
616 }
617 ts = &trx->ts[ts_nr];
618 ts_dump_vty(vty, ts);
619 return CMD_SUCCESS;
620 }
621 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200622 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000623 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200624 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000625 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
626 ts = &trx->ts[ts_nr];
627 ts_dump_vty(vty, ts);
628 }
629 }
630 }
631
632 return CMD_SUCCESS;
633}
634
Holger Hans Peter Freyther424c4f02010-01-06 06:00:40 +0100635static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte68628e82009-03-10 12:17:57 +0000636{
Harald Weltefcd24452009-06-20 18:15:19 +0200637 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte40f82892009-05-23 17:31:39 +0000638 subscr->authorized, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000639 if (subscr->name)
Harald Welte1bc77352009-03-10 19:47:51 +0000640 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000641 if (subscr->extension)
642 vty_out(vty, " Extension: %s%s", subscr->extension,
643 VTY_NEWLINE);
644 if (subscr->imsi)
645 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freyther22230252009-08-19 12:53:57 +0200646 if (subscr->tmsi != GSM_RESERVED_TMSI)
647 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte731fd912009-08-15 03:24:51 +0200648 VTY_NEWLINE);
Sylvain Munautaf292642009-12-27 19:29:28 +0100649
Harald Welte (local)15920de2009-08-14 20:27:16 +0200650 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000651}
652
Harald Welte8387a492009-12-22 21:43:14 +0100653static void meas_rep_dump_uni_vty(struct vty *vty,
654 struct gsm_meas_rep_unidir *mru,
655 const char *prefix,
656 const char *dir)
657{
658 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
659 prefix, dir, rxlev2dbm(mru->full.rx_lev),
660 dir, rxlev2dbm(mru->sub.rx_lev));
661 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
662 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
663 VTY_NEWLINE);
664}
665
666static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
667 const char *prefix)
668{
669 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
670 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
671 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
672 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
673 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
674 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
675 VTY_NEWLINE);
676 if (mr->flags & MEAS_REP_F_MS_TO)
677 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
678 mr->ms_timing_offset, VTY_NEWLINE);
679 if (mr->flags & MEAS_REP_F_MS_L1)
680 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
681 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
682 if (mr->flags & MEAS_REP_F_DL_VALID)
683 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
684 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
685}
686
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800687static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
Harald Welte68628e82009-03-10 12:17:57 +0000688{
Harald Welte8387a492009-12-22 21:43:14 +0100689 int idx;
690
Harald Welte68628e82009-03-10 12:17:57 +0000691 vty_out(vty, "Lchan %u in Timeslot %u of TRX %u in BTS %u, Type %s%s",
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +0200692 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
Harald Welte (local)ccd88452009-12-27 18:05:25 +0100693 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Harald Welte68628e82009-03-10 12:17:57 +0000694 VTY_NEWLINE);
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100695 vty_out(vty, " Use Count: %u, State: %s%s", lchan->conn.use_count,
Harald Welte1887f9d2009-12-29 10:52:38 +0100696 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100697 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
698 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
699 - lchan->bs_power*2,
700 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
701 VTY_NEWLINE);
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100702 if (lchan->conn.subscr) {
Harald Welte68628e82009-03-10 12:17:57 +0000703 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100704 subscr_dump_vty(vty, lchan->conn.subscr);
Harald Welte68628e82009-03-10 12:17:57 +0000705 } else
706 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte2c828992009-12-02 01:56:49 +0530707 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
708 struct in_addr ia;
Holger Hans Peter Freyther54fa7992010-04-07 15:39:16 +0200709 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte2c828992009-12-02 01:56:49 +0530710 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
711 inet_ntoa(ia), lchan->abis_ip.bound_port,
712 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
713 VTY_NEWLINE);
714 }
Harald Welte8387a492009-12-22 21:43:14 +0100715
716 /* we want to report the last measurement report */
717 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
718 lchan->meas_rep_idx, 1);
719 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte68628e82009-03-10 12:17:57 +0000720}
721
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800722static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
723{
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800724 struct gsm_meas_rep *mr;
725 int idx;
726
727 /* we want to report the last measurement report */
728 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
729 lchan->meas_rep_idx, 1);
730 mr = &lchan->meas_rep[idx];
731
732 vty_out(vty, "Lchan: %u Timeslot: %u TRX: %u BTS: %u Type: %s - L1 MS Power: %u dBm "
733 "RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800734 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
735 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800736 mr->ms_l1.pwr,
737 rxlev2dbm(mr->dl.full.rx_lev),
738 rxlev2dbm(mr->ul.full.rx_lev),
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800739 VTY_NEWLINE);
740}
741
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800742static int lchan_summary(struct vty *vty, int argc, const char **argv,
743 void (*dump_cb)(struct vty *, struct gsm_lchan *))
Harald Welte68628e82009-03-10 12:17:57 +0000744{
Harald Weltedcccb182010-05-16 20:52:23 +0200745 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000746 struct gsm_bts *bts;
747 struct gsm_bts_trx *trx;
748 struct gsm_bts_trx_ts *ts;
749 struct gsm_lchan *lchan;
750 int bts_nr, trx_nr, ts_nr, lchan_nr;
751
752 if (argc >= 1) {
753 /* use the BTS number that the user has specified */
754 bts_nr = atoi(argv[0]);
755 if (bts_nr >= net->num_bts) {
756 vty_out(vty, "%% can't find BTS %s%s", argv[0],
757 VTY_NEWLINE);
758 return CMD_WARNING;
759 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200760 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000761 }
762 if (argc >= 2) {
763 trx_nr = atoi(argv[1]);
764 if (trx_nr >= bts->num_trx) {
765 vty_out(vty, "%% can't find TRX %s%s", argv[1],
766 VTY_NEWLINE);
767 return CMD_WARNING;
768 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200769 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000770 }
771 if (argc >= 3) {
772 ts_nr = atoi(argv[2]);
773 if (ts_nr >= TRX_NR_TS) {
774 vty_out(vty, "%% can't find TS %s%s", argv[2],
775 VTY_NEWLINE);
776 return CMD_WARNING;
777 }
778 ts = &trx->ts[ts_nr];
779 }
780 if (argc >= 4) {
781 lchan_nr = atoi(argv[3]);
782 if (lchan_nr >= TS_MAX_LCHAN) {
783 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
784 VTY_NEWLINE);
785 return CMD_WARNING;
786 }
787 lchan = &ts->lchan[lchan_nr];
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800788 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000789 return CMD_SUCCESS;
790 }
791 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200792 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000793 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200794 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000795 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
796 ts = &trx->ts[ts_nr];
797 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
798 lchan_nr++) {
799 lchan = &ts->lchan[lchan_nr];
Harald Welteef235b52009-03-10 12:34:02 +0000800 if (lchan->type == GSM_LCHAN_NONE)
801 continue;
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800802 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000803 }
804 }
805 }
806 }
807
808 return CMD_SUCCESS;
809}
810
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800811
812DEFUN(show_lchan,
813 show_lchan_cmd,
814 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
815 SHOW_STR "Display information about a logical channel\n"
816 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
817 "Logical Channel Number\n")
818
819{
820 return lchan_summary(vty, argc, argv, lchan_dump_full_vty);
821}
822
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800823DEFUN(show_lchan_summary,
824 show_lchan_summary_cmd,
825 "show lchan summary [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
826 SHOW_STR "Display information about a logical channel\n"
827 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
828 "Logical Channel Number\n")
829{
830 return lchan_summary(vty, argc, argv, lchan_dump_short_vty);
831}
832
Harald Welte1bc77352009-03-10 19:47:51 +0000833static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
834{
835 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
836}
837
838DEFUN(show_e1drv,
839 show_e1drv_cmd,
840 "show e1_driver",
841 SHOW_STR "Display information about available E1 drivers\n")
842{
843 struct e1inp_driver *drv;
844
845 llist_for_each_entry(drv, &e1inp_driver_list, list)
846 e1drv_dump_vty(vty, drv);
847
848 return CMD_SUCCESS;
849}
850
Harald Welte68628e82009-03-10 12:17:57 +0000851static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
852{
853 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
854 line->num, line->name ? line->name : "",
855 line->driver->name, VTY_NEWLINE);
856}
857
858DEFUN(show_e1line,
859 show_e1line_cmd,
860 "show e1_line [line_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200861 SHOW_STR "Display information about a E1 line\n"
862 "E1 Line Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000863{
Harald Welte1bc77352009-03-10 19:47:51 +0000864 struct e1inp_line *line;
865
866 if (argc >= 1) {
867 int num = atoi(argv[0]);
868 llist_for_each_entry(line, &e1inp_line_list, list) {
869 if (line->num == num) {
870 e1line_dump_vty(vty, line);
871 return CMD_SUCCESS;
872 }
873 }
874 return CMD_WARNING;
875 }
876
877 llist_for_each_entry(line, &e1inp_line_list, list)
878 e1line_dump_vty(vty, line);
879
880 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000881}
882
883static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
884{
Harald Welte42581822009-08-08 16:12:58 +0200885 if (ts->type == E1INP_TS_TYPE_NONE)
886 return;
Harald Welte1bc77352009-03-10 19:47:51 +0000887 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
888 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
889 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000890}
891
892DEFUN(show_e1ts,
893 show_e1ts_cmd,
894 "show e1_timeslot [line_nr] [ts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200895 SHOW_STR "Display information about a E1 timeslot\n"
896 "E1 Line Number\n" "E1 Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000897{
Harald Welte986c3d72009-11-17 06:12:16 +0100898 struct e1inp_line *line = NULL;
Harald Welte1bc77352009-03-10 19:47:51 +0000899 struct e1inp_ts *ts;
900 int ts_nr;
Harald Welte68628e82009-03-10 12:17:57 +0000901
Harald Welte1bc77352009-03-10 19:47:51 +0000902 if (argc == 0) {
903 llist_for_each_entry(line, &e1inp_line_list, list) {
904 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
905 ts = &line->ts[ts_nr];
906 e1ts_dump_vty(vty, ts);
907 }
908 }
909 return CMD_SUCCESS;
910 }
911 if (argc >= 1) {
912 int num = atoi(argv[0]);
913 llist_for_each_entry(line, &e1inp_line_list, list) {
914 if (line->num == num)
915 break;
916 }
917 if (!line || line->num != num) {
918 vty_out(vty, "E1 line %s is invalid%s",
919 argv[0], VTY_NEWLINE);
920 return CMD_WARNING;
921 }
922 }
923 if (argc >= 2) {
924 ts_nr = atoi(argv[1]);
925 if (ts_nr > NUM_E1_TS) {
926 vty_out(vty, "E1 timeslot %s is invalid%s",
927 argv[1], VTY_NEWLINE);
928 return CMD_WARNING;
929 }
930 ts = &line->ts[ts_nr];
931 e1ts_dump_vty(vty, ts);
932 return CMD_SUCCESS;
933 } else {
934 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
935 ts = &line->ts[ts_nr];
936 e1ts_dump_vty(vty, ts);
937 }
938 return CMD_SUCCESS;
939 }
940 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000941}
942
Harald Weltebe4b7302009-05-23 16:59:33 +0000943static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
Harald Weltef5025b62009-03-28 16:55:11 +0000944{
945 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
946 subscr_dump_vty(vty, pag->subscr);
947}
948
Harald Weltebe4b7302009-05-23 16:59:33 +0000949static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
Harald Weltef5025b62009-03-28 16:55:11 +0000950{
951 struct gsm_paging_request *pag;
952
953 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
954 paging_dump_vty(vty, pag);
955}
956
957DEFUN(show_paging,
958 show_paging_cmd,
959 "show paging [bts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200960 SHOW_STR "Display information about paging reuqests of a BTS\n"
961 "BTS Number\n")
Harald Weltef5025b62009-03-28 16:55:11 +0000962{
Harald Weltedcccb182010-05-16 20:52:23 +0200963 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Weltef5025b62009-03-28 16:55:11 +0000964 struct gsm_bts *bts;
965 int bts_nr;
966
967 if (argc >= 1) {
968 /* use the BTS number that the user has specified */
969 bts_nr = atoi(argv[0]);
970 if (bts_nr >= net->num_bts) {
971 vty_out(vty, "%% can't find BTS %s%s", argv[0],
972 VTY_NEWLINE);
973 return CMD_WARNING;
974 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200975 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +0000976 bts_paging_dump_vty(vty, bts);
977
978 return CMD_SUCCESS;
979 }
980 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200981 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +0000982 bts_paging_dump_vty(vty, bts);
983 }
984
985 return CMD_SUCCESS;
986}
987
Harald Welte8f0ed552010-05-11 21:53:49 +0200988#define NETWORK_STR "Configure the GSM network\n"
989
Harald Welte5013b2a2009-08-07 13:29:14 +0200990DEFUN(cfg_net,
991 cfg_net_cmd,
Harald Welte8f0ed552010-05-11 21:53:49 +0200992 "network", NETWORK_STR)
Harald Welte5013b2a2009-08-07 13:29:14 +0200993{
Harald Weltedcccb182010-05-16 20:52:23 +0200994 vty->index = gsmnet_from_vty(vty);
Harald Welte5013b2a2009-08-07 13:29:14 +0200995 vty->node = GSMNET_NODE;
996
997 return CMD_SUCCESS;
998}
999
1000
1001DEFUN(cfg_net_ncc,
1002 cfg_net_ncc_cmd,
1003 "network country code <1-999>",
1004 "Set the GSM network country code")
1005{
Harald Weltedcccb182010-05-16 20:52:23 +02001006 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1007
Harald Welte5013b2a2009-08-07 13:29:14 +02001008 gsmnet->country_code = atoi(argv[0]);
1009
1010 return CMD_SUCCESS;
1011}
1012
1013DEFUN(cfg_net_mnc,
1014 cfg_net_mnc_cmd,
1015 "mobile network code <1-999>",
1016 "Set the GSM mobile network code")
1017{
Harald Weltedcccb182010-05-16 20:52:23 +02001018 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1019
Harald Welte5013b2a2009-08-07 13:29:14 +02001020 gsmnet->network_code = atoi(argv[0]);
1021
1022 return CMD_SUCCESS;
1023}
1024
1025DEFUN(cfg_net_name_short,
1026 cfg_net_name_short_cmd,
1027 "short name NAME",
1028 "Set the short GSM network name")
1029{
Harald Weltedcccb182010-05-16 20:52:23 +02001030 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1031
Harald Welte5013b2a2009-08-07 13:29:14 +02001032 if (gsmnet->name_short)
1033 talloc_free(gsmnet->name_short);
1034
1035 gsmnet->name_short = talloc_strdup(gsmnet, argv[0]);
1036
1037 return CMD_SUCCESS;
1038}
1039
1040DEFUN(cfg_net_name_long,
1041 cfg_net_name_long_cmd,
1042 "long name NAME",
1043 "Set the long GSM network name")
1044{
Harald Weltedcccb182010-05-16 20:52:23 +02001045 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1046
Harald Welte5013b2a2009-08-07 13:29:14 +02001047 if (gsmnet->name_long)
1048 talloc_free(gsmnet->name_long);
1049
1050 gsmnet->name_long = talloc_strdup(gsmnet, argv[0]);
1051
1052 return CMD_SUCCESS;
1053}
Harald Welte40f82892009-05-23 17:31:39 +00001054
Harald Welte (local)69de3972009-08-12 14:42:23 +02001055DEFUN(cfg_net_auth_policy,
1056 cfg_net_auth_policy_cmd,
1057 "auth policy (closed|accept-all|token)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001058 "Authentication (not cryptographic)\n"
1059 "Set the GSM network authentication policy\n"
1060 "Require the MS to be activated in HLR\n"
1061 "Accept all MS, whether in HLR or not\n"
1062 "Use SMS-token based authentication\n")
Harald Welte (local)69de3972009-08-12 14:42:23 +02001063{
1064 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001065 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte (local)69de3972009-08-12 14:42:23 +02001066
1067 gsmnet->auth_policy = policy;
1068
1069 return CMD_SUCCESS;
1070}
1071
Harald Welte1085c092009-11-18 20:33:19 +01001072DEFUN(cfg_net_reject_cause,
1073 cfg_net_reject_cause_cmd,
1074 "location updating reject cause <2-111>",
1075 "Set the reject cause of location updating reject\n")
1076{
Harald Weltedcccb182010-05-16 20:52:23 +02001077 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1078
Harald Welte1085c092009-11-18 20:33:19 +01001079 gsmnet->reject_cause = atoi(argv[0]);
1080
1081 return CMD_SUCCESS;
1082}
1083
Harald Welte4381cfe2009-08-30 15:47:06 +09001084DEFUN(cfg_net_encryption,
1085 cfg_net_encryption_cmd,
1086 "encryption a5 (0|1|2)",
Harald Welte28326062010-05-14 20:05:17 +02001087 "Encryption options\n"
1088 "A5 encryption\n" "A5/0: No encryption\n"
1089 "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n")
Harald Welte4381cfe2009-08-30 15:47:06 +09001090{
Harald Weltedcccb182010-05-16 20:52:23 +02001091 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1092
Andreas.Eversberg1059deb2009-11-17 09:55:26 +01001093 gsmnet->a5_encryption= atoi(argv[0]);
Harald Welte4381cfe2009-08-30 15:47:06 +09001094
1095 return CMD_SUCCESS;
1096}
1097
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001098DEFUN(cfg_net_neci,
1099 cfg_net_neci_cmd,
1100 "neci (0|1)",
Harald Welte28326062010-05-14 20:05:17 +02001101 "New Establish Cause Indication\n"
1102 "Don't set the NECI bit\n" "Set the NECI bit\n")
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001103{
Harald Weltedcccb182010-05-16 20:52:23 +02001104 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1105
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001106 gsmnet->neci = atoi(argv[0]);
1107 return CMD_SUCCESS;
1108}
1109
Harald Welteeab84a12009-12-13 10:53:12 +01001110DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1111 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001112 "Radio Resource Location Protocol\n"
1113 "Set the Radio Resource Location Protocol Mode\n"
1114 "Don't send RRLP request\n"
1115 "Request MS-based location\n"
1116 "Request any location, prefer MS-based\n"
1117 "Request any location, prefer MS-assisted\n")
Harald Welteeab84a12009-12-13 10:53:12 +01001118{
Harald Weltedcccb182010-05-16 20:52:23 +02001119 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1120
Harald Welteeab84a12009-12-13 10:53:12 +01001121 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1122
1123 return CMD_SUCCESS;
1124}
1125
Harald Welte648b6ce2009-12-14 09:00:24 +01001126DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1127 "mm info (0|1)",
1128 "Whether to send MM INFO after LOC UPD ACCEPT")
1129{
Harald Weltedcccb182010-05-16 20:52:23 +02001130 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1131
Harald Welte648b6ce2009-12-14 09:00:24 +01001132 gsmnet->send_mm_info = atoi(argv[0]);
1133
1134 return CMD_SUCCESS;
1135}
1136
Harald Welte8f0ed552010-05-11 21:53:49 +02001137#define HANDOVER_STR "Handover Options\n"
1138
Harald Weltebc814502009-12-19 21:41:52 +01001139DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1140 "handover (0|1)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001141 HANDOVER_STR
1142 "Don't perform in-call handover\n"
1143 "Perform in-call handover\n")
Harald Weltebc814502009-12-19 21:41:52 +01001144{
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001145 int enable = atoi(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001146 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001147
1148 if (enable && ipacc_rtp_direct) {
Harald Weltefe03f0d2009-12-20 13:51:01 +01001149 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1150 "is enabled by using the -P command line option%s",
1151 VTY_NEWLINE);
1152 return CMD_WARNING;
1153 }
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001154 gsmnet->handover.active = enable;
Harald Weltebc814502009-12-19 21:41:52 +01001155
1156 return CMD_SUCCESS;
1157}
1158
Harald Welte8f0ed552010-05-11 21:53:49 +02001159#define HO_WIN_STR HANDOVER_STR "Measurement Window\n"
1160#define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n"
1161#define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n"
1162#define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n"
1163
Harald Welteb720bd32009-12-21 16:51:50 +01001164DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1165 "handover window rxlev averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001166 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001167 "How many RxLev measurements are used for averaging")
1168{
Harald Weltedcccb182010-05-16 20:52:23 +02001169 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001170 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1171 return CMD_SUCCESS;
1172}
1173
1174DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1175 "handover window rxqual averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001176 HO_WIN_RXQUAL_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001177 "How many RxQual measurements are used for averaging")
1178{
Harald Weltedcccb182010-05-16 20:52:23 +02001179 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001180 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1181 return CMD_SUCCESS;
1182}
1183
1184DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1185 "handover window rxlev neighbor averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001186 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001187 "How many RxQual measurements are used for averaging")
1188{
Harald Weltedcccb182010-05-16 20:52:23 +02001189 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001190 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1191 return CMD_SUCCESS;
1192}
1193
1194DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1195 "handover power budget interval <1-99>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001196 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001197 "How often to check if we have a better cell (SACCH frames)")
1198{
Harald Weltedcccb182010-05-16 20:52:23 +02001199 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001200 gsmnet->handover.pwr_interval = atoi(argv[0]);
1201 return CMD_SUCCESS;
1202}
1203
1204DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1205 "handover power budget hysteresis <0-999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001206 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001207 "How many dB does a neighbor to be stronger to become a HO candidate")
1208{
Harald Weltedcccb182010-05-16 20:52:23 +02001209 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001210 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1211 return CMD_SUCCESS;
1212}
1213
1214DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1215 "handover maximum distance <0-9999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001216 HANDOVER_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001217 "How big is the maximum timing advance before HO is forced")
1218{
Harald Weltedcccb182010-05-16 20:52:23 +02001219 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001220 gsmnet->handover.max_distance = atoi(argv[0]);
1221 return CMD_SUCCESS;
1222}
Harald Weltebc814502009-12-19 21:41:52 +01001223
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001224#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001225 DEFUN(cfg_net_T##number, \
1226 cfg_net_T##number##_cmd, \
1227 "timer t" #number " <0-65535>", \
Harald Welte8f0ed552010-05-11 21:53:49 +02001228 "Configure GSM Timers\n" \
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001229 doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001230{ \
Harald Weltedcccb182010-05-16 20:52:23 +02001231 struct gsm_network *gsmnet = gsmnet_from_vty(vty); \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001232 int value = atoi(argv[0]); \
1233 \
1234 if (value < 0 || value > 65535) { \
1235 vty_out(vty, "Timer value %s out of range.%s", \
1236 argv[0], VTY_NEWLINE); \
1237 return CMD_WARNING; \
1238 } \
1239 \
1240 gsmnet->T##number = value; \
1241 return CMD_SUCCESS; \
1242}
1243
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001244DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1245DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1246DECLARE_TIMER(3105, "Currently not used.")
1247DECLARE_TIMER(3107, "Currently not used.")
1248DECLARE_TIMER(3109, "Currently not used.")
Holger Hans Peter Freytherf30c0dc2010-05-31 21:33:15 +08001249DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel.")
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001250DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1251DECLARE_TIMER(3115, "Currently not used.")
1252DECLARE_TIMER(3117, "Currently not used.")
1253DECLARE_TIMER(3119, "Currently not used.")
1254DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001255
1256
Harald Welte5258fc42009-03-28 19:07:53 +00001257/* per-BTS configuration */
1258DEFUN(cfg_bts,
1259 cfg_bts_cmd,
1260 "bts BTS_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02001261 "Select a BTS to configure\n"
1262 "BTS Number\n")
Harald Welte5258fc42009-03-28 19:07:53 +00001263{
Harald Weltedcccb182010-05-16 20:52:23 +02001264 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte5258fc42009-03-28 19:07:53 +00001265 int bts_nr = atoi(argv[0]);
1266 struct gsm_bts *bts;
1267
Harald Weltee441d9c2009-06-21 16:17:15 +02001268 if (bts_nr > gsmnet->num_bts) {
1269 vty_out(vty, "%% The next unused BTS number is %u%s",
1270 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001271 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001272 } else if (bts_nr == gsmnet->num_bts) {
1273 /* allocate a new one */
1274 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1275 HARDCODED_TSC, HARDCODED_BSIC);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001276 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02001277 bts = gsm_bts_num(gsmnet, bts_nr);
1278
Daniel Willmannf15c2762010-01-11 13:43:07 +01001279 if (!bts) {
1280 vty_out(vty, "%% Unable to allocate BTS %u%s",
1281 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee441d9c2009-06-21 16:17:15 +02001282 return CMD_WARNING;
Daniel Willmannf15c2762010-01-11 13:43:07 +01001283 }
Harald Welte5258fc42009-03-28 19:07:53 +00001284
1285 vty->index = bts;
Harald Welte197dea92010-05-14 17:59:53 +02001286 vty->index_sub = &bts->description;
Harald Welte5258fc42009-03-28 19:07:53 +00001287 vty->node = BTS_NODE;
1288
1289 return CMD_SUCCESS;
1290}
1291
1292DEFUN(cfg_bts_type,
1293 cfg_bts_type_cmd,
1294 "type TYPE",
1295 "Set the BTS type\n")
1296{
1297 struct gsm_bts *bts = vty->index;
Harald Welte39315c42010-01-10 18:01:52 +01001298 int rc;
Harald Welte5258fc42009-03-28 19:07:53 +00001299
Harald Welte39315c42010-01-10 18:01:52 +01001300 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1301 if (rc < 0)
1302 return CMD_WARNING;
Harald Welte8175e952009-10-20 00:22:00 +02001303
Harald Welte5258fc42009-03-28 19:07:53 +00001304 return CMD_SUCCESS;
1305}
1306
Harald Weltefcd24452009-06-20 18:15:19 +02001307DEFUN(cfg_bts_band,
1308 cfg_bts_band_cmd,
1309 "band BAND",
1310 "Set the frequency band of this BTS\n")
1311{
1312 struct gsm_bts *bts = vty->index;
Harald Welte42581822009-08-08 16:12:58 +02001313 int band = gsm_band_parse(argv[0]);
Harald Weltefcd24452009-06-20 18:15:19 +02001314
1315 if (band < 0) {
1316 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1317 band, VTY_NEWLINE);
1318 return CMD_WARNING;
1319 }
1320
1321 bts->band = band;
1322
1323 return CMD_SUCCESS;
1324}
1325
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001326DEFUN(cfg_bts_ci,
1327 cfg_bts_ci_cmd,
1328 "cell_identity <0-65535>",
1329 "Set the Cell identity of this BTS\n")
1330{
1331 struct gsm_bts *bts = vty->index;
1332 int ci = atoi(argv[0]);
1333
1334 if (ci < 0 || ci > 0xffff) {
1335 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1336 ci, VTY_NEWLINE);
1337 return CMD_WARNING;
1338 }
1339 bts->cell_identity = ci;
1340
1341 return CMD_SUCCESS;
1342}
1343
Harald Welte5258fc42009-03-28 19:07:53 +00001344DEFUN(cfg_bts_lac,
1345 cfg_bts_lac_cmd,
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001346 "location_area_code <0-65535>",
Harald Welte5258fc42009-03-28 19:07:53 +00001347 "Set the Location Area Code (LAC) of this BTS\n")
1348{
1349 struct gsm_bts *bts = vty->index;
1350 int lac = atoi(argv[0]);
1351
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001352 if (lac < 0 || lac > 0xffff) {
1353 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte5258fc42009-03-28 19:07:53 +00001354 lac, VTY_NEWLINE);
1355 return CMD_WARNING;
1356 }
Holger Hans Peter Freythere48b9562009-10-01 04:07:15 +02001357
1358 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1359 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1360 lac, VTY_NEWLINE);
1361 return CMD_WARNING;
1362 }
1363
Harald Welte5258fc42009-03-28 19:07:53 +00001364 bts->location_area_code = lac;
1365
1366 return CMD_SUCCESS;
1367}
1368
Harald Weltea43f7892009-12-01 18:04:30 +05301369
Harald Welte5258fc42009-03-28 19:07:53 +00001370DEFUN(cfg_bts_tsc,
1371 cfg_bts_tsc_cmd,
1372 "training_sequence_code <0-255>",
1373 "Set the Training Sequence Code (TSC) of this BTS\n")
1374{
1375 struct gsm_bts *bts = vty->index;
1376 int tsc = atoi(argv[0]);
1377
1378 if (tsc < 0 || tsc > 0xff) {
1379 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1380 tsc, VTY_NEWLINE);
1381 return CMD_WARNING;
1382 }
1383 bts->tsc = tsc;
1384
1385 return CMD_SUCCESS;
1386}
1387
Harald Welte78f2f502009-05-23 16:56:52 +00001388DEFUN(cfg_bts_bsic,
1389 cfg_bts_bsic_cmd,
1390 "base_station_id_code <0-63>",
1391 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1392{
1393 struct gsm_bts *bts = vty->index;
1394 int bsic = atoi(argv[0]);
1395
1396 if (bsic < 0 || bsic > 0x3f) {
Harald Welte42581822009-08-08 16:12:58 +02001397 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte78f2f502009-05-23 16:56:52 +00001398 bsic, VTY_NEWLINE);
1399 return CMD_WARNING;
1400 }
1401 bts->bsic = bsic;
1402
1403 return CMD_SUCCESS;
1404}
1405
1406
Harald Welte4cc34222009-05-01 15:12:31 +00001407DEFUN(cfg_bts_unit_id,
1408 cfg_bts_unit_id_cmd,
Harald Welte07dc73d2009-08-07 13:27:09 +02001409 "ip.access unit_id <0-65534> <0-255>",
1410 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte4cc34222009-05-01 15:12:31 +00001411{
1412 struct gsm_bts *bts = vty->index;
1413 int site_id = atoi(argv[0]);
1414 int bts_id = atoi(argv[1]);
1415
Harald Welte07dc73d2009-08-07 13:27:09 +02001416 if (!is_ipaccess_bts(bts)) {
1417 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1418 return CMD_WARNING;
1419 }
1420
Harald Welte4cc34222009-05-01 15:12:31 +00001421 bts->ip_access.site_id = site_id;
1422 bts->ip_access.bts_id = bts_id;
1423
1424 return CMD_SUCCESS;
1425}
1426
Harald Welte8f0ed552010-05-11 21:53:49 +02001427#define OML_STR "Organization & Maintenance Link\n"
1428#define IPA_STR "ip.access Specific Options\n"
1429
Harald Welte8175e952009-10-20 00:22:00 +02001430DEFUN(cfg_bts_stream_id,
1431 cfg_bts_stream_id_cmd,
1432 "oml ip.access stream_id <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001433 OML_STR IPA_STR
Harald Welte8175e952009-10-20 00:22:00 +02001434 "Set the ip.access Stream ID of the OML link of this BTS\n")
1435{
1436 struct gsm_bts *bts = vty->index;
1437 int stream_id = atoi(argv[0]);
1438
1439 if (!is_ipaccess_bts(bts)) {
1440 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1441 return CMD_WARNING;
1442 }
1443
1444 bts->oml_tei = stream_id;
1445
1446 return CMD_SUCCESS;
1447}
1448
Harald Welte8f0ed552010-05-11 21:53:49 +02001449#define OML_E1_STR OML_STR "E1 Line\n"
Harald Welte8175e952009-10-20 00:22:00 +02001450
Harald Welte42581822009-08-08 16:12:58 +02001451DEFUN(cfg_bts_oml_e1,
1452 cfg_bts_oml_e1_cmd,
1453 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001454 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001455 "E1 interface to be used for OML\n")
1456{
1457 struct gsm_bts *bts = vty->index;
1458
1459 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1460
1461 return CMD_SUCCESS;
1462}
1463
1464
1465DEFUN(cfg_bts_oml_e1_tei,
1466 cfg_bts_oml_e1_tei_cmd,
1467 "oml e1 tei <0-63>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001468 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001469 "Set the TEI to be used for OML")
1470{
1471 struct gsm_bts *bts = vty->index;
1472
1473 bts->oml_tei = atoi(argv[0]);
1474
1475 return CMD_SUCCESS;
1476}
1477
Harald Welte7a8fa412009-08-10 13:48:16 +02001478DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1479 "channel allocator (ascending|descending)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001480 "Channnel Allocator\n" "Channel Allocator\n"
1481 "Allocate Timeslots and Transceivers in ascending order\n"
1482 "Allocate Timeslots and Transceivers in descending order\n")
Harald Welte7a8fa412009-08-10 13:48:16 +02001483{
1484 struct gsm_bts *bts = vty->index;
1485
1486 if (!strcmp(argv[0], "ascending"))
1487 bts->chan_alloc_reverse = 0;
1488 else
1489 bts->chan_alloc_reverse = 1;
1490
1491 return CMD_SUCCESS;
1492}
1493
Harald Welte8f0ed552010-05-11 21:53:49 +02001494#define RACH_STR "Random Access Control Channel\n"
1495
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001496DEFUN(cfg_bts_rach_tx_integer,
1497 cfg_bts_rach_tx_integer_cmd,
1498 "rach tx integer <0-15>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001499 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001500 "Set the raw tx integer value in RACH Control parameters IE")
1501{
1502 struct gsm_bts *bts = vty->index;
1503 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1504 return CMD_SUCCESS;
1505}
1506
1507DEFUN(cfg_bts_rach_max_trans,
1508 cfg_bts_rach_max_trans_cmd,
1509 "rach max transmission (1|2|4|7)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001510 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001511 "Set the maximum number of RACH burst transmissions")
1512{
1513 struct gsm_bts *bts = vty->index;
1514 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1515 return CMD_SUCCESS;
1516}
1517
Harald Welte8f0ed552010-05-11 21:53:49 +02001518#define NM_STR "Network Management\n"
1519
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001520DEFUN(cfg_bts_rach_nm_b_thresh,
1521 cfg_bts_rach_nm_b_thresh_cmd,
1522 "rach nm busy threshold <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001523 RACH_STR NM_STR
1524 "Set the NM Busy Threshold in dB")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001525{
1526 struct gsm_bts *bts = vty->index;
1527 bts->rach_b_thresh = atoi(argv[0]);
1528 return CMD_SUCCESS;
1529}
1530
1531DEFUN(cfg_bts_rach_nm_ldavg,
1532 cfg_bts_rach_nm_ldavg_cmd,
1533 "rach nm load average <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001534 RACH_STR NM_STR
1535 "Set the NM Loadaverage Slots value")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001536{
1537 struct gsm_bts *bts = vty->index;
1538 bts->rach_ldavg_slots = atoi(argv[0]);
1539 return CMD_SUCCESS;
1540}
1541
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001542DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1543 "cell barred (0|1)",
1544 "Should this cell be barred from access?")
1545{
1546 struct gsm_bts *bts = vty->index;
1547
Harald Welte71355012009-12-21 23:08:18 +01001548 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001549
1550 return CMD_SUCCESS;
1551}
1552
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08001553DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd,
1554 "rach emergency call allowed (0|1)",
1555 "Should this cell allow emergency calls?")
1556{
1557 struct gsm_bts *bts = vty->index;
1558
1559 if (atoi(argv[0]) == 0)
1560 bts->si_common.rach_control.t2 |= 0x4;
1561 else
1562 bts->si_common.rach_control.t2 &= ~0x4;
1563
1564 return CMD_SUCCESS;
1565}
1566
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001567DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1568 "ms max power <0-40>",
1569 "Maximum transmit power of the MS")
1570{
1571 struct gsm_bts *bts = vty->index;
1572
1573 bts->ms_max_power = atoi(argv[0]);
1574
1575 return CMD_SUCCESS;
1576}
1577
Harald Welte73225282009-12-12 18:17:25 +01001578DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1579 "cell reselection hysteresis <0-14>",
1580 "Cell Re-Selection Hysteresis in dB")
1581{
1582 struct gsm_bts *bts = vty->index;
1583
1584 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1585
1586 return CMD_SUCCESS;
1587}
1588
1589DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1590 "rxlev access min <0-63>",
1591 "Minimum RxLev needed for cell access (better than -110dBm)")
1592{
1593 struct gsm_bts *bts = vty->index;
1594
1595 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1596
1597 return CMD_SUCCESS;
1598}
1599
Harald Welte (local)efc92312009-08-14 23:09:25 +02001600DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1601 "periodic location update <0-1530>",
1602 "Periodic Location Updating Interval in Minutes")
1603{
1604 struct gsm_bts *bts = vty->index;
1605
Harald Weltea43f7892009-12-01 18:04:30 +05301606 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 10;
Harald Welte (local)efc92312009-08-14 23:09:25 +02001607
1608 return CMD_SUCCESS;
1609}
1610
Harald Welte8f0ed552010-05-11 21:53:49 +02001611#define GPRS_TEXT "GPRS Packet Network\n"
1612
Harald Welteaf387632010-03-14 23:30:30 +08001613DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welte57ba7e32010-04-18 14:00:26 +02001614 "gprs cell bvci <2-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001615 GPRS_TEXT
1616 "GPRS Cell Settings\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001617 "GPRS BSSGP VC Identifier")
1618{
1619 struct gsm_bts *bts = vty->index;
1620
Harald Welte4511d892010-04-18 15:51:20 +02001621 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001622 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1623 return CMD_WARNING;
1624 }
1625
Harald Welte97a282b2010-03-14 15:37:43 +08001626 bts->gprs.cell.bvci = atoi(argv[0]);
1627
1628 return CMD_SUCCESS;
1629}
1630
Harald Weltea5731cf2010-03-22 11:48:36 +08001631DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
1632 "gprs nsei <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001633 GPRS_TEXT
Harald Weltea5731cf2010-03-22 11:48:36 +08001634 "GPRS NS Entity Identifier")
1635{
1636 struct gsm_bts *bts = vty->index;
1637
Harald Welte4511d892010-04-18 15:51:20 +02001638 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltea5731cf2010-03-22 11:48:36 +08001639 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1640 return CMD_WARNING;
1641 }
1642
1643 bts->gprs.nse.nsei = atoi(argv[0]);
1644
1645 return CMD_SUCCESS;
1646}
1647
Harald Welte8f0ed552010-05-11 21:53:49 +02001648#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
1649 "NSVC Logical Number\n"
Harald Weltea5731cf2010-03-22 11:48:36 +08001650
Harald Welte97a282b2010-03-14 15:37:43 +08001651DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
1652 "gprs nsvc <0-1> nsvci <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001653 GPRS_TEXT NSVC_TEXT
1654 "NS Virtual Connection Identifier\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001655 "GPRS NS VC Identifier")
1656{
1657 struct gsm_bts *bts = vty->index;
1658 int idx = atoi(argv[0]);
1659
Harald Welte4511d892010-04-18 15:51:20 +02001660 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001661 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1662 return CMD_WARNING;
1663 }
1664
Harald Welte97a282b2010-03-14 15:37:43 +08001665 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
1666
1667 return CMD_SUCCESS;
1668}
1669
Harald Welteaf387632010-03-14 23:30:30 +08001670DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
1671 "gprs nsvc <0-1> local udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001672 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001673 "GPRS NS Local UDP Port")
1674{
1675 struct gsm_bts *bts = vty->index;
1676 int idx = atoi(argv[0]);
1677
Harald Welte4511d892010-04-18 15:51:20 +02001678 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001679 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1680 return CMD_WARNING;
1681 }
1682
Harald Welteaf387632010-03-14 23:30:30 +08001683 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
1684
1685 return CMD_SUCCESS;
1686}
1687
1688DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
1689 "gprs nsvc <0-1> remote udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001690 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001691 "GPRS NS Remote UDP Port")
1692{
1693 struct gsm_bts *bts = vty->index;
1694 int idx = atoi(argv[0]);
1695
Harald Welte4511d892010-04-18 15:51:20 +02001696 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001697 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1698 return CMD_WARNING;
1699 }
1700
Harald Welteaf387632010-03-14 23:30:30 +08001701 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
1702
1703 return CMD_SUCCESS;
1704}
1705
1706DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
1707 "gprs nsvc <0-1> remote ip A.B.C.D",
Harald Welte8f0ed552010-05-11 21:53:49 +02001708 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001709 "GPRS NS Remote IP Address")
1710{
1711 struct gsm_bts *bts = vty->index;
1712 int idx = atoi(argv[0]);
1713 struct in_addr ia;
1714
Harald Welte4511d892010-04-18 15:51:20 +02001715 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001716 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1717 return CMD_WARNING;
1718 }
1719
Harald Welteaf387632010-03-14 23:30:30 +08001720 inet_aton(argv[1], &ia);
1721 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
1722
1723 return CMD_SUCCESS;
1724}
1725
Harald Welte615e9562010-05-11 23:50:21 +02001726DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd,
1727 "gprs ns timer " NS_TIMERS " <0-255>",
1728 GPRS_TEXT "Network Service\n"
1729 "Network Service Timer\n"
1730 NS_TIMERS_HELP "Timer Value\n")
1731{
1732 struct gsm_bts *bts = vty->index;
1733 int idx = get_string_value(gprs_ns_timer_strs, argv[0]);
1734 int val = atoi(argv[1]);
1735
1736 if (bts->gprs.mode == BTS_GPRS_NONE) {
1737 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1738 return CMD_WARNING;
1739 }
1740
1741 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
1742 return CMD_WARNING;
1743
1744 bts->gprs.nse.timer[idx] = val;
1745
1746 return CMD_SUCCESS;
1747}
1748
1749#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 Welte28326062010-05-14 20:05:17 +02001750#define BSSGP_TIMERS_HELP \
1751 "Tbvc-block timeout\n" \
1752 "Tbvc-block retries\n" \
1753 "Tbvc-unblock retries\n" \
1754 "Tbvcc-reset timeout\n" \
1755 "Tbvc-reset retries\n" \
1756 "Tbvc-suspend timeout\n" \
1757 "Tbvc-suspend retries\n" \
1758 "Tbvc-resume timeout\n" \
1759 "Tbvc-resume retries\n" \
1760 "Tbvc-capa-update timeout\n" \
1761 "Tbvc-capa-update retries\n"
Harald Welte615e9562010-05-11 23:50:21 +02001762
1763DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd,
1764 "gprs cell timer " BSSGP_TIMERS " <0-255>",
1765 GPRS_TEXT "Cell / BSSGP\n"
1766 "Cell/BSSGP Timer\n"
1767 BSSGP_TIMERS_HELP "Timer Value\n")
1768{
1769 struct gsm_bts *bts = vty->index;
1770 int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
1771 int val = atoi(argv[1]);
1772
1773 if (bts->gprs.mode == BTS_GPRS_NONE) {
1774 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1775 return CMD_WARNING;
1776 }
1777
1778 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer))
1779 return CMD_WARNING;
1780
1781 bts->gprs.cell.timer[idx] = val;
1782
1783 return CMD_SUCCESS;
1784}
1785
Harald Welte97a282b2010-03-14 15:37:43 +08001786DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
1787 "gprs routing area <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001788 GPRS_TEXT
Harald Welte97a282b2010-03-14 15:37:43 +08001789 "GPRS Routing Area Code")
1790{
1791 struct gsm_bts *bts = vty->index;
1792
Harald Welte4511d892010-04-18 15:51:20 +02001793 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001794 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1795 return CMD_WARNING;
1796 }
1797
Harald Welte97a282b2010-03-14 15:37:43 +08001798 bts->gprs.rac = atoi(argv[0]);
1799
1800 return CMD_SUCCESS;
1801}
1802
Harald Welte4511d892010-04-18 15:51:20 +02001803DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
1804 "gprs mode (none|gprs|egprs)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001805 GPRS_TEXT
1806 "GPRS Mode for this BTS\n"
1807 "GPRS Disabled on this BTS\n"
1808 "GPRS Enabled on this BTS\n"
1809 "EGPRS (EDGE) Enabled on this BTS\n")
Harald Welteaf387632010-03-14 23:30:30 +08001810{
1811 struct gsm_bts *bts = vty->index;
1812
Harald Welte4511d892010-04-18 15:51:20 +02001813 bts->gprs.mode = bts_gprs_mode_parse(argv[0]);
Harald Welteaf387632010-03-14 23:30:30 +08001814
1815 return CMD_SUCCESS;
1816}
1817
Harald Welte8f0ed552010-05-11 21:53:49 +02001818#define TRX_TEXT "Radio Transceiver\n"
Harald Welte7a8fa412009-08-10 13:48:16 +02001819
Harald Welte5258fc42009-03-28 19:07:53 +00001820/* per TRX configuration */
1821DEFUN(cfg_trx,
1822 cfg_trx_cmd,
1823 "trx TRX_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02001824 TRX_TEXT
Harald Welte5258fc42009-03-28 19:07:53 +00001825 "Select a TRX to configure")
1826{
1827 int trx_nr = atoi(argv[0]);
1828 struct gsm_bts *bts = vty->index;
1829 struct gsm_bts_trx *trx;
1830
Harald Weltee441d9c2009-06-21 16:17:15 +02001831 if (trx_nr > bts->num_trx) {
1832 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
1833 bts->num_trx, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001834 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001835 } else if (trx_nr == bts->num_trx) {
1836 /* we need to allocate a new one */
1837 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001838 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02001839 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001840
Harald Weltee441d9c2009-06-21 16:17:15 +02001841 if (!trx)
1842 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +00001843
1844 vty->index = trx;
Harald Welte197dea92010-05-14 17:59:53 +02001845 vty->index_sub = &trx->description;
Harald Welte5258fc42009-03-28 19:07:53 +00001846 vty->node = TRX_NODE;
1847
1848 return CMD_SUCCESS;
1849}
1850
1851DEFUN(cfg_trx_arfcn,
1852 cfg_trx_arfcn_cmd,
Harald Welte93e90202010-05-14 19:00:52 +02001853 "arfcn <0-1024>",
Harald Welte5258fc42009-03-28 19:07:53 +00001854 "Set the ARFCN for this TRX\n")
1855{
1856 int arfcn = atoi(argv[0]);
1857 struct gsm_bts_trx *trx = vty->index;
1858
1859 /* FIXME: check if this ARFCN is supported by this TRX */
1860
1861 trx->arfcn = arfcn;
1862
1863 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
1864 /* FIXME: use OML layer to update the ARFCN */
1865 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
1866
1867 return CMD_SUCCESS;
1868}
1869
Harald Welte (local)7b37d972009-12-27 20:56:38 +01001870DEFUN(cfg_trx_nominal_power,
1871 cfg_trx_nominal_power_cmd,
1872 "nominal power <0-100>",
1873 "Nominal TRX RF Power in dB\n")
1874{
1875 struct gsm_bts_trx *trx = vty->index;
1876
1877 trx->nominal_power = atoi(argv[0]);
1878
1879 return CMD_SUCCESS;
1880}
1881
Harald Weltefcd24452009-06-20 18:15:19 +02001882DEFUN(cfg_trx_max_power_red,
1883 cfg_trx_max_power_red_cmd,
1884 "max_power_red <0-100>",
1885 "Reduction of maximum BS RF Power in dB\n")
1886{
1887 int maxpwr_r = atoi(argv[0]);
1888 struct gsm_bts_trx *trx = vty->index;
Harald Welte61a83b22009-11-18 09:20:22 +01001889 int upper_limit = 24; /* default 12.21 max power red. */
Harald Weltefcd24452009-06-20 18:15:19 +02001890
1891 /* FIXME: check if our BTS type supports more than 12 */
1892 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
1893 vty_out(vty, "%% Power %d dB is not in the valid range%s",
1894 maxpwr_r, VTY_NEWLINE);
1895 return CMD_WARNING;
1896 }
1897 if (maxpwr_r & 1) {
1898 vty_out(vty, "%% Power %d dB is not an even value%s",
1899 maxpwr_r, VTY_NEWLINE);
1900 return CMD_WARNING;
1901 }
1902
1903 trx->max_power_red = maxpwr_r;
1904
1905 /* FIXME: make sure we update this using OML */
1906
1907 return CMD_SUCCESS;
1908}
1909
Harald Welte42581822009-08-08 16:12:58 +02001910DEFUN(cfg_trx_rsl_e1,
1911 cfg_trx_rsl_e1_cmd,
1912 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
1913 "E1 interface to be used for RSL\n")
1914{
1915 struct gsm_bts_trx *trx = vty->index;
1916
1917 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
1918
1919 return CMD_SUCCESS;
1920}
1921
1922DEFUN(cfg_trx_rsl_e1_tei,
1923 cfg_trx_rsl_e1_tei_cmd,
1924 "rsl e1 tei <0-63>",
1925 "Set the TEI to be used for RSL")
1926{
1927 struct gsm_bts_trx *trx = vty->index;
1928
1929 trx->rsl_tei = atoi(argv[0]);
1930
1931 return CMD_SUCCESS;
1932}
1933
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01001934DEFUN(cfg_trx_rf_locked,
1935 cfg_trx_rf_locked_cmd,
1936 "rf_locked (0|1)",
1937 "Turn off RF of the TRX.\n")
1938{
1939 int locked = atoi(argv[0]);
1940 struct gsm_bts_trx *trx = vty->index;
1941
1942 gsm_trx_lock_rf(trx, locked);
1943 return CMD_SUCCESS;
1944}
Harald Welte42581822009-08-08 16:12:58 +02001945
Harald Welte5258fc42009-03-28 19:07:53 +00001946/* per TS configuration */
1947DEFUN(cfg_ts,
1948 cfg_ts_cmd,
Harald Welte42581822009-08-08 16:12:58 +02001949 "timeslot <0-7>",
Harald Welte5258fc42009-03-28 19:07:53 +00001950 "Select a Timeslot to configure")
1951{
1952 int ts_nr = atoi(argv[0]);
1953 struct gsm_bts_trx *trx = vty->index;
1954 struct gsm_bts_trx_ts *ts;
1955
1956 if (ts_nr >= TRX_NR_TS) {
1957 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
1958 TRX_NR_TS, VTY_NEWLINE);
1959 return CMD_WARNING;
1960 }
1961
1962 ts = &trx->ts[ts_nr];
1963
1964 vty->index = ts;
1965 vty->node = TS_NODE;
1966
1967 return CMD_SUCCESS;
1968}
1969
Harald Weltea6fd58e2009-08-07 00:25:23 +02001970DEFUN(cfg_ts_pchan,
1971 cfg_ts_pchan_cmd,
1972 "phys_chan_config PCHAN",
1973 "Physical Channel configuration (TCH/SDCCH/...)")
1974{
1975 struct gsm_bts_trx_ts *ts = vty->index;
1976 int pchanc;
1977
1978 pchanc = gsm_pchan_parse(argv[0]);
1979 if (pchanc < 0)
1980 return CMD_WARNING;
1981
1982 ts->pchan = pchanc;
1983
1984 return CMD_SUCCESS;
1985}
1986
Harald Welte6e0cd042009-09-12 13:05:33 +02001987DEFUN(cfg_ts_hsn,
1988 cfg_ts_hsn_cmd,
1989 "hopping sequence number <0-63>",
1990 "Which hopping sequence to use for this channel")
1991{
1992 struct gsm_bts_trx_ts *ts = vty->index;
1993
1994 ts->hopping.hsn = atoi(argv[0]);
1995
1996 return CMD_SUCCESS;
1997}
1998
1999DEFUN(cfg_ts_maio,
2000 cfg_ts_maio_cmd,
2001 "hopping maio <0-63>",
2002 "Which hopping MAIO to use for this channel")
2003{
2004 struct gsm_bts_trx_ts *ts = vty->index;
2005
2006 ts->hopping.maio = atoi(argv[0]);
2007
2008 return CMD_SUCCESS;
2009}
2010
2011DEFUN(cfg_ts_arfcn_add,
2012 cfg_ts_arfcn_add_cmd,
2013 "hopping arfcn add <0-1023>",
2014 "Add an entry to the hopping ARFCN list")
2015{
2016 struct gsm_bts_trx_ts *ts = vty->index;
2017 int arfcn = atoi(argv[0]);
2018
2019 /* FIXME */
2020 return CMD_SUCCESS;
2021}
2022
2023DEFUN(cfg_ts_arfcn_del,
2024 cfg_ts_arfcn_del_cmd,
2025 "hopping arfcn del <0-1023>",
2026 "Delete an entry to the hopping ARFCN list")
2027{
2028 struct gsm_bts_trx_ts *ts = vty->index;
2029 int arfcn = atoi(argv[0]);
2030
2031 /* FIXME */
2032 return CMD_SUCCESS;
2033}
2034
Harald Weltea6fd58e2009-08-07 00:25:23 +02002035DEFUN(cfg_ts_e1_subslot,
2036 cfg_ts_e1_subslot_cmd,
Harald Welte42581822009-08-08 16:12:58 +02002037 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltea6fd58e2009-08-07 00:25:23 +02002038 "E1 sub-slot connected to this on-air timeslot")
2039{
2040 struct gsm_bts_trx_ts *ts = vty->index;
2041
Harald Welte42581822009-08-08 16:12:58 +02002042 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002043
2044 return CMD_SUCCESS;
2045}
Harald Welte5258fc42009-03-28 19:07:53 +00002046
Harald Welte4f10c252010-05-16 21:47:13 +02002047void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
2048{
2049 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
2050 counter_get(net->stats.chreq.total),
2051 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
2052 vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
2053 counter_get(net->stats.chan.rf_fail),
2054 counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
2055 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
2056 counter_get(net->stats.paging.attempted),
2057 counter_get(net->stats.paging.completed),
2058 counter_get(net->stats.paging.expired), VTY_NEWLINE);
2059 vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
2060 counter_get(net->stats.bts.oml_fail),
2061 counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
2062}
2063
Harald Welte5bc61dc2010-05-16 22:02:16 +02002064DEFUN(logging_fltr_imsi,
2065 logging_fltr_imsi_cmd,
2066 "logging filter imsi IMSI",
2067 LOGGING_STR FILTER_STR
2068 "Filter log messages by IMSI\n" "IMSI to be used as filter\n")
2069{
2070 struct telnet_connection *conn;
2071
2072 conn = (struct telnet_connection *) vty->priv;
2073 if (!conn->dbg) {
2074 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
2075 return CMD_WARNING;
2076 }
2077
2078 log_set_imsi_filter(conn->dbg, argv[0]);
2079 return CMD_SUCCESS;
2080}
2081
Harald Weltedcccb182010-05-16 20:52:23 +02002082extern int bsc_vty_init_extra(void);
Harald Welte1353f962010-05-16 19:20:24 +02002083extern const char *openbsc_copyright;
Holger Hans Peter Freythere1ffc082010-04-10 00:08:28 +02002084
Harald Weltedcccb182010-05-16 20:52:23 +02002085int bsc_vty_init(void)
Harald Welte68628e82009-03-10 12:17:57 +00002086{
Harald Welteb4d5b172010-05-12 16:10:35 +00002087 install_element_ve(&show_net_cmd);
2088 install_element_ve(&show_bts_cmd);
2089 install_element_ve(&show_trx_cmd);
2090 install_element_ve(&show_ts_cmd);
2091 install_element_ve(&show_lchan_cmd);
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08002092 install_element_ve(&show_lchan_summary_cmd);
Harald Welte5bc61dc2010-05-16 22:02:16 +02002093 install_element_ve(&logging_fltr_imsi_cmd);
Harald Welte1bc77352009-03-10 19:47:51 +00002094
Harald Welteb4d5b172010-05-12 16:10:35 +00002095 install_element_ve(&show_e1drv_cmd);
2096 install_element_ve(&show_e1line_cmd);
2097 install_element_ve(&show_e1ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002098
Harald Welteb4d5b172010-05-12 16:10:35 +00002099 install_element_ve(&show_paging_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002100
Harald Welte5bc61dc2010-05-16 22:02:16 +02002101 logging_vty_add_cmds();
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +01002102
Harald Welte5013b2a2009-08-07 13:29:14 +02002103 install_element(CONFIG_NODE, &cfg_net_cmd);
2104 install_node(&net_node, config_write_net);
2105 install_default(GSMNET_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002106 install_element(GSMNET_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002107 install_element(GSMNET_NODE, &ournode_end_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002108 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002109 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
2110 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
2111 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)69de3972009-08-12 14:42:23 +02002112 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte1085c092009-11-18 20:33:19 +01002113 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Welte4381cfe2009-08-30 15:47:06 +09002114 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01002115 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welteeab84a12009-12-13 10:53:12 +01002116 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte3d23db42009-12-14 17:49:15 +01002117 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Weltebc814502009-12-19 21:41:52 +01002118 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Welteb720bd32009-12-21 16:51:50 +01002119 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
2120 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
2121 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
2122 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
2123 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
2124 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01002125 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01002126 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
2127 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
2128 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
2129 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
2130 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
2131 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
2132 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
2133 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
2134 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
2135 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002136
2137 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte67ce0732009-08-06 19:06:46 +02002138 install_node(&bts_node, config_write_bts);
Harald Welte68628e82009-03-10 12:17:57 +00002139 install_default(BTS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002140 install_element(BTS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002141 install_element(BTS_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002142 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002143 install_element(BTS_NODE, &cfg_description_cmd);
2144 install_element(BTS_NODE, &cfg_no_description_cmd);
Harald Weltefcd24452009-06-20 18:15:19 +02002145 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02002146 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002147 install_element(BTS_NODE, &cfg_bts_lac_cmd);
2148 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002149 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte4cc34222009-05-01 15:12:31 +00002150 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte8175e952009-10-20 00:22:00 +02002151 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002152 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
2153 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02002154 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01002155 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
2156 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08002157 install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd);
2158 install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02002159 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08002160 install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd);
Harald Welte (local)0e451d02009-08-13 10:14:26 +02002161 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)efc92312009-08-14 23:09:25 +02002162 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welte73225282009-12-12 18:17:25 +01002163 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
2164 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Harald Welte4511d892010-04-18 15:51:20 +02002165 install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002166 install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002167 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
2168 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002169 install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
Harald Weltea5731cf2010-03-22 11:48:36 +08002170 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002171 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welteaf387632010-03-14 23:30:30 +08002172 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
2173 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
2174 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002175
Harald Welte5258fc42009-03-28 19:07:53 +00002176 install_element(BTS_NODE, &cfg_trx_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002177 install_node(&trx_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002178 install_default(TRX_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002179 install_element(TRX_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002180 install_element(TRX_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002181 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002182 install_element(TRX_NODE, &cfg_description_cmd);
2183 install_element(TRX_NODE, &cfg_no_description_cmd);
Harald Welte (local)7b37d972009-12-27 20:56:38 +01002184 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte879dc972009-06-20 22:36:12 +02002185 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002186 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
2187 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01002188 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002189
Harald Welte5258fc42009-03-28 19:07:53 +00002190 install_element(TRX_NODE, &cfg_ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002191 install_node(&ts_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002192 install_default(TS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002193 install_element(TS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002194 install_element(TS_NODE, &ournode_end_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002195 install_element(TS_NODE, &cfg_ts_pchan_cmd);
Harald Welte6e0cd042009-09-12 13:05:33 +02002196 install_element(TS_NODE, &cfg_ts_hsn_cmd);
2197 install_element(TS_NODE, &cfg_ts_maio_cmd);
2198 install_element(TS_NODE, &cfg_ts_arfcn_add_cmd);
2199 install_element(TS_NODE, &cfg_ts_arfcn_del_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002200 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002201
Harald Welte81c9b9c2010-05-31 16:40:40 +02002202 abis_nm_vty_init();
2203
Harald Weltedcccb182010-05-16 20:52:23 +02002204 bsc_vty_init_extra();
Harald Welte40f82892009-05-23 17:31:39 +00002205
Harald Welte68628e82009-03-10 12:17:57 +00002206 return 0;
2207}