blob: d4fda1062b8e86faf079af183560c757c19526ca [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 }
Harald Welte127af342010-12-24 12:07:07 +0100335 }
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 Weltecd103a92010-12-24 12:14:52 +0100636 vty_out(vty, "BTS %u, TRX %u, Timeslot %u, phys cfg %s",
Harald Welte026b4ca2010-12-24 12:12:10 +0100637 ts->trx->bts->nr, ts->trx->nr, ts->nr,
Harald Weltecd103a92010-12-24 12:14:52 +0100638 gsm_pchan_name(ts->pchan));
639 if (ts->pchan == GSM_PCHAN_TCH_F_PDCH)
640 vty_out(" (%s mode)",
641 ts->flags & TS_F_PDCH_MODE ? "PDCH" : "TCH/F");
642 vty_out(vty, "%s", VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000643 vty_out(vty, " NM State: ");
644 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte2c828992009-12-02 01:56:49 +0530645 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welteef235b52009-03-10 12:34:02 +0000646 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
647 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
648 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000649}
650
651DEFUN(show_ts,
652 show_ts_cmd,
Harald Welte1bc77352009-03-10 19:47:51 +0000653 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200654 SHOW_STR "Display information about a TS\n"
655 "BTS Number\n" "TRX Number\n" "Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000656{
Harald Weltedcccb182010-05-16 20:52:23 +0200657 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte274d0152010-12-24 12:05:03 +0100658 struct gsm_bts *bts = NULL;
659 struct gsm_bts_trx *trx = NULL;
660 struct gsm_bts_trx_ts *ts = NULL;
Harald Welte68628e82009-03-10 12:17:57 +0000661 int bts_nr, trx_nr, ts_nr;
662
663 if (argc >= 1) {
664 /* use the BTS number that the user has specified */
665 bts_nr = atoi(argv[0]);
666 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000667 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000668 VTY_NEWLINE);
669 return CMD_WARNING;
670 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200671 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000672 }
673 if (argc >= 2) {
674 trx_nr = atoi(argv[1]);
675 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000676 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000677 VTY_NEWLINE);
678 return CMD_WARNING;
679 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200680 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000681 }
682 if (argc >= 3) {
683 ts_nr = atoi(argv[2]);
684 if (ts_nr >= TRX_NR_TS) {
Harald Welte1bc77352009-03-10 19:47:51 +0000685 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
Harald Welte68628e82009-03-10 12:17:57 +0000686 VTY_NEWLINE);
687 return CMD_WARNING;
688 }
Harald Welte274d0152010-12-24 12:05:03 +0100689 /* Fully Specified: print and exit */
Harald Welte68628e82009-03-10 12:17:57 +0000690 ts = &trx->ts[ts_nr];
691 ts_dump_vty(vty, ts);
692 return CMD_SUCCESS;
693 }
Harald Welte274d0152010-12-24 12:05:03 +0100694
695 if (bts && trx) {
696 /* Iterate over all TS in this TRX */
697 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
698 ts = &trx->ts[ts_nr];
699 ts_dump_vty(vty, ts);
700 }
701 } else if (bts) {
702 /* Iterate over all TRX in this BTS, TS in each TRX */
Harald Welte68628e82009-03-10 12:17:57 +0000703 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200704 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000705 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
706 ts = &trx->ts[ts_nr];
707 ts_dump_vty(vty, ts);
708 }
709 }
Harald Welte274d0152010-12-24 12:05:03 +0100710 } else {
711 /* Iterate over all BTS, TRX in each BTS, TS in each TRX */
712 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
713 bts = gsm_bts_num(net, bts_nr);
714 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
715 trx = gsm_bts_trx_num(bts, trx_nr);
716 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
717 ts = &trx->ts[ts_nr];
718 ts_dump_vty(vty, ts);
719 }
720 }
721 }
Harald Welte68628e82009-03-10 12:17:57 +0000722 }
723
724 return CMD_SUCCESS;
725}
726
Holger Hans Peter Freyther424c4f02010-01-06 06:00:40 +0100727static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte68628e82009-03-10 12:17:57 +0000728{
Harald Weltefcd24452009-06-20 18:15:19 +0200729 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte40f82892009-05-23 17:31:39 +0000730 subscr->authorized, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000731 if (subscr->name)
Harald Welte1bc77352009-03-10 19:47:51 +0000732 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000733 if (subscr->extension)
734 vty_out(vty, " Extension: %s%s", subscr->extension,
735 VTY_NEWLINE);
736 if (subscr->imsi)
737 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freyther22230252009-08-19 12:53:57 +0200738 if (subscr->tmsi != GSM_RESERVED_TMSI)
739 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte731fd912009-08-15 03:24:51 +0200740 VTY_NEWLINE);
Sylvain Munautaf292642009-12-27 19:29:28 +0100741
Harald Welte (local)15920de2009-08-14 20:27:16 +0200742 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000743}
744
Harald Welte8387a492009-12-22 21:43:14 +0100745static void meas_rep_dump_uni_vty(struct vty *vty,
746 struct gsm_meas_rep_unidir *mru,
747 const char *prefix,
748 const char *dir)
749{
750 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
751 prefix, dir, rxlev2dbm(mru->full.rx_lev),
752 dir, rxlev2dbm(mru->sub.rx_lev));
753 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
754 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
755 VTY_NEWLINE);
756}
757
758static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
759 const char *prefix)
760{
761 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
762 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
763 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
764 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
765 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
766 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
767 VTY_NEWLINE);
768 if (mr->flags & MEAS_REP_F_MS_TO)
769 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
770 mr->ms_timing_offset, VTY_NEWLINE);
771 if (mr->flags & MEAS_REP_F_MS_L1)
772 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
773 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
774 if (mr->flags & MEAS_REP_F_DL_VALID)
775 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
776 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
777}
778
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800779static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
Harald Welte68628e82009-03-10 12:17:57 +0000780{
Harald Welte8387a492009-12-22 21:43:14 +0100781 int idx;
782
Harald Welte68628e82009-03-10 12:17:57 +0000783 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 +0200784 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
Harald Welte (local)ccd88452009-12-27 18:05:25 +0100785 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Harald Welte68628e82009-03-10 12:17:57 +0000786 VTY_NEWLINE);
Holger Hans Peter Freyther40494552010-06-28 17:09:29 +0800787 vty_out(vty, " Connection: %u, State: %s%s",
788 lchan->conn ? 1: 0,
Harald Welte1887f9d2009-12-29 10:52:38 +0100789 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100790 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
791 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
792 - lchan->bs_power*2,
793 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
794 VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800795 if (lchan->conn && lchan->conn->subscr) {
Harald Welte68628e82009-03-10 12:17:57 +0000796 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800797 subscr_dump_vty(vty, lchan->conn->subscr);
Harald Welte68628e82009-03-10 12:17:57 +0000798 } else
799 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte2c828992009-12-02 01:56:49 +0530800 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
801 struct in_addr ia;
Holger Hans Peter Freyther54fa7992010-04-07 15:39:16 +0200802 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte2c828992009-12-02 01:56:49 +0530803 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
804 inet_ntoa(ia), lchan->abis_ip.bound_port,
805 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
806 VTY_NEWLINE);
807 }
Harald Welte8387a492009-12-22 21:43:14 +0100808
809 /* we want to report the last measurement report */
810 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
811 lchan->meas_rep_idx, 1);
812 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte68628e82009-03-10 12:17:57 +0000813}
814
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800815static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
816{
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800817 struct gsm_meas_rep *mr;
818 int idx;
819
820 /* we want to report the last measurement report */
821 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
822 lchan->meas_rep_idx, 1);
823 mr = &lchan->meas_rep[idx];
824
825 vty_out(vty, "Lchan: %u Timeslot: %u TRX: %u BTS: %u Type: %s - L1 MS Power: %u dBm "
826 "RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800827 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
828 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800829 mr->ms_l1.pwr,
830 rxlev2dbm(mr->dl.full.rx_lev),
831 rxlev2dbm(mr->ul.full.rx_lev),
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800832 VTY_NEWLINE);
833}
834
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800835static int lchan_summary(struct vty *vty, int argc, const char **argv,
836 void (*dump_cb)(struct vty *, struct gsm_lchan *))
Harald Welte68628e82009-03-10 12:17:57 +0000837{
Harald Weltedcccb182010-05-16 20:52:23 +0200838 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000839 struct gsm_bts *bts;
840 struct gsm_bts_trx *trx;
841 struct gsm_bts_trx_ts *ts;
842 struct gsm_lchan *lchan;
843 int bts_nr, trx_nr, ts_nr, lchan_nr;
844
845 if (argc >= 1) {
846 /* use the BTS number that the user has specified */
847 bts_nr = atoi(argv[0]);
848 if (bts_nr >= net->num_bts) {
849 vty_out(vty, "%% can't find BTS %s%s", argv[0],
850 VTY_NEWLINE);
851 return CMD_WARNING;
852 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200853 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000854 }
855 if (argc >= 2) {
856 trx_nr = atoi(argv[1]);
857 if (trx_nr >= bts->num_trx) {
858 vty_out(vty, "%% can't find TRX %s%s", argv[1],
859 VTY_NEWLINE);
860 return CMD_WARNING;
861 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200862 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000863 }
864 if (argc >= 3) {
865 ts_nr = atoi(argv[2]);
866 if (ts_nr >= TRX_NR_TS) {
867 vty_out(vty, "%% can't find TS %s%s", argv[2],
868 VTY_NEWLINE);
869 return CMD_WARNING;
870 }
871 ts = &trx->ts[ts_nr];
872 }
873 if (argc >= 4) {
874 lchan_nr = atoi(argv[3]);
875 if (lchan_nr >= TS_MAX_LCHAN) {
876 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
877 VTY_NEWLINE);
878 return CMD_WARNING;
879 }
880 lchan = &ts->lchan[lchan_nr];
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800881 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000882 return CMD_SUCCESS;
883 }
884 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200885 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000886 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200887 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000888 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
889 ts = &trx->ts[ts_nr];
890 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
891 lchan_nr++) {
892 lchan = &ts->lchan[lchan_nr];
Harald Welteef235b52009-03-10 12:34:02 +0000893 if (lchan->type == GSM_LCHAN_NONE)
894 continue;
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800895 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000896 }
897 }
898 }
899 }
900
901 return CMD_SUCCESS;
902}
903
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800904
905DEFUN(show_lchan,
906 show_lchan_cmd,
907 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
908 SHOW_STR "Display information about a logical channel\n"
909 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
910 "Logical Channel Number\n")
911
912{
913 return lchan_summary(vty, argc, argv, lchan_dump_full_vty);
914}
915
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800916DEFUN(show_lchan_summary,
917 show_lchan_summary_cmd,
918 "show lchan summary [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
919 SHOW_STR "Display information about a logical channel\n"
920 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
921 "Logical Channel Number\n")
922{
923 return lchan_summary(vty, argc, argv, lchan_dump_short_vty);
924}
925
Harald Welte1bc77352009-03-10 19:47:51 +0000926static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
927{
928 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
929}
930
931DEFUN(show_e1drv,
932 show_e1drv_cmd,
933 "show e1_driver",
934 SHOW_STR "Display information about available E1 drivers\n")
935{
936 struct e1inp_driver *drv;
937
938 llist_for_each_entry(drv, &e1inp_driver_list, list)
939 e1drv_dump_vty(vty, drv);
940
941 return CMD_SUCCESS;
942}
943
Harald Welte68628e82009-03-10 12:17:57 +0000944static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
945{
946 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
947 line->num, line->name ? line->name : "",
948 line->driver->name, VTY_NEWLINE);
949}
950
951DEFUN(show_e1line,
952 show_e1line_cmd,
953 "show e1_line [line_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200954 SHOW_STR "Display information about a E1 line\n"
955 "E1 Line Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000956{
Harald Welte1bc77352009-03-10 19:47:51 +0000957 struct e1inp_line *line;
958
959 if (argc >= 1) {
960 int num = atoi(argv[0]);
961 llist_for_each_entry(line, &e1inp_line_list, list) {
962 if (line->num == num) {
963 e1line_dump_vty(vty, line);
964 return CMD_SUCCESS;
965 }
966 }
967 return CMD_WARNING;
968 }
969
970 llist_for_each_entry(line, &e1inp_line_list, list)
971 e1line_dump_vty(vty, line);
972
973 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000974}
975
976static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
977{
Harald Welte42581822009-08-08 16:12:58 +0200978 if (ts->type == E1INP_TS_TYPE_NONE)
979 return;
Harald Welte1bc77352009-03-10 19:47:51 +0000980 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
981 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
982 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000983}
984
985DEFUN(show_e1ts,
986 show_e1ts_cmd,
987 "show e1_timeslot [line_nr] [ts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200988 SHOW_STR "Display information about a E1 timeslot\n"
989 "E1 Line Number\n" "E1 Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000990{
Harald Welte986c3d72009-11-17 06:12:16 +0100991 struct e1inp_line *line = NULL;
Harald Welte1bc77352009-03-10 19:47:51 +0000992 struct e1inp_ts *ts;
993 int ts_nr;
Harald Welte68628e82009-03-10 12:17:57 +0000994
Harald Welte1bc77352009-03-10 19:47:51 +0000995 if (argc == 0) {
996 llist_for_each_entry(line, &e1inp_line_list, list) {
997 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
998 ts = &line->ts[ts_nr];
999 e1ts_dump_vty(vty, ts);
1000 }
1001 }
1002 return CMD_SUCCESS;
1003 }
1004 if (argc >= 1) {
1005 int num = atoi(argv[0]);
1006 llist_for_each_entry(line, &e1inp_line_list, list) {
1007 if (line->num == num)
1008 break;
1009 }
1010 if (!line || line->num != num) {
1011 vty_out(vty, "E1 line %s is invalid%s",
1012 argv[0], VTY_NEWLINE);
1013 return CMD_WARNING;
1014 }
1015 }
1016 if (argc >= 2) {
1017 ts_nr = atoi(argv[1]);
1018 if (ts_nr > NUM_E1_TS) {
1019 vty_out(vty, "E1 timeslot %s is invalid%s",
1020 argv[1], VTY_NEWLINE);
1021 return CMD_WARNING;
1022 }
1023 ts = &line->ts[ts_nr];
1024 e1ts_dump_vty(vty, ts);
1025 return CMD_SUCCESS;
1026 } else {
1027 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
1028 ts = &line->ts[ts_nr];
1029 e1ts_dump_vty(vty, ts);
1030 }
1031 return CMD_SUCCESS;
1032 }
1033 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +00001034}
1035
Harald Weltebe4b7302009-05-23 16:59:33 +00001036static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
Harald Weltef5025b62009-03-28 16:55:11 +00001037{
1038 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
1039 subscr_dump_vty(vty, pag->subscr);
1040}
1041
Harald Weltebe4b7302009-05-23 16:59:33 +00001042static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
Harald Weltef5025b62009-03-28 16:55:11 +00001043{
1044 struct gsm_paging_request *pag;
1045
1046 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
1047 paging_dump_vty(vty, pag);
1048}
1049
1050DEFUN(show_paging,
1051 show_paging_cmd,
1052 "show paging [bts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +02001053 SHOW_STR "Display information about paging reuqests of a BTS\n"
1054 "BTS Number\n")
Harald Weltef5025b62009-03-28 16:55:11 +00001055{
Harald Weltedcccb182010-05-16 20:52:23 +02001056 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Weltef5025b62009-03-28 16:55:11 +00001057 struct gsm_bts *bts;
1058 int bts_nr;
1059
1060 if (argc >= 1) {
1061 /* use the BTS number that the user has specified */
1062 bts_nr = atoi(argv[0]);
1063 if (bts_nr >= net->num_bts) {
1064 vty_out(vty, "%% can't find BTS %s%s", argv[0],
1065 VTY_NEWLINE);
1066 return CMD_WARNING;
1067 }
Harald Weltee441d9c2009-06-21 16:17:15 +02001068 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001069 bts_paging_dump_vty(vty, bts);
1070
1071 return CMD_SUCCESS;
1072 }
1073 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +02001074 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001075 bts_paging_dump_vty(vty, bts);
1076 }
1077
1078 return CMD_SUCCESS;
1079}
1080
Harald Welte8f0ed552010-05-11 21:53:49 +02001081#define NETWORK_STR "Configure the GSM network\n"
1082
Harald Welte5013b2a2009-08-07 13:29:14 +02001083DEFUN(cfg_net,
1084 cfg_net_cmd,
Harald Welte8f0ed552010-05-11 21:53:49 +02001085 "network", NETWORK_STR)
Harald Welte5013b2a2009-08-07 13:29:14 +02001086{
Harald Weltedcccb182010-05-16 20:52:23 +02001087 vty->index = gsmnet_from_vty(vty);
Harald Welte5013b2a2009-08-07 13:29:14 +02001088 vty->node = GSMNET_NODE;
1089
1090 return CMD_SUCCESS;
1091}
1092
1093
1094DEFUN(cfg_net_ncc,
1095 cfg_net_ncc_cmd,
1096 "network country code <1-999>",
1097 "Set the GSM network country code")
1098{
Harald Weltedcccb182010-05-16 20:52:23 +02001099 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1100
Harald Welte5013b2a2009-08-07 13:29:14 +02001101 gsmnet->country_code = atoi(argv[0]);
1102
1103 return CMD_SUCCESS;
1104}
1105
1106DEFUN(cfg_net_mnc,
1107 cfg_net_mnc_cmd,
1108 "mobile network code <1-999>",
1109 "Set the GSM mobile network code")
1110{
Harald Weltedcccb182010-05-16 20:52:23 +02001111 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1112
Harald Welte5013b2a2009-08-07 13:29:14 +02001113 gsmnet->network_code = atoi(argv[0]);
1114
1115 return CMD_SUCCESS;
1116}
1117
1118DEFUN(cfg_net_name_short,
1119 cfg_net_name_short_cmd,
1120 "short name NAME",
1121 "Set the short GSM network name")
1122{
Harald Weltedcccb182010-05-16 20:52:23 +02001123 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1124
Holger Hans Peter Freyther3e9a7f82010-10-12 23:21:54 +02001125 bsc_replace_string(gsmnet, &gsmnet->name_short, argv[0]);
Harald Welte5013b2a2009-08-07 13:29:14 +02001126 return CMD_SUCCESS;
1127}
1128
1129DEFUN(cfg_net_name_long,
1130 cfg_net_name_long_cmd,
1131 "long name NAME",
1132 "Set the long GSM network name")
1133{
Harald Weltedcccb182010-05-16 20:52:23 +02001134 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1135
Holger Hans Peter Freyther3e9a7f82010-10-12 23:21:54 +02001136 bsc_replace_string(gsmnet, &gsmnet->name_long, argv[0]);
Harald Welte5013b2a2009-08-07 13:29:14 +02001137 return CMD_SUCCESS;
1138}
Harald Welte40f82892009-05-23 17:31:39 +00001139
Harald Welte (local)69de3972009-08-12 14:42:23 +02001140DEFUN(cfg_net_auth_policy,
1141 cfg_net_auth_policy_cmd,
1142 "auth policy (closed|accept-all|token)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001143 "Authentication (not cryptographic)\n"
1144 "Set the GSM network authentication policy\n"
1145 "Require the MS to be activated in HLR\n"
1146 "Accept all MS, whether in HLR or not\n"
1147 "Use SMS-token based authentication\n")
Harald Welte (local)69de3972009-08-12 14:42:23 +02001148{
1149 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001150 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte (local)69de3972009-08-12 14:42:23 +02001151
1152 gsmnet->auth_policy = policy;
1153
1154 return CMD_SUCCESS;
1155}
1156
Harald Welte1085c092009-11-18 20:33:19 +01001157DEFUN(cfg_net_reject_cause,
1158 cfg_net_reject_cause_cmd,
1159 "location updating reject cause <2-111>",
1160 "Set the reject cause of location updating reject\n")
1161{
Harald Weltedcccb182010-05-16 20:52:23 +02001162 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1163
Harald Welte1085c092009-11-18 20:33:19 +01001164 gsmnet->reject_cause = atoi(argv[0]);
1165
1166 return CMD_SUCCESS;
1167}
1168
Harald Welte4381cfe2009-08-30 15:47:06 +09001169DEFUN(cfg_net_encryption,
1170 cfg_net_encryption_cmd,
1171 "encryption a5 (0|1|2)",
Harald Welte28326062010-05-14 20:05:17 +02001172 "Encryption options\n"
1173 "A5 encryption\n" "A5/0: No encryption\n"
1174 "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n")
Harald Welte4381cfe2009-08-30 15:47:06 +09001175{
Harald Weltedcccb182010-05-16 20:52:23 +02001176 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1177
Andreas.Eversberg1059deb2009-11-17 09:55:26 +01001178 gsmnet->a5_encryption= atoi(argv[0]);
Harald Welte4381cfe2009-08-30 15:47:06 +09001179
1180 return CMD_SUCCESS;
1181}
1182
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001183DEFUN(cfg_net_neci,
1184 cfg_net_neci_cmd,
1185 "neci (0|1)",
Harald Welte28326062010-05-14 20:05:17 +02001186 "New Establish Cause Indication\n"
1187 "Don't set the NECI bit\n" "Set the NECI bit\n")
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001188{
Harald Weltedcccb182010-05-16 20:52:23 +02001189 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1190
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001191 gsmnet->neci = atoi(argv[0]);
Holger Hans Peter Freyther78891072010-09-06 09:36:02 +08001192 gsm_net_update_ctype(gsmnet);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001193 return CMD_SUCCESS;
1194}
1195
Harald Welteeab84a12009-12-13 10:53:12 +01001196DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1197 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001198 "Radio Resource Location Protocol\n"
1199 "Set the Radio Resource Location Protocol Mode\n"
1200 "Don't send RRLP request\n"
1201 "Request MS-based location\n"
1202 "Request any location, prefer MS-based\n"
1203 "Request any location, prefer MS-assisted\n")
Harald Welteeab84a12009-12-13 10:53:12 +01001204{
Harald Weltedcccb182010-05-16 20:52:23 +02001205 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1206
Harald Welteeab84a12009-12-13 10:53:12 +01001207 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1208
1209 return CMD_SUCCESS;
1210}
1211
Harald Welte648b6ce2009-12-14 09:00:24 +01001212DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1213 "mm info (0|1)",
1214 "Whether to send MM INFO after LOC UPD ACCEPT")
1215{
Harald Weltedcccb182010-05-16 20:52:23 +02001216 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1217
Harald Welte648b6ce2009-12-14 09:00:24 +01001218 gsmnet->send_mm_info = atoi(argv[0]);
1219
1220 return CMD_SUCCESS;
1221}
1222
Harald Welte8f0ed552010-05-11 21:53:49 +02001223#define HANDOVER_STR "Handover Options\n"
1224
Harald Weltebc814502009-12-19 21:41:52 +01001225DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1226 "handover (0|1)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001227 HANDOVER_STR
1228 "Don't perform in-call handover\n"
1229 "Perform in-call handover\n")
Harald Weltebc814502009-12-19 21:41:52 +01001230{
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001231 int enable = atoi(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001232 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001233
1234 if (enable && ipacc_rtp_direct) {
Harald Weltefe03f0d2009-12-20 13:51:01 +01001235 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1236 "is enabled by using the -P command line option%s",
1237 VTY_NEWLINE);
1238 return CMD_WARNING;
1239 }
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001240 gsmnet->handover.active = enable;
Harald Weltebc814502009-12-19 21:41:52 +01001241
1242 return CMD_SUCCESS;
1243}
1244
Harald Welte8f0ed552010-05-11 21:53:49 +02001245#define HO_WIN_STR HANDOVER_STR "Measurement Window\n"
1246#define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n"
1247#define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n"
1248#define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n"
1249
Harald Welteb720bd32009-12-21 16:51:50 +01001250DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1251 "handover window rxlev averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001252 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001253 "How many RxLev measurements are used for averaging")
1254{
Harald Weltedcccb182010-05-16 20:52:23 +02001255 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001256 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1257 return CMD_SUCCESS;
1258}
1259
1260DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1261 "handover window rxqual averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001262 HO_WIN_RXQUAL_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001263 "How many RxQual measurements are used for averaging")
1264{
Harald Weltedcccb182010-05-16 20:52:23 +02001265 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001266 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1267 return CMD_SUCCESS;
1268}
1269
1270DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1271 "handover window rxlev neighbor averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001272 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001273 "How many RxQual measurements are used for averaging")
1274{
Harald Weltedcccb182010-05-16 20:52:23 +02001275 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001276 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1277 return CMD_SUCCESS;
1278}
1279
1280DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1281 "handover power budget interval <1-99>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001282 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001283 "How often to check if we have a better cell (SACCH frames)")
1284{
Harald Weltedcccb182010-05-16 20:52:23 +02001285 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001286 gsmnet->handover.pwr_interval = atoi(argv[0]);
1287 return CMD_SUCCESS;
1288}
1289
1290DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1291 "handover power budget hysteresis <0-999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001292 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001293 "How many dB does a neighbor to be stronger to become a HO candidate")
1294{
Harald Weltedcccb182010-05-16 20:52:23 +02001295 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001296 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1297 return CMD_SUCCESS;
1298}
1299
1300DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1301 "handover maximum distance <0-9999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001302 HANDOVER_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001303 "How big is the maximum timing advance before HO is forced")
1304{
Harald Weltedcccb182010-05-16 20:52:23 +02001305 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001306 gsmnet->handover.max_distance = atoi(argv[0]);
1307 return CMD_SUCCESS;
1308}
Harald Weltebc814502009-12-19 21:41:52 +01001309
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001310DEFUN(cfg_net_pag_any_tch,
1311 cfg_net_pag_any_tch_cmd,
1312 "paging any use tch (0|1)",
1313 "Assign a TCH when receiving a Paging Any request")
1314{
Holger Hans Peter Freytherb0e88b82010-09-06 10:09:19 +08001315 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001316 gsmnet->pag_any_tch = atoi(argv[0]);
1317 gsm_net_update_ctype(gsmnet);
1318 return CMD_SUCCESS;
1319}
1320
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001321#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001322 DEFUN(cfg_net_T##number, \
1323 cfg_net_T##number##_cmd, \
1324 "timer t" #number " <0-65535>", \
Harald Welte8f0ed552010-05-11 21:53:49 +02001325 "Configure GSM Timers\n" \
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001326 doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001327{ \
Harald Weltedcccb182010-05-16 20:52:23 +02001328 struct gsm_network *gsmnet = gsmnet_from_vty(vty); \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001329 int value = atoi(argv[0]); \
1330 \
1331 if (value < 0 || value > 65535) { \
1332 vty_out(vty, "Timer value %s out of range.%s", \
1333 argv[0], VTY_NEWLINE); \
1334 return CMD_WARNING; \
1335 } \
1336 \
1337 gsmnet->T##number = value; \
1338 return CMD_SUCCESS; \
1339}
1340
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001341DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1342DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1343DECLARE_TIMER(3105, "Currently not used.")
1344DECLARE_TIMER(3107, "Currently not used.")
1345DECLARE_TIMER(3109, "Currently not used.")
Holger Hans Peter Freytherf30c0dc2010-05-31 21:33:15 +08001346DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel.")
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001347DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1348DECLARE_TIMER(3115, "Currently not used.")
1349DECLARE_TIMER(3117, "Currently not used.")
1350DECLARE_TIMER(3119, "Currently not used.")
Harald Welte2862dca2010-12-23 14:39:29 +01001351DECLARE_TIMER(3122, "Waiting time (seconds) after IMM ASS REJECT")
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001352DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001353
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08001354DEFUN(cfg_net_dtx,
1355 cfg_net_dtx_cmd,
1356 "dtx-used (0|1)",
1357 "Enable the usage of DTX.\n"
1358 "DTX is enabled/disabled")
1359{
1360 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1361 gsmnet->dtx_enabled = atoi(argv[0]);
1362 return CMD_SUCCESS;
1363}
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001364
Harald Welte5258fc42009-03-28 19:07:53 +00001365/* per-BTS configuration */
1366DEFUN(cfg_bts,
1367 cfg_bts_cmd,
1368 "bts BTS_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02001369 "Select a BTS to configure\n"
1370 "BTS Number\n")
Harald Welte5258fc42009-03-28 19:07:53 +00001371{
Harald Weltedcccb182010-05-16 20:52:23 +02001372 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte5258fc42009-03-28 19:07:53 +00001373 int bts_nr = atoi(argv[0]);
1374 struct gsm_bts *bts;
1375
Harald Weltee441d9c2009-06-21 16:17:15 +02001376 if (bts_nr > gsmnet->num_bts) {
1377 vty_out(vty, "%% The next unused BTS number is %u%s",
1378 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001379 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001380 } else if (bts_nr == gsmnet->num_bts) {
1381 /* allocate a new one */
1382 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1383 HARDCODED_TSC, HARDCODED_BSIC);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001384 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02001385 bts = gsm_bts_num(gsmnet, bts_nr);
1386
Daniel Willmannf15c2762010-01-11 13:43:07 +01001387 if (!bts) {
1388 vty_out(vty, "%% Unable to allocate BTS %u%s",
1389 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee441d9c2009-06-21 16:17:15 +02001390 return CMD_WARNING;
Daniel Willmannf15c2762010-01-11 13:43:07 +01001391 }
Harald Welte5258fc42009-03-28 19:07:53 +00001392
1393 vty->index = bts;
Harald Welte197dea92010-05-14 17:59:53 +02001394 vty->index_sub = &bts->description;
Harald Welte5258fc42009-03-28 19:07:53 +00001395 vty->node = BTS_NODE;
1396
1397 return CMD_SUCCESS;
1398}
1399
1400DEFUN(cfg_bts_type,
1401 cfg_bts_type_cmd,
1402 "type TYPE",
1403 "Set the BTS type\n")
1404{
1405 struct gsm_bts *bts = vty->index;
Harald Welte39315c42010-01-10 18:01:52 +01001406 int rc;
Harald Welte5258fc42009-03-28 19:07:53 +00001407
Harald Welte39315c42010-01-10 18:01:52 +01001408 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1409 if (rc < 0)
1410 return CMD_WARNING;
Harald Welte8175e952009-10-20 00:22:00 +02001411
Harald Welte5258fc42009-03-28 19:07:53 +00001412 return CMD_SUCCESS;
1413}
1414
Harald Weltefcd24452009-06-20 18:15:19 +02001415DEFUN(cfg_bts_band,
1416 cfg_bts_band_cmd,
1417 "band BAND",
1418 "Set the frequency band of this BTS\n")
1419{
1420 struct gsm_bts *bts = vty->index;
Harald Welte42581822009-08-08 16:12:58 +02001421 int band = gsm_band_parse(argv[0]);
Harald Weltefcd24452009-06-20 18:15:19 +02001422
1423 if (band < 0) {
1424 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1425 band, VTY_NEWLINE);
1426 return CMD_WARNING;
1427 }
1428
1429 bts->band = band;
1430
1431 return CMD_SUCCESS;
1432}
1433
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001434DEFUN(cfg_bts_ci,
1435 cfg_bts_ci_cmd,
1436 "cell_identity <0-65535>",
1437 "Set the Cell identity of this BTS\n")
1438{
1439 struct gsm_bts *bts = vty->index;
1440 int ci = atoi(argv[0]);
1441
1442 if (ci < 0 || ci > 0xffff) {
1443 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1444 ci, VTY_NEWLINE);
1445 return CMD_WARNING;
1446 }
1447 bts->cell_identity = ci;
1448
1449 return CMD_SUCCESS;
1450}
1451
Harald Welte5258fc42009-03-28 19:07:53 +00001452DEFUN(cfg_bts_lac,
1453 cfg_bts_lac_cmd,
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001454 "location_area_code <0-65535>",
Harald Welte5258fc42009-03-28 19:07:53 +00001455 "Set the Location Area Code (LAC) of this BTS\n")
1456{
1457 struct gsm_bts *bts = vty->index;
1458 int lac = atoi(argv[0]);
1459
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001460 if (lac < 0 || lac > 0xffff) {
1461 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte5258fc42009-03-28 19:07:53 +00001462 lac, VTY_NEWLINE);
1463 return CMD_WARNING;
1464 }
Holger Hans Peter Freythere48b9562009-10-01 04:07:15 +02001465
1466 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1467 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1468 lac, VTY_NEWLINE);
1469 return CMD_WARNING;
1470 }
1471
Harald Welte5258fc42009-03-28 19:07:53 +00001472 bts->location_area_code = lac;
1473
1474 return CMD_SUCCESS;
1475}
1476
Harald Weltea43f7892009-12-01 18:04:30 +05301477
Harald Welte5258fc42009-03-28 19:07:53 +00001478DEFUN(cfg_bts_tsc,
1479 cfg_bts_tsc_cmd,
1480 "training_sequence_code <0-255>",
1481 "Set the Training Sequence Code (TSC) of this BTS\n")
1482{
1483 struct gsm_bts *bts = vty->index;
1484 int tsc = atoi(argv[0]);
1485
1486 if (tsc < 0 || tsc > 0xff) {
1487 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1488 tsc, VTY_NEWLINE);
1489 return CMD_WARNING;
1490 }
1491 bts->tsc = tsc;
1492
1493 return CMD_SUCCESS;
1494}
1495
Harald Welte78f2f502009-05-23 16:56:52 +00001496DEFUN(cfg_bts_bsic,
1497 cfg_bts_bsic_cmd,
1498 "base_station_id_code <0-63>",
1499 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1500{
1501 struct gsm_bts *bts = vty->index;
1502 int bsic = atoi(argv[0]);
1503
1504 if (bsic < 0 || bsic > 0x3f) {
Harald Welte42581822009-08-08 16:12:58 +02001505 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte78f2f502009-05-23 16:56:52 +00001506 bsic, VTY_NEWLINE);
1507 return CMD_WARNING;
1508 }
1509 bts->bsic = bsic;
1510
1511 return CMD_SUCCESS;
1512}
1513
1514
Harald Welte4cc34222009-05-01 15:12:31 +00001515DEFUN(cfg_bts_unit_id,
1516 cfg_bts_unit_id_cmd,
Harald Welte07dc73d2009-08-07 13:27:09 +02001517 "ip.access unit_id <0-65534> <0-255>",
1518 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte4cc34222009-05-01 15:12:31 +00001519{
1520 struct gsm_bts *bts = vty->index;
1521 int site_id = atoi(argv[0]);
1522 int bts_id = atoi(argv[1]);
1523
Harald Welte07dc73d2009-08-07 13:27:09 +02001524 if (!is_ipaccess_bts(bts)) {
1525 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1526 return CMD_WARNING;
1527 }
1528
Harald Welte4cc34222009-05-01 15:12:31 +00001529 bts->ip_access.site_id = site_id;
1530 bts->ip_access.bts_id = bts_id;
1531
1532 return CMD_SUCCESS;
1533}
1534
Harald Welte8f0ed552010-05-11 21:53:49 +02001535#define OML_STR "Organization & Maintenance Link\n"
1536#define IPA_STR "ip.access Specific Options\n"
1537
Harald Welte8175e952009-10-20 00:22:00 +02001538DEFUN(cfg_bts_stream_id,
1539 cfg_bts_stream_id_cmd,
1540 "oml ip.access stream_id <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001541 OML_STR IPA_STR
Harald Welte8175e952009-10-20 00:22:00 +02001542 "Set the ip.access Stream ID of the OML link of this BTS\n")
1543{
1544 struct gsm_bts *bts = vty->index;
1545 int stream_id = atoi(argv[0]);
1546
1547 if (!is_ipaccess_bts(bts)) {
1548 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1549 return CMD_WARNING;
1550 }
1551
1552 bts->oml_tei = stream_id;
1553
1554 return CMD_SUCCESS;
1555}
1556
Harald Welte8f0ed552010-05-11 21:53:49 +02001557#define OML_E1_STR OML_STR "E1 Line\n"
Harald Welte8175e952009-10-20 00:22:00 +02001558
Harald Welte42581822009-08-08 16:12:58 +02001559DEFUN(cfg_bts_oml_e1,
1560 cfg_bts_oml_e1_cmd,
1561 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001562 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001563 "E1 interface to be used for OML\n")
1564{
1565 struct gsm_bts *bts = vty->index;
1566
1567 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1568
1569 return CMD_SUCCESS;
1570}
1571
1572
1573DEFUN(cfg_bts_oml_e1_tei,
1574 cfg_bts_oml_e1_tei_cmd,
1575 "oml e1 tei <0-63>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001576 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001577 "Set the TEI to be used for OML")
1578{
1579 struct gsm_bts *bts = vty->index;
1580
1581 bts->oml_tei = atoi(argv[0]);
1582
1583 return CMD_SUCCESS;
1584}
1585
Harald Welte7a8fa412009-08-10 13:48:16 +02001586DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1587 "channel allocator (ascending|descending)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001588 "Channnel Allocator\n" "Channel Allocator\n"
1589 "Allocate Timeslots and Transceivers in ascending order\n"
1590 "Allocate Timeslots and Transceivers in descending order\n")
Harald Welte7a8fa412009-08-10 13:48:16 +02001591{
1592 struct gsm_bts *bts = vty->index;
1593
1594 if (!strcmp(argv[0], "ascending"))
1595 bts->chan_alloc_reverse = 0;
1596 else
1597 bts->chan_alloc_reverse = 1;
1598
1599 return CMD_SUCCESS;
1600}
1601
Harald Welte8f0ed552010-05-11 21:53:49 +02001602#define RACH_STR "Random Access Control Channel\n"
1603
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001604DEFUN(cfg_bts_rach_tx_integer,
1605 cfg_bts_rach_tx_integer_cmd,
1606 "rach tx integer <0-15>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001607 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001608 "Set the raw tx integer value in RACH Control parameters IE")
1609{
1610 struct gsm_bts *bts = vty->index;
1611 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1612 return CMD_SUCCESS;
1613}
1614
1615DEFUN(cfg_bts_rach_max_trans,
1616 cfg_bts_rach_max_trans_cmd,
1617 "rach max transmission (1|2|4|7)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001618 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001619 "Set the maximum number of RACH burst transmissions")
1620{
1621 struct gsm_bts *bts = vty->index;
1622 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1623 return CMD_SUCCESS;
1624}
1625
Harald Welte8f0ed552010-05-11 21:53:49 +02001626#define NM_STR "Network Management\n"
1627
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001628DEFUN(cfg_bts_rach_nm_b_thresh,
1629 cfg_bts_rach_nm_b_thresh_cmd,
1630 "rach nm busy threshold <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001631 RACH_STR NM_STR
1632 "Set the NM Busy Threshold in dB")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001633{
1634 struct gsm_bts *bts = vty->index;
1635 bts->rach_b_thresh = atoi(argv[0]);
1636 return CMD_SUCCESS;
1637}
1638
1639DEFUN(cfg_bts_rach_nm_ldavg,
1640 cfg_bts_rach_nm_ldavg_cmd,
1641 "rach nm load average <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001642 RACH_STR NM_STR
1643 "Set the NM Loadaverage Slots value")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001644{
1645 struct gsm_bts *bts = vty->index;
1646 bts->rach_ldavg_slots = atoi(argv[0]);
1647 return CMD_SUCCESS;
1648}
1649
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001650DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1651 "cell barred (0|1)",
1652 "Should this cell be barred from access?")
1653{
1654 struct gsm_bts *bts = vty->index;
1655
Harald Welte71355012009-12-21 23:08:18 +01001656 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001657
1658 return CMD_SUCCESS;
1659}
1660
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08001661DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd,
1662 "rach emergency call allowed (0|1)",
1663 "Should this cell allow emergency calls?")
1664{
1665 struct gsm_bts *bts = vty->index;
1666
1667 if (atoi(argv[0]) == 0)
1668 bts->si_common.rach_control.t2 |= 0x4;
1669 else
1670 bts->si_common.rach_control.t2 &= ~0x4;
1671
1672 return CMD_SUCCESS;
1673}
1674
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001675DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1676 "ms max power <0-40>",
1677 "Maximum transmit power of the MS")
1678{
1679 struct gsm_bts *bts = vty->index;
1680
1681 bts->ms_max_power = atoi(argv[0]);
1682
1683 return CMD_SUCCESS;
1684}
1685
Harald Welte73225282009-12-12 18:17:25 +01001686DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1687 "cell reselection hysteresis <0-14>",
1688 "Cell Re-Selection Hysteresis in dB")
1689{
1690 struct gsm_bts *bts = vty->index;
1691
1692 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1693
1694 return CMD_SUCCESS;
1695}
1696
1697DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1698 "rxlev access min <0-63>",
1699 "Minimum RxLev needed for cell access (better than -110dBm)")
1700{
1701 struct gsm_bts *bts = vty->index;
1702
1703 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1704
1705 return CMD_SUCCESS;
1706}
1707
Sylvain Munaute0b06b02010-11-28 18:17:28 +01001708DEFUN(cfg_bts_cell_bar_qualify, cfg_bts_cell_bar_qualify_cmd,
1709 "cell bar qualify (0|1)",
1710 "Cell Bar Qualify")
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.cbq = atoi(argv[0]);
1716
1717 return CMD_SUCCESS;
1718}
1719
1720DEFUN(cfg_bts_cell_resel_ofs, cfg_bts_cell_resel_ofs_cmd,
1721 "cell reselection offset <0-126>",
1722 "Cell Re-Selection Offset in dB")
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.cell_resel_off = atoi(argv[0])/2;
1728
1729 return CMD_SUCCESS;
1730}
1731
1732DEFUN(cfg_bts_temp_ofs, cfg_bts_temp_ofs_cmd,
1733 "temporary offset <0-60>",
1734 "Cell selection temporary negative offset in dB")
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.temp_offs = atoi(argv[0])/10;
1740
1741 return CMD_SUCCESS;
1742}
1743
1744DEFUN(cfg_bts_temp_ofs_inf, cfg_bts_temp_ofs_inf_cmd,
1745 "temporary offset infinite",
1746 "Sets cell selection temporary negative offset to infinity")
1747{
1748 struct gsm_bts *bts = vty->index;
1749
1750 bts->si_common.cell_ro_sel_par.present = 1;
1751 bts->si_common.cell_ro_sel_par.temp_offs = 7;
1752
1753 return CMD_SUCCESS;
1754}
1755
1756DEFUN(cfg_bts_penalty_time, cfg_bts_penalty_time_cmd,
1757 "penalty time <20-620>",
1758 "Cell selection penalty time in seconds (by 20s increments)")
1759{
1760 struct gsm_bts *bts = vty->index;
1761
1762 bts->si_common.cell_ro_sel_par.present = 1;
1763 bts->si_common.cell_ro_sel_par.penalty_time = (atoi(argv[0])-20)/20;
1764
1765 return CMD_SUCCESS;
1766}
1767
1768DEFUN(cfg_bts_penalty_time_rsvd, cfg_bts_penalty_time_rsvd_cmd,
1769 "penalty time reserved",
1770 "Set cell selection penalty time to reserved value 31\n"
1771 "(indicate that CELL_RESELECT_OFFSET is subtracted from C2 "
1772 "and TEMPORARY_OFFSET is ignored)")
1773{
1774 struct gsm_bts *bts = vty->index;
1775
1776 bts->si_common.cell_ro_sel_par.present = 1;
1777 bts->si_common.cell_ro_sel_par.penalty_time = 31;
1778
1779 return CMD_SUCCESS;
1780}
1781
Harald Welte (local)efc92312009-08-14 23:09:25 +02001782DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1783 "periodic location update <0-1530>",
1784 "Periodic Location Updating Interval in Minutes")
1785{
1786 struct gsm_bts *bts = vty->index;
1787
Dieter Spaard6613e02010-10-05 21:10:55 +02001788 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 6;
Harald Welte (local)efc92312009-08-14 23:09:25 +02001789
1790 return CMD_SUCCESS;
1791}
1792
Harald Welte8f0ed552010-05-11 21:53:49 +02001793#define GPRS_TEXT "GPRS Packet Network\n"
1794
Harald Welteaf387632010-03-14 23:30:30 +08001795DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welte57ba7e32010-04-18 14:00:26 +02001796 "gprs cell bvci <2-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001797 GPRS_TEXT
1798 "GPRS Cell Settings\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001799 "GPRS BSSGP VC Identifier")
1800{
1801 struct gsm_bts *bts = vty->index;
1802
Harald Welte4511d892010-04-18 15:51:20 +02001803 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001804 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1805 return CMD_WARNING;
1806 }
1807
Harald Welte97a282b2010-03-14 15:37:43 +08001808 bts->gprs.cell.bvci = atoi(argv[0]);
1809
1810 return CMD_SUCCESS;
1811}
1812
Harald Weltea5731cf2010-03-22 11:48:36 +08001813DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
1814 "gprs nsei <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001815 GPRS_TEXT
Harald Weltea5731cf2010-03-22 11:48:36 +08001816 "GPRS NS Entity Identifier")
1817{
1818 struct gsm_bts *bts = vty->index;
1819
Harald Welte4511d892010-04-18 15:51:20 +02001820 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltea5731cf2010-03-22 11:48:36 +08001821 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1822 return CMD_WARNING;
1823 }
1824
1825 bts->gprs.nse.nsei = atoi(argv[0]);
1826
1827 return CMD_SUCCESS;
1828}
1829
Harald Welte8f0ed552010-05-11 21:53:49 +02001830#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
1831 "NSVC Logical Number\n"
Harald Weltea5731cf2010-03-22 11:48:36 +08001832
Harald Welte97a282b2010-03-14 15:37:43 +08001833DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
1834 "gprs nsvc <0-1> nsvci <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001835 GPRS_TEXT NSVC_TEXT
1836 "NS Virtual Connection Identifier\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001837 "GPRS NS VC Identifier")
1838{
1839 struct gsm_bts *bts = vty->index;
1840 int idx = atoi(argv[0]);
1841
Harald Welte4511d892010-04-18 15:51:20 +02001842 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001843 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1844 return CMD_WARNING;
1845 }
1846
Harald Welte97a282b2010-03-14 15:37:43 +08001847 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
1848
1849 return CMD_SUCCESS;
1850}
1851
Harald Welteaf387632010-03-14 23:30:30 +08001852DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
1853 "gprs nsvc <0-1> local udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001854 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001855 "GPRS NS Local UDP Port")
1856{
1857 struct gsm_bts *bts = vty->index;
1858 int idx = atoi(argv[0]);
1859
Harald Welte4511d892010-04-18 15:51:20 +02001860 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001861 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1862 return CMD_WARNING;
1863 }
1864
Harald Welteaf387632010-03-14 23:30:30 +08001865 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
1866
1867 return CMD_SUCCESS;
1868}
1869
1870DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
1871 "gprs nsvc <0-1> remote udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001872 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001873 "GPRS NS Remote UDP Port")
1874{
1875 struct gsm_bts *bts = vty->index;
1876 int idx = atoi(argv[0]);
1877
Harald Welte4511d892010-04-18 15:51:20 +02001878 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001879 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1880 return CMD_WARNING;
1881 }
1882
Harald Welteaf387632010-03-14 23:30:30 +08001883 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
1884
1885 return CMD_SUCCESS;
1886}
1887
1888DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
1889 "gprs nsvc <0-1> remote ip A.B.C.D",
Harald Welte8f0ed552010-05-11 21:53:49 +02001890 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001891 "GPRS NS Remote IP Address")
1892{
1893 struct gsm_bts *bts = vty->index;
1894 int idx = atoi(argv[0]);
1895 struct in_addr ia;
1896
Harald Welte4511d892010-04-18 15:51:20 +02001897 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001898 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1899 return CMD_WARNING;
1900 }
1901
Harald Welteaf387632010-03-14 23:30:30 +08001902 inet_aton(argv[1], &ia);
1903 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
1904
1905 return CMD_SUCCESS;
1906}
1907
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08001908DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd,
1909 "paging free FREE_NR",
1910 "Only page when having a certain amount of free slots. -1 to disable")
1911{
1912 struct gsm_bts *bts = vty->index;
1913
1914 bts->paging.free_chans_need = atoi(argv[0]);
1915 return CMD_SUCCESS;
1916}
1917
Harald Welte615e9562010-05-11 23:50:21 +02001918DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd,
1919 "gprs ns timer " NS_TIMERS " <0-255>",
1920 GPRS_TEXT "Network Service\n"
1921 "Network Service Timer\n"
1922 NS_TIMERS_HELP "Timer Value\n")
1923{
1924 struct gsm_bts *bts = vty->index;
1925 int idx = get_string_value(gprs_ns_timer_strs, argv[0]);
1926 int val = atoi(argv[1]);
1927
1928 if (bts->gprs.mode == BTS_GPRS_NONE) {
1929 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1930 return CMD_WARNING;
1931 }
1932
1933 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
1934 return CMD_WARNING;
1935
1936 bts->gprs.nse.timer[idx] = val;
1937
1938 return CMD_SUCCESS;
1939}
1940
1941#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 +02001942#define BSSGP_TIMERS_HELP \
1943 "Tbvc-block timeout\n" \
1944 "Tbvc-block retries\n" \
1945 "Tbvc-unblock retries\n" \
1946 "Tbvcc-reset timeout\n" \
1947 "Tbvc-reset retries\n" \
1948 "Tbvc-suspend timeout\n" \
1949 "Tbvc-suspend retries\n" \
1950 "Tbvc-resume timeout\n" \
1951 "Tbvc-resume retries\n" \
1952 "Tbvc-capa-update timeout\n" \
1953 "Tbvc-capa-update retries\n"
Harald Welte615e9562010-05-11 23:50:21 +02001954
1955DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd,
1956 "gprs cell timer " BSSGP_TIMERS " <0-255>",
1957 GPRS_TEXT "Cell / BSSGP\n"
1958 "Cell/BSSGP Timer\n"
1959 BSSGP_TIMERS_HELP "Timer Value\n")
1960{
1961 struct gsm_bts *bts = vty->index;
1962 int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
1963 int val = atoi(argv[1]);
1964
1965 if (bts->gprs.mode == BTS_GPRS_NONE) {
1966 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1967 return CMD_WARNING;
1968 }
1969
1970 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer))
1971 return CMD_WARNING;
1972
1973 bts->gprs.cell.timer[idx] = val;
1974
1975 return CMD_SUCCESS;
1976}
1977
Harald Welte97a282b2010-03-14 15:37:43 +08001978DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
1979 "gprs routing area <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001980 GPRS_TEXT
Harald Welte97a282b2010-03-14 15:37:43 +08001981 "GPRS Routing Area Code")
1982{
1983 struct gsm_bts *bts = vty->index;
1984
Harald Welte4511d892010-04-18 15:51:20 +02001985 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001986 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1987 return CMD_WARNING;
1988 }
1989
Harald Welte97a282b2010-03-14 15:37:43 +08001990 bts->gprs.rac = atoi(argv[0]);
1991
1992 return CMD_SUCCESS;
1993}
1994
Harald Welte4511d892010-04-18 15:51:20 +02001995DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
1996 "gprs mode (none|gprs|egprs)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001997 GPRS_TEXT
1998 "GPRS Mode for this BTS\n"
1999 "GPRS Disabled on this BTS\n"
2000 "GPRS Enabled on this BTS\n"
2001 "EGPRS (EDGE) Enabled on this BTS\n")
Harald Welteaf387632010-03-14 23:30:30 +08002002{
2003 struct gsm_bts *bts = vty->index;
Harald Weltef3d8e922010-06-14 22:44:42 +02002004 enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0]);
Harald Welteaf387632010-03-14 23:30:30 +08002005
Harald Weltef3d8e922010-06-14 22:44:42 +02002006 if (mode != BTS_GPRS_NONE &&
2007 !gsm_bts_has_feature(bts, BTS_FEAT_GPRS)) {
2008 vty_out(vty, "This BTS type does not support %s%s", argv[0],
2009 VTY_NEWLINE);
2010 return CMD_WARNING;
2011 }
2012 if (mode == BTS_GPRS_EGPRS &&
2013 !gsm_bts_has_feature(bts, BTS_FEAT_EGPRS)) {
2014 vty_out(vty, "This BTS type does not support %s%s", argv[0],
2015 VTY_NEWLINE);
2016 return CMD_WARNING;
2017 }
2018
2019 bts->gprs.mode = mode;
Harald Welteaf387632010-03-14 23:30:30 +08002020
2021 return CMD_SUCCESS;
2022}
2023
Harald Welte9fbff4a2010-07-30 11:50:09 +02002024#define SI_TEXT "System Information Messages\n"
2025#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)"
2026#define SI_TYPE_HELP "System Information Type 1\n" \
2027 "System Information Type 2\n" \
2028 "System Information Type 3\n" \
2029 "System Information Type 4\n" \
2030 "System Information Type 5\n" \
2031 "System Information Type 6\n" \
2032 "System Information Type 7\n" \
2033 "System Information Type 8\n" \
2034 "System Information Type 9\n" \
2035 "System Information Type 10\n" \
2036 "System Information Type 13\n" \
2037 "System Information Type 16\n" \
2038 "System Information Type 17\n" \
2039 "System Information Type 18\n" \
2040 "System Information Type 19\n" \
2041 "System Information Type 20\n" \
2042 "System Information Type 2bis\n" \
2043 "System Information Type 2ter\n" \
2044 "System Information Type 2quater\n" \
2045 "System Information Type 5bis\n" \
2046 "System Information Type 5ter\n"
2047
2048DEFUN(cfg_bts_si_mode, cfg_bts_si_mode_cmd,
2049 "system-information " SI_TYPE_TEXT " mode (static|computed)",
2050 SI_TEXT SI_TYPE_HELP
2051 "System Information Mode\n"
2052 "Static user-specified\n"
2053 "Dynamic, BSC-computed\n")
2054{
2055 struct gsm_bts *bts = vty->index;
2056 int type;
2057
2058 type = get_string_value(osmo_sitype_strs, argv[0]);
2059 if (type < 0) {
2060 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2061 return CMD_WARNING;
2062 }
2063
2064 if (!strcmp(argv[1], "static"))
2065 bts->si_mode_static |= (1 << type);
2066 else
2067 bts->si_mode_static &= ~(1 << type);
2068
2069 return CMD_SUCCESS;
2070}
2071
2072DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd,
2073 "system-information " SI_TYPE_TEXT " static HEXSTRING",
2074 SI_TEXT SI_TYPE_HELP
2075 "Static System Information filling\n"
2076 "Static user-specified SI content in HEX notation\n")
2077{
2078 struct gsm_bts *bts = vty->index;
2079 int rc, type;
2080
2081 type = get_string_value(osmo_sitype_strs, argv[0]);
2082 if (type < 0) {
2083 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2084 return CMD_WARNING;
2085 }
2086
2087 if (!(bts->si_mode_static & (1 << type))) {
2088 vty_out(vty, "SI Type %s is not configured in static mode%s",
2089 get_value_string(osmo_sitype_strs, type), VTY_NEWLINE);
2090 return CMD_WARNING;
2091 }
2092
Harald Welte290aaed2010-07-30 11:53:18 +02002093 /* Fill buffer with padding pattern */
2094 memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type]));
2095
2096 /* Parse the user-specified SI in hex format, [partially] overwriting padding */
Harald Welte9fbff4a2010-07-30 11:50:09 +02002097 rc = hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0]));
2098 if (rc < 0 || rc > sizeof(bts->si_buf[0])) {
2099 vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
2100 return CMD_WARNING;
2101 }
2102
2103 /* Mark this SI as present */
2104 bts->si_valid |= (1 << type);
2105
2106 return CMD_SUCCESS;
2107}
2108
2109
Harald Welte8f0ed552010-05-11 21:53:49 +02002110#define TRX_TEXT "Radio Transceiver\n"
Harald Welte7a8fa412009-08-10 13:48:16 +02002111
Harald Welte5258fc42009-03-28 19:07:53 +00002112/* per TRX configuration */
2113DEFUN(cfg_trx,
2114 cfg_trx_cmd,
2115 "trx TRX_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02002116 TRX_TEXT
Harald Welte5258fc42009-03-28 19:07:53 +00002117 "Select a TRX to configure")
2118{
2119 int trx_nr = atoi(argv[0]);
2120 struct gsm_bts *bts = vty->index;
2121 struct gsm_bts_trx *trx;
2122
Harald Weltee441d9c2009-06-21 16:17:15 +02002123 if (trx_nr > bts->num_trx) {
2124 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
2125 bts->num_trx, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00002126 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02002127 } else if (trx_nr == bts->num_trx) {
2128 /* we need to allocate a new one */
2129 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02002130 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02002131 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02002132
Harald Weltee441d9c2009-06-21 16:17:15 +02002133 if (!trx)
2134 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +00002135
2136 vty->index = trx;
Harald Welte197dea92010-05-14 17:59:53 +02002137 vty->index_sub = &trx->description;
Harald Welte5258fc42009-03-28 19:07:53 +00002138 vty->node = TRX_NODE;
2139
2140 return CMD_SUCCESS;
2141}
2142
2143DEFUN(cfg_trx_arfcn,
2144 cfg_trx_arfcn_cmd,
Harald Welte93e90202010-05-14 19:00:52 +02002145 "arfcn <0-1024>",
Harald Welte5258fc42009-03-28 19:07:53 +00002146 "Set the ARFCN for this TRX\n")
2147{
2148 int arfcn = atoi(argv[0]);
2149 struct gsm_bts_trx *trx = vty->index;
2150
2151 /* FIXME: check if this ARFCN is supported by this TRX */
2152
2153 trx->arfcn = arfcn;
2154
2155 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
2156 /* FIXME: use OML layer to update the ARFCN */
2157 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
2158
2159 return CMD_SUCCESS;
2160}
2161
Harald Welte (local)7b37d972009-12-27 20:56:38 +01002162DEFUN(cfg_trx_nominal_power,
2163 cfg_trx_nominal_power_cmd,
2164 "nominal power <0-100>",
2165 "Nominal TRX RF Power in dB\n")
2166{
2167 struct gsm_bts_trx *trx = vty->index;
2168
2169 trx->nominal_power = atoi(argv[0]);
2170
2171 return CMD_SUCCESS;
2172}
2173
Harald Weltefcd24452009-06-20 18:15:19 +02002174DEFUN(cfg_trx_max_power_red,
2175 cfg_trx_max_power_red_cmd,
2176 "max_power_red <0-100>",
2177 "Reduction of maximum BS RF Power in dB\n")
2178{
2179 int maxpwr_r = atoi(argv[0]);
2180 struct gsm_bts_trx *trx = vty->index;
Harald Welte61a83b22009-11-18 09:20:22 +01002181 int upper_limit = 24; /* default 12.21 max power red. */
Harald Weltefcd24452009-06-20 18:15:19 +02002182
2183 /* FIXME: check if our BTS type supports more than 12 */
2184 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
2185 vty_out(vty, "%% Power %d dB is not in the valid range%s",
2186 maxpwr_r, VTY_NEWLINE);
2187 return CMD_WARNING;
2188 }
2189 if (maxpwr_r & 1) {
2190 vty_out(vty, "%% Power %d dB is not an even value%s",
2191 maxpwr_r, VTY_NEWLINE);
2192 return CMD_WARNING;
2193 }
2194
2195 trx->max_power_red = maxpwr_r;
2196
2197 /* FIXME: make sure we update this using OML */
2198
2199 return CMD_SUCCESS;
2200}
2201
Harald Welte42581822009-08-08 16:12:58 +02002202DEFUN(cfg_trx_rsl_e1,
2203 cfg_trx_rsl_e1_cmd,
2204 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
2205 "E1 interface to be used for RSL\n")
2206{
2207 struct gsm_bts_trx *trx = vty->index;
2208
2209 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
2210
2211 return CMD_SUCCESS;
2212}
2213
2214DEFUN(cfg_trx_rsl_e1_tei,
2215 cfg_trx_rsl_e1_tei_cmd,
2216 "rsl e1 tei <0-63>",
2217 "Set the TEI to be used for RSL")
2218{
2219 struct gsm_bts_trx *trx = vty->index;
2220
2221 trx->rsl_tei = atoi(argv[0]);
2222
2223 return CMD_SUCCESS;
2224}
2225
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01002226DEFUN(cfg_trx_rf_locked,
2227 cfg_trx_rf_locked_cmd,
2228 "rf_locked (0|1)",
2229 "Turn off RF of the TRX.\n")
2230{
2231 int locked = atoi(argv[0]);
2232 struct gsm_bts_trx *trx = vty->index;
2233
2234 gsm_trx_lock_rf(trx, locked);
2235 return CMD_SUCCESS;
2236}
Harald Welte42581822009-08-08 16:12:58 +02002237
Harald Welte5258fc42009-03-28 19:07:53 +00002238/* per TS configuration */
2239DEFUN(cfg_ts,
2240 cfg_ts_cmd,
Harald Welte42581822009-08-08 16:12:58 +02002241 "timeslot <0-7>",
Harald Welte5258fc42009-03-28 19:07:53 +00002242 "Select a Timeslot to configure")
2243{
2244 int ts_nr = atoi(argv[0]);
2245 struct gsm_bts_trx *trx = vty->index;
2246 struct gsm_bts_trx_ts *ts;
2247
2248 if (ts_nr >= TRX_NR_TS) {
2249 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
2250 TRX_NR_TS, VTY_NEWLINE);
2251 return CMD_WARNING;
2252 }
2253
2254 ts = &trx->ts[ts_nr];
2255
2256 vty->index = ts;
2257 vty->node = TS_NODE;
2258
2259 return CMD_SUCCESS;
2260}
2261
Harald Weltea6fd58e2009-08-07 00:25:23 +02002262DEFUN(cfg_ts_pchan,
2263 cfg_ts_pchan_cmd,
2264 "phys_chan_config PCHAN",
2265 "Physical Channel configuration (TCH/SDCCH/...)")
2266{
2267 struct gsm_bts_trx_ts *ts = vty->index;
2268 int pchanc;
2269
2270 pchanc = gsm_pchan_parse(argv[0]);
2271 if (pchanc < 0)
2272 return CMD_WARNING;
2273
2274 ts->pchan = pchanc;
2275
2276 return CMD_SUCCESS;
2277}
2278
Harald Weltea39b0f22010-06-14 22:26:10 +02002279#define HOPPING_STR "Configure frequency hopping\n"
2280
2281DEFUN(cfg_ts_hopping,
2282 cfg_ts_hopping_cmd,
2283 "hopping enabled (0|1)",
2284 HOPPING_STR "Enable or disable frequency hopping\n"
2285 "Disable frequency hopping\n" "Enable frequency hopping\n")
2286{
2287 struct gsm_bts_trx_ts *ts = vty->index;
Harald Weltec2fb3d02010-06-14 22:47:37 +02002288 int enabled = atoi(argv[0]);
Harald Weltea39b0f22010-06-14 22:26:10 +02002289
Harald Weltec2fb3d02010-06-14 22:47:37 +02002290 if (enabled && !gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_HOPPING)) {
2291 vty_out(vty, "BTS model does not support hopping%s",
2292 VTY_NEWLINE);
2293 return CMD_WARNING;
2294 }
2295
2296 ts->hopping.enabled = enabled;
Harald Weltea39b0f22010-06-14 22:26:10 +02002297
2298 return CMD_SUCCESS;
2299}
2300
Harald Welte6e0cd042009-09-12 13:05:33 +02002301DEFUN(cfg_ts_hsn,
2302 cfg_ts_hsn_cmd,
Harald Weltea39b0f22010-06-14 22:26:10 +02002303 "hopping sequence-number <0-63>",
2304 HOPPING_STR
Harald Welte6e0cd042009-09-12 13:05:33 +02002305 "Which hopping sequence to use for this channel")
2306{
2307 struct gsm_bts_trx_ts *ts = vty->index;
2308
2309 ts->hopping.hsn = atoi(argv[0]);
2310
2311 return CMD_SUCCESS;
2312}
2313
2314DEFUN(cfg_ts_maio,
2315 cfg_ts_maio_cmd,
2316 "hopping maio <0-63>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002317 HOPPING_STR
Harald Welte6e0cd042009-09-12 13:05:33 +02002318 "Which hopping MAIO to use for this channel")
2319{
2320 struct gsm_bts_trx_ts *ts = vty->index;
2321
2322 ts->hopping.maio = atoi(argv[0]);
2323
2324 return CMD_SUCCESS;
2325}
2326
2327DEFUN(cfg_ts_arfcn_add,
2328 cfg_ts_arfcn_add_cmd,
2329 "hopping arfcn add <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002330 HOPPING_STR "Configure hopping ARFCN list\n"
2331 "Add an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02002332{
2333 struct gsm_bts_trx_ts *ts = vty->index;
2334 int arfcn = atoi(argv[0]);
2335
Harald Weltea39b0f22010-06-14 22:26:10 +02002336 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1);
2337
Harald Welte6e0cd042009-09-12 13:05:33 +02002338 return CMD_SUCCESS;
2339}
2340
2341DEFUN(cfg_ts_arfcn_del,
2342 cfg_ts_arfcn_del_cmd,
2343 "hopping arfcn del <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002344 HOPPING_STR "Configure hopping ARFCN list\n"
2345 "Delete an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02002346{
2347 struct gsm_bts_trx_ts *ts = vty->index;
2348 int arfcn = atoi(argv[0]);
2349
Harald Weltea39b0f22010-06-14 22:26:10 +02002350 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0);
2351
Harald Welte6e0cd042009-09-12 13:05:33 +02002352 return CMD_SUCCESS;
2353}
2354
Harald Weltea6fd58e2009-08-07 00:25:23 +02002355DEFUN(cfg_ts_e1_subslot,
2356 cfg_ts_e1_subslot_cmd,
Harald Welte42581822009-08-08 16:12:58 +02002357 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltea6fd58e2009-08-07 00:25:23 +02002358 "E1 sub-slot connected to this on-air timeslot")
2359{
2360 struct gsm_bts_trx_ts *ts = vty->index;
2361
Harald Welte42581822009-08-08 16:12:58 +02002362 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002363
2364 return CMD_SUCCESS;
2365}
Harald Welte5258fc42009-03-28 19:07:53 +00002366
Harald Welte4f10c252010-05-16 21:47:13 +02002367void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
2368{
2369 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
2370 counter_get(net->stats.chreq.total),
2371 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
2372 vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
2373 counter_get(net->stats.chan.rf_fail),
2374 counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
2375 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
2376 counter_get(net->stats.paging.attempted),
2377 counter_get(net->stats.paging.completed),
2378 counter_get(net->stats.paging.expired), VTY_NEWLINE);
2379 vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
2380 counter_get(net->stats.bts.oml_fail),
2381 counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
2382}
2383
Harald Welte5bc61dc2010-05-16 22:02:16 +02002384DEFUN(logging_fltr_imsi,
2385 logging_fltr_imsi_cmd,
2386 "logging filter imsi IMSI",
2387 LOGGING_STR FILTER_STR
2388 "Filter log messages by IMSI\n" "IMSI to be used as filter\n")
2389{
2390 struct telnet_connection *conn;
2391
2392 conn = (struct telnet_connection *) vty->priv;
2393 if (!conn->dbg) {
2394 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
2395 return CMD_WARNING;
2396 }
2397
2398 log_set_imsi_filter(conn->dbg, argv[0]);
2399 return CMD_SUCCESS;
2400}
2401
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002402DEFUN(drop_bts,
2403 drop_bts_cmd,
Holger Hans Peter Freyther0586b0f2010-04-11 12:46:45 +02002404 "drop bts connection <0-65535> (oml|rsl)",
2405 "Debug/Simulation command to drop ipaccess BTS\n"
2406 "BTS NR\n" "Connection Type\n")
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002407{
2408 struct gsm_network *gsmnet;
2409 struct gsm_bts_trx *trx;
2410 struct gsm_bts *bts;
2411 unsigned int bts_nr;
2412
2413 gsmnet = gsmnet_from_vty(vty);
2414
2415 bts_nr = atoi(argv[0]);
2416 if (bts_nr >= gsmnet->num_bts) {
2417 vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s",
2418 gsmnet->num_bts, bts_nr, VTY_NEWLINE);
2419 return CMD_WARNING;
2420 }
2421
2422 bts = gsm_bts_num(gsmnet, bts_nr);
2423 if (!bts) {
2424 vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE);
2425 return CMD_WARNING;
2426 }
2427
2428 if (!is_ipaccess_bts(bts)) {
2429 vty_out(vty, "This command only works for ipaccess.%s", VTY_NEWLINE);
2430 return CMD_WARNING;
2431 }
2432
2433
2434 /* close all connections */
2435 if (strcmp(argv[1], "oml") == 0) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01002436 ipaccess_drop_oml(bts);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002437 } else if (strcmp(argv[1], "rsl") == 0) {
2438 /* close all rsl connections */
2439 llist_for_each_entry(trx, &bts->trx_list, list) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01002440 ipaccess_drop_rsl(trx);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002441 }
2442 } else {
2443 vty_out(vty, "Argument must be 'oml# or 'rsl'.%s", VTY_NEWLINE);
2444 return CMD_WARNING;
2445 }
2446
2447 return CMD_SUCCESS;
2448}
2449
Harald Welted0d2b0b2010-12-23 13:18:07 +01002450DEFUN(pdch_act, pdch_act_cmd,
2451 "bts <0-255> trx <0-255> timeslot <0-7> pdch (activate|deactivate)",
2452 "BTS related commands\n" "BTS Number\n" "Transceiver\n" "Transceiver Number\n"
2453 "TRX Timeslot\n" "Timeslot Number\n" "Packet Data Channel\n"
2454 "Activate Dynamic PDCH/TCH (-> PDCH mode)\n"
2455 "Deactivate Dynamic PDCH/TCH (-> TCH mode)\n")
2456{
2457 struct gsm_bts *bts;
2458 struct gsm_bts_trx *trx;
2459 struct gsm_bts_trx_ts *ts;
2460 int bts_nr = atoi(argv[0]);
2461 int trx_nr = atoi(argv[1]);
2462 int ts_nr = atoi(argv[2]);
2463 int activate;
2464
2465 bts = gsm_bts_num(bsc_gsmnet, bts_nr);
2466 if (!bts) {
2467 vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE);
2468 return CMD_WARNING;
2469 }
2470
2471 if (!is_ipaccess_bts(bts)) {
2472 vty_out(vty, "%% This command only works for ipaccess BTS%s",
2473 VTY_NEWLINE);
2474 return CMD_WARNING;
2475 }
2476
2477 trx = gsm_bts_trx_num(bts, trx_nr);
2478 if (!trx) {
2479 vty_out(vty, "%% No such TRX (%d)%s", trx_nr, VTY_NEWLINE);
2480 return CMD_WARNING;
2481 }
2482
2483 ts = &trx->ts[ts_nr];
2484 if (ts->pchan != GSM_PCHAN_TCH_F_PDCH) {
2485 vty_out(vty, "%% Timeslot %u is not in dynamic TCH_F/PDCH "
2486 "mode%s", ts_nr, VTY_NEWLINE);
2487 return CMD_WARNING;
2488 }
2489
2490 if (!strcmp(argv[3], "activate"))
2491 activate = 1;
2492 else
2493 activate = 0;
2494
2495 rsl_ipacc_pdch_activate(ts, activate);
2496
2497 return CMD_SUCCESS;
2498
2499}
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002500
Harald Weltedcccb182010-05-16 20:52:23 +02002501extern int bsc_vty_init_extra(void);
Harald Welte1353f962010-05-16 19:20:24 +02002502extern const char *openbsc_copyright;
Holger Hans Peter Freythere1ffc082010-04-10 00:08:28 +02002503
Harald Weltedcccb182010-05-16 20:52:23 +02002504int bsc_vty_init(void)
Harald Welte68628e82009-03-10 12:17:57 +00002505{
Harald Welteb4d5b172010-05-12 16:10:35 +00002506 install_element_ve(&show_net_cmd);
2507 install_element_ve(&show_bts_cmd);
2508 install_element_ve(&show_trx_cmd);
2509 install_element_ve(&show_ts_cmd);
2510 install_element_ve(&show_lchan_cmd);
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08002511 install_element_ve(&show_lchan_summary_cmd);
Harald Welte5bc61dc2010-05-16 22:02:16 +02002512 install_element_ve(&logging_fltr_imsi_cmd);
Harald Welte1bc77352009-03-10 19:47:51 +00002513
Harald Welteb4d5b172010-05-12 16:10:35 +00002514 install_element_ve(&show_e1drv_cmd);
2515 install_element_ve(&show_e1line_cmd);
2516 install_element_ve(&show_e1ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002517
Harald Welteb4d5b172010-05-12 16:10:35 +00002518 install_element_ve(&show_paging_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002519
Harald Welte5bc61dc2010-05-16 22:02:16 +02002520 logging_vty_add_cmds();
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +01002521
Harald Welte5013b2a2009-08-07 13:29:14 +02002522 install_element(CONFIG_NODE, &cfg_net_cmd);
2523 install_node(&net_node, config_write_net);
2524 install_default(GSMNET_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002525 install_element(GSMNET_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002526 install_element(GSMNET_NODE, &ournode_end_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002527 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002528 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
2529 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
2530 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)69de3972009-08-12 14:42:23 +02002531 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte1085c092009-11-18 20:33:19 +01002532 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Welte4381cfe2009-08-30 15:47:06 +09002533 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01002534 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welteeab84a12009-12-13 10:53:12 +01002535 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte3d23db42009-12-14 17:49:15 +01002536 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Weltebc814502009-12-19 21:41:52 +01002537 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Welteb720bd32009-12-21 16:51:50 +01002538 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
2539 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
2540 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
2541 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
2542 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
2543 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01002544 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01002545 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
2546 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
2547 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
2548 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
2549 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
2550 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
2551 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
2552 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
2553 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
Harald Weltec9f499f2010-12-23 22:53:50 +01002554 install_element(GSMNET_NODE, &cfg_net_T3122_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01002555 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08002556 install_element(GSMNET_NODE, &cfg_net_dtx_cmd);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08002557 install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002558
2559 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte67ce0732009-08-06 19:06:46 +02002560 install_node(&bts_node, config_write_bts);
Harald Welte68628e82009-03-10 12:17:57 +00002561 install_default(BTS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002562 install_element(BTS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002563 install_element(BTS_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002564 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002565 install_element(BTS_NODE, &cfg_description_cmd);
2566 install_element(BTS_NODE, &cfg_no_description_cmd);
Harald Weltefcd24452009-06-20 18:15:19 +02002567 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02002568 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002569 install_element(BTS_NODE, &cfg_bts_lac_cmd);
2570 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002571 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte4cc34222009-05-01 15:12:31 +00002572 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte8175e952009-10-20 00:22:00 +02002573 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002574 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
2575 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02002576 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01002577 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
2578 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08002579 install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd);
2580 install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02002581 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08002582 install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd);
Harald Welte (local)0e451d02009-08-13 10:14:26 +02002583 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)efc92312009-08-14 23:09:25 +02002584 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welte73225282009-12-12 18:17:25 +01002585 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
2586 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002587 install_element(BTS_NODE, &cfg_bts_cell_bar_qualify_cmd);
2588 install_element(BTS_NODE, &cfg_bts_cell_resel_ofs_cmd);
2589 install_element(BTS_NODE, &cfg_bts_temp_ofs_cmd);
2590 install_element(BTS_NODE, &cfg_bts_temp_ofs_inf_cmd);
2591 install_element(BTS_NODE, &cfg_bts_penalty_time_cmd);
2592 install_element(BTS_NODE, &cfg_bts_penalty_time_rsvd_cmd);
Harald Welte4511d892010-04-18 15:51:20 +02002593 install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002594 install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002595 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
2596 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002597 install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
Harald Weltea5731cf2010-03-22 11:48:36 +08002598 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002599 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welteaf387632010-03-14 23:30:30 +08002600 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
2601 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
2602 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08002603 install_element(BTS_NODE, &cfg_bts_pag_free_cmd);
Harald Welte9fbff4a2010-07-30 11:50:09 +02002604 install_element(BTS_NODE, &cfg_bts_si_mode_cmd);
2605 install_element(BTS_NODE, &cfg_bts_si_static_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002606
Harald Welte5258fc42009-03-28 19:07:53 +00002607 install_element(BTS_NODE, &cfg_trx_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002608 install_node(&trx_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002609 install_default(TRX_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002610 install_element(TRX_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002611 install_element(TRX_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002612 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002613 install_element(TRX_NODE, &cfg_description_cmd);
2614 install_element(TRX_NODE, &cfg_no_description_cmd);
Harald Welte (local)7b37d972009-12-27 20:56:38 +01002615 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte879dc972009-06-20 22:36:12 +02002616 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002617 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
2618 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01002619 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002620
Harald Welte5258fc42009-03-28 19:07:53 +00002621 install_element(TRX_NODE, &cfg_ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002622 install_node(&ts_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002623 install_default(TS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002624 install_element(TS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002625 install_element(TS_NODE, &ournode_end_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002626 install_element(TS_NODE, &cfg_ts_pchan_cmd);
Harald Weltea39b0f22010-06-14 22:26:10 +02002627 install_element(TS_NODE, &cfg_ts_hopping_cmd);
Harald Welte6e0cd042009-09-12 13:05:33 +02002628 install_element(TS_NODE, &cfg_ts_hsn_cmd);
2629 install_element(TS_NODE, &cfg_ts_maio_cmd);
2630 install_element(TS_NODE, &cfg_ts_arfcn_add_cmd);
2631 install_element(TS_NODE, &cfg_ts_arfcn_del_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002632 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002633
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002634 install_element(ENABLE_NODE, &drop_bts_cmd);
Harald Welted0d2b0b2010-12-23 13:18:07 +01002635 install_element(ENABLE_NODE, &pdch_act_cmd);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002636
Harald Welte81c9b9c2010-05-31 16:40:40 +02002637 abis_nm_vty_init();
2638
Harald Weltedcccb182010-05-16 20:52:23 +02002639 bsc_vty_init_extra();
Harald Welte40f82892009-05-23 17:31:39 +00002640
Harald Welte68628e82009-03-10 12:17:57 +00002641 return 0;
2642}