blob: dd35372cab5ee082830e321205b5190788bdc9c1 [file] [log] [blame]
Harald Welte68628e82009-03-10 12:17:57 +00001/* OpenBSC interface to quagga VTY */
Harald Welteaf387632010-03-14 23:30:30 +08002/* (C) 2009-2010 by Harald Welte <laforge@gnumonks.org>
Harald Welte68628e82009-03-10 12:17:57 +00003 * All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#include <stdlib.h>
22#include <unistd.h>
23#include <sys/types.h>
24
25#include <vty/command.h>
Harald Weltef9daefd2009-08-09 15:13:54 +020026#include <vty/buffer.h>
Harald Welte68628e82009-03-10 12:17:57 +000027#include <vty/vty.h>
28
29#include <arpa/inet.h>
30
Harald Weltedfe6c7d2010-02-20 16:24:02 +010031#include <osmocore/linuxlist.h>
Harald Welte68628e82009-03-10 12:17:57 +000032#include <openbsc/gsm_data.h>
Harald Welte68628e82009-03-10 12:17:57 +000033#include <openbsc/e1_input.h>
Harald Welte1bc77352009-03-10 19:47:51 +000034#include <openbsc/abis_nm.h>
Harald Weltedfe6c7d2010-02-20 16:24:02 +010035#include <osmocore/gsm_utils.h>
Harald Welteb908cb72009-12-22 13:09:29 +010036#include <openbsc/chan_alloc.h>
Harald Welte8387a492009-12-22 21:43:14 +010037#include <openbsc/meas_rep.h>
Harald Welte40f82892009-05-23 17:31:39 +000038#include <openbsc/db.h>
Harald Weltedfe6c7d2010-02-20 16:24:02 +010039#include <osmocore/talloc.h>
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +010040#include <openbsc/telnet_interface.h>
Holger Hans Peter Freyther3c712322010-04-06 11:55:37 +020041#include <openbsc/vty.h>
Harald Welte68628e82009-03-10 12:17:57 +000042
43static struct gsm_network *gsmnet;
44
Harald Welte5013b2a2009-08-07 13:29:14 +020045struct cmd_node net_node = {
46 GSMNET_NODE,
47 "%s(network)#",
48 1,
49};
50
Harald Welte68628e82009-03-10 12:17:57 +000051struct cmd_node bts_node = {
52 BTS_NODE,
53 "%s(bts)#",
54 1,
55};
56
57struct cmd_node trx_node = {
58 TRX_NODE,
59 "%s(trx)#",
60 1,
61};
62
63struct cmd_node ts_node = {
64 TS_NODE,
65 "%s(ts)#",
66 1,
67};
68
69static int dummy_config_write(struct vty *v)
70{
71 return CMD_SUCCESS;
72}
73
74static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
75{
Harald Welte1bc77352009-03-10 19:47:51 +000076 vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s",
77 nm_opstate_name(nms->operational), nms->administrative,
78 nm_avail_name(nms->availability), VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +000079}
80
Harald Welteb908cb72009-12-22 13:09:29 +010081static void dump_pchan_load_vty(struct vty *vty, char *prefix,
82 const struct pchan_load *pl)
83{
84 int i;
85
86 for (i = 0; i < ARRAY_SIZE(pl->pchan); i++) {
87 const struct load_counter *lc = &pl->pchan[i];
88 unsigned int percent;
89
90 if (lc->total == 0)
91 continue;
92
93 percent = (lc->used * 100) / lc->total;
94
95 vty_out(vty, "%s%20s: %3u%% (%u/%u)%s", prefix,
96 gsm_pchan_name(i), percent, lc->used, lc->total,
97 VTY_NEWLINE);
98 }
99}
100
Harald Welte68628e82009-03-10 12:17:57 +0000101static void net_dump_vty(struct vty *vty, struct gsm_network *net)
102{
Harald Welteb908cb72009-12-22 13:09:29 +0100103 struct pchan_load pl;
104
Harald Welteef235b52009-03-10 12:34:02 +0000105 vty_out(vty, "BSC is on Country Code %u, Network Code %u "
106 "and has %u BTS%s", net->country_code, net->network_code,
107 net->num_bts, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000108 vty_out(vty, " Long network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000109 net->name_long, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000110 vty_out(vty, " Short network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000111 net->name_short, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200112 vty_out(vty, " Authentication policy: %s%s",
113 gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100114 vty_out(vty, " Location updating reject cause: %u%s",
115 net->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900116 vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption,
117 VTY_NEWLINE);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +0100118 vty_out(vty, " NECI (TCH/H): %u%s", net->neci,
119 VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100120 vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode),
121 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100122 vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off",
123 VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100124 vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off",
125 VTY_NEWLINE);
Harald Welteb908cb72009-12-22 13:09:29 +0100126 network_chan_load(&pl, net);
127 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
128 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000129}
130
131DEFUN(show_net, show_net_cmd, "show network",
132 SHOW_STR "Display information about a GSM NETWORK\n")
133{
134 struct gsm_network *net = gsmnet;
135 net_dump_vty(vty, net);
136
137 return CMD_SUCCESS;
138}
139
140static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l)
141{
Harald Welteedb37782009-05-01 14:59:07 +0000142 struct e1inp_line *line;
143
144 if (!e1l) {
145 vty_out(vty, " None%s", VTY_NEWLINE);
146 return;
147 }
148
149 line = e1l->ts->line;
150
151 vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s",
152 line->num, line->driver->name, e1l->ts->num,
Harald Welte1bc77352009-03-10 19:47:51 +0000153 e1inp_signtype_name(e1l->type), VTY_NEWLINE);
Harald Welteedb37782009-05-01 14:59:07 +0000154 vty_out(vty, " E1 TEI %u, SAPI %u%s",
Harald Welte68628e82009-03-10 12:17:57 +0000155 e1l->tei, e1l->sapi, VTY_NEWLINE);
156}
157
158static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
159{
Harald Welteb908cb72009-12-22 13:09:29 +0100160 struct pchan_load pl;
161
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200162 vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
Harald Weltefcd24452009-06-20 18:15:19 +0200163 "BSIC %u, TSC %u and %u TRX%s",
164 bts->nr, btstype2str(bts->type), gsm_band_name(bts->band),
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200165 bts->cell_identity,
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +0200166 bts->location_area_code, bts->bsic, bts->tsc,
Harald Weltefcd24452009-06-20 18:15:19 +0200167 bts->num_trx, VTY_NEWLINE);
Harald Welte1d8dbc42009-12-12 15:38:16 +0100168 vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100169 vty_out(vty, "Minimum Rx Level for Access: %i dBm%s",
Harald Welte1d8dbc42009-12-12 15:38:16 +0100170 rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min),
171 VTY_NEWLINE);
172 vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s",
Harald Welte73225282009-12-12 18:17:25 +0100173 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100174 vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer,
175 VTY_NEWLINE);
176 vty_out(vty, "RACH Max transmissions: %u%s",
177 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
178 VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100179 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200180 vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE);
Harald Welte4cc34222009-05-01 15:12:31 +0000181 if (is_ipaccess_bts(bts))
Harald Welte8175e952009-10-20 00:22:00 +0200182 vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
Harald Welte4cc34222009-05-01 15:12:31 +0000183 bts->ip_access.site_id, bts->ip_access.bts_id,
Harald Welte8175e952009-10-20 00:22:00 +0200184 bts->oml_tei, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000185 vty_out(vty, " NM State: ");
186 net_dump_nmstate(vty, &bts->nm_state);
187 vty_out(vty, " Site Mgr NM State: ");
188 net_dump_nmstate(vty, &bts->site_mgr.nm_state);
189 vty_out(vty, " Paging: FIXME pending requests, %u free slots%s",
190 bts->paging.available_slots, VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200191 if (!is_ipaccess_bts(bts)) {
192 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
193 e1isl_dump_vty(vty, bts->oml_link);
194 }
Harald Welte68628e82009-03-10 12:17:57 +0000195 /* FIXME: oml_link, chan_desc */
Harald Welteb908cb72009-12-22 13:09:29 +0100196 memset(&pl, 0, sizeof(pl));
197 bts_chan_load(&pl, bts);
198 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
199 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000200}
201
202DEFUN(show_bts, show_bts_cmd, "show bts [number]",
203 SHOW_STR "Display information about a BTS\n"
204 "BTS number")
205{
206 struct gsm_network *net = gsmnet;
207 int bts_nr;
208
209 if (argc != 0) {
210 /* use the BTS number that the user has specified */
211 bts_nr = atoi(argv[0]);
212 if (bts_nr > net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000213 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000214 VTY_NEWLINE);
215 return CMD_WARNING;
216 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200217 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000218 return CMD_SUCCESS;
219 }
220 /* print all BTS's */
221 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee441d9c2009-06-21 16:17:15 +0200222 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000223
224 return CMD_SUCCESS;
225}
226
Harald Welte42581822009-08-08 16:12:58 +0200227/* utility functions */
228static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
229 const char *ts, const char *ss)
230{
231 e1_link->e1_nr = atoi(line);
232 e1_link->e1_ts = atoi(ts);
233 if (!strcmp(ss, "full"))
234 e1_link->e1_ts_ss = 255;
235 else
236 e1_link->e1_ts_ss = atoi(ss);
237}
238
239static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,
240 const char *prefix)
241{
242 if (!e1_link->e1_ts)
243 return;
244
245 if (e1_link->e1_ts_ss == 255)
246 vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s",
247 prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE);
248 else
249 vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s",
250 prefix, e1_link->e1_nr, e1_link->e1_ts,
251 e1_link->e1_ts_ss, VTY_NEWLINE);
252}
253
254
Harald Welte67ce0732009-08-06 19:06:46 +0200255static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
256{
Harald Welte42581822009-08-08 16:12:58 +0200257 vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
258 if (ts->pchan != GSM_PCHAN_NONE)
259 vty_out(vty, " phys_chan_config %s%s",
260 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
261 config_write_e1_link(vty, &ts->e1_link, " ");
Harald Welte67ce0732009-08-06 19:06:46 +0200262}
263
264static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
265{
266 int i;
267
Harald Welte5013b2a2009-08-07 13:29:14 +0200268 vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE);
Holger Hans Peter Freyther2ba40af2010-04-17 06:42:07 +0200269 vty_out(vty, " rf_locked %u%s",
270 trx->nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
271 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200272 vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
Harald Welte (local)7b37d972009-12-27 20:56:38 +0100273 vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200274 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200275 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
276 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte67ce0732009-08-06 19:06:46 +0200277
278 for (i = 0; i < TRX_NR_TS; i++)
279 config_write_ts_single(vty, &trx->ts[i]);
280}
281
282static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
283{
284 struct gsm_bts_trx *trx;
Harald Welte97a282b2010-03-14 15:37:43 +0800285 int i;
Harald Welte67ce0732009-08-06 19:06:46 +0200286
Harald Welte5013b2a2009-08-07 13:29:14 +0200287 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
288 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
289 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freytherf926ed62009-11-19 16:38:49 +0100290 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200291 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte67ce0732009-08-06 19:06:46 +0200292 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200293 vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE);
294 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)0e451d02009-08-13 10:14:26 +0200295 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100296 vty_out(vty, " cell reselection hysteresis %u%s",
297 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
298 vty_out(vty, " rxlev access min %u%s",
299 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Harald Weltea43f7892009-12-01 18:04:30 +0530300 if (bts->si_common.chan_desc.t3212)
Harald Welte (local)efc92312009-08-14 23:09:25 +0200301 vty_out(vty, " periodic location update %u%s",
Harald Weltea43f7892009-12-01 18:04:30 +0530302 bts->si_common.chan_desc.t3212 * 10, VTY_NEWLINE);
Harald Welte7a8fa412009-08-10 13:48:16 +0200303 vty_out(vty, " channel allocator %s%s",
304 bts->chan_alloc_reverse ? "descending" : "ascending",
305 VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100306 vty_out(vty, " rach tx integer %u%s",
307 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
308 vty_out(vty, " rach max transmission %u%s",
309 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
310 VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100311 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200312 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200313 if (is_ipaccess_bts(bts)) {
Harald Welte5013b2a2009-08-07 13:29:14 +0200314 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Weltea6fd58e2009-08-07 00:25:23 +0200315 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200316 vty_out(vty, " oml ip.access stream_id %u%s", bts->oml_tei, VTY_NEWLINE);
317 } else {
Harald Welte42581822009-08-08 16:12:58 +0200318 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
319 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
320 }
Harald Welte4511d892010-04-18 15:51:20 +0200321 vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode),
322 VTY_NEWLINE);
323 if (bts->gprs.mode != BTS_GPRS_NONE) {
Harald Welteaf387632010-03-14 23:30:30 +0800324 vty_out(vty, " gprs routing area %u%s", bts->gprs.rac,
325 VTY_NEWLINE);
326 vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
327 VTY_NEWLINE);
Harald Weltea5731cf2010-03-22 11:48:36 +0800328 vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei,
329 VTY_NEWLINE);
Harald Welteaf387632010-03-14 23:30:30 +0800330 for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
331 struct gsm_bts_gprs_nsvc *nsvc =
332 &bts->gprs.nsvc[i];
333 struct in_addr ia;
334
335 ia.s_addr = htonl(nsvc->remote_ip);
336 vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
337 nsvc->nsvci, VTY_NEWLINE);
338 vty_out(vty, " gprs nsvc %u local udp port %u%s", i,
339 nsvc->local_port, VTY_NEWLINE);
340 vty_out(vty, " gprs nsvc %u remote udp port %u%s", i,
341 nsvc->remote_port, VTY_NEWLINE);
342 vty_out(vty, " gprs nsvc %u remote ip %s%s", i,
343 inet_ntoa(ia), VTY_NEWLINE);
344 }
345 }
Harald Welte67ce0732009-08-06 19:06:46 +0200346
347 llist_for_each_entry(trx, &bts->trx_list, list)
348 config_write_trx_single(vty, trx);
349}
350
351static int config_write_bts(struct vty *v)
352{
353 struct gsm_bts *bts;
354
355 llist_for_each_entry(bts, &gsmnet->bts_list, list)
356 config_write_bts_single(v, bts);
357
358 return CMD_SUCCESS;
359}
360
Harald Welte5013b2a2009-08-07 13:29:14 +0200361static int config_write_net(struct vty *vty)
362{
363 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200364 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200365 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200366 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
367 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200368 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100369 vty_out(vty, " location updating reject cause %u%s",
370 gsmnet->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900371 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freytherd54c3372009-11-19 16:37:48 +0100372 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100373 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
374 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100375 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100376 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Welteb720bd32009-12-21 16:51:50 +0100377 vty_out(vty, " handover window rxlev averaging %u%s",
378 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
379 vty_out(vty, " handover window rxqual averaging %u%s",
380 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
381 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
382 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
383 vty_out(vty, " handover power budget interval %u%s",
384 gsmnet->handover.pwr_interval, VTY_NEWLINE);
385 vty_out(vty, " handover power budget hysteresis %u%s",
386 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
387 vty_out(vty, " handover maximum distance %u%s",
388 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +0100389 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100390 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
391 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
392 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
393 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
394 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
395 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
396 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
397 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
398 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
399 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200400
401 return CMD_SUCCESS;
402}
Harald Welte67ce0732009-08-06 19:06:46 +0200403
Harald Welte68628e82009-03-10 12:17:57 +0000404static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
405{
406 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
407 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Weltefcd24452009-06-20 18:15:19 +0200408 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte42581822009-08-08 16:12:58 +0200409 "resulting BS power: %d dBm%s",
Harald Weltefcd24452009-06-20 18:15:19 +0200410 trx->nominal_power, trx->max_power_red,
Harald Welte42581822009-08-08 16:12:58 +0200411 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000412 vty_out(vty, " NM State: ");
413 net_dump_nmstate(vty, &trx->nm_state);
414 vty_out(vty, " Baseband Transceiver NM State: ");
415 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte8175e952009-10-20 00:22:00 +0200416 if (is_ipaccess_bts(trx->bts)) {
417 vty_out(vty, " ip.access stream ID: 0x%02x%s",
418 trx->rsl_tei, VTY_NEWLINE);
419 } else {
420 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
421 e1isl_dump_vty(vty, trx->rsl_link);
422 }
Harald Welte68628e82009-03-10 12:17:57 +0000423}
424
425DEFUN(show_trx,
426 show_trx_cmd,
427 "show trx [bts_nr] [trx_nr]",
428 SHOW_STR "Display information about a TRX\n")
429{
430 struct gsm_network *net = gsmnet;
431 struct gsm_bts *bts = NULL;
432 struct gsm_bts_trx *trx;
433 int bts_nr, trx_nr;
434
435 if (argc >= 1) {
436 /* use the BTS number that the user has specified */
437 bts_nr = atoi(argv[0]);
438 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000439 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000440 VTY_NEWLINE);
441 return CMD_WARNING;
442 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200443 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000444 }
445 if (argc >= 2) {
446 trx_nr = atoi(argv[1]);
447 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000448 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000449 VTY_NEWLINE);
450 return CMD_WARNING;
451 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200452 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000453 trx_dump_vty(vty, trx);
454 return CMD_SUCCESS;
455 }
456 if (bts) {
457 /* print all TRX in this BTS */
458 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200459 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000460 trx_dump_vty(vty, trx);
461 }
462 return CMD_SUCCESS;
463 }
464
465 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200466 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000467 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200468 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000469 trx_dump_vty(vty, trx);
470 }
471 }
472
473 return CMD_SUCCESS;
474}
475
Harald Welte67ce0732009-08-06 19:06:46 +0200476
Harald Welte68628e82009-03-10 12:17:57 +0000477static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
478{
Harald Welte68628e82009-03-10 12:17:57 +0000479 vty_out(vty, "Timeslot %u of TRX %u in BTS %u, phys cfg %s%s",
480 ts->nr, ts->trx->nr, ts->trx->bts->nr,
481 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
482 vty_out(vty, " NM State: ");
483 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte2c828992009-12-02 01:56:49 +0530484 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welteef235b52009-03-10 12:34:02 +0000485 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
486 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
487 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000488}
489
490DEFUN(show_ts,
491 show_ts_cmd,
Harald Welte1bc77352009-03-10 19:47:51 +0000492 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
Harald Welte68628e82009-03-10 12:17:57 +0000493 SHOW_STR "Display information about a TS\n")
494{
495 struct gsm_network *net = gsmnet;
496 struct gsm_bts *bts;
497 struct gsm_bts_trx *trx;
498 struct gsm_bts_trx_ts *ts;
499 int bts_nr, trx_nr, ts_nr;
500
501 if (argc >= 1) {
502 /* use the BTS number that the user has specified */
503 bts_nr = atoi(argv[0]);
504 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000505 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000506 VTY_NEWLINE);
507 return CMD_WARNING;
508 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200509 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000510 }
511 if (argc >= 2) {
512 trx_nr = atoi(argv[1]);
513 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000514 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000515 VTY_NEWLINE);
516 return CMD_WARNING;
517 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200518 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000519 }
520 if (argc >= 3) {
521 ts_nr = atoi(argv[2]);
522 if (ts_nr >= TRX_NR_TS) {
Harald Welte1bc77352009-03-10 19:47:51 +0000523 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
Harald Welte68628e82009-03-10 12:17:57 +0000524 VTY_NEWLINE);
525 return CMD_WARNING;
526 }
527 ts = &trx->ts[ts_nr];
528 ts_dump_vty(vty, ts);
529 return CMD_SUCCESS;
530 }
531 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200532 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000533 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200534 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000535 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
536 ts = &trx->ts[ts_nr];
537 ts_dump_vty(vty, ts);
538 }
539 }
540 }
541
542 return CMD_SUCCESS;
543}
544
Holger Hans Peter Freyther424c4f02010-01-06 06:00:40 +0100545static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte68628e82009-03-10 12:17:57 +0000546{
Harald Weltefcd24452009-06-20 18:15:19 +0200547 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte40f82892009-05-23 17:31:39 +0000548 subscr->authorized, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000549 if (subscr->name)
Harald Welte1bc77352009-03-10 19:47:51 +0000550 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000551 if (subscr->extension)
552 vty_out(vty, " Extension: %s%s", subscr->extension,
553 VTY_NEWLINE);
554 if (subscr->imsi)
555 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freyther22230252009-08-19 12:53:57 +0200556 if (subscr->tmsi != GSM_RESERVED_TMSI)
557 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte731fd912009-08-15 03:24:51 +0200558 VTY_NEWLINE);
Sylvain Munautaf292642009-12-27 19:29:28 +0100559
Harald Welte (local)15920de2009-08-14 20:27:16 +0200560 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000561}
562
Harald Welte8387a492009-12-22 21:43:14 +0100563static void meas_rep_dump_uni_vty(struct vty *vty,
564 struct gsm_meas_rep_unidir *mru,
565 const char *prefix,
566 const char *dir)
567{
568 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
569 prefix, dir, rxlev2dbm(mru->full.rx_lev),
570 dir, rxlev2dbm(mru->sub.rx_lev));
571 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
572 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
573 VTY_NEWLINE);
574}
575
576static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
577 const char *prefix)
578{
579 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
580 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
581 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
582 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
583 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
584 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
585 VTY_NEWLINE);
586 if (mr->flags & MEAS_REP_F_MS_TO)
587 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
588 mr->ms_timing_offset, VTY_NEWLINE);
589 if (mr->flags & MEAS_REP_F_MS_L1)
590 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
591 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
592 if (mr->flags & MEAS_REP_F_DL_VALID)
593 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
594 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
595}
596
Harald Welte68628e82009-03-10 12:17:57 +0000597static void lchan_dump_vty(struct vty *vty, struct gsm_lchan *lchan)
598{
Harald Welte8387a492009-12-22 21:43:14 +0100599 int idx;
600
Harald Welte68628e82009-03-10 12:17:57 +0000601 vty_out(vty, "Lchan %u in Timeslot %u of TRX %u in BTS %u, Type %s%s",
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +0200602 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
Harald Welte (local)ccd88452009-12-27 18:05:25 +0100603 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Harald Welte68628e82009-03-10 12:17:57 +0000604 VTY_NEWLINE);
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100605 vty_out(vty, " Use Count: %u, State: %s%s", lchan->conn.use_count,
Harald Welte1887f9d2009-12-29 10:52:38 +0100606 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100607 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
608 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
609 - lchan->bs_power*2,
610 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
611 VTY_NEWLINE);
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100612 if (lchan->conn.subscr) {
Harald Welte68628e82009-03-10 12:17:57 +0000613 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100614 subscr_dump_vty(vty, lchan->conn.subscr);
Harald Welte68628e82009-03-10 12:17:57 +0000615 } else
616 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte2c828992009-12-02 01:56:49 +0530617 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
618 struct in_addr ia;
Holger Hans Peter Freyther54fa7992010-04-07 15:39:16 +0200619 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte2c828992009-12-02 01:56:49 +0530620 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
621 inet_ntoa(ia), lchan->abis_ip.bound_port,
622 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
623 VTY_NEWLINE);
624 }
Harald Welte8387a492009-12-22 21:43:14 +0100625
626 /* we want to report the last measurement report */
627 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
628 lchan->meas_rep_idx, 1);
629 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte68628e82009-03-10 12:17:57 +0000630}
631
Harald Welte4bfdfe72009-06-10 23:11:52 +0800632#if 0
633TODO: callref and remote callref of call must be resolved to get gsm_trans object
Harald Welte68628e82009-03-10 12:17:57 +0000634static void call_dump_vty(struct vty *vty, struct gsm_call *call)
635{
636 vty_out(vty, "Call Type %u, State %u, Transaction ID %u%s",
637 call->type, call->state, call->transaction_id, VTY_NEWLINE);
638
639 if (call->local_lchan) {
640 vty_out(vty, "Call Local Channel:%s", VTY_NEWLINE);
641 lchan_dump_vty(vty, call->local_lchan);
642 } else
643 vty_out(vty, "Call has no Local Channel%s", VTY_NEWLINE);
644
645 if (call->remote_lchan) {
646 vty_out(vty, "Call Remote Channel:%s", VTY_NEWLINE);
647 lchan_dump_vty(vty, call->remote_lchan);
648 } else
649 vty_out(vty, "Call has no Remote Channel%s", VTY_NEWLINE);
650
651 if (call->called_subscr) {
652 vty_out(vty, "Called Subscriber:%s", VTY_NEWLINE);
653 subscr_dump_vty(vty, call->called_subscr);
654 } else
655 vty_out(vty, "Call has no Called Subscriber%s", VTY_NEWLINE);
656}
Harald Welte4bfdfe72009-06-10 23:11:52 +0800657#endif
Harald Welte68628e82009-03-10 12:17:57 +0000658
659DEFUN(show_lchan,
660 show_lchan_cmd,
661 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
662 SHOW_STR "Display information about a logical channel\n")
663{
664 struct gsm_network *net = gsmnet;
665 struct gsm_bts *bts;
666 struct gsm_bts_trx *trx;
667 struct gsm_bts_trx_ts *ts;
668 struct gsm_lchan *lchan;
669 int bts_nr, trx_nr, ts_nr, lchan_nr;
670
671 if (argc >= 1) {
672 /* use the BTS number that the user has specified */
673 bts_nr = atoi(argv[0]);
674 if (bts_nr >= net->num_bts) {
675 vty_out(vty, "%% can't find BTS %s%s", argv[0],
676 VTY_NEWLINE);
677 return CMD_WARNING;
678 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200679 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000680 }
681 if (argc >= 2) {
682 trx_nr = atoi(argv[1]);
683 if (trx_nr >= bts->num_trx) {
684 vty_out(vty, "%% can't find TRX %s%s", argv[1],
685 VTY_NEWLINE);
686 return CMD_WARNING;
687 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200688 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000689 }
690 if (argc >= 3) {
691 ts_nr = atoi(argv[2]);
692 if (ts_nr >= TRX_NR_TS) {
693 vty_out(vty, "%% can't find TS %s%s", argv[2],
694 VTY_NEWLINE);
695 return CMD_WARNING;
696 }
697 ts = &trx->ts[ts_nr];
698 }
699 if (argc >= 4) {
700 lchan_nr = atoi(argv[3]);
701 if (lchan_nr >= TS_MAX_LCHAN) {
702 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
703 VTY_NEWLINE);
704 return CMD_WARNING;
705 }
706 lchan = &ts->lchan[lchan_nr];
707 lchan_dump_vty(vty, lchan);
708 return CMD_SUCCESS;
709 }
710 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200711 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000712 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200713 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000714 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
715 ts = &trx->ts[ts_nr];
716 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
717 lchan_nr++) {
718 lchan = &ts->lchan[lchan_nr];
Harald Welteef235b52009-03-10 12:34:02 +0000719 if (lchan->type == GSM_LCHAN_NONE)
720 continue;
Harald Welte68628e82009-03-10 12:17:57 +0000721 lchan_dump_vty(vty, lchan);
722 }
723 }
724 }
725 }
726
727 return CMD_SUCCESS;
728}
729
Harald Welte1bc77352009-03-10 19:47:51 +0000730static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
731{
732 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
733}
734
735DEFUN(show_e1drv,
736 show_e1drv_cmd,
737 "show e1_driver",
738 SHOW_STR "Display information about available E1 drivers\n")
739{
740 struct e1inp_driver *drv;
741
742 llist_for_each_entry(drv, &e1inp_driver_list, list)
743 e1drv_dump_vty(vty, drv);
744
745 return CMD_SUCCESS;
746}
747
Harald Welte68628e82009-03-10 12:17:57 +0000748static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
749{
750 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
751 line->num, line->name ? line->name : "",
752 line->driver->name, VTY_NEWLINE);
753}
754
755DEFUN(show_e1line,
756 show_e1line_cmd,
757 "show e1_line [line_nr]",
758 SHOW_STR "Display information about a E1 line\n")
759{
Harald Welte1bc77352009-03-10 19:47:51 +0000760 struct e1inp_line *line;
761
762 if (argc >= 1) {
763 int num = atoi(argv[0]);
764 llist_for_each_entry(line, &e1inp_line_list, list) {
765 if (line->num == num) {
766 e1line_dump_vty(vty, line);
767 return CMD_SUCCESS;
768 }
769 }
770 return CMD_WARNING;
771 }
772
773 llist_for_each_entry(line, &e1inp_line_list, list)
774 e1line_dump_vty(vty, line);
775
776 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000777}
778
779static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
780{
Harald Welte42581822009-08-08 16:12:58 +0200781 if (ts->type == E1INP_TS_TYPE_NONE)
782 return;
Harald Welte1bc77352009-03-10 19:47:51 +0000783 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
784 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
785 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000786}
787
788DEFUN(show_e1ts,
789 show_e1ts_cmd,
790 "show e1_timeslot [line_nr] [ts_nr]",
791 SHOW_STR "Display information about a E1 timeslot\n")
792{
Harald Welte986c3d72009-11-17 06:12:16 +0100793 struct e1inp_line *line = NULL;
Harald Welte1bc77352009-03-10 19:47:51 +0000794 struct e1inp_ts *ts;
795 int ts_nr;
Harald Welte68628e82009-03-10 12:17:57 +0000796
Harald Welte1bc77352009-03-10 19:47:51 +0000797 if (argc == 0) {
798 llist_for_each_entry(line, &e1inp_line_list, list) {
799 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
800 ts = &line->ts[ts_nr];
801 e1ts_dump_vty(vty, ts);
802 }
803 }
804 return CMD_SUCCESS;
805 }
806 if (argc >= 1) {
807 int num = atoi(argv[0]);
808 llist_for_each_entry(line, &e1inp_line_list, list) {
809 if (line->num == num)
810 break;
811 }
812 if (!line || line->num != num) {
813 vty_out(vty, "E1 line %s is invalid%s",
814 argv[0], VTY_NEWLINE);
815 return CMD_WARNING;
816 }
817 }
818 if (argc >= 2) {
819 ts_nr = atoi(argv[1]);
820 if (ts_nr > NUM_E1_TS) {
821 vty_out(vty, "E1 timeslot %s is invalid%s",
822 argv[1], VTY_NEWLINE);
823 return CMD_WARNING;
824 }
825 ts = &line->ts[ts_nr];
826 e1ts_dump_vty(vty, ts);
827 return CMD_SUCCESS;
828 } else {
829 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
830 ts = &line->ts[ts_nr];
831 e1ts_dump_vty(vty, ts);
832 }
833 return CMD_SUCCESS;
834 }
835 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000836}
837
Harald Weltebe4b7302009-05-23 16:59:33 +0000838static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
Harald Weltef5025b62009-03-28 16:55:11 +0000839{
840 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
841 subscr_dump_vty(vty, pag->subscr);
842}
843
Harald Weltebe4b7302009-05-23 16:59:33 +0000844static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
Harald Weltef5025b62009-03-28 16:55:11 +0000845{
846 struct gsm_paging_request *pag;
847
848 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
849 paging_dump_vty(vty, pag);
850}
851
852DEFUN(show_paging,
853 show_paging_cmd,
854 "show paging [bts_nr]",
Harald Weltebe4b7302009-05-23 16:59:33 +0000855 SHOW_STR "Display information about paging reuqests of a BTS\n")
Harald Weltef5025b62009-03-28 16:55:11 +0000856{
857 struct gsm_network *net = gsmnet;
858 struct gsm_bts *bts;
859 int bts_nr;
860
861 if (argc >= 1) {
862 /* use the BTS number that the user has specified */
863 bts_nr = atoi(argv[0]);
864 if (bts_nr >= net->num_bts) {
865 vty_out(vty, "%% can't find BTS %s%s", argv[0],
866 VTY_NEWLINE);
867 return CMD_WARNING;
868 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200869 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +0000870 bts_paging_dump_vty(vty, bts);
871
872 return CMD_SUCCESS;
873 }
874 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200875 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +0000876 bts_paging_dump_vty(vty, bts);
877 }
878
879 return CMD_SUCCESS;
880}
881
Harald Welte5013b2a2009-08-07 13:29:14 +0200882DEFUN(cfg_net,
883 cfg_net_cmd,
884 "network",
885 "Configure the GSM network")
886{
887 vty->index = gsmnet;
888 vty->node = GSMNET_NODE;
889
890 return CMD_SUCCESS;
891}
892
893
894DEFUN(cfg_net_ncc,
895 cfg_net_ncc_cmd,
896 "network country code <1-999>",
897 "Set the GSM network country code")
898{
899 gsmnet->country_code = atoi(argv[0]);
900
901 return CMD_SUCCESS;
902}
903
904DEFUN(cfg_net_mnc,
905 cfg_net_mnc_cmd,
906 "mobile network code <1-999>",
907 "Set the GSM mobile network code")
908{
909 gsmnet->network_code = atoi(argv[0]);
910
911 return CMD_SUCCESS;
912}
913
914DEFUN(cfg_net_name_short,
915 cfg_net_name_short_cmd,
916 "short name NAME",
917 "Set the short GSM network name")
918{
919 if (gsmnet->name_short)
920 talloc_free(gsmnet->name_short);
921
922 gsmnet->name_short = talloc_strdup(gsmnet, argv[0]);
923
924 return CMD_SUCCESS;
925}
926
927DEFUN(cfg_net_name_long,
928 cfg_net_name_long_cmd,
929 "long name NAME",
930 "Set the long GSM network name")
931{
932 if (gsmnet->name_long)
933 talloc_free(gsmnet->name_long);
934
935 gsmnet->name_long = talloc_strdup(gsmnet, argv[0]);
936
937 return CMD_SUCCESS;
938}
Harald Welte40f82892009-05-23 17:31:39 +0000939
Harald Welte (local)69de3972009-08-12 14:42:23 +0200940DEFUN(cfg_net_auth_policy,
941 cfg_net_auth_policy_cmd,
942 "auth policy (closed|accept-all|token)",
943 "Set the GSM network authentication policy\n")
944{
945 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
946
947 gsmnet->auth_policy = policy;
948
949 return CMD_SUCCESS;
950}
951
Harald Welte1085c092009-11-18 20:33:19 +0100952DEFUN(cfg_net_reject_cause,
953 cfg_net_reject_cause_cmd,
954 "location updating reject cause <2-111>",
955 "Set the reject cause of location updating reject\n")
956{
957 gsmnet->reject_cause = atoi(argv[0]);
958
959 return CMD_SUCCESS;
960}
961
Harald Welte4381cfe2009-08-30 15:47:06 +0900962DEFUN(cfg_net_encryption,
963 cfg_net_encryption_cmd,
964 "encryption a5 (0|1|2)",
965 "Enable or disable encryption (A5) for this network\n")
966{
Andreas.Eversberg1059deb2009-11-17 09:55:26 +0100967 gsmnet->a5_encryption= atoi(argv[0]);
Harald Welte4381cfe2009-08-30 15:47:06 +0900968
969 return CMD_SUCCESS;
970}
971
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +0100972DEFUN(cfg_net_neci,
973 cfg_net_neci_cmd,
974 "neci (0|1)",
975 "Set if NECI of cell selection is to be set")
976{
977 gsmnet->neci = atoi(argv[0]);
978 return CMD_SUCCESS;
979}
980
Harald Welteeab84a12009-12-13 10:53:12 +0100981DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
982 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
983 "Set the Radio Resource Location Protocol Mode")
984{
985 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
986
987 return CMD_SUCCESS;
988}
989
Harald Welte648b6ce2009-12-14 09:00:24 +0100990DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
991 "mm info (0|1)",
992 "Whether to send MM INFO after LOC UPD ACCEPT")
993{
994 gsmnet->send_mm_info = atoi(argv[0]);
995
996 return CMD_SUCCESS;
997}
998
Harald Weltebc814502009-12-19 21:41:52 +0100999DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1000 "handover (0|1)",
1001 "Whether or not to use in-call handover")
1002{
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001003 int enable = atoi(argv[0]);
1004
1005 if (enable && ipacc_rtp_direct) {
Harald Weltefe03f0d2009-12-20 13:51:01 +01001006 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1007 "is enabled by using the -P command line option%s",
1008 VTY_NEWLINE);
1009 return CMD_WARNING;
1010 }
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001011 gsmnet->handover.active = enable;
Harald Weltebc814502009-12-19 21:41:52 +01001012
1013 return CMD_SUCCESS;
1014}
1015
Harald Welteb720bd32009-12-21 16:51:50 +01001016DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1017 "handover window rxlev averaging <1-10>",
1018 "How many RxLev measurements are used for averaging")
1019{
1020 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1021 return CMD_SUCCESS;
1022}
1023
1024DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1025 "handover window rxqual averaging <1-10>",
1026 "How many RxQual measurements are used for averaging")
1027{
1028 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1029 return CMD_SUCCESS;
1030}
1031
1032DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1033 "handover window rxlev neighbor averaging <1-10>",
1034 "How many RxQual measurements are used for averaging")
1035{
1036 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1037 return CMD_SUCCESS;
1038}
1039
1040DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1041 "handover power budget interval <1-99>",
1042 "How often to check if we have a better cell (SACCH frames)")
1043{
1044 gsmnet->handover.pwr_interval = atoi(argv[0]);
1045 return CMD_SUCCESS;
1046}
1047
1048DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1049 "handover power budget hysteresis <0-999>",
1050 "How many dB does a neighbor to be stronger to become a HO candidate")
1051{
1052 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1053 return CMD_SUCCESS;
1054}
1055
1056DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1057 "handover maximum distance <0-9999>",
1058 "How big is the maximum timing advance before HO is forced")
1059{
1060 gsmnet->handover.max_distance = atoi(argv[0]);
1061 return CMD_SUCCESS;
1062}
Harald Weltebc814502009-12-19 21:41:52 +01001063
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001064#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001065 DEFUN(cfg_net_T##number, \
1066 cfg_net_T##number##_cmd, \
1067 "timer t" #number " <0-65535>", \
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001068 doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001069{ \
1070 int value = atoi(argv[0]); \
1071 \
1072 if (value < 0 || value > 65535) { \
1073 vty_out(vty, "Timer value %s out of range.%s", \
1074 argv[0], VTY_NEWLINE); \
1075 return CMD_WARNING; \
1076 } \
1077 \
1078 gsmnet->T##number = value; \
1079 return CMD_SUCCESS; \
1080}
1081
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001082DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1083DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1084DECLARE_TIMER(3105, "Currently not used.")
1085DECLARE_TIMER(3107, "Currently not used.")
1086DECLARE_TIMER(3109, "Currently not used.")
1087DECLARE_TIMER(3111, "Currently not used.")
1088DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1089DECLARE_TIMER(3115, "Currently not used.")
1090DECLARE_TIMER(3117, "Currently not used.")
1091DECLARE_TIMER(3119, "Currently not used.")
1092DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001093
1094
Harald Welte5258fc42009-03-28 19:07:53 +00001095/* per-BTS configuration */
1096DEFUN(cfg_bts,
1097 cfg_bts_cmd,
1098 "bts BTS_NR",
1099 "Select a BTS to configure\n")
1100{
1101 int bts_nr = atoi(argv[0]);
1102 struct gsm_bts *bts;
1103
Harald Weltee441d9c2009-06-21 16:17:15 +02001104 if (bts_nr > gsmnet->num_bts) {
1105 vty_out(vty, "%% The next unused BTS number is %u%s",
1106 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001107 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001108 } else if (bts_nr == gsmnet->num_bts) {
1109 /* allocate a new one */
1110 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1111 HARDCODED_TSC, HARDCODED_BSIC);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001112 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02001113 bts = gsm_bts_num(gsmnet, bts_nr);
1114
Daniel Willmannf15c2762010-01-11 13:43:07 +01001115 if (!bts) {
1116 vty_out(vty, "%% Unable to allocate BTS %u%s",
1117 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee441d9c2009-06-21 16:17:15 +02001118 return CMD_WARNING;
Daniel Willmannf15c2762010-01-11 13:43:07 +01001119 }
Harald Welte5258fc42009-03-28 19:07:53 +00001120
1121 vty->index = bts;
1122 vty->node = BTS_NODE;
1123
1124 return CMD_SUCCESS;
1125}
1126
1127DEFUN(cfg_bts_type,
1128 cfg_bts_type_cmd,
1129 "type TYPE",
1130 "Set the BTS type\n")
1131{
1132 struct gsm_bts *bts = vty->index;
Harald Welte39315c42010-01-10 18:01:52 +01001133 int rc;
Harald Welte5258fc42009-03-28 19:07:53 +00001134
Harald Welte39315c42010-01-10 18:01:52 +01001135 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1136 if (rc < 0)
1137 return CMD_WARNING;
Harald Welte8175e952009-10-20 00:22:00 +02001138
Harald Welte5258fc42009-03-28 19:07:53 +00001139 return CMD_SUCCESS;
1140}
1141
Harald Weltefcd24452009-06-20 18:15:19 +02001142DEFUN(cfg_bts_band,
1143 cfg_bts_band_cmd,
1144 "band BAND",
1145 "Set the frequency band of this BTS\n")
1146{
1147 struct gsm_bts *bts = vty->index;
Harald Welte42581822009-08-08 16:12:58 +02001148 int band = gsm_band_parse(argv[0]);
Harald Weltefcd24452009-06-20 18:15:19 +02001149
1150 if (band < 0) {
1151 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1152 band, VTY_NEWLINE);
1153 return CMD_WARNING;
1154 }
1155
1156 bts->band = band;
1157
1158 return CMD_SUCCESS;
1159}
1160
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001161DEFUN(cfg_bts_ci,
1162 cfg_bts_ci_cmd,
1163 "cell_identity <0-65535>",
1164 "Set the Cell identity of this BTS\n")
1165{
1166 struct gsm_bts *bts = vty->index;
1167 int ci = atoi(argv[0]);
1168
1169 if (ci < 0 || ci > 0xffff) {
1170 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1171 ci, VTY_NEWLINE);
1172 return CMD_WARNING;
1173 }
1174 bts->cell_identity = ci;
1175
1176 return CMD_SUCCESS;
1177}
1178
Harald Welte5258fc42009-03-28 19:07:53 +00001179DEFUN(cfg_bts_lac,
1180 cfg_bts_lac_cmd,
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001181 "location_area_code <0-65535>",
Harald Welte5258fc42009-03-28 19:07:53 +00001182 "Set the Location Area Code (LAC) of this BTS\n")
1183{
1184 struct gsm_bts *bts = vty->index;
1185 int lac = atoi(argv[0]);
1186
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001187 if (lac < 0 || lac > 0xffff) {
1188 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte5258fc42009-03-28 19:07:53 +00001189 lac, VTY_NEWLINE);
1190 return CMD_WARNING;
1191 }
Holger Hans Peter Freythere48b9562009-10-01 04:07:15 +02001192
1193 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1194 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1195 lac, VTY_NEWLINE);
1196 return CMD_WARNING;
1197 }
1198
Harald Welte5258fc42009-03-28 19:07:53 +00001199 bts->location_area_code = lac;
1200
1201 return CMD_SUCCESS;
1202}
1203
Harald Weltea43f7892009-12-01 18:04:30 +05301204
Harald Welte5258fc42009-03-28 19:07:53 +00001205DEFUN(cfg_bts_tsc,
1206 cfg_bts_tsc_cmd,
1207 "training_sequence_code <0-255>",
1208 "Set the Training Sequence Code (TSC) of this BTS\n")
1209{
1210 struct gsm_bts *bts = vty->index;
1211 int tsc = atoi(argv[0]);
1212
1213 if (tsc < 0 || tsc > 0xff) {
1214 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1215 tsc, VTY_NEWLINE);
1216 return CMD_WARNING;
1217 }
1218 bts->tsc = tsc;
1219
1220 return CMD_SUCCESS;
1221}
1222
Harald Welte78f2f502009-05-23 16:56:52 +00001223DEFUN(cfg_bts_bsic,
1224 cfg_bts_bsic_cmd,
1225 "base_station_id_code <0-63>",
1226 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1227{
1228 struct gsm_bts *bts = vty->index;
1229 int bsic = atoi(argv[0]);
1230
1231 if (bsic < 0 || bsic > 0x3f) {
Harald Welte42581822009-08-08 16:12:58 +02001232 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte78f2f502009-05-23 16:56:52 +00001233 bsic, VTY_NEWLINE);
1234 return CMD_WARNING;
1235 }
1236 bts->bsic = bsic;
1237
1238 return CMD_SUCCESS;
1239}
1240
1241
Harald Welte4cc34222009-05-01 15:12:31 +00001242DEFUN(cfg_bts_unit_id,
1243 cfg_bts_unit_id_cmd,
Harald Welte07dc73d2009-08-07 13:27:09 +02001244 "ip.access unit_id <0-65534> <0-255>",
1245 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte4cc34222009-05-01 15:12:31 +00001246{
1247 struct gsm_bts *bts = vty->index;
1248 int site_id = atoi(argv[0]);
1249 int bts_id = atoi(argv[1]);
1250
Harald Welte07dc73d2009-08-07 13:27:09 +02001251 if (!is_ipaccess_bts(bts)) {
1252 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1253 return CMD_WARNING;
1254 }
1255
Harald Welte4cc34222009-05-01 15:12:31 +00001256 bts->ip_access.site_id = site_id;
1257 bts->ip_access.bts_id = bts_id;
1258
1259 return CMD_SUCCESS;
1260}
1261
Harald Welte8175e952009-10-20 00:22:00 +02001262DEFUN(cfg_bts_stream_id,
1263 cfg_bts_stream_id_cmd,
1264 "oml ip.access stream_id <0-255>",
1265 "Set the ip.access Stream ID of the OML link of this BTS\n")
1266{
1267 struct gsm_bts *bts = vty->index;
1268 int stream_id = atoi(argv[0]);
1269
1270 if (!is_ipaccess_bts(bts)) {
1271 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1272 return CMD_WARNING;
1273 }
1274
1275 bts->oml_tei = stream_id;
1276
1277 return CMD_SUCCESS;
1278}
1279
1280
Harald Welte42581822009-08-08 16:12:58 +02001281DEFUN(cfg_bts_oml_e1,
1282 cfg_bts_oml_e1_cmd,
1283 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
1284 "E1 interface to be used for OML\n")
1285{
1286 struct gsm_bts *bts = vty->index;
1287
1288 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1289
1290 return CMD_SUCCESS;
1291}
1292
1293
1294DEFUN(cfg_bts_oml_e1_tei,
1295 cfg_bts_oml_e1_tei_cmd,
1296 "oml e1 tei <0-63>",
1297 "Set the TEI to be used for OML")
1298{
1299 struct gsm_bts *bts = vty->index;
1300
1301 bts->oml_tei = atoi(argv[0]);
1302
1303 return CMD_SUCCESS;
1304}
1305
Harald Welte7a8fa412009-08-10 13:48:16 +02001306DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1307 "channel allocator (ascending|descending)",
1308 "Should the channel allocator allocate in reverse TRX order?")
1309{
1310 struct gsm_bts *bts = vty->index;
1311
1312 if (!strcmp(argv[0], "ascending"))
1313 bts->chan_alloc_reverse = 0;
1314 else
1315 bts->chan_alloc_reverse = 1;
1316
1317 return CMD_SUCCESS;
1318}
1319
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001320DEFUN(cfg_bts_rach_tx_integer,
1321 cfg_bts_rach_tx_integer_cmd,
1322 "rach tx integer <0-15>",
1323 "Set the raw tx integer value in RACH Control parameters IE")
1324{
1325 struct gsm_bts *bts = vty->index;
1326 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1327 return CMD_SUCCESS;
1328}
1329
1330DEFUN(cfg_bts_rach_max_trans,
1331 cfg_bts_rach_max_trans_cmd,
1332 "rach max transmission (1|2|4|7)",
1333 "Set the maximum number of RACH burst transmissions")
1334{
1335 struct gsm_bts *bts = vty->index;
1336 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1337 return CMD_SUCCESS;
1338}
1339
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001340DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1341 "cell barred (0|1)",
1342 "Should this cell be barred from access?")
1343{
1344 struct gsm_bts *bts = vty->index;
1345
Harald Welte71355012009-12-21 23:08:18 +01001346 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001347
1348 return CMD_SUCCESS;
1349}
1350
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001351DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1352 "ms max power <0-40>",
1353 "Maximum transmit power of the MS")
1354{
1355 struct gsm_bts *bts = vty->index;
1356
1357 bts->ms_max_power = atoi(argv[0]);
1358
1359 return CMD_SUCCESS;
1360}
1361
Harald Welte73225282009-12-12 18:17:25 +01001362DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1363 "cell reselection hysteresis <0-14>",
1364 "Cell Re-Selection Hysteresis in dB")
1365{
1366 struct gsm_bts *bts = vty->index;
1367
1368 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1369
1370 return CMD_SUCCESS;
1371}
1372
1373DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1374 "rxlev access min <0-63>",
1375 "Minimum RxLev needed for cell access (better than -110dBm)")
1376{
1377 struct gsm_bts *bts = vty->index;
1378
1379 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1380
1381 return CMD_SUCCESS;
1382}
1383
Harald Welte (local)efc92312009-08-14 23:09:25 +02001384DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1385 "periodic location update <0-1530>",
1386 "Periodic Location Updating Interval in Minutes")
1387{
1388 struct gsm_bts *bts = vty->index;
1389
Harald Weltea43f7892009-12-01 18:04:30 +05301390 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 10;
Harald Welte (local)efc92312009-08-14 23:09:25 +02001391
1392 return CMD_SUCCESS;
1393}
1394
Harald Welteaf387632010-03-14 23:30:30 +08001395DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welte57ba7e32010-04-18 14:00:26 +02001396 "gprs cell bvci <2-65535>",
Harald Welte97a282b2010-03-14 15:37:43 +08001397 "GPRS BSSGP VC Identifier")
1398{
1399 struct gsm_bts *bts = vty->index;
1400
Harald Welte4511d892010-04-18 15:51:20 +02001401 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001402 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1403 return CMD_WARNING;
1404 }
1405
Harald Welte97a282b2010-03-14 15:37:43 +08001406 bts->gprs.cell.bvci = atoi(argv[0]);
1407
1408 return CMD_SUCCESS;
1409}
1410
Harald Weltea5731cf2010-03-22 11:48:36 +08001411DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
1412 "gprs nsei <0-65535>",
1413 "GPRS NS Entity Identifier")
1414{
1415 struct gsm_bts *bts = vty->index;
1416
Harald Welte4511d892010-04-18 15:51:20 +02001417 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltea5731cf2010-03-22 11:48:36 +08001418 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1419 return CMD_WARNING;
1420 }
1421
1422 bts->gprs.nse.nsei = atoi(argv[0]);
1423
1424 return CMD_SUCCESS;
1425}
1426
1427
Harald Welte97a282b2010-03-14 15:37:43 +08001428DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
1429 "gprs nsvc <0-1> nsvci <0-65535>",
1430 "GPRS NS VC Identifier")
1431{
1432 struct gsm_bts *bts = vty->index;
1433 int idx = atoi(argv[0]);
1434
Harald Welte4511d892010-04-18 15:51:20 +02001435 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001436 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1437 return CMD_WARNING;
1438 }
1439
Harald Welte97a282b2010-03-14 15:37:43 +08001440 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
1441
1442 return CMD_SUCCESS;
1443}
1444
Harald Welteaf387632010-03-14 23:30:30 +08001445DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
1446 "gprs nsvc <0-1> local udp port <0-65535>",
1447 "GPRS NS Local UDP Port")
1448{
1449 struct gsm_bts *bts = vty->index;
1450 int idx = atoi(argv[0]);
1451
Harald Welte4511d892010-04-18 15:51:20 +02001452 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001453 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1454 return CMD_WARNING;
1455 }
1456
Harald Welteaf387632010-03-14 23:30:30 +08001457 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
1458
1459 return CMD_SUCCESS;
1460}
1461
1462DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
1463 "gprs nsvc <0-1> remote udp port <0-65535>",
1464 "GPRS NS Remote UDP Port")
1465{
1466 struct gsm_bts *bts = vty->index;
1467 int idx = atoi(argv[0]);
1468
Harald Welte4511d892010-04-18 15:51:20 +02001469 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001470 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1471 return CMD_WARNING;
1472 }
1473
Harald Welteaf387632010-03-14 23:30:30 +08001474 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
1475
1476 return CMD_SUCCESS;
1477}
1478
1479DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
1480 "gprs nsvc <0-1> remote ip A.B.C.D",
1481 "GPRS NS Remote IP Address")
1482{
1483 struct gsm_bts *bts = vty->index;
1484 int idx = atoi(argv[0]);
1485 struct in_addr ia;
1486
Harald Welte4511d892010-04-18 15:51:20 +02001487 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001488 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1489 return CMD_WARNING;
1490 }
1491
Harald Welteaf387632010-03-14 23:30:30 +08001492 inet_aton(argv[1], &ia);
1493 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
1494
1495 return CMD_SUCCESS;
1496}
1497
Harald Welte97a282b2010-03-14 15:37:43 +08001498DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
1499 "gprs routing area <0-255>",
1500 "GPRS Routing Area Code")
1501{
1502 struct gsm_bts *bts = vty->index;
1503
Harald Welte4511d892010-04-18 15:51:20 +02001504 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001505 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1506 return CMD_WARNING;
1507 }
1508
Harald Welte97a282b2010-03-14 15:37:43 +08001509 bts->gprs.rac = atoi(argv[0]);
1510
1511 return CMD_SUCCESS;
1512}
1513
Harald Welte4511d892010-04-18 15:51:20 +02001514DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
1515 "gprs mode (none|gprs|egprs)",
1516 "GPRS Mode for this BTS")
Harald Welteaf387632010-03-14 23:30:30 +08001517{
1518 struct gsm_bts *bts = vty->index;
1519
Harald Welte4511d892010-04-18 15:51:20 +02001520 bts->gprs.mode = bts_gprs_mode_parse(argv[0]);
Harald Welteaf387632010-03-14 23:30:30 +08001521
1522 return CMD_SUCCESS;
1523}
1524
Harald Welte7a8fa412009-08-10 13:48:16 +02001525
Harald Welte5258fc42009-03-28 19:07:53 +00001526/* per TRX configuration */
1527DEFUN(cfg_trx,
1528 cfg_trx_cmd,
1529 "trx TRX_NR",
1530 "Select a TRX to configure")
1531{
1532 int trx_nr = atoi(argv[0]);
1533 struct gsm_bts *bts = vty->index;
1534 struct gsm_bts_trx *trx;
1535
Harald Weltee441d9c2009-06-21 16:17:15 +02001536 if (trx_nr > bts->num_trx) {
1537 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
1538 bts->num_trx, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001539 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001540 } else if (trx_nr == bts->num_trx) {
1541 /* we need to allocate a new one */
1542 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001543 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02001544 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001545
Harald Weltee441d9c2009-06-21 16:17:15 +02001546 if (!trx)
1547 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +00001548
1549 vty->index = trx;
1550 vty->node = TRX_NODE;
1551
1552 return CMD_SUCCESS;
1553}
1554
1555DEFUN(cfg_trx_arfcn,
1556 cfg_trx_arfcn_cmd,
1557 "arfcn <1-1024>",
1558 "Set the ARFCN for this TRX\n")
1559{
1560 int arfcn = atoi(argv[0]);
1561 struct gsm_bts_trx *trx = vty->index;
1562
1563 /* FIXME: check if this ARFCN is supported by this TRX */
1564
1565 trx->arfcn = arfcn;
1566
1567 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
1568 /* FIXME: use OML layer to update the ARFCN */
1569 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
1570
1571 return CMD_SUCCESS;
1572}
1573
Harald Welte (local)7b37d972009-12-27 20:56:38 +01001574DEFUN(cfg_trx_nominal_power,
1575 cfg_trx_nominal_power_cmd,
1576 "nominal power <0-100>",
1577 "Nominal TRX RF Power in dB\n")
1578{
1579 struct gsm_bts_trx *trx = vty->index;
1580
1581 trx->nominal_power = atoi(argv[0]);
1582
1583 return CMD_SUCCESS;
1584}
1585
Harald Weltefcd24452009-06-20 18:15:19 +02001586DEFUN(cfg_trx_max_power_red,
1587 cfg_trx_max_power_red_cmd,
1588 "max_power_red <0-100>",
1589 "Reduction of maximum BS RF Power in dB\n")
1590{
1591 int maxpwr_r = atoi(argv[0]);
1592 struct gsm_bts_trx *trx = vty->index;
Harald Welte61a83b22009-11-18 09:20:22 +01001593 int upper_limit = 24; /* default 12.21 max power red. */
Harald Weltefcd24452009-06-20 18:15:19 +02001594
1595 /* FIXME: check if our BTS type supports more than 12 */
1596 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
1597 vty_out(vty, "%% Power %d dB is not in the valid range%s",
1598 maxpwr_r, VTY_NEWLINE);
1599 return CMD_WARNING;
1600 }
1601 if (maxpwr_r & 1) {
1602 vty_out(vty, "%% Power %d dB is not an even value%s",
1603 maxpwr_r, VTY_NEWLINE);
1604 return CMD_WARNING;
1605 }
1606
1607 trx->max_power_red = maxpwr_r;
1608
1609 /* FIXME: make sure we update this using OML */
1610
1611 return CMD_SUCCESS;
1612}
1613
Harald Welte42581822009-08-08 16:12:58 +02001614DEFUN(cfg_trx_rsl_e1,
1615 cfg_trx_rsl_e1_cmd,
1616 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
1617 "E1 interface to be used for RSL\n")
1618{
1619 struct gsm_bts_trx *trx = vty->index;
1620
1621 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
1622
1623 return CMD_SUCCESS;
1624}
1625
1626DEFUN(cfg_trx_rsl_e1_tei,
1627 cfg_trx_rsl_e1_tei_cmd,
1628 "rsl e1 tei <0-63>",
1629 "Set the TEI to be used for RSL")
1630{
1631 struct gsm_bts_trx *trx = vty->index;
1632
1633 trx->rsl_tei = atoi(argv[0]);
1634
1635 return CMD_SUCCESS;
1636}
1637
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01001638DEFUN(cfg_trx_rf_locked,
1639 cfg_trx_rf_locked_cmd,
1640 "rf_locked (0|1)",
1641 "Turn off RF of the TRX.\n")
1642{
1643 int locked = atoi(argv[0]);
1644 struct gsm_bts_trx *trx = vty->index;
1645
1646 gsm_trx_lock_rf(trx, locked);
1647 return CMD_SUCCESS;
1648}
Harald Welte42581822009-08-08 16:12:58 +02001649
Harald Welte5258fc42009-03-28 19:07:53 +00001650/* per TS configuration */
1651DEFUN(cfg_ts,
1652 cfg_ts_cmd,
Harald Welte42581822009-08-08 16:12:58 +02001653 "timeslot <0-7>",
Harald Welte5258fc42009-03-28 19:07:53 +00001654 "Select a Timeslot to configure")
1655{
1656 int ts_nr = atoi(argv[0]);
1657 struct gsm_bts_trx *trx = vty->index;
1658 struct gsm_bts_trx_ts *ts;
1659
1660 if (ts_nr >= TRX_NR_TS) {
1661 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
1662 TRX_NR_TS, VTY_NEWLINE);
1663 return CMD_WARNING;
1664 }
1665
1666 ts = &trx->ts[ts_nr];
1667
1668 vty->index = ts;
1669 vty->node = TS_NODE;
1670
1671 return CMD_SUCCESS;
1672}
1673
Harald Weltea6fd58e2009-08-07 00:25:23 +02001674DEFUN(cfg_ts_pchan,
1675 cfg_ts_pchan_cmd,
1676 "phys_chan_config PCHAN",
1677 "Physical Channel configuration (TCH/SDCCH/...)")
1678{
1679 struct gsm_bts_trx_ts *ts = vty->index;
1680 int pchanc;
1681
1682 pchanc = gsm_pchan_parse(argv[0]);
1683 if (pchanc < 0)
1684 return CMD_WARNING;
1685
1686 ts->pchan = pchanc;
1687
1688 return CMD_SUCCESS;
1689}
1690
1691DEFUN(cfg_ts_e1_subslot,
1692 cfg_ts_e1_subslot_cmd,
Harald Welte42581822009-08-08 16:12:58 +02001693 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltea6fd58e2009-08-07 00:25:23 +02001694 "E1 sub-slot connected to this on-air timeslot")
1695{
1696 struct gsm_bts_trx_ts *ts = vty->index;
1697
Harald Welte42581822009-08-08 16:12:58 +02001698 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Weltea6fd58e2009-08-07 00:25:23 +02001699
1700 return CMD_SUCCESS;
1701}
Harald Welte5258fc42009-03-28 19:07:53 +00001702
Holger Hans Peter Freythere1ffc082010-04-10 00:08:28 +02001703extern int bsc_vty_init_extra(struct gsm_network *net);
1704
Harald Welte68628e82009-03-10 12:17:57 +00001705int bsc_vty_init(struct gsm_network *net)
1706{
1707 gsmnet = net;
1708
1709 cmd_init(1);
1710 vty_init();
1711
1712 install_element(VIEW_NODE, &show_net_cmd);
1713 install_element(VIEW_NODE, &show_bts_cmd);
1714 install_element(VIEW_NODE, &show_trx_cmd);
1715 install_element(VIEW_NODE, &show_ts_cmd);
1716 install_element(VIEW_NODE, &show_lchan_cmd);
Harald Welte1bc77352009-03-10 19:47:51 +00001717
1718 install_element(VIEW_NODE, &show_e1drv_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001719 install_element(VIEW_NODE, &show_e1line_cmd);
1720 install_element(VIEW_NODE, &show_e1ts_cmd);
1721
Harald Weltef5025b62009-03-28 16:55:11 +00001722 install_element(VIEW_NODE, &show_paging_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00001723
Holger Hans Peter Freyther3c712322010-04-06 11:55:37 +02001724 openbsc_vty_add_cmds();
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +01001725
Harald Welte5013b2a2009-08-07 13:29:14 +02001726 install_element(CONFIG_NODE, &cfg_net_cmd);
1727 install_node(&net_node, config_write_net);
1728 install_default(GSMNET_NODE);
Harald Welte42581822009-08-08 16:12:58 +02001729 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02001730 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
1731 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
1732 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)69de3972009-08-12 14:42:23 +02001733 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte1085c092009-11-18 20:33:19 +01001734 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Welte4381cfe2009-08-30 15:47:06 +09001735 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001736 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welteeab84a12009-12-13 10:53:12 +01001737 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte3d23db42009-12-14 17:49:15 +01001738 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Weltebc814502009-12-19 21:41:52 +01001739 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Welteb720bd32009-12-21 16:51:50 +01001740 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
1741 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
1742 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
1743 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
1744 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
1745 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001746 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01001747 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
1748 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
1749 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
1750 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
1751 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
1752 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
1753 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
1754 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
1755 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
1756 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02001757
1758 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte67ce0732009-08-06 19:06:46 +02001759 install_node(&bts_node, config_write_bts);
Harald Welte68628e82009-03-10 12:17:57 +00001760 install_default(BTS_NODE);
Harald Welte5258fc42009-03-28 19:07:53 +00001761 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Weltefcd24452009-06-20 18:15:19 +02001762 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001763 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00001764 install_element(BTS_NODE, &cfg_bts_lac_cmd);
1765 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte42581822009-08-08 16:12:58 +02001766 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte4cc34222009-05-01 15:12:31 +00001767 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte8175e952009-10-20 00:22:00 +02001768 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte42581822009-08-08 16:12:58 +02001769 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
1770 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02001771 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001772 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
1773 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001774 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001775 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)efc92312009-08-14 23:09:25 +02001776 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welte73225282009-12-12 18:17:25 +01001777 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
1778 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Harald Welte4511d892010-04-18 15:51:20 +02001779 install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08001780 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
1781 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Weltea5731cf2010-03-22 11:48:36 +08001782 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08001783 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welteaf387632010-03-14 23:30:30 +08001784 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
1785 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
1786 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001787
Harald Welte5258fc42009-03-28 19:07:53 +00001788 install_element(BTS_NODE, &cfg_trx_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001789 install_node(&trx_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00001790 install_default(TRX_NODE);
Harald Welte5258fc42009-03-28 19:07:53 +00001791 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte (local)7b37d972009-12-27 20:56:38 +01001792 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte879dc972009-06-20 22:36:12 +02001793 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte42581822009-08-08 16:12:58 +02001794 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
1795 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01001796 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001797
Harald Welte5258fc42009-03-28 19:07:53 +00001798 install_element(TRX_NODE, &cfg_ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001799 install_node(&ts_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00001800 install_default(TS_NODE);
Harald Weltea6fd58e2009-08-07 00:25:23 +02001801 install_element(TS_NODE, &cfg_ts_pchan_cmd);
1802 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001803
Holger Hans Peter Freythercfa90d42009-08-10 10:17:50 +02001804 bsc_vty_init_extra(net);
Harald Welte40f82892009-05-23 17:31:39 +00001805
Harald Welte68628e82009-03-10 12:17:57 +00001806 return 0;
1807}