blob: c293433c9530966aa57c3589f6bdb31360e9e106 [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 Welte9fbff4a2010-07-30 11:50:09 +020037#include <osmocore/utils.h>
Harald Weltedfe6c7d2010-02-20 16:24:02 +010038#include <osmocore/gsm_utils.h>
Harald Welteb908cb72009-12-22 13:09:29 +010039#include <openbsc/chan_alloc.h>
Harald Welte8387a492009-12-22 21:43:14 +010040#include <openbsc/meas_rep.h>
Harald Welte40f82892009-05-23 17:31:39 +000041#include <openbsc/db.h>
Harald Weltedfe6c7d2010-02-20 16:24:02 +010042#include <osmocore/talloc.h>
Holger Hans Peter Freyther3c712322010-04-06 11:55:37 +020043#include <openbsc/vty.h>
Harald Welte22229d62010-05-12 20:28:04 +020044#include <openbsc/gprs_ns.h>
Harald Welte9fbff4a2010-07-30 11:50:09 +020045#include <openbsc/system_information.h>
Harald Welte5bc61dc2010-05-16 22:02:16 +020046#include <openbsc/debug.h>
Holger Hans Peter Freyther85334f12010-11-09 17:00:42 +010047#include <openbsc/paging.h>
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +010048#include <openbsc/ipaccess.h>
Harald Welted0d2b0b2010-12-23 13:18:07 +010049#include <openbsc/abis_rsl.h>
Harald Welte68628e82009-03-10 12:17:57 +000050
Harald Welte1353f962010-05-16 19:20:24 +020051#include "../bscconfig.h"
52
Harald Welteea4647d2010-05-12 17:19:53 +000053/* FIXME: this should go to some common file */
54static const struct value_string gprs_ns_timer_strs[] = {
Harald Welte615e9562010-05-11 23:50:21 +020055 { 0, "tns-block" },
56 { 1, "tns-block-retries" },
57 { 2, "tns-reset" },
58 { 3, "tns-reset-retries" },
59 { 4, "tns-test" },
60 { 5, "tns-alive" },
61 { 6, "tns-alive-retries" },
62 { 0, NULL }
63};
64
Harald Welteea4647d2010-05-12 17:19:53 +000065static const struct value_string gprs_bssgp_cfg_strs[] = {
Harald Welte615e9562010-05-11 23:50:21 +020066 { 0, "blocking-timer" },
67 { 1, "blocking-retries" },
68 { 2, "unblocking-retries" },
69 { 3, "reset-timer" },
70 { 4, "reset-retries" },
71 { 5, "suspend-timer" },
72 { 6, "suspend-retries" },
73 { 7, "resume-timer" },
74 { 8, "resume-retries" },
75 { 9, "capability-update-timer" },
76 { 10, "capability-update-retries" },
77 { 0, NULL }
78};
79
Harald Welte5013b2a2009-08-07 13:29:14 +020080struct cmd_node net_node = {
81 GSMNET_NODE,
82 "%s(network)#",
83 1,
84};
85
Harald Welte68628e82009-03-10 12:17:57 +000086struct cmd_node bts_node = {
87 BTS_NODE,
88 "%s(bts)#",
89 1,
90};
91
92struct cmd_node trx_node = {
93 TRX_NODE,
94 "%s(trx)#",
95 1,
96};
97
98struct cmd_node ts_node = {
99 TS_NODE,
100 "%s(ts)#",
101 1,
102};
103
Harald Welte39231152010-05-27 13:39:40 +0200104extern struct gsm_network *bsc_gsmnet;
105
Harald Weltedcccb182010-05-16 20:52:23 +0200106struct gsm_network *gsmnet_from_vty(struct vty *v)
107{
Harald Welte39231152010-05-27 13:39:40 +0200108 /* In case we read from the config file, the vty->priv cannot
109 * point to a struct telnet_connection, and thus conn->priv
110 * will not point to the gsm_network structure */
111#if 0
Harald Weltedcccb182010-05-16 20:52:23 +0200112 struct telnet_connection *conn = v->priv;
113 return (struct gsm_network *) conn->priv;
Harald Welte39231152010-05-27 13:39:40 +0200114#else
115 return bsc_gsmnet;
116#endif
Harald Weltedcccb182010-05-16 20:52:23 +0200117}
118
Harald Welte68628e82009-03-10 12:17:57 +0000119static int dummy_config_write(struct vty *v)
120{
121 return CMD_SUCCESS;
122}
123
124static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
125{
Harald Welte1bc77352009-03-10 19:47:51 +0000126 vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s",
127 nm_opstate_name(nms->operational), nms->administrative,
128 nm_avail_name(nms->availability), VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000129}
130
Harald Welteb908cb72009-12-22 13:09:29 +0100131static void dump_pchan_load_vty(struct vty *vty, char *prefix,
132 const struct pchan_load *pl)
133{
134 int i;
135
136 for (i = 0; i < ARRAY_SIZE(pl->pchan); i++) {
137 const struct load_counter *lc = &pl->pchan[i];
138 unsigned int percent;
139
140 if (lc->total == 0)
141 continue;
142
143 percent = (lc->used * 100) / lc->total;
144
145 vty_out(vty, "%s%20s: %3u%% (%u/%u)%s", prefix,
146 gsm_pchan_name(i), percent, lc->used, lc->total,
147 VTY_NEWLINE);
148 }
149}
150
Harald Welte68628e82009-03-10 12:17:57 +0000151static void net_dump_vty(struct vty *vty, struct gsm_network *net)
152{
Harald Welteb908cb72009-12-22 13:09:29 +0100153 struct pchan_load pl;
154
Harald Welteef235b52009-03-10 12:34:02 +0000155 vty_out(vty, "BSC is on Country Code %u, Network Code %u "
156 "and has %u BTS%s", net->country_code, net->network_code,
157 net->num_bts, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000158 vty_out(vty, " Long network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000159 net->name_long, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000160 vty_out(vty, " Short network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000161 net->name_short, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200162 vty_out(vty, " Authentication policy: %s%s",
163 gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100164 vty_out(vty, " Location updating reject cause: %u%s",
165 net->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900166 vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption,
167 VTY_NEWLINE);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +0100168 vty_out(vty, " NECI (TCH/H): %u%s", net->neci,
169 VTY_NEWLINE);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +0800170 vty_out(vty, " Use TCH for Paging any: %d%s", net->pag_any_tch,
171 VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100172 vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode),
173 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100174 vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off",
175 VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100176 vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off",
177 VTY_NEWLINE);
Harald Welteb908cb72009-12-22 13:09:29 +0100178 network_chan_load(&pl, net);
179 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
180 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000181}
182
183DEFUN(show_net, show_net_cmd, "show network",
184 SHOW_STR "Display information about a GSM NETWORK\n")
185{
Harald Weltedcccb182010-05-16 20:52:23 +0200186 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000187 net_dump_vty(vty, net);
188
189 return CMD_SUCCESS;
190}
191
192static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l)
193{
Harald Welteedb37782009-05-01 14:59:07 +0000194 struct e1inp_line *line;
195
196 if (!e1l) {
197 vty_out(vty, " None%s", VTY_NEWLINE);
198 return;
199 }
200
201 line = e1l->ts->line;
202
203 vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s",
204 line->num, line->driver->name, e1l->ts->num,
Harald Welte1bc77352009-03-10 19:47:51 +0000205 e1inp_signtype_name(e1l->type), VTY_NEWLINE);
Harald Welteedb37782009-05-01 14:59:07 +0000206 vty_out(vty, " E1 TEI %u, SAPI %u%s",
Harald Welte68628e82009-03-10 12:17:57 +0000207 e1l->tei, e1l->sapi, VTY_NEWLINE);
208}
209
210static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
211{
Harald Welteb908cb72009-12-22 13:09:29 +0100212 struct pchan_load pl;
213
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200214 vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
Harald Weltefcd24452009-06-20 18:15:19 +0200215 "BSIC %u, TSC %u and %u TRX%s",
216 bts->nr, btstype2str(bts->type), gsm_band_name(bts->band),
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200217 bts->cell_identity,
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +0200218 bts->location_area_code, bts->bsic, bts->tsc,
Harald Weltefcd24452009-06-20 18:15:19 +0200219 bts->num_trx, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200220 vty_out(vty, "Description: %s%s",
221 bts->description ? bts->description : "(null)", VTY_NEWLINE);
Harald Welte1d8dbc42009-12-12 15:38:16 +0100222 vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100223 vty_out(vty, "Minimum Rx Level for Access: %i dBm%s",
Harald Welte1d8dbc42009-12-12 15:38:16 +0100224 rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min),
225 VTY_NEWLINE);
226 vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s",
Harald Welte73225282009-12-12 18:17:25 +0100227 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100228 vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer,
229 VTY_NEWLINE);
230 vty_out(vty, "RACH Max transmissions: %u%s",
231 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
232 VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100233 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200234 vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE);
Harald Welte9fbff4a2010-07-30 11:50:09 +0200235 vty_out(vty, "System Information present: 0x%08x, static: 0x%08x%s",
236 bts->si_valid, bts->si_mode_static, VTY_NEWLINE);
Harald Welte4cc34222009-05-01 15:12:31 +0000237 if (is_ipaccess_bts(bts))
Harald Welte8175e952009-10-20 00:22:00 +0200238 vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
Harald Welte4cc34222009-05-01 15:12:31 +0000239 bts->ip_access.site_id, bts->ip_access.bts_id,
Harald Welte8175e952009-10-20 00:22:00 +0200240 bts->oml_tei, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000241 vty_out(vty, " NM State: ");
242 net_dump_nmstate(vty, &bts->nm_state);
243 vty_out(vty, " Site Mgr NM State: ");
244 net_dump_nmstate(vty, &bts->site_mgr.nm_state);
245 vty_out(vty, " Paging: FIXME pending requests, %u free slots%s",
246 bts->paging.available_slots, VTY_NEWLINE);
Holger Hans Peter Freytherd283db42010-11-25 16:28:45 +0100247 if (is_ipaccess_bts(bts)) {
248 vty_out(vty, " OML Link state: %s.%s",
249 bts->oml_link ? "connected" : "disconnected", VTY_NEWLINE);
250 } else {
Harald Welte8175e952009-10-20 00:22:00 +0200251 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
252 e1isl_dump_vty(vty, bts->oml_link);
253 }
Holger Hans Peter Freytherd283db42010-11-25 16:28:45 +0100254
255 /* FIXME: chan_desc */
Harald Welteb908cb72009-12-22 13:09:29 +0100256 memset(&pl, 0, sizeof(pl));
257 bts_chan_load(&pl, bts);
258 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
259 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000260}
261
262DEFUN(show_bts, show_bts_cmd, "show bts [number]",
263 SHOW_STR "Display information about a BTS\n"
264 "BTS number")
265{
Harald Weltedcccb182010-05-16 20:52:23 +0200266 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000267 int bts_nr;
268
269 if (argc != 0) {
270 /* use the BTS number that the user has specified */
271 bts_nr = atoi(argv[0]);
272 if (bts_nr > net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000273 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000274 VTY_NEWLINE);
275 return CMD_WARNING;
276 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200277 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000278 return CMD_SUCCESS;
279 }
280 /* print all BTS's */
281 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee441d9c2009-06-21 16:17:15 +0200282 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000283
284 return CMD_SUCCESS;
285}
286
Harald Welte42581822009-08-08 16:12:58 +0200287/* utility functions */
288static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
289 const char *ts, const char *ss)
290{
291 e1_link->e1_nr = atoi(line);
292 e1_link->e1_ts = atoi(ts);
293 if (!strcmp(ss, "full"))
294 e1_link->e1_ts_ss = 255;
295 else
296 e1_link->e1_ts_ss = atoi(ss);
297}
298
299static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,
300 const char *prefix)
301{
302 if (!e1_link->e1_ts)
303 return;
304
305 if (e1_link->e1_ts_ss == 255)
306 vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s",
307 prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE);
308 else
309 vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s",
310 prefix, e1_link->e1_nr, e1_link->e1_ts,
311 e1_link->e1_ts_ss, VTY_NEWLINE);
312}
313
314
Harald Welte67ce0732009-08-06 19:06:46 +0200315static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
316{
Harald Welte42581822009-08-08 16:12:58 +0200317 vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
318 if (ts->pchan != GSM_PCHAN_NONE)
319 vty_out(vty, " phys_chan_config %s%s",
320 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200321 vty_out(vty, " hopping enabled %u%s",
322 ts->hopping.enabled, VTY_NEWLINE);
323 if (ts->hopping.enabled) {
324 unsigned int i;
325 vty_out(vty, " hopping sequence-number %u%s",
Harald Welte6e0cd042009-09-12 13:05:33 +0200326 ts->hopping.hsn, VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200327 vty_out(vty, " hopping maio %u%s",
Harald Welte6e0cd042009-09-12 13:05:33 +0200328 ts->hopping.maio, VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200329 for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) {
330 if (!bitvec_get_bit_pos(&ts->hopping.arfcns, i))
331 continue;
332 vty_out(vty, " hopping arfcn add %u%s",
333 i, VTY_NEWLINE);
334 }
335 } else
Harald Welte42581822009-08-08 16:12:58 +0200336 config_write_e1_link(vty, &ts->e1_link, " ");
Harald Welte67ce0732009-08-06 19:06:46 +0200337}
338
339static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
340{
341 int i;
342
Harald Welte5013b2a2009-08-07 13:29:14 +0200343 vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200344 if (trx->description)
345 vty_out(vty, " description %s%s", trx->description,
346 VTY_NEWLINE);
Holger Hans Peter Freyther2ba40af2010-04-17 06:42:07 +0200347 vty_out(vty, " rf_locked %u%s",
348 trx->nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
349 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200350 vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
Harald Welte (local)7b37d972009-12-27 20:56:38 +0100351 vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200352 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200353 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
354 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte67ce0732009-08-06 19:06:46 +0200355
356 for (i = 0; i < TRX_NR_TS; i++)
357 config_write_ts_single(vty, &trx->ts[i]);
358}
359
Harald Welte615e9562010-05-11 23:50:21 +0200360static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
361{
362 unsigned int i;
363 vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode),
364 VTY_NEWLINE);
365 if (bts->gprs.mode == BTS_GPRS_NONE)
366 return;
367
368 vty_out(vty, " gprs routing area %u%s", bts->gprs.rac,
369 VTY_NEWLINE);
370 vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
371 VTY_NEWLINE);
372 for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++)
373 vty_out(vty, " gprs cell timer %s %u%s",
374 get_value_string(gprs_bssgp_cfg_strs, i),
375 bts->gprs.cell.timer[i], VTY_NEWLINE);
376 vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei,
377 VTY_NEWLINE);
378 for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++)
379 vty_out(vty, " gprs ns timer %s %u%s",
380 get_value_string(gprs_ns_timer_strs, i),
381 bts->gprs.nse.timer[i], VTY_NEWLINE);
382 for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
383 struct gsm_bts_gprs_nsvc *nsvc =
384 &bts->gprs.nsvc[i];
385 struct in_addr ia;
386
387 ia.s_addr = htonl(nsvc->remote_ip);
388 vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
389 nsvc->nsvci, VTY_NEWLINE);
390 vty_out(vty, " gprs nsvc %u local udp port %u%s", i,
391 nsvc->local_port, VTY_NEWLINE);
392 vty_out(vty, " gprs nsvc %u remote udp port %u%s", i,
393 nsvc->remote_port, VTY_NEWLINE);
394 vty_out(vty, " gprs nsvc %u remote ip %s%s", i,
395 inet_ntoa(ia), VTY_NEWLINE);
396 }
397}
398
Harald Welte67ce0732009-08-06 19:06:46 +0200399static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
400{
401 struct gsm_bts_trx *trx;
Harald Welte9fbff4a2010-07-30 11:50:09 +0200402 int i;
Harald Welte67ce0732009-08-06 19:06:46 +0200403
Harald Welte5013b2a2009-08-07 13:29:14 +0200404 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
405 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200406 if (bts->description)
407 vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200408 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freytherf926ed62009-11-19 16:38:49 +0100409 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200410 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte67ce0732009-08-06 19:06:46 +0200411 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200412 vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE);
413 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)0e451d02009-08-13 10:14:26 +0200414 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100415 vty_out(vty, " cell reselection hysteresis %u%s",
416 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
417 vty_out(vty, " rxlev access min %u%s",
418 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Sylvain Munaute0b06b02010-11-28 18:17:28 +0100419
420 if (bts->si_common.cell_ro_sel_par.present) {
421 struct gsm48_si_selection_params *sp;
422 sp = &bts->si_common.cell_ro_sel_par;
423
424 if (sp->cbq)
425 vty_out(vty, " cell bar qualify %u%s",
426 sp->cbq, VTY_NEWLINE);
427
428 if (sp->cell_resel_off)
429 vty_out(vty, " cell reselection offset %u%s",
430 sp->cell_resel_off*2, VTY_NEWLINE);
431
432 if (sp->temp_offs == 7)
433 vty_out(vty, " temporary offset infinite%s",
434 VTY_NEWLINE);
435 else if (sp->temp_offs)
436 vty_out(vty, " temporary offset %u%s",
437 sp->temp_offs*10, VTY_NEWLINE);
438
439 if (sp->penalty_time == 31)
440 vty_out(vty, " penalty time reserved%s",
441 VTY_NEWLINE);
442 else if (sp->penalty_time)
443 vty_out(vty, " penalty time %u%s",
444 (sp->penalty_time*20)+20, VTY_NEWLINE);
445 }
446
Harald Weltea43f7892009-12-01 18:04:30 +0530447 if (bts->si_common.chan_desc.t3212)
Harald Welte (local)efc92312009-08-14 23:09:25 +0200448 vty_out(vty, " periodic location update %u%s",
Dieter Spaard6613e02010-10-05 21:10:55 +0200449 bts->si_common.chan_desc.t3212 * 6, VTY_NEWLINE);
Harald Welte7a8fa412009-08-10 13:48:16 +0200450 vty_out(vty, " channel allocator %s%s",
451 bts->chan_alloc_reverse ? "descending" : "ascending",
452 VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100453 vty_out(vty, " rach tx integer %u%s",
454 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
455 vty_out(vty, " rach max transmission %u%s",
456 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
457 VTY_NEWLINE);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +0800458
459 if (bts->rach_b_thresh != -1)
460 vty_out(vty, " rach nm busy threshold %u%s",
461 bts->rach_b_thresh, VTY_NEWLINE);
462 if (bts->rach_ldavg_slots != -1)
463 vty_out(vty, " rach nm load average %u%s",
464 bts->rach_ldavg_slots, VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100465 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200466 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +0800467 if ((bts->si_common.rach_control.t2 & 0x4) == 0)
468 vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE);
Harald Welte9fbff4a2010-07-30 11:50:09 +0200469 for (i = SYSINFO_TYPE_1; i < _MAX_SYSINFO_TYPE; i++) {
470 if (bts->si_mode_static & (1 << i)) {
471 vty_out(vty, " system-information %s mode static%s",
472 get_value_string(osmo_sitype_strs, i), VTY_NEWLINE);
473 vty_out(vty, " system-information %s static %s%s",
474 get_value_string(osmo_sitype_strs, i),
475 hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])),
476 VTY_NEWLINE);
477 }
478 }
Harald Welte8175e952009-10-20 00:22:00 +0200479 if (is_ipaccess_bts(bts)) {
Harald Welte5013b2a2009-08-07 13:29:14 +0200480 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Weltea6fd58e2009-08-07 00:25:23 +0200481 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200482 vty_out(vty, " oml ip.access stream_id %u%s", bts->oml_tei, VTY_NEWLINE);
483 } else {
Harald Welte42581822009-08-08 16:12:58 +0200484 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
485 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
486 }
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +0800487
488 /* if we have a limit, write it */
489 if (bts->paging.free_chans_need >= 0)
490 vty_out(vty, " paging free %d%s", bts->paging.free_chans_need, VTY_NEWLINE);
491
Harald Welte615e9562010-05-11 23:50:21 +0200492 config_write_bts_gprs(vty, bts);
Harald Welte67ce0732009-08-06 19:06:46 +0200493
494 llist_for_each_entry(trx, &bts->trx_list, list)
495 config_write_trx_single(vty, trx);
496}
497
498static int config_write_bts(struct vty *v)
499{
Harald Weltedcccb182010-05-16 20:52:23 +0200500 struct gsm_network *gsmnet = gsmnet_from_vty(v);
Harald Welte67ce0732009-08-06 19:06:46 +0200501 struct gsm_bts *bts;
502
503 llist_for_each_entry(bts, &gsmnet->bts_list, list)
504 config_write_bts_single(v, bts);
505
506 return CMD_SUCCESS;
507}
508
Harald Welte5013b2a2009-08-07 13:29:14 +0200509static int config_write_net(struct vty *vty)
510{
Harald Weltedcccb182010-05-16 20:52:23 +0200511 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
512
Harald Welte5013b2a2009-08-07 13:29:14 +0200513 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200514 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200515 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200516 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
517 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200518 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100519 vty_out(vty, " location updating reject cause %u%s",
520 gsmnet->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900521 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freytherd54c3372009-11-19 16:37:48 +0100522 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +0800523 vty_out(vty, " paging any use tch %d%s", gsmnet->pag_any_tch, VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100524 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
525 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100526 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100527 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Welteb720bd32009-12-21 16:51:50 +0100528 vty_out(vty, " handover window rxlev averaging %u%s",
529 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
530 vty_out(vty, " handover window rxqual averaging %u%s",
531 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
532 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
533 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
534 vty_out(vty, " handover power budget interval %u%s",
535 gsmnet->handover.pwr_interval, VTY_NEWLINE);
536 vty_out(vty, " handover power budget hysteresis %u%s",
537 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
538 vty_out(vty, " handover maximum distance %u%s",
539 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +0100540 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100541 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
542 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
543 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
544 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
545 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
546 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
547 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
548 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
549 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
Harald Welte2862dca2010-12-23 14:39:29 +0100550 vty_out(vty, " timer t3122 %u%s", gsmnet->T3122, VTY_NEWLINE);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100551 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Harald Welte63dbfc62010-12-15 15:34:23 +0100552 vty_out(vty, " dtx-used %u%s", gsmnet->dtx_enabled, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200553
554 return CMD_SUCCESS;
555}
Harald Welte67ce0732009-08-06 19:06:46 +0200556
Harald Welte68628e82009-03-10 12:17:57 +0000557static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
558{
559 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
560 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200561 vty_out(vty, "Description: %s%s",
562 trx->description ? trx->description : "(null)", VTY_NEWLINE);
Harald Weltefcd24452009-06-20 18:15:19 +0200563 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte42581822009-08-08 16:12:58 +0200564 "resulting BS power: %d dBm%s",
Harald Weltefcd24452009-06-20 18:15:19 +0200565 trx->nominal_power, trx->max_power_red,
Harald Welte42581822009-08-08 16:12:58 +0200566 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000567 vty_out(vty, " NM State: ");
568 net_dump_nmstate(vty, &trx->nm_state);
569 vty_out(vty, " Baseband Transceiver NM State: ");
570 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte8175e952009-10-20 00:22:00 +0200571 if (is_ipaccess_bts(trx->bts)) {
572 vty_out(vty, " ip.access stream ID: 0x%02x%s",
573 trx->rsl_tei, VTY_NEWLINE);
574 } else {
575 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
576 e1isl_dump_vty(vty, trx->rsl_link);
577 }
Harald Welte68628e82009-03-10 12:17:57 +0000578}
579
580DEFUN(show_trx,
581 show_trx_cmd,
582 "show trx [bts_nr] [trx_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200583 SHOW_STR "Display information about a TRX\n"
584 "BTS Number\n"
585 "TRX Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000586{
Harald Weltedcccb182010-05-16 20:52:23 +0200587 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000588 struct gsm_bts *bts = NULL;
589 struct gsm_bts_trx *trx;
590 int bts_nr, trx_nr;
591
592 if (argc >= 1) {
593 /* use the BTS number that the user has specified */
594 bts_nr = atoi(argv[0]);
595 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000596 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000597 VTY_NEWLINE);
598 return CMD_WARNING;
599 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200600 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000601 }
602 if (argc >= 2) {
603 trx_nr = atoi(argv[1]);
604 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000605 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000606 VTY_NEWLINE);
607 return CMD_WARNING;
608 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200609 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000610 trx_dump_vty(vty, trx);
611 return CMD_SUCCESS;
612 }
613 if (bts) {
614 /* print all TRX in this BTS */
615 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200616 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000617 trx_dump_vty(vty, trx);
618 }
619 return CMD_SUCCESS;
620 }
621
622 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200623 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000624 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200625 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000626 trx_dump_vty(vty, trx);
627 }
628 }
629
630 return CMD_SUCCESS;
631}
632
Harald Welte67ce0732009-08-06 19:06:46 +0200633
Harald Welte68628e82009-03-10 12:17:57 +0000634static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
635{
Harald Welte68628e82009-03-10 12:17:57 +0000636 vty_out(vty, "Timeslot %u of TRX %u in BTS %u, phys cfg %s%s",
637 ts->nr, ts->trx->nr, ts->trx->bts->nr,
638 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
639 vty_out(vty, " NM State: ");
640 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte2c828992009-12-02 01:56:49 +0530641 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welteef235b52009-03-10 12:34:02 +0000642 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
643 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
644 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000645}
646
647DEFUN(show_ts,
648 show_ts_cmd,
Harald Welte1bc77352009-03-10 19:47:51 +0000649 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200650 SHOW_STR "Display information about a TS\n"
651 "BTS Number\n" "TRX Number\n" "Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000652{
Harald Weltedcccb182010-05-16 20:52:23 +0200653 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000654 struct gsm_bts *bts;
655 struct gsm_bts_trx *trx;
656 struct gsm_bts_trx_ts *ts;
657 int bts_nr, trx_nr, ts_nr;
658
659 if (argc >= 1) {
660 /* use the BTS number that the user has specified */
661 bts_nr = atoi(argv[0]);
662 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000663 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000664 VTY_NEWLINE);
665 return CMD_WARNING;
666 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200667 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000668 }
669 if (argc >= 2) {
670 trx_nr = atoi(argv[1]);
671 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000672 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000673 VTY_NEWLINE);
674 return CMD_WARNING;
675 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200676 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000677 }
678 if (argc >= 3) {
679 ts_nr = atoi(argv[2]);
680 if (ts_nr >= TRX_NR_TS) {
Harald Welte1bc77352009-03-10 19:47:51 +0000681 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
Harald Welte68628e82009-03-10 12:17:57 +0000682 VTY_NEWLINE);
683 return CMD_WARNING;
684 }
685 ts = &trx->ts[ts_nr];
686 ts_dump_vty(vty, ts);
687 return CMD_SUCCESS;
688 }
689 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200690 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000691 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200692 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000693 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
694 ts = &trx->ts[ts_nr];
695 ts_dump_vty(vty, ts);
696 }
697 }
698 }
699
700 return CMD_SUCCESS;
701}
702
Holger Hans Peter Freyther424c4f02010-01-06 06:00:40 +0100703static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte68628e82009-03-10 12:17:57 +0000704{
Harald Weltefcd24452009-06-20 18:15:19 +0200705 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte40f82892009-05-23 17:31:39 +0000706 subscr->authorized, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000707 if (subscr->name)
Harald Welte1bc77352009-03-10 19:47:51 +0000708 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000709 if (subscr->extension)
710 vty_out(vty, " Extension: %s%s", subscr->extension,
711 VTY_NEWLINE);
712 if (subscr->imsi)
713 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freyther22230252009-08-19 12:53:57 +0200714 if (subscr->tmsi != GSM_RESERVED_TMSI)
715 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte731fd912009-08-15 03:24:51 +0200716 VTY_NEWLINE);
Sylvain Munautaf292642009-12-27 19:29:28 +0100717
Harald Welte (local)15920de2009-08-14 20:27:16 +0200718 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000719}
720
Harald Welte8387a492009-12-22 21:43:14 +0100721static void meas_rep_dump_uni_vty(struct vty *vty,
722 struct gsm_meas_rep_unidir *mru,
723 const char *prefix,
724 const char *dir)
725{
726 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
727 prefix, dir, rxlev2dbm(mru->full.rx_lev),
728 dir, rxlev2dbm(mru->sub.rx_lev));
729 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
730 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
731 VTY_NEWLINE);
732}
733
734static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
735 const char *prefix)
736{
737 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
738 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
739 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
740 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
741 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
742 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
743 VTY_NEWLINE);
744 if (mr->flags & MEAS_REP_F_MS_TO)
745 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
746 mr->ms_timing_offset, VTY_NEWLINE);
747 if (mr->flags & MEAS_REP_F_MS_L1)
748 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
749 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
750 if (mr->flags & MEAS_REP_F_DL_VALID)
751 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
752 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
753}
754
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800755static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
Harald Welte68628e82009-03-10 12:17:57 +0000756{
Harald Welte8387a492009-12-22 21:43:14 +0100757 int idx;
758
Harald Welte68628e82009-03-10 12:17:57 +0000759 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 +0200760 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
Harald Welte (local)ccd88452009-12-27 18:05:25 +0100761 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Harald Welte68628e82009-03-10 12:17:57 +0000762 VTY_NEWLINE);
Holger Hans Peter Freyther40494552010-06-28 17:09:29 +0800763 vty_out(vty, " Connection: %u, State: %s%s",
764 lchan->conn ? 1: 0,
Harald Welte1887f9d2009-12-29 10:52:38 +0100765 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100766 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
767 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
768 - lchan->bs_power*2,
769 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
770 VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800771 if (lchan->conn && lchan->conn->subscr) {
Harald Welte68628e82009-03-10 12:17:57 +0000772 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800773 subscr_dump_vty(vty, lchan->conn->subscr);
Harald Welte68628e82009-03-10 12:17:57 +0000774 } else
775 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte2c828992009-12-02 01:56:49 +0530776 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
777 struct in_addr ia;
Holger Hans Peter Freyther54fa7992010-04-07 15:39:16 +0200778 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte2c828992009-12-02 01:56:49 +0530779 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
780 inet_ntoa(ia), lchan->abis_ip.bound_port,
781 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
782 VTY_NEWLINE);
783 }
Harald Welte8387a492009-12-22 21:43:14 +0100784
785 /* we want to report the last measurement report */
786 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
787 lchan->meas_rep_idx, 1);
788 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte68628e82009-03-10 12:17:57 +0000789}
790
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800791static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
792{
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800793 struct gsm_meas_rep *mr;
794 int idx;
795
796 /* we want to report the last measurement report */
797 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
798 lchan->meas_rep_idx, 1);
799 mr = &lchan->meas_rep[idx];
800
801 vty_out(vty, "Lchan: %u Timeslot: %u TRX: %u BTS: %u Type: %s - L1 MS Power: %u dBm "
802 "RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800803 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
804 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800805 mr->ms_l1.pwr,
806 rxlev2dbm(mr->dl.full.rx_lev),
807 rxlev2dbm(mr->ul.full.rx_lev),
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800808 VTY_NEWLINE);
809}
810
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800811static int lchan_summary(struct vty *vty, int argc, const char **argv,
812 void (*dump_cb)(struct vty *, struct gsm_lchan *))
Harald Welte68628e82009-03-10 12:17:57 +0000813{
Harald Weltedcccb182010-05-16 20:52:23 +0200814 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000815 struct gsm_bts *bts;
816 struct gsm_bts_trx *trx;
817 struct gsm_bts_trx_ts *ts;
818 struct gsm_lchan *lchan;
819 int bts_nr, trx_nr, ts_nr, lchan_nr;
820
821 if (argc >= 1) {
822 /* use the BTS number that the user has specified */
823 bts_nr = atoi(argv[0]);
824 if (bts_nr >= net->num_bts) {
825 vty_out(vty, "%% can't find BTS %s%s", argv[0],
826 VTY_NEWLINE);
827 return CMD_WARNING;
828 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200829 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000830 }
831 if (argc >= 2) {
832 trx_nr = atoi(argv[1]);
833 if (trx_nr >= bts->num_trx) {
834 vty_out(vty, "%% can't find TRX %s%s", argv[1],
835 VTY_NEWLINE);
836 return CMD_WARNING;
837 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200838 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000839 }
840 if (argc >= 3) {
841 ts_nr = atoi(argv[2]);
842 if (ts_nr >= TRX_NR_TS) {
843 vty_out(vty, "%% can't find TS %s%s", argv[2],
844 VTY_NEWLINE);
845 return CMD_WARNING;
846 }
847 ts = &trx->ts[ts_nr];
848 }
849 if (argc >= 4) {
850 lchan_nr = atoi(argv[3]);
851 if (lchan_nr >= TS_MAX_LCHAN) {
852 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
853 VTY_NEWLINE);
854 return CMD_WARNING;
855 }
856 lchan = &ts->lchan[lchan_nr];
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800857 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000858 return CMD_SUCCESS;
859 }
860 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200861 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000862 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200863 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000864 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
865 ts = &trx->ts[ts_nr];
866 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
867 lchan_nr++) {
868 lchan = &ts->lchan[lchan_nr];
Harald Welteef235b52009-03-10 12:34:02 +0000869 if (lchan->type == GSM_LCHAN_NONE)
870 continue;
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800871 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000872 }
873 }
874 }
875 }
876
877 return CMD_SUCCESS;
878}
879
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800880
881DEFUN(show_lchan,
882 show_lchan_cmd,
883 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
884 SHOW_STR "Display information about a logical channel\n"
885 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
886 "Logical Channel Number\n")
887
888{
889 return lchan_summary(vty, argc, argv, lchan_dump_full_vty);
890}
891
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800892DEFUN(show_lchan_summary,
893 show_lchan_summary_cmd,
894 "show lchan summary [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
895 SHOW_STR "Display information about a logical channel\n"
896 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
897 "Logical Channel Number\n")
898{
899 return lchan_summary(vty, argc, argv, lchan_dump_short_vty);
900}
901
Harald Welte1bc77352009-03-10 19:47:51 +0000902static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
903{
904 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
905}
906
907DEFUN(show_e1drv,
908 show_e1drv_cmd,
909 "show e1_driver",
910 SHOW_STR "Display information about available E1 drivers\n")
911{
912 struct e1inp_driver *drv;
913
914 llist_for_each_entry(drv, &e1inp_driver_list, list)
915 e1drv_dump_vty(vty, drv);
916
917 return CMD_SUCCESS;
918}
919
Harald Welte68628e82009-03-10 12:17:57 +0000920static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
921{
922 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
923 line->num, line->name ? line->name : "",
924 line->driver->name, VTY_NEWLINE);
925}
926
927DEFUN(show_e1line,
928 show_e1line_cmd,
929 "show e1_line [line_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200930 SHOW_STR "Display information about a E1 line\n"
931 "E1 Line Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000932{
Harald Welte1bc77352009-03-10 19:47:51 +0000933 struct e1inp_line *line;
934
935 if (argc >= 1) {
936 int num = atoi(argv[0]);
937 llist_for_each_entry(line, &e1inp_line_list, list) {
938 if (line->num == num) {
939 e1line_dump_vty(vty, line);
940 return CMD_SUCCESS;
941 }
942 }
943 return CMD_WARNING;
944 }
945
946 llist_for_each_entry(line, &e1inp_line_list, list)
947 e1line_dump_vty(vty, line);
948
949 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000950}
951
952static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
953{
Harald Welte42581822009-08-08 16:12:58 +0200954 if (ts->type == E1INP_TS_TYPE_NONE)
955 return;
Harald Welte1bc77352009-03-10 19:47:51 +0000956 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
957 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
958 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000959}
960
961DEFUN(show_e1ts,
962 show_e1ts_cmd,
963 "show e1_timeslot [line_nr] [ts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200964 SHOW_STR "Display information about a E1 timeslot\n"
965 "E1 Line Number\n" "E1 Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000966{
Harald Welte986c3d72009-11-17 06:12:16 +0100967 struct e1inp_line *line = NULL;
Harald Welte1bc77352009-03-10 19:47:51 +0000968 struct e1inp_ts *ts;
969 int ts_nr;
Harald Welte68628e82009-03-10 12:17:57 +0000970
Harald Welte1bc77352009-03-10 19:47:51 +0000971 if (argc == 0) {
972 llist_for_each_entry(line, &e1inp_line_list, list) {
973 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
974 ts = &line->ts[ts_nr];
975 e1ts_dump_vty(vty, ts);
976 }
977 }
978 return CMD_SUCCESS;
979 }
980 if (argc >= 1) {
981 int num = atoi(argv[0]);
982 llist_for_each_entry(line, &e1inp_line_list, list) {
983 if (line->num == num)
984 break;
985 }
986 if (!line || line->num != num) {
987 vty_out(vty, "E1 line %s is invalid%s",
988 argv[0], VTY_NEWLINE);
989 return CMD_WARNING;
990 }
991 }
992 if (argc >= 2) {
993 ts_nr = atoi(argv[1]);
994 if (ts_nr > NUM_E1_TS) {
995 vty_out(vty, "E1 timeslot %s is invalid%s",
996 argv[1], VTY_NEWLINE);
997 return CMD_WARNING;
998 }
999 ts = &line->ts[ts_nr];
1000 e1ts_dump_vty(vty, ts);
1001 return CMD_SUCCESS;
1002 } else {
1003 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
1004 ts = &line->ts[ts_nr];
1005 e1ts_dump_vty(vty, ts);
1006 }
1007 return CMD_SUCCESS;
1008 }
1009 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +00001010}
1011
Harald Weltebe4b7302009-05-23 16:59:33 +00001012static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
Harald Weltef5025b62009-03-28 16:55:11 +00001013{
1014 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
1015 subscr_dump_vty(vty, pag->subscr);
1016}
1017
Harald Weltebe4b7302009-05-23 16:59:33 +00001018static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
Harald Weltef5025b62009-03-28 16:55:11 +00001019{
1020 struct gsm_paging_request *pag;
1021
1022 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
1023 paging_dump_vty(vty, pag);
1024}
1025
1026DEFUN(show_paging,
1027 show_paging_cmd,
1028 "show paging [bts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +02001029 SHOW_STR "Display information about paging reuqests of a BTS\n"
1030 "BTS Number\n")
Harald Weltef5025b62009-03-28 16:55:11 +00001031{
Harald Weltedcccb182010-05-16 20:52:23 +02001032 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Weltef5025b62009-03-28 16:55:11 +00001033 struct gsm_bts *bts;
1034 int bts_nr;
1035
1036 if (argc >= 1) {
1037 /* use the BTS number that the user has specified */
1038 bts_nr = atoi(argv[0]);
1039 if (bts_nr >= net->num_bts) {
1040 vty_out(vty, "%% can't find BTS %s%s", argv[0],
1041 VTY_NEWLINE);
1042 return CMD_WARNING;
1043 }
Harald Weltee441d9c2009-06-21 16:17:15 +02001044 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001045 bts_paging_dump_vty(vty, bts);
1046
1047 return CMD_SUCCESS;
1048 }
1049 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +02001050 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001051 bts_paging_dump_vty(vty, bts);
1052 }
1053
1054 return CMD_SUCCESS;
1055}
1056
Harald Welte8f0ed552010-05-11 21:53:49 +02001057#define NETWORK_STR "Configure the GSM network\n"
1058
Harald Welte5013b2a2009-08-07 13:29:14 +02001059DEFUN(cfg_net,
1060 cfg_net_cmd,
Harald Welte8f0ed552010-05-11 21:53:49 +02001061 "network", NETWORK_STR)
Harald Welte5013b2a2009-08-07 13:29:14 +02001062{
Harald Weltedcccb182010-05-16 20:52:23 +02001063 vty->index = gsmnet_from_vty(vty);
Harald Welte5013b2a2009-08-07 13:29:14 +02001064 vty->node = GSMNET_NODE;
1065
1066 return CMD_SUCCESS;
1067}
1068
1069
1070DEFUN(cfg_net_ncc,
1071 cfg_net_ncc_cmd,
1072 "network country code <1-999>",
1073 "Set the GSM network country code")
1074{
Harald Weltedcccb182010-05-16 20:52:23 +02001075 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1076
Harald Welte5013b2a2009-08-07 13:29:14 +02001077 gsmnet->country_code = atoi(argv[0]);
1078
1079 return CMD_SUCCESS;
1080}
1081
1082DEFUN(cfg_net_mnc,
1083 cfg_net_mnc_cmd,
1084 "mobile network code <1-999>",
1085 "Set the GSM mobile network code")
1086{
Harald Weltedcccb182010-05-16 20:52:23 +02001087 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1088
Harald Welte5013b2a2009-08-07 13:29:14 +02001089 gsmnet->network_code = atoi(argv[0]);
1090
1091 return CMD_SUCCESS;
1092}
1093
1094DEFUN(cfg_net_name_short,
1095 cfg_net_name_short_cmd,
1096 "short name NAME",
1097 "Set the short GSM network name")
1098{
Harald Weltedcccb182010-05-16 20:52:23 +02001099 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1100
Holger Hans Peter Freyther3e9a7f82010-10-12 23:21:54 +02001101 bsc_replace_string(gsmnet, &gsmnet->name_short, argv[0]);
Harald Welte5013b2a2009-08-07 13:29:14 +02001102 return CMD_SUCCESS;
1103}
1104
1105DEFUN(cfg_net_name_long,
1106 cfg_net_name_long_cmd,
1107 "long name NAME",
1108 "Set the long GSM network name")
1109{
Harald Weltedcccb182010-05-16 20:52:23 +02001110 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1111
Holger Hans Peter Freyther3e9a7f82010-10-12 23:21:54 +02001112 bsc_replace_string(gsmnet, &gsmnet->name_long, argv[0]);
Harald Welte5013b2a2009-08-07 13:29:14 +02001113 return CMD_SUCCESS;
1114}
Harald Welte40f82892009-05-23 17:31:39 +00001115
Harald Welte (local)69de3972009-08-12 14:42:23 +02001116DEFUN(cfg_net_auth_policy,
1117 cfg_net_auth_policy_cmd,
1118 "auth policy (closed|accept-all|token)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001119 "Authentication (not cryptographic)\n"
1120 "Set the GSM network authentication policy\n"
1121 "Require the MS to be activated in HLR\n"
1122 "Accept all MS, whether in HLR or not\n"
1123 "Use SMS-token based authentication\n")
Harald Welte (local)69de3972009-08-12 14:42:23 +02001124{
1125 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001126 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte (local)69de3972009-08-12 14:42:23 +02001127
1128 gsmnet->auth_policy = policy;
1129
1130 return CMD_SUCCESS;
1131}
1132
Harald Welte1085c092009-11-18 20:33:19 +01001133DEFUN(cfg_net_reject_cause,
1134 cfg_net_reject_cause_cmd,
1135 "location updating reject cause <2-111>",
1136 "Set the reject cause of location updating reject\n")
1137{
Harald Weltedcccb182010-05-16 20:52:23 +02001138 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1139
Harald Welte1085c092009-11-18 20:33:19 +01001140 gsmnet->reject_cause = atoi(argv[0]);
1141
1142 return CMD_SUCCESS;
1143}
1144
Harald Welte4381cfe2009-08-30 15:47:06 +09001145DEFUN(cfg_net_encryption,
1146 cfg_net_encryption_cmd,
1147 "encryption a5 (0|1|2)",
Harald Welte28326062010-05-14 20:05:17 +02001148 "Encryption options\n"
1149 "A5 encryption\n" "A5/0: No encryption\n"
1150 "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n")
Harald Welte4381cfe2009-08-30 15:47:06 +09001151{
Harald Weltedcccb182010-05-16 20:52:23 +02001152 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1153
Andreas.Eversberg1059deb2009-11-17 09:55:26 +01001154 gsmnet->a5_encryption= atoi(argv[0]);
Harald Welte4381cfe2009-08-30 15:47:06 +09001155
1156 return CMD_SUCCESS;
1157}
1158
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001159DEFUN(cfg_net_neci,
1160 cfg_net_neci_cmd,
1161 "neci (0|1)",
Harald Welte28326062010-05-14 20:05:17 +02001162 "New Establish Cause Indication\n"
1163 "Don't set the NECI bit\n" "Set the NECI bit\n")
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001164{
Harald Weltedcccb182010-05-16 20:52:23 +02001165 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1166
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001167 gsmnet->neci = atoi(argv[0]);
Holger Hans Peter Freyther78891072010-09-06 09:36:02 +08001168 gsm_net_update_ctype(gsmnet);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001169 return CMD_SUCCESS;
1170}
1171
Harald Welteeab84a12009-12-13 10:53:12 +01001172DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1173 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001174 "Radio Resource Location Protocol\n"
1175 "Set the Radio Resource Location Protocol Mode\n"
1176 "Don't send RRLP request\n"
1177 "Request MS-based location\n"
1178 "Request any location, prefer MS-based\n"
1179 "Request any location, prefer MS-assisted\n")
Harald Welteeab84a12009-12-13 10:53:12 +01001180{
Harald Weltedcccb182010-05-16 20:52:23 +02001181 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1182
Harald Welteeab84a12009-12-13 10:53:12 +01001183 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1184
1185 return CMD_SUCCESS;
1186}
1187
Harald Welte648b6ce2009-12-14 09:00:24 +01001188DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1189 "mm info (0|1)",
1190 "Whether to send MM INFO after LOC UPD ACCEPT")
1191{
Harald Weltedcccb182010-05-16 20:52:23 +02001192 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1193
Harald Welte648b6ce2009-12-14 09:00:24 +01001194 gsmnet->send_mm_info = atoi(argv[0]);
1195
1196 return CMD_SUCCESS;
1197}
1198
Harald Welte8f0ed552010-05-11 21:53:49 +02001199#define HANDOVER_STR "Handover Options\n"
1200
Harald Weltebc814502009-12-19 21:41:52 +01001201DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1202 "handover (0|1)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001203 HANDOVER_STR
1204 "Don't perform in-call handover\n"
1205 "Perform in-call handover\n")
Harald Weltebc814502009-12-19 21:41:52 +01001206{
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001207 int enable = atoi(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001208 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001209
1210 if (enable && ipacc_rtp_direct) {
Harald Weltefe03f0d2009-12-20 13:51:01 +01001211 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1212 "is enabled by using the -P command line option%s",
1213 VTY_NEWLINE);
1214 return CMD_WARNING;
1215 }
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001216 gsmnet->handover.active = enable;
Harald Weltebc814502009-12-19 21:41:52 +01001217
1218 return CMD_SUCCESS;
1219}
1220
Harald Welte8f0ed552010-05-11 21:53:49 +02001221#define HO_WIN_STR HANDOVER_STR "Measurement Window\n"
1222#define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n"
1223#define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n"
1224#define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n"
1225
Harald Welteb720bd32009-12-21 16:51:50 +01001226DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1227 "handover window rxlev averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001228 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001229 "How many RxLev measurements are used for averaging")
1230{
Harald Weltedcccb182010-05-16 20:52:23 +02001231 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001232 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1233 return CMD_SUCCESS;
1234}
1235
1236DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1237 "handover window rxqual averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001238 HO_WIN_RXQUAL_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001239 "How many RxQual measurements are used for averaging")
1240{
Harald Weltedcccb182010-05-16 20:52:23 +02001241 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001242 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1243 return CMD_SUCCESS;
1244}
1245
1246DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1247 "handover window rxlev neighbor averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001248 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001249 "How many RxQual measurements are used for averaging")
1250{
Harald Weltedcccb182010-05-16 20:52:23 +02001251 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001252 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1253 return CMD_SUCCESS;
1254}
1255
1256DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1257 "handover power budget interval <1-99>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001258 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001259 "How often to check if we have a better cell (SACCH frames)")
1260{
Harald Weltedcccb182010-05-16 20:52:23 +02001261 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001262 gsmnet->handover.pwr_interval = atoi(argv[0]);
1263 return CMD_SUCCESS;
1264}
1265
1266DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1267 "handover power budget hysteresis <0-999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001268 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001269 "How many dB does a neighbor to be stronger to become a HO candidate")
1270{
Harald Weltedcccb182010-05-16 20:52:23 +02001271 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001272 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1273 return CMD_SUCCESS;
1274}
1275
1276DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1277 "handover maximum distance <0-9999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001278 HANDOVER_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001279 "How big is the maximum timing advance before HO is forced")
1280{
Harald Weltedcccb182010-05-16 20:52:23 +02001281 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001282 gsmnet->handover.max_distance = atoi(argv[0]);
1283 return CMD_SUCCESS;
1284}
Harald Weltebc814502009-12-19 21:41:52 +01001285
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001286DEFUN(cfg_net_pag_any_tch,
1287 cfg_net_pag_any_tch_cmd,
1288 "paging any use tch (0|1)",
1289 "Assign a TCH when receiving a Paging Any request")
1290{
Holger Hans Peter Freytherb0e88b82010-09-06 10:09:19 +08001291 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001292 gsmnet->pag_any_tch = atoi(argv[0]);
1293 gsm_net_update_ctype(gsmnet);
1294 return CMD_SUCCESS;
1295}
1296
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001297#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001298 DEFUN(cfg_net_T##number, \
1299 cfg_net_T##number##_cmd, \
1300 "timer t" #number " <0-65535>", \
Harald Welte8f0ed552010-05-11 21:53:49 +02001301 "Configure GSM Timers\n" \
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001302 doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001303{ \
Harald Weltedcccb182010-05-16 20:52:23 +02001304 struct gsm_network *gsmnet = gsmnet_from_vty(vty); \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001305 int value = atoi(argv[0]); \
1306 \
1307 if (value < 0 || value > 65535) { \
1308 vty_out(vty, "Timer value %s out of range.%s", \
1309 argv[0], VTY_NEWLINE); \
1310 return CMD_WARNING; \
1311 } \
1312 \
1313 gsmnet->T##number = value; \
1314 return CMD_SUCCESS; \
1315}
1316
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001317DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1318DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1319DECLARE_TIMER(3105, "Currently not used.")
1320DECLARE_TIMER(3107, "Currently not used.")
1321DECLARE_TIMER(3109, "Currently not used.")
Holger Hans Peter Freytherf30c0dc2010-05-31 21:33:15 +08001322DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel.")
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001323DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1324DECLARE_TIMER(3115, "Currently not used.")
1325DECLARE_TIMER(3117, "Currently not used.")
1326DECLARE_TIMER(3119, "Currently not used.")
Harald Welte2862dca2010-12-23 14:39:29 +01001327DECLARE_TIMER(3122, "Waiting time (seconds) after IMM ASS REJECT")
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001328DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001329
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08001330DEFUN(cfg_net_dtx,
1331 cfg_net_dtx_cmd,
1332 "dtx-used (0|1)",
1333 "Enable the usage of DTX.\n"
1334 "DTX is enabled/disabled")
1335{
1336 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1337 gsmnet->dtx_enabled = atoi(argv[0]);
1338 return CMD_SUCCESS;
1339}
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001340
Harald Welte5258fc42009-03-28 19:07:53 +00001341/* per-BTS configuration */
1342DEFUN(cfg_bts,
1343 cfg_bts_cmd,
1344 "bts BTS_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02001345 "Select a BTS to configure\n"
1346 "BTS Number\n")
Harald Welte5258fc42009-03-28 19:07:53 +00001347{
Harald Weltedcccb182010-05-16 20:52:23 +02001348 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte5258fc42009-03-28 19:07:53 +00001349 int bts_nr = atoi(argv[0]);
1350 struct gsm_bts *bts;
1351
Harald Weltee441d9c2009-06-21 16:17:15 +02001352 if (bts_nr > gsmnet->num_bts) {
1353 vty_out(vty, "%% The next unused BTS number is %u%s",
1354 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001355 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001356 } else if (bts_nr == gsmnet->num_bts) {
1357 /* allocate a new one */
1358 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1359 HARDCODED_TSC, HARDCODED_BSIC);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001360 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02001361 bts = gsm_bts_num(gsmnet, bts_nr);
1362
Daniel Willmannf15c2762010-01-11 13:43:07 +01001363 if (!bts) {
1364 vty_out(vty, "%% Unable to allocate BTS %u%s",
1365 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee441d9c2009-06-21 16:17:15 +02001366 return CMD_WARNING;
Daniel Willmannf15c2762010-01-11 13:43:07 +01001367 }
Harald Welte5258fc42009-03-28 19:07:53 +00001368
1369 vty->index = bts;
Harald Welte197dea92010-05-14 17:59:53 +02001370 vty->index_sub = &bts->description;
Harald Welte5258fc42009-03-28 19:07:53 +00001371 vty->node = BTS_NODE;
1372
1373 return CMD_SUCCESS;
1374}
1375
1376DEFUN(cfg_bts_type,
1377 cfg_bts_type_cmd,
1378 "type TYPE",
1379 "Set the BTS type\n")
1380{
1381 struct gsm_bts *bts = vty->index;
Harald Welte39315c42010-01-10 18:01:52 +01001382 int rc;
Harald Welte5258fc42009-03-28 19:07:53 +00001383
Harald Welte39315c42010-01-10 18:01:52 +01001384 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1385 if (rc < 0)
1386 return CMD_WARNING;
Harald Welte8175e952009-10-20 00:22:00 +02001387
Harald Welte5258fc42009-03-28 19:07:53 +00001388 return CMD_SUCCESS;
1389}
1390
Harald Weltefcd24452009-06-20 18:15:19 +02001391DEFUN(cfg_bts_band,
1392 cfg_bts_band_cmd,
1393 "band BAND",
1394 "Set the frequency band of this BTS\n")
1395{
1396 struct gsm_bts *bts = vty->index;
Harald Welte42581822009-08-08 16:12:58 +02001397 int band = gsm_band_parse(argv[0]);
Harald Weltefcd24452009-06-20 18:15:19 +02001398
1399 if (band < 0) {
1400 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1401 band, VTY_NEWLINE);
1402 return CMD_WARNING;
1403 }
1404
1405 bts->band = band;
1406
1407 return CMD_SUCCESS;
1408}
1409
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001410DEFUN(cfg_bts_ci,
1411 cfg_bts_ci_cmd,
1412 "cell_identity <0-65535>",
1413 "Set the Cell identity of this BTS\n")
1414{
1415 struct gsm_bts *bts = vty->index;
1416 int ci = atoi(argv[0]);
1417
1418 if (ci < 0 || ci > 0xffff) {
1419 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1420 ci, VTY_NEWLINE);
1421 return CMD_WARNING;
1422 }
1423 bts->cell_identity = ci;
1424
1425 return CMD_SUCCESS;
1426}
1427
Harald Welte5258fc42009-03-28 19:07:53 +00001428DEFUN(cfg_bts_lac,
1429 cfg_bts_lac_cmd,
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001430 "location_area_code <0-65535>",
Harald Welte5258fc42009-03-28 19:07:53 +00001431 "Set the Location Area Code (LAC) of this BTS\n")
1432{
1433 struct gsm_bts *bts = vty->index;
1434 int lac = atoi(argv[0]);
1435
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001436 if (lac < 0 || lac > 0xffff) {
1437 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte5258fc42009-03-28 19:07:53 +00001438 lac, VTY_NEWLINE);
1439 return CMD_WARNING;
1440 }
Holger Hans Peter Freythere48b9562009-10-01 04:07:15 +02001441
1442 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1443 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1444 lac, VTY_NEWLINE);
1445 return CMD_WARNING;
1446 }
1447
Harald Welte5258fc42009-03-28 19:07:53 +00001448 bts->location_area_code = lac;
1449
1450 return CMD_SUCCESS;
1451}
1452
Harald Weltea43f7892009-12-01 18:04:30 +05301453
Harald Welte5258fc42009-03-28 19:07:53 +00001454DEFUN(cfg_bts_tsc,
1455 cfg_bts_tsc_cmd,
1456 "training_sequence_code <0-255>",
1457 "Set the Training Sequence Code (TSC) of this BTS\n")
1458{
1459 struct gsm_bts *bts = vty->index;
1460 int tsc = atoi(argv[0]);
1461
1462 if (tsc < 0 || tsc > 0xff) {
1463 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1464 tsc, VTY_NEWLINE);
1465 return CMD_WARNING;
1466 }
1467 bts->tsc = tsc;
1468
1469 return CMD_SUCCESS;
1470}
1471
Harald Welte78f2f502009-05-23 16:56:52 +00001472DEFUN(cfg_bts_bsic,
1473 cfg_bts_bsic_cmd,
1474 "base_station_id_code <0-63>",
1475 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1476{
1477 struct gsm_bts *bts = vty->index;
1478 int bsic = atoi(argv[0]);
1479
1480 if (bsic < 0 || bsic > 0x3f) {
Harald Welte42581822009-08-08 16:12:58 +02001481 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte78f2f502009-05-23 16:56:52 +00001482 bsic, VTY_NEWLINE);
1483 return CMD_WARNING;
1484 }
1485 bts->bsic = bsic;
1486
1487 return CMD_SUCCESS;
1488}
1489
1490
Harald Welte4cc34222009-05-01 15:12:31 +00001491DEFUN(cfg_bts_unit_id,
1492 cfg_bts_unit_id_cmd,
Harald Welte07dc73d2009-08-07 13:27:09 +02001493 "ip.access unit_id <0-65534> <0-255>",
1494 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte4cc34222009-05-01 15:12:31 +00001495{
1496 struct gsm_bts *bts = vty->index;
1497 int site_id = atoi(argv[0]);
1498 int bts_id = atoi(argv[1]);
1499
Harald Welte07dc73d2009-08-07 13:27:09 +02001500 if (!is_ipaccess_bts(bts)) {
1501 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1502 return CMD_WARNING;
1503 }
1504
Harald Welte4cc34222009-05-01 15:12:31 +00001505 bts->ip_access.site_id = site_id;
1506 bts->ip_access.bts_id = bts_id;
1507
1508 return CMD_SUCCESS;
1509}
1510
Harald Welte8f0ed552010-05-11 21:53:49 +02001511#define OML_STR "Organization & Maintenance Link\n"
1512#define IPA_STR "ip.access Specific Options\n"
1513
Harald Welte8175e952009-10-20 00:22:00 +02001514DEFUN(cfg_bts_stream_id,
1515 cfg_bts_stream_id_cmd,
1516 "oml ip.access stream_id <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001517 OML_STR IPA_STR
Harald Welte8175e952009-10-20 00:22:00 +02001518 "Set the ip.access Stream ID of the OML link of this BTS\n")
1519{
1520 struct gsm_bts *bts = vty->index;
1521 int stream_id = atoi(argv[0]);
1522
1523 if (!is_ipaccess_bts(bts)) {
1524 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1525 return CMD_WARNING;
1526 }
1527
1528 bts->oml_tei = stream_id;
1529
1530 return CMD_SUCCESS;
1531}
1532
Harald Welte8f0ed552010-05-11 21:53:49 +02001533#define OML_E1_STR OML_STR "E1 Line\n"
Harald Welte8175e952009-10-20 00:22:00 +02001534
Harald Welte42581822009-08-08 16:12:58 +02001535DEFUN(cfg_bts_oml_e1,
1536 cfg_bts_oml_e1_cmd,
1537 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001538 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001539 "E1 interface to be used for OML\n")
1540{
1541 struct gsm_bts *bts = vty->index;
1542
1543 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1544
1545 return CMD_SUCCESS;
1546}
1547
1548
1549DEFUN(cfg_bts_oml_e1_tei,
1550 cfg_bts_oml_e1_tei_cmd,
1551 "oml e1 tei <0-63>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001552 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001553 "Set the TEI to be used for OML")
1554{
1555 struct gsm_bts *bts = vty->index;
1556
1557 bts->oml_tei = atoi(argv[0]);
1558
1559 return CMD_SUCCESS;
1560}
1561
Harald Welte7a8fa412009-08-10 13:48:16 +02001562DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1563 "channel allocator (ascending|descending)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001564 "Channnel Allocator\n" "Channel Allocator\n"
1565 "Allocate Timeslots and Transceivers in ascending order\n"
1566 "Allocate Timeslots and Transceivers in descending order\n")
Harald Welte7a8fa412009-08-10 13:48:16 +02001567{
1568 struct gsm_bts *bts = vty->index;
1569
1570 if (!strcmp(argv[0], "ascending"))
1571 bts->chan_alloc_reverse = 0;
1572 else
1573 bts->chan_alloc_reverse = 1;
1574
1575 return CMD_SUCCESS;
1576}
1577
Harald Welte8f0ed552010-05-11 21:53:49 +02001578#define RACH_STR "Random Access Control Channel\n"
1579
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001580DEFUN(cfg_bts_rach_tx_integer,
1581 cfg_bts_rach_tx_integer_cmd,
1582 "rach tx integer <0-15>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001583 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001584 "Set the raw tx integer value in RACH Control parameters IE")
1585{
1586 struct gsm_bts *bts = vty->index;
1587 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1588 return CMD_SUCCESS;
1589}
1590
1591DEFUN(cfg_bts_rach_max_trans,
1592 cfg_bts_rach_max_trans_cmd,
1593 "rach max transmission (1|2|4|7)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001594 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001595 "Set the maximum number of RACH burst transmissions")
1596{
1597 struct gsm_bts *bts = vty->index;
1598 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1599 return CMD_SUCCESS;
1600}
1601
Harald Welte8f0ed552010-05-11 21:53:49 +02001602#define NM_STR "Network Management\n"
1603
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001604DEFUN(cfg_bts_rach_nm_b_thresh,
1605 cfg_bts_rach_nm_b_thresh_cmd,
1606 "rach nm busy threshold <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001607 RACH_STR NM_STR
1608 "Set the NM Busy Threshold in dB")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001609{
1610 struct gsm_bts *bts = vty->index;
1611 bts->rach_b_thresh = atoi(argv[0]);
1612 return CMD_SUCCESS;
1613}
1614
1615DEFUN(cfg_bts_rach_nm_ldavg,
1616 cfg_bts_rach_nm_ldavg_cmd,
1617 "rach nm load average <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001618 RACH_STR NM_STR
1619 "Set the NM Loadaverage Slots value")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001620{
1621 struct gsm_bts *bts = vty->index;
1622 bts->rach_ldavg_slots = atoi(argv[0]);
1623 return CMD_SUCCESS;
1624}
1625
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001626DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1627 "cell barred (0|1)",
1628 "Should this cell be barred from access?")
1629{
1630 struct gsm_bts *bts = vty->index;
1631
Harald Welte71355012009-12-21 23:08:18 +01001632 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001633
1634 return CMD_SUCCESS;
1635}
1636
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08001637DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd,
1638 "rach emergency call allowed (0|1)",
1639 "Should this cell allow emergency calls?")
1640{
1641 struct gsm_bts *bts = vty->index;
1642
1643 if (atoi(argv[0]) == 0)
1644 bts->si_common.rach_control.t2 |= 0x4;
1645 else
1646 bts->si_common.rach_control.t2 &= ~0x4;
1647
1648 return CMD_SUCCESS;
1649}
1650
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001651DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1652 "ms max power <0-40>",
1653 "Maximum transmit power of the MS")
1654{
1655 struct gsm_bts *bts = vty->index;
1656
1657 bts->ms_max_power = atoi(argv[0]);
1658
1659 return CMD_SUCCESS;
1660}
1661
Harald Welte73225282009-12-12 18:17:25 +01001662DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1663 "cell reselection hysteresis <0-14>",
1664 "Cell Re-Selection Hysteresis in dB")
1665{
1666 struct gsm_bts *bts = vty->index;
1667
1668 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1669
1670 return CMD_SUCCESS;
1671}
1672
1673DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1674 "rxlev access min <0-63>",
1675 "Minimum RxLev needed for cell access (better than -110dBm)")
1676{
1677 struct gsm_bts *bts = vty->index;
1678
1679 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1680
1681 return CMD_SUCCESS;
1682}
1683
Sylvain Munaute0b06b02010-11-28 18:17:28 +01001684DEFUN(cfg_bts_cell_bar_qualify, cfg_bts_cell_bar_qualify_cmd,
1685 "cell bar qualify (0|1)",
1686 "Cell Bar Qualify")
1687{
1688 struct gsm_bts *bts = vty->index;
1689
1690 bts->si_common.cell_ro_sel_par.present = 1;
1691 bts->si_common.cell_ro_sel_par.cbq = atoi(argv[0]);
1692
1693 return CMD_SUCCESS;
1694}
1695
1696DEFUN(cfg_bts_cell_resel_ofs, cfg_bts_cell_resel_ofs_cmd,
1697 "cell reselection offset <0-126>",
1698 "Cell Re-Selection Offset in dB")
1699{
1700 struct gsm_bts *bts = vty->index;
1701
1702 bts->si_common.cell_ro_sel_par.present = 1;
1703 bts->si_common.cell_ro_sel_par.cell_resel_off = atoi(argv[0])/2;
1704
1705 return CMD_SUCCESS;
1706}
1707
1708DEFUN(cfg_bts_temp_ofs, cfg_bts_temp_ofs_cmd,
1709 "temporary offset <0-60>",
1710 "Cell selection temporary negative offset in dB")
1711{
1712 struct gsm_bts *bts = vty->index;
1713
1714 bts->si_common.cell_ro_sel_par.present = 1;
1715 bts->si_common.cell_ro_sel_par.temp_offs = atoi(argv[0])/10;
1716
1717 return CMD_SUCCESS;
1718}
1719
1720DEFUN(cfg_bts_temp_ofs_inf, cfg_bts_temp_ofs_inf_cmd,
1721 "temporary offset infinite",
1722 "Sets cell selection temporary negative offset to infinity")
1723{
1724 struct gsm_bts *bts = vty->index;
1725
1726 bts->si_common.cell_ro_sel_par.present = 1;
1727 bts->si_common.cell_ro_sel_par.temp_offs = 7;
1728
1729 return CMD_SUCCESS;
1730}
1731
1732DEFUN(cfg_bts_penalty_time, cfg_bts_penalty_time_cmd,
1733 "penalty time <20-620>",
1734 "Cell selection penalty time in seconds (by 20s increments)")
1735{
1736 struct gsm_bts *bts = vty->index;
1737
1738 bts->si_common.cell_ro_sel_par.present = 1;
1739 bts->si_common.cell_ro_sel_par.penalty_time = (atoi(argv[0])-20)/20;
1740
1741 return CMD_SUCCESS;
1742}
1743
1744DEFUN(cfg_bts_penalty_time_rsvd, cfg_bts_penalty_time_rsvd_cmd,
1745 "penalty time reserved",
1746 "Set cell selection penalty time to reserved value 31\n"
1747 "(indicate that CELL_RESELECT_OFFSET is subtracted from C2 "
1748 "and TEMPORARY_OFFSET is ignored)")
1749{
1750 struct gsm_bts *bts = vty->index;
1751
1752 bts->si_common.cell_ro_sel_par.present = 1;
1753 bts->si_common.cell_ro_sel_par.penalty_time = 31;
1754
1755 return CMD_SUCCESS;
1756}
1757
Harald Welte (local)efc92312009-08-14 23:09:25 +02001758DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1759 "periodic location update <0-1530>",
1760 "Periodic Location Updating Interval in Minutes")
1761{
1762 struct gsm_bts *bts = vty->index;
1763
Dieter Spaard6613e02010-10-05 21:10:55 +02001764 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 6;
Harald Welte (local)efc92312009-08-14 23:09:25 +02001765
1766 return CMD_SUCCESS;
1767}
1768
Harald Welte8f0ed552010-05-11 21:53:49 +02001769#define GPRS_TEXT "GPRS Packet Network\n"
1770
Harald Welteaf387632010-03-14 23:30:30 +08001771DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welte57ba7e32010-04-18 14:00:26 +02001772 "gprs cell bvci <2-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001773 GPRS_TEXT
1774 "GPRS Cell Settings\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001775 "GPRS BSSGP VC Identifier")
1776{
1777 struct gsm_bts *bts = vty->index;
1778
Harald Welte4511d892010-04-18 15:51:20 +02001779 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001780 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1781 return CMD_WARNING;
1782 }
1783
Harald Welte97a282b2010-03-14 15:37:43 +08001784 bts->gprs.cell.bvci = atoi(argv[0]);
1785
1786 return CMD_SUCCESS;
1787}
1788
Harald Weltea5731cf2010-03-22 11:48:36 +08001789DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
1790 "gprs nsei <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001791 GPRS_TEXT
Harald Weltea5731cf2010-03-22 11:48:36 +08001792 "GPRS NS Entity Identifier")
1793{
1794 struct gsm_bts *bts = vty->index;
1795
Harald Welte4511d892010-04-18 15:51:20 +02001796 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltea5731cf2010-03-22 11:48:36 +08001797 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1798 return CMD_WARNING;
1799 }
1800
1801 bts->gprs.nse.nsei = atoi(argv[0]);
1802
1803 return CMD_SUCCESS;
1804}
1805
Harald Welte8f0ed552010-05-11 21:53:49 +02001806#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
1807 "NSVC Logical Number\n"
Harald Weltea5731cf2010-03-22 11:48:36 +08001808
Harald Welte97a282b2010-03-14 15:37:43 +08001809DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
1810 "gprs nsvc <0-1> nsvci <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001811 GPRS_TEXT NSVC_TEXT
1812 "NS Virtual Connection Identifier\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001813 "GPRS NS VC Identifier")
1814{
1815 struct gsm_bts *bts = vty->index;
1816 int idx = atoi(argv[0]);
1817
Harald Welte4511d892010-04-18 15:51:20 +02001818 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001819 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1820 return CMD_WARNING;
1821 }
1822
Harald Welte97a282b2010-03-14 15:37:43 +08001823 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
1824
1825 return CMD_SUCCESS;
1826}
1827
Harald Welteaf387632010-03-14 23:30:30 +08001828DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
1829 "gprs nsvc <0-1> local udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001830 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001831 "GPRS NS Local UDP Port")
1832{
1833 struct gsm_bts *bts = vty->index;
1834 int idx = atoi(argv[0]);
1835
Harald Welte4511d892010-04-18 15:51:20 +02001836 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001837 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1838 return CMD_WARNING;
1839 }
1840
Harald Welteaf387632010-03-14 23:30:30 +08001841 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
1842
1843 return CMD_SUCCESS;
1844}
1845
1846DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
1847 "gprs nsvc <0-1> remote udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001848 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001849 "GPRS NS Remote UDP Port")
1850{
1851 struct gsm_bts *bts = vty->index;
1852 int idx = atoi(argv[0]);
1853
Harald Welte4511d892010-04-18 15:51:20 +02001854 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001855 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1856 return CMD_WARNING;
1857 }
1858
Harald Welteaf387632010-03-14 23:30:30 +08001859 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
1860
1861 return CMD_SUCCESS;
1862}
1863
1864DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
1865 "gprs nsvc <0-1> remote ip A.B.C.D",
Harald Welte8f0ed552010-05-11 21:53:49 +02001866 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001867 "GPRS NS Remote IP Address")
1868{
1869 struct gsm_bts *bts = vty->index;
1870 int idx = atoi(argv[0]);
1871 struct in_addr ia;
1872
Harald Welte4511d892010-04-18 15:51:20 +02001873 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001874 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1875 return CMD_WARNING;
1876 }
1877
Harald Welteaf387632010-03-14 23:30:30 +08001878 inet_aton(argv[1], &ia);
1879 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
1880
1881 return CMD_SUCCESS;
1882}
1883
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08001884DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd,
1885 "paging free FREE_NR",
1886 "Only page when having a certain amount of free slots. -1 to disable")
1887{
1888 struct gsm_bts *bts = vty->index;
1889
1890 bts->paging.free_chans_need = atoi(argv[0]);
1891 return CMD_SUCCESS;
1892}
1893
Harald Welte615e9562010-05-11 23:50:21 +02001894DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd,
1895 "gprs ns timer " NS_TIMERS " <0-255>",
1896 GPRS_TEXT "Network Service\n"
1897 "Network Service Timer\n"
1898 NS_TIMERS_HELP "Timer Value\n")
1899{
1900 struct gsm_bts *bts = vty->index;
1901 int idx = get_string_value(gprs_ns_timer_strs, argv[0]);
1902 int val = atoi(argv[1]);
1903
1904 if (bts->gprs.mode == BTS_GPRS_NONE) {
1905 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1906 return CMD_WARNING;
1907 }
1908
1909 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
1910 return CMD_WARNING;
1911
1912 bts->gprs.nse.timer[idx] = val;
1913
1914 return CMD_SUCCESS;
1915}
1916
1917#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 +02001918#define BSSGP_TIMERS_HELP \
1919 "Tbvc-block timeout\n" \
1920 "Tbvc-block retries\n" \
1921 "Tbvc-unblock retries\n" \
1922 "Tbvcc-reset timeout\n" \
1923 "Tbvc-reset retries\n" \
1924 "Tbvc-suspend timeout\n" \
1925 "Tbvc-suspend retries\n" \
1926 "Tbvc-resume timeout\n" \
1927 "Tbvc-resume retries\n" \
1928 "Tbvc-capa-update timeout\n" \
1929 "Tbvc-capa-update retries\n"
Harald Welte615e9562010-05-11 23:50:21 +02001930
1931DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd,
1932 "gprs cell timer " BSSGP_TIMERS " <0-255>",
1933 GPRS_TEXT "Cell / BSSGP\n"
1934 "Cell/BSSGP Timer\n"
1935 BSSGP_TIMERS_HELP "Timer Value\n")
1936{
1937 struct gsm_bts *bts = vty->index;
1938 int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
1939 int val = atoi(argv[1]);
1940
1941 if (bts->gprs.mode == BTS_GPRS_NONE) {
1942 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1943 return CMD_WARNING;
1944 }
1945
1946 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer))
1947 return CMD_WARNING;
1948
1949 bts->gprs.cell.timer[idx] = val;
1950
1951 return CMD_SUCCESS;
1952}
1953
Harald Welte97a282b2010-03-14 15:37:43 +08001954DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
1955 "gprs routing area <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001956 GPRS_TEXT
Harald Welte97a282b2010-03-14 15:37:43 +08001957 "GPRS Routing Area Code")
1958{
1959 struct gsm_bts *bts = vty->index;
1960
Harald Welte4511d892010-04-18 15:51:20 +02001961 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001962 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1963 return CMD_WARNING;
1964 }
1965
Harald Welte97a282b2010-03-14 15:37:43 +08001966 bts->gprs.rac = atoi(argv[0]);
1967
1968 return CMD_SUCCESS;
1969}
1970
Harald Welte4511d892010-04-18 15:51:20 +02001971DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
1972 "gprs mode (none|gprs|egprs)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001973 GPRS_TEXT
1974 "GPRS Mode for this BTS\n"
1975 "GPRS Disabled on this BTS\n"
1976 "GPRS Enabled on this BTS\n"
1977 "EGPRS (EDGE) Enabled on this BTS\n")
Harald Welteaf387632010-03-14 23:30:30 +08001978{
1979 struct gsm_bts *bts = vty->index;
Harald Weltef3d8e922010-06-14 22:44:42 +02001980 enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0]);
Harald Welteaf387632010-03-14 23:30:30 +08001981
Harald Weltef3d8e922010-06-14 22:44:42 +02001982 if (mode != BTS_GPRS_NONE &&
1983 !gsm_bts_has_feature(bts, BTS_FEAT_GPRS)) {
1984 vty_out(vty, "This BTS type does not support %s%s", argv[0],
1985 VTY_NEWLINE);
1986 return CMD_WARNING;
1987 }
1988 if (mode == BTS_GPRS_EGPRS &&
1989 !gsm_bts_has_feature(bts, BTS_FEAT_EGPRS)) {
1990 vty_out(vty, "This BTS type does not support %s%s", argv[0],
1991 VTY_NEWLINE);
1992 return CMD_WARNING;
1993 }
1994
1995 bts->gprs.mode = mode;
Harald Welteaf387632010-03-14 23:30:30 +08001996
1997 return CMD_SUCCESS;
1998}
1999
Harald Welte9fbff4a2010-07-30 11:50:09 +02002000#define SI_TEXT "System Information Messages\n"
2001#define SI_TYPE_TEXT "(1|2|3|4|5|6|7|8|9|10|13|16|17|18|19|20|2bis|2ter|2quater|5bis|5ter)"
2002#define SI_TYPE_HELP "System Information Type 1\n" \
2003 "System Information Type 2\n" \
2004 "System Information Type 3\n" \
2005 "System Information Type 4\n" \
2006 "System Information Type 5\n" \
2007 "System Information Type 6\n" \
2008 "System Information Type 7\n" \
2009 "System Information Type 8\n" \
2010 "System Information Type 9\n" \
2011 "System Information Type 10\n" \
2012 "System Information Type 13\n" \
2013 "System Information Type 16\n" \
2014 "System Information Type 17\n" \
2015 "System Information Type 18\n" \
2016 "System Information Type 19\n" \
2017 "System Information Type 20\n" \
2018 "System Information Type 2bis\n" \
2019 "System Information Type 2ter\n" \
2020 "System Information Type 2quater\n" \
2021 "System Information Type 5bis\n" \
2022 "System Information Type 5ter\n"
2023
2024DEFUN(cfg_bts_si_mode, cfg_bts_si_mode_cmd,
2025 "system-information " SI_TYPE_TEXT " mode (static|computed)",
2026 SI_TEXT SI_TYPE_HELP
2027 "System Information Mode\n"
2028 "Static user-specified\n"
2029 "Dynamic, BSC-computed\n")
2030{
2031 struct gsm_bts *bts = vty->index;
2032 int type;
2033
2034 type = get_string_value(osmo_sitype_strs, argv[0]);
2035 if (type < 0) {
2036 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2037 return CMD_WARNING;
2038 }
2039
2040 if (!strcmp(argv[1], "static"))
2041 bts->si_mode_static |= (1 << type);
2042 else
2043 bts->si_mode_static &= ~(1 << type);
2044
2045 return CMD_SUCCESS;
2046}
2047
2048DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd,
2049 "system-information " SI_TYPE_TEXT " static HEXSTRING",
2050 SI_TEXT SI_TYPE_HELP
2051 "Static System Information filling\n"
2052 "Static user-specified SI content in HEX notation\n")
2053{
2054 struct gsm_bts *bts = vty->index;
2055 int rc, type;
2056
2057 type = get_string_value(osmo_sitype_strs, argv[0]);
2058 if (type < 0) {
2059 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2060 return CMD_WARNING;
2061 }
2062
2063 if (!(bts->si_mode_static & (1 << type))) {
2064 vty_out(vty, "SI Type %s is not configured in static mode%s",
2065 get_value_string(osmo_sitype_strs, type), VTY_NEWLINE);
2066 return CMD_WARNING;
2067 }
2068
Harald Welte290aaed2010-07-30 11:53:18 +02002069 /* Fill buffer with padding pattern */
2070 memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type]));
2071
2072 /* Parse the user-specified SI in hex format, [partially] overwriting padding */
Harald Welte9fbff4a2010-07-30 11:50:09 +02002073 rc = hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0]));
2074 if (rc < 0 || rc > sizeof(bts->si_buf[0])) {
2075 vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
2076 return CMD_WARNING;
2077 }
2078
2079 /* Mark this SI as present */
2080 bts->si_valid |= (1 << type);
2081
2082 return CMD_SUCCESS;
2083}
2084
2085
Harald Welte8f0ed552010-05-11 21:53:49 +02002086#define TRX_TEXT "Radio Transceiver\n"
Harald Welte7a8fa412009-08-10 13:48:16 +02002087
Harald Welte5258fc42009-03-28 19:07:53 +00002088/* per TRX configuration */
2089DEFUN(cfg_trx,
2090 cfg_trx_cmd,
2091 "trx TRX_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02002092 TRX_TEXT
Harald Welte5258fc42009-03-28 19:07:53 +00002093 "Select a TRX to configure")
2094{
2095 int trx_nr = atoi(argv[0]);
2096 struct gsm_bts *bts = vty->index;
2097 struct gsm_bts_trx *trx;
2098
Harald Weltee441d9c2009-06-21 16:17:15 +02002099 if (trx_nr > bts->num_trx) {
2100 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
2101 bts->num_trx, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00002102 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02002103 } else if (trx_nr == bts->num_trx) {
2104 /* we need to allocate a new one */
2105 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02002106 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02002107 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02002108
Harald Weltee441d9c2009-06-21 16:17:15 +02002109 if (!trx)
2110 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +00002111
2112 vty->index = trx;
Harald Welte197dea92010-05-14 17:59:53 +02002113 vty->index_sub = &trx->description;
Harald Welte5258fc42009-03-28 19:07:53 +00002114 vty->node = TRX_NODE;
2115
2116 return CMD_SUCCESS;
2117}
2118
2119DEFUN(cfg_trx_arfcn,
2120 cfg_trx_arfcn_cmd,
Harald Welte93e90202010-05-14 19:00:52 +02002121 "arfcn <0-1024>",
Harald Welte5258fc42009-03-28 19:07:53 +00002122 "Set the ARFCN for this TRX\n")
2123{
2124 int arfcn = atoi(argv[0]);
2125 struct gsm_bts_trx *trx = vty->index;
2126
2127 /* FIXME: check if this ARFCN is supported by this TRX */
2128
2129 trx->arfcn = arfcn;
2130
2131 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
2132 /* FIXME: use OML layer to update the ARFCN */
2133 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
2134
2135 return CMD_SUCCESS;
2136}
2137
Harald Welte (local)7b37d972009-12-27 20:56:38 +01002138DEFUN(cfg_trx_nominal_power,
2139 cfg_trx_nominal_power_cmd,
2140 "nominal power <0-100>",
2141 "Nominal TRX RF Power in dB\n")
2142{
2143 struct gsm_bts_trx *trx = vty->index;
2144
2145 trx->nominal_power = atoi(argv[0]);
2146
2147 return CMD_SUCCESS;
2148}
2149
Harald Weltefcd24452009-06-20 18:15:19 +02002150DEFUN(cfg_trx_max_power_red,
2151 cfg_trx_max_power_red_cmd,
2152 "max_power_red <0-100>",
2153 "Reduction of maximum BS RF Power in dB\n")
2154{
2155 int maxpwr_r = atoi(argv[0]);
2156 struct gsm_bts_trx *trx = vty->index;
Harald Welte61a83b22009-11-18 09:20:22 +01002157 int upper_limit = 24; /* default 12.21 max power red. */
Harald Weltefcd24452009-06-20 18:15:19 +02002158
2159 /* FIXME: check if our BTS type supports more than 12 */
2160 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
2161 vty_out(vty, "%% Power %d dB is not in the valid range%s",
2162 maxpwr_r, VTY_NEWLINE);
2163 return CMD_WARNING;
2164 }
2165 if (maxpwr_r & 1) {
2166 vty_out(vty, "%% Power %d dB is not an even value%s",
2167 maxpwr_r, VTY_NEWLINE);
2168 return CMD_WARNING;
2169 }
2170
2171 trx->max_power_red = maxpwr_r;
2172
2173 /* FIXME: make sure we update this using OML */
2174
2175 return CMD_SUCCESS;
2176}
2177
Harald Welte42581822009-08-08 16:12:58 +02002178DEFUN(cfg_trx_rsl_e1,
2179 cfg_trx_rsl_e1_cmd,
2180 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
2181 "E1 interface to be used for RSL\n")
2182{
2183 struct gsm_bts_trx *trx = vty->index;
2184
2185 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
2186
2187 return CMD_SUCCESS;
2188}
2189
2190DEFUN(cfg_trx_rsl_e1_tei,
2191 cfg_trx_rsl_e1_tei_cmd,
2192 "rsl e1 tei <0-63>",
2193 "Set the TEI to be used for RSL")
2194{
2195 struct gsm_bts_trx *trx = vty->index;
2196
2197 trx->rsl_tei = atoi(argv[0]);
2198
2199 return CMD_SUCCESS;
2200}
2201
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01002202DEFUN(cfg_trx_rf_locked,
2203 cfg_trx_rf_locked_cmd,
2204 "rf_locked (0|1)",
2205 "Turn off RF of the TRX.\n")
2206{
2207 int locked = atoi(argv[0]);
2208 struct gsm_bts_trx *trx = vty->index;
2209
2210 gsm_trx_lock_rf(trx, locked);
2211 return CMD_SUCCESS;
2212}
Harald Welte42581822009-08-08 16:12:58 +02002213
Harald Welte5258fc42009-03-28 19:07:53 +00002214/* per TS configuration */
2215DEFUN(cfg_ts,
2216 cfg_ts_cmd,
Harald Welte42581822009-08-08 16:12:58 +02002217 "timeslot <0-7>",
Harald Welte5258fc42009-03-28 19:07:53 +00002218 "Select a Timeslot to configure")
2219{
2220 int ts_nr = atoi(argv[0]);
2221 struct gsm_bts_trx *trx = vty->index;
2222 struct gsm_bts_trx_ts *ts;
2223
2224 if (ts_nr >= TRX_NR_TS) {
2225 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
2226 TRX_NR_TS, VTY_NEWLINE);
2227 return CMD_WARNING;
2228 }
2229
2230 ts = &trx->ts[ts_nr];
2231
2232 vty->index = ts;
2233 vty->node = TS_NODE;
2234
2235 return CMD_SUCCESS;
2236}
2237
Harald Weltea6fd58e2009-08-07 00:25:23 +02002238DEFUN(cfg_ts_pchan,
2239 cfg_ts_pchan_cmd,
2240 "phys_chan_config PCHAN",
2241 "Physical Channel configuration (TCH/SDCCH/...)")
2242{
2243 struct gsm_bts_trx_ts *ts = vty->index;
2244 int pchanc;
2245
2246 pchanc = gsm_pchan_parse(argv[0]);
2247 if (pchanc < 0)
2248 return CMD_WARNING;
2249
2250 ts->pchan = pchanc;
2251
2252 return CMD_SUCCESS;
2253}
2254
Harald Weltea39b0f22010-06-14 22:26:10 +02002255#define HOPPING_STR "Configure frequency hopping\n"
2256
2257DEFUN(cfg_ts_hopping,
2258 cfg_ts_hopping_cmd,
2259 "hopping enabled (0|1)",
2260 HOPPING_STR "Enable or disable frequency hopping\n"
2261 "Disable frequency hopping\n" "Enable frequency hopping\n")
2262{
2263 struct gsm_bts_trx_ts *ts = vty->index;
Harald Weltec2fb3d02010-06-14 22:47:37 +02002264 int enabled = atoi(argv[0]);
Harald Weltea39b0f22010-06-14 22:26:10 +02002265
Harald Weltec2fb3d02010-06-14 22:47:37 +02002266 if (enabled && !gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_HOPPING)) {
2267 vty_out(vty, "BTS model does not support hopping%s",
2268 VTY_NEWLINE);
2269 return CMD_WARNING;
2270 }
2271
2272 ts->hopping.enabled = enabled;
Harald Weltea39b0f22010-06-14 22:26:10 +02002273
2274 return CMD_SUCCESS;
2275}
2276
Harald Welte6e0cd042009-09-12 13:05:33 +02002277DEFUN(cfg_ts_hsn,
2278 cfg_ts_hsn_cmd,
Harald Weltea39b0f22010-06-14 22:26:10 +02002279 "hopping sequence-number <0-63>",
2280 HOPPING_STR
Harald Welte6e0cd042009-09-12 13:05:33 +02002281 "Which hopping sequence to use for this channel")
2282{
2283 struct gsm_bts_trx_ts *ts = vty->index;
2284
2285 ts->hopping.hsn = atoi(argv[0]);
2286
2287 return CMD_SUCCESS;
2288}
2289
2290DEFUN(cfg_ts_maio,
2291 cfg_ts_maio_cmd,
2292 "hopping maio <0-63>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002293 HOPPING_STR
Harald Welte6e0cd042009-09-12 13:05:33 +02002294 "Which hopping MAIO to use for this channel")
2295{
2296 struct gsm_bts_trx_ts *ts = vty->index;
2297
2298 ts->hopping.maio = atoi(argv[0]);
2299
2300 return CMD_SUCCESS;
2301}
2302
2303DEFUN(cfg_ts_arfcn_add,
2304 cfg_ts_arfcn_add_cmd,
2305 "hopping arfcn add <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002306 HOPPING_STR "Configure hopping ARFCN list\n"
2307 "Add an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02002308{
2309 struct gsm_bts_trx_ts *ts = vty->index;
2310 int arfcn = atoi(argv[0]);
2311
Harald Weltea39b0f22010-06-14 22:26:10 +02002312 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1);
2313
Harald Welte6e0cd042009-09-12 13:05:33 +02002314 return CMD_SUCCESS;
2315}
2316
2317DEFUN(cfg_ts_arfcn_del,
2318 cfg_ts_arfcn_del_cmd,
2319 "hopping arfcn del <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002320 HOPPING_STR "Configure hopping ARFCN list\n"
2321 "Delete an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02002322{
2323 struct gsm_bts_trx_ts *ts = vty->index;
2324 int arfcn = atoi(argv[0]);
2325
Harald Weltea39b0f22010-06-14 22:26:10 +02002326 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0);
2327
Harald Welte6e0cd042009-09-12 13:05:33 +02002328 return CMD_SUCCESS;
2329}
2330
Harald Weltea6fd58e2009-08-07 00:25:23 +02002331DEFUN(cfg_ts_e1_subslot,
2332 cfg_ts_e1_subslot_cmd,
Harald Welte42581822009-08-08 16:12:58 +02002333 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltea6fd58e2009-08-07 00:25:23 +02002334 "E1 sub-slot connected to this on-air timeslot")
2335{
2336 struct gsm_bts_trx_ts *ts = vty->index;
2337
Harald Welte42581822009-08-08 16:12:58 +02002338 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002339
2340 return CMD_SUCCESS;
2341}
Harald Welte5258fc42009-03-28 19:07:53 +00002342
Harald Welte4f10c252010-05-16 21:47:13 +02002343void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
2344{
2345 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
2346 counter_get(net->stats.chreq.total),
2347 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
2348 vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
2349 counter_get(net->stats.chan.rf_fail),
2350 counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
2351 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
2352 counter_get(net->stats.paging.attempted),
2353 counter_get(net->stats.paging.completed),
2354 counter_get(net->stats.paging.expired), VTY_NEWLINE);
2355 vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
2356 counter_get(net->stats.bts.oml_fail),
2357 counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
2358}
2359
Harald Welte5bc61dc2010-05-16 22:02:16 +02002360DEFUN(logging_fltr_imsi,
2361 logging_fltr_imsi_cmd,
2362 "logging filter imsi IMSI",
2363 LOGGING_STR FILTER_STR
2364 "Filter log messages by IMSI\n" "IMSI to be used as filter\n")
2365{
2366 struct telnet_connection *conn;
2367
2368 conn = (struct telnet_connection *) vty->priv;
2369 if (!conn->dbg) {
2370 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
2371 return CMD_WARNING;
2372 }
2373
2374 log_set_imsi_filter(conn->dbg, argv[0]);
2375 return CMD_SUCCESS;
2376}
2377
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002378DEFUN(drop_bts,
2379 drop_bts_cmd,
Holger Hans Peter Freyther0586b0f2010-04-11 12:46:45 +02002380 "drop bts connection <0-65535> (oml|rsl)",
2381 "Debug/Simulation command to drop ipaccess BTS\n"
2382 "BTS NR\n" "Connection Type\n")
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002383{
2384 struct gsm_network *gsmnet;
2385 struct gsm_bts_trx *trx;
2386 struct gsm_bts *bts;
2387 unsigned int bts_nr;
2388
2389 gsmnet = gsmnet_from_vty(vty);
2390
2391 bts_nr = atoi(argv[0]);
2392 if (bts_nr >= gsmnet->num_bts) {
2393 vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s",
2394 gsmnet->num_bts, bts_nr, VTY_NEWLINE);
2395 return CMD_WARNING;
2396 }
2397
2398 bts = gsm_bts_num(gsmnet, bts_nr);
2399 if (!bts) {
2400 vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE);
2401 return CMD_WARNING;
2402 }
2403
2404 if (!is_ipaccess_bts(bts)) {
2405 vty_out(vty, "This command only works for ipaccess.%s", VTY_NEWLINE);
2406 return CMD_WARNING;
2407 }
2408
2409
2410 /* close all connections */
2411 if (strcmp(argv[1], "oml") == 0) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01002412 ipaccess_drop_oml(bts);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002413 } else if (strcmp(argv[1], "rsl") == 0) {
2414 /* close all rsl connections */
2415 llist_for_each_entry(trx, &bts->trx_list, list) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01002416 ipaccess_drop_rsl(trx);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002417 }
2418 } else {
2419 vty_out(vty, "Argument must be 'oml# or 'rsl'.%s", VTY_NEWLINE);
2420 return CMD_WARNING;
2421 }
2422
2423 return CMD_SUCCESS;
2424}
2425
Harald Welted0d2b0b2010-12-23 13:18:07 +01002426DEFUN(pdch_act, pdch_act_cmd,
2427 "bts <0-255> trx <0-255> timeslot <0-7> pdch (activate|deactivate)",
2428 "BTS related commands\n" "BTS Number\n" "Transceiver\n" "Transceiver Number\n"
2429 "TRX Timeslot\n" "Timeslot Number\n" "Packet Data Channel\n"
2430 "Activate Dynamic PDCH/TCH (-> PDCH mode)\n"
2431 "Deactivate Dynamic PDCH/TCH (-> TCH mode)\n")
2432{
2433 struct gsm_bts *bts;
2434 struct gsm_bts_trx *trx;
2435 struct gsm_bts_trx_ts *ts;
2436 int bts_nr = atoi(argv[0]);
2437 int trx_nr = atoi(argv[1]);
2438 int ts_nr = atoi(argv[2]);
2439 int activate;
2440
2441 bts = gsm_bts_num(bsc_gsmnet, bts_nr);
2442 if (!bts) {
2443 vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE);
2444 return CMD_WARNING;
2445 }
2446
2447 if (!is_ipaccess_bts(bts)) {
2448 vty_out(vty, "%% This command only works for ipaccess BTS%s",
2449 VTY_NEWLINE);
2450 return CMD_WARNING;
2451 }
2452
2453 trx = gsm_bts_trx_num(bts, trx_nr);
2454 if (!trx) {
2455 vty_out(vty, "%% No such TRX (%d)%s", trx_nr, VTY_NEWLINE);
2456 return CMD_WARNING;
2457 }
2458
2459 ts = &trx->ts[ts_nr];
2460 if (ts->pchan != GSM_PCHAN_TCH_F_PDCH) {
2461 vty_out(vty, "%% Timeslot %u is not in dynamic TCH_F/PDCH "
2462 "mode%s", ts_nr, VTY_NEWLINE);
2463 return CMD_WARNING;
2464 }
2465
2466 if (!strcmp(argv[3], "activate"))
2467 activate = 1;
2468 else
2469 activate = 0;
2470
2471 rsl_ipacc_pdch_activate(ts, activate);
2472
2473 return CMD_SUCCESS;
2474
2475}
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002476
Harald Weltedcccb182010-05-16 20:52:23 +02002477extern int bsc_vty_init_extra(void);
Harald Welte1353f962010-05-16 19:20:24 +02002478extern const char *openbsc_copyright;
Holger Hans Peter Freythere1ffc082010-04-10 00:08:28 +02002479
Harald Weltedcccb182010-05-16 20:52:23 +02002480int bsc_vty_init(void)
Harald Welte68628e82009-03-10 12:17:57 +00002481{
Harald Welteb4d5b172010-05-12 16:10:35 +00002482 install_element_ve(&show_net_cmd);
2483 install_element_ve(&show_bts_cmd);
2484 install_element_ve(&show_trx_cmd);
2485 install_element_ve(&show_ts_cmd);
2486 install_element_ve(&show_lchan_cmd);
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08002487 install_element_ve(&show_lchan_summary_cmd);
Harald Welte5bc61dc2010-05-16 22:02:16 +02002488 install_element_ve(&logging_fltr_imsi_cmd);
Harald Welte1bc77352009-03-10 19:47:51 +00002489
Harald Welteb4d5b172010-05-12 16:10:35 +00002490 install_element_ve(&show_e1drv_cmd);
2491 install_element_ve(&show_e1line_cmd);
2492 install_element_ve(&show_e1ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002493
Harald Welteb4d5b172010-05-12 16:10:35 +00002494 install_element_ve(&show_paging_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002495
Harald Welte5bc61dc2010-05-16 22:02:16 +02002496 logging_vty_add_cmds();
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +01002497
Harald Welte5013b2a2009-08-07 13:29:14 +02002498 install_element(CONFIG_NODE, &cfg_net_cmd);
2499 install_node(&net_node, config_write_net);
2500 install_default(GSMNET_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002501 install_element(GSMNET_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002502 install_element(GSMNET_NODE, &ournode_end_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002503 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002504 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
2505 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
2506 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)69de3972009-08-12 14:42:23 +02002507 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte1085c092009-11-18 20:33:19 +01002508 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Welte4381cfe2009-08-30 15:47:06 +09002509 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01002510 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welteeab84a12009-12-13 10:53:12 +01002511 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte3d23db42009-12-14 17:49:15 +01002512 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Weltebc814502009-12-19 21:41:52 +01002513 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Welteb720bd32009-12-21 16:51:50 +01002514 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
2515 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
2516 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
2517 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
2518 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
2519 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01002520 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01002521 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
2522 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
2523 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
2524 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
2525 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
2526 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
2527 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
2528 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
2529 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
2530 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08002531 install_element(GSMNET_NODE, &cfg_net_dtx_cmd);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08002532 install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002533
2534 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte67ce0732009-08-06 19:06:46 +02002535 install_node(&bts_node, config_write_bts);
Harald Welte68628e82009-03-10 12:17:57 +00002536 install_default(BTS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002537 install_element(BTS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002538 install_element(BTS_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002539 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002540 install_element(BTS_NODE, &cfg_description_cmd);
2541 install_element(BTS_NODE, &cfg_no_description_cmd);
Harald Weltefcd24452009-06-20 18:15:19 +02002542 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02002543 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002544 install_element(BTS_NODE, &cfg_bts_lac_cmd);
2545 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002546 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte4cc34222009-05-01 15:12:31 +00002547 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte8175e952009-10-20 00:22:00 +02002548 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002549 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
2550 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02002551 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01002552 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
2553 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08002554 install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd);
2555 install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02002556 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08002557 install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd);
Harald Welte (local)0e451d02009-08-13 10:14:26 +02002558 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)efc92312009-08-14 23:09:25 +02002559 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welte73225282009-12-12 18:17:25 +01002560 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
2561 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002562 install_element(BTS_NODE, &cfg_bts_cell_bar_qualify_cmd);
2563 install_element(BTS_NODE, &cfg_bts_cell_resel_ofs_cmd);
2564 install_element(BTS_NODE, &cfg_bts_temp_ofs_cmd);
2565 install_element(BTS_NODE, &cfg_bts_temp_ofs_inf_cmd);
2566 install_element(BTS_NODE, &cfg_bts_penalty_time_cmd);
2567 install_element(BTS_NODE, &cfg_bts_penalty_time_rsvd_cmd);
Harald Welte4511d892010-04-18 15:51:20 +02002568 install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002569 install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002570 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
2571 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002572 install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
Harald Weltea5731cf2010-03-22 11:48:36 +08002573 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002574 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welteaf387632010-03-14 23:30:30 +08002575 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
2576 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
2577 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08002578 install_element(BTS_NODE, &cfg_bts_pag_free_cmd);
Harald Welte9fbff4a2010-07-30 11:50:09 +02002579 install_element(BTS_NODE, &cfg_bts_si_mode_cmd);
2580 install_element(BTS_NODE, &cfg_bts_si_static_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002581
Harald Welte5258fc42009-03-28 19:07:53 +00002582 install_element(BTS_NODE, &cfg_trx_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002583 install_node(&trx_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002584 install_default(TRX_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002585 install_element(TRX_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002586 install_element(TRX_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002587 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002588 install_element(TRX_NODE, &cfg_description_cmd);
2589 install_element(TRX_NODE, &cfg_no_description_cmd);
Harald Welte (local)7b37d972009-12-27 20:56:38 +01002590 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte879dc972009-06-20 22:36:12 +02002591 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002592 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
2593 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01002594 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002595
Harald Welte5258fc42009-03-28 19:07:53 +00002596 install_element(TRX_NODE, &cfg_ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002597 install_node(&ts_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002598 install_default(TS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002599 install_element(TS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002600 install_element(TS_NODE, &ournode_end_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002601 install_element(TS_NODE, &cfg_ts_pchan_cmd);
Harald Weltea39b0f22010-06-14 22:26:10 +02002602 install_element(TS_NODE, &cfg_ts_hopping_cmd);
Harald Welte6e0cd042009-09-12 13:05:33 +02002603 install_element(TS_NODE, &cfg_ts_hsn_cmd);
2604 install_element(TS_NODE, &cfg_ts_maio_cmd);
2605 install_element(TS_NODE, &cfg_ts_arfcn_add_cmd);
2606 install_element(TS_NODE, &cfg_ts_arfcn_del_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002607 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002608
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002609 install_element(ENABLE_NODE, &drop_bts_cmd);
Harald Welted0d2b0b2010-12-23 13:18:07 +01002610 install_element(ENABLE_NODE, &pdch_act_cmd);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002611
Harald Welte81c9b9c2010-05-31 16:40:40 +02002612 abis_nm_vty_init();
2613
Harald Weltedcccb182010-05-16 20:52:23 +02002614 bsc_vty_init_extra();
Harald Welte40f82892009-05-23 17:31:39 +00002615
Harald Welte68628e82009-03-10 12:17:57 +00002616 return 0;
2617}