blob: b7844657822727933062a0f1991904e79729ed6f [file] [log] [blame]
Harald Welte59b04682009-06-10 05:40:52 +08001/* OpenBSC interface to quagga VTY */
Harald Welte410575a2010-03-14 23:30:30 +08002/* (C) 2009-2010 by Harald Welte <laforge@gnumonks.org>
Harald Welte59b04682009-06-10 05:40:52 +08003 * 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 Weltebd9591f2010-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 Welte59b04682009-06-10 05:40:52 +080030
31#include <arpa/inet.h>
32
Harald Weltef4625b12010-02-20 16:24:02 +010033#include <osmocore/linuxlist.h>
Harald Welte59b04682009-06-10 05:40:52 +080034#include <openbsc/gsm_data.h>
Harald Welte59b04682009-06-10 05:40:52 +080035#include <openbsc/e1_input.h>
36#include <openbsc/abis_nm.h>
Harald Welted8acf142010-07-30 11:50:09 +020037#include <osmocore/utils.h>
Harald Weltef4625b12010-02-20 16:24:02 +010038#include <osmocore/gsm_utils.h>
Harald Weltefe96f382009-12-22 13:09:29 +010039#include <openbsc/chan_alloc.h>
Harald Welte44007742009-12-22 21:43:14 +010040#include <openbsc/meas_rep.h>
Harald Welte59b04682009-06-10 05:40:52 +080041#include <openbsc/db.h>
Harald Weltef4625b12010-02-20 16:24:02 +010042#include <osmocore/talloc.h>
Holger Hans Peter Freytherb70d45b2010-04-06 11:55:37 +020043#include <openbsc/vty.h>
Harald Weltef45981f2010-05-12 20:28:04 +020044#include <openbsc/gprs_ns.h>
Harald Welted8acf142010-07-30 11:50:09 +020045#include <openbsc/system_information.h>
Harald Welte682ee5f2010-05-16 22:02:16 +020046#include <openbsc/debug.h>
Holger Hans Peter Freyther25176f12010-11-09 17:00:42 +010047#include <openbsc/paging.h>
Holger Hans Peter Freyther03f17d02010-11-15 20:29:46 +010048#include <openbsc/ipaccess.h>
Harald Welte59b04682009-06-10 05:40:52 +080049
Harald Welte10c29f62010-05-16 19:20:24 +020050#include "../bscconfig.h"
51
Harald Welted6b62e32010-05-12 17:19:53 +000052/* FIXME: this should go to some common file */
53static const struct value_string gprs_ns_timer_strs[] = {
Harald Weltea9251762010-05-11 23:50:21 +020054 { 0, "tns-block" },
55 { 1, "tns-block-retries" },
56 { 2, "tns-reset" },
57 { 3, "tns-reset-retries" },
58 { 4, "tns-test" },
59 { 5, "tns-alive" },
60 { 6, "tns-alive-retries" },
61 { 0, NULL }
62};
63
Harald Welted6b62e32010-05-12 17:19:53 +000064static const struct value_string gprs_bssgp_cfg_strs[] = {
Harald Weltea9251762010-05-11 23:50:21 +020065 { 0, "blocking-timer" },
66 { 1, "blocking-retries" },
67 { 2, "unblocking-retries" },
68 { 3, "reset-timer" },
69 { 4, "reset-retries" },
70 { 5, "suspend-timer" },
71 { 6, "suspend-retries" },
72 { 7, "resume-timer" },
73 { 8, "resume-retries" },
74 { 9, "capability-update-timer" },
75 { 10, "capability-update-retries" },
76 { 0, NULL }
77};
78
Harald Weltee87eb462009-08-07 13:29:14 +020079struct cmd_node net_node = {
80 GSMNET_NODE,
81 "%s(network)#",
82 1,
83};
84
Harald Welte59b04682009-06-10 05:40:52 +080085struct cmd_node bts_node = {
86 BTS_NODE,
87 "%s(bts)#",
88 1,
89};
90
91struct cmd_node trx_node = {
92 TRX_NODE,
93 "%s(trx)#",
94 1,
95};
96
97struct cmd_node ts_node = {
98 TS_NODE,
99 "%s(ts)#",
100 1,
101};
102
Harald Welte61daf6d2010-05-27 13:39:40 +0200103extern struct gsm_network *bsc_gsmnet;
104
Harald Welte40152872010-05-16 20:52:23 +0200105struct gsm_network *gsmnet_from_vty(struct vty *v)
106{
Harald Welte61daf6d2010-05-27 13:39:40 +0200107 /* In case we read from the config file, the vty->priv cannot
108 * point to a struct telnet_connection, and thus conn->priv
109 * will not point to the gsm_network structure */
110#if 0
Harald Welte40152872010-05-16 20:52:23 +0200111 struct telnet_connection *conn = v->priv;
112 return (struct gsm_network *) conn->priv;
Harald Welte61daf6d2010-05-27 13:39:40 +0200113#else
114 return bsc_gsmnet;
115#endif
Harald Welte40152872010-05-16 20:52:23 +0200116}
117
Harald Welte59b04682009-06-10 05:40:52 +0800118static int dummy_config_write(struct vty *v)
119{
120 return CMD_SUCCESS;
121}
122
123static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
124{
125 vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s",
126 nm_opstate_name(nms->operational), nms->administrative,
127 nm_avail_name(nms->availability), VTY_NEWLINE);
128}
129
Harald Weltefe96f382009-12-22 13:09:29 +0100130static void dump_pchan_load_vty(struct vty *vty, char *prefix,
131 const struct pchan_load *pl)
132{
133 int i;
134
135 for (i = 0; i < ARRAY_SIZE(pl->pchan); i++) {
136 const struct load_counter *lc = &pl->pchan[i];
137 unsigned int percent;
138
139 if (lc->total == 0)
140 continue;
141
142 percent = (lc->used * 100) / lc->total;
143
144 vty_out(vty, "%s%20s: %3u%% (%u/%u)%s", prefix,
145 gsm_pchan_name(i), percent, lc->used, lc->total,
146 VTY_NEWLINE);
147 }
148}
149
Harald Welte59b04682009-06-10 05:40:52 +0800150static void net_dump_vty(struct vty *vty, struct gsm_network *net)
151{
Harald Weltefe96f382009-12-22 13:09:29 +0100152 struct pchan_load pl;
153
Harald Welte59b04682009-06-10 05:40:52 +0800154 vty_out(vty, "BSC is on Country Code %u, Network Code %u "
155 "and has %u BTS%s", net->country_code, net->network_code,
156 net->num_bts, VTY_NEWLINE);
157 vty_out(vty, " Long network name: '%s'%s",
158 net->name_long, VTY_NEWLINE);
159 vty_out(vty, " Short network name: '%s'%s",
160 net->name_short, VTY_NEWLINE);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +0200161 vty_out(vty, " Authentication policy: %s%s",
162 gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE);
Harald Welte59936d72009-11-18 20:33:19 +0100163 vty_out(vty, " Location updating reject cause: %u%s",
164 net->reject_cause, VTY_NEWLINE);
Harald Weltecca253a2009-08-30 15:47:06 +0900165 vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption,
166 VTY_NEWLINE);
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +0100167 vty_out(vty, " NECI (TCH/H): %u%s", net->neci,
168 VTY_NEWLINE);
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +0800169 vty_out(vty, " Use TCH for Paging any: %d%s", net->pag_any_tch,
170 VTY_NEWLINE);
Harald Welte52af1952009-12-13 10:53:12 +0100171 vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode),
172 VTY_NEWLINE);
Harald Weltea310f3e2009-12-14 09:00:24 +0100173 vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off",
174 VTY_NEWLINE);
Harald Welte0af9c9f2009-12-19 21:41:52 +0100175 vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off",
176 VTY_NEWLINE);
Harald Weltefe96f382009-12-22 13:09:29 +0100177 network_chan_load(&pl, net);
178 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
179 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte59b04682009-06-10 05:40:52 +0800180}
181
182DEFUN(show_net, show_net_cmd, "show network",
183 SHOW_STR "Display information about a GSM NETWORK\n")
184{
Harald Welte40152872010-05-16 20:52:23 +0200185 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800186 net_dump_vty(vty, net);
187
188 return CMD_SUCCESS;
189}
190
191static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l)
192{
193 struct e1inp_line *line;
194
195 if (!e1l) {
196 vty_out(vty, " None%s", VTY_NEWLINE);
197 return;
198 }
199
200 line = e1l->ts->line;
201
202 vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s",
203 line->num, line->driver->name, e1l->ts->num,
204 e1inp_signtype_name(e1l->type), VTY_NEWLINE);
205 vty_out(vty, " E1 TEI %u, SAPI %u%s",
206 e1l->tei, e1l->sapi, VTY_NEWLINE);
207}
208
209static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
210{
Harald Weltefe96f382009-12-22 13:09:29 +0100211 struct pchan_load pl;
212
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +0200213 vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
Harald Welte91afe4c2009-06-20 18:15:19 +0200214 "BSIC %u, TSC %u and %u TRX%s",
215 bts->nr, btstype2str(bts->type), gsm_band_name(bts->band),
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +0200216 bts->cell_identity,
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +0200217 bts->location_area_code, bts->bsic, bts->tsc,
Harald Welte91afe4c2009-06-20 18:15:19 +0200218 bts->num_trx, VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200219 vty_out(vty, "Description: %s%s",
220 bts->description ? bts->description : "(null)", VTY_NEWLINE);
Harald Welte8e9d1792009-12-12 15:38:16 +0100221 vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100222 vty_out(vty, "Minimum Rx Level for Access: %i dBm%s",
Harald Welte8e9d1792009-12-12 15:38:16 +0100223 rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min),
224 VTY_NEWLINE);
225 vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s",
Harald Welteb761bf82009-12-12 18:17:25 +0100226 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +0100227 vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer,
228 VTY_NEWLINE);
229 vty_out(vty, "RACH Max transmissions: %u%s",
230 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
231 VTY_NEWLINE);
Harald Welte8c973ba2009-12-21 23:08:18 +0100232 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)e19be3f2009-08-12 13:28:23 +0200233 vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE);
Harald Welted8acf142010-07-30 11:50:09 +0200234 vty_out(vty, "System Information present: 0x%08x, static: 0x%08x%s",
235 bts->si_valid, bts->si_mode_static, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800236 if (is_ipaccess_bts(bts))
Harald Welte25572872009-10-20 00:22:00 +0200237 vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
Harald Welte59b04682009-06-10 05:40:52 +0800238 bts->ip_access.site_id, bts->ip_access.bts_id,
Harald Welte25572872009-10-20 00:22:00 +0200239 bts->oml_tei, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800240 vty_out(vty, " NM State: ");
241 net_dump_nmstate(vty, &bts->nm_state);
242 vty_out(vty, " Site Mgr NM State: ");
243 net_dump_nmstate(vty, &bts->site_mgr.nm_state);
244 vty_out(vty, " Paging: FIXME pending requests, %u free slots%s",
245 bts->paging.available_slots, VTY_NEWLINE);
Holger Hans Peter Freytherb5c79c92010-11-25 16:28:45 +0100246 if (is_ipaccess_bts(bts)) {
247 vty_out(vty, " OML Link state: %s.%s",
248 bts->oml_link ? "connected" : "disconnected", VTY_NEWLINE);
249 } else {
Harald Welte25572872009-10-20 00:22:00 +0200250 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
251 e1isl_dump_vty(vty, bts->oml_link);
252 }
Holger Hans Peter Freytherb5c79c92010-11-25 16:28:45 +0100253
254 /* FIXME: chan_desc */
Harald Weltefe96f382009-12-22 13:09:29 +0100255 memset(&pl, 0, sizeof(pl));
256 bts_chan_load(&pl, bts);
257 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
258 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte59b04682009-06-10 05:40:52 +0800259}
260
261DEFUN(show_bts, show_bts_cmd, "show bts [number]",
262 SHOW_STR "Display information about a BTS\n"
263 "BTS number")
264{
Harald Welte40152872010-05-16 20:52:23 +0200265 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800266 int bts_nr;
267
268 if (argc != 0) {
269 /* use the BTS number that the user has specified */
270 bts_nr = atoi(argv[0]);
271 if (bts_nr > net->num_bts) {
272 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
273 VTY_NEWLINE);
274 return CMD_WARNING;
275 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200276 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte59b04682009-06-10 05:40:52 +0800277 return CMD_SUCCESS;
278 }
279 /* print all BTS's */
280 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee712a5f2009-06-21 16:17:15 +0200281 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte59b04682009-06-10 05:40:52 +0800282
283 return CMD_SUCCESS;
284}
285
Harald Welte62868882009-08-08 16:12:58 +0200286/* utility functions */
287static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
288 const char *ts, const char *ss)
289{
290 e1_link->e1_nr = atoi(line);
291 e1_link->e1_ts = atoi(ts);
292 if (!strcmp(ss, "full"))
293 e1_link->e1_ts_ss = 255;
294 else
295 e1_link->e1_ts_ss = atoi(ss);
296}
297
298static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,
299 const char *prefix)
300{
301 if (!e1_link->e1_ts)
302 return;
303
304 if (e1_link->e1_ts_ss == 255)
305 vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s",
306 prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE);
307 else
308 vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s",
309 prefix, e1_link->e1_nr, e1_link->e1_ts,
310 e1_link->e1_ts_ss, VTY_NEWLINE);
311}
312
313
Harald Welte97ceef92009-08-06 19:06:46 +0200314static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
315{
Harald Welte62868882009-08-08 16:12:58 +0200316 vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
317 if (ts->pchan != GSM_PCHAN_NONE)
318 vty_out(vty, " phys_chan_config %s%s",
319 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
Harald Weltea42a93f2010-06-14 22:26:10 +0200320 vty_out(vty, " hopping enabled %u%s",
321 ts->hopping.enabled, VTY_NEWLINE);
322 if (ts->hopping.enabled) {
323 unsigned int i;
324 vty_out(vty, " hopping sequence-number %u%s",
Harald Welte67104d12009-09-12 13:05:33 +0200325 ts->hopping.hsn, VTY_NEWLINE);
Harald Weltea42a93f2010-06-14 22:26:10 +0200326 vty_out(vty, " hopping maio %u%s",
Harald Welte67104d12009-09-12 13:05:33 +0200327 ts->hopping.maio, VTY_NEWLINE);
Harald Weltea42a93f2010-06-14 22:26:10 +0200328 for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) {
329 if (!bitvec_get_bit_pos(&ts->hopping.arfcns, i))
330 continue;
331 vty_out(vty, " hopping arfcn add %u%s",
332 i, VTY_NEWLINE);
333 }
334 } else
Harald Welte62868882009-08-08 16:12:58 +0200335 config_write_e1_link(vty, &ts->e1_link, " ");
Harald Welte97ceef92009-08-06 19:06:46 +0200336}
337
338static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
339{
340 int i;
341
Harald Weltee87eb462009-08-07 13:29:14 +0200342 vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200343 if (trx->description)
344 vty_out(vty, " description %s%s", trx->description,
345 VTY_NEWLINE);
Holger Hans Peter Freyther32be2aa2010-04-17 06:42:07 +0200346 vty_out(vty, " rf_locked %u%s",
347 trx->nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
348 VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200349 vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
Harald Welte (local)b709bfe2009-12-27 20:56:38 +0100350 vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200351 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200352 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
353 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte97ceef92009-08-06 19:06:46 +0200354
355 for (i = 0; i < TRX_NR_TS; i++)
356 config_write_ts_single(vty, &trx->ts[i]);
357}
358
Harald Weltea9251762010-05-11 23:50:21 +0200359static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
360{
361 unsigned int i;
362 vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode),
363 VTY_NEWLINE);
364 if (bts->gprs.mode == BTS_GPRS_NONE)
365 return;
366
367 vty_out(vty, " gprs routing area %u%s", bts->gprs.rac,
368 VTY_NEWLINE);
369 vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
370 VTY_NEWLINE);
371 for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++)
372 vty_out(vty, " gprs cell timer %s %u%s",
373 get_value_string(gprs_bssgp_cfg_strs, i),
374 bts->gprs.cell.timer[i], VTY_NEWLINE);
375 vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei,
376 VTY_NEWLINE);
377 for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++)
378 vty_out(vty, " gprs ns timer %s %u%s",
379 get_value_string(gprs_ns_timer_strs, i),
380 bts->gprs.nse.timer[i], VTY_NEWLINE);
381 for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
382 struct gsm_bts_gprs_nsvc *nsvc =
383 &bts->gprs.nsvc[i];
384 struct in_addr ia;
385
386 ia.s_addr = htonl(nsvc->remote_ip);
387 vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
388 nsvc->nsvci, VTY_NEWLINE);
389 vty_out(vty, " gprs nsvc %u local udp port %u%s", i,
390 nsvc->local_port, VTY_NEWLINE);
391 vty_out(vty, " gprs nsvc %u remote udp port %u%s", i,
392 nsvc->remote_port, VTY_NEWLINE);
393 vty_out(vty, " gprs nsvc %u remote ip %s%s", i,
394 inet_ntoa(ia), VTY_NEWLINE);
395 }
396}
397
Harald Welte97ceef92009-08-06 19:06:46 +0200398static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
399{
400 struct gsm_bts_trx *trx;
Harald Welted8acf142010-07-30 11:50:09 +0200401 int i;
Harald Welte97ceef92009-08-06 19:06:46 +0200402
Harald Weltee87eb462009-08-07 13:29:14 +0200403 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
404 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200405 if (bts->description)
406 vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200407 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freyther6d82b7c2009-11-19 16:38:49 +0100408 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200409 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte97ceef92009-08-06 19:06:46 +0200410 VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200411 vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE);
412 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)cbd46102009-08-13 10:14:26 +0200413 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100414 vty_out(vty, " cell reselection hysteresis %u%s",
415 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
416 vty_out(vty, " rxlev access min %u%s",
417 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Sylvain Munaut00d71462010-11-28 18:17:28 +0100418
419 if (bts->si_common.cell_ro_sel_par.present) {
420 struct gsm48_si_selection_params *sp;
421 sp = &bts->si_common.cell_ro_sel_par;
422
423 if (sp->cbq)
424 vty_out(vty, " cell bar qualify %u%s",
425 sp->cbq, VTY_NEWLINE);
426
427 if (sp->cell_resel_off)
428 vty_out(vty, " cell reselection offset %u%s",
429 sp->cell_resel_off*2, VTY_NEWLINE);
430
431 if (sp->temp_offs == 7)
432 vty_out(vty, " temporary offset infinite%s",
433 VTY_NEWLINE);
434 else if (sp->temp_offs)
435 vty_out(vty, " temporary offset %u%s",
436 sp->temp_offs*10, VTY_NEWLINE);
437
438 if (sp->penalty_time == 31)
439 vty_out(vty, " penalty time reserved%s",
440 VTY_NEWLINE);
441 else if (sp->penalty_time)
442 vty_out(vty, " penalty time %u%s",
443 (sp->penalty_time*20)+20, VTY_NEWLINE);
444 }
445
Harald Weltea54a2bb2009-12-01 18:04:30 +0530446 if (bts->si_common.chan_desc.t3212)
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +0200447 vty_out(vty, " periodic location update %u%s",
Dieter Spaarb0f746d2010-10-05 21:10:55 +0200448 bts->si_common.chan_desc.t3212 * 6, VTY_NEWLINE);
Harald Welte3e774612009-08-10 13:48:16 +0200449 vty_out(vty, " channel allocator %s%s",
450 bts->chan_alloc_reverse ? "descending" : "ascending",
451 VTY_NEWLINE);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +0100452 vty_out(vty, " rach tx integer %u%s",
453 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
454 vty_out(vty, " rach max transmission %u%s",
455 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
456 VTY_NEWLINE);
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +0800457
458 if (bts->rach_b_thresh != -1)
459 vty_out(vty, " rach nm busy threshold %u%s",
460 bts->rach_b_thresh, VTY_NEWLINE);
461 if (bts->rach_ldavg_slots != -1)
462 vty_out(vty, " rach nm load average %u%s",
463 bts->rach_ldavg_slots, VTY_NEWLINE);
Harald Welte8c973ba2009-12-21 23:08:18 +0100464 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)e19be3f2009-08-12 13:28:23 +0200465 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Holger Hans Peter Freyther440984b2010-05-14 00:39:19 +0800466 if ((bts->si_common.rach_control.t2 & 0x4) == 0)
467 vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE);
Harald Welted8acf142010-07-30 11:50:09 +0200468 for (i = SYSINFO_TYPE_1; i < _MAX_SYSINFO_TYPE; i++) {
469 if (bts->si_mode_static & (1 << i)) {
470 vty_out(vty, " system-information %s mode static%s",
471 get_value_string(osmo_sitype_strs, i), VTY_NEWLINE);
472 vty_out(vty, " system-information %s static %s%s",
473 get_value_string(osmo_sitype_strs, i),
474 hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])),
475 VTY_NEWLINE);
476 }
477 }
Harald Welte25572872009-10-20 00:22:00 +0200478 if (is_ipaccess_bts(bts)) {
Harald Weltee87eb462009-08-07 13:29:14 +0200479 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Welte3ffe1b32009-08-07 00:25:23 +0200480 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte25572872009-10-20 00:22:00 +0200481 vty_out(vty, " oml ip.access stream_id %u%s", bts->oml_tei, VTY_NEWLINE);
482 } else {
Harald Welte62868882009-08-08 16:12:58 +0200483 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
484 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
485 }
Holger Hans Peter Freyther3112f672010-09-06 10:11:25 +0800486
487 /* if we have a limit, write it */
488 if (bts->paging.free_chans_need >= 0)
489 vty_out(vty, " paging free %d%s", bts->paging.free_chans_need, VTY_NEWLINE);
490
Harald Weltea9251762010-05-11 23:50:21 +0200491 config_write_bts_gprs(vty, bts);
Harald Welte97ceef92009-08-06 19:06:46 +0200492
493 llist_for_each_entry(trx, &bts->trx_list, list)
494 config_write_trx_single(vty, trx);
495}
496
497static int config_write_bts(struct vty *v)
498{
Harald Welte40152872010-05-16 20:52:23 +0200499 struct gsm_network *gsmnet = gsmnet_from_vty(v);
Harald Welte97ceef92009-08-06 19:06:46 +0200500 struct gsm_bts *bts;
501
502 llist_for_each_entry(bts, &gsmnet->bts_list, list)
503 config_write_bts_single(v, bts);
504
505 return CMD_SUCCESS;
506}
507
Harald Weltee87eb462009-08-07 13:29:14 +0200508static int config_write_net(struct vty *vty)
509{
Harald Welte40152872010-05-16 20:52:23 +0200510 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
511
Harald Weltee87eb462009-08-07 13:29:14 +0200512 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200513 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200514 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200515 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
516 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +0200517 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Harald Welte59936d72009-11-18 20:33:19 +0100518 vty_out(vty, " location updating reject cause %u%s",
519 gsmnet->reject_cause, VTY_NEWLINE);
Harald Weltecca253a2009-08-30 15:47:06 +0900520 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freyther6b4f5462009-11-19 16:37:48 +0100521 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +0800522 vty_out(vty, " paging any use tch %d%s", gsmnet->pag_any_tch, VTY_NEWLINE);
Harald Welte52af1952009-12-13 10:53:12 +0100523 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
524 VTY_NEWLINE);
Harald Weltea310f3e2009-12-14 09:00:24 +0100525 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Welte0af9c9f2009-12-19 21:41:52 +0100526 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Weltea8062f12009-12-21 16:51:50 +0100527 vty_out(vty, " handover window rxlev averaging %u%s",
528 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
529 vty_out(vty, " handover window rxqual averaging %u%s",
530 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
531 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
532 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
533 vty_out(vty, " handover power budget interval %u%s",
534 gsmnet->handover.pwr_interval, VTY_NEWLINE);
535 vty_out(vty, " handover power budget hysteresis %u%s",
536 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
537 vty_out(vty, " handover maximum distance %u%s",
538 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +0100539 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +0100540 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
541 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
542 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
543 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
544 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
545 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
546 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
547 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
548 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
549 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Holger Hans Peter Freyther21d63ff2010-09-06 09:25:48 +0800550 vty_out(vty, " use-dtx %u%s", gsmnet->dtx_enabled, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200551
552 return CMD_SUCCESS;
553}
Harald Welte97ceef92009-08-06 19:06:46 +0200554
Harald Welte59b04682009-06-10 05:40:52 +0800555static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
556{
557 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
558 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200559 vty_out(vty, "Description: %s%s",
560 trx->description ? trx->description : "(null)", VTY_NEWLINE);
Harald Welte91afe4c2009-06-20 18:15:19 +0200561 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte62868882009-08-08 16:12:58 +0200562 "resulting BS power: %d dBm%s",
Harald Welte91afe4c2009-06-20 18:15:19 +0200563 trx->nominal_power, trx->max_power_red,
Harald Welte62868882009-08-08 16:12:58 +0200564 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800565 vty_out(vty, " NM State: ");
566 net_dump_nmstate(vty, &trx->nm_state);
567 vty_out(vty, " Baseband Transceiver NM State: ");
568 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte25572872009-10-20 00:22:00 +0200569 if (is_ipaccess_bts(trx->bts)) {
570 vty_out(vty, " ip.access stream ID: 0x%02x%s",
571 trx->rsl_tei, VTY_NEWLINE);
572 } else {
573 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
574 e1isl_dump_vty(vty, trx->rsl_link);
575 }
Harald Welte59b04682009-06-10 05:40:52 +0800576}
577
578DEFUN(show_trx,
579 show_trx_cmd,
580 "show trx [bts_nr] [trx_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200581 SHOW_STR "Display information about a TRX\n"
582 "BTS Number\n"
583 "TRX Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800584{
Harald Welte40152872010-05-16 20:52:23 +0200585 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800586 struct gsm_bts *bts = NULL;
587 struct gsm_bts_trx *trx;
588 int bts_nr, trx_nr;
589
590 if (argc >= 1) {
591 /* use the BTS number that the user has specified */
592 bts_nr = atoi(argv[0]);
593 if (bts_nr >= net->num_bts) {
594 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
595 VTY_NEWLINE);
596 return CMD_WARNING;
597 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200598 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800599 }
600 if (argc >= 2) {
601 trx_nr = atoi(argv[1]);
602 if (trx_nr >= bts->num_trx) {
603 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
604 VTY_NEWLINE);
605 return CMD_WARNING;
606 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200607 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800608 trx_dump_vty(vty, trx);
609 return CMD_SUCCESS;
610 }
611 if (bts) {
612 /* print all TRX in this BTS */
613 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200614 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800615 trx_dump_vty(vty, trx);
616 }
617 return CMD_SUCCESS;
618 }
619
620 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200621 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800622 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200623 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800624 trx_dump_vty(vty, trx);
625 }
626 }
627
628 return CMD_SUCCESS;
629}
630
Harald Welte97ceef92009-08-06 19:06:46 +0200631
Harald Welte59b04682009-06-10 05:40:52 +0800632static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
633{
Harald Welte59b04682009-06-10 05:40:52 +0800634 vty_out(vty, "Timeslot %u of TRX %u in BTS %u, phys cfg %s%s",
635 ts->nr, ts->trx->nr, ts->trx->bts->nr,
636 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
637 vty_out(vty, " NM State: ");
638 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte87504212009-12-02 01:56:49 +0530639 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welte59b04682009-06-10 05:40:52 +0800640 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
641 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
642 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800643}
644
645DEFUN(show_ts,
646 show_ts_cmd,
647 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200648 SHOW_STR "Display information about a TS\n"
649 "BTS Number\n" "TRX Number\n" "Timeslot Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800650{
Harald Welte40152872010-05-16 20:52:23 +0200651 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800652 struct gsm_bts *bts;
653 struct gsm_bts_trx *trx;
654 struct gsm_bts_trx_ts *ts;
655 int bts_nr, trx_nr, ts_nr;
656
657 if (argc >= 1) {
658 /* use the BTS number that the user has specified */
659 bts_nr = atoi(argv[0]);
660 if (bts_nr >= net->num_bts) {
661 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
662 VTY_NEWLINE);
663 return CMD_WARNING;
664 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200665 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800666 }
667 if (argc >= 2) {
668 trx_nr = atoi(argv[1]);
669 if (trx_nr >= bts->num_trx) {
670 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
671 VTY_NEWLINE);
672 return CMD_WARNING;
673 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200674 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800675 }
676 if (argc >= 3) {
677 ts_nr = atoi(argv[2]);
678 if (ts_nr >= TRX_NR_TS) {
679 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
680 VTY_NEWLINE);
681 return CMD_WARNING;
682 }
683 ts = &trx->ts[ts_nr];
684 ts_dump_vty(vty, ts);
685 return CMD_SUCCESS;
686 }
687 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200688 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800689 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200690 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800691 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
692 ts = &trx->ts[ts_nr];
693 ts_dump_vty(vty, ts);
694 }
695 }
696 }
697
698 return CMD_SUCCESS;
699}
700
Holger Hans Peter Freyther1dd0a1b2010-01-06 06:00:40 +0100701static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte59b04682009-06-10 05:40:52 +0800702{
Harald Welte91afe4c2009-06-20 18:15:19 +0200703 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte59b04682009-06-10 05:40:52 +0800704 subscr->authorized, VTY_NEWLINE);
705 if (subscr->name)
706 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
707 if (subscr->extension)
708 vty_out(vty, " Extension: %s%s", subscr->extension,
709 VTY_NEWLINE);
710 if (subscr->imsi)
711 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freythercd8bacf2009-08-19 12:53:57 +0200712 if (subscr->tmsi != GSM_RESERVED_TMSI)
713 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte270c06c2009-08-15 03:24:51 +0200714 VTY_NEWLINE);
Sylvain Munaute5863a22009-12-27 19:29:28 +0100715
Harald Welte (local)02d5efa2009-08-14 20:27:16 +0200716 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800717}
718
Harald Welte44007742009-12-22 21:43:14 +0100719static void meas_rep_dump_uni_vty(struct vty *vty,
720 struct gsm_meas_rep_unidir *mru,
721 const char *prefix,
722 const char *dir)
723{
724 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
725 prefix, dir, rxlev2dbm(mru->full.rx_lev),
726 dir, rxlev2dbm(mru->sub.rx_lev));
727 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
728 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
729 VTY_NEWLINE);
730}
731
732static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
733 const char *prefix)
734{
735 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
736 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
737 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
738 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
739 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
740 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
741 VTY_NEWLINE);
742 if (mr->flags & MEAS_REP_F_MS_TO)
743 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
744 mr->ms_timing_offset, VTY_NEWLINE);
745 if (mr->flags & MEAS_REP_F_MS_L1)
746 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
747 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
748 if (mr->flags & MEAS_REP_F_DL_VALID)
749 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
750 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
751}
752
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800753static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
Harald Welte59b04682009-06-10 05:40:52 +0800754{
Harald Welte44007742009-12-22 21:43:14 +0100755 int idx;
756
Harald Welte59b04682009-06-10 05:40:52 +0800757 vty_out(vty, "Lchan %u in Timeslot %u of TRX %u in BTS %u, Type %s%s",
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +0200758 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
Harald Welte (local)02204d02009-12-27 18:05:25 +0100759 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Harald Welte59b04682009-06-10 05:40:52 +0800760 VTY_NEWLINE);
Holger Hans Peter Freyther6e5c50f2010-06-28 17:09:29 +0800761 vty_out(vty, " Connection: %u, State: %s%s",
762 lchan->conn ? 1: 0,
Harald Welteab2534c2009-12-29 10:52:38 +0100763 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100764 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
765 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
766 - lchan->bs_power*2,
767 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
768 VTY_NEWLINE);
Holger Hans Peter Freyther1a95fa82010-06-28 15:47:12 +0800769 if (lchan->conn && lchan->conn->subscr) {
Harald Welte59b04682009-06-10 05:40:52 +0800770 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther1a95fa82010-06-28 15:47:12 +0800771 subscr_dump_vty(vty, lchan->conn->subscr);
Harald Welte59b04682009-06-10 05:40:52 +0800772 } else
773 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte87504212009-12-02 01:56:49 +0530774 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
775 struct in_addr ia;
Holger Hans Peter Freythercec1ec52010-04-07 15:39:16 +0200776 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte87504212009-12-02 01:56:49 +0530777 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
778 inet_ntoa(ia), lchan->abis_ip.bound_port,
779 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
780 VTY_NEWLINE);
781 }
Harald Welte44007742009-12-22 21:43:14 +0100782
783 /* we want to report the last measurement report */
784 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
785 lchan->meas_rep_idx, 1);
786 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte59b04682009-06-10 05:40:52 +0800787}
788
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +0800789static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
790{
Holger Hans Peter Freythercf13a922010-05-14 01:57:02 +0800791 struct gsm_meas_rep *mr;
792 int idx;
793
794 /* we want to report the last measurement report */
795 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
796 lchan->meas_rep_idx, 1);
797 mr = &lchan->meas_rep[idx];
798
799 vty_out(vty, "Lchan: %u Timeslot: %u TRX: %u BTS: %u Type: %s - L1 MS Power: %u dBm "
800 "RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +0800801 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
802 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Holger Hans Peter Freythercf13a922010-05-14 01:57:02 +0800803 mr->ms_l1.pwr,
804 rxlev2dbm(mr->dl.full.rx_lev),
805 rxlev2dbm(mr->ul.full.rx_lev),
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +0800806 VTY_NEWLINE);
807}
808
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800809static int lchan_summary(struct vty *vty, int argc, const char **argv,
810 void (*dump_cb)(struct vty *, struct gsm_lchan *))
Harald Welte59b04682009-06-10 05:40:52 +0800811{
Harald Welte40152872010-05-16 20:52:23 +0200812 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800813 struct gsm_bts *bts;
814 struct gsm_bts_trx *trx;
815 struct gsm_bts_trx_ts *ts;
816 struct gsm_lchan *lchan;
817 int bts_nr, trx_nr, ts_nr, lchan_nr;
818
819 if (argc >= 1) {
820 /* use the BTS number that the user has specified */
821 bts_nr = atoi(argv[0]);
822 if (bts_nr >= net->num_bts) {
823 vty_out(vty, "%% can't find BTS %s%s", argv[0],
824 VTY_NEWLINE);
825 return CMD_WARNING;
826 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200827 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800828 }
829 if (argc >= 2) {
830 trx_nr = atoi(argv[1]);
831 if (trx_nr >= bts->num_trx) {
832 vty_out(vty, "%% can't find TRX %s%s", argv[1],
833 VTY_NEWLINE);
834 return CMD_WARNING;
835 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200836 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800837 }
838 if (argc >= 3) {
839 ts_nr = atoi(argv[2]);
840 if (ts_nr >= TRX_NR_TS) {
841 vty_out(vty, "%% can't find TS %s%s", argv[2],
842 VTY_NEWLINE);
843 return CMD_WARNING;
844 }
845 ts = &trx->ts[ts_nr];
846 }
847 if (argc >= 4) {
848 lchan_nr = atoi(argv[3]);
849 if (lchan_nr >= TS_MAX_LCHAN) {
850 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
851 VTY_NEWLINE);
852 return CMD_WARNING;
853 }
854 lchan = &ts->lchan[lchan_nr];
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800855 dump_cb(vty, lchan);
Harald Welte59b04682009-06-10 05:40:52 +0800856 return CMD_SUCCESS;
857 }
858 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200859 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800860 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200861 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800862 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
863 ts = &trx->ts[ts_nr];
864 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
865 lchan_nr++) {
866 lchan = &ts->lchan[lchan_nr];
867 if (lchan->type == GSM_LCHAN_NONE)
868 continue;
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800869 dump_cb(vty, lchan);
Harald Welte59b04682009-06-10 05:40:52 +0800870 }
871 }
872 }
873 }
874
875 return CMD_SUCCESS;
876}
877
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800878
879DEFUN(show_lchan,
880 show_lchan_cmd,
881 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
882 SHOW_STR "Display information about a logical channel\n"
883 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
884 "Logical Channel Number\n")
885
886{
887 return lchan_summary(vty, argc, argv, lchan_dump_full_vty);
888}
889
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +0800890DEFUN(show_lchan_summary,
891 show_lchan_summary_cmd,
892 "show lchan summary [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
893 SHOW_STR "Display information about a logical channel\n"
894 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
895 "Logical Channel Number\n")
896{
897 return lchan_summary(vty, argc, argv, lchan_dump_short_vty);
898}
899
Harald Welte59b04682009-06-10 05:40:52 +0800900static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
901{
902 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
903}
904
905DEFUN(show_e1drv,
906 show_e1drv_cmd,
907 "show e1_driver",
908 SHOW_STR "Display information about available E1 drivers\n")
909{
910 struct e1inp_driver *drv;
911
912 llist_for_each_entry(drv, &e1inp_driver_list, list)
913 e1drv_dump_vty(vty, drv);
914
915 return CMD_SUCCESS;
916}
917
918static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
919{
920 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
921 line->num, line->name ? line->name : "",
922 line->driver->name, VTY_NEWLINE);
923}
924
925DEFUN(show_e1line,
926 show_e1line_cmd,
927 "show e1_line [line_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200928 SHOW_STR "Display information about a E1 line\n"
929 "E1 Line Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800930{
931 struct e1inp_line *line;
932
933 if (argc >= 1) {
934 int num = atoi(argv[0]);
935 llist_for_each_entry(line, &e1inp_line_list, list) {
936 if (line->num == num) {
937 e1line_dump_vty(vty, line);
938 return CMD_SUCCESS;
939 }
940 }
941 return CMD_WARNING;
942 }
943
944 llist_for_each_entry(line, &e1inp_line_list, list)
945 e1line_dump_vty(vty, line);
946
947 return CMD_SUCCESS;
948}
949
950static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
951{
Harald Welte62868882009-08-08 16:12:58 +0200952 if (ts->type == E1INP_TS_TYPE_NONE)
953 return;
Harald Welte59b04682009-06-10 05:40:52 +0800954 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
955 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
956 VTY_NEWLINE);
957}
958
959DEFUN(show_e1ts,
960 show_e1ts_cmd,
961 "show e1_timeslot [line_nr] [ts_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200962 SHOW_STR "Display information about a E1 timeslot\n"
963 "E1 Line Number\n" "E1 Timeslot Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800964{
Harald Welte49c79562009-11-17 06:12:16 +0100965 struct e1inp_line *line = NULL;
Harald Welte59b04682009-06-10 05:40:52 +0800966 struct e1inp_ts *ts;
967 int ts_nr;
968
969 if (argc == 0) {
970 llist_for_each_entry(line, &e1inp_line_list, list) {
971 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
972 ts = &line->ts[ts_nr];
973 e1ts_dump_vty(vty, ts);
974 }
975 }
976 return CMD_SUCCESS;
977 }
978 if (argc >= 1) {
979 int num = atoi(argv[0]);
980 llist_for_each_entry(line, &e1inp_line_list, list) {
981 if (line->num == num)
982 break;
983 }
984 if (!line || line->num != num) {
985 vty_out(vty, "E1 line %s is invalid%s",
986 argv[0], VTY_NEWLINE);
987 return CMD_WARNING;
988 }
989 }
990 if (argc >= 2) {
991 ts_nr = atoi(argv[1]);
992 if (ts_nr > NUM_E1_TS) {
993 vty_out(vty, "E1 timeslot %s is invalid%s",
994 argv[1], VTY_NEWLINE);
995 return CMD_WARNING;
996 }
997 ts = &line->ts[ts_nr];
998 e1ts_dump_vty(vty, ts);
999 return CMD_SUCCESS;
1000 } else {
1001 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
1002 ts = &line->ts[ts_nr];
1003 e1ts_dump_vty(vty, ts);
1004 }
1005 return CMD_SUCCESS;
1006 }
1007 return CMD_SUCCESS;
1008}
1009
1010static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
1011{
1012 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
1013 subscr_dump_vty(vty, pag->subscr);
1014}
1015
1016static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
1017{
1018 struct gsm_paging_request *pag;
1019
1020 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
1021 paging_dump_vty(vty, pag);
1022}
1023
1024DEFUN(show_paging,
1025 show_paging_cmd,
1026 "show paging [bts_nr]",
Harald Welte9e002452010-05-11 21:53:49 +02001027 SHOW_STR "Display information about paging reuqests of a BTS\n"
1028 "BTS Number\n")
Harald Welte59b04682009-06-10 05:40:52 +08001029{
Harald Welte40152872010-05-16 20:52:23 +02001030 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +08001031 struct gsm_bts *bts;
1032 int bts_nr;
1033
1034 if (argc >= 1) {
1035 /* use the BTS number that the user has specified */
1036 bts_nr = atoi(argv[0]);
1037 if (bts_nr >= net->num_bts) {
1038 vty_out(vty, "%% can't find BTS %s%s", argv[0],
1039 VTY_NEWLINE);
1040 return CMD_WARNING;
1041 }
Harald Weltee712a5f2009-06-21 16:17:15 +02001042 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +08001043 bts_paging_dump_vty(vty, bts);
1044
1045 return CMD_SUCCESS;
1046 }
1047 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +02001048 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +08001049 bts_paging_dump_vty(vty, bts);
1050 }
1051
1052 return CMD_SUCCESS;
1053}
1054
Harald Welte9e002452010-05-11 21:53:49 +02001055#define NETWORK_STR "Configure the GSM network\n"
1056
Harald Weltee87eb462009-08-07 13:29:14 +02001057DEFUN(cfg_net,
1058 cfg_net_cmd,
Harald Welte9e002452010-05-11 21:53:49 +02001059 "network", NETWORK_STR)
Harald Weltee87eb462009-08-07 13:29:14 +02001060{
Harald Welte40152872010-05-16 20:52:23 +02001061 vty->index = gsmnet_from_vty(vty);
Harald Weltee87eb462009-08-07 13:29:14 +02001062 vty->node = GSMNET_NODE;
1063
1064 return CMD_SUCCESS;
1065}
1066
1067
1068DEFUN(cfg_net_ncc,
1069 cfg_net_ncc_cmd,
1070 "network country code <1-999>",
1071 "Set the GSM network country code")
1072{
Harald Welte40152872010-05-16 20:52:23 +02001073 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1074
Harald Weltee87eb462009-08-07 13:29:14 +02001075 gsmnet->country_code = atoi(argv[0]);
1076
1077 return CMD_SUCCESS;
1078}
1079
1080DEFUN(cfg_net_mnc,
1081 cfg_net_mnc_cmd,
1082 "mobile network code <1-999>",
1083 "Set the GSM mobile network code")
1084{
Harald Welte40152872010-05-16 20:52:23 +02001085 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1086
Harald Weltee87eb462009-08-07 13:29:14 +02001087 gsmnet->network_code = atoi(argv[0]);
1088
1089 return CMD_SUCCESS;
1090}
1091
1092DEFUN(cfg_net_name_short,
1093 cfg_net_name_short_cmd,
1094 "short name NAME",
1095 "Set the short GSM network name")
1096{
Harald Welte40152872010-05-16 20:52:23 +02001097 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1098
Holger Hans Peter Freyther7c831f62010-10-12 23:21:54 +02001099 bsc_replace_string(gsmnet, &gsmnet->name_short, argv[0]);
Harald Weltee87eb462009-08-07 13:29:14 +02001100 return CMD_SUCCESS;
1101}
1102
1103DEFUN(cfg_net_name_long,
1104 cfg_net_name_long_cmd,
1105 "long name NAME",
1106 "Set the long GSM network name")
1107{
Harald Welte40152872010-05-16 20:52:23 +02001108 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1109
Holger Hans Peter Freyther7c831f62010-10-12 23:21:54 +02001110 bsc_replace_string(gsmnet, &gsmnet->name_long, argv[0]);
Harald Weltee87eb462009-08-07 13:29:14 +02001111 return CMD_SUCCESS;
1112}
Harald Welte59b04682009-06-10 05:40:52 +08001113
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02001114DEFUN(cfg_net_auth_policy,
1115 cfg_net_auth_policy_cmd,
1116 "auth policy (closed|accept-all|token)",
Harald Welte9e002452010-05-11 21:53:49 +02001117 "Authentication (not cryptographic)\n"
1118 "Set the GSM network authentication policy\n"
1119 "Require the MS to be activated in HLR\n"
1120 "Accept all MS, whether in HLR or not\n"
1121 "Use SMS-token based authentication\n")
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02001122{
1123 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
Harald Welte40152872010-05-16 20:52:23 +02001124 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02001125
1126 gsmnet->auth_policy = policy;
1127
1128 return CMD_SUCCESS;
1129}
1130
Harald Welte59936d72009-11-18 20:33:19 +01001131DEFUN(cfg_net_reject_cause,
1132 cfg_net_reject_cause_cmd,
1133 "location updating reject cause <2-111>",
1134 "Set the reject cause of location updating reject\n")
1135{
Harald Welte40152872010-05-16 20:52:23 +02001136 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1137
Harald Welte59936d72009-11-18 20:33:19 +01001138 gsmnet->reject_cause = atoi(argv[0]);
1139
1140 return CMD_SUCCESS;
1141}
1142
Harald Weltecca253a2009-08-30 15:47:06 +09001143DEFUN(cfg_net_encryption,
1144 cfg_net_encryption_cmd,
1145 "encryption a5 (0|1|2)",
Harald Welte18ce31c2010-05-14 20:05:17 +02001146 "Encryption options\n"
1147 "A5 encryption\n" "A5/0: No encryption\n"
1148 "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n")
Harald Weltecca253a2009-08-30 15:47:06 +09001149{
Harald Welte40152872010-05-16 20:52:23 +02001150 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1151
Andreas.Eversberg53293292009-11-17 09:55:26 +01001152 gsmnet->a5_encryption= atoi(argv[0]);
Harald Weltecca253a2009-08-30 15:47:06 +09001153
1154 return CMD_SUCCESS;
1155}
1156
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001157DEFUN(cfg_net_neci,
1158 cfg_net_neci_cmd,
1159 "neci (0|1)",
Harald Welte18ce31c2010-05-14 20:05:17 +02001160 "New Establish Cause Indication\n"
1161 "Don't set the NECI bit\n" "Set the NECI bit\n")
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001162{
Harald Welte40152872010-05-16 20:52:23 +02001163 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1164
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001165 gsmnet->neci = atoi(argv[0]);
Holger Hans Peter Freytherf0f37f12010-09-06 09:36:02 +08001166 gsm_net_update_ctype(gsmnet);
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001167 return CMD_SUCCESS;
1168}
1169
Harald Welte52af1952009-12-13 10:53:12 +01001170DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1171 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
Harald Welte9e002452010-05-11 21:53:49 +02001172 "Radio Resource Location Protocol\n"
1173 "Set the Radio Resource Location Protocol Mode\n"
1174 "Don't send RRLP request\n"
1175 "Request MS-based location\n"
1176 "Request any location, prefer MS-based\n"
1177 "Request any location, prefer MS-assisted\n")
Harald Welte52af1952009-12-13 10:53:12 +01001178{
Harald Welte40152872010-05-16 20:52:23 +02001179 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1180
Harald Welte52af1952009-12-13 10:53:12 +01001181 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1182
1183 return CMD_SUCCESS;
1184}
1185
Harald Weltea310f3e2009-12-14 09:00:24 +01001186DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1187 "mm info (0|1)",
1188 "Whether to send MM INFO after LOC UPD ACCEPT")
1189{
Harald Welte40152872010-05-16 20:52:23 +02001190 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1191
Harald Weltea310f3e2009-12-14 09:00:24 +01001192 gsmnet->send_mm_info = atoi(argv[0]);
1193
1194 return CMD_SUCCESS;
1195}
1196
Harald Welte9e002452010-05-11 21:53:49 +02001197#define HANDOVER_STR "Handover Options\n"
1198
Harald Welte0af9c9f2009-12-19 21:41:52 +01001199DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1200 "handover (0|1)",
Harald Welte9e002452010-05-11 21:53:49 +02001201 HANDOVER_STR
1202 "Don't perform in-call handover\n"
1203 "Perform in-call handover\n")
Harald Welte0af9c9f2009-12-19 21:41:52 +01001204{
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001205 int enable = atoi(argv[0]);
Harald Welte40152872010-05-16 20:52:23 +02001206 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001207
1208 if (enable && ipacc_rtp_direct) {
Harald Welteaa2c3032009-12-20 13:51:01 +01001209 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1210 "is enabled by using the -P command line option%s",
1211 VTY_NEWLINE);
1212 return CMD_WARNING;
1213 }
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001214 gsmnet->handover.active = enable;
Harald Welte0af9c9f2009-12-19 21:41:52 +01001215
1216 return CMD_SUCCESS;
1217}
1218
Harald Welte9e002452010-05-11 21:53:49 +02001219#define HO_WIN_STR HANDOVER_STR "Measurement Window\n"
1220#define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n"
1221#define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n"
1222#define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n"
1223
Harald Weltea8062f12009-12-21 16:51:50 +01001224DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1225 "handover window rxlev averaging <1-10>",
Harald Welte9e002452010-05-11 21:53:49 +02001226 HO_WIN_RXLEV_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001227 "How many RxLev measurements are used for averaging")
1228{
Harald Welte40152872010-05-16 20:52:23 +02001229 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001230 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1231 return CMD_SUCCESS;
1232}
1233
1234DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1235 "handover window rxqual averaging <1-10>",
Harald Welte9e002452010-05-11 21:53:49 +02001236 HO_WIN_RXQUAL_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001237 "How many RxQual measurements are used for averaging")
1238{
Harald Welte40152872010-05-16 20:52:23 +02001239 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001240 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1241 return CMD_SUCCESS;
1242}
1243
1244DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1245 "handover window rxlev neighbor averaging <1-10>",
Harald Welte9e002452010-05-11 21:53:49 +02001246 HO_WIN_RXLEV_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001247 "How many RxQual measurements are used for averaging")
1248{
Harald Welte40152872010-05-16 20:52:23 +02001249 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001250 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1251 return CMD_SUCCESS;
1252}
1253
1254DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1255 "handover power budget interval <1-99>",
Harald Welte9e002452010-05-11 21:53:49 +02001256 HO_PBUDGET_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001257 "How often to check if we have a better cell (SACCH frames)")
1258{
Harald Welte40152872010-05-16 20:52:23 +02001259 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001260 gsmnet->handover.pwr_interval = atoi(argv[0]);
1261 return CMD_SUCCESS;
1262}
1263
1264DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1265 "handover power budget hysteresis <0-999>",
Harald Welte9e002452010-05-11 21:53:49 +02001266 HO_PBUDGET_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001267 "How many dB does a neighbor to be stronger to become a HO candidate")
1268{
Harald Welte40152872010-05-16 20:52:23 +02001269 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001270 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1271 return CMD_SUCCESS;
1272}
1273
1274DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1275 "handover maximum distance <0-9999>",
Harald Welte9e002452010-05-11 21:53:49 +02001276 HANDOVER_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001277 "How big is the maximum timing advance before HO is forced")
1278{
Harald Welte40152872010-05-16 20:52:23 +02001279 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001280 gsmnet->handover.max_distance = atoi(argv[0]);
1281 return CMD_SUCCESS;
1282}
Harald Welte0af9c9f2009-12-19 21:41:52 +01001283
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +08001284DEFUN(cfg_net_pag_any_tch,
1285 cfg_net_pag_any_tch_cmd,
1286 "paging any use tch (0|1)",
1287 "Assign a TCH when receiving a Paging Any request")
1288{
Holger Hans Peter Freytherc5628882010-09-06 10:09:19 +08001289 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +08001290 gsmnet->pag_any_tch = atoi(argv[0]);
1291 gsm_net_update_ctype(gsmnet);
1292 return CMD_SUCCESS;
1293}
1294
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001295#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001296 DEFUN(cfg_net_T##number, \
1297 cfg_net_T##number##_cmd, \
1298 "timer t" #number " <0-65535>", \
Harald Welte9e002452010-05-11 21:53:49 +02001299 "Configure GSM Timers\n" \
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001300 doc) \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001301{ \
Harald Welte40152872010-05-16 20:52:23 +02001302 struct gsm_network *gsmnet = gsmnet_from_vty(vty); \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001303 int value = atoi(argv[0]); \
1304 \
1305 if (value < 0 || value > 65535) { \
1306 vty_out(vty, "Timer value %s out of range.%s", \
1307 argv[0], VTY_NEWLINE); \
1308 return CMD_WARNING; \
1309 } \
1310 \
1311 gsmnet->T##number = value; \
1312 return CMD_SUCCESS; \
1313}
1314
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001315DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1316DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1317DECLARE_TIMER(3105, "Currently not used.")
1318DECLARE_TIMER(3107, "Currently not used.")
1319DECLARE_TIMER(3109, "Currently not used.")
Holger Hans Peter Freyther4a00c062010-05-31 21:33:15 +08001320DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel.")
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001321DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1322DECLARE_TIMER(3115, "Currently not used.")
1323DECLARE_TIMER(3117, "Currently not used.")
1324DECLARE_TIMER(3119, "Currently not used.")
1325DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001326
Holger Hans Peter Freyther21d63ff2010-09-06 09:25:48 +08001327DEFUN(cfg_net_dtx,
1328 cfg_net_dtx_cmd,
1329 "dtx-used (0|1)",
1330 "Enable the usage of DTX.\n"
1331 "DTX is enabled/disabled")
1332{
1333 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1334 gsmnet->dtx_enabled = atoi(argv[0]);
1335 return CMD_SUCCESS;
1336}
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001337
Harald Welte59b04682009-06-10 05:40:52 +08001338/* per-BTS configuration */
1339DEFUN(cfg_bts,
1340 cfg_bts_cmd,
1341 "bts BTS_NR",
Harald Welte9e002452010-05-11 21:53:49 +02001342 "Select a BTS to configure\n"
1343 "BTS Number\n")
Harald Welte59b04682009-06-10 05:40:52 +08001344{
Harald Welte40152872010-05-16 20:52:23 +02001345 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +08001346 int bts_nr = atoi(argv[0]);
1347 struct gsm_bts *bts;
1348
Harald Weltee712a5f2009-06-21 16:17:15 +02001349 if (bts_nr > gsmnet->num_bts) {
1350 vty_out(vty, "%% The next unused BTS number is %u%s",
1351 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +08001352 return CMD_WARNING;
Harald Weltee712a5f2009-06-21 16:17:15 +02001353 } else if (bts_nr == gsmnet->num_bts) {
1354 /* allocate a new one */
1355 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1356 HARDCODED_TSC, HARDCODED_BSIC);
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +02001357 } else
Harald Weltee712a5f2009-06-21 16:17:15 +02001358 bts = gsm_bts_num(gsmnet, bts_nr);
1359
Daniel Willmann580085f2010-01-11 13:43:07 +01001360 if (!bts) {
1361 vty_out(vty, "%% Unable to allocate BTS %u%s",
1362 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee712a5f2009-06-21 16:17:15 +02001363 return CMD_WARNING;
Daniel Willmann580085f2010-01-11 13:43:07 +01001364 }
Harald Welte59b04682009-06-10 05:40:52 +08001365
1366 vty->index = bts;
Harald Welte8791dac2010-05-14 17:59:53 +02001367 vty->index_sub = &bts->description;
Harald Welte59b04682009-06-10 05:40:52 +08001368 vty->node = BTS_NODE;
1369
1370 return CMD_SUCCESS;
1371}
1372
1373DEFUN(cfg_bts_type,
1374 cfg_bts_type_cmd,
1375 "type TYPE",
1376 "Set the BTS type\n")
1377{
1378 struct gsm_bts *bts = vty->index;
Harald Welte59698fb2010-01-10 18:01:52 +01001379 int rc;
Harald Welte59b04682009-06-10 05:40:52 +08001380
Harald Welte59698fb2010-01-10 18:01:52 +01001381 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1382 if (rc < 0)
1383 return CMD_WARNING;
Harald Welte25572872009-10-20 00:22:00 +02001384
Harald Welte59b04682009-06-10 05:40:52 +08001385 return CMD_SUCCESS;
1386}
1387
Harald Welte91afe4c2009-06-20 18:15:19 +02001388DEFUN(cfg_bts_band,
1389 cfg_bts_band_cmd,
1390 "band BAND",
1391 "Set the frequency band of this BTS\n")
1392{
1393 struct gsm_bts *bts = vty->index;
Harald Welte62868882009-08-08 16:12:58 +02001394 int band = gsm_band_parse(argv[0]);
Harald Welte91afe4c2009-06-20 18:15:19 +02001395
1396 if (band < 0) {
1397 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1398 band, VTY_NEWLINE);
1399 return CMD_WARNING;
1400 }
1401
1402 bts->band = band;
1403
1404 return CMD_SUCCESS;
1405}
1406
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +02001407DEFUN(cfg_bts_ci,
1408 cfg_bts_ci_cmd,
1409 "cell_identity <0-65535>",
1410 "Set the Cell identity of this BTS\n")
1411{
1412 struct gsm_bts *bts = vty->index;
1413 int ci = atoi(argv[0]);
1414
1415 if (ci < 0 || ci > 0xffff) {
1416 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1417 ci, VTY_NEWLINE);
1418 return CMD_WARNING;
1419 }
1420 bts->cell_identity = ci;
1421
1422 return CMD_SUCCESS;
1423}
1424
Harald Welte59b04682009-06-10 05:40:52 +08001425DEFUN(cfg_bts_lac,
1426 cfg_bts_lac_cmd,
Holger Hans Peter Freyther54a22832009-09-29 14:02:33 +02001427 "location_area_code <0-65535>",
Harald Welte59b04682009-06-10 05:40:52 +08001428 "Set the Location Area Code (LAC) of this BTS\n")
1429{
1430 struct gsm_bts *bts = vty->index;
1431 int lac = atoi(argv[0]);
1432
Holger Hans Peter Freyther54a22832009-09-29 14:02:33 +02001433 if (lac < 0 || lac > 0xffff) {
1434 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte59b04682009-06-10 05:40:52 +08001435 lac, VTY_NEWLINE);
1436 return CMD_WARNING;
1437 }
Holger Hans Peter Freyther6c6ab862009-10-01 04:07:15 +02001438
1439 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1440 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1441 lac, VTY_NEWLINE);
1442 return CMD_WARNING;
1443 }
1444
Harald Welte59b04682009-06-10 05:40:52 +08001445 bts->location_area_code = lac;
1446
1447 return CMD_SUCCESS;
1448}
1449
Harald Weltea54a2bb2009-12-01 18:04:30 +05301450
Harald Welte59b04682009-06-10 05:40:52 +08001451DEFUN(cfg_bts_tsc,
1452 cfg_bts_tsc_cmd,
1453 "training_sequence_code <0-255>",
1454 "Set the Training Sequence Code (TSC) of this BTS\n")
1455{
1456 struct gsm_bts *bts = vty->index;
1457 int tsc = atoi(argv[0]);
1458
1459 if (tsc < 0 || tsc > 0xff) {
1460 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1461 tsc, VTY_NEWLINE);
1462 return CMD_WARNING;
1463 }
1464 bts->tsc = tsc;
1465
1466 return CMD_SUCCESS;
1467}
1468
1469DEFUN(cfg_bts_bsic,
1470 cfg_bts_bsic_cmd,
1471 "base_station_id_code <0-63>",
1472 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1473{
1474 struct gsm_bts *bts = vty->index;
1475 int bsic = atoi(argv[0]);
1476
1477 if (bsic < 0 || bsic > 0x3f) {
Harald Welte62868882009-08-08 16:12:58 +02001478 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte59b04682009-06-10 05:40:52 +08001479 bsic, VTY_NEWLINE);
1480 return CMD_WARNING;
1481 }
1482 bts->bsic = bsic;
1483
1484 return CMD_SUCCESS;
1485}
1486
1487
1488DEFUN(cfg_bts_unit_id,
1489 cfg_bts_unit_id_cmd,
Harald Weltef515aa02009-08-07 13:27:09 +02001490 "ip.access unit_id <0-65534> <0-255>",
1491 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte59b04682009-06-10 05:40:52 +08001492{
1493 struct gsm_bts *bts = vty->index;
1494 int site_id = atoi(argv[0]);
1495 int bts_id = atoi(argv[1]);
1496
Harald Weltef515aa02009-08-07 13:27:09 +02001497 if (!is_ipaccess_bts(bts)) {
1498 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1499 return CMD_WARNING;
1500 }
1501
Harald Welte59b04682009-06-10 05:40:52 +08001502 bts->ip_access.site_id = site_id;
1503 bts->ip_access.bts_id = bts_id;
1504
1505 return CMD_SUCCESS;
1506}
1507
Harald Welte9e002452010-05-11 21:53:49 +02001508#define OML_STR "Organization & Maintenance Link\n"
1509#define IPA_STR "ip.access Specific Options\n"
1510
Harald Welte25572872009-10-20 00:22:00 +02001511DEFUN(cfg_bts_stream_id,
1512 cfg_bts_stream_id_cmd,
1513 "oml ip.access stream_id <0-255>",
Harald Welte9e002452010-05-11 21:53:49 +02001514 OML_STR IPA_STR
Harald Welte25572872009-10-20 00:22:00 +02001515 "Set the ip.access Stream ID of the OML link of this BTS\n")
1516{
1517 struct gsm_bts *bts = vty->index;
1518 int stream_id = atoi(argv[0]);
1519
1520 if (!is_ipaccess_bts(bts)) {
1521 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1522 return CMD_WARNING;
1523 }
1524
1525 bts->oml_tei = stream_id;
1526
1527 return CMD_SUCCESS;
1528}
1529
Harald Welte9e002452010-05-11 21:53:49 +02001530#define OML_E1_STR OML_STR "E1 Line\n"
Harald Welte25572872009-10-20 00:22:00 +02001531
Harald Welte62868882009-08-08 16:12:58 +02001532DEFUN(cfg_bts_oml_e1,
1533 cfg_bts_oml_e1_cmd,
1534 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte9e002452010-05-11 21:53:49 +02001535 OML_E1_STR
Harald Welte62868882009-08-08 16:12:58 +02001536 "E1 interface to be used for OML\n")
1537{
1538 struct gsm_bts *bts = vty->index;
1539
1540 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1541
1542 return CMD_SUCCESS;
1543}
1544
1545
1546DEFUN(cfg_bts_oml_e1_tei,
1547 cfg_bts_oml_e1_tei_cmd,
1548 "oml e1 tei <0-63>",
Harald Welte9e002452010-05-11 21:53:49 +02001549 OML_E1_STR
Harald Welte62868882009-08-08 16:12:58 +02001550 "Set the TEI to be used for OML")
1551{
1552 struct gsm_bts *bts = vty->index;
1553
1554 bts->oml_tei = atoi(argv[0]);
1555
1556 return CMD_SUCCESS;
1557}
1558
Harald Welte3e774612009-08-10 13:48:16 +02001559DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1560 "channel allocator (ascending|descending)",
Harald Welte9e002452010-05-11 21:53:49 +02001561 "Channnel Allocator\n" "Channel Allocator\n"
1562 "Allocate Timeslots and Transceivers in ascending order\n"
1563 "Allocate Timeslots and Transceivers in descending order\n")
Harald Welte3e774612009-08-10 13:48:16 +02001564{
1565 struct gsm_bts *bts = vty->index;
1566
1567 if (!strcmp(argv[0], "ascending"))
1568 bts->chan_alloc_reverse = 0;
1569 else
1570 bts->chan_alloc_reverse = 1;
1571
1572 return CMD_SUCCESS;
1573}
1574
Harald Welte9e002452010-05-11 21:53:49 +02001575#define RACH_STR "Random Access Control Channel\n"
1576
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001577DEFUN(cfg_bts_rach_tx_integer,
1578 cfg_bts_rach_tx_integer_cmd,
1579 "rach tx integer <0-15>",
Harald Welte9e002452010-05-11 21:53:49 +02001580 RACH_STR
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001581 "Set the raw tx integer value in RACH Control parameters IE")
1582{
1583 struct gsm_bts *bts = vty->index;
1584 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1585 return CMD_SUCCESS;
1586}
1587
1588DEFUN(cfg_bts_rach_max_trans,
1589 cfg_bts_rach_max_trans_cmd,
1590 "rach max transmission (1|2|4|7)",
Harald Welte9e002452010-05-11 21:53:49 +02001591 RACH_STR
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001592 "Set the maximum number of RACH burst transmissions")
1593{
1594 struct gsm_bts *bts = vty->index;
1595 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1596 return CMD_SUCCESS;
1597}
1598
Harald Welte9e002452010-05-11 21:53:49 +02001599#define NM_STR "Network Management\n"
1600
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08001601DEFUN(cfg_bts_rach_nm_b_thresh,
1602 cfg_bts_rach_nm_b_thresh_cmd,
1603 "rach nm busy threshold <0-255>",
Harald Welte9e002452010-05-11 21:53:49 +02001604 RACH_STR NM_STR
1605 "Set the NM Busy Threshold in dB")
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08001606{
1607 struct gsm_bts *bts = vty->index;
1608 bts->rach_b_thresh = atoi(argv[0]);
1609 return CMD_SUCCESS;
1610}
1611
1612DEFUN(cfg_bts_rach_nm_ldavg,
1613 cfg_bts_rach_nm_ldavg_cmd,
1614 "rach nm load average <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001615 RACH_STR NM_STR
1616 "Set the NM Loadaverage Slots value")
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08001617{
1618 struct gsm_bts *bts = vty->index;
1619 bts->rach_ldavg_slots = atoi(argv[0]);
1620 return CMD_SUCCESS;
1621}
1622
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02001623DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1624 "cell barred (0|1)",
1625 "Should this cell be barred from access?")
1626{
1627 struct gsm_bts *bts = vty->index;
1628
Harald Welte8c973ba2009-12-21 23:08:18 +01001629 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02001630
1631 return CMD_SUCCESS;
1632}
1633
Holger Hans Peter Freyther440984b2010-05-14 00:39:19 +08001634DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd,
1635 "rach emergency call allowed (0|1)",
1636 "Should this cell allow emergency calls?")
1637{
1638 struct gsm_bts *bts = vty->index;
1639
1640 if (atoi(argv[0]) == 0)
1641 bts->si_common.rach_control.t2 |= 0x4;
1642 else
1643 bts->si_common.rach_control.t2 &= ~0x4;
1644
1645 return CMD_SUCCESS;
1646}
1647
Harald Welte (local)cbd46102009-08-13 10:14:26 +02001648DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1649 "ms max power <0-40>",
1650 "Maximum transmit power of the MS")
1651{
1652 struct gsm_bts *bts = vty->index;
1653
1654 bts->ms_max_power = atoi(argv[0]);
1655
1656 return CMD_SUCCESS;
1657}
1658
Harald Welteb761bf82009-12-12 18:17:25 +01001659DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1660 "cell reselection hysteresis <0-14>",
1661 "Cell Re-Selection Hysteresis in dB")
1662{
1663 struct gsm_bts *bts = vty->index;
1664
1665 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1666
1667 return CMD_SUCCESS;
1668}
1669
1670DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1671 "rxlev access min <0-63>",
1672 "Minimum RxLev needed for cell access (better than -110dBm)")
1673{
1674 struct gsm_bts *bts = vty->index;
1675
1676 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1677
1678 return CMD_SUCCESS;
1679}
1680
Sylvain Munaut00d71462010-11-28 18:17:28 +01001681DEFUN(cfg_bts_cell_bar_qualify, cfg_bts_cell_bar_qualify_cmd,
1682 "cell bar qualify (0|1)",
1683 "Cell Bar Qualify")
1684{
1685 struct gsm_bts *bts = vty->index;
1686
1687 bts->si_common.cell_ro_sel_par.present = 1;
1688 bts->si_common.cell_ro_sel_par.cbq = atoi(argv[0]);
1689
1690 return CMD_SUCCESS;
1691}
1692
1693DEFUN(cfg_bts_cell_resel_ofs, cfg_bts_cell_resel_ofs_cmd,
1694 "cell reselection offset <0-126>",
1695 "Cell Re-Selection Offset in dB")
1696{
1697 struct gsm_bts *bts = vty->index;
1698
1699 bts->si_common.cell_ro_sel_par.present = 1;
1700 bts->si_common.cell_ro_sel_par.cell_resel_off = atoi(argv[0])/2;
1701
1702 return CMD_SUCCESS;
1703}
1704
1705DEFUN(cfg_bts_temp_ofs, cfg_bts_temp_ofs_cmd,
1706 "temporary offset <0-60>",
1707 "Cell selection temporary negative offset in dB")
1708{
1709 struct gsm_bts *bts = vty->index;
1710
1711 bts->si_common.cell_ro_sel_par.present = 1;
1712 bts->si_common.cell_ro_sel_par.temp_offs = atoi(argv[0])/10;
1713
1714 return CMD_SUCCESS;
1715}
1716
1717DEFUN(cfg_bts_temp_ofs_inf, cfg_bts_temp_ofs_inf_cmd,
1718 "temporary offset infinite",
1719 "Sets cell selection temporary negative offset to infinity")
1720{
1721 struct gsm_bts *bts = vty->index;
1722
1723 bts->si_common.cell_ro_sel_par.present = 1;
1724 bts->si_common.cell_ro_sel_par.temp_offs = 7;
1725
1726 return CMD_SUCCESS;
1727}
1728
1729DEFUN(cfg_bts_penalty_time, cfg_bts_penalty_time_cmd,
1730 "penalty time <20-620>",
1731 "Cell selection penalty time in seconds (by 20s increments)")
1732{
1733 struct gsm_bts *bts = vty->index;
1734
1735 bts->si_common.cell_ro_sel_par.present = 1;
1736 bts->si_common.cell_ro_sel_par.penalty_time = (atoi(argv[0])-20)/20;
1737
1738 return CMD_SUCCESS;
1739}
1740
1741DEFUN(cfg_bts_penalty_time_rsvd, cfg_bts_penalty_time_rsvd_cmd,
1742 "penalty time reserved",
1743 "Set cell selection penalty time to reserved value 31\n"
1744 "(indicate that CELL_RESELECT_OFFSET is subtracted from C2 "
1745 "and TEMPORARY_OFFSET is ignored)")
1746{
1747 struct gsm_bts *bts = vty->index;
1748
1749 bts->si_common.cell_ro_sel_par.present = 1;
1750 bts->si_common.cell_ro_sel_par.penalty_time = 31;
1751
1752 return CMD_SUCCESS;
1753}
1754
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02001755DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1756 "periodic location update <0-1530>",
1757 "Periodic Location Updating Interval in Minutes")
1758{
1759 struct gsm_bts *bts = vty->index;
1760
Dieter Spaarb0f746d2010-10-05 21:10:55 +02001761 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 6;
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02001762
1763 return CMD_SUCCESS;
1764}
1765
Harald Welte9e002452010-05-11 21:53:49 +02001766#define GPRS_TEXT "GPRS Packet Network\n"
1767
Harald Welte410575a2010-03-14 23:30:30 +08001768DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welteb42fe342010-04-18 14:00:26 +02001769 "gprs cell bvci <2-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001770 GPRS_TEXT
1771 "GPRS Cell Settings\n"
Harald Welte3055e332010-03-14 15:37:43 +08001772 "GPRS BSSGP VC Identifier")
1773{
1774 struct gsm_bts *bts = vty->index;
1775
Harald Weltecb20b7a2010-04-18 15:51:20 +02001776 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001777 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1778 return CMD_WARNING;
1779 }
1780
Harald Welte3055e332010-03-14 15:37:43 +08001781 bts->gprs.cell.bvci = atoi(argv[0]);
1782
1783 return CMD_SUCCESS;
1784}
1785
Harald Welte4a048c52010-03-22 11:48:36 +08001786DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
1787 "gprs nsei <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001788 GPRS_TEXT
Harald Welte4a048c52010-03-22 11:48:36 +08001789 "GPRS NS Entity Identifier")
1790{
1791 struct gsm_bts *bts = vty->index;
1792
Harald Weltecb20b7a2010-04-18 15:51:20 +02001793 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte4a048c52010-03-22 11:48:36 +08001794 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1795 return CMD_WARNING;
1796 }
1797
1798 bts->gprs.nse.nsei = atoi(argv[0]);
1799
1800 return CMD_SUCCESS;
1801}
1802
Harald Welte9e002452010-05-11 21:53:49 +02001803#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
1804 "NSVC Logical Number\n"
Harald Welte4a048c52010-03-22 11:48:36 +08001805
Harald Welte3055e332010-03-14 15:37:43 +08001806DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
1807 "gprs nsvc <0-1> nsvci <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001808 GPRS_TEXT NSVC_TEXT
1809 "NS Virtual Connection Identifier\n"
Harald Welte3055e332010-03-14 15:37:43 +08001810 "GPRS NS VC Identifier")
1811{
1812 struct gsm_bts *bts = vty->index;
1813 int idx = atoi(argv[0]);
1814
Harald Weltecb20b7a2010-04-18 15:51:20 +02001815 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001816 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1817 return CMD_WARNING;
1818 }
1819
Harald Welte3055e332010-03-14 15:37:43 +08001820 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
1821
1822 return CMD_SUCCESS;
1823}
1824
Harald Welte410575a2010-03-14 23:30:30 +08001825DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
1826 "gprs nsvc <0-1> local udp port <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001827 GPRS_TEXT NSVC_TEXT
Harald Welte410575a2010-03-14 23:30:30 +08001828 "GPRS NS Local UDP Port")
1829{
1830 struct gsm_bts *bts = vty->index;
1831 int idx = atoi(argv[0]);
1832
Harald Weltecb20b7a2010-04-18 15:51:20 +02001833 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001834 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1835 return CMD_WARNING;
1836 }
1837
Harald Welte410575a2010-03-14 23:30:30 +08001838 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
1839
1840 return CMD_SUCCESS;
1841}
1842
1843DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
1844 "gprs nsvc <0-1> remote udp port <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001845 GPRS_TEXT NSVC_TEXT
Harald Welte410575a2010-03-14 23:30:30 +08001846 "GPRS NS Remote UDP Port")
1847{
1848 struct gsm_bts *bts = vty->index;
1849 int idx = atoi(argv[0]);
1850
Harald Weltecb20b7a2010-04-18 15:51:20 +02001851 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-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 Welte410575a2010-03-14 23:30:30 +08001856 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
1857
1858 return CMD_SUCCESS;
1859}
1860
1861DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
1862 "gprs nsvc <0-1> remote ip A.B.C.D",
Harald Welte9e002452010-05-11 21:53:49 +02001863 GPRS_TEXT NSVC_TEXT
Harald Welte410575a2010-03-14 23:30:30 +08001864 "GPRS NS Remote IP Address")
1865{
1866 struct gsm_bts *bts = vty->index;
1867 int idx = atoi(argv[0]);
1868 struct in_addr ia;
1869
Harald Weltecb20b7a2010-04-18 15:51:20 +02001870 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001871 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1872 return CMD_WARNING;
1873 }
1874
Harald Welte410575a2010-03-14 23:30:30 +08001875 inet_aton(argv[1], &ia);
1876 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
1877
1878 return CMD_SUCCESS;
1879}
1880
Holger Hans Peter Freyther3112f672010-09-06 10:11:25 +08001881DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd,
1882 "paging free FREE_NR",
1883 "Only page when having a certain amount of free slots. -1 to disable")
1884{
1885 struct gsm_bts *bts = vty->index;
1886
1887 bts->paging.free_chans_need = atoi(argv[0]);
1888 return CMD_SUCCESS;
1889}
1890
Harald Weltea9251762010-05-11 23:50:21 +02001891DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd,
1892 "gprs ns timer " NS_TIMERS " <0-255>",
1893 GPRS_TEXT "Network Service\n"
1894 "Network Service Timer\n"
1895 NS_TIMERS_HELP "Timer Value\n")
1896{
1897 struct gsm_bts *bts = vty->index;
1898 int idx = get_string_value(gprs_ns_timer_strs, argv[0]);
1899 int val = atoi(argv[1]);
1900
1901 if (bts->gprs.mode == BTS_GPRS_NONE) {
1902 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1903 return CMD_WARNING;
1904 }
1905
1906 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
1907 return CMD_WARNING;
1908
1909 bts->gprs.nse.timer[idx] = val;
1910
1911 return CMD_SUCCESS;
1912}
1913
1914#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 Welte18ce31c2010-05-14 20:05:17 +02001915#define BSSGP_TIMERS_HELP \
1916 "Tbvc-block timeout\n" \
1917 "Tbvc-block retries\n" \
1918 "Tbvc-unblock retries\n" \
1919 "Tbvcc-reset timeout\n" \
1920 "Tbvc-reset retries\n" \
1921 "Tbvc-suspend timeout\n" \
1922 "Tbvc-suspend retries\n" \
1923 "Tbvc-resume timeout\n" \
1924 "Tbvc-resume retries\n" \
1925 "Tbvc-capa-update timeout\n" \
1926 "Tbvc-capa-update retries\n"
Harald Weltea9251762010-05-11 23:50:21 +02001927
1928DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd,
1929 "gprs cell timer " BSSGP_TIMERS " <0-255>",
1930 GPRS_TEXT "Cell / BSSGP\n"
1931 "Cell/BSSGP Timer\n"
1932 BSSGP_TIMERS_HELP "Timer Value\n")
1933{
1934 struct gsm_bts *bts = vty->index;
1935 int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
1936 int val = atoi(argv[1]);
1937
1938 if (bts->gprs.mode == BTS_GPRS_NONE) {
1939 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1940 return CMD_WARNING;
1941 }
1942
1943 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer))
1944 return CMD_WARNING;
1945
1946 bts->gprs.cell.timer[idx] = val;
1947
1948 return CMD_SUCCESS;
1949}
1950
Harald Welte3055e332010-03-14 15:37:43 +08001951DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
1952 "gprs routing area <0-255>",
Harald Welte9e002452010-05-11 21:53:49 +02001953 GPRS_TEXT
Harald Welte3055e332010-03-14 15:37:43 +08001954 "GPRS Routing Area Code")
1955{
1956 struct gsm_bts *bts = vty->index;
1957
Harald Weltecb20b7a2010-04-18 15:51:20 +02001958 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001959 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1960 return CMD_WARNING;
1961 }
1962
Harald Welte3055e332010-03-14 15:37:43 +08001963 bts->gprs.rac = atoi(argv[0]);
1964
1965 return CMD_SUCCESS;
1966}
1967
Harald Weltecb20b7a2010-04-18 15:51:20 +02001968DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
1969 "gprs mode (none|gprs|egprs)",
Harald Welte9e002452010-05-11 21:53:49 +02001970 GPRS_TEXT
1971 "GPRS Mode for this BTS\n"
1972 "GPRS Disabled on this BTS\n"
1973 "GPRS Enabled on this BTS\n"
1974 "EGPRS (EDGE) Enabled on this BTS\n")
Harald Welte410575a2010-03-14 23:30:30 +08001975{
1976 struct gsm_bts *bts = vty->index;
Harald Welte20e275a2010-06-14 22:44:42 +02001977 enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0]);
Harald Welte410575a2010-03-14 23:30:30 +08001978
Harald Welte20e275a2010-06-14 22:44:42 +02001979 if (mode != BTS_GPRS_NONE &&
1980 !gsm_bts_has_feature(bts, BTS_FEAT_GPRS)) {
1981 vty_out(vty, "This BTS type does not support %s%s", argv[0],
1982 VTY_NEWLINE);
1983 return CMD_WARNING;
1984 }
1985 if (mode == BTS_GPRS_EGPRS &&
1986 !gsm_bts_has_feature(bts, BTS_FEAT_EGPRS)) {
1987 vty_out(vty, "This BTS type does not support %s%s", argv[0],
1988 VTY_NEWLINE);
1989 return CMD_WARNING;
1990 }
1991
1992 bts->gprs.mode = mode;
Harald Welte410575a2010-03-14 23:30:30 +08001993
1994 return CMD_SUCCESS;
1995}
1996
Harald Welted8acf142010-07-30 11:50:09 +02001997#define SI_TEXT "System Information Messages\n"
1998#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)"
1999#define SI_TYPE_HELP "System Information Type 1\n" \
2000 "System Information Type 2\n" \
2001 "System Information Type 3\n" \
2002 "System Information Type 4\n" \
2003 "System Information Type 5\n" \
2004 "System Information Type 6\n" \
2005 "System Information Type 7\n" \
2006 "System Information Type 8\n" \
2007 "System Information Type 9\n" \
2008 "System Information Type 10\n" \
2009 "System Information Type 13\n" \
2010 "System Information Type 16\n" \
2011 "System Information Type 17\n" \
2012 "System Information Type 18\n" \
2013 "System Information Type 19\n" \
2014 "System Information Type 20\n" \
2015 "System Information Type 2bis\n" \
2016 "System Information Type 2ter\n" \
2017 "System Information Type 2quater\n" \
2018 "System Information Type 5bis\n" \
2019 "System Information Type 5ter\n"
2020
2021DEFUN(cfg_bts_si_mode, cfg_bts_si_mode_cmd,
2022 "system-information " SI_TYPE_TEXT " mode (static|computed)",
2023 SI_TEXT SI_TYPE_HELP
2024 "System Information Mode\n"
2025 "Static user-specified\n"
2026 "Dynamic, BSC-computed\n")
2027{
2028 struct gsm_bts *bts = vty->index;
2029 int type;
2030
2031 type = get_string_value(osmo_sitype_strs, argv[0]);
2032 if (type < 0) {
2033 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2034 return CMD_WARNING;
2035 }
2036
2037 if (!strcmp(argv[1], "static"))
2038 bts->si_mode_static |= (1 << type);
2039 else
2040 bts->si_mode_static &= ~(1 << type);
2041
2042 return CMD_SUCCESS;
2043}
2044
2045DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd,
2046 "system-information " SI_TYPE_TEXT " static HEXSTRING",
2047 SI_TEXT SI_TYPE_HELP
2048 "Static System Information filling\n"
2049 "Static user-specified SI content in HEX notation\n")
2050{
2051 struct gsm_bts *bts = vty->index;
2052 int rc, type;
2053
2054 type = get_string_value(osmo_sitype_strs, argv[0]);
2055 if (type < 0) {
2056 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2057 return CMD_WARNING;
2058 }
2059
2060 if (!(bts->si_mode_static & (1 << type))) {
2061 vty_out(vty, "SI Type %s is not configured in static mode%s",
2062 get_value_string(osmo_sitype_strs, type), VTY_NEWLINE);
2063 return CMD_WARNING;
2064 }
2065
Harald Welte9f09ac32010-07-30 11:53:18 +02002066 /* Fill buffer with padding pattern */
2067 memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type]));
2068
2069 /* Parse the user-specified SI in hex format, [partially] overwriting padding */
Harald Welted8acf142010-07-30 11:50:09 +02002070 rc = hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0]));
2071 if (rc < 0 || rc > sizeof(bts->si_buf[0])) {
2072 vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
2073 return CMD_WARNING;
2074 }
2075
2076 /* Mark this SI as present */
2077 bts->si_valid |= (1 << type);
2078
2079 return CMD_SUCCESS;
2080}
2081
2082
Harald Welte9e002452010-05-11 21:53:49 +02002083#define TRX_TEXT "Radio Transceiver\n"
Harald Welte3e774612009-08-10 13:48:16 +02002084
Harald Welte59b04682009-06-10 05:40:52 +08002085/* per TRX configuration */
2086DEFUN(cfg_trx,
2087 cfg_trx_cmd,
2088 "trx TRX_NR",
Harald Welte9e002452010-05-11 21:53:49 +02002089 TRX_TEXT
Harald Welte59b04682009-06-10 05:40:52 +08002090 "Select a TRX to configure")
2091{
2092 int trx_nr = atoi(argv[0]);
2093 struct gsm_bts *bts = vty->index;
2094 struct gsm_bts_trx *trx;
2095
Harald Weltee712a5f2009-06-21 16:17:15 +02002096 if (trx_nr > bts->num_trx) {
2097 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
2098 bts->num_trx, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +08002099 return CMD_WARNING;
Harald Weltee712a5f2009-06-21 16:17:15 +02002100 } else if (trx_nr == bts->num_trx) {
2101 /* we need to allocate a new one */
2102 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +02002103 } else
Harald Weltee712a5f2009-06-21 16:17:15 +02002104 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +02002105
Harald Weltee712a5f2009-06-21 16:17:15 +02002106 if (!trx)
2107 return CMD_WARNING;
Harald Welte59b04682009-06-10 05:40:52 +08002108
2109 vty->index = trx;
Harald Welte8791dac2010-05-14 17:59:53 +02002110 vty->index_sub = &trx->description;
Harald Welte59b04682009-06-10 05:40:52 +08002111 vty->node = TRX_NODE;
2112
2113 return CMD_SUCCESS;
2114}
2115
2116DEFUN(cfg_trx_arfcn,
2117 cfg_trx_arfcn_cmd,
Harald Welte00044592010-05-14 19:00:52 +02002118 "arfcn <0-1024>",
Harald Welte59b04682009-06-10 05:40:52 +08002119 "Set the ARFCN for this TRX\n")
2120{
2121 int arfcn = atoi(argv[0]);
2122 struct gsm_bts_trx *trx = vty->index;
2123
2124 /* FIXME: check if this ARFCN is supported by this TRX */
2125
2126 trx->arfcn = arfcn;
2127
2128 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
2129 /* FIXME: use OML layer to update the ARFCN */
2130 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
2131
2132 return CMD_SUCCESS;
2133}
2134
Harald Welte (local)b709bfe2009-12-27 20:56:38 +01002135DEFUN(cfg_trx_nominal_power,
2136 cfg_trx_nominal_power_cmd,
2137 "nominal power <0-100>",
2138 "Nominal TRX RF Power in dB\n")
2139{
2140 struct gsm_bts_trx *trx = vty->index;
2141
2142 trx->nominal_power = atoi(argv[0]);
2143
2144 return CMD_SUCCESS;
2145}
2146
Harald Welte91afe4c2009-06-20 18:15:19 +02002147DEFUN(cfg_trx_max_power_red,
2148 cfg_trx_max_power_red_cmd,
2149 "max_power_red <0-100>",
2150 "Reduction of maximum BS RF Power in dB\n")
2151{
2152 int maxpwr_r = atoi(argv[0]);
2153 struct gsm_bts_trx *trx = vty->index;
Harald Welte01acd742009-11-18 09:20:22 +01002154 int upper_limit = 24; /* default 12.21 max power red. */
Harald Welte91afe4c2009-06-20 18:15:19 +02002155
2156 /* FIXME: check if our BTS type supports more than 12 */
2157 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
2158 vty_out(vty, "%% Power %d dB is not in the valid range%s",
2159 maxpwr_r, VTY_NEWLINE);
2160 return CMD_WARNING;
2161 }
2162 if (maxpwr_r & 1) {
2163 vty_out(vty, "%% Power %d dB is not an even value%s",
2164 maxpwr_r, VTY_NEWLINE);
2165 return CMD_WARNING;
2166 }
2167
2168 trx->max_power_red = maxpwr_r;
2169
2170 /* FIXME: make sure we update this using OML */
2171
2172 return CMD_SUCCESS;
2173}
2174
Harald Welte62868882009-08-08 16:12:58 +02002175DEFUN(cfg_trx_rsl_e1,
2176 cfg_trx_rsl_e1_cmd,
2177 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
2178 "E1 interface to be used for RSL\n")
2179{
2180 struct gsm_bts_trx *trx = vty->index;
2181
2182 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
2183
2184 return CMD_SUCCESS;
2185}
2186
2187DEFUN(cfg_trx_rsl_e1_tei,
2188 cfg_trx_rsl_e1_tei_cmd,
2189 "rsl e1 tei <0-63>",
2190 "Set the TEI to be used for RSL")
2191{
2192 struct gsm_bts_trx *trx = vty->index;
2193
2194 trx->rsl_tei = atoi(argv[0]);
2195
2196 return CMD_SUCCESS;
2197}
2198
Holger Hans Peter Freyther1c8b4802009-11-11 11:54:24 +01002199DEFUN(cfg_trx_rf_locked,
2200 cfg_trx_rf_locked_cmd,
2201 "rf_locked (0|1)",
2202 "Turn off RF of the TRX.\n")
2203{
2204 int locked = atoi(argv[0]);
2205 struct gsm_bts_trx *trx = vty->index;
2206
2207 gsm_trx_lock_rf(trx, locked);
2208 return CMD_SUCCESS;
2209}
Harald Welte62868882009-08-08 16:12:58 +02002210
Harald Welte59b04682009-06-10 05:40:52 +08002211/* per TS configuration */
2212DEFUN(cfg_ts,
2213 cfg_ts_cmd,
Harald Welte62868882009-08-08 16:12:58 +02002214 "timeslot <0-7>",
Harald Welte59b04682009-06-10 05:40:52 +08002215 "Select a Timeslot to configure")
2216{
2217 int ts_nr = atoi(argv[0]);
2218 struct gsm_bts_trx *trx = vty->index;
2219 struct gsm_bts_trx_ts *ts;
2220
2221 if (ts_nr >= TRX_NR_TS) {
2222 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
2223 TRX_NR_TS, VTY_NEWLINE);
2224 return CMD_WARNING;
2225 }
2226
2227 ts = &trx->ts[ts_nr];
2228
2229 vty->index = ts;
2230 vty->node = TS_NODE;
2231
2232 return CMD_SUCCESS;
2233}
2234
Harald Welte3ffe1b32009-08-07 00:25:23 +02002235DEFUN(cfg_ts_pchan,
2236 cfg_ts_pchan_cmd,
2237 "phys_chan_config PCHAN",
2238 "Physical Channel configuration (TCH/SDCCH/...)")
2239{
2240 struct gsm_bts_trx_ts *ts = vty->index;
2241 int pchanc;
2242
2243 pchanc = gsm_pchan_parse(argv[0]);
2244 if (pchanc < 0)
2245 return CMD_WARNING;
2246
2247 ts->pchan = pchanc;
2248
2249 return CMD_SUCCESS;
2250}
2251
Harald Weltea42a93f2010-06-14 22:26:10 +02002252#define HOPPING_STR "Configure frequency hopping\n"
2253
2254DEFUN(cfg_ts_hopping,
2255 cfg_ts_hopping_cmd,
2256 "hopping enabled (0|1)",
2257 HOPPING_STR "Enable or disable frequency hopping\n"
2258 "Disable frequency hopping\n" "Enable frequency hopping\n")
2259{
2260 struct gsm_bts_trx_ts *ts = vty->index;
Harald Welte059c1ef2010-06-14 22:47:37 +02002261 int enabled = atoi(argv[0]);
Harald Weltea42a93f2010-06-14 22:26:10 +02002262
Harald Welte059c1ef2010-06-14 22:47:37 +02002263 if (enabled && !gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_HOPPING)) {
2264 vty_out(vty, "BTS model does not support hopping%s",
2265 VTY_NEWLINE);
2266 return CMD_WARNING;
2267 }
2268
2269 ts->hopping.enabled = enabled;
Harald Weltea42a93f2010-06-14 22:26:10 +02002270
2271 return CMD_SUCCESS;
2272}
2273
Harald Welte67104d12009-09-12 13:05:33 +02002274DEFUN(cfg_ts_hsn,
2275 cfg_ts_hsn_cmd,
Harald Weltea42a93f2010-06-14 22:26:10 +02002276 "hopping sequence-number <0-63>",
2277 HOPPING_STR
Harald Welte67104d12009-09-12 13:05:33 +02002278 "Which hopping sequence to use for this channel")
2279{
2280 struct gsm_bts_trx_ts *ts = vty->index;
2281
2282 ts->hopping.hsn = atoi(argv[0]);
2283
2284 return CMD_SUCCESS;
2285}
2286
2287DEFUN(cfg_ts_maio,
2288 cfg_ts_maio_cmd,
2289 "hopping maio <0-63>",
Harald Weltea42a93f2010-06-14 22:26:10 +02002290 HOPPING_STR
Harald Welte67104d12009-09-12 13:05:33 +02002291 "Which hopping MAIO to use for this channel")
2292{
2293 struct gsm_bts_trx_ts *ts = vty->index;
2294
2295 ts->hopping.maio = atoi(argv[0]);
2296
2297 return CMD_SUCCESS;
2298}
2299
2300DEFUN(cfg_ts_arfcn_add,
2301 cfg_ts_arfcn_add_cmd,
2302 "hopping arfcn add <0-1023>",
Harald Weltea42a93f2010-06-14 22:26:10 +02002303 HOPPING_STR "Configure hopping ARFCN list\n"
2304 "Add an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte67104d12009-09-12 13:05:33 +02002305{
2306 struct gsm_bts_trx_ts *ts = vty->index;
2307 int arfcn = atoi(argv[0]);
2308
Harald Weltea42a93f2010-06-14 22:26:10 +02002309 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1);
2310
Harald Welte67104d12009-09-12 13:05:33 +02002311 return CMD_SUCCESS;
2312}
2313
2314DEFUN(cfg_ts_arfcn_del,
2315 cfg_ts_arfcn_del_cmd,
2316 "hopping arfcn del <0-1023>",
Harald Weltea42a93f2010-06-14 22:26:10 +02002317 HOPPING_STR "Configure hopping ARFCN list\n"
2318 "Delete an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte67104d12009-09-12 13:05:33 +02002319{
2320 struct gsm_bts_trx_ts *ts = vty->index;
2321 int arfcn = atoi(argv[0]);
2322
Harald Weltea42a93f2010-06-14 22:26:10 +02002323 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0);
2324
Harald Welte67104d12009-09-12 13:05:33 +02002325 return CMD_SUCCESS;
2326}
2327
Harald Welte3ffe1b32009-08-07 00:25:23 +02002328DEFUN(cfg_ts_e1_subslot,
2329 cfg_ts_e1_subslot_cmd,
Harald Welte62868882009-08-08 16:12:58 +02002330 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte3ffe1b32009-08-07 00:25:23 +02002331 "E1 sub-slot connected to this on-air timeslot")
2332{
2333 struct gsm_bts_trx_ts *ts = vty->index;
2334
Harald Welte62868882009-08-08 16:12:58 +02002335 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Welte3ffe1b32009-08-07 00:25:23 +02002336
2337 return CMD_SUCCESS;
2338}
Harald Welte59b04682009-06-10 05:40:52 +08002339
Harald Weltea5b1dae2010-05-16 21:47:13 +02002340void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
2341{
2342 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
2343 counter_get(net->stats.chreq.total),
2344 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
2345 vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
2346 counter_get(net->stats.chan.rf_fail),
2347 counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
2348 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
2349 counter_get(net->stats.paging.attempted),
2350 counter_get(net->stats.paging.completed),
2351 counter_get(net->stats.paging.expired), VTY_NEWLINE);
2352 vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
2353 counter_get(net->stats.bts.oml_fail),
2354 counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
2355}
2356
Harald Welte682ee5f2010-05-16 22:02:16 +02002357DEFUN(logging_fltr_imsi,
2358 logging_fltr_imsi_cmd,
2359 "logging filter imsi IMSI",
2360 LOGGING_STR FILTER_STR
2361 "Filter log messages by IMSI\n" "IMSI to be used as filter\n")
2362{
2363 struct telnet_connection *conn;
2364
2365 conn = (struct telnet_connection *) vty->priv;
2366 if (!conn->dbg) {
2367 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
2368 return CMD_WARNING;
2369 }
2370
2371 log_set_imsi_filter(conn->dbg, argv[0]);
2372 return CMD_SUCCESS;
2373}
2374
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02002375DEFUN(drop_bts,
2376 drop_bts_cmd,
Holger Hans Peter Freythere4ac0e42010-04-11 12:46:45 +02002377 "drop bts connection <0-65535> (oml|rsl)",
2378 "Debug/Simulation command to drop ipaccess BTS\n"
2379 "BTS NR\n" "Connection Type\n")
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02002380{
2381 struct gsm_network *gsmnet;
2382 struct gsm_bts_trx *trx;
2383 struct gsm_bts *bts;
2384 unsigned int bts_nr;
2385
2386 gsmnet = gsmnet_from_vty(vty);
2387
2388 bts_nr = atoi(argv[0]);
2389 if (bts_nr >= gsmnet->num_bts) {
2390 vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s",
2391 gsmnet->num_bts, bts_nr, VTY_NEWLINE);
2392 return CMD_WARNING;
2393 }
2394
2395 bts = gsm_bts_num(gsmnet, bts_nr);
2396 if (!bts) {
2397 vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE);
2398 return CMD_WARNING;
2399 }
2400
2401 if (!is_ipaccess_bts(bts)) {
2402 vty_out(vty, "This command only works for ipaccess.%s", VTY_NEWLINE);
2403 return CMD_WARNING;
2404 }
2405
2406
2407 /* close all connections */
2408 if (strcmp(argv[1], "oml") == 0) {
Holger Hans Peter Freyther03f17d02010-11-15 20:29:46 +01002409 ipaccess_drop_oml(bts);
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02002410 } else if (strcmp(argv[1], "rsl") == 0) {
2411 /* close all rsl connections */
2412 llist_for_each_entry(trx, &bts->trx_list, list) {
Holger Hans Peter Freyther03f17d02010-11-15 20:29:46 +01002413 ipaccess_drop_rsl(trx);
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02002414 }
2415 } else {
2416 vty_out(vty, "Argument must be 'oml# or 'rsl'.%s", VTY_NEWLINE);
2417 return CMD_WARNING;
2418 }
2419
2420 return CMD_SUCCESS;
2421}
2422
2423
Harald Welte40152872010-05-16 20:52:23 +02002424extern int bsc_vty_init_extra(void);
Harald Welte10c29f62010-05-16 19:20:24 +02002425extern const char *openbsc_copyright;
Holger Hans Peter Freytherc48a2a12010-04-10 00:08:28 +02002426
Harald Welte40152872010-05-16 20:52:23 +02002427int bsc_vty_init(void)
Harald Welte59b04682009-06-10 05:40:52 +08002428{
Harald Welte7bc28f62010-05-12 16:10:35 +00002429 install_element_ve(&show_net_cmd);
2430 install_element_ve(&show_bts_cmd);
2431 install_element_ve(&show_trx_cmd);
2432 install_element_ve(&show_ts_cmd);
2433 install_element_ve(&show_lchan_cmd);
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +08002434 install_element_ve(&show_lchan_summary_cmd);
Harald Welte682ee5f2010-05-16 22:02:16 +02002435 install_element_ve(&logging_fltr_imsi_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002436
Harald Welte7bc28f62010-05-12 16:10:35 +00002437 install_element_ve(&show_e1drv_cmd);
2438 install_element_ve(&show_e1line_cmd);
2439 install_element_ve(&show_e1ts_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002440
Harald Welte7bc28f62010-05-12 16:10:35 +00002441 install_element_ve(&show_paging_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002442
Harald Welte682ee5f2010-05-16 22:02:16 +02002443 logging_vty_add_cmds();
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +01002444
Harald Weltee87eb462009-08-07 13:29:14 +02002445 install_element(CONFIG_NODE, &cfg_net_cmd);
2446 install_node(&net_node, config_write_net);
2447 install_default(GSMNET_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002448 install_element(GSMNET_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002449 install_element(GSMNET_NODE, &ournode_end_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002450 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Weltee87eb462009-08-07 13:29:14 +02002451 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
2452 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
2453 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02002454 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte59936d72009-11-18 20:33:19 +01002455 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Weltecca253a2009-08-30 15:47:06 +09002456 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01002457 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welte52af1952009-12-13 10:53:12 +01002458 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte284ddba2009-12-14 17:49:15 +01002459 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Welte0af9c9f2009-12-19 21:41:52 +01002460 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Weltea8062f12009-12-21 16:51:50 +01002461 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
2462 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
2463 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
2464 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
2465 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
2466 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01002467 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +01002468 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
2469 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
2470 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
2471 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
2472 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
2473 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
2474 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
2475 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
2476 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
2477 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Holger Hans Peter Freyther21d63ff2010-09-06 09:25:48 +08002478 install_element(GSMNET_NODE, &cfg_net_dtx_cmd);
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +08002479 install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd);
Harald Weltee87eb462009-08-07 13:29:14 +02002480
2481 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte97ceef92009-08-06 19:06:46 +02002482 install_node(&bts_node, config_write_bts);
Harald Welte59b04682009-06-10 05:40:52 +08002483 install_default(BTS_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002484 install_element(BTS_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002485 install_element(BTS_NODE, &ournode_end_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002486 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte8791dac2010-05-14 17:59:53 +02002487 install_element(BTS_NODE, &cfg_description_cmd);
2488 install_element(BTS_NODE, &cfg_no_description_cmd);
Harald Welte91afe4c2009-06-20 18:15:19 +02002489 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +02002490 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002491 install_element(BTS_NODE, &cfg_bts_lac_cmd);
2492 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002493 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002494 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte25572872009-10-20 00:22:00 +02002495 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002496 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
2497 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte3e774612009-08-10 13:48:16 +02002498 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01002499 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
2500 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08002501 install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd);
2502 install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd);
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02002503 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Holger Hans Peter Freyther440984b2010-05-14 00:39:19 +08002504 install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd);
Harald Welte (local)cbd46102009-08-13 10:14:26 +02002505 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02002506 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welteb761bf82009-12-12 18:17:25 +01002507 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
2508 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Sylvain Munaut00d71462010-11-28 18:17:28 +01002509 install_element(BTS_NODE, &cfg_bts_cell_bar_qualify_cmd);
2510 install_element(BTS_NODE, &cfg_bts_cell_resel_ofs_cmd);
2511 install_element(BTS_NODE, &cfg_bts_temp_ofs_cmd);
2512 install_element(BTS_NODE, &cfg_bts_temp_ofs_inf_cmd);
2513 install_element(BTS_NODE, &cfg_bts_penalty_time_cmd);
2514 install_element(BTS_NODE, &cfg_bts_penalty_time_rsvd_cmd);
Harald Weltecb20b7a2010-04-18 15:51:20 +02002515 install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
Harald Weltea9251762010-05-11 23:50:21 +02002516 install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd);
Harald Welte3055e332010-03-14 15:37:43 +08002517 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
2518 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Weltea9251762010-05-11 23:50:21 +02002519 install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
Harald Welte4a048c52010-03-22 11:48:36 +08002520 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte3055e332010-03-14 15:37:43 +08002521 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welte410575a2010-03-14 23:30:30 +08002522 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
2523 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
2524 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Holger Hans Peter Freyther3112f672010-09-06 10:11:25 +08002525 install_element(BTS_NODE, &cfg_bts_pag_free_cmd);
Harald Welted8acf142010-07-30 11:50:09 +02002526 install_element(BTS_NODE, &cfg_bts_si_mode_cmd);
2527 install_element(BTS_NODE, &cfg_bts_si_static_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002528
2529 install_element(BTS_NODE, &cfg_trx_cmd);
2530 install_node(&trx_node, dummy_config_write);
2531 install_default(TRX_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002532 install_element(TRX_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002533 install_element(TRX_NODE, &ournode_end_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002534 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte8791dac2010-05-14 17:59:53 +02002535 install_element(TRX_NODE, &cfg_description_cmd);
2536 install_element(TRX_NODE, &cfg_no_description_cmd);
Harald Welte (local)b709bfe2009-12-27 20:56:38 +01002537 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte7f597bc2009-06-20 22:36:12 +02002538 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002539 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
2540 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther1c8b4802009-11-11 11:54:24 +01002541 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002542
2543 install_element(TRX_NODE, &cfg_ts_cmd);
2544 install_node(&ts_node, dummy_config_write);
2545 install_default(TS_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002546 install_element(TS_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002547 install_element(TS_NODE, &ournode_end_cmd);
Harald Welte3ffe1b32009-08-07 00:25:23 +02002548 install_element(TS_NODE, &cfg_ts_pchan_cmd);
Harald Weltea42a93f2010-06-14 22:26:10 +02002549 install_element(TS_NODE, &cfg_ts_hopping_cmd);
Harald Welte67104d12009-09-12 13:05:33 +02002550 install_element(TS_NODE, &cfg_ts_hsn_cmd);
2551 install_element(TS_NODE, &cfg_ts_maio_cmd);
2552 install_element(TS_NODE, &cfg_ts_arfcn_add_cmd);
2553 install_element(TS_NODE, &cfg_ts_arfcn_del_cmd);
Harald Welte3ffe1b32009-08-07 00:25:23 +02002554 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002555
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02002556 install_element(ENABLE_NODE, &drop_bts_cmd);
2557
Harald Welte63b964e2010-05-31 16:40:40 +02002558 abis_nm_vty_init();
2559
Harald Welte40152872010-05-16 20:52:23 +02002560 bsc_vty_init_extra();
Harald Welte59b04682009-06-10 05:40:52 +08002561
2562 return 0;
2563}