blob: 97093016e809aeb6168ba4b6cd7a270ee11c6015 [file] [log] [blame]
Harald Welte59b04682009-06-10 05:40:52 +08001/* OpenBSC interface to quagga VTY */
Harald Welte410575a2010-03-14 23:30:30 +08002/* (C) 2009-2010 by Harald Welte <laforge@gnumonks.org>
Harald Welte59b04682009-06-10 05:40:52 +08003 * All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
Harald Welte0e3e88e2011-01-01 15:25:50 +01006 * it under the terms of the GNU Affero General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
Harald Welte59b04682009-06-10 05:40:52 +08008 * (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
Harald Welte0e3e88e2011-01-01 15:25:50 +010013 * GNU Affero General Public License for more details.
Harald Welte59b04682009-06-10 05:40:52 +080014 *
Harald Welte0e3e88e2011-01-01 15:25:50 +010015 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
Harald Welte59b04682009-06-10 05:40:52 +080017 *
18 */
19
20#include <stdlib.h>
21#include <unistd.h>
22#include <sys/types.h>
23
Harald Weltebd9591f2010-05-19 19:45:32 +020024#include <osmocom/vty/command.h>
25#include <osmocom/vty/buffer.h>
26#include <osmocom/vty/vty.h>
27#include <osmocom/vty/logging.h>
28#include <osmocom/vty/telnet_interface.h>
Harald Welte59b04682009-06-10 05:40:52 +080029
30#include <arpa/inet.h>
31
Harald Weltef4625b12010-02-20 16:24:02 +010032#include <osmocore/linuxlist.h>
Harald Welte59b04682009-06-10 05:40:52 +080033#include <openbsc/gsm_data.h>
Harald Welte59b04682009-06-10 05:40:52 +080034#include <openbsc/e1_input.h>
35#include <openbsc/abis_nm.h>
Harald Welted8acf142010-07-30 11:50:09 +020036#include <osmocore/utils.h>
Harald Weltef4625b12010-02-20 16:24:02 +010037#include <osmocore/gsm_utils.h>
Harald Weltefe96f382009-12-22 13:09:29 +010038#include <openbsc/chan_alloc.h>
Harald Welte44007742009-12-22 21:43:14 +010039#include <openbsc/meas_rep.h>
Harald Welte59b04682009-06-10 05:40:52 +080040#include <openbsc/db.h>
Harald Weltef4625b12010-02-20 16:24:02 +010041#include <osmocore/talloc.h>
Holger Hans Peter Freytherb70d45b2010-04-06 11:55:37 +020042#include <openbsc/vty.h>
Harald Weltef45981f2010-05-12 20:28:04 +020043#include <openbsc/gprs_ns.h>
Harald Welted8acf142010-07-30 11:50:09 +020044#include <openbsc/system_information.h>
Harald Welte682ee5f2010-05-16 22:02:16 +020045#include <openbsc/debug.h>
Holger Hans Peter Freyther25176f12010-11-09 17:00:42 +010046#include <openbsc/paging.h>
Holger Hans Peter Freyther03f17d02010-11-15 20:29:46 +010047#include <openbsc/ipaccess.h>
Harald Welte5213e992010-12-23 13:18:07 +010048#include <openbsc/abis_rsl.h>
Harald Welte59b04682009-06-10 05:40:52 +080049
Harald Welte10c29f62010-05-16 19:20:24 +020050#include "../bscconfig.h"
51
Harald Welted6b62e32010-05-12 17:19:53 +000052/* FIXME: this should go to some common file */
53static const struct value_string gprs_ns_timer_strs[] = {
Harald Weltea9251762010-05-11 23:50:21 +020054 { 0, "tns-block" },
55 { 1, "tns-block-retries" },
56 { 2, "tns-reset" },
57 { 3, "tns-reset-retries" },
58 { 4, "tns-test" },
59 { 5, "tns-alive" },
60 { 6, "tns-alive-retries" },
61 { 0, NULL }
62};
63
Harald Welted6b62e32010-05-12 17:19:53 +000064static const struct value_string gprs_bssgp_cfg_strs[] = {
Harald Weltea9251762010-05-11 23:50:21 +020065 { 0, "blocking-timer" },
66 { 1, "blocking-retries" },
67 { 2, "unblocking-retries" },
68 { 3, "reset-timer" },
69 { 4, "reset-retries" },
70 { 5, "suspend-timer" },
71 { 6, "suspend-retries" },
72 { 7, "resume-timer" },
73 { 8, "resume-retries" },
74 { 9, "capability-update-timer" },
75 { 10, "capability-update-retries" },
76 { 0, NULL }
77};
78
Harald Weltee87eb462009-08-07 13:29:14 +020079struct cmd_node net_node = {
80 GSMNET_NODE,
81 "%s(network)#",
82 1,
83};
84
Harald Welte59b04682009-06-10 05:40:52 +080085struct cmd_node bts_node = {
86 BTS_NODE,
87 "%s(bts)#",
88 1,
89};
90
91struct cmd_node trx_node = {
92 TRX_NODE,
93 "%s(trx)#",
94 1,
95};
96
97struct cmd_node ts_node = {
98 TS_NODE,
99 "%s(ts)#",
100 1,
101};
102
Harald Welte61daf6d2010-05-27 13:39:40 +0200103extern struct gsm_network *bsc_gsmnet;
104
Harald Welte40152872010-05-16 20:52:23 +0200105struct gsm_network *gsmnet_from_vty(struct vty *v)
106{
Harald Welte61daf6d2010-05-27 13:39:40 +0200107 /* In case we read from the config file, the vty->priv cannot
108 * point to a struct telnet_connection, and thus conn->priv
109 * will not point to the gsm_network structure */
110#if 0
Harald Welte40152872010-05-16 20:52:23 +0200111 struct telnet_connection *conn = v->priv;
112 return (struct gsm_network *) conn->priv;
Harald Welte61daf6d2010-05-27 13:39:40 +0200113#else
114 return bsc_gsmnet;
115#endif
Harald Welte40152872010-05-16 20:52:23 +0200116}
117
Harald Welte59b04682009-06-10 05:40:52 +0800118static int dummy_config_write(struct vty *v)
119{
120 return CMD_SUCCESS;
121}
122
123static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
124{
125 vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s",
126 nm_opstate_name(nms->operational), nms->administrative,
127 nm_avail_name(nms->availability), VTY_NEWLINE);
128}
129
Harald Weltefe96f382009-12-22 13:09:29 +0100130static void dump_pchan_load_vty(struct vty *vty, char *prefix,
131 const struct pchan_load *pl)
132{
133 int i;
134
135 for (i = 0; i < ARRAY_SIZE(pl->pchan); i++) {
136 const struct load_counter *lc = &pl->pchan[i];
137 unsigned int percent;
138
139 if (lc->total == 0)
140 continue;
141
142 percent = (lc->used * 100) / lc->total;
143
144 vty_out(vty, "%s%20s: %3u%% (%u/%u)%s", prefix,
145 gsm_pchan_name(i), percent, lc->used, lc->total,
146 VTY_NEWLINE);
147 }
148}
149
Harald Welte59b04682009-06-10 05:40:52 +0800150static void net_dump_vty(struct vty *vty, struct gsm_network *net)
151{
Harald Weltefe96f382009-12-22 13:09:29 +0100152 struct pchan_load pl;
153
Harald Welte59b04682009-06-10 05:40:52 +0800154 vty_out(vty, "BSC is on Country Code %u, Network Code %u "
155 "and has %u BTS%s", net->country_code, net->network_code,
156 net->num_bts, VTY_NEWLINE);
157 vty_out(vty, " Long network name: '%s'%s",
158 net->name_long, VTY_NEWLINE);
159 vty_out(vty, " Short network name: '%s'%s",
160 net->name_short, VTY_NEWLINE);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +0200161 vty_out(vty, " Authentication policy: %s%s",
162 gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE);
Harald Welte59936d72009-11-18 20:33:19 +0100163 vty_out(vty, " Location updating reject cause: %u%s",
164 net->reject_cause, VTY_NEWLINE);
Harald Weltecca253a2009-08-30 15:47:06 +0900165 vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption,
166 VTY_NEWLINE);
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +0100167 vty_out(vty, " NECI (TCH/H): %u%s", net->neci,
168 VTY_NEWLINE);
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +0800169 vty_out(vty, " Use TCH for Paging any: %d%s", net->pag_any_tch,
170 VTY_NEWLINE);
Harald Welte52af1952009-12-13 10:53:12 +0100171 vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode),
172 VTY_NEWLINE);
Harald Weltea310f3e2009-12-14 09:00:24 +0100173 vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off",
174 VTY_NEWLINE);
Harald Welte0af9c9f2009-12-19 21:41:52 +0100175 vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off",
176 VTY_NEWLINE);
Harald Weltefe96f382009-12-22 13:09:29 +0100177 network_chan_load(&pl, net);
178 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
179 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte59b04682009-06-10 05:40:52 +0800180}
181
182DEFUN(show_net, show_net_cmd, "show network",
183 SHOW_STR "Display information about a GSM NETWORK\n")
184{
Harald Welte40152872010-05-16 20:52:23 +0200185 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800186 net_dump_vty(vty, net);
187
188 return CMD_SUCCESS;
189}
190
191static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l)
192{
193 struct e1inp_line *line;
194
195 if (!e1l) {
196 vty_out(vty, " None%s", VTY_NEWLINE);
197 return;
198 }
199
200 line = e1l->ts->line;
201
202 vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s",
203 line->num, line->driver->name, e1l->ts->num,
204 e1inp_signtype_name(e1l->type), VTY_NEWLINE);
205 vty_out(vty, " E1 TEI %u, SAPI %u%s",
206 e1l->tei, e1l->sapi, VTY_NEWLINE);
207}
208
209static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
210{
Harald Weltefe96f382009-12-22 13:09:29 +0100211 struct pchan_load pl;
212
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +0200213 vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
Harald Welte91afe4c2009-06-20 18:15:19 +0200214 "BSIC %u, TSC %u and %u TRX%s",
215 bts->nr, btstype2str(bts->type), gsm_band_name(bts->band),
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +0200216 bts->cell_identity,
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +0200217 bts->location_area_code, bts->bsic, bts->tsc,
Harald Welte91afe4c2009-06-20 18:15:19 +0200218 bts->num_trx, VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200219 vty_out(vty, "Description: %s%s",
220 bts->description ? bts->description : "(null)", VTY_NEWLINE);
Harald Welte8e9d1792009-12-12 15:38:16 +0100221 vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100222 vty_out(vty, "Minimum Rx Level for Access: %i dBm%s",
Harald Welte8e9d1792009-12-12 15:38:16 +0100223 rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min),
224 VTY_NEWLINE);
225 vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s",
Harald Welteb761bf82009-12-12 18:17:25 +0100226 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +0100227 vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer,
228 VTY_NEWLINE);
229 vty_out(vty, "RACH Max transmissions: %u%s",
230 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
231 VTY_NEWLINE);
Harald Welte8c973ba2009-12-21 23:08:18 +0100232 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)e19be3f2009-08-12 13:28:23 +0200233 vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE);
Harald Welted8acf142010-07-30 11:50:09 +0200234 vty_out(vty, "System Information present: 0x%08x, static: 0x%08x%s",
235 bts->si_valid, bts->si_mode_static, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800236 if (is_ipaccess_bts(bts))
Harald Welte25572872009-10-20 00:22:00 +0200237 vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
Harald Welte59b04682009-06-10 05:40:52 +0800238 bts->ip_access.site_id, bts->ip_access.bts_id,
Harald Welte25572872009-10-20 00:22:00 +0200239 bts->oml_tei, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800240 vty_out(vty, " NM State: ");
241 net_dump_nmstate(vty, &bts->nm_state);
242 vty_out(vty, " Site Mgr NM State: ");
243 net_dump_nmstate(vty, &bts->site_mgr.nm_state);
244 vty_out(vty, " Paging: FIXME pending requests, %u free slots%s",
245 bts->paging.available_slots, VTY_NEWLINE);
Holger Hans Peter Freytherb5c79c92010-11-25 16:28:45 +0100246 if (is_ipaccess_bts(bts)) {
247 vty_out(vty, " OML Link state: %s.%s",
248 bts->oml_link ? "connected" : "disconnected", VTY_NEWLINE);
249 } else {
Harald Welte25572872009-10-20 00:22:00 +0200250 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
251 e1isl_dump_vty(vty, bts->oml_link);
252 }
Holger Hans Peter Freytherb5c79c92010-11-25 16:28:45 +0100253
254 /* FIXME: chan_desc */
Harald Weltefe96f382009-12-22 13:09:29 +0100255 memset(&pl, 0, sizeof(pl));
256 bts_chan_load(&pl, bts);
257 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
258 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte59b04682009-06-10 05:40:52 +0800259}
260
261DEFUN(show_bts, show_bts_cmd, "show bts [number]",
262 SHOW_STR "Display information about a BTS\n"
263 "BTS number")
264{
Harald Welte40152872010-05-16 20:52:23 +0200265 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800266 int bts_nr;
267
268 if (argc != 0) {
269 /* use the BTS number that the user has specified */
270 bts_nr = atoi(argv[0]);
Harald Welteda5db862010-12-24 12:24:03 +0100271 if (bts_nr >= net->num_bts) {
Harald Welte59b04682009-06-10 05:40:52 +0800272 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
273 VTY_NEWLINE);
274 return CMD_WARNING;
275 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200276 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte59b04682009-06-10 05:40:52 +0800277 return CMD_SUCCESS;
278 }
279 /* print all BTS's */
280 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee712a5f2009-06-21 16:17:15 +0200281 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte59b04682009-06-10 05:40:52 +0800282
283 return CMD_SUCCESS;
284}
285
Harald Welte62868882009-08-08 16:12:58 +0200286/* utility functions */
287static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
288 const char *ts, const char *ss)
289{
290 e1_link->e1_nr = atoi(line);
291 e1_link->e1_ts = atoi(ts);
292 if (!strcmp(ss, "full"))
293 e1_link->e1_ts_ss = 255;
294 else
295 e1_link->e1_ts_ss = atoi(ss);
296}
297
298static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,
299 const char *prefix)
300{
301 if (!e1_link->e1_ts)
302 return;
303
304 if (e1_link->e1_ts_ss == 255)
305 vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s",
306 prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE);
307 else
308 vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s",
309 prefix, e1_link->e1_nr, e1_link->e1_ts,
310 e1_link->e1_ts_ss, VTY_NEWLINE);
311}
312
313
Harald Welte97ceef92009-08-06 19:06:46 +0200314static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
315{
Harald Welte62868882009-08-08 16:12:58 +0200316 vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
317 if (ts->pchan != GSM_PCHAN_NONE)
318 vty_out(vty, " phys_chan_config %s%s",
319 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
Harald Weltea42a93f2010-06-14 22:26:10 +0200320 vty_out(vty, " hopping enabled %u%s",
321 ts->hopping.enabled, VTY_NEWLINE);
322 if (ts->hopping.enabled) {
323 unsigned int i;
324 vty_out(vty, " hopping sequence-number %u%s",
Harald Welte67104d12009-09-12 13:05:33 +0200325 ts->hopping.hsn, VTY_NEWLINE);
Harald Weltea42a93f2010-06-14 22:26:10 +0200326 vty_out(vty, " hopping maio %u%s",
Harald Welte67104d12009-09-12 13:05:33 +0200327 ts->hopping.maio, VTY_NEWLINE);
Harald Weltea42a93f2010-06-14 22:26:10 +0200328 for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) {
329 if (!bitvec_get_bit_pos(&ts->hopping.arfcns, i))
330 continue;
331 vty_out(vty, " hopping arfcn add %u%s",
332 i, VTY_NEWLINE);
333 }
Harald Welteff598092010-12-24 12:07:07 +0100334 }
Harald Welte62868882009-08-08 16:12:58 +0200335 config_write_e1_link(vty, &ts->e1_link, " ");
Harald Welte97ceef92009-08-06 19:06:46 +0200336}
337
338static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
339{
340 int i;
341
Harald Weltee87eb462009-08-07 13:29:14 +0200342 vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200343 if (trx->description)
344 vty_out(vty, " description %s%s", trx->description,
345 VTY_NEWLINE);
Holger Hans Peter Freyther32be2aa2010-04-17 06:42:07 +0200346 vty_out(vty, " rf_locked %u%s",
347 trx->nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
348 VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200349 vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
Harald Welte (local)b709bfe2009-12-27 20:56:38 +0100350 vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200351 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200352 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
353 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte97ceef92009-08-06 19:06:46 +0200354
355 for (i = 0; i < TRX_NR_TS; i++)
356 config_write_ts_single(vty, &trx->ts[i]);
357}
358
Harald Weltea9251762010-05-11 23:50:21 +0200359static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
360{
361 unsigned int i;
362 vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode),
363 VTY_NEWLINE);
364 if (bts->gprs.mode == BTS_GPRS_NONE)
365 return;
366
367 vty_out(vty, " gprs routing area %u%s", bts->gprs.rac,
368 VTY_NEWLINE);
369 vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
370 VTY_NEWLINE);
371 for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++)
372 vty_out(vty, " gprs cell timer %s %u%s",
373 get_value_string(gprs_bssgp_cfg_strs, i),
374 bts->gprs.cell.timer[i], VTY_NEWLINE);
375 vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei,
376 VTY_NEWLINE);
377 for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++)
378 vty_out(vty, " gprs ns timer %s %u%s",
379 get_value_string(gprs_ns_timer_strs, i),
380 bts->gprs.nse.timer[i], VTY_NEWLINE);
381 for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
382 struct gsm_bts_gprs_nsvc *nsvc =
383 &bts->gprs.nsvc[i];
384 struct in_addr ia;
385
386 ia.s_addr = htonl(nsvc->remote_ip);
387 vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
388 nsvc->nsvci, VTY_NEWLINE);
389 vty_out(vty, " gprs nsvc %u local udp port %u%s", i,
390 nsvc->local_port, VTY_NEWLINE);
391 vty_out(vty, " gprs nsvc %u remote udp port %u%s", i,
392 nsvc->remote_port, VTY_NEWLINE);
393 vty_out(vty, " gprs nsvc %u remote ip %s%s", i,
394 inet_ntoa(ia), VTY_NEWLINE);
395 }
396}
397
Harald Welte97ceef92009-08-06 19:06:46 +0200398static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
399{
400 struct gsm_bts_trx *trx;
Harald Welted8acf142010-07-30 11:50:09 +0200401 int i;
Harald Welte97ceef92009-08-06 19:06:46 +0200402
Harald Weltee87eb462009-08-07 13:29:14 +0200403 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
404 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200405 if (bts->description)
406 vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200407 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freyther6d82b7c2009-11-19 16:38:49 +0100408 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200409 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte97ceef92009-08-06 19:06:46 +0200410 VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200411 vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE);
412 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)cbd46102009-08-13 10:14:26 +0200413 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100414 vty_out(vty, " cell reselection hysteresis %u%s",
415 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
416 vty_out(vty, " rxlev access min %u%s",
417 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Sylvain Munaut00d71462010-11-28 18:17:28 +0100418
419 if (bts->si_common.cell_ro_sel_par.present) {
420 struct gsm48_si_selection_params *sp;
421 sp = &bts->si_common.cell_ro_sel_par;
422
423 if (sp->cbq)
424 vty_out(vty, " cell bar qualify %u%s",
425 sp->cbq, VTY_NEWLINE);
426
427 if (sp->cell_resel_off)
428 vty_out(vty, " cell reselection offset %u%s",
429 sp->cell_resel_off*2, VTY_NEWLINE);
430
431 if (sp->temp_offs == 7)
432 vty_out(vty, " temporary offset infinite%s",
433 VTY_NEWLINE);
434 else if (sp->temp_offs)
435 vty_out(vty, " temporary offset %u%s",
436 sp->temp_offs*10, VTY_NEWLINE);
437
438 if (sp->penalty_time == 31)
439 vty_out(vty, " penalty time reserved%s",
440 VTY_NEWLINE);
441 else if (sp->penalty_time)
442 vty_out(vty, " penalty time %u%s",
443 (sp->penalty_time*20)+20, VTY_NEWLINE);
444 }
445
Harald Weltea54a2bb2009-12-01 18:04:30 +0530446 if (bts->si_common.chan_desc.t3212)
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +0200447 vty_out(vty, " periodic location update %u%s",
Dieter Spaarb0f746d2010-10-05 21:10:55 +0200448 bts->si_common.chan_desc.t3212 * 6, VTY_NEWLINE);
Harald Welte3e774612009-08-10 13:48:16 +0200449 vty_out(vty, " channel allocator %s%s",
450 bts->chan_alloc_reverse ? "descending" : "ascending",
451 VTY_NEWLINE);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +0100452 vty_out(vty, " rach tx integer %u%s",
453 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
454 vty_out(vty, " rach max transmission %u%s",
455 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
456 VTY_NEWLINE);
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +0800457
458 if (bts->rach_b_thresh != -1)
459 vty_out(vty, " rach nm busy threshold %u%s",
460 bts->rach_b_thresh, VTY_NEWLINE);
461 if (bts->rach_ldavg_slots != -1)
462 vty_out(vty, " rach nm load average %u%s",
463 bts->rach_ldavg_slots, VTY_NEWLINE);
Harald Welte8c973ba2009-12-21 23:08:18 +0100464 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)e19be3f2009-08-12 13:28:23 +0200465 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Holger Hans Peter Freyther440984b2010-05-14 00:39:19 +0800466 if ((bts->si_common.rach_control.t2 & 0x4) == 0)
467 vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE);
Harald Welted8acf142010-07-30 11:50:09 +0200468 for (i = SYSINFO_TYPE_1; i < _MAX_SYSINFO_TYPE; i++) {
469 if (bts->si_mode_static & (1 << i)) {
470 vty_out(vty, " system-information %s mode static%s",
471 get_value_string(osmo_sitype_strs, i), VTY_NEWLINE);
472 vty_out(vty, " system-information %s static %s%s",
473 get_value_string(osmo_sitype_strs, i),
474 hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])),
475 VTY_NEWLINE);
476 }
477 }
Harald Welte25572872009-10-20 00:22:00 +0200478 if (is_ipaccess_bts(bts)) {
Harald Weltee87eb462009-08-07 13:29:14 +0200479 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Welte3ffe1b32009-08-07 00:25:23 +0200480 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte25572872009-10-20 00:22:00 +0200481 vty_out(vty, " oml ip.access stream_id %u%s", bts->oml_tei, VTY_NEWLINE);
482 } else {
Harald Welte62868882009-08-08 16:12:58 +0200483 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
484 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
485 }
Holger Hans Peter Freyther3112f672010-09-06 10:11:25 +0800486
487 /* if we have a limit, write it */
488 if (bts->paging.free_chans_need >= 0)
489 vty_out(vty, " paging free %d%s", bts->paging.free_chans_need, VTY_NEWLINE);
490
Harald Welteca46eff2011-01-11 23:44:56 +0100491 vty_out(vty, " neighbor-list mode %s%s",
492 bts->neigh_list_manual_mode ? "manual" : "automatic", VTY_NEWLINE);
493 if (bts->neigh_list_manual_mode) {
494 for (i = 0; i < 1024; i++) {
495 if (bitvec_get_bit_pos(&bts->si_common.neigh_list, i))
496 vty_out(vty, " neighbor-list add arfcn %u%s",
497 i, VTY_NEWLINE);
498 }
499 }
500
Harald Weltea9251762010-05-11 23:50:21 +0200501 config_write_bts_gprs(vty, bts);
Harald Welte97ceef92009-08-06 19:06:46 +0200502
503 llist_for_each_entry(trx, &bts->trx_list, list)
504 config_write_trx_single(vty, trx);
505}
506
507static int config_write_bts(struct vty *v)
508{
Harald Welte40152872010-05-16 20:52:23 +0200509 struct gsm_network *gsmnet = gsmnet_from_vty(v);
Harald Welte97ceef92009-08-06 19:06:46 +0200510 struct gsm_bts *bts;
511
512 llist_for_each_entry(bts, &gsmnet->bts_list, list)
513 config_write_bts_single(v, bts);
514
515 return CMD_SUCCESS;
516}
517
Harald Weltee87eb462009-08-07 13:29:14 +0200518static int config_write_net(struct vty *vty)
519{
Harald Welte40152872010-05-16 20:52:23 +0200520 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
521
Harald Weltee87eb462009-08-07 13:29:14 +0200522 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200523 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200524 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200525 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
526 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +0200527 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Harald Welte59936d72009-11-18 20:33:19 +0100528 vty_out(vty, " location updating reject cause %u%s",
529 gsmnet->reject_cause, VTY_NEWLINE);
Harald Weltecca253a2009-08-30 15:47:06 +0900530 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freyther6b4f5462009-11-19 16:37:48 +0100531 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +0800532 vty_out(vty, " paging any use tch %d%s", gsmnet->pag_any_tch, VTY_NEWLINE);
Harald Welte52af1952009-12-13 10:53:12 +0100533 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
534 VTY_NEWLINE);
Harald Weltea310f3e2009-12-14 09:00:24 +0100535 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Welte0af9c9f2009-12-19 21:41:52 +0100536 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Weltea8062f12009-12-21 16:51:50 +0100537 vty_out(vty, " handover window rxlev averaging %u%s",
538 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
539 vty_out(vty, " handover window rxqual averaging %u%s",
540 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
541 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
542 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
543 vty_out(vty, " handover power budget interval %u%s",
544 gsmnet->handover.pwr_interval, VTY_NEWLINE);
545 vty_out(vty, " handover power budget hysteresis %u%s",
546 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
547 vty_out(vty, " handover maximum distance %u%s",
548 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +0100549 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +0100550 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
551 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
552 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
553 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
554 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
555 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
556 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
557 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
558 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
Harald Weltea00fdd72010-12-23 14:39:29 +0100559 vty_out(vty, " timer t3122 %u%s", gsmnet->T3122, VTY_NEWLINE);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +0100560 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Harald Weltef41bfd52010-12-15 15:34:23 +0100561 vty_out(vty, " dtx-used %u%s", gsmnet->dtx_enabled, VTY_NEWLINE);
Holger Hans Peter Freyther68b21e12010-12-22 16:26:04 +0100562 vty_out(vty, " subscriber-keep-in-ram %d%s",
563 gsmnet->keep_subscr, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200564
565 return CMD_SUCCESS;
566}
Harald Welte97ceef92009-08-06 19:06:46 +0200567
Harald Welte59b04682009-06-10 05:40:52 +0800568static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
569{
570 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
571 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200572 vty_out(vty, "Description: %s%s",
573 trx->description ? trx->description : "(null)", VTY_NEWLINE);
Harald Welte91afe4c2009-06-20 18:15:19 +0200574 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte62868882009-08-08 16:12:58 +0200575 "resulting BS power: %d dBm%s",
Harald Welte91afe4c2009-06-20 18:15:19 +0200576 trx->nominal_power, trx->max_power_red,
Harald Welte62868882009-08-08 16:12:58 +0200577 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800578 vty_out(vty, " NM State: ");
579 net_dump_nmstate(vty, &trx->nm_state);
580 vty_out(vty, " Baseband Transceiver NM State: ");
581 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte25572872009-10-20 00:22:00 +0200582 if (is_ipaccess_bts(trx->bts)) {
583 vty_out(vty, " ip.access stream ID: 0x%02x%s",
584 trx->rsl_tei, VTY_NEWLINE);
585 } else {
586 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
587 e1isl_dump_vty(vty, trx->rsl_link);
588 }
Harald Welte59b04682009-06-10 05:40:52 +0800589}
590
591DEFUN(show_trx,
592 show_trx_cmd,
593 "show trx [bts_nr] [trx_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200594 SHOW_STR "Display information about a TRX\n"
595 "BTS Number\n"
596 "TRX Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800597{
Harald Welte40152872010-05-16 20:52:23 +0200598 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800599 struct gsm_bts *bts = NULL;
600 struct gsm_bts_trx *trx;
601 int bts_nr, trx_nr;
602
603 if (argc >= 1) {
604 /* use the BTS number that the user has specified */
605 bts_nr = atoi(argv[0]);
606 if (bts_nr >= net->num_bts) {
607 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
608 VTY_NEWLINE);
609 return CMD_WARNING;
610 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200611 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800612 }
613 if (argc >= 2) {
614 trx_nr = atoi(argv[1]);
615 if (trx_nr >= bts->num_trx) {
616 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
617 VTY_NEWLINE);
618 return CMD_WARNING;
619 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200620 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800621 trx_dump_vty(vty, trx);
622 return CMD_SUCCESS;
623 }
624 if (bts) {
625 /* print all TRX in this BTS */
626 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200627 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800628 trx_dump_vty(vty, trx);
629 }
630 return CMD_SUCCESS;
631 }
632
633 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200634 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800635 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200636 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800637 trx_dump_vty(vty, trx);
638 }
639 }
640
641 return CMD_SUCCESS;
642}
643
Harald Welte97ceef92009-08-06 19:06:46 +0200644
Harald Welte59b04682009-06-10 05:40:52 +0800645static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
646{
Harald Welte98d2bb82010-12-24 12:14:52 +0100647 vty_out(vty, "BTS %u, TRX %u, Timeslot %u, phys cfg %s",
Harald Weltee3bd0c02010-12-24 12:12:10 +0100648 ts->trx->bts->nr, ts->trx->nr, ts->nr,
Harald Welte98d2bb82010-12-24 12:14:52 +0100649 gsm_pchan_name(ts->pchan));
650 if (ts->pchan == GSM_PCHAN_TCH_F_PDCH)
Harald Welte81c2ed32010-12-24 12:26:13 +0100651 vty_out(vty, " (%s mode)",
Harald Welte98d2bb82010-12-24 12:14:52 +0100652 ts->flags & TS_F_PDCH_MODE ? "PDCH" : "TCH/F");
653 vty_out(vty, "%s", VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800654 vty_out(vty, " NM State: ");
655 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte87504212009-12-02 01:56:49 +0530656 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welte59b04682009-06-10 05:40:52 +0800657 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
658 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
659 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800660}
661
662DEFUN(show_ts,
663 show_ts_cmd,
664 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200665 SHOW_STR "Display information about a TS\n"
666 "BTS Number\n" "TRX Number\n" "Timeslot Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800667{
Harald Welte40152872010-05-16 20:52:23 +0200668 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte06868382010-12-24 12:05:03 +0100669 struct gsm_bts *bts = NULL;
670 struct gsm_bts_trx *trx = NULL;
671 struct gsm_bts_trx_ts *ts = NULL;
Harald Welte59b04682009-06-10 05:40:52 +0800672 int bts_nr, trx_nr, ts_nr;
673
674 if (argc >= 1) {
675 /* use the BTS number that the user has specified */
676 bts_nr = atoi(argv[0]);
677 if (bts_nr >= net->num_bts) {
678 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
679 VTY_NEWLINE);
680 return CMD_WARNING;
681 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200682 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800683 }
684 if (argc >= 2) {
685 trx_nr = atoi(argv[1]);
686 if (trx_nr >= bts->num_trx) {
687 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
688 VTY_NEWLINE);
689 return CMD_WARNING;
690 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200691 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800692 }
693 if (argc >= 3) {
694 ts_nr = atoi(argv[2]);
695 if (ts_nr >= TRX_NR_TS) {
696 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
697 VTY_NEWLINE);
698 return CMD_WARNING;
699 }
Harald Welte06868382010-12-24 12:05:03 +0100700 /* Fully Specified: print and exit */
Harald Welte59b04682009-06-10 05:40:52 +0800701 ts = &trx->ts[ts_nr];
702 ts_dump_vty(vty, ts);
703 return CMD_SUCCESS;
704 }
Harald Welte06868382010-12-24 12:05:03 +0100705
706 if (bts && trx) {
707 /* Iterate over all TS in this TRX */
708 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
709 ts = &trx->ts[ts_nr];
710 ts_dump_vty(vty, ts);
711 }
712 } else if (bts) {
713 /* Iterate over all TRX in this BTS, TS in each TRX */
Harald Welte59b04682009-06-10 05:40:52 +0800714 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200715 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800716 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
717 ts = &trx->ts[ts_nr];
718 ts_dump_vty(vty, ts);
719 }
720 }
Harald Welte06868382010-12-24 12:05:03 +0100721 } else {
722 /* Iterate over all BTS, TRX in each BTS, TS in each TRX */
723 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
724 bts = gsm_bts_num(net, bts_nr);
725 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
726 trx = gsm_bts_trx_num(bts, trx_nr);
727 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
728 ts = &trx->ts[ts_nr];
729 ts_dump_vty(vty, ts);
730 }
731 }
732 }
Harald Welte59b04682009-06-10 05:40:52 +0800733 }
734
735 return CMD_SUCCESS;
736}
737
Holger Hans Peter Freyther1dd0a1b2010-01-06 06:00:40 +0100738static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte59b04682009-06-10 05:40:52 +0800739{
Harald Welte91afe4c2009-06-20 18:15:19 +0200740 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte59b04682009-06-10 05:40:52 +0800741 subscr->authorized, VTY_NEWLINE);
742 if (subscr->name)
743 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
744 if (subscr->extension)
745 vty_out(vty, " Extension: %s%s", subscr->extension,
746 VTY_NEWLINE);
747 if (subscr->imsi)
748 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freythercd8bacf2009-08-19 12:53:57 +0200749 if (subscr->tmsi != GSM_RESERVED_TMSI)
750 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte270c06c2009-08-15 03:24:51 +0200751 VTY_NEWLINE);
Sylvain Munaute5863a22009-12-27 19:29:28 +0100752
Harald Welte (local)02d5efa2009-08-14 20:27:16 +0200753 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800754}
755
Harald Welte44007742009-12-22 21:43:14 +0100756static void meas_rep_dump_uni_vty(struct vty *vty,
757 struct gsm_meas_rep_unidir *mru,
758 const char *prefix,
759 const char *dir)
760{
761 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
762 prefix, dir, rxlev2dbm(mru->full.rx_lev),
763 dir, rxlev2dbm(mru->sub.rx_lev));
764 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
765 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
766 VTY_NEWLINE);
767}
768
769static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
770 const char *prefix)
771{
772 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
773 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
774 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
775 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
776 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
777 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
778 VTY_NEWLINE);
779 if (mr->flags & MEAS_REP_F_MS_TO)
780 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
781 mr->ms_timing_offset, VTY_NEWLINE);
782 if (mr->flags & MEAS_REP_F_MS_L1)
783 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
784 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
785 if (mr->flags & MEAS_REP_F_DL_VALID)
786 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
787 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
788}
789
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800790static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
Harald Welte59b04682009-06-10 05:40:52 +0800791{
Harald Welte44007742009-12-22 21:43:14 +0100792 int idx;
793
Harald Weltef62dad62010-12-24 12:22:34 +0100794 vty_out(vty, "BTS %u, TRX %u, Timeslot %u, Lchan %u: Type %s%s",
795 lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
796 lchan->nr, gsm_lchant_name(lchan->type), VTY_NEWLINE);
Holger Hans Peter Freyther6e5c50f2010-06-28 17:09:29 +0800797 vty_out(vty, " Connection: %u, State: %s%s",
798 lchan->conn ? 1: 0,
Harald Welteab2534c2009-12-29 10:52:38 +0100799 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100800 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
801 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
802 - lchan->bs_power*2,
803 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
804 VTY_NEWLINE);
Holger Hans Peter Freyther1a95fa82010-06-28 15:47:12 +0800805 if (lchan->conn && lchan->conn->subscr) {
Harald Welte59b04682009-06-10 05:40:52 +0800806 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther1a95fa82010-06-28 15:47:12 +0800807 subscr_dump_vty(vty, lchan->conn->subscr);
Harald Welte59b04682009-06-10 05:40:52 +0800808 } else
809 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte87504212009-12-02 01:56:49 +0530810 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
811 struct in_addr ia;
Holger Hans Peter Freythercec1ec52010-04-07 15:39:16 +0200812 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte87504212009-12-02 01:56:49 +0530813 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
814 inet_ntoa(ia), lchan->abis_ip.bound_port,
815 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
816 VTY_NEWLINE);
817 }
Harald Welte44007742009-12-22 21:43:14 +0100818
819 /* we want to report the last measurement report */
820 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
821 lchan->meas_rep_idx, 1);
822 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte59b04682009-06-10 05:40:52 +0800823}
824
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +0800825static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
826{
Holger Hans Peter Freythercf13a922010-05-14 01:57:02 +0800827 struct gsm_meas_rep *mr;
828 int idx;
829
830 /* we want to report the last measurement report */
831 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
832 lchan->meas_rep_idx, 1);
833 mr = &lchan->meas_rep[idx];
834
Harald Weltef62dad62010-12-24 12:22:34 +0100835 vty_out(vty, "BTS %u, TRX %u, Timeslot %u, Lchan %u, Type %s - "
836 "L1 MS Power: %u dBm RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
837 lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
Harald Welte81c2ed32010-12-24 12:26:13 +0100838 lchan->nr, gsm_lchant_name(lchan->type), mr->ms_l1.pwr,
Holger Hans Peter Freythercf13a922010-05-14 01:57:02 +0800839 rxlev2dbm(mr->dl.full.rx_lev),
840 rxlev2dbm(mr->ul.full.rx_lev),
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +0800841 VTY_NEWLINE);
842}
843
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800844static int lchan_summary(struct vty *vty, int argc, const char **argv,
845 void (*dump_cb)(struct vty *, struct gsm_lchan *))
Harald Welte59b04682009-06-10 05:40:52 +0800846{
Harald Welte40152872010-05-16 20:52:23 +0200847 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800848 struct gsm_bts *bts;
849 struct gsm_bts_trx *trx;
850 struct gsm_bts_trx_ts *ts;
851 struct gsm_lchan *lchan;
852 int bts_nr, trx_nr, ts_nr, lchan_nr;
853
854 if (argc >= 1) {
855 /* use the BTS number that the user has specified */
856 bts_nr = atoi(argv[0]);
857 if (bts_nr >= net->num_bts) {
858 vty_out(vty, "%% can't find BTS %s%s", argv[0],
859 VTY_NEWLINE);
860 return CMD_WARNING;
861 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200862 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800863 }
864 if (argc >= 2) {
865 trx_nr = atoi(argv[1]);
866 if (trx_nr >= bts->num_trx) {
867 vty_out(vty, "%% can't find TRX %s%s", argv[1],
868 VTY_NEWLINE);
869 return CMD_WARNING;
870 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200871 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800872 }
873 if (argc >= 3) {
874 ts_nr = atoi(argv[2]);
875 if (ts_nr >= TRX_NR_TS) {
876 vty_out(vty, "%% can't find TS %s%s", argv[2],
877 VTY_NEWLINE);
878 return CMD_WARNING;
879 }
880 ts = &trx->ts[ts_nr];
881 }
882 if (argc >= 4) {
883 lchan_nr = atoi(argv[3]);
884 if (lchan_nr >= TS_MAX_LCHAN) {
885 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
886 VTY_NEWLINE);
887 return CMD_WARNING;
888 }
889 lchan = &ts->lchan[lchan_nr];
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800890 dump_cb(vty, lchan);
Harald Welte59b04682009-06-10 05:40:52 +0800891 return CMD_SUCCESS;
892 }
893 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200894 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800895 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200896 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800897 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
898 ts = &trx->ts[ts_nr];
899 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
900 lchan_nr++) {
901 lchan = &ts->lchan[lchan_nr];
902 if (lchan->type == GSM_LCHAN_NONE)
903 continue;
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800904 dump_cb(vty, lchan);
Harald Welte59b04682009-06-10 05:40:52 +0800905 }
906 }
907 }
908 }
909
910 return CMD_SUCCESS;
911}
912
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800913
914DEFUN(show_lchan,
915 show_lchan_cmd,
916 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
917 SHOW_STR "Display information about a logical channel\n"
918 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
919 "Logical Channel Number\n")
920
921{
922 return lchan_summary(vty, argc, argv, lchan_dump_full_vty);
923}
924
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +0800925DEFUN(show_lchan_summary,
926 show_lchan_summary_cmd,
927 "show lchan summary [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
928 SHOW_STR "Display information about a logical channel\n"
929 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
930 "Logical Channel Number\n")
931{
932 return lchan_summary(vty, argc, argv, lchan_dump_short_vty);
933}
934
Harald Welte59b04682009-06-10 05:40:52 +0800935static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
936{
937 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
938}
939
940DEFUN(show_e1drv,
941 show_e1drv_cmd,
942 "show e1_driver",
943 SHOW_STR "Display information about available E1 drivers\n")
944{
945 struct e1inp_driver *drv;
946
947 llist_for_each_entry(drv, &e1inp_driver_list, list)
948 e1drv_dump_vty(vty, drv);
949
950 return CMD_SUCCESS;
951}
952
953static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
954{
955 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
956 line->num, line->name ? line->name : "",
957 line->driver->name, VTY_NEWLINE);
958}
959
960DEFUN(show_e1line,
961 show_e1line_cmd,
962 "show e1_line [line_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200963 SHOW_STR "Display information about a E1 line\n"
964 "E1 Line Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800965{
966 struct e1inp_line *line;
967
968 if (argc >= 1) {
969 int num = atoi(argv[0]);
970 llist_for_each_entry(line, &e1inp_line_list, list) {
971 if (line->num == num) {
972 e1line_dump_vty(vty, line);
973 return CMD_SUCCESS;
974 }
975 }
976 return CMD_WARNING;
977 }
978
979 llist_for_each_entry(line, &e1inp_line_list, list)
980 e1line_dump_vty(vty, line);
981
982 return CMD_SUCCESS;
983}
984
985static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
986{
Harald Welte62868882009-08-08 16:12:58 +0200987 if (ts->type == E1INP_TS_TYPE_NONE)
988 return;
Harald Welte59b04682009-06-10 05:40:52 +0800989 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
990 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
991 VTY_NEWLINE);
992}
993
994DEFUN(show_e1ts,
995 show_e1ts_cmd,
996 "show e1_timeslot [line_nr] [ts_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200997 SHOW_STR "Display information about a E1 timeslot\n"
998 "E1 Line Number\n" "E1 Timeslot Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800999{
Harald Welte49c79562009-11-17 06:12:16 +01001000 struct e1inp_line *line = NULL;
Harald Welte59b04682009-06-10 05:40:52 +08001001 struct e1inp_ts *ts;
1002 int ts_nr;
1003
1004 if (argc == 0) {
1005 llist_for_each_entry(line, &e1inp_line_list, list) {
1006 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
1007 ts = &line->ts[ts_nr];
1008 e1ts_dump_vty(vty, ts);
1009 }
1010 }
1011 return CMD_SUCCESS;
1012 }
1013 if (argc >= 1) {
1014 int num = atoi(argv[0]);
1015 llist_for_each_entry(line, &e1inp_line_list, list) {
1016 if (line->num == num)
1017 break;
1018 }
1019 if (!line || line->num != num) {
1020 vty_out(vty, "E1 line %s is invalid%s",
1021 argv[0], VTY_NEWLINE);
1022 return CMD_WARNING;
1023 }
1024 }
1025 if (argc >= 2) {
1026 ts_nr = atoi(argv[1]);
1027 if (ts_nr > NUM_E1_TS) {
1028 vty_out(vty, "E1 timeslot %s is invalid%s",
1029 argv[1], VTY_NEWLINE);
1030 return CMD_WARNING;
1031 }
1032 ts = &line->ts[ts_nr];
1033 e1ts_dump_vty(vty, ts);
1034 return CMD_SUCCESS;
1035 } else {
1036 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
1037 ts = &line->ts[ts_nr];
1038 e1ts_dump_vty(vty, ts);
1039 }
1040 return CMD_SUCCESS;
1041 }
1042 return CMD_SUCCESS;
1043}
1044
1045static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
1046{
1047 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
1048 subscr_dump_vty(vty, pag->subscr);
1049}
1050
1051static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
1052{
1053 struct gsm_paging_request *pag;
1054
1055 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
1056 paging_dump_vty(vty, pag);
1057}
1058
1059DEFUN(show_paging,
1060 show_paging_cmd,
1061 "show paging [bts_nr]",
Harald Welte9e002452010-05-11 21:53:49 +02001062 SHOW_STR "Display information about paging reuqests of a BTS\n"
1063 "BTS Number\n")
Harald Welte59b04682009-06-10 05:40:52 +08001064{
Harald Welte40152872010-05-16 20:52:23 +02001065 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +08001066 struct gsm_bts *bts;
1067 int bts_nr;
1068
1069 if (argc >= 1) {
1070 /* use the BTS number that the user has specified */
1071 bts_nr = atoi(argv[0]);
1072 if (bts_nr >= net->num_bts) {
1073 vty_out(vty, "%% can't find BTS %s%s", argv[0],
1074 VTY_NEWLINE);
1075 return CMD_WARNING;
1076 }
Harald Weltee712a5f2009-06-21 16:17:15 +02001077 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +08001078 bts_paging_dump_vty(vty, bts);
1079
1080 return CMD_SUCCESS;
1081 }
1082 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +02001083 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +08001084 bts_paging_dump_vty(vty, bts);
1085 }
1086
1087 return CMD_SUCCESS;
1088}
1089
Harald Welte9e002452010-05-11 21:53:49 +02001090#define NETWORK_STR "Configure the GSM network\n"
1091
Harald Weltee87eb462009-08-07 13:29:14 +02001092DEFUN(cfg_net,
1093 cfg_net_cmd,
Harald Welte9e002452010-05-11 21:53:49 +02001094 "network", NETWORK_STR)
Harald Weltee87eb462009-08-07 13:29:14 +02001095{
Harald Welte40152872010-05-16 20:52:23 +02001096 vty->index = gsmnet_from_vty(vty);
Harald Weltee87eb462009-08-07 13:29:14 +02001097 vty->node = GSMNET_NODE;
1098
1099 return CMD_SUCCESS;
1100}
1101
1102
1103DEFUN(cfg_net_ncc,
1104 cfg_net_ncc_cmd,
1105 "network country code <1-999>",
1106 "Set the GSM network country code")
1107{
Harald Welte40152872010-05-16 20:52:23 +02001108 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1109
Harald Weltee87eb462009-08-07 13:29:14 +02001110 gsmnet->country_code = atoi(argv[0]);
1111
1112 return CMD_SUCCESS;
1113}
1114
1115DEFUN(cfg_net_mnc,
1116 cfg_net_mnc_cmd,
1117 "mobile network code <1-999>",
1118 "Set the GSM mobile network code")
1119{
Harald Welte40152872010-05-16 20:52:23 +02001120 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1121
Harald Weltee87eb462009-08-07 13:29:14 +02001122 gsmnet->network_code = atoi(argv[0]);
1123
1124 return CMD_SUCCESS;
1125}
1126
1127DEFUN(cfg_net_name_short,
1128 cfg_net_name_short_cmd,
1129 "short name NAME",
1130 "Set the short GSM network name")
1131{
Harald Welte40152872010-05-16 20:52:23 +02001132 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1133
Holger Hans Peter Freyther7c831f62010-10-12 23:21:54 +02001134 bsc_replace_string(gsmnet, &gsmnet->name_short, argv[0]);
Harald Weltee87eb462009-08-07 13:29:14 +02001135 return CMD_SUCCESS;
1136}
1137
1138DEFUN(cfg_net_name_long,
1139 cfg_net_name_long_cmd,
1140 "long name NAME",
1141 "Set the long GSM network name")
1142{
Harald Welte40152872010-05-16 20:52:23 +02001143 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1144
Holger Hans Peter Freyther7c831f62010-10-12 23:21:54 +02001145 bsc_replace_string(gsmnet, &gsmnet->name_long, argv[0]);
Harald Weltee87eb462009-08-07 13:29:14 +02001146 return CMD_SUCCESS;
1147}
Harald Welte59b04682009-06-10 05:40:52 +08001148
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02001149DEFUN(cfg_net_auth_policy,
1150 cfg_net_auth_policy_cmd,
1151 "auth policy (closed|accept-all|token)",
Harald Welte9e002452010-05-11 21:53:49 +02001152 "Authentication (not cryptographic)\n"
1153 "Set the GSM network authentication policy\n"
1154 "Require the MS to be activated in HLR\n"
1155 "Accept all MS, whether in HLR or not\n"
1156 "Use SMS-token based authentication\n")
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02001157{
1158 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
Harald Welte40152872010-05-16 20:52:23 +02001159 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02001160
1161 gsmnet->auth_policy = policy;
1162
1163 return CMD_SUCCESS;
1164}
1165
Harald Welte59936d72009-11-18 20:33:19 +01001166DEFUN(cfg_net_reject_cause,
1167 cfg_net_reject_cause_cmd,
1168 "location updating reject cause <2-111>",
1169 "Set the reject cause of location updating reject\n")
1170{
Harald Welte40152872010-05-16 20:52:23 +02001171 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1172
Harald Welte59936d72009-11-18 20:33:19 +01001173 gsmnet->reject_cause = atoi(argv[0]);
1174
1175 return CMD_SUCCESS;
1176}
1177
Harald Weltecca253a2009-08-30 15:47:06 +09001178DEFUN(cfg_net_encryption,
1179 cfg_net_encryption_cmd,
1180 "encryption a5 (0|1|2)",
Harald Welte18ce31c2010-05-14 20:05:17 +02001181 "Encryption options\n"
1182 "A5 encryption\n" "A5/0: No encryption\n"
1183 "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n")
Harald Weltecca253a2009-08-30 15:47:06 +09001184{
Harald Welte40152872010-05-16 20:52:23 +02001185 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1186
Andreas.Eversberg53293292009-11-17 09:55:26 +01001187 gsmnet->a5_encryption= atoi(argv[0]);
Harald Weltecca253a2009-08-30 15:47:06 +09001188
1189 return CMD_SUCCESS;
1190}
1191
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001192DEFUN(cfg_net_neci,
1193 cfg_net_neci_cmd,
1194 "neci (0|1)",
Harald Welte18ce31c2010-05-14 20:05:17 +02001195 "New Establish Cause Indication\n"
1196 "Don't set the NECI bit\n" "Set the NECI bit\n")
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001197{
Harald Welte40152872010-05-16 20:52:23 +02001198 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1199
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001200 gsmnet->neci = atoi(argv[0]);
Holger Hans Peter Freytherf0f37f12010-09-06 09:36:02 +08001201 gsm_net_update_ctype(gsmnet);
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001202 return CMD_SUCCESS;
1203}
1204
Harald Welte52af1952009-12-13 10:53:12 +01001205DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1206 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
Harald Welte9e002452010-05-11 21:53:49 +02001207 "Radio Resource Location Protocol\n"
1208 "Set the Radio Resource Location Protocol Mode\n"
1209 "Don't send RRLP request\n"
1210 "Request MS-based location\n"
1211 "Request any location, prefer MS-based\n"
1212 "Request any location, prefer MS-assisted\n")
Harald Welte52af1952009-12-13 10:53:12 +01001213{
Harald Welte40152872010-05-16 20:52:23 +02001214 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1215
Harald Welte52af1952009-12-13 10:53:12 +01001216 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1217
1218 return CMD_SUCCESS;
1219}
1220
Harald Weltea310f3e2009-12-14 09:00:24 +01001221DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1222 "mm info (0|1)",
1223 "Whether to send MM INFO after LOC UPD ACCEPT")
1224{
Harald Welte40152872010-05-16 20:52:23 +02001225 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1226
Harald Weltea310f3e2009-12-14 09:00:24 +01001227 gsmnet->send_mm_info = atoi(argv[0]);
1228
1229 return CMD_SUCCESS;
1230}
1231
Harald Welte9e002452010-05-11 21:53:49 +02001232#define HANDOVER_STR "Handover Options\n"
1233
Harald Welte0af9c9f2009-12-19 21:41:52 +01001234DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1235 "handover (0|1)",
Harald Welte9e002452010-05-11 21:53:49 +02001236 HANDOVER_STR
1237 "Don't perform in-call handover\n"
1238 "Perform in-call handover\n")
Harald Welte0af9c9f2009-12-19 21:41:52 +01001239{
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001240 int enable = atoi(argv[0]);
Harald Welte40152872010-05-16 20:52:23 +02001241 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001242
1243 if (enable && ipacc_rtp_direct) {
Harald Welteaa2c3032009-12-20 13:51:01 +01001244 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1245 "is enabled by using the -P command line option%s",
1246 VTY_NEWLINE);
1247 return CMD_WARNING;
1248 }
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001249 gsmnet->handover.active = enable;
Harald Welte0af9c9f2009-12-19 21:41:52 +01001250
1251 return CMD_SUCCESS;
1252}
1253
Harald Welte9e002452010-05-11 21:53:49 +02001254#define HO_WIN_STR HANDOVER_STR "Measurement Window\n"
1255#define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n"
1256#define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n"
1257#define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n"
1258
Harald Weltea8062f12009-12-21 16:51:50 +01001259DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1260 "handover window rxlev averaging <1-10>",
Harald Welte9e002452010-05-11 21:53:49 +02001261 HO_WIN_RXLEV_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001262 "How many RxLev measurements are used for averaging")
1263{
Harald Welte40152872010-05-16 20:52:23 +02001264 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001265 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1266 return CMD_SUCCESS;
1267}
1268
1269DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1270 "handover window rxqual averaging <1-10>",
Harald Welte9e002452010-05-11 21:53:49 +02001271 HO_WIN_RXQUAL_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001272 "How many RxQual measurements are used for averaging")
1273{
Harald Welte40152872010-05-16 20:52:23 +02001274 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001275 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1276 return CMD_SUCCESS;
1277}
1278
1279DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1280 "handover window rxlev neighbor averaging <1-10>",
Harald Welte9e002452010-05-11 21:53:49 +02001281 HO_WIN_RXLEV_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001282 "How many RxQual measurements are used for averaging")
1283{
Harald Welte40152872010-05-16 20:52:23 +02001284 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001285 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1286 return CMD_SUCCESS;
1287}
1288
1289DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1290 "handover power budget interval <1-99>",
Harald Welte9e002452010-05-11 21:53:49 +02001291 HO_PBUDGET_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001292 "How often to check if we have a better cell (SACCH frames)")
1293{
Harald Welte40152872010-05-16 20:52:23 +02001294 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001295 gsmnet->handover.pwr_interval = atoi(argv[0]);
1296 return CMD_SUCCESS;
1297}
1298
1299DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1300 "handover power budget hysteresis <0-999>",
Harald Welte9e002452010-05-11 21:53:49 +02001301 HO_PBUDGET_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001302 "How many dB does a neighbor to be stronger to become a HO candidate")
1303{
Harald Welte40152872010-05-16 20:52:23 +02001304 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001305 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1306 return CMD_SUCCESS;
1307}
1308
1309DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1310 "handover maximum distance <0-9999>",
Harald Welte9e002452010-05-11 21:53:49 +02001311 HANDOVER_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001312 "How big is the maximum timing advance before HO is forced")
1313{
Harald Welte40152872010-05-16 20:52:23 +02001314 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001315 gsmnet->handover.max_distance = atoi(argv[0]);
1316 return CMD_SUCCESS;
1317}
Harald Welte0af9c9f2009-12-19 21:41:52 +01001318
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +08001319DEFUN(cfg_net_pag_any_tch,
1320 cfg_net_pag_any_tch_cmd,
1321 "paging any use tch (0|1)",
1322 "Assign a TCH when receiving a Paging Any request")
1323{
Holger Hans Peter Freytherc5628882010-09-06 10:09:19 +08001324 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +08001325 gsmnet->pag_any_tch = atoi(argv[0]);
1326 gsm_net_update_ctype(gsmnet);
1327 return CMD_SUCCESS;
1328}
1329
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001330#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001331 DEFUN(cfg_net_T##number, \
1332 cfg_net_T##number##_cmd, \
1333 "timer t" #number " <0-65535>", \
Harald Welte9e002452010-05-11 21:53:49 +02001334 "Configure GSM Timers\n" \
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001335 doc) \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001336{ \
Harald Welte40152872010-05-16 20:52:23 +02001337 struct gsm_network *gsmnet = gsmnet_from_vty(vty); \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001338 int value = atoi(argv[0]); \
1339 \
1340 if (value < 0 || value > 65535) { \
1341 vty_out(vty, "Timer value %s out of range.%s", \
1342 argv[0], VTY_NEWLINE); \
1343 return CMD_WARNING; \
1344 } \
1345 \
1346 gsmnet->T##number = value; \
1347 return CMD_SUCCESS; \
1348}
1349
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001350DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1351DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1352DECLARE_TIMER(3105, "Currently not used.")
1353DECLARE_TIMER(3107, "Currently not used.")
1354DECLARE_TIMER(3109, "Currently not used.")
Holger Hans Peter Freyther4a00c062010-05-31 21:33:15 +08001355DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel.")
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001356DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1357DECLARE_TIMER(3115, "Currently not used.")
1358DECLARE_TIMER(3117, "Currently not used.")
1359DECLARE_TIMER(3119, "Currently not used.")
Harald Weltea00fdd72010-12-23 14:39:29 +01001360DECLARE_TIMER(3122, "Waiting time (seconds) after IMM ASS REJECT")
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001361DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001362
Holger Hans Peter Freyther21d63ff2010-09-06 09:25:48 +08001363DEFUN(cfg_net_dtx,
1364 cfg_net_dtx_cmd,
1365 "dtx-used (0|1)",
1366 "Enable the usage of DTX.\n"
1367 "DTX is enabled/disabled")
1368{
1369 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1370 gsmnet->dtx_enabled = atoi(argv[0]);
1371 return CMD_SUCCESS;
1372}
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001373
Holger Hans Peter Freyther68b21e12010-12-22 16:26:04 +01001374DEFUN(cfg_net_subscr_keep,
1375 cfg_net_subscr_keep_cmd,
1376 "subscriber-keep-in-ram (0|1)",
1377 "Keep unused subscribers in RAM.\n"
1378 "Delete unused subscribers\n" "Keep unused subscribers\n")
1379{
1380 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1381 gsmnet->keep_subscr = atoi(argv[0]);
1382 return CMD_SUCCESS;
1383}
1384
Harald Welte59b04682009-06-10 05:40:52 +08001385/* per-BTS configuration */
1386DEFUN(cfg_bts,
1387 cfg_bts_cmd,
1388 "bts BTS_NR",
Harald Welte9e002452010-05-11 21:53:49 +02001389 "Select a BTS to configure\n"
1390 "BTS Number\n")
Harald Welte59b04682009-06-10 05:40:52 +08001391{
Harald Welte40152872010-05-16 20:52:23 +02001392 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +08001393 int bts_nr = atoi(argv[0]);
1394 struct gsm_bts *bts;
1395
Harald Weltee712a5f2009-06-21 16:17:15 +02001396 if (bts_nr > gsmnet->num_bts) {
1397 vty_out(vty, "%% The next unused BTS number is %u%s",
1398 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +08001399 return CMD_WARNING;
Harald Weltee712a5f2009-06-21 16:17:15 +02001400 } else if (bts_nr == gsmnet->num_bts) {
1401 /* allocate a new one */
1402 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1403 HARDCODED_TSC, HARDCODED_BSIC);
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +02001404 } else
Harald Weltee712a5f2009-06-21 16:17:15 +02001405 bts = gsm_bts_num(gsmnet, bts_nr);
1406
Daniel Willmann580085f2010-01-11 13:43:07 +01001407 if (!bts) {
1408 vty_out(vty, "%% Unable to allocate BTS %u%s",
1409 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee712a5f2009-06-21 16:17:15 +02001410 return CMD_WARNING;
Daniel Willmann580085f2010-01-11 13:43:07 +01001411 }
Harald Welte59b04682009-06-10 05:40:52 +08001412
1413 vty->index = bts;
Harald Welte8791dac2010-05-14 17:59:53 +02001414 vty->index_sub = &bts->description;
Harald Welte59b04682009-06-10 05:40:52 +08001415 vty->node = BTS_NODE;
1416
1417 return CMD_SUCCESS;
1418}
1419
1420DEFUN(cfg_bts_type,
1421 cfg_bts_type_cmd,
1422 "type TYPE",
1423 "Set the BTS type\n")
1424{
1425 struct gsm_bts *bts = vty->index;
Harald Welte59698fb2010-01-10 18:01:52 +01001426 int rc;
Harald Welte59b04682009-06-10 05:40:52 +08001427
Harald Welte59698fb2010-01-10 18:01:52 +01001428 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1429 if (rc < 0)
1430 return CMD_WARNING;
Harald Welte25572872009-10-20 00:22:00 +02001431
Harald Welte59b04682009-06-10 05:40:52 +08001432 return CMD_SUCCESS;
1433}
1434
Harald Welte91afe4c2009-06-20 18:15:19 +02001435DEFUN(cfg_bts_band,
1436 cfg_bts_band_cmd,
1437 "band BAND",
1438 "Set the frequency band of this BTS\n")
1439{
1440 struct gsm_bts *bts = vty->index;
Harald Welte62868882009-08-08 16:12:58 +02001441 int band = gsm_band_parse(argv[0]);
Harald Welte91afe4c2009-06-20 18:15:19 +02001442
1443 if (band < 0) {
1444 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1445 band, VTY_NEWLINE);
1446 return CMD_WARNING;
1447 }
1448
1449 bts->band = band;
1450
1451 return CMD_SUCCESS;
1452}
1453
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +02001454DEFUN(cfg_bts_ci,
1455 cfg_bts_ci_cmd,
1456 "cell_identity <0-65535>",
1457 "Set the Cell identity of this BTS\n")
1458{
1459 struct gsm_bts *bts = vty->index;
1460 int ci = atoi(argv[0]);
1461
1462 if (ci < 0 || ci > 0xffff) {
1463 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1464 ci, VTY_NEWLINE);
1465 return CMD_WARNING;
1466 }
1467 bts->cell_identity = ci;
1468
1469 return CMD_SUCCESS;
1470}
1471
Harald Welte59b04682009-06-10 05:40:52 +08001472DEFUN(cfg_bts_lac,
1473 cfg_bts_lac_cmd,
Holger Hans Peter Freyther54a22832009-09-29 14:02:33 +02001474 "location_area_code <0-65535>",
Harald Welte59b04682009-06-10 05:40:52 +08001475 "Set the Location Area Code (LAC) of this BTS\n")
1476{
1477 struct gsm_bts *bts = vty->index;
1478 int lac = atoi(argv[0]);
1479
Holger Hans Peter Freyther54a22832009-09-29 14:02:33 +02001480 if (lac < 0 || lac > 0xffff) {
1481 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte59b04682009-06-10 05:40:52 +08001482 lac, VTY_NEWLINE);
1483 return CMD_WARNING;
1484 }
Holger Hans Peter Freyther6c6ab862009-10-01 04:07:15 +02001485
1486 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1487 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1488 lac, VTY_NEWLINE);
1489 return CMD_WARNING;
1490 }
1491
Harald Welte59b04682009-06-10 05:40:52 +08001492 bts->location_area_code = lac;
1493
1494 return CMD_SUCCESS;
1495}
1496
Harald Weltea54a2bb2009-12-01 18:04:30 +05301497
Harald Welte59b04682009-06-10 05:40:52 +08001498DEFUN(cfg_bts_tsc,
1499 cfg_bts_tsc_cmd,
1500 "training_sequence_code <0-255>",
1501 "Set the Training Sequence Code (TSC) of this BTS\n")
1502{
1503 struct gsm_bts *bts = vty->index;
1504 int tsc = atoi(argv[0]);
1505
1506 if (tsc < 0 || tsc > 0xff) {
1507 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1508 tsc, VTY_NEWLINE);
1509 return CMD_WARNING;
1510 }
1511 bts->tsc = tsc;
1512
1513 return CMD_SUCCESS;
1514}
1515
1516DEFUN(cfg_bts_bsic,
1517 cfg_bts_bsic_cmd,
1518 "base_station_id_code <0-63>",
1519 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1520{
1521 struct gsm_bts *bts = vty->index;
1522 int bsic = atoi(argv[0]);
1523
1524 if (bsic < 0 || bsic > 0x3f) {
Harald Welte62868882009-08-08 16:12:58 +02001525 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte59b04682009-06-10 05:40:52 +08001526 bsic, VTY_NEWLINE);
1527 return CMD_WARNING;
1528 }
1529 bts->bsic = bsic;
1530
1531 return CMD_SUCCESS;
1532}
1533
1534
1535DEFUN(cfg_bts_unit_id,
1536 cfg_bts_unit_id_cmd,
Harald Weltef515aa02009-08-07 13:27:09 +02001537 "ip.access unit_id <0-65534> <0-255>",
1538 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte59b04682009-06-10 05:40:52 +08001539{
1540 struct gsm_bts *bts = vty->index;
1541 int site_id = atoi(argv[0]);
1542 int bts_id = atoi(argv[1]);
1543
Harald Weltef515aa02009-08-07 13:27:09 +02001544 if (!is_ipaccess_bts(bts)) {
1545 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1546 return CMD_WARNING;
1547 }
1548
Harald Welte59b04682009-06-10 05:40:52 +08001549 bts->ip_access.site_id = site_id;
1550 bts->ip_access.bts_id = bts_id;
1551
1552 return CMD_SUCCESS;
1553}
1554
Harald Welte9e002452010-05-11 21:53:49 +02001555#define OML_STR "Organization & Maintenance Link\n"
1556#define IPA_STR "ip.access Specific Options\n"
1557
Harald Welte25572872009-10-20 00:22:00 +02001558DEFUN(cfg_bts_stream_id,
1559 cfg_bts_stream_id_cmd,
1560 "oml ip.access stream_id <0-255>",
Harald Welte9e002452010-05-11 21:53:49 +02001561 OML_STR IPA_STR
Harald Welte25572872009-10-20 00:22:00 +02001562 "Set the ip.access Stream ID of the OML link of this BTS\n")
1563{
1564 struct gsm_bts *bts = vty->index;
1565 int stream_id = atoi(argv[0]);
1566
1567 if (!is_ipaccess_bts(bts)) {
1568 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1569 return CMD_WARNING;
1570 }
1571
1572 bts->oml_tei = stream_id;
1573
1574 return CMD_SUCCESS;
1575}
1576
Harald Welte9e002452010-05-11 21:53:49 +02001577#define OML_E1_STR OML_STR "E1 Line\n"
Harald Welte25572872009-10-20 00:22:00 +02001578
Harald Welte62868882009-08-08 16:12:58 +02001579DEFUN(cfg_bts_oml_e1,
1580 cfg_bts_oml_e1_cmd,
1581 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte9e002452010-05-11 21:53:49 +02001582 OML_E1_STR
Harald Welte62868882009-08-08 16:12:58 +02001583 "E1 interface to be used for OML\n")
1584{
1585 struct gsm_bts *bts = vty->index;
1586
1587 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1588
1589 return CMD_SUCCESS;
1590}
1591
1592
1593DEFUN(cfg_bts_oml_e1_tei,
1594 cfg_bts_oml_e1_tei_cmd,
1595 "oml e1 tei <0-63>",
Harald Welte9e002452010-05-11 21:53:49 +02001596 OML_E1_STR
Harald Welte62868882009-08-08 16:12:58 +02001597 "Set the TEI to be used for OML")
1598{
1599 struct gsm_bts *bts = vty->index;
1600
1601 bts->oml_tei = atoi(argv[0]);
1602
1603 return CMD_SUCCESS;
1604}
1605
Harald Welte3e774612009-08-10 13:48:16 +02001606DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1607 "channel allocator (ascending|descending)",
Harald Welte9e002452010-05-11 21:53:49 +02001608 "Channnel Allocator\n" "Channel Allocator\n"
1609 "Allocate Timeslots and Transceivers in ascending order\n"
1610 "Allocate Timeslots and Transceivers in descending order\n")
Harald Welte3e774612009-08-10 13:48:16 +02001611{
1612 struct gsm_bts *bts = vty->index;
1613
1614 if (!strcmp(argv[0], "ascending"))
1615 bts->chan_alloc_reverse = 0;
1616 else
1617 bts->chan_alloc_reverse = 1;
1618
1619 return CMD_SUCCESS;
1620}
1621
Harald Welte9e002452010-05-11 21:53:49 +02001622#define RACH_STR "Random Access Control Channel\n"
1623
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001624DEFUN(cfg_bts_rach_tx_integer,
1625 cfg_bts_rach_tx_integer_cmd,
1626 "rach tx integer <0-15>",
Harald Welte9e002452010-05-11 21:53:49 +02001627 RACH_STR
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001628 "Set the raw tx integer value in RACH Control parameters IE")
1629{
1630 struct gsm_bts *bts = vty->index;
1631 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1632 return CMD_SUCCESS;
1633}
1634
1635DEFUN(cfg_bts_rach_max_trans,
1636 cfg_bts_rach_max_trans_cmd,
1637 "rach max transmission (1|2|4|7)",
Harald Welte9e002452010-05-11 21:53:49 +02001638 RACH_STR
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001639 "Set the maximum number of RACH burst transmissions")
1640{
1641 struct gsm_bts *bts = vty->index;
1642 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1643 return CMD_SUCCESS;
1644}
1645
Harald Welte9e002452010-05-11 21:53:49 +02001646#define NM_STR "Network Management\n"
1647
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08001648DEFUN(cfg_bts_rach_nm_b_thresh,
1649 cfg_bts_rach_nm_b_thresh_cmd,
1650 "rach nm busy threshold <0-255>",
Harald Welte9e002452010-05-11 21:53:49 +02001651 RACH_STR NM_STR
1652 "Set the NM Busy Threshold in dB")
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08001653{
1654 struct gsm_bts *bts = vty->index;
1655 bts->rach_b_thresh = atoi(argv[0]);
1656 return CMD_SUCCESS;
1657}
1658
1659DEFUN(cfg_bts_rach_nm_ldavg,
1660 cfg_bts_rach_nm_ldavg_cmd,
1661 "rach nm load average <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001662 RACH_STR NM_STR
1663 "Set the NM Loadaverage Slots value")
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08001664{
1665 struct gsm_bts *bts = vty->index;
1666 bts->rach_ldavg_slots = atoi(argv[0]);
1667 return CMD_SUCCESS;
1668}
1669
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02001670DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1671 "cell barred (0|1)",
1672 "Should this cell be barred from access?")
1673{
1674 struct gsm_bts *bts = vty->index;
1675
Harald Welte8c973ba2009-12-21 23:08:18 +01001676 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02001677
1678 return CMD_SUCCESS;
1679}
1680
Holger Hans Peter Freyther440984b2010-05-14 00:39:19 +08001681DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd,
1682 "rach emergency call allowed (0|1)",
1683 "Should this cell allow emergency calls?")
1684{
1685 struct gsm_bts *bts = vty->index;
1686
1687 if (atoi(argv[0]) == 0)
1688 bts->si_common.rach_control.t2 |= 0x4;
1689 else
1690 bts->si_common.rach_control.t2 &= ~0x4;
1691
1692 return CMD_SUCCESS;
1693}
1694
Harald Welte (local)cbd46102009-08-13 10:14:26 +02001695DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1696 "ms max power <0-40>",
1697 "Maximum transmit power of the MS")
1698{
1699 struct gsm_bts *bts = vty->index;
1700
1701 bts->ms_max_power = atoi(argv[0]);
1702
1703 return CMD_SUCCESS;
1704}
1705
Harald Welteb761bf82009-12-12 18:17:25 +01001706DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1707 "cell reselection hysteresis <0-14>",
1708 "Cell Re-Selection Hysteresis in dB")
1709{
1710 struct gsm_bts *bts = vty->index;
1711
1712 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1713
1714 return CMD_SUCCESS;
1715}
1716
1717DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1718 "rxlev access min <0-63>",
1719 "Minimum RxLev needed for cell access (better than -110dBm)")
1720{
1721 struct gsm_bts *bts = vty->index;
1722
1723 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1724
1725 return CMD_SUCCESS;
1726}
1727
Sylvain Munaut00d71462010-11-28 18:17:28 +01001728DEFUN(cfg_bts_cell_bar_qualify, cfg_bts_cell_bar_qualify_cmd,
1729 "cell bar qualify (0|1)",
1730 "Cell Bar Qualify")
1731{
1732 struct gsm_bts *bts = vty->index;
1733
1734 bts->si_common.cell_ro_sel_par.present = 1;
1735 bts->si_common.cell_ro_sel_par.cbq = atoi(argv[0]);
1736
1737 return CMD_SUCCESS;
1738}
1739
1740DEFUN(cfg_bts_cell_resel_ofs, cfg_bts_cell_resel_ofs_cmd,
1741 "cell reselection offset <0-126>",
1742 "Cell Re-Selection Offset in dB")
1743{
1744 struct gsm_bts *bts = vty->index;
1745
1746 bts->si_common.cell_ro_sel_par.present = 1;
1747 bts->si_common.cell_ro_sel_par.cell_resel_off = atoi(argv[0])/2;
1748
1749 return CMD_SUCCESS;
1750}
1751
1752DEFUN(cfg_bts_temp_ofs, cfg_bts_temp_ofs_cmd,
1753 "temporary offset <0-60>",
1754 "Cell selection temporary negative offset in dB")
1755{
1756 struct gsm_bts *bts = vty->index;
1757
1758 bts->si_common.cell_ro_sel_par.present = 1;
1759 bts->si_common.cell_ro_sel_par.temp_offs = atoi(argv[0])/10;
1760
1761 return CMD_SUCCESS;
1762}
1763
1764DEFUN(cfg_bts_temp_ofs_inf, cfg_bts_temp_ofs_inf_cmd,
1765 "temporary offset infinite",
1766 "Sets cell selection temporary negative offset to infinity")
1767{
1768 struct gsm_bts *bts = vty->index;
1769
1770 bts->si_common.cell_ro_sel_par.present = 1;
1771 bts->si_common.cell_ro_sel_par.temp_offs = 7;
1772
1773 return CMD_SUCCESS;
1774}
1775
1776DEFUN(cfg_bts_penalty_time, cfg_bts_penalty_time_cmd,
1777 "penalty time <20-620>",
1778 "Cell selection penalty time in seconds (by 20s increments)")
1779{
1780 struct gsm_bts *bts = vty->index;
1781
1782 bts->si_common.cell_ro_sel_par.present = 1;
1783 bts->si_common.cell_ro_sel_par.penalty_time = (atoi(argv[0])-20)/20;
1784
1785 return CMD_SUCCESS;
1786}
1787
1788DEFUN(cfg_bts_penalty_time_rsvd, cfg_bts_penalty_time_rsvd_cmd,
1789 "penalty time reserved",
1790 "Set cell selection penalty time to reserved value 31\n"
1791 "(indicate that CELL_RESELECT_OFFSET is subtracted from C2 "
1792 "and TEMPORARY_OFFSET is ignored)")
1793{
1794 struct gsm_bts *bts = vty->index;
1795
1796 bts->si_common.cell_ro_sel_par.present = 1;
1797 bts->si_common.cell_ro_sel_par.penalty_time = 31;
1798
1799 return CMD_SUCCESS;
1800}
1801
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02001802DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1803 "periodic location update <0-1530>",
1804 "Periodic Location Updating Interval in Minutes")
1805{
1806 struct gsm_bts *bts = vty->index;
1807
Dieter Spaarb0f746d2010-10-05 21:10:55 +02001808 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 6;
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02001809
1810 return CMD_SUCCESS;
1811}
1812
Harald Welte9e002452010-05-11 21:53:49 +02001813#define GPRS_TEXT "GPRS Packet Network\n"
1814
Harald Welte410575a2010-03-14 23:30:30 +08001815DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welteb42fe342010-04-18 14:00:26 +02001816 "gprs cell bvci <2-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001817 GPRS_TEXT
1818 "GPRS Cell Settings\n"
Harald Welte3055e332010-03-14 15:37:43 +08001819 "GPRS BSSGP VC Identifier")
1820{
1821 struct gsm_bts *bts = vty->index;
1822
Harald Weltecb20b7a2010-04-18 15:51:20 +02001823 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001824 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1825 return CMD_WARNING;
1826 }
1827
Harald Welte3055e332010-03-14 15:37:43 +08001828 bts->gprs.cell.bvci = atoi(argv[0]);
1829
1830 return CMD_SUCCESS;
1831}
1832
Harald Welte4a048c52010-03-22 11:48:36 +08001833DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
1834 "gprs nsei <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001835 GPRS_TEXT
Harald Welte4a048c52010-03-22 11:48:36 +08001836 "GPRS NS Entity Identifier")
1837{
1838 struct gsm_bts *bts = vty->index;
1839
Harald Weltecb20b7a2010-04-18 15:51:20 +02001840 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte4a048c52010-03-22 11:48:36 +08001841 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1842 return CMD_WARNING;
1843 }
1844
1845 bts->gprs.nse.nsei = atoi(argv[0]);
1846
1847 return CMD_SUCCESS;
1848}
1849
Harald Welte9e002452010-05-11 21:53:49 +02001850#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
1851 "NSVC Logical Number\n"
Harald Welte4a048c52010-03-22 11:48:36 +08001852
Harald Welte3055e332010-03-14 15:37:43 +08001853DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
1854 "gprs nsvc <0-1> nsvci <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001855 GPRS_TEXT NSVC_TEXT
1856 "NS Virtual Connection Identifier\n"
Harald Welte3055e332010-03-14 15:37:43 +08001857 "GPRS NS VC Identifier")
1858{
1859 struct gsm_bts *bts = vty->index;
1860 int idx = atoi(argv[0]);
1861
Harald Weltecb20b7a2010-04-18 15:51:20 +02001862 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001863 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1864 return CMD_WARNING;
1865 }
1866
Harald Welte3055e332010-03-14 15:37:43 +08001867 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
1868
1869 return CMD_SUCCESS;
1870}
1871
Harald Welte410575a2010-03-14 23:30:30 +08001872DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
1873 "gprs nsvc <0-1> local udp port <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001874 GPRS_TEXT NSVC_TEXT
Harald Welte410575a2010-03-14 23:30:30 +08001875 "GPRS NS Local UDP Port")
1876{
1877 struct gsm_bts *bts = vty->index;
1878 int idx = atoi(argv[0]);
1879
Harald Weltecb20b7a2010-04-18 15:51:20 +02001880 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001881 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1882 return CMD_WARNING;
1883 }
1884
Harald Welte410575a2010-03-14 23:30:30 +08001885 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
1886
1887 return CMD_SUCCESS;
1888}
1889
1890DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
1891 "gprs nsvc <0-1> remote udp port <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001892 GPRS_TEXT NSVC_TEXT
Harald Welte410575a2010-03-14 23:30:30 +08001893 "GPRS NS Remote UDP Port")
1894{
1895 struct gsm_bts *bts = vty->index;
1896 int idx = atoi(argv[0]);
1897
Harald Weltecb20b7a2010-04-18 15:51:20 +02001898 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001899 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1900 return CMD_WARNING;
1901 }
1902
Harald Welte410575a2010-03-14 23:30:30 +08001903 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
1904
1905 return CMD_SUCCESS;
1906}
1907
1908DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
1909 "gprs nsvc <0-1> remote ip A.B.C.D",
Harald Welte9e002452010-05-11 21:53:49 +02001910 GPRS_TEXT NSVC_TEXT
Harald Welte410575a2010-03-14 23:30:30 +08001911 "GPRS NS Remote IP Address")
1912{
1913 struct gsm_bts *bts = vty->index;
1914 int idx = atoi(argv[0]);
1915 struct in_addr ia;
1916
Harald Weltecb20b7a2010-04-18 15:51:20 +02001917 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001918 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1919 return CMD_WARNING;
1920 }
1921
Harald Welte410575a2010-03-14 23:30:30 +08001922 inet_aton(argv[1], &ia);
1923 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
1924
1925 return CMD_SUCCESS;
1926}
1927
Holger Hans Peter Freyther3112f672010-09-06 10:11:25 +08001928DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd,
1929 "paging free FREE_NR",
1930 "Only page when having a certain amount of free slots. -1 to disable")
1931{
1932 struct gsm_bts *bts = vty->index;
1933
1934 bts->paging.free_chans_need = atoi(argv[0]);
1935 return CMD_SUCCESS;
1936}
1937
Harald Weltea9251762010-05-11 23:50:21 +02001938DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd,
1939 "gprs ns timer " NS_TIMERS " <0-255>",
1940 GPRS_TEXT "Network Service\n"
1941 "Network Service Timer\n"
1942 NS_TIMERS_HELP "Timer Value\n")
1943{
1944 struct gsm_bts *bts = vty->index;
1945 int idx = get_string_value(gprs_ns_timer_strs, argv[0]);
1946 int val = atoi(argv[1]);
1947
1948 if (bts->gprs.mode == BTS_GPRS_NONE) {
1949 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1950 return CMD_WARNING;
1951 }
1952
1953 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
1954 return CMD_WARNING;
1955
1956 bts->gprs.nse.timer[idx] = val;
1957
1958 return CMD_SUCCESS;
1959}
1960
1961#define BSSGP_TIMERS "(blocking-timer|blocking-retries|unblocking-retries|reset-timer|reset-retries|suspend-timer|suspend-retries|resume-timer|resume-retries|capability-update-timer|capability-update-retries)"
Harald Welte18ce31c2010-05-14 20:05:17 +02001962#define BSSGP_TIMERS_HELP \
1963 "Tbvc-block timeout\n" \
1964 "Tbvc-block retries\n" \
1965 "Tbvc-unblock retries\n" \
1966 "Tbvcc-reset timeout\n" \
1967 "Tbvc-reset retries\n" \
1968 "Tbvc-suspend timeout\n" \
1969 "Tbvc-suspend retries\n" \
1970 "Tbvc-resume timeout\n" \
1971 "Tbvc-resume retries\n" \
1972 "Tbvc-capa-update timeout\n" \
1973 "Tbvc-capa-update retries\n"
Harald Weltea9251762010-05-11 23:50:21 +02001974
1975DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd,
1976 "gprs cell timer " BSSGP_TIMERS " <0-255>",
1977 GPRS_TEXT "Cell / BSSGP\n"
1978 "Cell/BSSGP Timer\n"
1979 BSSGP_TIMERS_HELP "Timer Value\n")
1980{
1981 struct gsm_bts *bts = vty->index;
1982 int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
1983 int val = atoi(argv[1]);
1984
1985 if (bts->gprs.mode == BTS_GPRS_NONE) {
1986 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1987 return CMD_WARNING;
1988 }
1989
1990 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer))
1991 return CMD_WARNING;
1992
1993 bts->gprs.cell.timer[idx] = val;
1994
1995 return CMD_SUCCESS;
1996}
1997
Harald Welte3055e332010-03-14 15:37:43 +08001998DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
1999 "gprs routing area <0-255>",
Harald Welte9e002452010-05-11 21:53:49 +02002000 GPRS_TEXT
Harald Welte3055e332010-03-14 15:37:43 +08002001 "GPRS Routing Area Code")
2002{
2003 struct gsm_bts *bts = vty->index;
2004
Harald Weltecb20b7a2010-04-18 15:51:20 +02002005 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08002006 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2007 return CMD_WARNING;
2008 }
2009
Harald Welte3055e332010-03-14 15:37:43 +08002010 bts->gprs.rac = atoi(argv[0]);
2011
2012 return CMD_SUCCESS;
2013}
2014
Harald Weltecb20b7a2010-04-18 15:51:20 +02002015DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
2016 "gprs mode (none|gprs|egprs)",
Harald Welte9e002452010-05-11 21:53:49 +02002017 GPRS_TEXT
2018 "GPRS Mode for this BTS\n"
2019 "GPRS Disabled on this BTS\n"
2020 "GPRS Enabled on this BTS\n"
2021 "EGPRS (EDGE) Enabled on this BTS\n")
Harald Welte410575a2010-03-14 23:30:30 +08002022{
2023 struct gsm_bts *bts = vty->index;
Harald Welte20e275a2010-06-14 22:44:42 +02002024 enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0]);
Harald Welte410575a2010-03-14 23:30:30 +08002025
Harald Welte20e275a2010-06-14 22:44:42 +02002026 if (mode != BTS_GPRS_NONE &&
2027 !gsm_bts_has_feature(bts, BTS_FEAT_GPRS)) {
2028 vty_out(vty, "This BTS type does not support %s%s", argv[0],
2029 VTY_NEWLINE);
2030 return CMD_WARNING;
2031 }
2032 if (mode == BTS_GPRS_EGPRS &&
2033 !gsm_bts_has_feature(bts, BTS_FEAT_EGPRS)) {
2034 vty_out(vty, "This BTS type does not support %s%s", argv[0],
2035 VTY_NEWLINE);
2036 return CMD_WARNING;
2037 }
2038
2039 bts->gprs.mode = mode;
Harald Welte410575a2010-03-14 23:30:30 +08002040
2041 return CMD_SUCCESS;
2042}
2043
Harald Welted8acf142010-07-30 11:50:09 +02002044#define SI_TEXT "System Information Messages\n"
2045#define SI_TYPE_TEXT "(1|2|3|4|5|6|7|8|9|10|13|16|17|18|19|20|2bis|2ter|2quater|5bis|5ter)"
2046#define SI_TYPE_HELP "System Information Type 1\n" \
2047 "System Information Type 2\n" \
2048 "System Information Type 3\n" \
2049 "System Information Type 4\n" \
2050 "System Information Type 5\n" \
2051 "System Information Type 6\n" \
2052 "System Information Type 7\n" \
2053 "System Information Type 8\n" \
2054 "System Information Type 9\n" \
2055 "System Information Type 10\n" \
2056 "System Information Type 13\n" \
2057 "System Information Type 16\n" \
2058 "System Information Type 17\n" \
2059 "System Information Type 18\n" \
2060 "System Information Type 19\n" \
2061 "System Information Type 20\n" \
2062 "System Information Type 2bis\n" \
2063 "System Information Type 2ter\n" \
2064 "System Information Type 2quater\n" \
2065 "System Information Type 5bis\n" \
2066 "System Information Type 5ter\n"
2067
2068DEFUN(cfg_bts_si_mode, cfg_bts_si_mode_cmd,
2069 "system-information " SI_TYPE_TEXT " mode (static|computed)",
2070 SI_TEXT SI_TYPE_HELP
2071 "System Information Mode\n"
2072 "Static user-specified\n"
2073 "Dynamic, BSC-computed\n")
2074{
2075 struct gsm_bts *bts = vty->index;
2076 int type;
2077
2078 type = get_string_value(osmo_sitype_strs, argv[0]);
2079 if (type < 0) {
2080 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2081 return CMD_WARNING;
2082 }
2083
2084 if (!strcmp(argv[1], "static"))
2085 bts->si_mode_static |= (1 << type);
2086 else
2087 bts->si_mode_static &= ~(1 << type);
2088
2089 return CMD_SUCCESS;
2090}
2091
2092DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd,
2093 "system-information " SI_TYPE_TEXT " static HEXSTRING",
2094 SI_TEXT SI_TYPE_HELP
2095 "Static System Information filling\n"
2096 "Static user-specified SI content in HEX notation\n")
2097{
2098 struct gsm_bts *bts = vty->index;
2099 int rc, type;
2100
2101 type = get_string_value(osmo_sitype_strs, argv[0]);
2102 if (type < 0) {
2103 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2104 return CMD_WARNING;
2105 }
2106
2107 if (!(bts->si_mode_static & (1 << type))) {
2108 vty_out(vty, "SI Type %s is not configured in static mode%s",
2109 get_value_string(osmo_sitype_strs, type), VTY_NEWLINE);
2110 return CMD_WARNING;
2111 }
2112
Harald Welte9f09ac32010-07-30 11:53:18 +02002113 /* Fill buffer with padding pattern */
2114 memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type]));
2115
2116 /* Parse the user-specified SI in hex format, [partially] overwriting padding */
Harald Welted8acf142010-07-30 11:50:09 +02002117 rc = hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0]));
2118 if (rc < 0 || rc > sizeof(bts->si_buf[0])) {
2119 vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
2120 return CMD_WARNING;
2121 }
2122
2123 /* Mark this SI as present */
2124 bts->si_valid |= (1 << type);
2125
2126 return CMD_SUCCESS;
2127}
2128
Harald Welteca46eff2011-01-11 23:44:56 +01002129DEFUN(cfg_bts_neigh_mode, cfg_bts_neigh_mode_cmd,
2130 "neighbor-list mode (automatic|manual)",
2131 "Neighbor List\n" "Mode of Neighbor List generation\n"
2132 "Automatically from all BTS in this OpenBSC\n" "Manual\n")
2133{
2134 struct gsm_bts *bts = vty->index;
2135
2136 if (!strcmp(argv[0], "manual")) {
2137 /* make sure we clear the current list when switching to
2138 * manual mode */
2139 if (bts->neigh_list_manual_mode == 0)
2140 memset(&bts->si_common.data.neigh_list, 0,
2141 sizeof(bts->si_common.data.neigh_list));
2142 bts->neigh_list_manual_mode = 1;
2143 } else
2144 bts->neigh_list_manual_mode = 0;
2145
2146 return CMD_SUCCESS;
2147}
2148
2149DEFUN(cfg_bts_neigh, cfg_bts_neigh_cmd,
2150 "neighbor-list (add|del) arfcn <0-1024>",
2151 "Neighbor List\n" "Add to manual neighbor list\n"
2152 "Delete from manual neighbor list\n" "ARFCN of neighbor\n"
2153 "ARFCN of neighbor\n")
2154{
2155 struct gsm_bts *bts = vty->index;
2156 struct bitvec *bv = &bts->si_common.neigh_list;
2157 uint16_t arfcn = atoi(argv[1]);
2158
2159 if (!bts->neigh_list_manual_mode) {
2160 vty_out(vty, "%% Cannot configure neighbor list in "
2161 "automatic mode%s", VTY_NEWLINE);
2162 return CMD_WARNING;
2163 }
2164
2165 if (!strcmp(argv[0], "add"))
2166 bitvec_set_bit_pos(bv, arfcn, 1);
2167 else
2168 bitvec_set_bit_pos(bv, arfcn, 0);
2169
2170 return CMD_SUCCESS;
2171}
2172
Harald Welted8acf142010-07-30 11:50:09 +02002173
Harald Welte9e002452010-05-11 21:53:49 +02002174#define TRX_TEXT "Radio Transceiver\n"
Harald Welte3e774612009-08-10 13:48:16 +02002175
Harald Welte59b04682009-06-10 05:40:52 +08002176/* per TRX configuration */
2177DEFUN(cfg_trx,
2178 cfg_trx_cmd,
2179 "trx TRX_NR",
Harald Welte9e002452010-05-11 21:53:49 +02002180 TRX_TEXT
Harald Welte59b04682009-06-10 05:40:52 +08002181 "Select a TRX to configure")
2182{
2183 int trx_nr = atoi(argv[0]);
2184 struct gsm_bts *bts = vty->index;
2185 struct gsm_bts_trx *trx;
2186
Harald Weltee712a5f2009-06-21 16:17:15 +02002187 if (trx_nr > bts->num_trx) {
2188 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
2189 bts->num_trx, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +08002190 return CMD_WARNING;
Harald Weltee712a5f2009-06-21 16:17:15 +02002191 } else if (trx_nr == bts->num_trx) {
2192 /* we need to allocate a new one */
2193 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +02002194 } else
Harald Weltee712a5f2009-06-21 16:17:15 +02002195 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +02002196
Harald Weltee712a5f2009-06-21 16:17:15 +02002197 if (!trx)
2198 return CMD_WARNING;
Harald Welte59b04682009-06-10 05:40:52 +08002199
2200 vty->index = trx;
Harald Welte8791dac2010-05-14 17:59:53 +02002201 vty->index_sub = &trx->description;
Harald Welte59b04682009-06-10 05:40:52 +08002202 vty->node = TRX_NODE;
2203
2204 return CMD_SUCCESS;
2205}
2206
2207DEFUN(cfg_trx_arfcn,
2208 cfg_trx_arfcn_cmd,
Harald Welte00044592010-05-14 19:00:52 +02002209 "arfcn <0-1024>",
Harald Welte59b04682009-06-10 05:40:52 +08002210 "Set the ARFCN for this TRX\n")
2211{
2212 int arfcn = atoi(argv[0]);
2213 struct gsm_bts_trx *trx = vty->index;
2214
2215 /* FIXME: check if this ARFCN is supported by this TRX */
2216
2217 trx->arfcn = arfcn;
2218
2219 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
2220 /* FIXME: use OML layer to update the ARFCN */
2221 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
2222
2223 return CMD_SUCCESS;
2224}
2225
Harald Welte (local)b709bfe2009-12-27 20:56:38 +01002226DEFUN(cfg_trx_nominal_power,
2227 cfg_trx_nominal_power_cmd,
2228 "nominal power <0-100>",
2229 "Nominal TRX RF Power in dB\n")
2230{
2231 struct gsm_bts_trx *trx = vty->index;
2232
2233 trx->nominal_power = atoi(argv[0]);
2234
2235 return CMD_SUCCESS;
2236}
2237
Harald Welte91afe4c2009-06-20 18:15:19 +02002238DEFUN(cfg_trx_max_power_red,
2239 cfg_trx_max_power_red_cmd,
2240 "max_power_red <0-100>",
2241 "Reduction of maximum BS RF Power in dB\n")
2242{
2243 int maxpwr_r = atoi(argv[0]);
2244 struct gsm_bts_trx *trx = vty->index;
Harald Welte01acd742009-11-18 09:20:22 +01002245 int upper_limit = 24; /* default 12.21 max power red. */
Harald Welte91afe4c2009-06-20 18:15:19 +02002246
2247 /* FIXME: check if our BTS type supports more than 12 */
2248 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
2249 vty_out(vty, "%% Power %d dB is not in the valid range%s",
2250 maxpwr_r, VTY_NEWLINE);
2251 return CMD_WARNING;
2252 }
2253 if (maxpwr_r & 1) {
2254 vty_out(vty, "%% Power %d dB is not an even value%s",
2255 maxpwr_r, VTY_NEWLINE);
2256 return CMD_WARNING;
2257 }
2258
2259 trx->max_power_red = maxpwr_r;
2260
2261 /* FIXME: make sure we update this using OML */
2262
2263 return CMD_SUCCESS;
2264}
2265
Harald Welte62868882009-08-08 16:12:58 +02002266DEFUN(cfg_trx_rsl_e1,
2267 cfg_trx_rsl_e1_cmd,
2268 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
2269 "E1 interface to be used for RSL\n")
2270{
2271 struct gsm_bts_trx *trx = vty->index;
2272
2273 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
2274
2275 return CMD_SUCCESS;
2276}
2277
2278DEFUN(cfg_trx_rsl_e1_tei,
2279 cfg_trx_rsl_e1_tei_cmd,
2280 "rsl e1 tei <0-63>",
2281 "Set the TEI to be used for RSL")
2282{
2283 struct gsm_bts_trx *trx = vty->index;
2284
2285 trx->rsl_tei = atoi(argv[0]);
2286
2287 return CMD_SUCCESS;
2288}
2289
Holger Hans Peter Freyther1c8b4802009-11-11 11:54:24 +01002290DEFUN(cfg_trx_rf_locked,
2291 cfg_trx_rf_locked_cmd,
2292 "rf_locked (0|1)",
2293 "Turn off RF of the TRX.\n")
2294{
2295 int locked = atoi(argv[0]);
2296 struct gsm_bts_trx *trx = vty->index;
2297
2298 gsm_trx_lock_rf(trx, locked);
2299 return CMD_SUCCESS;
2300}
Harald Welte62868882009-08-08 16:12:58 +02002301
Harald Welte59b04682009-06-10 05:40:52 +08002302/* per TS configuration */
2303DEFUN(cfg_ts,
2304 cfg_ts_cmd,
Harald Welte62868882009-08-08 16:12:58 +02002305 "timeslot <0-7>",
Harald Welte59b04682009-06-10 05:40:52 +08002306 "Select a Timeslot to configure")
2307{
2308 int ts_nr = atoi(argv[0]);
2309 struct gsm_bts_trx *trx = vty->index;
2310 struct gsm_bts_trx_ts *ts;
2311
2312 if (ts_nr >= TRX_NR_TS) {
2313 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
2314 TRX_NR_TS, VTY_NEWLINE);
2315 return CMD_WARNING;
2316 }
2317
2318 ts = &trx->ts[ts_nr];
2319
2320 vty->index = ts;
2321 vty->node = TS_NODE;
2322
2323 return CMD_SUCCESS;
2324}
2325
Harald Welte3ffe1b32009-08-07 00:25:23 +02002326DEFUN(cfg_ts_pchan,
2327 cfg_ts_pchan_cmd,
2328 "phys_chan_config PCHAN",
2329 "Physical Channel configuration (TCH/SDCCH/...)")
2330{
2331 struct gsm_bts_trx_ts *ts = vty->index;
2332 int pchanc;
2333
2334 pchanc = gsm_pchan_parse(argv[0]);
2335 if (pchanc < 0)
2336 return CMD_WARNING;
2337
2338 ts->pchan = pchanc;
2339
2340 return CMD_SUCCESS;
2341}
2342
Harald Weltea42a93f2010-06-14 22:26:10 +02002343#define HOPPING_STR "Configure frequency hopping\n"
2344
2345DEFUN(cfg_ts_hopping,
2346 cfg_ts_hopping_cmd,
2347 "hopping enabled (0|1)",
2348 HOPPING_STR "Enable or disable frequency hopping\n"
2349 "Disable frequency hopping\n" "Enable frequency hopping\n")
2350{
2351 struct gsm_bts_trx_ts *ts = vty->index;
Harald Welte059c1ef2010-06-14 22:47:37 +02002352 int enabled = atoi(argv[0]);
Harald Weltea42a93f2010-06-14 22:26:10 +02002353
Harald Welte059c1ef2010-06-14 22:47:37 +02002354 if (enabled && !gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_HOPPING)) {
2355 vty_out(vty, "BTS model does not support hopping%s",
2356 VTY_NEWLINE);
2357 return CMD_WARNING;
2358 }
2359
2360 ts->hopping.enabled = enabled;
Harald Weltea42a93f2010-06-14 22:26:10 +02002361
2362 return CMD_SUCCESS;
2363}
2364
Harald Welte67104d12009-09-12 13:05:33 +02002365DEFUN(cfg_ts_hsn,
2366 cfg_ts_hsn_cmd,
Harald Weltea42a93f2010-06-14 22:26:10 +02002367 "hopping sequence-number <0-63>",
2368 HOPPING_STR
Harald Welte67104d12009-09-12 13:05:33 +02002369 "Which hopping sequence to use for this channel")
2370{
2371 struct gsm_bts_trx_ts *ts = vty->index;
2372
2373 ts->hopping.hsn = atoi(argv[0]);
2374
2375 return CMD_SUCCESS;
2376}
2377
2378DEFUN(cfg_ts_maio,
2379 cfg_ts_maio_cmd,
2380 "hopping maio <0-63>",
Harald Weltea42a93f2010-06-14 22:26:10 +02002381 HOPPING_STR
Harald Welte67104d12009-09-12 13:05:33 +02002382 "Which hopping MAIO to use for this channel")
2383{
2384 struct gsm_bts_trx_ts *ts = vty->index;
2385
2386 ts->hopping.maio = atoi(argv[0]);
2387
2388 return CMD_SUCCESS;
2389}
2390
2391DEFUN(cfg_ts_arfcn_add,
2392 cfg_ts_arfcn_add_cmd,
2393 "hopping arfcn add <0-1023>",
Harald Weltea42a93f2010-06-14 22:26:10 +02002394 HOPPING_STR "Configure hopping ARFCN list\n"
2395 "Add an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte67104d12009-09-12 13:05:33 +02002396{
2397 struct gsm_bts_trx_ts *ts = vty->index;
2398 int arfcn = atoi(argv[0]);
2399
Harald Weltea42a93f2010-06-14 22:26:10 +02002400 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1);
2401
Harald Welte67104d12009-09-12 13:05:33 +02002402 return CMD_SUCCESS;
2403}
2404
2405DEFUN(cfg_ts_arfcn_del,
2406 cfg_ts_arfcn_del_cmd,
2407 "hopping arfcn del <0-1023>",
Harald Weltea42a93f2010-06-14 22:26:10 +02002408 HOPPING_STR "Configure hopping ARFCN list\n"
2409 "Delete an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte67104d12009-09-12 13:05:33 +02002410{
2411 struct gsm_bts_trx_ts *ts = vty->index;
2412 int arfcn = atoi(argv[0]);
2413
Harald Weltea42a93f2010-06-14 22:26:10 +02002414 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0);
2415
Harald Welte67104d12009-09-12 13:05:33 +02002416 return CMD_SUCCESS;
2417}
2418
Harald Welte3ffe1b32009-08-07 00:25:23 +02002419DEFUN(cfg_ts_e1_subslot,
2420 cfg_ts_e1_subslot_cmd,
Harald Welte62868882009-08-08 16:12:58 +02002421 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte3ffe1b32009-08-07 00:25:23 +02002422 "E1 sub-slot connected to this on-air timeslot")
2423{
2424 struct gsm_bts_trx_ts *ts = vty->index;
2425
Harald Welte62868882009-08-08 16:12:58 +02002426 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Welte3ffe1b32009-08-07 00:25:23 +02002427
2428 return CMD_SUCCESS;
2429}
Harald Welte59b04682009-06-10 05:40:52 +08002430
Harald Weltea5b1dae2010-05-16 21:47:13 +02002431void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
2432{
2433 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
2434 counter_get(net->stats.chreq.total),
2435 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
2436 vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
2437 counter_get(net->stats.chan.rf_fail),
2438 counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
2439 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
2440 counter_get(net->stats.paging.attempted),
2441 counter_get(net->stats.paging.completed),
2442 counter_get(net->stats.paging.expired), VTY_NEWLINE);
2443 vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
2444 counter_get(net->stats.bts.oml_fail),
2445 counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
2446}
2447
Harald Welte682ee5f2010-05-16 22:02:16 +02002448DEFUN(logging_fltr_imsi,
2449 logging_fltr_imsi_cmd,
2450 "logging filter imsi IMSI",
2451 LOGGING_STR FILTER_STR
2452 "Filter log messages by IMSI\n" "IMSI to be used as filter\n")
2453{
2454 struct telnet_connection *conn;
2455
2456 conn = (struct telnet_connection *) vty->priv;
2457 if (!conn->dbg) {
2458 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
2459 return CMD_WARNING;
2460 }
2461
2462 log_set_imsi_filter(conn->dbg, argv[0]);
2463 return CMD_SUCCESS;
2464}
2465
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02002466DEFUN(drop_bts,
2467 drop_bts_cmd,
Holger Hans Peter Freythere4ac0e42010-04-11 12:46:45 +02002468 "drop bts connection <0-65535> (oml|rsl)",
2469 "Debug/Simulation command to drop ipaccess BTS\n"
2470 "BTS NR\n" "Connection Type\n")
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02002471{
2472 struct gsm_network *gsmnet;
2473 struct gsm_bts_trx *trx;
2474 struct gsm_bts *bts;
2475 unsigned int bts_nr;
2476
2477 gsmnet = gsmnet_from_vty(vty);
2478
2479 bts_nr = atoi(argv[0]);
2480 if (bts_nr >= gsmnet->num_bts) {
2481 vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s",
2482 gsmnet->num_bts, bts_nr, VTY_NEWLINE);
2483 return CMD_WARNING;
2484 }
2485
2486 bts = gsm_bts_num(gsmnet, bts_nr);
2487 if (!bts) {
2488 vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE);
2489 return CMD_WARNING;
2490 }
2491
2492 if (!is_ipaccess_bts(bts)) {
2493 vty_out(vty, "This command only works for ipaccess.%s", VTY_NEWLINE);
2494 return CMD_WARNING;
2495 }
2496
2497
2498 /* close all connections */
2499 if (strcmp(argv[1], "oml") == 0) {
Holger Hans Peter Freyther03f17d02010-11-15 20:29:46 +01002500 ipaccess_drop_oml(bts);
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02002501 } else if (strcmp(argv[1], "rsl") == 0) {
2502 /* close all rsl connections */
2503 llist_for_each_entry(trx, &bts->trx_list, list) {
Holger Hans Peter Freyther03f17d02010-11-15 20:29:46 +01002504 ipaccess_drop_rsl(trx);
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02002505 }
2506 } else {
2507 vty_out(vty, "Argument must be 'oml# or 'rsl'.%s", VTY_NEWLINE);
2508 return CMD_WARNING;
2509 }
2510
2511 return CMD_SUCCESS;
2512}
2513
Harald Welte5213e992010-12-23 13:18:07 +01002514DEFUN(pdch_act, pdch_act_cmd,
2515 "bts <0-255> trx <0-255> timeslot <0-7> pdch (activate|deactivate)",
2516 "BTS related commands\n" "BTS Number\n" "Transceiver\n" "Transceiver Number\n"
2517 "TRX Timeslot\n" "Timeslot Number\n" "Packet Data Channel\n"
2518 "Activate Dynamic PDCH/TCH (-> PDCH mode)\n"
2519 "Deactivate Dynamic PDCH/TCH (-> TCH mode)\n")
2520{
2521 struct gsm_bts *bts;
2522 struct gsm_bts_trx *trx;
2523 struct gsm_bts_trx_ts *ts;
2524 int bts_nr = atoi(argv[0]);
2525 int trx_nr = atoi(argv[1]);
2526 int ts_nr = atoi(argv[2]);
2527 int activate;
2528
2529 bts = gsm_bts_num(bsc_gsmnet, bts_nr);
2530 if (!bts) {
2531 vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE);
2532 return CMD_WARNING;
2533 }
2534
2535 if (!is_ipaccess_bts(bts)) {
2536 vty_out(vty, "%% This command only works for ipaccess BTS%s",
2537 VTY_NEWLINE);
2538 return CMD_WARNING;
2539 }
2540
2541 trx = gsm_bts_trx_num(bts, trx_nr);
2542 if (!trx) {
2543 vty_out(vty, "%% No such TRX (%d)%s", trx_nr, VTY_NEWLINE);
2544 return CMD_WARNING;
2545 }
2546
2547 ts = &trx->ts[ts_nr];
2548 if (ts->pchan != GSM_PCHAN_TCH_F_PDCH) {
2549 vty_out(vty, "%% Timeslot %u is not in dynamic TCH_F/PDCH "
2550 "mode%s", ts_nr, VTY_NEWLINE);
2551 return CMD_WARNING;
2552 }
2553
2554 if (!strcmp(argv[3], "activate"))
2555 activate = 1;
2556 else
2557 activate = 0;
2558
2559 rsl_ipacc_pdch_activate(ts, activate);
2560
2561 return CMD_SUCCESS;
2562
2563}
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02002564
Harald Welte40152872010-05-16 20:52:23 +02002565extern int bsc_vty_init_extra(void);
Harald Welte10c29f62010-05-16 19:20:24 +02002566extern const char *openbsc_copyright;
Holger Hans Peter Freytherc48a2a12010-04-10 00:08:28 +02002567
Harald Welte40152872010-05-16 20:52:23 +02002568int bsc_vty_init(void)
Harald Welte59b04682009-06-10 05:40:52 +08002569{
Harald Welte7bc28f62010-05-12 16:10:35 +00002570 install_element_ve(&show_net_cmd);
2571 install_element_ve(&show_bts_cmd);
2572 install_element_ve(&show_trx_cmd);
2573 install_element_ve(&show_ts_cmd);
2574 install_element_ve(&show_lchan_cmd);
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +08002575 install_element_ve(&show_lchan_summary_cmd);
Harald Welte682ee5f2010-05-16 22:02:16 +02002576 install_element_ve(&logging_fltr_imsi_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002577
Harald Welte7bc28f62010-05-12 16:10:35 +00002578 install_element_ve(&show_e1drv_cmd);
2579 install_element_ve(&show_e1line_cmd);
2580 install_element_ve(&show_e1ts_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002581
Harald Welte7bc28f62010-05-12 16:10:35 +00002582 install_element_ve(&show_paging_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002583
Harald Welte682ee5f2010-05-16 22:02:16 +02002584 logging_vty_add_cmds();
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +01002585
Harald Weltee87eb462009-08-07 13:29:14 +02002586 install_element(CONFIG_NODE, &cfg_net_cmd);
2587 install_node(&net_node, config_write_net);
2588 install_default(GSMNET_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002589 install_element(GSMNET_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002590 install_element(GSMNET_NODE, &ournode_end_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002591 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Weltee87eb462009-08-07 13:29:14 +02002592 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
2593 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
2594 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02002595 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte59936d72009-11-18 20:33:19 +01002596 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Weltecca253a2009-08-30 15:47:06 +09002597 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01002598 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welte52af1952009-12-13 10:53:12 +01002599 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte284ddba2009-12-14 17:49:15 +01002600 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Welte0af9c9f2009-12-19 21:41:52 +01002601 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Weltea8062f12009-12-21 16:51:50 +01002602 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
2603 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
2604 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
2605 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
2606 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
2607 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01002608 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +01002609 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
2610 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
2611 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
2612 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
2613 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
2614 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
2615 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
2616 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
2617 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
Harald Weltee2aaf442010-12-23 22:53:50 +01002618 install_element(GSMNET_NODE, &cfg_net_T3122_cmd);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +01002619 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Holger Hans Peter Freyther21d63ff2010-09-06 09:25:48 +08002620 install_element(GSMNET_NODE, &cfg_net_dtx_cmd);
Holger Hans Peter Freyther68b21e12010-12-22 16:26:04 +01002621 install_element(GSMNET_NODE, &cfg_net_subscr_keep_cmd);
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +08002622 install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd);
Harald Weltee87eb462009-08-07 13:29:14 +02002623
2624 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte97ceef92009-08-06 19:06:46 +02002625 install_node(&bts_node, config_write_bts);
Harald Welte59b04682009-06-10 05:40:52 +08002626 install_default(BTS_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002627 install_element(BTS_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002628 install_element(BTS_NODE, &ournode_end_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002629 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte8791dac2010-05-14 17:59:53 +02002630 install_element(BTS_NODE, &cfg_description_cmd);
2631 install_element(BTS_NODE, &cfg_no_description_cmd);
Harald Welte91afe4c2009-06-20 18:15:19 +02002632 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +02002633 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002634 install_element(BTS_NODE, &cfg_bts_lac_cmd);
2635 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002636 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002637 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte25572872009-10-20 00:22:00 +02002638 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002639 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
2640 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte3e774612009-08-10 13:48:16 +02002641 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01002642 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
2643 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08002644 install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd);
2645 install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd);
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02002646 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Holger Hans Peter Freyther440984b2010-05-14 00:39:19 +08002647 install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd);
Harald Welte (local)cbd46102009-08-13 10:14:26 +02002648 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02002649 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welteb761bf82009-12-12 18:17:25 +01002650 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
2651 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Sylvain Munaut00d71462010-11-28 18:17:28 +01002652 install_element(BTS_NODE, &cfg_bts_cell_bar_qualify_cmd);
2653 install_element(BTS_NODE, &cfg_bts_cell_resel_ofs_cmd);
2654 install_element(BTS_NODE, &cfg_bts_temp_ofs_cmd);
2655 install_element(BTS_NODE, &cfg_bts_temp_ofs_inf_cmd);
2656 install_element(BTS_NODE, &cfg_bts_penalty_time_cmd);
2657 install_element(BTS_NODE, &cfg_bts_penalty_time_rsvd_cmd);
Harald Weltecb20b7a2010-04-18 15:51:20 +02002658 install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
Harald Weltea9251762010-05-11 23:50:21 +02002659 install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd);
Harald Welte3055e332010-03-14 15:37:43 +08002660 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
2661 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Weltea9251762010-05-11 23:50:21 +02002662 install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
Harald Welte4a048c52010-03-22 11:48:36 +08002663 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte3055e332010-03-14 15:37:43 +08002664 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welte410575a2010-03-14 23:30:30 +08002665 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
2666 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
2667 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Holger Hans Peter Freyther3112f672010-09-06 10:11:25 +08002668 install_element(BTS_NODE, &cfg_bts_pag_free_cmd);
Harald Welted8acf142010-07-30 11:50:09 +02002669 install_element(BTS_NODE, &cfg_bts_si_mode_cmd);
2670 install_element(BTS_NODE, &cfg_bts_si_static_cmd);
Harald Welteca46eff2011-01-11 23:44:56 +01002671 install_element(BTS_NODE, &cfg_bts_neigh_mode_cmd);
2672 install_element(BTS_NODE, &cfg_bts_neigh_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002673
2674 install_element(BTS_NODE, &cfg_trx_cmd);
2675 install_node(&trx_node, dummy_config_write);
2676 install_default(TRX_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002677 install_element(TRX_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002678 install_element(TRX_NODE, &ournode_end_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002679 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte8791dac2010-05-14 17:59:53 +02002680 install_element(TRX_NODE, &cfg_description_cmd);
2681 install_element(TRX_NODE, &cfg_no_description_cmd);
Harald Welte (local)b709bfe2009-12-27 20:56:38 +01002682 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte7f597bc2009-06-20 22:36:12 +02002683 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002684 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
2685 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther1c8b4802009-11-11 11:54:24 +01002686 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002687
2688 install_element(TRX_NODE, &cfg_ts_cmd);
2689 install_node(&ts_node, dummy_config_write);
2690 install_default(TS_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002691 install_element(TS_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002692 install_element(TS_NODE, &ournode_end_cmd);
Harald Welte3ffe1b32009-08-07 00:25:23 +02002693 install_element(TS_NODE, &cfg_ts_pchan_cmd);
Harald Weltea42a93f2010-06-14 22:26:10 +02002694 install_element(TS_NODE, &cfg_ts_hopping_cmd);
Harald Welte67104d12009-09-12 13:05:33 +02002695 install_element(TS_NODE, &cfg_ts_hsn_cmd);
2696 install_element(TS_NODE, &cfg_ts_maio_cmd);
2697 install_element(TS_NODE, &cfg_ts_arfcn_add_cmd);
2698 install_element(TS_NODE, &cfg_ts_arfcn_del_cmd);
Harald Welte3ffe1b32009-08-07 00:25:23 +02002699 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002700
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02002701 install_element(ENABLE_NODE, &drop_bts_cmd);
Harald Welte5213e992010-12-23 13:18:07 +01002702 install_element(ENABLE_NODE, &pdch_act_cmd);
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02002703
Harald Welte63b964e2010-05-31 16:40:40 +02002704 abis_nm_vty_init();
2705
Harald Welte40152872010-05-16 20:52:23 +02002706 bsc_vty_init_extra();
Harald Welte59b04682009-06-10 05:40:52 +08002707
2708 return 0;
2709}