blob: ac66bcb368511ced6508fcb91a62ba5a24e8a95a [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 Welte68628e82009-03-10 12:17:57 +000049
Harald Welte1353f962010-05-16 19:20:24 +020050#include "../bscconfig.h"
51
Harald Welteea4647d2010-05-12 17:19:53 +000052/* FIXME: this should go to some common file */
53static const struct value_string gprs_ns_timer_strs[] = {
Harald Welte615e9562010-05-11 23:50:21 +020054 { 0, "tns-block" },
55 { 1, "tns-block-retries" },
56 { 2, "tns-reset" },
57 { 3, "tns-reset-retries" },
58 { 4, "tns-test" },
59 { 5, "tns-alive" },
60 { 6, "tns-alive-retries" },
61 { 0, NULL }
62};
63
Harald Welteea4647d2010-05-12 17:19:53 +000064static const struct value_string gprs_bssgp_cfg_strs[] = {
Harald Welte615e9562010-05-11 23:50:21 +020065 { 0, "blocking-timer" },
66 { 1, "blocking-retries" },
67 { 2, "unblocking-retries" },
68 { 3, "reset-timer" },
69 { 4, "reset-retries" },
70 { 5, "suspend-timer" },
71 { 6, "suspend-retries" },
72 { 7, "resume-timer" },
73 { 8, "resume-retries" },
74 { 9, "capability-update-timer" },
75 { 10, "capability-update-retries" },
76 { 0, NULL }
77};
78
Harald Welte5013b2a2009-08-07 13:29:14 +020079struct cmd_node net_node = {
80 GSMNET_NODE,
81 "%s(network)#",
82 1,
83};
84
Harald Welte68628e82009-03-10 12:17:57 +000085struct cmd_node bts_node = {
86 BTS_NODE,
87 "%s(bts)#",
88 1,
89};
90
91struct cmd_node trx_node = {
92 TRX_NODE,
93 "%s(trx)#",
94 1,
95};
96
97struct cmd_node ts_node = {
98 TS_NODE,
99 "%s(ts)#",
100 1,
101};
102
Harald Welte39231152010-05-27 13:39:40 +0200103extern struct gsm_network *bsc_gsmnet;
104
Harald Weltedcccb182010-05-16 20:52:23 +0200105struct gsm_network *gsmnet_from_vty(struct vty *v)
106{
Harald Welte39231152010-05-27 13:39:40 +0200107 /* In case we read from the config file, the vty->priv cannot
108 * point to a struct telnet_connection, and thus conn->priv
109 * will not point to the gsm_network structure */
110#if 0
Harald Weltedcccb182010-05-16 20:52:23 +0200111 struct telnet_connection *conn = v->priv;
112 return (struct gsm_network *) conn->priv;
Harald Welte39231152010-05-27 13:39:40 +0200113#else
114 return bsc_gsmnet;
115#endif
Harald Weltedcccb182010-05-16 20:52:23 +0200116}
117
Harald Welte68628e82009-03-10 12:17:57 +0000118static int dummy_config_write(struct vty *v)
119{
120 return CMD_SUCCESS;
121}
122
123static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
124{
Harald Welte1bc77352009-03-10 19:47:51 +0000125 vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s",
126 nm_opstate_name(nms->operational), nms->administrative,
127 nm_avail_name(nms->availability), VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000128}
129
Harald Welteb908cb72009-12-22 13:09:29 +0100130static void dump_pchan_load_vty(struct vty *vty, char *prefix,
131 const struct pchan_load *pl)
132{
133 int i;
134
135 for (i = 0; i < ARRAY_SIZE(pl->pchan); i++) {
136 const struct load_counter *lc = &pl->pchan[i];
137 unsigned int percent;
138
139 if (lc->total == 0)
140 continue;
141
142 percent = (lc->used * 100) / lc->total;
143
144 vty_out(vty, "%s%20s: %3u%% (%u/%u)%s", prefix,
145 gsm_pchan_name(i), percent, lc->used, lc->total,
146 VTY_NEWLINE);
147 }
148}
149
Harald Welte68628e82009-03-10 12:17:57 +0000150static void net_dump_vty(struct vty *vty, struct gsm_network *net)
151{
Harald Welteb908cb72009-12-22 13:09:29 +0100152 struct pchan_load pl;
153
Harald Welteef235b52009-03-10 12:34:02 +0000154 vty_out(vty, "BSC is on Country Code %u, Network Code %u "
155 "and has %u BTS%s", net->country_code, net->network_code,
156 net->num_bts, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000157 vty_out(vty, " Long network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000158 net->name_long, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000159 vty_out(vty, " Short network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000160 net->name_short, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200161 vty_out(vty, " Authentication policy: %s%s",
162 gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100163 vty_out(vty, " Location updating reject cause: %u%s",
164 net->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900165 vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption,
166 VTY_NEWLINE);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +0100167 vty_out(vty, " NECI (TCH/H): %u%s", net->neci,
168 VTY_NEWLINE);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +0800169 vty_out(vty, " Use TCH for Paging any: %d%s", net->pag_any_tch,
170 VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100171 vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode),
172 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100173 vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off",
174 VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100175 vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off",
176 VTY_NEWLINE);
Harald Welteb908cb72009-12-22 13:09:29 +0100177 network_chan_load(&pl, net);
178 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
179 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000180}
181
182DEFUN(show_net, show_net_cmd, "show network",
183 SHOW_STR "Display information about a GSM NETWORK\n")
184{
Harald Weltedcccb182010-05-16 20:52:23 +0200185 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000186 net_dump_vty(vty, net);
187
188 return CMD_SUCCESS;
189}
190
191static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l)
192{
Harald Welteedb37782009-05-01 14:59:07 +0000193 struct e1inp_line *line;
194
195 if (!e1l) {
196 vty_out(vty, " None%s", VTY_NEWLINE);
197 return;
198 }
199
200 line = e1l->ts->line;
201
202 vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s",
203 line->num, line->driver->name, e1l->ts->num,
Harald Welte1bc77352009-03-10 19:47:51 +0000204 e1inp_signtype_name(e1l->type), VTY_NEWLINE);
Harald Welteedb37782009-05-01 14:59:07 +0000205 vty_out(vty, " E1 TEI %u, SAPI %u%s",
Harald Welte68628e82009-03-10 12:17:57 +0000206 e1l->tei, e1l->sapi, VTY_NEWLINE);
207}
208
209static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
210{
Harald Welteb908cb72009-12-22 13:09:29 +0100211 struct pchan_load pl;
212
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200213 vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
Harald Weltefcd24452009-06-20 18:15:19 +0200214 "BSIC %u, TSC %u and %u TRX%s",
215 bts->nr, btstype2str(bts->type), gsm_band_name(bts->band),
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200216 bts->cell_identity,
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +0200217 bts->location_area_code, bts->bsic, bts->tsc,
Harald Weltefcd24452009-06-20 18:15:19 +0200218 bts->num_trx, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200219 vty_out(vty, "Description: %s%s",
220 bts->description ? bts->description : "(null)", VTY_NEWLINE);
Harald Welte1d8dbc42009-12-12 15:38:16 +0100221 vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100222 vty_out(vty, "Minimum Rx Level for Access: %i dBm%s",
Harald Welte1d8dbc42009-12-12 15:38:16 +0100223 rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min),
224 VTY_NEWLINE);
225 vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s",
Harald Welte73225282009-12-12 18:17:25 +0100226 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100227 vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer,
228 VTY_NEWLINE);
229 vty_out(vty, "RACH Max transmissions: %u%s",
230 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
231 VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100232 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200233 vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE);
Harald Welte9fbff4a2010-07-30 11:50:09 +0200234 vty_out(vty, "System Information present: 0x%08x, static: 0x%08x%s",
235 bts->si_valid, bts->si_mode_static, VTY_NEWLINE);
Harald Welte4cc34222009-05-01 15:12:31 +0000236 if (is_ipaccess_bts(bts))
Harald Welte8175e952009-10-20 00:22:00 +0200237 vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
Harald Welte4cc34222009-05-01 15:12:31 +0000238 bts->ip_access.site_id, bts->ip_access.bts_id,
Harald Welte8175e952009-10-20 00:22:00 +0200239 bts->oml_tei, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000240 vty_out(vty, " NM State: ");
241 net_dump_nmstate(vty, &bts->nm_state);
242 vty_out(vty, " Site Mgr NM State: ");
243 net_dump_nmstate(vty, &bts->site_mgr.nm_state);
244 vty_out(vty, " Paging: FIXME pending requests, %u free slots%s",
245 bts->paging.available_slots, VTY_NEWLINE);
Holger Hans Peter Freytherd283db42010-11-25 16:28:45 +0100246 if (is_ipaccess_bts(bts)) {
247 vty_out(vty, " OML Link state: %s.%s",
248 bts->oml_link ? "connected" : "disconnected", VTY_NEWLINE);
249 } else {
Harald Welte8175e952009-10-20 00:22:00 +0200250 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
251 e1isl_dump_vty(vty, bts->oml_link);
252 }
Holger Hans Peter Freytherd283db42010-11-25 16:28:45 +0100253
254 /* FIXME: chan_desc */
Harald Welteb908cb72009-12-22 13:09:29 +0100255 memset(&pl, 0, sizeof(pl));
256 bts_chan_load(&pl, bts);
257 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
258 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000259}
260
261DEFUN(show_bts, show_bts_cmd, "show bts [number]",
262 SHOW_STR "Display information about a BTS\n"
263 "BTS number")
264{
Harald Weltedcccb182010-05-16 20:52:23 +0200265 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000266 int bts_nr;
267
268 if (argc != 0) {
269 /* use the BTS number that the user has specified */
270 bts_nr = atoi(argv[0]);
271 if (bts_nr > net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000272 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000273 VTY_NEWLINE);
274 return CMD_WARNING;
275 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200276 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000277 return CMD_SUCCESS;
278 }
279 /* print all BTS's */
280 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee441d9c2009-06-21 16:17:15 +0200281 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000282
283 return CMD_SUCCESS;
284}
285
Harald Welte42581822009-08-08 16:12:58 +0200286/* utility functions */
287static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
288 const char *ts, const char *ss)
289{
290 e1_link->e1_nr = atoi(line);
291 e1_link->e1_ts = atoi(ts);
292 if (!strcmp(ss, "full"))
293 e1_link->e1_ts_ss = 255;
294 else
295 e1_link->e1_ts_ss = atoi(ss);
296}
297
298static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,
299 const char *prefix)
300{
301 if (!e1_link->e1_ts)
302 return;
303
304 if (e1_link->e1_ts_ss == 255)
305 vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s",
306 prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE);
307 else
308 vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s",
309 prefix, e1_link->e1_nr, e1_link->e1_ts,
310 e1_link->e1_ts_ss, VTY_NEWLINE);
311}
312
313
Harald Welte67ce0732009-08-06 19:06:46 +0200314static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
315{
Harald Welte42581822009-08-08 16:12:58 +0200316 vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
317 if (ts->pchan != GSM_PCHAN_NONE)
318 vty_out(vty, " phys_chan_config %s%s",
319 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200320 vty_out(vty, " hopping enabled %u%s",
321 ts->hopping.enabled, VTY_NEWLINE);
322 if (ts->hopping.enabled) {
323 unsigned int i;
324 vty_out(vty, " hopping sequence-number %u%s",
Harald Welte6e0cd042009-09-12 13:05:33 +0200325 ts->hopping.hsn, VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200326 vty_out(vty, " hopping maio %u%s",
Harald Welte6e0cd042009-09-12 13:05:33 +0200327 ts->hopping.maio, VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200328 for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) {
329 if (!bitvec_get_bit_pos(&ts->hopping.arfcns, i))
330 continue;
331 vty_out(vty, " hopping arfcn add %u%s",
332 i, VTY_NEWLINE);
333 }
334 } else
Harald Welte42581822009-08-08 16:12:58 +0200335 config_write_e1_link(vty, &ts->e1_link, " ");
Harald Welte67ce0732009-08-06 19:06:46 +0200336}
337
338static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
339{
340 int i;
341
Harald Welte5013b2a2009-08-07 13:29:14 +0200342 vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200343 if (trx->description)
344 vty_out(vty, " description %s%s", trx->description,
345 VTY_NEWLINE);
Holger Hans Peter Freyther2ba40af2010-04-17 06:42:07 +0200346 vty_out(vty, " rf_locked %u%s",
347 trx->nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
348 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200349 vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
Harald Welte (local)7b37d972009-12-27 20:56:38 +0100350 vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200351 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200352 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
353 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte67ce0732009-08-06 19:06:46 +0200354
355 for (i = 0; i < TRX_NR_TS; i++)
356 config_write_ts_single(vty, &trx->ts[i]);
357}
358
Harald Welte615e9562010-05-11 23:50:21 +0200359static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
360{
361 unsigned int i;
362 vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode),
363 VTY_NEWLINE);
364 if (bts->gprs.mode == BTS_GPRS_NONE)
365 return;
366
367 vty_out(vty, " gprs routing area %u%s", bts->gprs.rac,
368 VTY_NEWLINE);
369 vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
370 VTY_NEWLINE);
371 for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++)
372 vty_out(vty, " gprs cell timer %s %u%s",
373 get_value_string(gprs_bssgp_cfg_strs, i),
374 bts->gprs.cell.timer[i], VTY_NEWLINE);
375 vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei,
376 VTY_NEWLINE);
377 for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++)
378 vty_out(vty, " gprs ns timer %s %u%s",
379 get_value_string(gprs_ns_timer_strs, i),
380 bts->gprs.nse.timer[i], VTY_NEWLINE);
381 for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
382 struct gsm_bts_gprs_nsvc *nsvc =
383 &bts->gprs.nsvc[i];
384 struct in_addr ia;
385
386 ia.s_addr = htonl(nsvc->remote_ip);
387 vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
388 nsvc->nsvci, VTY_NEWLINE);
389 vty_out(vty, " gprs nsvc %u local udp port %u%s", i,
390 nsvc->local_port, VTY_NEWLINE);
391 vty_out(vty, " gprs nsvc %u remote udp port %u%s", i,
392 nsvc->remote_port, VTY_NEWLINE);
393 vty_out(vty, " gprs nsvc %u remote ip %s%s", i,
394 inet_ntoa(ia), VTY_NEWLINE);
395 }
396}
397
Harald Welte67ce0732009-08-06 19:06:46 +0200398static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
399{
400 struct gsm_bts_trx *trx;
Harald Welte9fbff4a2010-07-30 11:50:09 +0200401 int i;
Harald Welte67ce0732009-08-06 19:06:46 +0200402
Harald Welte5013b2a2009-08-07 13:29:14 +0200403 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
404 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200405 if (bts->description)
406 vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200407 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freytherf926ed62009-11-19 16:38:49 +0100408 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200409 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte67ce0732009-08-06 19:06:46 +0200410 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200411 vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE);
412 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)0e451d02009-08-13 10:14:26 +0200413 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100414 vty_out(vty, " cell reselection hysteresis %u%s",
415 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
416 vty_out(vty, " rxlev access min %u%s",
417 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Harald Weltea43f7892009-12-01 18:04:30 +0530418 if (bts->si_common.chan_desc.t3212)
Harald Welte (local)efc92312009-08-14 23:09:25 +0200419 vty_out(vty, " periodic location update %u%s",
Dieter Spaard6613e02010-10-05 21:10:55 +0200420 bts->si_common.chan_desc.t3212 * 6, VTY_NEWLINE);
Harald Welte7a8fa412009-08-10 13:48:16 +0200421 vty_out(vty, " channel allocator %s%s",
422 bts->chan_alloc_reverse ? "descending" : "ascending",
423 VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100424 vty_out(vty, " rach tx integer %u%s",
425 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
426 vty_out(vty, " rach max transmission %u%s",
427 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
428 VTY_NEWLINE);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +0800429
430 if (bts->rach_b_thresh != -1)
431 vty_out(vty, " rach nm busy threshold %u%s",
432 bts->rach_b_thresh, VTY_NEWLINE);
433 if (bts->rach_ldavg_slots != -1)
434 vty_out(vty, " rach nm load average %u%s",
435 bts->rach_ldavg_slots, VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100436 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200437 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +0800438 if ((bts->si_common.rach_control.t2 & 0x4) == 0)
439 vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE);
Harald Welte9fbff4a2010-07-30 11:50:09 +0200440 for (i = SYSINFO_TYPE_1; i < _MAX_SYSINFO_TYPE; i++) {
441 if (bts->si_mode_static & (1 << i)) {
442 vty_out(vty, " system-information %s mode static%s",
443 get_value_string(osmo_sitype_strs, i), VTY_NEWLINE);
444 vty_out(vty, " system-information %s static %s%s",
445 get_value_string(osmo_sitype_strs, i),
446 hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])),
447 VTY_NEWLINE);
448 }
449 }
Harald Welte8175e952009-10-20 00:22:00 +0200450 if (is_ipaccess_bts(bts)) {
Harald Welte5013b2a2009-08-07 13:29:14 +0200451 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Weltea6fd58e2009-08-07 00:25:23 +0200452 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200453 vty_out(vty, " oml ip.access stream_id %u%s", bts->oml_tei, VTY_NEWLINE);
454 } else {
Harald Welte42581822009-08-08 16:12:58 +0200455 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
456 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
457 }
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +0800458
459 /* if we have a limit, write it */
460 if (bts->paging.free_chans_need >= 0)
461 vty_out(vty, " paging free %d%s", bts->paging.free_chans_need, VTY_NEWLINE);
462
Harald Welte615e9562010-05-11 23:50:21 +0200463 config_write_bts_gprs(vty, bts);
Harald Welte67ce0732009-08-06 19:06:46 +0200464
465 llist_for_each_entry(trx, &bts->trx_list, list)
466 config_write_trx_single(vty, trx);
467}
468
469static int config_write_bts(struct vty *v)
470{
Harald Weltedcccb182010-05-16 20:52:23 +0200471 struct gsm_network *gsmnet = gsmnet_from_vty(v);
Harald Welte67ce0732009-08-06 19:06:46 +0200472 struct gsm_bts *bts;
473
474 llist_for_each_entry(bts, &gsmnet->bts_list, list)
475 config_write_bts_single(v, bts);
476
477 return CMD_SUCCESS;
478}
479
Harald Welte5013b2a2009-08-07 13:29:14 +0200480static int config_write_net(struct vty *vty)
481{
Harald Weltedcccb182010-05-16 20:52:23 +0200482 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
483
Harald Welte5013b2a2009-08-07 13:29:14 +0200484 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200485 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200486 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200487 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
488 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200489 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100490 vty_out(vty, " location updating reject cause %u%s",
491 gsmnet->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900492 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freytherd54c3372009-11-19 16:37:48 +0100493 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +0800494 vty_out(vty, " paging any use tch %d%s", gsmnet->pag_any_tch, VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100495 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
496 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100497 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100498 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Welteb720bd32009-12-21 16:51:50 +0100499 vty_out(vty, " handover window rxlev averaging %u%s",
500 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
501 vty_out(vty, " handover window rxqual averaging %u%s",
502 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
503 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
504 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
505 vty_out(vty, " handover power budget interval %u%s",
506 gsmnet->handover.pwr_interval, VTY_NEWLINE);
507 vty_out(vty, " handover power budget hysteresis %u%s",
508 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
509 vty_out(vty, " handover maximum distance %u%s",
510 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +0100511 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100512 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
513 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
514 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
515 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
516 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
517 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
518 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
519 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
520 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
521 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +0800522 vty_out(vty, " use-dtx %u%s", gsmnet->dtx_enabled, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200523
524 return CMD_SUCCESS;
525}
Harald Welte67ce0732009-08-06 19:06:46 +0200526
Harald Welte68628e82009-03-10 12:17:57 +0000527static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
528{
529 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
530 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200531 vty_out(vty, "Description: %s%s",
532 trx->description ? trx->description : "(null)", VTY_NEWLINE);
Harald Weltefcd24452009-06-20 18:15:19 +0200533 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte42581822009-08-08 16:12:58 +0200534 "resulting BS power: %d dBm%s",
Harald Weltefcd24452009-06-20 18:15:19 +0200535 trx->nominal_power, trx->max_power_red,
Harald Welte42581822009-08-08 16:12:58 +0200536 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000537 vty_out(vty, " NM State: ");
538 net_dump_nmstate(vty, &trx->nm_state);
539 vty_out(vty, " Baseband Transceiver NM State: ");
540 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte8175e952009-10-20 00:22:00 +0200541 if (is_ipaccess_bts(trx->bts)) {
542 vty_out(vty, " ip.access stream ID: 0x%02x%s",
543 trx->rsl_tei, VTY_NEWLINE);
544 } else {
545 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
546 e1isl_dump_vty(vty, trx->rsl_link);
547 }
Harald Welte68628e82009-03-10 12:17:57 +0000548}
549
550DEFUN(show_trx,
551 show_trx_cmd,
552 "show trx [bts_nr] [trx_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200553 SHOW_STR "Display information about a TRX\n"
554 "BTS Number\n"
555 "TRX Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000556{
Harald Weltedcccb182010-05-16 20:52:23 +0200557 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000558 struct gsm_bts *bts = NULL;
559 struct gsm_bts_trx *trx;
560 int bts_nr, trx_nr;
561
562 if (argc >= 1) {
563 /* use the BTS number that the user has specified */
564 bts_nr = atoi(argv[0]);
565 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000566 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000567 VTY_NEWLINE);
568 return CMD_WARNING;
569 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200570 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000571 }
572 if (argc >= 2) {
573 trx_nr = atoi(argv[1]);
574 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000575 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000576 VTY_NEWLINE);
577 return CMD_WARNING;
578 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200579 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000580 trx_dump_vty(vty, trx);
581 return CMD_SUCCESS;
582 }
583 if (bts) {
584 /* print all TRX in this BTS */
585 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200586 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000587 trx_dump_vty(vty, trx);
588 }
589 return CMD_SUCCESS;
590 }
591
592 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200593 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000594 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200595 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000596 trx_dump_vty(vty, trx);
597 }
598 }
599
600 return CMD_SUCCESS;
601}
602
Harald Welte67ce0732009-08-06 19:06:46 +0200603
Harald Welte68628e82009-03-10 12:17:57 +0000604static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
605{
Harald Welte68628e82009-03-10 12:17:57 +0000606 vty_out(vty, "Timeslot %u of TRX %u in BTS %u, phys cfg %s%s",
607 ts->nr, ts->trx->nr, ts->trx->bts->nr,
608 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
609 vty_out(vty, " NM State: ");
610 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte2c828992009-12-02 01:56:49 +0530611 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welteef235b52009-03-10 12:34:02 +0000612 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
613 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
614 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000615}
616
617DEFUN(show_ts,
618 show_ts_cmd,
Harald Welte1bc77352009-03-10 19:47:51 +0000619 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200620 SHOW_STR "Display information about a TS\n"
621 "BTS Number\n" "TRX Number\n" "Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000622{
Harald Weltedcccb182010-05-16 20:52:23 +0200623 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000624 struct gsm_bts *bts;
625 struct gsm_bts_trx *trx;
626 struct gsm_bts_trx_ts *ts;
627 int bts_nr, trx_nr, ts_nr;
628
629 if (argc >= 1) {
630 /* use the BTS number that the user has specified */
631 bts_nr = atoi(argv[0]);
632 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000633 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000634 VTY_NEWLINE);
635 return CMD_WARNING;
636 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200637 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000638 }
639 if (argc >= 2) {
640 trx_nr = atoi(argv[1]);
641 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000642 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000643 VTY_NEWLINE);
644 return CMD_WARNING;
645 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200646 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000647 }
648 if (argc >= 3) {
649 ts_nr = atoi(argv[2]);
650 if (ts_nr >= TRX_NR_TS) {
Harald Welte1bc77352009-03-10 19:47:51 +0000651 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
Harald Welte68628e82009-03-10 12:17:57 +0000652 VTY_NEWLINE);
653 return CMD_WARNING;
654 }
655 ts = &trx->ts[ts_nr];
656 ts_dump_vty(vty, ts);
657 return CMD_SUCCESS;
658 }
659 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200660 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000661 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200662 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000663 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
664 ts = &trx->ts[ts_nr];
665 ts_dump_vty(vty, ts);
666 }
667 }
668 }
669
670 return CMD_SUCCESS;
671}
672
Holger Hans Peter Freyther424c4f02010-01-06 06:00:40 +0100673static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte68628e82009-03-10 12:17:57 +0000674{
Harald Weltefcd24452009-06-20 18:15:19 +0200675 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte40f82892009-05-23 17:31:39 +0000676 subscr->authorized, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000677 if (subscr->name)
Harald Welte1bc77352009-03-10 19:47:51 +0000678 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000679 if (subscr->extension)
680 vty_out(vty, " Extension: %s%s", subscr->extension,
681 VTY_NEWLINE);
682 if (subscr->imsi)
683 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freyther22230252009-08-19 12:53:57 +0200684 if (subscr->tmsi != GSM_RESERVED_TMSI)
685 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte731fd912009-08-15 03:24:51 +0200686 VTY_NEWLINE);
Sylvain Munautaf292642009-12-27 19:29:28 +0100687
Harald Welte (local)15920de2009-08-14 20:27:16 +0200688 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000689}
690
Harald Welte8387a492009-12-22 21:43:14 +0100691static void meas_rep_dump_uni_vty(struct vty *vty,
692 struct gsm_meas_rep_unidir *mru,
693 const char *prefix,
694 const char *dir)
695{
696 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
697 prefix, dir, rxlev2dbm(mru->full.rx_lev),
698 dir, rxlev2dbm(mru->sub.rx_lev));
699 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
700 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
701 VTY_NEWLINE);
702}
703
704static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
705 const char *prefix)
706{
707 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
708 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
709 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
710 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
711 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
712 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
713 VTY_NEWLINE);
714 if (mr->flags & MEAS_REP_F_MS_TO)
715 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
716 mr->ms_timing_offset, VTY_NEWLINE);
717 if (mr->flags & MEAS_REP_F_MS_L1)
718 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
719 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
720 if (mr->flags & MEAS_REP_F_DL_VALID)
721 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
722 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
723}
724
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800725static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
Harald Welte68628e82009-03-10 12:17:57 +0000726{
Harald Welte8387a492009-12-22 21:43:14 +0100727 int idx;
728
Harald Welte68628e82009-03-10 12:17:57 +0000729 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 +0200730 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
Harald Welte (local)ccd88452009-12-27 18:05:25 +0100731 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Harald Welte68628e82009-03-10 12:17:57 +0000732 VTY_NEWLINE);
Holger Hans Peter Freyther40494552010-06-28 17:09:29 +0800733 vty_out(vty, " Connection: %u, State: %s%s",
734 lchan->conn ? 1: 0,
Harald Welte1887f9d2009-12-29 10:52:38 +0100735 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100736 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
737 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
738 - lchan->bs_power*2,
739 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
740 VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800741 if (lchan->conn && lchan->conn->subscr) {
Harald Welte68628e82009-03-10 12:17:57 +0000742 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800743 subscr_dump_vty(vty, lchan->conn->subscr);
Harald Welte68628e82009-03-10 12:17:57 +0000744 } else
745 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte2c828992009-12-02 01:56:49 +0530746 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
747 struct in_addr ia;
Holger Hans Peter Freyther54fa7992010-04-07 15:39:16 +0200748 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte2c828992009-12-02 01:56:49 +0530749 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
750 inet_ntoa(ia), lchan->abis_ip.bound_port,
751 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
752 VTY_NEWLINE);
753 }
Harald Welte8387a492009-12-22 21:43:14 +0100754
755 /* we want to report the last measurement report */
756 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
757 lchan->meas_rep_idx, 1);
758 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte68628e82009-03-10 12:17:57 +0000759}
760
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800761static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
762{
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800763 struct gsm_meas_rep *mr;
764 int idx;
765
766 /* we want to report the last measurement report */
767 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
768 lchan->meas_rep_idx, 1);
769 mr = &lchan->meas_rep[idx];
770
771 vty_out(vty, "Lchan: %u Timeslot: %u TRX: %u BTS: %u Type: %s - L1 MS Power: %u dBm "
772 "RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800773 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
774 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800775 mr->ms_l1.pwr,
776 rxlev2dbm(mr->dl.full.rx_lev),
777 rxlev2dbm(mr->ul.full.rx_lev),
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800778 VTY_NEWLINE);
779}
780
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800781static int lchan_summary(struct vty *vty, int argc, const char **argv,
782 void (*dump_cb)(struct vty *, struct gsm_lchan *))
Harald Welte68628e82009-03-10 12:17:57 +0000783{
Harald Weltedcccb182010-05-16 20:52:23 +0200784 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000785 struct gsm_bts *bts;
786 struct gsm_bts_trx *trx;
787 struct gsm_bts_trx_ts *ts;
788 struct gsm_lchan *lchan;
789 int bts_nr, trx_nr, ts_nr, lchan_nr;
790
791 if (argc >= 1) {
792 /* use the BTS number that the user has specified */
793 bts_nr = atoi(argv[0]);
794 if (bts_nr >= net->num_bts) {
795 vty_out(vty, "%% can't find BTS %s%s", argv[0],
796 VTY_NEWLINE);
797 return CMD_WARNING;
798 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200799 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000800 }
801 if (argc >= 2) {
802 trx_nr = atoi(argv[1]);
803 if (trx_nr >= bts->num_trx) {
804 vty_out(vty, "%% can't find TRX %s%s", argv[1],
805 VTY_NEWLINE);
806 return CMD_WARNING;
807 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200808 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000809 }
810 if (argc >= 3) {
811 ts_nr = atoi(argv[2]);
812 if (ts_nr >= TRX_NR_TS) {
813 vty_out(vty, "%% can't find TS %s%s", argv[2],
814 VTY_NEWLINE);
815 return CMD_WARNING;
816 }
817 ts = &trx->ts[ts_nr];
818 }
819 if (argc >= 4) {
820 lchan_nr = atoi(argv[3]);
821 if (lchan_nr >= TS_MAX_LCHAN) {
822 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
823 VTY_NEWLINE);
824 return CMD_WARNING;
825 }
826 lchan = &ts->lchan[lchan_nr];
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800827 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000828 return CMD_SUCCESS;
829 }
830 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200831 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000832 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200833 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000834 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
835 ts = &trx->ts[ts_nr];
836 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
837 lchan_nr++) {
838 lchan = &ts->lchan[lchan_nr];
Harald Welteef235b52009-03-10 12:34:02 +0000839 if (lchan->type == GSM_LCHAN_NONE)
840 continue;
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800841 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000842 }
843 }
844 }
845 }
846
847 return CMD_SUCCESS;
848}
849
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800850
851DEFUN(show_lchan,
852 show_lchan_cmd,
853 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
854 SHOW_STR "Display information about a logical channel\n"
855 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
856 "Logical Channel Number\n")
857
858{
859 return lchan_summary(vty, argc, argv, lchan_dump_full_vty);
860}
861
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800862DEFUN(show_lchan_summary,
863 show_lchan_summary_cmd,
864 "show lchan summary [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
865 SHOW_STR "Display information about a logical channel\n"
866 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
867 "Logical Channel Number\n")
868{
869 return lchan_summary(vty, argc, argv, lchan_dump_short_vty);
870}
871
Harald Welte1bc77352009-03-10 19:47:51 +0000872static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
873{
874 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
875}
876
877DEFUN(show_e1drv,
878 show_e1drv_cmd,
879 "show e1_driver",
880 SHOW_STR "Display information about available E1 drivers\n")
881{
882 struct e1inp_driver *drv;
883
884 llist_for_each_entry(drv, &e1inp_driver_list, list)
885 e1drv_dump_vty(vty, drv);
886
887 return CMD_SUCCESS;
888}
889
Harald Welte68628e82009-03-10 12:17:57 +0000890static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
891{
892 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
893 line->num, line->name ? line->name : "",
894 line->driver->name, VTY_NEWLINE);
895}
896
897DEFUN(show_e1line,
898 show_e1line_cmd,
899 "show e1_line [line_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200900 SHOW_STR "Display information about a E1 line\n"
901 "E1 Line Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000902{
Harald Welte1bc77352009-03-10 19:47:51 +0000903 struct e1inp_line *line;
904
905 if (argc >= 1) {
906 int num = atoi(argv[0]);
907 llist_for_each_entry(line, &e1inp_line_list, list) {
908 if (line->num == num) {
909 e1line_dump_vty(vty, line);
910 return CMD_SUCCESS;
911 }
912 }
913 return CMD_WARNING;
914 }
915
916 llist_for_each_entry(line, &e1inp_line_list, list)
917 e1line_dump_vty(vty, line);
918
919 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000920}
921
922static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
923{
Harald Welte42581822009-08-08 16:12:58 +0200924 if (ts->type == E1INP_TS_TYPE_NONE)
925 return;
Harald Welte1bc77352009-03-10 19:47:51 +0000926 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
927 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
928 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000929}
930
931DEFUN(show_e1ts,
932 show_e1ts_cmd,
933 "show e1_timeslot [line_nr] [ts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200934 SHOW_STR "Display information about a E1 timeslot\n"
935 "E1 Line Number\n" "E1 Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000936{
Harald Welte986c3d72009-11-17 06:12:16 +0100937 struct e1inp_line *line = NULL;
Harald Welte1bc77352009-03-10 19:47:51 +0000938 struct e1inp_ts *ts;
939 int ts_nr;
Harald Welte68628e82009-03-10 12:17:57 +0000940
Harald Welte1bc77352009-03-10 19:47:51 +0000941 if (argc == 0) {
942 llist_for_each_entry(line, &e1inp_line_list, list) {
943 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
944 ts = &line->ts[ts_nr];
945 e1ts_dump_vty(vty, ts);
946 }
947 }
948 return CMD_SUCCESS;
949 }
950 if (argc >= 1) {
951 int num = atoi(argv[0]);
952 llist_for_each_entry(line, &e1inp_line_list, list) {
953 if (line->num == num)
954 break;
955 }
956 if (!line || line->num != num) {
957 vty_out(vty, "E1 line %s is invalid%s",
958 argv[0], VTY_NEWLINE);
959 return CMD_WARNING;
960 }
961 }
962 if (argc >= 2) {
963 ts_nr = atoi(argv[1]);
964 if (ts_nr > NUM_E1_TS) {
965 vty_out(vty, "E1 timeslot %s is invalid%s",
966 argv[1], VTY_NEWLINE);
967 return CMD_WARNING;
968 }
969 ts = &line->ts[ts_nr];
970 e1ts_dump_vty(vty, ts);
971 return CMD_SUCCESS;
972 } else {
973 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
974 ts = &line->ts[ts_nr];
975 e1ts_dump_vty(vty, ts);
976 }
977 return CMD_SUCCESS;
978 }
979 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000980}
981
Harald Weltebe4b7302009-05-23 16:59:33 +0000982static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
Harald Weltef5025b62009-03-28 16:55:11 +0000983{
984 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
985 subscr_dump_vty(vty, pag->subscr);
986}
987
Harald Weltebe4b7302009-05-23 16:59:33 +0000988static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
Harald Weltef5025b62009-03-28 16:55:11 +0000989{
990 struct gsm_paging_request *pag;
991
992 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
993 paging_dump_vty(vty, pag);
994}
995
996DEFUN(show_paging,
997 show_paging_cmd,
998 "show paging [bts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200999 SHOW_STR "Display information about paging reuqests of a BTS\n"
1000 "BTS Number\n")
Harald Weltef5025b62009-03-28 16:55:11 +00001001{
Harald Weltedcccb182010-05-16 20:52:23 +02001002 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Weltef5025b62009-03-28 16:55:11 +00001003 struct gsm_bts *bts;
1004 int bts_nr;
1005
1006 if (argc >= 1) {
1007 /* use the BTS number that the user has specified */
1008 bts_nr = atoi(argv[0]);
1009 if (bts_nr >= net->num_bts) {
1010 vty_out(vty, "%% can't find BTS %s%s", argv[0],
1011 VTY_NEWLINE);
1012 return CMD_WARNING;
1013 }
Harald Weltee441d9c2009-06-21 16:17:15 +02001014 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001015 bts_paging_dump_vty(vty, bts);
1016
1017 return CMD_SUCCESS;
1018 }
1019 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +02001020 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001021 bts_paging_dump_vty(vty, bts);
1022 }
1023
1024 return CMD_SUCCESS;
1025}
1026
Harald Welte8f0ed552010-05-11 21:53:49 +02001027#define NETWORK_STR "Configure the GSM network\n"
1028
Harald Welte5013b2a2009-08-07 13:29:14 +02001029DEFUN(cfg_net,
1030 cfg_net_cmd,
Harald Welte8f0ed552010-05-11 21:53:49 +02001031 "network", NETWORK_STR)
Harald Welte5013b2a2009-08-07 13:29:14 +02001032{
Harald Weltedcccb182010-05-16 20:52:23 +02001033 vty->index = gsmnet_from_vty(vty);
Harald Welte5013b2a2009-08-07 13:29:14 +02001034 vty->node = GSMNET_NODE;
1035
1036 return CMD_SUCCESS;
1037}
1038
1039
1040DEFUN(cfg_net_ncc,
1041 cfg_net_ncc_cmd,
1042 "network country code <1-999>",
1043 "Set the GSM network country code")
1044{
Harald Weltedcccb182010-05-16 20:52:23 +02001045 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1046
Harald Welte5013b2a2009-08-07 13:29:14 +02001047 gsmnet->country_code = atoi(argv[0]);
1048
1049 return CMD_SUCCESS;
1050}
1051
1052DEFUN(cfg_net_mnc,
1053 cfg_net_mnc_cmd,
1054 "mobile network code <1-999>",
1055 "Set the GSM mobile network code")
1056{
Harald Weltedcccb182010-05-16 20:52:23 +02001057 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1058
Harald Welte5013b2a2009-08-07 13:29:14 +02001059 gsmnet->network_code = atoi(argv[0]);
1060
1061 return CMD_SUCCESS;
1062}
1063
1064DEFUN(cfg_net_name_short,
1065 cfg_net_name_short_cmd,
1066 "short name NAME",
1067 "Set the short GSM network name")
1068{
Harald Weltedcccb182010-05-16 20:52:23 +02001069 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1070
Holger Hans Peter Freyther3e9a7f82010-10-12 23:21:54 +02001071 bsc_replace_string(gsmnet, &gsmnet->name_short, argv[0]);
Harald Welte5013b2a2009-08-07 13:29:14 +02001072 return CMD_SUCCESS;
1073}
1074
1075DEFUN(cfg_net_name_long,
1076 cfg_net_name_long_cmd,
1077 "long name NAME",
1078 "Set the long GSM network name")
1079{
Harald Weltedcccb182010-05-16 20:52:23 +02001080 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1081
Holger Hans Peter Freyther3e9a7f82010-10-12 23:21:54 +02001082 bsc_replace_string(gsmnet, &gsmnet->name_long, argv[0]);
Harald Welte5013b2a2009-08-07 13:29:14 +02001083 return CMD_SUCCESS;
1084}
Harald Welte40f82892009-05-23 17:31:39 +00001085
Harald Welte (local)69de3972009-08-12 14:42:23 +02001086DEFUN(cfg_net_auth_policy,
1087 cfg_net_auth_policy_cmd,
1088 "auth policy (closed|accept-all|token)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001089 "Authentication (not cryptographic)\n"
1090 "Set the GSM network authentication policy\n"
1091 "Require the MS to be activated in HLR\n"
1092 "Accept all MS, whether in HLR or not\n"
1093 "Use SMS-token based authentication\n")
Harald Welte (local)69de3972009-08-12 14:42:23 +02001094{
1095 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001096 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte (local)69de3972009-08-12 14:42:23 +02001097
1098 gsmnet->auth_policy = policy;
1099
1100 return CMD_SUCCESS;
1101}
1102
Harald Welte1085c092009-11-18 20:33:19 +01001103DEFUN(cfg_net_reject_cause,
1104 cfg_net_reject_cause_cmd,
1105 "location updating reject cause <2-111>",
1106 "Set the reject cause of location updating reject\n")
1107{
Harald Weltedcccb182010-05-16 20:52:23 +02001108 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1109
Harald Welte1085c092009-11-18 20:33:19 +01001110 gsmnet->reject_cause = atoi(argv[0]);
1111
1112 return CMD_SUCCESS;
1113}
1114
Harald Welte4381cfe2009-08-30 15:47:06 +09001115DEFUN(cfg_net_encryption,
1116 cfg_net_encryption_cmd,
1117 "encryption a5 (0|1|2)",
Harald Welte28326062010-05-14 20:05:17 +02001118 "Encryption options\n"
1119 "A5 encryption\n" "A5/0: No encryption\n"
1120 "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n")
Harald Welte4381cfe2009-08-30 15:47:06 +09001121{
Harald Weltedcccb182010-05-16 20:52:23 +02001122 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1123
Andreas.Eversberg1059deb2009-11-17 09:55:26 +01001124 gsmnet->a5_encryption= atoi(argv[0]);
Harald Welte4381cfe2009-08-30 15:47:06 +09001125
1126 return CMD_SUCCESS;
1127}
1128
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001129DEFUN(cfg_net_neci,
1130 cfg_net_neci_cmd,
1131 "neci (0|1)",
Harald Welte28326062010-05-14 20:05:17 +02001132 "New Establish Cause Indication\n"
1133 "Don't set the NECI bit\n" "Set the NECI bit\n")
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001134{
Harald Weltedcccb182010-05-16 20:52:23 +02001135 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1136
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001137 gsmnet->neci = atoi(argv[0]);
Holger Hans Peter Freyther78891072010-09-06 09:36:02 +08001138 gsm_net_update_ctype(gsmnet);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001139 return CMD_SUCCESS;
1140}
1141
Harald Welteeab84a12009-12-13 10:53:12 +01001142DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1143 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001144 "Radio Resource Location Protocol\n"
1145 "Set the Radio Resource Location Protocol Mode\n"
1146 "Don't send RRLP request\n"
1147 "Request MS-based location\n"
1148 "Request any location, prefer MS-based\n"
1149 "Request any location, prefer MS-assisted\n")
Harald Welteeab84a12009-12-13 10:53:12 +01001150{
Harald Weltedcccb182010-05-16 20:52:23 +02001151 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1152
Harald Welteeab84a12009-12-13 10:53:12 +01001153 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1154
1155 return CMD_SUCCESS;
1156}
1157
Harald Welte648b6ce2009-12-14 09:00:24 +01001158DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1159 "mm info (0|1)",
1160 "Whether to send MM INFO after LOC UPD ACCEPT")
1161{
Harald Weltedcccb182010-05-16 20:52:23 +02001162 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1163
Harald Welte648b6ce2009-12-14 09:00:24 +01001164 gsmnet->send_mm_info = atoi(argv[0]);
1165
1166 return CMD_SUCCESS;
1167}
1168
Harald Welte8f0ed552010-05-11 21:53:49 +02001169#define HANDOVER_STR "Handover Options\n"
1170
Harald Weltebc814502009-12-19 21:41:52 +01001171DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1172 "handover (0|1)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001173 HANDOVER_STR
1174 "Don't perform in-call handover\n"
1175 "Perform in-call handover\n")
Harald Weltebc814502009-12-19 21:41:52 +01001176{
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001177 int enable = atoi(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001178 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001179
1180 if (enable && ipacc_rtp_direct) {
Harald Weltefe03f0d2009-12-20 13:51:01 +01001181 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1182 "is enabled by using the -P command line option%s",
1183 VTY_NEWLINE);
1184 return CMD_WARNING;
1185 }
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001186 gsmnet->handover.active = enable;
Harald Weltebc814502009-12-19 21:41:52 +01001187
1188 return CMD_SUCCESS;
1189}
1190
Harald Welte8f0ed552010-05-11 21:53:49 +02001191#define HO_WIN_STR HANDOVER_STR "Measurement Window\n"
1192#define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n"
1193#define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n"
1194#define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n"
1195
Harald Welteb720bd32009-12-21 16:51:50 +01001196DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1197 "handover window rxlev averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001198 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001199 "How many RxLev measurements are used for averaging")
1200{
Harald Weltedcccb182010-05-16 20:52:23 +02001201 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001202 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1203 return CMD_SUCCESS;
1204}
1205
1206DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1207 "handover window rxqual averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001208 HO_WIN_RXQUAL_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001209 "How many RxQual measurements are used for averaging")
1210{
Harald Weltedcccb182010-05-16 20:52:23 +02001211 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001212 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1213 return CMD_SUCCESS;
1214}
1215
1216DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1217 "handover window rxlev neighbor averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001218 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001219 "How many RxQual measurements are used for averaging")
1220{
Harald Weltedcccb182010-05-16 20:52:23 +02001221 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001222 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1223 return CMD_SUCCESS;
1224}
1225
1226DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1227 "handover power budget interval <1-99>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001228 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001229 "How often to check if we have a better cell (SACCH frames)")
1230{
Harald Weltedcccb182010-05-16 20:52:23 +02001231 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001232 gsmnet->handover.pwr_interval = atoi(argv[0]);
1233 return CMD_SUCCESS;
1234}
1235
1236DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1237 "handover power budget hysteresis <0-999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001238 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001239 "How many dB does a neighbor to be stronger to become a HO candidate")
1240{
Harald Weltedcccb182010-05-16 20:52:23 +02001241 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001242 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1243 return CMD_SUCCESS;
1244}
1245
1246DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1247 "handover maximum distance <0-9999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001248 HANDOVER_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001249 "How big is the maximum timing advance before HO is forced")
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.max_distance = atoi(argv[0]);
1253 return CMD_SUCCESS;
1254}
Harald Weltebc814502009-12-19 21:41:52 +01001255
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001256DEFUN(cfg_net_pag_any_tch,
1257 cfg_net_pag_any_tch_cmd,
1258 "paging any use tch (0|1)",
1259 "Assign a TCH when receiving a Paging Any request")
1260{
Holger Hans Peter Freytherb0e88b82010-09-06 10:09:19 +08001261 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001262 gsmnet->pag_any_tch = atoi(argv[0]);
1263 gsm_net_update_ctype(gsmnet);
1264 return CMD_SUCCESS;
1265}
1266
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001267#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001268 DEFUN(cfg_net_T##number, \
1269 cfg_net_T##number##_cmd, \
1270 "timer t" #number " <0-65535>", \
Harald Welte8f0ed552010-05-11 21:53:49 +02001271 "Configure GSM Timers\n" \
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001272 doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001273{ \
Harald Weltedcccb182010-05-16 20:52:23 +02001274 struct gsm_network *gsmnet = gsmnet_from_vty(vty); \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001275 int value = atoi(argv[0]); \
1276 \
1277 if (value < 0 || value > 65535) { \
1278 vty_out(vty, "Timer value %s out of range.%s", \
1279 argv[0], VTY_NEWLINE); \
1280 return CMD_WARNING; \
1281 } \
1282 \
1283 gsmnet->T##number = value; \
1284 return CMD_SUCCESS; \
1285}
1286
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001287DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1288DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1289DECLARE_TIMER(3105, "Currently not used.")
1290DECLARE_TIMER(3107, "Currently not used.")
1291DECLARE_TIMER(3109, "Currently not used.")
Holger Hans Peter Freytherf30c0dc2010-05-31 21:33:15 +08001292DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel.")
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001293DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1294DECLARE_TIMER(3115, "Currently not used.")
1295DECLARE_TIMER(3117, "Currently not used.")
1296DECLARE_TIMER(3119, "Currently not used.")
1297DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001298
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08001299DEFUN(cfg_net_dtx,
1300 cfg_net_dtx_cmd,
1301 "dtx-used (0|1)",
1302 "Enable the usage of DTX.\n"
1303 "DTX is enabled/disabled")
1304{
1305 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1306 gsmnet->dtx_enabled = atoi(argv[0]);
1307 return CMD_SUCCESS;
1308}
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001309
Harald Welte5258fc42009-03-28 19:07:53 +00001310/* per-BTS configuration */
1311DEFUN(cfg_bts,
1312 cfg_bts_cmd,
1313 "bts BTS_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02001314 "Select a BTS to configure\n"
1315 "BTS Number\n")
Harald Welte5258fc42009-03-28 19:07:53 +00001316{
Harald Weltedcccb182010-05-16 20:52:23 +02001317 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte5258fc42009-03-28 19:07:53 +00001318 int bts_nr = atoi(argv[0]);
1319 struct gsm_bts *bts;
1320
Harald Weltee441d9c2009-06-21 16:17:15 +02001321 if (bts_nr > gsmnet->num_bts) {
1322 vty_out(vty, "%% The next unused BTS number is %u%s",
1323 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001324 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001325 } else if (bts_nr == gsmnet->num_bts) {
1326 /* allocate a new one */
1327 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1328 HARDCODED_TSC, HARDCODED_BSIC);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001329 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02001330 bts = gsm_bts_num(gsmnet, bts_nr);
1331
Daniel Willmannf15c2762010-01-11 13:43:07 +01001332 if (!bts) {
1333 vty_out(vty, "%% Unable to allocate BTS %u%s",
1334 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee441d9c2009-06-21 16:17:15 +02001335 return CMD_WARNING;
Daniel Willmannf15c2762010-01-11 13:43:07 +01001336 }
Harald Welte5258fc42009-03-28 19:07:53 +00001337
1338 vty->index = bts;
Harald Welte197dea92010-05-14 17:59:53 +02001339 vty->index_sub = &bts->description;
Harald Welte5258fc42009-03-28 19:07:53 +00001340 vty->node = BTS_NODE;
1341
1342 return CMD_SUCCESS;
1343}
1344
1345DEFUN(cfg_bts_type,
1346 cfg_bts_type_cmd,
1347 "type TYPE",
1348 "Set the BTS type\n")
1349{
1350 struct gsm_bts *bts = vty->index;
Harald Welte39315c42010-01-10 18:01:52 +01001351 int rc;
Harald Welte5258fc42009-03-28 19:07:53 +00001352
Harald Welte39315c42010-01-10 18:01:52 +01001353 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1354 if (rc < 0)
1355 return CMD_WARNING;
Harald Welte8175e952009-10-20 00:22:00 +02001356
Harald Welte5258fc42009-03-28 19:07:53 +00001357 return CMD_SUCCESS;
1358}
1359
Harald Weltefcd24452009-06-20 18:15:19 +02001360DEFUN(cfg_bts_band,
1361 cfg_bts_band_cmd,
1362 "band BAND",
1363 "Set the frequency band of this BTS\n")
1364{
1365 struct gsm_bts *bts = vty->index;
Harald Welte42581822009-08-08 16:12:58 +02001366 int band = gsm_band_parse(argv[0]);
Harald Weltefcd24452009-06-20 18:15:19 +02001367
1368 if (band < 0) {
1369 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1370 band, VTY_NEWLINE);
1371 return CMD_WARNING;
1372 }
1373
1374 bts->band = band;
1375
1376 return CMD_SUCCESS;
1377}
1378
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001379DEFUN(cfg_bts_ci,
1380 cfg_bts_ci_cmd,
1381 "cell_identity <0-65535>",
1382 "Set the Cell identity of this BTS\n")
1383{
1384 struct gsm_bts *bts = vty->index;
1385 int ci = atoi(argv[0]);
1386
1387 if (ci < 0 || ci > 0xffff) {
1388 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1389 ci, VTY_NEWLINE);
1390 return CMD_WARNING;
1391 }
1392 bts->cell_identity = ci;
1393
1394 return CMD_SUCCESS;
1395}
1396
Harald Welte5258fc42009-03-28 19:07:53 +00001397DEFUN(cfg_bts_lac,
1398 cfg_bts_lac_cmd,
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001399 "location_area_code <0-65535>",
Harald Welte5258fc42009-03-28 19:07:53 +00001400 "Set the Location Area Code (LAC) of this BTS\n")
1401{
1402 struct gsm_bts *bts = vty->index;
1403 int lac = atoi(argv[0]);
1404
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001405 if (lac < 0 || lac > 0xffff) {
1406 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte5258fc42009-03-28 19:07:53 +00001407 lac, VTY_NEWLINE);
1408 return CMD_WARNING;
1409 }
Holger Hans Peter Freythere48b9562009-10-01 04:07:15 +02001410
1411 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1412 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1413 lac, VTY_NEWLINE);
1414 return CMD_WARNING;
1415 }
1416
Harald Welte5258fc42009-03-28 19:07:53 +00001417 bts->location_area_code = lac;
1418
1419 return CMD_SUCCESS;
1420}
1421
Harald Weltea43f7892009-12-01 18:04:30 +05301422
Harald Welte5258fc42009-03-28 19:07:53 +00001423DEFUN(cfg_bts_tsc,
1424 cfg_bts_tsc_cmd,
1425 "training_sequence_code <0-255>",
1426 "Set the Training Sequence Code (TSC) of this BTS\n")
1427{
1428 struct gsm_bts *bts = vty->index;
1429 int tsc = atoi(argv[0]);
1430
1431 if (tsc < 0 || tsc > 0xff) {
1432 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1433 tsc, VTY_NEWLINE);
1434 return CMD_WARNING;
1435 }
1436 bts->tsc = tsc;
1437
1438 return CMD_SUCCESS;
1439}
1440
Harald Welte78f2f502009-05-23 16:56:52 +00001441DEFUN(cfg_bts_bsic,
1442 cfg_bts_bsic_cmd,
1443 "base_station_id_code <0-63>",
1444 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1445{
1446 struct gsm_bts *bts = vty->index;
1447 int bsic = atoi(argv[0]);
1448
1449 if (bsic < 0 || bsic > 0x3f) {
Harald Welte42581822009-08-08 16:12:58 +02001450 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte78f2f502009-05-23 16:56:52 +00001451 bsic, VTY_NEWLINE);
1452 return CMD_WARNING;
1453 }
1454 bts->bsic = bsic;
1455
1456 return CMD_SUCCESS;
1457}
1458
1459
Harald Welte4cc34222009-05-01 15:12:31 +00001460DEFUN(cfg_bts_unit_id,
1461 cfg_bts_unit_id_cmd,
Harald Welte07dc73d2009-08-07 13:27:09 +02001462 "ip.access unit_id <0-65534> <0-255>",
1463 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte4cc34222009-05-01 15:12:31 +00001464{
1465 struct gsm_bts *bts = vty->index;
1466 int site_id = atoi(argv[0]);
1467 int bts_id = atoi(argv[1]);
1468
Harald Welte07dc73d2009-08-07 13:27:09 +02001469 if (!is_ipaccess_bts(bts)) {
1470 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1471 return CMD_WARNING;
1472 }
1473
Harald Welte4cc34222009-05-01 15:12:31 +00001474 bts->ip_access.site_id = site_id;
1475 bts->ip_access.bts_id = bts_id;
1476
1477 return CMD_SUCCESS;
1478}
1479
Harald Welte8f0ed552010-05-11 21:53:49 +02001480#define OML_STR "Organization & Maintenance Link\n"
1481#define IPA_STR "ip.access Specific Options\n"
1482
Harald Welte8175e952009-10-20 00:22:00 +02001483DEFUN(cfg_bts_stream_id,
1484 cfg_bts_stream_id_cmd,
1485 "oml ip.access stream_id <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001486 OML_STR IPA_STR
Harald Welte8175e952009-10-20 00:22:00 +02001487 "Set the ip.access Stream ID of the OML link of this BTS\n")
1488{
1489 struct gsm_bts *bts = vty->index;
1490 int stream_id = atoi(argv[0]);
1491
1492 if (!is_ipaccess_bts(bts)) {
1493 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1494 return CMD_WARNING;
1495 }
1496
1497 bts->oml_tei = stream_id;
1498
1499 return CMD_SUCCESS;
1500}
1501
Harald Welte8f0ed552010-05-11 21:53:49 +02001502#define OML_E1_STR OML_STR "E1 Line\n"
Harald Welte8175e952009-10-20 00:22:00 +02001503
Harald Welte42581822009-08-08 16:12:58 +02001504DEFUN(cfg_bts_oml_e1,
1505 cfg_bts_oml_e1_cmd,
1506 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001507 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001508 "E1 interface to be used for OML\n")
1509{
1510 struct gsm_bts *bts = vty->index;
1511
1512 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1513
1514 return CMD_SUCCESS;
1515}
1516
1517
1518DEFUN(cfg_bts_oml_e1_tei,
1519 cfg_bts_oml_e1_tei_cmd,
1520 "oml e1 tei <0-63>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001521 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001522 "Set the TEI to be used for OML")
1523{
1524 struct gsm_bts *bts = vty->index;
1525
1526 bts->oml_tei = atoi(argv[0]);
1527
1528 return CMD_SUCCESS;
1529}
1530
Harald Welte7a8fa412009-08-10 13:48:16 +02001531DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1532 "channel allocator (ascending|descending)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001533 "Channnel Allocator\n" "Channel Allocator\n"
1534 "Allocate Timeslots and Transceivers in ascending order\n"
1535 "Allocate Timeslots and Transceivers in descending order\n")
Harald Welte7a8fa412009-08-10 13:48:16 +02001536{
1537 struct gsm_bts *bts = vty->index;
1538
1539 if (!strcmp(argv[0], "ascending"))
1540 bts->chan_alloc_reverse = 0;
1541 else
1542 bts->chan_alloc_reverse = 1;
1543
1544 return CMD_SUCCESS;
1545}
1546
Harald Welte8f0ed552010-05-11 21:53:49 +02001547#define RACH_STR "Random Access Control Channel\n"
1548
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001549DEFUN(cfg_bts_rach_tx_integer,
1550 cfg_bts_rach_tx_integer_cmd,
1551 "rach tx integer <0-15>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001552 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001553 "Set the raw tx integer value in RACH Control parameters IE")
1554{
1555 struct gsm_bts *bts = vty->index;
1556 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1557 return CMD_SUCCESS;
1558}
1559
1560DEFUN(cfg_bts_rach_max_trans,
1561 cfg_bts_rach_max_trans_cmd,
1562 "rach max transmission (1|2|4|7)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001563 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001564 "Set the maximum number of RACH burst transmissions")
1565{
1566 struct gsm_bts *bts = vty->index;
1567 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1568 return CMD_SUCCESS;
1569}
1570
Harald Welte8f0ed552010-05-11 21:53:49 +02001571#define NM_STR "Network Management\n"
1572
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001573DEFUN(cfg_bts_rach_nm_b_thresh,
1574 cfg_bts_rach_nm_b_thresh_cmd,
1575 "rach nm busy threshold <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001576 RACH_STR NM_STR
1577 "Set the NM Busy Threshold in dB")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001578{
1579 struct gsm_bts *bts = vty->index;
1580 bts->rach_b_thresh = atoi(argv[0]);
1581 return CMD_SUCCESS;
1582}
1583
1584DEFUN(cfg_bts_rach_nm_ldavg,
1585 cfg_bts_rach_nm_ldavg_cmd,
1586 "rach nm load average <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001587 RACH_STR NM_STR
1588 "Set the NM Loadaverage Slots value")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001589{
1590 struct gsm_bts *bts = vty->index;
1591 bts->rach_ldavg_slots = atoi(argv[0]);
1592 return CMD_SUCCESS;
1593}
1594
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001595DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1596 "cell barred (0|1)",
1597 "Should this cell be barred from access?")
1598{
1599 struct gsm_bts *bts = vty->index;
1600
Harald Welte71355012009-12-21 23:08:18 +01001601 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001602
1603 return CMD_SUCCESS;
1604}
1605
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08001606DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd,
1607 "rach emergency call allowed (0|1)",
1608 "Should this cell allow emergency calls?")
1609{
1610 struct gsm_bts *bts = vty->index;
1611
1612 if (atoi(argv[0]) == 0)
1613 bts->si_common.rach_control.t2 |= 0x4;
1614 else
1615 bts->si_common.rach_control.t2 &= ~0x4;
1616
1617 return CMD_SUCCESS;
1618}
1619
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001620DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1621 "ms max power <0-40>",
1622 "Maximum transmit power of the MS")
1623{
1624 struct gsm_bts *bts = vty->index;
1625
1626 bts->ms_max_power = atoi(argv[0]);
1627
1628 return CMD_SUCCESS;
1629}
1630
Harald Welte73225282009-12-12 18:17:25 +01001631DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1632 "cell reselection hysteresis <0-14>",
1633 "Cell Re-Selection Hysteresis in dB")
1634{
1635 struct gsm_bts *bts = vty->index;
1636
1637 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1638
1639 return CMD_SUCCESS;
1640}
1641
1642DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1643 "rxlev access min <0-63>",
1644 "Minimum RxLev needed for cell access (better than -110dBm)")
1645{
1646 struct gsm_bts *bts = vty->index;
1647
1648 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1649
1650 return CMD_SUCCESS;
1651}
1652
Harald Welte (local)efc92312009-08-14 23:09:25 +02001653DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1654 "periodic location update <0-1530>",
1655 "Periodic Location Updating Interval in Minutes")
1656{
1657 struct gsm_bts *bts = vty->index;
1658
Dieter Spaard6613e02010-10-05 21:10:55 +02001659 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 6;
Harald Welte (local)efc92312009-08-14 23:09:25 +02001660
1661 return CMD_SUCCESS;
1662}
1663
Harald Welte8f0ed552010-05-11 21:53:49 +02001664#define GPRS_TEXT "GPRS Packet Network\n"
1665
Harald Welteaf387632010-03-14 23:30:30 +08001666DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welte57ba7e32010-04-18 14:00:26 +02001667 "gprs cell bvci <2-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001668 GPRS_TEXT
1669 "GPRS Cell Settings\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001670 "GPRS BSSGP VC Identifier")
1671{
1672 struct gsm_bts *bts = vty->index;
1673
Harald Welte4511d892010-04-18 15:51:20 +02001674 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001675 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1676 return CMD_WARNING;
1677 }
1678
Harald Welte97a282b2010-03-14 15:37:43 +08001679 bts->gprs.cell.bvci = atoi(argv[0]);
1680
1681 return CMD_SUCCESS;
1682}
1683
Harald Weltea5731cf2010-03-22 11:48:36 +08001684DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
1685 "gprs nsei <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001686 GPRS_TEXT
Harald Weltea5731cf2010-03-22 11:48:36 +08001687 "GPRS NS Entity Identifier")
1688{
1689 struct gsm_bts *bts = vty->index;
1690
Harald Welte4511d892010-04-18 15:51:20 +02001691 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltea5731cf2010-03-22 11:48:36 +08001692 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1693 return CMD_WARNING;
1694 }
1695
1696 bts->gprs.nse.nsei = atoi(argv[0]);
1697
1698 return CMD_SUCCESS;
1699}
1700
Harald Welte8f0ed552010-05-11 21:53:49 +02001701#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
1702 "NSVC Logical Number\n"
Harald Weltea5731cf2010-03-22 11:48:36 +08001703
Harald Welte97a282b2010-03-14 15:37:43 +08001704DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
1705 "gprs nsvc <0-1> nsvci <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001706 GPRS_TEXT NSVC_TEXT
1707 "NS Virtual Connection Identifier\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001708 "GPRS NS VC Identifier")
1709{
1710 struct gsm_bts *bts = vty->index;
1711 int idx = atoi(argv[0]);
1712
Harald Welte4511d892010-04-18 15:51:20 +02001713 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001714 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1715 return CMD_WARNING;
1716 }
1717
Harald Welte97a282b2010-03-14 15:37:43 +08001718 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
1719
1720 return CMD_SUCCESS;
1721}
1722
Harald Welteaf387632010-03-14 23:30:30 +08001723DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
1724 "gprs nsvc <0-1> local udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001725 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001726 "GPRS NS Local UDP Port")
1727{
1728 struct gsm_bts *bts = vty->index;
1729 int idx = atoi(argv[0]);
1730
Harald Welte4511d892010-04-18 15:51:20 +02001731 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001732 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1733 return CMD_WARNING;
1734 }
1735
Harald Welteaf387632010-03-14 23:30:30 +08001736 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
1737
1738 return CMD_SUCCESS;
1739}
1740
1741DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
1742 "gprs nsvc <0-1> remote udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001743 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001744 "GPRS NS Remote UDP Port")
1745{
1746 struct gsm_bts *bts = vty->index;
1747 int idx = atoi(argv[0]);
1748
Harald Welte4511d892010-04-18 15:51:20 +02001749 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001750 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1751 return CMD_WARNING;
1752 }
1753
Harald Welteaf387632010-03-14 23:30:30 +08001754 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
1755
1756 return CMD_SUCCESS;
1757}
1758
1759DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
1760 "gprs nsvc <0-1> remote ip A.B.C.D",
Harald Welte8f0ed552010-05-11 21:53:49 +02001761 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001762 "GPRS NS Remote IP Address")
1763{
1764 struct gsm_bts *bts = vty->index;
1765 int idx = atoi(argv[0]);
1766 struct in_addr ia;
1767
Harald Welte4511d892010-04-18 15:51:20 +02001768 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001769 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1770 return CMD_WARNING;
1771 }
1772
Harald Welteaf387632010-03-14 23:30:30 +08001773 inet_aton(argv[1], &ia);
1774 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
1775
1776 return CMD_SUCCESS;
1777}
1778
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08001779DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd,
1780 "paging free FREE_NR",
1781 "Only page when having a certain amount of free slots. -1 to disable")
1782{
1783 struct gsm_bts *bts = vty->index;
1784
1785 bts->paging.free_chans_need = atoi(argv[0]);
1786 return CMD_SUCCESS;
1787}
1788
Harald Welte615e9562010-05-11 23:50:21 +02001789DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd,
1790 "gprs ns timer " NS_TIMERS " <0-255>",
1791 GPRS_TEXT "Network Service\n"
1792 "Network Service Timer\n"
1793 NS_TIMERS_HELP "Timer Value\n")
1794{
1795 struct gsm_bts *bts = vty->index;
1796 int idx = get_string_value(gprs_ns_timer_strs, argv[0]);
1797 int val = atoi(argv[1]);
1798
1799 if (bts->gprs.mode == BTS_GPRS_NONE) {
1800 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1801 return CMD_WARNING;
1802 }
1803
1804 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
1805 return CMD_WARNING;
1806
1807 bts->gprs.nse.timer[idx] = val;
1808
1809 return CMD_SUCCESS;
1810}
1811
1812#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 +02001813#define BSSGP_TIMERS_HELP \
1814 "Tbvc-block timeout\n" \
1815 "Tbvc-block retries\n" \
1816 "Tbvc-unblock retries\n" \
1817 "Tbvcc-reset timeout\n" \
1818 "Tbvc-reset retries\n" \
1819 "Tbvc-suspend timeout\n" \
1820 "Tbvc-suspend retries\n" \
1821 "Tbvc-resume timeout\n" \
1822 "Tbvc-resume retries\n" \
1823 "Tbvc-capa-update timeout\n" \
1824 "Tbvc-capa-update retries\n"
Harald Welte615e9562010-05-11 23:50:21 +02001825
1826DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd,
1827 "gprs cell timer " BSSGP_TIMERS " <0-255>",
1828 GPRS_TEXT "Cell / BSSGP\n"
1829 "Cell/BSSGP Timer\n"
1830 BSSGP_TIMERS_HELP "Timer Value\n")
1831{
1832 struct gsm_bts *bts = vty->index;
1833 int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
1834 int val = atoi(argv[1]);
1835
1836 if (bts->gprs.mode == BTS_GPRS_NONE) {
1837 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1838 return CMD_WARNING;
1839 }
1840
1841 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer))
1842 return CMD_WARNING;
1843
1844 bts->gprs.cell.timer[idx] = val;
1845
1846 return CMD_SUCCESS;
1847}
1848
Harald Welte97a282b2010-03-14 15:37:43 +08001849DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
1850 "gprs routing area <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001851 GPRS_TEXT
Harald Welte97a282b2010-03-14 15:37:43 +08001852 "GPRS Routing Area Code")
1853{
1854 struct gsm_bts *bts = vty->index;
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 Welte97a282b2010-03-14 15:37:43 +08001861 bts->gprs.rac = atoi(argv[0]);
1862
1863 return CMD_SUCCESS;
1864}
1865
Harald Welte4511d892010-04-18 15:51:20 +02001866DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
1867 "gprs mode (none|gprs|egprs)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001868 GPRS_TEXT
1869 "GPRS Mode for this BTS\n"
1870 "GPRS Disabled on this BTS\n"
1871 "GPRS Enabled on this BTS\n"
1872 "EGPRS (EDGE) Enabled on this BTS\n")
Harald Welteaf387632010-03-14 23:30:30 +08001873{
1874 struct gsm_bts *bts = vty->index;
Harald Weltef3d8e922010-06-14 22:44:42 +02001875 enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0]);
Harald Welteaf387632010-03-14 23:30:30 +08001876
Harald Weltef3d8e922010-06-14 22:44:42 +02001877 if (mode != BTS_GPRS_NONE &&
1878 !gsm_bts_has_feature(bts, BTS_FEAT_GPRS)) {
1879 vty_out(vty, "This BTS type does not support %s%s", argv[0],
1880 VTY_NEWLINE);
1881 return CMD_WARNING;
1882 }
1883 if (mode == BTS_GPRS_EGPRS &&
1884 !gsm_bts_has_feature(bts, BTS_FEAT_EGPRS)) {
1885 vty_out(vty, "This BTS type does not support %s%s", argv[0],
1886 VTY_NEWLINE);
1887 return CMD_WARNING;
1888 }
1889
1890 bts->gprs.mode = mode;
Harald Welteaf387632010-03-14 23:30:30 +08001891
1892 return CMD_SUCCESS;
1893}
1894
Harald Welte9fbff4a2010-07-30 11:50:09 +02001895#define SI_TEXT "System Information Messages\n"
1896#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)"
1897#define SI_TYPE_HELP "System Information Type 1\n" \
1898 "System Information Type 2\n" \
1899 "System Information Type 3\n" \
1900 "System Information Type 4\n" \
1901 "System Information Type 5\n" \
1902 "System Information Type 6\n" \
1903 "System Information Type 7\n" \
1904 "System Information Type 8\n" \
1905 "System Information Type 9\n" \
1906 "System Information Type 10\n" \
1907 "System Information Type 13\n" \
1908 "System Information Type 16\n" \
1909 "System Information Type 17\n" \
1910 "System Information Type 18\n" \
1911 "System Information Type 19\n" \
1912 "System Information Type 20\n" \
1913 "System Information Type 2bis\n" \
1914 "System Information Type 2ter\n" \
1915 "System Information Type 2quater\n" \
1916 "System Information Type 5bis\n" \
1917 "System Information Type 5ter\n"
1918
1919DEFUN(cfg_bts_si_mode, cfg_bts_si_mode_cmd,
1920 "system-information " SI_TYPE_TEXT " mode (static|computed)",
1921 SI_TEXT SI_TYPE_HELP
1922 "System Information Mode\n"
1923 "Static user-specified\n"
1924 "Dynamic, BSC-computed\n")
1925{
1926 struct gsm_bts *bts = vty->index;
1927 int type;
1928
1929 type = get_string_value(osmo_sitype_strs, argv[0]);
1930 if (type < 0) {
1931 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
1932 return CMD_WARNING;
1933 }
1934
1935 if (!strcmp(argv[1], "static"))
1936 bts->si_mode_static |= (1 << type);
1937 else
1938 bts->si_mode_static &= ~(1 << type);
1939
1940 return CMD_SUCCESS;
1941}
1942
1943DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd,
1944 "system-information " SI_TYPE_TEXT " static HEXSTRING",
1945 SI_TEXT SI_TYPE_HELP
1946 "Static System Information filling\n"
1947 "Static user-specified SI content in HEX notation\n")
1948{
1949 struct gsm_bts *bts = vty->index;
1950 int rc, type;
1951
1952 type = get_string_value(osmo_sitype_strs, argv[0]);
1953 if (type < 0) {
1954 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
1955 return CMD_WARNING;
1956 }
1957
1958 if (!(bts->si_mode_static & (1 << type))) {
1959 vty_out(vty, "SI Type %s is not configured in static mode%s",
1960 get_value_string(osmo_sitype_strs, type), VTY_NEWLINE);
1961 return CMD_WARNING;
1962 }
1963
Harald Welte290aaed2010-07-30 11:53:18 +02001964 /* Fill buffer with padding pattern */
1965 memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type]));
1966
1967 /* Parse the user-specified SI in hex format, [partially] overwriting padding */
Harald Welte9fbff4a2010-07-30 11:50:09 +02001968 rc = hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0]));
1969 if (rc < 0 || rc > sizeof(bts->si_buf[0])) {
1970 vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
1971 return CMD_WARNING;
1972 }
1973
1974 /* Mark this SI as present */
1975 bts->si_valid |= (1 << type);
1976
1977 return CMD_SUCCESS;
1978}
1979
1980
Harald Welte8f0ed552010-05-11 21:53:49 +02001981#define TRX_TEXT "Radio Transceiver\n"
Harald Welte7a8fa412009-08-10 13:48:16 +02001982
Harald Welte5258fc42009-03-28 19:07:53 +00001983/* per TRX configuration */
1984DEFUN(cfg_trx,
1985 cfg_trx_cmd,
1986 "trx TRX_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02001987 TRX_TEXT
Harald Welte5258fc42009-03-28 19:07:53 +00001988 "Select a TRX to configure")
1989{
1990 int trx_nr = atoi(argv[0]);
1991 struct gsm_bts *bts = vty->index;
1992 struct gsm_bts_trx *trx;
1993
Harald Weltee441d9c2009-06-21 16:17:15 +02001994 if (trx_nr > bts->num_trx) {
1995 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
1996 bts->num_trx, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001997 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001998 } else if (trx_nr == bts->num_trx) {
1999 /* we need to allocate a new one */
2000 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02002001 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02002002 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02002003
Harald Weltee441d9c2009-06-21 16:17:15 +02002004 if (!trx)
2005 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +00002006
2007 vty->index = trx;
Harald Welte197dea92010-05-14 17:59:53 +02002008 vty->index_sub = &trx->description;
Harald Welte5258fc42009-03-28 19:07:53 +00002009 vty->node = TRX_NODE;
2010
2011 return CMD_SUCCESS;
2012}
2013
2014DEFUN(cfg_trx_arfcn,
2015 cfg_trx_arfcn_cmd,
Harald Welte93e90202010-05-14 19:00:52 +02002016 "arfcn <0-1024>",
Harald Welte5258fc42009-03-28 19:07:53 +00002017 "Set the ARFCN for this TRX\n")
2018{
2019 int arfcn = atoi(argv[0]);
2020 struct gsm_bts_trx *trx = vty->index;
2021
2022 /* FIXME: check if this ARFCN is supported by this TRX */
2023
2024 trx->arfcn = arfcn;
2025
2026 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
2027 /* FIXME: use OML layer to update the ARFCN */
2028 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
2029
2030 return CMD_SUCCESS;
2031}
2032
Harald Welte (local)7b37d972009-12-27 20:56:38 +01002033DEFUN(cfg_trx_nominal_power,
2034 cfg_trx_nominal_power_cmd,
2035 "nominal power <0-100>",
2036 "Nominal TRX RF Power in dB\n")
2037{
2038 struct gsm_bts_trx *trx = vty->index;
2039
2040 trx->nominal_power = atoi(argv[0]);
2041
2042 return CMD_SUCCESS;
2043}
2044
Harald Weltefcd24452009-06-20 18:15:19 +02002045DEFUN(cfg_trx_max_power_red,
2046 cfg_trx_max_power_red_cmd,
2047 "max_power_red <0-100>",
2048 "Reduction of maximum BS RF Power in dB\n")
2049{
2050 int maxpwr_r = atoi(argv[0]);
2051 struct gsm_bts_trx *trx = vty->index;
Harald Welte61a83b22009-11-18 09:20:22 +01002052 int upper_limit = 24; /* default 12.21 max power red. */
Harald Weltefcd24452009-06-20 18:15:19 +02002053
2054 /* FIXME: check if our BTS type supports more than 12 */
2055 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
2056 vty_out(vty, "%% Power %d dB is not in the valid range%s",
2057 maxpwr_r, VTY_NEWLINE);
2058 return CMD_WARNING;
2059 }
2060 if (maxpwr_r & 1) {
2061 vty_out(vty, "%% Power %d dB is not an even value%s",
2062 maxpwr_r, VTY_NEWLINE);
2063 return CMD_WARNING;
2064 }
2065
2066 trx->max_power_red = maxpwr_r;
2067
2068 /* FIXME: make sure we update this using OML */
2069
2070 return CMD_SUCCESS;
2071}
2072
Harald Welte42581822009-08-08 16:12:58 +02002073DEFUN(cfg_trx_rsl_e1,
2074 cfg_trx_rsl_e1_cmd,
2075 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
2076 "E1 interface to be used for RSL\n")
2077{
2078 struct gsm_bts_trx *trx = vty->index;
2079
2080 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
2081
2082 return CMD_SUCCESS;
2083}
2084
2085DEFUN(cfg_trx_rsl_e1_tei,
2086 cfg_trx_rsl_e1_tei_cmd,
2087 "rsl e1 tei <0-63>",
2088 "Set the TEI to be used for RSL")
2089{
2090 struct gsm_bts_trx *trx = vty->index;
2091
2092 trx->rsl_tei = atoi(argv[0]);
2093
2094 return CMD_SUCCESS;
2095}
2096
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01002097DEFUN(cfg_trx_rf_locked,
2098 cfg_trx_rf_locked_cmd,
2099 "rf_locked (0|1)",
2100 "Turn off RF of the TRX.\n")
2101{
2102 int locked = atoi(argv[0]);
2103 struct gsm_bts_trx *trx = vty->index;
2104
2105 gsm_trx_lock_rf(trx, locked);
2106 return CMD_SUCCESS;
2107}
Harald Welte42581822009-08-08 16:12:58 +02002108
Harald Welte5258fc42009-03-28 19:07:53 +00002109/* per TS configuration */
2110DEFUN(cfg_ts,
2111 cfg_ts_cmd,
Harald Welte42581822009-08-08 16:12:58 +02002112 "timeslot <0-7>",
Harald Welte5258fc42009-03-28 19:07:53 +00002113 "Select a Timeslot to configure")
2114{
2115 int ts_nr = atoi(argv[0]);
2116 struct gsm_bts_trx *trx = vty->index;
2117 struct gsm_bts_trx_ts *ts;
2118
2119 if (ts_nr >= TRX_NR_TS) {
2120 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
2121 TRX_NR_TS, VTY_NEWLINE);
2122 return CMD_WARNING;
2123 }
2124
2125 ts = &trx->ts[ts_nr];
2126
2127 vty->index = ts;
2128 vty->node = TS_NODE;
2129
2130 return CMD_SUCCESS;
2131}
2132
Harald Weltea6fd58e2009-08-07 00:25:23 +02002133DEFUN(cfg_ts_pchan,
2134 cfg_ts_pchan_cmd,
2135 "phys_chan_config PCHAN",
2136 "Physical Channel configuration (TCH/SDCCH/...)")
2137{
2138 struct gsm_bts_trx_ts *ts = vty->index;
2139 int pchanc;
2140
2141 pchanc = gsm_pchan_parse(argv[0]);
2142 if (pchanc < 0)
2143 return CMD_WARNING;
2144
2145 ts->pchan = pchanc;
2146
2147 return CMD_SUCCESS;
2148}
2149
Harald Weltea39b0f22010-06-14 22:26:10 +02002150#define HOPPING_STR "Configure frequency hopping\n"
2151
2152DEFUN(cfg_ts_hopping,
2153 cfg_ts_hopping_cmd,
2154 "hopping enabled (0|1)",
2155 HOPPING_STR "Enable or disable frequency hopping\n"
2156 "Disable frequency hopping\n" "Enable frequency hopping\n")
2157{
2158 struct gsm_bts_trx_ts *ts = vty->index;
Harald Weltec2fb3d02010-06-14 22:47:37 +02002159 int enabled = atoi(argv[0]);
Harald Weltea39b0f22010-06-14 22:26:10 +02002160
Harald Weltec2fb3d02010-06-14 22:47:37 +02002161 if (enabled && !gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_HOPPING)) {
2162 vty_out(vty, "BTS model does not support hopping%s",
2163 VTY_NEWLINE);
2164 return CMD_WARNING;
2165 }
2166
2167 ts->hopping.enabled = enabled;
Harald Weltea39b0f22010-06-14 22:26:10 +02002168
2169 return CMD_SUCCESS;
2170}
2171
Harald Welte6e0cd042009-09-12 13:05:33 +02002172DEFUN(cfg_ts_hsn,
2173 cfg_ts_hsn_cmd,
Harald Weltea39b0f22010-06-14 22:26:10 +02002174 "hopping sequence-number <0-63>",
2175 HOPPING_STR
Harald Welte6e0cd042009-09-12 13:05:33 +02002176 "Which hopping sequence to use for this channel")
2177{
2178 struct gsm_bts_trx_ts *ts = vty->index;
2179
2180 ts->hopping.hsn = atoi(argv[0]);
2181
2182 return CMD_SUCCESS;
2183}
2184
2185DEFUN(cfg_ts_maio,
2186 cfg_ts_maio_cmd,
2187 "hopping maio <0-63>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002188 HOPPING_STR
Harald Welte6e0cd042009-09-12 13:05:33 +02002189 "Which hopping MAIO to use for this channel")
2190{
2191 struct gsm_bts_trx_ts *ts = vty->index;
2192
2193 ts->hopping.maio = atoi(argv[0]);
2194
2195 return CMD_SUCCESS;
2196}
2197
2198DEFUN(cfg_ts_arfcn_add,
2199 cfg_ts_arfcn_add_cmd,
2200 "hopping arfcn add <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002201 HOPPING_STR "Configure hopping ARFCN list\n"
2202 "Add an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02002203{
2204 struct gsm_bts_trx_ts *ts = vty->index;
2205 int arfcn = atoi(argv[0]);
2206
Harald Weltea39b0f22010-06-14 22:26:10 +02002207 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1);
2208
Harald Welte6e0cd042009-09-12 13:05:33 +02002209 return CMD_SUCCESS;
2210}
2211
2212DEFUN(cfg_ts_arfcn_del,
2213 cfg_ts_arfcn_del_cmd,
2214 "hopping arfcn del <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002215 HOPPING_STR "Configure hopping ARFCN list\n"
2216 "Delete an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02002217{
2218 struct gsm_bts_trx_ts *ts = vty->index;
2219 int arfcn = atoi(argv[0]);
2220
Harald Weltea39b0f22010-06-14 22:26:10 +02002221 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0);
2222
Harald Welte6e0cd042009-09-12 13:05:33 +02002223 return CMD_SUCCESS;
2224}
2225
Harald Weltea6fd58e2009-08-07 00:25:23 +02002226DEFUN(cfg_ts_e1_subslot,
2227 cfg_ts_e1_subslot_cmd,
Harald Welte42581822009-08-08 16:12:58 +02002228 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltea6fd58e2009-08-07 00:25:23 +02002229 "E1 sub-slot connected to this on-air timeslot")
2230{
2231 struct gsm_bts_trx_ts *ts = vty->index;
2232
Harald Welte42581822009-08-08 16:12:58 +02002233 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002234
2235 return CMD_SUCCESS;
2236}
Harald Welte5258fc42009-03-28 19:07:53 +00002237
Harald Welte4f10c252010-05-16 21:47:13 +02002238void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
2239{
2240 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
2241 counter_get(net->stats.chreq.total),
2242 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
2243 vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
2244 counter_get(net->stats.chan.rf_fail),
2245 counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
2246 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
2247 counter_get(net->stats.paging.attempted),
2248 counter_get(net->stats.paging.completed),
2249 counter_get(net->stats.paging.expired), VTY_NEWLINE);
2250 vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
2251 counter_get(net->stats.bts.oml_fail),
2252 counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
2253}
2254
Harald Welte5bc61dc2010-05-16 22:02:16 +02002255DEFUN(logging_fltr_imsi,
2256 logging_fltr_imsi_cmd,
2257 "logging filter imsi IMSI",
2258 LOGGING_STR FILTER_STR
2259 "Filter log messages by IMSI\n" "IMSI to be used as filter\n")
2260{
2261 struct telnet_connection *conn;
2262
2263 conn = (struct telnet_connection *) vty->priv;
2264 if (!conn->dbg) {
2265 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
2266 return CMD_WARNING;
2267 }
2268
2269 log_set_imsi_filter(conn->dbg, argv[0]);
2270 return CMD_SUCCESS;
2271}
2272
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002273DEFUN(drop_bts,
2274 drop_bts_cmd,
Holger Hans Peter Freyther0586b0f2010-04-11 12:46:45 +02002275 "drop bts connection <0-65535> (oml|rsl)",
2276 "Debug/Simulation command to drop ipaccess BTS\n"
2277 "BTS NR\n" "Connection Type\n")
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002278{
2279 struct gsm_network *gsmnet;
2280 struct gsm_bts_trx *trx;
2281 struct gsm_bts *bts;
2282 unsigned int bts_nr;
2283
2284 gsmnet = gsmnet_from_vty(vty);
2285
2286 bts_nr = atoi(argv[0]);
2287 if (bts_nr >= gsmnet->num_bts) {
2288 vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s",
2289 gsmnet->num_bts, bts_nr, VTY_NEWLINE);
2290 return CMD_WARNING;
2291 }
2292
2293 bts = gsm_bts_num(gsmnet, bts_nr);
2294 if (!bts) {
2295 vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE);
2296 return CMD_WARNING;
2297 }
2298
2299 if (!is_ipaccess_bts(bts)) {
2300 vty_out(vty, "This command only works for ipaccess.%s", VTY_NEWLINE);
2301 return CMD_WARNING;
2302 }
2303
2304
2305 /* close all connections */
2306 if (strcmp(argv[1], "oml") == 0) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01002307 ipaccess_drop_oml(bts);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002308 } else if (strcmp(argv[1], "rsl") == 0) {
2309 /* close all rsl connections */
2310 llist_for_each_entry(trx, &bts->trx_list, list) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01002311 ipaccess_drop_rsl(trx);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002312 }
2313 } else {
2314 vty_out(vty, "Argument must be 'oml# or 'rsl'.%s", VTY_NEWLINE);
2315 return CMD_WARNING;
2316 }
2317
2318 return CMD_SUCCESS;
2319}
2320
2321
Harald Weltedcccb182010-05-16 20:52:23 +02002322extern int bsc_vty_init_extra(void);
Harald Welte1353f962010-05-16 19:20:24 +02002323extern const char *openbsc_copyright;
Holger Hans Peter Freythere1ffc082010-04-10 00:08:28 +02002324
Harald Weltedcccb182010-05-16 20:52:23 +02002325int bsc_vty_init(void)
Harald Welte68628e82009-03-10 12:17:57 +00002326{
Harald Welteb4d5b172010-05-12 16:10:35 +00002327 install_element_ve(&show_net_cmd);
2328 install_element_ve(&show_bts_cmd);
2329 install_element_ve(&show_trx_cmd);
2330 install_element_ve(&show_ts_cmd);
2331 install_element_ve(&show_lchan_cmd);
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08002332 install_element_ve(&show_lchan_summary_cmd);
Harald Welte5bc61dc2010-05-16 22:02:16 +02002333 install_element_ve(&logging_fltr_imsi_cmd);
Harald Welte1bc77352009-03-10 19:47:51 +00002334
Harald Welteb4d5b172010-05-12 16:10:35 +00002335 install_element_ve(&show_e1drv_cmd);
2336 install_element_ve(&show_e1line_cmd);
2337 install_element_ve(&show_e1ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002338
Harald Welteb4d5b172010-05-12 16:10:35 +00002339 install_element_ve(&show_paging_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002340
Harald Welte5bc61dc2010-05-16 22:02:16 +02002341 logging_vty_add_cmds();
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +01002342
Harald Welte5013b2a2009-08-07 13:29:14 +02002343 install_element(CONFIG_NODE, &cfg_net_cmd);
2344 install_node(&net_node, config_write_net);
2345 install_default(GSMNET_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002346 install_element(GSMNET_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002347 install_element(GSMNET_NODE, &ournode_end_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002348 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002349 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
2350 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
2351 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)69de3972009-08-12 14:42:23 +02002352 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte1085c092009-11-18 20:33:19 +01002353 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Welte4381cfe2009-08-30 15:47:06 +09002354 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01002355 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welteeab84a12009-12-13 10:53:12 +01002356 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte3d23db42009-12-14 17:49:15 +01002357 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Weltebc814502009-12-19 21:41:52 +01002358 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Welteb720bd32009-12-21 16:51:50 +01002359 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
2360 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
2361 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
2362 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
2363 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
2364 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01002365 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01002366 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
2367 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
2368 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
2369 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
2370 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
2371 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
2372 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
2373 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
2374 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
2375 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08002376 install_element(GSMNET_NODE, &cfg_net_dtx_cmd);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08002377 install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002378
2379 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte67ce0732009-08-06 19:06:46 +02002380 install_node(&bts_node, config_write_bts);
Harald Welte68628e82009-03-10 12:17:57 +00002381 install_default(BTS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002382 install_element(BTS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002383 install_element(BTS_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002384 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002385 install_element(BTS_NODE, &cfg_description_cmd);
2386 install_element(BTS_NODE, &cfg_no_description_cmd);
Harald Weltefcd24452009-06-20 18:15:19 +02002387 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02002388 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002389 install_element(BTS_NODE, &cfg_bts_lac_cmd);
2390 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002391 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte4cc34222009-05-01 15:12:31 +00002392 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte8175e952009-10-20 00:22:00 +02002393 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002394 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
2395 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02002396 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01002397 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
2398 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08002399 install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd);
2400 install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02002401 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08002402 install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd);
Harald Welte (local)0e451d02009-08-13 10:14:26 +02002403 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)efc92312009-08-14 23:09:25 +02002404 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welte73225282009-12-12 18:17:25 +01002405 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
2406 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Harald Welte4511d892010-04-18 15:51:20 +02002407 install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002408 install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002409 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
2410 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002411 install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
Harald Weltea5731cf2010-03-22 11:48:36 +08002412 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002413 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welteaf387632010-03-14 23:30:30 +08002414 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
2415 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
2416 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08002417 install_element(BTS_NODE, &cfg_bts_pag_free_cmd);
Harald Welte9fbff4a2010-07-30 11:50:09 +02002418 install_element(BTS_NODE, &cfg_bts_si_mode_cmd);
2419 install_element(BTS_NODE, &cfg_bts_si_static_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002420
Harald Welte5258fc42009-03-28 19:07:53 +00002421 install_element(BTS_NODE, &cfg_trx_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002422 install_node(&trx_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002423 install_default(TRX_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002424 install_element(TRX_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002425 install_element(TRX_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002426 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002427 install_element(TRX_NODE, &cfg_description_cmd);
2428 install_element(TRX_NODE, &cfg_no_description_cmd);
Harald Welte (local)7b37d972009-12-27 20:56:38 +01002429 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte879dc972009-06-20 22:36:12 +02002430 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002431 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
2432 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01002433 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002434
Harald Welte5258fc42009-03-28 19:07:53 +00002435 install_element(TRX_NODE, &cfg_ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002436 install_node(&ts_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002437 install_default(TS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002438 install_element(TS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002439 install_element(TS_NODE, &ournode_end_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002440 install_element(TS_NODE, &cfg_ts_pchan_cmd);
Harald Weltea39b0f22010-06-14 22:26:10 +02002441 install_element(TS_NODE, &cfg_ts_hopping_cmd);
Harald Welte6e0cd042009-09-12 13:05:33 +02002442 install_element(TS_NODE, &cfg_ts_hsn_cmd);
2443 install_element(TS_NODE, &cfg_ts_maio_cmd);
2444 install_element(TS_NODE, &cfg_ts_arfcn_add_cmd);
2445 install_element(TS_NODE, &cfg_ts_arfcn_del_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002446 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002447
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002448 install_element(ENABLE_NODE, &drop_bts_cmd);
2449
Harald Welte81c9b9c2010-05-31 16:40:40 +02002450 abis_nm_vty_init();
2451
Harald Weltedcccb182010-05-16 20:52:23 +02002452 bsc_vty_init_extra();
Harald Welte40f82892009-05-23 17:31:39 +00002453
Harald Welte68628e82009-03-10 12:17:57 +00002454 return 0;
2455}