blob: 40e7342123a7d7f588c49bfb4f76766f21da0071 [file] [log] [blame]
Harald Welte68628e82009-03-10 12:17:57 +00001/* OpenBSC interface to quagga VTY */
Harald Welteaf387632010-03-14 23:30:30 +08002/* (C) 2009-2010 by Harald Welte <laforge@gnumonks.org>
Harald Welte68628e82009-03-10 12:17:57 +00003 * All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#include <stdlib.h>
22#include <unistd.h>
23#include <sys/types.h>
24
Harald Welte4b037e42010-05-19 19:45:32 +020025#include <osmocom/vty/command.h>
26#include <osmocom/vty/buffer.h>
27#include <osmocom/vty/vty.h>
28#include <osmocom/vty/logging.h>
29#include <osmocom/vty/telnet_interface.h>
Harald Welte68628e82009-03-10 12:17:57 +000030
31#include <arpa/inet.h>
32
Harald Weltedfe6c7d2010-02-20 16:24:02 +010033#include <osmocore/linuxlist.h>
Harald Welte68628e82009-03-10 12:17:57 +000034#include <openbsc/gsm_data.h>
Harald Welte68628e82009-03-10 12:17:57 +000035#include <openbsc/e1_input.h>
Harald Welte1bc77352009-03-10 19:47:51 +000036#include <openbsc/abis_nm.h>
Harald Welte9fbff4a2010-07-30 11:50:09 +020037#include <osmocore/utils.h>
Harald Weltedfe6c7d2010-02-20 16:24:02 +010038#include <osmocore/gsm_utils.h>
Harald Welteb908cb72009-12-22 13:09:29 +010039#include <openbsc/chan_alloc.h>
Harald Welte8387a492009-12-22 21:43:14 +010040#include <openbsc/meas_rep.h>
Harald Welte40f82892009-05-23 17:31:39 +000041#include <openbsc/db.h>
Harald Weltedfe6c7d2010-02-20 16:24:02 +010042#include <osmocore/talloc.h>
Holger Hans Peter Freyther3c712322010-04-06 11:55:37 +020043#include <openbsc/vty.h>
Harald Welte22229d62010-05-12 20:28:04 +020044#include <openbsc/gprs_ns.h>
Harald Welte9fbff4a2010-07-30 11:50:09 +020045#include <openbsc/system_information.h>
Harald Welte5bc61dc2010-05-16 22:02:16 +020046#include <openbsc/debug.h>
Holger Hans Peter Freyther85334f12010-11-09 17:00:42 +010047#include <openbsc/paging.h>
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +010048#include <openbsc/ipaccess.h>
Harald Welted0d2b0b2010-12-23 13:18:07 +010049#include <openbsc/abis_rsl.h>
Harald Welte68628e82009-03-10 12:17:57 +000050
Harald Welte1353f962010-05-16 19:20:24 +020051#include "../bscconfig.h"
52
Harald Welteea4647d2010-05-12 17:19:53 +000053/* FIXME: this should go to some common file */
54static const struct value_string gprs_ns_timer_strs[] = {
Harald Welte615e9562010-05-11 23:50:21 +020055 { 0, "tns-block" },
56 { 1, "tns-block-retries" },
57 { 2, "tns-reset" },
58 { 3, "tns-reset-retries" },
59 { 4, "tns-test" },
60 { 5, "tns-alive" },
61 { 6, "tns-alive-retries" },
62 { 0, NULL }
63};
64
Harald Welteea4647d2010-05-12 17:19:53 +000065static const struct value_string gprs_bssgp_cfg_strs[] = {
Harald Welte615e9562010-05-11 23:50:21 +020066 { 0, "blocking-timer" },
67 { 1, "blocking-retries" },
68 { 2, "unblocking-retries" },
69 { 3, "reset-timer" },
70 { 4, "reset-retries" },
71 { 5, "suspend-timer" },
72 { 6, "suspend-retries" },
73 { 7, "resume-timer" },
74 { 8, "resume-retries" },
75 { 9, "capability-update-timer" },
76 { 10, "capability-update-retries" },
77 { 0, NULL }
78};
79
Harald Welte5013b2a2009-08-07 13:29:14 +020080struct cmd_node net_node = {
81 GSMNET_NODE,
82 "%s(network)#",
83 1,
84};
85
Harald Welte68628e82009-03-10 12:17:57 +000086struct cmd_node bts_node = {
87 BTS_NODE,
88 "%s(bts)#",
89 1,
90};
91
92struct cmd_node trx_node = {
93 TRX_NODE,
94 "%s(trx)#",
95 1,
96};
97
98struct cmd_node ts_node = {
99 TS_NODE,
100 "%s(ts)#",
101 1,
102};
103
Harald Welte39231152010-05-27 13:39:40 +0200104extern struct gsm_network *bsc_gsmnet;
105
Harald Weltedcccb182010-05-16 20:52:23 +0200106struct gsm_network *gsmnet_from_vty(struct vty *v)
107{
Harald Welte39231152010-05-27 13:39:40 +0200108 /* In case we read from the config file, the vty->priv cannot
109 * point to a struct telnet_connection, and thus conn->priv
110 * will not point to the gsm_network structure */
111#if 0
Harald Weltedcccb182010-05-16 20:52:23 +0200112 struct telnet_connection *conn = v->priv;
113 return (struct gsm_network *) conn->priv;
Harald Welte39231152010-05-27 13:39:40 +0200114#else
115 return bsc_gsmnet;
116#endif
Harald Weltedcccb182010-05-16 20:52:23 +0200117}
118
Harald Welte68628e82009-03-10 12:17:57 +0000119static int dummy_config_write(struct vty *v)
120{
121 return CMD_SUCCESS;
122}
123
124static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
125{
Harald Welte1bc77352009-03-10 19:47:51 +0000126 vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s",
127 nm_opstate_name(nms->operational), nms->administrative,
128 nm_avail_name(nms->availability), VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000129}
130
Harald Welteb908cb72009-12-22 13:09:29 +0100131static void dump_pchan_load_vty(struct vty *vty, char *prefix,
132 const struct pchan_load *pl)
133{
134 int i;
135
136 for (i = 0; i < ARRAY_SIZE(pl->pchan); i++) {
137 const struct load_counter *lc = &pl->pchan[i];
138 unsigned int percent;
139
140 if (lc->total == 0)
141 continue;
142
143 percent = (lc->used * 100) / lc->total;
144
145 vty_out(vty, "%s%20s: %3u%% (%u/%u)%s", prefix,
146 gsm_pchan_name(i), percent, lc->used, lc->total,
147 VTY_NEWLINE);
148 }
149}
150
Harald Welte68628e82009-03-10 12:17:57 +0000151static void net_dump_vty(struct vty *vty, struct gsm_network *net)
152{
Harald Welteb908cb72009-12-22 13:09:29 +0100153 struct pchan_load pl;
154
Harald Welteef235b52009-03-10 12:34:02 +0000155 vty_out(vty, "BSC is on Country Code %u, Network Code %u "
156 "and has %u BTS%s", net->country_code, net->network_code,
157 net->num_bts, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000158 vty_out(vty, " Long network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000159 net->name_long, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000160 vty_out(vty, " Short network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000161 net->name_short, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200162 vty_out(vty, " Authentication policy: %s%s",
163 gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100164 vty_out(vty, " Location updating reject cause: %u%s",
165 net->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900166 vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption,
167 VTY_NEWLINE);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +0100168 vty_out(vty, " NECI (TCH/H): %u%s", net->neci,
169 VTY_NEWLINE);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +0800170 vty_out(vty, " Use TCH for Paging any: %d%s", net->pag_any_tch,
171 VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100172 vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode),
173 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100174 vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off",
175 VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100176 vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off",
177 VTY_NEWLINE);
Harald Welteb908cb72009-12-22 13:09:29 +0100178 network_chan_load(&pl, net);
179 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
180 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000181}
182
183DEFUN(show_net, show_net_cmd, "show network",
184 SHOW_STR "Display information about a GSM NETWORK\n")
185{
Harald Weltedcccb182010-05-16 20:52:23 +0200186 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000187 net_dump_vty(vty, net);
188
189 return CMD_SUCCESS;
190}
191
192static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l)
193{
Harald Welteedb37782009-05-01 14:59:07 +0000194 struct e1inp_line *line;
195
196 if (!e1l) {
197 vty_out(vty, " None%s", VTY_NEWLINE);
198 return;
199 }
200
201 line = e1l->ts->line;
202
203 vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s",
204 line->num, line->driver->name, e1l->ts->num,
Harald Welte1bc77352009-03-10 19:47:51 +0000205 e1inp_signtype_name(e1l->type), VTY_NEWLINE);
Harald Welteedb37782009-05-01 14:59:07 +0000206 vty_out(vty, " E1 TEI %u, SAPI %u%s",
Harald Welte68628e82009-03-10 12:17:57 +0000207 e1l->tei, e1l->sapi, VTY_NEWLINE);
208}
209
210static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
211{
Harald Welteb908cb72009-12-22 13:09:29 +0100212 struct pchan_load pl;
213
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200214 vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
Harald Weltefcd24452009-06-20 18:15:19 +0200215 "BSIC %u, TSC %u and %u TRX%s",
216 bts->nr, btstype2str(bts->type), gsm_band_name(bts->band),
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200217 bts->cell_identity,
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +0200218 bts->location_area_code, bts->bsic, bts->tsc,
Harald Weltefcd24452009-06-20 18:15:19 +0200219 bts->num_trx, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200220 vty_out(vty, "Description: %s%s",
221 bts->description ? bts->description : "(null)", VTY_NEWLINE);
Harald Welte1d8dbc42009-12-12 15:38:16 +0100222 vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100223 vty_out(vty, "Minimum Rx Level for Access: %i dBm%s",
Harald Welte1d8dbc42009-12-12 15:38:16 +0100224 rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min),
225 VTY_NEWLINE);
226 vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s",
Harald Welte73225282009-12-12 18:17:25 +0100227 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100228 vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer,
229 VTY_NEWLINE);
230 vty_out(vty, "RACH Max transmissions: %u%s",
231 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
232 VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100233 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200234 vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE);
Harald Welte9fbff4a2010-07-30 11:50:09 +0200235 vty_out(vty, "System Information present: 0x%08x, static: 0x%08x%s",
236 bts->si_valid, bts->si_mode_static, VTY_NEWLINE);
Harald Welte4cc34222009-05-01 15:12:31 +0000237 if (is_ipaccess_bts(bts))
Harald Welte8175e952009-10-20 00:22:00 +0200238 vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
Harald Welte4cc34222009-05-01 15:12:31 +0000239 bts->ip_access.site_id, bts->ip_access.bts_id,
Harald Welte8175e952009-10-20 00:22:00 +0200240 bts->oml_tei, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000241 vty_out(vty, " NM State: ");
242 net_dump_nmstate(vty, &bts->nm_state);
243 vty_out(vty, " Site Mgr NM State: ");
244 net_dump_nmstate(vty, &bts->site_mgr.nm_state);
245 vty_out(vty, " Paging: FIXME pending requests, %u free slots%s",
246 bts->paging.available_slots, VTY_NEWLINE);
Holger Hans Peter Freytherd283db42010-11-25 16:28:45 +0100247 if (is_ipaccess_bts(bts)) {
248 vty_out(vty, " OML Link state: %s.%s",
249 bts->oml_link ? "connected" : "disconnected", VTY_NEWLINE);
250 } else {
Harald Welte8175e952009-10-20 00:22:00 +0200251 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
252 e1isl_dump_vty(vty, bts->oml_link);
253 }
Holger Hans Peter Freytherd283db42010-11-25 16:28:45 +0100254
255 /* FIXME: chan_desc */
Harald Welteb908cb72009-12-22 13:09:29 +0100256 memset(&pl, 0, sizeof(pl));
257 bts_chan_load(&pl, bts);
258 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
259 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000260}
261
262DEFUN(show_bts, show_bts_cmd, "show bts [number]",
263 SHOW_STR "Display information about a BTS\n"
264 "BTS number")
265{
Harald Weltedcccb182010-05-16 20:52:23 +0200266 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000267 int bts_nr;
268
269 if (argc != 0) {
270 /* use the BTS number that the user has specified */
271 bts_nr = atoi(argv[0]);
272 if (bts_nr > net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000273 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000274 VTY_NEWLINE);
275 return CMD_WARNING;
276 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200277 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000278 return CMD_SUCCESS;
279 }
280 /* print all BTS's */
281 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee441d9c2009-06-21 16:17:15 +0200282 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000283
284 return CMD_SUCCESS;
285}
286
Harald Welte42581822009-08-08 16:12:58 +0200287/* utility functions */
288static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
289 const char *ts, const char *ss)
290{
291 e1_link->e1_nr = atoi(line);
292 e1_link->e1_ts = atoi(ts);
293 if (!strcmp(ss, "full"))
294 e1_link->e1_ts_ss = 255;
295 else
296 e1_link->e1_ts_ss = atoi(ss);
297}
298
299static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,
300 const char *prefix)
301{
302 if (!e1_link->e1_ts)
303 return;
304
305 if (e1_link->e1_ts_ss == 255)
306 vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s",
307 prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE);
308 else
309 vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s",
310 prefix, e1_link->e1_nr, e1_link->e1_ts,
311 e1_link->e1_ts_ss, VTY_NEWLINE);
312}
313
314
Harald Welte67ce0732009-08-06 19:06:46 +0200315static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
316{
Harald Welte42581822009-08-08 16:12:58 +0200317 vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
318 if (ts->pchan != GSM_PCHAN_NONE)
319 vty_out(vty, " phys_chan_config %s%s",
320 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200321 vty_out(vty, " hopping enabled %u%s",
322 ts->hopping.enabled, VTY_NEWLINE);
323 if (ts->hopping.enabled) {
324 unsigned int i;
325 vty_out(vty, " hopping sequence-number %u%s",
Harald Welte6e0cd042009-09-12 13:05:33 +0200326 ts->hopping.hsn, VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200327 vty_out(vty, " hopping maio %u%s",
Harald Welte6e0cd042009-09-12 13:05:33 +0200328 ts->hopping.maio, VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200329 for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) {
330 if (!bitvec_get_bit_pos(&ts->hopping.arfcns, i))
331 continue;
332 vty_out(vty, " hopping arfcn add %u%s",
333 i, VTY_NEWLINE);
334 }
Harald Welte127af342010-12-24 12:07:07 +0100335 }
Harald Welte42581822009-08-08 16:12:58 +0200336 config_write_e1_link(vty, &ts->e1_link, " ");
Harald Welte67ce0732009-08-06 19:06:46 +0200337}
338
339static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
340{
341 int i;
342
Harald Welte5013b2a2009-08-07 13:29:14 +0200343 vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200344 if (trx->description)
345 vty_out(vty, " description %s%s", trx->description,
346 VTY_NEWLINE);
Holger Hans Peter Freyther2ba40af2010-04-17 06:42:07 +0200347 vty_out(vty, " rf_locked %u%s",
348 trx->nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
349 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200350 vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
Harald Welte (local)7b37d972009-12-27 20:56:38 +0100351 vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200352 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200353 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
354 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte67ce0732009-08-06 19:06:46 +0200355
356 for (i = 0; i < TRX_NR_TS; i++)
357 config_write_ts_single(vty, &trx->ts[i]);
358}
359
Harald Welte615e9562010-05-11 23:50:21 +0200360static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
361{
362 unsigned int i;
363 vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode),
364 VTY_NEWLINE);
365 if (bts->gprs.mode == BTS_GPRS_NONE)
366 return;
367
368 vty_out(vty, " gprs routing area %u%s", bts->gprs.rac,
369 VTY_NEWLINE);
370 vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
371 VTY_NEWLINE);
372 for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++)
373 vty_out(vty, " gprs cell timer %s %u%s",
374 get_value_string(gprs_bssgp_cfg_strs, i),
375 bts->gprs.cell.timer[i], VTY_NEWLINE);
376 vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei,
377 VTY_NEWLINE);
378 for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++)
379 vty_out(vty, " gprs ns timer %s %u%s",
380 get_value_string(gprs_ns_timer_strs, i),
381 bts->gprs.nse.timer[i], VTY_NEWLINE);
382 for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
383 struct gsm_bts_gprs_nsvc *nsvc =
384 &bts->gprs.nsvc[i];
385 struct in_addr ia;
386
387 ia.s_addr = htonl(nsvc->remote_ip);
388 vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
389 nsvc->nsvci, VTY_NEWLINE);
390 vty_out(vty, " gprs nsvc %u local udp port %u%s", i,
391 nsvc->local_port, VTY_NEWLINE);
392 vty_out(vty, " gprs nsvc %u remote udp port %u%s", i,
393 nsvc->remote_port, VTY_NEWLINE);
394 vty_out(vty, " gprs nsvc %u remote ip %s%s", i,
395 inet_ntoa(ia), VTY_NEWLINE);
396 }
397}
398
Harald Welte67ce0732009-08-06 19:06:46 +0200399static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
400{
401 struct gsm_bts_trx *trx;
Harald Welte9fbff4a2010-07-30 11:50:09 +0200402 int i;
Harald Welte67ce0732009-08-06 19:06:46 +0200403
Harald Welte5013b2a2009-08-07 13:29:14 +0200404 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
405 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200406 if (bts->description)
407 vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200408 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freytherf926ed62009-11-19 16:38:49 +0100409 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200410 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte67ce0732009-08-06 19:06:46 +0200411 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200412 vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE);
413 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)0e451d02009-08-13 10:14:26 +0200414 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100415 vty_out(vty, " cell reselection hysteresis %u%s",
416 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
417 vty_out(vty, " rxlev access min %u%s",
418 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Sylvain Munaute0b06b02010-11-28 18:17:28 +0100419
420 if (bts->si_common.cell_ro_sel_par.present) {
421 struct gsm48_si_selection_params *sp;
422 sp = &bts->si_common.cell_ro_sel_par;
423
424 if (sp->cbq)
425 vty_out(vty, " cell bar qualify %u%s",
426 sp->cbq, VTY_NEWLINE);
427
428 if (sp->cell_resel_off)
429 vty_out(vty, " cell reselection offset %u%s",
430 sp->cell_resel_off*2, VTY_NEWLINE);
431
432 if (sp->temp_offs == 7)
433 vty_out(vty, " temporary offset infinite%s",
434 VTY_NEWLINE);
435 else if (sp->temp_offs)
436 vty_out(vty, " temporary offset %u%s",
437 sp->temp_offs*10, VTY_NEWLINE);
438
439 if (sp->penalty_time == 31)
440 vty_out(vty, " penalty time reserved%s",
441 VTY_NEWLINE);
442 else if (sp->penalty_time)
443 vty_out(vty, " penalty time %u%s",
444 (sp->penalty_time*20)+20, VTY_NEWLINE);
445 }
446
Harald Weltea43f7892009-12-01 18:04:30 +0530447 if (bts->si_common.chan_desc.t3212)
Harald Welte (local)efc92312009-08-14 23:09:25 +0200448 vty_out(vty, " periodic location update %u%s",
Dieter Spaard6613e02010-10-05 21:10:55 +0200449 bts->si_common.chan_desc.t3212 * 6, VTY_NEWLINE);
Harald Welte7a8fa412009-08-10 13:48:16 +0200450 vty_out(vty, " channel allocator %s%s",
451 bts->chan_alloc_reverse ? "descending" : "ascending",
452 VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100453 vty_out(vty, " rach tx integer %u%s",
454 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
455 vty_out(vty, " rach max transmission %u%s",
456 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
457 VTY_NEWLINE);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +0800458
459 if (bts->rach_b_thresh != -1)
460 vty_out(vty, " rach nm busy threshold %u%s",
461 bts->rach_b_thresh, VTY_NEWLINE);
462 if (bts->rach_ldavg_slots != -1)
463 vty_out(vty, " rach nm load average %u%s",
464 bts->rach_ldavg_slots, VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100465 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200466 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +0800467 if ((bts->si_common.rach_control.t2 & 0x4) == 0)
468 vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE);
Harald Welte9fbff4a2010-07-30 11:50:09 +0200469 for (i = SYSINFO_TYPE_1; i < _MAX_SYSINFO_TYPE; i++) {
470 if (bts->si_mode_static & (1 << i)) {
471 vty_out(vty, " system-information %s mode static%s",
472 get_value_string(osmo_sitype_strs, i), VTY_NEWLINE);
473 vty_out(vty, " system-information %s static %s%s",
474 get_value_string(osmo_sitype_strs, i),
475 hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])),
476 VTY_NEWLINE);
477 }
478 }
Harald Welte8175e952009-10-20 00:22:00 +0200479 if (is_ipaccess_bts(bts)) {
Harald Welte5013b2a2009-08-07 13:29:14 +0200480 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Weltea6fd58e2009-08-07 00:25:23 +0200481 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200482 vty_out(vty, " oml ip.access stream_id %u%s", bts->oml_tei, VTY_NEWLINE);
483 } else {
Harald Welte42581822009-08-08 16:12:58 +0200484 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
485 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
486 }
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +0800487
488 /* if we have a limit, write it */
489 if (bts->paging.free_chans_need >= 0)
490 vty_out(vty, " paging free %d%s", bts->paging.free_chans_need, VTY_NEWLINE);
491
Harald Welte615e9562010-05-11 23:50:21 +0200492 config_write_bts_gprs(vty, bts);
Harald Welte67ce0732009-08-06 19:06:46 +0200493
494 llist_for_each_entry(trx, &bts->trx_list, list)
495 config_write_trx_single(vty, trx);
496}
497
498static int config_write_bts(struct vty *v)
499{
Harald Weltedcccb182010-05-16 20:52:23 +0200500 struct gsm_network *gsmnet = gsmnet_from_vty(v);
Harald Welte67ce0732009-08-06 19:06:46 +0200501 struct gsm_bts *bts;
502
503 llist_for_each_entry(bts, &gsmnet->bts_list, list)
504 config_write_bts_single(v, bts);
505
506 return CMD_SUCCESS;
507}
508
Harald Welte5013b2a2009-08-07 13:29:14 +0200509static int config_write_net(struct vty *vty)
510{
Harald Weltedcccb182010-05-16 20:52:23 +0200511 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
512
Harald Welte5013b2a2009-08-07 13:29:14 +0200513 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200514 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200515 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200516 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
517 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200518 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100519 vty_out(vty, " location updating reject cause %u%s",
520 gsmnet->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900521 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freytherd54c3372009-11-19 16:37:48 +0100522 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +0800523 vty_out(vty, " paging any use tch %d%s", gsmnet->pag_any_tch, VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100524 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
525 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100526 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100527 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Welteb720bd32009-12-21 16:51:50 +0100528 vty_out(vty, " handover window rxlev averaging %u%s",
529 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
530 vty_out(vty, " handover window rxqual averaging %u%s",
531 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
532 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
533 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
534 vty_out(vty, " handover power budget interval %u%s",
535 gsmnet->handover.pwr_interval, VTY_NEWLINE);
536 vty_out(vty, " handover power budget hysteresis %u%s",
537 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
538 vty_out(vty, " handover maximum distance %u%s",
539 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +0100540 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100541 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
542 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
543 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
544 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
545 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
546 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
547 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
548 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
549 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
Harald Welte2862dca2010-12-23 14:39:29 +0100550 vty_out(vty, " timer t3122 %u%s", gsmnet->T3122, VTY_NEWLINE);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100551 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Harald Welte63dbfc62010-12-15 15:34:23 +0100552 vty_out(vty, " dtx-used %u%s", gsmnet->dtx_enabled, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200553
554 return CMD_SUCCESS;
555}
Harald Welte67ce0732009-08-06 19:06:46 +0200556
Harald Welte68628e82009-03-10 12:17:57 +0000557static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
558{
559 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
560 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200561 vty_out(vty, "Description: %s%s",
562 trx->description ? trx->description : "(null)", VTY_NEWLINE);
Harald Weltefcd24452009-06-20 18:15:19 +0200563 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte42581822009-08-08 16:12:58 +0200564 "resulting BS power: %d dBm%s",
Harald Weltefcd24452009-06-20 18:15:19 +0200565 trx->nominal_power, trx->max_power_red,
Harald Welte42581822009-08-08 16:12:58 +0200566 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000567 vty_out(vty, " NM State: ");
568 net_dump_nmstate(vty, &trx->nm_state);
569 vty_out(vty, " Baseband Transceiver NM State: ");
570 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte8175e952009-10-20 00:22:00 +0200571 if (is_ipaccess_bts(trx->bts)) {
572 vty_out(vty, " ip.access stream ID: 0x%02x%s",
573 trx->rsl_tei, VTY_NEWLINE);
574 } else {
575 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
576 e1isl_dump_vty(vty, trx->rsl_link);
577 }
Harald Welte68628e82009-03-10 12:17:57 +0000578}
579
580DEFUN(show_trx,
581 show_trx_cmd,
582 "show trx [bts_nr] [trx_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200583 SHOW_STR "Display information about a TRX\n"
584 "BTS Number\n"
585 "TRX Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000586{
Harald Weltedcccb182010-05-16 20:52:23 +0200587 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000588 struct gsm_bts *bts = NULL;
589 struct gsm_bts_trx *trx;
590 int bts_nr, trx_nr;
591
592 if (argc >= 1) {
593 /* use the BTS number that the user has specified */
594 bts_nr = atoi(argv[0]);
595 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000596 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000597 VTY_NEWLINE);
598 return CMD_WARNING;
599 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200600 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000601 }
602 if (argc >= 2) {
603 trx_nr = atoi(argv[1]);
604 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000605 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000606 VTY_NEWLINE);
607 return CMD_WARNING;
608 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200609 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000610 trx_dump_vty(vty, trx);
611 return CMD_SUCCESS;
612 }
613 if (bts) {
614 /* print all TRX in this BTS */
615 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200616 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000617 trx_dump_vty(vty, trx);
618 }
619 return CMD_SUCCESS;
620 }
621
622 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200623 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000624 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200625 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000626 trx_dump_vty(vty, trx);
627 }
628 }
629
630 return CMD_SUCCESS;
631}
632
Harald Welte67ce0732009-08-06 19:06:46 +0200633
Harald Welte68628e82009-03-10 12:17:57 +0000634static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
635{
Harald Welte026b4ca2010-12-24 12:12:10 +0100636 vty_out(vty, "BTS %u, TRX %u, Timeslot %u, phys cfg %s%s",
637 ts->trx->bts->nr, ts->trx->nr, ts->nr,
Harald Welte68628e82009-03-10 12:17:57 +0000638 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
639 vty_out(vty, " NM State: ");
640 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte2c828992009-12-02 01:56:49 +0530641 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welteef235b52009-03-10 12:34:02 +0000642 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
643 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
644 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000645}
646
647DEFUN(show_ts,
648 show_ts_cmd,
Harald Welte1bc77352009-03-10 19:47:51 +0000649 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200650 SHOW_STR "Display information about a TS\n"
651 "BTS Number\n" "TRX Number\n" "Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000652{
Harald Weltedcccb182010-05-16 20:52:23 +0200653 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte274d0152010-12-24 12:05:03 +0100654 struct gsm_bts *bts = NULL;
655 struct gsm_bts_trx *trx = NULL;
656 struct gsm_bts_trx_ts *ts = NULL;
Harald Welte68628e82009-03-10 12:17:57 +0000657 int bts_nr, trx_nr, ts_nr;
658
659 if (argc >= 1) {
660 /* use the BTS number that the user has specified */
661 bts_nr = atoi(argv[0]);
662 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000663 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000664 VTY_NEWLINE);
665 return CMD_WARNING;
666 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200667 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000668 }
669 if (argc >= 2) {
670 trx_nr = atoi(argv[1]);
671 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000672 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000673 VTY_NEWLINE);
674 return CMD_WARNING;
675 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200676 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000677 }
678 if (argc >= 3) {
679 ts_nr = atoi(argv[2]);
680 if (ts_nr >= TRX_NR_TS) {
Harald Welte1bc77352009-03-10 19:47:51 +0000681 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
Harald Welte68628e82009-03-10 12:17:57 +0000682 VTY_NEWLINE);
683 return CMD_WARNING;
684 }
Harald Welte274d0152010-12-24 12:05:03 +0100685 /* Fully Specified: print and exit */
Harald Welte68628e82009-03-10 12:17:57 +0000686 ts = &trx->ts[ts_nr];
687 ts_dump_vty(vty, ts);
688 return CMD_SUCCESS;
689 }
Harald Welte274d0152010-12-24 12:05:03 +0100690
691 if (bts && trx) {
692 /* Iterate over all TS in this TRX */
693 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
694 ts = &trx->ts[ts_nr];
695 ts_dump_vty(vty, ts);
696 }
697 } else if (bts) {
698 /* Iterate over all TRX in this BTS, TS in each TRX */
Harald Welte68628e82009-03-10 12:17:57 +0000699 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200700 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000701 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
702 ts = &trx->ts[ts_nr];
703 ts_dump_vty(vty, ts);
704 }
705 }
Harald Welte274d0152010-12-24 12:05:03 +0100706 } else {
707 /* Iterate over all BTS, TRX in each BTS, TS in each TRX */
708 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
709 bts = gsm_bts_num(net, bts_nr);
710 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
711 trx = gsm_bts_trx_num(bts, trx_nr);
712 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
713 ts = &trx->ts[ts_nr];
714 ts_dump_vty(vty, ts);
715 }
716 }
717 }
Harald Welte68628e82009-03-10 12:17:57 +0000718 }
719
720 return CMD_SUCCESS;
721}
722
Holger Hans Peter Freyther424c4f02010-01-06 06:00:40 +0100723static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte68628e82009-03-10 12:17:57 +0000724{
Harald Weltefcd24452009-06-20 18:15:19 +0200725 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte40f82892009-05-23 17:31:39 +0000726 subscr->authorized, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000727 if (subscr->name)
Harald Welte1bc77352009-03-10 19:47:51 +0000728 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000729 if (subscr->extension)
730 vty_out(vty, " Extension: %s%s", subscr->extension,
731 VTY_NEWLINE);
732 if (subscr->imsi)
733 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freyther22230252009-08-19 12:53:57 +0200734 if (subscr->tmsi != GSM_RESERVED_TMSI)
735 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte731fd912009-08-15 03:24:51 +0200736 VTY_NEWLINE);
Sylvain Munautaf292642009-12-27 19:29:28 +0100737
Harald Welte (local)15920de2009-08-14 20:27:16 +0200738 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000739}
740
Harald Welte8387a492009-12-22 21:43:14 +0100741static void meas_rep_dump_uni_vty(struct vty *vty,
742 struct gsm_meas_rep_unidir *mru,
743 const char *prefix,
744 const char *dir)
745{
746 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
747 prefix, dir, rxlev2dbm(mru->full.rx_lev),
748 dir, rxlev2dbm(mru->sub.rx_lev));
749 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
750 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
751 VTY_NEWLINE);
752}
753
754static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
755 const char *prefix)
756{
757 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
758 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
759 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
760 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
761 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
762 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
763 VTY_NEWLINE);
764 if (mr->flags & MEAS_REP_F_MS_TO)
765 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
766 mr->ms_timing_offset, VTY_NEWLINE);
767 if (mr->flags & MEAS_REP_F_MS_L1)
768 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
769 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
770 if (mr->flags & MEAS_REP_F_DL_VALID)
771 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
772 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
773}
774
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800775static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
Harald Welte68628e82009-03-10 12:17:57 +0000776{
Harald Welte8387a492009-12-22 21:43:14 +0100777 int idx;
778
Harald Welte68628e82009-03-10 12:17:57 +0000779 vty_out(vty, "Lchan %u in Timeslot %u of TRX %u in BTS %u, Type %s%s",
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +0200780 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
Harald Welte (local)ccd88452009-12-27 18:05:25 +0100781 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Harald Welte68628e82009-03-10 12:17:57 +0000782 VTY_NEWLINE);
Holger Hans Peter Freyther40494552010-06-28 17:09:29 +0800783 vty_out(vty, " Connection: %u, State: %s%s",
784 lchan->conn ? 1: 0,
Harald Welte1887f9d2009-12-29 10:52:38 +0100785 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100786 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
787 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
788 - lchan->bs_power*2,
789 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
790 VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800791 if (lchan->conn && lchan->conn->subscr) {
Harald Welte68628e82009-03-10 12:17:57 +0000792 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800793 subscr_dump_vty(vty, lchan->conn->subscr);
Harald Welte68628e82009-03-10 12:17:57 +0000794 } else
795 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte2c828992009-12-02 01:56:49 +0530796 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
797 struct in_addr ia;
Holger Hans Peter Freyther54fa7992010-04-07 15:39:16 +0200798 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte2c828992009-12-02 01:56:49 +0530799 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
800 inet_ntoa(ia), lchan->abis_ip.bound_port,
801 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
802 VTY_NEWLINE);
803 }
Harald Welte8387a492009-12-22 21:43:14 +0100804
805 /* we want to report the last measurement report */
806 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
807 lchan->meas_rep_idx, 1);
808 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte68628e82009-03-10 12:17:57 +0000809}
810
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800811static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
812{
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800813 struct gsm_meas_rep *mr;
814 int idx;
815
816 /* we want to report the last measurement report */
817 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
818 lchan->meas_rep_idx, 1);
819 mr = &lchan->meas_rep[idx];
820
821 vty_out(vty, "Lchan: %u Timeslot: %u TRX: %u BTS: %u Type: %s - L1 MS Power: %u dBm "
822 "RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800823 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
824 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800825 mr->ms_l1.pwr,
826 rxlev2dbm(mr->dl.full.rx_lev),
827 rxlev2dbm(mr->ul.full.rx_lev),
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800828 VTY_NEWLINE);
829}
830
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800831static int lchan_summary(struct vty *vty, int argc, const char **argv,
832 void (*dump_cb)(struct vty *, struct gsm_lchan *))
Harald Welte68628e82009-03-10 12:17:57 +0000833{
Harald Weltedcccb182010-05-16 20:52:23 +0200834 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000835 struct gsm_bts *bts;
836 struct gsm_bts_trx *trx;
837 struct gsm_bts_trx_ts *ts;
838 struct gsm_lchan *lchan;
839 int bts_nr, trx_nr, ts_nr, lchan_nr;
840
841 if (argc >= 1) {
842 /* use the BTS number that the user has specified */
843 bts_nr = atoi(argv[0]);
844 if (bts_nr >= net->num_bts) {
845 vty_out(vty, "%% can't find BTS %s%s", argv[0],
846 VTY_NEWLINE);
847 return CMD_WARNING;
848 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200849 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000850 }
851 if (argc >= 2) {
852 trx_nr = atoi(argv[1]);
853 if (trx_nr >= bts->num_trx) {
854 vty_out(vty, "%% can't find TRX %s%s", argv[1],
855 VTY_NEWLINE);
856 return CMD_WARNING;
857 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200858 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000859 }
860 if (argc >= 3) {
861 ts_nr = atoi(argv[2]);
862 if (ts_nr >= TRX_NR_TS) {
863 vty_out(vty, "%% can't find TS %s%s", argv[2],
864 VTY_NEWLINE);
865 return CMD_WARNING;
866 }
867 ts = &trx->ts[ts_nr];
868 }
869 if (argc >= 4) {
870 lchan_nr = atoi(argv[3]);
871 if (lchan_nr >= TS_MAX_LCHAN) {
872 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
873 VTY_NEWLINE);
874 return CMD_WARNING;
875 }
876 lchan = &ts->lchan[lchan_nr];
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800877 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000878 return CMD_SUCCESS;
879 }
880 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200881 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000882 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200883 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000884 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
885 ts = &trx->ts[ts_nr];
886 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
887 lchan_nr++) {
888 lchan = &ts->lchan[lchan_nr];
Harald Welteef235b52009-03-10 12:34:02 +0000889 if (lchan->type == GSM_LCHAN_NONE)
890 continue;
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800891 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000892 }
893 }
894 }
895 }
896
897 return CMD_SUCCESS;
898}
899
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800900
901DEFUN(show_lchan,
902 show_lchan_cmd,
903 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
904 SHOW_STR "Display information about a logical channel\n"
905 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
906 "Logical Channel Number\n")
907
908{
909 return lchan_summary(vty, argc, argv, lchan_dump_full_vty);
910}
911
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800912DEFUN(show_lchan_summary,
913 show_lchan_summary_cmd,
914 "show lchan summary [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
915 SHOW_STR "Display information about a logical channel\n"
916 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
917 "Logical Channel Number\n")
918{
919 return lchan_summary(vty, argc, argv, lchan_dump_short_vty);
920}
921
Harald Welte1bc77352009-03-10 19:47:51 +0000922static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
923{
924 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
925}
926
927DEFUN(show_e1drv,
928 show_e1drv_cmd,
929 "show e1_driver",
930 SHOW_STR "Display information about available E1 drivers\n")
931{
932 struct e1inp_driver *drv;
933
934 llist_for_each_entry(drv, &e1inp_driver_list, list)
935 e1drv_dump_vty(vty, drv);
936
937 return CMD_SUCCESS;
938}
939
Harald Welte68628e82009-03-10 12:17:57 +0000940static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
941{
942 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
943 line->num, line->name ? line->name : "",
944 line->driver->name, VTY_NEWLINE);
945}
946
947DEFUN(show_e1line,
948 show_e1line_cmd,
949 "show e1_line [line_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200950 SHOW_STR "Display information about a E1 line\n"
951 "E1 Line Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000952{
Harald Welte1bc77352009-03-10 19:47:51 +0000953 struct e1inp_line *line;
954
955 if (argc >= 1) {
956 int num = atoi(argv[0]);
957 llist_for_each_entry(line, &e1inp_line_list, list) {
958 if (line->num == num) {
959 e1line_dump_vty(vty, line);
960 return CMD_SUCCESS;
961 }
962 }
963 return CMD_WARNING;
964 }
965
966 llist_for_each_entry(line, &e1inp_line_list, list)
967 e1line_dump_vty(vty, line);
968
969 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000970}
971
972static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
973{
Harald Welte42581822009-08-08 16:12:58 +0200974 if (ts->type == E1INP_TS_TYPE_NONE)
975 return;
Harald Welte1bc77352009-03-10 19:47:51 +0000976 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
977 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
978 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000979}
980
981DEFUN(show_e1ts,
982 show_e1ts_cmd,
983 "show e1_timeslot [line_nr] [ts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200984 SHOW_STR "Display information about a E1 timeslot\n"
985 "E1 Line Number\n" "E1 Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000986{
Harald Welte986c3d72009-11-17 06:12:16 +0100987 struct e1inp_line *line = NULL;
Harald Welte1bc77352009-03-10 19:47:51 +0000988 struct e1inp_ts *ts;
989 int ts_nr;
Harald Welte68628e82009-03-10 12:17:57 +0000990
Harald Welte1bc77352009-03-10 19:47:51 +0000991 if (argc == 0) {
992 llist_for_each_entry(line, &e1inp_line_list, list) {
993 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
994 ts = &line->ts[ts_nr];
995 e1ts_dump_vty(vty, ts);
996 }
997 }
998 return CMD_SUCCESS;
999 }
1000 if (argc >= 1) {
1001 int num = atoi(argv[0]);
1002 llist_for_each_entry(line, &e1inp_line_list, list) {
1003 if (line->num == num)
1004 break;
1005 }
1006 if (!line || line->num != num) {
1007 vty_out(vty, "E1 line %s is invalid%s",
1008 argv[0], VTY_NEWLINE);
1009 return CMD_WARNING;
1010 }
1011 }
1012 if (argc >= 2) {
1013 ts_nr = atoi(argv[1]);
1014 if (ts_nr > NUM_E1_TS) {
1015 vty_out(vty, "E1 timeslot %s is invalid%s",
1016 argv[1], VTY_NEWLINE);
1017 return CMD_WARNING;
1018 }
1019 ts = &line->ts[ts_nr];
1020 e1ts_dump_vty(vty, ts);
1021 return CMD_SUCCESS;
1022 } else {
1023 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
1024 ts = &line->ts[ts_nr];
1025 e1ts_dump_vty(vty, ts);
1026 }
1027 return CMD_SUCCESS;
1028 }
1029 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +00001030}
1031
Harald Weltebe4b7302009-05-23 16:59:33 +00001032static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
Harald Weltef5025b62009-03-28 16:55:11 +00001033{
1034 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
1035 subscr_dump_vty(vty, pag->subscr);
1036}
1037
Harald Weltebe4b7302009-05-23 16:59:33 +00001038static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
Harald Weltef5025b62009-03-28 16:55:11 +00001039{
1040 struct gsm_paging_request *pag;
1041
1042 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
1043 paging_dump_vty(vty, pag);
1044}
1045
1046DEFUN(show_paging,
1047 show_paging_cmd,
1048 "show paging [bts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +02001049 SHOW_STR "Display information about paging reuqests of a BTS\n"
1050 "BTS Number\n")
Harald Weltef5025b62009-03-28 16:55:11 +00001051{
Harald Weltedcccb182010-05-16 20:52:23 +02001052 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Weltef5025b62009-03-28 16:55:11 +00001053 struct gsm_bts *bts;
1054 int bts_nr;
1055
1056 if (argc >= 1) {
1057 /* use the BTS number that the user has specified */
1058 bts_nr = atoi(argv[0]);
1059 if (bts_nr >= net->num_bts) {
1060 vty_out(vty, "%% can't find BTS %s%s", argv[0],
1061 VTY_NEWLINE);
1062 return CMD_WARNING;
1063 }
Harald Weltee441d9c2009-06-21 16:17:15 +02001064 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001065 bts_paging_dump_vty(vty, bts);
1066
1067 return CMD_SUCCESS;
1068 }
1069 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +02001070 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001071 bts_paging_dump_vty(vty, bts);
1072 }
1073
1074 return CMD_SUCCESS;
1075}
1076
Harald Welte8f0ed552010-05-11 21:53:49 +02001077#define NETWORK_STR "Configure the GSM network\n"
1078
Harald Welte5013b2a2009-08-07 13:29:14 +02001079DEFUN(cfg_net,
1080 cfg_net_cmd,
Harald Welte8f0ed552010-05-11 21:53:49 +02001081 "network", NETWORK_STR)
Harald Welte5013b2a2009-08-07 13:29:14 +02001082{
Harald Weltedcccb182010-05-16 20:52:23 +02001083 vty->index = gsmnet_from_vty(vty);
Harald Welte5013b2a2009-08-07 13:29:14 +02001084 vty->node = GSMNET_NODE;
1085
1086 return CMD_SUCCESS;
1087}
1088
1089
1090DEFUN(cfg_net_ncc,
1091 cfg_net_ncc_cmd,
1092 "network country code <1-999>",
1093 "Set the GSM network country code")
1094{
Harald Weltedcccb182010-05-16 20:52:23 +02001095 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1096
Harald Welte5013b2a2009-08-07 13:29:14 +02001097 gsmnet->country_code = atoi(argv[0]);
1098
1099 return CMD_SUCCESS;
1100}
1101
1102DEFUN(cfg_net_mnc,
1103 cfg_net_mnc_cmd,
1104 "mobile network code <1-999>",
1105 "Set the GSM mobile network code")
1106{
Harald Weltedcccb182010-05-16 20:52:23 +02001107 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1108
Harald Welte5013b2a2009-08-07 13:29:14 +02001109 gsmnet->network_code = atoi(argv[0]);
1110
1111 return CMD_SUCCESS;
1112}
1113
1114DEFUN(cfg_net_name_short,
1115 cfg_net_name_short_cmd,
1116 "short name NAME",
1117 "Set the short GSM network name")
1118{
Harald Weltedcccb182010-05-16 20:52:23 +02001119 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1120
Holger Hans Peter Freyther3e9a7f82010-10-12 23:21:54 +02001121 bsc_replace_string(gsmnet, &gsmnet->name_short, argv[0]);
Harald Welte5013b2a2009-08-07 13:29:14 +02001122 return CMD_SUCCESS;
1123}
1124
1125DEFUN(cfg_net_name_long,
1126 cfg_net_name_long_cmd,
1127 "long name NAME",
1128 "Set the long GSM network name")
1129{
Harald Weltedcccb182010-05-16 20:52:23 +02001130 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1131
Holger Hans Peter Freyther3e9a7f82010-10-12 23:21:54 +02001132 bsc_replace_string(gsmnet, &gsmnet->name_long, argv[0]);
Harald Welte5013b2a2009-08-07 13:29:14 +02001133 return CMD_SUCCESS;
1134}
Harald Welte40f82892009-05-23 17:31:39 +00001135
Harald Welte (local)69de3972009-08-12 14:42:23 +02001136DEFUN(cfg_net_auth_policy,
1137 cfg_net_auth_policy_cmd,
1138 "auth policy (closed|accept-all|token)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001139 "Authentication (not cryptographic)\n"
1140 "Set the GSM network authentication policy\n"
1141 "Require the MS to be activated in HLR\n"
1142 "Accept all MS, whether in HLR or not\n"
1143 "Use SMS-token based authentication\n")
Harald Welte (local)69de3972009-08-12 14:42:23 +02001144{
1145 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001146 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte (local)69de3972009-08-12 14:42:23 +02001147
1148 gsmnet->auth_policy = policy;
1149
1150 return CMD_SUCCESS;
1151}
1152
Harald Welte1085c092009-11-18 20:33:19 +01001153DEFUN(cfg_net_reject_cause,
1154 cfg_net_reject_cause_cmd,
1155 "location updating reject cause <2-111>",
1156 "Set the reject cause of location updating reject\n")
1157{
Harald Weltedcccb182010-05-16 20:52:23 +02001158 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1159
Harald Welte1085c092009-11-18 20:33:19 +01001160 gsmnet->reject_cause = atoi(argv[0]);
1161
1162 return CMD_SUCCESS;
1163}
1164
Harald Welte4381cfe2009-08-30 15:47:06 +09001165DEFUN(cfg_net_encryption,
1166 cfg_net_encryption_cmd,
1167 "encryption a5 (0|1|2)",
Harald Welte28326062010-05-14 20:05:17 +02001168 "Encryption options\n"
1169 "A5 encryption\n" "A5/0: No encryption\n"
1170 "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n")
Harald Welte4381cfe2009-08-30 15:47:06 +09001171{
Harald Weltedcccb182010-05-16 20:52:23 +02001172 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1173
Andreas.Eversberg1059deb2009-11-17 09:55:26 +01001174 gsmnet->a5_encryption= atoi(argv[0]);
Harald Welte4381cfe2009-08-30 15:47:06 +09001175
1176 return CMD_SUCCESS;
1177}
1178
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001179DEFUN(cfg_net_neci,
1180 cfg_net_neci_cmd,
1181 "neci (0|1)",
Harald Welte28326062010-05-14 20:05:17 +02001182 "New Establish Cause Indication\n"
1183 "Don't set the NECI bit\n" "Set the NECI bit\n")
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001184{
Harald Weltedcccb182010-05-16 20:52:23 +02001185 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1186
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001187 gsmnet->neci = atoi(argv[0]);
Holger Hans Peter Freyther78891072010-09-06 09:36:02 +08001188 gsm_net_update_ctype(gsmnet);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001189 return CMD_SUCCESS;
1190}
1191
Harald Welteeab84a12009-12-13 10:53:12 +01001192DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1193 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001194 "Radio Resource Location Protocol\n"
1195 "Set the Radio Resource Location Protocol Mode\n"
1196 "Don't send RRLP request\n"
1197 "Request MS-based location\n"
1198 "Request any location, prefer MS-based\n"
1199 "Request any location, prefer MS-assisted\n")
Harald Welteeab84a12009-12-13 10:53:12 +01001200{
Harald Weltedcccb182010-05-16 20:52:23 +02001201 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1202
Harald Welteeab84a12009-12-13 10:53:12 +01001203 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1204
1205 return CMD_SUCCESS;
1206}
1207
Harald Welte648b6ce2009-12-14 09:00:24 +01001208DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1209 "mm info (0|1)",
1210 "Whether to send MM INFO after LOC UPD ACCEPT")
1211{
Harald Weltedcccb182010-05-16 20:52:23 +02001212 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1213
Harald Welte648b6ce2009-12-14 09:00:24 +01001214 gsmnet->send_mm_info = atoi(argv[0]);
1215
1216 return CMD_SUCCESS;
1217}
1218
Harald Welte8f0ed552010-05-11 21:53:49 +02001219#define HANDOVER_STR "Handover Options\n"
1220
Harald Weltebc814502009-12-19 21:41:52 +01001221DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1222 "handover (0|1)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001223 HANDOVER_STR
1224 "Don't perform in-call handover\n"
1225 "Perform in-call handover\n")
Harald Weltebc814502009-12-19 21:41:52 +01001226{
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001227 int enable = atoi(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001228 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001229
1230 if (enable && ipacc_rtp_direct) {
Harald Weltefe03f0d2009-12-20 13:51:01 +01001231 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1232 "is enabled by using the -P command line option%s",
1233 VTY_NEWLINE);
1234 return CMD_WARNING;
1235 }
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001236 gsmnet->handover.active = enable;
Harald Weltebc814502009-12-19 21:41:52 +01001237
1238 return CMD_SUCCESS;
1239}
1240
Harald Welte8f0ed552010-05-11 21:53:49 +02001241#define HO_WIN_STR HANDOVER_STR "Measurement Window\n"
1242#define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n"
1243#define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n"
1244#define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n"
1245
Harald Welteb720bd32009-12-21 16:51:50 +01001246DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1247 "handover window rxlev averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001248 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001249 "How many RxLev measurements are used for averaging")
1250{
Harald Weltedcccb182010-05-16 20:52:23 +02001251 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001252 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1253 return CMD_SUCCESS;
1254}
1255
1256DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1257 "handover window rxqual averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001258 HO_WIN_RXQUAL_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001259 "How many RxQual measurements are used for averaging")
1260{
Harald Weltedcccb182010-05-16 20:52:23 +02001261 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001262 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1263 return CMD_SUCCESS;
1264}
1265
1266DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1267 "handover window rxlev neighbor averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001268 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001269 "How many RxQual measurements are used for averaging")
1270{
Harald Weltedcccb182010-05-16 20:52:23 +02001271 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001272 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1273 return CMD_SUCCESS;
1274}
1275
1276DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1277 "handover power budget interval <1-99>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001278 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001279 "How often to check if we have a better cell (SACCH frames)")
1280{
Harald Weltedcccb182010-05-16 20:52:23 +02001281 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001282 gsmnet->handover.pwr_interval = atoi(argv[0]);
1283 return CMD_SUCCESS;
1284}
1285
1286DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1287 "handover power budget hysteresis <0-999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001288 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001289 "How many dB does a neighbor to be stronger to become a HO candidate")
1290{
Harald Weltedcccb182010-05-16 20:52:23 +02001291 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001292 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1293 return CMD_SUCCESS;
1294}
1295
1296DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1297 "handover maximum distance <0-9999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001298 HANDOVER_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001299 "How big is the maximum timing advance before HO is forced")
1300{
Harald Weltedcccb182010-05-16 20:52:23 +02001301 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001302 gsmnet->handover.max_distance = atoi(argv[0]);
1303 return CMD_SUCCESS;
1304}
Harald Weltebc814502009-12-19 21:41:52 +01001305
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001306DEFUN(cfg_net_pag_any_tch,
1307 cfg_net_pag_any_tch_cmd,
1308 "paging any use tch (0|1)",
1309 "Assign a TCH when receiving a Paging Any request")
1310{
Holger Hans Peter Freytherb0e88b82010-09-06 10:09:19 +08001311 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001312 gsmnet->pag_any_tch = atoi(argv[0]);
1313 gsm_net_update_ctype(gsmnet);
1314 return CMD_SUCCESS;
1315}
1316
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001317#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001318 DEFUN(cfg_net_T##number, \
1319 cfg_net_T##number##_cmd, \
1320 "timer t" #number " <0-65535>", \
Harald Welte8f0ed552010-05-11 21:53:49 +02001321 "Configure GSM Timers\n" \
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001322 doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001323{ \
Harald Weltedcccb182010-05-16 20:52:23 +02001324 struct gsm_network *gsmnet = gsmnet_from_vty(vty); \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001325 int value = atoi(argv[0]); \
1326 \
1327 if (value < 0 || value > 65535) { \
1328 vty_out(vty, "Timer value %s out of range.%s", \
1329 argv[0], VTY_NEWLINE); \
1330 return CMD_WARNING; \
1331 } \
1332 \
1333 gsmnet->T##number = value; \
1334 return CMD_SUCCESS; \
1335}
1336
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001337DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1338DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1339DECLARE_TIMER(3105, "Currently not used.")
1340DECLARE_TIMER(3107, "Currently not used.")
1341DECLARE_TIMER(3109, "Currently not used.")
Holger Hans Peter Freytherf30c0dc2010-05-31 21:33:15 +08001342DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel.")
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001343DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1344DECLARE_TIMER(3115, "Currently not used.")
1345DECLARE_TIMER(3117, "Currently not used.")
1346DECLARE_TIMER(3119, "Currently not used.")
Harald Welte2862dca2010-12-23 14:39:29 +01001347DECLARE_TIMER(3122, "Waiting time (seconds) after IMM ASS REJECT")
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001348DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001349
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08001350DEFUN(cfg_net_dtx,
1351 cfg_net_dtx_cmd,
1352 "dtx-used (0|1)",
1353 "Enable the usage of DTX.\n"
1354 "DTX is enabled/disabled")
1355{
1356 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1357 gsmnet->dtx_enabled = atoi(argv[0]);
1358 return CMD_SUCCESS;
1359}
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001360
Harald Welte5258fc42009-03-28 19:07:53 +00001361/* per-BTS configuration */
1362DEFUN(cfg_bts,
1363 cfg_bts_cmd,
1364 "bts BTS_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02001365 "Select a BTS to configure\n"
1366 "BTS Number\n")
Harald Welte5258fc42009-03-28 19:07:53 +00001367{
Harald Weltedcccb182010-05-16 20:52:23 +02001368 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte5258fc42009-03-28 19:07:53 +00001369 int bts_nr = atoi(argv[0]);
1370 struct gsm_bts *bts;
1371
Harald Weltee441d9c2009-06-21 16:17:15 +02001372 if (bts_nr > gsmnet->num_bts) {
1373 vty_out(vty, "%% The next unused BTS number is %u%s",
1374 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001375 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001376 } else if (bts_nr == gsmnet->num_bts) {
1377 /* allocate a new one */
1378 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1379 HARDCODED_TSC, HARDCODED_BSIC);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001380 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02001381 bts = gsm_bts_num(gsmnet, bts_nr);
1382
Daniel Willmannf15c2762010-01-11 13:43:07 +01001383 if (!bts) {
1384 vty_out(vty, "%% Unable to allocate BTS %u%s",
1385 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee441d9c2009-06-21 16:17:15 +02001386 return CMD_WARNING;
Daniel Willmannf15c2762010-01-11 13:43:07 +01001387 }
Harald Welte5258fc42009-03-28 19:07:53 +00001388
1389 vty->index = bts;
Harald Welte197dea92010-05-14 17:59:53 +02001390 vty->index_sub = &bts->description;
Harald Welte5258fc42009-03-28 19:07:53 +00001391 vty->node = BTS_NODE;
1392
1393 return CMD_SUCCESS;
1394}
1395
1396DEFUN(cfg_bts_type,
1397 cfg_bts_type_cmd,
1398 "type TYPE",
1399 "Set the BTS type\n")
1400{
1401 struct gsm_bts *bts = vty->index;
Harald Welte39315c42010-01-10 18:01:52 +01001402 int rc;
Harald Welte5258fc42009-03-28 19:07:53 +00001403
Harald Welte39315c42010-01-10 18:01:52 +01001404 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1405 if (rc < 0)
1406 return CMD_WARNING;
Harald Welte8175e952009-10-20 00:22:00 +02001407
Harald Welte5258fc42009-03-28 19:07:53 +00001408 return CMD_SUCCESS;
1409}
1410
Harald Weltefcd24452009-06-20 18:15:19 +02001411DEFUN(cfg_bts_band,
1412 cfg_bts_band_cmd,
1413 "band BAND",
1414 "Set the frequency band of this BTS\n")
1415{
1416 struct gsm_bts *bts = vty->index;
Harald Welte42581822009-08-08 16:12:58 +02001417 int band = gsm_band_parse(argv[0]);
Harald Weltefcd24452009-06-20 18:15:19 +02001418
1419 if (band < 0) {
1420 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1421 band, VTY_NEWLINE);
1422 return CMD_WARNING;
1423 }
1424
1425 bts->band = band;
1426
1427 return CMD_SUCCESS;
1428}
1429
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001430DEFUN(cfg_bts_ci,
1431 cfg_bts_ci_cmd,
1432 "cell_identity <0-65535>",
1433 "Set the Cell identity of this BTS\n")
1434{
1435 struct gsm_bts *bts = vty->index;
1436 int ci = atoi(argv[0]);
1437
1438 if (ci < 0 || ci > 0xffff) {
1439 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1440 ci, VTY_NEWLINE);
1441 return CMD_WARNING;
1442 }
1443 bts->cell_identity = ci;
1444
1445 return CMD_SUCCESS;
1446}
1447
Harald Welte5258fc42009-03-28 19:07:53 +00001448DEFUN(cfg_bts_lac,
1449 cfg_bts_lac_cmd,
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001450 "location_area_code <0-65535>",
Harald Welte5258fc42009-03-28 19:07:53 +00001451 "Set the Location Area Code (LAC) of this BTS\n")
1452{
1453 struct gsm_bts *bts = vty->index;
1454 int lac = atoi(argv[0]);
1455
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001456 if (lac < 0 || lac > 0xffff) {
1457 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte5258fc42009-03-28 19:07:53 +00001458 lac, VTY_NEWLINE);
1459 return CMD_WARNING;
1460 }
Holger Hans Peter Freythere48b9562009-10-01 04:07:15 +02001461
1462 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1463 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1464 lac, VTY_NEWLINE);
1465 return CMD_WARNING;
1466 }
1467
Harald Welte5258fc42009-03-28 19:07:53 +00001468 bts->location_area_code = lac;
1469
1470 return CMD_SUCCESS;
1471}
1472
Harald Weltea43f7892009-12-01 18:04:30 +05301473
Harald Welte5258fc42009-03-28 19:07:53 +00001474DEFUN(cfg_bts_tsc,
1475 cfg_bts_tsc_cmd,
1476 "training_sequence_code <0-255>",
1477 "Set the Training Sequence Code (TSC) of this BTS\n")
1478{
1479 struct gsm_bts *bts = vty->index;
1480 int tsc = atoi(argv[0]);
1481
1482 if (tsc < 0 || tsc > 0xff) {
1483 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1484 tsc, VTY_NEWLINE);
1485 return CMD_WARNING;
1486 }
1487 bts->tsc = tsc;
1488
1489 return CMD_SUCCESS;
1490}
1491
Harald Welte78f2f502009-05-23 16:56:52 +00001492DEFUN(cfg_bts_bsic,
1493 cfg_bts_bsic_cmd,
1494 "base_station_id_code <0-63>",
1495 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1496{
1497 struct gsm_bts *bts = vty->index;
1498 int bsic = atoi(argv[0]);
1499
1500 if (bsic < 0 || bsic > 0x3f) {
Harald Welte42581822009-08-08 16:12:58 +02001501 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte78f2f502009-05-23 16:56:52 +00001502 bsic, VTY_NEWLINE);
1503 return CMD_WARNING;
1504 }
1505 bts->bsic = bsic;
1506
1507 return CMD_SUCCESS;
1508}
1509
1510
Harald Welte4cc34222009-05-01 15:12:31 +00001511DEFUN(cfg_bts_unit_id,
1512 cfg_bts_unit_id_cmd,
Harald Welte07dc73d2009-08-07 13:27:09 +02001513 "ip.access unit_id <0-65534> <0-255>",
1514 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte4cc34222009-05-01 15:12:31 +00001515{
1516 struct gsm_bts *bts = vty->index;
1517 int site_id = atoi(argv[0]);
1518 int bts_id = atoi(argv[1]);
1519
Harald Welte07dc73d2009-08-07 13:27:09 +02001520 if (!is_ipaccess_bts(bts)) {
1521 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1522 return CMD_WARNING;
1523 }
1524
Harald Welte4cc34222009-05-01 15:12:31 +00001525 bts->ip_access.site_id = site_id;
1526 bts->ip_access.bts_id = bts_id;
1527
1528 return CMD_SUCCESS;
1529}
1530
Harald Welte8f0ed552010-05-11 21:53:49 +02001531#define OML_STR "Organization & Maintenance Link\n"
1532#define IPA_STR "ip.access Specific Options\n"
1533
Harald Welte8175e952009-10-20 00:22:00 +02001534DEFUN(cfg_bts_stream_id,
1535 cfg_bts_stream_id_cmd,
1536 "oml ip.access stream_id <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001537 OML_STR IPA_STR
Harald Welte8175e952009-10-20 00:22:00 +02001538 "Set the ip.access Stream ID of the OML link of this BTS\n")
1539{
1540 struct gsm_bts *bts = vty->index;
1541 int stream_id = atoi(argv[0]);
1542
1543 if (!is_ipaccess_bts(bts)) {
1544 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1545 return CMD_WARNING;
1546 }
1547
1548 bts->oml_tei = stream_id;
1549
1550 return CMD_SUCCESS;
1551}
1552
Harald Welte8f0ed552010-05-11 21:53:49 +02001553#define OML_E1_STR OML_STR "E1 Line\n"
Harald Welte8175e952009-10-20 00:22:00 +02001554
Harald Welte42581822009-08-08 16:12:58 +02001555DEFUN(cfg_bts_oml_e1,
1556 cfg_bts_oml_e1_cmd,
1557 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001558 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001559 "E1 interface to be used for OML\n")
1560{
1561 struct gsm_bts *bts = vty->index;
1562
1563 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1564
1565 return CMD_SUCCESS;
1566}
1567
1568
1569DEFUN(cfg_bts_oml_e1_tei,
1570 cfg_bts_oml_e1_tei_cmd,
1571 "oml e1 tei <0-63>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001572 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001573 "Set the TEI to be used for OML")
1574{
1575 struct gsm_bts *bts = vty->index;
1576
1577 bts->oml_tei = atoi(argv[0]);
1578
1579 return CMD_SUCCESS;
1580}
1581
Harald Welte7a8fa412009-08-10 13:48:16 +02001582DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1583 "channel allocator (ascending|descending)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001584 "Channnel Allocator\n" "Channel Allocator\n"
1585 "Allocate Timeslots and Transceivers in ascending order\n"
1586 "Allocate Timeslots and Transceivers in descending order\n")
Harald Welte7a8fa412009-08-10 13:48:16 +02001587{
1588 struct gsm_bts *bts = vty->index;
1589
1590 if (!strcmp(argv[0], "ascending"))
1591 bts->chan_alloc_reverse = 0;
1592 else
1593 bts->chan_alloc_reverse = 1;
1594
1595 return CMD_SUCCESS;
1596}
1597
Harald Welte8f0ed552010-05-11 21:53:49 +02001598#define RACH_STR "Random Access Control Channel\n"
1599
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001600DEFUN(cfg_bts_rach_tx_integer,
1601 cfg_bts_rach_tx_integer_cmd,
1602 "rach tx integer <0-15>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001603 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001604 "Set the raw tx integer value in RACH Control parameters IE")
1605{
1606 struct gsm_bts *bts = vty->index;
1607 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1608 return CMD_SUCCESS;
1609}
1610
1611DEFUN(cfg_bts_rach_max_trans,
1612 cfg_bts_rach_max_trans_cmd,
1613 "rach max transmission (1|2|4|7)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001614 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001615 "Set the maximum number of RACH burst transmissions")
1616{
1617 struct gsm_bts *bts = vty->index;
1618 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1619 return CMD_SUCCESS;
1620}
1621
Harald Welte8f0ed552010-05-11 21:53:49 +02001622#define NM_STR "Network Management\n"
1623
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001624DEFUN(cfg_bts_rach_nm_b_thresh,
1625 cfg_bts_rach_nm_b_thresh_cmd,
1626 "rach nm busy threshold <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001627 RACH_STR NM_STR
1628 "Set the NM Busy Threshold in dB")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001629{
1630 struct gsm_bts *bts = vty->index;
1631 bts->rach_b_thresh = atoi(argv[0]);
1632 return CMD_SUCCESS;
1633}
1634
1635DEFUN(cfg_bts_rach_nm_ldavg,
1636 cfg_bts_rach_nm_ldavg_cmd,
1637 "rach nm load average <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001638 RACH_STR NM_STR
1639 "Set the NM Loadaverage Slots value")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001640{
1641 struct gsm_bts *bts = vty->index;
1642 bts->rach_ldavg_slots = atoi(argv[0]);
1643 return CMD_SUCCESS;
1644}
1645
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001646DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1647 "cell barred (0|1)",
1648 "Should this cell be barred from access?")
1649{
1650 struct gsm_bts *bts = vty->index;
1651
Harald Welte71355012009-12-21 23:08:18 +01001652 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001653
1654 return CMD_SUCCESS;
1655}
1656
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08001657DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd,
1658 "rach emergency call allowed (0|1)",
1659 "Should this cell allow emergency calls?")
1660{
1661 struct gsm_bts *bts = vty->index;
1662
1663 if (atoi(argv[0]) == 0)
1664 bts->si_common.rach_control.t2 |= 0x4;
1665 else
1666 bts->si_common.rach_control.t2 &= ~0x4;
1667
1668 return CMD_SUCCESS;
1669}
1670
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001671DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1672 "ms max power <0-40>",
1673 "Maximum transmit power of the MS")
1674{
1675 struct gsm_bts *bts = vty->index;
1676
1677 bts->ms_max_power = atoi(argv[0]);
1678
1679 return CMD_SUCCESS;
1680}
1681
Harald Welte73225282009-12-12 18:17:25 +01001682DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1683 "cell reselection hysteresis <0-14>",
1684 "Cell Re-Selection Hysteresis in dB")
1685{
1686 struct gsm_bts *bts = vty->index;
1687
1688 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1689
1690 return CMD_SUCCESS;
1691}
1692
1693DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1694 "rxlev access min <0-63>",
1695 "Minimum RxLev needed for cell access (better than -110dBm)")
1696{
1697 struct gsm_bts *bts = vty->index;
1698
1699 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1700
1701 return CMD_SUCCESS;
1702}
1703
Sylvain Munaute0b06b02010-11-28 18:17:28 +01001704DEFUN(cfg_bts_cell_bar_qualify, cfg_bts_cell_bar_qualify_cmd,
1705 "cell bar qualify (0|1)",
1706 "Cell Bar Qualify")
1707{
1708 struct gsm_bts *bts = vty->index;
1709
1710 bts->si_common.cell_ro_sel_par.present = 1;
1711 bts->si_common.cell_ro_sel_par.cbq = atoi(argv[0]);
1712
1713 return CMD_SUCCESS;
1714}
1715
1716DEFUN(cfg_bts_cell_resel_ofs, cfg_bts_cell_resel_ofs_cmd,
1717 "cell reselection offset <0-126>",
1718 "Cell Re-Selection Offset in dB")
1719{
1720 struct gsm_bts *bts = vty->index;
1721
1722 bts->si_common.cell_ro_sel_par.present = 1;
1723 bts->si_common.cell_ro_sel_par.cell_resel_off = atoi(argv[0])/2;
1724
1725 return CMD_SUCCESS;
1726}
1727
1728DEFUN(cfg_bts_temp_ofs, cfg_bts_temp_ofs_cmd,
1729 "temporary offset <0-60>",
1730 "Cell selection temporary negative offset in dB")
1731{
1732 struct gsm_bts *bts = vty->index;
1733
1734 bts->si_common.cell_ro_sel_par.present = 1;
1735 bts->si_common.cell_ro_sel_par.temp_offs = atoi(argv[0])/10;
1736
1737 return CMD_SUCCESS;
1738}
1739
1740DEFUN(cfg_bts_temp_ofs_inf, cfg_bts_temp_ofs_inf_cmd,
1741 "temporary offset infinite",
1742 "Sets cell selection temporary negative offset to infinity")
1743{
1744 struct gsm_bts *bts = vty->index;
1745
1746 bts->si_common.cell_ro_sel_par.present = 1;
1747 bts->si_common.cell_ro_sel_par.temp_offs = 7;
1748
1749 return CMD_SUCCESS;
1750}
1751
1752DEFUN(cfg_bts_penalty_time, cfg_bts_penalty_time_cmd,
1753 "penalty time <20-620>",
1754 "Cell selection penalty time in seconds (by 20s increments)")
1755{
1756 struct gsm_bts *bts = vty->index;
1757
1758 bts->si_common.cell_ro_sel_par.present = 1;
1759 bts->si_common.cell_ro_sel_par.penalty_time = (atoi(argv[0])-20)/20;
1760
1761 return CMD_SUCCESS;
1762}
1763
1764DEFUN(cfg_bts_penalty_time_rsvd, cfg_bts_penalty_time_rsvd_cmd,
1765 "penalty time reserved",
1766 "Set cell selection penalty time to reserved value 31\n"
1767 "(indicate that CELL_RESELECT_OFFSET is subtracted from C2 "
1768 "and TEMPORARY_OFFSET is ignored)")
1769{
1770 struct gsm_bts *bts = vty->index;
1771
1772 bts->si_common.cell_ro_sel_par.present = 1;
1773 bts->si_common.cell_ro_sel_par.penalty_time = 31;
1774
1775 return CMD_SUCCESS;
1776}
1777
Harald Welte (local)efc92312009-08-14 23:09:25 +02001778DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1779 "periodic location update <0-1530>",
1780 "Periodic Location Updating Interval in Minutes")
1781{
1782 struct gsm_bts *bts = vty->index;
1783
Dieter Spaard6613e02010-10-05 21:10:55 +02001784 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 6;
Harald Welte (local)efc92312009-08-14 23:09:25 +02001785
1786 return CMD_SUCCESS;
1787}
1788
Harald Welte8f0ed552010-05-11 21:53:49 +02001789#define GPRS_TEXT "GPRS Packet Network\n"
1790
Harald Welteaf387632010-03-14 23:30:30 +08001791DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welte57ba7e32010-04-18 14:00:26 +02001792 "gprs cell bvci <2-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001793 GPRS_TEXT
1794 "GPRS Cell Settings\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001795 "GPRS BSSGP VC Identifier")
1796{
1797 struct gsm_bts *bts = vty->index;
1798
Harald Welte4511d892010-04-18 15:51:20 +02001799 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001800 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1801 return CMD_WARNING;
1802 }
1803
Harald Welte97a282b2010-03-14 15:37:43 +08001804 bts->gprs.cell.bvci = atoi(argv[0]);
1805
1806 return CMD_SUCCESS;
1807}
1808
Harald Weltea5731cf2010-03-22 11:48:36 +08001809DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
1810 "gprs nsei <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001811 GPRS_TEXT
Harald Weltea5731cf2010-03-22 11:48:36 +08001812 "GPRS NS Entity Identifier")
1813{
1814 struct gsm_bts *bts = vty->index;
1815
Harald Welte4511d892010-04-18 15:51:20 +02001816 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltea5731cf2010-03-22 11:48:36 +08001817 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1818 return CMD_WARNING;
1819 }
1820
1821 bts->gprs.nse.nsei = atoi(argv[0]);
1822
1823 return CMD_SUCCESS;
1824}
1825
Harald Welte8f0ed552010-05-11 21:53:49 +02001826#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
1827 "NSVC Logical Number\n"
Harald Weltea5731cf2010-03-22 11:48:36 +08001828
Harald Welte97a282b2010-03-14 15:37:43 +08001829DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
1830 "gprs nsvc <0-1> nsvci <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001831 GPRS_TEXT NSVC_TEXT
1832 "NS Virtual Connection Identifier\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001833 "GPRS NS VC Identifier")
1834{
1835 struct gsm_bts *bts = vty->index;
1836 int idx = atoi(argv[0]);
1837
Harald Welte4511d892010-04-18 15:51:20 +02001838 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001839 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1840 return CMD_WARNING;
1841 }
1842
Harald Welte97a282b2010-03-14 15:37:43 +08001843 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
1844
1845 return CMD_SUCCESS;
1846}
1847
Harald Welteaf387632010-03-14 23:30:30 +08001848DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
1849 "gprs nsvc <0-1> local udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001850 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001851 "GPRS NS Local UDP Port")
1852{
1853 struct gsm_bts *bts = vty->index;
1854 int idx = atoi(argv[0]);
1855
Harald Welte4511d892010-04-18 15:51:20 +02001856 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001857 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1858 return CMD_WARNING;
1859 }
1860
Harald Welteaf387632010-03-14 23:30:30 +08001861 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
1862
1863 return CMD_SUCCESS;
1864}
1865
1866DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
1867 "gprs nsvc <0-1> remote udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001868 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001869 "GPRS NS Remote UDP Port")
1870{
1871 struct gsm_bts *bts = vty->index;
1872 int idx = atoi(argv[0]);
1873
Harald Welte4511d892010-04-18 15:51:20 +02001874 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001875 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1876 return CMD_WARNING;
1877 }
1878
Harald Welteaf387632010-03-14 23:30:30 +08001879 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
1880
1881 return CMD_SUCCESS;
1882}
1883
1884DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
1885 "gprs nsvc <0-1> remote ip A.B.C.D",
Harald Welte8f0ed552010-05-11 21:53:49 +02001886 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001887 "GPRS NS Remote IP Address")
1888{
1889 struct gsm_bts *bts = vty->index;
1890 int idx = atoi(argv[0]);
1891 struct in_addr ia;
1892
Harald Welte4511d892010-04-18 15:51:20 +02001893 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001894 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1895 return CMD_WARNING;
1896 }
1897
Harald Welteaf387632010-03-14 23:30:30 +08001898 inet_aton(argv[1], &ia);
1899 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
1900
1901 return CMD_SUCCESS;
1902}
1903
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08001904DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd,
1905 "paging free FREE_NR",
1906 "Only page when having a certain amount of free slots. -1 to disable")
1907{
1908 struct gsm_bts *bts = vty->index;
1909
1910 bts->paging.free_chans_need = atoi(argv[0]);
1911 return CMD_SUCCESS;
1912}
1913
Harald Welte615e9562010-05-11 23:50:21 +02001914DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd,
1915 "gprs ns timer " NS_TIMERS " <0-255>",
1916 GPRS_TEXT "Network Service\n"
1917 "Network Service Timer\n"
1918 NS_TIMERS_HELP "Timer Value\n")
1919{
1920 struct gsm_bts *bts = vty->index;
1921 int idx = get_string_value(gprs_ns_timer_strs, argv[0]);
1922 int val = atoi(argv[1]);
1923
1924 if (bts->gprs.mode == BTS_GPRS_NONE) {
1925 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1926 return CMD_WARNING;
1927 }
1928
1929 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
1930 return CMD_WARNING;
1931
1932 bts->gprs.nse.timer[idx] = val;
1933
1934 return CMD_SUCCESS;
1935}
1936
1937#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 +02001938#define BSSGP_TIMERS_HELP \
1939 "Tbvc-block timeout\n" \
1940 "Tbvc-block retries\n" \
1941 "Tbvc-unblock retries\n" \
1942 "Tbvcc-reset timeout\n" \
1943 "Tbvc-reset retries\n" \
1944 "Tbvc-suspend timeout\n" \
1945 "Tbvc-suspend retries\n" \
1946 "Tbvc-resume timeout\n" \
1947 "Tbvc-resume retries\n" \
1948 "Tbvc-capa-update timeout\n" \
1949 "Tbvc-capa-update retries\n"
Harald Welte615e9562010-05-11 23:50:21 +02001950
1951DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd,
1952 "gprs cell timer " BSSGP_TIMERS " <0-255>",
1953 GPRS_TEXT "Cell / BSSGP\n"
1954 "Cell/BSSGP Timer\n"
1955 BSSGP_TIMERS_HELP "Timer Value\n")
1956{
1957 struct gsm_bts *bts = vty->index;
1958 int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
1959 int val = atoi(argv[1]);
1960
1961 if (bts->gprs.mode == BTS_GPRS_NONE) {
1962 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1963 return CMD_WARNING;
1964 }
1965
1966 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer))
1967 return CMD_WARNING;
1968
1969 bts->gprs.cell.timer[idx] = val;
1970
1971 return CMD_SUCCESS;
1972}
1973
Harald Welte97a282b2010-03-14 15:37:43 +08001974DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
1975 "gprs routing area <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001976 GPRS_TEXT
Harald Welte97a282b2010-03-14 15:37:43 +08001977 "GPRS Routing Area Code")
1978{
1979 struct gsm_bts *bts = vty->index;
1980
Harald Welte4511d892010-04-18 15:51:20 +02001981 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001982 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1983 return CMD_WARNING;
1984 }
1985
Harald Welte97a282b2010-03-14 15:37:43 +08001986 bts->gprs.rac = atoi(argv[0]);
1987
1988 return CMD_SUCCESS;
1989}
1990
Harald Welte4511d892010-04-18 15:51:20 +02001991DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
1992 "gprs mode (none|gprs|egprs)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001993 GPRS_TEXT
1994 "GPRS Mode for this BTS\n"
1995 "GPRS Disabled on this BTS\n"
1996 "GPRS Enabled on this BTS\n"
1997 "EGPRS (EDGE) Enabled on this BTS\n")
Harald Welteaf387632010-03-14 23:30:30 +08001998{
1999 struct gsm_bts *bts = vty->index;
Harald Weltef3d8e922010-06-14 22:44:42 +02002000 enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0]);
Harald Welteaf387632010-03-14 23:30:30 +08002001
Harald Weltef3d8e922010-06-14 22:44:42 +02002002 if (mode != BTS_GPRS_NONE &&
2003 !gsm_bts_has_feature(bts, BTS_FEAT_GPRS)) {
2004 vty_out(vty, "This BTS type does not support %s%s", argv[0],
2005 VTY_NEWLINE);
2006 return CMD_WARNING;
2007 }
2008 if (mode == BTS_GPRS_EGPRS &&
2009 !gsm_bts_has_feature(bts, BTS_FEAT_EGPRS)) {
2010 vty_out(vty, "This BTS type does not support %s%s", argv[0],
2011 VTY_NEWLINE);
2012 return CMD_WARNING;
2013 }
2014
2015 bts->gprs.mode = mode;
Harald Welteaf387632010-03-14 23:30:30 +08002016
2017 return CMD_SUCCESS;
2018}
2019
Harald Welte9fbff4a2010-07-30 11:50:09 +02002020#define SI_TEXT "System Information Messages\n"
2021#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)"
2022#define SI_TYPE_HELP "System Information Type 1\n" \
2023 "System Information Type 2\n" \
2024 "System Information Type 3\n" \
2025 "System Information Type 4\n" \
2026 "System Information Type 5\n" \
2027 "System Information Type 6\n" \
2028 "System Information Type 7\n" \
2029 "System Information Type 8\n" \
2030 "System Information Type 9\n" \
2031 "System Information Type 10\n" \
2032 "System Information Type 13\n" \
2033 "System Information Type 16\n" \
2034 "System Information Type 17\n" \
2035 "System Information Type 18\n" \
2036 "System Information Type 19\n" \
2037 "System Information Type 20\n" \
2038 "System Information Type 2bis\n" \
2039 "System Information Type 2ter\n" \
2040 "System Information Type 2quater\n" \
2041 "System Information Type 5bis\n" \
2042 "System Information Type 5ter\n"
2043
2044DEFUN(cfg_bts_si_mode, cfg_bts_si_mode_cmd,
2045 "system-information " SI_TYPE_TEXT " mode (static|computed)",
2046 SI_TEXT SI_TYPE_HELP
2047 "System Information Mode\n"
2048 "Static user-specified\n"
2049 "Dynamic, BSC-computed\n")
2050{
2051 struct gsm_bts *bts = vty->index;
2052 int type;
2053
2054 type = get_string_value(osmo_sitype_strs, argv[0]);
2055 if (type < 0) {
2056 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2057 return CMD_WARNING;
2058 }
2059
2060 if (!strcmp(argv[1], "static"))
2061 bts->si_mode_static |= (1 << type);
2062 else
2063 bts->si_mode_static &= ~(1 << type);
2064
2065 return CMD_SUCCESS;
2066}
2067
2068DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd,
2069 "system-information " SI_TYPE_TEXT " static HEXSTRING",
2070 SI_TEXT SI_TYPE_HELP
2071 "Static System Information filling\n"
2072 "Static user-specified SI content in HEX notation\n")
2073{
2074 struct gsm_bts *bts = vty->index;
2075 int rc, type;
2076
2077 type = get_string_value(osmo_sitype_strs, argv[0]);
2078 if (type < 0) {
2079 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2080 return CMD_WARNING;
2081 }
2082
2083 if (!(bts->si_mode_static & (1 << type))) {
2084 vty_out(vty, "SI Type %s is not configured in static mode%s",
2085 get_value_string(osmo_sitype_strs, type), VTY_NEWLINE);
2086 return CMD_WARNING;
2087 }
2088
Harald Welte290aaed2010-07-30 11:53:18 +02002089 /* Fill buffer with padding pattern */
2090 memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type]));
2091
2092 /* Parse the user-specified SI in hex format, [partially] overwriting padding */
Harald Welte9fbff4a2010-07-30 11:50:09 +02002093 rc = hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0]));
2094 if (rc < 0 || rc > sizeof(bts->si_buf[0])) {
2095 vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
2096 return CMD_WARNING;
2097 }
2098
2099 /* Mark this SI as present */
2100 bts->si_valid |= (1 << type);
2101
2102 return CMD_SUCCESS;
2103}
2104
2105
Harald Welte8f0ed552010-05-11 21:53:49 +02002106#define TRX_TEXT "Radio Transceiver\n"
Harald Welte7a8fa412009-08-10 13:48:16 +02002107
Harald Welte5258fc42009-03-28 19:07:53 +00002108/* per TRX configuration */
2109DEFUN(cfg_trx,
2110 cfg_trx_cmd,
2111 "trx TRX_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02002112 TRX_TEXT
Harald Welte5258fc42009-03-28 19:07:53 +00002113 "Select a TRX to configure")
2114{
2115 int trx_nr = atoi(argv[0]);
2116 struct gsm_bts *bts = vty->index;
2117 struct gsm_bts_trx *trx;
2118
Harald Weltee441d9c2009-06-21 16:17:15 +02002119 if (trx_nr > bts->num_trx) {
2120 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
2121 bts->num_trx, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00002122 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02002123 } else if (trx_nr == bts->num_trx) {
2124 /* we need to allocate a new one */
2125 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02002126 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02002127 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02002128
Harald Weltee441d9c2009-06-21 16:17:15 +02002129 if (!trx)
2130 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +00002131
2132 vty->index = trx;
Harald Welte197dea92010-05-14 17:59:53 +02002133 vty->index_sub = &trx->description;
Harald Welte5258fc42009-03-28 19:07:53 +00002134 vty->node = TRX_NODE;
2135
2136 return CMD_SUCCESS;
2137}
2138
2139DEFUN(cfg_trx_arfcn,
2140 cfg_trx_arfcn_cmd,
Harald Welte93e90202010-05-14 19:00:52 +02002141 "arfcn <0-1024>",
Harald Welte5258fc42009-03-28 19:07:53 +00002142 "Set the ARFCN for this TRX\n")
2143{
2144 int arfcn = atoi(argv[0]);
2145 struct gsm_bts_trx *trx = vty->index;
2146
2147 /* FIXME: check if this ARFCN is supported by this TRX */
2148
2149 trx->arfcn = arfcn;
2150
2151 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
2152 /* FIXME: use OML layer to update the ARFCN */
2153 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
2154
2155 return CMD_SUCCESS;
2156}
2157
Harald Welte (local)7b37d972009-12-27 20:56:38 +01002158DEFUN(cfg_trx_nominal_power,
2159 cfg_trx_nominal_power_cmd,
2160 "nominal power <0-100>",
2161 "Nominal TRX RF Power in dB\n")
2162{
2163 struct gsm_bts_trx *trx = vty->index;
2164
2165 trx->nominal_power = atoi(argv[0]);
2166
2167 return CMD_SUCCESS;
2168}
2169
Harald Weltefcd24452009-06-20 18:15:19 +02002170DEFUN(cfg_trx_max_power_red,
2171 cfg_trx_max_power_red_cmd,
2172 "max_power_red <0-100>",
2173 "Reduction of maximum BS RF Power in dB\n")
2174{
2175 int maxpwr_r = atoi(argv[0]);
2176 struct gsm_bts_trx *trx = vty->index;
Harald Welte61a83b22009-11-18 09:20:22 +01002177 int upper_limit = 24; /* default 12.21 max power red. */
Harald Weltefcd24452009-06-20 18:15:19 +02002178
2179 /* FIXME: check if our BTS type supports more than 12 */
2180 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
2181 vty_out(vty, "%% Power %d dB is not in the valid range%s",
2182 maxpwr_r, VTY_NEWLINE);
2183 return CMD_WARNING;
2184 }
2185 if (maxpwr_r & 1) {
2186 vty_out(vty, "%% Power %d dB is not an even value%s",
2187 maxpwr_r, VTY_NEWLINE);
2188 return CMD_WARNING;
2189 }
2190
2191 trx->max_power_red = maxpwr_r;
2192
2193 /* FIXME: make sure we update this using OML */
2194
2195 return CMD_SUCCESS;
2196}
2197
Harald Welte42581822009-08-08 16:12:58 +02002198DEFUN(cfg_trx_rsl_e1,
2199 cfg_trx_rsl_e1_cmd,
2200 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
2201 "E1 interface to be used for RSL\n")
2202{
2203 struct gsm_bts_trx *trx = vty->index;
2204
2205 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
2206
2207 return CMD_SUCCESS;
2208}
2209
2210DEFUN(cfg_trx_rsl_e1_tei,
2211 cfg_trx_rsl_e1_tei_cmd,
2212 "rsl e1 tei <0-63>",
2213 "Set the TEI to be used for RSL")
2214{
2215 struct gsm_bts_trx *trx = vty->index;
2216
2217 trx->rsl_tei = atoi(argv[0]);
2218
2219 return CMD_SUCCESS;
2220}
2221
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01002222DEFUN(cfg_trx_rf_locked,
2223 cfg_trx_rf_locked_cmd,
2224 "rf_locked (0|1)",
2225 "Turn off RF of the TRX.\n")
2226{
2227 int locked = atoi(argv[0]);
2228 struct gsm_bts_trx *trx = vty->index;
2229
2230 gsm_trx_lock_rf(trx, locked);
2231 return CMD_SUCCESS;
2232}
Harald Welte42581822009-08-08 16:12:58 +02002233
Harald Welte5258fc42009-03-28 19:07:53 +00002234/* per TS configuration */
2235DEFUN(cfg_ts,
2236 cfg_ts_cmd,
Harald Welte42581822009-08-08 16:12:58 +02002237 "timeslot <0-7>",
Harald Welte5258fc42009-03-28 19:07:53 +00002238 "Select a Timeslot to configure")
2239{
2240 int ts_nr = atoi(argv[0]);
2241 struct gsm_bts_trx *trx = vty->index;
2242 struct gsm_bts_trx_ts *ts;
2243
2244 if (ts_nr >= TRX_NR_TS) {
2245 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
2246 TRX_NR_TS, VTY_NEWLINE);
2247 return CMD_WARNING;
2248 }
2249
2250 ts = &trx->ts[ts_nr];
2251
2252 vty->index = ts;
2253 vty->node = TS_NODE;
2254
2255 return CMD_SUCCESS;
2256}
2257
Harald Weltea6fd58e2009-08-07 00:25:23 +02002258DEFUN(cfg_ts_pchan,
2259 cfg_ts_pchan_cmd,
2260 "phys_chan_config PCHAN",
2261 "Physical Channel configuration (TCH/SDCCH/...)")
2262{
2263 struct gsm_bts_trx_ts *ts = vty->index;
2264 int pchanc;
2265
2266 pchanc = gsm_pchan_parse(argv[0]);
2267 if (pchanc < 0)
2268 return CMD_WARNING;
2269
2270 ts->pchan = pchanc;
2271
2272 return CMD_SUCCESS;
2273}
2274
Harald Weltea39b0f22010-06-14 22:26:10 +02002275#define HOPPING_STR "Configure frequency hopping\n"
2276
2277DEFUN(cfg_ts_hopping,
2278 cfg_ts_hopping_cmd,
2279 "hopping enabled (0|1)",
2280 HOPPING_STR "Enable or disable frequency hopping\n"
2281 "Disable frequency hopping\n" "Enable frequency hopping\n")
2282{
2283 struct gsm_bts_trx_ts *ts = vty->index;
Harald Weltec2fb3d02010-06-14 22:47:37 +02002284 int enabled = atoi(argv[0]);
Harald Weltea39b0f22010-06-14 22:26:10 +02002285
Harald Weltec2fb3d02010-06-14 22:47:37 +02002286 if (enabled && !gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_HOPPING)) {
2287 vty_out(vty, "BTS model does not support hopping%s",
2288 VTY_NEWLINE);
2289 return CMD_WARNING;
2290 }
2291
2292 ts->hopping.enabled = enabled;
Harald Weltea39b0f22010-06-14 22:26:10 +02002293
2294 return CMD_SUCCESS;
2295}
2296
Harald Welte6e0cd042009-09-12 13:05:33 +02002297DEFUN(cfg_ts_hsn,
2298 cfg_ts_hsn_cmd,
Harald Weltea39b0f22010-06-14 22:26:10 +02002299 "hopping sequence-number <0-63>",
2300 HOPPING_STR
Harald Welte6e0cd042009-09-12 13:05:33 +02002301 "Which hopping sequence to use for this channel")
2302{
2303 struct gsm_bts_trx_ts *ts = vty->index;
2304
2305 ts->hopping.hsn = atoi(argv[0]);
2306
2307 return CMD_SUCCESS;
2308}
2309
2310DEFUN(cfg_ts_maio,
2311 cfg_ts_maio_cmd,
2312 "hopping maio <0-63>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002313 HOPPING_STR
Harald Welte6e0cd042009-09-12 13:05:33 +02002314 "Which hopping MAIO to use for this channel")
2315{
2316 struct gsm_bts_trx_ts *ts = vty->index;
2317
2318 ts->hopping.maio = atoi(argv[0]);
2319
2320 return CMD_SUCCESS;
2321}
2322
2323DEFUN(cfg_ts_arfcn_add,
2324 cfg_ts_arfcn_add_cmd,
2325 "hopping arfcn add <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002326 HOPPING_STR "Configure hopping ARFCN list\n"
2327 "Add an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02002328{
2329 struct gsm_bts_trx_ts *ts = vty->index;
2330 int arfcn = atoi(argv[0]);
2331
Harald Weltea39b0f22010-06-14 22:26:10 +02002332 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1);
2333
Harald Welte6e0cd042009-09-12 13:05:33 +02002334 return CMD_SUCCESS;
2335}
2336
2337DEFUN(cfg_ts_arfcn_del,
2338 cfg_ts_arfcn_del_cmd,
2339 "hopping arfcn del <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002340 HOPPING_STR "Configure hopping ARFCN list\n"
2341 "Delete an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02002342{
2343 struct gsm_bts_trx_ts *ts = vty->index;
2344 int arfcn = atoi(argv[0]);
2345
Harald Weltea39b0f22010-06-14 22:26:10 +02002346 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0);
2347
Harald Welte6e0cd042009-09-12 13:05:33 +02002348 return CMD_SUCCESS;
2349}
2350
Harald Weltea6fd58e2009-08-07 00:25:23 +02002351DEFUN(cfg_ts_e1_subslot,
2352 cfg_ts_e1_subslot_cmd,
Harald Welte42581822009-08-08 16:12:58 +02002353 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltea6fd58e2009-08-07 00:25:23 +02002354 "E1 sub-slot connected to this on-air timeslot")
2355{
2356 struct gsm_bts_trx_ts *ts = vty->index;
2357
Harald Welte42581822009-08-08 16:12:58 +02002358 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002359
2360 return CMD_SUCCESS;
2361}
Harald Welte5258fc42009-03-28 19:07:53 +00002362
Harald Welte4f10c252010-05-16 21:47:13 +02002363void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
2364{
2365 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
2366 counter_get(net->stats.chreq.total),
2367 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
2368 vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
2369 counter_get(net->stats.chan.rf_fail),
2370 counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
2371 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
2372 counter_get(net->stats.paging.attempted),
2373 counter_get(net->stats.paging.completed),
2374 counter_get(net->stats.paging.expired), VTY_NEWLINE);
2375 vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
2376 counter_get(net->stats.bts.oml_fail),
2377 counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
2378}
2379
Harald Welte5bc61dc2010-05-16 22:02:16 +02002380DEFUN(logging_fltr_imsi,
2381 logging_fltr_imsi_cmd,
2382 "logging filter imsi IMSI",
2383 LOGGING_STR FILTER_STR
2384 "Filter log messages by IMSI\n" "IMSI to be used as filter\n")
2385{
2386 struct telnet_connection *conn;
2387
2388 conn = (struct telnet_connection *) vty->priv;
2389 if (!conn->dbg) {
2390 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
2391 return CMD_WARNING;
2392 }
2393
2394 log_set_imsi_filter(conn->dbg, argv[0]);
2395 return CMD_SUCCESS;
2396}
2397
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002398DEFUN(drop_bts,
2399 drop_bts_cmd,
Holger Hans Peter Freyther0586b0f2010-04-11 12:46:45 +02002400 "drop bts connection <0-65535> (oml|rsl)",
2401 "Debug/Simulation command to drop ipaccess BTS\n"
2402 "BTS NR\n" "Connection Type\n")
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002403{
2404 struct gsm_network *gsmnet;
2405 struct gsm_bts_trx *trx;
2406 struct gsm_bts *bts;
2407 unsigned int bts_nr;
2408
2409 gsmnet = gsmnet_from_vty(vty);
2410
2411 bts_nr = atoi(argv[0]);
2412 if (bts_nr >= gsmnet->num_bts) {
2413 vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s",
2414 gsmnet->num_bts, bts_nr, VTY_NEWLINE);
2415 return CMD_WARNING;
2416 }
2417
2418 bts = gsm_bts_num(gsmnet, bts_nr);
2419 if (!bts) {
2420 vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE);
2421 return CMD_WARNING;
2422 }
2423
2424 if (!is_ipaccess_bts(bts)) {
2425 vty_out(vty, "This command only works for ipaccess.%s", VTY_NEWLINE);
2426 return CMD_WARNING;
2427 }
2428
2429
2430 /* close all connections */
2431 if (strcmp(argv[1], "oml") == 0) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01002432 ipaccess_drop_oml(bts);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002433 } else if (strcmp(argv[1], "rsl") == 0) {
2434 /* close all rsl connections */
2435 llist_for_each_entry(trx, &bts->trx_list, list) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01002436 ipaccess_drop_rsl(trx);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002437 }
2438 } else {
2439 vty_out(vty, "Argument must be 'oml# or 'rsl'.%s", VTY_NEWLINE);
2440 return CMD_WARNING;
2441 }
2442
2443 return CMD_SUCCESS;
2444}
2445
Harald Welted0d2b0b2010-12-23 13:18:07 +01002446DEFUN(pdch_act, pdch_act_cmd,
2447 "bts <0-255> trx <0-255> timeslot <0-7> pdch (activate|deactivate)",
2448 "BTS related commands\n" "BTS Number\n" "Transceiver\n" "Transceiver Number\n"
2449 "TRX Timeslot\n" "Timeslot Number\n" "Packet Data Channel\n"
2450 "Activate Dynamic PDCH/TCH (-> PDCH mode)\n"
2451 "Deactivate Dynamic PDCH/TCH (-> TCH mode)\n")
2452{
2453 struct gsm_bts *bts;
2454 struct gsm_bts_trx *trx;
2455 struct gsm_bts_trx_ts *ts;
2456 int bts_nr = atoi(argv[0]);
2457 int trx_nr = atoi(argv[1]);
2458 int ts_nr = atoi(argv[2]);
2459 int activate;
2460
2461 bts = gsm_bts_num(bsc_gsmnet, bts_nr);
2462 if (!bts) {
2463 vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE);
2464 return CMD_WARNING;
2465 }
2466
2467 if (!is_ipaccess_bts(bts)) {
2468 vty_out(vty, "%% This command only works for ipaccess BTS%s",
2469 VTY_NEWLINE);
2470 return CMD_WARNING;
2471 }
2472
2473 trx = gsm_bts_trx_num(bts, trx_nr);
2474 if (!trx) {
2475 vty_out(vty, "%% No such TRX (%d)%s", trx_nr, VTY_NEWLINE);
2476 return CMD_WARNING;
2477 }
2478
2479 ts = &trx->ts[ts_nr];
2480 if (ts->pchan != GSM_PCHAN_TCH_F_PDCH) {
2481 vty_out(vty, "%% Timeslot %u is not in dynamic TCH_F/PDCH "
2482 "mode%s", ts_nr, VTY_NEWLINE);
2483 return CMD_WARNING;
2484 }
2485
2486 if (!strcmp(argv[3], "activate"))
2487 activate = 1;
2488 else
2489 activate = 0;
2490
2491 rsl_ipacc_pdch_activate(ts, activate);
2492
2493 return CMD_SUCCESS;
2494
2495}
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002496
Harald Weltedcccb182010-05-16 20:52:23 +02002497extern int bsc_vty_init_extra(void);
Harald Welte1353f962010-05-16 19:20:24 +02002498extern const char *openbsc_copyright;
Holger Hans Peter Freythere1ffc082010-04-10 00:08:28 +02002499
Harald Weltedcccb182010-05-16 20:52:23 +02002500int bsc_vty_init(void)
Harald Welte68628e82009-03-10 12:17:57 +00002501{
Harald Welteb4d5b172010-05-12 16:10:35 +00002502 install_element_ve(&show_net_cmd);
2503 install_element_ve(&show_bts_cmd);
2504 install_element_ve(&show_trx_cmd);
2505 install_element_ve(&show_ts_cmd);
2506 install_element_ve(&show_lchan_cmd);
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08002507 install_element_ve(&show_lchan_summary_cmd);
Harald Welte5bc61dc2010-05-16 22:02:16 +02002508 install_element_ve(&logging_fltr_imsi_cmd);
Harald Welte1bc77352009-03-10 19:47:51 +00002509
Harald Welteb4d5b172010-05-12 16:10:35 +00002510 install_element_ve(&show_e1drv_cmd);
2511 install_element_ve(&show_e1line_cmd);
2512 install_element_ve(&show_e1ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002513
Harald Welteb4d5b172010-05-12 16:10:35 +00002514 install_element_ve(&show_paging_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002515
Harald Welte5bc61dc2010-05-16 22:02:16 +02002516 logging_vty_add_cmds();
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +01002517
Harald Welte5013b2a2009-08-07 13:29:14 +02002518 install_element(CONFIG_NODE, &cfg_net_cmd);
2519 install_node(&net_node, config_write_net);
2520 install_default(GSMNET_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002521 install_element(GSMNET_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002522 install_element(GSMNET_NODE, &ournode_end_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002523 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002524 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
2525 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
2526 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)69de3972009-08-12 14:42:23 +02002527 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte1085c092009-11-18 20:33:19 +01002528 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Welte4381cfe2009-08-30 15:47:06 +09002529 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01002530 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welteeab84a12009-12-13 10:53:12 +01002531 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte3d23db42009-12-14 17:49:15 +01002532 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Weltebc814502009-12-19 21:41:52 +01002533 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Welteb720bd32009-12-21 16:51:50 +01002534 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
2535 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
2536 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
2537 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
2538 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
2539 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01002540 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01002541 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
2542 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
2543 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
2544 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
2545 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
2546 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
2547 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
2548 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
2549 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
Harald Weltec9f499f2010-12-23 22:53:50 +01002550 install_element(GSMNET_NODE, &cfg_net_T3122_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01002551 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08002552 install_element(GSMNET_NODE, &cfg_net_dtx_cmd);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08002553 install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002554
2555 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte67ce0732009-08-06 19:06:46 +02002556 install_node(&bts_node, config_write_bts);
Harald Welte68628e82009-03-10 12:17:57 +00002557 install_default(BTS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002558 install_element(BTS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002559 install_element(BTS_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002560 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002561 install_element(BTS_NODE, &cfg_description_cmd);
2562 install_element(BTS_NODE, &cfg_no_description_cmd);
Harald Weltefcd24452009-06-20 18:15:19 +02002563 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02002564 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002565 install_element(BTS_NODE, &cfg_bts_lac_cmd);
2566 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002567 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte4cc34222009-05-01 15:12:31 +00002568 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte8175e952009-10-20 00:22:00 +02002569 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002570 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
2571 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02002572 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01002573 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
2574 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08002575 install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd);
2576 install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02002577 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08002578 install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd);
Harald Welte (local)0e451d02009-08-13 10:14:26 +02002579 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)efc92312009-08-14 23:09:25 +02002580 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welte73225282009-12-12 18:17:25 +01002581 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
2582 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002583 install_element(BTS_NODE, &cfg_bts_cell_bar_qualify_cmd);
2584 install_element(BTS_NODE, &cfg_bts_cell_resel_ofs_cmd);
2585 install_element(BTS_NODE, &cfg_bts_temp_ofs_cmd);
2586 install_element(BTS_NODE, &cfg_bts_temp_ofs_inf_cmd);
2587 install_element(BTS_NODE, &cfg_bts_penalty_time_cmd);
2588 install_element(BTS_NODE, &cfg_bts_penalty_time_rsvd_cmd);
Harald Welte4511d892010-04-18 15:51:20 +02002589 install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002590 install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002591 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
2592 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002593 install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
Harald Weltea5731cf2010-03-22 11:48:36 +08002594 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002595 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welteaf387632010-03-14 23:30:30 +08002596 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
2597 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
2598 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08002599 install_element(BTS_NODE, &cfg_bts_pag_free_cmd);
Harald Welte9fbff4a2010-07-30 11:50:09 +02002600 install_element(BTS_NODE, &cfg_bts_si_mode_cmd);
2601 install_element(BTS_NODE, &cfg_bts_si_static_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002602
Harald Welte5258fc42009-03-28 19:07:53 +00002603 install_element(BTS_NODE, &cfg_trx_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002604 install_node(&trx_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002605 install_default(TRX_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002606 install_element(TRX_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002607 install_element(TRX_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002608 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002609 install_element(TRX_NODE, &cfg_description_cmd);
2610 install_element(TRX_NODE, &cfg_no_description_cmd);
Harald Welte (local)7b37d972009-12-27 20:56:38 +01002611 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte879dc972009-06-20 22:36:12 +02002612 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002613 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
2614 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01002615 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002616
Harald Welte5258fc42009-03-28 19:07:53 +00002617 install_element(TRX_NODE, &cfg_ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002618 install_node(&ts_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002619 install_default(TS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002620 install_element(TS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002621 install_element(TS_NODE, &ournode_end_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002622 install_element(TS_NODE, &cfg_ts_pchan_cmd);
Harald Weltea39b0f22010-06-14 22:26:10 +02002623 install_element(TS_NODE, &cfg_ts_hopping_cmd);
Harald Welte6e0cd042009-09-12 13:05:33 +02002624 install_element(TS_NODE, &cfg_ts_hsn_cmd);
2625 install_element(TS_NODE, &cfg_ts_maio_cmd);
2626 install_element(TS_NODE, &cfg_ts_arfcn_add_cmd);
2627 install_element(TS_NODE, &cfg_ts_arfcn_del_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002628 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002629
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002630 install_element(ENABLE_NODE, &drop_bts_cmd);
Harald Welted0d2b0b2010-12-23 13:18:07 +01002631 install_element(ENABLE_NODE, &pdch_act_cmd);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002632
Harald Welte81c9b9c2010-05-31 16:40:40 +02002633 abis_nm_vty_init();
2634
Harald Weltedcccb182010-05-16 20:52:23 +02002635 bsc_vty_init_extra();
Harald Welte40f82892009-05-23 17:31:39 +00002636
Harald Welte68628e82009-03-10 12:17:57 +00002637 return 0;
2638}