blob: e5cc3a871d0934b472b595b87920832bfd967a1b [file] [log] [blame]
Harald Welte68628e82009-03-10 12:17:57 +00001/* OpenBSC interface to quagga VTY */
Harald Welteaf387632010-03-14 23:30:30 +08002/* (C) 2009-2010 by Harald Welte <laforge@gnumonks.org>
Harald Welte68628e82009-03-10 12:17:57 +00003 * All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
Harald Welte9af6ddf2011-01-01 15:25:50 +01006 * it under the terms of the GNU Affero General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
Harald Welte68628e82009-03-10 12:17:57 +00008 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Harald Welte9af6ddf2011-01-01 15:25:50 +010013 * GNU Affero General Public License for more details.
Harald Welte68628e82009-03-10 12:17:57 +000014 *
Harald Welte9af6ddf2011-01-01 15:25:50 +010015 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
Harald Welte68628e82009-03-10 12:17:57 +000017 *
18 */
19
20#include <stdlib.h>
21#include <unistd.h>
22#include <sys/types.h>
23
Harald Welte4b037e42010-05-19 19:45:32 +020024#include <osmocom/vty/command.h>
25#include <osmocom/vty/buffer.h>
26#include <osmocom/vty/vty.h>
27#include <osmocom/vty/logging.h>
28#include <osmocom/vty/telnet_interface.h>
Harald Welte68628e82009-03-10 12:17:57 +000029
30#include <arpa/inet.h>
31
Harald Weltedfe6c7d2010-02-20 16:24:02 +010032#include <osmocore/linuxlist.h>
Harald Welte68628e82009-03-10 12:17:57 +000033#include <openbsc/gsm_data.h>
Harald Welte68628e82009-03-10 12:17:57 +000034#include <openbsc/e1_input.h>
Harald Welte1bc77352009-03-10 19:47:51 +000035#include <openbsc/abis_nm.h>
Harald Welte9fbff4a2010-07-30 11:50:09 +020036#include <osmocore/utils.h>
Harald Weltedfe6c7d2010-02-20 16:24:02 +010037#include <osmocore/gsm_utils.h>
Harald Welteb908cb72009-12-22 13:09:29 +010038#include <openbsc/chan_alloc.h>
Harald Welte8387a492009-12-22 21:43:14 +010039#include <openbsc/meas_rep.h>
Harald Welte40f82892009-05-23 17:31:39 +000040#include <openbsc/db.h>
Harald Weltedfe6c7d2010-02-20 16:24:02 +010041#include <osmocore/talloc.h>
Holger Hans Peter Freyther3c712322010-04-06 11:55:37 +020042#include <openbsc/vty.h>
Harald Welte22229d62010-05-12 20:28:04 +020043#include <openbsc/gprs_ns.h>
Harald Welte9fbff4a2010-07-30 11:50:09 +020044#include <openbsc/system_information.h>
Harald Welte5bc61dc2010-05-16 22:02:16 +020045#include <openbsc/debug.h>
Holger Hans Peter Freyther85334f12010-11-09 17:00:42 +010046#include <openbsc/paging.h>
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +010047#include <openbsc/ipaccess.h>
Harald Welted0d2b0b2010-12-23 13:18:07 +010048#include <openbsc/abis_rsl.h>
Harald Welte68628e82009-03-10 12:17:57 +000049
Harald Welte1353f962010-05-16 19:20:24 +020050#include "../bscconfig.h"
51
Harald Welteea4647d2010-05-12 17:19:53 +000052/* FIXME: this should go to some common file */
53static const struct value_string gprs_ns_timer_strs[] = {
Harald Welte615e9562010-05-11 23:50:21 +020054 { 0, "tns-block" },
55 { 1, "tns-block-retries" },
56 { 2, "tns-reset" },
57 { 3, "tns-reset-retries" },
58 { 4, "tns-test" },
59 { 5, "tns-alive" },
60 { 6, "tns-alive-retries" },
61 { 0, NULL }
62};
63
Harald Welteea4647d2010-05-12 17:19:53 +000064static const struct value_string gprs_bssgp_cfg_strs[] = {
Harald Welte615e9562010-05-11 23:50:21 +020065 { 0, "blocking-timer" },
66 { 1, "blocking-retries" },
67 { 2, "unblocking-retries" },
68 { 3, "reset-timer" },
69 { 4, "reset-retries" },
70 { 5, "suspend-timer" },
71 { 6, "suspend-retries" },
72 { 7, "resume-timer" },
73 { 8, "resume-retries" },
74 { 9, "capability-update-timer" },
75 { 10, "capability-update-retries" },
76 { 0, NULL }
77};
78
Harald Welte5013b2a2009-08-07 13:29:14 +020079struct cmd_node net_node = {
80 GSMNET_NODE,
81 "%s(network)#",
82 1,
83};
84
Harald Welte68628e82009-03-10 12:17:57 +000085struct cmd_node bts_node = {
86 BTS_NODE,
87 "%s(bts)#",
88 1,
89};
90
91struct cmd_node trx_node = {
92 TRX_NODE,
93 "%s(trx)#",
94 1,
95};
96
97struct cmd_node ts_node = {
98 TS_NODE,
99 "%s(ts)#",
100 1,
101};
102
Harald Welte39231152010-05-27 13:39:40 +0200103extern struct gsm_network *bsc_gsmnet;
104
Harald Weltedcccb182010-05-16 20:52:23 +0200105struct gsm_network *gsmnet_from_vty(struct vty *v)
106{
Harald Welte39231152010-05-27 13:39:40 +0200107 /* In case we read from the config file, the vty->priv cannot
108 * point to a struct telnet_connection, and thus conn->priv
109 * will not point to the gsm_network structure */
110#if 0
Harald Weltedcccb182010-05-16 20:52:23 +0200111 struct telnet_connection *conn = v->priv;
112 return (struct gsm_network *) conn->priv;
Harald Welte39231152010-05-27 13:39:40 +0200113#else
114 return bsc_gsmnet;
115#endif
Harald Weltedcccb182010-05-16 20:52:23 +0200116}
117
Harald Welte68628e82009-03-10 12:17:57 +0000118static int dummy_config_write(struct vty *v)
119{
120 return CMD_SUCCESS;
121}
122
123static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
124{
Harald Welte1bc77352009-03-10 19:47:51 +0000125 vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s",
126 nm_opstate_name(nms->operational), nms->administrative,
127 nm_avail_name(nms->availability), VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000128}
129
Harald Welteb908cb72009-12-22 13:09:29 +0100130static void dump_pchan_load_vty(struct vty *vty, char *prefix,
131 const struct pchan_load *pl)
132{
133 int i;
134
135 for (i = 0; i < ARRAY_SIZE(pl->pchan); i++) {
136 const struct load_counter *lc = &pl->pchan[i];
137 unsigned int percent;
138
139 if (lc->total == 0)
140 continue;
141
142 percent = (lc->used * 100) / lc->total;
143
144 vty_out(vty, "%s%20s: %3u%% (%u/%u)%s", prefix,
145 gsm_pchan_name(i), percent, lc->used, lc->total,
146 VTY_NEWLINE);
147 }
148}
149
Harald Welte68628e82009-03-10 12:17:57 +0000150static void net_dump_vty(struct vty *vty, struct gsm_network *net)
151{
Harald Welteb908cb72009-12-22 13:09:29 +0100152 struct pchan_load pl;
153
Harald Welteef235b52009-03-10 12:34:02 +0000154 vty_out(vty, "BSC is on Country Code %u, Network Code %u "
155 "and has %u BTS%s", net->country_code, net->network_code,
156 net->num_bts, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000157 vty_out(vty, " Long network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000158 net->name_long, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000159 vty_out(vty, " Short network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000160 net->name_short, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200161 vty_out(vty, " Authentication policy: %s%s",
162 gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100163 vty_out(vty, " Location updating reject cause: %u%s",
164 net->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900165 vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption,
166 VTY_NEWLINE);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +0100167 vty_out(vty, " NECI (TCH/H): %u%s", net->neci,
168 VTY_NEWLINE);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +0800169 vty_out(vty, " Use TCH for Paging any: %d%s", net->pag_any_tch,
170 VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100171 vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode),
172 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100173 vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off",
174 VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100175 vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off",
176 VTY_NEWLINE);
Harald Welteb908cb72009-12-22 13:09:29 +0100177 network_chan_load(&pl, net);
178 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
179 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000180}
181
182DEFUN(show_net, show_net_cmd, "show network",
183 SHOW_STR "Display information about a GSM NETWORK\n")
184{
Harald Weltedcccb182010-05-16 20:52:23 +0200185 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000186 net_dump_vty(vty, net);
187
188 return CMD_SUCCESS;
189}
190
191static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l)
192{
Harald Welteedb37782009-05-01 14:59:07 +0000193 struct e1inp_line *line;
194
195 if (!e1l) {
196 vty_out(vty, " None%s", VTY_NEWLINE);
197 return;
198 }
199
200 line = e1l->ts->line;
201
202 vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s",
203 line->num, line->driver->name, e1l->ts->num,
Harald Welte1bc77352009-03-10 19:47:51 +0000204 e1inp_signtype_name(e1l->type), VTY_NEWLINE);
Harald Welteedb37782009-05-01 14:59:07 +0000205 vty_out(vty, " E1 TEI %u, SAPI %u%s",
Harald Welte68628e82009-03-10 12:17:57 +0000206 e1l->tei, e1l->sapi, VTY_NEWLINE);
207}
208
209static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
210{
Harald Welteb908cb72009-12-22 13:09:29 +0100211 struct pchan_load pl;
212
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200213 vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
Harald Weltefcd24452009-06-20 18:15:19 +0200214 "BSIC %u, TSC %u and %u TRX%s",
215 bts->nr, btstype2str(bts->type), gsm_band_name(bts->band),
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200216 bts->cell_identity,
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +0200217 bts->location_area_code, bts->bsic, bts->tsc,
Harald Weltefcd24452009-06-20 18:15:19 +0200218 bts->num_trx, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200219 vty_out(vty, "Description: %s%s",
220 bts->description ? bts->description : "(null)", VTY_NEWLINE);
Harald Welte1d8dbc42009-12-12 15:38:16 +0100221 vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100222 vty_out(vty, "Minimum Rx Level for Access: %i dBm%s",
Harald Welte1d8dbc42009-12-12 15:38:16 +0100223 rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min),
224 VTY_NEWLINE);
225 vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s",
Harald Welte73225282009-12-12 18:17:25 +0100226 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100227 vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer,
228 VTY_NEWLINE);
229 vty_out(vty, "RACH Max transmissions: %u%s",
230 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
231 VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100232 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200233 vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE);
Harald Welte9fbff4a2010-07-30 11:50:09 +0200234 vty_out(vty, "System Information present: 0x%08x, static: 0x%08x%s",
235 bts->si_valid, bts->si_mode_static, VTY_NEWLINE);
Harald Welte4cc34222009-05-01 15:12:31 +0000236 if (is_ipaccess_bts(bts))
Harald Welte8175e952009-10-20 00:22:00 +0200237 vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
Harald Welte4cc34222009-05-01 15:12:31 +0000238 bts->ip_access.site_id, bts->ip_access.bts_id,
Harald Welte8175e952009-10-20 00:22:00 +0200239 bts->oml_tei, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000240 vty_out(vty, " NM State: ");
241 net_dump_nmstate(vty, &bts->nm_state);
242 vty_out(vty, " Site Mgr NM State: ");
243 net_dump_nmstate(vty, &bts->site_mgr.nm_state);
244 vty_out(vty, " Paging: FIXME pending requests, %u free slots%s",
245 bts->paging.available_slots, VTY_NEWLINE);
Holger Hans Peter Freytherd283db42010-11-25 16:28:45 +0100246 if (is_ipaccess_bts(bts)) {
247 vty_out(vty, " OML Link state: %s.%s",
248 bts->oml_link ? "connected" : "disconnected", VTY_NEWLINE);
249 } else {
Harald Welte8175e952009-10-20 00:22:00 +0200250 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
251 e1isl_dump_vty(vty, bts->oml_link);
252 }
Holger Hans Peter Freytherd283db42010-11-25 16:28:45 +0100253
254 /* FIXME: chan_desc */
Harald Welteb908cb72009-12-22 13:09:29 +0100255 memset(&pl, 0, sizeof(pl));
256 bts_chan_load(&pl, bts);
257 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
258 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000259}
260
261DEFUN(show_bts, show_bts_cmd, "show bts [number]",
262 SHOW_STR "Display information about a BTS\n"
263 "BTS number")
264{
Harald Weltedcccb182010-05-16 20:52:23 +0200265 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000266 int bts_nr;
267
268 if (argc != 0) {
269 /* use the BTS number that the user has specified */
270 bts_nr = atoi(argv[0]);
Harald Welte712ddbc2010-12-24 12:24:03 +0100271 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000272 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000273 VTY_NEWLINE);
274 return CMD_WARNING;
275 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200276 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000277 return CMD_SUCCESS;
278 }
279 /* print all BTS's */
280 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee441d9c2009-06-21 16:17:15 +0200281 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000282
283 return CMD_SUCCESS;
284}
285
Harald Welte42581822009-08-08 16:12:58 +0200286/* utility functions */
287static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
288 const char *ts, const char *ss)
289{
290 e1_link->e1_nr = atoi(line);
291 e1_link->e1_ts = atoi(ts);
292 if (!strcmp(ss, "full"))
293 e1_link->e1_ts_ss = 255;
294 else
295 e1_link->e1_ts_ss = atoi(ss);
296}
297
298static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,
299 const char *prefix)
300{
301 if (!e1_link->e1_ts)
302 return;
303
304 if (e1_link->e1_ts_ss == 255)
305 vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s",
306 prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE);
307 else
308 vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s",
309 prefix, e1_link->e1_nr, e1_link->e1_ts,
310 e1_link->e1_ts_ss, VTY_NEWLINE);
311}
312
313
Harald Welte67ce0732009-08-06 19:06:46 +0200314static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
315{
Harald Welte42581822009-08-08 16:12:58 +0200316 vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
317 if (ts->pchan != GSM_PCHAN_NONE)
318 vty_out(vty, " phys_chan_config %s%s",
319 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200320 vty_out(vty, " hopping enabled %u%s",
321 ts->hopping.enabled, VTY_NEWLINE);
322 if (ts->hopping.enabled) {
323 unsigned int i;
324 vty_out(vty, " hopping sequence-number %u%s",
Harald Welte6e0cd042009-09-12 13:05:33 +0200325 ts->hopping.hsn, VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200326 vty_out(vty, " hopping maio %u%s",
Harald Welte6e0cd042009-09-12 13:05:33 +0200327 ts->hopping.maio, VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200328 for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) {
329 if (!bitvec_get_bit_pos(&ts->hopping.arfcns, i))
330 continue;
331 vty_out(vty, " hopping arfcn add %u%s",
332 i, VTY_NEWLINE);
333 }
Harald Welte127af342010-12-24 12:07:07 +0100334 }
Harald Welte42581822009-08-08 16:12:58 +0200335 config_write_e1_link(vty, &ts->e1_link, " ");
Harald Welte67ce0732009-08-06 19:06:46 +0200336}
337
338static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
339{
340 int i;
341
Harald Welte5013b2a2009-08-07 13:29:14 +0200342 vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200343 if (trx->description)
344 vty_out(vty, " description %s%s", trx->description,
345 VTY_NEWLINE);
Holger Hans Peter Freyther2ba40af2010-04-17 06:42:07 +0200346 vty_out(vty, " rf_locked %u%s",
347 trx->nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
348 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200349 vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
Harald Welte (local)7b37d972009-12-27 20:56:38 +0100350 vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200351 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200352 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
353 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte67ce0732009-08-06 19:06:46 +0200354
355 for (i = 0; i < TRX_NR_TS; i++)
356 config_write_ts_single(vty, &trx->ts[i]);
357}
358
Harald Welte615e9562010-05-11 23:50:21 +0200359static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
360{
361 unsigned int i;
362 vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode),
363 VTY_NEWLINE);
364 if (bts->gprs.mode == BTS_GPRS_NONE)
365 return;
366
367 vty_out(vty, " gprs routing area %u%s", bts->gprs.rac,
368 VTY_NEWLINE);
369 vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
370 VTY_NEWLINE);
371 for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++)
372 vty_out(vty, " gprs cell timer %s %u%s",
373 get_value_string(gprs_bssgp_cfg_strs, i),
374 bts->gprs.cell.timer[i], VTY_NEWLINE);
375 vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei,
376 VTY_NEWLINE);
377 for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++)
378 vty_out(vty, " gprs ns timer %s %u%s",
379 get_value_string(gprs_ns_timer_strs, i),
380 bts->gprs.nse.timer[i], VTY_NEWLINE);
381 for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
382 struct gsm_bts_gprs_nsvc *nsvc =
383 &bts->gprs.nsvc[i];
384 struct in_addr ia;
385
386 ia.s_addr = htonl(nsvc->remote_ip);
387 vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
388 nsvc->nsvci, VTY_NEWLINE);
389 vty_out(vty, " gprs nsvc %u local udp port %u%s", i,
390 nsvc->local_port, VTY_NEWLINE);
391 vty_out(vty, " gprs nsvc %u remote udp port %u%s", i,
392 nsvc->remote_port, VTY_NEWLINE);
393 vty_out(vty, " gprs nsvc %u remote ip %s%s", i,
394 inet_ntoa(ia), VTY_NEWLINE);
395 }
396}
397
Harald Welte67ce0732009-08-06 19:06:46 +0200398static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
399{
400 struct gsm_bts_trx *trx;
Harald Welte9fbff4a2010-07-30 11:50:09 +0200401 int i;
Harald Welte67ce0732009-08-06 19:06:46 +0200402
Harald Welte5013b2a2009-08-07 13:29:14 +0200403 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
404 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200405 if (bts->description)
406 vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200407 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freytherf926ed62009-11-19 16:38:49 +0100408 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200409 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte67ce0732009-08-06 19:06:46 +0200410 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200411 vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE);
412 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)0e451d02009-08-13 10:14:26 +0200413 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100414 vty_out(vty, " cell reselection hysteresis %u%s",
415 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
416 vty_out(vty, " rxlev access min %u%s",
417 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Sylvain Munaute0b06b02010-11-28 18:17:28 +0100418
419 if (bts->si_common.cell_ro_sel_par.present) {
420 struct gsm48_si_selection_params *sp;
421 sp = &bts->si_common.cell_ro_sel_par;
422
423 if (sp->cbq)
424 vty_out(vty, " cell bar qualify %u%s",
425 sp->cbq, VTY_NEWLINE);
426
427 if (sp->cell_resel_off)
428 vty_out(vty, " cell reselection offset %u%s",
429 sp->cell_resel_off*2, VTY_NEWLINE);
430
431 if (sp->temp_offs == 7)
432 vty_out(vty, " temporary offset infinite%s",
433 VTY_NEWLINE);
434 else if (sp->temp_offs)
435 vty_out(vty, " temporary offset %u%s",
436 sp->temp_offs*10, VTY_NEWLINE);
437
438 if (sp->penalty_time == 31)
439 vty_out(vty, " penalty time reserved%s",
440 VTY_NEWLINE);
441 else if (sp->penalty_time)
442 vty_out(vty, " penalty time %u%s",
443 (sp->penalty_time*20)+20, VTY_NEWLINE);
444 }
445
Harald Weltea43f7892009-12-01 18:04:30 +0530446 if (bts->si_common.chan_desc.t3212)
Harald Welte (local)efc92312009-08-14 23:09:25 +0200447 vty_out(vty, " periodic location update %u%s",
Dieter Spaard6613e02010-10-05 21:10:55 +0200448 bts->si_common.chan_desc.t3212 * 6, VTY_NEWLINE);
Harald Welte7a8fa412009-08-10 13:48:16 +0200449 vty_out(vty, " channel allocator %s%s",
450 bts->chan_alloc_reverse ? "descending" : "ascending",
451 VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100452 vty_out(vty, " rach tx integer %u%s",
453 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
454 vty_out(vty, " rach max transmission %u%s",
455 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
456 VTY_NEWLINE);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +0800457
458 if (bts->rach_b_thresh != -1)
459 vty_out(vty, " rach nm busy threshold %u%s",
460 bts->rach_b_thresh, VTY_NEWLINE);
461 if (bts->rach_ldavg_slots != -1)
462 vty_out(vty, " rach nm load average %u%s",
463 bts->rach_ldavg_slots, VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100464 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200465 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +0800466 if ((bts->si_common.rach_control.t2 & 0x4) == 0)
467 vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE);
Harald Welte9fbff4a2010-07-30 11:50:09 +0200468 for (i = SYSINFO_TYPE_1; i < _MAX_SYSINFO_TYPE; i++) {
469 if (bts->si_mode_static & (1 << i)) {
470 vty_out(vty, " system-information %s mode static%s",
471 get_value_string(osmo_sitype_strs, i), VTY_NEWLINE);
472 vty_out(vty, " system-information %s static %s%s",
473 get_value_string(osmo_sitype_strs, i),
474 hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])),
475 VTY_NEWLINE);
476 }
477 }
Harald Welte8175e952009-10-20 00:22:00 +0200478 if (is_ipaccess_bts(bts)) {
Harald Welte5013b2a2009-08-07 13:29:14 +0200479 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Weltea6fd58e2009-08-07 00:25:23 +0200480 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte8175e952009-10-20 00:22:00 +0200481 vty_out(vty, " oml ip.access stream_id %u%s", bts->oml_tei, VTY_NEWLINE);
482 } else {
Harald Welte42581822009-08-08 16:12:58 +0200483 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
484 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
485 }
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +0800486
487 /* if we have a limit, write it */
488 if (bts->paging.free_chans_need >= 0)
489 vty_out(vty, " paging free %d%s", bts->paging.free_chans_need, VTY_NEWLINE);
490
Harald Welte615e9562010-05-11 23:50:21 +0200491 config_write_bts_gprs(vty, bts);
Harald Welte67ce0732009-08-06 19:06:46 +0200492
493 llist_for_each_entry(trx, &bts->trx_list, list)
494 config_write_trx_single(vty, trx);
495}
496
497static int config_write_bts(struct vty *v)
498{
Harald Weltedcccb182010-05-16 20:52:23 +0200499 struct gsm_network *gsmnet = gsmnet_from_vty(v);
Harald Welte67ce0732009-08-06 19:06:46 +0200500 struct gsm_bts *bts;
501
502 llist_for_each_entry(bts, &gsmnet->bts_list, list)
503 config_write_bts_single(v, bts);
504
505 return CMD_SUCCESS;
506}
507
Harald Welte5013b2a2009-08-07 13:29:14 +0200508static int config_write_net(struct vty *vty)
509{
Harald Weltedcccb182010-05-16 20:52:23 +0200510 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
511
Harald Welte5013b2a2009-08-07 13:29:14 +0200512 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200513 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200514 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200515 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
516 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200517 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100518 vty_out(vty, " location updating reject cause %u%s",
519 gsmnet->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900520 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freytherd54c3372009-11-19 16:37:48 +0100521 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +0800522 vty_out(vty, " paging any use tch %d%s", gsmnet->pag_any_tch, VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100523 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
524 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100525 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100526 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Welteb720bd32009-12-21 16:51:50 +0100527 vty_out(vty, " handover window rxlev averaging %u%s",
528 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
529 vty_out(vty, " handover window rxqual averaging %u%s",
530 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
531 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
532 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
533 vty_out(vty, " handover power budget interval %u%s",
534 gsmnet->handover.pwr_interval, VTY_NEWLINE);
535 vty_out(vty, " handover power budget hysteresis %u%s",
536 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
537 vty_out(vty, " handover maximum distance %u%s",
538 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +0100539 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100540 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
541 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
542 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
543 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
544 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
545 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
546 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
547 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
548 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
Harald Welte2862dca2010-12-23 14:39:29 +0100549 vty_out(vty, " timer t3122 %u%s", gsmnet->T3122, VTY_NEWLINE);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100550 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Harald Welte63dbfc62010-12-15 15:34:23 +0100551 vty_out(vty, " dtx-used %u%s", gsmnet->dtx_enabled, VTY_NEWLINE);
Holger Hans Peter Freytherae9006a2010-12-22 16:26:04 +0100552 vty_out(vty, " subscriber-keep-in-ram %d%s",
553 gsmnet->keep_subscr, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200554
555 return CMD_SUCCESS;
556}
Harald Welte67ce0732009-08-06 19:06:46 +0200557
Harald Welte68628e82009-03-10 12:17:57 +0000558static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
559{
560 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
561 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200562 vty_out(vty, "Description: %s%s",
563 trx->description ? trx->description : "(null)", VTY_NEWLINE);
Harald Weltefcd24452009-06-20 18:15:19 +0200564 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte42581822009-08-08 16:12:58 +0200565 "resulting BS power: %d dBm%s",
Harald Weltefcd24452009-06-20 18:15:19 +0200566 trx->nominal_power, trx->max_power_red,
Harald Welte42581822009-08-08 16:12:58 +0200567 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000568 vty_out(vty, " NM State: ");
569 net_dump_nmstate(vty, &trx->nm_state);
570 vty_out(vty, " Baseband Transceiver NM State: ");
571 net_dump_nmstate(vty, &trx->bb_transc.nm_state);
Harald Welte8175e952009-10-20 00:22:00 +0200572 if (is_ipaccess_bts(trx->bts)) {
573 vty_out(vty, " ip.access stream ID: 0x%02x%s",
574 trx->rsl_tei, VTY_NEWLINE);
575 } else {
576 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
577 e1isl_dump_vty(vty, trx->rsl_link);
578 }
Harald Welte68628e82009-03-10 12:17:57 +0000579}
580
581DEFUN(show_trx,
582 show_trx_cmd,
583 "show trx [bts_nr] [trx_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200584 SHOW_STR "Display information about a TRX\n"
585 "BTS Number\n"
586 "TRX Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000587{
Harald Weltedcccb182010-05-16 20:52:23 +0200588 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000589 struct gsm_bts *bts = NULL;
590 struct gsm_bts_trx *trx;
591 int bts_nr, trx_nr;
592
593 if (argc >= 1) {
594 /* use the BTS number that the user has specified */
595 bts_nr = atoi(argv[0]);
596 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000597 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000598 VTY_NEWLINE);
599 return CMD_WARNING;
600 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200601 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000602 }
603 if (argc >= 2) {
604 trx_nr = atoi(argv[1]);
605 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000606 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000607 VTY_NEWLINE);
608 return CMD_WARNING;
609 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200610 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000611 trx_dump_vty(vty, trx);
612 return CMD_SUCCESS;
613 }
614 if (bts) {
615 /* print all TRX in this BTS */
616 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200617 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000618 trx_dump_vty(vty, trx);
619 }
620 return CMD_SUCCESS;
621 }
622
623 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200624 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000625 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200626 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000627 trx_dump_vty(vty, trx);
628 }
629 }
630
631 return CMD_SUCCESS;
632}
633
Harald Welte67ce0732009-08-06 19:06:46 +0200634
Harald Welte68628e82009-03-10 12:17:57 +0000635static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
636{
Harald Weltecd103a92010-12-24 12:14:52 +0100637 vty_out(vty, "BTS %u, TRX %u, Timeslot %u, phys cfg %s",
Harald Welte026b4ca2010-12-24 12:12:10 +0100638 ts->trx->bts->nr, ts->trx->nr, ts->nr,
Harald Weltecd103a92010-12-24 12:14:52 +0100639 gsm_pchan_name(ts->pchan));
640 if (ts->pchan == GSM_PCHAN_TCH_F_PDCH)
Harald Welteb29cea12010-12-24 12:26:13 +0100641 vty_out(vty, " (%s mode)",
Harald Weltecd103a92010-12-24 12:14:52 +0100642 ts->flags & TS_F_PDCH_MODE ? "PDCH" : "TCH/F");
643 vty_out(vty, "%s", VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000644 vty_out(vty, " NM State: ");
645 net_dump_nmstate(vty, &ts->nm_state);
Harald Welte2c828992009-12-02 01:56:49 +0530646 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welteef235b52009-03-10 12:34:02 +0000647 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
648 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
649 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000650}
651
652DEFUN(show_ts,
653 show_ts_cmd,
Harald Welte1bc77352009-03-10 19:47:51 +0000654 "show timeslot [bts_nr] [trx_nr] [ts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200655 SHOW_STR "Display information about a TS\n"
656 "BTS Number\n" "TRX Number\n" "Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000657{
Harald Weltedcccb182010-05-16 20:52:23 +0200658 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte274d0152010-12-24 12:05:03 +0100659 struct gsm_bts *bts = NULL;
660 struct gsm_bts_trx *trx = NULL;
661 struct gsm_bts_trx_ts *ts = NULL;
Harald Welte68628e82009-03-10 12:17:57 +0000662 int bts_nr, trx_nr, ts_nr;
663
664 if (argc >= 1) {
665 /* use the BTS number that the user has specified */
666 bts_nr = atoi(argv[0]);
667 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000668 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000669 VTY_NEWLINE);
670 return CMD_WARNING;
671 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200672 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000673 }
674 if (argc >= 2) {
675 trx_nr = atoi(argv[1]);
676 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000677 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000678 VTY_NEWLINE);
679 return CMD_WARNING;
680 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200681 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000682 }
683 if (argc >= 3) {
684 ts_nr = atoi(argv[2]);
685 if (ts_nr >= TRX_NR_TS) {
Harald Welte1bc77352009-03-10 19:47:51 +0000686 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
Harald Welte68628e82009-03-10 12:17:57 +0000687 VTY_NEWLINE);
688 return CMD_WARNING;
689 }
Harald Welte274d0152010-12-24 12:05:03 +0100690 /* Fully Specified: print and exit */
Harald Welte68628e82009-03-10 12:17:57 +0000691 ts = &trx->ts[ts_nr];
692 ts_dump_vty(vty, ts);
693 return CMD_SUCCESS;
694 }
Harald Welte274d0152010-12-24 12:05:03 +0100695
696 if (bts && trx) {
697 /* Iterate over all TS in this TRX */
698 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
699 ts = &trx->ts[ts_nr];
700 ts_dump_vty(vty, ts);
701 }
702 } else if (bts) {
703 /* Iterate over all TRX in this BTS, TS in each TRX */
Harald Welte68628e82009-03-10 12:17:57 +0000704 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200705 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000706 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
707 ts = &trx->ts[ts_nr];
708 ts_dump_vty(vty, ts);
709 }
710 }
Harald Welte274d0152010-12-24 12:05:03 +0100711 } else {
712 /* Iterate over all BTS, TRX in each BTS, TS in each TRX */
713 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
714 bts = gsm_bts_num(net, bts_nr);
715 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
716 trx = gsm_bts_trx_num(bts, trx_nr);
717 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
718 ts = &trx->ts[ts_nr];
719 ts_dump_vty(vty, ts);
720 }
721 }
722 }
Harald Welte68628e82009-03-10 12:17:57 +0000723 }
724
725 return CMD_SUCCESS;
726}
727
Holger Hans Peter Freyther424c4f02010-01-06 06:00:40 +0100728static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte68628e82009-03-10 12:17:57 +0000729{
Harald Weltefcd24452009-06-20 18:15:19 +0200730 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte40f82892009-05-23 17:31:39 +0000731 subscr->authorized, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000732 if (subscr->name)
Harald Welte1bc77352009-03-10 19:47:51 +0000733 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000734 if (subscr->extension)
735 vty_out(vty, " Extension: %s%s", subscr->extension,
736 VTY_NEWLINE);
737 if (subscr->imsi)
738 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freyther22230252009-08-19 12:53:57 +0200739 if (subscr->tmsi != GSM_RESERVED_TMSI)
740 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte731fd912009-08-15 03:24:51 +0200741 VTY_NEWLINE);
Sylvain Munautaf292642009-12-27 19:29:28 +0100742
Harald Welte (local)15920de2009-08-14 20:27:16 +0200743 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000744}
745
Harald Welte8387a492009-12-22 21:43:14 +0100746static void meas_rep_dump_uni_vty(struct vty *vty,
747 struct gsm_meas_rep_unidir *mru,
748 const char *prefix,
749 const char *dir)
750{
751 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
752 prefix, dir, rxlev2dbm(mru->full.rx_lev),
753 dir, rxlev2dbm(mru->sub.rx_lev));
754 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
755 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
756 VTY_NEWLINE);
757}
758
759static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
760 const char *prefix)
761{
762 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
763 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
764 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
765 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
766 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
767 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
768 VTY_NEWLINE);
769 if (mr->flags & MEAS_REP_F_MS_TO)
770 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
771 mr->ms_timing_offset, VTY_NEWLINE);
772 if (mr->flags & MEAS_REP_F_MS_L1)
773 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
774 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
775 if (mr->flags & MEAS_REP_F_DL_VALID)
776 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
777 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
778}
779
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800780static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
Harald Welte68628e82009-03-10 12:17:57 +0000781{
Harald Welte8387a492009-12-22 21:43:14 +0100782 int idx;
783
Harald Welte85bded82010-12-24 12:22:34 +0100784 vty_out(vty, "BTS %u, TRX %u, Timeslot %u, Lchan %u: Type %s%s",
785 lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
786 lchan->nr, gsm_lchant_name(lchan->type), VTY_NEWLINE);
Holger Hans Peter Freyther40494552010-06-28 17:09:29 +0800787 vty_out(vty, " Connection: %u, State: %s%s",
788 lchan->conn ? 1: 0,
Harald Welte1887f9d2009-12-29 10:52:38 +0100789 gsm_lchans_name(lchan->state), VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100790 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
791 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
792 - lchan->bs_power*2,
793 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
794 VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800795 if (lchan->conn && lchan->conn->subscr) {
Harald Welte68628e82009-03-10 12:17:57 +0000796 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800797 subscr_dump_vty(vty, lchan->conn->subscr);
Harald Welte68628e82009-03-10 12:17:57 +0000798 } else
799 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte2c828992009-12-02 01:56:49 +0530800 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
801 struct in_addr ia;
Holger Hans Peter Freyther54fa7992010-04-07 15:39:16 +0200802 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte2c828992009-12-02 01:56:49 +0530803 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
804 inet_ntoa(ia), lchan->abis_ip.bound_port,
805 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
806 VTY_NEWLINE);
807 }
Harald Welte8387a492009-12-22 21:43:14 +0100808
809 /* we want to report the last measurement report */
810 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
811 lchan->meas_rep_idx, 1);
812 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte68628e82009-03-10 12:17:57 +0000813}
814
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800815static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
816{
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800817 struct gsm_meas_rep *mr;
818 int idx;
819
820 /* we want to report the last measurement report */
821 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
822 lchan->meas_rep_idx, 1);
823 mr = &lchan->meas_rep[idx];
824
Harald Welte85bded82010-12-24 12:22:34 +0100825 vty_out(vty, "BTS %u, TRX %u, Timeslot %u, Lchan %u, Type %s - "
826 "L1 MS Power: %u dBm RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
827 lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
Harald Welteb29cea12010-12-24 12:26:13 +0100828 lchan->nr, gsm_lchant_name(lchan->type), mr->ms_l1.pwr,
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +0800829 rxlev2dbm(mr->dl.full.rx_lev),
830 rxlev2dbm(mr->ul.full.rx_lev),
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800831 VTY_NEWLINE);
832}
833
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800834static int lchan_summary(struct vty *vty, int argc, const char **argv,
835 void (*dump_cb)(struct vty *, struct gsm_lchan *))
Harald Welte68628e82009-03-10 12:17:57 +0000836{
Harald Weltedcccb182010-05-16 20:52:23 +0200837 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000838 struct gsm_bts *bts;
839 struct gsm_bts_trx *trx;
840 struct gsm_bts_trx_ts *ts;
841 struct gsm_lchan *lchan;
842 int bts_nr, trx_nr, ts_nr, lchan_nr;
843
844 if (argc >= 1) {
845 /* use the BTS number that the user has specified */
846 bts_nr = atoi(argv[0]);
847 if (bts_nr >= net->num_bts) {
848 vty_out(vty, "%% can't find BTS %s%s", argv[0],
849 VTY_NEWLINE);
850 return CMD_WARNING;
851 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200852 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000853 }
854 if (argc >= 2) {
855 trx_nr = atoi(argv[1]);
856 if (trx_nr >= bts->num_trx) {
857 vty_out(vty, "%% can't find TRX %s%s", argv[1],
858 VTY_NEWLINE);
859 return CMD_WARNING;
860 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200861 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000862 }
863 if (argc >= 3) {
864 ts_nr = atoi(argv[2]);
865 if (ts_nr >= TRX_NR_TS) {
866 vty_out(vty, "%% can't find TS %s%s", argv[2],
867 VTY_NEWLINE);
868 return CMD_WARNING;
869 }
870 ts = &trx->ts[ts_nr];
871 }
872 if (argc >= 4) {
873 lchan_nr = atoi(argv[3]);
874 if (lchan_nr >= TS_MAX_LCHAN) {
875 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
876 VTY_NEWLINE);
877 return CMD_WARNING;
878 }
879 lchan = &ts->lchan[lchan_nr];
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800880 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000881 return CMD_SUCCESS;
882 }
883 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200884 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000885 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200886 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000887 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
888 ts = &trx->ts[ts_nr];
889 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN;
890 lchan_nr++) {
891 lchan = &ts->lchan[lchan_nr];
Harald Welteef235b52009-03-10 12:34:02 +0000892 if (lchan->type == GSM_LCHAN_NONE)
893 continue;
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800894 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +0000895 }
896 }
897 }
898 }
899
900 return CMD_SUCCESS;
901}
902
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +0800903
904DEFUN(show_lchan,
905 show_lchan_cmd,
906 "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
907 SHOW_STR "Display information about a logical channel\n"
908 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
909 "Logical Channel Number\n")
910
911{
912 return lchan_summary(vty, argc, argv, lchan_dump_full_vty);
913}
914
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +0800915DEFUN(show_lchan_summary,
916 show_lchan_summary_cmd,
917 "show lchan summary [bts_nr] [trx_nr] [ts_nr] [lchan_nr]",
918 SHOW_STR "Display information about a logical channel\n"
919 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
920 "Logical Channel Number\n")
921{
922 return lchan_summary(vty, argc, argv, lchan_dump_short_vty);
923}
924
Harald Welte1bc77352009-03-10 19:47:51 +0000925static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv)
926{
927 vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE);
928}
929
930DEFUN(show_e1drv,
931 show_e1drv_cmd,
932 "show e1_driver",
933 SHOW_STR "Display information about available E1 drivers\n")
934{
935 struct e1inp_driver *drv;
936
937 llist_for_each_entry(drv, &e1inp_driver_list, list)
938 e1drv_dump_vty(vty, drv);
939
940 return CMD_SUCCESS;
941}
942
Harald Welte68628e82009-03-10 12:17:57 +0000943static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line)
944{
945 vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s",
946 line->num, line->name ? line->name : "",
947 line->driver->name, VTY_NEWLINE);
948}
949
950DEFUN(show_e1line,
951 show_e1line_cmd,
952 "show e1_line [line_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200953 SHOW_STR "Display information about a E1 line\n"
954 "E1 Line Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000955{
Harald Welte1bc77352009-03-10 19:47:51 +0000956 struct e1inp_line *line;
957
958 if (argc >= 1) {
959 int num = atoi(argv[0]);
960 llist_for_each_entry(line, &e1inp_line_list, list) {
961 if (line->num == num) {
962 e1line_dump_vty(vty, line);
963 return CMD_SUCCESS;
964 }
965 }
966 return CMD_WARNING;
967 }
968
969 llist_for_each_entry(line, &e1inp_line_list, list)
970 e1line_dump_vty(vty, line);
971
972 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +0000973}
974
975static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts)
976{
Harald Welte42581822009-08-08 16:12:58 +0200977 if (ts->type == E1INP_TS_TYPE_NONE)
978 return;
Harald Welte1bc77352009-03-10 19:47:51 +0000979 vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s",
980 ts->num, ts->line->num, e1inp_tstype_name(ts->type),
981 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000982}
983
984DEFUN(show_e1ts,
985 show_e1ts_cmd,
986 "show e1_timeslot [line_nr] [ts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200987 SHOW_STR "Display information about a E1 timeslot\n"
988 "E1 Line Number\n" "E1 Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000989{
Harald Welte986c3d72009-11-17 06:12:16 +0100990 struct e1inp_line *line = NULL;
Harald Welte1bc77352009-03-10 19:47:51 +0000991 struct e1inp_ts *ts;
992 int ts_nr;
Harald Welte68628e82009-03-10 12:17:57 +0000993
Harald Welte1bc77352009-03-10 19:47:51 +0000994 if (argc == 0) {
995 llist_for_each_entry(line, &e1inp_line_list, list) {
996 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
997 ts = &line->ts[ts_nr];
998 e1ts_dump_vty(vty, ts);
999 }
1000 }
1001 return CMD_SUCCESS;
1002 }
1003 if (argc >= 1) {
1004 int num = atoi(argv[0]);
1005 llist_for_each_entry(line, &e1inp_line_list, list) {
1006 if (line->num == num)
1007 break;
1008 }
1009 if (!line || line->num != num) {
1010 vty_out(vty, "E1 line %s is invalid%s",
1011 argv[0], VTY_NEWLINE);
1012 return CMD_WARNING;
1013 }
1014 }
1015 if (argc >= 2) {
1016 ts_nr = atoi(argv[1]);
1017 if (ts_nr > NUM_E1_TS) {
1018 vty_out(vty, "E1 timeslot %s is invalid%s",
1019 argv[1], VTY_NEWLINE);
1020 return CMD_WARNING;
1021 }
1022 ts = &line->ts[ts_nr];
1023 e1ts_dump_vty(vty, ts);
1024 return CMD_SUCCESS;
1025 } else {
1026 for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) {
1027 ts = &line->ts[ts_nr];
1028 e1ts_dump_vty(vty, ts);
1029 }
1030 return CMD_SUCCESS;
1031 }
1032 return CMD_SUCCESS;
Harald Welte68628e82009-03-10 12:17:57 +00001033}
1034
Harald Weltebe4b7302009-05-23 16:59:33 +00001035static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
Harald Weltef5025b62009-03-28 16:55:11 +00001036{
1037 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
1038 subscr_dump_vty(vty, pag->subscr);
1039}
1040
Harald Weltebe4b7302009-05-23 16:59:33 +00001041static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
Harald Weltef5025b62009-03-28 16:55:11 +00001042{
1043 struct gsm_paging_request *pag;
1044
1045 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
1046 paging_dump_vty(vty, pag);
1047}
1048
1049DEFUN(show_paging,
1050 show_paging_cmd,
1051 "show paging [bts_nr]",
Harald Welte8f0ed552010-05-11 21:53:49 +02001052 SHOW_STR "Display information about paging reuqests of a BTS\n"
1053 "BTS Number\n")
Harald Weltef5025b62009-03-28 16:55:11 +00001054{
Harald Weltedcccb182010-05-16 20:52:23 +02001055 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Weltef5025b62009-03-28 16:55:11 +00001056 struct gsm_bts *bts;
1057 int bts_nr;
1058
1059 if (argc >= 1) {
1060 /* use the BTS number that the user has specified */
1061 bts_nr = atoi(argv[0]);
1062 if (bts_nr >= net->num_bts) {
1063 vty_out(vty, "%% can't find BTS %s%s", argv[0],
1064 VTY_NEWLINE);
1065 return CMD_WARNING;
1066 }
Harald Weltee441d9c2009-06-21 16:17:15 +02001067 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001068 bts_paging_dump_vty(vty, bts);
1069
1070 return CMD_SUCCESS;
1071 }
1072 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +02001073 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001074 bts_paging_dump_vty(vty, bts);
1075 }
1076
1077 return CMD_SUCCESS;
1078}
1079
Harald Welte8f0ed552010-05-11 21:53:49 +02001080#define NETWORK_STR "Configure the GSM network\n"
1081
Harald Welte5013b2a2009-08-07 13:29:14 +02001082DEFUN(cfg_net,
1083 cfg_net_cmd,
Harald Welte8f0ed552010-05-11 21:53:49 +02001084 "network", NETWORK_STR)
Harald Welte5013b2a2009-08-07 13:29:14 +02001085{
Harald Weltedcccb182010-05-16 20:52:23 +02001086 vty->index = gsmnet_from_vty(vty);
Harald Welte5013b2a2009-08-07 13:29:14 +02001087 vty->node = GSMNET_NODE;
1088
1089 return CMD_SUCCESS;
1090}
1091
1092
1093DEFUN(cfg_net_ncc,
1094 cfg_net_ncc_cmd,
1095 "network country code <1-999>",
1096 "Set the GSM network country code")
1097{
Harald Weltedcccb182010-05-16 20:52:23 +02001098 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1099
Harald Welte5013b2a2009-08-07 13:29:14 +02001100 gsmnet->country_code = atoi(argv[0]);
1101
1102 return CMD_SUCCESS;
1103}
1104
1105DEFUN(cfg_net_mnc,
1106 cfg_net_mnc_cmd,
1107 "mobile network code <1-999>",
1108 "Set the GSM mobile network code")
1109{
Harald Weltedcccb182010-05-16 20:52:23 +02001110 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1111
Harald Welte5013b2a2009-08-07 13:29:14 +02001112 gsmnet->network_code = atoi(argv[0]);
1113
1114 return CMD_SUCCESS;
1115}
1116
1117DEFUN(cfg_net_name_short,
1118 cfg_net_name_short_cmd,
1119 "short name NAME",
1120 "Set the short GSM network name")
1121{
Harald Weltedcccb182010-05-16 20:52:23 +02001122 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1123
Holger Hans Peter Freyther3e9a7f82010-10-12 23:21:54 +02001124 bsc_replace_string(gsmnet, &gsmnet->name_short, argv[0]);
Harald Welte5013b2a2009-08-07 13:29:14 +02001125 return CMD_SUCCESS;
1126}
1127
1128DEFUN(cfg_net_name_long,
1129 cfg_net_name_long_cmd,
1130 "long name NAME",
1131 "Set the long GSM network name")
1132{
Harald Weltedcccb182010-05-16 20:52:23 +02001133 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1134
Holger Hans Peter Freyther3e9a7f82010-10-12 23:21:54 +02001135 bsc_replace_string(gsmnet, &gsmnet->name_long, argv[0]);
Harald Welte5013b2a2009-08-07 13:29:14 +02001136 return CMD_SUCCESS;
1137}
Harald Welte40f82892009-05-23 17:31:39 +00001138
Harald Welte (local)69de3972009-08-12 14:42:23 +02001139DEFUN(cfg_net_auth_policy,
1140 cfg_net_auth_policy_cmd,
1141 "auth policy (closed|accept-all|token)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001142 "Authentication (not cryptographic)\n"
1143 "Set the GSM network authentication policy\n"
1144 "Require the MS to be activated in HLR\n"
1145 "Accept all MS, whether in HLR or not\n"
1146 "Use SMS-token based authentication\n")
Harald Welte (local)69de3972009-08-12 14:42:23 +02001147{
1148 enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001149 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte (local)69de3972009-08-12 14:42:23 +02001150
1151 gsmnet->auth_policy = policy;
1152
1153 return CMD_SUCCESS;
1154}
1155
Harald Welte1085c092009-11-18 20:33:19 +01001156DEFUN(cfg_net_reject_cause,
1157 cfg_net_reject_cause_cmd,
1158 "location updating reject cause <2-111>",
1159 "Set the reject cause of location updating reject\n")
1160{
Harald Weltedcccb182010-05-16 20:52:23 +02001161 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1162
Harald Welte1085c092009-11-18 20:33:19 +01001163 gsmnet->reject_cause = atoi(argv[0]);
1164
1165 return CMD_SUCCESS;
1166}
1167
Harald Welte4381cfe2009-08-30 15:47:06 +09001168DEFUN(cfg_net_encryption,
1169 cfg_net_encryption_cmd,
1170 "encryption a5 (0|1|2)",
Harald Welte28326062010-05-14 20:05:17 +02001171 "Encryption options\n"
1172 "A5 encryption\n" "A5/0: No encryption\n"
1173 "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n")
Harald Welte4381cfe2009-08-30 15:47:06 +09001174{
Harald Weltedcccb182010-05-16 20:52:23 +02001175 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1176
Andreas.Eversberg1059deb2009-11-17 09:55:26 +01001177 gsmnet->a5_encryption= atoi(argv[0]);
Harald Welte4381cfe2009-08-30 15:47:06 +09001178
1179 return CMD_SUCCESS;
1180}
1181
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001182DEFUN(cfg_net_neci,
1183 cfg_net_neci_cmd,
1184 "neci (0|1)",
Harald Welte28326062010-05-14 20:05:17 +02001185 "New Establish Cause Indication\n"
1186 "Don't set the NECI bit\n" "Set the NECI bit\n")
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001187{
Harald Weltedcccb182010-05-16 20:52:23 +02001188 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1189
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001190 gsmnet->neci = atoi(argv[0]);
Holger Hans Peter Freyther78891072010-09-06 09:36:02 +08001191 gsm_net_update_ctype(gsmnet);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001192 return CMD_SUCCESS;
1193}
1194
Harald Welteeab84a12009-12-13 10:53:12 +01001195DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
1196 "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001197 "Radio Resource Location Protocol\n"
1198 "Set the Radio Resource Location Protocol Mode\n"
1199 "Don't send RRLP request\n"
1200 "Request MS-based location\n"
1201 "Request any location, prefer MS-based\n"
1202 "Request any location, prefer MS-assisted\n")
Harald Welteeab84a12009-12-13 10:53:12 +01001203{
Harald Weltedcccb182010-05-16 20:52:23 +02001204 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1205
Harald Welteeab84a12009-12-13 10:53:12 +01001206 gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
1207
1208 return CMD_SUCCESS;
1209}
1210
Harald Welte648b6ce2009-12-14 09:00:24 +01001211DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
1212 "mm info (0|1)",
1213 "Whether to send MM INFO after LOC UPD ACCEPT")
1214{
Harald Weltedcccb182010-05-16 20:52:23 +02001215 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1216
Harald Welte648b6ce2009-12-14 09:00:24 +01001217 gsmnet->send_mm_info = atoi(argv[0]);
1218
1219 return CMD_SUCCESS;
1220}
1221
Harald Welte8f0ed552010-05-11 21:53:49 +02001222#define HANDOVER_STR "Handover Options\n"
1223
Harald Weltebc814502009-12-19 21:41:52 +01001224DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1225 "handover (0|1)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001226 HANDOVER_STR
1227 "Don't perform in-call handover\n"
1228 "Perform in-call handover\n")
Harald Weltebc814502009-12-19 21:41:52 +01001229{
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001230 int enable = atoi(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001231 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001232
1233 if (enable && ipacc_rtp_direct) {
Harald Weltefe03f0d2009-12-20 13:51:01 +01001234 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1235 "is enabled by using the -P command line option%s",
1236 VTY_NEWLINE);
1237 return CMD_WARNING;
1238 }
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001239 gsmnet->handover.active = enable;
Harald Weltebc814502009-12-19 21:41:52 +01001240
1241 return CMD_SUCCESS;
1242}
1243
Harald Welte8f0ed552010-05-11 21:53:49 +02001244#define HO_WIN_STR HANDOVER_STR "Measurement Window\n"
1245#define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n"
1246#define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n"
1247#define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n"
1248
Harald Welteb720bd32009-12-21 16:51:50 +01001249DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1250 "handover window rxlev averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001251 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001252 "How many RxLev measurements are used for averaging")
1253{
Harald Weltedcccb182010-05-16 20:52:23 +02001254 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001255 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1256 return CMD_SUCCESS;
1257}
1258
1259DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1260 "handover window rxqual averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001261 HO_WIN_RXQUAL_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001262 "How many RxQual measurements are used for averaging")
1263{
Harald Weltedcccb182010-05-16 20:52:23 +02001264 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001265 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1266 return CMD_SUCCESS;
1267}
1268
1269DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1270 "handover window rxlev neighbor averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001271 HO_WIN_RXLEV_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001272 "How many RxQual measurements are used for averaging")
1273{
Harald Weltedcccb182010-05-16 20:52:23 +02001274 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001275 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1276 return CMD_SUCCESS;
1277}
1278
1279DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1280 "handover power budget interval <1-99>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001281 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001282 "How often to check if we have a better cell (SACCH frames)")
1283{
Harald Weltedcccb182010-05-16 20:52:23 +02001284 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001285 gsmnet->handover.pwr_interval = atoi(argv[0]);
1286 return CMD_SUCCESS;
1287}
1288
1289DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1290 "handover power budget hysteresis <0-999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001291 HO_PBUDGET_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001292 "How many dB does a neighbor to be stronger to become a HO candidate")
1293{
Harald Weltedcccb182010-05-16 20:52:23 +02001294 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001295 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1296 return CMD_SUCCESS;
1297}
1298
1299DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1300 "handover maximum distance <0-9999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001301 HANDOVER_STR
Harald Welteb720bd32009-12-21 16:51:50 +01001302 "How big is the maximum timing advance before HO is forced")
1303{
Harald Weltedcccb182010-05-16 20:52:23 +02001304 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001305 gsmnet->handover.max_distance = atoi(argv[0]);
1306 return CMD_SUCCESS;
1307}
Harald Weltebc814502009-12-19 21:41:52 +01001308
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001309DEFUN(cfg_net_pag_any_tch,
1310 cfg_net_pag_any_tch_cmd,
1311 "paging any use tch (0|1)",
1312 "Assign a TCH when receiving a Paging Any request")
1313{
Holger Hans Peter Freytherb0e88b82010-09-06 10:09:19 +08001314 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001315 gsmnet->pag_any_tch = atoi(argv[0]);
1316 gsm_net_update_ctype(gsmnet);
1317 return CMD_SUCCESS;
1318}
1319
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001320#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001321 DEFUN(cfg_net_T##number, \
1322 cfg_net_T##number##_cmd, \
1323 "timer t" #number " <0-65535>", \
Harald Welte8f0ed552010-05-11 21:53:49 +02001324 "Configure GSM Timers\n" \
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001325 doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001326{ \
Harald Weltedcccb182010-05-16 20:52:23 +02001327 struct gsm_network *gsmnet = gsmnet_from_vty(vty); \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001328 int value = atoi(argv[0]); \
1329 \
1330 if (value < 0 || value > 65535) { \
1331 vty_out(vty, "Timer value %s out of range.%s", \
1332 argv[0], VTY_NEWLINE); \
1333 return CMD_WARNING; \
1334 } \
1335 \
1336 gsmnet->T##number = value; \
1337 return CMD_SUCCESS; \
1338}
1339
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001340DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.")
1341DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.")
1342DECLARE_TIMER(3105, "Currently not used.")
1343DECLARE_TIMER(3107, "Currently not used.")
1344DECLARE_TIMER(3109, "Currently not used.")
Holger Hans Peter Freytherf30c0dc2010-05-31 21:33:15 +08001345DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel.")
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001346DECLARE_TIMER(3113, "Set the time to try paging a subscriber.")
1347DECLARE_TIMER(3115, "Currently not used.")
1348DECLARE_TIMER(3117, "Currently not used.")
1349DECLARE_TIMER(3119, "Currently not used.")
Harald Welte2862dca2010-12-23 14:39:29 +01001350DECLARE_TIMER(3122, "Waiting time (seconds) after IMM ASS REJECT")
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001351DECLARE_TIMER(3141, "Currently not used.")
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001352
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08001353DEFUN(cfg_net_dtx,
1354 cfg_net_dtx_cmd,
1355 "dtx-used (0|1)",
1356 "Enable the usage of DTX.\n"
1357 "DTX is enabled/disabled")
1358{
1359 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1360 gsmnet->dtx_enabled = atoi(argv[0]);
1361 return CMD_SUCCESS;
1362}
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001363
Holger Hans Peter Freytherae9006a2010-12-22 16:26:04 +01001364DEFUN(cfg_net_subscr_keep,
1365 cfg_net_subscr_keep_cmd,
1366 "subscriber-keep-in-ram (0|1)",
1367 "Keep unused subscribers in RAM.\n"
1368 "Delete unused subscribers\n" "Keep unused subscribers\n")
1369{
1370 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1371 gsmnet->keep_subscr = atoi(argv[0]);
1372 return CMD_SUCCESS;
1373}
1374
Harald Welte5258fc42009-03-28 19:07:53 +00001375/* per-BTS configuration */
1376DEFUN(cfg_bts,
1377 cfg_bts_cmd,
1378 "bts BTS_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02001379 "Select a BTS to configure\n"
1380 "BTS Number\n")
Harald Welte5258fc42009-03-28 19:07:53 +00001381{
Harald Weltedcccb182010-05-16 20:52:23 +02001382 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte5258fc42009-03-28 19:07:53 +00001383 int bts_nr = atoi(argv[0]);
1384 struct gsm_bts *bts;
1385
Harald Weltee441d9c2009-06-21 16:17:15 +02001386 if (bts_nr > gsmnet->num_bts) {
1387 vty_out(vty, "%% The next unused BTS number is %u%s",
1388 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001389 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001390 } else if (bts_nr == gsmnet->num_bts) {
1391 /* allocate a new one */
1392 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
1393 HARDCODED_TSC, HARDCODED_BSIC);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001394 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02001395 bts = gsm_bts_num(gsmnet, bts_nr);
1396
Daniel Willmannf15c2762010-01-11 13:43:07 +01001397 if (!bts) {
1398 vty_out(vty, "%% Unable to allocate BTS %u%s",
1399 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee441d9c2009-06-21 16:17:15 +02001400 return CMD_WARNING;
Daniel Willmannf15c2762010-01-11 13:43:07 +01001401 }
Harald Welte5258fc42009-03-28 19:07:53 +00001402
1403 vty->index = bts;
Harald Welte197dea92010-05-14 17:59:53 +02001404 vty->index_sub = &bts->description;
Harald Welte5258fc42009-03-28 19:07:53 +00001405 vty->node = BTS_NODE;
1406
1407 return CMD_SUCCESS;
1408}
1409
1410DEFUN(cfg_bts_type,
1411 cfg_bts_type_cmd,
1412 "type TYPE",
1413 "Set the BTS type\n")
1414{
1415 struct gsm_bts *bts = vty->index;
Harald Welte39315c42010-01-10 18:01:52 +01001416 int rc;
Harald Welte5258fc42009-03-28 19:07:53 +00001417
Harald Welte39315c42010-01-10 18:01:52 +01001418 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1419 if (rc < 0)
1420 return CMD_WARNING;
Harald Welte8175e952009-10-20 00:22:00 +02001421
Harald Welte5258fc42009-03-28 19:07:53 +00001422 return CMD_SUCCESS;
1423}
1424
Harald Weltefcd24452009-06-20 18:15:19 +02001425DEFUN(cfg_bts_band,
1426 cfg_bts_band_cmd,
1427 "band BAND",
1428 "Set the frequency band of this BTS\n")
1429{
1430 struct gsm_bts *bts = vty->index;
Harald Welte42581822009-08-08 16:12:58 +02001431 int band = gsm_band_parse(argv[0]);
Harald Weltefcd24452009-06-20 18:15:19 +02001432
1433 if (band < 0) {
1434 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1435 band, VTY_NEWLINE);
1436 return CMD_WARNING;
1437 }
1438
1439 bts->band = band;
1440
1441 return CMD_SUCCESS;
1442}
1443
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001444DEFUN(cfg_bts_ci,
1445 cfg_bts_ci_cmd,
1446 "cell_identity <0-65535>",
1447 "Set the Cell identity of this BTS\n")
1448{
1449 struct gsm_bts *bts = vty->index;
1450 int ci = atoi(argv[0]);
1451
1452 if (ci < 0 || ci > 0xffff) {
1453 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1454 ci, VTY_NEWLINE);
1455 return CMD_WARNING;
1456 }
1457 bts->cell_identity = ci;
1458
1459 return CMD_SUCCESS;
1460}
1461
Harald Welte5258fc42009-03-28 19:07:53 +00001462DEFUN(cfg_bts_lac,
1463 cfg_bts_lac_cmd,
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001464 "location_area_code <0-65535>",
Harald Welte5258fc42009-03-28 19:07:53 +00001465 "Set the Location Area Code (LAC) of this BTS\n")
1466{
1467 struct gsm_bts *bts = vty->index;
1468 int lac = atoi(argv[0]);
1469
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001470 if (lac < 0 || lac > 0xffff) {
1471 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte5258fc42009-03-28 19:07:53 +00001472 lac, VTY_NEWLINE);
1473 return CMD_WARNING;
1474 }
Holger Hans Peter Freythere48b9562009-10-01 04:07:15 +02001475
1476 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1477 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1478 lac, VTY_NEWLINE);
1479 return CMD_WARNING;
1480 }
1481
Harald Welte5258fc42009-03-28 19:07:53 +00001482 bts->location_area_code = lac;
1483
1484 return CMD_SUCCESS;
1485}
1486
Harald Weltea43f7892009-12-01 18:04:30 +05301487
Harald Welte5258fc42009-03-28 19:07:53 +00001488DEFUN(cfg_bts_tsc,
1489 cfg_bts_tsc_cmd,
1490 "training_sequence_code <0-255>",
1491 "Set the Training Sequence Code (TSC) of this BTS\n")
1492{
1493 struct gsm_bts *bts = vty->index;
1494 int tsc = atoi(argv[0]);
1495
1496 if (tsc < 0 || tsc > 0xff) {
1497 vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s",
1498 tsc, VTY_NEWLINE);
1499 return CMD_WARNING;
1500 }
1501 bts->tsc = tsc;
1502
1503 return CMD_SUCCESS;
1504}
1505
Harald Welte78f2f502009-05-23 16:56:52 +00001506DEFUN(cfg_bts_bsic,
1507 cfg_bts_bsic_cmd,
1508 "base_station_id_code <0-63>",
1509 "Set the Base Station Identity Code (BSIC) of this BTS\n")
1510{
1511 struct gsm_bts *bts = vty->index;
1512 int bsic = atoi(argv[0]);
1513
1514 if (bsic < 0 || bsic > 0x3f) {
Harald Welte42581822009-08-08 16:12:58 +02001515 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte78f2f502009-05-23 16:56:52 +00001516 bsic, VTY_NEWLINE);
1517 return CMD_WARNING;
1518 }
1519 bts->bsic = bsic;
1520
1521 return CMD_SUCCESS;
1522}
1523
1524
Harald Welte4cc34222009-05-01 15:12:31 +00001525DEFUN(cfg_bts_unit_id,
1526 cfg_bts_unit_id_cmd,
Harald Welte07dc73d2009-08-07 13:27:09 +02001527 "ip.access unit_id <0-65534> <0-255>",
1528 "Set the ip.access BTS Unit ID of this BTS\n")
Harald Welte4cc34222009-05-01 15:12:31 +00001529{
1530 struct gsm_bts *bts = vty->index;
1531 int site_id = atoi(argv[0]);
1532 int bts_id = atoi(argv[1]);
1533
Harald Welte07dc73d2009-08-07 13:27:09 +02001534 if (!is_ipaccess_bts(bts)) {
1535 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1536 return CMD_WARNING;
1537 }
1538
Harald Welte4cc34222009-05-01 15:12:31 +00001539 bts->ip_access.site_id = site_id;
1540 bts->ip_access.bts_id = bts_id;
1541
1542 return CMD_SUCCESS;
1543}
1544
Harald Welte8f0ed552010-05-11 21:53:49 +02001545#define OML_STR "Organization & Maintenance Link\n"
1546#define IPA_STR "ip.access Specific Options\n"
1547
Harald Welte8175e952009-10-20 00:22:00 +02001548DEFUN(cfg_bts_stream_id,
1549 cfg_bts_stream_id_cmd,
1550 "oml ip.access stream_id <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001551 OML_STR IPA_STR
Harald Welte8175e952009-10-20 00:22:00 +02001552 "Set the ip.access Stream ID of the OML link of this BTS\n")
1553{
1554 struct gsm_bts *bts = vty->index;
1555 int stream_id = atoi(argv[0]);
1556
1557 if (!is_ipaccess_bts(bts)) {
1558 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1559 return CMD_WARNING;
1560 }
1561
1562 bts->oml_tei = stream_id;
1563
1564 return CMD_SUCCESS;
1565}
1566
Harald Welte8f0ed552010-05-11 21:53:49 +02001567#define OML_E1_STR OML_STR "E1 Line\n"
Harald Welte8175e952009-10-20 00:22:00 +02001568
Harald Welte42581822009-08-08 16:12:58 +02001569DEFUN(cfg_bts_oml_e1,
1570 cfg_bts_oml_e1_cmd,
1571 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001572 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001573 "E1 interface to be used for OML\n")
1574{
1575 struct gsm_bts *bts = vty->index;
1576
1577 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1578
1579 return CMD_SUCCESS;
1580}
1581
1582
1583DEFUN(cfg_bts_oml_e1_tei,
1584 cfg_bts_oml_e1_tei_cmd,
1585 "oml e1 tei <0-63>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001586 OML_E1_STR
Harald Welte42581822009-08-08 16:12:58 +02001587 "Set the TEI to be used for OML")
1588{
1589 struct gsm_bts *bts = vty->index;
1590
1591 bts->oml_tei = atoi(argv[0]);
1592
1593 return CMD_SUCCESS;
1594}
1595
Harald Welte7a8fa412009-08-10 13:48:16 +02001596DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1597 "channel allocator (ascending|descending)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001598 "Channnel Allocator\n" "Channel Allocator\n"
1599 "Allocate Timeslots and Transceivers in ascending order\n"
1600 "Allocate Timeslots and Transceivers in descending order\n")
Harald Welte7a8fa412009-08-10 13:48:16 +02001601{
1602 struct gsm_bts *bts = vty->index;
1603
1604 if (!strcmp(argv[0], "ascending"))
1605 bts->chan_alloc_reverse = 0;
1606 else
1607 bts->chan_alloc_reverse = 1;
1608
1609 return CMD_SUCCESS;
1610}
1611
Harald Welte8f0ed552010-05-11 21:53:49 +02001612#define RACH_STR "Random Access Control Channel\n"
1613
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001614DEFUN(cfg_bts_rach_tx_integer,
1615 cfg_bts_rach_tx_integer_cmd,
1616 "rach tx integer <0-15>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001617 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001618 "Set the raw tx integer value in RACH Control parameters IE")
1619{
1620 struct gsm_bts *bts = vty->index;
1621 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1622 return CMD_SUCCESS;
1623}
1624
1625DEFUN(cfg_bts_rach_max_trans,
1626 cfg_bts_rach_max_trans_cmd,
1627 "rach max transmission (1|2|4|7)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001628 RACH_STR
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001629 "Set the maximum number of RACH burst transmissions")
1630{
1631 struct gsm_bts *bts = vty->index;
1632 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1633 return CMD_SUCCESS;
1634}
1635
Harald Welte8f0ed552010-05-11 21:53:49 +02001636#define NM_STR "Network Management\n"
1637
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001638DEFUN(cfg_bts_rach_nm_b_thresh,
1639 cfg_bts_rach_nm_b_thresh_cmd,
1640 "rach nm busy threshold <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001641 RACH_STR NM_STR
1642 "Set the NM Busy Threshold in dB")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001643{
1644 struct gsm_bts *bts = vty->index;
1645 bts->rach_b_thresh = atoi(argv[0]);
1646 return CMD_SUCCESS;
1647}
1648
1649DEFUN(cfg_bts_rach_nm_ldavg,
1650 cfg_bts_rach_nm_ldavg_cmd,
1651 "rach nm load average <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001652 RACH_STR NM_STR
1653 "Set the NM Loadaverage Slots value")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08001654{
1655 struct gsm_bts *bts = vty->index;
1656 bts->rach_ldavg_slots = atoi(argv[0]);
1657 return CMD_SUCCESS;
1658}
1659
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001660DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
1661 "cell barred (0|1)",
1662 "Should this cell be barred from access?")
1663{
1664 struct gsm_bts *bts = vty->index;
1665
Harald Welte71355012009-12-21 23:08:18 +01001666 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02001667
1668 return CMD_SUCCESS;
1669}
1670
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08001671DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd,
1672 "rach emergency call allowed (0|1)",
1673 "Should this cell allow emergency calls?")
1674{
1675 struct gsm_bts *bts = vty->index;
1676
1677 if (atoi(argv[0]) == 0)
1678 bts->si_common.rach_control.t2 |= 0x4;
1679 else
1680 bts->si_common.rach_control.t2 &= ~0x4;
1681
1682 return CMD_SUCCESS;
1683}
1684
Harald Welte (local)0e451d02009-08-13 10:14:26 +02001685DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
1686 "ms max power <0-40>",
1687 "Maximum transmit power of the MS")
1688{
1689 struct gsm_bts *bts = vty->index;
1690
1691 bts->ms_max_power = atoi(argv[0]);
1692
1693 return CMD_SUCCESS;
1694}
1695
Harald Welte73225282009-12-12 18:17:25 +01001696DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
1697 "cell reselection hysteresis <0-14>",
1698 "Cell Re-Selection Hysteresis in dB")
1699{
1700 struct gsm_bts *bts = vty->index;
1701
1702 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
1703
1704 return CMD_SUCCESS;
1705}
1706
1707DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
1708 "rxlev access min <0-63>",
1709 "Minimum RxLev needed for cell access (better than -110dBm)")
1710{
1711 struct gsm_bts *bts = vty->index;
1712
1713 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
1714
1715 return CMD_SUCCESS;
1716}
1717
Sylvain Munaute0b06b02010-11-28 18:17:28 +01001718DEFUN(cfg_bts_cell_bar_qualify, cfg_bts_cell_bar_qualify_cmd,
1719 "cell bar qualify (0|1)",
1720 "Cell Bar Qualify")
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.cbq = atoi(argv[0]);
1726
1727 return CMD_SUCCESS;
1728}
1729
1730DEFUN(cfg_bts_cell_resel_ofs, cfg_bts_cell_resel_ofs_cmd,
1731 "cell reselection offset <0-126>",
1732 "Cell Re-Selection Offset in dB")
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.cell_resel_off = atoi(argv[0])/2;
1738
1739 return CMD_SUCCESS;
1740}
1741
1742DEFUN(cfg_bts_temp_ofs, cfg_bts_temp_ofs_cmd,
1743 "temporary offset <0-60>",
1744 "Cell selection temporary negative offset in dB")
1745{
1746 struct gsm_bts *bts = vty->index;
1747
1748 bts->si_common.cell_ro_sel_par.present = 1;
1749 bts->si_common.cell_ro_sel_par.temp_offs = atoi(argv[0])/10;
1750
1751 return CMD_SUCCESS;
1752}
1753
1754DEFUN(cfg_bts_temp_ofs_inf, cfg_bts_temp_ofs_inf_cmd,
1755 "temporary offset infinite",
1756 "Sets cell selection temporary negative offset to infinity")
1757{
1758 struct gsm_bts *bts = vty->index;
1759
1760 bts->si_common.cell_ro_sel_par.present = 1;
1761 bts->si_common.cell_ro_sel_par.temp_offs = 7;
1762
1763 return CMD_SUCCESS;
1764}
1765
1766DEFUN(cfg_bts_penalty_time, cfg_bts_penalty_time_cmd,
1767 "penalty time <20-620>",
1768 "Cell selection penalty time in seconds (by 20s increments)")
1769{
1770 struct gsm_bts *bts = vty->index;
1771
1772 bts->si_common.cell_ro_sel_par.present = 1;
1773 bts->si_common.cell_ro_sel_par.penalty_time = (atoi(argv[0])-20)/20;
1774
1775 return CMD_SUCCESS;
1776}
1777
1778DEFUN(cfg_bts_penalty_time_rsvd, cfg_bts_penalty_time_rsvd_cmd,
1779 "penalty time reserved",
1780 "Set cell selection penalty time to reserved value 31\n"
1781 "(indicate that CELL_RESELECT_OFFSET is subtracted from C2 "
1782 "and TEMPORARY_OFFSET is ignored)")
1783{
1784 struct gsm_bts *bts = vty->index;
1785
1786 bts->si_common.cell_ro_sel_par.present = 1;
1787 bts->si_common.cell_ro_sel_par.penalty_time = 31;
1788
1789 return CMD_SUCCESS;
1790}
1791
Harald Welte (local)efc92312009-08-14 23:09:25 +02001792DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
1793 "periodic location update <0-1530>",
1794 "Periodic Location Updating Interval in Minutes")
1795{
1796 struct gsm_bts *bts = vty->index;
1797
Dieter Spaard6613e02010-10-05 21:10:55 +02001798 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 6;
Harald Welte (local)efc92312009-08-14 23:09:25 +02001799
1800 return CMD_SUCCESS;
1801}
1802
Harald Welte8f0ed552010-05-11 21:53:49 +02001803#define GPRS_TEXT "GPRS Packet Network\n"
1804
Harald Welteaf387632010-03-14 23:30:30 +08001805DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welte57ba7e32010-04-18 14:00:26 +02001806 "gprs cell bvci <2-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001807 GPRS_TEXT
1808 "GPRS Cell Settings\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001809 "GPRS BSSGP VC Identifier")
1810{
1811 struct gsm_bts *bts = vty->index;
1812
Harald Welte4511d892010-04-18 15:51:20 +02001813 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001814 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1815 return CMD_WARNING;
1816 }
1817
Harald Welte97a282b2010-03-14 15:37:43 +08001818 bts->gprs.cell.bvci = atoi(argv[0]);
1819
1820 return CMD_SUCCESS;
1821}
1822
Harald Weltea5731cf2010-03-22 11:48:36 +08001823DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
1824 "gprs nsei <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001825 GPRS_TEXT
Harald Weltea5731cf2010-03-22 11:48:36 +08001826 "GPRS NS Entity Identifier")
1827{
1828 struct gsm_bts *bts = vty->index;
1829
Harald Welte4511d892010-04-18 15:51:20 +02001830 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltea5731cf2010-03-22 11:48:36 +08001831 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1832 return CMD_WARNING;
1833 }
1834
1835 bts->gprs.nse.nsei = atoi(argv[0]);
1836
1837 return CMD_SUCCESS;
1838}
1839
Harald Welte8f0ed552010-05-11 21:53:49 +02001840#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
1841 "NSVC Logical Number\n"
Harald Weltea5731cf2010-03-22 11:48:36 +08001842
Harald Welte97a282b2010-03-14 15:37:43 +08001843DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
1844 "gprs nsvc <0-1> nsvci <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001845 GPRS_TEXT NSVC_TEXT
1846 "NS Virtual Connection Identifier\n"
Harald Welte97a282b2010-03-14 15:37:43 +08001847 "GPRS NS VC Identifier")
1848{
1849 struct gsm_bts *bts = vty->index;
1850 int idx = atoi(argv[0]);
1851
Harald Welte4511d892010-04-18 15:51:20 +02001852 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-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 Welte97a282b2010-03-14 15:37:43 +08001857 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
1858
1859 return CMD_SUCCESS;
1860}
1861
Harald Welteaf387632010-03-14 23:30:30 +08001862DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
1863 "gprs nsvc <0-1> local udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001864 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001865 "GPRS NS Local UDP Port")
1866{
1867 struct gsm_bts *bts = vty->index;
1868 int idx = atoi(argv[0]);
1869
Harald Welte4511d892010-04-18 15:51:20 +02001870 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001871 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1872 return CMD_WARNING;
1873 }
1874
Harald Welteaf387632010-03-14 23:30:30 +08001875 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
1876
1877 return CMD_SUCCESS;
1878}
1879
1880DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
1881 "gprs nsvc <0-1> remote udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001882 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001883 "GPRS NS Remote UDP Port")
1884{
1885 struct gsm_bts *bts = vty->index;
1886 int idx = atoi(argv[0]);
1887
Harald Welte4511d892010-04-18 15:51:20 +02001888 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001889 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1890 return CMD_WARNING;
1891 }
1892
Harald Welteaf387632010-03-14 23:30:30 +08001893 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
1894
1895 return CMD_SUCCESS;
1896}
1897
1898DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
1899 "gprs nsvc <0-1> remote ip A.B.C.D",
Harald Welte8f0ed552010-05-11 21:53:49 +02001900 GPRS_TEXT NSVC_TEXT
Harald Welteaf387632010-03-14 23:30:30 +08001901 "GPRS NS Remote IP Address")
1902{
1903 struct gsm_bts *bts = vty->index;
1904 int idx = atoi(argv[0]);
1905 struct in_addr ia;
1906
Harald Welte4511d892010-04-18 15:51:20 +02001907 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001908 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1909 return CMD_WARNING;
1910 }
1911
Harald Welteaf387632010-03-14 23:30:30 +08001912 inet_aton(argv[1], &ia);
1913 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
1914
1915 return CMD_SUCCESS;
1916}
1917
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08001918DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd,
1919 "paging free FREE_NR",
1920 "Only page when having a certain amount of free slots. -1 to disable")
1921{
1922 struct gsm_bts *bts = vty->index;
1923
1924 bts->paging.free_chans_need = atoi(argv[0]);
1925 return CMD_SUCCESS;
1926}
1927
Harald Welte615e9562010-05-11 23:50:21 +02001928DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd,
1929 "gprs ns timer " NS_TIMERS " <0-255>",
1930 GPRS_TEXT "Network Service\n"
1931 "Network Service Timer\n"
1932 NS_TIMERS_HELP "Timer Value\n")
1933{
1934 struct gsm_bts *bts = vty->index;
1935 int idx = get_string_value(gprs_ns_timer_strs, argv[0]);
1936 int val = atoi(argv[1]);
1937
1938 if (bts->gprs.mode == BTS_GPRS_NONE) {
1939 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1940 return CMD_WARNING;
1941 }
1942
1943 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
1944 return CMD_WARNING;
1945
1946 bts->gprs.nse.timer[idx] = val;
1947
1948 return CMD_SUCCESS;
1949}
1950
1951#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 Welte28326062010-05-14 20:05:17 +02001952#define BSSGP_TIMERS_HELP \
1953 "Tbvc-block timeout\n" \
1954 "Tbvc-block retries\n" \
1955 "Tbvc-unblock retries\n" \
1956 "Tbvcc-reset timeout\n" \
1957 "Tbvc-reset retries\n" \
1958 "Tbvc-suspend timeout\n" \
1959 "Tbvc-suspend retries\n" \
1960 "Tbvc-resume timeout\n" \
1961 "Tbvc-resume retries\n" \
1962 "Tbvc-capa-update timeout\n" \
1963 "Tbvc-capa-update retries\n"
Harald Welte615e9562010-05-11 23:50:21 +02001964
1965DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd,
1966 "gprs cell timer " BSSGP_TIMERS " <0-255>",
1967 GPRS_TEXT "Cell / BSSGP\n"
1968 "Cell/BSSGP Timer\n"
1969 BSSGP_TIMERS_HELP "Timer Value\n")
1970{
1971 struct gsm_bts *bts = vty->index;
1972 int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
1973 int val = atoi(argv[1]);
1974
1975 if (bts->gprs.mode == BTS_GPRS_NONE) {
1976 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1977 return CMD_WARNING;
1978 }
1979
1980 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer))
1981 return CMD_WARNING;
1982
1983 bts->gprs.cell.timer[idx] = val;
1984
1985 return CMD_SUCCESS;
1986}
1987
Harald Welte97a282b2010-03-14 15:37:43 +08001988DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
1989 "gprs routing area <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001990 GPRS_TEXT
Harald Welte97a282b2010-03-14 15:37:43 +08001991 "GPRS Routing Area Code")
1992{
1993 struct gsm_bts *bts = vty->index;
1994
Harald Welte4511d892010-04-18 15:51:20 +02001995 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08001996 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
1997 return CMD_WARNING;
1998 }
1999
Harald Welte97a282b2010-03-14 15:37:43 +08002000 bts->gprs.rac = atoi(argv[0]);
2001
2002 return CMD_SUCCESS;
2003}
2004
Harald Welte4511d892010-04-18 15:51:20 +02002005DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
2006 "gprs mode (none|gprs|egprs)",
Harald Welte8f0ed552010-05-11 21:53:49 +02002007 GPRS_TEXT
2008 "GPRS Mode for this BTS\n"
2009 "GPRS Disabled on this BTS\n"
2010 "GPRS Enabled on this BTS\n"
2011 "EGPRS (EDGE) Enabled on this BTS\n")
Harald Welteaf387632010-03-14 23:30:30 +08002012{
2013 struct gsm_bts *bts = vty->index;
Harald Weltef3d8e922010-06-14 22:44:42 +02002014 enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0]);
Harald Welteaf387632010-03-14 23:30:30 +08002015
Harald Weltef3d8e922010-06-14 22:44:42 +02002016 if (mode != BTS_GPRS_NONE &&
2017 !gsm_bts_has_feature(bts, BTS_FEAT_GPRS)) {
2018 vty_out(vty, "This BTS type does not support %s%s", argv[0],
2019 VTY_NEWLINE);
2020 return CMD_WARNING;
2021 }
2022 if (mode == BTS_GPRS_EGPRS &&
2023 !gsm_bts_has_feature(bts, BTS_FEAT_EGPRS)) {
2024 vty_out(vty, "This BTS type does not support %s%s", argv[0],
2025 VTY_NEWLINE);
2026 return CMD_WARNING;
2027 }
2028
2029 bts->gprs.mode = mode;
Harald Welteaf387632010-03-14 23:30:30 +08002030
2031 return CMD_SUCCESS;
2032}
2033
Harald Welte9fbff4a2010-07-30 11:50:09 +02002034#define SI_TEXT "System Information Messages\n"
2035#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)"
2036#define SI_TYPE_HELP "System Information Type 1\n" \
2037 "System Information Type 2\n" \
2038 "System Information Type 3\n" \
2039 "System Information Type 4\n" \
2040 "System Information Type 5\n" \
2041 "System Information Type 6\n" \
2042 "System Information Type 7\n" \
2043 "System Information Type 8\n" \
2044 "System Information Type 9\n" \
2045 "System Information Type 10\n" \
2046 "System Information Type 13\n" \
2047 "System Information Type 16\n" \
2048 "System Information Type 17\n" \
2049 "System Information Type 18\n" \
2050 "System Information Type 19\n" \
2051 "System Information Type 20\n" \
2052 "System Information Type 2bis\n" \
2053 "System Information Type 2ter\n" \
2054 "System Information Type 2quater\n" \
2055 "System Information Type 5bis\n" \
2056 "System Information Type 5ter\n"
2057
2058DEFUN(cfg_bts_si_mode, cfg_bts_si_mode_cmd,
2059 "system-information " SI_TYPE_TEXT " mode (static|computed)",
2060 SI_TEXT SI_TYPE_HELP
2061 "System Information Mode\n"
2062 "Static user-specified\n"
2063 "Dynamic, BSC-computed\n")
2064{
2065 struct gsm_bts *bts = vty->index;
2066 int type;
2067
2068 type = get_string_value(osmo_sitype_strs, argv[0]);
2069 if (type < 0) {
2070 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2071 return CMD_WARNING;
2072 }
2073
2074 if (!strcmp(argv[1], "static"))
2075 bts->si_mode_static |= (1 << type);
2076 else
2077 bts->si_mode_static &= ~(1 << type);
2078
2079 return CMD_SUCCESS;
2080}
2081
2082DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd,
2083 "system-information " SI_TYPE_TEXT " static HEXSTRING",
2084 SI_TEXT SI_TYPE_HELP
2085 "Static System Information filling\n"
2086 "Static user-specified SI content in HEX notation\n")
2087{
2088 struct gsm_bts *bts = vty->index;
2089 int rc, type;
2090
2091 type = get_string_value(osmo_sitype_strs, argv[0]);
2092 if (type < 0) {
2093 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2094 return CMD_WARNING;
2095 }
2096
2097 if (!(bts->si_mode_static & (1 << type))) {
2098 vty_out(vty, "SI Type %s is not configured in static mode%s",
2099 get_value_string(osmo_sitype_strs, type), VTY_NEWLINE);
2100 return CMD_WARNING;
2101 }
2102
Harald Welte290aaed2010-07-30 11:53:18 +02002103 /* Fill buffer with padding pattern */
2104 memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type]));
2105
2106 /* Parse the user-specified SI in hex format, [partially] overwriting padding */
Harald Welte9fbff4a2010-07-30 11:50:09 +02002107 rc = hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0]));
2108 if (rc < 0 || rc > sizeof(bts->si_buf[0])) {
2109 vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
2110 return CMD_WARNING;
2111 }
2112
2113 /* Mark this SI as present */
2114 bts->si_valid |= (1 << type);
2115
2116 return CMD_SUCCESS;
2117}
2118
2119
Harald Welte8f0ed552010-05-11 21:53:49 +02002120#define TRX_TEXT "Radio Transceiver\n"
Harald Welte7a8fa412009-08-10 13:48:16 +02002121
Harald Welte5258fc42009-03-28 19:07:53 +00002122/* per TRX configuration */
2123DEFUN(cfg_trx,
2124 cfg_trx_cmd,
2125 "trx TRX_NR",
Harald Welte8f0ed552010-05-11 21:53:49 +02002126 TRX_TEXT
Harald Welte5258fc42009-03-28 19:07:53 +00002127 "Select a TRX to configure")
2128{
2129 int trx_nr = atoi(argv[0]);
2130 struct gsm_bts *bts = vty->index;
2131 struct gsm_bts_trx *trx;
2132
Harald Weltee441d9c2009-06-21 16:17:15 +02002133 if (trx_nr > bts->num_trx) {
2134 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
2135 bts->num_trx, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00002136 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02002137 } else if (trx_nr == bts->num_trx) {
2138 /* we need to allocate a new one */
2139 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02002140 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02002141 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02002142
Harald Weltee441d9c2009-06-21 16:17:15 +02002143 if (!trx)
2144 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +00002145
2146 vty->index = trx;
Harald Welte197dea92010-05-14 17:59:53 +02002147 vty->index_sub = &trx->description;
Harald Welte5258fc42009-03-28 19:07:53 +00002148 vty->node = TRX_NODE;
2149
2150 return CMD_SUCCESS;
2151}
2152
2153DEFUN(cfg_trx_arfcn,
2154 cfg_trx_arfcn_cmd,
Harald Welte93e90202010-05-14 19:00:52 +02002155 "arfcn <0-1024>",
Harald Welte5258fc42009-03-28 19:07:53 +00002156 "Set the ARFCN for this TRX\n")
2157{
2158 int arfcn = atoi(argv[0]);
2159 struct gsm_bts_trx *trx = vty->index;
2160
2161 /* FIXME: check if this ARFCN is supported by this TRX */
2162
2163 trx->arfcn = arfcn;
2164
2165 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
2166 /* FIXME: use OML layer to update the ARFCN */
2167 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
2168
2169 return CMD_SUCCESS;
2170}
2171
Harald Welte (local)7b37d972009-12-27 20:56:38 +01002172DEFUN(cfg_trx_nominal_power,
2173 cfg_trx_nominal_power_cmd,
2174 "nominal power <0-100>",
2175 "Nominal TRX RF Power in dB\n")
2176{
2177 struct gsm_bts_trx *trx = vty->index;
2178
2179 trx->nominal_power = atoi(argv[0]);
2180
2181 return CMD_SUCCESS;
2182}
2183
Harald Weltefcd24452009-06-20 18:15:19 +02002184DEFUN(cfg_trx_max_power_red,
2185 cfg_trx_max_power_red_cmd,
2186 "max_power_red <0-100>",
2187 "Reduction of maximum BS RF Power in dB\n")
2188{
2189 int maxpwr_r = atoi(argv[0]);
2190 struct gsm_bts_trx *trx = vty->index;
Harald Welte61a83b22009-11-18 09:20:22 +01002191 int upper_limit = 24; /* default 12.21 max power red. */
Harald Weltefcd24452009-06-20 18:15:19 +02002192
2193 /* FIXME: check if our BTS type supports more than 12 */
2194 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
2195 vty_out(vty, "%% Power %d dB is not in the valid range%s",
2196 maxpwr_r, VTY_NEWLINE);
2197 return CMD_WARNING;
2198 }
2199 if (maxpwr_r & 1) {
2200 vty_out(vty, "%% Power %d dB is not an even value%s",
2201 maxpwr_r, VTY_NEWLINE);
2202 return CMD_WARNING;
2203 }
2204
2205 trx->max_power_red = maxpwr_r;
2206
2207 /* FIXME: make sure we update this using OML */
2208
2209 return CMD_SUCCESS;
2210}
2211
Harald Welte42581822009-08-08 16:12:58 +02002212DEFUN(cfg_trx_rsl_e1,
2213 cfg_trx_rsl_e1_cmd,
2214 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
2215 "E1 interface to be used for RSL\n")
2216{
2217 struct gsm_bts_trx *trx = vty->index;
2218
2219 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
2220
2221 return CMD_SUCCESS;
2222}
2223
2224DEFUN(cfg_trx_rsl_e1_tei,
2225 cfg_trx_rsl_e1_tei_cmd,
2226 "rsl e1 tei <0-63>",
2227 "Set the TEI to be used for RSL")
2228{
2229 struct gsm_bts_trx *trx = vty->index;
2230
2231 trx->rsl_tei = atoi(argv[0]);
2232
2233 return CMD_SUCCESS;
2234}
2235
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01002236DEFUN(cfg_trx_rf_locked,
2237 cfg_trx_rf_locked_cmd,
2238 "rf_locked (0|1)",
2239 "Turn off RF of the TRX.\n")
2240{
2241 int locked = atoi(argv[0]);
2242 struct gsm_bts_trx *trx = vty->index;
2243
2244 gsm_trx_lock_rf(trx, locked);
2245 return CMD_SUCCESS;
2246}
Harald Welte42581822009-08-08 16:12:58 +02002247
Harald Welte5258fc42009-03-28 19:07:53 +00002248/* per TS configuration */
2249DEFUN(cfg_ts,
2250 cfg_ts_cmd,
Harald Welte42581822009-08-08 16:12:58 +02002251 "timeslot <0-7>",
Harald Welte5258fc42009-03-28 19:07:53 +00002252 "Select a Timeslot to configure")
2253{
2254 int ts_nr = atoi(argv[0]);
2255 struct gsm_bts_trx *trx = vty->index;
2256 struct gsm_bts_trx_ts *ts;
2257
2258 if (ts_nr >= TRX_NR_TS) {
2259 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
2260 TRX_NR_TS, VTY_NEWLINE);
2261 return CMD_WARNING;
2262 }
2263
2264 ts = &trx->ts[ts_nr];
2265
2266 vty->index = ts;
2267 vty->node = TS_NODE;
2268
2269 return CMD_SUCCESS;
2270}
2271
Harald Weltea6fd58e2009-08-07 00:25:23 +02002272DEFUN(cfg_ts_pchan,
2273 cfg_ts_pchan_cmd,
2274 "phys_chan_config PCHAN",
2275 "Physical Channel configuration (TCH/SDCCH/...)")
2276{
2277 struct gsm_bts_trx_ts *ts = vty->index;
2278 int pchanc;
2279
2280 pchanc = gsm_pchan_parse(argv[0]);
2281 if (pchanc < 0)
2282 return CMD_WARNING;
2283
2284 ts->pchan = pchanc;
2285
2286 return CMD_SUCCESS;
2287}
2288
Harald Weltea39b0f22010-06-14 22:26:10 +02002289#define HOPPING_STR "Configure frequency hopping\n"
2290
2291DEFUN(cfg_ts_hopping,
2292 cfg_ts_hopping_cmd,
2293 "hopping enabled (0|1)",
2294 HOPPING_STR "Enable or disable frequency hopping\n"
2295 "Disable frequency hopping\n" "Enable frequency hopping\n")
2296{
2297 struct gsm_bts_trx_ts *ts = vty->index;
Harald Weltec2fb3d02010-06-14 22:47:37 +02002298 int enabled = atoi(argv[0]);
Harald Weltea39b0f22010-06-14 22:26:10 +02002299
Harald Weltec2fb3d02010-06-14 22:47:37 +02002300 if (enabled && !gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_HOPPING)) {
2301 vty_out(vty, "BTS model does not support hopping%s",
2302 VTY_NEWLINE);
2303 return CMD_WARNING;
2304 }
2305
2306 ts->hopping.enabled = enabled;
Harald Weltea39b0f22010-06-14 22:26:10 +02002307
2308 return CMD_SUCCESS;
2309}
2310
Harald Welte6e0cd042009-09-12 13:05:33 +02002311DEFUN(cfg_ts_hsn,
2312 cfg_ts_hsn_cmd,
Harald Weltea39b0f22010-06-14 22:26:10 +02002313 "hopping sequence-number <0-63>",
2314 HOPPING_STR
Harald Welte6e0cd042009-09-12 13:05:33 +02002315 "Which hopping sequence to use for this channel")
2316{
2317 struct gsm_bts_trx_ts *ts = vty->index;
2318
2319 ts->hopping.hsn = atoi(argv[0]);
2320
2321 return CMD_SUCCESS;
2322}
2323
2324DEFUN(cfg_ts_maio,
2325 cfg_ts_maio_cmd,
2326 "hopping maio <0-63>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002327 HOPPING_STR
Harald Welte6e0cd042009-09-12 13:05:33 +02002328 "Which hopping MAIO to use for this channel")
2329{
2330 struct gsm_bts_trx_ts *ts = vty->index;
2331
2332 ts->hopping.maio = atoi(argv[0]);
2333
2334 return CMD_SUCCESS;
2335}
2336
2337DEFUN(cfg_ts_arfcn_add,
2338 cfg_ts_arfcn_add_cmd,
2339 "hopping arfcn add <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002340 HOPPING_STR "Configure hopping ARFCN list\n"
2341 "Add an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02002342{
2343 struct gsm_bts_trx_ts *ts = vty->index;
2344 int arfcn = atoi(argv[0]);
2345
Harald Weltea39b0f22010-06-14 22:26:10 +02002346 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1);
2347
Harald Welte6e0cd042009-09-12 13:05:33 +02002348 return CMD_SUCCESS;
2349}
2350
2351DEFUN(cfg_ts_arfcn_del,
2352 cfg_ts_arfcn_del_cmd,
2353 "hopping arfcn del <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02002354 HOPPING_STR "Configure hopping ARFCN list\n"
2355 "Delete an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02002356{
2357 struct gsm_bts_trx_ts *ts = vty->index;
2358 int arfcn = atoi(argv[0]);
2359
Harald Weltea39b0f22010-06-14 22:26:10 +02002360 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0);
2361
Harald Welte6e0cd042009-09-12 13:05:33 +02002362 return CMD_SUCCESS;
2363}
2364
Harald Weltea6fd58e2009-08-07 00:25:23 +02002365DEFUN(cfg_ts_e1_subslot,
2366 cfg_ts_e1_subslot_cmd,
Harald Welte42581822009-08-08 16:12:58 +02002367 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltea6fd58e2009-08-07 00:25:23 +02002368 "E1 sub-slot connected to this on-air timeslot")
2369{
2370 struct gsm_bts_trx_ts *ts = vty->index;
2371
Harald Welte42581822009-08-08 16:12:58 +02002372 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002373
2374 return CMD_SUCCESS;
2375}
Harald Welte5258fc42009-03-28 19:07:53 +00002376
Harald Welte4f10c252010-05-16 21:47:13 +02002377void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
2378{
2379 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
2380 counter_get(net->stats.chreq.total),
2381 counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
2382 vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
2383 counter_get(net->stats.chan.rf_fail),
2384 counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
2385 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
2386 counter_get(net->stats.paging.attempted),
2387 counter_get(net->stats.paging.completed),
2388 counter_get(net->stats.paging.expired), VTY_NEWLINE);
2389 vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
2390 counter_get(net->stats.bts.oml_fail),
2391 counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
2392}
2393
Harald Welte5bc61dc2010-05-16 22:02:16 +02002394DEFUN(logging_fltr_imsi,
2395 logging_fltr_imsi_cmd,
2396 "logging filter imsi IMSI",
2397 LOGGING_STR FILTER_STR
2398 "Filter log messages by IMSI\n" "IMSI to be used as filter\n")
2399{
2400 struct telnet_connection *conn;
2401
2402 conn = (struct telnet_connection *) vty->priv;
2403 if (!conn->dbg) {
2404 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
2405 return CMD_WARNING;
2406 }
2407
2408 log_set_imsi_filter(conn->dbg, argv[0]);
2409 return CMD_SUCCESS;
2410}
2411
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002412DEFUN(drop_bts,
2413 drop_bts_cmd,
Holger Hans Peter Freyther0586b0f2010-04-11 12:46:45 +02002414 "drop bts connection <0-65535> (oml|rsl)",
2415 "Debug/Simulation command to drop ipaccess BTS\n"
2416 "BTS NR\n" "Connection Type\n")
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002417{
2418 struct gsm_network *gsmnet;
2419 struct gsm_bts_trx *trx;
2420 struct gsm_bts *bts;
2421 unsigned int bts_nr;
2422
2423 gsmnet = gsmnet_from_vty(vty);
2424
2425 bts_nr = atoi(argv[0]);
2426 if (bts_nr >= gsmnet->num_bts) {
2427 vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s",
2428 gsmnet->num_bts, bts_nr, VTY_NEWLINE);
2429 return CMD_WARNING;
2430 }
2431
2432 bts = gsm_bts_num(gsmnet, bts_nr);
2433 if (!bts) {
2434 vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE);
2435 return CMD_WARNING;
2436 }
2437
2438 if (!is_ipaccess_bts(bts)) {
2439 vty_out(vty, "This command only works for ipaccess.%s", VTY_NEWLINE);
2440 return CMD_WARNING;
2441 }
2442
2443
2444 /* close all connections */
2445 if (strcmp(argv[1], "oml") == 0) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01002446 ipaccess_drop_oml(bts);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002447 } else if (strcmp(argv[1], "rsl") == 0) {
2448 /* close all rsl connections */
2449 llist_for_each_entry(trx, &bts->trx_list, list) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01002450 ipaccess_drop_rsl(trx);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002451 }
2452 } else {
2453 vty_out(vty, "Argument must be 'oml# or 'rsl'.%s", VTY_NEWLINE);
2454 return CMD_WARNING;
2455 }
2456
2457 return CMD_SUCCESS;
2458}
2459
Harald Welted0d2b0b2010-12-23 13:18:07 +01002460DEFUN(pdch_act, pdch_act_cmd,
2461 "bts <0-255> trx <0-255> timeslot <0-7> pdch (activate|deactivate)",
2462 "BTS related commands\n" "BTS Number\n" "Transceiver\n" "Transceiver Number\n"
2463 "TRX Timeslot\n" "Timeslot Number\n" "Packet Data Channel\n"
2464 "Activate Dynamic PDCH/TCH (-> PDCH mode)\n"
2465 "Deactivate Dynamic PDCH/TCH (-> TCH mode)\n")
2466{
2467 struct gsm_bts *bts;
2468 struct gsm_bts_trx *trx;
2469 struct gsm_bts_trx_ts *ts;
2470 int bts_nr = atoi(argv[0]);
2471 int trx_nr = atoi(argv[1]);
2472 int ts_nr = atoi(argv[2]);
2473 int activate;
2474
2475 bts = gsm_bts_num(bsc_gsmnet, bts_nr);
2476 if (!bts) {
2477 vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE);
2478 return CMD_WARNING;
2479 }
2480
2481 if (!is_ipaccess_bts(bts)) {
2482 vty_out(vty, "%% This command only works for ipaccess BTS%s",
2483 VTY_NEWLINE);
2484 return CMD_WARNING;
2485 }
2486
2487 trx = gsm_bts_trx_num(bts, trx_nr);
2488 if (!trx) {
2489 vty_out(vty, "%% No such TRX (%d)%s", trx_nr, VTY_NEWLINE);
2490 return CMD_WARNING;
2491 }
2492
2493 ts = &trx->ts[ts_nr];
2494 if (ts->pchan != GSM_PCHAN_TCH_F_PDCH) {
2495 vty_out(vty, "%% Timeslot %u is not in dynamic TCH_F/PDCH "
2496 "mode%s", ts_nr, VTY_NEWLINE);
2497 return CMD_WARNING;
2498 }
2499
2500 if (!strcmp(argv[3], "activate"))
2501 activate = 1;
2502 else
2503 activate = 0;
2504
2505 rsl_ipacc_pdch_activate(ts, activate);
2506
2507 return CMD_SUCCESS;
2508
2509}
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002510
Harald Weltedcccb182010-05-16 20:52:23 +02002511extern int bsc_vty_init_extra(void);
Harald Welte1353f962010-05-16 19:20:24 +02002512extern const char *openbsc_copyright;
Holger Hans Peter Freythere1ffc082010-04-10 00:08:28 +02002513
Harald Weltedcccb182010-05-16 20:52:23 +02002514int bsc_vty_init(void)
Harald Welte68628e82009-03-10 12:17:57 +00002515{
Harald Welteb4d5b172010-05-12 16:10:35 +00002516 install_element_ve(&show_net_cmd);
2517 install_element_ve(&show_bts_cmd);
2518 install_element_ve(&show_trx_cmd);
2519 install_element_ve(&show_ts_cmd);
2520 install_element_ve(&show_lchan_cmd);
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08002521 install_element_ve(&show_lchan_summary_cmd);
Harald Welte5bc61dc2010-05-16 22:02:16 +02002522 install_element_ve(&logging_fltr_imsi_cmd);
Harald Welte1bc77352009-03-10 19:47:51 +00002523
Harald Welteb4d5b172010-05-12 16:10:35 +00002524 install_element_ve(&show_e1drv_cmd);
2525 install_element_ve(&show_e1line_cmd);
2526 install_element_ve(&show_e1ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002527
Harald Welteb4d5b172010-05-12 16:10:35 +00002528 install_element_ve(&show_paging_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002529
Harald Welte5bc61dc2010-05-16 22:02:16 +02002530 logging_vty_add_cmds();
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +01002531
Harald Welte5013b2a2009-08-07 13:29:14 +02002532 install_element(CONFIG_NODE, &cfg_net_cmd);
2533 install_node(&net_node, config_write_net);
2534 install_default(GSMNET_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002535 install_element(GSMNET_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002536 install_element(GSMNET_NODE, &ournode_end_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002537 install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002538 install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
2539 install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
2540 install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
Harald Welte (local)69de3972009-08-12 14:42:23 +02002541 install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
Harald Welte1085c092009-11-18 20:33:19 +01002542 install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
Harald Welte4381cfe2009-08-30 15:47:06 +09002543 install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01002544 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welteeab84a12009-12-13 10:53:12 +01002545 install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
Harald Welte3d23db42009-12-14 17:49:15 +01002546 install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
Harald Weltebc814502009-12-19 21:41:52 +01002547 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Welteb720bd32009-12-21 16:51:50 +01002548 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
2549 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
2550 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
2551 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
2552 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
2553 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01002554 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01002555 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
2556 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
2557 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
2558 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
2559 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
2560 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
2561 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
2562 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
2563 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
Harald Weltec9f499f2010-12-23 22:53:50 +01002564 install_element(GSMNET_NODE, &cfg_net_T3122_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01002565 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08002566 install_element(GSMNET_NODE, &cfg_net_dtx_cmd);
Holger Hans Peter Freytherae9006a2010-12-22 16:26:04 +01002567 install_element(GSMNET_NODE, &cfg_net_subscr_keep_cmd);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08002568 install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02002569
2570 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte67ce0732009-08-06 19:06:46 +02002571 install_node(&bts_node, config_write_bts);
Harald Welte68628e82009-03-10 12:17:57 +00002572 install_default(BTS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002573 install_element(BTS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002574 install_element(BTS_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002575 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002576 install_element(BTS_NODE, &cfg_description_cmd);
2577 install_element(BTS_NODE, &cfg_no_description_cmd);
Harald Weltefcd24452009-06-20 18:15:19 +02002578 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02002579 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002580 install_element(BTS_NODE, &cfg_bts_lac_cmd);
2581 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002582 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte4cc34222009-05-01 15:12:31 +00002583 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte8175e952009-10-20 00:22:00 +02002584 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002585 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
2586 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02002587 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01002588 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
2589 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08002590 install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd);
2591 install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02002592 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08002593 install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd);
Harald Welte (local)0e451d02009-08-13 10:14:26 +02002594 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)efc92312009-08-14 23:09:25 +02002595 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Harald Welte73225282009-12-12 18:17:25 +01002596 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
2597 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002598 install_element(BTS_NODE, &cfg_bts_cell_bar_qualify_cmd);
2599 install_element(BTS_NODE, &cfg_bts_cell_resel_ofs_cmd);
2600 install_element(BTS_NODE, &cfg_bts_temp_ofs_cmd);
2601 install_element(BTS_NODE, &cfg_bts_temp_ofs_inf_cmd);
2602 install_element(BTS_NODE, &cfg_bts_penalty_time_cmd);
2603 install_element(BTS_NODE, &cfg_bts_penalty_time_rsvd_cmd);
Harald Welte4511d892010-04-18 15:51:20 +02002604 install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002605 install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002606 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
2607 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02002608 install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
Harald Weltea5731cf2010-03-22 11:48:36 +08002609 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08002610 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welteaf387632010-03-14 23:30:30 +08002611 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
2612 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
2613 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08002614 install_element(BTS_NODE, &cfg_bts_pag_free_cmd);
Harald Welte9fbff4a2010-07-30 11:50:09 +02002615 install_element(BTS_NODE, &cfg_bts_si_mode_cmd);
2616 install_element(BTS_NODE, &cfg_bts_si_static_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002617
Harald Welte5258fc42009-03-28 19:07:53 +00002618 install_element(BTS_NODE, &cfg_trx_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002619 install_node(&trx_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002620 install_default(TRX_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002621 install_element(TRX_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002622 install_element(TRX_NODE, &ournode_end_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00002623 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02002624 install_element(TRX_NODE, &cfg_description_cmd);
2625 install_element(TRX_NODE, &cfg_no_description_cmd);
Harald Welte (local)7b37d972009-12-27 20:56:38 +01002626 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte879dc972009-06-20 22:36:12 +02002627 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte42581822009-08-08 16:12:58 +02002628 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
2629 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01002630 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002631
Harald Welte5258fc42009-03-28 19:07:53 +00002632 install_element(TRX_NODE, &cfg_ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002633 install_node(&ts_node, dummy_config_write);
Harald Welte68628e82009-03-10 12:17:57 +00002634 install_default(TS_NODE);
Harald Welte62ab20c2010-05-14 18:59:17 +02002635 install_element(TS_NODE, &ournode_exit_cmd);
Harald Welte54f74242010-05-14 19:11:04 +02002636 install_element(TS_NODE, &ournode_end_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002637 install_element(TS_NODE, &cfg_ts_pchan_cmd);
Harald Weltea39b0f22010-06-14 22:26:10 +02002638 install_element(TS_NODE, &cfg_ts_hopping_cmd);
Harald Welte6e0cd042009-09-12 13:05:33 +02002639 install_element(TS_NODE, &cfg_ts_hsn_cmd);
2640 install_element(TS_NODE, &cfg_ts_maio_cmd);
2641 install_element(TS_NODE, &cfg_ts_arfcn_add_cmd);
2642 install_element(TS_NODE, &cfg_ts_arfcn_del_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02002643 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00002644
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002645 install_element(ENABLE_NODE, &drop_bts_cmd);
Harald Welted0d2b0b2010-12-23 13:18:07 +01002646 install_element(ENABLE_NODE, &pdch_act_cmd);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02002647
Harald Welte81c9b9c2010-05-31 16:40:40 +02002648 abis_nm_vty_init();
2649
Harald Weltedcccb182010-05-16 20:52:23 +02002650 bsc_vty_init_extra();
Harald Welte40f82892009-05-23 17:31:39 +00002651
Harald Welte68628e82009-03-10 12:17:57 +00002652 return 0;
2653}