blob: aabb7827f833fcbd9c2e60b7f253f9dd48b62c12 [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>
Harald Welte68628e82009-03-10 12:17:57 +000048
Harald Welte1353f962010-05-16 19:20:24 +020049#include "../bscconfig.h"
50
Harald Welteea4647d2010-05-12 17:19:53 +000051/* FIXME: this should go to some common file */
52static const struct value_string gprs_ns_timer_strs[] = {
Harald Welte615e9562010-05-11 23:50:21 +020053 { 0, "tns-block" },
54 { 1, "tns-block-retries" },
55 { 2, "tns-reset" },
56 { 3, "tns-reset-retries" },
57 { 4, "tns-test" },
58 { 5, "tns-alive" },
59 { 6, "tns-alive-retries" },
60 { 0, NULL }
61};
62
Harald Welteea4647d2010-05-12 17:19:53 +000063static const struct value_string gprs_bssgp_cfg_strs[] = {
Harald Welte615e9562010-05-11 23:50:21 +020064 { 0, "blocking-timer" },
65 { 1, "blocking-retries" },
66 { 2, "unblocking-retries" },
67 { 3, "reset-timer" },
68 { 4, "reset-retries" },
69 { 5, "suspend-timer" },
70 { 6, "suspend-retries" },
71 { 7, "resume-timer" },
72 { 8, "resume-retries" },
73 { 9, "capability-update-timer" },
74 { 10, "capability-update-retries" },
75 { 0, NULL }
76};
77
Harald Welte5013b2a2009-08-07 13:29:14 +020078struct cmd_node net_node = {
79 GSMNET_NODE,
80 "%s(network)#",
81 1,
82};
83
Harald Welte68628e82009-03-10 12:17:57 +000084struct cmd_node bts_node = {
85 BTS_NODE,
86 "%s(bts)#",
87 1,
88};
89
90struct cmd_node trx_node = {
91 TRX_NODE,
92 "%s(trx)#",
93 1,
94};
95
96struct cmd_node ts_node = {
97 TS_NODE,
98 "%s(ts)#",
99 1,
100};
101
Harald Welte39231152010-05-27 13:39:40 +0200102extern struct gsm_network *bsc_gsmnet;
103
Harald Weltedcccb182010-05-16 20:52:23 +0200104struct gsm_network *gsmnet_from_vty(struct vty *v)
105{
Harald Welte39231152010-05-27 13:39:40 +0200106 /* In case we read from the config file, the vty->priv cannot
107 * point to a struct telnet_connection, and thus conn->priv
108 * will not point to the gsm_network structure */
109#if 0
Harald Weltedcccb182010-05-16 20:52:23 +0200110 struct telnet_connection *conn = v->priv;
111 return (struct gsm_network *) conn->priv;
Harald Welte39231152010-05-27 13:39:40 +0200112#else
113 return bsc_gsmnet;
114#endif
Harald Weltedcccb182010-05-16 20:52:23 +0200115}
116
Harald Welte68628e82009-03-10 12:17:57 +0000117static int dummy_config_write(struct vty *v)
118{
119 return CMD_SUCCESS;
120}
121
122static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
123{
Harald Welte1bc77352009-03-10 19:47:51 +0000124 vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s",
125 nm_opstate_name(nms->operational), nms->administrative,
126 nm_avail_name(nms->availability), VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000127}
128
Harald Welteb908cb72009-12-22 13:09:29 +0100129static void dump_pchan_load_vty(struct vty *vty, char *prefix,
130 const struct pchan_load *pl)
131{
132 int i;
133
134 for (i = 0; i < ARRAY_SIZE(pl->pchan); i++) {
135 const struct load_counter *lc = &pl->pchan[i];
136 unsigned int percent;
137
138 if (lc->total == 0)
139 continue;
140
141 percent = (lc->used * 100) / lc->total;
142
143 vty_out(vty, "%s%20s: %3u%% (%u/%u)%s", prefix,
144 gsm_pchan_name(i), percent, lc->used, lc->total,
145 VTY_NEWLINE);
146 }
147}
148
Harald Welte68628e82009-03-10 12:17:57 +0000149static void net_dump_vty(struct vty *vty, struct gsm_network *net)
150{
Harald Welteb908cb72009-12-22 13:09:29 +0100151 struct pchan_load pl;
152
Harald Welteef235b52009-03-10 12:34:02 +0000153 vty_out(vty, "BSC is on Country Code %u, Network Code %u "
154 "and has %u BTS%s", net->country_code, net->network_code,
155 net->num_bts, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000156 vty_out(vty, " Long network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000157 net->name_long, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000158 vty_out(vty, " Short network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000159 net->name_short, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200160 vty_out(vty, " Authentication policy: %s%s",
161 gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100162 vty_out(vty, " Location updating reject cause: %u%s",
163 net->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900164 vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption,
165 VTY_NEWLINE);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +0100166 vty_out(vty, " NECI (TCH/H): %u%s", net->neci,
167 VTY_NEWLINE);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +0800168 vty_out(vty, " Use TCH for Paging any: %d%s", net->pag_any_tch,
169 VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100170 vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode),
171 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100172 vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off",
173 VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100174 vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off",
175 VTY_NEWLINE);
Harald Welteb908cb72009-12-22 13:09:29 +0100176 network_chan_load(&pl, net);
177 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
178 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000179}
180
181DEFUN(show_net, show_net_cmd, "show network",
182 SHOW_STR "Display information about a GSM NETWORK\n")
183{
Harald Weltedcccb182010-05-16 20:52:23 +0200184 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000185 net_dump_vty(vty, net);
186
187 return CMD_SUCCESS;
188}
189
190static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l)
191{
Harald Welteedb37782009-05-01 14:59:07 +0000192 struct e1inp_line *line;
193
194 if (!e1l) {
195 vty_out(vty, " None%s", VTY_NEWLINE);
196 return;
197 }
198
199 line = e1l->ts->line;
200
201 vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s",
202 line->num, line->driver->name, e1l->ts->num,
Harald Welte1bc77352009-03-10 19:47:51 +0000203 e1inp_signtype_name(e1l->type), VTY_NEWLINE);
Harald Welteedb37782009-05-01 14:59:07 +0000204 vty_out(vty, " E1 TEI %u, SAPI %u%s",
Harald Welte68628e82009-03-10 12:17:57 +0000205 e1l->tei, e1l->sapi, VTY_NEWLINE);
206}
207
208static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
209{
Harald Welteb908cb72009-12-22 13:09:29 +0100210 struct pchan_load pl;
211
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200212 vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
Harald Weltefcd24452009-06-20 18:15:19 +0200213 "BSIC %u, TSC %u and %u TRX%s",
214 bts->nr, btstype2str(bts->type), gsm_band_name(bts->band),
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200215 bts->cell_identity,
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +0200216 bts->location_area_code, bts->bsic, bts->tsc,
Harald Weltefcd24452009-06-20 18:15:19 +0200217 bts->num_trx, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200218 vty_out(vty, "Description: %s%s",
219 bts->description ? bts->description : "(null)", VTY_NEWLINE);
Harald Welte1d8dbc42009-12-12 15:38:16 +0100220 vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100221 vty_out(vty, "Minimum Rx Level for Access: %i dBm%s",
Harald Welte1d8dbc42009-12-12 15:38:16 +0100222 rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min),
223 VTY_NEWLINE);
224 vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s",
Harald Welte73225282009-12-12 18:17:25 +0100225 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100226 vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer,
227 VTY_NEWLINE);
228 vty_out(vty, "RACH Max transmissions: %u%s",
229 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
230 VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100231 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200232 vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE);
Harald Welte9fbff4a2010-07-30 11:50:09 +0200233 vty_out(vty, "System Information present: 0x%08x, static: 0x%08x%s",
234 bts->si_valid, bts->si_mode_static, VTY_NEWLINE);
Harald Welte4cc34222009-05-01 15:12:31 +0000235 if (is_ipaccess_bts(bts))
Harald Welte8175e952009-10-20 00:22:00 +0200236 vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
Harald Welte4cc34222009-05-01 15:12:31 +0000237 bts->ip_access.site_id, bts->ip_access.bts_id,
Harald Welte8175e952009-10-20 00:22:00 +0200238 bts->oml_tei, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000239 vty_out(vty, " NM State: ");
240 net_dump_nmstate(vty, &bts->nm_state);
241 vty_out(vty, " Site Mgr NM State: ");
242 net_dump_nmstate(vty, &bts->site_mgr.nm_state);
243 vty_out(vty, " Paging: FIXME pending requests, %u free slots%s",
244 bts->paging.available_slots, VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200245 if (!is_ipaccess_bts(bts)) {
246 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
247 e1isl_dump_vty(vty, bts->oml_link);
248 }
Harald Welte68628e82009-03-10 12:17:57 +0000249 /* FIXME: oml_link, chan_desc */
Harald Welteb908cb72009-12-22 13:09:29 +0100250 memset(&pl, 0, sizeof(pl));
251 bts_chan_load(&pl, bts);
252 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
253 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000254}
255
256DEFUN(show_bts, show_bts_cmd, "show bts [number]",
257 SHOW_STR "Display information about a BTS\n"
258 "BTS number")
259{
Harald Weltedcccb182010-05-16 20:52:23 +0200260 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000261 int bts_nr;
262
263 if (argc != 0) {
264 /* use the BTS number that the user has specified */
265 bts_nr = atoi(argv[0]);
266 if (bts_nr > net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000267 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000268 VTY_NEWLINE);
269 return CMD_WARNING;
270 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200271 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000272 return CMD_SUCCESS;
273 }
274 /* print all BTS's */
275 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee441d9c2009-06-21 16:17:15 +0200276 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000277
278 return CMD_SUCCESS;
279}
280
Harald Welte42581822009-08-08 16:12:58 +0200281/* utility functions */
282static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
283 const char *ts, const char *ss)
284{
285 e1_link->e1_nr = atoi(line);
286 e1_link->e1_ts = atoi(ts);
287 if (!strcmp(ss, "full"))
288 e1_link->e1_ts_ss = 255;
289 else
290 e1_link->e1_ts_ss = atoi(ss);
291}
292
293static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,
294 const char *prefix)
295{
296 if (!e1_link->e1_ts)
297 return;
298
299 if (e1_link->e1_ts_ss == 255)
300 vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s",
301 prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE);
302 else
303 vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s",
304 prefix, e1_link->e1_nr, e1_link->e1_ts,
305 e1_link->e1_ts_ss, VTY_NEWLINE);
306}
307
308
Harald Welte67ce0732009-08-06 19:06:46 +0200309static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
310{
Harald Welte42581822009-08-08 16:12:58 +0200311 vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
312 if (ts->pchan != GSM_PCHAN_NONE)
313 vty_out(vty, " phys_chan_config %s%s",
314 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200315 vty_out(vty, " hopping enabled %u%s",
316 ts->hopping.enabled, VTY_NEWLINE);
317 if (ts->hopping.enabled) {
318 unsigned int i;
319 vty_out(vty, " hopping sequence-number %u%s",
Harald Welte6e0cd042009-09-12 13:05:33 +0200320 ts->hopping.hsn, VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200321 vty_out(vty, " hopping maio %u%s",
Harald Welte6e0cd042009-09-12 13:05:33 +0200322 ts->hopping.maio, VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200323 for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) {
324 if (!bitvec_get_bit_pos(&ts->hopping.arfcns, i))
325 continue;
326 vty_out(vty, " hopping arfcn add %u%s",
327 i, VTY_NEWLINE);
328 }
329 } else
Harald Welte42581822009-08-08 16:12:58 +0200330 config_write_e1_link(vty, &ts->e1_link, " ");
Harald Welte67ce0732009-08-06 19:06:46 +0200331}
332
333static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
334{
335 int i;
336
Harald Welte5013b2a2009-08-07 13:29:14 +0200337 vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200338 if (trx->description)
339 vty_out(vty, " description %s%s", trx->description,
340 VTY_NEWLINE);
Holger Hans Peter Freyther2ba40af2010-04-17 06:42:07 +0200341 vty_out(vty, " rf_locked %u%s",
342 trx->nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
343 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200344 vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
Harald Welte (local)7b37d972009-12-27 20:56:38 +0100345 vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200346 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200347 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
348 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte67ce0732009-08-06 19:06:46 +0200349
350 for (i = 0; i < TRX_NR_TS; i++)
351 config_write_ts_single(vty, &trx->ts[i]);
352}
353
Harald Welte615e9562010-05-11 23:50:21 +0200354static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
355{
356 unsigned int i;
357 vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode),
358 VTY_NEWLINE);
359 if (bts->gprs.mode == BTS_GPRS_NONE)
360 return;
361
362 vty_out(vty, " gprs routing area %u%s", bts->gprs.rac,
363 VTY_NEWLINE);
364 vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
365 VTY_NEWLINE);
366 for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++)
367 vty_out(vty, " gprs cell timer %s %u%s",
368 get_value_string(gprs_bssgp_cfg_strs, i),
369 bts->gprs.cell.timer[i], VTY_NEWLINE);
370 vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei,
371 VTY_NEWLINE);
372 for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++)
373 vty_out(vty, " gprs ns timer %s %u%s",
374 get_value_string(gprs_ns_timer_strs, i),
375 bts->gprs.nse.timer[i], VTY_NEWLINE);
376 for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
377 struct gsm_bts_gprs_nsvc *nsvc =
378 &bts->gprs.nsvc[i];
379 struct in_addr ia;
380
381 ia.s_addr = htonl(nsvc->remote_ip);
382 vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
383 nsvc->nsvci, VTY_NEWLINE);
384 vty_out(vty, " gprs nsvc %u local udp port %u%s", i,
385 nsvc->local_port, VTY_NEWLINE);
386 vty_out(vty, " gprs nsvc %u remote udp port %u%s", i,
387 nsvc->remote_port, VTY_NEWLINE);
388 vty_out(vty, " gprs nsvc %u remote ip %s%s", i,
389 inet_ntoa(ia), VTY_NEWLINE);
390 }
391}
392
Harald Welte67ce0732009-08-06 19:06:46 +0200393static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
394{
395 struct gsm_bts_trx *trx;
Harald Welte9fbff4a2010-07-30 11:50:09 +0200396 int i;
Harald Welte67ce0732009-08-06 19:06:46 +0200397
Harald Welte5013b2a2009-08-07 13:29:14 +0200398 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
399 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200400 if (bts->description)
401 vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200402 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freytherf926ed62009-11-19 16:38:49 +0100403 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200404 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte67ce0732009-08-06 19:06:46 +0200405 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200406 vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE);
407 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)0e451d02009-08-13 10:14:26 +0200408 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100409 vty_out(vty, " cell reselection hysteresis %u%s",
410 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
411 vty_out(vty, " rxlev access min %u%s",
412 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Harald Weltea43f7892009-12-01 18:04:30 +0530413 if (bts->si_common.chan_desc.t3212)
Harald Welte (local)efc92312009-08-14 23:09:25 +0200414 vty_out(vty, " periodic location update %u%s",
Dieter Spaard6613e02010-10-05 21:10:55 +0200415 bts->si_common.chan_desc.t3212 * 6, VTY_NEWLINE);
Harald Welte7a8fa412009-08-10 13:48:16 +0200416 vty_out(vty, " channel allocator %s%s",
417 bts->chan_alloc_reverse ? "descending" : "ascending",
418 VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100419 vty_out(vty, " rach tx integer %u%s",
420 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
421 vty_out(vty, " rach max transmission %u%s",
422 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
423 VTY_NEWLINE);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +0800424
425 if (bts->rach_b_thresh != -1)
426 vty_out(vty, " rach nm busy threshold %u%s",
427 bts->rach_b_thresh, VTY_NEWLINE);
428 if (bts->rach_ldavg_slots != -1)
429 vty_out(vty, " rach nm load average %u%s",
430 bts->rach_ldavg_slots, VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100431 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200432 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +0800433 if ((bts->si_common.rach_control.t2 & 0x4) == 0)
434 vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE);
Harald Welte9fbff4a2010-07-30 11:50:09 +0200435 for (i = SYSINFO_TYPE_1; i < _MAX_SYSINFO_TYPE; i++) {
436 if (bts->si_mode_static & (1 << i)) {
437 vty_out(vty, " system-information %s mode static%s",
438 get_value_string(osmo_sitype_strs, i), VTY_NEWLINE);
439 vty_out(vty, " system-information %s static %s%s",
440 get_value_string(osmo_sitype_strs, i),
441 hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])),
442 VTY_NEWLINE);
443 }
444 }
Harald Welte8175e952009-10-20 00:22:00 +0200445 if (is_ipaccess_bts(bts)) {
Harald Welte5013b2a2009-08-07 13:29:14 +0200446 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Weltea6fd58e2009-08-07 00:25:23 +0200447 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200448 vty_out(vty, " oml ip.access stream_id %u%s", bts->oml_tei, VTY_NEWLINE);
449 } else {
Harald Welte42581822009-08-08 16:12:58 +0200450 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
451 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
452 }
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +0800453
454 /* if we have a limit, write it */
455 if (bts->paging.free_chans_need >= 0)
456 vty_out(vty, " paging free %d%s", bts->paging.free_chans_need, VTY_NEWLINE);
457
Harald Welte615e9562010-05-11 23:50:21 +0200458 config_write_bts_gprs(vty, bts);
Harald Welte67ce0732009-08-06 19:06:46 +0200459
460 llist_for_each_entry(trx, &bts->trx_list, list)
461 config_write_trx_single(vty, trx);
462}
463
464static int config_write_bts(struct vty *v)
465{
Harald Weltedcccb182010-05-16 20:52:23 +0200466 struct gsm_network *gsmnet = gsmnet_from_vty(v);
Harald Welte67ce0732009-08-06 19:06:46 +0200467 struct gsm_bts *bts;
468
469 llist_for_each_entry(bts, &gsmnet->bts_list, list)
470 config_write_bts_single(v, bts);
471
472 return CMD_SUCCESS;
473}
474
Harald Welte5013b2a2009-08-07 13:29:14 +0200475static int config_write_net(struct vty *vty)
476{
Harald Weltedcccb182010-05-16 20:52:23 +0200477 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
478
Harald Welte5013b2a2009-08-07 13:29:14 +0200479 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200480 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200481 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200482 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
483 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200484 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100485 vty_out(vty, " location updating reject cause %u%s",
486 gsmnet->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900487 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freytherd54c3372009-11-19 16:37:48 +0100488 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +0800489 vty_out(vty, " paging any use tch %d%s", gsmnet->pag_any_tch, VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100490 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
491 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100492 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100493 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Welteb720bd32009-12-21 16:51:50 +0100494 vty_out(vty, " handover window rxlev averaging %u%s",
495 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
496 vty_out(vty, " handover window rxqual averaging %u%s",
497 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
498 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
499 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
500 vty_out(vty, " handover power budget interval %u%s",
501 gsmnet->handover.pwr_interval, VTY_NEWLINE);
502 vty_out(vty, " handover power budget hysteresis %u%s",
503 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
504 vty_out(vty, " handover maximum distance %u%s",
505 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +0100506 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100507 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
508 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
509 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
510 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
511 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
512 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
513 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
514 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
515 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
516 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +0800517 vty_out(vty, " use-dtx %u%s", gsmnet->dtx_enabled, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200518
519 return CMD_SUCCESS;
520}
Harald Welte67ce0732009-08-06 19:06:46 +0200521
Harald Welte68628e82009-03-10 12:17:57 +0000522static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
523{
524 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
525 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200526 vty_out(vty, "Description: %s%s",
527 trx->description ? trx->description : "(null)", VTY_NEWLINE);
Harald Weltefcd24452009-06-20 18:15:19 +0200528 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte42581822009-08-08 16:12:58 +0200529 "resulting BS power: %d dBm%s",
Harald Weltefcd24452009-06-20 18:15:19 +0200530 trx->nominal_power, trx->max_power_red,
Harald Welte42581822009-08-08 16:12:58 +0200531 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000532 vty_out(vty, " NM State: ");
533 net_dump_nmstate(vty, &trx->nm_state);
534 vty_out(vty, " Baseband Transceiver NM State: ");
535 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte8175e952009-10-20 00:22:00 +0200536 if (is_ipaccess_bts(trx->bts)) {
537 vty_out(vty, " ip.access stream ID: 0x%02x%s",
538 trx->rsl_tei, VTY_NEWLINE);
539 } else {
540 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
541 e1isl_dump_vty(vty, trx->rsl_link);
542 }
Harald Welte68628e82009-03-10 12:17:57 +0000543}
544
545DEFUN(show_trx,
546 show_trx_cmd,
547 "show trx [bts_nr] [trx_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200548 SHOW_STR "Display information about a TRX\n"
549 "BTS Number\n"
550 "TRX Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000551{
Harald Weltedcccb182010-05-16 20:52:23 +0200552 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000553 struct gsm_bts *bts = NULL;
554 struct gsm_bts_trx *trx;
555 int bts_nr, trx_nr;
556
557 if (argc >= 1) {
558 /* use the BTS number that the user has specified */
559 bts_nr = atoi(argv[0]);
560 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000561 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000562 VTY_NEWLINE);
563 return CMD_WARNING;
564 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200565 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000566 }
567 if (argc >= 2) {
568 trx_nr = atoi(argv[1]);
569 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000570 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000571 VTY_NEWLINE);
572 return CMD_WARNING;
573 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200574 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000575 trx_dump_vty(vty, trx);
576 return CMD_SUCCESS;
577 }
578 if (bts) {
579 /* print all TRX in this BTS */
580 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200581 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000582 trx_dump_vty(vty, trx);
583 }
584 return CMD_SUCCESS;
585 }
586
587 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200588 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000589 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200590 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000591 trx_dump_vty(vty, trx);
592 }
593 }
594
595 return CMD_SUCCESS;
596}
597
Harald Welte67ce0732009-08-06 19:06:46 +0200598
Harald Welte68628e82009-03-10 12:17:57 +0000599static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
600{
Harald Welte68628e82009-03-10 12:17:57 +0000601 vty_out(vty, "Timeslot %u of TRX %u in BTS %u, phys cfg %s%s",
602 ts->nr, ts->trx->nr, ts->trx->bts->nr,
603 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
604 vty_out(vty, " NM State: ");
605 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte2c828992009-12-02 01:56:49 +0530606 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welteef235b52009-03-10 12:34:02 +0000607 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
608 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
609 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000610}
611
612DEFUN(show_ts,
613 show_ts_cmd,
Harald Welte1bc77352009-03-10 19:47:51 +0000614 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200615 SHOW_STR "Display information about a TS\n"
616 "BTS Number\n" "TRX Number\n" "Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000617{
Harald Weltedcccb182010-05-16 20:52:23 +0200618 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000619 struct gsm_bts *bts;
620 struct gsm_bts_trx *trx;
621 struct gsm_bts_trx_ts *ts;
622 int bts_nr, trx_nr, ts_nr;
623
624 if (argc >= 1) {
625 /* use the BTS number that the user has specified */
626 bts_nr = atoi(argv[0]);
627 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000628 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000629 VTY_NEWLINE);
630 return CMD_WARNING;
631 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200632 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000633 }
634 if (argc >= 2) {
635 trx_nr = atoi(argv[1]);
636 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000637 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000638 VTY_NEWLINE);
639 return CMD_WARNING;
640 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200641 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000642 }
643 if (argc >= 3) {
644 ts_nr = atoi(argv[2]);
645 if (ts_nr >= TRX_NR_TS) {
Harald Welte1bc77352009-03-10 19:47:51 +0000646 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
Harald Welte68628e82009-03-10 12:17:57 +0000647 VTY_NEWLINE);
648 return CMD_WARNING;
649 }
650 ts = &trx->ts[ts_nr];
651 ts_dump_vty(vty, ts);
652 return CMD_SUCCESS;
653 }
654 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200655 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000656 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200657 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000658 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
659 ts = &trx->ts[ts_nr];
660 ts_dump_vty(vty, ts);
661 }
662 }
663 }
664
665 return CMD_SUCCESS;
666}
667
Holger Hans Peter Freyther424c4f02010-01-06 06:00:40 +0100668static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte68628e82009-03-10 12:17:57 +0000669{
Harald Weltefcd24452009-06-20 18:15:19 +0200670 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte40f82892009-05-23 17:31:39 +0000671 subscr->authorized, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000672 if (subscr->name)
Harald Welte1bc77352009-03-10 19:47:51 +0000673 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000674 if (subscr->extension)
675 vty_out(vty, " Extension: %s%s", subscr->extension,
676 VTY_NEWLINE);
677 if (subscr->imsi)
678 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freyther22230252009-08-19 12:53:57 +0200679 if (subscr->tmsi != GSM_RESERVED_TMSI)
680 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte731fd912009-08-15 03:24:51 +0200681 VTY_NEWLINE);
Sylvain Munautaf292642009-12-27 19:29:28 +0100682
Harald Welte (local)15920de2009-08-14 20:27:16 +0200683 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000684}
685
Harald Welte8387a492009-12-22 21:43:14 +0100686static void meas_rep_dump_uni_vty(struct vty *vty,
687 struct gsm_meas_rep_unidir *mru,
688 const char *prefix,
689 const char *dir)
690{
691 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
692 prefix, dir, rxlev2dbm(mru->full.rx_lev),
693 dir, rxlev2dbm(mru->sub.rx_lev));
694 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
695 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
696 VTY_NEWLINE);
697}
698
699static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
700 const char *prefix)
701{
702 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
703 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
704 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
705 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
706 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
707 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
708 VTY_NEWLINE);
709 if (mr->flags & MEAS_REP_F_MS_TO)
710 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
711 mr->ms_timing_offset, VTY_NEWLINE);
712 if (mr->flags & MEAS_REP_F_MS_L1)
713 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
714 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
715 if (mr->flags & MEAS_REP_F_DL_VALID)
716 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
717 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
718}
719
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800720static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
Harald Welte68628e82009-03-10 12:17:57 +0000721{
Harald Welte8387a492009-12-22 21:43:14 +0100722 int idx;
723
Harald Welte68628e82009-03-10 12:17:57 +0000724 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 +0200725 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
Harald Welte (local)ccd88452009-12-27 18:05:25 +0100726 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Harald Welte68628e82009-03-10 12:17:57 +0000727 VTY_NEWLINE);
Holger Hans Peter Freyther40494552010-06-28 17:09:29 +0800728 vty_out(vty, " Connection: %u, State: %s%s",
729 lchan->conn ? 1: 0,
Harald Welte1887f9d2009-12-29 10:52:38 +0100730 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100731 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
732 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
733 - lchan->bs_power*2,
734 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
735 VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800736 if (lchan->conn && lchan->conn->subscr) {
Harald Welte68628e82009-03-10 12:17:57 +0000737 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800738 subscr_dump_vty(vty, lchan->conn->subscr);
Harald Welte68628e82009-03-10 12:17:57 +0000739 } else
740 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte2c828992009-12-02 01:56:49 +0530741 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
742 struct in_addr ia;
Holger Hans Peter Freyther54fa7992010-04-07 15:39:16 +0200743 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte2c828992009-12-02 01:56:49 +0530744 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
745 inet_ntoa(ia), lchan->abis_ip.bound_port,
746 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
747 VTY_NEWLINE);
748 }
Harald Welte8387a492009-12-22 21:43:14 +0100749
750 /* we want to report the last measurement report */
751 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
752 lchan->meas_rep_idx, 1);
753 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte68628e82009-03-10 12:17:57 +0000754}
755
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800756static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
757{
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800758 struct gsm_meas_rep *mr;
759 int idx;
760
761 /* we want to report the last measurement report */
762 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
763 lchan->meas_rep_idx, 1);
764 mr = &lchan->meas_rep[idx];
765
766 vty_out(vty, "Lchan: %u Timeslot: %u TRX: %u BTS: %u Type: %s - L1 MS Power: %u dBm "
767 "RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800768 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
769 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800770 mr->ms_l1.pwr,
771 rxlev2dbm(mr->dl.full.rx_lev),
772 rxlev2dbm(mr->ul.full.rx_lev),
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800773 VTY_NEWLINE);
774}
775
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800776static int lchan_summary(struct vty *vty, int argc, const char **argv,
777 void (*dump_cb)(struct vty *, struct gsm_lchan *))
Harald Welte68628e82009-03-10 12:17:57 +0000778{
Harald Weltedcccb182010-05-16 20:52:23 +0200779 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000780 struct gsm_bts *bts;
781 struct gsm_bts_trx *trx;
782 struct gsm_bts_trx_ts *ts;
783 struct gsm_lchan *lchan;
784 int bts_nr, trx_nr, ts_nr, lchan_nr;
785
786 if (argc >= 1) {
787 /* use the BTS number that the user has specified */
788 bts_nr = atoi(argv[0]);
789 if (bts_nr >= net->num_bts) {
790 vty_out(vty, "%% can't find BTS %s%s", argv[0],
791 VTY_NEWLINE);
792 return CMD_WARNING;
793 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200794 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000795 }
796 if (argc >= 2) {
797 trx_nr = atoi(argv[1]);
798 if (trx_nr >= bts->num_trx) {
799 vty_out(vty, "%% can't find TRX %s%s", argv[1],
800 VTY_NEWLINE);
801 return CMD_WARNING;
802 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200803 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000804 }
805 if (argc >= 3) {
806 ts_nr = atoi(argv[2]);
807 if (ts_nr >= TRX_NR_TS) {
808 vty_out(vty, "%% can't find TS %s%s", argv[2],
809 VTY_NEWLINE);
810 return CMD_WARNING;
811 }
812 ts = &trx->ts[ts_nr];
813 }
814 if (argc >= 4) {
815 lchan_nr = atoi(argv[3]);
816 if (lchan_nr >= TS_MAX_LCHAN) {
817 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
818 VTY_NEWLINE);
819 return CMD_WARNING;
820 }
821 lchan = &ts->lchan[lchan_nr];
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800822 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000823 return CMD_SUCCESS;
824 }
825 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200826 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000827 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200828 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000829 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
830 ts = &trx->ts[ts_nr];
831 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
832 lchan_nr++) {
833 lchan = &ts->lchan[lchan_nr];
Harald Welteef235b52009-03-10 12:34:02 +0000834 if (lchan->type == GSM_LCHAN_NONE)
835 continue;
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800836 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000837 }
838 }
839 }
840 }
841
842 return CMD_SUCCESS;
843}
844
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800845
846DEFUN(show_lchan,
847 show_lchan_cmd,
848 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
849 SHOW_STR "Display information about a logical channel\n"
850 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
851 "Logical Channel Number\n")
852
853{
854 return lchan_summary(vty, argc, argv, lchan_dump_full_vty);
855}
856
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800857DEFUN(show_lchan_summary,
858 show_lchan_summary_cmd,
859 "show lchan summary [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
860 SHOW_STR "Display information about a logical channel\n"
861 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
862 "Logical Channel Number\n")
863{
864 return lchan_summary(vty, argc, argv, lchan_dump_short_vty);
865}
866
Harald Welte1bc77352009-03-10 19:47:51 +0000867static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
868{
869 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
870}
871
872DEFUN(show_e1drv,
873 show_e1drv_cmd,
874 "show e1_driver",
875 SHOW_STR "Display information about available E1 drivers\n")
876{
877 struct e1inp_driver *drv;
878
879 llist_for_each_entry(drv, &e1inp_driver_list, list)
880 e1drv_dump_vty(vty, drv);
881
882 return CMD_SUCCESS;
883}
884
Harald Welte68628e82009-03-10 12:17:57 +0000885static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
886{
887 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
888 line->num, line->name ? line->name : "",
889 line->driver->name, VTY_NEWLINE);
890}
891
892DEFUN(show_e1line,
893 show_e1line_cmd,
894 "show e1_line [line_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200895 SHOW_STR "Display information about a E1 line\n"
896 "E1 Line Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000897{
Harald Welte1bc77352009-03-10 19:47:51 +0000898 struct e1inp_line *line;
899
900 if (argc >= 1) {
901 int num = atoi(argv[0]);
902 llist_for_each_entry(line, &e1inp_line_list, list) {
903 if (line->num == num) {
904 e1line_dump_vty(vty, line);
905 return CMD_SUCCESS;
906 }
907 }
908 return CMD_WARNING;
909 }
910
911 llist_for_each_entry(line, &e1inp_line_list, list)
912 e1line_dump_vty(vty, line);
913
914 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000915}
916
917static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
918{
Harald Welte42581822009-08-08 16:12:58 +0200919 if (ts->type == E1INP_TS_TYPE_NONE)
920 return;
Harald Welte1bc77352009-03-10 19:47:51 +0000921 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
922 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
923 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000924}
925
926DEFUN(show_e1ts,
927 show_e1ts_cmd,
928 "show e1_timeslot [line_nr] [ts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200929 SHOW_STR "Display information about a E1 timeslot\n"
930 "E1 Line Number\n" "E1 Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000931{
Harald Welte986c3d72009-11-17 06:12:16 +0100932 struct e1inp_line *line = NULL;
Harald Welte1bc77352009-03-10 19:47:51 +0000933 struct e1inp_ts *ts;
934 int ts_nr;
Harald Welte68628e82009-03-10 12:17:57 +0000935
Harald Welte1bc77352009-03-10 19:47:51 +0000936 if (argc == 0) {
937 llist_for_each_entry(line, &e1inp_line_list, list) {
938 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
939 ts = &line->ts[ts_nr];
940 e1ts_dump_vty(vty, ts);
941 }
942 }
943 return CMD_SUCCESS;
944 }
945 if (argc >= 1) {
946 int num = atoi(argv[0]);
947 llist_for_each_entry(line, &e1inp_line_list, list) {
948 if (line->num == num)
949 break;
950 }
951 if (!line || line->num != num) {
952 vty_out(vty, "E1 line %s is invalid%s",
953 argv[0], VTY_NEWLINE);
954 return CMD_WARNING;
955 }
956 }
957 if (argc >= 2) {
958 ts_nr = atoi(argv[1]);
959 if (ts_nr > NUM_E1_TS) {
960 vty_out(vty, "E1 timeslot %s is invalid%s",
961 argv[1], VTY_NEWLINE);
962 return CMD_WARNING;
963 }
964 ts = &line->ts[ts_nr];
965 e1ts_dump_vty(vty, ts);
966 return CMD_SUCCESS;
967 } else {
968 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
969 ts = &line->ts[ts_nr];
970 e1ts_dump_vty(vty, ts);
971 }
972 return CMD_SUCCESS;
973 }
974 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000975}
976
Harald Weltebe4b7302009-05-23 16:59:33 +0000977static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
Harald Weltef5025b62009-03-28 16:55:11 +0000978{
979 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
980 subscr_dump_vty(vty, pag->subscr);
981}
982
Harald Weltebe4b7302009-05-23 16:59:33 +0000983static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
Harald Weltef5025b62009-03-28 16:55:11 +0000984{
985 struct gsm_paging_request *pag;
986
987 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
988 paging_dump_vty(vty, pag);
989}
990
991DEFUN(show_paging,
992 show_paging_cmd,
993 "show paging [bts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200994 SHOW_STR "Display information about paging reuqests of a BTS\n"
995 "BTS Number\n")
Harald Weltef5025b62009-03-28 16:55:11 +0000996{
Harald Weltedcccb182010-05-16 20:52:23 +0200997 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Weltef5025b62009-03-28 16:55:11 +0000998 struct gsm_bts *bts;
999 int bts_nr;
1000
1001 if (argc >= 1) {
1002 /* use the BTS number that the user has specified */
1003 bts_nr = atoi(argv[0]);
1004 if (bts_nr >= net->num_bts) {
1005 vty_out(vty, "%% can't find BTS %s%s", argv[0],
1006 VTY_NEWLINE);
1007 return CMD_WARNING;
1008 }
Harald Weltee441d9c2009-06-21 16:17:15 +02001009 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001010 bts_paging_dump_vty(vty, bts);
1011
1012 return CMD_SUCCESS;
1013 }
1014 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +02001015 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001016 bts_paging_dump_vty(vty, bts);
1017 }
1018
1019 return CMD_SUCCESS;
1020}
1021
Harald Welte8f0ed552010-05-11 21:53:49 +02001022#define NETWORK_STR "Configure the GSM network\n"
1023
Harald Welte5013b2a2009-08-07 13:29:14 +02001024DEFUN(cfg_net,
1025 cfg_net_cmd,
Harald Welte8f0ed552010-05-11 21:53:49 +02001026 "network", NETWORK_STR)
Harald Welte5013b2a2009-08-07 13:29:14 +02001027{
Harald Weltedcccb182010-05-16 20:52:23 +02001028 vty->index = gsmnet_from_vty(vty);
Harald Welte5013b2a2009-08-07 13:29:14 +02001029 vty->node = GSMNET_NODE;
1030
1031 return CMD_SUCCESS;
1032}
1033
1034
1035DEFUN(cfg_net_ncc,
1036 cfg_net_ncc_cmd,
1037 "network country code <1-999>",
1038 "Set the GSM network country code")
1039{
Harald Weltedcccb182010-05-16 20:52:23 +02001040 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1041
Harald Welte5013b2a2009-08-07 13:29:14 +02001042 gsmnet->country_code = atoi(argv[0]);
1043
1044 return CMD_SUCCESS;
1045}
1046
1047DEFUN(cfg_net_mnc,
1048 cfg_net_mnc_cmd,
1049 "mobile network code <1-999>",
1050 "Set the GSM mobile network code")
1051{
Harald Weltedcccb182010-05-16 20:52:23 +02001052 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1053
Harald Welte5013b2a2009-08-07 13:29:14 +02001054 gsmnet->network_code = atoi(argv[0]);
1055
1056 return CMD_SUCCESS;
1057}
1058
1059DEFUN(cfg_net_name_short,
1060 cfg_net_name_short_cmd,
1061 "short name NAME",
1062 "Set the short GSM network name")
1063{
Harald Weltedcccb182010-05-16 20:52:23 +02001064 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1065
Holger Hans Peter Freyther3e9a7f82010-10-12 23:21:54 +02001066 bsc_replace_string(gsmnet, &gsmnet->name_short, argv[0]);
Harald Welte5013b2a2009-08-07 13:29:14 +02001067 return CMD_SUCCESS;
1068}
1069
1070DEFUN(cfg_net_name_long,
1071 cfg_net_name_long_cmd,
1072 "long name NAME",
1073 "Set the long GSM network name")
1074{
Harald Weltedcccb182010-05-16 20:52:23 +02001075 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1076
Holger Hans Peter Freyther3e9a7f82010-10-12 23:21:54 +02001077 bsc_replace_string(gsmnet, &gsmnet->name_long, argv[0]);
Harald Welte5013b2a2009-08-07 13:29:14 +02001078 return CMD_SUCCESS;
1079}
Harald Welte40f82892009-05-23 17:31:39 +00001080
Harald Welte (local)69de3972009-08-12 14:42:23 +02001081DEFUN(cfg_net_auth_policy,
1082 cfg_net_auth_policy_cmd,
1083 "auth policy (closed|accept-all|token)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001084 "Authentication (not cryptographic)\n"
1085 "Set the GSM network authentication policy\n"
1086 "Require the MS to be activated in HLR\n"
1087 "Accept all MS, whether in HLR or not\n"
1088 "Use SMS-token based authentication\n")
Harald Welte (local)69de3972009-08-12 14:42:23 +02001089{
1090 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001091 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte (local)69de3972009-08-12 14:42:23 +02001092
1093 gsmnet->auth_policy = policy;
1094
1095 return CMD_SUCCESS;
1096}
1097
Harald Welte1085c092009-11-18 20:33:19 +01001098DEFUN(cfg_net_reject_cause,
1099 cfg_net_reject_cause_cmd,
1100 "location updating reject cause <2-111>",
1101 "Set the reject cause of location updating reject\n")
1102{
Harald Weltedcccb182010-05-16 20:52:23 +02001103 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1104
Harald Welte1085c092009-11-18 20:33:19 +01001105 gsmnet->reject_cause = atoi(argv[0]);
1106
1107 return CMD_SUCCESS;
1108}
1109
Harald Welte4381cfe2009-08-30 15:47:06 +09001110DEFUN(cfg_net_encryption,
1111 cfg_net_encryption_cmd,
1112 "encryption a5 (0|1|2)",
Harald Welte28326062010-05-14 20:05:17 +02001113 "Encryption options\n"
1114 "A5 encryption\n" "A5/0: No encryption\n"
1115 "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n")
Harald Welte4381cfe2009-08-30 15:47:06 +09001116{
Harald Weltedcccb182010-05-16 20:52:23 +02001117 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1118
Andreas.Eversberg1059deb2009-11-17 09:55:26 +01001119 gsmnet->a5_encryption= atoi(argv[0]);
Harald Welte4381cfe2009-08-30 15:47:06 +09001120
1121 return CMD_SUCCESS;
1122}
1123
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001124DEFUN(cfg_net_neci,
1125 cfg_net_neci_cmd,
1126 "neci (0|1)",
Harald Welte28326062010-05-14 20:05:17 +02001127 "New Establish Cause Indication\n"
1128 "Don't set the NECI bit\n" "Set the NECI bit\n")
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001129{
Harald Weltedcccb182010-05-16 20:52:23 +02001130 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1131
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001132 gsmnet->neci = atoi(argv[0]);
Holger Hans Peter Freyther78891072010-09-06 09:36:02 +08001133 gsm_net_update_ctype(gsmnet);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001134 return CMD_SUCCESS;
1135}
1136
Harald Welteeab84a12009-12-13 10:53:12 +01001137DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1138 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001139 "Radio Resource Location Protocol\n"
1140 "Set the Radio Resource Location Protocol Mode\n"
1141 "Don't send RRLP request\n"
1142 "Request MS-based location\n"
1143 "Request any location, prefer MS-based\n"
1144 "Request any location, prefer MS-assisted\n")
Harald Welteeab84a12009-12-13 10:53:12 +01001145{
Harald Weltedcccb182010-05-16 20:52:23 +02001146 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1147
Harald Welteeab84a12009-12-13 10:53:12 +01001148 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1149
1150 return CMD_SUCCESS;
1151}
1152
Harald Welte648b6ce2009-12-14 09:00:24 +01001153DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1154 "mm info (0|1)",
1155 "Whether to send MM INFO after LOC UPD ACCEPT")
1156{
Harald Weltedcccb182010-05-16 20:52:23 +02001157 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1158
Harald Welte648b6ce2009-12-14 09:00:24 +01001159 gsmnet->send_mm_info = atoi(argv[0]);
1160
1161 return CMD_SUCCESS;
1162}
1163
Harald Welte8f0ed552010-05-11 21:53:49 +02001164#define HANDOVER_STR "Handover Options\n"
1165
Harald Weltebc814502009-12-19 21:41:52 +01001166DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1167 "handover (0|1)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001168 HANDOVER_STR
1169 "Don't perform in-call handover\n"
1170 "Perform in-call handover\n")
Harald Weltebc814502009-12-19 21:41:52 +01001171{
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001172 int enable = atoi(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001173 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001174
1175 if (enable && ipacc_rtp_direct) {
Harald Weltefe03f0d2009-12-20 13:51:01 +01001176 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1177 "is enabled by using the -P command line option%s",
1178 VTY_NEWLINE);
1179 return CMD_WARNING;
1180 }
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001181 gsmnet->handover.active = enable;
Harald Weltebc814502009-12-19 21:41:52 +01001182
1183 return CMD_SUCCESS;
1184}
1185
Harald Welte8f0ed552010-05-11 21:53:49 +02001186#define HO_WIN_STR HANDOVER_STR "Measurement Window\n"
1187#define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n"
1188#define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n"
1189#define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n"
1190
Harald Welteb720bd32009-12-21 16:51:50 +01001191DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1192 "handover window rxlev averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001193 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001194 "How many RxLev measurements are used for averaging")
1195{
Harald Weltedcccb182010-05-16 20:52:23 +02001196 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001197 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1198 return CMD_SUCCESS;
1199}
1200
1201DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1202 "handover window rxqual averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001203 HO_WIN_RXQUAL_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001204 "How many RxQual measurements are used for averaging")
1205{
Harald Weltedcccb182010-05-16 20:52:23 +02001206 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001207 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1208 return CMD_SUCCESS;
1209}
1210
1211DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1212 "handover window rxlev neighbor averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001213 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001214 "How many RxQual measurements are used for averaging")
1215{
Harald Weltedcccb182010-05-16 20:52:23 +02001216 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001217 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1218 return CMD_SUCCESS;
1219}
1220
1221DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1222 "handover power budget interval <1-99>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001223 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001224 "How often to check if we have a better cell (SACCH frames)")
1225{
Harald Weltedcccb182010-05-16 20:52:23 +02001226 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001227 gsmnet->handover.pwr_interval = atoi(argv[0]);
1228 return CMD_SUCCESS;
1229}
1230
1231DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1232 "handover power budget hysteresis <0-999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001233 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001234 "How many dB does a neighbor to be stronger to become a HO candidate")
1235{
Harald Weltedcccb182010-05-16 20:52:23 +02001236 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001237 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1238 return CMD_SUCCESS;
1239}
1240
1241DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1242 "handover maximum distance <0-9999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001243 HANDOVER_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001244 "How big is the maximum timing advance before HO is forced")
1245{
Harald Weltedcccb182010-05-16 20:52:23 +02001246 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001247 gsmnet->handover.max_distance = atoi(argv[0]);
1248 return CMD_SUCCESS;
1249}
Harald Weltebc814502009-12-19 21:41:52 +01001250
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001251DEFUN(cfg_net_pag_any_tch,
1252 cfg_net_pag_any_tch_cmd,
1253 "paging any use tch (0|1)",
1254 "Assign a TCH when receiving a Paging Any request")
1255{
Holger Hans Peter Freytherb0e88b82010-09-06 10:09:19 +08001256 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001257 gsmnet->pag_any_tch = atoi(argv[0]);
1258 gsm_net_update_ctype(gsmnet);
1259 return CMD_SUCCESS;
1260}
1261
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001262#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001263 DEFUN(cfg_net_T##number, \
1264 cfg_net_T##number##_cmd, \
1265 "timer t" #number " <0-65535>", \
Harald Welte8f0ed552010-05-11 21:53:49 +02001266 "Configure GSM Timers\n" \
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001267 doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001268{ \
Harald Weltedcccb182010-05-16 20:52:23 +02001269 struct gsm_network *gsmnet = gsmnet_from_vty(vty); \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001270 int value = atoi(argv[0]); \
1271 \
1272 if (value < 0 || value > 65535) { \
1273 vty_out(vty, "Timer value %s out of range.%s", \
1274 argv[0], VTY_NEWLINE); \
1275 return CMD_WARNING; \
1276 } \
1277 \
1278 gsmnet->T##number = value; \
1279 return CMD_SUCCESS; \
1280}
1281
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001282DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1283DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1284DECLARE_TIMER(3105, "Currently not used.")
1285DECLARE_TIMER(3107, "Currently not used.")
1286DECLARE_TIMER(3109, "Currently not used.")
Holger Hans Peter Freytherf30c0dc2010-05-31 21:33:15 +08001287DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel.")
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001288DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1289DECLARE_TIMER(3115, "Currently not used.")
1290DECLARE_TIMER(3117, "Currently not used.")
1291DECLARE_TIMER(3119, "Currently not used.")
1292DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001293
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08001294DEFUN(cfg_net_dtx,
1295 cfg_net_dtx_cmd,
1296 "dtx-used (0|1)",
1297 "Enable the usage of DTX.\n"
1298 "DTX is enabled/disabled")
1299{
1300 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1301 gsmnet->dtx_enabled = atoi(argv[0]);
1302 return CMD_SUCCESS;
1303}
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001304
Harald Welte5258fc42009-03-28 19:07:53 +00001305/* per-BTS configuration */
1306DEFUN(cfg_bts,
1307 cfg_bts_cmd,
1308 "bts BTS_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02001309 "Select a BTS to configure\n"
1310 "BTS Number\n")
Harald Welte5258fc42009-03-28 19:07:53 +00001311{
Harald Weltedcccb182010-05-16 20:52:23 +02001312 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte5258fc42009-03-28 19:07:53 +00001313 int bts_nr = atoi(argv[0]);
1314 struct gsm_bts *bts;
1315
Harald Weltee441d9c2009-06-21 16:17:15 +02001316 if (bts_nr > gsmnet->num_bts) {
1317 vty_out(vty, "%% The next unused BTS number is %u%s",
1318 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001319 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001320 } else if (bts_nr == gsmnet->num_bts) {
1321 /* allocate a new one */
1322 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1323 HARDCODED_TSC, HARDCODED_BSIC);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001324 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02001325 bts = gsm_bts_num(gsmnet, bts_nr);
1326
Daniel Willmannf15c2762010-01-11 13:43:07 +01001327 if (!bts) {
1328 vty_out(vty, "%% Unable to allocate BTS %u%s",
1329 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee441d9c2009-06-21 16:17:15 +02001330 return CMD_WARNING;
Daniel Willmannf15c2762010-01-11 13:43:07 +01001331 }
Harald Welte5258fc42009-03-28 19:07:53 +00001332
1333 vty->index = bts;
Harald Welte197dea92010-05-14 17:59:53 +02001334 vty->index_sub = &bts->description;
Harald Welte5258fc42009-03-28 19:07:53 +00001335 vty->node = BTS_NODE;
1336
1337 return CMD_SUCCESS;
1338}
1339
1340DEFUN(cfg_bts_type,
1341 cfg_bts_type_cmd,
1342 "type TYPE",
1343 "Set the BTS type\n")
1344{
1345 struct gsm_bts *bts = vty->index;
Harald Welte39315c42010-01-10 18:01:52 +01001346 int rc;
Harald Welte5258fc42009-03-28 19:07:53 +00001347
Harald Welte39315c42010-01-10 18:01:52 +01001348 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1349 if (rc < 0)
1350 return CMD_WARNING;
Harald Welte8175e952009-10-20 00:22:00 +02001351
Harald Welte5258fc42009-03-28 19:07:53 +00001352 return CMD_SUCCESS;
1353}
1354
Harald Weltefcd24452009-06-20 18:15:19 +02001355DEFUN(cfg_bts_band,
1356 cfg_bts_band_cmd,
1357 "band BAND",
1358 "Set the frequency band of this BTS\n")
1359{
1360 struct gsm_bts *bts = vty->index;
Harald Welte42581822009-08-08 16:12:58 +02001361 int band = gsm_band_parse(argv[0]);
Harald Weltefcd24452009-06-20 18:15:19 +02001362
1363 if (band < 0) {
1364 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1365 band, VTY_NEWLINE);
1366 return CMD_WARNING;
1367 }
1368
1369 bts->band = band;
1370
1371 return CMD_SUCCESS;
1372}
1373
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001374DEFUN(cfg_bts_ci,
1375 cfg_bts_ci_cmd,
1376 "cell_identity <0-65535>",
1377 "Set the Cell identity of this BTS\n")
1378{
1379 struct gsm_bts *bts = vty->index;
1380 int ci = atoi(argv[0]);
1381
1382 if (ci < 0 || ci > 0xffff) {
1383 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1384 ci, VTY_NEWLINE);
1385 return CMD_WARNING;
1386 }
1387 bts->cell_identity = ci;
1388
1389 return CMD_SUCCESS;
1390}
1391
Harald Welte5258fc42009-03-28 19:07:53 +00001392DEFUN(cfg_bts_lac,
1393 cfg_bts_lac_cmd,
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001394 "location_area_code <0-65535>",
Harald Welte5258fc42009-03-28 19:07:53 +00001395 "Set the Location Area Code (LAC) of this BTS\n")
1396{
1397 struct gsm_bts *bts = vty->index;
1398 int lac = atoi(argv[0]);
1399
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001400 if (lac < 0 || lac > 0xffff) {
1401 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte5258fc42009-03-28 19:07:53 +00001402 lac, VTY_NEWLINE);
1403 return CMD_WARNING;
1404 }
Holger Hans Peter Freythere48b9562009-10-01 04:07:15 +02001405
1406 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1407 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1408 lac, VTY_NEWLINE);
1409 return CMD_WARNING;
1410 }
1411
Harald Welte5258fc42009-03-28 19:07:53 +00001412 bts->location_area_code = lac;
1413
1414 return CMD_SUCCESS;
1415}
1416
Harald Weltea43f7892009-12-01 18:04:30 +05301417
Harald Welte5258fc42009-03-28 19:07:53 +00001418DEFUN(cfg_bts_tsc,
1419 cfg_bts_tsc_cmd,
1420 "training_sequence_code <0-255>",
1421 "Set the Training Sequence Code (TSC) of this BTS\n")
1422{
1423 struct gsm_bts *bts = vty->index;
1424 int tsc = atoi(argv[0]);
1425
1426 if (tsc < 0 || tsc > 0xff) {
1427 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1428 tsc, VTY_NEWLINE);
1429 return CMD_WARNING;
1430 }
1431 bts->tsc = tsc;
1432
1433 return CMD_SUCCESS;
1434}
1435
Harald Welte78f2f502009-05-23 16:56:52 +00001436DEFUN(cfg_bts_bsic,
1437 cfg_bts_bsic_cmd,
1438 "base_station_id_code <0-63>",
1439 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1440{
1441 struct gsm_bts *bts = vty->index;
1442 int bsic = atoi(argv[0]);
1443
1444 if (bsic < 0 || bsic > 0x3f) {
Harald Welte42581822009-08-08 16:12:58 +02001445 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte78f2f502009-05-23 16:56:52 +00001446 bsic, VTY_NEWLINE);
1447 return CMD_WARNING;
1448 }
1449 bts->bsic = bsic;
1450
1451 return CMD_SUCCESS;
1452}
1453
1454
Harald Welte4cc34222009-05-01 15:12:31 +00001455DEFUN(cfg_bts_unit_id,
1456 cfg_bts_unit_id_cmd,
Harald Welte07dc73d2009-08-07 13:27:09 +02001457 "ip.access unit_id <0-65534> <0-255>",
1458 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte4cc34222009-05-01 15:12:31 +00001459{
1460 struct gsm_bts *bts = vty->index;
1461 int site_id = atoi(argv[0]);
1462 int bts_id = atoi(argv[1]);
1463
Harald Welte07dc73d2009-08-07 13:27:09 +02001464 if (!is_ipaccess_bts(bts)) {
1465 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1466 return CMD_WARNING;
1467 }
1468
Harald Welte4cc34222009-05-01 15:12:31 +00001469 bts->ip_access.site_id = site_id;
1470 bts->ip_access.bts_id = bts_id;
1471
1472 return CMD_SUCCESS;
1473}
1474
Harald Welte8f0ed552010-05-11 21:53:49 +02001475#define OML_STR "Organization & Maintenance Link\n"
1476#define IPA_STR "ip.access Specific Options\n"
1477
Harald Welte8175e952009-10-20 00:22:00 +02001478DEFUN(cfg_bts_stream_id,
1479 cfg_bts_stream_id_cmd,
1480 "oml ip.access stream_id <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001481 OML_STR IPA_STR
Harald Welte8175e952009-10-20 00:22:00 +02001482 "Set the ip.access Stream ID of the OML link of this BTS\n")
1483{
1484 struct gsm_bts *bts = vty->index;
1485 int stream_id = atoi(argv[0]);
1486
1487 if (!is_ipaccess_bts(bts)) {
1488 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1489 return CMD_WARNING;
1490 }
1491
1492 bts->oml_tei = stream_id;
1493
1494 return CMD_SUCCESS;
1495}
1496
Harald Welte8f0ed552010-05-11 21:53:49 +02001497#define OML_E1_STR OML_STR "E1 Line\n"
Harald Welte8175e952009-10-20 00:22:00 +02001498
Harald Welte42581822009-08-08 16:12:58 +02001499DEFUN(cfg_bts_oml_e1,
1500 cfg_bts_oml_e1_cmd,
1501 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001502 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001503 "E1 interface to be used for OML\n")
1504{
1505 struct gsm_bts *bts = vty->index;
1506
1507 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1508
1509 return CMD_SUCCESS;
1510}
1511
1512
1513DEFUN(cfg_bts_oml_e1_tei,
1514 cfg_bts_oml_e1_tei_cmd,
1515 "oml e1 tei <0-63>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001516 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001517 "Set the TEI to be used for OML")
1518{
1519 struct gsm_bts *bts = vty->index;
1520
1521 bts->oml_tei = atoi(argv[0]);
1522
1523 return CMD_SUCCESS;
1524}
1525
Harald Welte7a8fa412009-08-10 13:48:16 +02001526DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1527 "channel allocator (ascending|descending)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001528 "Channnel Allocator\n" "Channel Allocator\n"
1529 "Allocate Timeslots and Transceivers in ascending order\n"
1530 "Allocate Timeslots and Transceivers in descending order\n")
Harald Welte7a8fa412009-08-10 13:48:16 +02001531{
1532 struct gsm_bts *bts = vty->index;
1533
1534 if (!strcmp(argv[0], "ascending"))
1535 bts->chan_alloc_reverse = 0;
1536 else
1537 bts->chan_alloc_reverse = 1;
1538
1539 return CMD_SUCCESS;
1540}
1541
Harald Welte8f0ed552010-05-11 21:53:49 +02001542#define RACH_STR "Random Access Control Channel\n"
1543
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001544DEFUN(cfg_bts_rach_tx_integer,
1545 cfg_bts_rach_tx_integer_cmd,
1546 "rach tx integer <0-15>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001547 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001548 "Set the raw tx integer value in RACH Control parameters IE")
1549{
1550 struct gsm_bts *bts = vty->index;
1551 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1552 return CMD_SUCCESS;
1553}
1554
1555DEFUN(cfg_bts_rach_max_trans,
1556 cfg_bts_rach_max_trans_cmd,
1557 "rach max transmission (1|2|4|7)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001558 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001559 "Set the maximum number of RACH burst transmissions")
1560{
1561 struct gsm_bts *bts = vty->index;
1562 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1563 return CMD_SUCCESS;
1564}
1565
Harald Welte8f0ed552010-05-11 21:53:49 +02001566#define NM_STR "Network Management\n"
1567
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001568DEFUN(cfg_bts_rach_nm_b_thresh,
1569 cfg_bts_rach_nm_b_thresh_cmd,
1570 "rach nm busy threshold <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001571 RACH_STR NM_STR
1572 "Set the NM Busy Threshold in dB")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001573{
1574 struct gsm_bts *bts = vty->index;
1575 bts->rach_b_thresh = atoi(argv[0]);
1576 return CMD_SUCCESS;
1577}
1578
1579DEFUN(cfg_bts_rach_nm_ldavg,
1580 cfg_bts_rach_nm_ldavg_cmd,
1581 "rach nm load average <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001582 RACH_STR NM_STR
1583 "Set the NM Loadaverage Slots value")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001584{
1585 struct gsm_bts *bts = vty->index;
1586 bts->rach_ldavg_slots = atoi(argv[0]);
1587 return CMD_SUCCESS;
1588}
1589
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001590DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1591 "cell barred (0|1)",
1592 "Should this cell be barred from access?")
1593{
1594 struct gsm_bts *bts = vty->index;
1595
Harald Welte71355012009-12-21 23:08:18 +01001596 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001597
1598 return CMD_SUCCESS;
1599}
1600
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08001601DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd,
1602 "rach emergency call allowed (0|1)",
1603 "Should this cell allow emergency calls?")
1604{
1605 struct gsm_bts *bts = vty->index;
1606
1607 if (atoi(argv[0]) == 0)
1608 bts->si_common.rach_control.t2 |= 0x4;
1609 else
1610 bts->si_common.rach_control.t2 &= ~0x4;
1611
1612 return CMD_SUCCESS;
1613}
1614
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001615DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1616 "ms max power <0-40>",
1617 "Maximum transmit power of the MS")
1618{
1619 struct gsm_bts *bts = vty->index;
1620
1621 bts->ms_max_power = atoi(argv[0]);
1622
1623 return CMD_SUCCESS;
1624}
1625
Harald Welte73225282009-12-12 18:17:25 +01001626DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1627 "cell reselection hysteresis <0-14>",
1628 "Cell Re-Selection Hysteresis in dB")
1629{
1630 struct gsm_bts *bts = vty->index;
1631
1632 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1633
1634 return CMD_SUCCESS;
1635}
1636
1637DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1638 "rxlev access min <0-63>",
1639 "Minimum RxLev needed for cell access (better than -110dBm)")
1640{
1641 struct gsm_bts *bts = vty->index;
1642
1643 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1644
1645 return CMD_SUCCESS;
1646}
1647
Harald Welte (local)efc92312009-08-14 23:09:25 +02001648DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1649 "periodic location update <0-1530>",
1650 "Periodic Location Updating Interval in Minutes")
1651{
1652 struct gsm_bts *bts = vty->index;
1653
Dieter Spaard6613e02010-10-05 21:10:55 +02001654 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 6;
Harald Welte (local)efc92312009-08-14 23:09:25 +02001655
1656 return CMD_SUCCESS;
1657}
1658
Harald Welte8f0ed552010-05-11 21:53:49 +02001659#define GPRS_TEXT "GPRS Packet Network\n"
1660
Harald Welteaf387632010-03-14 23:30:30 +08001661DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welte57ba7e32010-04-18 14:00:26 +02001662 "gprs cell bvci <2-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001663 GPRS_TEXT
1664 "GPRS Cell Settings\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001665 "GPRS BSSGP VC Identifier")
1666{
1667 struct gsm_bts *bts = vty->index;
1668
Harald Welte4511d892010-04-18 15:51:20 +02001669 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001670 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1671 return CMD_WARNING;
1672 }
1673
Harald Welte97a282b2010-03-14 15:37:43 +08001674 bts->gprs.cell.bvci = atoi(argv[0]);
1675
1676 return CMD_SUCCESS;
1677}
1678
Harald Weltea5731cf2010-03-22 11:48:36 +08001679DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
1680 "gprs nsei <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001681 GPRS_TEXT
Harald Weltea5731cf2010-03-22 11:48:36 +08001682 "GPRS NS Entity Identifier")
1683{
1684 struct gsm_bts *bts = vty->index;
1685
Harald Welte4511d892010-04-18 15:51:20 +02001686 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltea5731cf2010-03-22 11:48:36 +08001687 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1688 return CMD_WARNING;
1689 }
1690
1691 bts->gprs.nse.nsei = atoi(argv[0]);
1692
1693 return CMD_SUCCESS;
1694}
1695
Harald Welte8f0ed552010-05-11 21:53:49 +02001696#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
1697 "NSVC Logical Number\n"
Harald Weltea5731cf2010-03-22 11:48:36 +08001698
Harald Welte97a282b2010-03-14 15:37:43 +08001699DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
1700 "gprs nsvc <0-1> nsvci <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001701 GPRS_TEXT NSVC_TEXT
1702 "NS Virtual Connection Identifier\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001703 "GPRS NS VC Identifier")
1704{
1705 struct gsm_bts *bts = vty->index;
1706 int idx = atoi(argv[0]);
1707
Harald Welte4511d892010-04-18 15:51:20 +02001708 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001709 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1710 return CMD_WARNING;
1711 }
1712
Harald Welte97a282b2010-03-14 15:37:43 +08001713 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
1714
1715 return CMD_SUCCESS;
1716}
1717
Harald Welteaf387632010-03-14 23:30:30 +08001718DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
1719 "gprs nsvc <0-1> local udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001720 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001721 "GPRS NS Local UDP Port")
1722{
1723 struct gsm_bts *bts = vty->index;
1724 int idx = atoi(argv[0]);
1725
Harald Welte4511d892010-04-18 15:51:20 +02001726 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001727 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1728 return CMD_WARNING;
1729 }
1730
Harald Welteaf387632010-03-14 23:30:30 +08001731 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
1732
1733 return CMD_SUCCESS;
1734}
1735
1736DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
1737 "gprs nsvc <0-1> remote udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001738 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001739 "GPRS NS Remote UDP Port")
1740{
1741 struct gsm_bts *bts = vty->index;
1742 int idx = atoi(argv[0]);
1743
Harald Welte4511d892010-04-18 15:51:20 +02001744 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001745 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1746 return CMD_WARNING;
1747 }
1748
Harald Welteaf387632010-03-14 23:30:30 +08001749 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
1750
1751 return CMD_SUCCESS;
1752}
1753
1754DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
1755 "gprs nsvc <0-1> remote ip A.B.C.D",
Harald Welte8f0ed552010-05-11 21:53:49 +02001756 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001757 "GPRS NS Remote IP Address")
1758{
1759 struct gsm_bts *bts = vty->index;
1760 int idx = atoi(argv[0]);
1761 struct in_addr ia;
1762
Harald Welte4511d892010-04-18 15:51:20 +02001763 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001764 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1765 return CMD_WARNING;
1766 }
1767
Harald Welteaf387632010-03-14 23:30:30 +08001768 inet_aton(argv[1], &ia);
1769 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
1770
1771 return CMD_SUCCESS;
1772}
1773
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08001774DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd,
1775 "paging free FREE_NR",
1776 "Only page when having a certain amount of free slots. -1 to disable")
1777{
1778 struct gsm_bts *bts = vty->index;
1779
1780 bts->paging.free_chans_need = atoi(argv[0]);
1781 return CMD_SUCCESS;
1782}
1783
Harald Welte615e9562010-05-11 23:50:21 +02001784DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd,
1785 "gprs ns timer " NS_TIMERS " <0-255>",
1786 GPRS_TEXT "Network Service\n"
1787 "Network Service Timer\n"
1788 NS_TIMERS_HELP "Timer Value\n")
1789{
1790 struct gsm_bts *bts = vty->index;
1791 int idx = get_string_value(gprs_ns_timer_strs, argv[0]);
1792 int val = atoi(argv[1]);
1793
1794 if (bts->gprs.mode == BTS_GPRS_NONE) {
1795 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1796 return CMD_WARNING;
1797 }
1798
1799 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
1800 return CMD_WARNING;
1801
1802 bts->gprs.nse.timer[idx] = val;
1803
1804 return CMD_SUCCESS;
1805}
1806
1807#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 +02001808#define BSSGP_TIMERS_HELP \
1809 "Tbvc-block timeout\n" \
1810 "Tbvc-block retries\n" \
1811 "Tbvc-unblock retries\n" \
1812 "Tbvcc-reset timeout\n" \
1813 "Tbvc-reset retries\n" \
1814 "Tbvc-suspend timeout\n" \
1815 "Tbvc-suspend retries\n" \
1816 "Tbvc-resume timeout\n" \
1817 "Tbvc-resume retries\n" \
1818 "Tbvc-capa-update timeout\n" \
1819 "Tbvc-capa-update retries\n"
Harald Welte615e9562010-05-11 23:50:21 +02001820
1821DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd,
1822 "gprs cell timer " BSSGP_TIMERS " <0-255>",
1823 GPRS_TEXT "Cell / BSSGP\n"
1824 "Cell/BSSGP Timer\n"
1825 BSSGP_TIMERS_HELP "Timer Value\n")
1826{
1827 struct gsm_bts *bts = vty->index;
1828 int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
1829 int val = atoi(argv[1]);
1830
1831 if (bts->gprs.mode == BTS_GPRS_NONE) {
1832 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1833 return CMD_WARNING;
1834 }
1835
1836 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer))
1837 return CMD_WARNING;
1838
1839 bts->gprs.cell.timer[idx] = val;
1840
1841 return CMD_SUCCESS;
1842}
1843
Harald Welte97a282b2010-03-14 15:37:43 +08001844DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
1845 "gprs routing area <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001846 GPRS_TEXT
Harald Welte97a282b2010-03-14 15:37:43 +08001847 "GPRS Routing Area Code")
1848{
1849 struct gsm_bts *bts = vty->index;
1850
Harald Welte4511d892010-04-18 15:51:20 +02001851 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001852 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1853 return CMD_WARNING;
1854 }
1855
Harald Welte97a282b2010-03-14 15:37:43 +08001856 bts->gprs.rac = atoi(argv[0]);
1857
1858 return CMD_SUCCESS;
1859}
1860
Harald Welte4511d892010-04-18 15:51:20 +02001861DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
1862 "gprs mode (none|gprs|egprs)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001863 GPRS_TEXT
1864 "GPRS Mode for this BTS\n"
1865 "GPRS Disabled on this BTS\n"
1866 "GPRS Enabled on this BTS\n"
1867 "EGPRS (EDGE) Enabled on this BTS\n")
Harald Welteaf387632010-03-14 23:30:30 +08001868{
1869 struct gsm_bts *bts = vty->index;
Harald Weltef3d8e922010-06-14 22:44:42 +02001870 enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0]);
Harald Welteaf387632010-03-14 23:30:30 +08001871
Harald Weltef3d8e922010-06-14 22:44:42 +02001872 if (mode != BTS_GPRS_NONE &&
1873 !gsm_bts_has_feature(bts, BTS_FEAT_GPRS)) {
1874 vty_out(vty, "This BTS type does not support %s%s", argv[0],
1875 VTY_NEWLINE);
1876 return CMD_WARNING;
1877 }
1878 if (mode == BTS_GPRS_EGPRS &&
1879 !gsm_bts_has_feature(bts, BTS_FEAT_EGPRS)) {
1880 vty_out(vty, "This BTS type does not support %s%s", argv[0],
1881 VTY_NEWLINE);
1882 return CMD_WARNING;
1883 }
1884
1885 bts->gprs.mode = mode;
Harald Welteaf387632010-03-14 23:30:30 +08001886
1887 return CMD_SUCCESS;
1888}
1889
Harald Welte9fbff4a2010-07-30 11:50:09 +02001890#define SI_TEXT "System Information Messages\n"
1891#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)"
1892#define SI_TYPE_HELP "System Information Type 1\n" \
1893 "System Information Type 2\n" \
1894 "System Information Type 3\n" \
1895 "System Information Type 4\n" \
1896 "System Information Type 5\n" \
1897 "System Information Type 6\n" \
1898 "System Information Type 7\n" \
1899 "System Information Type 8\n" \
1900 "System Information Type 9\n" \
1901 "System Information Type 10\n" \
1902 "System Information Type 13\n" \
1903 "System Information Type 16\n" \
1904 "System Information Type 17\n" \
1905 "System Information Type 18\n" \
1906 "System Information Type 19\n" \
1907 "System Information Type 20\n" \
1908 "System Information Type 2bis\n" \
1909 "System Information Type 2ter\n" \
1910 "System Information Type 2quater\n" \
1911 "System Information Type 5bis\n" \
1912 "System Information Type 5ter\n"
1913
1914DEFUN(cfg_bts_si_mode, cfg_bts_si_mode_cmd,
1915 "system-information " SI_TYPE_TEXT " mode (static|computed)",
1916 SI_TEXT SI_TYPE_HELP
1917 "System Information Mode\n"
1918 "Static user-specified\n"
1919 "Dynamic, BSC-computed\n")
1920{
1921 struct gsm_bts *bts = vty->index;
1922 int type;
1923
1924 type = get_string_value(osmo_sitype_strs, argv[0]);
1925 if (type < 0) {
1926 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
1927 return CMD_WARNING;
1928 }
1929
1930 if (!strcmp(argv[1], "static"))
1931 bts->si_mode_static |= (1 << type);
1932 else
1933 bts->si_mode_static &= ~(1 << type);
1934
1935 return CMD_SUCCESS;
1936}
1937
1938DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd,
1939 "system-information " SI_TYPE_TEXT " static HEXSTRING",
1940 SI_TEXT SI_TYPE_HELP
1941 "Static System Information filling\n"
1942 "Static user-specified SI content in HEX notation\n")
1943{
1944 struct gsm_bts *bts = vty->index;
1945 int rc, type;
1946
1947 type = get_string_value(osmo_sitype_strs, argv[0]);
1948 if (type < 0) {
1949 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
1950 return CMD_WARNING;
1951 }
1952
1953 if (!(bts->si_mode_static & (1 << type))) {
1954 vty_out(vty, "SI Type %s is not configured in static mode%s",
1955 get_value_string(osmo_sitype_strs, type), VTY_NEWLINE);
1956 return CMD_WARNING;
1957 }
1958
Harald Welte290aaed2010-07-30 11:53:18 +02001959 /* Fill buffer with padding pattern */
1960 memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type]));
1961
1962 /* Parse the user-specified SI in hex format, [partially] overwriting padding */
Harald Welte9fbff4a2010-07-30 11:50:09 +02001963 rc = hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0]));
1964 if (rc < 0 || rc > sizeof(bts->si_buf[0])) {
1965 vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
1966 return CMD_WARNING;
1967 }
1968
1969 /* Mark this SI as present */
1970 bts->si_valid |= (1 << type);
1971
1972 return CMD_SUCCESS;
1973}
1974
1975
Harald Welte8f0ed552010-05-11 21:53:49 +02001976#define TRX_TEXT "Radio Transceiver\n"
Harald Welte7a8fa412009-08-10 13:48:16 +02001977
Harald Welte5258fc42009-03-28 19:07:53 +00001978/* per TRX configuration */
1979DEFUN(cfg_trx,
1980 cfg_trx_cmd,
1981 "trx TRX_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02001982 TRX_TEXT
Harald Welte5258fc42009-03-28 19:07:53 +00001983 "Select a TRX to configure")
1984{
1985 int trx_nr = atoi(argv[0]);
1986 struct gsm_bts *bts = vty->index;
1987 struct gsm_bts_trx *trx;
1988
Harald Weltee441d9c2009-06-21 16:17:15 +02001989 if (trx_nr > bts->num_trx) {
1990 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
1991 bts->num_trx, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001992 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001993 } else if (trx_nr == bts->num_trx) {
1994 /* we need to allocate a new one */
1995 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001996 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02001997 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001998
Harald Weltee441d9c2009-06-21 16:17:15 +02001999 if (!trx)
2000 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +00002001
2002 vty->index = trx;
Harald Welte197dea92010-05-14 17:59:53 +02002003 vty->index_sub = &trx->description;
Harald Welte5258fc42009-03-28 19:07:53 +00002004 vty->node = TRX_NODE;
2005
2006 return CMD_SUCCESS;
2007}
2008
2009DEFUN(cfg_trx_arfcn,
2010 cfg_trx_arfcn_cmd,
Harald Welte93e90202010-05-14 19:00:52 +02002011 "arfcn <0-1024>",
Harald Welte5258fc42009-03-28 19:07:53 +00002012 "Set the ARFCN for this TRX\n")
2013{
2014 int arfcn = atoi(argv[0]);
2015 struct gsm_bts_trx *trx = vty->index;
2016
2017 /* FIXME: check if this ARFCN is supported by this TRX */
2018
2019 trx->arfcn = arfcn;
2020
2021 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
2022 /* FIXME: use OML layer to update the ARFCN */
2023 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
2024
2025 return CMD_SUCCESS;
2026}
2027
Harald Welte (local)7b37d972009-12-27 20:56:38 +01002028DEFUN(cfg_trx_nominal_power,
2029 cfg_trx_nominal_power_cmd,
2030 "nominal power <0-100>",
2031 "Nominal TRX RF Power in dB\n")
2032{
2033 struct gsm_bts_trx *trx = vty->index;
2034
2035 trx->nominal_power = atoi(argv[0]);
2036
2037 return CMD_SUCCESS;
2038}
2039
Harald Weltefcd24452009-06-20 18:15:19 +02002040DEFUN(cfg_trx_max_power_red,
2041 cfg_trx_max_power_red_cmd,
2042 "max_power_red <0-100>",
2043 "Reduction of maximum BS RF Power in dB\n")
2044{
2045 int maxpwr_r = atoi(argv[0]);
2046 struct gsm_bts_trx *trx = vty->index;
Harald Welte61a83b22009-11-18 09:20:22 +01002047 int upper_limit = 24; /* default 12.21 max power red. */
Harald Weltefcd24452009-06-20 18:15:19 +02002048
2049 /* FIXME: check if our BTS type supports more than 12 */
2050 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
2051 vty_out(vty, "%% Power %d dB is not in the valid range%s",
2052 maxpwr_r, VTY_NEWLINE);
2053 return CMD_WARNING;
2054 }
2055 if (maxpwr_r & 1) {
2056 vty_out(vty, "%% Power %d dB is not an even value%s",
2057 maxpwr_r, VTY_NEWLINE);
2058 return CMD_WARNING;
2059 }
2060
2061 trx->max_power_red = maxpwr_r;
2062
2063 /* FIXME: make sure we update this using OML */
2064
2065 return CMD_SUCCESS;
2066}
2067
Harald Welte42581822009-08-08 16:12:58 +02002068DEFUN(cfg_trx_rsl_e1,
2069 cfg_trx_rsl_e1_cmd,
2070 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
2071 "E1 interface to be used for RSL\n")
2072{
2073 struct gsm_bts_trx *trx = vty->index;
2074
2075 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
2076
2077 return CMD_SUCCESS;
2078}
2079
2080DEFUN(cfg_trx_rsl_e1_tei,
2081 cfg_trx_rsl_e1_tei_cmd,
2082 "rsl e1 tei <0-63>",
2083 "Set the TEI to be used for RSL")
2084{
2085 struct gsm_bts_trx *trx = vty->index;
2086
2087 trx->rsl_tei = atoi(argv[0]);
2088
2089 return CMD_SUCCESS;
2090}
2091
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01002092DEFUN(cfg_trx_rf_locked,
2093 cfg_trx_rf_locked_cmd,
2094 "rf_locked (0|1)",
2095 "Turn off RF of the TRX.\n")
2096{
2097 int locked = atoi(argv[0]);
2098 struct gsm_bts_trx *trx = vty->index;
2099
2100 gsm_trx_lock_rf(trx, locked);
2101 return CMD_SUCCESS;
2102}
Harald Welte42581822009-08-08 16:12:58 +02002103
Harald Welte5258fc42009-03-28 19:07:53 +00002104/* per TS configuration */
2105DEFUN(cfg_ts,
2106 cfg_ts_cmd,
Harald Welte42581822009-08-08 16:12:58 +02002107 "timeslot <0-7>",
Harald Welte5258fc42009-03-28 19:07:53 +00002108 "Select a Timeslot to configure")
2109{
2110 int ts_nr = atoi(argv[0]);
2111 struct gsm_bts_trx *trx = vty->index;
2112 struct gsm_bts_trx_ts *ts;
2113
2114 if (ts_nr >= TRX_NR_TS) {
2115 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
2116 TRX_NR_TS, VTY_NEWLINE);
2117 return CMD_WARNING;
2118 }
2119
2120 ts = &trx->ts[ts_nr];
2121
2122 vty->index = ts;
2123 vty->node = TS_NODE;
2124
2125 return CMD_SUCCESS;
2126}
2127
Harald Weltea6fd58e2009-08-07 00:25:23 +02002128DEFUN(cfg_ts_pchan,
2129 cfg_ts_pchan_cmd,
2130 "phys_chan_config PCHAN",
2131 "Physical Channel configuration (TCH/SDCCH/...)")
2132{
2133 struct gsm_bts_trx_ts *ts = vty->index;
2134 int pchanc;
2135
2136 pchanc = gsm_pchan_parse(argv[0]);
2137 if (pchanc < 0)
2138 return CMD_WARNING;
2139
2140 ts->pchan = pchanc;
2141
2142 return CMD_SUCCESS;
2143}
2144
Harald Weltea39b0f22010-06-14 22:26:10 +02002145#define HOPPING_STR "Configure frequency hopping\n"
2146
2147DEFUN(cfg_ts_hopping,
2148 cfg_ts_hopping_cmd,
2149 "hopping enabled (0|1)",
2150 HOPPING_STR "Enable or disable frequency hopping\n"
2151 "Disable frequency hopping\n" "Enable frequency hopping\n")
2152{
2153 struct gsm_bts_trx_ts *ts = vty->index;
Harald Weltec2fb3d02010-06-14 22:47:37 +02002154 int enabled = atoi(argv[0]);
Harald Weltea39b0f22010-06-14 22:26:10 +02002155
Harald Weltec2fb3d02010-06-14 22:47:37 +02002156 if (enabled && !gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_HOPPING)) {
2157 vty_out(vty, "BTS model does not support hopping%s",
2158 VTY_NEWLINE);
2159 return CMD_WARNING;
2160 }
2161
2162 ts->hopping.enabled = enabled;
Harald Weltea39b0f22010-06-14 22:26:10 +02002163
2164 return CMD_SUCCESS;
2165}
2166
Harald Welte6e0cd042009-09-12 13:05:33 +02002167DEFUN(cfg_ts_hsn,
2168 cfg_ts_hsn_cmd,
Harald Weltea39b0f22010-06-14 22:26:10 +02002169 "hopping sequence-number <0-63>",
2170 HOPPING_STR
Harald Welte6e0cd042009-09-12 13:05:33 +02002171 "Which hopping sequence to use for this channel")
2172{
2173 struct gsm_bts_trx_ts *ts = vty->index;
2174
2175 ts->hopping.hsn = atoi(argv[0]);
2176
2177 return CMD_SUCCESS;
2178}
2179
2180DEFUN(cfg_ts_maio,
2181 cfg_ts_maio_cmd,
2182 "hopping maio <0-63>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002183 HOPPING_STR
Harald Welte6e0cd042009-09-12 13:05:33 +02002184 "Which hopping MAIO to use for this channel")
2185{
2186 struct gsm_bts_trx_ts *ts = vty->index;
2187
2188 ts->hopping.maio = atoi(argv[0]);
2189
2190 return CMD_SUCCESS;
2191}
2192
2193DEFUN(cfg_ts_arfcn_add,
2194 cfg_ts_arfcn_add_cmd,
2195 "hopping arfcn add <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002196 HOPPING_STR "Configure hopping ARFCN list\n"
2197 "Add an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02002198{
2199 struct gsm_bts_trx_ts *ts = vty->index;
2200 int arfcn = atoi(argv[0]);
2201
Harald Weltea39b0f22010-06-14 22:26:10 +02002202 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1);
2203
Harald Welte6e0cd042009-09-12 13:05:33 +02002204 return CMD_SUCCESS;
2205}
2206
2207DEFUN(cfg_ts_arfcn_del,
2208 cfg_ts_arfcn_del_cmd,
2209 "hopping arfcn del <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002210 HOPPING_STR "Configure hopping ARFCN list\n"
2211 "Delete an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02002212{
2213 struct gsm_bts_trx_ts *ts = vty->index;
2214 int arfcn = atoi(argv[0]);
2215
Harald Weltea39b0f22010-06-14 22:26:10 +02002216 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0);
2217
Harald Welte6e0cd042009-09-12 13:05:33 +02002218 return CMD_SUCCESS;
2219}
2220
Harald Weltea6fd58e2009-08-07 00:25:23 +02002221DEFUN(cfg_ts_e1_subslot,
2222 cfg_ts_e1_subslot_cmd,
Harald Welte42581822009-08-08 16:12:58 +02002223 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltea6fd58e2009-08-07 00:25:23 +02002224 "E1 sub-slot connected to this on-air timeslot")
2225{
2226 struct gsm_bts_trx_ts *ts = vty->index;
2227
Harald Welte42581822009-08-08 16:12:58 +02002228 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002229
2230 return CMD_SUCCESS;
2231}
Harald Welte5258fc42009-03-28 19:07:53 +00002232
Harald Welte4f10c252010-05-16 21:47:13 +02002233void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
2234{
2235 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
2236 counter_get(net->stats.chreq.total),
2237 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
2238 vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
2239 counter_get(net->stats.chan.rf_fail),
2240 counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
2241 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
2242 counter_get(net->stats.paging.attempted),
2243 counter_get(net->stats.paging.completed),
2244 counter_get(net->stats.paging.expired), VTY_NEWLINE);
2245 vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
2246 counter_get(net->stats.bts.oml_fail),
2247 counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
2248}
2249
Harald Welte5bc61dc2010-05-16 22:02:16 +02002250DEFUN(logging_fltr_imsi,
2251 logging_fltr_imsi_cmd,
2252 "logging filter imsi IMSI",
2253 LOGGING_STR FILTER_STR
2254 "Filter log messages by IMSI\n" "IMSI to be used as filter\n")
2255{
2256 struct telnet_connection *conn;
2257
2258 conn = (struct telnet_connection *) vty->priv;
2259 if (!conn->dbg) {
2260 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
2261 return CMD_WARNING;
2262 }
2263
2264 log_set_imsi_filter(conn->dbg, argv[0]);
2265 return CMD_SUCCESS;
2266}
2267
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002268DEFUN(drop_bts,
2269 drop_bts_cmd,
Holger Hans Peter Freyther0586b0f2010-04-11 12:46:45 +02002270 "drop bts connection <0-65535> (oml|rsl)",
2271 "Debug/Simulation command to drop ipaccess BTS\n"
2272 "BTS NR\n" "Connection Type\n")
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002273{
2274 struct gsm_network *gsmnet;
2275 struct gsm_bts_trx *trx;
2276 struct gsm_bts *bts;
2277 unsigned int bts_nr;
2278
2279 gsmnet = gsmnet_from_vty(vty);
2280
2281 bts_nr = atoi(argv[0]);
2282 if (bts_nr >= gsmnet->num_bts) {
2283 vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s",
2284 gsmnet->num_bts, bts_nr, VTY_NEWLINE);
2285 return CMD_WARNING;
2286 }
2287
2288 bts = gsm_bts_num(gsmnet, bts_nr);
2289 if (!bts) {
2290 vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE);
2291 return CMD_WARNING;
2292 }
2293
2294 if (!is_ipaccess_bts(bts)) {
2295 vty_out(vty, "This command only works for ipaccess.%s", VTY_NEWLINE);
2296 return CMD_WARNING;
2297 }
2298
2299
2300 /* close all connections */
2301 if (strcmp(argv[1], "oml") == 0) {
Holger Hans Peter Freyther0586b0f2010-04-11 12:46:45 +02002302 if (bts->oml_link)
2303 close(bts->oml_link->ts->driver.ipaccess.fd.fd);
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 Freyther0586b0f2010-04-11 12:46:45 +02002307 if (trx->rsl_link)
2308 close(trx->rsl_link->ts->driver.ipaccess.fd.fd);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002309 }
2310 } else {
2311 vty_out(vty, "Argument must be 'oml# or 'rsl'.%s", VTY_NEWLINE);
2312 return CMD_WARNING;
2313 }
2314
2315 return CMD_SUCCESS;
2316}
2317
2318
Harald Weltedcccb182010-05-16 20:52:23 +02002319extern int bsc_vty_init_extra(void);
Harald Welte1353f962010-05-16 19:20:24 +02002320extern const char *openbsc_copyright;
Holger Hans Peter Freythere1ffc082010-04-10 00:08:28 +02002321
Harald Weltedcccb182010-05-16 20:52:23 +02002322int bsc_vty_init(void)
Harald Welte68628e82009-03-10 12:17:57 +00002323{
Harald Welteb4d5b172010-05-12 16:10:35 +00002324 install_element_ve(&show_net_cmd);
2325 install_element_ve(&show_bts_cmd);
2326 install_element_ve(&show_trx_cmd);
2327 install_element_ve(&show_ts_cmd);
2328 install_element_ve(&show_lchan_cmd);
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08002329 install_element_ve(&show_lchan_summary_cmd);
Harald Welte5bc61dc2010-05-16 22:02:16 +02002330 install_element_ve(&logging_fltr_imsi_cmd);
Harald Welte1bc77352009-03-10 19:47:51 +00002331
Harald Welteb4d5b172010-05-12 16:10:35 +00002332 install_element_ve(&show_e1drv_cmd);
2333 install_element_ve(&show_e1line_cmd);
2334 install_element_ve(&show_e1ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002335
Harald Welteb4d5b172010-05-12 16:10:35 +00002336 install_element_ve(&show_paging_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002337
Harald Welte5bc61dc2010-05-16 22:02:16 +02002338 logging_vty_add_cmds();
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +01002339
Harald Welte5013b2a2009-08-07 13:29:14 +02002340 install_element(CONFIG_NODE, &cfg_net_cmd);
2341 install_node(&net_node, config_write_net);
2342 install_default(GSMNET_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002343 install_element(GSMNET_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002344 install_element(GSMNET_NODE, &ournode_end_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002345 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002346 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
2347 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
2348 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)69de3972009-08-12 14:42:23 +02002349 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte1085c092009-11-18 20:33:19 +01002350 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Welte4381cfe2009-08-30 15:47:06 +09002351 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01002352 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welteeab84a12009-12-13 10:53:12 +01002353 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte3d23db42009-12-14 17:49:15 +01002354 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Weltebc814502009-12-19 21:41:52 +01002355 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Welteb720bd32009-12-21 16:51:50 +01002356 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
2357 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
2358 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
2359 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
2360 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
2361 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01002362 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01002363 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
2364 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
2365 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
2366 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
2367 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
2368 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
2369 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
2370 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
2371 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
2372 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08002373 install_element(GSMNET_NODE, &cfg_net_dtx_cmd);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08002374 install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002375
2376 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte67ce0732009-08-06 19:06:46 +02002377 install_node(&bts_node, config_write_bts);
Harald Welte68628e82009-03-10 12:17:57 +00002378 install_default(BTS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002379 install_element(BTS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002380 install_element(BTS_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002381 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002382 install_element(BTS_NODE, &cfg_description_cmd);
2383 install_element(BTS_NODE, &cfg_no_description_cmd);
Harald Weltefcd24452009-06-20 18:15:19 +02002384 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02002385 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002386 install_element(BTS_NODE, &cfg_bts_lac_cmd);
2387 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002388 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte4cc34222009-05-01 15:12:31 +00002389 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte8175e952009-10-20 00:22:00 +02002390 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002391 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
2392 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02002393 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01002394 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
2395 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08002396 install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd);
2397 install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02002398 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08002399 install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd);
Harald Welte (local)0e451d02009-08-13 10:14:26 +02002400 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)efc92312009-08-14 23:09:25 +02002401 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welte73225282009-12-12 18:17:25 +01002402 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
2403 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Harald Welte4511d892010-04-18 15:51:20 +02002404 install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002405 install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002406 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
2407 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002408 install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
Harald Weltea5731cf2010-03-22 11:48:36 +08002409 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002410 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welteaf387632010-03-14 23:30:30 +08002411 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
2412 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
2413 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08002414 install_element(BTS_NODE, &cfg_bts_pag_free_cmd);
Harald Welte9fbff4a2010-07-30 11:50:09 +02002415 install_element(BTS_NODE, &cfg_bts_si_mode_cmd);
2416 install_element(BTS_NODE, &cfg_bts_si_static_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002417
Harald Welte5258fc42009-03-28 19:07:53 +00002418 install_element(BTS_NODE, &cfg_trx_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002419 install_node(&trx_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002420 install_default(TRX_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002421 install_element(TRX_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002422 install_element(TRX_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002423 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002424 install_element(TRX_NODE, &cfg_description_cmd);
2425 install_element(TRX_NODE, &cfg_no_description_cmd);
Harald Welte (local)7b37d972009-12-27 20:56:38 +01002426 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte879dc972009-06-20 22:36:12 +02002427 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002428 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
2429 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01002430 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002431
Harald Welte5258fc42009-03-28 19:07:53 +00002432 install_element(TRX_NODE, &cfg_ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002433 install_node(&ts_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002434 install_default(TS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002435 install_element(TS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002436 install_element(TS_NODE, &ournode_end_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002437 install_element(TS_NODE, &cfg_ts_pchan_cmd);
Harald Weltea39b0f22010-06-14 22:26:10 +02002438 install_element(TS_NODE, &cfg_ts_hopping_cmd);
Harald Welte6e0cd042009-09-12 13:05:33 +02002439 install_element(TS_NODE, &cfg_ts_hsn_cmd);
2440 install_element(TS_NODE, &cfg_ts_maio_cmd);
2441 install_element(TS_NODE, &cfg_ts_arfcn_add_cmd);
2442 install_element(TS_NODE, &cfg_ts_arfcn_del_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002443 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002444
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002445 install_element(ENABLE_NODE, &drop_bts_cmd);
2446
Harald Welte81c9b9c2010-05-31 16:40:40 +02002447 abis_nm_vty_init();
2448
Harald Weltedcccb182010-05-16 20:52:23 +02002449 bsc_vty_init_extra();
Harald Welte40f82892009-05-23 17:31:39 +00002450
Harald Welte68628e82009-03-10 12:17:57 +00002451 return 0;
2452}