blob: 71fd9b5bef95c31fd8568bfe66b9181e826f925a [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);
Holger Hans Peter Freytherae9006a2010-12-22 16:26:04 +0100553 vty_out(vty, " subscriber-keep-in-ram %d%s",
554 gsmnet->keep_subscr, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200555
556 return CMD_SUCCESS;
557}
Harald Welte67ce0732009-08-06 19:06:46 +0200558
Harald Welte68628e82009-03-10 12:17:57 +0000559static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
560{
561 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
562 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200563 vty_out(vty, "Description: %s%s",
564 trx->description ? trx->description : "(null)", VTY_NEWLINE);
Harald Weltefcd24452009-06-20 18:15:19 +0200565 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte42581822009-08-08 16:12:58 +0200566 "resulting BS power: %d dBm%s",
Harald Weltefcd24452009-06-20 18:15:19 +0200567 trx->nominal_power, trx->max_power_red,
Harald Welte42581822009-08-08 16:12:58 +0200568 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000569 vty_out(vty, " NM State: ");
570 net_dump_nmstate(vty, &trx->nm_state);
571 vty_out(vty, " Baseband Transceiver NM State: ");
572 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte8175e952009-10-20 00:22:00 +0200573 if (is_ipaccess_bts(trx->bts)) {
574 vty_out(vty, " ip.access stream ID: 0x%02x%s",
575 trx->rsl_tei, VTY_NEWLINE);
576 } else {
577 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
578 e1isl_dump_vty(vty, trx->rsl_link);
579 }
Harald Welte68628e82009-03-10 12:17:57 +0000580}
581
582DEFUN(show_trx,
583 show_trx_cmd,
584 "show trx [bts_nr] [trx_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200585 SHOW_STR "Display information about a TRX\n"
586 "BTS Number\n"
587 "TRX Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000588{
Harald Weltedcccb182010-05-16 20:52:23 +0200589 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000590 struct gsm_bts *bts = NULL;
591 struct gsm_bts_trx *trx;
592 int bts_nr, trx_nr;
593
594 if (argc >= 1) {
595 /* use the BTS number that the user has specified */
596 bts_nr = atoi(argv[0]);
597 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000598 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000599 VTY_NEWLINE);
600 return CMD_WARNING;
601 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200602 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000603 }
604 if (argc >= 2) {
605 trx_nr = atoi(argv[1]);
606 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000607 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000608 VTY_NEWLINE);
609 return CMD_WARNING;
610 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200611 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000612 trx_dump_vty(vty, trx);
613 return CMD_SUCCESS;
614 }
615 if (bts) {
616 /* print all TRX in this BTS */
617 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200618 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000619 trx_dump_vty(vty, trx);
620 }
621 return CMD_SUCCESS;
622 }
623
624 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200625 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000626 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200627 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000628 trx_dump_vty(vty, trx);
629 }
630 }
631
632 return CMD_SUCCESS;
633}
634
Harald Welte67ce0732009-08-06 19:06:46 +0200635
Harald Welte68628e82009-03-10 12:17:57 +0000636static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
637{
Harald Weltecd103a92010-12-24 12:14:52 +0100638 vty_out(vty, "BTS %u, TRX %u, Timeslot %u, phys cfg %s",
Harald Welte026b4ca2010-12-24 12:12:10 +0100639 ts->trx->bts->nr, ts->trx->nr, ts->nr,
Harald Weltecd103a92010-12-24 12:14:52 +0100640 gsm_pchan_name(ts->pchan));
641 if (ts->pchan == GSM_PCHAN_TCH_F_PDCH)
Harald Welteb29cea12010-12-24 12:26:13 +0100642 vty_out(vty, " (%s mode)",
Harald Weltecd103a92010-12-24 12:14:52 +0100643 ts->flags & TS_F_PDCH_MODE ? "PDCH" : "TCH/F");
644 vty_out(vty, "%s", VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000645 vty_out(vty, " NM State: ");
646 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte2c828992009-12-02 01:56:49 +0530647 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welteef235b52009-03-10 12:34:02 +0000648 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
649 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
650 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000651}
652
653DEFUN(show_ts,
654 show_ts_cmd,
Harald Welte1bc77352009-03-10 19:47:51 +0000655 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200656 SHOW_STR "Display information about a TS\n"
657 "BTS Number\n" "TRX Number\n" "Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000658{
Harald Weltedcccb182010-05-16 20:52:23 +0200659 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte274d0152010-12-24 12:05:03 +0100660 struct gsm_bts *bts = NULL;
661 struct gsm_bts_trx *trx = NULL;
662 struct gsm_bts_trx_ts *ts = NULL;
Harald Welte68628e82009-03-10 12:17:57 +0000663 int bts_nr, trx_nr, ts_nr;
664
665 if (argc >= 1) {
666 /* use the BTS number that the user has specified */
667 bts_nr = atoi(argv[0]);
668 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000669 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000670 VTY_NEWLINE);
671 return CMD_WARNING;
672 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200673 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000674 }
675 if (argc >= 2) {
676 trx_nr = atoi(argv[1]);
677 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000678 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000679 VTY_NEWLINE);
680 return CMD_WARNING;
681 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200682 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000683 }
684 if (argc >= 3) {
685 ts_nr = atoi(argv[2]);
686 if (ts_nr >= TRX_NR_TS) {
Harald Welte1bc77352009-03-10 19:47:51 +0000687 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
Harald Welte68628e82009-03-10 12:17:57 +0000688 VTY_NEWLINE);
689 return CMD_WARNING;
690 }
Harald Welte274d0152010-12-24 12:05:03 +0100691 /* Fully Specified: print and exit */
Harald Welte68628e82009-03-10 12:17:57 +0000692 ts = &trx->ts[ts_nr];
693 ts_dump_vty(vty, ts);
694 return CMD_SUCCESS;
695 }
Harald Welte274d0152010-12-24 12:05:03 +0100696
697 if (bts && trx) {
698 /* Iterate over all TS in this TRX */
699 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
700 ts = &trx->ts[ts_nr];
701 ts_dump_vty(vty, ts);
702 }
703 } else if (bts) {
704 /* Iterate over all TRX in this BTS, TS in each TRX */
Harald Welte68628e82009-03-10 12:17:57 +0000705 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200706 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000707 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
708 ts = &trx->ts[ts_nr];
709 ts_dump_vty(vty, ts);
710 }
711 }
Harald Welte274d0152010-12-24 12:05:03 +0100712 } else {
713 /* Iterate over all BTS, TRX in each BTS, TS in each TRX */
714 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
715 bts = gsm_bts_num(net, bts_nr);
716 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
717 trx = gsm_bts_trx_num(bts, trx_nr);
718 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
719 ts = &trx->ts[ts_nr];
720 ts_dump_vty(vty, ts);
721 }
722 }
723 }
Harald Welte68628e82009-03-10 12:17:57 +0000724 }
725
726 return CMD_SUCCESS;
727}
728
Holger Hans Peter Freyther424c4f02010-01-06 06:00:40 +0100729static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte68628e82009-03-10 12:17:57 +0000730{
Harald Weltefcd24452009-06-20 18:15:19 +0200731 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte40f82892009-05-23 17:31:39 +0000732 subscr->authorized, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000733 if (subscr->name)
Harald Welte1bc77352009-03-10 19:47:51 +0000734 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000735 if (subscr->extension)
736 vty_out(vty, " Extension: %s%s", subscr->extension,
737 VTY_NEWLINE);
738 if (subscr->imsi)
739 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freyther22230252009-08-19 12:53:57 +0200740 if (subscr->tmsi != GSM_RESERVED_TMSI)
741 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte731fd912009-08-15 03:24:51 +0200742 VTY_NEWLINE);
Sylvain Munautaf292642009-12-27 19:29:28 +0100743
Harald Welte (local)15920de2009-08-14 20:27:16 +0200744 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000745}
746
Harald Welte8387a492009-12-22 21:43:14 +0100747static void meas_rep_dump_uni_vty(struct vty *vty,
748 struct gsm_meas_rep_unidir *mru,
749 const char *prefix,
750 const char *dir)
751{
752 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
753 prefix, dir, rxlev2dbm(mru->full.rx_lev),
754 dir, rxlev2dbm(mru->sub.rx_lev));
755 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
756 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
757 VTY_NEWLINE);
758}
759
760static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
761 const char *prefix)
762{
763 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
764 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
765 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
766 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
767 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
768 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
769 VTY_NEWLINE);
770 if (mr->flags & MEAS_REP_F_MS_TO)
771 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
772 mr->ms_timing_offset, VTY_NEWLINE);
773 if (mr->flags & MEAS_REP_F_MS_L1)
774 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
775 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
776 if (mr->flags & MEAS_REP_F_DL_VALID)
777 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
778 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
779}
780
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800781static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
Harald Welte68628e82009-03-10 12:17:57 +0000782{
Harald Welte8387a492009-12-22 21:43:14 +0100783 int idx;
784
Harald Welte85bded82010-12-24 12:22:34 +0100785 vty_out(vty, "BTS %u, TRX %u, Timeslot %u, Lchan %u: Type %s%s",
786 lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
787 lchan->nr, gsm_lchant_name(lchan->type), VTY_NEWLINE);
Holger Hans Peter Freyther40494552010-06-28 17:09:29 +0800788 vty_out(vty, " Connection: %u, State: %s%s",
789 lchan->conn ? 1: 0,
Harald Welte1887f9d2009-12-29 10:52:38 +0100790 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100791 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
792 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
793 - lchan->bs_power*2,
794 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
795 VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800796 if (lchan->conn && lchan->conn->subscr) {
Harald Welte68628e82009-03-10 12:17:57 +0000797 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800798 subscr_dump_vty(vty, lchan->conn->subscr);
Harald Welte68628e82009-03-10 12:17:57 +0000799 } else
800 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte2c828992009-12-02 01:56:49 +0530801 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
802 struct in_addr ia;
Holger Hans Peter Freyther54fa7992010-04-07 15:39:16 +0200803 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte2c828992009-12-02 01:56:49 +0530804 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
805 inet_ntoa(ia), lchan->abis_ip.bound_port,
806 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
807 VTY_NEWLINE);
808 }
Harald Welte8387a492009-12-22 21:43:14 +0100809
810 /* we want to report the last measurement report */
811 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
812 lchan->meas_rep_idx, 1);
813 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte68628e82009-03-10 12:17:57 +0000814}
815
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800816static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
817{
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800818 struct gsm_meas_rep *mr;
819 int idx;
820
821 /* we want to report the last measurement report */
822 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
823 lchan->meas_rep_idx, 1);
824 mr = &lchan->meas_rep[idx];
825
Harald Welte85bded82010-12-24 12:22:34 +0100826 vty_out(vty, "BTS %u, TRX %u, Timeslot %u, Lchan %u, Type %s - "
827 "L1 MS Power: %u dBm RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
828 lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
Harald Welteb29cea12010-12-24 12:26:13 +0100829 lchan->nr, gsm_lchant_name(lchan->type), mr->ms_l1.pwr,
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800830 rxlev2dbm(mr->dl.full.rx_lev),
831 rxlev2dbm(mr->ul.full.rx_lev),
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800832 VTY_NEWLINE);
833}
834
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800835static int lchan_summary(struct vty *vty, int argc, const char **argv,
836 void (*dump_cb)(struct vty *, struct gsm_lchan *))
Harald Welte68628e82009-03-10 12:17:57 +0000837{
Harald Weltedcccb182010-05-16 20:52:23 +0200838 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000839 struct gsm_bts *bts;
840 struct gsm_bts_trx *trx;
841 struct gsm_bts_trx_ts *ts;
842 struct gsm_lchan *lchan;
843 int bts_nr, trx_nr, ts_nr, lchan_nr;
844
845 if (argc >= 1) {
846 /* use the BTS number that the user has specified */
847 bts_nr = atoi(argv[0]);
848 if (bts_nr >= net->num_bts) {
849 vty_out(vty, "%% can't find BTS %s%s", argv[0],
850 VTY_NEWLINE);
851 return CMD_WARNING;
852 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200853 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000854 }
855 if (argc >= 2) {
856 trx_nr = atoi(argv[1]);
857 if (trx_nr >= bts->num_trx) {
858 vty_out(vty, "%% can't find TRX %s%s", argv[1],
859 VTY_NEWLINE);
860 return CMD_WARNING;
861 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200862 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000863 }
864 if (argc >= 3) {
865 ts_nr = atoi(argv[2]);
866 if (ts_nr >= TRX_NR_TS) {
867 vty_out(vty, "%% can't find TS %s%s", argv[2],
868 VTY_NEWLINE);
869 return CMD_WARNING;
870 }
871 ts = &trx->ts[ts_nr];
872 }
873 if (argc >= 4) {
874 lchan_nr = atoi(argv[3]);
875 if (lchan_nr >= TS_MAX_LCHAN) {
876 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
877 VTY_NEWLINE);
878 return CMD_WARNING;
879 }
880 lchan = &ts->lchan[lchan_nr];
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800881 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000882 return CMD_SUCCESS;
883 }
884 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200885 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000886 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200887 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000888 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
889 ts = &trx->ts[ts_nr];
890 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
891 lchan_nr++) {
892 lchan = &ts->lchan[lchan_nr];
Harald Welteef235b52009-03-10 12:34:02 +0000893 if (lchan->type == GSM_LCHAN_NONE)
894 continue;
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800895 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000896 }
897 }
898 }
899 }
900
901 return CMD_SUCCESS;
902}
903
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800904
905DEFUN(show_lchan,
906 show_lchan_cmd,
907 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
908 SHOW_STR "Display information about a logical channel\n"
909 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
910 "Logical Channel Number\n")
911
912{
913 return lchan_summary(vty, argc, argv, lchan_dump_full_vty);
914}
915
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800916DEFUN(show_lchan_summary,
917 show_lchan_summary_cmd,
918 "show lchan summary [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
919 SHOW_STR "Display information about a logical channel\n"
920 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
921 "Logical Channel Number\n")
922{
923 return lchan_summary(vty, argc, argv, lchan_dump_short_vty);
924}
925
Harald Welte1bc77352009-03-10 19:47:51 +0000926static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
927{
928 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
929}
930
931DEFUN(show_e1drv,
932 show_e1drv_cmd,
933 "show e1_driver",
934 SHOW_STR "Display information about available E1 drivers\n")
935{
936 struct e1inp_driver *drv;
937
938 llist_for_each_entry(drv, &e1inp_driver_list, list)
939 e1drv_dump_vty(vty, drv);
940
941 return CMD_SUCCESS;
942}
943
Harald Welte68628e82009-03-10 12:17:57 +0000944static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
945{
946 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
947 line->num, line->name ? line->name : "",
948 line->driver->name, VTY_NEWLINE);
949}
950
951DEFUN(show_e1line,
952 show_e1line_cmd,
953 "show e1_line [line_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200954 SHOW_STR "Display information about a E1 line\n"
955 "E1 Line Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000956{
Harald Welte1bc77352009-03-10 19:47:51 +0000957 struct e1inp_line *line;
958
959 if (argc >= 1) {
960 int num = atoi(argv[0]);
961 llist_for_each_entry(line, &e1inp_line_list, list) {
962 if (line->num == num) {
963 e1line_dump_vty(vty, line);
964 return CMD_SUCCESS;
965 }
966 }
967 return CMD_WARNING;
968 }
969
970 llist_for_each_entry(line, &e1inp_line_list, list)
971 e1line_dump_vty(vty, line);
972
973 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000974}
975
976static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
977{
Harald Welte42581822009-08-08 16:12:58 +0200978 if (ts->type == E1INP_TS_TYPE_NONE)
979 return;
Harald Welte1bc77352009-03-10 19:47:51 +0000980 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
981 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
982 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000983}
984
985DEFUN(show_e1ts,
986 show_e1ts_cmd,
987 "show e1_timeslot [line_nr] [ts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200988 SHOW_STR "Display information about a E1 timeslot\n"
989 "E1 Line Number\n" "E1 Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000990{
Harald Welte986c3d72009-11-17 06:12:16 +0100991 struct e1inp_line *line = NULL;
Harald Welte1bc77352009-03-10 19:47:51 +0000992 struct e1inp_ts *ts;
993 int ts_nr;
Harald Welte68628e82009-03-10 12:17:57 +0000994
Harald Welte1bc77352009-03-10 19:47:51 +0000995 if (argc == 0) {
996 llist_for_each_entry(line, &e1inp_line_list, list) {
997 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
998 ts = &line->ts[ts_nr];
999 e1ts_dump_vty(vty, ts);
1000 }
1001 }
1002 return CMD_SUCCESS;
1003 }
1004 if (argc >= 1) {
1005 int num = atoi(argv[0]);
1006 llist_for_each_entry(line, &e1inp_line_list, list) {
1007 if (line->num == num)
1008 break;
1009 }
1010 if (!line || line->num != num) {
1011 vty_out(vty, "E1 line %s is invalid%s",
1012 argv[0], VTY_NEWLINE);
1013 return CMD_WARNING;
1014 }
1015 }
1016 if (argc >= 2) {
1017 ts_nr = atoi(argv[1]);
1018 if (ts_nr > NUM_E1_TS) {
1019 vty_out(vty, "E1 timeslot %s is invalid%s",
1020 argv[1], VTY_NEWLINE);
1021 return CMD_WARNING;
1022 }
1023 ts = &line->ts[ts_nr];
1024 e1ts_dump_vty(vty, ts);
1025 return CMD_SUCCESS;
1026 } else {
1027 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
1028 ts = &line->ts[ts_nr];
1029 e1ts_dump_vty(vty, ts);
1030 }
1031 return CMD_SUCCESS;
1032 }
1033 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +00001034}
1035
Harald Weltebe4b7302009-05-23 16:59:33 +00001036static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
Harald Weltef5025b62009-03-28 16:55:11 +00001037{
1038 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
1039 subscr_dump_vty(vty, pag->subscr);
1040}
1041
Harald Weltebe4b7302009-05-23 16:59:33 +00001042static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
Harald Weltef5025b62009-03-28 16:55:11 +00001043{
1044 struct gsm_paging_request *pag;
1045
1046 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
1047 paging_dump_vty(vty, pag);
1048}
1049
1050DEFUN(show_paging,
1051 show_paging_cmd,
1052 "show paging [bts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +02001053 SHOW_STR "Display information about paging reuqests of a BTS\n"
1054 "BTS Number\n")
Harald Weltef5025b62009-03-28 16:55:11 +00001055{
Harald Weltedcccb182010-05-16 20:52:23 +02001056 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Weltef5025b62009-03-28 16:55:11 +00001057 struct gsm_bts *bts;
1058 int bts_nr;
1059
1060 if (argc >= 1) {
1061 /* use the BTS number that the user has specified */
1062 bts_nr = atoi(argv[0]);
1063 if (bts_nr >= net->num_bts) {
1064 vty_out(vty, "%% can't find BTS %s%s", argv[0],
1065 VTY_NEWLINE);
1066 return CMD_WARNING;
1067 }
Harald Weltee441d9c2009-06-21 16:17:15 +02001068 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001069 bts_paging_dump_vty(vty, bts);
1070
1071 return CMD_SUCCESS;
1072 }
1073 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +02001074 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001075 bts_paging_dump_vty(vty, bts);
1076 }
1077
1078 return CMD_SUCCESS;
1079}
1080
Harald Welte8f0ed552010-05-11 21:53:49 +02001081#define NETWORK_STR "Configure the GSM network\n"
1082
Harald Welte5013b2a2009-08-07 13:29:14 +02001083DEFUN(cfg_net,
1084 cfg_net_cmd,
Harald Welte8f0ed552010-05-11 21:53:49 +02001085 "network", NETWORK_STR)
Harald Welte5013b2a2009-08-07 13:29:14 +02001086{
Harald Weltedcccb182010-05-16 20:52:23 +02001087 vty->index = gsmnet_from_vty(vty);
Harald Welte5013b2a2009-08-07 13:29:14 +02001088 vty->node = GSMNET_NODE;
1089
1090 return CMD_SUCCESS;
1091}
1092
1093
1094DEFUN(cfg_net_ncc,
1095 cfg_net_ncc_cmd,
1096 "network country code <1-999>",
1097 "Set the GSM network country code")
1098{
Harald Weltedcccb182010-05-16 20:52:23 +02001099 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1100
Harald Welte5013b2a2009-08-07 13:29:14 +02001101 gsmnet->country_code = atoi(argv[0]);
1102
1103 return CMD_SUCCESS;
1104}
1105
1106DEFUN(cfg_net_mnc,
1107 cfg_net_mnc_cmd,
1108 "mobile network code <1-999>",
1109 "Set the GSM mobile network code")
1110{
Harald Weltedcccb182010-05-16 20:52:23 +02001111 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1112
Harald Welte5013b2a2009-08-07 13:29:14 +02001113 gsmnet->network_code = atoi(argv[0]);
1114
1115 return CMD_SUCCESS;
1116}
1117
1118DEFUN(cfg_net_name_short,
1119 cfg_net_name_short_cmd,
1120 "short name NAME",
1121 "Set the short GSM network name")
1122{
Harald Weltedcccb182010-05-16 20:52:23 +02001123 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1124
Holger Hans Peter Freyther3e9a7f82010-10-12 23:21:54 +02001125 bsc_replace_string(gsmnet, &gsmnet->name_short, argv[0]);
Harald Welte5013b2a2009-08-07 13:29:14 +02001126 return CMD_SUCCESS;
1127}
1128
1129DEFUN(cfg_net_name_long,
1130 cfg_net_name_long_cmd,
1131 "long name NAME",
1132 "Set the long GSM network name")
1133{
Harald Weltedcccb182010-05-16 20:52:23 +02001134 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1135
Holger Hans Peter Freyther3e9a7f82010-10-12 23:21:54 +02001136 bsc_replace_string(gsmnet, &gsmnet->name_long, argv[0]);
Harald Welte5013b2a2009-08-07 13:29:14 +02001137 return CMD_SUCCESS;
1138}
Harald Welte40f82892009-05-23 17:31:39 +00001139
Harald Welte (local)69de3972009-08-12 14:42:23 +02001140DEFUN(cfg_net_auth_policy,
1141 cfg_net_auth_policy_cmd,
1142 "auth policy (closed|accept-all|token)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001143 "Authentication (not cryptographic)\n"
1144 "Set the GSM network authentication policy\n"
1145 "Require the MS to be activated in HLR\n"
1146 "Accept all MS, whether in HLR or not\n"
1147 "Use SMS-token based authentication\n")
Harald Welte (local)69de3972009-08-12 14:42:23 +02001148{
1149 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001150 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte (local)69de3972009-08-12 14:42:23 +02001151
1152 gsmnet->auth_policy = policy;
1153
1154 return CMD_SUCCESS;
1155}
1156
Harald Welte1085c092009-11-18 20:33:19 +01001157DEFUN(cfg_net_reject_cause,
1158 cfg_net_reject_cause_cmd,
1159 "location updating reject cause <2-111>",
1160 "Set the reject cause of location updating reject\n")
1161{
Harald Weltedcccb182010-05-16 20:52:23 +02001162 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1163
Harald Welte1085c092009-11-18 20:33:19 +01001164 gsmnet->reject_cause = atoi(argv[0]);
1165
1166 return CMD_SUCCESS;
1167}
1168
Harald Welte4381cfe2009-08-30 15:47:06 +09001169DEFUN(cfg_net_encryption,
1170 cfg_net_encryption_cmd,
1171 "encryption a5 (0|1|2)",
Harald Welte28326062010-05-14 20:05:17 +02001172 "Encryption options\n"
1173 "A5 encryption\n" "A5/0: No encryption\n"
1174 "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n")
Harald Welte4381cfe2009-08-30 15:47:06 +09001175{
Harald Weltedcccb182010-05-16 20:52:23 +02001176 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1177
Andreas.Eversberg1059deb2009-11-17 09:55:26 +01001178 gsmnet->a5_encryption= atoi(argv[0]);
Harald Welte4381cfe2009-08-30 15:47:06 +09001179
1180 return CMD_SUCCESS;
1181}
1182
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001183DEFUN(cfg_net_neci,
1184 cfg_net_neci_cmd,
1185 "neci (0|1)",
Harald Welte28326062010-05-14 20:05:17 +02001186 "New Establish Cause Indication\n"
1187 "Don't set the NECI bit\n" "Set the NECI bit\n")
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001188{
Harald Weltedcccb182010-05-16 20:52:23 +02001189 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1190
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001191 gsmnet->neci = atoi(argv[0]);
Holger Hans Peter Freyther78891072010-09-06 09:36:02 +08001192 gsm_net_update_ctype(gsmnet);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001193 return CMD_SUCCESS;
1194}
1195
Harald Welteeab84a12009-12-13 10:53:12 +01001196DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1197 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001198 "Radio Resource Location Protocol\n"
1199 "Set the Radio Resource Location Protocol Mode\n"
1200 "Don't send RRLP request\n"
1201 "Request MS-based location\n"
1202 "Request any location, prefer MS-based\n"
1203 "Request any location, prefer MS-assisted\n")
Harald Welteeab84a12009-12-13 10:53:12 +01001204{
Harald Weltedcccb182010-05-16 20:52:23 +02001205 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1206
Harald Welteeab84a12009-12-13 10:53:12 +01001207 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1208
1209 return CMD_SUCCESS;
1210}
1211
Harald Welte648b6ce2009-12-14 09:00:24 +01001212DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1213 "mm info (0|1)",
1214 "Whether to send MM INFO after LOC UPD ACCEPT")
1215{
Harald Weltedcccb182010-05-16 20:52:23 +02001216 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1217
Harald Welte648b6ce2009-12-14 09:00:24 +01001218 gsmnet->send_mm_info = atoi(argv[0]);
1219
1220 return CMD_SUCCESS;
1221}
1222
Harald Welte8f0ed552010-05-11 21:53:49 +02001223#define HANDOVER_STR "Handover Options\n"
1224
Harald Weltebc814502009-12-19 21:41:52 +01001225DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1226 "handover (0|1)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001227 HANDOVER_STR
1228 "Don't perform in-call handover\n"
1229 "Perform in-call handover\n")
Harald Weltebc814502009-12-19 21:41:52 +01001230{
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001231 int enable = atoi(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001232 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001233
1234 if (enable && ipacc_rtp_direct) {
Harald Weltefe03f0d2009-12-20 13:51:01 +01001235 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1236 "is enabled by using the -P command line option%s",
1237 VTY_NEWLINE);
1238 return CMD_WARNING;
1239 }
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001240 gsmnet->handover.active = enable;
Harald Weltebc814502009-12-19 21:41:52 +01001241
1242 return CMD_SUCCESS;
1243}
1244
Harald Welte8f0ed552010-05-11 21:53:49 +02001245#define HO_WIN_STR HANDOVER_STR "Measurement Window\n"
1246#define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n"
1247#define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n"
1248#define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n"
1249
Harald Welteb720bd32009-12-21 16:51:50 +01001250DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1251 "handover window rxlev averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001252 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001253 "How many RxLev measurements are used for averaging")
1254{
Harald Weltedcccb182010-05-16 20:52:23 +02001255 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001256 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1257 return CMD_SUCCESS;
1258}
1259
1260DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1261 "handover window rxqual averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001262 HO_WIN_RXQUAL_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001263 "How many RxQual measurements are used for averaging")
1264{
Harald Weltedcccb182010-05-16 20:52:23 +02001265 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001266 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1267 return CMD_SUCCESS;
1268}
1269
1270DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1271 "handover window rxlev neighbor averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001272 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001273 "How many RxQual measurements are used for averaging")
1274{
Harald Weltedcccb182010-05-16 20:52:23 +02001275 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001276 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1277 return CMD_SUCCESS;
1278}
1279
1280DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1281 "handover power budget interval <1-99>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001282 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001283 "How often to check if we have a better cell (SACCH frames)")
1284{
Harald Weltedcccb182010-05-16 20:52:23 +02001285 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001286 gsmnet->handover.pwr_interval = atoi(argv[0]);
1287 return CMD_SUCCESS;
1288}
1289
1290DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1291 "handover power budget hysteresis <0-999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001292 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001293 "How many dB does a neighbor to be stronger to become a HO candidate")
1294{
Harald Weltedcccb182010-05-16 20:52:23 +02001295 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001296 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1297 return CMD_SUCCESS;
1298}
1299
1300DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1301 "handover maximum distance <0-9999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001302 HANDOVER_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001303 "How big is the maximum timing advance before HO is forced")
1304{
Harald Weltedcccb182010-05-16 20:52:23 +02001305 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001306 gsmnet->handover.max_distance = atoi(argv[0]);
1307 return CMD_SUCCESS;
1308}
Harald Weltebc814502009-12-19 21:41:52 +01001309
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001310DEFUN(cfg_net_pag_any_tch,
1311 cfg_net_pag_any_tch_cmd,
1312 "paging any use tch (0|1)",
1313 "Assign a TCH when receiving a Paging Any request")
1314{
Holger Hans Peter Freytherb0e88b82010-09-06 10:09:19 +08001315 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001316 gsmnet->pag_any_tch = atoi(argv[0]);
1317 gsm_net_update_ctype(gsmnet);
1318 return CMD_SUCCESS;
1319}
1320
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001321#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001322 DEFUN(cfg_net_T##number, \
1323 cfg_net_T##number##_cmd, \
1324 "timer t" #number " <0-65535>", \
Harald Welte8f0ed552010-05-11 21:53:49 +02001325 "Configure GSM Timers\n" \
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001326 doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001327{ \
Harald Weltedcccb182010-05-16 20:52:23 +02001328 struct gsm_network *gsmnet = gsmnet_from_vty(vty); \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001329 int value = atoi(argv[0]); \
1330 \
1331 if (value < 0 || value > 65535) { \
1332 vty_out(vty, "Timer value %s out of range.%s", \
1333 argv[0], VTY_NEWLINE); \
1334 return CMD_WARNING; \
1335 } \
1336 \
1337 gsmnet->T##number = value; \
1338 return CMD_SUCCESS; \
1339}
1340
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001341DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1342DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1343DECLARE_TIMER(3105, "Currently not used.")
1344DECLARE_TIMER(3107, "Currently not used.")
1345DECLARE_TIMER(3109, "Currently not used.")
Holger Hans Peter Freytherf30c0dc2010-05-31 21:33:15 +08001346DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel.")
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001347DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1348DECLARE_TIMER(3115, "Currently not used.")
1349DECLARE_TIMER(3117, "Currently not used.")
1350DECLARE_TIMER(3119, "Currently not used.")
Harald Welte2862dca2010-12-23 14:39:29 +01001351DECLARE_TIMER(3122, "Waiting time (seconds) after IMM ASS REJECT")
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001352DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001353
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08001354DEFUN(cfg_net_dtx,
1355 cfg_net_dtx_cmd,
1356 "dtx-used (0|1)",
1357 "Enable the usage of DTX.\n"
1358 "DTX is enabled/disabled")
1359{
1360 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1361 gsmnet->dtx_enabled = atoi(argv[0]);
1362 return CMD_SUCCESS;
1363}
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001364
Holger Hans Peter Freytherae9006a2010-12-22 16:26:04 +01001365DEFUN(cfg_net_subscr_keep,
1366 cfg_net_subscr_keep_cmd,
1367 "subscriber-keep-in-ram (0|1)",
1368 "Keep unused subscribers in RAM.\n"
1369 "Delete unused subscribers\n" "Keep unused subscribers\n")
1370{
1371 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1372 gsmnet->keep_subscr = atoi(argv[0]);
1373 return CMD_SUCCESS;
1374}
1375
Harald Welte5258fc42009-03-28 19:07:53 +00001376/* per-BTS configuration */
1377DEFUN(cfg_bts,
1378 cfg_bts_cmd,
1379 "bts BTS_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02001380 "Select a BTS to configure\n"
1381 "BTS Number\n")
Harald Welte5258fc42009-03-28 19:07:53 +00001382{
Harald Weltedcccb182010-05-16 20:52:23 +02001383 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte5258fc42009-03-28 19:07:53 +00001384 int bts_nr = atoi(argv[0]);
1385 struct gsm_bts *bts;
1386
Harald Weltee441d9c2009-06-21 16:17:15 +02001387 if (bts_nr > gsmnet->num_bts) {
1388 vty_out(vty, "%% The next unused BTS number is %u%s",
1389 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001390 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001391 } else if (bts_nr == gsmnet->num_bts) {
1392 /* allocate a new one */
1393 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1394 HARDCODED_TSC, HARDCODED_BSIC);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001395 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02001396 bts = gsm_bts_num(gsmnet, bts_nr);
1397
Daniel Willmannf15c2762010-01-11 13:43:07 +01001398 if (!bts) {
1399 vty_out(vty, "%% Unable to allocate BTS %u%s",
1400 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee441d9c2009-06-21 16:17:15 +02001401 return CMD_WARNING;
Daniel Willmannf15c2762010-01-11 13:43:07 +01001402 }
Harald Welte5258fc42009-03-28 19:07:53 +00001403
1404 vty->index = bts;
Harald Welte197dea92010-05-14 17:59:53 +02001405 vty->index_sub = &bts->description;
Harald Welte5258fc42009-03-28 19:07:53 +00001406 vty->node = BTS_NODE;
1407
1408 return CMD_SUCCESS;
1409}
1410
1411DEFUN(cfg_bts_type,
1412 cfg_bts_type_cmd,
1413 "type TYPE",
1414 "Set the BTS type\n")
1415{
1416 struct gsm_bts *bts = vty->index;
Harald Welte39315c42010-01-10 18:01:52 +01001417 int rc;
Harald Welte5258fc42009-03-28 19:07:53 +00001418
Harald Welte39315c42010-01-10 18:01:52 +01001419 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1420 if (rc < 0)
1421 return CMD_WARNING;
Harald Welte8175e952009-10-20 00:22:00 +02001422
Harald Welte5258fc42009-03-28 19:07:53 +00001423 return CMD_SUCCESS;
1424}
1425
Harald Weltefcd24452009-06-20 18:15:19 +02001426DEFUN(cfg_bts_band,
1427 cfg_bts_band_cmd,
1428 "band BAND",
1429 "Set the frequency band of this BTS\n")
1430{
1431 struct gsm_bts *bts = vty->index;
Harald Welte42581822009-08-08 16:12:58 +02001432 int band = gsm_band_parse(argv[0]);
Harald Weltefcd24452009-06-20 18:15:19 +02001433
1434 if (band < 0) {
1435 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1436 band, VTY_NEWLINE);
1437 return CMD_WARNING;
1438 }
1439
1440 bts->band = band;
1441
1442 return CMD_SUCCESS;
1443}
1444
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001445DEFUN(cfg_bts_ci,
1446 cfg_bts_ci_cmd,
1447 "cell_identity <0-65535>",
1448 "Set the Cell identity of this BTS\n")
1449{
1450 struct gsm_bts *bts = vty->index;
1451 int ci = atoi(argv[0]);
1452
1453 if (ci < 0 || ci > 0xffff) {
1454 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1455 ci, VTY_NEWLINE);
1456 return CMD_WARNING;
1457 }
1458 bts->cell_identity = ci;
1459
1460 return CMD_SUCCESS;
1461}
1462
Harald Welte5258fc42009-03-28 19:07:53 +00001463DEFUN(cfg_bts_lac,
1464 cfg_bts_lac_cmd,
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001465 "location_area_code <0-65535>",
Harald Welte5258fc42009-03-28 19:07:53 +00001466 "Set the Location Area Code (LAC) of this BTS\n")
1467{
1468 struct gsm_bts *bts = vty->index;
1469 int lac = atoi(argv[0]);
1470
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001471 if (lac < 0 || lac > 0xffff) {
1472 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte5258fc42009-03-28 19:07:53 +00001473 lac, VTY_NEWLINE);
1474 return CMD_WARNING;
1475 }
Holger Hans Peter Freythere48b9562009-10-01 04:07:15 +02001476
1477 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1478 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1479 lac, VTY_NEWLINE);
1480 return CMD_WARNING;
1481 }
1482
Harald Welte5258fc42009-03-28 19:07:53 +00001483 bts->location_area_code = lac;
1484
1485 return CMD_SUCCESS;
1486}
1487
Harald Weltea43f7892009-12-01 18:04:30 +05301488
Harald Welte5258fc42009-03-28 19:07:53 +00001489DEFUN(cfg_bts_tsc,
1490 cfg_bts_tsc_cmd,
1491 "training_sequence_code <0-255>",
1492 "Set the Training Sequence Code (TSC) of this BTS\n")
1493{
1494 struct gsm_bts *bts = vty->index;
1495 int tsc = atoi(argv[0]);
1496
1497 if (tsc < 0 || tsc > 0xff) {
1498 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1499 tsc, VTY_NEWLINE);
1500 return CMD_WARNING;
1501 }
1502 bts->tsc = tsc;
1503
1504 return CMD_SUCCESS;
1505}
1506
Harald Welte78f2f502009-05-23 16:56:52 +00001507DEFUN(cfg_bts_bsic,
1508 cfg_bts_bsic_cmd,
1509 "base_station_id_code <0-63>",
1510 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1511{
1512 struct gsm_bts *bts = vty->index;
1513 int bsic = atoi(argv[0]);
1514
1515 if (bsic < 0 || bsic > 0x3f) {
Harald Welte42581822009-08-08 16:12:58 +02001516 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte78f2f502009-05-23 16:56:52 +00001517 bsic, VTY_NEWLINE);
1518 return CMD_WARNING;
1519 }
1520 bts->bsic = bsic;
1521
1522 return CMD_SUCCESS;
1523}
1524
1525
Harald Welte4cc34222009-05-01 15:12:31 +00001526DEFUN(cfg_bts_unit_id,
1527 cfg_bts_unit_id_cmd,
Harald Welte07dc73d2009-08-07 13:27:09 +02001528 "ip.access unit_id <0-65534> <0-255>",
1529 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte4cc34222009-05-01 15:12:31 +00001530{
1531 struct gsm_bts *bts = vty->index;
1532 int site_id = atoi(argv[0]);
1533 int bts_id = atoi(argv[1]);
1534
Harald Welte07dc73d2009-08-07 13:27:09 +02001535 if (!is_ipaccess_bts(bts)) {
1536 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1537 return CMD_WARNING;
1538 }
1539
Harald Welte4cc34222009-05-01 15:12:31 +00001540 bts->ip_access.site_id = site_id;
1541 bts->ip_access.bts_id = bts_id;
1542
1543 return CMD_SUCCESS;
1544}
1545
Harald Welte8f0ed552010-05-11 21:53:49 +02001546#define OML_STR "Organization & Maintenance Link\n"
1547#define IPA_STR "ip.access Specific Options\n"
1548
Harald Welte8175e952009-10-20 00:22:00 +02001549DEFUN(cfg_bts_stream_id,
1550 cfg_bts_stream_id_cmd,
1551 "oml ip.access stream_id <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001552 OML_STR IPA_STR
Harald Welte8175e952009-10-20 00:22:00 +02001553 "Set the ip.access Stream ID of the OML link of this BTS\n")
1554{
1555 struct gsm_bts *bts = vty->index;
1556 int stream_id = atoi(argv[0]);
1557
1558 if (!is_ipaccess_bts(bts)) {
1559 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1560 return CMD_WARNING;
1561 }
1562
1563 bts->oml_tei = stream_id;
1564
1565 return CMD_SUCCESS;
1566}
1567
Harald Welte8f0ed552010-05-11 21:53:49 +02001568#define OML_E1_STR OML_STR "E1 Line\n"
Harald Welte8175e952009-10-20 00:22:00 +02001569
Harald Welte42581822009-08-08 16:12:58 +02001570DEFUN(cfg_bts_oml_e1,
1571 cfg_bts_oml_e1_cmd,
1572 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001573 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001574 "E1 interface to be used for OML\n")
1575{
1576 struct gsm_bts *bts = vty->index;
1577
1578 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1579
1580 return CMD_SUCCESS;
1581}
1582
1583
1584DEFUN(cfg_bts_oml_e1_tei,
1585 cfg_bts_oml_e1_tei_cmd,
1586 "oml e1 tei <0-63>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001587 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001588 "Set the TEI to be used for OML")
1589{
1590 struct gsm_bts *bts = vty->index;
1591
1592 bts->oml_tei = atoi(argv[0]);
1593
1594 return CMD_SUCCESS;
1595}
1596
Harald Welte7a8fa412009-08-10 13:48:16 +02001597DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1598 "channel allocator (ascending|descending)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001599 "Channnel Allocator\n" "Channel Allocator\n"
1600 "Allocate Timeslots and Transceivers in ascending order\n"
1601 "Allocate Timeslots and Transceivers in descending order\n")
Harald Welte7a8fa412009-08-10 13:48:16 +02001602{
1603 struct gsm_bts *bts = vty->index;
1604
1605 if (!strcmp(argv[0], "ascending"))
1606 bts->chan_alloc_reverse = 0;
1607 else
1608 bts->chan_alloc_reverse = 1;
1609
1610 return CMD_SUCCESS;
1611}
1612
Harald Welte8f0ed552010-05-11 21:53:49 +02001613#define RACH_STR "Random Access Control Channel\n"
1614
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001615DEFUN(cfg_bts_rach_tx_integer,
1616 cfg_bts_rach_tx_integer_cmd,
1617 "rach tx integer <0-15>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001618 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001619 "Set the raw tx integer value in RACH Control parameters IE")
1620{
1621 struct gsm_bts *bts = vty->index;
1622 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1623 return CMD_SUCCESS;
1624}
1625
1626DEFUN(cfg_bts_rach_max_trans,
1627 cfg_bts_rach_max_trans_cmd,
1628 "rach max transmission (1|2|4|7)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001629 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001630 "Set the maximum number of RACH burst transmissions")
1631{
1632 struct gsm_bts *bts = vty->index;
1633 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1634 return CMD_SUCCESS;
1635}
1636
Harald Welte8f0ed552010-05-11 21:53:49 +02001637#define NM_STR "Network Management\n"
1638
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001639DEFUN(cfg_bts_rach_nm_b_thresh,
1640 cfg_bts_rach_nm_b_thresh_cmd,
1641 "rach nm busy threshold <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001642 RACH_STR NM_STR
1643 "Set the NM Busy Threshold in dB")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001644{
1645 struct gsm_bts *bts = vty->index;
1646 bts->rach_b_thresh = atoi(argv[0]);
1647 return CMD_SUCCESS;
1648}
1649
1650DEFUN(cfg_bts_rach_nm_ldavg,
1651 cfg_bts_rach_nm_ldavg_cmd,
1652 "rach nm load average <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001653 RACH_STR NM_STR
1654 "Set the NM Loadaverage Slots value")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001655{
1656 struct gsm_bts *bts = vty->index;
1657 bts->rach_ldavg_slots = atoi(argv[0]);
1658 return CMD_SUCCESS;
1659}
1660
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001661DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1662 "cell barred (0|1)",
1663 "Should this cell be barred from access?")
1664{
1665 struct gsm_bts *bts = vty->index;
1666
Harald Welte71355012009-12-21 23:08:18 +01001667 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001668
1669 return CMD_SUCCESS;
1670}
1671
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08001672DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd,
1673 "rach emergency call allowed (0|1)",
1674 "Should this cell allow emergency calls?")
1675{
1676 struct gsm_bts *bts = vty->index;
1677
1678 if (atoi(argv[0]) == 0)
1679 bts->si_common.rach_control.t2 |= 0x4;
1680 else
1681 bts->si_common.rach_control.t2 &= ~0x4;
1682
1683 return CMD_SUCCESS;
1684}
1685
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001686DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1687 "ms max power <0-40>",
1688 "Maximum transmit power of the MS")
1689{
1690 struct gsm_bts *bts = vty->index;
1691
1692 bts->ms_max_power = atoi(argv[0]);
1693
1694 return CMD_SUCCESS;
1695}
1696
Harald Welte73225282009-12-12 18:17:25 +01001697DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1698 "cell reselection hysteresis <0-14>",
1699 "Cell Re-Selection Hysteresis in dB")
1700{
1701 struct gsm_bts *bts = vty->index;
1702
1703 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1704
1705 return CMD_SUCCESS;
1706}
1707
1708DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1709 "rxlev access min <0-63>",
1710 "Minimum RxLev needed for cell access (better than -110dBm)")
1711{
1712 struct gsm_bts *bts = vty->index;
1713
1714 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1715
1716 return CMD_SUCCESS;
1717}
1718
Sylvain Munaute0b06b02010-11-28 18:17:28 +01001719DEFUN(cfg_bts_cell_bar_qualify, cfg_bts_cell_bar_qualify_cmd,
1720 "cell bar qualify (0|1)",
1721 "Cell Bar Qualify")
1722{
1723 struct gsm_bts *bts = vty->index;
1724
1725 bts->si_common.cell_ro_sel_par.present = 1;
1726 bts->si_common.cell_ro_sel_par.cbq = atoi(argv[0]);
1727
1728 return CMD_SUCCESS;
1729}
1730
1731DEFUN(cfg_bts_cell_resel_ofs, cfg_bts_cell_resel_ofs_cmd,
1732 "cell reselection offset <0-126>",
1733 "Cell Re-Selection Offset in dB")
1734{
1735 struct gsm_bts *bts = vty->index;
1736
1737 bts->si_common.cell_ro_sel_par.present = 1;
1738 bts->si_common.cell_ro_sel_par.cell_resel_off = atoi(argv[0])/2;
1739
1740 return CMD_SUCCESS;
1741}
1742
1743DEFUN(cfg_bts_temp_ofs, cfg_bts_temp_ofs_cmd,
1744 "temporary offset <0-60>",
1745 "Cell selection temporary negative offset in dB")
1746{
1747 struct gsm_bts *bts = vty->index;
1748
1749 bts->si_common.cell_ro_sel_par.present = 1;
1750 bts->si_common.cell_ro_sel_par.temp_offs = atoi(argv[0])/10;
1751
1752 return CMD_SUCCESS;
1753}
1754
1755DEFUN(cfg_bts_temp_ofs_inf, cfg_bts_temp_ofs_inf_cmd,
1756 "temporary offset infinite",
1757 "Sets cell selection temporary negative offset to infinity")
1758{
1759 struct gsm_bts *bts = vty->index;
1760
1761 bts->si_common.cell_ro_sel_par.present = 1;
1762 bts->si_common.cell_ro_sel_par.temp_offs = 7;
1763
1764 return CMD_SUCCESS;
1765}
1766
1767DEFUN(cfg_bts_penalty_time, cfg_bts_penalty_time_cmd,
1768 "penalty time <20-620>",
1769 "Cell selection penalty time in seconds (by 20s increments)")
1770{
1771 struct gsm_bts *bts = vty->index;
1772
1773 bts->si_common.cell_ro_sel_par.present = 1;
1774 bts->si_common.cell_ro_sel_par.penalty_time = (atoi(argv[0])-20)/20;
1775
1776 return CMD_SUCCESS;
1777}
1778
1779DEFUN(cfg_bts_penalty_time_rsvd, cfg_bts_penalty_time_rsvd_cmd,
1780 "penalty time reserved",
1781 "Set cell selection penalty time to reserved value 31\n"
1782 "(indicate that CELL_RESELECT_OFFSET is subtracted from C2 "
1783 "and TEMPORARY_OFFSET is ignored)")
1784{
1785 struct gsm_bts *bts = vty->index;
1786
1787 bts->si_common.cell_ro_sel_par.present = 1;
1788 bts->si_common.cell_ro_sel_par.penalty_time = 31;
1789
1790 return CMD_SUCCESS;
1791}
1792
Harald Welte (local)efc92312009-08-14 23:09:25 +02001793DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1794 "periodic location update <0-1530>",
1795 "Periodic Location Updating Interval in Minutes")
1796{
1797 struct gsm_bts *bts = vty->index;
1798
Dieter Spaard6613e02010-10-05 21:10:55 +02001799 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 6;
Harald Welte (local)efc92312009-08-14 23:09:25 +02001800
1801 return CMD_SUCCESS;
1802}
1803
Harald Welte8f0ed552010-05-11 21:53:49 +02001804#define GPRS_TEXT "GPRS Packet Network\n"
1805
Harald Welteaf387632010-03-14 23:30:30 +08001806DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welte57ba7e32010-04-18 14:00:26 +02001807 "gprs cell bvci <2-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001808 GPRS_TEXT
1809 "GPRS Cell Settings\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001810 "GPRS BSSGP VC Identifier")
1811{
1812 struct gsm_bts *bts = vty->index;
1813
Harald Welte4511d892010-04-18 15:51:20 +02001814 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001815 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1816 return CMD_WARNING;
1817 }
1818
Harald Welte97a282b2010-03-14 15:37:43 +08001819 bts->gprs.cell.bvci = atoi(argv[0]);
1820
1821 return CMD_SUCCESS;
1822}
1823
Harald Weltea5731cf2010-03-22 11:48:36 +08001824DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
1825 "gprs nsei <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001826 GPRS_TEXT
Harald Weltea5731cf2010-03-22 11:48:36 +08001827 "GPRS NS Entity Identifier")
1828{
1829 struct gsm_bts *bts = vty->index;
1830
Harald Welte4511d892010-04-18 15:51:20 +02001831 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltea5731cf2010-03-22 11:48:36 +08001832 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1833 return CMD_WARNING;
1834 }
1835
1836 bts->gprs.nse.nsei = atoi(argv[0]);
1837
1838 return CMD_SUCCESS;
1839}
1840
Harald Welte8f0ed552010-05-11 21:53:49 +02001841#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
1842 "NSVC Logical Number\n"
Harald Weltea5731cf2010-03-22 11:48:36 +08001843
Harald Welte97a282b2010-03-14 15:37:43 +08001844DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
1845 "gprs nsvc <0-1> nsvci <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001846 GPRS_TEXT NSVC_TEXT
1847 "NS Virtual Connection Identifier\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001848 "GPRS NS VC Identifier")
1849{
1850 struct gsm_bts *bts = vty->index;
1851 int idx = atoi(argv[0]);
1852
Harald Welte4511d892010-04-18 15:51:20 +02001853 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001854 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1855 return CMD_WARNING;
1856 }
1857
Harald Welte97a282b2010-03-14 15:37:43 +08001858 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
1859
1860 return CMD_SUCCESS;
1861}
1862
Harald Welteaf387632010-03-14 23:30:30 +08001863DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
1864 "gprs nsvc <0-1> local udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001865 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001866 "GPRS NS Local UDP Port")
1867{
1868 struct gsm_bts *bts = vty->index;
1869 int idx = atoi(argv[0]);
1870
Harald Welte4511d892010-04-18 15:51:20 +02001871 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001872 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1873 return CMD_WARNING;
1874 }
1875
Harald Welteaf387632010-03-14 23:30:30 +08001876 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
1877
1878 return CMD_SUCCESS;
1879}
1880
1881DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
1882 "gprs nsvc <0-1> remote udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001883 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001884 "GPRS NS Remote UDP Port")
1885{
1886 struct gsm_bts *bts = vty->index;
1887 int idx = atoi(argv[0]);
1888
Harald Welte4511d892010-04-18 15:51:20 +02001889 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001890 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1891 return CMD_WARNING;
1892 }
1893
Harald Welteaf387632010-03-14 23:30:30 +08001894 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
1895
1896 return CMD_SUCCESS;
1897}
1898
1899DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
1900 "gprs nsvc <0-1> remote ip A.B.C.D",
Harald Welte8f0ed552010-05-11 21:53:49 +02001901 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001902 "GPRS NS Remote IP Address")
1903{
1904 struct gsm_bts *bts = vty->index;
1905 int idx = atoi(argv[0]);
1906 struct in_addr ia;
1907
Harald Welte4511d892010-04-18 15:51:20 +02001908 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001909 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1910 return CMD_WARNING;
1911 }
1912
Harald Welteaf387632010-03-14 23:30:30 +08001913 inet_aton(argv[1], &ia);
1914 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
1915
1916 return CMD_SUCCESS;
1917}
1918
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08001919DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd,
1920 "paging free FREE_NR",
1921 "Only page when having a certain amount of free slots. -1 to disable")
1922{
1923 struct gsm_bts *bts = vty->index;
1924
1925 bts->paging.free_chans_need = atoi(argv[0]);
1926 return CMD_SUCCESS;
1927}
1928
Harald Welte615e9562010-05-11 23:50:21 +02001929DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd,
1930 "gprs ns timer " NS_TIMERS " <0-255>",
1931 GPRS_TEXT "Network Service\n"
1932 "Network Service Timer\n"
1933 NS_TIMERS_HELP "Timer Value\n")
1934{
1935 struct gsm_bts *bts = vty->index;
1936 int idx = get_string_value(gprs_ns_timer_strs, argv[0]);
1937 int val = atoi(argv[1]);
1938
1939 if (bts->gprs.mode == BTS_GPRS_NONE) {
1940 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1941 return CMD_WARNING;
1942 }
1943
1944 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
1945 return CMD_WARNING;
1946
1947 bts->gprs.nse.timer[idx] = val;
1948
1949 return CMD_SUCCESS;
1950}
1951
1952#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 +02001953#define BSSGP_TIMERS_HELP \
1954 "Tbvc-block timeout\n" \
1955 "Tbvc-block retries\n" \
1956 "Tbvc-unblock retries\n" \
1957 "Tbvcc-reset timeout\n" \
1958 "Tbvc-reset retries\n" \
1959 "Tbvc-suspend timeout\n" \
1960 "Tbvc-suspend retries\n" \
1961 "Tbvc-resume timeout\n" \
1962 "Tbvc-resume retries\n" \
1963 "Tbvc-capa-update timeout\n" \
1964 "Tbvc-capa-update retries\n"
Harald Welte615e9562010-05-11 23:50:21 +02001965
1966DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd,
1967 "gprs cell timer " BSSGP_TIMERS " <0-255>",
1968 GPRS_TEXT "Cell / BSSGP\n"
1969 "Cell/BSSGP Timer\n"
1970 BSSGP_TIMERS_HELP "Timer Value\n")
1971{
1972 struct gsm_bts *bts = vty->index;
1973 int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
1974 int val = atoi(argv[1]);
1975
1976 if (bts->gprs.mode == BTS_GPRS_NONE) {
1977 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1978 return CMD_WARNING;
1979 }
1980
1981 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer))
1982 return CMD_WARNING;
1983
1984 bts->gprs.cell.timer[idx] = val;
1985
1986 return CMD_SUCCESS;
1987}
1988
Harald Welte97a282b2010-03-14 15:37:43 +08001989DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
1990 "gprs routing area <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001991 GPRS_TEXT
Harald Welte97a282b2010-03-14 15:37:43 +08001992 "GPRS Routing Area Code")
1993{
1994 struct gsm_bts *bts = vty->index;
1995
Harald Welte4511d892010-04-18 15:51:20 +02001996 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001997 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1998 return CMD_WARNING;
1999 }
2000
Harald Welte97a282b2010-03-14 15:37:43 +08002001 bts->gprs.rac = atoi(argv[0]);
2002
2003 return CMD_SUCCESS;
2004}
2005
Harald Welte4511d892010-04-18 15:51:20 +02002006DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
2007 "gprs mode (none|gprs|egprs)",
Harald Welte8f0ed552010-05-11 21:53:49 +02002008 GPRS_TEXT
2009 "GPRS Mode for this BTS\n"
2010 "GPRS Disabled on this BTS\n"
2011 "GPRS Enabled on this BTS\n"
2012 "EGPRS (EDGE) Enabled on this BTS\n")
Harald Welteaf387632010-03-14 23:30:30 +08002013{
2014 struct gsm_bts *bts = vty->index;
Harald Weltef3d8e922010-06-14 22:44:42 +02002015 enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0]);
Harald Welteaf387632010-03-14 23:30:30 +08002016
Harald Weltef3d8e922010-06-14 22:44:42 +02002017 if (mode != BTS_GPRS_NONE &&
2018 !gsm_bts_has_feature(bts, BTS_FEAT_GPRS)) {
2019 vty_out(vty, "This BTS type does not support %s%s", argv[0],
2020 VTY_NEWLINE);
2021 return CMD_WARNING;
2022 }
2023 if (mode == BTS_GPRS_EGPRS &&
2024 !gsm_bts_has_feature(bts, BTS_FEAT_EGPRS)) {
2025 vty_out(vty, "This BTS type does not support %s%s", argv[0],
2026 VTY_NEWLINE);
2027 return CMD_WARNING;
2028 }
2029
2030 bts->gprs.mode = mode;
Harald Welteaf387632010-03-14 23:30:30 +08002031
2032 return CMD_SUCCESS;
2033}
2034
Harald Welte9fbff4a2010-07-30 11:50:09 +02002035#define SI_TEXT "System Information Messages\n"
2036#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)"
2037#define SI_TYPE_HELP "System Information Type 1\n" \
2038 "System Information Type 2\n" \
2039 "System Information Type 3\n" \
2040 "System Information Type 4\n" \
2041 "System Information Type 5\n" \
2042 "System Information Type 6\n" \
2043 "System Information Type 7\n" \
2044 "System Information Type 8\n" \
2045 "System Information Type 9\n" \
2046 "System Information Type 10\n" \
2047 "System Information Type 13\n" \
2048 "System Information Type 16\n" \
2049 "System Information Type 17\n" \
2050 "System Information Type 18\n" \
2051 "System Information Type 19\n" \
2052 "System Information Type 20\n" \
2053 "System Information Type 2bis\n" \
2054 "System Information Type 2ter\n" \
2055 "System Information Type 2quater\n" \
2056 "System Information Type 5bis\n" \
2057 "System Information Type 5ter\n"
2058
2059DEFUN(cfg_bts_si_mode, cfg_bts_si_mode_cmd,
2060 "system-information " SI_TYPE_TEXT " mode (static|computed)",
2061 SI_TEXT SI_TYPE_HELP
2062 "System Information Mode\n"
2063 "Static user-specified\n"
2064 "Dynamic, BSC-computed\n")
2065{
2066 struct gsm_bts *bts = vty->index;
2067 int type;
2068
2069 type = get_string_value(osmo_sitype_strs, argv[0]);
2070 if (type < 0) {
2071 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2072 return CMD_WARNING;
2073 }
2074
2075 if (!strcmp(argv[1], "static"))
2076 bts->si_mode_static |= (1 << type);
2077 else
2078 bts->si_mode_static &= ~(1 << type);
2079
2080 return CMD_SUCCESS;
2081}
2082
2083DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd,
2084 "system-information " SI_TYPE_TEXT " static HEXSTRING",
2085 SI_TEXT SI_TYPE_HELP
2086 "Static System Information filling\n"
2087 "Static user-specified SI content in HEX notation\n")
2088{
2089 struct gsm_bts *bts = vty->index;
2090 int rc, type;
2091
2092 type = get_string_value(osmo_sitype_strs, argv[0]);
2093 if (type < 0) {
2094 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2095 return CMD_WARNING;
2096 }
2097
2098 if (!(bts->si_mode_static & (1 << type))) {
2099 vty_out(vty, "SI Type %s is not configured in static mode%s",
2100 get_value_string(osmo_sitype_strs, type), VTY_NEWLINE);
2101 return CMD_WARNING;
2102 }
2103
Harald Welte290aaed2010-07-30 11:53:18 +02002104 /* Fill buffer with padding pattern */
2105 memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type]));
2106
2107 /* Parse the user-specified SI in hex format, [partially] overwriting padding */
Harald Welte9fbff4a2010-07-30 11:50:09 +02002108 rc = hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0]));
2109 if (rc < 0 || rc > sizeof(bts->si_buf[0])) {
2110 vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
2111 return CMD_WARNING;
2112 }
2113
2114 /* Mark this SI as present */
2115 bts->si_valid |= (1 << type);
2116
2117 return CMD_SUCCESS;
2118}
2119
2120
Harald Welte8f0ed552010-05-11 21:53:49 +02002121#define TRX_TEXT "Radio Transceiver\n"
Harald Welte7a8fa412009-08-10 13:48:16 +02002122
Harald Welte5258fc42009-03-28 19:07:53 +00002123/* per TRX configuration */
2124DEFUN(cfg_trx,
2125 cfg_trx_cmd,
2126 "trx TRX_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02002127 TRX_TEXT
Harald Welte5258fc42009-03-28 19:07:53 +00002128 "Select a TRX to configure")
2129{
2130 int trx_nr = atoi(argv[0]);
2131 struct gsm_bts *bts = vty->index;
2132 struct gsm_bts_trx *trx;
2133
Harald Weltee441d9c2009-06-21 16:17:15 +02002134 if (trx_nr > bts->num_trx) {
2135 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
2136 bts->num_trx, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00002137 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02002138 } else if (trx_nr == bts->num_trx) {
2139 /* we need to allocate a new one */
2140 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02002141 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02002142 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02002143
Harald Weltee441d9c2009-06-21 16:17:15 +02002144 if (!trx)
2145 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +00002146
2147 vty->index = trx;
Harald Welte197dea92010-05-14 17:59:53 +02002148 vty->index_sub = &trx->description;
Harald Welte5258fc42009-03-28 19:07:53 +00002149 vty->node = TRX_NODE;
2150
2151 return CMD_SUCCESS;
2152}
2153
2154DEFUN(cfg_trx_arfcn,
2155 cfg_trx_arfcn_cmd,
Harald Welte93e90202010-05-14 19:00:52 +02002156 "arfcn <0-1024>",
Harald Welte5258fc42009-03-28 19:07:53 +00002157 "Set the ARFCN for this TRX\n")
2158{
2159 int arfcn = atoi(argv[0]);
2160 struct gsm_bts_trx *trx = vty->index;
2161
2162 /* FIXME: check if this ARFCN is supported by this TRX */
2163
2164 trx->arfcn = arfcn;
2165
2166 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
2167 /* FIXME: use OML layer to update the ARFCN */
2168 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
2169
2170 return CMD_SUCCESS;
2171}
2172
Harald Welte (local)7b37d972009-12-27 20:56:38 +01002173DEFUN(cfg_trx_nominal_power,
2174 cfg_trx_nominal_power_cmd,
2175 "nominal power <0-100>",
2176 "Nominal TRX RF Power in dB\n")
2177{
2178 struct gsm_bts_trx *trx = vty->index;
2179
2180 trx->nominal_power = atoi(argv[0]);
2181
2182 return CMD_SUCCESS;
2183}
2184
Harald Weltefcd24452009-06-20 18:15:19 +02002185DEFUN(cfg_trx_max_power_red,
2186 cfg_trx_max_power_red_cmd,
2187 "max_power_red <0-100>",
2188 "Reduction of maximum BS RF Power in dB\n")
2189{
2190 int maxpwr_r = atoi(argv[0]);
2191 struct gsm_bts_trx *trx = vty->index;
Harald Welte61a83b22009-11-18 09:20:22 +01002192 int upper_limit = 24; /* default 12.21 max power red. */
Harald Weltefcd24452009-06-20 18:15:19 +02002193
2194 /* FIXME: check if our BTS type supports more than 12 */
2195 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
2196 vty_out(vty, "%% Power %d dB is not in the valid range%s",
2197 maxpwr_r, VTY_NEWLINE);
2198 return CMD_WARNING;
2199 }
2200 if (maxpwr_r & 1) {
2201 vty_out(vty, "%% Power %d dB is not an even value%s",
2202 maxpwr_r, VTY_NEWLINE);
2203 return CMD_WARNING;
2204 }
2205
2206 trx->max_power_red = maxpwr_r;
2207
2208 /* FIXME: make sure we update this using OML */
2209
2210 return CMD_SUCCESS;
2211}
2212
Harald Welte42581822009-08-08 16:12:58 +02002213DEFUN(cfg_trx_rsl_e1,
2214 cfg_trx_rsl_e1_cmd,
2215 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
2216 "E1 interface to be used for RSL\n")
2217{
2218 struct gsm_bts_trx *trx = vty->index;
2219
2220 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
2221
2222 return CMD_SUCCESS;
2223}
2224
2225DEFUN(cfg_trx_rsl_e1_tei,
2226 cfg_trx_rsl_e1_tei_cmd,
2227 "rsl e1 tei <0-63>",
2228 "Set the TEI to be used for RSL")
2229{
2230 struct gsm_bts_trx *trx = vty->index;
2231
2232 trx->rsl_tei = atoi(argv[0]);
2233
2234 return CMD_SUCCESS;
2235}
2236
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01002237DEFUN(cfg_trx_rf_locked,
2238 cfg_trx_rf_locked_cmd,
2239 "rf_locked (0|1)",
2240 "Turn off RF of the TRX.\n")
2241{
2242 int locked = atoi(argv[0]);
2243 struct gsm_bts_trx *trx = vty->index;
2244
2245 gsm_trx_lock_rf(trx, locked);
2246 return CMD_SUCCESS;
2247}
Harald Welte42581822009-08-08 16:12:58 +02002248
Harald Welte5258fc42009-03-28 19:07:53 +00002249/* per TS configuration */
2250DEFUN(cfg_ts,
2251 cfg_ts_cmd,
Harald Welte42581822009-08-08 16:12:58 +02002252 "timeslot <0-7>",
Harald Welte5258fc42009-03-28 19:07:53 +00002253 "Select a Timeslot to configure")
2254{
2255 int ts_nr = atoi(argv[0]);
2256 struct gsm_bts_trx *trx = vty->index;
2257 struct gsm_bts_trx_ts *ts;
2258
2259 if (ts_nr >= TRX_NR_TS) {
2260 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
2261 TRX_NR_TS, VTY_NEWLINE);
2262 return CMD_WARNING;
2263 }
2264
2265 ts = &trx->ts[ts_nr];
2266
2267 vty->index = ts;
2268 vty->node = TS_NODE;
2269
2270 return CMD_SUCCESS;
2271}
2272
Harald Weltea6fd58e2009-08-07 00:25:23 +02002273DEFUN(cfg_ts_pchan,
2274 cfg_ts_pchan_cmd,
2275 "phys_chan_config PCHAN",
2276 "Physical Channel configuration (TCH/SDCCH/...)")
2277{
2278 struct gsm_bts_trx_ts *ts = vty->index;
2279 int pchanc;
2280
2281 pchanc = gsm_pchan_parse(argv[0]);
2282 if (pchanc < 0)
2283 return CMD_WARNING;
2284
2285 ts->pchan = pchanc;
2286
2287 return CMD_SUCCESS;
2288}
2289
Harald Weltea39b0f22010-06-14 22:26:10 +02002290#define HOPPING_STR "Configure frequency hopping\n"
2291
2292DEFUN(cfg_ts_hopping,
2293 cfg_ts_hopping_cmd,
2294 "hopping enabled (0|1)",
2295 HOPPING_STR "Enable or disable frequency hopping\n"
2296 "Disable frequency hopping\n" "Enable frequency hopping\n")
2297{
2298 struct gsm_bts_trx_ts *ts = vty->index;
Harald Weltec2fb3d02010-06-14 22:47:37 +02002299 int enabled = atoi(argv[0]);
Harald Weltea39b0f22010-06-14 22:26:10 +02002300
Harald Weltec2fb3d02010-06-14 22:47:37 +02002301 if (enabled && !gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_HOPPING)) {
2302 vty_out(vty, "BTS model does not support hopping%s",
2303 VTY_NEWLINE);
2304 return CMD_WARNING;
2305 }
2306
2307 ts->hopping.enabled = enabled;
Harald Weltea39b0f22010-06-14 22:26:10 +02002308
2309 return CMD_SUCCESS;
2310}
2311
Harald Welte6e0cd042009-09-12 13:05:33 +02002312DEFUN(cfg_ts_hsn,
2313 cfg_ts_hsn_cmd,
Harald Weltea39b0f22010-06-14 22:26:10 +02002314 "hopping sequence-number <0-63>",
2315 HOPPING_STR
Harald Welte6e0cd042009-09-12 13:05:33 +02002316 "Which hopping sequence to use for this channel")
2317{
2318 struct gsm_bts_trx_ts *ts = vty->index;
2319
2320 ts->hopping.hsn = atoi(argv[0]);
2321
2322 return CMD_SUCCESS;
2323}
2324
2325DEFUN(cfg_ts_maio,
2326 cfg_ts_maio_cmd,
2327 "hopping maio <0-63>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002328 HOPPING_STR
Harald Welte6e0cd042009-09-12 13:05:33 +02002329 "Which hopping MAIO to use for this channel")
2330{
2331 struct gsm_bts_trx_ts *ts = vty->index;
2332
2333 ts->hopping.maio = atoi(argv[0]);
2334
2335 return CMD_SUCCESS;
2336}
2337
2338DEFUN(cfg_ts_arfcn_add,
2339 cfg_ts_arfcn_add_cmd,
2340 "hopping arfcn add <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002341 HOPPING_STR "Configure hopping ARFCN list\n"
2342 "Add an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02002343{
2344 struct gsm_bts_trx_ts *ts = vty->index;
2345 int arfcn = atoi(argv[0]);
2346
Harald Weltea39b0f22010-06-14 22:26:10 +02002347 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1);
2348
Harald Welte6e0cd042009-09-12 13:05:33 +02002349 return CMD_SUCCESS;
2350}
2351
2352DEFUN(cfg_ts_arfcn_del,
2353 cfg_ts_arfcn_del_cmd,
2354 "hopping arfcn del <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002355 HOPPING_STR "Configure hopping ARFCN list\n"
2356 "Delete an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02002357{
2358 struct gsm_bts_trx_ts *ts = vty->index;
2359 int arfcn = atoi(argv[0]);
2360
Harald Weltea39b0f22010-06-14 22:26:10 +02002361 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0);
2362
Harald Welte6e0cd042009-09-12 13:05:33 +02002363 return CMD_SUCCESS;
2364}
2365
Harald Weltea6fd58e2009-08-07 00:25:23 +02002366DEFUN(cfg_ts_e1_subslot,
2367 cfg_ts_e1_subslot_cmd,
Harald Welte42581822009-08-08 16:12:58 +02002368 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltea6fd58e2009-08-07 00:25:23 +02002369 "E1 sub-slot connected to this on-air timeslot")
2370{
2371 struct gsm_bts_trx_ts *ts = vty->index;
2372
Harald Welte42581822009-08-08 16:12:58 +02002373 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002374
2375 return CMD_SUCCESS;
2376}
Harald Welte5258fc42009-03-28 19:07:53 +00002377
Harald Welte4f10c252010-05-16 21:47:13 +02002378void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
2379{
2380 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
2381 counter_get(net->stats.chreq.total),
2382 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
2383 vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
2384 counter_get(net->stats.chan.rf_fail),
2385 counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
2386 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
2387 counter_get(net->stats.paging.attempted),
2388 counter_get(net->stats.paging.completed),
2389 counter_get(net->stats.paging.expired), VTY_NEWLINE);
2390 vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
2391 counter_get(net->stats.bts.oml_fail),
2392 counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
2393}
2394
Harald Welte5bc61dc2010-05-16 22:02:16 +02002395DEFUN(logging_fltr_imsi,
2396 logging_fltr_imsi_cmd,
2397 "logging filter imsi IMSI",
2398 LOGGING_STR FILTER_STR
2399 "Filter log messages by IMSI\n" "IMSI to be used as filter\n")
2400{
2401 struct telnet_connection *conn;
2402
2403 conn = (struct telnet_connection *) vty->priv;
2404 if (!conn->dbg) {
2405 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
2406 return CMD_WARNING;
2407 }
2408
2409 log_set_imsi_filter(conn->dbg, argv[0]);
2410 return CMD_SUCCESS;
2411}
2412
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002413DEFUN(drop_bts,
2414 drop_bts_cmd,
Holger Hans Peter Freyther0586b0f2010-04-11 12:46:45 +02002415 "drop bts connection <0-65535> (oml|rsl)",
2416 "Debug/Simulation command to drop ipaccess BTS\n"
2417 "BTS NR\n" "Connection Type\n")
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002418{
2419 struct gsm_network *gsmnet;
2420 struct gsm_bts_trx *trx;
2421 struct gsm_bts *bts;
2422 unsigned int bts_nr;
2423
2424 gsmnet = gsmnet_from_vty(vty);
2425
2426 bts_nr = atoi(argv[0]);
2427 if (bts_nr >= gsmnet->num_bts) {
2428 vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s",
2429 gsmnet->num_bts, bts_nr, VTY_NEWLINE);
2430 return CMD_WARNING;
2431 }
2432
2433 bts = gsm_bts_num(gsmnet, bts_nr);
2434 if (!bts) {
2435 vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE);
2436 return CMD_WARNING;
2437 }
2438
2439 if (!is_ipaccess_bts(bts)) {
2440 vty_out(vty, "This command only works for ipaccess.%s", VTY_NEWLINE);
2441 return CMD_WARNING;
2442 }
2443
2444
2445 /* close all connections */
2446 if (strcmp(argv[1], "oml") == 0) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01002447 ipaccess_drop_oml(bts);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002448 } else if (strcmp(argv[1], "rsl") == 0) {
2449 /* close all rsl connections */
2450 llist_for_each_entry(trx, &bts->trx_list, list) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01002451 ipaccess_drop_rsl(trx);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002452 }
2453 } else {
2454 vty_out(vty, "Argument must be 'oml# or 'rsl'.%s", VTY_NEWLINE);
2455 return CMD_WARNING;
2456 }
2457
2458 return CMD_SUCCESS;
2459}
2460
Harald Welted0d2b0b2010-12-23 13:18:07 +01002461DEFUN(pdch_act, pdch_act_cmd,
2462 "bts <0-255> trx <0-255> timeslot <0-7> pdch (activate|deactivate)",
2463 "BTS related commands\n" "BTS Number\n" "Transceiver\n" "Transceiver Number\n"
2464 "TRX Timeslot\n" "Timeslot Number\n" "Packet Data Channel\n"
2465 "Activate Dynamic PDCH/TCH (-> PDCH mode)\n"
2466 "Deactivate Dynamic PDCH/TCH (-> TCH mode)\n")
2467{
2468 struct gsm_bts *bts;
2469 struct gsm_bts_trx *trx;
2470 struct gsm_bts_trx_ts *ts;
2471 int bts_nr = atoi(argv[0]);
2472 int trx_nr = atoi(argv[1]);
2473 int ts_nr = atoi(argv[2]);
2474 int activate;
2475
2476 bts = gsm_bts_num(bsc_gsmnet, bts_nr);
2477 if (!bts) {
2478 vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE);
2479 return CMD_WARNING;
2480 }
2481
2482 if (!is_ipaccess_bts(bts)) {
2483 vty_out(vty, "%% This command only works for ipaccess BTS%s",
2484 VTY_NEWLINE);
2485 return CMD_WARNING;
2486 }
2487
2488 trx = gsm_bts_trx_num(bts, trx_nr);
2489 if (!trx) {
2490 vty_out(vty, "%% No such TRX (%d)%s", trx_nr, VTY_NEWLINE);
2491 return CMD_WARNING;
2492 }
2493
2494 ts = &trx->ts[ts_nr];
2495 if (ts->pchan != GSM_PCHAN_TCH_F_PDCH) {
2496 vty_out(vty, "%% Timeslot %u is not in dynamic TCH_F/PDCH "
2497 "mode%s", ts_nr, VTY_NEWLINE);
2498 return CMD_WARNING;
2499 }
2500
2501 if (!strcmp(argv[3], "activate"))
2502 activate = 1;
2503 else
2504 activate = 0;
2505
2506 rsl_ipacc_pdch_activate(ts, activate);
2507
2508 return CMD_SUCCESS;
2509
2510}
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002511
Harald Weltedcccb182010-05-16 20:52:23 +02002512extern int bsc_vty_init_extra(void);
Harald Welte1353f962010-05-16 19:20:24 +02002513extern const char *openbsc_copyright;
Holger Hans Peter Freythere1ffc082010-04-10 00:08:28 +02002514
Harald Weltedcccb182010-05-16 20:52:23 +02002515int bsc_vty_init(void)
Harald Welte68628e82009-03-10 12:17:57 +00002516{
Harald Welteb4d5b172010-05-12 16:10:35 +00002517 install_element_ve(&show_net_cmd);
2518 install_element_ve(&show_bts_cmd);
2519 install_element_ve(&show_trx_cmd);
2520 install_element_ve(&show_ts_cmd);
2521 install_element_ve(&show_lchan_cmd);
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08002522 install_element_ve(&show_lchan_summary_cmd);
Harald Welte5bc61dc2010-05-16 22:02:16 +02002523 install_element_ve(&logging_fltr_imsi_cmd);
Harald Welte1bc77352009-03-10 19:47:51 +00002524
Harald Welteb4d5b172010-05-12 16:10:35 +00002525 install_element_ve(&show_e1drv_cmd);
2526 install_element_ve(&show_e1line_cmd);
2527 install_element_ve(&show_e1ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002528
Harald Welteb4d5b172010-05-12 16:10:35 +00002529 install_element_ve(&show_paging_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002530
Harald Welte5bc61dc2010-05-16 22:02:16 +02002531 logging_vty_add_cmds();
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +01002532
Harald Welte5013b2a2009-08-07 13:29:14 +02002533 install_element(CONFIG_NODE, &cfg_net_cmd);
2534 install_node(&net_node, config_write_net);
2535 install_default(GSMNET_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002536 install_element(GSMNET_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002537 install_element(GSMNET_NODE, &ournode_end_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002538 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002539 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
2540 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
2541 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)69de3972009-08-12 14:42:23 +02002542 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte1085c092009-11-18 20:33:19 +01002543 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Welte4381cfe2009-08-30 15:47:06 +09002544 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01002545 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welteeab84a12009-12-13 10:53:12 +01002546 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte3d23db42009-12-14 17:49:15 +01002547 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Weltebc814502009-12-19 21:41:52 +01002548 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Welteb720bd32009-12-21 16:51:50 +01002549 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
2550 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
2551 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
2552 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
2553 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
2554 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01002555 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01002556 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
2557 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
2558 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
2559 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
2560 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
2561 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
2562 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
2563 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
2564 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
Harald Weltec9f499f2010-12-23 22:53:50 +01002565 install_element(GSMNET_NODE, &cfg_net_T3122_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01002566 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08002567 install_element(GSMNET_NODE, &cfg_net_dtx_cmd);
Holger Hans Peter Freytherae9006a2010-12-22 16:26:04 +01002568 install_element(GSMNET_NODE, &cfg_net_subscr_keep_cmd);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08002569 install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002570
2571 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte67ce0732009-08-06 19:06:46 +02002572 install_node(&bts_node, config_write_bts);
Harald Welte68628e82009-03-10 12:17:57 +00002573 install_default(BTS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002574 install_element(BTS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002575 install_element(BTS_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002576 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002577 install_element(BTS_NODE, &cfg_description_cmd);
2578 install_element(BTS_NODE, &cfg_no_description_cmd);
Harald Weltefcd24452009-06-20 18:15:19 +02002579 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02002580 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002581 install_element(BTS_NODE, &cfg_bts_lac_cmd);
2582 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002583 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte4cc34222009-05-01 15:12:31 +00002584 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte8175e952009-10-20 00:22:00 +02002585 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002586 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
2587 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02002588 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01002589 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
2590 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08002591 install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd);
2592 install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02002593 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08002594 install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd);
Harald Welte (local)0e451d02009-08-13 10:14:26 +02002595 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)efc92312009-08-14 23:09:25 +02002596 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welte73225282009-12-12 18:17:25 +01002597 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
2598 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002599 install_element(BTS_NODE, &cfg_bts_cell_bar_qualify_cmd);
2600 install_element(BTS_NODE, &cfg_bts_cell_resel_ofs_cmd);
2601 install_element(BTS_NODE, &cfg_bts_temp_ofs_cmd);
2602 install_element(BTS_NODE, &cfg_bts_temp_ofs_inf_cmd);
2603 install_element(BTS_NODE, &cfg_bts_penalty_time_cmd);
2604 install_element(BTS_NODE, &cfg_bts_penalty_time_rsvd_cmd);
Harald Welte4511d892010-04-18 15:51:20 +02002605 install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002606 install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002607 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
2608 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002609 install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
Harald Weltea5731cf2010-03-22 11:48:36 +08002610 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002611 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welteaf387632010-03-14 23:30:30 +08002612 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
2613 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
2614 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08002615 install_element(BTS_NODE, &cfg_bts_pag_free_cmd);
Harald Welte9fbff4a2010-07-30 11:50:09 +02002616 install_element(BTS_NODE, &cfg_bts_si_mode_cmd);
2617 install_element(BTS_NODE, &cfg_bts_si_static_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002618
Harald Welte5258fc42009-03-28 19:07:53 +00002619 install_element(BTS_NODE, &cfg_trx_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002620 install_node(&trx_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002621 install_default(TRX_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002622 install_element(TRX_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002623 install_element(TRX_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002624 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002625 install_element(TRX_NODE, &cfg_description_cmd);
2626 install_element(TRX_NODE, &cfg_no_description_cmd);
Harald Welte (local)7b37d972009-12-27 20:56:38 +01002627 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte879dc972009-06-20 22:36:12 +02002628 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002629 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
2630 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01002631 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002632
Harald Welte5258fc42009-03-28 19:07:53 +00002633 install_element(TRX_NODE, &cfg_ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002634 install_node(&ts_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002635 install_default(TS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002636 install_element(TS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002637 install_element(TS_NODE, &ournode_end_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002638 install_element(TS_NODE, &cfg_ts_pchan_cmd);
Harald Weltea39b0f22010-06-14 22:26:10 +02002639 install_element(TS_NODE, &cfg_ts_hopping_cmd);
Harald Welte6e0cd042009-09-12 13:05:33 +02002640 install_element(TS_NODE, &cfg_ts_hsn_cmd);
2641 install_element(TS_NODE, &cfg_ts_maio_cmd);
2642 install_element(TS_NODE, &cfg_ts_arfcn_add_cmd);
2643 install_element(TS_NODE, &cfg_ts_arfcn_del_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002644 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002645
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002646 install_element(ENABLE_NODE, &drop_bts_cmd);
Harald Welted0d2b0b2010-12-23 13:18:07 +01002647 install_element(ENABLE_NODE, &pdch_act_cmd);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002648
Harald Welte81c9b9c2010-05-31 16:40:40 +02002649 abis_nm_vty_init();
2650
Harald Weltedcccb182010-05-16 20:52:23 +02002651 bsc_vty_init_extra();
Harald Welte40f82892009-05-23 17:31:39 +00002652
Harald Welte68628e82009-03-10 12:17:57 +00002653 return 0;
2654}