blob: 02d8b03bf356ae71769f6381c89309fca469b760 [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);
Harald Welte8175e952009-10-20 00:22:00 +0200246 if (!is_ipaccess_bts(bts)) {
247 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
248 e1isl_dump_vty(vty, bts->oml_link);
249 }
Harald Welte68628e82009-03-10 12:17:57 +0000250 /* FIXME: oml_link, chan_desc */
Harald Welteb908cb72009-12-22 13:09:29 +0100251 memset(&pl, 0, sizeof(pl));
252 bts_chan_load(&pl, bts);
253 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
254 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000255}
256
257DEFUN(show_bts, show_bts_cmd, "show bts [number]",
258 SHOW_STR "Display information about a BTS\n"
259 "BTS number")
260{
Harald Weltedcccb182010-05-16 20:52:23 +0200261 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000262 int bts_nr;
263
264 if (argc != 0) {
265 /* use the BTS number that the user has specified */
266 bts_nr = atoi(argv[0]);
267 if (bts_nr > net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000268 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000269 VTY_NEWLINE);
270 return CMD_WARNING;
271 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200272 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000273 return CMD_SUCCESS;
274 }
275 /* print all BTS's */
276 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee441d9c2009-06-21 16:17:15 +0200277 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000278
279 return CMD_SUCCESS;
280}
281
Harald Welte42581822009-08-08 16:12:58 +0200282/* utility functions */
283static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
284 const char *ts, const char *ss)
285{
286 e1_link->e1_nr = atoi(line);
287 e1_link->e1_ts = atoi(ts);
288 if (!strcmp(ss, "full"))
289 e1_link->e1_ts_ss = 255;
290 else
291 e1_link->e1_ts_ss = atoi(ss);
292}
293
294static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,
295 const char *prefix)
296{
297 if (!e1_link->e1_ts)
298 return;
299
300 if (e1_link->e1_ts_ss == 255)
301 vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s",
302 prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE);
303 else
304 vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s",
305 prefix, e1_link->e1_nr, e1_link->e1_ts,
306 e1_link->e1_ts_ss, VTY_NEWLINE);
307}
308
309
Harald Welte67ce0732009-08-06 19:06:46 +0200310static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
311{
Harald Welte42581822009-08-08 16:12:58 +0200312 vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
313 if (ts->pchan != GSM_PCHAN_NONE)
314 vty_out(vty, " phys_chan_config %s%s",
315 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200316 vty_out(vty, " hopping enabled %u%s",
317 ts->hopping.enabled, VTY_NEWLINE);
318 if (ts->hopping.enabled) {
319 unsigned int i;
320 vty_out(vty, " hopping sequence-number %u%s",
Harald Welte6e0cd042009-09-12 13:05:33 +0200321 ts->hopping.hsn, VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200322 vty_out(vty, " hopping maio %u%s",
Harald Welte6e0cd042009-09-12 13:05:33 +0200323 ts->hopping.maio, VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200324 for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) {
325 if (!bitvec_get_bit_pos(&ts->hopping.arfcns, i))
326 continue;
327 vty_out(vty, " hopping arfcn add %u%s",
328 i, VTY_NEWLINE);
329 }
330 } else
Harald Welte42581822009-08-08 16:12:58 +0200331 config_write_e1_link(vty, &ts->e1_link, " ");
Harald Welte67ce0732009-08-06 19:06:46 +0200332}
333
334static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
335{
336 int i;
337
Harald Welte5013b2a2009-08-07 13:29:14 +0200338 vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200339 if (trx->description)
340 vty_out(vty, " description %s%s", trx->description,
341 VTY_NEWLINE);
Holger Hans Peter Freyther2ba40af2010-04-17 06:42:07 +0200342 vty_out(vty, " rf_locked %u%s",
343 trx->nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
344 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200345 vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
Harald Welte (local)7b37d972009-12-27 20:56:38 +0100346 vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200347 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200348 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
349 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte67ce0732009-08-06 19:06:46 +0200350
351 for (i = 0; i < TRX_NR_TS; i++)
352 config_write_ts_single(vty, &trx->ts[i]);
353}
354
Harald Welte615e9562010-05-11 23:50:21 +0200355static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
356{
357 unsigned int i;
358 vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode),
359 VTY_NEWLINE);
360 if (bts->gprs.mode == BTS_GPRS_NONE)
361 return;
362
363 vty_out(vty, " gprs routing area %u%s", bts->gprs.rac,
364 VTY_NEWLINE);
365 vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
366 VTY_NEWLINE);
367 for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++)
368 vty_out(vty, " gprs cell timer %s %u%s",
369 get_value_string(gprs_bssgp_cfg_strs, i),
370 bts->gprs.cell.timer[i], VTY_NEWLINE);
371 vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei,
372 VTY_NEWLINE);
373 for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++)
374 vty_out(vty, " gprs ns timer %s %u%s",
375 get_value_string(gprs_ns_timer_strs, i),
376 bts->gprs.nse.timer[i], VTY_NEWLINE);
377 for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
378 struct gsm_bts_gprs_nsvc *nsvc =
379 &bts->gprs.nsvc[i];
380 struct in_addr ia;
381
382 ia.s_addr = htonl(nsvc->remote_ip);
383 vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
384 nsvc->nsvci, VTY_NEWLINE);
385 vty_out(vty, " gprs nsvc %u local udp port %u%s", i,
386 nsvc->local_port, VTY_NEWLINE);
387 vty_out(vty, " gprs nsvc %u remote udp port %u%s", i,
388 nsvc->remote_port, VTY_NEWLINE);
389 vty_out(vty, " gprs nsvc %u remote ip %s%s", i,
390 inet_ntoa(ia), VTY_NEWLINE);
391 }
392}
393
Harald Welte67ce0732009-08-06 19:06:46 +0200394static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
395{
396 struct gsm_bts_trx *trx;
Harald Welte9fbff4a2010-07-30 11:50:09 +0200397 int i;
Harald Welte67ce0732009-08-06 19:06:46 +0200398
Harald Welte5013b2a2009-08-07 13:29:14 +0200399 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
400 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200401 if (bts->description)
402 vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200403 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freytherf926ed62009-11-19 16:38:49 +0100404 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200405 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte67ce0732009-08-06 19:06:46 +0200406 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200407 vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE);
408 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)0e451d02009-08-13 10:14:26 +0200409 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100410 vty_out(vty, " cell reselection hysteresis %u%s",
411 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
412 vty_out(vty, " rxlev access min %u%s",
413 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Harald Weltea43f7892009-12-01 18:04:30 +0530414 if (bts->si_common.chan_desc.t3212)
Harald Welte (local)efc92312009-08-14 23:09:25 +0200415 vty_out(vty, " periodic location update %u%s",
Dieter Spaard6613e02010-10-05 21:10:55 +0200416 bts->si_common.chan_desc.t3212 * 6, VTY_NEWLINE);
Harald Welte7a8fa412009-08-10 13:48:16 +0200417 vty_out(vty, " channel allocator %s%s",
418 bts->chan_alloc_reverse ? "descending" : "ascending",
419 VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100420 vty_out(vty, " rach tx integer %u%s",
421 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
422 vty_out(vty, " rach max transmission %u%s",
423 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
424 VTY_NEWLINE);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +0800425
426 if (bts->rach_b_thresh != -1)
427 vty_out(vty, " rach nm busy threshold %u%s",
428 bts->rach_b_thresh, VTY_NEWLINE);
429 if (bts->rach_ldavg_slots != -1)
430 vty_out(vty, " rach nm load average %u%s",
431 bts->rach_ldavg_slots, VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100432 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200433 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +0800434 if ((bts->si_common.rach_control.t2 & 0x4) == 0)
435 vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE);
Harald Welte9fbff4a2010-07-30 11:50:09 +0200436 for (i = SYSINFO_TYPE_1; i < _MAX_SYSINFO_TYPE; i++) {
437 if (bts->si_mode_static & (1 << i)) {
438 vty_out(vty, " system-information %s mode static%s",
439 get_value_string(osmo_sitype_strs, i), VTY_NEWLINE);
440 vty_out(vty, " system-information %s static %s%s",
441 get_value_string(osmo_sitype_strs, i),
442 hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])),
443 VTY_NEWLINE);
444 }
445 }
Harald Welte8175e952009-10-20 00:22:00 +0200446 if (is_ipaccess_bts(bts)) {
Harald Welte5013b2a2009-08-07 13:29:14 +0200447 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Weltea6fd58e2009-08-07 00:25:23 +0200448 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200449 vty_out(vty, " oml ip.access stream_id %u%s", bts->oml_tei, VTY_NEWLINE);
450 } else {
Harald Welte42581822009-08-08 16:12:58 +0200451 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
452 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
453 }
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +0800454
455 /* if we have a limit, write it */
456 if (bts->paging.free_chans_need >= 0)
457 vty_out(vty, " paging free %d%s", bts->paging.free_chans_need, VTY_NEWLINE);
458
Harald Welte615e9562010-05-11 23:50:21 +0200459 config_write_bts_gprs(vty, bts);
Harald Welte67ce0732009-08-06 19:06:46 +0200460
461 llist_for_each_entry(trx, &bts->trx_list, list)
462 config_write_trx_single(vty, trx);
463}
464
465static int config_write_bts(struct vty *v)
466{
Harald Weltedcccb182010-05-16 20:52:23 +0200467 struct gsm_network *gsmnet = gsmnet_from_vty(v);
Harald Welte67ce0732009-08-06 19:06:46 +0200468 struct gsm_bts *bts;
469
470 llist_for_each_entry(bts, &gsmnet->bts_list, list)
471 config_write_bts_single(v, bts);
472
473 return CMD_SUCCESS;
474}
475
Harald Welte5013b2a2009-08-07 13:29:14 +0200476static int config_write_net(struct vty *vty)
477{
Harald Weltedcccb182010-05-16 20:52:23 +0200478 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
479
Harald Welte5013b2a2009-08-07 13:29:14 +0200480 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200481 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200482 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200483 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
484 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200485 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100486 vty_out(vty, " location updating reject cause %u%s",
487 gsmnet->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900488 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freytherd54c3372009-11-19 16:37:48 +0100489 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +0800490 vty_out(vty, " paging any use tch %d%s", gsmnet->pag_any_tch, VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100491 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
492 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100493 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100494 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Welteb720bd32009-12-21 16:51:50 +0100495 vty_out(vty, " handover window rxlev averaging %u%s",
496 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
497 vty_out(vty, " handover window rxqual averaging %u%s",
498 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
499 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
500 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
501 vty_out(vty, " handover power budget interval %u%s",
502 gsmnet->handover.pwr_interval, VTY_NEWLINE);
503 vty_out(vty, " handover power budget hysteresis %u%s",
504 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
505 vty_out(vty, " handover maximum distance %u%s",
506 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +0100507 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100508 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
509 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
510 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
511 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
512 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
513 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
514 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
515 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
516 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
517 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +0800518 vty_out(vty, " use-dtx %u%s", gsmnet->dtx_enabled, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200519
520 return CMD_SUCCESS;
521}
Harald Welte67ce0732009-08-06 19:06:46 +0200522
Harald Welte68628e82009-03-10 12:17:57 +0000523static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
524{
525 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
526 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200527 vty_out(vty, "Description: %s%s",
528 trx->description ? trx->description : "(null)", VTY_NEWLINE);
Harald Weltefcd24452009-06-20 18:15:19 +0200529 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte42581822009-08-08 16:12:58 +0200530 "resulting BS power: %d dBm%s",
Harald Weltefcd24452009-06-20 18:15:19 +0200531 trx->nominal_power, trx->max_power_red,
Harald Welte42581822009-08-08 16:12:58 +0200532 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000533 vty_out(vty, " NM State: ");
534 net_dump_nmstate(vty, &trx->nm_state);
535 vty_out(vty, " Baseband Transceiver NM State: ");
536 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte8175e952009-10-20 00:22:00 +0200537 if (is_ipaccess_bts(trx->bts)) {
538 vty_out(vty, " ip.access stream ID: 0x%02x%s",
539 trx->rsl_tei, VTY_NEWLINE);
540 } else {
541 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
542 e1isl_dump_vty(vty, trx->rsl_link);
543 }
Harald Welte68628e82009-03-10 12:17:57 +0000544}
545
546DEFUN(show_trx,
547 show_trx_cmd,
548 "show trx [bts_nr] [trx_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200549 SHOW_STR "Display information about a TRX\n"
550 "BTS Number\n"
551 "TRX Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000552{
Harald Weltedcccb182010-05-16 20:52:23 +0200553 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000554 struct gsm_bts *bts = NULL;
555 struct gsm_bts_trx *trx;
556 int bts_nr, trx_nr;
557
558 if (argc >= 1) {
559 /* use the BTS number that the user has specified */
560 bts_nr = atoi(argv[0]);
561 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000562 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000563 VTY_NEWLINE);
564 return CMD_WARNING;
565 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200566 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000567 }
568 if (argc >= 2) {
569 trx_nr = atoi(argv[1]);
570 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000571 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000572 VTY_NEWLINE);
573 return CMD_WARNING;
574 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200575 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000576 trx_dump_vty(vty, trx);
577 return CMD_SUCCESS;
578 }
579 if (bts) {
580 /* print all TRX in this BTS */
581 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200582 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000583 trx_dump_vty(vty, trx);
584 }
585 return CMD_SUCCESS;
586 }
587
588 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200589 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000590 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200591 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000592 trx_dump_vty(vty, trx);
593 }
594 }
595
596 return CMD_SUCCESS;
597}
598
Harald Welte67ce0732009-08-06 19:06:46 +0200599
Harald Welte68628e82009-03-10 12:17:57 +0000600static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
601{
Harald Welte68628e82009-03-10 12:17:57 +0000602 vty_out(vty, "Timeslot %u of TRX %u in BTS %u, phys cfg %s%s",
603 ts->nr, ts->trx->nr, ts->trx->bts->nr,
604 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
605 vty_out(vty, " NM State: ");
606 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte2c828992009-12-02 01:56:49 +0530607 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welteef235b52009-03-10 12:34:02 +0000608 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
609 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
610 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000611}
612
613DEFUN(show_ts,
614 show_ts_cmd,
Harald Welte1bc77352009-03-10 19:47:51 +0000615 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200616 SHOW_STR "Display information about a TS\n"
617 "BTS Number\n" "TRX Number\n" "Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000618{
Harald Weltedcccb182010-05-16 20:52:23 +0200619 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000620 struct gsm_bts *bts;
621 struct gsm_bts_trx *trx;
622 struct gsm_bts_trx_ts *ts;
623 int bts_nr, trx_nr, ts_nr;
624
625 if (argc >= 1) {
626 /* use the BTS number that the user has specified */
627 bts_nr = atoi(argv[0]);
628 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000629 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000630 VTY_NEWLINE);
631 return CMD_WARNING;
632 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200633 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000634 }
635 if (argc >= 2) {
636 trx_nr = atoi(argv[1]);
637 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000638 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000639 VTY_NEWLINE);
640 return CMD_WARNING;
641 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200642 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000643 }
644 if (argc >= 3) {
645 ts_nr = atoi(argv[2]);
646 if (ts_nr >= TRX_NR_TS) {
Harald Welte1bc77352009-03-10 19:47:51 +0000647 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
Harald Welte68628e82009-03-10 12:17:57 +0000648 VTY_NEWLINE);
649 return CMD_WARNING;
650 }
651 ts = &trx->ts[ts_nr];
652 ts_dump_vty(vty, ts);
653 return CMD_SUCCESS;
654 }
655 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200656 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000657 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200658 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000659 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
660 ts = &trx->ts[ts_nr];
661 ts_dump_vty(vty, ts);
662 }
663 }
664 }
665
666 return CMD_SUCCESS;
667}
668
Holger Hans Peter Freyther424c4f02010-01-06 06:00:40 +0100669static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte68628e82009-03-10 12:17:57 +0000670{
Harald Weltefcd24452009-06-20 18:15:19 +0200671 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte40f82892009-05-23 17:31:39 +0000672 subscr->authorized, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000673 if (subscr->name)
Harald Welte1bc77352009-03-10 19:47:51 +0000674 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000675 if (subscr->extension)
676 vty_out(vty, " Extension: %s%s", subscr->extension,
677 VTY_NEWLINE);
678 if (subscr->imsi)
679 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freyther22230252009-08-19 12:53:57 +0200680 if (subscr->tmsi != GSM_RESERVED_TMSI)
681 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte731fd912009-08-15 03:24:51 +0200682 VTY_NEWLINE);
Sylvain Munautaf292642009-12-27 19:29:28 +0100683
Harald Welte (local)15920de2009-08-14 20:27:16 +0200684 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000685}
686
Harald Welte8387a492009-12-22 21:43:14 +0100687static void meas_rep_dump_uni_vty(struct vty *vty,
688 struct gsm_meas_rep_unidir *mru,
689 const char *prefix,
690 const char *dir)
691{
692 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
693 prefix, dir, rxlev2dbm(mru->full.rx_lev),
694 dir, rxlev2dbm(mru->sub.rx_lev));
695 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
696 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
697 VTY_NEWLINE);
698}
699
700static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
701 const char *prefix)
702{
703 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
704 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
705 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
706 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
707 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
708 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
709 VTY_NEWLINE);
710 if (mr->flags & MEAS_REP_F_MS_TO)
711 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
712 mr->ms_timing_offset, VTY_NEWLINE);
713 if (mr->flags & MEAS_REP_F_MS_L1)
714 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
715 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
716 if (mr->flags & MEAS_REP_F_DL_VALID)
717 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
718 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
719}
720
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800721static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
Harald Welte68628e82009-03-10 12:17:57 +0000722{
Harald Welte8387a492009-12-22 21:43:14 +0100723 int idx;
724
Harald Welte68628e82009-03-10 12:17:57 +0000725 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 +0200726 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
Harald Welte (local)ccd88452009-12-27 18:05:25 +0100727 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Harald Welte68628e82009-03-10 12:17:57 +0000728 VTY_NEWLINE);
Holger Hans Peter Freyther40494552010-06-28 17:09:29 +0800729 vty_out(vty, " Connection: %u, State: %s%s",
730 lchan->conn ? 1: 0,
Harald Welte1887f9d2009-12-29 10:52:38 +0100731 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100732 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
733 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
734 - lchan->bs_power*2,
735 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
736 VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800737 if (lchan->conn && lchan->conn->subscr) {
Harald Welte68628e82009-03-10 12:17:57 +0000738 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800739 subscr_dump_vty(vty, lchan->conn->subscr);
Harald Welte68628e82009-03-10 12:17:57 +0000740 } else
741 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte2c828992009-12-02 01:56:49 +0530742 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
743 struct in_addr ia;
Holger Hans Peter Freyther54fa7992010-04-07 15:39:16 +0200744 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte2c828992009-12-02 01:56:49 +0530745 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
746 inet_ntoa(ia), lchan->abis_ip.bound_port,
747 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
748 VTY_NEWLINE);
749 }
Harald Welte8387a492009-12-22 21:43:14 +0100750
751 /* we want to report the last measurement report */
752 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
753 lchan->meas_rep_idx, 1);
754 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte68628e82009-03-10 12:17:57 +0000755}
756
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800757static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
758{
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800759 struct gsm_meas_rep *mr;
760 int idx;
761
762 /* we want to report the last measurement report */
763 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
764 lchan->meas_rep_idx, 1);
765 mr = &lchan->meas_rep[idx];
766
767 vty_out(vty, "Lchan: %u Timeslot: %u TRX: %u BTS: %u Type: %s - L1 MS Power: %u dBm "
768 "RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800769 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
770 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800771 mr->ms_l1.pwr,
772 rxlev2dbm(mr->dl.full.rx_lev),
773 rxlev2dbm(mr->ul.full.rx_lev),
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800774 VTY_NEWLINE);
775}
776
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800777static int lchan_summary(struct vty *vty, int argc, const char **argv,
778 void (*dump_cb)(struct vty *, struct gsm_lchan *))
Harald Welte68628e82009-03-10 12:17:57 +0000779{
Harald Weltedcccb182010-05-16 20:52:23 +0200780 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000781 struct gsm_bts *bts;
782 struct gsm_bts_trx *trx;
783 struct gsm_bts_trx_ts *ts;
784 struct gsm_lchan *lchan;
785 int bts_nr, trx_nr, ts_nr, lchan_nr;
786
787 if (argc >= 1) {
788 /* use the BTS number that the user has specified */
789 bts_nr = atoi(argv[0]);
790 if (bts_nr >= net->num_bts) {
791 vty_out(vty, "%% can't find BTS %s%s", argv[0],
792 VTY_NEWLINE);
793 return CMD_WARNING;
794 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200795 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000796 }
797 if (argc >= 2) {
798 trx_nr = atoi(argv[1]);
799 if (trx_nr >= bts->num_trx) {
800 vty_out(vty, "%% can't find TRX %s%s", argv[1],
801 VTY_NEWLINE);
802 return CMD_WARNING;
803 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200804 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000805 }
806 if (argc >= 3) {
807 ts_nr = atoi(argv[2]);
808 if (ts_nr >= TRX_NR_TS) {
809 vty_out(vty, "%% can't find TS %s%s", argv[2],
810 VTY_NEWLINE);
811 return CMD_WARNING;
812 }
813 ts = &trx->ts[ts_nr];
814 }
815 if (argc >= 4) {
816 lchan_nr = atoi(argv[3]);
817 if (lchan_nr >= TS_MAX_LCHAN) {
818 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
819 VTY_NEWLINE);
820 return CMD_WARNING;
821 }
822 lchan = &ts->lchan[lchan_nr];
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800823 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000824 return CMD_SUCCESS;
825 }
826 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200827 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000828 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200829 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000830 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
831 ts = &trx->ts[ts_nr];
832 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
833 lchan_nr++) {
834 lchan = &ts->lchan[lchan_nr];
Harald Welteef235b52009-03-10 12:34:02 +0000835 if (lchan->type == GSM_LCHAN_NONE)
836 continue;
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800837 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000838 }
839 }
840 }
841 }
842
843 return CMD_SUCCESS;
844}
845
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800846
847DEFUN(show_lchan,
848 show_lchan_cmd,
849 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
850 SHOW_STR "Display information about a logical channel\n"
851 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
852 "Logical Channel Number\n")
853
854{
855 return lchan_summary(vty, argc, argv, lchan_dump_full_vty);
856}
857
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800858DEFUN(show_lchan_summary,
859 show_lchan_summary_cmd,
860 "show lchan summary [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
861 SHOW_STR "Display information about a logical channel\n"
862 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
863 "Logical Channel Number\n")
864{
865 return lchan_summary(vty, argc, argv, lchan_dump_short_vty);
866}
867
Harald Welte1bc77352009-03-10 19:47:51 +0000868static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
869{
870 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
871}
872
873DEFUN(show_e1drv,
874 show_e1drv_cmd,
875 "show e1_driver",
876 SHOW_STR "Display information about available E1 drivers\n")
877{
878 struct e1inp_driver *drv;
879
880 llist_for_each_entry(drv, &e1inp_driver_list, list)
881 e1drv_dump_vty(vty, drv);
882
883 return CMD_SUCCESS;
884}
885
Harald Welte68628e82009-03-10 12:17:57 +0000886static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
887{
888 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
889 line->num, line->name ? line->name : "",
890 line->driver->name, VTY_NEWLINE);
891}
892
893DEFUN(show_e1line,
894 show_e1line_cmd,
895 "show e1_line [line_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200896 SHOW_STR "Display information about a E1 line\n"
897 "E1 Line Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000898{
Harald Welte1bc77352009-03-10 19:47:51 +0000899 struct e1inp_line *line;
900
901 if (argc >= 1) {
902 int num = atoi(argv[0]);
903 llist_for_each_entry(line, &e1inp_line_list, list) {
904 if (line->num == num) {
905 e1line_dump_vty(vty, line);
906 return CMD_SUCCESS;
907 }
908 }
909 return CMD_WARNING;
910 }
911
912 llist_for_each_entry(line, &e1inp_line_list, list)
913 e1line_dump_vty(vty, line);
914
915 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000916}
917
918static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
919{
Harald Welte42581822009-08-08 16:12:58 +0200920 if (ts->type == E1INP_TS_TYPE_NONE)
921 return;
Harald Welte1bc77352009-03-10 19:47:51 +0000922 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
923 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
924 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000925}
926
927DEFUN(show_e1ts,
928 show_e1ts_cmd,
929 "show e1_timeslot [line_nr] [ts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200930 SHOW_STR "Display information about a E1 timeslot\n"
931 "E1 Line Number\n" "E1 Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000932{
Harald Welte986c3d72009-11-17 06:12:16 +0100933 struct e1inp_line *line = NULL;
Harald Welte1bc77352009-03-10 19:47:51 +0000934 struct e1inp_ts *ts;
935 int ts_nr;
Harald Welte68628e82009-03-10 12:17:57 +0000936
Harald Welte1bc77352009-03-10 19:47:51 +0000937 if (argc == 0) {
938 llist_for_each_entry(line, &e1inp_line_list, list) {
939 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
940 ts = &line->ts[ts_nr];
941 e1ts_dump_vty(vty, ts);
942 }
943 }
944 return CMD_SUCCESS;
945 }
946 if (argc >= 1) {
947 int num = atoi(argv[0]);
948 llist_for_each_entry(line, &e1inp_line_list, list) {
949 if (line->num == num)
950 break;
951 }
952 if (!line || line->num != num) {
953 vty_out(vty, "E1 line %s is invalid%s",
954 argv[0], VTY_NEWLINE);
955 return CMD_WARNING;
956 }
957 }
958 if (argc >= 2) {
959 ts_nr = atoi(argv[1]);
960 if (ts_nr > NUM_E1_TS) {
961 vty_out(vty, "E1 timeslot %s is invalid%s",
962 argv[1], VTY_NEWLINE);
963 return CMD_WARNING;
964 }
965 ts = &line->ts[ts_nr];
966 e1ts_dump_vty(vty, ts);
967 return CMD_SUCCESS;
968 } else {
969 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
970 ts = &line->ts[ts_nr];
971 e1ts_dump_vty(vty, ts);
972 }
973 return CMD_SUCCESS;
974 }
975 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000976}
977
Harald Weltebe4b7302009-05-23 16:59:33 +0000978static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
Harald Weltef5025b62009-03-28 16:55:11 +0000979{
980 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
981 subscr_dump_vty(vty, pag->subscr);
982}
983
Harald Weltebe4b7302009-05-23 16:59:33 +0000984static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
Harald Weltef5025b62009-03-28 16:55:11 +0000985{
986 struct gsm_paging_request *pag;
987
988 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
989 paging_dump_vty(vty, pag);
990}
991
992DEFUN(show_paging,
993 show_paging_cmd,
994 "show paging [bts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200995 SHOW_STR "Display information about paging reuqests of a BTS\n"
996 "BTS Number\n")
Harald Weltef5025b62009-03-28 16:55:11 +0000997{
Harald Weltedcccb182010-05-16 20:52:23 +0200998 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Weltef5025b62009-03-28 16:55:11 +0000999 struct gsm_bts *bts;
1000 int bts_nr;
1001
1002 if (argc >= 1) {
1003 /* use the BTS number that the user has specified */
1004 bts_nr = atoi(argv[0]);
1005 if (bts_nr >= net->num_bts) {
1006 vty_out(vty, "%% can't find BTS %s%s", argv[0],
1007 VTY_NEWLINE);
1008 return CMD_WARNING;
1009 }
Harald Weltee441d9c2009-06-21 16:17:15 +02001010 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001011 bts_paging_dump_vty(vty, bts);
1012
1013 return CMD_SUCCESS;
1014 }
1015 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +02001016 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001017 bts_paging_dump_vty(vty, bts);
1018 }
1019
1020 return CMD_SUCCESS;
1021}
1022
Harald Welte8f0ed552010-05-11 21:53:49 +02001023#define NETWORK_STR "Configure the GSM network\n"
1024
Harald Welte5013b2a2009-08-07 13:29:14 +02001025DEFUN(cfg_net,
1026 cfg_net_cmd,
Harald Welte8f0ed552010-05-11 21:53:49 +02001027 "network", NETWORK_STR)
Harald Welte5013b2a2009-08-07 13:29:14 +02001028{
Harald Weltedcccb182010-05-16 20:52:23 +02001029 vty->index = gsmnet_from_vty(vty);
Harald Welte5013b2a2009-08-07 13:29:14 +02001030 vty->node = GSMNET_NODE;
1031
1032 return CMD_SUCCESS;
1033}
1034
1035
1036DEFUN(cfg_net_ncc,
1037 cfg_net_ncc_cmd,
1038 "network country code <1-999>",
1039 "Set the GSM network country code")
1040{
Harald Weltedcccb182010-05-16 20:52:23 +02001041 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1042
Harald Welte5013b2a2009-08-07 13:29:14 +02001043 gsmnet->country_code = atoi(argv[0]);
1044
1045 return CMD_SUCCESS;
1046}
1047
1048DEFUN(cfg_net_mnc,
1049 cfg_net_mnc_cmd,
1050 "mobile network code <1-999>",
1051 "Set the GSM mobile network code")
1052{
Harald Weltedcccb182010-05-16 20:52:23 +02001053 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1054
Harald Welte5013b2a2009-08-07 13:29:14 +02001055 gsmnet->network_code = atoi(argv[0]);
1056
1057 return CMD_SUCCESS;
1058}
1059
1060DEFUN(cfg_net_name_short,
1061 cfg_net_name_short_cmd,
1062 "short name NAME",
1063 "Set the short GSM network name")
1064{
Harald Weltedcccb182010-05-16 20:52:23 +02001065 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1066
Holger Hans Peter Freyther3e9a7f82010-10-12 23:21:54 +02001067 bsc_replace_string(gsmnet, &gsmnet->name_short, argv[0]);
Harald Welte5013b2a2009-08-07 13:29:14 +02001068 return CMD_SUCCESS;
1069}
1070
1071DEFUN(cfg_net_name_long,
1072 cfg_net_name_long_cmd,
1073 "long name NAME",
1074 "Set the long GSM network name")
1075{
Harald Weltedcccb182010-05-16 20:52:23 +02001076 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1077
Holger Hans Peter Freyther3e9a7f82010-10-12 23:21:54 +02001078 bsc_replace_string(gsmnet, &gsmnet->name_long, argv[0]);
Harald Welte5013b2a2009-08-07 13:29:14 +02001079 return CMD_SUCCESS;
1080}
Harald Welte40f82892009-05-23 17:31:39 +00001081
Harald Welte (local)69de3972009-08-12 14:42:23 +02001082DEFUN(cfg_net_auth_policy,
1083 cfg_net_auth_policy_cmd,
1084 "auth policy (closed|accept-all|token)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001085 "Authentication (not cryptographic)\n"
1086 "Set the GSM network authentication policy\n"
1087 "Require the MS to be activated in HLR\n"
1088 "Accept all MS, whether in HLR or not\n"
1089 "Use SMS-token based authentication\n")
Harald Welte (local)69de3972009-08-12 14:42:23 +02001090{
1091 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001092 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte (local)69de3972009-08-12 14:42:23 +02001093
1094 gsmnet->auth_policy = policy;
1095
1096 return CMD_SUCCESS;
1097}
1098
Harald Welte1085c092009-11-18 20:33:19 +01001099DEFUN(cfg_net_reject_cause,
1100 cfg_net_reject_cause_cmd,
1101 "location updating reject cause <2-111>",
1102 "Set the reject cause of location updating reject\n")
1103{
Harald Weltedcccb182010-05-16 20:52:23 +02001104 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1105
Harald Welte1085c092009-11-18 20:33:19 +01001106 gsmnet->reject_cause = atoi(argv[0]);
1107
1108 return CMD_SUCCESS;
1109}
1110
Harald Welte4381cfe2009-08-30 15:47:06 +09001111DEFUN(cfg_net_encryption,
1112 cfg_net_encryption_cmd,
1113 "encryption a5 (0|1|2)",
Harald Welte28326062010-05-14 20:05:17 +02001114 "Encryption options\n"
1115 "A5 encryption\n" "A5/0: No encryption\n"
1116 "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n")
Harald Welte4381cfe2009-08-30 15:47:06 +09001117{
Harald Weltedcccb182010-05-16 20:52:23 +02001118 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1119
Andreas.Eversberg1059deb2009-11-17 09:55:26 +01001120 gsmnet->a5_encryption= atoi(argv[0]);
Harald Welte4381cfe2009-08-30 15:47:06 +09001121
1122 return CMD_SUCCESS;
1123}
1124
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001125DEFUN(cfg_net_neci,
1126 cfg_net_neci_cmd,
1127 "neci (0|1)",
Harald Welte28326062010-05-14 20:05:17 +02001128 "New Establish Cause Indication\n"
1129 "Don't set the NECI bit\n" "Set the NECI bit\n")
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001130{
Harald Weltedcccb182010-05-16 20:52:23 +02001131 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1132
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001133 gsmnet->neci = atoi(argv[0]);
Holger Hans Peter Freyther78891072010-09-06 09:36:02 +08001134 gsm_net_update_ctype(gsmnet);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001135 return CMD_SUCCESS;
1136}
1137
Harald Welteeab84a12009-12-13 10:53:12 +01001138DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1139 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001140 "Radio Resource Location Protocol\n"
1141 "Set the Radio Resource Location Protocol Mode\n"
1142 "Don't send RRLP request\n"
1143 "Request MS-based location\n"
1144 "Request any location, prefer MS-based\n"
1145 "Request any location, prefer MS-assisted\n")
Harald Welteeab84a12009-12-13 10:53:12 +01001146{
Harald Weltedcccb182010-05-16 20:52:23 +02001147 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1148
Harald Welteeab84a12009-12-13 10:53:12 +01001149 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1150
1151 return CMD_SUCCESS;
1152}
1153
Harald Welte648b6ce2009-12-14 09:00:24 +01001154DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1155 "mm info (0|1)",
1156 "Whether to send MM INFO after LOC UPD ACCEPT")
1157{
Harald Weltedcccb182010-05-16 20:52:23 +02001158 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1159
Harald Welte648b6ce2009-12-14 09:00:24 +01001160 gsmnet->send_mm_info = atoi(argv[0]);
1161
1162 return CMD_SUCCESS;
1163}
1164
Harald Welte8f0ed552010-05-11 21:53:49 +02001165#define HANDOVER_STR "Handover Options\n"
1166
Harald Weltebc814502009-12-19 21:41:52 +01001167DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1168 "handover (0|1)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001169 HANDOVER_STR
1170 "Don't perform in-call handover\n"
1171 "Perform in-call handover\n")
Harald Weltebc814502009-12-19 21:41:52 +01001172{
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001173 int enable = atoi(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001174 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001175
1176 if (enable && ipacc_rtp_direct) {
Harald Weltefe03f0d2009-12-20 13:51:01 +01001177 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1178 "is enabled by using the -P command line option%s",
1179 VTY_NEWLINE);
1180 return CMD_WARNING;
1181 }
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001182 gsmnet->handover.active = enable;
Harald Weltebc814502009-12-19 21:41:52 +01001183
1184 return CMD_SUCCESS;
1185}
1186
Harald Welte8f0ed552010-05-11 21:53:49 +02001187#define HO_WIN_STR HANDOVER_STR "Measurement Window\n"
1188#define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n"
1189#define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n"
1190#define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n"
1191
Harald Welteb720bd32009-12-21 16:51:50 +01001192DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1193 "handover window rxlev averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001194 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001195 "How many RxLev measurements are used for averaging")
1196{
Harald Weltedcccb182010-05-16 20:52:23 +02001197 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001198 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1199 return CMD_SUCCESS;
1200}
1201
1202DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1203 "handover window rxqual averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001204 HO_WIN_RXQUAL_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001205 "How many RxQual measurements are used for averaging")
1206{
Harald Weltedcccb182010-05-16 20:52:23 +02001207 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001208 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1209 return CMD_SUCCESS;
1210}
1211
1212DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1213 "handover window rxlev neighbor averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001214 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001215 "How many RxQual measurements are used for averaging")
1216{
Harald Weltedcccb182010-05-16 20:52:23 +02001217 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001218 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1219 return CMD_SUCCESS;
1220}
1221
1222DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1223 "handover power budget interval <1-99>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001224 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001225 "How often to check if we have a better cell (SACCH frames)")
1226{
Harald Weltedcccb182010-05-16 20:52:23 +02001227 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001228 gsmnet->handover.pwr_interval = atoi(argv[0]);
1229 return CMD_SUCCESS;
1230}
1231
1232DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1233 "handover power budget hysteresis <0-999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001234 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001235 "How many dB does a neighbor to be stronger to become a HO candidate")
1236{
Harald Weltedcccb182010-05-16 20:52:23 +02001237 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001238 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1239 return CMD_SUCCESS;
1240}
1241
1242DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1243 "handover maximum distance <0-9999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001244 HANDOVER_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001245 "How big is the maximum timing advance before HO is forced")
1246{
Harald Weltedcccb182010-05-16 20:52:23 +02001247 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001248 gsmnet->handover.max_distance = atoi(argv[0]);
1249 return CMD_SUCCESS;
1250}
Harald Weltebc814502009-12-19 21:41:52 +01001251
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001252DEFUN(cfg_net_pag_any_tch,
1253 cfg_net_pag_any_tch_cmd,
1254 "paging any use tch (0|1)",
1255 "Assign a TCH when receiving a Paging Any request")
1256{
Holger Hans Peter Freytherb0e88b82010-09-06 10:09:19 +08001257 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001258 gsmnet->pag_any_tch = atoi(argv[0]);
1259 gsm_net_update_ctype(gsmnet);
1260 return CMD_SUCCESS;
1261}
1262
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001263#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001264 DEFUN(cfg_net_T##number, \
1265 cfg_net_T##number##_cmd, \
1266 "timer t" #number " <0-65535>", \
Harald Welte8f0ed552010-05-11 21:53:49 +02001267 "Configure GSM Timers\n" \
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001268 doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001269{ \
Harald Weltedcccb182010-05-16 20:52:23 +02001270 struct gsm_network *gsmnet = gsmnet_from_vty(vty); \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001271 int value = atoi(argv[0]); \
1272 \
1273 if (value < 0 || value > 65535) { \
1274 vty_out(vty, "Timer value %s out of range.%s", \
1275 argv[0], VTY_NEWLINE); \
1276 return CMD_WARNING; \
1277 } \
1278 \
1279 gsmnet->T##number = value; \
1280 return CMD_SUCCESS; \
1281}
1282
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001283DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1284DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1285DECLARE_TIMER(3105, "Currently not used.")
1286DECLARE_TIMER(3107, "Currently not used.")
1287DECLARE_TIMER(3109, "Currently not used.")
Holger Hans Peter Freytherf30c0dc2010-05-31 21:33:15 +08001288DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel.")
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001289DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1290DECLARE_TIMER(3115, "Currently not used.")
1291DECLARE_TIMER(3117, "Currently not used.")
1292DECLARE_TIMER(3119, "Currently not used.")
1293DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001294
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08001295DEFUN(cfg_net_dtx,
1296 cfg_net_dtx_cmd,
1297 "dtx-used (0|1)",
1298 "Enable the usage of DTX.\n"
1299 "DTX is enabled/disabled")
1300{
1301 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1302 gsmnet->dtx_enabled = atoi(argv[0]);
1303 return CMD_SUCCESS;
1304}
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001305
Harald Welte5258fc42009-03-28 19:07:53 +00001306/* per-BTS configuration */
1307DEFUN(cfg_bts,
1308 cfg_bts_cmd,
1309 "bts BTS_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02001310 "Select a BTS to configure\n"
1311 "BTS Number\n")
Harald Welte5258fc42009-03-28 19:07:53 +00001312{
Harald Weltedcccb182010-05-16 20:52:23 +02001313 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte5258fc42009-03-28 19:07:53 +00001314 int bts_nr = atoi(argv[0]);
1315 struct gsm_bts *bts;
1316
Harald Weltee441d9c2009-06-21 16:17:15 +02001317 if (bts_nr > gsmnet->num_bts) {
1318 vty_out(vty, "%% The next unused BTS number is %u%s",
1319 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001320 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001321 } else if (bts_nr == gsmnet->num_bts) {
1322 /* allocate a new one */
1323 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1324 HARDCODED_TSC, HARDCODED_BSIC);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001325 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02001326 bts = gsm_bts_num(gsmnet, bts_nr);
1327
Daniel Willmannf15c2762010-01-11 13:43:07 +01001328 if (!bts) {
1329 vty_out(vty, "%% Unable to allocate BTS %u%s",
1330 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee441d9c2009-06-21 16:17:15 +02001331 return CMD_WARNING;
Daniel Willmannf15c2762010-01-11 13:43:07 +01001332 }
Harald Welte5258fc42009-03-28 19:07:53 +00001333
1334 vty->index = bts;
Harald Welte197dea92010-05-14 17:59:53 +02001335 vty->index_sub = &bts->description;
Harald Welte5258fc42009-03-28 19:07:53 +00001336 vty->node = BTS_NODE;
1337
1338 return CMD_SUCCESS;
1339}
1340
1341DEFUN(cfg_bts_type,
1342 cfg_bts_type_cmd,
1343 "type TYPE",
1344 "Set the BTS type\n")
1345{
1346 struct gsm_bts *bts = vty->index;
Harald Welte39315c42010-01-10 18:01:52 +01001347 int rc;
Harald Welte5258fc42009-03-28 19:07:53 +00001348
Harald Welte39315c42010-01-10 18:01:52 +01001349 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1350 if (rc < 0)
1351 return CMD_WARNING;
Harald Welte8175e952009-10-20 00:22:00 +02001352
Harald Welte5258fc42009-03-28 19:07:53 +00001353 return CMD_SUCCESS;
1354}
1355
Harald Weltefcd24452009-06-20 18:15:19 +02001356DEFUN(cfg_bts_band,
1357 cfg_bts_band_cmd,
1358 "band BAND",
1359 "Set the frequency band of this BTS\n")
1360{
1361 struct gsm_bts *bts = vty->index;
Harald Welte42581822009-08-08 16:12:58 +02001362 int band = gsm_band_parse(argv[0]);
Harald Weltefcd24452009-06-20 18:15:19 +02001363
1364 if (band < 0) {
1365 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1366 band, VTY_NEWLINE);
1367 return CMD_WARNING;
1368 }
1369
1370 bts->band = band;
1371
1372 return CMD_SUCCESS;
1373}
1374
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001375DEFUN(cfg_bts_ci,
1376 cfg_bts_ci_cmd,
1377 "cell_identity <0-65535>",
1378 "Set the Cell identity of this BTS\n")
1379{
1380 struct gsm_bts *bts = vty->index;
1381 int ci = atoi(argv[0]);
1382
1383 if (ci < 0 || ci > 0xffff) {
1384 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1385 ci, VTY_NEWLINE);
1386 return CMD_WARNING;
1387 }
1388 bts->cell_identity = ci;
1389
1390 return CMD_SUCCESS;
1391}
1392
Harald Welte5258fc42009-03-28 19:07:53 +00001393DEFUN(cfg_bts_lac,
1394 cfg_bts_lac_cmd,
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001395 "location_area_code <0-65535>",
Harald Welte5258fc42009-03-28 19:07:53 +00001396 "Set the Location Area Code (LAC) of this BTS\n")
1397{
1398 struct gsm_bts *bts = vty->index;
1399 int lac = atoi(argv[0]);
1400
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001401 if (lac < 0 || lac > 0xffff) {
1402 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte5258fc42009-03-28 19:07:53 +00001403 lac, VTY_NEWLINE);
1404 return CMD_WARNING;
1405 }
Holger Hans Peter Freythere48b9562009-10-01 04:07:15 +02001406
1407 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1408 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1409 lac, VTY_NEWLINE);
1410 return CMD_WARNING;
1411 }
1412
Harald Welte5258fc42009-03-28 19:07:53 +00001413 bts->location_area_code = lac;
1414
1415 return CMD_SUCCESS;
1416}
1417
Harald Weltea43f7892009-12-01 18:04:30 +05301418
Harald Welte5258fc42009-03-28 19:07:53 +00001419DEFUN(cfg_bts_tsc,
1420 cfg_bts_tsc_cmd,
1421 "training_sequence_code <0-255>",
1422 "Set the Training Sequence Code (TSC) of this BTS\n")
1423{
1424 struct gsm_bts *bts = vty->index;
1425 int tsc = atoi(argv[0]);
1426
1427 if (tsc < 0 || tsc > 0xff) {
1428 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1429 tsc, VTY_NEWLINE);
1430 return CMD_WARNING;
1431 }
1432 bts->tsc = tsc;
1433
1434 return CMD_SUCCESS;
1435}
1436
Harald Welte78f2f502009-05-23 16:56:52 +00001437DEFUN(cfg_bts_bsic,
1438 cfg_bts_bsic_cmd,
1439 "base_station_id_code <0-63>",
1440 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1441{
1442 struct gsm_bts *bts = vty->index;
1443 int bsic = atoi(argv[0]);
1444
1445 if (bsic < 0 || bsic > 0x3f) {
Harald Welte42581822009-08-08 16:12:58 +02001446 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte78f2f502009-05-23 16:56:52 +00001447 bsic, VTY_NEWLINE);
1448 return CMD_WARNING;
1449 }
1450 bts->bsic = bsic;
1451
1452 return CMD_SUCCESS;
1453}
1454
1455
Harald Welte4cc34222009-05-01 15:12:31 +00001456DEFUN(cfg_bts_unit_id,
1457 cfg_bts_unit_id_cmd,
Harald Welte07dc73d2009-08-07 13:27:09 +02001458 "ip.access unit_id <0-65534> <0-255>",
1459 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte4cc34222009-05-01 15:12:31 +00001460{
1461 struct gsm_bts *bts = vty->index;
1462 int site_id = atoi(argv[0]);
1463 int bts_id = atoi(argv[1]);
1464
Harald Welte07dc73d2009-08-07 13:27:09 +02001465 if (!is_ipaccess_bts(bts)) {
1466 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1467 return CMD_WARNING;
1468 }
1469
Harald Welte4cc34222009-05-01 15:12:31 +00001470 bts->ip_access.site_id = site_id;
1471 bts->ip_access.bts_id = bts_id;
1472
1473 return CMD_SUCCESS;
1474}
1475
Harald Welte8f0ed552010-05-11 21:53:49 +02001476#define OML_STR "Organization & Maintenance Link\n"
1477#define IPA_STR "ip.access Specific Options\n"
1478
Harald Welte8175e952009-10-20 00:22:00 +02001479DEFUN(cfg_bts_stream_id,
1480 cfg_bts_stream_id_cmd,
1481 "oml ip.access stream_id <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001482 OML_STR IPA_STR
Harald Welte8175e952009-10-20 00:22:00 +02001483 "Set the ip.access Stream ID of the OML link of this BTS\n")
1484{
1485 struct gsm_bts *bts = vty->index;
1486 int stream_id = atoi(argv[0]);
1487
1488 if (!is_ipaccess_bts(bts)) {
1489 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1490 return CMD_WARNING;
1491 }
1492
1493 bts->oml_tei = stream_id;
1494
1495 return CMD_SUCCESS;
1496}
1497
Harald Welte8f0ed552010-05-11 21:53:49 +02001498#define OML_E1_STR OML_STR "E1 Line\n"
Harald Welte8175e952009-10-20 00:22:00 +02001499
Harald Welte42581822009-08-08 16:12:58 +02001500DEFUN(cfg_bts_oml_e1,
1501 cfg_bts_oml_e1_cmd,
1502 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001503 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001504 "E1 interface to be used for OML\n")
1505{
1506 struct gsm_bts *bts = vty->index;
1507
1508 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1509
1510 return CMD_SUCCESS;
1511}
1512
1513
1514DEFUN(cfg_bts_oml_e1_tei,
1515 cfg_bts_oml_e1_tei_cmd,
1516 "oml e1 tei <0-63>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001517 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001518 "Set the TEI to be used for OML")
1519{
1520 struct gsm_bts *bts = vty->index;
1521
1522 bts->oml_tei = atoi(argv[0]);
1523
1524 return CMD_SUCCESS;
1525}
1526
Harald Welte7a8fa412009-08-10 13:48:16 +02001527DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1528 "channel allocator (ascending|descending)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001529 "Channnel Allocator\n" "Channel Allocator\n"
1530 "Allocate Timeslots and Transceivers in ascending order\n"
1531 "Allocate Timeslots and Transceivers in descending order\n")
Harald Welte7a8fa412009-08-10 13:48:16 +02001532{
1533 struct gsm_bts *bts = vty->index;
1534
1535 if (!strcmp(argv[0], "ascending"))
1536 bts->chan_alloc_reverse = 0;
1537 else
1538 bts->chan_alloc_reverse = 1;
1539
1540 return CMD_SUCCESS;
1541}
1542
Harald Welte8f0ed552010-05-11 21:53:49 +02001543#define RACH_STR "Random Access Control Channel\n"
1544
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001545DEFUN(cfg_bts_rach_tx_integer,
1546 cfg_bts_rach_tx_integer_cmd,
1547 "rach tx integer <0-15>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001548 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001549 "Set the raw tx integer value in RACH Control parameters IE")
1550{
1551 struct gsm_bts *bts = vty->index;
1552 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1553 return CMD_SUCCESS;
1554}
1555
1556DEFUN(cfg_bts_rach_max_trans,
1557 cfg_bts_rach_max_trans_cmd,
1558 "rach max transmission (1|2|4|7)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001559 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001560 "Set the maximum number of RACH burst transmissions")
1561{
1562 struct gsm_bts *bts = vty->index;
1563 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1564 return CMD_SUCCESS;
1565}
1566
Harald Welte8f0ed552010-05-11 21:53:49 +02001567#define NM_STR "Network Management\n"
1568
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001569DEFUN(cfg_bts_rach_nm_b_thresh,
1570 cfg_bts_rach_nm_b_thresh_cmd,
1571 "rach nm busy threshold <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001572 RACH_STR NM_STR
1573 "Set the NM Busy Threshold in dB")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001574{
1575 struct gsm_bts *bts = vty->index;
1576 bts->rach_b_thresh = atoi(argv[0]);
1577 return CMD_SUCCESS;
1578}
1579
1580DEFUN(cfg_bts_rach_nm_ldavg,
1581 cfg_bts_rach_nm_ldavg_cmd,
1582 "rach nm load average <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001583 RACH_STR NM_STR
1584 "Set the NM Loadaverage Slots value")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001585{
1586 struct gsm_bts *bts = vty->index;
1587 bts->rach_ldavg_slots = atoi(argv[0]);
1588 return CMD_SUCCESS;
1589}
1590
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001591DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1592 "cell barred (0|1)",
1593 "Should this cell be barred from access?")
1594{
1595 struct gsm_bts *bts = vty->index;
1596
Harald Welte71355012009-12-21 23:08:18 +01001597 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001598
1599 return CMD_SUCCESS;
1600}
1601
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08001602DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd,
1603 "rach emergency call allowed (0|1)",
1604 "Should this cell allow emergency calls?")
1605{
1606 struct gsm_bts *bts = vty->index;
1607
1608 if (atoi(argv[0]) == 0)
1609 bts->si_common.rach_control.t2 |= 0x4;
1610 else
1611 bts->si_common.rach_control.t2 &= ~0x4;
1612
1613 return CMD_SUCCESS;
1614}
1615
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001616DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1617 "ms max power <0-40>",
1618 "Maximum transmit power of the MS")
1619{
1620 struct gsm_bts *bts = vty->index;
1621
1622 bts->ms_max_power = atoi(argv[0]);
1623
1624 return CMD_SUCCESS;
1625}
1626
Harald Welte73225282009-12-12 18:17:25 +01001627DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1628 "cell reselection hysteresis <0-14>",
1629 "Cell Re-Selection Hysteresis in dB")
1630{
1631 struct gsm_bts *bts = vty->index;
1632
1633 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1634
1635 return CMD_SUCCESS;
1636}
1637
1638DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1639 "rxlev access min <0-63>",
1640 "Minimum RxLev needed for cell access (better than -110dBm)")
1641{
1642 struct gsm_bts *bts = vty->index;
1643
1644 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1645
1646 return CMD_SUCCESS;
1647}
1648
Harald Welte (local)efc92312009-08-14 23:09:25 +02001649DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1650 "periodic location update <0-1530>",
1651 "Periodic Location Updating Interval in Minutes")
1652{
1653 struct gsm_bts *bts = vty->index;
1654
Dieter Spaard6613e02010-10-05 21:10:55 +02001655 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 6;
Harald Welte (local)efc92312009-08-14 23:09:25 +02001656
1657 return CMD_SUCCESS;
1658}
1659
Harald Welte8f0ed552010-05-11 21:53:49 +02001660#define GPRS_TEXT "GPRS Packet Network\n"
1661
Harald Welteaf387632010-03-14 23:30:30 +08001662DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welte57ba7e32010-04-18 14:00:26 +02001663 "gprs cell bvci <2-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001664 GPRS_TEXT
1665 "GPRS Cell Settings\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001666 "GPRS BSSGP VC Identifier")
1667{
1668 struct gsm_bts *bts = vty->index;
1669
Harald Welte4511d892010-04-18 15:51:20 +02001670 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001671 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1672 return CMD_WARNING;
1673 }
1674
Harald Welte97a282b2010-03-14 15:37:43 +08001675 bts->gprs.cell.bvci = atoi(argv[0]);
1676
1677 return CMD_SUCCESS;
1678}
1679
Harald Weltea5731cf2010-03-22 11:48:36 +08001680DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
1681 "gprs nsei <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001682 GPRS_TEXT
Harald Weltea5731cf2010-03-22 11:48:36 +08001683 "GPRS NS Entity Identifier")
1684{
1685 struct gsm_bts *bts = vty->index;
1686
Harald Welte4511d892010-04-18 15:51:20 +02001687 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltea5731cf2010-03-22 11:48:36 +08001688 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1689 return CMD_WARNING;
1690 }
1691
1692 bts->gprs.nse.nsei = atoi(argv[0]);
1693
1694 return CMD_SUCCESS;
1695}
1696
Harald Welte8f0ed552010-05-11 21:53:49 +02001697#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
1698 "NSVC Logical Number\n"
Harald Weltea5731cf2010-03-22 11:48:36 +08001699
Harald Welte97a282b2010-03-14 15:37:43 +08001700DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
1701 "gprs nsvc <0-1> nsvci <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001702 GPRS_TEXT NSVC_TEXT
1703 "NS Virtual Connection Identifier\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001704 "GPRS NS VC Identifier")
1705{
1706 struct gsm_bts *bts = vty->index;
1707 int idx = atoi(argv[0]);
1708
Harald Welte4511d892010-04-18 15:51:20 +02001709 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001710 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1711 return CMD_WARNING;
1712 }
1713
Harald Welte97a282b2010-03-14 15:37:43 +08001714 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
1715
1716 return CMD_SUCCESS;
1717}
1718
Harald Welteaf387632010-03-14 23:30:30 +08001719DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
1720 "gprs nsvc <0-1> local udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001721 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001722 "GPRS NS Local UDP Port")
1723{
1724 struct gsm_bts *bts = vty->index;
1725 int idx = atoi(argv[0]);
1726
Harald Welte4511d892010-04-18 15:51:20 +02001727 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001728 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1729 return CMD_WARNING;
1730 }
1731
Harald Welteaf387632010-03-14 23:30:30 +08001732 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
1733
1734 return CMD_SUCCESS;
1735}
1736
1737DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
1738 "gprs nsvc <0-1> remote udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001739 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001740 "GPRS NS Remote UDP Port")
1741{
1742 struct gsm_bts *bts = vty->index;
1743 int idx = atoi(argv[0]);
1744
Harald Welte4511d892010-04-18 15:51:20 +02001745 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001746 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1747 return CMD_WARNING;
1748 }
1749
Harald Welteaf387632010-03-14 23:30:30 +08001750 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
1751
1752 return CMD_SUCCESS;
1753}
1754
1755DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
1756 "gprs nsvc <0-1> remote ip A.B.C.D",
Harald Welte8f0ed552010-05-11 21:53:49 +02001757 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001758 "GPRS NS Remote IP Address")
1759{
1760 struct gsm_bts *bts = vty->index;
1761 int idx = atoi(argv[0]);
1762 struct in_addr ia;
1763
Harald Welte4511d892010-04-18 15:51:20 +02001764 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001765 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1766 return CMD_WARNING;
1767 }
1768
Harald Welteaf387632010-03-14 23:30:30 +08001769 inet_aton(argv[1], &ia);
1770 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
1771
1772 return CMD_SUCCESS;
1773}
1774
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08001775DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd,
1776 "paging free FREE_NR",
1777 "Only page when having a certain amount of free slots. -1 to disable")
1778{
1779 struct gsm_bts *bts = vty->index;
1780
1781 bts->paging.free_chans_need = atoi(argv[0]);
1782 return CMD_SUCCESS;
1783}
1784
Harald Welte615e9562010-05-11 23:50:21 +02001785DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd,
1786 "gprs ns timer " NS_TIMERS " <0-255>",
1787 GPRS_TEXT "Network Service\n"
1788 "Network Service Timer\n"
1789 NS_TIMERS_HELP "Timer Value\n")
1790{
1791 struct gsm_bts *bts = vty->index;
1792 int idx = get_string_value(gprs_ns_timer_strs, argv[0]);
1793 int val = atoi(argv[1]);
1794
1795 if (bts->gprs.mode == BTS_GPRS_NONE) {
1796 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1797 return CMD_WARNING;
1798 }
1799
1800 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
1801 return CMD_WARNING;
1802
1803 bts->gprs.nse.timer[idx] = val;
1804
1805 return CMD_SUCCESS;
1806}
1807
1808#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 +02001809#define BSSGP_TIMERS_HELP \
1810 "Tbvc-block timeout\n" \
1811 "Tbvc-block retries\n" \
1812 "Tbvc-unblock retries\n" \
1813 "Tbvcc-reset timeout\n" \
1814 "Tbvc-reset retries\n" \
1815 "Tbvc-suspend timeout\n" \
1816 "Tbvc-suspend retries\n" \
1817 "Tbvc-resume timeout\n" \
1818 "Tbvc-resume retries\n" \
1819 "Tbvc-capa-update timeout\n" \
1820 "Tbvc-capa-update retries\n"
Harald Welte615e9562010-05-11 23:50:21 +02001821
1822DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd,
1823 "gprs cell timer " BSSGP_TIMERS " <0-255>",
1824 GPRS_TEXT "Cell / BSSGP\n"
1825 "Cell/BSSGP Timer\n"
1826 BSSGP_TIMERS_HELP "Timer Value\n")
1827{
1828 struct gsm_bts *bts = vty->index;
1829 int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
1830 int val = atoi(argv[1]);
1831
1832 if (bts->gprs.mode == BTS_GPRS_NONE) {
1833 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1834 return CMD_WARNING;
1835 }
1836
1837 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer))
1838 return CMD_WARNING;
1839
1840 bts->gprs.cell.timer[idx] = val;
1841
1842 return CMD_SUCCESS;
1843}
1844
Harald Welte97a282b2010-03-14 15:37:43 +08001845DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
1846 "gprs routing area <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001847 GPRS_TEXT
Harald Welte97a282b2010-03-14 15:37:43 +08001848 "GPRS Routing Area Code")
1849{
1850 struct gsm_bts *bts = vty->index;
1851
Harald Welte4511d892010-04-18 15:51:20 +02001852 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001853 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1854 return CMD_WARNING;
1855 }
1856
Harald Welte97a282b2010-03-14 15:37:43 +08001857 bts->gprs.rac = atoi(argv[0]);
1858
1859 return CMD_SUCCESS;
1860}
1861
Harald Welte4511d892010-04-18 15:51:20 +02001862DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
1863 "gprs mode (none|gprs|egprs)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001864 GPRS_TEXT
1865 "GPRS Mode for this BTS\n"
1866 "GPRS Disabled on this BTS\n"
1867 "GPRS Enabled on this BTS\n"
1868 "EGPRS (EDGE) Enabled on this BTS\n")
Harald Welteaf387632010-03-14 23:30:30 +08001869{
1870 struct gsm_bts *bts = vty->index;
Harald Weltef3d8e922010-06-14 22:44:42 +02001871 enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0]);
Harald Welteaf387632010-03-14 23:30:30 +08001872
Harald Weltef3d8e922010-06-14 22:44:42 +02001873 if (mode != BTS_GPRS_NONE &&
1874 !gsm_bts_has_feature(bts, BTS_FEAT_GPRS)) {
1875 vty_out(vty, "This BTS type does not support %s%s", argv[0],
1876 VTY_NEWLINE);
1877 return CMD_WARNING;
1878 }
1879 if (mode == BTS_GPRS_EGPRS &&
1880 !gsm_bts_has_feature(bts, BTS_FEAT_EGPRS)) {
1881 vty_out(vty, "This BTS type does not support %s%s", argv[0],
1882 VTY_NEWLINE);
1883 return CMD_WARNING;
1884 }
1885
1886 bts->gprs.mode = mode;
Harald Welteaf387632010-03-14 23:30:30 +08001887
1888 return CMD_SUCCESS;
1889}
1890
Harald Welte9fbff4a2010-07-30 11:50:09 +02001891#define SI_TEXT "System Information Messages\n"
1892#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)"
1893#define SI_TYPE_HELP "System Information Type 1\n" \
1894 "System Information Type 2\n" \
1895 "System Information Type 3\n" \
1896 "System Information Type 4\n" \
1897 "System Information Type 5\n" \
1898 "System Information Type 6\n" \
1899 "System Information Type 7\n" \
1900 "System Information Type 8\n" \
1901 "System Information Type 9\n" \
1902 "System Information Type 10\n" \
1903 "System Information Type 13\n" \
1904 "System Information Type 16\n" \
1905 "System Information Type 17\n" \
1906 "System Information Type 18\n" \
1907 "System Information Type 19\n" \
1908 "System Information Type 20\n" \
1909 "System Information Type 2bis\n" \
1910 "System Information Type 2ter\n" \
1911 "System Information Type 2quater\n" \
1912 "System Information Type 5bis\n" \
1913 "System Information Type 5ter\n"
1914
1915DEFUN(cfg_bts_si_mode, cfg_bts_si_mode_cmd,
1916 "system-information " SI_TYPE_TEXT " mode (static|computed)",
1917 SI_TEXT SI_TYPE_HELP
1918 "System Information Mode\n"
1919 "Static user-specified\n"
1920 "Dynamic, BSC-computed\n")
1921{
1922 struct gsm_bts *bts = vty->index;
1923 int type;
1924
1925 type = get_string_value(osmo_sitype_strs, argv[0]);
1926 if (type < 0) {
1927 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
1928 return CMD_WARNING;
1929 }
1930
1931 if (!strcmp(argv[1], "static"))
1932 bts->si_mode_static |= (1 << type);
1933 else
1934 bts->si_mode_static &= ~(1 << type);
1935
1936 return CMD_SUCCESS;
1937}
1938
1939DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd,
1940 "system-information " SI_TYPE_TEXT " static HEXSTRING",
1941 SI_TEXT SI_TYPE_HELP
1942 "Static System Information filling\n"
1943 "Static user-specified SI content in HEX notation\n")
1944{
1945 struct gsm_bts *bts = vty->index;
1946 int rc, type;
1947
1948 type = get_string_value(osmo_sitype_strs, argv[0]);
1949 if (type < 0) {
1950 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
1951 return CMD_WARNING;
1952 }
1953
1954 if (!(bts->si_mode_static & (1 << type))) {
1955 vty_out(vty, "SI Type %s is not configured in static mode%s",
1956 get_value_string(osmo_sitype_strs, type), VTY_NEWLINE);
1957 return CMD_WARNING;
1958 }
1959
Harald Welte290aaed2010-07-30 11:53:18 +02001960 /* Fill buffer with padding pattern */
1961 memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type]));
1962
1963 /* Parse the user-specified SI in hex format, [partially] overwriting padding */
Harald Welte9fbff4a2010-07-30 11:50:09 +02001964 rc = hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0]));
1965 if (rc < 0 || rc > sizeof(bts->si_buf[0])) {
1966 vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
1967 return CMD_WARNING;
1968 }
1969
1970 /* Mark this SI as present */
1971 bts->si_valid |= (1 << type);
1972
1973 return CMD_SUCCESS;
1974}
1975
1976
Harald Welte8f0ed552010-05-11 21:53:49 +02001977#define TRX_TEXT "Radio Transceiver\n"
Harald Welte7a8fa412009-08-10 13:48:16 +02001978
Harald Welte5258fc42009-03-28 19:07:53 +00001979/* per TRX configuration */
1980DEFUN(cfg_trx,
1981 cfg_trx_cmd,
1982 "trx TRX_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02001983 TRX_TEXT
Harald Welte5258fc42009-03-28 19:07:53 +00001984 "Select a TRX to configure")
1985{
1986 int trx_nr = atoi(argv[0]);
1987 struct gsm_bts *bts = vty->index;
1988 struct gsm_bts_trx *trx;
1989
Harald Weltee441d9c2009-06-21 16:17:15 +02001990 if (trx_nr > bts->num_trx) {
1991 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
1992 bts->num_trx, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001993 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001994 } else if (trx_nr == bts->num_trx) {
1995 /* we need to allocate a new one */
1996 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001997 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02001998 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001999
Harald Weltee441d9c2009-06-21 16:17:15 +02002000 if (!trx)
2001 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +00002002
2003 vty->index = trx;
Harald Welte197dea92010-05-14 17:59:53 +02002004 vty->index_sub = &trx->description;
Harald Welte5258fc42009-03-28 19:07:53 +00002005 vty->node = TRX_NODE;
2006
2007 return CMD_SUCCESS;
2008}
2009
2010DEFUN(cfg_trx_arfcn,
2011 cfg_trx_arfcn_cmd,
Harald Welte93e90202010-05-14 19:00:52 +02002012 "arfcn <0-1024>",
Harald Welte5258fc42009-03-28 19:07:53 +00002013 "Set the ARFCN for this TRX\n")
2014{
2015 int arfcn = atoi(argv[0]);
2016 struct gsm_bts_trx *trx = vty->index;
2017
2018 /* FIXME: check if this ARFCN is supported by this TRX */
2019
2020 trx->arfcn = arfcn;
2021
2022 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
2023 /* FIXME: use OML layer to update the ARFCN */
2024 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
2025
2026 return CMD_SUCCESS;
2027}
2028
Harald Welte (local)7b37d972009-12-27 20:56:38 +01002029DEFUN(cfg_trx_nominal_power,
2030 cfg_trx_nominal_power_cmd,
2031 "nominal power <0-100>",
2032 "Nominal TRX RF Power in dB\n")
2033{
2034 struct gsm_bts_trx *trx = vty->index;
2035
2036 trx->nominal_power = atoi(argv[0]);
2037
2038 return CMD_SUCCESS;
2039}
2040
Harald Weltefcd24452009-06-20 18:15:19 +02002041DEFUN(cfg_trx_max_power_red,
2042 cfg_trx_max_power_red_cmd,
2043 "max_power_red <0-100>",
2044 "Reduction of maximum BS RF Power in dB\n")
2045{
2046 int maxpwr_r = atoi(argv[0]);
2047 struct gsm_bts_trx *trx = vty->index;
Harald Welte61a83b22009-11-18 09:20:22 +01002048 int upper_limit = 24; /* default 12.21 max power red. */
Harald Weltefcd24452009-06-20 18:15:19 +02002049
2050 /* FIXME: check if our BTS type supports more than 12 */
2051 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
2052 vty_out(vty, "%% Power %d dB is not in the valid range%s",
2053 maxpwr_r, VTY_NEWLINE);
2054 return CMD_WARNING;
2055 }
2056 if (maxpwr_r & 1) {
2057 vty_out(vty, "%% Power %d dB is not an even value%s",
2058 maxpwr_r, VTY_NEWLINE);
2059 return CMD_WARNING;
2060 }
2061
2062 trx->max_power_red = maxpwr_r;
2063
2064 /* FIXME: make sure we update this using OML */
2065
2066 return CMD_SUCCESS;
2067}
2068
Harald Welte42581822009-08-08 16:12:58 +02002069DEFUN(cfg_trx_rsl_e1,
2070 cfg_trx_rsl_e1_cmd,
2071 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
2072 "E1 interface to be used for RSL\n")
2073{
2074 struct gsm_bts_trx *trx = vty->index;
2075
2076 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
2077
2078 return CMD_SUCCESS;
2079}
2080
2081DEFUN(cfg_trx_rsl_e1_tei,
2082 cfg_trx_rsl_e1_tei_cmd,
2083 "rsl e1 tei <0-63>",
2084 "Set the TEI to be used for RSL")
2085{
2086 struct gsm_bts_trx *trx = vty->index;
2087
2088 trx->rsl_tei = atoi(argv[0]);
2089
2090 return CMD_SUCCESS;
2091}
2092
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01002093DEFUN(cfg_trx_rf_locked,
2094 cfg_trx_rf_locked_cmd,
2095 "rf_locked (0|1)",
2096 "Turn off RF of the TRX.\n")
2097{
2098 int locked = atoi(argv[0]);
2099 struct gsm_bts_trx *trx = vty->index;
2100
2101 gsm_trx_lock_rf(trx, locked);
2102 return CMD_SUCCESS;
2103}
Harald Welte42581822009-08-08 16:12:58 +02002104
Harald Welte5258fc42009-03-28 19:07:53 +00002105/* per TS configuration */
2106DEFUN(cfg_ts,
2107 cfg_ts_cmd,
Harald Welte42581822009-08-08 16:12:58 +02002108 "timeslot <0-7>",
Harald Welte5258fc42009-03-28 19:07:53 +00002109 "Select a Timeslot to configure")
2110{
2111 int ts_nr = atoi(argv[0]);
2112 struct gsm_bts_trx *trx = vty->index;
2113 struct gsm_bts_trx_ts *ts;
2114
2115 if (ts_nr >= TRX_NR_TS) {
2116 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
2117 TRX_NR_TS, VTY_NEWLINE);
2118 return CMD_WARNING;
2119 }
2120
2121 ts = &trx->ts[ts_nr];
2122
2123 vty->index = ts;
2124 vty->node = TS_NODE;
2125
2126 return CMD_SUCCESS;
2127}
2128
Harald Weltea6fd58e2009-08-07 00:25:23 +02002129DEFUN(cfg_ts_pchan,
2130 cfg_ts_pchan_cmd,
2131 "phys_chan_config PCHAN",
2132 "Physical Channel configuration (TCH/SDCCH/...)")
2133{
2134 struct gsm_bts_trx_ts *ts = vty->index;
2135 int pchanc;
2136
2137 pchanc = gsm_pchan_parse(argv[0]);
2138 if (pchanc < 0)
2139 return CMD_WARNING;
2140
2141 ts->pchan = pchanc;
2142
2143 return CMD_SUCCESS;
2144}
2145
Harald Weltea39b0f22010-06-14 22:26:10 +02002146#define HOPPING_STR "Configure frequency hopping\n"
2147
2148DEFUN(cfg_ts_hopping,
2149 cfg_ts_hopping_cmd,
2150 "hopping enabled (0|1)",
2151 HOPPING_STR "Enable or disable frequency hopping\n"
2152 "Disable frequency hopping\n" "Enable frequency hopping\n")
2153{
2154 struct gsm_bts_trx_ts *ts = vty->index;
Harald Weltec2fb3d02010-06-14 22:47:37 +02002155 int enabled = atoi(argv[0]);
Harald Weltea39b0f22010-06-14 22:26:10 +02002156
Harald Weltec2fb3d02010-06-14 22:47:37 +02002157 if (enabled && !gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_HOPPING)) {
2158 vty_out(vty, "BTS model does not support hopping%s",
2159 VTY_NEWLINE);
2160 return CMD_WARNING;
2161 }
2162
2163 ts->hopping.enabled = enabled;
Harald Weltea39b0f22010-06-14 22:26:10 +02002164
2165 return CMD_SUCCESS;
2166}
2167
Harald Welte6e0cd042009-09-12 13:05:33 +02002168DEFUN(cfg_ts_hsn,
2169 cfg_ts_hsn_cmd,
Harald Weltea39b0f22010-06-14 22:26:10 +02002170 "hopping sequence-number <0-63>",
2171 HOPPING_STR
Harald Welte6e0cd042009-09-12 13:05:33 +02002172 "Which hopping sequence to use for this channel")
2173{
2174 struct gsm_bts_trx_ts *ts = vty->index;
2175
2176 ts->hopping.hsn = atoi(argv[0]);
2177
2178 return CMD_SUCCESS;
2179}
2180
2181DEFUN(cfg_ts_maio,
2182 cfg_ts_maio_cmd,
2183 "hopping maio <0-63>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002184 HOPPING_STR
Harald Welte6e0cd042009-09-12 13:05:33 +02002185 "Which hopping MAIO to use for this channel")
2186{
2187 struct gsm_bts_trx_ts *ts = vty->index;
2188
2189 ts->hopping.maio = atoi(argv[0]);
2190
2191 return CMD_SUCCESS;
2192}
2193
2194DEFUN(cfg_ts_arfcn_add,
2195 cfg_ts_arfcn_add_cmd,
2196 "hopping arfcn add <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002197 HOPPING_STR "Configure hopping ARFCN list\n"
2198 "Add an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02002199{
2200 struct gsm_bts_trx_ts *ts = vty->index;
2201 int arfcn = atoi(argv[0]);
2202
Harald Weltea39b0f22010-06-14 22:26:10 +02002203 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1);
2204
Harald Welte6e0cd042009-09-12 13:05:33 +02002205 return CMD_SUCCESS;
2206}
2207
2208DEFUN(cfg_ts_arfcn_del,
2209 cfg_ts_arfcn_del_cmd,
2210 "hopping arfcn del <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002211 HOPPING_STR "Configure hopping ARFCN list\n"
2212 "Delete an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02002213{
2214 struct gsm_bts_trx_ts *ts = vty->index;
2215 int arfcn = atoi(argv[0]);
2216
Harald Weltea39b0f22010-06-14 22:26:10 +02002217 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0);
2218
Harald Welte6e0cd042009-09-12 13:05:33 +02002219 return CMD_SUCCESS;
2220}
2221
Harald Weltea6fd58e2009-08-07 00:25:23 +02002222DEFUN(cfg_ts_e1_subslot,
2223 cfg_ts_e1_subslot_cmd,
Harald Welte42581822009-08-08 16:12:58 +02002224 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltea6fd58e2009-08-07 00:25:23 +02002225 "E1 sub-slot connected to this on-air timeslot")
2226{
2227 struct gsm_bts_trx_ts *ts = vty->index;
2228
Harald Welte42581822009-08-08 16:12:58 +02002229 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002230
2231 return CMD_SUCCESS;
2232}
Harald Welte5258fc42009-03-28 19:07:53 +00002233
Harald Welte4f10c252010-05-16 21:47:13 +02002234void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
2235{
2236 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
2237 counter_get(net->stats.chreq.total),
2238 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
2239 vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
2240 counter_get(net->stats.chan.rf_fail),
2241 counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
2242 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
2243 counter_get(net->stats.paging.attempted),
2244 counter_get(net->stats.paging.completed),
2245 counter_get(net->stats.paging.expired), VTY_NEWLINE);
2246 vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
2247 counter_get(net->stats.bts.oml_fail),
2248 counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
2249}
2250
Harald Welte5bc61dc2010-05-16 22:02:16 +02002251DEFUN(logging_fltr_imsi,
2252 logging_fltr_imsi_cmd,
2253 "logging filter imsi IMSI",
2254 LOGGING_STR FILTER_STR
2255 "Filter log messages by IMSI\n" "IMSI to be used as filter\n")
2256{
2257 struct telnet_connection *conn;
2258
2259 conn = (struct telnet_connection *) vty->priv;
2260 if (!conn->dbg) {
2261 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
2262 return CMD_WARNING;
2263 }
2264
2265 log_set_imsi_filter(conn->dbg, argv[0]);
2266 return CMD_SUCCESS;
2267}
2268
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002269DEFUN(drop_bts,
2270 drop_bts_cmd,
Holger Hans Peter Freyther0586b0f2010-04-11 12:46:45 +02002271 "drop bts connection <0-65535> (oml|rsl)",
2272 "Debug/Simulation command to drop ipaccess BTS\n"
2273 "BTS NR\n" "Connection Type\n")
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002274{
2275 struct gsm_network *gsmnet;
2276 struct gsm_bts_trx *trx;
2277 struct gsm_bts *bts;
2278 unsigned int bts_nr;
2279
2280 gsmnet = gsmnet_from_vty(vty);
2281
2282 bts_nr = atoi(argv[0]);
2283 if (bts_nr >= gsmnet->num_bts) {
2284 vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s",
2285 gsmnet->num_bts, bts_nr, VTY_NEWLINE);
2286 return CMD_WARNING;
2287 }
2288
2289 bts = gsm_bts_num(gsmnet, bts_nr);
2290 if (!bts) {
2291 vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE);
2292 return CMD_WARNING;
2293 }
2294
2295 if (!is_ipaccess_bts(bts)) {
2296 vty_out(vty, "This command only works for ipaccess.%s", VTY_NEWLINE);
2297 return CMD_WARNING;
2298 }
2299
2300
2301 /* close all connections */
2302 if (strcmp(argv[1], "oml") == 0) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01002303 ipaccess_drop_oml(bts);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002304 } else if (strcmp(argv[1], "rsl") == 0) {
2305 /* close all rsl connections */
2306 llist_for_each_entry(trx, &bts->trx_list, list) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01002307 ipaccess_drop_rsl(trx);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002308 }
2309 } else {
2310 vty_out(vty, "Argument must be 'oml# or 'rsl'.%s", VTY_NEWLINE);
2311 return CMD_WARNING;
2312 }
2313
2314 return CMD_SUCCESS;
2315}
2316
2317
Harald Weltedcccb182010-05-16 20:52:23 +02002318extern int bsc_vty_init_extra(void);
Harald Welte1353f962010-05-16 19:20:24 +02002319extern const char *openbsc_copyright;
Holger Hans Peter Freythere1ffc082010-04-10 00:08:28 +02002320
Harald Weltedcccb182010-05-16 20:52:23 +02002321int bsc_vty_init(void)
Harald Welte68628e82009-03-10 12:17:57 +00002322{
Harald Welteb4d5b172010-05-12 16:10:35 +00002323 install_element_ve(&show_net_cmd);
2324 install_element_ve(&show_bts_cmd);
2325 install_element_ve(&show_trx_cmd);
2326 install_element_ve(&show_ts_cmd);
2327 install_element_ve(&show_lchan_cmd);
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08002328 install_element_ve(&show_lchan_summary_cmd);
Harald Welte5bc61dc2010-05-16 22:02:16 +02002329 install_element_ve(&logging_fltr_imsi_cmd);
Harald Welte1bc77352009-03-10 19:47:51 +00002330
Harald Welteb4d5b172010-05-12 16:10:35 +00002331 install_element_ve(&show_e1drv_cmd);
2332 install_element_ve(&show_e1line_cmd);
2333 install_element_ve(&show_e1ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002334
Harald Welteb4d5b172010-05-12 16:10:35 +00002335 install_element_ve(&show_paging_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002336
Harald Welte5bc61dc2010-05-16 22:02:16 +02002337 logging_vty_add_cmds();
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +01002338
Harald Welte5013b2a2009-08-07 13:29:14 +02002339 install_element(CONFIG_NODE, &cfg_net_cmd);
2340 install_node(&net_node, config_write_net);
2341 install_default(GSMNET_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002342 install_element(GSMNET_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002343 install_element(GSMNET_NODE, &ournode_end_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002344 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002345 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
2346 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
2347 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)69de3972009-08-12 14:42:23 +02002348 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte1085c092009-11-18 20:33:19 +01002349 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Welte4381cfe2009-08-30 15:47:06 +09002350 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01002351 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welteeab84a12009-12-13 10:53:12 +01002352 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte3d23db42009-12-14 17:49:15 +01002353 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Weltebc814502009-12-19 21:41:52 +01002354 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Welteb720bd32009-12-21 16:51:50 +01002355 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
2356 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
2357 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
2358 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
2359 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
2360 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01002361 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01002362 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
2363 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
2364 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
2365 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
2366 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
2367 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
2368 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
2369 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
2370 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
2371 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08002372 install_element(GSMNET_NODE, &cfg_net_dtx_cmd);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08002373 install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002374
2375 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte67ce0732009-08-06 19:06:46 +02002376 install_node(&bts_node, config_write_bts);
Harald Welte68628e82009-03-10 12:17:57 +00002377 install_default(BTS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002378 install_element(BTS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002379 install_element(BTS_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002380 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002381 install_element(BTS_NODE, &cfg_description_cmd);
2382 install_element(BTS_NODE, &cfg_no_description_cmd);
Harald Weltefcd24452009-06-20 18:15:19 +02002383 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02002384 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002385 install_element(BTS_NODE, &cfg_bts_lac_cmd);
2386 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002387 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte4cc34222009-05-01 15:12:31 +00002388 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte8175e952009-10-20 00:22:00 +02002389 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002390 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
2391 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02002392 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01002393 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
2394 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08002395 install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd);
2396 install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02002397 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08002398 install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd);
Harald Welte (local)0e451d02009-08-13 10:14:26 +02002399 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)efc92312009-08-14 23:09:25 +02002400 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welte73225282009-12-12 18:17:25 +01002401 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
2402 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Harald Welte4511d892010-04-18 15:51:20 +02002403 install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002404 install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002405 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
2406 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002407 install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
Harald Weltea5731cf2010-03-22 11:48:36 +08002408 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002409 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welteaf387632010-03-14 23:30:30 +08002410 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
2411 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
2412 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08002413 install_element(BTS_NODE, &cfg_bts_pag_free_cmd);
Harald Welte9fbff4a2010-07-30 11:50:09 +02002414 install_element(BTS_NODE, &cfg_bts_si_mode_cmd);
2415 install_element(BTS_NODE, &cfg_bts_si_static_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002416
Harald Welte5258fc42009-03-28 19:07:53 +00002417 install_element(BTS_NODE, &cfg_trx_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002418 install_node(&trx_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002419 install_default(TRX_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002420 install_element(TRX_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002421 install_element(TRX_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002422 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002423 install_element(TRX_NODE, &cfg_description_cmd);
2424 install_element(TRX_NODE, &cfg_no_description_cmd);
Harald Welte (local)7b37d972009-12-27 20:56:38 +01002425 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte879dc972009-06-20 22:36:12 +02002426 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002427 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
2428 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01002429 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002430
Harald Welte5258fc42009-03-28 19:07:53 +00002431 install_element(TRX_NODE, &cfg_ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002432 install_node(&ts_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002433 install_default(TS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002434 install_element(TS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002435 install_element(TS_NODE, &ournode_end_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002436 install_element(TS_NODE, &cfg_ts_pchan_cmd);
Harald Weltea39b0f22010-06-14 22:26:10 +02002437 install_element(TS_NODE, &cfg_ts_hopping_cmd);
Harald Welte6e0cd042009-09-12 13:05:33 +02002438 install_element(TS_NODE, &cfg_ts_hsn_cmd);
2439 install_element(TS_NODE, &cfg_ts_maio_cmd);
2440 install_element(TS_NODE, &cfg_ts_arfcn_add_cmd);
2441 install_element(TS_NODE, &cfg_ts_arfcn_del_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002442 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002443
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002444 install_element(ENABLE_NODE, &drop_bts_cmd);
2445
Harald Welte81c9b9c2010-05-31 16:40:40 +02002446 abis_nm_vty_init();
2447
Harald Weltedcccb182010-05-16 20:52:23 +02002448 bsc_vty_init_extra();
Harald Welte40f82892009-05-23 17:31:39 +00002449
Harald Welte68628e82009-03-10 12:17:57 +00002450 return 0;
2451}