blob: 82737e3c755ff32059e36e1e728acff3e1795623 [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]);
Harald Welte712ddbc2010-12-24 12:24:03 +0100272 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)
Harald Welteb29cea12010-12-24 12:26:13 +0100640 vty_out(vty, " (%s mode)",
Harald Weltecd103a92010-12-24 12:14:52 +0100641 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 Welte85bded82010-12-24 12:22:34 +0100783 vty_out(vty, "BTS %u, TRX %u, Timeslot %u, Lchan %u: Type %s%s",
784 lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
785 lchan->nr, gsm_lchant_name(lchan->type), VTY_NEWLINE);
Holger Hans Peter Freyther40494552010-06-28 17:09:29 +0800786 vty_out(vty, " Connection: %u, State: %s%s",
787 lchan->conn ? 1: 0,
Harald Welte1887f9d2009-12-29 10:52:38 +0100788 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100789 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
790 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
791 - lchan->bs_power*2,
792 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
793 VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800794 if (lchan->conn && lchan->conn->subscr) {
Harald Welte68628e82009-03-10 12:17:57 +0000795 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800796 subscr_dump_vty(vty, lchan->conn->subscr);
Harald Welte68628e82009-03-10 12:17:57 +0000797 } else
798 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte2c828992009-12-02 01:56:49 +0530799 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
800 struct in_addr ia;
Holger Hans Peter Freyther54fa7992010-04-07 15:39:16 +0200801 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte2c828992009-12-02 01:56:49 +0530802 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
803 inet_ntoa(ia), lchan->abis_ip.bound_port,
804 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
805 VTY_NEWLINE);
806 }
Harald Welte8387a492009-12-22 21:43:14 +0100807
808 /* we want to report the last measurement report */
809 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
810 lchan->meas_rep_idx, 1);
811 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte68628e82009-03-10 12:17:57 +0000812}
813
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800814static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
815{
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800816 struct gsm_meas_rep *mr;
817 int idx;
818
819 /* we want to report the last measurement report */
820 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
821 lchan->meas_rep_idx, 1);
822 mr = &lchan->meas_rep[idx];
823
Harald Welte85bded82010-12-24 12:22:34 +0100824 vty_out(vty, "BTS %u, TRX %u, Timeslot %u, Lchan %u, Type %s - "
825 "L1 MS Power: %u dBm RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
826 lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
Harald Welteb29cea12010-12-24 12:26:13 +0100827 lchan->nr, gsm_lchant_name(lchan->type), mr->ms_l1.pwr,
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800828 rxlev2dbm(mr->dl.full.rx_lev),
829 rxlev2dbm(mr->ul.full.rx_lev),
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800830 VTY_NEWLINE);
831}
832
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800833static int lchan_summary(struct vty *vty, int argc, const char **argv,
834 void (*dump_cb)(struct vty *, struct gsm_lchan *))
Harald Welte68628e82009-03-10 12:17:57 +0000835{
Harald Weltedcccb182010-05-16 20:52:23 +0200836 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000837 struct gsm_bts *bts;
838 struct gsm_bts_trx *trx;
839 struct gsm_bts_trx_ts *ts;
840 struct gsm_lchan *lchan;
841 int bts_nr, trx_nr, ts_nr, lchan_nr;
842
843 if (argc >= 1) {
844 /* use the BTS number that the user has specified */
845 bts_nr = atoi(argv[0]);
846 if (bts_nr >= net->num_bts) {
847 vty_out(vty, "%% can't find BTS %s%s", argv[0],
848 VTY_NEWLINE);
849 return CMD_WARNING;
850 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200851 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000852 }
853 if (argc >= 2) {
854 trx_nr = atoi(argv[1]);
855 if (trx_nr >= bts->num_trx) {
856 vty_out(vty, "%% can't find TRX %s%s", argv[1],
857 VTY_NEWLINE);
858 return CMD_WARNING;
859 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200860 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000861 }
862 if (argc >= 3) {
863 ts_nr = atoi(argv[2]);
864 if (ts_nr >= TRX_NR_TS) {
865 vty_out(vty, "%% can't find TS %s%s", argv[2],
866 VTY_NEWLINE);
867 return CMD_WARNING;
868 }
869 ts = &trx->ts[ts_nr];
870 }
871 if (argc >= 4) {
872 lchan_nr = atoi(argv[3]);
873 if (lchan_nr >= TS_MAX_LCHAN) {
874 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
875 VTY_NEWLINE);
876 return CMD_WARNING;
877 }
878 lchan = &ts->lchan[lchan_nr];
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800879 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000880 return CMD_SUCCESS;
881 }
882 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200883 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000884 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200885 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000886 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
887 ts = &trx->ts[ts_nr];
888 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
889 lchan_nr++) {
890 lchan = &ts->lchan[lchan_nr];
Harald Welteef235b52009-03-10 12:34:02 +0000891 if (lchan->type == GSM_LCHAN_NONE)
892 continue;
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800893 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000894 }
895 }
896 }
897 }
898
899 return CMD_SUCCESS;
900}
901
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800902
903DEFUN(show_lchan,
904 show_lchan_cmd,
905 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
906 SHOW_STR "Display information about a logical channel\n"
907 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
908 "Logical Channel Number\n")
909
910{
911 return lchan_summary(vty, argc, argv, lchan_dump_full_vty);
912}
913
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800914DEFUN(show_lchan_summary,
915 show_lchan_summary_cmd,
916 "show lchan summary [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
917 SHOW_STR "Display information about a logical channel\n"
918 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
919 "Logical Channel Number\n")
920{
921 return lchan_summary(vty, argc, argv, lchan_dump_short_vty);
922}
923
Harald Welte1bc77352009-03-10 19:47:51 +0000924static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
925{
926 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
927}
928
929DEFUN(show_e1drv,
930 show_e1drv_cmd,
931 "show e1_driver",
932 SHOW_STR "Display information about available E1 drivers\n")
933{
934 struct e1inp_driver *drv;
935
936 llist_for_each_entry(drv, &e1inp_driver_list, list)
937 e1drv_dump_vty(vty, drv);
938
939 return CMD_SUCCESS;
940}
941
Harald Welte68628e82009-03-10 12:17:57 +0000942static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
943{
944 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
945 line->num, line->name ? line->name : "",
946 line->driver->name, VTY_NEWLINE);
947}
948
949DEFUN(show_e1line,
950 show_e1line_cmd,
951 "show e1_line [line_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200952 SHOW_STR "Display information about a E1 line\n"
953 "E1 Line Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000954{
Harald Welte1bc77352009-03-10 19:47:51 +0000955 struct e1inp_line *line;
956
957 if (argc >= 1) {
958 int num = atoi(argv[0]);
959 llist_for_each_entry(line, &e1inp_line_list, list) {
960 if (line->num == num) {
961 e1line_dump_vty(vty, line);
962 return CMD_SUCCESS;
963 }
964 }
965 return CMD_WARNING;
966 }
967
968 llist_for_each_entry(line, &e1inp_line_list, list)
969 e1line_dump_vty(vty, line);
970
971 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000972}
973
974static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
975{
Harald Welte42581822009-08-08 16:12:58 +0200976 if (ts->type == E1INP_TS_TYPE_NONE)
977 return;
Harald Welte1bc77352009-03-10 19:47:51 +0000978 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
979 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
980 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000981}
982
983DEFUN(show_e1ts,
984 show_e1ts_cmd,
985 "show e1_timeslot [line_nr] [ts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200986 SHOW_STR "Display information about a E1 timeslot\n"
987 "E1 Line Number\n" "E1 Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000988{
Harald Welte986c3d72009-11-17 06:12:16 +0100989 struct e1inp_line *line = NULL;
Harald Welte1bc77352009-03-10 19:47:51 +0000990 struct e1inp_ts *ts;
991 int ts_nr;
Harald Welte68628e82009-03-10 12:17:57 +0000992
Harald Welte1bc77352009-03-10 19:47:51 +0000993 if (argc == 0) {
994 llist_for_each_entry(line, &e1inp_line_list, list) {
995 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
996 ts = &line->ts[ts_nr];
997 e1ts_dump_vty(vty, ts);
998 }
999 }
1000 return CMD_SUCCESS;
1001 }
1002 if (argc >= 1) {
1003 int num = atoi(argv[0]);
1004 llist_for_each_entry(line, &e1inp_line_list, list) {
1005 if (line->num == num)
1006 break;
1007 }
1008 if (!line || line->num != num) {
1009 vty_out(vty, "E1 line %s is invalid%s",
1010 argv[0], VTY_NEWLINE);
1011 return CMD_WARNING;
1012 }
1013 }
1014 if (argc >= 2) {
1015 ts_nr = atoi(argv[1]);
1016 if (ts_nr > NUM_E1_TS) {
1017 vty_out(vty, "E1 timeslot %s is invalid%s",
1018 argv[1], VTY_NEWLINE);
1019 return CMD_WARNING;
1020 }
1021 ts = &line->ts[ts_nr];
1022 e1ts_dump_vty(vty, ts);
1023 return CMD_SUCCESS;
1024 } else {
1025 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
1026 ts = &line->ts[ts_nr];
1027 e1ts_dump_vty(vty, ts);
1028 }
1029 return CMD_SUCCESS;
1030 }
1031 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +00001032}
1033
Harald Weltebe4b7302009-05-23 16:59:33 +00001034static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
Harald Weltef5025b62009-03-28 16:55:11 +00001035{
1036 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
1037 subscr_dump_vty(vty, pag->subscr);
1038}
1039
Harald Weltebe4b7302009-05-23 16:59:33 +00001040static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
Harald Weltef5025b62009-03-28 16:55:11 +00001041{
1042 struct gsm_paging_request *pag;
1043
1044 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
1045 paging_dump_vty(vty, pag);
1046}
1047
1048DEFUN(show_paging,
1049 show_paging_cmd,
1050 "show paging [bts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +02001051 SHOW_STR "Display information about paging reuqests of a BTS\n"
1052 "BTS Number\n")
Harald Weltef5025b62009-03-28 16:55:11 +00001053{
Harald Weltedcccb182010-05-16 20:52:23 +02001054 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Weltef5025b62009-03-28 16:55:11 +00001055 struct gsm_bts *bts;
1056 int bts_nr;
1057
1058 if (argc >= 1) {
1059 /* use the BTS number that the user has specified */
1060 bts_nr = atoi(argv[0]);
1061 if (bts_nr >= net->num_bts) {
1062 vty_out(vty, "%% can't find BTS %s%s", argv[0],
1063 VTY_NEWLINE);
1064 return CMD_WARNING;
1065 }
Harald Weltee441d9c2009-06-21 16:17:15 +02001066 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001067 bts_paging_dump_vty(vty, bts);
1068
1069 return CMD_SUCCESS;
1070 }
1071 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +02001072 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001073 bts_paging_dump_vty(vty, bts);
1074 }
1075
1076 return CMD_SUCCESS;
1077}
1078
Harald Welte8f0ed552010-05-11 21:53:49 +02001079#define NETWORK_STR "Configure the GSM network\n"
1080
Harald Welte5013b2a2009-08-07 13:29:14 +02001081DEFUN(cfg_net,
1082 cfg_net_cmd,
Harald Welte8f0ed552010-05-11 21:53:49 +02001083 "network", NETWORK_STR)
Harald Welte5013b2a2009-08-07 13:29:14 +02001084{
Harald Weltedcccb182010-05-16 20:52:23 +02001085 vty->index = gsmnet_from_vty(vty);
Harald Welte5013b2a2009-08-07 13:29:14 +02001086 vty->node = GSMNET_NODE;
1087
1088 return CMD_SUCCESS;
1089}
1090
1091
1092DEFUN(cfg_net_ncc,
1093 cfg_net_ncc_cmd,
1094 "network country code <1-999>",
1095 "Set the GSM network country code")
1096{
Harald Weltedcccb182010-05-16 20:52:23 +02001097 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1098
Harald Welte5013b2a2009-08-07 13:29:14 +02001099 gsmnet->country_code = atoi(argv[0]);
1100
1101 return CMD_SUCCESS;
1102}
1103
1104DEFUN(cfg_net_mnc,
1105 cfg_net_mnc_cmd,
1106 "mobile network code <1-999>",
1107 "Set the GSM mobile network code")
1108{
Harald Weltedcccb182010-05-16 20:52:23 +02001109 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1110
Harald Welte5013b2a2009-08-07 13:29:14 +02001111 gsmnet->network_code = atoi(argv[0]);
1112
1113 return CMD_SUCCESS;
1114}
1115
1116DEFUN(cfg_net_name_short,
1117 cfg_net_name_short_cmd,
1118 "short name NAME",
1119 "Set the short GSM network name")
1120{
Harald Weltedcccb182010-05-16 20:52:23 +02001121 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1122
Holger Hans Peter Freyther3e9a7f82010-10-12 23:21:54 +02001123 bsc_replace_string(gsmnet, &gsmnet->name_short, argv[0]);
Harald Welte5013b2a2009-08-07 13:29:14 +02001124 return CMD_SUCCESS;
1125}
1126
1127DEFUN(cfg_net_name_long,
1128 cfg_net_name_long_cmd,
1129 "long name NAME",
1130 "Set the long GSM network name")
1131{
Harald Weltedcccb182010-05-16 20:52:23 +02001132 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1133
Holger Hans Peter Freyther3e9a7f82010-10-12 23:21:54 +02001134 bsc_replace_string(gsmnet, &gsmnet->name_long, argv[0]);
Harald Welte5013b2a2009-08-07 13:29:14 +02001135 return CMD_SUCCESS;
1136}
Harald Welte40f82892009-05-23 17:31:39 +00001137
Harald Welte (local)69de3972009-08-12 14:42:23 +02001138DEFUN(cfg_net_auth_policy,
1139 cfg_net_auth_policy_cmd,
1140 "auth policy (closed|accept-all|token)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001141 "Authentication (not cryptographic)\n"
1142 "Set the GSM network authentication policy\n"
1143 "Require the MS to be activated in HLR\n"
1144 "Accept all MS, whether in HLR or not\n"
1145 "Use SMS-token based authentication\n")
Harald Welte (local)69de3972009-08-12 14:42:23 +02001146{
1147 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001148 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte (local)69de3972009-08-12 14:42:23 +02001149
1150 gsmnet->auth_policy = policy;
1151
1152 return CMD_SUCCESS;
1153}
1154
Harald Welte1085c092009-11-18 20:33:19 +01001155DEFUN(cfg_net_reject_cause,
1156 cfg_net_reject_cause_cmd,
1157 "location updating reject cause <2-111>",
1158 "Set the reject cause of location updating reject\n")
1159{
Harald Weltedcccb182010-05-16 20:52:23 +02001160 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1161
Harald Welte1085c092009-11-18 20:33:19 +01001162 gsmnet->reject_cause = atoi(argv[0]);
1163
1164 return CMD_SUCCESS;
1165}
1166
Harald Welte4381cfe2009-08-30 15:47:06 +09001167DEFUN(cfg_net_encryption,
1168 cfg_net_encryption_cmd,
1169 "encryption a5 (0|1|2)",
Harald Welte28326062010-05-14 20:05:17 +02001170 "Encryption options\n"
1171 "A5 encryption\n" "A5/0: No encryption\n"
1172 "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n")
Harald Welte4381cfe2009-08-30 15:47:06 +09001173{
Harald Weltedcccb182010-05-16 20:52:23 +02001174 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1175
Andreas.Eversberg1059deb2009-11-17 09:55:26 +01001176 gsmnet->a5_encryption= atoi(argv[0]);
Harald Welte4381cfe2009-08-30 15:47:06 +09001177
1178 return CMD_SUCCESS;
1179}
1180
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001181DEFUN(cfg_net_neci,
1182 cfg_net_neci_cmd,
1183 "neci (0|1)",
Harald Welte28326062010-05-14 20:05:17 +02001184 "New Establish Cause Indication\n"
1185 "Don't set the NECI bit\n" "Set the NECI bit\n")
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001186{
Harald Weltedcccb182010-05-16 20:52:23 +02001187 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1188
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001189 gsmnet->neci = atoi(argv[0]);
Holger Hans Peter Freyther78891072010-09-06 09:36:02 +08001190 gsm_net_update_ctype(gsmnet);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001191 return CMD_SUCCESS;
1192}
1193
Harald Welteeab84a12009-12-13 10:53:12 +01001194DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1195 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001196 "Radio Resource Location Protocol\n"
1197 "Set the Radio Resource Location Protocol Mode\n"
1198 "Don't send RRLP request\n"
1199 "Request MS-based location\n"
1200 "Request any location, prefer MS-based\n"
1201 "Request any location, prefer MS-assisted\n")
Harald Welteeab84a12009-12-13 10:53:12 +01001202{
Harald Weltedcccb182010-05-16 20:52:23 +02001203 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1204
Harald Welteeab84a12009-12-13 10:53:12 +01001205 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1206
1207 return CMD_SUCCESS;
1208}
1209
Harald Welte648b6ce2009-12-14 09:00:24 +01001210DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1211 "mm info (0|1)",
1212 "Whether to send MM INFO after LOC UPD ACCEPT")
1213{
Harald Weltedcccb182010-05-16 20:52:23 +02001214 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1215
Harald Welte648b6ce2009-12-14 09:00:24 +01001216 gsmnet->send_mm_info = atoi(argv[0]);
1217
1218 return CMD_SUCCESS;
1219}
1220
Harald Welte8f0ed552010-05-11 21:53:49 +02001221#define HANDOVER_STR "Handover Options\n"
1222
Harald Weltebc814502009-12-19 21:41:52 +01001223DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1224 "handover (0|1)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001225 HANDOVER_STR
1226 "Don't perform in-call handover\n"
1227 "Perform in-call handover\n")
Harald Weltebc814502009-12-19 21:41:52 +01001228{
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001229 int enable = atoi(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001230 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001231
1232 if (enable && ipacc_rtp_direct) {
Harald Weltefe03f0d2009-12-20 13:51:01 +01001233 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1234 "is enabled by using the -P command line option%s",
1235 VTY_NEWLINE);
1236 return CMD_WARNING;
1237 }
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001238 gsmnet->handover.active = enable;
Harald Weltebc814502009-12-19 21:41:52 +01001239
1240 return CMD_SUCCESS;
1241}
1242
Harald Welte8f0ed552010-05-11 21:53:49 +02001243#define HO_WIN_STR HANDOVER_STR "Measurement Window\n"
1244#define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n"
1245#define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n"
1246#define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n"
1247
Harald Welteb720bd32009-12-21 16:51:50 +01001248DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1249 "handover window rxlev averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001250 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001251 "How many RxLev measurements are used for averaging")
1252{
Harald Weltedcccb182010-05-16 20:52:23 +02001253 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001254 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1255 return CMD_SUCCESS;
1256}
1257
1258DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1259 "handover window rxqual averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001260 HO_WIN_RXQUAL_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001261 "How many RxQual measurements are used for averaging")
1262{
Harald Weltedcccb182010-05-16 20:52:23 +02001263 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001264 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1265 return CMD_SUCCESS;
1266}
1267
1268DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1269 "handover window rxlev neighbor averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001270 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001271 "How many RxQual measurements are used for averaging")
1272{
Harald Weltedcccb182010-05-16 20:52:23 +02001273 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001274 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1275 return CMD_SUCCESS;
1276}
1277
1278DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1279 "handover power budget interval <1-99>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001280 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001281 "How often to check if we have a better cell (SACCH frames)")
1282{
Harald Weltedcccb182010-05-16 20:52:23 +02001283 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001284 gsmnet->handover.pwr_interval = atoi(argv[0]);
1285 return CMD_SUCCESS;
1286}
1287
1288DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1289 "handover power budget hysteresis <0-999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001290 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001291 "How many dB does a neighbor to be stronger to become a HO candidate")
1292{
Harald Weltedcccb182010-05-16 20:52:23 +02001293 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001294 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1295 return CMD_SUCCESS;
1296}
1297
1298DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1299 "handover maximum distance <0-9999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001300 HANDOVER_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001301 "How big is the maximum timing advance before HO is forced")
1302{
Harald Weltedcccb182010-05-16 20:52:23 +02001303 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001304 gsmnet->handover.max_distance = atoi(argv[0]);
1305 return CMD_SUCCESS;
1306}
Harald Weltebc814502009-12-19 21:41:52 +01001307
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001308DEFUN(cfg_net_pag_any_tch,
1309 cfg_net_pag_any_tch_cmd,
1310 "paging any use tch (0|1)",
1311 "Assign a TCH when receiving a Paging Any request")
1312{
Holger Hans Peter Freytherb0e88b82010-09-06 10:09:19 +08001313 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001314 gsmnet->pag_any_tch = atoi(argv[0]);
1315 gsm_net_update_ctype(gsmnet);
1316 return CMD_SUCCESS;
1317}
1318
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001319#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001320 DEFUN(cfg_net_T##number, \
1321 cfg_net_T##number##_cmd, \
1322 "timer t" #number " <0-65535>", \
Harald Welte8f0ed552010-05-11 21:53:49 +02001323 "Configure GSM Timers\n" \
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001324 doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001325{ \
Harald Weltedcccb182010-05-16 20:52:23 +02001326 struct gsm_network *gsmnet = gsmnet_from_vty(vty); \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001327 int value = atoi(argv[0]); \
1328 \
1329 if (value < 0 || value > 65535) { \
1330 vty_out(vty, "Timer value %s out of range.%s", \
1331 argv[0], VTY_NEWLINE); \
1332 return CMD_WARNING; \
1333 } \
1334 \
1335 gsmnet->T##number = value; \
1336 return CMD_SUCCESS; \
1337}
1338
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001339DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1340DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1341DECLARE_TIMER(3105, "Currently not used.")
1342DECLARE_TIMER(3107, "Currently not used.")
1343DECLARE_TIMER(3109, "Currently not used.")
Holger Hans Peter Freytherf30c0dc2010-05-31 21:33:15 +08001344DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel.")
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001345DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1346DECLARE_TIMER(3115, "Currently not used.")
1347DECLARE_TIMER(3117, "Currently not used.")
1348DECLARE_TIMER(3119, "Currently not used.")
Harald Welte2862dca2010-12-23 14:39:29 +01001349DECLARE_TIMER(3122, "Waiting time (seconds) after IMM ASS REJECT")
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001350DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001351
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08001352DEFUN(cfg_net_dtx,
1353 cfg_net_dtx_cmd,
1354 "dtx-used (0|1)",
1355 "Enable the usage of DTX.\n"
1356 "DTX is enabled/disabled")
1357{
1358 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1359 gsmnet->dtx_enabled = atoi(argv[0]);
1360 return CMD_SUCCESS;
1361}
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001362
Harald Welte5258fc42009-03-28 19:07:53 +00001363/* per-BTS configuration */
1364DEFUN(cfg_bts,
1365 cfg_bts_cmd,
1366 "bts BTS_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02001367 "Select a BTS to configure\n"
1368 "BTS Number\n")
Harald Welte5258fc42009-03-28 19:07:53 +00001369{
Harald Weltedcccb182010-05-16 20:52:23 +02001370 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte5258fc42009-03-28 19:07:53 +00001371 int bts_nr = atoi(argv[0]);
1372 struct gsm_bts *bts;
1373
Harald Weltee441d9c2009-06-21 16:17:15 +02001374 if (bts_nr > gsmnet->num_bts) {
1375 vty_out(vty, "%% The next unused BTS number is %u%s",
1376 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001377 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001378 } else if (bts_nr == gsmnet->num_bts) {
1379 /* allocate a new one */
1380 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1381 HARDCODED_TSC, HARDCODED_BSIC);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001382 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02001383 bts = gsm_bts_num(gsmnet, bts_nr);
1384
Daniel Willmannf15c2762010-01-11 13:43:07 +01001385 if (!bts) {
1386 vty_out(vty, "%% Unable to allocate BTS %u%s",
1387 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee441d9c2009-06-21 16:17:15 +02001388 return CMD_WARNING;
Daniel Willmannf15c2762010-01-11 13:43:07 +01001389 }
Harald Welte5258fc42009-03-28 19:07:53 +00001390
1391 vty->index = bts;
Harald Welte197dea92010-05-14 17:59:53 +02001392 vty->index_sub = &bts->description;
Harald Welte5258fc42009-03-28 19:07:53 +00001393 vty->node = BTS_NODE;
1394
1395 return CMD_SUCCESS;
1396}
1397
1398DEFUN(cfg_bts_type,
1399 cfg_bts_type_cmd,
1400 "type TYPE",
1401 "Set the BTS type\n")
1402{
1403 struct gsm_bts *bts = vty->index;
Harald Welte39315c42010-01-10 18:01:52 +01001404 int rc;
Harald Welte5258fc42009-03-28 19:07:53 +00001405
Harald Welte39315c42010-01-10 18:01:52 +01001406 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1407 if (rc < 0)
1408 return CMD_WARNING;
Harald Welte8175e952009-10-20 00:22:00 +02001409
Harald Welte5258fc42009-03-28 19:07:53 +00001410 return CMD_SUCCESS;
1411}
1412
Harald Weltefcd24452009-06-20 18:15:19 +02001413DEFUN(cfg_bts_band,
1414 cfg_bts_band_cmd,
1415 "band BAND",
1416 "Set the frequency band of this BTS\n")
1417{
1418 struct gsm_bts *bts = vty->index;
Harald Welte42581822009-08-08 16:12:58 +02001419 int band = gsm_band_parse(argv[0]);
Harald Weltefcd24452009-06-20 18:15:19 +02001420
1421 if (band < 0) {
1422 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1423 band, VTY_NEWLINE);
1424 return CMD_WARNING;
1425 }
1426
1427 bts->band = band;
1428
1429 return CMD_SUCCESS;
1430}
1431
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001432DEFUN(cfg_bts_ci,
1433 cfg_bts_ci_cmd,
1434 "cell_identity <0-65535>",
1435 "Set the Cell identity of this BTS\n")
1436{
1437 struct gsm_bts *bts = vty->index;
1438 int ci = atoi(argv[0]);
1439
1440 if (ci < 0 || ci > 0xffff) {
1441 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1442 ci, VTY_NEWLINE);
1443 return CMD_WARNING;
1444 }
1445 bts->cell_identity = ci;
1446
1447 return CMD_SUCCESS;
1448}
1449
Harald Welte5258fc42009-03-28 19:07:53 +00001450DEFUN(cfg_bts_lac,
1451 cfg_bts_lac_cmd,
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001452 "location_area_code <0-65535>",
Harald Welte5258fc42009-03-28 19:07:53 +00001453 "Set the Location Area Code (LAC) of this BTS\n")
1454{
1455 struct gsm_bts *bts = vty->index;
1456 int lac = atoi(argv[0]);
1457
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001458 if (lac < 0 || lac > 0xffff) {
1459 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte5258fc42009-03-28 19:07:53 +00001460 lac, VTY_NEWLINE);
1461 return CMD_WARNING;
1462 }
Holger Hans Peter Freythere48b9562009-10-01 04:07:15 +02001463
1464 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1465 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1466 lac, VTY_NEWLINE);
1467 return CMD_WARNING;
1468 }
1469
Harald Welte5258fc42009-03-28 19:07:53 +00001470 bts->location_area_code = lac;
1471
1472 return CMD_SUCCESS;
1473}
1474
Harald Weltea43f7892009-12-01 18:04:30 +05301475
Harald Welte5258fc42009-03-28 19:07:53 +00001476DEFUN(cfg_bts_tsc,
1477 cfg_bts_tsc_cmd,
1478 "training_sequence_code <0-255>",
1479 "Set the Training Sequence Code (TSC) of this BTS\n")
1480{
1481 struct gsm_bts *bts = vty->index;
1482 int tsc = atoi(argv[0]);
1483
1484 if (tsc < 0 || tsc > 0xff) {
1485 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1486 tsc, VTY_NEWLINE);
1487 return CMD_WARNING;
1488 }
1489 bts->tsc = tsc;
1490
1491 return CMD_SUCCESS;
1492}
1493
Harald Welte78f2f502009-05-23 16:56:52 +00001494DEFUN(cfg_bts_bsic,
1495 cfg_bts_bsic_cmd,
1496 "base_station_id_code <0-63>",
1497 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1498{
1499 struct gsm_bts *bts = vty->index;
1500 int bsic = atoi(argv[0]);
1501
1502 if (bsic < 0 || bsic > 0x3f) {
Harald Welte42581822009-08-08 16:12:58 +02001503 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte78f2f502009-05-23 16:56:52 +00001504 bsic, VTY_NEWLINE);
1505 return CMD_WARNING;
1506 }
1507 bts->bsic = bsic;
1508
1509 return CMD_SUCCESS;
1510}
1511
1512
Harald Welte4cc34222009-05-01 15:12:31 +00001513DEFUN(cfg_bts_unit_id,
1514 cfg_bts_unit_id_cmd,
Harald Welte07dc73d2009-08-07 13:27:09 +02001515 "ip.access unit_id <0-65534> <0-255>",
1516 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte4cc34222009-05-01 15:12:31 +00001517{
1518 struct gsm_bts *bts = vty->index;
1519 int site_id = atoi(argv[0]);
1520 int bts_id = atoi(argv[1]);
1521
Harald Welte07dc73d2009-08-07 13:27:09 +02001522 if (!is_ipaccess_bts(bts)) {
1523 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1524 return CMD_WARNING;
1525 }
1526
Harald Welte4cc34222009-05-01 15:12:31 +00001527 bts->ip_access.site_id = site_id;
1528 bts->ip_access.bts_id = bts_id;
1529
1530 return CMD_SUCCESS;
1531}
1532
Harald Welte8f0ed552010-05-11 21:53:49 +02001533#define OML_STR "Organization & Maintenance Link\n"
1534#define IPA_STR "ip.access Specific Options\n"
1535
Harald Welte8175e952009-10-20 00:22:00 +02001536DEFUN(cfg_bts_stream_id,
1537 cfg_bts_stream_id_cmd,
1538 "oml ip.access stream_id <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001539 OML_STR IPA_STR
Harald Welte8175e952009-10-20 00:22:00 +02001540 "Set the ip.access Stream ID of the OML link of this BTS\n")
1541{
1542 struct gsm_bts *bts = vty->index;
1543 int stream_id = atoi(argv[0]);
1544
1545 if (!is_ipaccess_bts(bts)) {
1546 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1547 return CMD_WARNING;
1548 }
1549
1550 bts->oml_tei = stream_id;
1551
1552 return CMD_SUCCESS;
1553}
1554
Harald Welte8f0ed552010-05-11 21:53:49 +02001555#define OML_E1_STR OML_STR "E1 Line\n"
Harald Welte8175e952009-10-20 00:22:00 +02001556
Harald Welte42581822009-08-08 16:12:58 +02001557DEFUN(cfg_bts_oml_e1,
1558 cfg_bts_oml_e1_cmd,
1559 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001560 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001561 "E1 interface to be used for OML\n")
1562{
1563 struct gsm_bts *bts = vty->index;
1564
1565 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1566
1567 return CMD_SUCCESS;
1568}
1569
1570
1571DEFUN(cfg_bts_oml_e1_tei,
1572 cfg_bts_oml_e1_tei_cmd,
1573 "oml e1 tei <0-63>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001574 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001575 "Set the TEI to be used for OML")
1576{
1577 struct gsm_bts *bts = vty->index;
1578
1579 bts->oml_tei = atoi(argv[0]);
1580
1581 return CMD_SUCCESS;
1582}
1583
Harald Welte7a8fa412009-08-10 13:48:16 +02001584DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1585 "channel allocator (ascending|descending)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001586 "Channnel Allocator\n" "Channel Allocator\n"
1587 "Allocate Timeslots and Transceivers in ascending order\n"
1588 "Allocate Timeslots and Transceivers in descending order\n")
Harald Welte7a8fa412009-08-10 13:48:16 +02001589{
1590 struct gsm_bts *bts = vty->index;
1591
1592 if (!strcmp(argv[0], "ascending"))
1593 bts->chan_alloc_reverse = 0;
1594 else
1595 bts->chan_alloc_reverse = 1;
1596
1597 return CMD_SUCCESS;
1598}
1599
Harald Welte8f0ed552010-05-11 21:53:49 +02001600#define RACH_STR "Random Access Control Channel\n"
1601
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001602DEFUN(cfg_bts_rach_tx_integer,
1603 cfg_bts_rach_tx_integer_cmd,
1604 "rach tx integer <0-15>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001605 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001606 "Set the raw tx integer value in RACH Control parameters IE")
1607{
1608 struct gsm_bts *bts = vty->index;
1609 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1610 return CMD_SUCCESS;
1611}
1612
1613DEFUN(cfg_bts_rach_max_trans,
1614 cfg_bts_rach_max_trans_cmd,
1615 "rach max transmission (1|2|4|7)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001616 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001617 "Set the maximum number of RACH burst transmissions")
1618{
1619 struct gsm_bts *bts = vty->index;
1620 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1621 return CMD_SUCCESS;
1622}
1623
Harald Welte8f0ed552010-05-11 21:53:49 +02001624#define NM_STR "Network Management\n"
1625
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001626DEFUN(cfg_bts_rach_nm_b_thresh,
1627 cfg_bts_rach_nm_b_thresh_cmd,
1628 "rach nm busy threshold <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001629 RACH_STR NM_STR
1630 "Set the NM Busy Threshold in dB")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001631{
1632 struct gsm_bts *bts = vty->index;
1633 bts->rach_b_thresh = atoi(argv[0]);
1634 return CMD_SUCCESS;
1635}
1636
1637DEFUN(cfg_bts_rach_nm_ldavg,
1638 cfg_bts_rach_nm_ldavg_cmd,
1639 "rach nm load average <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001640 RACH_STR NM_STR
1641 "Set the NM Loadaverage Slots value")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001642{
1643 struct gsm_bts *bts = vty->index;
1644 bts->rach_ldavg_slots = atoi(argv[0]);
1645 return CMD_SUCCESS;
1646}
1647
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001648DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1649 "cell barred (0|1)",
1650 "Should this cell be barred from access?")
1651{
1652 struct gsm_bts *bts = vty->index;
1653
Harald Welte71355012009-12-21 23:08:18 +01001654 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001655
1656 return CMD_SUCCESS;
1657}
1658
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08001659DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd,
1660 "rach emergency call allowed (0|1)",
1661 "Should this cell allow emergency calls?")
1662{
1663 struct gsm_bts *bts = vty->index;
1664
1665 if (atoi(argv[0]) == 0)
1666 bts->si_common.rach_control.t2 |= 0x4;
1667 else
1668 bts->si_common.rach_control.t2 &= ~0x4;
1669
1670 return CMD_SUCCESS;
1671}
1672
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001673DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1674 "ms max power <0-40>",
1675 "Maximum transmit power of the MS")
1676{
1677 struct gsm_bts *bts = vty->index;
1678
1679 bts->ms_max_power = atoi(argv[0]);
1680
1681 return CMD_SUCCESS;
1682}
1683
Harald Welte73225282009-12-12 18:17:25 +01001684DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1685 "cell reselection hysteresis <0-14>",
1686 "Cell Re-Selection Hysteresis in dB")
1687{
1688 struct gsm_bts *bts = vty->index;
1689
1690 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1691
1692 return CMD_SUCCESS;
1693}
1694
1695DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1696 "rxlev access min <0-63>",
1697 "Minimum RxLev needed for cell access (better than -110dBm)")
1698{
1699 struct gsm_bts *bts = vty->index;
1700
1701 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1702
1703 return CMD_SUCCESS;
1704}
1705
Sylvain Munaute0b06b02010-11-28 18:17:28 +01001706DEFUN(cfg_bts_cell_bar_qualify, cfg_bts_cell_bar_qualify_cmd,
1707 "cell bar qualify (0|1)",
1708 "Cell Bar Qualify")
1709{
1710 struct gsm_bts *bts = vty->index;
1711
1712 bts->si_common.cell_ro_sel_par.present = 1;
1713 bts->si_common.cell_ro_sel_par.cbq = atoi(argv[0]);
1714
1715 return CMD_SUCCESS;
1716}
1717
1718DEFUN(cfg_bts_cell_resel_ofs, cfg_bts_cell_resel_ofs_cmd,
1719 "cell reselection offset <0-126>",
1720 "Cell Re-Selection Offset in dB")
1721{
1722 struct gsm_bts *bts = vty->index;
1723
1724 bts->si_common.cell_ro_sel_par.present = 1;
1725 bts->si_common.cell_ro_sel_par.cell_resel_off = atoi(argv[0])/2;
1726
1727 return CMD_SUCCESS;
1728}
1729
1730DEFUN(cfg_bts_temp_ofs, cfg_bts_temp_ofs_cmd,
1731 "temporary offset <0-60>",
1732 "Cell selection temporary negative offset in dB")
1733{
1734 struct gsm_bts *bts = vty->index;
1735
1736 bts->si_common.cell_ro_sel_par.present = 1;
1737 bts->si_common.cell_ro_sel_par.temp_offs = atoi(argv[0])/10;
1738
1739 return CMD_SUCCESS;
1740}
1741
1742DEFUN(cfg_bts_temp_ofs_inf, cfg_bts_temp_ofs_inf_cmd,
1743 "temporary offset infinite",
1744 "Sets cell selection temporary negative offset to infinity")
1745{
1746 struct gsm_bts *bts = vty->index;
1747
1748 bts->si_common.cell_ro_sel_par.present = 1;
1749 bts->si_common.cell_ro_sel_par.temp_offs = 7;
1750
1751 return CMD_SUCCESS;
1752}
1753
1754DEFUN(cfg_bts_penalty_time, cfg_bts_penalty_time_cmd,
1755 "penalty time <20-620>",
1756 "Cell selection penalty time in seconds (by 20s increments)")
1757{
1758 struct gsm_bts *bts = vty->index;
1759
1760 bts->si_common.cell_ro_sel_par.present = 1;
1761 bts->si_common.cell_ro_sel_par.penalty_time = (atoi(argv[0])-20)/20;
1762
1763 return CMD_SUCCESS;
1764}
1765
1766DEFUN(cfg_bts_penalty_time_rsvd, cfg_bts_penalty_time_rsvd_cmd,
1767 "penalty time reserved",
1768 "Set cell selection penalty time to reserved value 31\n"
1769 "(indicate that CELL_RESELECT_OFFSET is subtracted from C2 "
1770 "and TEMPORARY_OFFSET is ignored)")
1771{
1772 struct gsm_bts *bts = vty->index;
1773
1774 bts->si_common.cell_ro_sel_par.present = 1;
1775 bts->si_common.cell_ro_sel_par.penalty_time = 31;
1776
1777 return CMD_SUCCESS;
1778}
1779
Harald Welte (local)efc92312009-08-14 23:09:25 +02001780DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1781 "periodic location update <0-1530>",
1782 "Periodic Location Updating Interval in Minutes")
1783{
1784 struct gsm_bts *bts = vty->index;
1785
Dieter Spaard6613e02010-10-05 21:10:55 +02001786 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 6;
Harald Welte (local)efc92312009-08-14 23:09:25 +02001787
1788 return CMD_SUCCESS;
1789}
1790
Harald Welte8f0ed552010-05-11 21:53:49 +02001791#define GPRS_TEXT "GPRS Packet Network\n"
1792
Harald Welteaf387632010-03-14 23:30:30 +08001793DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welte57ba7e32010-04-18 14:00:26 +02001794 "gprs cell bvci <2-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001795 GPRS_TEXT
1796 "GPRS Cell Settings\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001797 "GPRS BSSGP VC Identifier")
1798{
1799 struct gsm_bts *bts = vty->index;
1800
Harald Welte4511d892010-04-18 15:51:20 +02001801 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001802 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1803 return CMD_WARNING;
1804 }
1805
Harald Welte97a282b2010-03-14 15:37:43 +08001806 bts->gprs.cell.bvci = atoi(argv[0]);
1807
1808 return CMD_SUCCESS;
1809}
1810
Harald Weltea5731cf2010-03-22 11:48:36 +08001811DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
1812 "gprs nsei <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001813 GPRS_TEXT
Harald Weltea5731cf2010-03-22 11:48:36 +08001814 "GPRS NS Entity Identifier")
1815{
1816 struct gsm_bts *bts = vty->index;
1817
Harald Welte4511d892010-04-18 15:51:20 +02001818 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltea5731cf2010-03-22 11:48:36 +08001819 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1820 return CMD_WARNING;
1821 }
1822
1823 bts->gprs.nse.nsei = atoi(argv[0]);
1824
1825 return CMD_SUCCESS;
1826}
1827
Harald Welte8f0ed552010-05-11 21:53:49 +02001828#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
1829 "NSVC Logical Number\n"
Harald Weltea5731cf2010-03-22 11:48:36 +08001830
Harald Welte97a282b2010-03-14 15:37:43 +08001831DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
1832 "gprs nsvc <0-1> nsvci <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001833 GPRS_TEXT NSVC_TEXT
1834 "NS Virtual Connection Identifier\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001835 "GPRS NS VC Identifier")
1836{
1837 struct gsm_bts *bts = vty->index;
1838 int idx = atoi(argv[0]);
1839
Harald Welte4511d892010-04-18 15:51:20 +02001840 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001841 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1842 return CMD_WARNING;
1843 }
1844
Harald Welte97a282b2010-03-14 15:37:43 +08001845 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
1846
1847 return CMD_SUCCESS;
1848}
1849
Harald Welteaf387632010-03-14 23:30:30 +08001850DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
1851 "gprs nsvc <0-1> local udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001852 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001853 "GPRS NS Local UDP Port")
1854{
1855 struct gsm_bts *bts = vty->index;
1856 int idx = atoi(argv[0]);
1857
Harald Welte4511d892010-04-18 15:51:20 +02001858 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001859 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1860 return CMD_WARNING;
1861 }
1862
Harald Welteaf387632010-03-14 23:30:30 +08001863 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
1864
1865 return CMD_SUCCESS;
1866}
1867
1868DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
1869 "gprs nsvc <0-1> remote udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001870 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001871 "GPRS NS Remote UDP Port")
1872{
1873 struct gsm_bts *bts = vty->index;
1874 int idx = atoi(argv[0]);
1875
Harald Welte4511d892010-04-18 15:51:20 +02001876 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001877 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1878 return CMD_WARNING;
1879 }
1880
Harald Welteaf387632010-03-14 23:30:30 +08001881 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
1882
1883 return CMD_SUCCESS;
1884}
1885
1886DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
1887 "gprs nsvc <0-1> remote ip A.B.C.D",
Harald Welte8f0ed552010-05-11 21:53:49 +02001888 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001889 "GPRS NS Remote IP Address")
1890{
1891 struct gsm_bts *bts = vty->index;
1892 int idx = atoi(argv[0]);
1893 struct in_addr ia;
1894
Harald Welte4511d892010-04-18 15:51:20 +02001895 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001896 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1897 return CMD_WARNING;
1898 }
1899
Harald Welteaf387632010-03-14 23:30:30 +08001900 inet_aton(argv[1], &ia);
1901 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
1902
1903 return CMD_SUCCESS;
1904}
1905
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08001906DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd,
1907 "paging free FREE_NR",
1908 "Only page when having a certain amount of free slots. -1 to disable")
1909{
1910 struct gsm_bts *bts = vty->index;
1911
1912 bts->paging.free_chans_need = atoi(argv[0]);
1913 return CMD_SUCCESS;
1914}
1915
Harald Welte615e9562010-05-11 23:50:21 +02001916DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd,
1917 "gprs ns timer " NS_TIMERS " <0-255>",
1918 GPRS_TEXT "Network Service\n"
1919 "Network Service Timer\n"
1920 NS_TIMERS_HELP "Timer Value\n")
1921{
1922 struct gsm_bts *bts = vty->index;
1923 int idx = get_string_value(gprs_ns_timer_strs, argv[0]);
1924 int val = atoi(argv[1]);
1925
1926 if (bts->gprs.mode == BTS_GPRS_NONE) {
1927 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1928 return CMD_WARNING;
1929 }
1930
1931 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
1932 return CMD_WARNING;
1933
1934 bts->gprs.nse.timer[idx] = val;
1935
1936 return CMD_SUCCESS;
1937}
1938
1939#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 +02001940#define BSSGP_TIMERS_HELP \
1941 "Tbvc-block timeout\n" \
1942 "Tbvc-block retries\n" \
1943 "Tbvc-unblock retries\n" \
1944 "Tbvcc-reset timeout\n" \
1945 "Tbvc-reset retries\n" \
1946 "Tbvc-suspend timeout\n" \
1947 "Tbvc-suspend retries\n" \
1948 "Tbvc-resume timeout\n" \
1949 "Tbvc-resume retries\n" \
1950 "Tbvc-capa-update timeout\n" \
1951 "Tbvc-capa-update retries\n"
Harald Welte615e9562010-05-11 23:50:21 +02001952
1953DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd,
1954 "gprs cell timer " BSSGP_TIMERS " <0-255>",
1955 GPRS_TEXT "Cell / BSSGP\n"
1956 "Cell/BSSGP Timer\n"
1957 BSSGP_TIMERS_HELP "Timer Value\n")
1958{
1959 struct gsm_bts *bts = vty->index;
1960 int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
1961 int val = atoi(argv[1]);
1962
1963 if (bts->gprs.mode == BTS_GPRS_NONE) {
1964 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1965 return CMD_WARNING;
1966 }
1967
1968 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer))
1969 return CMD_WARNING;
1970
1971 bts->gprs.cell.timer[idx] = val;
1972
1973 return CMD_SUCCESS;
1974}
1975
Harald Welte97a282b2010-03-14 15:37:43 +08001976DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
1977 "gprs routing area <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001978 GPRS_TEXT
Harald Welte97a282b2010-03-14 15:37:43 +08001979 "GPRS Routing Area Code")
1980{
1981 struct gsm_bts *bts = vty->index;
1982
Harald Welte4511d892010-04-18 15:51:20 +02001983 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001984 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1985 return CMD_WARNING;
1986 }
1987
Harald Welte97a282b2010-03-14 15:37:43 +08001988 bts->gprs.rac = atoi(argv[0]);
1989
1990 return CMD_SUCCESS;
1991}
1992
Harald Welte4511d892010-04-18 15:51:20 +02001993DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
1994 "gprs mode (none|gprs|egprs)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001995 GPRS_TEXT
1996 "GPRS Mode for this BTS\n"
1997 "GPRS Disabled on this BTS\n"
1998 "GPRS Enabled on this BTS\n"
1999 "EGPRS (EDGE) Enabled on this BTS\n")
Harald Welteaf387632010-03-14 23:30:30 +08002000{
2001 struct gsm_bts *bts = vty->index;
Harald Weltef3d8e922010-06-14 22:44:42 +02002002 enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0]);
Harald Welteaf387632010-03-14 23:30:30 +08002003
Harald Weltef3d8e922010-06-14 22:44:42 +02002004 if (mode != BTS_GPRS_NONE &&
2005 !gsm_bts_has_feature(bts, BTS_FEAT_GPRS)) {
2006 vty_out(vty, "This BTS type does not support %s%s", argv[0],
2007 VTY_NEWLINE);
2008 return CMD_WARNING;
2009 }
2010 if (mode == BTS_GPRS_EGPRS &&
2011 !gsm_bts_has_feature(bts, BTS_FEAT_EGPRS)) {
2012 vty_out(vty, "This BTS type does not support %s%s", argv[0],
2013 VTY_NEWLINE);
2014 return CMD_WARNING;
2015 }
2016
2017 bts->gprs.mode = mode;
Harald Welteaf387632010-03-14 23:30:30 +08002018
2019 return CMD_SUCCESS;
2020}
2021
Harald Welte9fbff4a2010-07-30 11:50:09 +02002022#define SI_TEXT "System Information Messages\n"
2023#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)"
2024#define SI_TYPE_HELP "System Information Type 1\n" \
2025 "System Information Type 2\n" \
2026 "System Information Type 3\n" \
2027 "System Information Type 4\n" \
2028 "System Information Type 5\n" \
2029 "System Information Type 6\n" \
2030 "System Information Type 7\n" \
2031 "System Information Type 8\n" \
2032 "System Information Type 9\n" \
2033 "System Information Type 10\n" \
2034 "System Information Type 13\n" \
2035 "System Information Type 16\n" \
2036 "System Information Type 17\n" \
2037 "System Information Type 18\n" \
2038 "System Information Type 19\n" \
2039 "System Information Type 20\n" \
2040 "System Information Type 2bis\n" \
2041 "System Information Type 2ter\n" \
2042 "System Information Type 2quater\n" \
2043 "System Information Type 5bis\n" \
2044 "System Information Type 5ter\n"
2045
2046DEFUN(cfg_bts_si_mode, cfg_bts_si_mode_cmd,
2047 "system-information " SI_TYPE_TEXT " mode (static|computed)",
2048 SI_TEXT SI_TYPE_HELP
2049 "System Information Mode\n"
2050 "Static user-specified\n"
2051 "Dynamic, BSC-computed\n")
2052{
2053 struct gsm_bts *bts = vty->index;
2054 int type;
2055
2056 type = get_string_value(osmo_sitype_strs, argv[0]);
2057 if (type < 0) {
2058 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2059 return CMD_WARNING;
2060 }
2061
2062 if (!strcmp(argv[1], "static"))
2063 bts->si_mode_static |= (1 << type);
2064 else
2065 bts->si_mode_static &= ~(1 << type);
2066
2067 return CMD_SUCCESS;
2068}
2069
2070DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd,
2071 "system-information " SI_TYPE_TEXT " static HEXSTRING",
2072 SI_TEXT SI_TYPE_HELP
2073 "Static System Information filling\n"
2074 "Static user-specified SI content in HEX notation\n")
2075{
2076 struct gsm_bts *bts = vty->index;
2077 int rc, type;
2078
2079 type = get_string_value(osmo_sitype_strs, argv[0]);
2080 if (type < 0) {
2081 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2082 return CMD_WARNING;
2083 }
2084
2085 if (!(bts->si_mode_static & (1 << type))) {
2086 vty_out(vty, "SI Type %s is not configured in static mode%s",
2087 get_value_string(osmo_sitype_strs, type), VTY_NEWLINE);
2088 return CMD_WARNING;
2089 }
2090
Harald Welte290aaed2010-07-30 11:53:18 +02002091 /* Fill buffer with padding pattern */
2092 memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type]));
2093
2094 /* Parse the user-specified SI in hex format, [partially] overwriting padding */
Harald Welte9fbff4a2010-07-30 11:50:09 +02002095 rc = hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0]));
2096 if (rc < 0 || rc > sizeof(bts->si_buf[0])) {
2097 vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
2098 return CMD_WARNING;
2099 }
2100
2101 /* Mark this SI as present */
2102 bts->si_valid |= (1 << type);
2103
2104 return CMD_SUCCESS;
2105}
2106
2107
Harald Welte8f0ed552010-05-11 21:53:49 +02002108#define TRX_TEXT "Radio Transceiver\n"
Harald Welte7a8fa412009-08-10 13:48:16 +02002109
Harald Welte5258fc42009-03-28 19:07:53 +00002110/* per TRX configuration */
2111DEFUN(cfg_trx,
2112 cfg_trx_cmd,
2113 "trx TRX_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02002114 TRX_TEXT
Harald Welte5258fc42009-03-28 19:07:53 +00002115 "Select a TRX to configure")
2116{
2117 int trx_nr = atoi(argv[0]);
2118 struct gsm_bts *bts = vty->index;
2119 struct gsm_bts_trx *trx;
2120
Harald Weltee441d9c2009-06-21 16:17:15 +02002121 if (trx_nr > bts->num_trx) {
2122 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
2123 bts->num_trx, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00002124 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02002125 } else if (trx_nr == bts->num_trx) {
2126 /* we need to allocate a new one */
2127 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02002128 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02002129 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02002130
Harald Weltee441d9c2009-06-21 16:17:15 +02002131 if (!trx)
2132 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +00002133
2134 vty->index = trx;
Harald Welte197dea92010-05-14 17:59:53 +02002135 vty->index_sub = &trx->description;
Harald Welte5258fc42009-03-28 19:07:53 +00002136 vty->node = TRX_NODE;
2137
2138 return CMD_SUCCESS;
2139}
2140
2141DEFUN(cfg_trx_arfcn,
2142 cfg_trx_arfcn_cmd,
Harald Welte93e90202010-05-14 19:00:52 +02002143 "arfcn <0-1024>",
Harald Welte5258fc42009-03-28 19:07:53 +00002144 "Set the ARFCN for this TRX\n")
2145{
2146 int arfcn = atoi(argv[0]);
2147 struct gsm_bts_trx *trx = vty->index;
2148
2149 /* FIXME: check if this ARFCN is supported by this TRX */
2150
2151 trx->arfcn = arfcn;
2152
2153 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
2154 /* FIXME: use OML layer to update the ARFCN */
2155 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
2156
2157 return CMD_SUCCESS;
2158}
2159
Harald Welte (local)7b37d972009-12-27 20:56:38 +01002160DEFUN(cfg_trx_nominal_power,
2161 cfg_trx_nominal_power_cmd,
2162 "nominal power <0-100>",
2163 "Nominal TRX RF Power in dB\n")
2164{
2165 struct gsm_bts_trx *trx = vty->index;
2166
2167 trx->nominal_power = atoi(argv[0]);
2168
2169 return CMD_SUCCESS;
2170}
2171
Harald Weltefcd24452009-06-20 18:15:19 +02002172DEFUN(cfg_trx_max_power_red,
2173 cfg_trx_max_power_red_cmd,
2174 "max_power_red <0-100>",
2175 "Reduction of maximum BS RF Power in dB\n")
2176{
2177 int maxpwr_r = atoi(argv[0]);
2178 struct gsm_bts_trx *trx = vty->index;
Harald Welte61a83b22009-11-18 09:20:22 +01002179 int upper_limit = 24; /* default 12.21 max power red. */
Harald Weltefcd24452009-06-20 18:15:19 +02002180
2181 /* FIXME: check if our BTS type supports more than 12 */
2182 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
2183 vty_out(vty, "%% Power %d dB is not in the valid range%s",
2184 maxpwr_r, VTY_NEWLINE);
2185 return CMD_WARNING;
2186 }
2187 if (maxpwr_r & 1) {
2188 vty_out(vty, "%% Power %d dB is not an even value%s",
2189 maxpwr_r, VTY_NEWLINE);
2190 return CMD_WARNING;
2191 }
2192
2193 trx->max_power_red = maxpwr_r;
2194
2195 /* FIXME: make sure we update this using OML */
2196
2197 return CMD_SUCCESS;
2198}
2199
Harald Welte42581822009-08-08 16:12:58 +02002200DEFUN(cfg_trx_rsl_e1,
2201 cfg_trx_rsl_e1_cmd,
2202 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
2203 "E1 interface to be used for RSL\n")
2204{
2205 struct gsm_bts_trx *trx = vty->index;
2206
2207 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
2208
2209 return CMD_SUCCESS;
2210}
2211
2212DEFUN(cfg_trx_rsl_e1_tei,
2213 cfg_trx_rsl_e1_tei_cmd,
2214 "rsl e1 tei <0-63>",
2215 "Set the TEI to be used for RSL")
2216{
2217 struct gsm_bts_trx *trx = vty->index;
2218
2219 trx->rsl_tei = atoi(argv[0]);
2220
2221 return CMD_SUCCESS;
2222}
2223
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01002224DEFUN(cfg_trx_rf_locked,
2225 cfg_trx_rf_locked_cmd,
2226 "rf_locked (0|1)",
2227 "Turn off RF of the TRX.\n")
2228{
2229 int locked = atoi(argv[0]);
2230 struct gsm_bts_trx *trx = vty->index;
2231
2232 gsm_trx_lock_rf(trx, locked);
2233 return CMD_SUCCESS;
2234}
Harald Welte42581822009-08-08 16:12:58 +02002235
Harald Welte5258fc42009-03-28 19:07:53 +00002236/* per TS configuration */
2237DEFUN(cfg_ts,
2238 cfg_ts_cmd,
Harald Welte42581822009-08-08 16:12:58 +02002239 "timeslot <0-7>",
Harald Welte5258fc42009-03-28 19:07:53 +00002240 "Select a Timeslot to configure")
2241{
2242 int ts_nr = atoi(argv[0]);
2243 struct gsm_bts_trx *trx = vty->index;
2244 struct gsm_bts_trx_ts *ts;
2245
2246 if (ts_nr >= TRX_NR_TS) {
2247 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
2248 TRX_NR_TS, VTY_NEWLINE);
2249 return CMD_WARNING;
2250 }
2251
2252 ts = &trx->ts[ts_nr];
2253
2254 vty->index = ts;
2255 vty->node = TS_NODE;
2256
2257 return CMD_SUCCESS;
2258}
2259
Harald Weltea6fd58e2009-08-07 00:25:23 +02002260DEFUN(cfg_ts_pchan,
2261 cfg_ts_pchan_cmd,
2262 "phys_chan_config PCHAN",
2263 "Physical Channel configuration (TCH/SDCCH/...)")
2264{
2265 struct gsm_bts_trx_ts *ts = vty->index;
2266 int pchanc;
2267
2268 pchanc = gsm_pchan_parse(argv[0]);
2269 if (pchanc < 0)
2270 return CMD_WARNING;
2271
2272 ts->pchan = pchanc;
2273
2274 return CMD_SUCCESS;
2275}
2276
Harald Weltea39b0f22010-06-14 22:26:10 +02002277#define HOPPING_STR "Configure frequency hopping\n"
2278
2279DEFUN(cfg_ts_hopping,
2280 cfg_ts_hopping_cmd,
2281 "hopping enabled (0|1)",
2282 HOPPING_STR "Enable or disable frequency hopping\n"
2283 "Disable frequency hopping\n" "Enable frequency hopping\n")
2284{
2285 struct gsm_bts_trx_ts *ts = vty->index;
Harald Weltec2fb3d02010-06-14 22:47:37 +02002286 int enabled = atoi(argv[0]);
Harald Weltea39b0f22010-06-14 22:26:10 +02002287
Harald Weltec2fb3d02010-06-14 22:47:37 +02002288 if (enabled && !gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_HOPPING)) {
2289 vty_out(vty, "BTS model does not support hopping%s",
2290 VTY_NEWLINE);
2291 return CMD_WARNING;
2292 }
2293
2294 ts->hopping.enabled = enabled;
Harald Weltea39b0f22010-06-14 22:26:10 +02002295
2296 return CMD_SUCCESS;
2297}
2298
Harald Welte6e0cd042009-09-12 13:05:33 +02002299DEFUN(cfg_ts_hsn,
2300 cfg_ts_hsn_cmd,
Harald Weltea39b0f22010-06-14 22:26:10 +02002301 "hopping sequence-number <0-63>",
2302 HOPPING_STR
Harald Welte6e0cd042009-09-12 13:05:33 +02002303 "Which hopping sequence to use for this channel")
2304{
2305 struct gsm_bts_trx_ts *ts = vty->index;
2306
2307 ts->hopping.hsn = atoi(argv[0]);
2308
2309 return CMD_SUCCESS;
2310}
2311
2312DEFUN(cfg_ts_maio,
2313 cfg_ts_maio_cmd,
2314 "hopping maio <0-63>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002315 HOPPING_STR
Harald Welte6e0cd042009-09-12 13:05:33 +02002316 "Which hopping MAIO to use for this channel")
2317{
2318 struct gsm_bts_trx_ts *ts = vty->index;
2319
2320 ts->hopping.maio = atoi(argv[0]);
2321
2322 return CMD_SUCCESS;
2323}
2324
2325DEFUN(cfg_ts_arfcn_add,
2326 cfg_ts_arfcn_add_cmd,
2327 "hopping arfcn add <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002328 HOPPING_STR "Configure hopping ARFCN list\n"
2329 "Add an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02002330{
2331 struct gsm_bts_trx_ts *ts = vty->index;
2332 int arfcn = atoi(argv[0]);
2333
Harald Weltea39b0f22010-06-14 22:26:10 +02002334 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1);
2335
Harald Welte6e0cd042009-09-12 13:05:33 +02002336 return CMD_SUCCESS;
2337}
2338
2339DEFUN(cfg_ts_arfcn_del,
2340 cfg_ts_arfcn_del_cmd,
2341 "hopping arfcn del <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002342 HOPPING_STR "Configure hopping ARFCN list\n"
2343 "Delete an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02002344{
2345 struct gsm_bts_trx_ts *ts = vty->index;
2346 int arfcn = atoi(argv[0]);
2347
Harald Weltea39b0f22010-06-14 22:26:10 +02002348 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0);
2349
Harald Welte6e0cd042009-09-12 13:05:33 +02002350 return CMD_SUCCESS;
2351}
2352
Harald Weltea6fd58e2009-08-07 00:25:23 +02002353DEFUN(cfg_ts_e1_subslot,
2354 cfg_ts_e1_subslot_cmd,
Harald Welte42581822009-08-08 16:12:58 +02002355 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltea6fd58e2009-08-07 00:25:23 +02002356 "E1 sub-slot connected to this on-air timeslot")
2357{
2358 struct gsm_bts_trx_ts *ts = vty->index;
2359
Harald Welte42581822009-08-08 16:12:58 +02002360 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002361
2362 return CMD_SUCCESS;
2363}
Harald Welte5258fc42009-03-28 19:07:53 +00002364
Harald Welte4f10c252010-05-16 21:47:13 +02002365void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
2366{
2367 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
2368 counter_get(net->stats.chreq.total),
2369 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
2370 vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
2371 counter_get(net->stats.chan.rf_fail),
2372 counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
2373 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
2374 counter_get(net->stats.paging.attempted),
2375 counter_get(net->stats.paging.completed),
2376 counter_get(net->stats.paging.expired), VTY_NEWLINE);
2377 vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
2378 counter_get(net->stats.bts.oml_fail),
2379 counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
2380}
2381
Harald Welte5bc61dc2010-05-16 22:02:16 +02002382DEFUN(logging_fltr_imsi,
2383 logging_fltr_imsi_cmd,
2384 "logging filter imsi IMSI",
2385 LOGGING_STR FILTER_STR
2386 "Filter log messages by IMSI\n" "IMSI to be used as filter\n")
2387{
2388 struct telnet_connection *conn;
2389
2390 conn = (struct telnet_connection *) vty->priv;
2391 if (!conn->dbg) {
2392 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
2393 return CMD_WARNING;
2394 }
2395
2396 log_set_imsi_filter(conn->dbg, argv[0]);
2397 return CMD_SUCCESS;
2398}
2399
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002400DEFUN(drop_bts,
2401 drop_bts_cmd,
Holger Hans Peter Freyther0586b0f2010-04-11 12:46:45 +02002402 "drop bts connection <0-65535> (oml|rsl)",
2403 "Debug/Simulation command to drop ipaccess BTS\n"
2404 "BTS NR\n" "Connection Type\n")
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002405{
2406 struct gsm_network *gsmnet;
2407 struct gsm_bts_trx *trx;
2408 struct gsm_bts *bts;
2409 unsigned int bts_nr;
2410
2411 gsmnet = gsmnet_from_vty(vty);
2412
2413 bts_nr = atoi(argv[0]);
2414 if (bts_nr >= gsmnet->num_bts) {
2415 vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s",
2416 gsmnet->num_bts, bts_nr, VTY_NEWLINE);
2417 return CMD_WARNING;
2418 }
2419
2420 bts = gsm_bts_num(gsmnet, bts_nr);
2421 if (!bts) {
2422 vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE);
2423 return CMD_WARNING;
2424 }
2425
2426 if (!is_ipaccess_bts(bts)) {
2427 vty_out(vty, "This command only works for ipaccess.%s", VTY_NEWLINE);
2428 return CMD_WARNING;
2429 }
2430
2431
2432 /* close all connections */
2433 if (strcmp(argv[1], "oml") == 0) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01002434 ipaccess_drop_oml(bts);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002435 } else if (strcmp(argv[1], "rsl") == 0) {
2436 /* close all rsl connections */
2437 llist_for_each_entry(trx, &bts->trx_list, list) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01002438 ipaccess_drop_rsl(trx);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002439 }
2440 } else {
2441 vty_out(vty, "Argument must be 'oml# or 'rsl'.%s", VTY_NEWLINE);
2442 return CMD_WARNING;
2443 }
2444
2445 return CMD_SUCCESS;
2446}
2447
Harald Welted0d2b0b2010-12-23 13:18:07 +01002448DEFUN(pdch_act, pdch_act_cmd,
2449 "bts <0-255> trx <0-255> timeslot <0-7> pdch (activate|deactivate)",
2450 "BTS related commands\n" "BTS Number\n" "Transceiver\n" "Transceiver Number\n"
2451 "TRX Timeslot\n" "Timeslot Number\n" "Packet Data Channel\n"
2452 "Activate Dynamic PDCH/TCH (-> PDCH mode)\n"
2453 "Deactivate Dynamic PDCH/TCH (-> TCH mode)\n")
2454{
2455 struct gsm_bts *bts;
2456 struct gsm_bts_trx *trx;
2457 struct gsm_bts_trx_ts *ts;
2458 int bts_nr = atoi(argv[0]);
2459 int trx_nr = atoi(argv[1]);
2460 int ts_nr = atoi(argv[2]);
2461 int activate;
2462
2463 bts = gsm_bts_num(bsc_gsmnet, bts_nr);
2464 if (!bts) {
2465 vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE);
2466 return CMD_WARNING;
2467 }
2468
2469 if (!is_ipaccess_bts(bts)) {
2470 vty_out(vty, "%% This command only works for ipaccess BTS%s",
2471 VTY_NEWLINE);
2472 return CMD_WARNING;
2473 }
2474
2475 trx = gsm_bts_trx_num(bts, trx_nr);
2476 if (!trx) {
2477 vty_out(vty, "%% No such TRX (%d)%s", trx_nr, VTY_NEWLINE);
2478 return CMD_WARNING;
2479 }
2480
2481 ts = &trx->ts[ts_nr];
2482 if (ts->pchan != GSM_PCHAN_TCH_F_PDCH) {
2483 vty_out(vty, "%% Timeslot %u is not in dynamic TCH_F/PDCH "
2484 "mode%s", ts_nr, VTY_NEWLINE);
2485 return CMD_WARNING;
2486 }
2487
2488 if (!strcmp(argv[3], "activate"))
2489 activate = 1;
2490 else
2491 activate = 0;
2492
2493 rsl_ipacc_pdch_activate(ts, activate);
2494
2495 return CMD_SUCCESS;
2496
2497}
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002498
Harald Weltedcccb182010-05-16 20:52:23 +02002499extern int bsc_vty_init_extra(void);
Harald Welte1353f962010-05-16 19:20:24 +02002500extern const char *openbsc_copyright;
Holger Hans Peter Freythere1ffc082010-04-10 00:08:28 +02002501
Harald Weltedcccb182010-05-16 20:52:23 +02002502int bsc_vty_init(void)
Harald Welte68628e82009-03-10 12:17:57 +00002503{
Harald Welteb4d5b172010-05-12 16:10:35 +00002504 install_element_ve(&show_net_cmd);
2505 install_element_ve(&show_bts_cmd);
2506 install_element_ve(&show_trx_cmd);
2507 install_element_ve(&show_ts_cmd);
2508 install_element_ve(&show_lchan_cmd);
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08002509 install_element_ve(&show_lchan_summary_cmd);
Harald Welte5bc61dc2010-05-16 22:02:16 +02002510 install_element_ve(&logging_fltr_imsi_cmd);
Harald Welte1bc77352009-03-10 19:47:51 +00002511
Harald Welteb4d5b172010-05-12 16:10:35 +00002512 install_element_ve(&show_e1drv_cmd);
2513 install_element_ve(&show_e1line_cmd);
2514 install_element_ve(&show_e1ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002515
Harald Welteb4d5b172010-05-12 16:10:35 +00002516 install_element_ve(&show_paging_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002517
Harald Welte5bc61dc2010-05-16 22:02:16 +02002518 logging_vty_add_cmds();
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +01002519
Harald Welte5013b2a2009-08-07 13:29:14 +02002520 install_element(CONFIG_NODE, &cfg_net_cmd);
2521 install_node(&net_node, config_write_net);
2522 install_default(GSMNET_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002523 install_element(GSMNET_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002524 install_element(GSMNET_NODE, &ournode_end_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002525 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002526 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
2527 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
2528 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)69de3972009-08-12 14:42:23 +02002529 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte1085c092009-11-18 20:33:19 +01002530 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Welte4381cfe2009-08-30 15:47:06 +09002531 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01002532 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welteeab84a12009-12-13 10:53:12 +01002533 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte3d23db42009-12-14 17:49:15 +01002534 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Weltebc814502009-12-19 21:41:52 +01002535 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Welteb720bd32009-12-21 16:51:50 +01002536 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
2537 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
2538 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
2539 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
2540 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
2541 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01002542 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01002543 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
2544 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
2545 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
2546 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
2547 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
2548 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
2549 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
2550 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
2551 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
Harald Weltec9f499f2010-12-23 22:53:50 +01002552 install_element(GSMNET_NODE, &cfg_net_T3122_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01002553 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08002554 install_element(GSMNET_NODE, &cfg_net_dtx_cmd);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08002555 install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002556
2557 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte67ce0732009-08-06 19:06:46 +02002558 install_node(&bts_node, config_write_bts);
Harald Welte68628e82009-03-10 12:17:57 +00002559 install_default(BTS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002560 install_element(BTS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002561 install_element(BTS_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002562 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002563 install_element(BTS_NODE, &cfg_description_cmd);
2564 install_element(BTS_NODE, &cfg_no_description_cmd);
Harald Weltefcd24452009-06-20 18:15:19 +02002565 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02002566 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002567 install_element(BTS_NODE, &cfg_bts_lac_cmd);
2568 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002569 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte4cc34222009-05-01 15:12:31 +00002570 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte8175e952009-10-20 00:22:00 +02002571 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002572 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
2573 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02002574 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01002575 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
2576 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08002577 install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd);
2578 install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02002579 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08002580 install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd);
Harald Welte (local)0e451d02009-08-13 10:14:26 +02002581 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)efc92312009-08-14 23:09:25 +02002582 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welte73225282009-12-12 18:17:25 +01002583 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
2584 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002585 install_element(BTS_NODE, &cfg_bts_cell_bar_qualify_cmd);
2586 install_element(BTS_NODE, &cfg_bts_cell_resel_ofs_cmd);
2587 install_element(BTS_NODE, &cfg_bts_temp_ofs_cmd);
2588 install_element(BTS_NODE, &cfg_bts_temp_ofs_inf_cmd);
2589 install_element(BTS_NODE, &cfg_bts_penalty_time_cmd);
2590 install_element(BTS_NODE, &cfg_bts_penalty_time_rsvd_cmd);
Harald Welte4511d892010-04-18 15:51:20 +02002591 install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002592 install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002593 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
2594 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002595 install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
Harald Weltea5731cf2010-03-22 11:48:36 +08002596 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002597 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welteaf387632010-03-14 23:30:30 +08002598 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
2599 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
2600 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08002601 install_element(BTS_NODE, &cfg_bts_pag_free_cmd);
Harald Welte9fbff4a2010-07-30 11:50:09 +02002602 install_element(BTS_NODE, &cfg_bts_si_mode_cmd);
2603 install_element(BTS_NODE, &cfg_bts_si_static_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002604
Harald Welte5258fc42009-03-28 19:07:53 +00002605 install_element(BTS_NODE, &cfg_trx_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002606 install_node(&trx_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002607 install_default(TRX_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002608 install_element(TRX_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002609 install_element(TRX_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002610 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002611 install_element(TRX_NODE, &cfg_description_cmd);
2612 install_element(TRX_NODE, &cfg_no_description_cmd);
Harald Welte (local)7b37d972009-12-27 20:56:38 +01002613 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte879dc972009-06-20 22:36:12 +02002614 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002615 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
2616 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01002617 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002618
Harald Welte5258fc42009-03-28 19:07:53 +00002619 install_element(TRX_NODE, &cfg_ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002620 install_node(&ts_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002621 install_default(TS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002622 install_element(TS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002623 install_element(TS_NODE, &ournode_end_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002624 install_element(TS_NODE, &cfg_ts_pchan_cmd);
Harald Weltea39b0f22010-06-14 22:26:10 +02002625 install_element(TS_NODE, &cfg_ts_hopping_cmd);
Harald Welte6e0cd042009-09-12 13:05:33 +02002626 install_element(TS_NODE, &cfg_ts_hsn_cmd);
2627 install_element(TS_NODE, &cfg_ts_maio_cmd);
2628 install_element(TS_NODE, &cfg_ts_arfcn_add_cmd);
2629 install_element(TS_NODE, &cfg_ts_arfcn_del_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002630 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002631
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002632 install_element(ENABLE_NODE, &drop_bts_cmd);
Harald Welted0d2b0b2010-12-23 13:18:07 +01002633 install_element(ENABLE_NODE, &pdch_act_cmd);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002634
Harald Welte81c9b9c2010-05-31 16:40:40 +02002635 abis_nm_vty_init();
2636
Harald Weltedcccb182010-05-16 20:52:23 +02002637 bsc_vty_init_extra();
Harald Welte40f82892009-05-23 17:31:39 +00002638
Harald Welte68628e82009-03-10 12:17:57 +00002639 return 0;
2640}