blob: adef1480a6e91ff81d6fa124df9266a84967dfa2 [file] [log] [blame]
Harald Welte68628e82009-03-10 12:17:57 +00001/* OpenBSC interface to quagga VTY */
2/* (C) 2009 by Harald Welte <laforge@gnumonks.org>
3 * 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 Welte1bc77352009-03-10 19:47:51 +000031#include <openbsc/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 Weltef9daefd2009-08-09 15:13:54 +020035#include <openbsc/gsm_utils.h>
Harald Welte40f82892009-05-23 17:31:39 +000036#include <openbsc/db.h>
Harald Welte5013b2a2009-08-07 13:29:14 +020037#include <openbsc/talloc.h>
Harald Welte68628e82009-03-10 12:17:57 +000038
39static struct gsm_network *gsmnet;
40
Harald Welte5013b2a2009-08-07 13:29:14 +020041struct cmd_node net_node = {
42 GSMNET_NODE,
43 "%s(network)#",
44 1,
45};
46
Harald Welte68628e82009-03-10 12:17:57 +000047struct cmd_node bts_node = {
48 BTS_NODE,
49 "%s(bts)#",
50 1,
51};
52
53struct cmd_node trx_node = {
54 TRX_NODE,
55 "%s(trx)#",
56 1,
57};
58
59struct cmd_node ts_node = {
60 TS_NODE,
61 "%s(ts)#",
62 1,
63};
64
65static int dummy_config_write(struct vty *v)
66{
67 return CMD_SUCCESS;
68}
69
70static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
71{
Harald Welte1bc77352009-03-10 19:47:51 +000072 vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s",
73 nm_opstate_name(nms->operational), nms->administrative,
74 nm_avail_name(nms->availability), VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +000075}
76
77static void net_dump_vty(struct vty *vty, struct gsm_network *net)
78{
Harald Welteef235b52009-03-10 12:34:02 +000079 vty_out(vty, "BSC is on Country Code %u, Network Code %u "
80 "and has %u BTS%s", net->country_code, net->network_code,
81 net->num_bts, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +000082 vty_out(vty, " Long network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +000083 net->name_long, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +000084 vty_out(vty, " Short network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +000085 net->name_short, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +020086 vty_out(vty, " Authentication policy: %s%s",
87 gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +010088 vty_out(vty, " Location updating reject cause: %u%s",
89 net->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +090090 vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption,
91 VTY_NEWLINE);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +010092 vty_out(vty, " NECI (TCH/H): %u%s", net->neci,
93 VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +010094 vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode),
95 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +000096}
97
98DEFUN(show_net, show_net_cmd, "show network",
99 SHOW_STR "Display information about a GSM NETWORK\n")
100{
101 struct gsm_network *net = gsmnet;
102 net_dump_vty(vty, net);
103
104 return CMD_SUCCESS;
105}
106
107static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l)
108{
Harald Welteedb37782009-05-01 14:59:07 +0000109 struct e1inp_line *line;
110
111 if (!e1l) {
112 vty_out(vty, " None%s", VTY_NEWLINE);
113 return;
114 }
115
116 line = e1l->ts->line;
117
118 vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s",
119 line->num, line->driver->name, e1l->ts->num,
Harald Welte1bc77352009-03-10 19:47:51 +0000120 e1inp_signtype_name(e1l->type), VTY_NEWLINE);
Harald Welteedb37782009-05-01 14:59:07 +0000121 vty_out(vty, " E1 TEI %u, SAPI %u%s",
Harald Welte68628e82009-03-10 12:17:57 +0000122 e1l->tei, e1l->sapi, VTY_NEWLINE);
123}
124
125static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
126{
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200127 vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
Harald Weltefcd24452009-06-20 18:15:19 +0200128 "BSIC %u, TSC %u and %u TRX%s",
129 bts->nr, btstype2str(bts->type), gsm_band_name(bts->band),
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200130 bts->cell_identity,
Harald Weltefcd24452009-06-20 18:15:19 +0200131 bts->location_area_code, bts->bsic, bts->tsc,
132 bts->num_trx, VTY_NEWLINE);
Harald Welte1d8dbc42009-12-12 15:38:16 +0100133 vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100134 vty_out(vty, "Minimum Rx Level for Access: %i dBm%s",
Harald Welte1d8dbc42009-12-12 15:38:16 +0100135 rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min),
136 VTY_NEWLINE);
137 vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s",
Harald Welte73225282009-12-12 18:17:25 +0100138 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200139 if (bts->cell_barred)
140 vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE);
Harald Welte4cc34222009-05-01 15:12:31 +0000141 if (is_ipaccess_bts(bts))
Harald Welte8175e952009-10-20 00:22:00 +0200142 vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
Harald Welte4cc34222009-05-01 15:12:31 +0000143 bts->ip_access.site_id, bts->ip_access.bts_id,
Harald Welte8175e952009-10-20 00:22:00 +0200144 bts->oml_tei, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000145 vty_out(vty, " NM State: ");
146 net_dump_nmstate(vty, &bts->nm_state);
147 vty_out(vty, " Site Mgr NM State: ");
148 net_dump_nmstate(vty, &bts->site_mgr.nm_state);
149 vty_out(vty, " Paging: FIXME pending requests, %u free slots%s",
150 bts->paging.available_slots, VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200151 if (!is_ipaccess_bts(bts)) {
152 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
153 e1isl_dump_vty(vty, bts->oml_link);
154 }
Harald Welte68628e82009-03-10 12:17:57 +0000155 /* FIXME: oml_link, chan_desc */
156}
157
158DEFUN(show_bts, show_bts_cmd, "show bts [number]",
159 SHOW_STR "Display information about a BTS\n"
160 "BTS number")
161{
162 struct gsm_network *net = gsmnet;
163 int bts_nr;
164
165 if (argc != 0) {
166 /* use the BTS number that the user has specified */
167 bts_nr = atoi(argv[0]);
168 if (bts_nr > net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000169 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000170 VTY_NEWLINE);
171 return CMD_WARNING;
172 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200173 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000174 return CMD_SUCCESS;
175 }
176 /* print all BTS's */
177 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee441d9c2009-06-21 16:17:15 +0200178 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000179
180 return CMD_SUCCESS;
181}
182
Harald Welte42581822009-08-08 16:12:58 +0200183/* utility functions */
184static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
185 const char *ts, const char *ss)
186{
187 e1_link->e1_nr = atoi(line);
188 e1_link->e1_ts = atoi(ts);
189 if (!strcmp(ss, "full"))
190 e1_link->e1_ts_ss = 255;
191 else
192 e1_link->e1_ts_ss = atoi(ss);
193}
194
195static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,
196 const char *prefix)
197{
198 if (!e1_link->e1_ts)
199 return;
200
201 if (e1_link->e1_ts_ss == 255)
202 vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s",
203 prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE);
204 else
205 vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s",
206 prefix, e1_link->e1_nr, e1_link->e1_ts,
207 e1_link->e1_ts_ss, VTY_NEWLINE);
208}
209
210
Harald Welte67ce0732009-08-06 19:06:46 +0200211static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
212{
Harald Welte42581822009-08-08 16:12:58 +0200213 vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
214 if (ts->pchan != GSM_PCHAN_NONE)
215 vty_out(vty, " phys_chan_config %s%s",
216 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
217 config_write_e1_link(vty, &ts->e1_link, " ");
Harald Welte67ce0732009-08-06 19:06:46 +0200218}
219
220static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
221{
222 int i;
223
Harald Welte5013b2a2009-08-07 13:29:14 +0200224 vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE);
225 vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
226 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200227 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
228 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte67ce0732009-08-06 19:06:46 +0200229
230 for (i = 0; i < TRX_NR_TS; i++)
231 config_write_ts_single(vty, &trx->ts[i]);
232}
233
234static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
235{
236 struct gsm_bts_trx *trx;
237
Harald Welte5013b2a2009-08-07 13:29:14 +0200238 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
239 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
240 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freytherf926ed62009-11-19 16:38:49 +0100241 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200242 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte67ce0732009-08-06 19:06:46 +0200243 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200244 vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE);
245 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)0e451d02009-08-13 10:14:26 +0200246 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100247 vty_out(vty, " cell reselection hysteresis %u%s",
248 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
249 vty_out(vty, " rxlev access min %u%s",
250 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Harald Weltea43f7892009-12-01 18:04:30 +0530251 if (bts->si_common.chan_desc.t3212)
Harald Welte (local)efc92312009-08-14 23:09:25 +0200252 vty_out(vty, " periodic location update %u%s",
Harald Weltea43f7892009-12-01 18:04:30 +0530253 bts->si_common.chan_desc.t3212 * 10, VTY_NEWLINE);
Harald Welte7a8fa412009-08-10 13:48:16 +0200254 vty_out(vty, " channel allocator %s%s",
255 bts->chan_alloc_reverse ? "descending" : "ascending",
256 VTY_NEWLINE);
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200257 if (bts->cell_barred)
258 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200259 if (is_ipaccess_bts(bts)) {
Harald Welte5013b2a2009-08-07 13:29:14 +0200260 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Weltea6fd58e2009-08-07 00:25:23 +0200261 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200262 vty_out(vty, " oml ip.access stream_id %u%s", bts->oml_tei, VTY_NEWLINE);
263 } else {
Harald Welte42581822009-08-08 16:12:58 +0200264 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
265 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
266 }
Harald Welte67ce0732009-08-06 19:06:46 +0200267
268 llist_for_each_entry(trx, &bts->trx_list, list)
269 config_write_trx_single(vty, trx);
270}
271
272static int config_write_bts(struct vty *v)
273{
274 struct gsm_bts *bts;
275
276 llist_for_each_entry(bts, &gsmnet->bts_list, list)
277 config_write_bts_single(v, bts);
278
279 return CMD_SUCCESS;
280}
281
Harald Welte5013b2a2009-08-07 13:29:14 +0200282static int config_write_net(struct vty *vty)
283{
284 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200285 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200286 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200287 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
288 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200289 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100290 vty_out(vty, " location updating reject cause %u%s",
291 gsmnet->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900292 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freytherd54c3372009-11-19 16:37:48 +0100293 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100294 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
295 VTY_NEWLINE);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +0100296 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100297 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
298 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
299 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
300 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
301 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
302 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
303 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
304 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
305 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
306 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200307
308 return CMD_SUCCESS;
309}
Harald Welte67ce0732009-08-06 19:06:46 +0200310
Harald Welte68628e82009-03-10 12:17:57 +0000311static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
312{
313 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
314 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Weltefcd24452009-06-20 18:15:19 +0200315 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte42581822009-08-08 16:12:58 +0200316 "resulting BS power: %d dBm%s",
Harald Weltefcd24452009-06-20 18:15:19 +0200317 trx->nominal_power, trx->max_power_red,
Harald Welte42581822009-08-08 16:12:58 +0200318 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000319 vty_out(vty, " NM State: ");
320 net_dump_nmstate(vty, &trx->nm_state);
321 vty_out(vty, " Baseband Transceiver NM State: ");
322 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte8175e952009-10-20 00:22:00 +0200323 if (is_ipaccess_bts(trx->bts)) {
324 vty_out(vty, " ip.access stream ID: 0x%02x%s",
325 trx->rsl_tei, VTY_NEWLINE);
326 } else {
327 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
328 e1isl_dump_vty(vty, trx->rsl_link);
329 }
Harald Welte68628e82009-03-10 12:17:57 +0000330}
331
332DEFUN(show_trx,
333 show_trx_cmd,
334 "show trx [bts_nr] [trx_nr]",
335 SHOW_STR "Display information about a TRX\n")
336{
337 struct gsm_network *net = gsmnet;
338 struct gsm_bts *bts = NULL;
339 struct gsm_bts_trx *trx;
340 int bts_nr, trx_nr;
341
342 if (argc >= 1) {
343 /* use the BTS number that the user has specified */
344 bts_nr = atoi(argv[0]);
345 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000346 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000347 VTY_NEWLINE);
348 return CMD_WARNING;
349 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200350 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000351 }
352 if (argc >= 2) {
353 trx_nr = atoi(argv[1]);
354 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000355 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000356 VTY_NEWLINE);
357 return CMD_WARNING;
358 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200359 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000360 trx_dump_vty(vty, trx);
361 return CMD_SUCCESS;
362 }
363 if (bts) {
364 /* print all TRX in this BTS */
365 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200366 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000367 trx_dump_vty(vty, trx);
368 }
369 return CMD_SUCCESS;
370 }
371
372 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200373 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000374 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200375 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000376 trx_dump_vty(vty, trx);
377 }
378 }
379
380 return CMD_SUCCESS;
381}
382
Harald Welte67ce0732009-08-06 19:06:46 +0200383
Harald Welte68628e82009-03-10 12:17:57 +0000384static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
385{
Harald Welte68628e82009-03-10 12:17:57 +0000386 vty_out(vty, "Timeslot %u of TRX %u in BTS %u, phys cfg %s%s",
387 ts->nr, ts->trx->nr, ts->trx->bts->nr,
388 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
389 vty_out(vty, " NM State: ");
390 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte2c828992009-12-02 01:56:49 +0530391 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welteef235b52009-03-10 12:34:02 +0000392 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
393 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
394 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000395}
396
397DEFUN(show_ts,
398 show_ts_cmd,
Harald Welte1bc77352009-03-10 19:47:51 +0000399 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
Harald Welte68628e82009-03-10 12:17:57 +0000400 SHOW_STR "Display information about a TS\n")
401{
402 struct gsm_network *net = gsmnet;
403 struct gsm_bts *bts;
404 struct gsm_bts_trx *trx;
405 struct gsm_bts_trx_ts *ts;
406 int bts_nr, trx_nr, ts_nr;
407
408 if (argc >= 1) {
409 /* use the BTS number that the user has specified */
410 bts_nr = atoi(argv[0]);
411 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000412 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000413 VTY_NEWLINE);
414 return CMD_WARNING;
415 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200416 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000417 }
418 if (argc >= 2) {
419 trx_nr = atoi(argv[1]);
420 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000421 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000422 VTY_NEWLINE);
423 return CMD_WARNING;
424 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200425 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000426 }
427 if (argc >= 3) {
428 ts_nr = atoi(argv[2]);
429 if (ts_nr >= TRX_NR_TS) {
Harald Welte1bc77352009-03-10 19:47:51 +0000430 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
Harald Welte68628e82009-03-10 12:17:57 +0000431 VTY_NEWLINE);
432 return CMD_WARNING;
433 }
434 ts = &trx->ts[ts_nr];
435 ts_dump_vty(vty, ts);
436 return CMD_SUCCESS;
437 }
438 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200439 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000440 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200441 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000442 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
443 ts = &trx->ts[ts_nr];
444 ts_dump_vty(vty, ts);
445 }
446 }
447 }
448
449 return CMD_SUCCESS;
450}
451
Holger Hans Peter Freythercfa90d42009-08-10 10:17:50 +0200452void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte68628e82009-03-10 12:17:57 +0000453{
Harald Weltefcd24452009-06-20 18:15:19 +0200454 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte40f82892009-05-23 17:31:39 +0000455 subscr->authorized, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000456 if (subscr->name)
Harald Welte1bc77352009-03-10 19:47:51 +0000457 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000458 if (subscr->extension)
459 vty_out(vty, " Extension: %s%s", subscr->extension,
460 VTY_NEWLINE);
461 if (subscr->imsi)
462 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freyther22230252009-08-19 12:53:57 +0200463 if (subscr->tmsi != GSM_RESERVED_TMSI)
464 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte731fd912009-08-15 03:24:51 +0200465 VTY_NEWLINE);
Harald Welte (local)15920de2009-08-14 20:27:16 +0200466 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000467}
468
469static void lchan_dump_vty(struct vty *vty, struct gsm_lchan *lchan)
470{
471 vty_out(vty, "Lchan %u in Timeslot %u of TRX %u in BTS %u, Type %s%s",
472 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
473 lchan->ts->trx->bts->nr, gsm_lchan_name(lchan->type),
474 VTY_NEWLINE);
475 vty_out(vty, " Use Count: %u%s", lchan->use_count, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100476 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
477 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
478 - lchan->bs_power*2,
479 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
480 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000481 if (lchan->subscr) {
482 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
483 subscr_dump_vty(vty, lchan->subscr);
484 } else
485 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte2c828992009-12-02 01:56:49 +0530486 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
487 struct in_addr ia;
488 ia.s_addr = lchan->abis_ip.bound_ip;
489 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
490 inet_ntoa(ia), lchan->abis_ip.bound_port,
491 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
492 VTY_NEWLINE);
493 }
Harald Welte68628e82009-03-10 12:17:57 +0000494}
495
Harald Welte4bfdfe72009-06-10 23:11:52 +0800496#if 0
497TODO: callref and remote callref of call must be resolved to get gsm_trans object
Harald Welte68628e82009-03-10 12:17:57 +0000498static void call_dump_vty(struct vty *vty, struct gsm_call *call)
499{
500 vty_out(vty, "Call Type %u, State %u, Transaction ID %u%s",
501 call->type, call->state, call->transaction_id, VTY_NEWLINE);
502
503 if (call->local_lchan) {
504 vty_out(vty, "Call Local Channel:%s", VTY_NEWLINE);
505 lchan_dump_vty(vty, call->local_lchan);
506 } else
507 vty_out(vty, "Call has no Local Channel%s", VTY_NEWLINE);
508
509 if (call->remote_lchan) {
510 vty_out(vty, "Call Remote Channel:%s", VTY_NEWLINE);
511 lchan_dump_vty(vty, call->remote_lchan);
512 } else
513 vty_out(vty, "Call has no Remote Channel%s", VTY_NEWLINE);
514
515 if (call->called_subscr) {
516 vty_out(vty, "Called Subscriber:%s", VTY_NEWLINE);
517 subscr_dump_vty(vty, call->called_subscr);
518 } else
519 vty_out(vty, "Call has no Called Subscriber%s", VTY_NEWLINE);
520}
Harald Welte4bfdfe72009-06-10 23:11:52 +0800521#endif
Harald Welte68628e82009-03-10 12:17:57 +0000522
523DEFUN(show_lchan,
524 show_lchan_cmd,
525 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
526 SHOW_STR "Display information about a logical channel\n")
527{
528 struct gsm_network *net = gsmnet;
529 struct gsm_bts *bts;
530 struct gsm_bts_trx *trx;
531 struct gsm_bts_trx_ts *ts;
532 struct gsm_lchan *lchan;
533 int bts_nr, trx_nr, ts_nr, lchan_nr;
534
535 if (argc >= 1) {
536 /* use the BTS number that the user has specified */
537 bts_nr = atoi(argv[0]);
538 if (bts_nr >= net->num_bts) {
539 vty_out(vty, "%% can't find BTS %s%s", argv[0],
540 VTY_NEWLINE);
541 return CMD_WARNING;
542 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200543 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000544 }
545 if (argc >= 2) {
546 trx_nr = atoi(argv[1]);
547 if (trx_nr >= bts->num_trx) {
548 vty_out(vty, "%% can't find TRX %s%s", argv[1],
549 VTY_NEWLINE);
550 return CMD_WARNING;
551 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200552 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000553 }
554 if (argc >= 3) {
555 ts_nr = atoi(argv[2]);
556 if (ts_nr >= TRX_NR_TS) {
557 vty_out(vty, "%% can't find TS %s%s", argv[2],
558 VTY_NEWLINE);
559 return CMD_WARNING;
560 }
561 ts = &trx->ts[ts_nr];
562 }
563 if (argc >= 4) {
564 lchan_nr = atoi(argv[3]);
565 if (lchan_nr >= TS_MAX_LCHAN) {
566 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
567 VTY_NEWLINE);
568 return CMD_WARNING;
569 }
570 lchan = &ts->lchan[lchan_nr];
571 lchan_dump_vty(vty, lchan);
572 return CMD_SUCCESS;
573 }
574 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200575 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000576 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200577 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000578 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
579 ts = &trx->ts[ts_nr];
580 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
581 lchan_nr++) {
582 lchan = &ts->lchan[lchan_nr];
Harald Welteef235b52009-03-10 12:34:02 +0000583 if (lchan->type == GSM_LCHAN_NONE)
584 continue;
Harald Welte68628e82009-03-10 12:17:57 +0000585 lchan_dump_vty(vty, lchan);
586 }
587 }
588 }
589 }
590
591 return CMD_SUCCESS;
592}
593
Harald Welte1bc77352009-03-10 19:47:51 +0000594static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
595{
596 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
597}
598
599DEFUN(show_e1drv,
600 show_e1drv_cmd,
601 "show e1_driver",
602 SHOW_STR "Display information about available E1 drivers\n")
603{
604 struct e1inp_driver *drv;
605
606 llist_for_each_entry(drv, &e1inp_driver_list, list)
607 e1drv_dump_vty(vty, drv);
608
609 return CMD_SUCCESS;
610}
611
Harald Welte68628e82009-03-10 12:17:57 +0000612static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
613{
614 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
615 line->num, line->name ? line->name : "",
616 line->driver->name, VTY_NEWLINE);
617}
618
619DEFUN(show_e1line,
620 show_e1line_cmd,
621 "show e1_line [line_nr]",
622 SHOW_STR "Display information about a E1 line\n")
623{
Harald Welte1bc77352009-03-10 19:47:51 +0000624 struct e1inp_line *line;
625
626 if (argc >= 1) {
627 int num = atoi(argv[0]);
628 llist_for_each_entry(line, &e1inp_line_list, list) {
629 if (line->num == num) {
630 e1line_dump_vty(vty, line);
631 return CMD_SUCCESS;
632 }
633 }
634 return CMD_WARNING;
635 }
636
637 llist_for_each_entry(line, &e1inp_line_list, list)
638 e1line_dump_vty(vty, line);
639
640 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000641}
642
643static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
644{
Harald Welte42581822009-08-08 16:12:58 +0200645 if (ts->type == E1INP_TS_TYPE_NONE)
646 return;
Harald Welte1bc77352009-03-10 19:47:51 +0000647 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
648 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
649 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000650}
651
652DEFUN(show_e1ts,
653 show_e1ts_cmd,
654 "show e1_timeslot [line_nr] [ts_nr]",
655 SHOW_STR "Display information about a E1 timeslot\n")
656{
Harald Welte986c3d72009-11-17 06:12:16 +0100657 struct e1inp_line *line = NULL;
Harald Welte1bc77352009-03-10 19:47:51 +0000658 struct e1inp_ts *ts;
659 int ts_nr;
Harald Welte68628e82009-03-10 12:17:57 +0000660
Harald Welte1bc77352009-03-10 19:47:51 +0000661 if (argc == 0) {
662 llist_for_each_entry(line, &e1inp_line_list, list) {
663 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
664 ts = &line->ts[ts_nr];
665 e1ts_dump_vty(vty, ts);
666 }
667 }
668 return CMD_SUCCESS;
669 }
670 if (argc >= 1) {
671 int num = atoi(argv[0]);
672 llist_for_each_entry(line, &e1inp_line_list, list) {
673 if (line->num == num)
674 break;
675 }
676 if (!line || line->num != num) {
677 vty_out(vty, "E1 line %s is invalid%s",
678 argv[0], VTY_NEWLINE);
679 return CMD_WARNING;
680 }
681 }
682 if (argc >= 2) {
683 ts_nr = atoi(argv[1]);
684 if (ts_nr > NUM_E1_TS) {
685 vty_out(vty, "E1 timeslot %s is invalid%s",
686 argv[1], VTY_NEWLINE);
687 return CMD_WARNING;
688 }
689 ts = &line->ts[ts_nr];
690 e1ts_dump_vty(vty, ts);
691 return CMD_SUCCESS;
692 } else {
693 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
694 ts = &line->ts[ts_nr];
695 e1ts_dump_vty(vty, ts);
696 }
697 return CMD_SUCCESS;
698 }
699 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000700}
701
Harald Weltebe4b7302009-05-23 16:59:33 +0000702static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
Harald Weltef5025b62009-03-28 16:55:11 +0000703{
704 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
705 subscr_dump_vty(vty, pag->subscr);
706}
707
Harald Weltebe4b7302009-05-23 16:59:33 +0000708static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
Harald Weltef5025b62009-03-28 16:55:11 +0000709{
710 struct gsm_paging_request *pag;
711
712 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
713 paging_dump_vty(vty, pag);
714}
715
716DEFUN(show_paging,
717 show_paging_cmd,
718 "show paging [bts_nr]",
Harald Weltebe4b7302009-05-23 16:59:33 +0000719 SHOW_STR "Display information about paging reuqests of a BTS\n")
Harald Weltef5025b62009-03-28 16:55:11 +0000720{
721 struct gsm_network *net = gsmnet;
722 struct gsm_bts *bts;
723 int bts_nr;
724
725 if (argc >= 1) {
726 /* use the BTS number that the user has specified */
727 bts_nr = atoi(argv[0]);
728 if (bts_nr >= net->num_bts) {
729 vty_out(vty, "%% can't find BTS %s%s", argv[0],
730 VTY_NEWLINE);
731 return CMD_WARNING;
732 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200733 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +0000734 bts_paging_dump_vty(vty, bts);
735
736 return CMD_SUCCESS;
737 }
738 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200739 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +0000740 bts_paging_dump_vty(vty, bts);
741 }
742
743 return CMD_SUCCESS;
744}
745
Harald Welte5013b2a2009-08-07 13:29:14 +0200746DEFUN(cfg_net,
747 cfg_net_cmd,
748 "network",
749 "Configure the GSM network")
750{
751 vty->index = gsmnet;
752 vty->node = GSMNET_NODE;
753
754 return CMD_SUCCESS;
755}
756
757
758DEFUN(cfg_net_ncc,
759 cfg_net_ncc_cmd,
760 "network country code <1-999>",
761 "Set the GSM network country code")
762{
763 gsmnet->country_code = atoi(argv[0]);
764
765 return CMD_SUCCESS;
766}
767
768DEFUN(cfg_net_mnc,
769 cfg_net_mnc_cmd,
770 "mobile network code <1-999>",
771 "Set the GSM mobile network code")
772{
773 gsmnet->network_code = atoi(argv[0]);
774
775 return CMD_SUCCESS;
776}
777
778DEFUN(cfg_net_name_short,
779 cfg_net_name_short_cmd,
780 "short name NAME",
781 "Set the short GSM network name")
782{
783 if (gsmnet->name_short)
784 talloc_free(gsmnet->name_short);
785
786 gsmnet->name_short = talloc_strdup(gsmnet, argv[0]);
787
788 return CMD_SUCCESS;
789}
790
791DEFUN(cfg_net_name_long,
792 cfg_net_name_long_cmd,
793 "long name NAME",
794 "Set the long GSM network name")
795{
796 if (gsmnet->name_long)
797 talloc_free(gsmnet->name_long);
798
799 gsmnet->name_long = talloc_strdup(gsmnet, argv[0]);
800
801 return CMD_SUCCESS;
802}
Harald Welte40f82892009-05-23 17:31:39 +0000803
Harald Welte (local)69de3972009-08-12 14:42:23 +0200804DEFUN(cfg_net_auth_policy,
805 cfg_net_auth_policy_cmd,
806 "auth policy (closed|accept-all|token)",
807 "Set the GSM network authentication policy\n")
808{
809 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
810
811 gsmnet->auth_policy = policy;
812
813 return CMD_SUCCESS;
814}
815
Harald Welte1085c092009-11-18 20:33:19 +0100816DEFUN(cfg_net_reject_cause,
817 cfg_net_reject_cause_cmd,
818 "location updating reject cause <2-111>",
819 "Set the reject cause of location updating reject\n")
820{
821 gsmnet->reject_cause = atoi(argv[0]);
822
823 return CMD_SUCCESS;
824}
825
Harald Welte4381cfe2009-08-30 15:47:06 +0900826DEFUN(cfg_net_encryption,
827 cfg_net_encryption_cmd,
828 "encryption a5 (0|1|2)",
829 "Enable or disable encryption (A5) for this network\n")
830{
Andreas.Eversberg1059deb2009-11-17 09:55:26 +0100831 gsmnet->a5_encryption= atoi(argv[0]);
Harald Welte4381cfe2009-08-30 15:47:06 +0900832
833 return CMD_SUCCESS;
834}
835
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +0100836DEFUN(cfg_net_neci,
837 cfg_net_neci_cmd,
838 "neci (0|1)",
839 "Set if NECI of cell selection is to be set")
840{
841 gsmnet->neci = atoi(argv[0]);
842 return CMD_SUCCESS;
843}
844
Harald Welteeab84a12009-12-13 10:53:12 +0100845DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
846 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
847 "Set the Radio Resource Location Protocol Mode")
848{
849 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
850
851 return CMD_SUCCESS;
852}
853
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +0100854#define DECLARE_TIMER(number) \
855 DEFUN(cfg_net_T##number, \
856 cfg_net_T##number##_cmd, \
857 "timer t" #number " <0-65535>", \
858 "Set the T" #number " value.") \
859{ \
860 int value = atoi(argv[0]); \
861 \
862 if (value < 0 || value > 65535) { \
863 vty_out(vty, "Timer value %s out of range.%s", \
864 argv[0], VTY_NEWLINE); \
865 return CMD_WARNING; \
866 } \
867 \
868 gsmnet->T##number = value; \
869 return CMD_SUCCESS; \
870}
871
872DECLARE_TIMER(3101)
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100873DECLARE_TIMER(3103)
874DECLARE_TIMER(3105)
875DECLARE_TIMER(3107)
876DECLARE_TIMER(3109)
877DECLARE_TIMER(3111)
878DECLARE_TIMER(3113)
879DECLARE_TIMER(3115)
880DECLARE_TIMER(3117)
881DECLARE_TIMER(3119)
882DECLARE_TIMER(3141)
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +0100883
884
Harald Welte5258fc42009-03-28 19:07:53 +0000885/* per-BTS configuration */
886DEFUN(cfg_bts,
887 cfg_bts_cmd,
888 "bts BTS_NR",
889 "Select a BTS to configure\n")
890{
891 int bts_nr = atoi(argv[0]);
892 struct gsm_bts *bts;
893
Harald Weltee441d9c2009-06-21 16:17:15 +0200894 if (bts_nr > gsmnet->num_bts) {
895 vty_out(vty, "%% The next unused BTS number is %u%s",
896 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +0000897 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +0200898 } else if (bts_nr == gsmnet->num_bts) {
899 /* allocate a new one */
900 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
901 HARDCODED_TSC, HARDCODED_BSIC);
902 } else
903 bts = gsm_bts_num(gsmnet, bts_nr);
904
905 if (!bts)
906 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +0000907
908 vty->index = bts;
909 vty->node = BTS_NODE;
910
911 return CMD_SUCCESS;
912}
913
914DEFUN(cfg_bts_type,
915 cfg_bts_type_cmd,
916 "type TYPE",
917 "Set the BTS type\n")
918{
919 struct gsm_bts *bts = vty->index;
920
Harald Weltea6fd58e2009-08-07 00:25:23 +0200921 bts->type = parse_btstype(argv[0]);
922
Harald Welte8175e952009-10-20 00:22:00 +0200923 if (is_ipaccess_bts(bts)) {
924 /* Set the default OML Stream ID to 0xff */
925 bts->oml_tei = 0xff;
926 }
927
Harald Welte5258fc42009-03-28 19:07:53 +0000928 return CMD_SUCCESS;
929}
930
Harald Weltefcd24452009-06-20 18:15:19 +0200931DEFUN(cfg_bts_band,
932 cfg_bts_band_cmd,
933 "band BAND",
934 "Set the frequency band of this BTS\n")
935{
936 struct gsm_bts *bts = vty->index;
Harald Welte42581822009-08-08 16:12:58 +0200937 int band = gsm_band_parse(argv[0]);
Harald Weltefcd24452009-06-20 18:15:19 +0200938
939 if (band < 0) {
940 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
941 band, VTY_NEWLINE);
942 return CMD_WARNING;
943 }
944
945 bts->band = band;
946
947 return CMD_SUCCESS;
948}
949
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200950DEFUN(cfg_bts_ci,
951 cfg_bts_ci_cmd,
952 "cell_identity <0-65535>",
953 "Set the Cell identity of this BTS\n")
954{
955 struct gsm_bts *bts = vty->index;
956 int ci = atoi(argv[0]);
957
958 if (ci < 0 || ci > 0xffff) {
959 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
960 ci, VTY_NEWLINE);
961 return CMD_WARNING;
962 }
963 bts->cell_identity = ci;
964
965 return CMD_SUCCESS;
966}
967
Harald Welte5258fc42009-03-28 19:07:53 +0000968DEFUN(cfg_bts_lac,
969 cfg_bts_lac_cmd,
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +0200970 "location_area_code <0-65535>",
Harald Welte5258fc42009-03-28 19:07:53 +0000971 "Set the Location Area Code (LAC) of this BTS\n")
972{
973 struct gsm_bts *bts = vty->index;
974 int lac = atoi(argv[0]);
975
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +0200976 if (lac < 0 || lac > 0xffff) {
977 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte5258fc42009-03-28 19:07:53 +0000978 lac, VTY_NEWLINE);
979 return CMD_WARNING;
980 }
Holger Hans Peter Freythere48b9562009-10-01 04:07:15 +0200981
982 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
983 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
984 lac, VTY_NEWLINE);
985 return CMD_WARNING;
986 }
987
Harald Welte5258fc42009-03-28 19:07:53 +0000988 bts->location_area_code = lac;
989
990 return CMD_SUCCESS;
991}
992
Harald Weltea43f7892009-12-01 18:04:30 +0530993
Harald Welte5258fc42009-03-28 19:07:53 +0000994DEFUN(cfg_bts_tsc,
995 cfg_bts_tsc_cmd,
996 "training_sequence_code <0-255>",
997 "Set the Training Sequence Code (TSC) of this BTS\n")
998{
999 struct gsm_bts *bts = vty->index;
1000 int tsc = atoi(argv[0]);
1001
1002 if (tsc < 0 || tsc > 0xff) {
1003 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1004 tsc, VTY_NEWLINE);
1005 return CMD_WARNING;
1006 }
1007 bts->tsc = tsc;
1008
1009 return CMD_SUCCESS;
1010}
1011
Harald Welte78f2f502009-05-23 16:56:52 +00001012DEFUN(cfg_bts_bsic,
1013 cfg_bts_bsic_cmd,
1014 "base_station_id_code <0-63>",
1015 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1016{
1017 struct gsm_bts *bts = vty->index;
1018 int bsic = atoi(argv[0]);
1019
1020 if (bsic < 0 || bsic > 0x3f) {
Harald Welte42581822009-08-08 16:12:58 +02001021 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte78f2f502009-05-23 16:56:52 +00001022 bsic, VTY_NEWLINE);
1023 return CMD_WARNING;
1024 }
1025 bts->bsic = bsic;
1026
1027 return CMD_SUCCESS;
1028}
1029
1030
Harald Welte4cc34222009-05-01 15:12:31 +00001031DEFUN(cfg_bts_unit_id,
1032 cfg_bts_unit_id_cmd,
Harald Welte07dc73d2009-08-07 13:27:09 +02001033 "ip.access unit_id <0-65534> <0-255>",
1034 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte4cc34222009-05-01 15:12:31 +00001035{
1036 struct gsm_bts *bts = vty->index;
1037 int site_id = atoi(argv[0]);
1038 int bts_id = atoi(argv[1]);
1039
Harald Welte07dc73d2009-08-07 13:27:09 +02001040 if (!is_ipaccess_bts(bts)) {
1041 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1042 return CMD_WARNING;
1043 }
1044
Harald Welte4cc34222009-05-01 15:12:31 +00001045 bts->ip_access.site_id = site_id;
1046 bts->ip_access.bts_id = bts_id;
1047
1048 return CMD_SUCCESS;
1049}
1050
Harald Welte8175e952009-10-20 00:22:00 +02001051DEFUN(cfg_bts_stream_id,
1052 cfg_bts_stream_id_cmd,
1053 "oml ip.access stream_id <0-255>",
1054 "Set the ip.access Stream ID of the OML link of this BTS\n")
1055{
1056 struct gsm_bts *bts = vty->index;
1057 int stream_id = atoi(argv[0]);
1058
1059 if (!is_ipaccess_bts(bts)) {
1060 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1061 return CMD_WARNING;
1062 }
1063
1064 bts->oml_tei = stream_id;
1065
1066 return CMD_SUCCESS;
1067}
1068
1069
Harald Welte42581822009-08-08 16:12:58 +02001070DEFUN(cfg_bts_oml_e1,
1071 cfg_bts_oml_e1_cmd,
1072 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
1073 "E1 interface to be used for OML\n")
1074{
1075 struct gsm_bts *bts = vty->index;
1076
1077 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1078
1079 return CMD_SUCCESS;
1080}
1081
1082
1083DEFUN(cfg_bts_oml_e1_tei,
1084 cfg_bts_oml_e1_tei_cmd,
1085 "oml e1 tei <0-63>",
1086 "Set the TEI to be used for OML")
1087{
1088 struct gsm_bts *bts = vty->index;
1089
1090 bts->oml_tei = atoi(argv[0]);
1091
1092 return CMD_SUCCESS;
1093}
1094
Harald Welte7a8fa412009-08-10 13:48:16 +02001095DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1096 "channel allocator (ascending|descending)",
1097 "Should the channel allocator allocate in reverse TRX order?")
1098{
1099 struct gsm_bts *bts = vty->index;
1100
1101 if (!strcmp(argv[0], "ascending"))
1102 bts->chan_alloc_reverse = 0;
1103 else
1104 bts->chan_alloc_reverse = 1;
1105
1106 return CMD_SUCCESS;
1107}
1108
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001109DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1110 "cell barred (0|1)",
1111 "Should this cell be barred from access?")
1112{
1113 struct gsm_bts *bts = vty->index;
1114
1115 bts->cell_barred = atoi(argv[0]);
1116
1117 return CMD_SUCCESS;
1118}
1119
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001120DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1121 "ms max power <0-40>",
1122 "Maximum transmit power of the MS")
1123{
1124 struct gsm_bts *bts = vty->index;
1125
1126 bts->ms_max_power = atoi(argv[0]);
1127
1128 return CMD_SUCCESS;
1129}
1130
Harald Welte73225282009-12-12 18:17:25 +01001131DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1132 "cell reselection hysteresis <0-14>",
1133 "Cell Re-Selection Hysteresis in dB")
1134{
1135 struct gsm_bts *bts = vty->index;
1136
1137 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1138
1139 return CMD_SUCCESS;
1140}
1141
1142DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1143 "rxlev access min <0-63>",
1144 "Minimum RxLev needed for cell access (better than -110dBm)")
1145{
1146 struct gsm_bts *bts = vty->index;
1147
1148 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1149
1150 return CMD_SUCCESS;
1151}
1152
Harald Welte (local)efc92312009-08-14 23:09:25 +02001153DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1154 "periodic location update <0-1530>",
1155 "Periodic Location Updating Interval in Minutes")
1156{
1157 struct gsm_bts *bts = vty->index;
1158
Harald Weltea43f7892009-12-01 18:04:30 +05301159 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 10;
Harald Welte (local)efc92312009-08-14 23:09:25 +02001160
1161 return CMD_SUCCESS;
1162}
1163
Harald Welte7a8fa412009-08-10 13:48:16 +02001164
Harald Welte5258fc42009-03-28 19:07:53 +00001165/* per TRX configuration */
1166DEFUN(cfg_trx,
1167 cfg_trx_cmd,
1168 "trx TRX_NR",
1169 "Select a TRX to configure")
1170{
1171 int trx_nr = atoi(argv[0]);
1172 struct gsm_bts *bts = vty->index;
1173 struct gsm_bts_trx *trx;
1174
Harald Weltee441d9c2009-06-21 16:17:15 +02001175 if (trx_nr > bts->num_trx) {
1176 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
1177 bts->num_trx, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001178 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001179 } else if (trx_nr == bts->num_trx) {
1180 /* we need to allocate a new one */
1181 trx = gsm_bts_trx_alloc(bts);
1182 } else
1183 trx = gsm_bts_trx_num(bts, trx_nr);
1184
1185 if (!trx)
1186 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +00001187
1188 vty->index = trx;
1189 vty->node = TRX_NODE;
1190
1191 return CMD_SUCCESS;
1192}
1193
1194DEFUN(cfg_trx_arfcn,
1195 cfg_trx_arfcn_cmd,
1196 "arfcn <1-1024>",
1197 "Set the ARFCN for this TRX\n")
1198{
1199 int arfcn = atoi(argv[0]);
1200 struct gsm_bts_trx *trx = vty->index;
1201
1202 /* FIXME: check if this ARFCN is supported by this TRX */
1203
1204 trx->arfcn = arfcn;
1205
1206 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
1207 /* FIXME: use OML layer to update the ARFCN */
1208 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
1209
1210 return CMD_SUCCESS;
1211}
1212
Harald Weltefcd24452009-06-20 18:15:19 +02001213DEFUN(cfg_trx_max_power_red,
1214 cfg_trx_max_power_red_cmd,
1215 "max_power_red <0-100>",
1216 "Reduction of maximum BS RF Power in dB\n")
1217{
1218 int maxpwr_r = atoi(argv[0]);
1219 struct gsm_bts_trx *trx = vty->index;
Harald Welte61a83b22009-11-18 09:20:22 +01001220 int upper_limit = 24; /* default 12.21 max power red. */
Harald Weltefcd24452009-06-20 18:15:19 +02001221
1222 /* FIXME: check if our BTS type supports more than 12 */
1223 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
1224 vty_out(vty, "%% Power %d dB is not in the valid range%s",
1225 maxpwr_r, VTY_NEWLINE);
1226 return CMD_WARNING;
1227 }
1228 if (maxpwr_r & 1) {
1229 vty_out(vty, "%% Power %d dB is not an even value%s",
1230 maxpwr_r, VTY_NEWLINE);
1231 return CMD_WARNING;
1232 }
1233
1234 trx->max_power_red = maxpwr_r;
1235
1236 /* FIXME: make sure we update this using OML */
1237
1238 return CMD_SUCCESS;
1239}
1240
Harald Welte42581822009-08-08 16:12:58 +02001241DEFUN(cfg_trx_rsl_e1,
1242 cfg_trx_rsl_e1_cmd,
1243 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
1244 "E1 interface to be used for RSL\n")
1245{
1246 struct gsm_bts_trx *trx = vty->index;
1247
1248 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
1249
1250 return CMD_SUCCESS;
1251}
1252
1253DEFUN(cfg_trx_rsl_e1_tei,
1254 cfg_trx_rsl_e1_tei_cmd,
1255 "rsl e1 tei <0-63>",
1256 "Set the TEI to be used for RSL")
1257{
1258 struct gsm_bts_trx *trx = vty->index;
1259
1260 trx->rsl_tei = atoi(argv[0]);
1261
1262 return CMD_SUCCESS;
1263}
1264
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01001265DEFUN(cfg_trx_rf_locked,
1266 cfg_trx_rf_locked_cmd,
1267 "rf_locked (0|1)",
1268 "Turn off RF of the TRX.\n")
1269{
1270 int locked = atoi(argv[0]);
1271 struct gsm_bts_trx *trx = vty->index;
1272
1273 gsm_trx_lock_rf(trx, locked);
1274 return CMD_SUCCESS;
1275}
Harald Welte42581822009-08-08 16:12:58 +02001276
Harald Welte5258fc42009-03-28 19:07:53 +00001277/* per TS configuration */
1278DEFUN(cfg_ts,
1279 cfg_ts_cmd,
Harald Welte42581822009-08-08 16:12:58 +02001280 "timeslot <0-7>",
Harald Welte5258fc42009-03-28 19:07:53 +00001281 "Select a Timeslot to configure")
1282{
1283 int ts_nr = atoi(argv[0]);
1284 struct gsm_bts_trx *trx = vty->index;
1285 struct gsm_bts_trx_ts *ts;
1286
1287 if (ts_nr >= TRX_NR_TS) {
1288 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
1289 TRX_NR_TS, VTY_NEWLINE);
1290 return CMD_WARNING;
1291 }
1292
1293 ts = &trx->ts[ts_nr];
1294
1295 vty->index = ts;
1296 vty->node = TS_NODE;
1297
1298 return CMD_SUCCESS;
1299}
1300
Harald Weltea6fd58e2009-08-07 00:25:23 +02001301DEFUN(cfg_ts_pchan,
1302 cfg_ts_pchan_cmd,
1303 "phys_chan_config PCHAN",
1304 "Physical Channel configuration (TCH/SDCCH/...)")
1305{
1306 struct gsm_bts_trx_ts *ts = vty->index;
1307 int pchanc;
1308
1309 pchanc = gsm_pchan_parse(argv[0]);
1310 if (pchanc < 0)
1311 return CMD_WARNING;
1312
1313 ts->pchan = pchanc;
1314
1315 return CMD_SUCCESS;
1316}
1317
1318DEFUN(cfg_ts_e1_subslot,
1319 cfg_ts_e1_subslot_cmd,
Harald Welte42581822009-08-08 16:12:58 +02001320 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltea6fd58e2009-08-07 00:25:23 +02001321 "E1 sub-slot connected to this on-air timeslot")
1322{
1323 struct gsm_bts_trx_ts *ts = vty->index;
1324
Harald Welte42581822009-08-08 16:12:58 +02001325 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Weltea6fd58e2009-08-07 00:25:23 +02001326
1327 return CMD_SUCCESS;
1328}
Harald Welte5258fc42009-03-28 19:07:53 +00001329
Harald Welte68628e82009-03-10 12:17:57 +00001330int bsc_vty_init(struct gsm_network *net)
1331{
1332 gsmnet = net;
1333
1334 cmd_init(1);
1335 vty_init();
1336
1337 install_element(VIEW_NODE, &show_net_cmd);
1338 install_element(VIEW_NODE, &show_bts_cmd);
1339 install_element(VIEW_NODE, &show_trx_cmd);
1340 install_element(VIEW_NODE, &show_ts_cmd);
1341 install_element(VIEW_NODE, &show_lchan_cmd);
Harald Welte1bc77352009-03-10 19:47:51 +00001342
1343 install_element(VIEW_NODE, &show_e1drv_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001344 install_element(VIEW_NODE, &show_e1line_cmd);
1345 install_element(VIEW_NODE, &show_e1ts_cmd);
1346
Harald Weltef5025b62009-03-28 16:55:11 +00001347 install_element(VIEW_NODE, &show_paging_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00001348
Harald Welte5013b2a2009-08-07 13:29:14 +02001349 install_element(CONFIG_NODE, &cfg_net_cmd);
1350 install_node(&net_node, config_write_net);
1351 install_default(GSMNET_NODE);
Harald Welte42581822009-08-08 16:12:58 +02001352 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02001353 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
1354 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
1355 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)69de3972009-08-12 14:42:23 +02001356 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte1085c092009-11-18 20:33:19 +01001357 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Welte4381cfe2009-08-30 15:47:06 +09001358 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001359 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welteeab84a12009-12-13 10:53:12 +01001360 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001361 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01001362 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
1363 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
1364 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
1365 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
1366 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
1367 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
1368 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
1369 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
1370 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
1371 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02001372
1373 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte67ce0732009-08-06 19:06:46 +02001374 install_node(&bts_node, config_write_bts);
Harald Welte68628e82009-03-10 12:17:57 +00001375 install_default(BTS_NODE);
Harald Welte5258fc42009-03-28 19:07:53 +00001376 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Weltefcd24452009-06-20 18:15:19 +02001377 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001378 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00001379 install_element(BTS_NODE, &cfg_bts_lac_cmd);
1380 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte42581822009-08-08 16:12:58 +02001381 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte4cc34222009-05-01 15:12:31 +00001382 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte8175e952009-10-20 00:22:00 +02001383 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte42581822009-08-08 16:12:58 +02001384 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
1385 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02001386 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001387 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001388 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)efc92312009-08-14 23:09:25 +02001389 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welte73225282009-12-12 18:17:25 +01001390 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
1391 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02001392
Harald Welte68628e82009-03-10 12:17:57 +00001393
Harald Welte5258fc42009-03-28 19:07:53 +00001394 install_element(BTS_NODE, &cfg_trx_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001395 install_node(&trx_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00001396 install_default(TRX_NODE);
Harald Welte5258fc42009-03-28 19:07:53 +00001397 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte879dc972009-06-20 22:36:12 +02001398 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte42581822009-08-08 16:12:58 +02001399 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
1400 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01001401 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001402
Harald Welte5258fc42009-03-28 19:07:53 +00001403 install_element(TRX_NODE, &cfg_ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001404 install_node(&ts_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00001405 install_default(TS_NODE);
Harald Weltea6fd58e2009-08-07 00:25:23 +02001406 install_element(TS_NODE, &cfg_ts_pchan_cmd);
1407 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00001408
Holger Hans Peter Freythercfa90d42009-08-10 10:17:50 +02001409 bsc_vty_init_extra(net);
Harald Welte40f82892009-05-23 17:31:39 +00001410
Harald Welte68628e82009-03-10 12:17:57 +00001411 return 0;
1412}