blob: a0c19b7ca4b2ee37c05f36858add77c41966eb7f [file] [log] [blame]
Harald Welte59b04682009-06-10 05:40:52 +08001/* OpenBSC interface to quagga VTY */
Harald Welte410575a2010-03-14 23:30:30 +08002/* (C) 2009-2010 by Harald Welte <laforge@gnumonks.org>
Harald Welte59b04682009-06-10 05:40:52 +08003 * All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#include <stdlib.h>
22#include <unistd.h>
23#include <sys/types.h>
24
Harald Weltebd9591f2010-05-19 19:45:32 +020025#include <osmocom/vty/command.h>
26#include <osmocom/vty/buffer.h>
27#include <osmocom/vty/vty.h>
28#include <osmocom/vty/logging.h>
29#include <osmocom/vty/telnet_interface.h>
Harald Welte59b04682009-06-10 05:40:52 +080030
31#include <arpa/inet.h>
32
Harald Weltef4625b12010-02-20 16:24:02 +010033#include <osmocore/linuxlist.h>
Harald Welte59b04682009-06-10 05:40:52 +080034#include <openbsc/gsm_data.h>
Harald Welte59b04682009-06-10 05:40:52 +080035#include <openbsc/e1_input.h>
36#include <openbsc/abis_nm.h>
Harald Welted8acf142010-07-30 11:50:09 +020037#include <osmocore/utils.h>
Harald Weltef4625b12010-02-20 16:24:02 +010038#include <osmocore/gsm_utils.h>
Harald Weltefe96f382009-12-22 13:09:29 +010039#include <openbsc/chan_alloc.h>
Harald Welte44007742009-12-22 21:43:14 +010040#include <openbsc/meas_rep.h>
Harald Welte59b04682009-06-10 05:40:52 +080041#include <openbsc/db.h>
Harald Weltef4625b12010-02-20 16:24:02 +010042#include <osmocore/talloc.h>
Holger Hans Peter Freytherb70d45b2010-04-06 11:55:37 +020043#include <openbsc/vty.h>
Harald Weltef45981f2010-05-12 20:28:04 +020044#include <openbsc/gprs_ns.h>
Harald Welted8acf142010-07-30 11:50:09 +020045#include <openbsc/system_information.h>
Harald Welte682ee5f2010-05-16 22:02:16 +020046#include <openbsc/debug.h>
Holger Hans Peter Freyther25176f12010-11-09 17:00:42 +010047#include <openbsc/paging.h>
Holger Hans Peter Freyther03f17d02010-11-15 20:29:46 +010048#include <openbsc/ipaccess.h>
Harald Welte5213e992010-12-23 13:18:07 +010049#include <openbsc/abis_rsl.h>
Harald Welte59b04682009-06-10 05:40:52 +080050
Harald Welte10c29f62010-05-16 19:20:24 +020051#include "../bscconfig.h"
52
Harald Welted6b62e32010-05-12 17:19:53 +000053/* FIXME: this should go to some common file */
54static const struct value_string gprs_ns_timer_strs[] = {
Harald Weltea9251762010-05-11 23:50:21 +020055 { 0, "tns-block" },
56 { 1, "tns-block-retries" },
57 { 2, "tns-reset" },
58 { 3, "tns-reset-retries" },
59 { 4, "tns-test" },
60 { 5, "tns-alive" },
61 { 6, "tns-alive-retries" },
62 { 0, NULL }
63};
64
Harald Welted6b62e32010-05-12 17:19:53 +000065static const struct value_string gprs_bssgp_cfg_strs[] = {
Harald Weltea9251762010-05-11 23:50:21 +020066 { 0, "blocking-timer" },
67 { 1, "blocking-retries" },
68 { 2, "unblocking-retries" },
69 { 3, "reset-timer" },
70 { 4, "reset-retries" },
71 { 5, "suspend-timer" },
72 { 6, "suspend-retries" },
73 { 7, "resume-timer" },
74 { 8, "resume-retries" },
75 { 9, "capability-update-timer" },
76 { 10, "capability-update-retries" },
77 { 0, NULL }
78};
79
Harald Weltee87eb462009-08-07 13:29:14 +020080struct cmd_node net_node = {
81 GSMNET_NODE,
82 "%s(network)#",
83 1,
84};
85
Harald Welte59b04682009-06-10 05:40:52 +080086struct cmd_node bts_node = {
87 BTS_NODE,
88 "%s(bts)#",
89 1,
90};
91
92struct cmd_node trx_node = {
93 TRX_NODE,
94 "%s(trx)#",
95 1,
96};
97
98struct cmd_node ts_node = {
99 TS_NODE,
100 "%s(ts)#",
101 1,
102};
103
Harald Welte61daf6d2010-05-27 13:39:40 +0200104extern struct gsm_network *bsc_gsmnet;
105
Harald Welte40152872010-05-16 20:52:23 +0200106struct gsm_network *gsmnet_from_vty(struct vty *v)
107{
Harald Welte61daf6d2010-05-27 13:39:40 +0200108 /* In case we read from the config file, the vty->priv cannot
109 * point to a struct telnet_connection, and thus conn->priv
110 * will not point to the gsm_network structure */
111#if 0
Harald Welte40152872010-05-16 20:52:23 +0200112 struct telnet_connection *conn = v->priv;
113 return (struct gsm_network *) conn->priv;
Harald Welte61daf6d2010-05-27 13:39:40 +0200114#else
115 return bsc_gsmnet;
116#endif
Harald Welte40152872010-05-16 20:52:23 +0200117}
118
Harald Welte59b04682009-06-10 05:40:52 +0800119static int dummy_config_write(struct vty *v)
120{
121 return CMD_SUCCESS;
122}
123
124static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
125{
126 vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s",
127 nm_opstate_name(nms->operational), nms->administrative,
128 nm_avail_name(nms->availability), VTY_NEWLINE);
129}
130
Harald Weltefe96f382009-12-22 13:09:29 +0100131static void dump_pchan_load_vty(struct vty *vty, char *prefix,
132 const struct pchan_load *pl)
133{
134 int i;
135
136 for (i = 0; i < ARRAY_SIZE(pl->pchan); i++) {
137 const struct load_counter *lc = &pl->pchan[i];
138 unsigned int percent;
139
140 if (lc->total == 0)
141 continue;
142
143 percent = (lc->used * 100) / lc->total;
144
145 vty_out(vty, "%s%20s: %3u%% (%u/%u)%s", prefix,
146 gsm_pchan_name(i), percent, lc->used, lc->total,
147 VTY_NEWLINE);
148 }
149}
150
Harald Welte59b04682009-06-10 05:40:52 +0800151static void net_dump_vty(struct vty *vty, struct gsm_network *net)
152{
Harald Weltefe96f382009-12-22 13:09:29 +0100153 struct pchan_load pl;
154
Harald Welte59b04682009-06-10 05:40:52 +0800155 vty_out(vty, "BSC is on Country Code %u, Network Code %u "
156 "and has %u BTS%s", net->country_code, net->network_code,
157 net->num_bts, VTY_NEWLINE);
158 vty_out(vty, " Long network name: '%s'%s",
159 net->name_long, VTY_NEWLINE);
160 vty_out(vty, " Short network name: '%s'%s",
161 net->name_short, VTY_NEWLINE);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +0200162 vty_out(vty, " Authentication policy: %s%s",
163 gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE);
Harald Welte59936d72009-11-18 20:33:19 +0100164 vty_out(vty, " Location updating reject cause: %u%s",
165 net->reject_cause, VTY_NEWLINE);
Harald Weltecca253a2009-08-30 15:47:06 +0900166 vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption,
167 VTY_NEWLINE);
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +0100168 vty_out(vty, " NECI (TCH/H): %u%s", net->neci,
169 VTY_NEWLINE);
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +0800170 vty_out(vty, " Use TCH for Paging any: %d%s", net->pag_any_tch,
171 VTY_NEWLINE);
Harald Welte52af1952009-12-13 10:53:12 +0100172 vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode),
173 VTY_NEWLINE);
Harald Weltea310f3e2009-12-14 09:00:24 +0100174 vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off",
175 VTY_NEWLINE);
Harald Welte0af9c9f2009-12-19 21:41:52 +0100176 vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off",
177 VTY_NEWLINE);
Harald Weltefe96f382009-12-22 13:09:29 +0100178 network_chan_load(&pl, net);
179 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
180 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte59b04682009-06-10 05:40:52 +0800181}
182
183DEFUN(show_net, show_net_cmd, "show network",
184 SHOW_STR "Display information about a GSM NETWORK\n")
185{
Harald Welte40152872010-05-16 20:52:23 +0200186 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800187 net_dump_vty(vty, net);
188
189 return CMD_SUCCESS;
190}
191
192static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l)
193{
194 struct e1inp_line *line;
195
196 if (!e1l) {
197 vty_out(vty, " None%s", VTY_NEWLINE);
198 return;
199 }
200
201 line = e1l->ts->line;
202
203 vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s",
204 line->num, line->driver->name, e1l->ts->num,
205 e1inp_signtype_name(e1l->type), VTY_NEWLINE);
206 vty_out(vty, " E1 TEI %u, SAPI %u%s",
207 e1l->tei, e1l->sapi, VTY_NEWLINE);
208}
209
210static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
211{
Harald Weltefe96f382009-12-22 13:09:29 +0100212 struct pchan_load pl;
213
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +0200214 vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
Harald Welte91afe4c2009-06-20 18:15:19 +0200215 "BSIC %u, TSC %u and %u TRX%s",
216 bts->nr, btstype2str(bts->type), gsm_band_name(bts->band),
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +0200217 bts->cell_identity,
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +0200218 bts->location_area_code, bts->bsic, bts->tsc,
Harald Welte91afe4c2009-06-20 18:15:19 +0200219 bts->num_trx, VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200220 vty_out(vty, "Description: %s%s",
221 bts->description ? bts->description : "(null)", VTY_NEWLINE);
Harald Welte8e9d1792009-12-12 15:38:16 +0100222 vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100223 vty_out(vty, "Minimum Rx Level for Access: %i dBm%s",
Harald Welte8e9d1792009-12-12 15:38:16 +0100224 rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min),
225 VTY_NEWLINE);
226 vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s",
Harald Welteb761bf82009-12-12 18:17:25 +0100227 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +0100228 vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer,
229 VTY_NEWLINE);
230 vty_out(vty, "RACH Max transmissions: %u%s",
231 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
232 VTY_NEWLINE);
Harald Welte8c973ba2009-12-21 23:08:18 +0100233 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)e19be3f2009-08-12 13:28:23 +0200234 vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE);
Harald Welted8acf142010-07-30 11:50:09 +0200235 vty_out(vty, "System Information present: 0x%08x, static: 0x%08x%s",
236 bts->si_valid, bts->si_mode_static, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800237 if (is_ipaccess_bts(bts))
Harald Welte25572872009-10-20 00:22:00 +0200238 vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
Harald Welte59b04682009-06-10 05:40:52 +0800239 bts->ip_access.site_id, bts->ip_access.bts_id,
Harald Welte25572872009-10-20 00:22:00 +0200240 bts->oml_tei, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800241 vty_out(vty, " NM State: ");
242 net_dump_nmstate(vty, &bts->nm_state);
243 vty_out(vty, " Site Mgr NM State: ");
244 net_dump_nmstate(vty, &bts->site_mgr.nm_state);
245 vty_out(vty, " Paging: FIXME pending requests, %u free slots%s",
246 bts->paging.available_slots, VTY_NEWLINE);
Holger Hans Peter Freytherb5c79c92010-11-25 16:28:45 +0100247 if (is_ipaccess_bts(bts)) {
248 vty_out(vty, " OML Link state: %s.%s",
249 bts->oml_link ? "connected" : "disconnected", VTY_NEWLINE);
250 } else {
Harald Welte25572872009-10-20 00:22:00 +0200251 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
252 e1isl_dump_vty(vty, bts->oml_link);
253 }
Holger Hans Peter Freytherb5c79c92010-11-25 16:28:45 +0100254
255 /* FIXME: chan_desc */
Harald Weltefe96f382009-12-22 13:09:29 +0100256 memset(&pl, 0, sizeof(pl));
257 bts_chan_load(&pl, bts);
258 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
259 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte59b04682009-06-10 05:40:52 +0800260}
261
262DEFUN(show_bts, show_bts_cmd, "show bts [number]",
263 SHOW_STR "Display information about a BTS\n"
264 "BTS number")
265{
Harald Welte40152872010-05-16 20:52:23 +0200266 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800267 int bts_nr;
268
269 if (argc != 0) {
270 /* use the BTS number that the user has specified */
271 bts_nr = atoi(argv[0]);
272 if (bts_nr > net->num_bts) {
273 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
274 VTY_NEWLINE);
275 return CMD_WARNING;
276 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200277 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte59b04682009-06-10 05:40:52 +0800278 return CMD_SUCCESS;
279 }
280 /* print all BTS's */
281 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee712a5f2009-06-21 16:17:15 +0200282 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte59b04682009-06-10 05:40:52 +0800283
284 return CMD_SUCCESS;
285}
286
Harald Welte62868882009-08-08 16:12:58 +0200287/* utility functions */
288static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
289 const char *ts, const char *ss)
290{
291 e1_link->e1_nr = atoi(line);
292 e1_link->e1_ts = atoi(ts);
293 if (!strcmp(ss, "full"))
294 e1_link->e1_ts_ss = 255;
295 else
296 e1_link->e1_ts_ss = atoi(ss);
297}
298
299static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,
300 const char *prefix)
301{
302 if (!e1_link->e1_ts)
303 return;
304
305 if (e1_link->e1_ts_ss == 255)
306 vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s",
307 prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE);
308 else
309 vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s",
310 prefix, e1_link->e1_nr, e1_link->e1_ts,
311 e1_link->e1_ts_ss, VTY_NEWLINE);
312}
313
314
Harald Welte97ceef92009-08-06 19:06:46 +0200315static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
316{
Harald Welte62868882009-08-08 16:12:58 +0200317 vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
318 if (ts->pchan != GSM_PCHAN_NONE)
319 vty_out(vty, " phys_chan_config %s%s",
320 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
Harald Weltea42a93f2010-06-14 22:26:10 +0200321 vty_out(vty, " hopping enabled %u%s",
322 ts->hopping.enabled, VTY_NEWLINE);
323 if (ts->hopping.enabled) {
324 unsigned int i;
325 vty_out(vty, " hopping sequence-number %u%s",
Harald Welte67104d12009-09-12 13:05:33 +0200326 ts->hopping.hsn, VTY_NEWLINE);
Harald Weltea42a93f2010-06-14 22:26:10 +0200327 vty_out(vty, " hopping maio %u%s",
Harald Welte67104d12009-09-12 13:05:33 +0200328 ts->hopping.maio, VTY_NEWLINE);
Harald Weltea42a93f2010-06-14 22:26:10 +0200329 for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) {
330 if (!bitvec_get_bit_pos(&ts->hopping.arfcns, i))
331 continue;
332 vty_out(vty, " hopping arfcn add %u%s",
333 i, VTY_NEWLINE);
334 }
335 } else
Harald Welte62868882009-08-08 16:12:58 +0200336 config_write_e1_link(vty, &ts->e1_link, " ");
Harald Welte97ceef92009-08-06 19:06:46 +0200337}
338
339static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
340{
341 int i;
342
Harald Weltee87eb462009-08-07 13:29:14 +0200343 vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200344 if (trx->description)
345 vty_out(vty, " description %s%s", trx->description,
346 VTY_NEWLINE);
Holger Hans Peter Freyther32be2aa2010-04-17 06:42:07 +0200347 vty_out(vty, " rf_locked %u%s",
348 trx->nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
349 VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200350 vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
Harald Welte (local)b709bfe2009-12-27 20:56:38 +0100351 vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200352 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200353 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
354 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte97ceef92009-08-06 19:06:46 +0200355
356 for (i = 0; i < TRX_NR_TS; i++)
357 config_write_ts_single(vty, &trx->ts[i]);
358}
359
Harald Weltea9251762010-05-11 23:50:21 +0200360static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
361{
362 unsigned int i;
363 vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode),
364 VTY_NEWLINE);
365 if (bts->gprs.mode == BTS_GPRS_NONE)
366 return;
367
368 vty_out(vty, " gprs routing area %u%s", bts->gprs.rac,
369 VTY_NEWLINE);
370 vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
371 VTY_NEWLINE);
372 for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++)
373 vty_out(vty, " gprs cell timer %s %u%s",
374 get_value_string(gprs_bssgp_cfg_strs, i),
375 bts->gprs.cell.timer[i], VTY_NEWLINE);
376 vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei,
377 VTY_NEWLINE);
378 for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++)
379 vty_out(vty, " gprs ns timer %s %u%s",
380 get_value_string(gprs_ns_timer_strs, i),
381 bts->gprs.nse.timer[i], VTY_NEWLINE);
382 for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
383 struct gsm_bts_gprs_nsvc *nsvc =
384 &bts->gprs.nsvc[i];
385 struct in_addr ia;
386
387 ia.s_addr = htonl(nsvc->remote_ip);
388 vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
389 nsvc->nsvci, VTY_NEWLINE);
390 vty_out(vty, " gprs nsvc %u local udp port %u%s", i,
391 nsvc->local_port, VTY_NEWLINE);
392 vty_out(vty, " gprs nsvc %u remote udp port %u%s", i,
393 nsvc->remote_port, VTY_NEWLINE);
394 vty_out(vty, " gprs nsvc %u remote ip %s%s", i,
395 inet_ntoa(ia), VTY_NEWLINE);
396 }
397}
398
Harald Welte97ceef92009-08-06 19:06:46 +0200399static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
400{
401 struct gsm_bts_trx *trx;
Harald Welted8acf142010-07-30 11:50:09 +0200402 int i;
Harald Welte97ceef92009-08-06 19:06:46 +0200403
Harald Weltee87eb462009-08-07 13:29:14 +0200404 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
405 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200406 if (bts->description)
407 vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200408 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freyther6d82b7c2009-11-19 16:38:49 +0100409 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200410 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte97ceef92009-08-06 19:06:46 +0200411 VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200412 vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE);
413 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)cbd46102009-08-13 10:14:26 +0200414 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100415 vty_out(vty, " cell reselection hysteresis %u%s",
416 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
417 vty_out(vty, " rxlev access min %u%s",
418 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Sylvain Munaut00d71462010-11-28 18:17:28 +0100419
420 if (bts->si_common.cell_ro_sel_par.present) {
421 struct gsm48_si_selection_params *sp;
422 sp = &bts->si_common.cell_ro_sel_par;
423
424 if (sp->cbq)
425 vty_out(vty, " cell bar qualify %u%s",
426 sp->cbq, VTY_NEWLINE);
427
428 if (sp->cell_resel_off)
429 vty_out(vty, " cell reselection offset %u%s",
430 sp->cell_resel_off*2, VTY_NEWLINE);
431
432 if (sp->temp_offs == 7)
433 vty_out(vty, " temporary offset infinite%s",
434 VTY_NEWLINE);
435 else if (sp->temp_offs)
436 vty_out(vty, " temporary offset %u%s",
437 sp->temp_offs*10, VTY_NEWLINE);
438
439 if (sp->penalty_time == 31)
440 vty_out(vty, " penalty time reserved%s",
441 VTY_NEWLINE);
442 else if (sp->penalty_time)
443 vty_out(vty, " penalty time %u%s",
444 (sp->penalty_time*20)+20, VTY_NEWLINE);
445 }
446
Harald Weltea54a2bb2009-12-01 18:04:30 +0530447 if (bts->si_common.chan_desc.t3212)
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +0200448 vty_out(vty, " periodic location update %u%s",
Dieter Spaarb0f746d2010-10-05 21:10:55 +0200449 bts->si_common.chan_desc.t3212 * 6, VTY_NEWLINE);
Harald Welte3e774612009-08-10 13:48:16 +0200450 vty_out(vty, " channel allocator %s%s",
451 bts->chan_alloc_reverse ? "descending" : "ascending",
452 VTY_NEWLINE);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +0100453 vty_out(vty, " rach tx integer %u%s",
454 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
455 vty_out(vty, " rach max transmission %u%s",
456 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
457 VTY_NEWLINE);
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +0800458
459 if (bts->rach_b_thresh != -1)
460 vty_out(vty, " rach nm busy threshold %u%s",
461 bts->rach_b_thresh, VTY_NEWLINE);
462 if (bts->rach_ldavg_slots != -1)
463 vty_out(vty, " rach nm load average %u%s",
464 bts->rach_ldavg_slots, VTY_NEWLINE);
Harald Welte8c973ba2009-12-21 23:08:18 +0100465 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)e19be3f2009-08-12 13:28:23 +0200466 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Holger Hans Peter Freyther440984b2010-05-14 00:39:19 +0800467 if ((bts->si_common.rach_control.t2 & 0x4) == 0)
468 vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE);
Harald Welted8acf142010-07-30 11:50:09 +0200469 for (i = SYSINFO_TYPE_1; i < _MAX_SYSINFO_TYPE; i++) {
470 if (bts->si_mode_static & (1 << i)) {
471 vty_out(vty, " system-information %s mode static%s",
472 get_value_string(osmo_sitype_strs, i), VTY_NEWLINE);
473 vty_out(vty, " system-information %s static %s%s",
474 get_value_string(osmo_sitype_strs, i),
475 hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])),
476 VTY_NEWLINE);
477 }
478 }
Harald Welte25572872009-10-20 00:22:00 +0200479 if (is_ipaccess_bts(bts)) {
Harald Weltee87eb462009-08-07 13:29:14 +0200480 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Welte3ffe1b32009-08-07 00:25:23 +0200481 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte25572872009-10-20 00:22:00 +0200482 vty_out(vty, " oml ip.access stream_id %u%s", bts->oml_tei, VTY_NEWLINE);
483 } else {
Harald Welte62868882009-08-08 16:12:58 +0200484 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
485 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
486 }
Holger Hans Peter Freyther3112f672010-09-06 10:11:25 +0800487
488 /* if we have a limit, write it */
489 if (bts->paging.free_chans_need >= 0)
490 vty_out(vty, " paging free %d%s", bts->paging.free_chans_need, VTY_NEWLINE);
491
Harald Weltea9251762010-05-11 23:50:21 +0200492 config_write_bts_gprs(vty, bts);
Harald Welte97ceef92009-08-06 19:06:46 +0200493
494 llist_for_each_entry(trx, &bts->trx_list, list)
495 config_write_trx_single(vty, trx);
496}
497
498static int config_write_bts(struct vty *v)
499{
Harald Welte40152872010-05-16 20:52:23 +0200500 struct gsm_network *gsmnet = gsmnet_from_vty(v);
Harald Welte97ceef92009-08-06 19:06:46 +0200501 struct gsm_bts *bts;
502
503 llist_for_each_entry(bts, &gsmnet->bts_list, list)
504 config_write_bts_single(v, bts);
505
506 return CMD_SUCCESS;
507}
508
Harald Weltee87eb462009-08-07 13:29:14 +0200509static int config_write_net(struct vty *vty)
510{
Harald Welte40152872010-05-16 20:52:23 +0200511 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
512
Harald Weltee87eb462009-08-07 13:29:14 +0200513 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200514 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200515 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200516 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
517 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +0200518 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Harald Welte59936d72009-11-18 20:33:19 +0100519 vty_out(vty, " location updating reject cause %u%s",
520 gsmnet->reject_cause, VTY_NEWLINE);
Harald Weltecca253a2009-08-30 15:47:06 +0900521 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freyther6b4f5462009-11-19 16:37:48 +0100522 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +0800523 vty_out(vty, " paging any use tch %d%s", gsmnet->pag_any_tch, VTY_NEWLINE);
Harald Welte52af1952009-12-13 10:53:12 +0100524 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
525 VTY_NEWLINE);
Harald Weltea310f3e2009-12-14 09:00:24 +0100526 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Welte0af9c9f2009-12-19 21:41:52 +0100527 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Weltea8062f12009-12-21 16:51:50 +0100528 vty_out(vty, " handover window rxlev averaging %u%s",
529 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
530 vty_out(vty, " handover window rxqual averaging %u%s",
531 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
532 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
533 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
534 vty_out(vty, " handover power budget interval %u%s",
535 gsmnet->handover.pwr_interval, VTY_NEWLINE);
536 vty_out(vty, " handover power budget hysteresis %u%s",
537 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
538 vty_out(vty, " handover maximum distance %u%s",
539 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +0100540 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +0100541 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
542 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
543 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
544 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
545 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
546 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
547 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
548 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
549 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
550 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Harald Weltef41bfd52010-12-15 15:34:23 +0100551 vty_out(vty, " dtx-used %u%s", gsmnet->dtx_enabled, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200552
553 return CMD_SUCCESS;
554}
Harald Welte97ceef92009-08-06 19:06:46 +0200555
Harald Welte59b04682009-06-10 05:40:52 +0800556static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
557{
558 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
559 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200560 vty_out(vty, "Description: %s%s",
561 trx->description ? trx->description : "(null)", VTY_NEWLINE);
Harald Welte91afe4c2009-06-20 18:15:19 +0200562 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte62868882009-08-08 16:12:58 +0200563 "resulting BS power: %d dBm%s",
Harald Welte91afe4c2009-06-20 18:15:19 +0200564 trx->nominal_power, trx->max_power_red,
Harald Welte62868882009-08-08 16:12:58 +0200565 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800566 vty_out(vty, " NM State: ");
567 net_dump_nmstate(vty, &trx->nm_state);
568 vty_out(vty, " Baseband Transceiver NM State: ");
569 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte25572872009-10-20 00:22:00 +0200570 if (is_ipaccess_bts(trx->bts)) {
571 vty_out(vty, " ip.access stream ID: 0x%02x%s",
572 trx->rsl_tei, VTY_NEWLINE);
573 } else {
574 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
575 e1isl_dump_vty(vty, trx->rsl_link);
576 }
Harald Welte59b04682009-06-10 05:40:52 +0800577}
578
579DEFUN(show_trx,
580 show_trx_cmd,
581 "show trx [bts_nr] [trx_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200582 SHOW_STR "Display information about a TRX\n"
583 "BTS Number\n"
584 "TRX Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800585{
Harald Welte40152872010-05-16 20:52:23 +0200586 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800587 struct gsm_bts *bts = NULL;
588 struct gsm_bts_trx *trx;
589 int bts_nr, trx_nr;
590
591 if (argc >= 1) {
592 /* use the BTS number that the user has specified */
593 bts_nr = atoi(argv[0]);
594 if (bts_nr >= net->num_bts) {
595 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
596 VTY_NEWLINE);
597 return CMD_WARNING;
598 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200599 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800600 }
601 if (argc >= 2) {
602 trx_nr = atoi(argv[1]);
603 if (trx_nr >= bts->num_trx) {
604 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
605 VTY_NEWLINE);
606 return CMD_WARNING;
607 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200608 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800609 trx_dump_vty(vty, trx);
610 return CMD_SUCCESS;
611 }
612 if (bts) {
613 /* print all TRX in this BTS */
614 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200615 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800616 trx_dump_vty(vty, trx);
617 }
618 return CMD_SUCCESS;
619 }
620
621 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200622 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800623 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200624 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800625 trx_dump_vty(vty, trx);
626 }
627 }
628
629 return CMD_SUCCESS;
630}
631
Harald Welte97ceef92009-08-06 19:06:46 +0200632
Harald Welte59b04682009-06-10 05:40:52 +0800633static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
634{
Harald Welte59b04682009-06-10 05:40:52 +0800635 vty_out(vty, "Timeslot %u of TRX %u in BTS %u, phys cfg %s%s",
636 ts->nr, ts->trx->nr, ts->trx->bts->nr,
637 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
638 vty_out(vty, " NM State: ");
639 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte87504212009-12-02 01:56:49 +0530640 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welte59b04682009-06-10 05:40:52 +0800641 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
642 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
643 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800644}
645
646DEFUN(show_ts,
647 show_ts_cmd,
648 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200649 SHOW_STR "Display information about a TS\n"
650 "BTS Number\n" "TRX Number\n" "Timeslot Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800651{
Harald Welte40152872010-05-16 20:52:23 +0200652 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800653 struct gsm_bts *bts;
654 struct gsm_bts_trx *trx;
655 struct gsm_bts_trx_ts *ts;
656 int bts_nr, trx_nr, ts_nr;
657
658 if (argc >= 1) {
659 /* use the BTS number that the user has specified */
660 bts_nr = atoi(argv[0]);
661 if (bts_nr >= net->num_bts) {
662 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
663 VTY_NEWLINE);
664 return CMD_WARNING;
665 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200666 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800667 }
668 if (argc >= 2) {
669 trx_nr = atoi(argv[1]);
670 if (trx_nr >= bts->num_trx) {
671 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
672 VTY_NEWLINE);
673 return CMD_WARNING;
674 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200675 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800676 }
677 if (argc >= 3) {
678 ts_nr = atoi(argv[2]);
679 if (ts_nr >= TRX_NR_TS) {
680 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
681 VTY_NEWLINE);
682 return CMD_WARNING;
683 }
684 ts = &trx->ts[ts_nr];
685 ts_dump_vty(vty, ts);
686 return CMD_SUCCESS;
687 }
688 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200689 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800690 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200691 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800692 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
693 ts = &trx->ts[ts_nr];
694 ts_dump_vty(vty, ts);
695 }
696 }
697 }
698
699 return CMD_SUCCESS;
700}
701
Holger Hans Peter Freyther1dd0a1b2010-01-06 06:00:40 +0100702static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte59b04682009-06-10 05:40:52 +0800703{
Harald Welte91afe4c2009-06-20 18:15:19 +0200704 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte59b04682009-06-10 05:40:52 +0800705 subscr->authorized, VTY_NEWLINE);
706 if (subscr->name)
707 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
708 if (subscr->extension)
709 vty_out(vty, " Extension: %s%s", subscr->extension,
710 VTY_NEWLINE);
711 if (subscr->imsi)
712 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freythercd8bacf2009-08-19 12:53:57 +0200713 if (subscr->tmsi != GSM_RESERVED_TMSI)
714 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte270c06c2009-08-15 03:24:51 +0200715 VTY_NEWLINE);
Sylvain Munaute5863a22009-12-27 19:29:28 +0100716
Harald Welte (local)02d5efa2009-08-14 20:27:16 +0200717 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800718}
719
Harald Welte44007742009-12-22 21:43:14 +0100720static void meas_rep_dump_uni_vty(struct vty *vty,
721 struct gsm_meas_rep_unidir *mru,
722 const char *prefix,
723 const char *dir)
724{
725 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
726 prefix, dir, rxlev2dbm(mru->full.rx_lev),
727 dir, rxlev2dbm(mru->sub.rx_lev));
728 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
729 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
730 VTY_NEWLINE);
731}
732
733static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
734 const char *prefix)
735{
736 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
737 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
738 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
739 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
740 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
741 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
742 VTY_NEWLINE);
743 if (mr->flags & MEAS_REP_F_MS_TO)
744 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
745 mr->ms_timing_offset, VTY_NEWLINE);
746 if (mr->flags & MEAS_REP_F_MS_L1)
747 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
748 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
749 if (mr->flags & MEAS_REP_F_DL_VALID)
750 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
751 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
752}
753
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800754static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
Harald Welte59b04682009-06-10 05:40:52 +0800755{
Harald Welte44007742009-12-22 21:43:14 +0100756 int idx;
757
Harald Welte59b04682009-06-10 05:40:52 +0800758 vty_out(vty, "Lchan %u in Timeslot %u of TRX %u in BTS %u, Type %s%s",
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +0200759 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
Harald Welte (local)02204d02009-12-27 18:05:25 +0100760 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Harald Welte59b04682009-06-10 05:40:52 +0800761 VTY_NEWLINE);
Holger Hans Peter Freyther6e5c50f2010-06-28 17:09:29 +0800762 vty_out(vty, " Connection: %u, State: %s%s",
763 lchan->conn ? 1: 0,
Harald Welteab2534c2009-12-29 10:52:38 +0100764 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100765 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
766 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
767 - lchan->bs_power*2,
768 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
769 VTY_NEWLINE);
Holger Hans Peter Freyther1a95fa82010-06-28 15:47:12 +0800770 if (lchan->conn && lchan->conn->subscr) {
Harald Welte59b04682009-06-10 05:40:52 +0800771 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther1a95fa82010-06-28 15:47:12 +0800772 subscr_dump_vty(vty, lchan->conn->subscr);
Harald Welte59b04682009-06-10 05:40:52 +0800773 } else
774 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte87504212009-12-02 01:56:49 +0530775 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
776 struct in_addr ia;
Holger Hans Peter Freythercec1ec52010-04-07 15:39:16 +0200777 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte87504212009-12-02 01:56:49 +0530778 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
779 inet_ntoa(ia), lchan->abis_ip.bound_port,
780 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
781 VTY_NEWLINE);
782 }
Harald Welte44007742009-12-22 21:43:14 +0100783
784 /* we want to report the last measurement report */
785 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
786 lchan->meas_rep_idx, 1);
787 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte59b04682009-06-10 05:40:52 +0800788}
789
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +0800790static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
791{
Holger Hans Peter Freythercf13a922010-05-14 01:57:02 +0800792 struct gsm_meas_rep *mr;
793 int idx;
794
795 /* we want to report the last measurement report */
796 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
797 lchan->meas_rep_idx, 1);
798 mr = &lchan->meas_rep[idx];
799
800 vty_out(vty, "Lchan: %u Timeslot: %u TRX: %u BTS: %u Type: %s - L1 MS Power: %u dBm "
801 "RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +0800802 lchan->nr, lchan->ts->nr, lchan->ts->trx->nr,
803 lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type),
Holger Hans Peter Freythercf13a922010-05-14 01:57:02 +0800804 mr->ms_l1.pwr,
805 rxlev2dbm(mr->dl.full.rx_lev),
806 rxlev2dbm(mr->ul.full.rx_lev),
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +0800807 VTY_NEWLINE);
808}
809
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800810static int lchan_summary(struct vty *vty, int argc, const char **argv,
811 void (*dump_cb)(struct vty *, struct gsm_lchan *))
Harald Welte59b04682009-06-10 05:40:52 +0800812{
Harald Welte40152872010-05-16 20:52:23 +0200813 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800814 struct gsm_bts *bts;
815 struct gsm_bts_trx *trx;
816 struct gsm_bts_trx_ts *ts;
817 struct gsm_lchan *lchan;
818 int bts_nr, trx_nr, ts_nr, lchan_nr;
819
820 if (argc >= 1) {
821 /* use the BTS number that the user has specified */
822 bts_nr = atoi(argv[0]);
823 if (bts_nr >= net->num_bts) {
824 vty_out(vty, "%% can't find BTS %s%s", argv[0],
825 VTY_NEWLINE);
826 return CMD_WARNING;
827 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200828 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800829 }
830 if (argc >= 2) {
831 trx_nr = atoi(argv[1]);
832 if (trx_nr >= bts->num_trx) {
833 vty_out(vty, "%% can't find TRX %s%s", argv[1],
834 VTY_NEWLINE);
835 return CMD_WARNING;
836 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200837 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800838 }
839 if (argc >= 3) {
840 ts_nr = atoi(argv[2]);
841 if (ts_nr >= TRX_NR_TS) {
842 vty_out(vty, "%% can't find TS %s%s", argv[2],
843 VTY_NEWLINE);
844 return CMD_WARNING;
845 }
846 ts = &trx->ts[ts_nr];
847 }
848 if (argc >= 4) {
849 lchan_nr = atoi(argv[3]);
850 if (lchan_nr >= TS_MAX_LCHAN) {
851 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
852 VTY_NEWLINE);
853 return CMD_WARNING;
854 }
855 lchan = &ts->lchan[lchan_nr];
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800856 dump_cb(vty, lchan);
Harald Welte59b04682009-06-10 05:40:52 +0800857 return CMD_SUCCESS;
858 }
859 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200860 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800861 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200862 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800863 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
864 ts = &trx->ts[ts_nr];
865 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
866 lchan_nr++) {
867 lchan = &ts->lchan[lchan_nr];
868 if (lchan->type == GSM_LCHAN_NONE)
869 continue;
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800870 dump_cb(vty, lchan);
Harald Welte59b04682009-06-10 05:40:52 +0800871 }
872 }
873 }
874 }
875
876 return CMD_SUCCESS;
877}
878
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +0800879
880DEFUN(show_lchan,
881 show_lchan_cmd,
882 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
883 SHOW_STR "Display information about a logical channel\n"
884 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
885 "Logical Channel Number\n")
886
887{
888 return lchan_summary(vty, argc, argv, lchan_dump_full_vty);
889}
890
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +0800891DEFUN(show_lchan_summary,
892 show_lchan_summary_cmd,
893 "show lchan summary [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
894 SHOW_STR "Display information about a logical channel\n"
895 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
896 "Logical Channel Number\n")
897{
898 return lchan_summary(vty, argc, argv, lchan_dump_short_vty);
899}
900
Harald Welte59b04682009-06-10 05:40:52 +0800901static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
902{
903 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
904}
905
906DEFUN(show_e1drv,
907 show_e1drv_cmd,
908 "show e1_driver",
909 SHOW_STR "Display information about available E1 drivers\n")
910{
911 struct e1inp_driver *drv;
912
913 llist_for_each_entry(drv, &e1inp_driver_list, list)
914 e1drv_dump_vty(vty, drv);
915
916 return CMD_SUCCESS;
917}
918
919static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
920{
921 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
922 line->num, line->name ? line->name : "",
923 line->driver->name, VTY_NEWLINE);
924}
925
926DEFUN(show_e1line,
927 show_e1line_cmd,
928 "show e1_line [line_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200929 SHOW_STR "Display information about a E1 line\n"
930 "E1 Line Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800931{
932 struct e1inp_line *line;
933
934 if (argc >= 1) {
935 int num = atoi(argv[0]);
936 llist_for_each_entry(line, &e1inp_line_list, list) {
937 if (line->num == num) {
938 e1line_dump_vty(vty, line);
939 return CMD_SUCCESS;
940 }
941 }
942 return CMD_WARNING;
943 }
944
945 llist_for_each_entry(line, &e1inp_line_list, list)
946 e1line_dump_vty(vty, line);
947
948 return CMD_SUCCESS;
949}
950
951static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
952{
Harald Welte62868882009-08-08 16:12:58 +0200953 if (ts->type == E1INP_TS_TYPE_NONE)
954 return;
Harald Welte59b04682009-06-10 05:40:52 +0800955 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
956 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
957 VTY_NEWLINE);
958}
959
960DEFUN(show_e1ts,
961 show_e1ts_cmd,
962 "show e1_timeslot [line_nr] [ts_nr]",
Harald Welte9e002452010-05-11 21:53:49 +0200963 SHOW_STR "Display information about a E1 timeslot\n"
964 "E1 Line Number\n" "E1 Timeslot Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800965{
Harald Welte49c79562009-11-17 06:12:16 +0100966 struct e1inp_line *line = NULL;
Harald Welte59b04682009-06-10 05:40:52 +0800967 struct e1inp_ts *ts;
968 int ts_nr;
969
970 if (argc == 0) {
971 llist_for_each_entry(line, &e1inp_line_list, list) {
972 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
973 ts = &line->ts[ts_nr];
974 e1ts_dump_vty(vty, ts);
975 }
976 }
977 return CMD_SUCCESS;
978 }
979 if (argc >= 1) {
980 int num = atoi(argv[0]);
981 llist_for_each_entry(line, &e1inp_line_list, list) {
982 if (line->num == num)
983 break;
984 }
985 if (!line || line->num != num) {
986 vty_out(vty, "E1 line %s is invalid%s",
987 argv[0], VTY_NEWLINE);
988 return CMD_WARNING;
989 }
990 }
991 if (argc >= 2) {
992 ts_nr = atoi(argv[1]);
993 if (ts_nr > NUM_E1_TS) {
994 vty_out(vty, "E1 timeslot %s is invalid%s",
995 argv[1], VTY_NEWLINE);
996 return CMD_WARNING;
997 }
998 ts = &line->ts[ts_nr];
999 e1ts_dump_vty(vty, ts);
1000 return CMD_SUCCESS;
1001 } else {
1002 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
1003 ts = &line->ts[ts_nr];
1004 e1ts_dump_vty(vty, ts);
1005 }
1006 return CMD_SUCCESS;
1007 }
1008 return CMD_SUCCESS;
1009}
1010
1011static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
1012{
1013 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
1014 subscr_dump_vty(vty, pag->subscr);
1015}
1016
1017static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
1018{
1019 struct gsm_paging_request *pag;
1020
1021 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
1022 paging_dump_vty(vty, pag);
1023}
1024
1025DEFUN(show_paging,
1026 show_paging_cmd,
1027 "show paging [bts_nr]",
Harald Welte9e002452010-05-11 21:53:49 +02001028 SHOW_STR "Display information about paging reuqests of a BTS\n"
1029 "BTS Number\n")
Harald Welte59b04682009-06-10 05:40:52 +08001030{
Harald Welte40152872010-05-16 20:52:23 +02001031 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +08001032 struct gsm_bts *bts;
1033 int bts_nr;
1034
1035 if (argc >= 1) {
1036 /* use the BTS number that the user has specified */
1037 bts_nr = atoi(argv[0]);
1038 if (bts_nr >= net->num_bts) {
1039 vty_out(vty, "%% can't find BTS %s%s", argv[0],
1040 VTY_NEWLINE);
1041 return CMD_WARNING;
1042 }
Harald Weltee712a5f2009-06-21 16:17:15 +02001043 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +08001044 bts_paging_dump_vty(vty, bts);
1045
1046 return CMD_SUCCESS;
1047 }
1048 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +02001049 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +08001050 bts_paging_dump_vty(vty, bts);
1051 }
1052
1053 return CMD_SUCCESS;
1054}
1055
Harald Welte9e002452010-05-11 21:53:49 +02001056#define NETWORK_STR "Configure the GSM network\n"
1057
Harald Weltee87eb462009-08-07 13:29:14 +02001058DEFUN(cfg_net,
1059 cfg_net_cmd,
Harald Welte9e002452010-05-11 21:53:49 +02001060 "network", NETWORK_STR)
Harald Weltee87eb462009-08-07 13:29:14 +02001061{
Harald Welte40152872010-05-16 20:52:23 +02001062 vty->index = gsmnet_from_vty(vty);
Harald Weltee87eb462009-08-07 13:29:14 +02001063 vty->node = GSMNET_NODE;
1064
1065 return CMD_SUCCESS;
1066}
1067
1068
1069DEFUN(cfg_net_ncc,
1070 cfg_net_ncc_cmd,
1071 "network country code <1-999>",
1072 "Set the GSM network country code")
1073{
Harald Welte40152872010-05-16 20:52:23 +02001074 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1075
Harald Weltee87eb462009-08-07 13:29:14 +02001076 gsmnet->country_code = atoi(argv[0]);
1077
1078 return CMD_SUCCESS;
1079}
1080
1081DEFUN(cfg_net_mnc,
1082 cfg_net_mnc_cmd,
1083 "mobile network code <1-999>",
1084 "Set the GSM mobile network code")
1085{
Harald Welte40152872010-05-16 20:52:23 +02001086 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1087
Harald Weltee87eb462009-08-07 13:29:14 +02001088 gsmnet->network_code = atoi(argv[0]);
1089
1090 return CMD_SUCCESS;
1091}
1092
1093DEFUN(cfg_net_name_short,
1094 cfg_net_name_short_cmd,
1095 "short name NAME",
1096 "Set the short GSM network name")
1097{
Harald Welte40152872010-05-16 20:52:23 +02001098 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1099
Holger Hans Peter Freyther7c831f62010-10-12 23:21:54 +02001100 bsc_replace_string(gsmnet, &gsmnet->name_short, argv[0]);
Harald Weltee87eb462009-08-07 13:29:14 +02001101 return CMD_SUCCESS;
1102}
1103
1104DEFUN(cfg_net_name_long,
1105 cfg_net_name_long_cmd,
1106 "long name NAME",
1107 "Set the long GSM network name")
1108{
Harald Welte40152872010-05-16 20:52:23 +02001109 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1110
Holger Hans Peter Freyther7c831f62010-10-12 23:21:54 +02001111 bsc_replace_string(gsmnet, &gsmnet->name_long, argv[0]);
Harald Weltee87eb462009-08-07 13:29:14 +02001112 return CMD_SUCCESS;
1113}
Harald Welte59b04682009-06-10 05:40:52 +08001114
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02001115DEFUN(cfg_net_auth_policy,
1116 cfg_net_auth_policy_cmd,
1117 "auth policy (closed|accept-all|token)",
Harald Welte9e002452010-05-11 21:53:49 +02001118 "Authentication (not cryptographic)\n"
1119 "Set the GSM network authentication policy\n"
1120 "Require the MS to be activated in HLR\n"
1121 "Accept all MS, whether in HLR or not\n"
1122 "Use SMS-token based authentication\n")
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02001123{
1124 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
Harald Welte40152872010-05-16 20:52:23 +02001125 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02001126
1127 gsmnet->auth_policy = policy;
1128
1129 return CMD_SUCCESS;
1130}
1131
Harald Welte59936d72009-11-18 20:33:19 +01001132DEFUN(cfg_net_reject_cause,
1133 cfg_net_reject_cause_cmd,
1134 "location updating reject cause <2-111>",
1135 "Set the reject cause of location updating reject\n")
1136{
Harald Welte40152872010-05-16 20:52:23 +02001137 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1138
Harald Welte59936d72009-11-18 20:33:19 +01001139 gsmnet->reject_cause = atoi(argv[0]);
1140
1141 return CMD_SUCCESS;
1142}
1143
Harald Weltecca253a2009-08-30 15:47:06 +09001144DEFUN(cfg_net_encryption,
1145 cfg_net_encryption_cmd,
1146 "encryption a5 (0|1|2)",
Harald Welte18ce31c2010-05-14 20:05:17 +02001147 "Encryption options\n"
1148 "A5 encryption\n" "A5/0: No encryption\n"
1149 "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n")
Harald Weltecca253a2009-08-30 15:47:06 +09001150{
Harald Welte40152872010-05-16 20:52:23 +02001151 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1152
Andreas.Eversberg53293292009-11-17 09:55:26 +01001153 gsmnet->a5_encryption= atoi(argv[0]);
Harald Weltecca253a2009-08-30 15:47:06 +09001154
1155 return CMD_SUCCESS;
1156}
1157
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001158DEFUN(cfg_net_neci,
1159 cfg_net_neci_cmd,
1160 "neci (0|1)",
Harald Welte18ce31c2010-05-14 20:05:17 +02001161 "New Establish Cause Indication\n"
1162 "Don't set the NECI bit\n" "Set the NECI bit\n")
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001163{
Harald Welte40152872010-05-16 20:52:23 +02001164 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1165
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001166 gsmnet->neci = atoi(argv[0]);
Holger Hans Peter Freytherf0f37f12010-09-06 09:36:02 +08001167 gsm_net_update_ctype(gsmnet);
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001168 return CMD_SUCCESS;
1169}
1170
Harald Welte52af1952009-12-13 10:53:12 +01001171DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1172 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
Harald Welte9e002452010-05-11 21:53:49 +02001173 "Radio Resource Location Protocol\n"
1174 "Set the Radio Resource Location Protocol Mode\n"
1175 "Don't send RRLP request\n"
1176 "Request MS-based location\n"
1177 "Request any location, prefer MS-based\n"
1178 "Request any location, prefer MS-assisted\n")
Harald Welte52af1952009-12-13 10:53:12 +01001179{
Harald Welte40152872010-05-16 20:52:23 +02001180 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1181
Harald Welte52af1952009-12-13 10:53:12 +01001182 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1183
1184 return CMD_SUCCESS;
1185}
1186
Harald Weltea310f3e2009-12-14 09:00:24 +01001187DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1188 "mm info (0|1)",
1189 "Whether to send MM INFO after LOC UPD ACCEPT")
1190{
Harald Welte40152872010-05-16 20:52:23 +02001191 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1192
Harald Weltea310f3e2009-12-14 09:00:24 +01001193 gsmnet->send_mm_info = atoi(argv[0]);
1194
1195 return CMD_SUCCESS;
1196}
1197
Harald Welte9e002452010-05-11 21:53:49 +02001198#define HANDOVER_STR "Handover Options\n"
1199
Harald Welte0af9c9f2009-12-19 21:41:52 +01001200DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1201 "handover (0|1)",
Harald Welte9e002452010-05-11 21:53:49 +02001202 HANDOVER_STR
1203 "Don't perform in-call handover\n"
1204 "Perform in-call handover\n")
Harald Welte0af9c9f2009-12-19 21:41:52 +01001205{
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001206 int enable = atoi(argv[0]);
Harald Welte40152872010-05-16 20:52:23 +02001207 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001208
1209 if (enable && ipacc_rtp_direct) {
Harald Welteaa2c3032009-12-20 13:51:01 +01001210 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1211 "is enabled by using the -P command line option%s",
1212 VTY_NEWLINE);
1213 return CMD_WARNING;
1214 }
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001215 gsmnet->handover.active = enable;
Harald Welte0af9c9f2009-12-19 21:41:52 +01001216
1217 return CMD_SUCCESS;
1218}
1219
Harald Welte9e002452010-05-11 21:53:49 +02001220#define HO_WIN_STR HANDOVER_STR "Measurement Window\n"
1221#define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n"
1222#define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n"
1223#define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n"
1224
Harald Weltea8062f12009-12-21 16:51:50 +01001225DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1226 "handover window rxlev averaging <1-10>",
Harald Welte9e002452010-05-11 21:53:49 +02001227 HO_WIN_RXLEV_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001228 "How many RxLev measurements are used for averaging")
1229{
Harald Welte40152872010-05-16 20:52:23 +02001230 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001231 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1232 return CMD_SUCCESS;
1233}
1234
1235DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1236 "handover window rxqual averaging <1-10>",
Harald Welte9e002452010-05-11 21:53:49 +02001237 HO_WIN_RXQUAL_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001238 "How many RxQual measurements are used for averaging")
1239{
Harald Welte40152872010-05-16 20:52:23 +02001240 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001241 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1242 return CMD_SUCCESS;
1243}
1244
1245DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1246 "handover window rxlev neighbor averaging <1-10>",
Harald Welte9e002452010-05-11 21:53:49 +02001247 HO_WIN_RXLEV_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001248 "How many RxQual measurements are used for averaging")
1249{
Harald Welte40152872010-05-16 20:52:23 +02001250 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001251 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1252 return CMD_SUCCESS;
1253}
1254
1255DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1256 "handover power budget interval <1-99>",
Harald Welte9e002452010-05-11 21:53:49 +02001257 HO_PBUDGET_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001258 "How often to check if we have a better cell (SACCH frames)")
1259{
Harald Welte40152872010-05-16 20:52:23 +02001260 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001261 gsmnet->handover.pwr_interval = atoi(argv[0]);
1262 return CMD_SUCCESS;
1263}
1264
1265DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1266 "handover power budget hysteresis <0-999>",
Harald Welte9e002452010-05-11 21:53:49 +02001267 HO_PBUDGET_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001268 "How many dB does a neighbor to be stronger to become a HO candidate")
1269{
Harald Welte40152872010-05-16 20:52:23 +02001270 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001271 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1272 return CMD_SUCCESS;
1273}
1274
1275DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1276 "handover maximum distance <0-9999>",
Harald Welte9e002452010-05-11 21:53:49 +02001277 HANDOVER_STR
Harald Weltea8062f12009-12-21 16:51:50 +01001278 "How big is the maximum timing advance before HO is forced")
1279{
Harald Welte40152872010-05-16 20:52:23 +02001280 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001281 gsmnet->handover.max_distance = atoi(argv[0]);
1282 return CMD_SUCCESS;
1283}
Harald Welte0af9c9f2009-12-19 21:41:52 +01001284
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +08001285DEFUN(cfg_net_pag_any_tch,
1286 cfg_net_pag_any_tch_cmd,
1287 "paging any use tch (0|1)",
1288 "Assign a TCH when receiving a Paging Any request")
1289{
Holger Hans Peter Freytherc5628882010-09-06 10:09:19 +08001290 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +08001291 gsmnet->pag_any_tch = atoi(argv[0]);
1292 gsm_net_update_ctype(gsmnet);
1293 return CMD_SUCCESS;
1294}
1295
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001296#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001297 DEFUN(cfg_net_T##number, \
1298 cfg_net_T##number##_cmd, \
1299 "timer t" #number " <0-65535>", \
Harald Welte9e002452010-05-11 21:53:49 +02001300 "Configure GSM Timers\n" \
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001301 doc) \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001302{ \
Harald Welte40152872010-05-16 20:52:23 +02001303 struct gsm_network *gsmnet = gsmnet_from_vty(vty); \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001304 int value = atoi(argv[0]); \
1305 \
1306 if (value < 0 || value > 65535) { \
1307 vty_out(vty, "Timer value %s out of range.%s", \
1308 argv[0], VTY_NEWLINE); \
1309 return CMD_WARNING; \
1310 } \
1311 \
1312 gsmnet->T##number = value; \
1313 return CMD_SUCCESS; \
1314}
1315
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001316DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1317DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1318DECLARE_TIMER(3105, "Currently not used.")
1319DECLARE_TIMER(3107, "Currently not used.")
1320DECLARE_TIMER(3109, "Currently not used.")
Holger Hans Peter Freyther4a00c062010-05-31 21:33:15 +08001321DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel.")
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001322DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1323DECLARE_TIMER(3115, "Currently not used.")
1324DECLARE_TIMER(3117, "Currently not used.")
1325DECLARE_TIMER(3119, "Currently not used.")
1326DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001327
Holger Hans Peter Freyther21d63ff2010-09-06 09:25:48 +08001328DEFUN(cfg_net_dtx,
1329 cfg_net_dtx_cmd,
1330 "dtx-used (0|1)",
1331 "Enable the usage of DTX.\n"
1332 "DTX is enabled/disabled")
1333{
1334 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1335 gsmnet->dtx_enabled = atoi(argv[0]);
1336 return CMD_SUCCESS;
1337}
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001338
Harald Welte59b04682009-06-10 05:40:52 +08001339/* per-BTS configuration */
1340DEFUN(cfg_bts,
1341 cfg_bts_cmd,
1342 "bts BTS_NR",
Harald Welte9e002452010-05-11 21:53:49 +02001343 "Select a BTS to configure\n"
1344 "BTS Number\n")
Harald Welte59b04682009-06-10 05:40:52 +08001345{
Harald Welte40152872010-05-16 20:52:23 +02001346 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +08001347 int bts_nr = atoi(argv[0]);
1348 struct gsm_bts *bts;
1349
Harald Weltee712a5f2009-06-21 16:17:15 +02001350 if (bts_nr > gsmnet->num_bts) {
1351 vty_out(vty, "%% The next unused BTS number is %u%s",
1352 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +08001353 return CMD_WARNING;
Harald Weltee712a5f2009-06-21 16:17:15 +02001354 } else if (bts_nr == gsmnet->num_bts) {
1355 /* allocate a new one */
1356 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1357 HARDCODED_TSC, HARDCODED_BSIC);
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +02001358 } else
Harald Weltee712a5f2009-06-21 16:17:15 +02001359 bts = gsm_bts_num(gsmnet, bts_nr);
1360
Daniel Willmann580085f2010-01-11 13:43:07 +01001361 if (!bts) {
1362 vty_out(vty, "%% Unable to allocate BTS %u%s",
1363 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee712a5f2009-06-21 16:17:15 +02001364 return CMD_WARNING;
Daniel Willmann580085f2010-01-11 13:43:07 +01001365 }
Harald Welte59b04682009-06-10 05:40:52 +08001366
1367 vty->index = bts;
Harald Welte8791dac2010-05-14 17:59:53 +02001368 vty->index_sub = &bts->description;
Harald Welte59b04682009-06-10 05:40:52 +08001369 vty->node = BTS_NODE;
1370
1371 return CMD_SUCCESS;
1372}
1373
1374DEFUN(cfg_bts_type,
1375 cfg_bts_type_cmd,
1376 "type TYPE",
1377 "Set the BTS type\n")
1378{
1379 struct gsm_bts *bts = vty->index;
Harald Welte59698fb2010-01-10 18:01:52 +01001380 int rc;
Harald Welte59b04682009-06-10 05:40:52 +08001381
Harald Welte59698fb2010-01-10 18:01:52 +01001382 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1383 if (rc < 0)
1384 return CMD_WARNING;
Harald Welte25572872009-10-20 00:22:00 +02001385
Harald Welte59b04682009-06-10 05:40:52 +08001386 return CMD_SUCCESS;
1387}
1388
Harald Welte91afe4c2009-06-20 18:15:19 +02001389DEFUN(cfg_bts_band,
1390 cfg_bts_band_cmd,
1391 "band BAND",
1392 "Set the frequency band of this BTS\n")
1393{
1394 struct gsm_bts *bts = vty->index;
Harald Welte62868882009-08-08 16:12:58 +02001395 int band = gsm_band_parse(argv[0]);
Harald Welte91afe4c2009-06-20 18:15:19 +02001396
1397 if (band < 0) {
1398 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1399 band, VTY_NEWLINE);
1400 return CMD_WARNING;
1401 }
1402
1403 bts->band = band;
1404
1405 return CMD_SUCCESS;
1406}
1407
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +02001408DEFUN(cfg_bts_ci,
1409 cfg_bts_ci_cmd,
1410 "cell_identity <0-65535>",
1411 "Set the Cell identity of this BTS\n")
1412{
1413 struct gsm_bts *bts = vty->index;
1414 int ci = atoi(argv[0]);
1415
1416 if (ci < 0 || ci > 0xffff) {
1417 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1418 ci, VTY_NEWLINE);
1419 return CMD_WARNING;
1420 }
1421 bts->cell_identity = ci;
1422
1423 return CMD_SUCCESS;
1424}
1425
Harald Welte59b04682009-06-10 05:40:52 +08001426DEFUN(cfg_bts_lac,
1427 cfg_bts_lac_cmd,
Holger Hans Peter Freyther54a22832009-09-29 14:02:33 +02001428 "location_area_code <0-65535>",
Harald Welte59b04682009-06-10 05:40:52 +08001429 "Set the Location Area Code (LAC) of this BTS\n")
1430{
1431 struct gsm_bts *bts = vty->index;
1432 int lac = atoi(argv[0]);
1433
Holger Hans Peter Freyther54a22832009-09-29 14:02:33 +02001434 if (lac < 0 || lac > 0xffff) {
1435 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte59b04682009-06-10 05:40:52 +08001436 lac, VTY_NEWLINE);
1437 return CMD_WARNING;
1438 }
Holger Hans Peter Freyther6c6ab862009-10-01 04:07:15 +02001439
1440 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1441 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1442 lac, VTY_NEWLINE);
1443 return CMD_WARNING;
1444 }
1445
Harald Welte59b04682009-06-10 05:40:52 +08001446 bts->location_area_code = lac;
1447
1448 return CMD_SUCCESS;
1449}
1450
Harald Weltea54a2bb2009-12-01 18:04:30 +05301451
Harald Welte59b04682009-06-10 05:40:52 +08001452DEFUN(cfg_bts_tsc,
1453 cfg_bts_tsc_cmd,
1454 "training_sequence_code <0-255>",
1455 "Set the Training Sequence Code (TSC) of this BTS\n")
1456{
1457 struct gsm_bts *bts = vty->index;
1458 int tsc = atoi(argv[0]);
1459
1460 if (tsc < 0 || tsc > 0xff) {
1461 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1462 tsc, VTY_NEWLINE);
1463 return CMD_WARNING;
1464 }
1465 bts->tsc = tsc;
1466
1467 return CMD_SUCCESS;
1468}
1469
1470DEFUN(cfg_bts_bsic,
1471 cfg_bts_bsic_cmd,
1472 "base_station_id_code <0-63>",
1473 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1474{
1475 struct gsm_bts *bts = vty->index;
1476 int bsic = atoi(argv[0]);
1477
1478 if (bsic < 0 || bsic > 0x3f) {
Harald Welte62868882009-08-08 16:12:58 +02001479 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte59b04682009-06-10 05:40:52 +08001480 bsic, VTY_NEWLINE);
1481 return CMD_WARNING;
1482 }
1483 bts->bsic = bsic;
1484
1485 return CMD_SUCCESS;
1486}
1487
1488
1489DEFUN(cfg_bts_unit_id,
1490 cfg_bts_unit_id_cmd,
Harald Weltef515aa02009-08-07 13:27:09 +02001491 "ip.access unit_id <0-65534> <0-255>",
1492 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte59b04682009-06-10 05:40:52 +08001493{
1494 struct gsm_bts *bts = vty->index;
1495 int site_id = atoi(argv[0]);
1496 int bts_id = atoi(argv[1]);
1497
Harald Weltef515aa02009-08-07 13:27:09 +02001498 if (!is_ipaccess_bts(bts)) {
1499 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1500 return CMD_WARNING;
1501 }
1502
Harald Welte59b04682009-06-10 05:40:52 +08001503 bts->ip_access.site_id = site_id;
1504 bts->ip_access.bts_id = bts_id;
1505
1506 return CMD_SUCCESS;
1507}
1508
Harald Welte9e002452010-05-11 21:53:49 +02001509#define OML_STR "Organization & Maintenance Link\n"
1510#define IPA_STR "ip.access Specific Options\n"
1511
Harald Welte25572872009-10-20 00:22:00 +02001512DEFUN(cfg_bts_stream_id,
1513 cfg_bts_stream_id_cmd,
1514 "oml ip.access stream_id <0-255>",
Harald Welte9e002452010-05-11 21:53:49 +02001515 OML_STR IPA_STR
Harald Welte25572872009-10-20 00:22:00 +02001516 "Set the ip.access Stream ID of the OML link of this BTS\n")
1517{
1518 struct gsm_bts *bts = vty->index;
1519 int stream_id = atoi(argv[0]);
1520
1521 if (!is_ipaccess_bts(bts)) {
1522 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1523 return CMD_WARNING;
1524 }
1525
1526 bts->oml_tei = stream_id;
1527
1528 return CMD_SUCCESS;
1529}
1530
Harald Welte9e002452010-05-11 21:53:49 +02001531#define OML_E1_STR OML_STR "E1 Line\n"
Harald Welte25572872009-10-20 00:22:00 +02001532
Harald Welte62868882009-08-08 16:12:58 +02001533DEFUN(cfg_bts_oml_e1,
1534 cfg_bts_oml_e1_cmd,
1535 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte9e002452010-05-11 21:53:49 +02001536 OML_E1_STR
Harald Welte62868882009-08-08 16:12:58 +02001537 "E1 interface to be used for OML\n")
1538{
1539 struct gsm_bts *bts = vty->index;
1540
1541 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1542
1543 return CMD_SUCCESS;
1544}
1545
1546
1547DEFUN(cfg_bts_oml_e1_tei,
1548 cfg_bts_oml_e1_tei_cmd,
1549 "oml e1 tei <0-63>",
Harald Welte9e002452010-05-11 21:53:49 +02001550 OML_E1_STR
Harald Welte62868882009-08-08 16:12:58 +02001551 "Set the TEI to be used for OML")
1552{
1553 struct gsm_bts *bts = vty->index;
1554
1555 bts->oml_tei = atoi(argv[0]);
1556
1557 return CMD_SUCCESS;
1558}
1559
Harald Welte3e774612009-08-10 13:48:16 +02001560DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1561 "channel allocator (ascending|descending)",
Harald Welte9e002452010-05-11 21:53:49 +02001562 "Channnel Allocator\n" "Channel Allocator\n"
1563 "Allocate Timeslots and Transceivers in ascending order\n"
1564 "Allocate Timeslots and Transceivers in descending order\n")
Harald Welte3e774612009-08-10 13:48:16 +02001565{
1566 struct gsm_bts *bts = vty->index;
1567
1568 if (!strcmp(argv[0], "ascending"))
1569 bts->chan_alloc_reverse = 0;
1570 else
1571 bts->chan_alloc_reverse = 1;
1572
1573 return CMD_SUCCESS;
1574}
1575
Harald Welte9e002452010-05-11 21:53:49 +02001576#define RACH_STR "Random Access Control Channel\n"
1577
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001578DEFUN(cfg_bts_rach_tx_integer,
1579 cfg_bts_rach_tx_integer_cmd,
1580 "rach tx integer <0-15>",
Harald Welte9e002452010-05-11 21:53:49 +02001581 RACH_STR
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001582 "Set the raw tx integer value in RACH Control parameters IE")
1583{
1584 struct gsm_bts *bts = vty->index;
1585 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1586 return CMD_SUCCESS;
1587}
1588
1589DEFUN(cfg_bts_rach_max_trans,
1590 cfg_bts_rach_max_trans_cmd,
1591 "rach max transmission (1|2|4|7)",
Harald Welte9e002452010-05-11 21:53:49 +02001592 RACH_STR
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001593 "Set the maximum number of RACH burst transmissions")
1594{
1595 struct gsm_bts *bts = vty->index;
1596 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1597 return CMD_SUCCESS;
1598}
1599
Harald Welte9e002452010-05-11 21:53:49 +02001600#define NM_STR "Network Management\n"
1601
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08001602DEFUN(cfg_bts_rach_nm_b_thresh,
1603 cfg_bts_rach_nm_b_thresh_cmd,
1604 "rach nm busy threshold <0-255>",
Harald Welte9e002452010-05-11 21:53:49 +02001605 RACH_STR NM_STR
1606 "Set the NM Busy Threshold in dB")
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08001607{
1608 struct gsm_bts *bts = vty->index;
1609 bts->rach_b_thresh = atoi(argv[0]);
1610 return CMD_SUCCESS;
1611}
1612
1613DEFUN(cfg_bts_rach_nm_ldavg,
1614 cfg_bts_rach_nm_ldavg_cmd,
1615 "rach nm load average <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001616 RACH_STR NM_STR
1617 "Set the NM Loadaverage Slots value")
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08001618{
1619 struct gsm_bts *bts = vty->index;
1620 bts->rach_ldavg_slots = atoi(argv[0]);
1621 return CMD_SUCCESS;
1622}
1623
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02001624DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1625 "cell barred (0|1)",
1626 "Should this cell be barred from access?")
1627{
1628 struct gsm_bts *bts = vty->index;
1629
Harald Welte8c973ba2009-12-21 23:08:18 +01001630 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02001631
1632 return CMD_SUCCESS;
1633}
1634
Holger Hans Peter Freyther440984b2010-05-14 00:39:19 +08001635DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd,
1636 "rach emergency call allowed (0|1)",
1637 "Should this cell allow emergency calls?")
1638{
1639 struct gsm_bts *bts = vty->index;
1640
1641 if (atoi(argv[0]) == 0)
1642 bts->si_common.rach_control.t2 |= 0x4;
1643 else
1644 bts->si_common.rach_control.t2 &= ~0x4;
1645
1646 return CMD_SUCCESS;
1647}
1648
Harald Welte (local)cbd46102009-08-13 10:14:26 +02001649DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1650 "ms max power <0-40>",
1651 "Maximum transmit power of the MS")
1652{
1653 struct gsm_bts *bts = vty->index;
1654
1655 bts->ms_max_power = atoi(argv[0]);
1656
1657 return CMD_SUCCESS;
1658}
1659
Harald Welteb761bf82009-12-12 18:17:25 +01001660DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1661 "cell reselection hysteresis <0-14>",
1662 "Cell Re-Selection Hysteresis in dB")
1663{
1664 struct gsm_bts *bts = vty->index;
1665
1666 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1667
1668 return CMD_SUCCESS;
1669}
1670
1671DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1672 "rxlev access min <0-63>",
1673 "Minimum RxLev needed for cell access (better than -110dBm)")
1674{
1675 struct gsm_bts *bts = vty->index;
1676
1677 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1678
1679 return CMD_SUCCESS;
1680}
1681
Sylvain Munaut00d71462010-11-28 18:17:28 +01001682DEFUN(cfg_bts_cell_bar_qualify, cfg_bts_cell_bar_qualify_cmd,
1683 "cell bar qualify (0|1)",
1684 "Cell Bar Qualify")
1685{
1686 struct gsm_bts *bts = vty->index;
1687
1688 bts->si_common.cell_ro_sel_par.present = 1;
1689 bts->si_common.cell_ro_sel_par.cbq = atoi(argv[0]);
1690
1691 return CMD_SUCCESS;
1692}
1693
1694DEFUN(cfg_bts_cell_resel_ofs, cfg_bts_cell_resel_ofs_cmd,
1695 "cell reselection offset <0-126>",
1696 "Cell Re-Selection Offset in dB")
1697{
1698 struct gsm_bts *bts = vty->index;
1699
1700 bts->si_common.cell_ro_sel_par.present = 1;
1701 bts->si_common.cell_ro_sel_par.cell_resel_off = atoi(argv[0])/2;
1702
1703 return CMD_SUCCESS;
1704}
1705
1706DEFUN(cfg_bts_temp_ofs, cfg_bts_temp_ofs_cmd,
1707 "temporary offset <0-60>",
1708 "Cell selection temporary negative offset in dB")
1709{
1710 struct gsm_bts *bts = vty->index;
1711
1712 bts->si_common.cell_ro_sel_par.present = 1;
1713 bts->si_common.cell_ro_sel_par.temp_offs = atoi(argv[0])/10;
1714
1715 return CMD_SUCCESS;
1716}
1717
1718DEFUN(cfg_bts_temp_ofs_inf, cfg_bts_temp_ofs_inf_cmd,
1719 "temporary offset infinite",
1720 "Sets cell selection temporary negative offset to infinity")
1721{
1722 struct gsm_bts *bts = vty->index;
1723
1724 bts->si_common.cell_ro_sel_par.present = 1;
1725 bts->si_common.cell_ro_sel_par.temp_offs = 7;
1726
1727 return CMD_SUCCESS;
1728}
1729
1730DEFUN(cfg_bts_penalty_time, cfg_bts_penalty_time_cmd,
1731 "penalty time <20-620>",
1732 "Cell selection penalty time in seconds (by 20s increments)")
1733{
1734 struct gsm_bts *bts = vty->index;
1735
1736 bts->si_common.cell_ro_sel_par.present = 1;
1737 bts->si_common.cell_ro_sel_par.penalty_time = (atoi(argv[0])-20)/20;
1738
1739 return CMD_SUCCESS;
1740}
1741
1742DEFUN(cfg_bts_penalty_time_rsvd, cfg_bts_penalty_time_rsvd_cmd,
1743 "penalty time reserved",
1744 "Set cell selection penalty time to reserved value 31\n"
1745 "(indicate that CELL_RESELECT_OFFSET is subtracted from C2 "
1746 "and TEMPORARY_OFFSET is ignored)")
1747{
1748 struct gsm_bts *bts = vty->index;
1749
1750 bts->si_common.cell_ro_sel_par.present = 1;
1751 bts->si_common.cell_ro_sel_par.penalty_time = 31;
1752
1753 return CMD_SUCCESS;
1754}
1755
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02001756DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1757 "periodic location update <0-1530>",
1758 "Periodic Location Updating Interval in Minutes")
1759{
1760 struct gsm_bts *bts = vty->index;
1761
Dieter Spaarb0f746d2010-10-05 21:10:55 +02001762 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 6;
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02001763
1764 return CMD_SUCCESS;
1765}
1766
Harald Welte9e002452010-05-11 21:53:49 +02001767#define GPRS_TEXT "GPRS Packet Network\n"
1768
Harald Welte410575a2010-03-14 23:30:30 +08001769DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welteb42fe342010-04-18 14:00:26 +02001770 "gprs cell bvci <2-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001771 GPRS_TEXT
1772 "GPRS Cell Settings\n"
Harald Welte3055e332010-03-14 15:37:43 +08001773 "GPRS BSSGP VC Identifier")
1774{
1775 struct gsm_bts *bts = vty->index;
1776
Harald Weltecb20b7a2010-04-18 15:51:20 +02001777 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001778 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1779 return CMD_WARNING;
1780 }
1781
Harald Welte3055e332010-03-14 15:37:43 +08001782 bts->gprs.cell.bvci = atoi(argv[0]);
1783
1784 return CMD_SUCCESS;
1785}
1786
Harald Welte4a048c52010-03-22 11:48:36 +08001787DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
1788 "gprs nsei <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001789 GPRS_TEXT
Harald Welte4a048c52010-03-22 11:48:36 +08001790 "GPRS NS Entity Identifier")
1791{
1792 struct gsm_bts *bts = vty->index;
1793
Harald Weltecb20b7a2010-04-18 15:51:20 +02001794 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte4a048c52010-03-22 11:48:36 +08001795 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1796 return CMD_WARNING;
1797 }
1798
1799 bts->gprs.nse.nsei = atoi(argv[0]);
1800
1801 return CMD_SUCCESS;
1802}
1803
Harald Welte9e002452010-05-11 21:53:49 +02001804#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
1805 "NSVC Logical Number\n"
Harald Welte4a048c52010-03-22 11:48:36 +08001806
Harald Welte3055e332010-03-14 15:37:43 +08001807DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
1808 "gprs nsvc <0-1> nsvci <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001809 GPRS_TEXT NSVC_TEXT
1810 "NS Virtual Connection Identifier\n"
Harald Welte3055e332010-03-14 15:37:43 +08001811 "GPRS NS VC Identifier")
1812{
1813 struct gsm_bts *bts = vty->index;
1814 int idx = atoi(argv[0]);
1815
Harald Weltecb20b7a2010-04-18 15:51:20 +02001816 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001817 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1818 return CMD_WARNING;
1819 }
1820
Harald Welte3055e332010-03-14 15:37:43 +08001821 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
1822
1823 return CMD_SUCCESS;
1824}
1825
Harald Welte410575a2010-03-14 23:30:30 +08001826DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
1827 "gprs nsvc <0-1> local udp port <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001828 GPRS_TEXT NSVC_TEXT
Harald Welte410575a2010-03-14 23:30:30 +08001829 "GPRS NS Local UDP Port")
1830{
1831 struct gsm_bts *bts = vty->index;
1832 int idx = atoi(argv[0]);
1833
Harald Weltecb20b7a2010-04-18 15:51:20 +02001834 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001835 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1836 return CMD_WARNING;
1837 }
1838
Harald Welte410575a2010-03-14 23:30:30 +08001839 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
1840
1841 return CMD_SUCCESS;
1842}
1843
1844DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
1845 "gprs nsvc <0-1> remote udp port <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02001846 GPRS_TEXT NSVC_TEXT
Harald Welte410575a2010-03-14 23:30:30 +08001847 "GPRS NS Remote UDP Port")
1848{
1849 struct gsm_bts *bts = vty->index;
1850 int idx = atoi(argv[0]);
1851
Harald Weltecb20b7a2010-04-18 15:51:20 +02001852 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001853 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1854 return CMD_WARNING;
1855 }
1856
Harald Welte410575a2010-03-14 23:30:30 +08001857 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
1858
1859 return CMD_SUCCESS;
1860}
1861
1862DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
1863 "gprs nsvc <0-1> remote ip A.B.C.D",
Harald Welte9e002452010-05-11 21:53:49 +02001864 GPRS_TEXT NSVC_TEXT
Harald Welte410575a2010-03-14 23:30:30 +08001865 "GPRS NS Remote IP Address")
1866{
1867 struct gsm_bts *bts = vty->index;
1868 int idx = atoi(argv[0]);
1869 struct in_addr ia;
1870
Harald Weltecb20b7a2010-04-18 15:51:20 +02001871 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001872 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1873 return CMD_WARNING;
1874 }
1875
Harald Welte410575a2010-03-14 23:30:30 +08001876 inet_aton(argv[1], &ia);
1877 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
1878
1879 return CMD_SUCCESS;
1880}
1881
Holger Hans Peter Freyther3112f672010-09-06 10:11:25 +08001882DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd,
1883 "paging free FREE_NR",
1884 "Only page when having a certain amount of free slots. -1 to disable")
1885{
1886 struct gsm_bts *bts = vty->index;
1887
1888 bts->paging.free_chans_need = atoi(argv[0]);
1889 return CMD_SUCCESS;
1890}
1891
Harald Weltea9251762010-05-11 23:50:21 +02001892DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd,
1893 "gprs ns timer " NS_TIMERS " <0-255>",
1894 GPRS_TEXT "Network Service\n"
1895 "Network Service Timer\n"
1896 NS_TIMERS_HELP "Timer Value\n")
1897{
1898 struct gsm_bts *bts = vty->index;
1899 int idx = get_string_value(gprs_ns_timer_strs, argv[0]);
1900 int val = atoi(argv[1]);
1901
1902 if (bts->gprs.mode == BTS_GPRS_NONE) {
1903 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1904 return CMD_WARNING;
1905 }
1906
1907 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
1908 return CMD_WARNING;
1909
1910 bts->gprs.nse.timer[idx] = val;
1911
1912 return CMD_SUCCESS;
1913}
1914
1915#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 +02001916#define BSSGP_TIMERS_HELP \
1917 "Tbvc-block timeout\n" \
1918 "Tbvc-block retries\n" \
1919 "Tbvc-unblock retries\n" \
1920 "Tbvcc-reset timeout\n" \
1921 "Tbvc-reset retries\n" \
1922 "Tbvc-suspend timeout\n" \
1923 "Tbvc-suspend retries\n" \
1924 "Tbvc-resume timeout\n" \
1925 "Tbvc-resume retries\n" \
1926 "Tbvc-capa-update timeout\n" \
1927 "Tbvc-capa-update retries\n"
Harald Weltea9251762010-05-11 23:50:21 +02001928
1929DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd,
1930 "gprs cell timer " BSSGP_TIMERS " <0-255>",
1931 GPRS_TEXT "Cell / BSSGP\n"
1932 "Cell/BSSGP Timer\n"
1933 BSSGP_TIMERS_HELP "Timer Value\n")
1934{
1935 struct gsm_bts *bts = vty->index;
1936 int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
1937 int val = atoi(argv[1]);
1938
1939 if (bts->gprs.mode == BTS_GPRS_NONE) {
1940 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1941 return CMD_WARNING;
1942 }
1943
1944 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer))
1945 return CMD_WARNING;
1946
1947 bts->gprs.cell.timer[idx] = val;
1948
1949 return CMD_SUCCESS;
1950}
1951
Harald Welte3055e332010-03-14 15:37:43 +08001952DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
1953 "gprs routing area <0-255>",
Harald Welte9e002452010-05-11 21:53:49 +02001954 GPRS_TEXT
Harald Welte3055e332010-03-14 15:37:43 +08001955 "GPRS Routing Area Code")
1956{
1957 struct gsm_bts *bts = vty->index;
1958
Harald Weltecb20b7a2010-04-18 15:51:20 +02001959 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08001960 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1961 return CMD_WARNING;
1962 }
1963
Harald Welte3055e332010-03-14 15:37:43 +08001964 bts->gprs.rac = atoi(argv[0]);
1965
1966 return CMD_SUCCESS;
1967}
1968
Harald Weltecb20b7a2010-04-18 15:51:20 +02001969DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
1970 "gprs mode (none|gprs|egprs)",
Harald Welte9e002452010-05-11 21:53:49 +02001971 GPRS_TEXT
1972 "GPRS Mode for this BTS\n"
1973 "GPRS Disabled on this BTS\n"
1974 "GPRS Enabled on this BTS\n"
1975 "EGPRS (EDGE) Enabled on this BTS\n")
Harald Welte410575a2010-03-14 23:30:30 +08001976{
1977 struct gsm_bts *bts = vty->index;
Harald Welte20e275a2010-06-14 22:44:42 +02001978 enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0]);
Harald Welte410575a2010-03-14 23:30:30 +08001979
Harald Welte20e275a2010-06-14 22:44:42 +02001980 if (mode != BTS_GPRS_NONE &&
1981 !gsm_bts_has_feature(bts, BTS_FEAT_GPRS)) {
1982 vty_out(vty, "This BTS type does not support %s%s", argv[0],
1983 VTY_NEWLINE);
1984 return CMD_WARNING;
1985 }
1986 if (mode == BTS_GPRS_EGPRS &&
1987 !gsm_bts_has_feature(bts, BTS_FEAT_EGPRS)) {
1988 vty_out(vty, "This BTS type does not support %s%s", argv[0],
1989 VTY_NEWLINE);
1990 return CMD_WARNING;
1991 }
1992
1993 bts->gprs.mode = mode;
Harald Welte410575a2010-03-14 23:30:30 +08001994
1995 return CMD_SUCCESS;
1996}
1997
Harald Welted8acf142010-07-30 11:50:09 +02001998#define SI_TEXT "System Information Messages\n"
1999#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)"
2000#define SI_TYPE_HELP "System Information Type 1\n" \
2001 "System Information Type 2\n" \
2002 "System Information Type 3\n" \
2003 "System Information Type 4\n" \
2004 "System Information Type 5\n" \
2005 "System Information Type 6\n" \
2006 "System Information Type 7\n" \
2007 "System Information Type 8\n" \
2008 "System Information Type 9\n" \
2009 "System Information Type 10\n" \
2010 "System Information Type 13\n" \
2011 "System Information Type 16\n" \
2012 "System Information Type 17\n" \
2013 "System Information Type 18\n" \
2014 "System Information Type 19\n" \
2015 "System Information Type 20\n" \
2016 "System Information Type 2bis\n" \
2017 "System Information Type 2ter\n" \
2018 "System Information Type 2quater\n" \
2019 "System Information Type 5bis\n" \
2020 "System Information Type 5ter\n"
2021
2022DEFUN(cfg_bts_si_mode, cfg_bts_si_mode_cmd,
2023 "system-information " SI_TYPE_TEXT " mode (static|computed)",
2024 SI_TEXT SI_TYPE_HELP
2025 "System Information Mode\n"
2026 "Static user-specified\n"
2027 "Dynamic, BSC-computed\n")
2028{
2029 struct gsm_bts *bts = vty->index;
2030 int type;
2031
2032 type = get_string_value(osmo_sitype_strs, argv[0]);
2033 if (type < 0) {
2034 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2035 return CMD_WARNING;
2036 }
2037
2038 if (!strcmp(argv[1], "static"))
2039 bts->si_mode_static |= (1 << type);
2040 else
2041 bts->si_mode_static &= ~(1 << type);
2042
2043 return CMD_SUCCESS;
2044}
2045
2046DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd,
2047 "system-information " SI_TYPE_TEXT " static HEXSTRING",
2048 SI_TEXT SI_TYPE_HELP
2049 "Static System Information filling\n"
2050 "Static user-specified SI content in HEX notation\n")
2051{
2052 struct gsm_bts *bts = vty->index;
2053 int rc, type;
2054
2055 type = get_string_value(osmo_sitype_strs, argv[0]);
2056 if (type < 0) {
2057 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2058 return CMD_WARNING;
2059 }
2060
2061 if (!(bts->si_mode_static & (1 << type))) {
2062 vty_out(vty, "SI Type %s is not configured in static mode%s",
2063 get_value_string(osmo_sitype_strs, type), VTY_NEWLINE);
2064 return CMD_WARNING;
2065 }
2066
Harald Welte9f09ac32010-07-30 11:53:18 +02002067 /* Fill buffer with padding pattern */
2068 memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type]));
2069
2070 /* Parse the user-specified SI in hex format, [partially] overwriting padding */
Harald Welted8acf142010-07-30 11:50:09 +02002071 rc = hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0]));
2072 if (rc < 0 || rc > sizeof(bts->si_buf[0])) {
2073 vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
2074 return CMD_WARNING;
2075 }
2076
2077 /* Mark this SI as present */
2078 bts->si_valid |= (1 << type);
2079
2080 return CMD_SUCCESS;
2081}
2082
2083
Harald Welte9e002452010-05-11 21:53:49 +02002084#define TRX_TEXT "Radio Transceiver\n"
Harald Welte3e774612009-08-10 13:48:16 +02002085
Harald Welte59b04682009-06-10 05:40:52 +08002086/* per TRX configuration */
2087DEFUN(cfg_trx,
2088 cfg_trx_cmd,
2089 "trx TRX_NR",
Harald Welte9e002452010-05-11 21:53:49 +02002090 TRX_TEXT
Harald Welte59b04682009-06-10 05:40:52 +08002091 "Select a TRX to configure")
2092{
2093 int trx_nr = atoi(argv[0]);
2094 struct gsm_bts *bts = vty->index;
2095 struct gsm_bts_trx *trx;
2096
Harald Weltee712a5f2009-06-21 16:17:15 +02002097 if (trx_nr > bts->num_trx) {
2098 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
2099 bts->num_trx, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +08002100 return CMD_WARNING;
Harald Weltee712a5f2009-06-21 16:17:15 +02002101 } else if (trx_nr == bts->num_trx) {
2102 /* we need to allocate a new one */
2103 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +02002104 } else
Harald Weltee712a5f2009-06-21 16:17:15 +02002105 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +02002106
Harald Weltee712a5f2009-06-21 16:17:15 +02002107 if (!trx)
2108 return CMD_WARNING;
Harald Welte59b04682009-06-10 05:40:52 +08002109
2110 vty->index = trx;
Harald Welte8791dac2010-05-14 17:59:53 +02002111 vty->index_sub = &trx->description;
Harald Welte59b04682009-06-10 05:40:52 +08002112 vty->node = TRX_NODE;
2113
2114 return CMD_SUCCESS;
2115}
2116
2117DEFUN(cfg_trx_arfcn,
2118 cfg_trx_arfcn_cmd,
Harald Welte00044592010-05-14 19:00:52 +02002119 "arfcn <0-1024>",
Harald Welte59b04682009-06-10 05:40:52 +08002120 "Set the ARFCN for this TRX\n")
2121{
2122 int arfcn = atoi(argv[0]);
2123 struct gsm_bts_trx *trx = vty->index;
2124
2125 /* FIXME: check if this ARFCN is supported by this TRX */
2126
2127 trx->arfcn = arfcn;
2128
2129 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
2130 /* FIXME: use OML layer to update the ARFCN */
2131 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
2132
2133 return CMD_SUCCESS;
2134}
2135
Harald Welte (local)b709bfe2009-12-27 20:56:38 +01002136DEFUN(cfg_trx_nominal_power,
2137 cfg_trx_nominal_power_cmd,
2138 "nominal power <0-100>",
2139 "Nominal TRX RF Power in dB\n")
2140{
2141 struct gsm_bts_trx *trx = vty->index;
2142
2143 trx->nominal_power = atoi(argv[0]);
2144
2145 return CMD_SUCCESS;
2146}
2147
Harald Welte91afe4c2009-06-20 18:15:19 +02002148DEFUN(cfg_trx_max_power_red,
2149 cfg_trx_max_power_red_cmd,
2150 "max_power_red <0-100>",
2151 "Reduction of maximum BS RF Power in dB\n")
2152{
2153 int maxpwr_r = atoi(argv[0]);
2154 struct gsm_bts_trx *trx = vty->index;
Harald Welte01acd742009-11-18 09:20:22 +01002155 int upper_limit = 24; /* default 12.21 max power red. */
Harald Welte91afe4c2009-06-20 18:15:19 +02002156
2157 /* FIXME: check if our BTS type supports more than 12 */
2158 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
2159 vty_out(vty, "%% Power %d dB is not in the valid range%s",
2160 maxpwr_r, VTY_NEWLINE);
2161 return CMD_WARNING;
2162 }
2163 if (maxpwr_r & 1) {
2164 vty_out(vty, "%% Power %d dB is not an even value%s",
2165 maxpwr_r, VTY_NEWLINE);
2166 return CMD_WARNING;
2167 }
2168
2169 trx->max_power_red = maxpwr_r;
2170
2171 /* FIXME: make sure we update this using OML */
2172
2173 return CMD_SUCCESS;
2174}
2175
Harald Welte62868882009-08-08 16:12:58 +02002176DEFUN(cfg_trx_rsl_e1,
2177 cfg_trx_rsl_e1_cmd,
2178 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
2179 "E1 interface to be used for RSL\n")
2180{
2181 struct gsm_bts_trx *trx = vty->index;
2182
2183 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
2184
2185 return CMD_SUCCESS;
2186}
2187
2188DEFUN(cfg_trx_rsl_e1_tei,
2189 cfg_trx_rsl_e1_tei_cmd,
2190 "rsl e1 tei <0-63>",
2191 "Set the TEI to be used for RSL")
2192{
2193 struct gsm_bts_trx *trx = vty->index;
2194
2195 trx->rsl_tei = atoi(argv[0]);
2196
2197 return CMD_SUCCESS;
2198}
2199
Holger Hans Peter Freyther1c8b4802009-11-11 11:54:24 +01002200DEFUN(cfg_trx_rf_locked,
2201 cfg_trx_rf_locked_cmd,
2202 "rf_locked (0|1)",
2203 "Turn off RF of the TRX.\n")
2204{
2205 int locked = atoi(argv[0]);
2206 struct gsm_bts_trx *trx = vty->index;
2207
2208 gsm_trx_lock_rf(trx, locked);
2209 return CMD_SUCCESS;
2210}
Harald Welte62868882009-08-08 16:12:58 +02002211
Harald Welte59b04682009-06-10 05:40:52 +08002212/* per TS configuration */
2213DEFUN(cfg_ts,
2214 cfg_ts_cmd,
Harald Welte62868882009-08-08 16:12:58 +02002215 "timeslot <0-7>",
Harald Welte59b04682009-06-10 05:40:52 +08002216 "Select a Timeslot to configure")
2217{
2218 int ts_nr = atoi(argv[0]);
2219 struct gsm_bts_trx *trx = vty->index;
2220 struct gsm_bts_trx_ts *ts;
2221
2222 if (ts_nr >= TRX_NR_TS) {
2223 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
2224 TRX_NR_TS, VTY_NEWLINE);
2225 return CMD_WARNING;
2226 }
2227
2228 ts = &trx->ts[ts_nr];
2229
2230 vty->index = ts;
2231 vty->node = TS_NODE;
2232
2233 return CMD_SUCCESS;
2234}
2235
Harald Welte3ffe1b32009-08-07 00:25:23 +02002236DEFUN(cfg_ts_pchan,
2237 cfg_ts_pchan_cmd,
2238 "phys_chan_config PCHAN",
2239 "Physical Channel configuration (TCH/SDCCH/...)")
2240{
2241 struct gsm_bts_trx_ts *ts = vty->index;
2242 int pchanc;
2243
2244 pchanc = gsm_pchan_parse(argv[0]);
2245 if (pchanc < 0)
2246 return CMD_WARNING;
2247
2248 ts->pchan = pchanc;
2249
2250 return CMD_SUCCESS;
2251}
2252
Harald Weltea42a93f2010-06-14 22:26:10 +02002253#define HOPPING_STR "Configure frequency hopping\n"
2254
2255DEFUN(cfg_ts_hopping,
2256 cfg_ts_hopping_cmd,
2257 "hopping enabled (0|1)",
2258 HOPPING_STR "Enable or disable frequency hopping\n"
2259 "Disable frequency hopping\n" "Enable frequency hopping\n")
2260{
2261 struct gsm_bts_trx_ts *ts = vty->index;
Harald Welte059c1ef2010-06-14 22:47:37 +02002262 int enabled = atoi(argv[0]);
Harald Weltea42a93f2010-06-14 22:26:10 +02002263
Harald Welte059c1ef2010-06-14 22:47:37 +02002264 if (enabled && !gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_HOPPING)) {
2265 vty_out(vty, "BTS model does not support hopping%s",
2266 VTY_NEWLINE);
2267 return CMD_WARNING;
2268 }
2269
2270 ts->hopping.enabled = enabled;
Harald Weltea42a93f2010-06-14 22:26:10 +02002271
2272 return CMD_SUCCESS;
2273}
2274
Harald Welte67104d12009-09-12 13:05:33 +02002275DEFUN(cfg_ts_hsn,
2276 cfg_ts_hsn_cmd,
Harald Weltea42a93f2010-06-14 22:26:10 +02002277 "hopping sequence-number <0-63>",
2278 HOPPING_STR
Harald Welte67104d12009-09-12 13:05:33 +02002279 "Which hopping sequence to use for this channel")
2280{
2281 struct gsm_bts_trx_ts *ts = vty->index;
2282
2283 ts->hopping.hsn = atoi(argv[0]);
2284
2285 return CMD_SUCCESS;
2286}
2287
2288DEFUN(cfg_ts_maio,
2289 cfg_ts_maio_cmd,
2290 "hopping maio <0-63>",
Harald Weltea42a93f2010-06-14 22:26:10 +02002291 HOPPING_STR
Harald Welte67104d12009-09-12 13:05:33 +02002292 "Which hopping MAIO to use for this channel")
2293{
2294 struct gsm_bts_trx_ts *ts = vty->index;
2295
2296 ts->hopping.maio = atoi(argv[0]);
2297
2298 return CMD_SUCCESS;
2299}
2300
2301DEFUN(cfg_ts_arfcn_add,
2302 cfg_ts_arfcn_add_cmd,
2303 "hopping arfcn add <0-1023>",
Harald Weltea42a93f2010-06-14 22:26:10 +02002304 HOPPING_STR "Configure hopping ARFCN list\n"
2305 "Add an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte67104d12009-09-12 13:05:33 +02002306{
2307 struct gsm_bts_trx_ts *ts = vty->index;
2308 int arfcn = atoi(argv[0]);
2309
Harald Weltea42a93f2010-06-14 22:26:10 +02002310 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1);
2311
Harald Welte67104d12009-09-12 13:05:33 +02002312 return CMD_SUCCESS;
2313}
2314
2315DEFUN(cfg_ts_arfcn_del,
2316 cfg_ts_arfcn_del_cmd,
2317 "hopping arfcn del <0-1023>",
Harald Weltea42a93f2010-06-14 22:26:10 +02002318 HOPPING_STR "Configure hopping ARFCN list\n"
2319 "Delete an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte67104d12009-09-12 13:05:33 +02002320{
2321 struct gsm_bts_trx_ts *ts = vty->index;
2322 int arfcn = atoi(argv[0]);
2323
Harald Weltea42a93f2010-06-14 22:26:10 +02002324 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0);
2325
Harald Welte67104d12009-09-12 13:05:33 +02002326 return CMD_SUCCESS;
2327}
2328
Harald Welte3ffe1b32009-08-07 00:25:23 +02002329DEFUN(cfg_ts_e1_subslot,
2330 cfg_ts_e1_subslot_cmd,
Harald Welte62868882009-08-08 16:12:58 +02002331 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte3ffe1b32009-08-07 00:25:23 +02002332 "E1 sub-slot connected to this on-air timeslot")
2333{
2334 struct gsm_bts_trx_ts *ts = vty->index;
2335
Harald Welte62868882009-08-08 16:12:58 +02002336 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Welte3ffe1b32009-08-07 00:25:23 +02002337
2338 return CMD_SUCCESS;
2339}
Harald Welte59b04682009-06-10 05:40:52 +08002340
Harald Weltea5b1dae2010-05-16 21:47:13 +02002341void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
2342{
2343 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
2344 counter_get(net->stats.chreq.total),
2345 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
2346 vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
2347 counter_get(net->stats.chan.rf_fail),
2348 counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
2349 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
2350 counter_get(net->stats.paging.attempted),
2351 counter_get(net->stats.paging.completed),
2352 counter_get(net->stats.paging.expired), VTY_NEWLINE);
2353 vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
2354 counter_get(net->stats.bts.oml_fail),
2355 counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
2356}
2357
Harald Welte682ee5f2010-05-16 22:02:16 +02002358DEFUN(logging_fltr_imsi,
2359 logging_fltr_imsi_cmd,
2360 "logging filter imsi IMSI",
2361 LOGGING_STR FILTER_STR
2362 "Filter log messages by IMSI\n" "IMSI to be used as filter\n")
2363{
2364 struct telnet_connection *conn;
2365
2366 conn = (struct telnet_connection *) vty->priv;
2367 if (!conn->dbg) {
2368 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
2369 return CMD_WARNING;
2370 }
2371
2372 log_set_imsi_filter(conn->dbg, argv[0]);
2373 return CMD_SUCCESS;
2374}
2375
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02002376DEFUN(drop_bts,
2377 drop_bts_cmd,
Holger Hans Peter Freythere4ac0e42010-04-11 12:46:45 +02002378 "drop bts connection <0-65535> (oml|rsl)",
2379 "Debug/Simulation command to drop ipaccess BTS\n"
2380 "BTS NR\n" "Connection Type\n")
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02002381{
2382 struct gsm_network *gsmnet;
2383 struct gsm_bts_trx *trx;
2384 struct gsm_bts *bts;
2385 unsigned int bts_nr;
2386
2387 gsmnet = gsmnet_from_vty(vty);
2388
2389 bts_nr = atoi(argv[0]);
2390 if (bts_nr >= gsmnet->num_bts) {
2391 vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s",
2392 gsmnet->num_bts, bts_nr, VTY_NEWLINE);
2393 return CMD_WARNING;
2394 }
2395
2396 bts = gsm_bts_num(gsmnet, bts_nr);
2397 if (!bts) {
2398 vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE);
2399 return CMD_WARNING;
2400 }
2401
2402 if (!is_ipaccess_bts(bts)) {
2403 vty_out(vty, "This command only works for ipaccess.%s", VTY_NEWLINE);
2404 return CMD_WARNING;
2405 }
2406
2407
2408 /* close all connections */
2409 if (strcmp(argv[1], "oml") == 0) {
Holger Hans Peter Freyther03f17d02010-11-15 20:29:46 +01002410 ipaccess_drop_oml(bts);
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02002411 } else if (strcmp(argv[1], "rsl") == 0) {
2412 /* close all rsl connections */
2413 llist_for_each_entry(trx, &bts->trx_list, list) {
Holger Hans Peter Freyther03f17d02010-11-15 20:29:46 +01002414 ipaccess_drop_rsl(trx);
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02002415 }
2416 } else {
2417 vty_out(vty, "Argument must be 'oml# or 'rsl'.%s", VTY_NEWLINE);
2418 return CMD_WARNING;
2419 }
2420
2421 return CMD_SUCCESS;
2422}
2423
Harald Welte5213e992010-12-23 13:18:07 +01002424DEFUN(pdch_act, pdch_act_cmd,
2425 "bts <0-255> trx <0-255> timeslot <0-7> pdch (activate|deactivate)",
2426 "BTS related commands\n" "BTS Number\n" "Transceiver\n" "Transceiver Number\n"
2427 "TRX Timeslot\n" "Timeslot Number\n" "Packet Data Channel\n"
2428 "Activate Dynamic PDCH/TCH (-> PDCH mode)\n"
2429 "Deactivate Dynamic PDCH/TCH (-> TCH mode)\n")
2430{
2431 struct gsm_bts *bts;
2432 struct gsm_bts_trx *trx;
2433 struct gsm_bts_trx_ts *ts;
2434 int bts_nr = atoi(argv[0]);
2435 int trx_nr = atoi(argv[1]);
2436 int ts_nr = atoi(argv[2]);
2437 int activate;
2438
2439 bts = gsm_bts_num(bsc_gsmnet, bts_nr);
2440 if (!bts) {
2441 vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE);
2442 return CMD_WARNING;
2443 }
2444
2445 if (!is_ipaccess_bts(bts)) {
2446 vty_out(vty, "%% This command only works for ipaccess BTS%s",
2447 VTY_NEWLINE);
2448 return CMD_WARNING;
2449 }
2450
2451 trx = gsm_bts_trx_num(bts, trx_nr);
2452 if (!trx) {
2453 vty_out(vty, "%% No such TRX (%d)%s", trx_nr, VTY_NEWLINE);
2454 return CMD_WARNING;
2455 }
2456
2457 ts = &trx->ts[ts_nr];
2458 if (ts->pchan != GSM_PCHAN_TCH_F_PDCH) {
2459 vty_out(vty, "%% Timeslot %u is not in dynamic TCH_F/PDCH "
2460 "mode%s", ts_nr, VTY_NEWLINE);
2461 return CMD_WARNING;
2462 }
2463
2464 if (!strcmp(argv[3], "activate"))
2465 activate = 1;
2466 else
2467 activate = 0;
2468
2469 rsl_ipacc_pdch_activate(ts, activate);
2470
2471 return CMD_SUCCESS;
2472
2473}
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02002474
Harald Welte40152872010-05-16 20:52:23 +02002475extern int bsc_vty_init_extra(void);
Harald Welte10c29f62010-05-16 19:20:24 +02002476extern const char *openbsc_copyright;
Holger Hans Peter Freytherc48a2a12010-04-10 00:08:28 +02002477
Harald Welte40152872010-05-16 20:52:23 +02002478int bsc_vty_init(void)
Harald Welte59b04682009-06-10 05:40:52 +08002479{
Harald Welte7bc28f62010-05-12 16:10:35 +00002480 install_element_ve(&show_net_cmd);
2481 install_element_ve(&show_bts_cmd);
2482 install_element_ve(&show_trx_cmd);
2483 install_element_ve(&show_ts_cmd);
2484 install_element_ve(&show_lchan_cmd);
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +08002485 install_element_ve(&show_lchan_summary_cmd);
Harald Welte682ee5f2010-05-16 22:02:16 +02002486 install_element_ve(&logging_fltr_imsi_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002487
Harald Welte7bc28f62010-05-12 16:10:35 +00002488 install_element_ve(&show_e1drv_cmd);
2489 install_element_ve(&show_e1line_cmd);
2490 install_element_ve(&show_e1ts_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002491
Harald Welte7bc28f62010-05-12 16:10:35 +00002492 install_element_ve(&show_paging_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002493
Harald Welte682ee5f2010-05-16 22:02:16 +02002494 logging_vty_add_cmds();
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +01002495
Harald Weltee87eb462009-08-07 13:29:14 +02002496 install_element(CONFIG_NODE, &cfg_net_cmd);
2497 install_node(&net_node, config_write_net);
2498 install_default(GSMNET_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002499 install_element(GSMNET_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002500 install_element(GSMNET_NODE, &ournode_end_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002501 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Weltee87eb462009-08-07 13:29:14 +02002502 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
2503 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
2504 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +02002505 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte59936d72009-11-18 20:33:19 +01002506 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Weltecca253a2009-08-30 15:47:06 +09002507 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01002508 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welte52af1952009-12-13 10:53:12 +01002509 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte284ddba2009-12-14 17:49:15 +01002510 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Welte0af9c9f2009-12-19 21:41:52 +01002511 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Weltea8062f12009-12-21 16:51:50 +01002512 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
2513 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
2514 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
2515 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
2516 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
2517 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01002518 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +01002519 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
2520 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
2521 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
2522 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
2523 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
2524 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
2525 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
2526 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
2527 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
2528 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Holger Hans Peter Freyther21d63ff2010-09-06 09:25:48 +08002529 install_element(GSMNET_NODE, &cfg_net_dtx_cmd);
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +08002530 install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd);
Harald Weltee87eb462009-08-07 13:29:14 +02002531
2532 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte97ceef92009-08-06 19:06:46 +02002533 install_node(&bts_node, config_write_bts);
Harald Welte59b04682009-06-10 05:40:52 +08002534 install_default(BTS_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002535 install_element(BTS_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002536 install_element(BTS_NODE, &ournode_end_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002537 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte8791dac2010-05-14 17:59:53 +02002538 install_element(BTS_NODE, &cfg_description_cmd);
2539 install_element(BTS_NODE, &cfg_no_description_cmd);
Harald Welte91afe4c2009-06-20 18:15:19 +02002540 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +02002541 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002542 install_element(BTS_NODE, &cfg_bts_lac_cmd);
2543 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002544 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002545 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte25572872009-10-20 00:22:00 +02002546 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002547 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
2548 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte3e774612009-08-10 13:48:16 +02002549 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01002550 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
2551 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08002552 install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd);
2553 install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd);
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02002554 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Holger Hans Peter Freyther440984b2010-05-14 00:39:19 +08002555 install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd);
Harald Welte (local)cbd46102009-08-13 10:14:26 +02002556 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02002557 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welteb761bf82009-12-12 18:17:25 +01002558 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
2559 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Sylvain Munaut00d71462010-11-28 18:17:28 +01002560 install_element(BTS_NODE, &cfg_bts_cell_bar_qualify_cmd);
2561 install_element(BTS_NODE, &cfg_bts_cell_resel_ofs_cmd);
2562 install_element(BTS_NODE, &cfg_bts_temp_ofs_cmd);
2563 install_element(BTS_NODE, &cfg_bts_temp_ofs_inf_cmd);
2564 install_element(BTS_NODE, &cfg_bts_penalty_time_cmd);
2565 install_element(BTS_NODE, &cfg_bts_penalty_time_rsvd_cmd);
Harald Weltecb20b7a2010-04-18 15:51:20 +02002566 install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
Harald Weltea9251762010-05-11 23:50:21 +02002567 install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd);
Harald Welte3055e332010-03-14 15:37:43 +08002568 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
2569 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Weltea9251762010-05-11 23:50:21 +02002570 install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
Harald Welte4a048c52010-03-22 11:48:36 +08002571 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte3055e332010-03-14 15:37:43 +08002572 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welte410575a2010-03-14 23:30:30 +08002573 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
2574 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
2575 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Holger Hans Peter Freyther3112f672010-09-06 10:11:25 +08002576 install_element(BTS_NODE, &cfg_bts_pag_free_cmd);
Harald Welted8acf142010-07-30 11:50:09 +02002577 install_element(BTS_NODE, &cfg_bts_si_mode_cmd);
2578 install_element(BTS_NODE, &cfg_bts_si_static_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002579
2580 install_element(BTS_NODE, &cfg_trx_cmd);
2581 install_node(&trx_node, dummy_config_write);
2582 install_default(TRX_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002583 install_element(TRX_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002584 install_element(TRX_NODE, &ournode_end_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002585 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte8791dac2010-05-14 17:59:53 +02002586 install_element(TRX_NODE, &cfg_description_cmd);
2587 install_element(TRX_NODE, &cfg_no_description_cmd);
Harald Welte (local)b709bfe2009-12-27 20:56:38 +01002588 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte7f597bc2009-06-20 22:36:12 +02002589 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte62868882009-08-08 16:12:58 +02002590 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
2591 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther1c8b4802009-11-11 11:54:24 +01002592 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002593
2594 install_element(TRX_NODE, &cfg_ts_cmd);
2595 install_node(&ts_node, dummy_config_write);
2596 install_default(TS_NODE);
Harald Welte58ed1cb2010-05-14 18:59:17 +02002597 install_element(TS_NODE, &ournode_exit_cmd);
Harald Weltedc82b9b2010-05-14 19:11:04 +02002598 install_element(TS_NODE, &ournode_end_cmd);
Harald Welte3ffe1b32009-08-07 00:25:23 +02002599 install_element(TS_NODE, &cfg_ts_pchan_cmd);
Harald Weltea42a93f2010-06-14 22:26:10 +02002600 install_element(TS_NODE, &cfg_ts_hopping_cmd);
Harald Welte67104d12009-09-12 13:05:33 +02002601 install_element(TS_NODE, &cfg_ts_hsn_cmd);
2602 install_element(TS_NODE, &cfg_ts_maio_cmd);
2603 install_element(TS_NODE, &cfg_ts_arfcn_add_cmd);
2604 install_element(TS_NODE, &cfg_ts_arfcn_del_cmd);
Harald Welte3ffe1b32009-08-07 00:25:23 +02002605 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08002606
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02002607 install_element(ENABLE_NODE, &drop_bts_cmd);
Harald Welte5213e992010-12-23 13:18:07 +01002608 install_element(ENABLE_NODE, &pdch_act_cmd);
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02002609
Harald Welte63b964e2010-05-31 16:40:40 +02002610 abis_nm_vty_init();
2611
Harald Welte40152872010-05-16 20:52:23 +02002612 bsc_vty_init_extra();
Harald Welte59b04682009-06-10 05:40:52 +08002613
2614 return 0;
2615}