blob: 66b30cd6ed3fab3e1d6415287d9cbbdf1679afbe [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>
Maxc08ee712016-05-11 12:45:13 +020021#include <stdbool.h>
Harald Welte68628e82009-03-10 12:17:57 +000022#include <unistd.h>
Harald Welte68628e82009-03-10 12:17:57 +000023
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>
Jacob Erlbeck64630cc2015-10-26 16:25:37 +010028#include <osmocom/vty/stats.h>
Harald Welte4b037e42010-05-19 19:45:32 +020029#include <osmocom/vty/telnet_interface.h>
Harald Welte4ab9d7c2012-08-17 12:42:06 +020030#include <osmocom/vty/misc.h>
Maxc08ee712016-05-11 12:45:13 +020031#include <osmocom/gsm/protocol/gsm_04_08.h>
Holger Hans Peter Freytherec37bb22013-02-05 09:39:09 +010032#include <osmocom/gsm/gsm0502.h>
33
Harald Welte68628e82009-03-10 12:17:57 +000034#include <arpa/inet.h>
35
Pablo Neira Ayuso136f4532011-03-22 16:47:59 +010036#include <osmocom/core/linuxlist.h>
Harald Welte68628e82009-03-10 12:17:57 +000037#include <openbsc/gsm_data.h>
Pablo Neira Ayusoed5cacb2011-08-17 22:44:07 +020038#include <osmocom/abis/e1_input.h>
Harald Welte1bc77352009-03-10 19:47:51 +000039#include <openbsc/abis_nm.h>
Harald Welte4d54d0b2011-02-19 16:48:17 +010040#include <openbsc/abis_om2000.h>
Pablo Neira Ayuso136f4532011-03-22 16:47:59 +010041#include <osmocom/core/utils.h>
42#include <osmocom/gsm/gsm_utils.h>
Harald Weltecdc59ff2011-05-23 20:42:26 +020043#include <osmocom/gsm/abis_nm.h>
Harald Welteb908cb72009-12-22 13:09:29 +010044#include <openbsc/chan_alloc.h>
Harald Welte8387a492009-12-22 21:43:14 +010045#include <openbsc/meas_rep.h>
Harald Welte40f82892009-05-23 17:31:39 +000046#include <openbsc/db.h>
Holger Hans Peter Freyther3c712322010-04-06 11:55:37 +020047#include <openbsc/vty.h>
Harald Welteea34a4e2012-06-16 14:59:56 +080048#include <osmocom/gprs/gprs_ns.h>
Harald Welte9fbff4a2010-07-30 11:50:09 +020049#include <openbsc/system_information.h>
Harald Welte5bc61dc2010-05-16 22:02:16 +020050#include <openbsc/debug.h>
Holger Hans Peter Freyther85334f12010-11-09 17:00:42 +010051#include <openbsc/paging.h>
Harald Weltef7a2b192011-08-20 18:25:02 +020052#include <openbsc/ipaccess.h>
Harald Welted0d2b0b2010-12-23 13:18:07 +010053#include <openbsc/abis_rsl.h>
Neels Hofmeyra42855f2017-02-23 21:49:55 +010054#include <openbsc/bsc_msc_data.h>
Holger Hans Peter Freyther37ac4202011-02-24 14:19:14 +010055#include <openbsc/osmo_bsc_rf.h>
Harald Welte68628e82009-03-10 12:17:57 +000056
Neels Hofmeyr06d39fd2016-05-12 01:16:58 +020057#include <openbsc/common_cs.h>
58
Holger Hans Peter Freytherec37bb22013-02-05 09:39:09 +010059#include <inttypes.h>
60
Harald Weltec08e8be2011-03-04 13:53:51 +010061#include "../../bscconfig.h"
Harald Welte1353f962010-05-16 19:20:24 +020062
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +020063
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +020064#define LCHAN_NR_STR "Logical Channel Number\n"
65
66
Harald Welteea4647d2010-05-12 17:19:53 +000067/* FIXME: this should go to some common file */
68static const struct value_string gprs_ns_timer_strs[] = {
Harald Welte615e9562010-05-11 23:50:21 +020069 { 0, "tns-block" },
70 { 1, "tns-block-retries" },
71 { 2, "tns-reset" },
72 { 3, "tns-reset-retries" },
73 { 4, "tns-test" },
74 { 5, "tns-alive" },
75 { 6, "tns-alive-retries" },
76 { 0, NULL }
77};
78
Harald Welteea4647d2010-05-12 17:19:53 +000079static const struct value_string gprs_bssgp_cfg_strs[] = {
Harald Welte615e9562010-05-11 23:50:21 +020080 { 0, "blocking-timer" },
81 { 1, "blocking-retries" },
82 { 2, "unblocking-retries" },
83 { 3, "reset-timer" },
84 { 4, "reset-retries" },
85 { 5, "suspend-timer" },
86 { 6, "suspend-retries" },
87 { 7, "resume-timer" },
88 { 8, "resume-retries" },
89 { 9, "capability-update-timer" },
90 { 10, "capability-update-retries" },
91 { 0, NULL }
92};
93
Harald Welte64c07d22011-02-15 11:43:27 +010094static const struct value_string bts_neigh_mode_strs[] = {
95 { NL_MODE_AUTOMATIC, "automatic" },
96 { NL_MODE_MANUAL, "manual" },
97 { NL_MODE_MANUAL_SI5SEP, "manual-si5" },
98 { 0, NULL }
99};
100
Daniel Willmann7d109832012-05-14 18:43:23 +0200101const struct value_string bts_loc_fix_names[] = {
102 { BTS_LOC_FIX_INVALID, "invalid" },
103 { BTS_LOC_FIX_2D, "fix2d" },
104 { BTS_LOC_FIX_3D, "fix3d" },
105 { 0, NULL }
106};
107
Harald Welte68628e82009-03-10 12:17:57 +0000108struct cmd_node bts_node = {
109 BTS_NODE,
Harald Welte570ce242012-08-17 13:16:10 +0200110 "%s(config-net-bts)# ",
Harald Welte68628e82009-03-10 12:17:57 +0000111 1,
112};
113
114struct cmd_node trx_node = {
115 TRX_NODE,
Harald Welte570ce242012-08-17 13:16:10 +0200116 "%s(config-net-bts-trx)# ",
Harald Welte68628e82009-03-10 12:17:57 +0000117 1,
118};
119
120struct cmd_node ts_node = {
121 TS_NODE,
Harald Welte570ce242012-08-17 13:16:10 +0200122 "%s(config-net-bts-trx-ts)# ",
Harald Welte68628e82009-03-10 12:17:57 +0000123 1,
124};
125
126static int dummy_config_write(struct vty *v)
127{
128 return CMD_SUCCESS;
129}
130
131static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
132{
Harald Welte1304b352013-03-15 16:57:33 +0100133 vty_out(vty,"Oper '%s', Admin '%s', Avail '%s'%s",
134 abis_nm_opstate_name(nms->operational),
135 get_value_string(abis_nm_adm_state_names, nms->administrative),
Harald Welte867d9f32011-05-23 20:30:39 +0200136 abis_nm_avail_name(nms->availability), VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000137}
138
Harald Welteb908cb72009-12-22 13:09:29 +0100139static void dump_pchan_load_vty(struct vty *vty, char *prefix,
140 const struct pchan_load *pl)
141{
142 int i;
143
144 for (i = 0; i < ARRAY_SIZE(pl->pchan); i++) {
145 const struct load_counter *lc = &pl->pchan[i];
146 unsigned int percent;
147
148 if (lc->total == 0)
149 continue;
150
151 percent = (lc->used * 100) / lc->total;
152
153 vty_out(vty, "%s%20s: %3u%% (%u/%u)%s", prefix,
154 gsm_pchan_name(i), percent, lc->used, lc->total,
155 VTY_NEWLINE);
156 }
157}
158
Harald Welte68628e82009-03-10 12:17:57 +0000159static void net_dump_vty(struct vty *vty, struct gsm_network *net)
160{
Harald Welteb908cb72009-12-22 13:09:29 +0100161 struct pchan_load pl;
162
Harald Welteef235b52009-03-10 12:34:02 +0000163 vty_out(vty, "BSC is on Country Code %u, Network Code %u "
164 "and has %u BTS%s", net->country_code, net->network_code,
165 net->num_bts, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000166 vty_out(vty, " Long network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000167 net->name_long, VTY_NEWLINE);
Harald Welte1bc77352009-03-10 19:47:51 +0000168 vty_out(vty, " Short network name: '%s'%s",
Harald Welte68628e82009-03-10 12:17:57 +0000169 net->name_short, VTY_NEWLINE);
Maxddee01f2016-05-24 14:23:27 +0200170 vty_out(vty, " Authentication policy: %s",
171 gsm_auth_policy_name(net->auth_policy));
172 if (net->authorized_reg_str)
173 vty_out(vty, ", authorized regexp: %s", net->authorized_reg_str);
174 vty_out(vty, "%s", VTY_NEWLINE);
Maxe6052c42016-06-30 10:25:49 +0200175 vty_out(vty, " Auto create subscriber: %s%s",
176 net->auto_create_subscr ? "yes" : "no", VTY_NEWLINE);
177 vty_out(vty, " Auto assign extension: %s%s",
178 net->auto_assign_exten ? "yes" : "no", VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100179 vty_out(vty, " Location updating reject cause: %u%s",
180 net->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900181 vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption,
182 VTY_NEWLINE);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +0100183 vty_out(vty, " NECI (TCH/H): %u%s", net->neci,
184 VTY_NEWLINE);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +0800185 vty_out(vty, " Use TCH for Paging any: %d%s", net->pag_any_tch,
186 VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100187 vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode),
188 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100189 vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off",
190 VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100191 vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off",
192 VTY_NEWLINE);
Harald Welteb908cb72009-12-22 13:09:29 +0100193 network_chan_load(&pl, net);
194 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
195 dump_pchan_load_vty(vty, " ", &pl);
Holger Hans Peter Freyther37ac4202011-02-24 14:19:14 +0100196
197 /* show rf */
Holger Hans Peter Freythera9fae1a2014-02-08 12:12:03 +0100198 if (net->bsc_data)
Holger Hans Peter Freyther37ac4202011-02-24 14:19:14 +0100199 vty_out(vty, " Last RF Command: %s%s",
Holger Hans Peter Freyther8ec49522011-08-15 15:53:00 +0200200 net->bsc_data->rf_ctrl->last_state_command,
Holger Hans Peter Freyther37ac4202011-02-24 14:19:14 +0100201 VTY_NEWLINE);
Holger Hans Peter Freythera9fae1a2014-02-08 12:12:03 +0100202 if (net->bsc_data)
Jacob Erlbeck779a7282013-09-11 10:46:57 +0200203 vty_out(vty, " Last RF Lock Command: %s%s",
204 net->bsc_data->rf_ctrl->last_rf_lock_ctrl_command,
205 VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000206}
207
Neels Hofmeyrea11bf82016-05-12 01:53:23 +0200208DEFUN(bsc_show_net, bsc_show_net_cmd, "show network",
Harald Welte68628e82009-03-10 12:17:57 +0000209 SHOW_STR "Display information about a GSM NETWORK\n")
210{
Harald Weltedcccb182010-05-16 20:52:23 +0200211 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000212 net_dump_vty(vty, net);
213
214 return CMD_SUCCESS;
215}
216
217static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l)
218{
Harald Welteedb37782009-05-01 14:59:07 +0000219 struct e1inp_line *line;
220
221 if (!e1l) {
222 vty_out(vty, " None%s", VTY_NEWLINE);
223 return;
224 }
225
226 line = e1l->ts->line;
227
228 vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s",
229 line->num, line->driver->name, e1l->ts->num,
Harald Welte1bc77352009-03-10 19:47:51 +0000230 e1inp_signtype_name(e1l->type), VTY_NEWLINE);
Harald Welteedb37782009-05-01 14:59:07 +0000231 vty_out(vty, " E1 TEI %u, SAPI %u%s",
Harald Welte68628e82009-03-10 12:17:57 +0000232 e1l->tei, e1l->sapi, VTY_NEWLINE);
233}
234
235static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
236{
Harald Welteb908cb72009-12-22 13:09:29 +0100237 struct pchan_load pl;
238
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200239 vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
Harald Welte557c84e2015-11-20 10:50:24 +0100240 "BSIC %u (NCC=%u, BCC=%u) and %u TRX%s",
Harald Weltefcd24452009-06-20 18:15:19 +0200241 bts->nr, btstype2str(bts->type), gsm_band_name(bts->band),
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200242 bts->cell_identity,
Harald Weltea2bbc5e2015-11-20 10:43:31 +0100243 bts->location_area_code, bts->bsic,
Harald Welte557c84e2015-11-20 10:50:24 +0100244 bts->bsic >> 3, bts->bsic & 7,
Harald Weltefcd24452009-06-20 18:15:19 +0200245 bts->num_trx, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200246 vty_out(vty, "Description: %s%s",
247 bts->description ? bts->description : "(null)", VTY_NEWLINE);
Harald Welte1d8dbc42009-12-12 15:38:16 +0100248 vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100249 vty_out(vty, "Minimum Rx Level for Access: %i dBm%s",
Harald Welte1d8dbc42009-12-12 15:38:16 +0100250 rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min),
251 VTY_NEWLINE);
252 vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s",
Harald Welte73225282009-12-12 18:17:25 +0100253 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100254 vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer,
255 VTY_NEWLINE);
256 vty_out(vty, "RACH Max transmissions: %u%s",
257 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
258 VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100259 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200260 vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE);
Maxc08ee712016-05-11 12:45:13 +0200261 if (bts->dtxu != GSM48_DTX_SHALL_NOT_BE_USED)
262 vty_out(vty, "Uplink DTX: %s%s",
263 (bts->dtxu != GSM48_DTX_SHALL_BE_USED) ?
264 "enabled" : "forced", VTY_NEWLINE);
265 else
266 vty_out(vty, "Uplink DTX: not enabled%s", VTY_NEWLINE);
267 vty_out(vty, "Downlink DTX: %senabled%s", bts->dtxd ? "" : "not ",
268 VTY_NEWLINE);
Andreas Eversberg2ee7ecd2012-10-13 07:27:47 +0200269 vty_out(vty, "Channel Description Attachment: %s%s",
270 (bts->si_common.chan_desc.att) ? "yes" : "no", VTY_NEWLINE);
271 vty_out(vty, "Channel Description BS-PA-MFRMS: %u%s",
272 bts->si_common.chan_desc.bs_pa_mfrms + 2, VTY_NEWLINE);
273 vty_out(vty, "Channel Description BS-AG_BLKS-RES: %u%s",
274 bts->si_common.chan_desc.bs_ag_blks_res, VTY_NEWLINE);
Harald Welte9fbff4a2010-07-30 11:50:09 +0200275 vty_out(vty, "System Information present: 0x%08x, static: 0x%08x%s",
276 bts->si_valid, bts->si_mode_static, VTY_NEWLINE);
Harald Welte42def722017-01-13 00:10:32 +0100277 vty_out(vty, "Early Classmark Sending: %s%s",
278 bts->early_classmark_allowed ? "allowed" : "forbidden",
279 VTY_NEWLINE);
Harald Welte4cc34222009-05-01 15:12:31 +0000280 if (is_ipaccess_bts(bts))
Harald Welte8175e952009-10-20 00:22:00 +0200281 vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
Harald Welte4cc34222009-05-01 15:12:31 +0000282 bts->ip_access.site_id, bts->ip_access.bts_id,
Harald Welte8175e952009-10-20 00:22:00 +0200283 bts->oml_tei, VTY_NEWLINE);
Sylvain Munautc9519462011-10-17 14:04:55 +0200284 else if (bts->type == GSM_BTS_TYPE_NOKIA_SITE)
285 vty_out(vty, " Skip Reset: %d%s",
286 bts->nokia.skip_reset, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000287 vty_out(vty, " NM State: ");
Harald Welted64c0bc2011-05-30 12:07:53 +0200288 net_dump_nmstate(vty, &bts->mo.nm_state);
Harald Welte68628e82009-03-10 12:17:57 +0000289 vty_out(vty, " Site Mgr NM State: ");
Harald Welted64c0bc2011-05-30 12:07:53 +0200290 net_dump_nmstate(vty, &bts->site_mgr.mo.nm_state);
Holger Hans Peter Freyther846d8dc2013-05-29 16:22:09 +0200291 vty_out(vty, " GPRS NSE: ");
292 net_dump_nmstate(vty, &bts->gprs.nse.mo.nm_state);
293 vty_out(vty, " GPRS CELL: ");
294 net_dump_nmstate(vty, &bts->gprs.cell.mo.nm_state);
295 vty_out(vty, " GPRS NSVC0: ");
296 net_dump_nmstate(vty, &bts->gprs.nsvc[0].mo.nm_state);
297 vty_out(vty, " GPRS NSVC1: ");
298 net_dump_nmstate(vty, &bts->gprs.nsvc[1].mo.nm_state);
Holger Hans Peter Freyther66e14cd2011-04-26 15:52:34 +0200299 vty_out(vty, " Paging: %u pending requests, %u free slots%s",
300 paging_pending_requests_nr(bts),
Harald Welte68628e82009-03-10 12:17:57 +0000301 bts->paging.available_slots, VTY_NEWLINE);
Holger Hans Peter Freytherd283db42010-11-25 16:28:45 +0100302 if (is_ipaccess_bts(bts)) {
303 vty_out(vty, " OML Link state: %s.%s",
304 bts->oml_link ? "connected" : "disconnected", VTY_NEWLINE);
305 } else {
Harald Welte8175e952009-10-20 00:22:00 +0200306 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
307 e1isl_dump_vty(vty, bts->oml_link);
308 }
Holger Hans Peter Freytherd283db42010-11-25 16:28:45 +0100309
310 /* FIXME: chan_desc */
Harald Welteb908cb72009-12-22 13:09:29 +0100311 memset(&pl, 0, sizeof(pl));
Neels Hofmeyr2afffd52016-09-25 17:01:20 +0200312 bts_chan_load(&pl, bts);
Harald Welteb908cb72009-12-22 13:09:29 +0100313 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
314 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000315}
316
Sylvain Munaut39c31de2012-12-28 12:15:11 +0100317DEFUN(show_bts, show_bts_cmd, "show bts [<0-255>]",
Harald Welte68628e82009-03-10 12:17:57 +0000318 SHOW_STR "Display information about a BTS\n"
319 "BTS number")
320{
Harald Weltedcccb182010-05-16 20:52:23 +0200321 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000322 int bts_nr;
323
324 if (argc != 0) {
325 /* use the BTS number that the user has specified */
326 bts_nr = atoi(argv[0]);
Harald Welte712ddbc2010-12-24 12:24:03 +0100327 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000328 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000329 VTY_NEWLINE);
330 return CMD_WARNING;
331 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200332 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000333 return CMD_SUCCESS;
334 }
335 /* print all BTS's */
336 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee441d9c2009-06-21 16:17:15 +0200337 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000338
339 return CMD_SUCCESS;
340}
341
Harald Welte42581822009-08-08 16:12:58 +0200342/* utility functions */
343static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
344 const char *ts, const char *ss)
345{
346 e1_link->e1_nr = atoi(line);
347 e1_link->e1_ts = atoi(ts);
348 if (!strcmp(ss, "full"))
349 e1_link->e1_ts_ss = 255;
350 else
351 e1_link->e1_ts_ss = atoi(ss);
352}
353
354static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,
355 const char *prefix)
356{
357 if (!e1_link->e1_ts)
358 return;
359
360 if (e1_link->e1_ts_ss == 255)
361 vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s",
362 prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE);
363 else
364 vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s",
365 prefix, e1_link->e1_nr, e1_link->e1_ts,
366 e1_link->e1_ts_ss, VTY_NEWLINE);
367}
368
369
Harald Welte67ce0732009-08-06 19:06:46 +0200370static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
371{
Neels Hofmeyr9c4f1d62016-01-27 14:20:29 +0100372 vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
Harald Weltea2bbc5e2015-11-20 10:43:31 +0100373 if (ts->tsc != -1)
Neels Hofmeyr9c4f1d62016-01-27 14:20:29 +0100374 vty_out(vty, " training_sequence_code %u%s", ts->tsc, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200375 if (ts->pchan != GSM_PCHAN_NONE)
Neels Hofmeyr9c4f1d62016-01-27 14:20:29 +0100376 vty_out(vty, " phys_chan_config %s%s",
Harald Welte42581822009-08-08 16:12:58 +0200377 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
Neels Hofmeyr9c4f1d62016-01-27 14:20:29 +0100378 vty_out(vty, " hopping enabled %u%s",
Harald Weltea39b0f22010-06-14 22:26:10 +0200379 ts->hopping.enabled, VTY_NEWLINE);
380 if (ts->hopping.enabled) {
381 unsigned int i;
Neels Hofmeyr9c4f1d62016-01-27 14:20:29 +0100382 vty_out(vty, " hopping sequence-number %u%s",
Harald Welte6e0cd042009-09-12 13:05:33 +0200383 ts->hopping.hsn, VTY_NEWLINE);
Neels Hofmeyr9c4f1d62016-01-27 14:20:29 +0100384 vty_out(vty, " hopping maio %u%s",
Harald Welte6e0cd042009-09-12 13:05:33 +0200385 ts->hopping.maio, VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200386 for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) {
387 if (!bitvec_get_bit_pos(&ts->hopping.arfcns, i))
388 continue;
Neels Hofmeyr9c4f1d62016-01-27 14:20:29 +0100389 vty_out(vty, " hopping arfcn add %u%s",
Harald Weltea39b0f22010-06-14 22:26:10 +0200390 i, VTY_NEWLINE);
391 }
Harald Welte127af342010-12-24 12:07:07 +0100392 }
Neels Hofmeyr9c4f1d62016-01-27 14:20:29 +0100393 config_write_e1_link(vty, &ts->e1_link, " ");
Harald Welteface7ed2011-02-14 16:15:21 +0100394
395 if (ts->trx->bts->model->config_write_ts)
396 ts->trx->bts->model->config_write_ts(vty, ts);
Harald Welte67ce0732009-08-06 19:06:46 +0200397}
398
399static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
400{
401 int i;
402
Harald Welte5013b2a2009-08-07 13:29:14 +0200403 vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200404 if (trx->description)
405 vty_out(vty, " description %s%s", trx->description,
406 VTY_NEWLINE);
Holger Hans Peter Freyther2ba40af2010-04-17 06:42:07 +0200407 vty_out(vty, " rf_locked %u%s",
Harald Welted64c0bc2011-05-30 12:07:53 +0200408 trx->mo.nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
Holger Hans Peter Freyther2ba40af2010-04-17 06:42:07 +0200409 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200410 vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
Harald Welte (local)7b37d972009-12-27 20:56:38 +0100411 vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200412 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200413 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
414 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte67ce0732009-08-06 19:06:46 +0200415
Harald Welteface7ed2011-02-14 16:15:21 +0100416 if (trx->bts->model->config_write_trx)
417 trx->bts->model->config_write_trx(vty, trx);
418
Harald Welte67ce0732009-08-06 19:06:46 +0200419 for (i = 0; i < TRX_NR_TS; i++)
420 config_write_ts_single(vty, &trx->ts[i]);
421}
422
Harald Welte615e9562010-05-11 23:50:21 +0200423static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
424{
425 unsigned int i;
426 vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode),
427 VTY_NEWLINE);
428 if (bts->gprs.mode == BTS_GPRS_NONE)
429 return;
430
bhargava350533c2016-07-21 11:14:34 +0530431 vty_out(vty, " gprs 11bit_rach_support_for_egprs %u%s",
432 bts->gprs.supports_egprs_11bit_rach, VTY_NEWLINE);
433
Harald Welte615e9562010-05-11 23:50:21 +0200434 vty_out(vty, " gprs routing area %u%s", bts->gprs.rac,
435 VTY_NEWLINE);
Andreas Eversberg0c8f9ca2013-03-16 16:31:26 +0100436 vty_out(vty, " gprs network-control-order nc%u%s",
437 bts->gprs.net_ctrl_ord, VTY_NEWLINE);
Max292ec582016-07-28 11:55:37 +0200438 if (!bts->gprs.ctrl_ack_type_use_block)
439 vty_out(vty, " gprs control-ack-type-rach%s", VTY_NEWLINE);
Harald Welte615e9562010-05-11 23:50:21 +0200440 vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
441 VTY_NEWLINE);
442 for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++)
443 vty_out(vty, " gprs cell timer %s %u%s",
444 get_value_string(gprs_bssgp_cfg_strs, i),
445 bts->gprs.cell.timer[i], VTY_NEWLINE);
446 vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei,
447 VTY_NEWLINE);
448 for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++)
449 vty_out(vty, " gprs ns timer %s %u%s",
450 get_value_string(gprs_ns_timer_strs, i),
451 bts->gprs.nse.timer[i], VTY_NEWLINE);
452 for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
453 struct gsm_bts_gprs_nsvc *nsvc =
454 &bts->gprs.nsvc[i];
455 struct in_addr ia;
456
457 ia.s_addr = htonl(nsvc->remote_ip);
458 vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
459 nsvc->nsvci, VTY_NEWLINE);
460 vty_out(vty, " gprs nsvc %u local udp port %u%s", i,
461 nsvc->local_port, VTY_NEWLINE);
462 vty_out(vty, " gprs nsvc %u remote udp port %u%s", i,
463 nsvc->remote_port, VTY_NEWLINE);
464 vty_out(vty, " gprs nsvc %u remote ip %s%s", i,
465 inet_ntoa(ia), VTY_NEWLINE);
466 }
467}
468
Holger Hans Peter Freythercd40fb42013-09-15 17:23:34 +0200469/* Write the model data if there is one */
470static void config_write_bts_model(struct vty *vty, struct gsm_bts *bts)
Harald Welte67ce0732009-08-06 19:06:46 +0200471{
472 struct gsm_bts_trx *trx;
Holger Hans Peter Freythercd40fb42013-09-15 17:23:34 +0200473
474 if (!bts->model)
475 return;
476
477 if (bts->model->config_write_bts)
478 bts->model->config_write_bts(vty, bts);
479
480 llist_for_each_entry(trx, &bts->trx_list, list)
481 config_write_trx_single(vty, trx);
482}
483
Holger Hans Peter Freythera174a472015-09-24 11:39:38 +0200484static void write_amr_modes(struct vty *vty, const char *prefix,
485 const char *name, struct amr_mode *modes, int num)
486{
487 int i;
488
489 vty_out(vty, " %s threshold %s", prefix, name);
490 for (i = 0; i < num - 1; i++)
491 vty_out(vty, " %d", modes[i].threshold);
492 vty_out(vty, "%s", VTY_NEWLINE);
493 vty_out(vty, " %s hysteresis %s", prefix, name);
494 for (i = 0; i < num - 1; i++)
495 vty_out(vty, " %d", modes[i].hysteresis);
496 vty_out(vty, "%s", VTY_NEWLINE);
497}
498
Andreas Eversberg73266522014-01-19 11:47:44 +0100499static void config_write_bts_amr(struct vty *vty, struct gsm_bts *bts,
500 struct amr_multirate_conf *mr, int full)
501{
502 struct gsm48_multi_rate_conf *mr_conf;
503 const char *prefix = (full) ? "amr tch-f" : "amr tch-h";
504 int i, num;
505
506 if (!(mr->gsm48_ie[1]))
507 return;
508
509 mr_conf = (struct gsm48_multi_rate_conf *) mr->gsm48_ie;
510
511 num = 0;
512 vty_out(vty, " %s modes", prefix);
513 for (i = 0; i < ((full) ? 8 : 6); i++) {
514 if ((mr->gsm48_ie[1] & (1 << i))) {
515 vty_out(vty, " %d", i);
516 num++;
517 }
518 }
519 vty_out(vty, "%s", VTY_NEWLINE);
520 if (num > 4)
521 num = 4;
522 if (num > 1) {
Holger Hans Peter Freythera174a472015-09-24 11:39:38 +0200523 write_amr_modes(vty, prefix, "ms", mr->ms_mode, num);
524 write_amr_modes(vty, prefix, "bts", mr->bts_mode, num);
Andreas Eversberg73266522014-01-19 11:47:44 +0100525 }
526 vty_out(vty, " %s start-mode ", prefix);
527 if (mr_conf->icmi) {
528 num = 0;
529 for (i = 0; i < ((full) ? 8 : 6) && num < 4; i++) {
530 if ((mr->gsm48_ie[1] & (1 << i)))
531 num++;
532 if (mr_conf->smod == num - 1) {
533 vty_out(vty, "%d%s", num, VTY_NEWLINE);
534 break;
535 }
536 }
537 } else
538 vty_out(vty, "auto%s", VTY_NEWLINE);
539}
540
Holger Hans Peter Freythercd40fb42013-09-15 17:23:34 +0200541static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
542{
Harald Welte9fbff4a2010-07-30 11:50:09 +0200543 int i;
Max2c16bee2017-02-15 13:51:37 +0100544 uint8_t tmp;
Harald Welte67ce0732009-08-06 19:06:46 +0200545
Harald Welte5013b2a2009-08-07 13:29:14 +0200546 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
547 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200548 if (bts->description)
549 vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200550 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freytherf926ed62009-11-19 16:38:49 +0100551 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200552 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte67ce0732009-08-06 19:06:46 +0200553 VTY_NEWLINE);
Maxc08ee712016-05-11 12:45:13 +0200554 if (bts->dtxu != GSM48_DTX_SHALL_NOT_BE_USED)
555 vty_out(vty, " dtx uplink%s%s",
556 (bts->dtxu != GSM48_DTX_SHALL_BE_USED) ? "" : " force",
557 VTY_NEWLINE);
558 if (bts->dtxd)
559 vty_out(vty, " dtx downlink%s", VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200560 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)0e451d02009-08-13 10:14:26 +0200561 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100562 vty_out(vty, " cell reselection hysteresis %u%s",
563 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
564 vty_out(vty, " rxlev access min %u%s",
565 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Sylvain Munaute0b06b02010-11-28 18:17:28 +0100566
567 if (bts->si_common.cell_ro_sel_par.present) {
568 struct gsm48_si_selection_params *sp;
569 sp = &bts->si_common.cell_ro_sel_par;
570
571 if (sp->cbq)
572 vty_out(vty, " cell bar qualify %u%s",
573 sp->cbq, VTY_NEWLINE);
574
575 if (sp->cell_resel_off)
576 vty_out(vty, " cell reselection offset %u%s",
577 sp->cell_resel_off*2, VTY_NEWLINE);
578
579 if (sp->temp_offs == 7)
580 vty_out(vty, " temporary offset infinite%s",
581 VTY_NEWLINE);
582 else if (sp->temp_offs)
583 vty_out(vty, " temporary offset %u%s",
584 sp->temp_offs*10, VTY_NEWLINE);
585
586 if (sp->penalty_time == 31)
587 vty_out(vty, " penalty time reserved%s",
588 VTY_NEWLINE);
589 else if (sp->penalty_time)
590 vty_out(vty, " penalty time %u%s",
591 (sp->penalty_time*20)+20, VTY_NEWLINE);
592 }
593
Holger Hans Peter Freytherc63f6f12013-07-27 21:07:57 +0200594 /* Is periodic LU enabled or disabled? */
595 if (bts->si_common.chan_desc.t3212 == 0)
596 vty_out(vty, " no periodic location update%s", VTY_NEWLINE);
597 else
598 vty_out(vty, " periodic location update %u%s",
599 bts->si_common.chan_desc.t3212 * 6, VTY_NEWLINE);
600
Andreas Eversberg4d4944a2013-03-10 11:49:35 +0100601 vty_out(vty, " radio-link-timeout %d%s",
602 get_radio_link_timeout(&bts->si_common.cell_options),
603 VTY_NEWLINE);
Harald Welte7a8fa412009-08-10 13:48:16 +0200604 vty_out(vty, " channel allocator %s%s",
605 bts->chan_alloc_reverse ? "descending" : "ascending",
606 VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100607 vty_out(vty, " rach tx integer %u%s",
608 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
609 vty_out(vty, " rach max transmission %u%s",
610 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
611 VTY_NEWLINE);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +0800612
Andreas Eversberg2ee7ecd2012-10-13 07:27:47 +0200613 vty_out(vty, " channel-descrption attach %u%s",
614 bts->si_common.chan_desc.att, VTY_NEWLINE);
615 vty_out(vty, " channel-descrption bs-pa-mfrms %u%s",
616 bts->si_common.chan_desc.bs_pa_mfrms + 2, VTY_NEWLINE);
617 vty_out(vty, " channel-descrption bs-ag-blks-res %u%s",
618 bts->si_common.chan_desc.bs_ag_blks_res, VTY_NEWLINE);
619
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +0800620 if (bts->rach_b_thresh != -1)
621 vty_out(vty, " rach nm busy threshold %u%s",
622 bts->rach_b_thresh, VTY_NEWLINE);
623 if (bts->rach_ldavg_slots != -1)
624 vty_out(vty, " rach nm load average %u%s",
625 bts->rach_ldavg_slots, VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100626 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200627 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +0800628 if ((bts->si_common.rach_control.t2 & 0x4) == 0)
629 vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE);
Ivan Kluchnikov67920592013-09-16 13:13:04 +0400630 if ((bts->si_common.rach_control.t3) != 0)
631 for (i = 0; i < 8; i++)
632 if (bts->si_common.rach_control.t3 & (0x1 << i))
633 vty_out(vty, " rach access-control-class %d barred%s", i, VTY_NEWLINE);
634 if ((bts->si_common.rach_control.t2 & 0xfb) != 0)
635 for (i = 0; i < 8; i++)
636 if ((i != 2) && (bts->si_common.rach_control.t2 & (0x1 << i)))
637 vty_out(vty, " rach access-control-class %d barred%s", i+8, VTY_NEWLINE);
Harald Welte9fbff4a2010-07-30 11:50:09 +0200638 for (i = SYSINFO_TYPE_1; i < _MAX_SYSINFO_TYPE; i++) {
639 if (bts->si_mode_static & (1 << i)) {
640 vty_out(vty, " system-information %s mode static%s",
641 get_value_string(osmo_sitype_strs, i), VTY_NEWLINE);
642 vty_out(vty, " system-information %s static %s%s",
643 get_value_string(osmo_sitype_strs, i),
Sylvain Munaut63ef2152011-11-13 23:05:23 +0100644 osmo_hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])),
Harald Welte9fbff4a2010-07-30 11:50:09 +0200645 VTY_NEWLINE);
646 }
647 }
Harald Welte42def722017-01-13 00:10:32 +0100648 vty_out(vty, " early-classmark-sending %s%s",
649 bts->early_classmark_allowed ? "allowed" : "forbidden", VTY_NEWLINE);
Harald Weltefd355a32011-03-04 13:41:31 +0100650 switch (bts->type) {
651 case GSM_BTS_TYPE_NANOBTS:
Harald Weltef383aa12012-07-02 19:51:55 +0200652 case GSM_BTS_TYPE_OSMO_SYSMO:
Harald Welte5013b2a2009-08-07 13:29:14 +0200653 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Weltea6fd58e2009-08-07 00:25:23 +0200654 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte8b291802013-03-12 13:57:05 +0100655 if (bts->ip_access.rsl_ip) {
656 struct in_addr ia;
657 ia.s_addr = htonl(bts->ip_access.rsl_ip);
658 vty_out(vty, " ip.access rsl-ip %s%s", inet_ntoa(ia),
659 VTY_NEWLINE);
660 }
Pablo Neira Ayusoed5cacb2011-08-17 22:44:07 +0200661 vty_out(vty, " oml ip.access stream_id %u line %u%s",
662 bts->oml_tei, bts->oml_e1_link.e1_nr, VTY_NEWLINE);
Harald Weltefd355a32011-03-04 13:41:31 +0100663 break;
Sylvain Munautc9519462011-10-17 14:04:55 +0200664 case GSM_BTS_TYPE_NOKIA_SITE:
665 vty_out(vty, " nokia_site skip-reset %d%s", bts->nokia.skip_reset, VTY_NEWLINE);
Andreas Eversberg7d8fa342013-12-05 13:25:06 +0100666 vty_out(vty, " nokia_site no-local-rel-conf %d%s",
667 bts->nokia.no_loc_rel_cnf, VTY_NEWLINE);
Sipos Csaba56e17662015-02-07 13:27:36 +0100668 vty_out(vty, " nokia_site bts-reset-timer %d%s", bts->nokia.bts_reset_timer_cnf, VTY_NEWLINE);
Andreas Eversbergb6f95162013-12-05 16:02:37 +0100669 /* fall through: Nokia requires "oml e1" parameters also */
Harald Weltefd355a32011-03-04 13:41:31 +0100670 default:
Harald Welte42581822009-08-08 16:12:58 +0200671 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
672 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
Harald Weltefd355a32011-03-04 13:41:31 +0100673 break;
Harald Welte42581822009-08-08 16:12:58 +0200674 }
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +0800675
676 /* if we have a limit, write it */
677 if (bts->paging.free_chans_need >= 0)
678 vty_out(vty, " paging free %d%s", bts->paging.free_chans_need, VTY_NEWLINE);
679
Harald Welte32c09622011-01-11 23:44:56 +0100680 vty_out(vty, " neighbor-list mode %s%s",
Harald Welte64c07d22011-02-15 11:43:27 +0100681 get_value_string(bts_neigh_mode_strs, bts->neigh_list_manual_mode), VTY_NEWLINE);
682 if (bts->neigh_list_manual_mode != NL_MODE_AUTOMATIC) {
Harald Welte32c09622011-01-11 23:44:56 +0100683 for (i = 0; i < 1024; i++) {
684 if (bitvec_get_bit_pos(&bts->si_common.neigh_list, i))
685 vty_out(vty, " neighbor-list add arfcn %u%s",
686 i, VTY_NEWLINE);
687 }
688 }
Harald Welte64c07d22011-02-15 11:43:27 +0100689 if (bts->neigh_list_manual_mode == NL_MODE_MANUAL_SI5SEP) {
690 for (i = 0; i < 1024; i++) {
691 if (bitvec_get_bit_pos(&bts->si_common.si5_neigh_list, i))
692 vty_out(vty, " si5 neighbor-list add arfcn %u%s",
693 i, VTY_NEWLINE);
694 }
695 }
Harald Welte32c09622011-01-11 23:44:56 +0100696
Max59a1bf32016-04-15 16:04:46 +0200697 for (i = 0; i < MAX_EARFCN_LIST; i++) {
Max2c16bee2017-02-15 13:51:37 +0100698 struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list;
699 if (e->arfcn[i] != OSMO_EARFCN_INVALID) {
700 vty_out(vty, " si2quater neighbor-list add earfcn %u "
701 "thresh-hi %u", e->arfcn[i], e->thresh_hi);
702
703 vty_out(vty, " thresh-lo %u",
704 e->thresh_lo_valid ? e->thresh_lo : 32);
705
706 vty_out(vty, " prio %u",
707 e->prio_valid ? e->prio : 8);
708
709 vty_out(vty, " qrxlv %u",
710 e->qrxlm_valid ? e->qrxlm : 32);
711
712 tmp = e->meas_bw[i];
713 vty_out(vty, " meas %u",
714 (tmp != OSMO_EARFCN_MEAS_INVALID) ? tmp : 8);
Max59a1bf32016-04-15 16:04:46 +0200715
716 vty_out(vty, "%s", VTY_NEWLINE);
717 }
718 }
719
Max26679e02016-04-20 15:57:13 +0200720 for (i = 0; i < bts->si_common.uarfcn_length; i++) {
721 vty_out(vty, " si2quater neighbor-list add uarfcn %u %u %u%s",
722 bts->si_common.data.uarfcn_list[i],
723 bts->si_common.data.scramble_list[i] & ~(1 << 9),
724 (bts->si_common.data.scramble_list[i] >> 9) & 1,
725 VTY_NEWLINE);
726 }
727
Andreas Eversberga83d5112013-12-07 18:32:28 +0100728 vty_out(vty, " codec-support fr");
729 if (bts->codec.hr)
730 vty_out(vty, " hr");
731 if (bts->codec.efr)
732 vty_out(vty, " efr");
733 if (bts->codec.amr)
734 vty_out(vty, " amr");
735 vty_out(vty, "%s", VTY_NEWLINE);
736
Andreas Eversberg73266522014-01-19 11:47:44 +0100737 config_write_bts_amr(vty, bts, &bts->mr_full, 1);
738 config_write_bts_amr(vty, bts, &bts->mr_half, 0);
739
Harald Welte615e9562010-05-11 23:50:21 +0200740 config_write_bts_gprs(vty, bts);
Harald Welte67ce0732009-08-06 19:06:46 +0200741
Holger Hans Peter Freythere30d40d2012-07-20 10:27:31 +0200742 if (bts->excl_from_rf_lock)
743 vty_out(vty, " rf-lock-exclude%s", VTY_NEWLINE);
744
Jacob Erlbeck65d114f2014-01-16 11:02:14 +0100745 vty_out(vty, " %sforce-combined-si%s",
746 bts->force_combined_si ? "" : "no ", VTY_NEWLINE);
747
Holger Hans Peter Freytherc22930e2014-12-17 14:46:17 +0100748 for (i = 0; i < ARRAY_SIZE(bts->depends_on); ++i) {
749 int j;
750
751 if (bts->depends_on[i] == 0)
752 continue;
753
754 for (j = 0; j < sizeof(bts->depends_on[i]) * 8; ++j) {
755 int bts_nr;
756
757 if ((bts->depends_on[i] & (1<<j)) == 0)
758 continue;
759
760 bts_nr = (i * sizeof(bts->depends_on[i]) * 8) + j;
761 vty_out(vty, " depends-on-bts %d%s", bts_nr, VTY_NEWLINE);
762 }
763 }
764
Holger Hans Peter Freythercd40fb42013-09-15 17:23:34 +0200765 config_write_bts_model(vty, bts);
Harald Welte67ce0732009-08-06 19:06:46 +0200766}
767
768static int config_write_bts(struct vty *v)
769{
Harald Weltedcccb182010-05-16 20:52:23 +0200770 struct gsm_network *gsmnet = gsmnet_from_vty(v);
Harald Welte67ce0732009-08-06 19:06:46 +0200771 struct gsm_bts *bts;
772
773 llist_for_each_entry(bts, &gsmnet->bts_list, list)
774 config_write_bts_single(v, bts);
775
776 return CMD_SUCCESS;
777}
778
Harald Welte5013b2a2009-08-07 13:29:14 +0200779static int config_write_net(struct vty *vty)
780{
Harald Weltedcccb182010-05-16 20:52:23 +0200781 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
782
Harald Welte5013b2a2009-08-07 13:29:14 +0200783 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200784 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200785 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200786 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
787 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200788 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Maxddee01f2016-05-24 14:23:27 +0200789 if (gsmnet->authorized_reg_str)
790 vty_out(vty, " authorized-regexp %s%s", gsmnet->authorized_reg_str, VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100791 vty_out(vty, " location updating reject cause %u%s",
792 gsmnet->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900793 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freytherd54c3372009-11-19 16:37:48 +0100794 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +0800795 vty_out(vty, " paging any use tch %d%s", gsmnet->pag_any_tch, VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100796 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
797 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100798 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100799 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Welteb720bd32009-12-21 16:51:50 +0100800 vty_out(vty, " handover window rxlev averaging %u%s",
801 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
802 vty_out(vty, " handover window rxqual averaging %u%s",
803 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
804 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
805 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
806 vty_out(vty, " handover power budget interval %u%s",
807 gsmnet->handover.pwr_interval, VTY_NEWLINE);
808 vty_out(vty, " handover power budget hysteresis %u%s",
809 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
810 vty_out(vty, " handover maximum distance %u%s",
811 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +0100812 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100813 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
814 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
815 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
816 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
817 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
818 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
819 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
820 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
821 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
Harald Welte2862dca2010-12-23 14:39:29 +0100822 vty_out(vty, " timer t3122 %u%s", gsmnet->T3122, VTY_NEWLINE);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100823 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Vadim Yanitskiy7f3724e2017-03-31 23:27:44 +0700824 vty_out(vty, " dyn_ts_allow_tch_f %d%s",
825 gsmnet->dyn_ts_allow_tch_f ? 1 : 0, VTY_NEWLINE);
Holger Hans Peter Freytherae9006a2010-12-22 16:26:04 +0100826 vty_out(vty, " subscriber-keep-in-ram %d%s",
Jacob Erlbeck1e30a282014-12-03 09:28:24 +0100827 gsmnet->subscr_group->keep_subscr, VTY_NEWLINE);
Neels Hofmeyr73983952016-05-10 13:29:33 +0200828 if (gsmnet->tz.override != 0) {
829 if (gsmnet->tz.dst)
830 vty_out(vty, " timezone %d %d %d%s",
831 gsmnet->tz.hr, gsmnet->tz.mn, gsmnet->tz.dst,
832 VTY_NEWLINE);
833 else
834 vty_out(vty, " timezone %d %d%s",
835 gsmnet->tz.hr, gsmnet->tz.mn, VTY_NEWLINE);
836 }
Harald Welte5013b2a2009-08-07 13:29:14 +0200837
838 return CMD_SUCCESS;
839}
Harald Welte67ce0732009-08-06 19:06:46 +0200840
Harald Welte68628e82009-03-10 12:17:57 +0000841static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
842{
843 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
844 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200845 vty_out(vty, "Description: %s%s",
846 trx->description ? trx->description : "(null)", VTY_NEWLINE);
Harald Weltefcd24452009-06-20 18:15:19 +0200847 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte42581822009-08-08 16:12:58 +0200848 "resulting BS power: %d dBm%s",
Harald Weltefcd24452009-06-20 18:15:19 +0200849 trx->nominal_power, trx->max_power_red,
Harald Welte42581822009-08-08 16:12:58 +0200850 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000851 vty_out(vty, " NM State: ");
Harald Welted64c0bc2011-05-30 12:07:53 +0200852 net_dump_nmstate(vty, &trx->mo.nm_state);
Harald Welte68628e82009-03-10 12:17:57 +0000853 vty_out(vty, " Baseband Transceiver NM State: ");
Harald Welted64c0bc2011-05-30 12:07:53 +0200854 net_dump_nmstate(vty, &trx->bb_transc.mo.nm_state);
Harald Welte8175e952009-10-20 00:22:00 +0200855 if (is_ipaccess_bts(trx->bts)) {
856 vty_out(vty, " ip.access stream ID: 0x%02x%s",
857 trx->rsl_tei, VTY_NEWLINE);
858 } else {
859 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
860 e1isl_dump_vty(vty, trx->rsl_link);
861 }
Harald Welte68628e82009-03-10 12:17:57 +0000862}
863
864DEFUN(show_trx,
865 show_trx_cmd,
Sylvain Munaut39c31de2012-12-28 12:15:11 +0100866 "show trx [<0-255>] [<0-255>]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200867 SHOW_STR "Display information about a TRX\n"
868 "BTS Number\n"
869 "TRX Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000870{
Harald Weltedcccb182010-05-16 20:52:23 +0200871 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000872 struct gsm_bts *bts = NULL;
873 struct gsm_bts_trx *trx;
874 int bts_nr, trx_nr;
875
876 if (argc >= 1) {
877 /* use the BTS number that the user has specified */
878 bts_nr = atoi(argv[0]);
879 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000880 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000881 VTY_NEWLINE);
882 return CMD_WARNING;
883 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200884 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000885 }
886 if (argc >= 2) {
887 trx_nr = atoi(argv[1]);
888 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000889 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000890 VTY_NEWLINE);
891 return CMD_WARNING;
892 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200893 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000894 trx_dump_vty(vty, trx);
895 return CMD_SUCCESS;
896 }
897 if (bts) {
898 /* print all TRX in this BTS */
899 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200900 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000901 trx_dump_vty(vty, trx);
902 }
903 return CMD_SUCCESS;
904 }
905
906 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200907 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000908 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200909 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000910 trx_dump_vty(vty, trx);
911 }
912 }
913
914 return CMD_SUCCESS;
915}
916
Harald Welte67ce0732009-08-06 19:06:46 +0200917
Harald Welte68628e82009-03-10 12:17:57 +0000918static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
919{
Harald Welte135a6482011-05-30 12:09:13 +0200920 vty_out(vty, "BTS %u, TRX %u, Timeslot %u, phys cfg %s, TSC %u",
Harald Welte026b4ca2010-12-24 12:12:10 +0100921 ts->trx->bts->nr, ts->trx->nr, ts->nr,
Harald Welte1fe24122014-01-19 17:18:21 +0100922 gsm_pchan_name(ts->pchan), gsm_ts_tsc(ts));
Harald Weltecd103a92010-12-24 12:14:52 +0100923 if (ts->pchan == GSM_PCHAN_TCH_F_PDCH)
Harald Welteb29cea12010-12-24 12:26:13 +0100924 vty_out(vty, " (%s mode)",
Neels Hofmeyr2ebacce2016-06-14 14:08:35 +0200925 ts->flags & TS_F_PDCH_ACTIVE ? "PDCH" : "TCH/F");
Harald Weltecd103a92010-12-24 12:14:52 +0100926 vty_out(vty, "%s", VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000927 vty_out(vty, " NM State: ");
Harald Welted64c0bc2011-05-30 12:07:53 +0200928 net_dump_nmstate(vty, &ts->mo.nm_state);
Harald Welte2c828992009-12-02 01:56:49 +0530929 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welteef235b52009-03-10 12:34:02 +0000930 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
931 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
932 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000933}
934
935DEFUN(show_ts,
936 show_ts_cmd,
Sylvain Munaut39c31de2012-12-28 12:15:11 +0100937 "show timeslot [<0-255>] [<0-255>] [<0-7>]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200938 SHOW_STR "Display information about a TS\n"
939 "BTS Number\n" "TRX Number\n" "Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000940{
Harald Weltedcccb182010-05-16 20:52:23 +0200941 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte274d0152010-12-24 12:05:03 +0100942 struct gsm_bts *bts = NULL;
943 struct gsm_bts_trx *trx = NULL;
944 struct gsm_bts_trx_ts *ts = NULL;
Harald Welte68628e82009-03-10 12:17:57 +0000945 int bts_nr, trx_nr, ts_nr;
946
947 if (argc >= 1) {
948 /* use the BTS number that the user has specified */
949 bts_nr = atoi(argv[0]);
950 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000951 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000952 VTY_NEWLINE);
953 return CMD_WARNING;
954 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200955 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000956 }
957 if (argc >= 2) {
958 trx_nr = atoi(argv[1]);
959 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000960 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000961 VTY_NEWLINE);
962 return CMD_WARNING;
963 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200964 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000965 }
966 if (argc >= 3) {
967 ts_nr = atoi(argv[2]);
968 if (ts_nr >= TRX_NR_TS) {
Harald Welte1bc77352009-03-10 19:47:51 +0000969 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
Harald Welte68628e82009-03-10 12:17:57 +0000970 VTY_NEWLINE);
971 return CMD_WARNING;
972 }
Harald Welte274d0152010-12-24 12:05:03 +0100973 /* Fully Specified: print and exit */
Harald Welte68628e82009-03-10 12:17:57 +0000974 ts = &trx->ts[ts_nr];
975 ts_dump_vty(vty, ts);
976 return CMD_SUCCESS;
977 }
Harald Welte274d0152010-12-24 12:05:03 +0100978
979 if (bts && trx) {
980 /* Iterate over all TS in this TRX */
981 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
982 ts = &trx->ts[ts_nr];
983 ts_dump_vty(vty, ts);
984 }
985 } else if (bts) {
986 /* Iterate over all TRX in this BTS, TS in each TRX */
Harald Welte68628e82009-03-10 12:17:57 +0000987 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200988 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000989 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
990 ts = &trx->ts[ts_nr];
991 ts_dump_vty(vty, ts);
992 }
993 }
Harald Welte274d0152010-12-24 12:05:03 +0100994 } else {
995 /* Iterate over all BTS, TRX in each BTS, TS in each TRX */
996 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
997 bts = gsm_bts_num(net, bts_nr);
998 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
999 trx = gsm_bts_trx_num(bts, trx_nr);
1000 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
1001 ts = &trx->ts[ts_nr];
1002 ts_dump_vty(vty, ts);
1003 }
1004 }
1005 }
Harald Welte68628e82009-03-10 12:17:57 +00001006 }
1007
1008 return CMD_SUCCESS;
1009}
1010
Holger Hans Peter Freyther424c4f02010-01-06 06:00:40 +01001011static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte68628e82009-03-10 12:17:57 +00001012{
Harald Weltefcd24452009-06-20 18:15:19 +02001013 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte40f82892009-05-23 17:31:39 +00001014 subscr->authorized, VTY_NEWLINE);
Holger Hans Peter Freyther7f180e82013-12-12 15:45:41 +01001015 if (strlen(subscr->name))
Harald Welte1bc77352009-03-10 19:47:51 +00001016 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
Holger Hans Peter Freytherbd30cd32014-04-04 11:53:18 +02001017 if (strlen(subscr->extension))
Harald Welte68628e82009-03-10 12:17:57 +00001018 vty_out(vty, " Extension: %s%s", subscr->extension,
1019 VTY_NEWLINE);
Holger Hans Peter Freyther5ccd0152013-07-14 08:38:24 +02001020 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freyther22230252009-08-19 12:53:57 +02001021 if (subscr->tmsi != GSM_RESERVED_TMSI)
1022 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte731fd912009-08-15 03:24:51 +02001023 VTY_NEWLINE);
Sylvain Munautaf292642009-12-27 19:29:28 +01001024
Harald Welte (local)15920de2009-08-14 20:27:16 +02001025 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +00001026}
1027
Neels Hofmeyr6d804b12017-02-18 22:20:46 +01001028static void bsc_subscr_dump_vty(struct vty *vty, struct bsc_subscr *bsub)
1029{
1030 if (strlen(bsub->imsi))
1031 vty_out(vty, " IMSI: %s%s", bsub->imsi, VTY_NEWLINE);
1032 if (bsub->tmsi != GSM_RESERVED_TMSI)
1033 vty_out(vty, " TMSI: 0x%08x%s", bsub->tmsi,
1034 VTY_NEWLINE);
1035 vty_out(vty, " Use count: %d%s", bsub->use_count, VTY_NEWLINE);
1036}
1037
Harald Welte8387a492009-12-22 21:43:14 +01001038static void meas_rep_dump_uni_vty(struct vty *vty,
1039 struct gsm_meas_rep_unidir *mru,
1040 const char *prefix,
1041 const char *dir)
1042{
1043 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
1044 prefix, dir, rxlev2dbm(mru->full.rx_lev),
1045 dir, rxlev2dbm(mru->sub.rx_lev));
1046 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
1047 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
1048 VTY_NEWLINE);
1049}
1050
1051static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
1052 const char *prefix)
1053{
1054 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
1055 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
1056 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
1057 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
1058 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
1059 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
1060 VTY_NEWLINE);
1061 if (mr->flags & MEAS_REP_F_MS_TO)
1062 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
1063 mr->ms_timing_offset, VTY_NEWLINE);
1064 if (mr->flags & MEAS_REP_F_MS_L1)
1065 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
1066 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
1067 if (mr->flags & MEAS_REP_F_DL_VALID)
1068 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
1069 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
1070}
1071
Harald Welte0a8cf322015-12-05 17:22:49 +01001072/* FIXME: move this to libosmogsm */
1073static const struct value_string gsm48_cmode_names[] = {
1074 { GSM48_CMODE_SIGN, "signalling" },
1075 { GSM48_CMODE_SPEECH_V1, "FR or HR" },
1076 { GSM48_CMODE_SPEECH_EFR, "EFR" },
1077 { GSM48_CMODE_SPEECH_AMR, "AMR" },
1078 { GSM48_CMODE_DATA_14k5, "CSD(14k5)" },
1079 { GSM48_CMODE_DATA_12k0, "CSD(12k0)" },
1080 { GSM48_CMODE_DATA_6k0, "CSD(6k0)" },
1081 { GSM48_CMODE_DATA_3k6, "CSD(3k6)" },
1082 { 0, NULL }
1083};
1084
Neels Hofmeyrb7480122016-11-02 14:28:15 +01001085/* call vty_out() to print a string like " as TCH/H" for dynamic timeslots.
1086 * Don't do anything if the ts is not dynamic. */
1087static void vty_out_dyn_ts_status(struct vty *vty, struct gsm_bts_trx_ts *ts)
1088{
1089 switch (ts->pchan) {
1090 case GSM_PCHAN_TCH_F_TCH_H_PDCH:
1091 if (ts->dyn.pchan_is == ts->dyn.pchan_want)
1092 vty_out(vty, " as %s",
1093 gsm_pchan_name(ts->dyn.pchan_is));
1094 else
1095 vty_out(vty, " switching %s -> %s",
1096 gsm_pchan_name(ts->dyn.pchan_is),
1097 gsm_pchan_name(ts->dyn.pchan_want));
1098 break;
1099 case GSM_PCHAN_TCH_F_PDCH:
1100 if ((ts->flags & TS_F_PDCH_PENDING_MASK) == 0)
1101 vty_out(vty, " as %s",
1102 (ts->flags & TS_F_PDCH_ACTIVE)? "PDCH"
1103 : "TCH/F");
1104 else
1105 vty_out(vty, " switching %s -> %s",
1106 (ts->flags & TS_F_PDCH_ACTIVE)? "PDCH"
1107 : "TCH/F",
1108 (ts->flags & TS_F_PDCH_ACT_PENDING)? "PDCH"
1109 : "TCH/F");
1110 break;
1111 default:
1112 /* no dyn ts */
1113 break;
1114 }
1115}
1116
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +08001117static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
Harald Welte68628e82009-03-10 12:17:57 +00001118{
Harald Welte8387a492009-12-22 21:43:14 +01001119 int idx;
1120
Harald Welte85bded82010-12-24 12:22:34 +01001121 vty_out(vty, "BTS %u, TRX %u, Timeslot %u, Lchan %u: Type %s%s",
1122 lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
1123 lchan->nr, gsm_lchant_name(lchan->type), VTY_NEWLINE);
Neels Hofmeyrb7480122016-11-02 14:28:15 +01001124 /* show dyn TS details, if applicable */
1125 switch (lchan->ts->pchan) {
1126 case GSM_PCHAN_TCH_F_TCH_H_PDCH:
1127 vty_out(vty, " Osmocom Dyn TS:");
1128 vty_out_dyn_ts_status(vty, lchan->ts);
1129 vty_out(vty, VTY_NEWLINE);
1130 break;
1131 case GSM_PCHAN_TCH_F_PDCH:
1132 vty_out(vty, " IPACC Dyn PDCH TS:");
1133 vty_out_dyn_ts_status(vty, lchan->ts);
1134 vty_out(vty, VTY_NEWLINE);
1135 break;
1136 default:
1137 /* no dyn ts */
1138 break;
1139 }
Holger Hans Peter Freyther454140e2014-12-28 12:08:28 +01001140 vty_out(vty, " Connection: %u, State: %s%s%s%s",
Holger Hans Peter Freyther40494552010-06-28 17:09:29 +08001141 lchan->conn ? 1: 0,
Holger Hans Peter Freyther454140e2014-12-28 12:08:28 +01001142 gsm_lchans_name(lchan->state),
1143 lchan->state == LCHAN_S_BROKEN ? " Error reason: " : "",
1144 lchan->state == LCHAN_S_BROKEN ? lchan->broken_reason : "",
1145 VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +01001146 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
1147 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
1148 - lchan->bs_power*2,
1149 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
1150 VTY_NEWLINE);
Harald Welte0a8cf322015-12-05 17:22:49 +01001151 vty_out(vty, " Channel Mode / Codec: %s%s",
1152 get_value_string(gsm48_cmode_names, lchan->tch_mode),
1153 VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +08001154 if (lchan->conn && lchan->conn->subscr) {
Harald Welte68628e82009-03-10 12:17:57 +00001155 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +08001156 subscr_dump_vty(vty, lchan->conn->subscr);
Harald Welte68628e82009-03-10 12:17:57 +00001157 } else
1158 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte2c828992009-12-02 01:56:49 +05301159 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
1160 struct in_addr ia;
Holger Hans Peter Freyther54fa7992010-04-07 15:39:16 +02001161 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte2c828992009-12-02 01:56:49 +05301162 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
1163 inet_ntoa(ia), lchan->abis_ip.bound_port,
1164 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
1165 VTY_NEWLINE);
1166 }
Harald Welte8387a492009-12-22 21:43:14 +01001167
1168 /* we want to report the last measurement report */
1169 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
1170 lchan->meas_rep_idx, 1);
1171 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte68628e82009-03-10 12:17:57 +00001172}
1173
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08001174static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
1175{
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +08001176 struct gsm_meas_rep *mr;
1177 int idx;
1178
1179 /* we want to report the last measurement report */
1180 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
1181 lchan->meas_rep_idx, 1);
1182 mr = &lchan->meas_rep[idx];
1183
Neels Hofmeyrb7480122016-11-02 14:28:15 +01001184 vty_out(vty, "BTS %u, TRX %u, Timeslot %u %s",
Harald Welte85bded82010-12-24 12:22:34 +01001185 lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
Neels Hofmeyrb7480122016-11-02 14:28:15 +01001186 gsm_pchan_name(lchan->ts->pchan));
1187 vty_out_dyn_ts_status(vty, lchan->ts);
1188 vty_out(vty, ", Lchan %u, Type %s, State %s - "
1189 "L1 MS Power: %u dBm RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
Neels Hofmeyrefedf802016-06-14 01:31:38 +02001190 lchan->nr,
1191 gsm_lchant_name(lchan->type), gsm_lchans_name(lchan->state),
1192 mr->ms_l1.pwr,
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +08001193 rxlev2dbm(mr->dl.full.rx_lev),
1194 rxlev2dbm(mr->ul.full.rx_lev),
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08001195 VTY_NEWLINE);
1196}
1197
Holger Hans Peter Freyther7173f632011-12-27 16:34:12 +01001198
1199static int dump_lchan_trx_ts(struct gsm_bts_trx_ts *ts, struct vty *vty,
1200 void (*dump_cb)(struct vty *, struct gsm_lchan *))
1201{
1202 int lchan_nr;
1203 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN; lchan_nr++) {
1204 struct gsm_lchan *lchan = &ts->lchan[lchan_nr];
1205 if ((lchan->type == GSM_LCHAN_NONE) && (lchan->state == LCHAN_S_NONE))
1206 continue;
1207 dump_cb(vty, lchan);
1208 }
1209
1210 return CMD_SUCCESS;
1211}
1212
1213static int dump_lchan_trx(struct gsm_bts_trx *trx, struct vty *vty,
1214 void (*dump_cb)(struct vty *, struct gsm_lchan *))
1215{
1216 int ts_nr;
1217
1218 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
1219 struct gsm_bts_trx_ts *ts = &trx->ts[ts_nr];
1220 dump_lchan_trx_ts(ts, vty, dump_cb);
1221 }
1222
1223 return CMD_SUCCESS;
1224}
1225
1226static int dump_lchan_bts(struct gsm_bts *bts, struct vty *vty,
1227 void (*dump_cb)(struct vty *, struct gsm_lchan *))
1228{
1229 int trx_nr;
1230
1231 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
1232 struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, trx_nr);
1233 dump_lchan_trx(trx, vty, dump_cb);
1234 }
1235
1236 return CMD_SUCCESS;
1237}
1238
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +08001239static int lchan_summary(struct vty *vty, int argc, const char **argv,
1240 void (*dump_cb)(struct vty *, struct gsm_lchan *))
Harald Welte68628e82009-03-10 12:17:57 +00001241{
Harald Weltedcccb182010-05-16 20:52:23 +02001242 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +00001243 struct gsm_bts *bts;
1244 struct gsm_bts_trx *trx;
1245 struct gsm_bts_trx_ts *ts;
1246 struct gsm_lchan *lchan;
1247 int bts_nr, trx_nr, ts_nr, lchan_nr;
1248
1249 if (argc >= 1) {
1250 /* use the BTS number that the user has specified */
1251 bts_nr = atoi(argv[0]);
1252 if (bts_nr >= net->num_bts) {
1253 vty_out(vty, "%% can't find BTS %s%s", argv[0],
1254 VTY_NEWLINE);
1255 return CMD_WARNING;
1256 }
Harald Weltee441d9c2009-06-21 16:17:15 +02001257 bts = gsm_bts_num(net, bts_nr);
Holger Hans Peter Freyther7173f632011-12-27 16:34:12 +01001258
1259 if (argc == 1)
1260 return dump_lchan_bts(bts, vty, dump_cb);
Harald Welte68628e82009-03-10 12:17:57 +00001261 }
1262 if (argc >= 2) {
1263 trx_nr = atoi(argv[1]);
1264 if (trx_nr >= bts->num_trx) {
1265 vty_out(vty, "%% can't find TRX %s%s", argv[1],
1266 VTY_NEWLINE);
1267 return CMD_WARNING;
1268 }
Harald Weltee441d9c2009-06-21 16:17:15 +02001269 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freyther7173f632011-12-27 16:34:12 +01001270
1271 if (argc == 2)
1272 return dump_lchan_trx(trx, vty, dump_cb);
Harald Welte68628e82009-03-10 12:17:57 +00001273 }
1274 if (argc >= 3) {
1275 ts_nr = atoi(argv[2]);
1276 if (ts_nr >= TRX_NR_TS) {
1277 vty_out(vty, "%% can't find TS %s%s", argv[2],
1278 VTY_NEWLINE);
1279 return CMD_WARNING;
1280 }
1281 ts = &trx->ts[ts_nr];
Holger Hans Peter Freyther7173f632011-12-27 16:34:12 +01001282
1283 if (argc == 3)
1284 return dump_lchan_trx_ts(ts, vty, dump_cb);
Harald Welte68628e82009-03-10 12:17:57 +00001285 }
1286 if (argc >= 4) {
1287 lchan_nr = atoi(argv[3]);
1288 if (lchan_nr >= TS_MAX_LCHAN) {
1289 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
1290 VTY_NEWLINE);
1291 return CMD_WARNING;
1292 }
1293 lchan = &ts->lchan[lchan_nr];
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +08001294 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +00001295 return CMD_SUCCESS;
1296 }
Holger Hans Peter Freyther7173f632011-12-27 16:34:12 +01001297
1298
Harald Welte68628e82009-03-10 12:17:57 +00001299 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +02001300 bts = gsm_bts_num(net, bts_nr);
Holger Hans Peter Freyther7173f632011-12-27 16:34:12 +01001301 dump_lchan_bts(bts, vty, dump_cb);
Harald Welte68628e82009-03-10 12:17:57 +00001302 }
1303
1304 return CMD_SUCCESS;
1305}
1306
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +08001307
1308DEFUN(show_lchan,
1309 show_lchan_cmd,
Sylvain Munaut39c31de2012-12-28 12:15:11 +01001310 "show lchan [<0-255>] [<0-255>] [<0-7>] [lchan_nr]",
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +08001311 SHOW_STR "Display information about a logical channel\n"
1312 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001313 LCHAN_NR_STR)
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +08001314
1315{
1316 return lchan_summary(vty, argc, argv, lchan_dump_full_vty);
1317}
1318
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08001319DEFUN(show_lchan_summary,
1320 show_lchan_summary_cmd,
Sylvain Munaut39c31de2012-12-28 12:15:11 +01001321 "show lchan summary [<0-255>] [<0-255>] [<0-7>] [lchan_nr]",
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08001322 SHOW_STR "Display information about a logical channel\n"
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001323 "Short summary\n"
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08001324 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001325 LCHAN_NR_STR)
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08001326{
1327 return lchan_summary(vty, argc, argv, lchan_dump_short_vty);
1328}
1329
Harald Weltebe4b7302009-05-23 16:59:33 +00001330static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
Harald Weltef5025b62009-03-28 16:55:11 +00001331{
1332 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
Neels Hofmeyr6d804b12017-02-18 22:20:46 +01001333 bsc_subscr_dump_vty(vty, pag->bsub);
Harald Weltef5025b62009-03-28 16:55:11 +00001334}
1335
Harald Weltebe4b7302009-05-23 16:59:33 +00001336static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
Harald Weltef5025b62009-03-28 16:55:11 +00001337{
1338 struct gsm_paging_request *pag;
1339
Holger Hans Peter Freyther9b5192b2013-03-03 11:03:17 +01001340 if (!bts->paging.bts)
1341 return;
1342
Harald Weltef5025b62009-03-28 16:55:11 +00001343 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
1344 paging_dump_vty(vty, pag);
1345}
1346
1347DEFUN(show_paging,
1348 show_paging_cmd,
Sylvain Munaut39c31de2012-12-28 12:15:11 +01001349 "show paging [<0-255>]",
Harald Welte8f0ed552010-05-11 21:53:49 +02001350 SHOW_STR "Display information about paging reuqests of a BTS\n"
1351 "BTS Number\n")
Harald Weltef5025b62009-03-28 16:55:11 +00001352{
Harald Weltedcccb182010-05-16 20:52:23 +02001353 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Weltef5025b62009-03-28 16:55:11 +00001354 struct gsm_bts *bts;
1355 int bts_nr;
1356
1357 if (argc >= 1) {
1358 /* use the BTS number that the user has specified */
1359 bts_nr = atoi(argv[0]);
1360 if (bts_nr >= net->num_bts) {
1361 vty_out(vty, "%% can't find BTS %s%s", argv[0],
1362 VTY_NEWLINE);
1363 return CMD_WARNING;
1364 }
Harald Weltee441d9c2009-06-21 16:17:15 +02001365 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001366 bts_paging_dump_vty(vty, bts);
1367
1368 return CMD_SUCCESS;
1369 }
1370 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +02001371 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001372 bts_paging_dump_vty(vty, bts);
1373 }
1374
1375 return CMD_SUCCESS;
1376}
1377
Holger Hans Peter Freytherec37bb22013-02-05 09:39:09 +01001378DEFUN(show_paging_group,
1379 show_paging_group_cmd,
1380 "show paging-group <0-255> IMSI",
1381 SHOW_STR "Display the paging group\n"
1382 "BTS Number\n" "IMSI\n")
1383{
1384 struct gsm_network *net = gsmnet_from_vty(vty);
1385 struct gsm_bts *bts;
1386 unsigned int page_group;
1387 int bts_nr = atoi(argv[0]);
1388
1389 if (bts_nr >= net->num_bts) {
1390 vty_out(vty, "%% can't find BTS %s%s", argv[0], VTY_NEWLINE);
1391 return CMD_WARNING;
1392 }
1393
1394 bts = gsm_bts_num(net, bts_nr);
1395 if (!bts) {
1396 vty_out(vty, "%% can't find BTS %s%s", argv[0], VTY_NEWLINE);
1397 return CMD_WARNING;
1398 }
1399
1400 page_group = gsm0502_calc_paging_group(&bts->si_common.chan_desc,
1401 str_to_imsi(argv[1]));
1402 vty_out(vty, "%%Paging group for IMSI %" PRIu64 " on BTS #%d is %u%s",
1403 str_to_imsi(argv[1]), bts->nr,
1404 page_group, VTY_NEWLINE);
1405 return CMD_SUCCESS;
1406}
1407
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001408DEFUN(cfg_net_neci,
1409 cfg_net_neci_cmd,
1410 "neci (0|1)",
Harald Welte28326062010-05-14 20:05:17 +02001411 "New Establish Cause Indication\n"
1412 "Don't set the NECI bit\n" "Set the NECI bit\n")
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001413{
Harald Weltedcccb182010-05-16 20:52:23 +02001414 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1415
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001416 gsmnet->neci = atoi(argv[0]);
Holger Hans Peter Freyther78891072010-09-06 09:36:02 +08001417 gsm_net_update_ctype(gsmnet);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001418 return CMD_SUCCESS;
1419}
1420
Harald Welte8f0ed552010-05-11 21:53:49 +02001421#define HANDOVER_STR "Handover Options\n"
1422
Harald Weltebc814502009-12-19 21:41:52 +01001423DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1424 "handover (0|1)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001425 HANDOVER_STR
1426 "Don't perform in-call handover\n"
1427 "Perform in-call handover\n")
Harald Weltebc814502009-12-19 21:41:52 +01001428{
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001429 int enable = atoi(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001430 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001431
1432 if (enable && ipacc_rtp_direct) {
Harald Weltefe03f0d2009-12-20 13:51:01 +01001433 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1434 "is enabled by using the -P command line option%s",
1435 VTY_NEWLINE);
1436 return CMD_WARNING;
1437 }
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001438 gsmnet->handover.active = enable;
Harald Weltebc814502009-12-19 21:41:52 +01001439
1440 return CMD_SUCCESS;
1441}
1442
Harald Welte8f0ed552010-05-11 21:53:49 +02001443#define HO_WIN_STR HANDOVER_STR "Measurement Window\n"
1444#define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n"
1445#define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n"
1446#define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n"
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001447#define HO_AVG_COUNT_STR "Amount to use for Averaging\n"
Harald Welte8f0ed552010-05-11 21:53:49 +02001448
Harald Welteb720bd32009-12-21 16:51:50 +01001449DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1450 "handover window rxlev averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001451 HO_WIN_RXLEV_STR
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001452 "How many RxLev measurements are used for averaging\n"
1453 HO_AVG_COUNT_STR)
Harald Welteb720bd32009-12-21 16:51:50 +01001454{
Harald Weltedcccb182010-05-16 20:52:23 +02001455 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001456 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1457 return CMD_SUCCESS;
1458}
1459
1460DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1461 "handover window rxqual averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001462 HO_WIN_RXQUAL_STR
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001463 "How many RxQual measurements are used for averaging\n"
1464 HO_AVG_COUNT_STR)
Harald Welteb720bd32009-12-21 16:51:50 +01001465{
Harald Weltedcccb182010-05-16 20:52:23 +02001466 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001467 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1468 return CMD_SUCCESS;
1469}
1470
1471DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1472 "handover window rxlev neighbor averaging <1-10>",
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001473 HO_WIN_RXLEV_STR "Neighbor\n"
1474 "How many RxQual measurements are used for averaging\n"
1475 HO_AVG_COUNT_STR)
Harald Welteb720bd32009-12-21 16:51:50 +01001476{
Harald Weltedcccb182010-05-16 20:52:23 +02001477 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001478 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1479 return CMD_SUCCESS;
1480}
1481
1482DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1483 "handover power budget interval <1-99>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001484 HO_PBUDGET_STR
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001485 "How often to check if we have a better cell (SACCH frames)\n"
1486 "Interval\n" "Number\n")
Harald Welteb720bd32009-12-21 16:51:50 +01001487{
Harald Weltedcccb182010-05-16 20:52:23 +02001488 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001489 gsmnet->handover.pwr_interval = atoi(argv[0]);
1490 return CMD_SUCCESS;
1491}
1492
1493DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1494 "handover power budget hysteresis <0-999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001495 HO_PBUDGET_STR
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001496 "How many dB does a neighbor to be stronger to become a HO candidate\n"
1497 "Hysteresis\n" "Number\n")
Harald Welteb720bd32009-12-21 16:51:50 +01001498{
Harald Weltedcccb182010-05-16 20:52:23 +02001499 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001500 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1501 return CMD_SUCCESS;
1502}
1503
1504DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1505 "handover maximum distance <0-9999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001506 HANDOVER_STR
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001507 "How big is the maximum timing advance before HO is forced\n"
1508 "Distance\n" "Number\n")
Harald Welteb720bd32009-12-21 16:51:50 +01001509{
Harald Weltedcccb182010-05-16 20:52:23 +02001510 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001511 gsmnet->handover.max_distance = atoi(argv[0]);
1512 return CMD_SUCCESS;
1513}
Harald Weltebc814502009-12-19 21:41:52 +01001514
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001515DEFUN(cfg_net_pag_any_tch,
1516 cfg_net_pag_any_tch_cmd,
1517 "paging any use tch (0|1)",
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001518 "Assign a TCH when receiving a Paging Any request\n"
1519 "Any Channel\n" "Use\n" "TCH\n"
1520 "Do not use TCH for Paging Request Any\n"
1521 "Do use TCH for Paging Request Any\n")
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001522{
Holger Hans Peter Freytherb0e88b82010-09-06 10:09:19 +08001523 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001524 gsmnet->pag_any_tch = atoi(argv[0]);
1525 gsm_net_update_ctype(gsmnet);
1526 return CMD_SUCCESS;
1527}
1528
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001529#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001530 DEFUN(cfg_net_T##number, \
1531 cfg_net_T##number##_cmd, \
1532 "timer t" #number " <0-65535>", \
Harald Welte8f0ed552010-05-11 21:53:49 +02001533 "Configure GSM Timers\n" \
Holger Hans Peter Freyther5dd295f2014-04-11 19:30:27 +02001534 doc "Timer Value in seconds\n") \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001535{ \
Harald Weltedcccb182010-05-16 20:52:23 +02001536 struct gsm_network *gsmnet = gsmnet_from_vty(vty); \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001537 int value = atoi(argv[0]); \
1538 \
1539 if (value < 0 || value > 65535) { \
1540 vty_out(vty, "Timer value %s out of range.%s", \
1541 argv[0], VTY_NEWLINE); \
1542 return CMD_WARNING; \
1543 } \
1544 \
1545 gsmnet->T##number = value; \
1546 return CMD_SUCCESS; \
1547}
1548
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001549DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.\n")
1550DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.\n")
Harald Welte67161f22012-06-03 13:01:47 +02001551DECLARE_TIMER(3105, "Set the timer for repetition of PHYSICAL INFORMATION.\n")
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001552DECLARE_TIMER(3107, "Currently not used.\n")
Holger Hans Peter Freytherb3489392011-12-28 16:21:05 +01001553DECLARE_TIMER(3109, "Set the RSL SACCH deactivation timeout.\n")
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001554DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel.\n")
1555DECLARE_TIMER(3113, "Set the time to try paging a subscriber.\n")
1556DECLARE_TIMER(3115, "Currently not used.\n")
1557DECLARE_TIMER(3117, "Currently not used.\n")
1558DECLARE_TIMER(3119, "Currently not used.\n")
1559DECLARE_TIMER(3122, "Waiting time (seconds) after IMM ASS REJECT\n")
1560DECLARE_TIMER(3141, "Currently not used.\n")
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001561
Maxc08ee712016-05-11 12:45:13 +02001562DEFUN_DEPRECATED(cfg_net_dtx,
1563 cfg_net_dtx_cmd,
1564 "dtx-used (0|1)",
1565 ".HIDDEN\n""Obsolete\n""Obsolete\n")
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08001566{
Maxc08ee712016-05-11 12:45:13 +02001567 vty_out(vty, "%% 'dtx-used' is now deprecated: use dtx * "
1568 "configuration options of BTS instead%s", VTY_NEWLINE);
1569 return CMD_SUCCESS;
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08001570}
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001571
Harald Welte5258fc42009-03-28 19:07:53 +00001572/* per-BTS configuration */
1573DEFUN(cfg_bts,
1574 cfg_bts_cmd,
Harald Welte57e07242012-08-17 12:50:14 +02001575 "bts <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001576 "Select a BTS to configure\n"
1577 "BTS Number\n")
Harald Welte5258fc42009-03-28 19:07:53 +00001578{
Harald Weltedcccb182010-05-16 20:52:23 +02001579 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte5258fc42009-03-28 19:07:53 +00001580 int bts_nr = atoi(argv[0]);
1581 struct gsm_bts *bts;
1582
Harald Weltee441d9c2009-06-21 16:17:15 +02001583 if (bts_nr > gsmnet->num_bts) {
1584 vty_out(vty, "%% The next unused BTS number is %u%s",
1585 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001586 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001587 } else if (bts_nr == gsmnet->num_bts) {
1588 /* allocate a new one */
Harald Welte3300c012011-06-05 13:31:33 +02001589 bts = gsm_bts_alloc_register(gsmnet, GSM_BTS_TYPE_UNKNOWN,
Harald Weltea2bbc5e2015-11-20 10:43:31 +01001590 HARDCODED_BSIC);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001591 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02001592 bts = gsm_bts_num(gsmnet, bts_nr);
1593
Daniel Willmannf15c2762010-01-11 13:43:07 +01001594 if (!bts) {
1595 vty_out(vty, "%% Unable to allocate BTS %u%s",
1596 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee441d9c2009-06-21 16:17:15 +02001597 return CMD_WARNING;
Daniel Willmannf15c2762010-01-11 13:43:07 +01001598 }
Harald Welte5258fc42009-03-28 19:07:53 +00001599
1600 vty->index = bts;
Harald Welte197dea92010-05-14 17:59:53 +02001601 vty->index_sub = &bts->description;
Harald Welte5258fc42009-03-28 19:07:53 +00001602 vty->node = BTS_NODE;
1603
1604 return CMD_SUCCESS;
1605}
1606
1607DEFUN(cfg_bts_type,
1608 cfg_bts_type_cmd,
Harald Weltee555c2b2012-08-17 13:02:12 +02001609 "type TYPE", /* dynamically created */
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001610 "Set the BTS type\n" "Type\n")
Harald Welte5258fc42009-03-28 19:07:53 +00001611{
1612 struct gsm_bts *bts = vty->index;
Harald Welte39315c42010-01-10 18:01:52 +01001613 int rc;
Harald Welte5258fc42009-03-28 19:07:53 +00001614
Harald Welte39315c42010-01-10 18:01:52 +01001615 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1616 if (rc < 0)
1617 return CMD_WARNING;
Harald Welte8175e952009-10-20 00:22:00 +02001618
Harald Welte5258fc42009-03-28 19:07:53 +00001619 return CMD_SUCCESS;
1620}
1621
Harald Weltefcd24452009-06-20 18:15:19 +02001622DEFUN(cfg_bts_band,
1623 cfg_bts_band_cmd,
1624 "band BAND",
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001625 "Set the frequency band of this BTS\n" "Frequency band\n")
Harald Weltefcd24452009-06-20 18:15:19 +02001626{
1627 struct gsm_bts *bts = vty->index;
Harald Welte42581822009-08-08 16:12:58 +02001628 int band = gsm_band_parse(argv[0]);
Harald Weltefcd24452009-06-20 18:15:19 +02001629
1630 if (band < 0) {
1631 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1632 band, VTY_NEWLINE);
1633 return CMD_WARNING;
1634 }
1635
1636 bts->band = band;
1637
1638 return CMD_SUCCESS;
1639}
1640
Maxc08ee712016-05-11 12:45:13 +02001641DEFUN(cfg_bts_dtxu, cfg_bts_dtxu_cmd, "dtx uplink [force]",
1642 "Configure discontinuous transmission\n"
1643 "Enable Uplink DTX for this BTS\n"
1644 "MS 'shall' use DTXu instead of 'may' use (might not be supported by "
1645 "older phones).\n")
1646{
1647 struct gsm_bts *bts = vty->index;
1648
1649 bts->dtxu = (argc > 0) ? GSM48_DTX_SHALL_BE_USED : GSM48_DTX_MAY_BE_USED;
Max60795282016-06-06 11:30:57 +02001650 if (!is_ipaccess_bts(bts))
1651 vty_out(vty, "%% DTX enabled on non-IP BTS: this configuration "
1652 "neither supported nor tested!%s", VTY_NEWLINE);
Maxc08ee712016-05-11 12:45:13 +02001653 return CMD_SUCCESS;
1654}
1655
1656DEFUN(cfg_bts_no_dtxu, cfg_bts_no_dtxu_cmd, "no dtx uplink",
1657 NO_STR
1658 "Configure discontinuous transmission\n"
1659 "Disable Uplink DTX for this BTS\n")
1660{
1661 struct gsm_bts *bts = vty->index;
1662
1663 bts->dtxu = GSM48_DTX_SHALL_NOT_BE_USED;
1664
1665 return CMD_SUCCESS;
1666}
1667
1668DEFUN(cfg_bts_dtxd, cfg_bts_dtxd_cmd, "dtx downlink",
1669 "Configure discontinuous transmission\n"
1670 "Enable Downlink DTX for this BTS\n")
1671{
1672 struct gsm_bts *bts = vty->index;
1673
1674 bts->dtxd = true;
Max60795282016-06-06 11:30:57 +02001675 if (!is_ipaccess_bts(bts))
1676 vty_out(vty, "%% DTX enabled on non-IP BTS: this configuration "
1677 "neither supported nor tested!%s", VTY_NEWLINE);
Maxc08ee712016-05-11 12:45:13 +02001678 return CMD_SUCCESS;
1679}
1680
1681DEFUN(cfg_bts_no_dtxd, cfg_bts_no_dtxd_cmd, "no dtx downlink",
1682 NO_STR
1683 "Configure discontinuous transmission\n"
1684 "Disable Downlink DTX for this BTS\n")
1685{
1686 struct gsm_bts *bts = vty->index;
1687
1688 bts->dtxd = false;
1689
1690 return CMD_SUCCESS;
1691}
1692
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001693DEFUN(cfg_bts_ci,
1694 cfg_bts_ci_cmd,
1695 "cell_identity <0-65535>",
Holger Hans Peter Freyther64c17fa2012-07-21 00:27:10 +02001696 "Set the Cell identity of this BTS\n" "Cell Identity\n")
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001697{
1698 struct gsm_bts *bts = vty->index;
1699 int ci = atoi(argv[0]);
1700
1701 if (ci < 0 || ci > 0xffff) {
1702 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1703 ci, VTY_NEWLINE);
1704 return CMD_WARNING;
1705 }
1706 bts->cell_identity = ci;
1707
1708 return CMD_SUCCESS;
1709}
1710
Harald Welte5258fc42009-03-28 19:07:53 +00001711DEFUN(cfg_bts_lac,
1712 cfg_bts_lac_cmd,
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001713 "location_area_code <0-65535>",
Holger Hans Peter Freyther64c17fa2012-07-21 00:27:10 +02001714 "Set the Location Area Code (LAC) of this BTS\n" "LAC\n")
Harald Welte5258fc42009-03-28 19:07:53 +00001715{
1716 struct gsm_bts *bts = vty->index;
1717 int lac = atoi(argv[0]);
1718
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001719 if (lac < 0 || lac > 0xffff) {
1720 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte5258fc42009-03-28 19:07:53 +00001721 lac, VTY_NEWLINE);
1722 return CMD_WARNING;
1723 }
Holger Hans Peter Freythere48b9562009-10-01 04:07:15 +02001724
1725 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1726 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1727 lac, VTY_NEWLINE);
1728 return CMD_WARNING;
1729 }
1730
Harald Welte5258fc42009-03-28 19:07:53 +00001731 bts->location_area_code = lac;
1732
1733 return CMD_SUCCESS;
1734}
1735
Harald Weltea43f7892009-12-01 18:04:30 +05301736
Harald Weltea2bbc5e2015-11-20 10:43:31 +01001737/* compatibility wrapper for old config files */
1738DEFUN_HIDDEN(cfg_bts_tsc,
Harald Welte5258fc42009-03-28 19:07:53 +00001739 cfg_bts_tsc_cmd,
Harald Weltec513ded2012-05-31 10:57:08 +02001740 "training_sequence_code <0-7>",
Holger Hans Peter Freyther64c17fa2012-07-21 00:27:10 +02001741 "Set the Training Sequence Code (TSC) of this BTS\n" "TSC\n")
Harald Welte5258fc42009-03-28 19:07:53 +00001742{
Harald Welte5258fc42009-03-28 19:07:53 +00001743 return CMD_SUCCESS;
1744}
1745
Harald Welte78f2f502009-05-23 16:56:52 +00001746DEFUN(cfg_bts_bsic,
1747 cfg_bts_bsic_cmd,
1748 "base_station_id_code <0-63>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02001749 "Set the Base Station Identity Code (BSIC) of this BTS\n"
1750 "BSIC of this BTS\n")
Harald Welte78f2f502009-05-23 16:56:52 +00001751{
1752 struct gsm_bts *bts = vty->index;
1753 int bsic = atoi(argv[0]);
1754
1755 if (bsic < 0 || bsic > 0x3f) {
Harald Welte42581822009-08-08 16:12:58 +02001756 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte78f2f502009-05-23 16:56:52 +00001757 bsic, VTY_NEWLINE);
1758 return CMD_WARNING;
1759 }
1760 bts->bsic = bsic;
1761
1762 return CMD_SUCCESS;
1763}
1764
Harald Welte4cc34222009-05-01 15:12:31 +00001765DEFUN(cfg_bts_unit_id,
1766 cfg_bts_unit_id_cmd,
Harald Welte07dc73d2009-08-07 13:27:09 +02001767 "ip.access unit_id <0-65534> <0-255>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02001768 "Abis/IP specific options\n"
1769 "Set the IPA BTS Unit ID\n"
1770 "Unit ID (Site)\n"
1771 "Unit ID (BTS)\n")
Harald Welte4cc34222009-05-01 15:12:31 +00001772{
1773 struct gsm_bts *bts = vty->index;
1774 int site_id = atoi(argv[0]);
1775 int bts_id = atoi(argv[1]);
1776
Harald Welte07dc73d2009-08-07 13:27:09 +02001777 if (!is_ipaccess_bts(bts)) {
1778 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1779 return CMD_WARNING;
1780 }
1781
Harald Welte4cc34222009-05-01 15:12:31 +00001782 bts->ip_access.site_id = site_id;
1783 bts->ip_access.bts_id = bts_id;
1784
1785 return CMD_SUCCESS;
1786}
1787
Harald Welte8b291802013-03-12 13:57:05 +01001788DEFUN(cfg_bts_rsl_ip,
1789 cfg_bts_rsl_ip_cmd,
1790 "ip.access rsl-ip A.B.C.D",
1791 "Abis/IP specific options\n"
1792 "Set the IPA RSL IP Address of the BSC\n"
1793 "Destination IP address for RSL connection\n")
1794{
1795 struct gsm_bts *bts = vty->index;
1796 struct in_addr ia;
1797
1798 if (!is_ipaccess_bts(bts)) {
1799 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1800 return CMD_WARNING;
1801 }
1802
1803 inet_aton(argv[0], &ia);
1804 bts->ip_access.rsl_ip = ntohl(ia.s_addr);
1805
1806 return CMD_SUCCESS;
1807}
1808
Andreas Eversberg7d8fa342013-12-05 13:25:06 +01001809#define NOKIA_STR "Nokia *Site related commands\n"
Harald Welte8b291802013-03-12 13:57:05 +01001810
Sylvain Munautc9519462011-10-17 14:04:55 +02001811DEFUN(cfg_bts_nokia_site_skip_reset,
1812 cfg_bts_nokia_site_skip_reset_cmd,
1813 "nokia_site skip-reset (0|1)",
Andreas Eversberg7d8fa342013-12-05 13:25:06 +01001814 NOKIA_STR
Harald Weltecfaabbb2012-08-16 23:23:50 +02001815 "Skip the reset step during bootstrap process of this BTS\n"
1816 "Do NOT skip the reset\n" "Skip the reset\n")
Sylvain Munautc9519462011-10-17 14:04:55 +02001817{
1818 struct gsm_bts *bts = vty->index;
1819
1820 if (bts->type != GSM_BTS_TYPE_NOKIA_SITE) {
1821 vty_out(vty, "%% BTS is not of Nokia *Site type%s", VTY_NEWLINE);
1822 return CMD_WARNING;
1823 }
1824
1825 bts->nokia.skip_reset = atoi(argv[0]);
1826
1827 return CMD_SUCCESS;
1828}
1829
Andreas Eversberg7d8fa342013-12-05 13:25:06 +01001830DEFUN(cfg_bts_nokia_site_no_loc_rel_cnf,
1831 cfg_bts_nokia_site_no_loc_rel_cnf_cmd,
1832 "nokia_site no-local-rel-conf (0|1)",
1833 NOKIA_STR
1834 "Do not wait for RELease CONFirm message when releasing channel locally\n"
1835 "Wait for RELease CONFirm\n" "Do not wait for RELease CONFirm\n")
1836{
1837 struct gsm_bts *bts = vty->index;
1838
1839 if (!is_nokia_bts(bts)) {
1840 vty_out(vty, "%% BTS is not of Nokia *Site type%s",
1841 VTY_NEWLINE);
1842 return CMD_WARNING;
1843 }
1844
1845 bts->nokia.no_loc_rel_cnf = atoi(argv[0]);
1846
1847 return CMD_SUCCESS;
1848}
1849
Sipos Csaba56e17662015-02-07 13:27:36 +01001850DEFUN(cfg_bts_nokia_site_bts_reset_timer_cnf,
1851 cfg_bts_nokia_site_bts_reset_timer_cnf_cmd,
1852 "nokia_site bts-reset-timer <15-100>",
1853 NOKIA_STR
1854 "The amount of time (in sec.) between BTS_RESET is sent,\n"
1855 "and the BTS is being bootstrapped.\n")
1856{
1857 struct gsm_bts *bts = vty->index;
1858
1859 if (!is_nokia_bts(bts)) {
1860 vty_out(vty, "%% BTS is not of Nokia *Site type%s",
1861 VTY_NEWLINE);
1862 return CMD_WARNING;
1863 }
1864
1865 bts->nokia.bts_reset_timer_cnf = atoi(argv[0]);
1866
1867 return CMD_SUCCESS;
1868}
Harald Welte8f0ed552010-05-11 21:53:49 +02001869#define OML_STR "Organization & Maintenance Link\n"
Harald Weltecfaabbb2012-08-16 23:23:50 +02001870#define IPA_STR "A-bis/IP Specific Options\n"
Harald Welte8f0ed552010-05-11 21:53:49 +02001871
Harald Welte8175e952009-10-20 00:22:00 +02001872DEFUN(cfg_bts_stream_id,
1873 cfg_bts_stream_id_cmd,
Pablo Neira Ayusoed5cacb2011-08-17 22:44:07 +02001874 "oml ip.access stream_id <0-255> line E1_LINE",
Harald Welte8f0ed552010-05-11 21:53:49 +02001875 OML_STR IPA_STR
Harald Weltecfaabbb2012-08-16 23:23:50 +02001876 "Set the ip.access Stream ID of the OML link of this BTS\n"
1877 "Stream Identifier\n" "Virtual E1 Line Number\n" "Virtual E1 Line Number\n")
Harald Welte8175e952009-10-20 00:22:00 +02001878{
1879 struct gsm_bts *bts = vty->index;
Pablo Neira Ayusoed5cacb2011-08-17 22:44:07 +02001880 int stream_id = atoi(argv[0]), linenr = atoi(argv[1]);
Harald Welte8175e952009-10-20 00:22:00 +02001881
1882 if (!is_ipaccess_bts(bts)) {
1883 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1884 return CMD_WARNING;
1885 }
1886
1887 bts->oml_tei = stream_id;
Pablo Neira Ayusoed5cacb2011-08-17 22:44:07 +02001888 /* This is used by e1inp_bind_ops callback for each BTS model. */
1889 bts->oml_e1_link.e1_nr = linenr;
1890
1891 return CMD_SUCCESS;
1892}
1893
Harald Welted13e0cd2012-08-17 09:52:03 +02001894#define OML_E1_STR OML_STR "OML E1/T1 Configuration\n"
Harald Welte8175e952009-10-20 00:22:00 +02001895
Harald Welte42581822009-08-08 16:12:58 +02001896DEFUN(cfg_bts_oml_e1,
1897 cfg_bts_oml_e1_cmd,
1898 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welted13e0cd2012-08-17 09:52:03 +02001899 OML_E1_STR
1900 "E1/T1 line number to be used for OML\n"
Harald Weltecfaabbb2012-08-16 23:23:50 +02001901 "E1/T1 line number to be used for OML\n"
1902 "E1/T1 timeslot to be used for OML\n"
1903 "E1/T1 timeslot to be used for OML\n"
1904 "E1/T1 sub-slot to be used for OML\n"
1905 "Use E1/T1 sub-slot 0\n"
1906 "Use E1/T1 sub-slot 1\n"
1907 "Use E1/T1 sub-slot 2\n"
1908 "Use E1/T1 sub-slot 3\n"
1909 "Use full E1 slot 3\n"
1910 )
Harald Welte42581822009-08-08 16:12:58 +02001911{
1912 struct gsm_bts *bts = vty->index;
1913
1914 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1915
1916 return CMD_SUCCESS;
1917}
1918
1919
1920DEFUN(cfg_bts_oml_e1_tei,
1921 cfg_bts_oml_e1_tei_cmd,
1922 "oml e1 tei <0-63>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001923 OML_E1_STR
Harald Weltecfaabbb2012-08-16 23:23:50 +02001924 "Set the TEI to be used for OML\n"
1925 "TEI Number\n")
Harald Welte42581822009-08-08 16:12:58 +02001926{
1927 struct gsm_bts *bts = vty->index;
1928
1929 bts->oml_tei = atoi(argv[0]);
1930
1931 return CMD_SUCCESS;
1932}
1933
Harald Welte7a8fa412009-08-10 13:48:16 +02001934DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1935 "channel allocator (ascending|descending)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001936 "Channnel Allocator\n" "Channel Allocator\n"
1937 "Allocate Timeslots and Transceivers in ascending order\n"
1938 "Allocate Timeslots and Transceivers in descending order\n")
Harald Welte7a8fa412009-08-10 13:48:16 +02001939{
1940 struct gsm_bts *bts = vty->index;
1941
1942 if (!strcmp(argv[0], "ascending"))
1943 bts->chan_alloc_reverse = 0;
1944 else
1945 bts->chan_alloc_reverse = 1;
1946
1947 return CMD_SUCCESS;
1948}
1949
Harald Welte8f0ed552010-05-11 21:53:49 +02001950#define RACH_STR "Random Access Control Channel\n"
1951
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001952DEFUN(cfg_bts_rach_tx_integer,
1953 cfg_bts_rach_tx_integer_cmd,
1954 "rach tx integer <0-15>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001955 RACH_STR
Harald Weltecfaabbb2012-08-16 23:23:50 +02001956 "Set the raw tx integer value in RACH Control parameters IE\n"
1957 "Set the raw tx integer value in RACH Control parameters IE\n"
1958 "Raw tx integer value in RACH Control parameters IE\n")
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001959{
1960 struct gsm_bts *bts = vty->index;
1961 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1962 return CMD_SUCCESS;
1963}
1964
1965DEFUN(cfg_bts_rach_max_trans,
1966 cfg_bts_rach_max_trans_cmd,
1967 "rach max transmission (1|2|4|7)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001968 RACH_STR
Harald Weltecfaabbb2012-08-16 23:23:50 +02001969 "Set the maximum number of RACH burst transmissions\n"
1970 "Set the maximum number of RACH burst transmissions\n"
Harald Welted13e0cd2012-08-17 09:52:03 +02001971 "Maximum number of 1 RACH burst transmissions\n"
1972 "Maximum number of 2 RACH burst transmissions\n"
1973 "Maximum number of 4 RACH burst transmissions\n"
1974 "Maximum number of 7 RACH burst transmissions\n")
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001975{
1976 struct gsm_bts *bts = vty->index;
1977 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1978 return CMD_SUCCESS;
1979}
1980
Andreas Eversberg2ee7ecd2012-10-13 07:27:47 +02001981#define CD_STR "Channel Description\n"
1982
1983DEFUN(cfg_bts_chan_desc_att,
1984 cfg_bts_chan_desc_att_cmd,
1985 "channel-descrption attach (0|1)",
1986 CD_STR
1987 "Set if attachment is required\n"
1988 "Attachment is NOT required\n"
1989 "Attachment is required (standard)\n")
1990{
1991 struct gsm_bts *bts = vty->index;
1992 bts->si_common.chan_desc.att = atoi(argv[0]);
1993 return CMD_SUCCESS;
1994}
1995
1996DEFUN(cfg_bts_chan_desc_bs_pa_mfrms,
1997 cfg_bts_chan_desc_bs_pa_mfrms_cmd,
1998 "channel-descrption bs-pa-mfrms <2-9>",
1999 CD_STR
2000 "Set number of multiframe periods for paging groups\n"
2001 "Number of multiframe periods for paging groups\n")
2002{
2003 struct gsm_bts *bts = vty->index;
2004 int bs_pa_mfrms = atoi(argv[0]);
2005
2006 bts->si_common.chan_desc.bs_pa_mfrms = bs_pa_mfrms - 2;
2007 return CMD_SUCCESS;
2008}
2009
2010DEFUN(cfg_bts_chan_desc_bs_ag_blks_res,
2011 cfg_bts_chan_desc_bs_ag_blks_res_cmd,
2012 "channel-descrption bs-ag-blks-res <0-7>",
2013 CD_STR
2014 "Set number of blocks reserved for access grant\n"
2015 "Number of blocks reserved for access grant\n")
2016{
2017 struct gsm_bts *bts = vty->index;
2018 int bs_ag_blks_res = atoi(argv[0]);
2019
2020 bts->si_common.chan_desc.bs_ag_blks_res = bs_ag_blks_res;
2021 return CMD_SUCCESS;
2022}
2023
Harald Welte8f0ed552010-05-11 21:53:49 +02002024#define NM_STR "Network Management\n"
2025
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08002026DEFUN(cfg_bts_rach_nm_b_thresh,
2027 cfg_bts_rach_nm_b_thresh_cmd,
2028 "rach nm busy threshold <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02002029 RACH_STR NM_STR
Harald Weltecfaabbb2012-08-16 23:23:50 +02002030 "Set the NM Busy Threshold\n"
2031 "Set the NM Busy Threshold\n"
2032 "NM Busy Threshold in dB")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08002033{
2034 struct gsm_bts *bts = vty->index;
2035 bts->rach_b_thresh = atoi(argv[0]);
2036 return CMD_SUCCESS;
2037}
2038
2039DEFUN(cfg_bts_rach_nm_ldavg,
2040 cfg_bts_rach_nm_ldavg_cmd,
2041 "rach nm load average <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02002042 RACH_STR NM_STR
Harald Weltecfaabbb2012-08-16 23:23:50 +02002043 "Set the NM Loadaverage Slots value\n"
2044 "Set the NM Loadaverage Slots value\n"
2045 "NM Loadaverage Slots value\n")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08002046{
2047 struct gsm_bts *bts = vty->index;
2048 bts->rach_ldavg_slots = atoi(argv[0]);
2049 return CMD_SUCCESS;
2050}
2051
Harald Welte (local)5dececf2009-08-12 13:28:23 +02002052DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
2053 "cell barred (0|1)",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002054 "Should this cell be barred from access?\n"
2055 "Should this cell be barred from access?\n"
2056 "Cell should NOT be barred\n"
2057 "Cell should be barred\n")
2058
Harald Welte (local)5dececf2009-08-12 13:28:23 +02002059{
2060 struct gsm_bts *bts = vty->index;
2061
Harald Welte71355012009-12-21 23:08:18 +01002062 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02002063
2064 return CMD_SUCCESS;
2065}
2066
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08002067DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd,
2068 "rach emergency call allowed (0|1)",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002069 RACH_STR
2070 "Should this cell allow emergency calls?\n"
2071 "Should this cell allow emergency calls?\n"
2072 "Should this cell allow emergency calls?\n"
2073 "Do NOT allow emergency calls\n"
2074 "Allow emergency calls\n")
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08002075{
2076 struct gsm_bts *bts = vty->index;
2077
2078 if (atoi(argv[0]) == 0)
2079 bts->si_common.rach_control.t2 |= 0x4;
2080 else
2081 bts->si_common.rach_control.t2 &= ~0x4;
2082
2083 return CMD_SUCCESS;
2084}
2085
Ivan Kluchnikov67920592013-09-16 13:13:04 +04002086DEFUN(cfg_bts_rach_ac_class, cfg_bts_rach_ac_class_cmd,
2087 "rach access-control-class (0|1|2|3|4|5|6|7|8|9|11|12|13|14|15) (barred|allowed)",
2088 RACH_STR
2089 "Set access control class\n"
2090 "Access control class 0\n"
2091 "Access control class 1\n"
2092 "Access control class 2\n"
2093 "Access control class 3\n"
2094 "Access control class 4\n"
2095 "Access control class 5\n"
2096 "Access control class 6\n"
2097 "Access control class 7\n"
2098 "Access control class 8\n"
2099 "Access control class 9\n"
2100 "Access control class 11 for PLMN use\n"
2101 "Access control class 12 for security services\n"
2102 "Access control class 13 for public utilities (e.g. water/gas suppliers)\n"
2103 "Access control class 14 for emergency services\n"
2104 "Access control class 15 for PLMN staff\n"
2105 "barred to use access control class\n"
2106 "allowed to use access control class\n")
2107{
2108 struct gsm_bts *bts = vty->index;
2109
2110 uint8_t control_class;
2111 uint8_t allowed = 0;
2112
2113 if (strcmp(argv[1], "allowed") == 0)
2114 allowed = 1;
2115
2116 control_class = atoi(argv[0]);
2117 if (control_class < 8)
2118 if (allowed)
2119 bts->si_common.rach_control.t3 &= ~(0x1 << control_class);
2120 else
2121 bts->si_common.rach_control.t3 |= (0x1 << control_class);
2122 else
2123 if (allowed)
2124 bts->si_common.rach_control.t2 &= ~(0x1 << (control_class - 8));
2125 else
2126 bts->si_common.rach_control.t2 |= (0x1 << (control_class - 8));
2127
2128 return CMD_SUCCESS;
2129}
2130
Harald Welte (local)0e451d02009-08-13 10:14:26 +02002131DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
2132 "ms max power <0-40>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002133 "MS Options\n"
Harald Welted13e0cd2012-08-17 09:52:03 +02002134 "Maximum transmit power of the MS\n"
2135 "Maximum transmit power of the MS\n"
Harald Weltecfaabbb2012-08-16 23:23:50 +02002136 "Maximum transmit power of the MS in dBm")
Harald Welte (local)0e451d02009-08-13 10:14:26 +02002137{
2138 struct gsm_bts *bts = vty->index;
2139
2140 bts->ms_max_power = atoi(argv[0]);
2141
2142 return CMD_SUCCESS;
2143}
2144
Harald Weltecfaabbb2012-08-16 23:23:50 +02002145#define CELL_STR "Cell Parameters\n"
2146
Harald Welte73225282009-12-12 18:17:25 +01002147DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
2148 "cell reselection hysteresis <0-14>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002149 CELL_STR "Cell re-selection parameters\n"
2150 "Cell Re-Selection Hysteresis in dB\n"
Harald Welte73225282009-12-12 18:17:25 +01002151 "Cell Re-Selection Hysteresis in dB")
2152{
2153 struct gsm_bts *bts = vty->index;
2154
2155 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
2156
2157 return CMD_SUCCESS;
2158}
2159
2160DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
2161 "rxlev access min <0-63>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002162 "Minimum RxLev needed for cell access\n"
2163 "Minimum RxLev needed for cell access\n"
2164 "Minimum RxLev needed for cell access\n"
Harald Welte73225282009-12-12 18:17:25 +01002165 "Minimum RxLev needed for cell access (better than -110dBm)")
2166{
2167 struct gsm_bts *bts = vty->index;
2168
2169 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
2170
2171 return CMD_SUCCESS;
2172}
2173
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002174DEFUN(cfg_bts_cell_bar_qualify, cfg_bts_cell_bar_qualify_cmd,
2175 "cell bar qualify (0|1)",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002176 CELL_STR "Cell Bar Qualify\n" "Cell Bar Qualify\n"
2177 "Set CBQ to 0\n" "Set CBQ to 1\n")
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002178{
2179 struct gsm_bts *bts = vty->index;
2180
2181 bts->si_common.cell_ro_sel_par.present = 1;
2182 bts->si_common.cell_ro_sel_par.cbq = atoi(argv[0]);
2183
2184 return CMD_SUCCESS;
2185}
2186
2187DEFUN(cfg_bts_cell_resel_ofs, cfg_bts_cell_resel_ofs_cmd,
2188 "cell reselection offset <0-126>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002189 CELL_STR "Cell Re-Selection Parameters\n"
2190 "Cell Re-Selection Offset (CRO) in dB\n"
2191 "Cell Re-Selection Offset (CRO) in dB\n"
2192 )
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002193{
2194 struct gsm_bts *bts = vty->index;
2195
2196 bts->si_common.cell_ro_sel_par.present = 1;
2197 bts->si_common.cell_ro_sel_par.cell_resel_off = atoi(argv[0])/2;
2198
2199 return CMD_SUCCESS;
2200}
2201
2202DEFUN(cfg_bts_temp_ofs, cfg_bts_temp_ofs_cmd,
2203 "temporary offset <0-60>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002204 "Cell selection temporary negative offset\n"
2205 "Cell selection temporary negative offset\n"
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002206 "Cell selection temporary negative offset in dB")
2207{
2208 struct gsm_bts *bts = vty->index;
2209
2210 bts->si_common.cell_ro_sel_par.present = 1;
2211 bts->si_common.cell_ro_sel_par.temp_offs = atoi(argv[0])/10;
2212
2213 return CMD_SUCCESS;
2214}
2215
2216DEFUN(cfg_bts_temp_ofs_inf, cfg_bts_temp_ofs_inf_cmd,
2217 "temporary offset infinite",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002218 "Cell selection temporary negative offset\n"
2219 "Cell selection temporary negative offset\n"
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002220 "Sets cell selection temporary negative offset to infinity")
2221{
2222 struct gsm_bts *bts = vty->index;
2223
2224 bts->si_common.cell_ro_sel_par.present = 1;
2225 bts->si_common.cell_ro_sel_par.temp_offs = 7;
2226
2227 return CMD_SUCCESS;
2228}
2229
2230DEFUN(cfg_bts_penalty_time, cfg_bts_penalty_time_cmd,
2231 "penalty time <20-620>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002232 "Cell selection penalty time\n"
2233 "Cell selection penalty time\n"
2234 "Cell selection penalty time in seconds (by 20s increments)\n")
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002235{
2236 struct gsm_bts *bts = vty->index;
2237
2238 bts->si_common.cell_ro_sel_par.present = 1;
2239 bts->si_common.cell_ro_sel_par.penalty_time = (atoi(argv[0])-20)/20;
2240
2241 return CMD_SUCCESS;
2242}
2243
2244DEFUN(cfg_bts_penalty_time_rsvd, cfg_bts_penalty_time_rsvd_cmd,
2245 "penalty time reserved",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002246 "Cell selection penalty time\n"
2247 "Cell selection penalty time\n"
2248 "Set cell selection penalty time to reserved value 31, "
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002249 "(indicate that CELL_RESELECT_OFFSET is subtracted from C2 "
2250 "and TEMPORARY_OFFSET is ignored)")
2251{
2252 struct gsm_bts *bts = vty->index;
2253
2254 bts->si_common.cell_ro_sel_par.present = 1;
2255 bts->si_common.cell_ro_sel_par.penalty_time = 31;
2256
2257 return CMD_SUCCESS;
2258}
2259
Harald Welte (local)efc92312009-08-14 23:09:25 +02002260DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
Daniel Willmann4d62d632012-12-27 00:02:01 +01002261 "periodic location update <6-1530>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002262 "Periodic Location Updating Interval\n"
2263 "Periodic Location Updating Interval\n"
2264 "Periodic Location Updating Interval\n"
2265 "Periodic Location Updating Interval in Minutes\n")
Harald Welte (local)efc92312009-08-14 23:09:25 +02002266{
2267 struct gsm_bts *bts = vty->index;
2268
Dieter Spaard6613e02010-10-05 21:10:55 +02002269 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 6;
Harald Welte (local)efc92312009-08-14 23:09:25 +02002270
2271 return CMD_SUCCESS;
2272}
2273
Holger Hans Peter Freytherc63f6f12013-07-27 21:07:57 +02002274DEFUN(cfg_bts_no_per_loc_upd, cfg_bts_no_per_loc_upd_cmd,
2275 "no periodic location update",
2276 NO_STR
2277 "Periodic Location Updating Interval\n"
2278 "Periodic Location Updating Interval\n"
2279 "Periodic Location Updating Interval\n")
2280{
2281 struct gsm_bts *bts = vty->index;
2282
2283 bts->si_common.chan_desc.t3212 = 0;
Andreas Eversberg4d4944a2013-03-10 11:49:35 +01002284
2285 return CMD_SUCCESS;
2286}
2287
2288DEFUN(cfg_bts_radio_link_timeout, cfg_bts_radio_link_timeout_cmd,
2289 "radio-link-timeout <4-64>",
2290 "Radio link timeout criterion (BTS side)\n"
2291 "Radio link timeout value (lost SACCH block)\n")
2292{
2293 struct gsm_bts *bts = vty->index;
2294
2295 set_radio_link_timeout(&bts->si_common.cell_options, atoi(argv[0]));
2296
Holger Hans Peter Freytherc63f6f12013-07-27 21:07:57 +02002297 return CMD_SUCCESS;
2298}
2299
Harald Welte8f0ed552010-05-11 21:53:49 +02002300#define GPRS_TEXT "GPRS Packet Network\n"
2301
Harald Welteaf387632010-03-14 23:30:30 +08002302DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welte57ba7e32010-04-18 14:00:26 +02002303 "gprs cell bvci <2-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02002304 GPRS_TEXT
2305 "GPRS Cell Settings\n"
Harald Weltecfaabbb2012-08-16 23:23:50 +02002306 "GPRS BSSGP VC Identifier\n"
Harald Welte97a282b2010-03-14 15:37:43 +08002307 "GPRS BSSGP VC Identifier")
2308{
2309 struct gsm_bts *bts = vty->index;
2310
Harald Welte4511d892010-04-18 15:51:20 +02002311 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08002312 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2313 return CMD_WARNING;
2314 }
2315
Harald Welte97a282b2010-03-14 15:37:43 +08002316 bts->gprs.cell.bvci = atoi(argv[0]);
2317
2318 return CMD_SUCCESS;
2319}
2320
Harald Weltea5731cf2010-03-22 11:48:36 +08002321DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
2322 "gprs nsei <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02002323 GPRS_TEXT
Harald Weltecfaabbb2012-08-16 23:23:50 +02002324 "GPRS NS Entity Identifier\n"
Harald Weltea5731cf2010-03-22 11:48:36 +08002325 "GPRS NS Entity Identifier")
2326{
2327 struct gsm_bts *bts = vty->index;
2328
Harald Welte4511d892010-04-18 15:51:20 +02002329 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltea5731cf2010-03-22 11:48:36 +08002330 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2331 return CMD_WARNING;
2332 }
2333
2334 bts->gprs.nse.nsei = atoi(argv[0]);
2335
2336 return CMD_SUCCESS;
2337}
2338
Harald Welte8f0ed552010-05-11 21:53:49 +02002339#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
2340 "NSVC Logical Number\n"
Harald Weltea5731cf2010-03-22 11:48:36 +08002341
Harald Welte97a282b2010-03-14 15:37:43 +08002342DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
2343 "gprs nsvc <0-1> nsvci <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02002344 GPRS_TEXT NSVC_TEXT
2345 "NS Virtual Connection Identifier\n"
Harald Welte97a282b2010-03-14 15:37:43 +08002346 "GPRS NS VC Identifier")
2347{
2348 struct gsm_bts *bts = vty->index;
2349 int idx = atoi(argv[0]);
2350
Harald Welte4511d892010-04-18 15:51:20 +02002351 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08002352 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2353 return CMD_WARNING;
2354 }
2355
Harald Welte97a282b2010-03-14 15:37:43 +08002356 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
2357
2358 return CMD_SUCCESS;
2359}
2360
Harald Welteaf387632010-03-14 23:30:30 +08002361DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
2362 "gprs nsvc <0-1> local udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02002363 GPRS_TEXT NSVC_TEXT
Harald Weltecfaabbb2012-08-16 23:23:50 +02002364 "GPRS NS Local UDP Port\n"
2365 "GPRS NS Local UDP Port\n"
2366 "GPRS NS Local UDP Port\n"
Harald Welte13fe2192012-08-17 09:57:25 +02002367 "GPRS NS Local UDP Port Number\n")
Harald Welteaf387632010-03-14 23:30:30 +08002368{
2369 struct gsm_bts *bts = vty->index;
2370 int idx = atoi(argv[0]);
2371
Harald Welte4511d892010-04-18 15:51:20 +02002372 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08002373 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2374 return CMD_WARNING;
2375 }
2376
Harald Welteaf387632010-03-14 23:30:30 +08002377 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
2378
2379 return CMD_SUCCESS;
2380}
2381
2382DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
2383 "gprs nsvc <0-1> remote udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02002384 GPRS_TEXT NSVC_TEXT
Harald Weltecfaabbb2012-08-16 23:23:50 +02002385 "GPRS NS Remote UDP Port\n"
2386 "GPRS NS Remote UDP Port\n"
Harald Welte13fe2192012-08-17 09:57:25 +02002387 "GPRS NS Remote UDP Port\n"
2388 "GPRS NS Remote UDP Port Number\n")
Harald Welteaf387632010-03-14 23:30:30 +08002389{
2390 struct gsm_bts *bts = vty->index;
2391 int idx = atoi(argv[0]);
2392
Harald Welte4511d892010-04-18 15:51:20 +02002393 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08002394 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2395 return CMD_WARNING;
2396 }
2397
Harald Welteaf387632010-03-14 23:30:30 +08002398 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
2399
2400 return CMD_SUCCESS;
2401}
2402
2403DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
2404 "gprs nsvc <0-1> remote ip A.B.C.D",
Harald Welte8f0ed552010-05-11 21:53:49 +02002405 GPRS_TEXT NSVC_TEXT
Harald Weltecfaabbb2012-08-16 23:23:50 +02002406 "GPRS NS Remote IP Address\n"
2407 "GPRS NS Remote IP Address\n"
2408 "GPRS NS Remote IP Address\n")
Harald Welteaf387632010-03-14 23:30:30 +08002409{
2410 struct gsm_bts *bts = vty->index;
2411 int idx = atoi(argv[0]);
2412 struct in_addr ia;
2413
Harald Welte4511d892010-04-18 15:51:20 +02002414 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08002415 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2416 return CMD_WARNING;
2417 }
2418
Harald Welteaf387632010-03-14 23:30:30 +08002419 inet_aton(argv[1], &ia);
2420 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
2421
2422 return CMD_SUCCESS;
2423}
2424
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08002425DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd,
Harald Weltecfaabbb2012-08-16 23:23:50 +02002426 "paging free <-1-1024>",
2427 "Paging options\n"
2428 "Only page when having a certain amount of free slots\n"
2429 "amount of required free paging slots. -1 to disable\n")
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08002430{
2431 struct gsm_bts *bts = vty->index;
2432
2433 bts->paging.free_chans_need = atoi(argv[0]);
2434 return CMD_SUCCESS;
2435}
2436
Harald Welte615e9562010-05-11 23:50:21 +02002437DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd,
2438 "gprs ns timer " NS_TIMERS " <0-255>",
2439 GPRS_TEXT "Network Service\n"
2440 "Network Service Timer\n"
2441 NS_TIMERS_HELP "Timer Value\n")
2442{
2443 struct gsm_bts *bts = vty->index;
2444 int idx = get_string_value(gprs_ns_timer_strs, argv[0]);
2445 int val = atoi(argv[1]);
2446
2447 if (bts->gprs.mode == BTS_GPRS_NONE) {
2448 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2449 return CMD_WARNING;
2450 }
2451
2452 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
2453 return CMD_WARNING;
2454
2455 bts->gprs.nse.timer[idx] = val;
2456
2457 return CMD_SUCCESS;
2458}
2459
2460#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 +02002461#define BSSGP_TIMERS_HELP \
2462 "Tbvc-block timeout\n" \
2463 "Tbvc-block retries\n" \
2464 "Tbvc-unblock retries\n" \
2465 "Tbvcc-reset timeout\n" \
2466 "Tbvc-reset retries\n" \
2467 "Tbvc-suspend timeout\n" \
2468 "Tbvc-suspend retries\n" \
2469 "Tbvc-resume timeout\n" \
2470 "Tbvc-resume retries\n" \
2471 "Tbvc-capa-update timeout\n" \
2472 "Tbvc-capa-update retries\n"
Harald Welte615e9562010-05-11 23:50:21 +02002473
2474DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd,
2475 "gprs cell timer " BSSGP_TIMERS " <0-255>",
2476 GPRS_TEXT "Cell / BSSGP\n"
2477 "Cell/BSSGP Timer\n"
2478 BSSGP_TIMERS_HELP "Timer Value\n")
2479{
2480 struct gsm_bts *bts = vty->index;
2481 int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
2482 int val = atoi(argv[1]);
2483
2484 if (bts->gprs.mode == BTS_GPRS_NONE) {
2485 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2486 return CMD_WARNING;
2487 }
2488
2489 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer))
2490 return CMD_WARNING;
2491
2492 bts->gprs.cell.timer[idx] = val;
2493
2494 return CMD_SUCCESS;
2495}
2496
Harald Welte97a282b2010-03-14 15:37:43 +08002497DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
2498 "gprs routing area <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02002499 GPRS_TEXT
Harald Weltecfaabbb2012-08-16 23:23:50 +02002500 "GPRS Routing Area Code\n"
2501 "GPRS Routing Area Code\n"
2502 "GPRS Routing Area Code\n")
Harald Welte97a282b2010-03-14 15:37:43 +08002503{
2504 struct gsm_bts *bts = vty->index;
2505
Harald Welte4511d892010-04-18 15:51:20 +02002506 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08002507 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2508 return CMD_WARNING;
2509 }
2510
Harald Welte97a282b2010-03-14 15:37:43 +08002511 bts->gprs.rac = atoi(argv[0]);
2512
2513 return CMD_SUCCESS;
2514}
2515
Max292ec582016-07-28 11:55:37 +02002516DEFUN(cfg_bts_gprs_ctrl_ack, cfg_bts_gprs_ctrl_ack_cmd,
2517 "gprs control-ack-type-rach", GPRS_TEXT
2518 "Set GPRS Control Ack Type for PACKET CONTROL ACKNOWLEDGMENT message to "
2519 "four access bursts format instead of default RLC/MAC control block\n")
2520{
2521 struct gsm_bts *bts = vty->index;
2522
2523 if (bts->gprs.mode == BTS_GPRS_NONE) {
2524 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2525 return CMD_WARNING;
2526 }
2527
2528 bts->gprs.ctrl_ack_type_use_block = false;
2529
2530 return CMD_SUCCESS;
2531}
2532
2533DEFUN(cfg_no_bts_gprs_ctrl_ack, cfg_no_bts_gprs_ctrl_ack_cmd,
2534 "no gprs control-ack-type-rach", NO_STR GPRS_TEXT
2535 "Set GPRS Control Ack Type for PACKET CONTROL ACKNOWLEDGMENT message to "
2536 "four access bursts format instead of default RLC/MAC control block\n")
2537{
2538 struct gsm_bts *bts = vty->index;
2539
2540 if (bts->gprs.mode == BTS_GPRS_NONE) {
2541 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2542 return CMD_WARNING;
2543 }
2544
2545 bts->gprs.ctrl_ack_type_use_block = true;
2546
2547 return CMD_SUCCESS;
2548}
2549
Andreas Eversberg0c8f9ca2013-03-16 16:31:26 +01002550DEFUN(cfg_bts_gprs_net_ctrl_ord, cfg_bts_gprs_net_ctrl_ord_cmd,
2551 "gprs network-control-order (nc0|nc1|nc2)",
2552 GPRS_TEXT
2553 "GPRS Network Control Order\n"
2554 "MS controlled cell re-selection, no measurement reporting\n"
2555 "MS controlled cell re-selection, MS sends measurement reports\n"
2556 "Network controlled cell re-selection, MS sends measurement reports\n")
2557{
2558 struct gsm_bts *bts = vty->index;
2559
2560 if (bts->gprs.mode == BTS_GPRS_NONE) {
2561 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2562 return CMD_WARNING;
2563 }
2564
2565 bts->gprs.net_ctrl_ord = atoi(argv[0] + 2);
2566
2567 return CMD_SUCCESS;
2568}
2569
Harald Welte4511d892010-04-18 15:51:20 +02002570DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
2571 "gprs mode (none|gprs|egprs)",
Harald Welte8f0ed552010-05-11 21:53:49 +02002572 GPRS_TEXT
2573 "GPRS Mode for this BTS\n"
2574 "GPRS Disabled on this BTS\n"
2575 "GPRS Enabled on this BTS\n"
2576 "EGPRS (EDGE) Enabled on this BTS\n")
Harald Welteaf387632010-03-14 23:30:30 +08002577{
2578 struct gsm_bts *bts = vty->index;
Holger Hans Peter Freyther4e13a8f2015-01-31 22:16:00 +01002579 enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0], NULL);
Harald Welteaf387632010-03-14 23:30:30 +08002580
Holger Hans Peter Freyther4e13a8f2015-01-31 22:16:00 +01002581 if (!bts_gprs_mode_is_compat(bts, mode)) {
Harald Weltef3d8e922010-06-14 22:44:42 +02002582 vty_out(vty, "This BTS type does not support %s%s", argv[0],
2583 VTY_NEWLINE);
2584 return CMD_WARNING;
2585 }
2586
2587 bts->gprs.mode = mode;
Harald Welteaf387632010-03-14 23:30:30 +08002588
2589 return CMD_SUCCESS;
2590}
2591
bhargava350533c2016-07-21 11:14:34 +05302592DEFUN(cfg_bts_gprs_11bit_rach_support_for_egprs,
2593 cfg_bts_gprs_11bit_rach_support_for_egprs_cmd,
2594 "gprs 11bit_rach_support_for_egprs (0|1)",
2595 GPRS_TEXT "11 bit RACH options\n"
2596 "Disable 11 bit RACH for EGPRS\n"
2597 "Enable 11 bit RACH for EGPRS")
2598{
2599 struct gsm_bts *bts = vty->index;
2600
2601 bts->gprs.supports_egprs_11bit_rach = atoi(argv[0]);
2602
2603 if (bts->gprs.supports_egprs_11bit_rach > 1) {
2604 vty_out(vty, "Error in RACH type%s", VTY_NEWLINE);
2605 return CMD_WARNING;
2606 }
2607
2608 if ((bts->gprs.mode == BTS_GPRS_NONE) &&
2609 (bts->gprs.supports_egprs_11bit_rach == 1)) {
2610 vty_out(vty, "Error:gprs mode is none and 11bit rach is"
2611 " enabled%s", VTY_NEWLINE);
2612 return CMD_WARNING;
2613 }
2614
2615 return CMD_SUCCESS;
2616}
2617
Harald Welte9fbff4a2010-07-30 11:50:09 +02002618#define SI_TEXT "System Information Messages\n"
2619#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)"
2620#define SI_TYPE_HELP "System Information Type 1\n" \
2621 "System Information Type 2\n" \
2622 "System Information Type 3\n" \
2623 "System Information Type 4\n" \
2624 "System Information Type 5\n" \
2625 "System Information Type 6\n" \
2626 "System Information Type 7\n" \
2627 "System Information Type 8\n" \
2628 "System Information Type 9\n" \
2629 "System Information Type 10\n" \
2630 "System Information Type 13\n" \
2631 "System Information Type 16\n" \
2632 "System Information Type 17\n" \
2633 "System Information Type 18\n" \
2634 "System Information Type 19\n" \
2635 "System Information Type 20\n" \
2636 "System Information Type 2bis\n" \
2637 "System Information Type 2ter\n" \
2638 "System Information Type 2quater\n" \
2639 "System Information Type 5bis\n" \
2640 "System Information Type 5ter\n"
2641
2642DEFUN(cfg_bts_si_mode, cfg_bts_si_mode_cmd,
2643 "system-information " SI_TYPE_TEXT " mode (static|computed)",
2644 SI_TEXT SI_TYPE_HELP
2645 "System Information Mode\n"
2646 "Static user-specified\n"
2647 "Dynamic, BSC-computed\n")
2648{
2649 struct gsm_bts *bts = vty->index;
2650 int type;
2651
2652 type = get_string_value(osmo_sitype_strs, argv[0]);
2653 if (type < 0) {
2654 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2655 return CMD_WARNING;
2656 }
2657
2658 if (!strcmp(argv[1], "static"))
2659 bts->si_mode_static |= (1 << type);
2660 else
2661 bts->si_mode_static &= ~(1 << type);
2662
2663 return CMD_SUCCESS;
2664}
2665
2666DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd,
2667 "system-information " SI_TYPE_TEXT " static HEXSTRING",
2668 SI_TEXT SI_TYPE_HELP
2669 "Static System Information filling\n"
2670 "Static user-specified SI content in HEX notation\n")
2671{
2672 struct gsm_bts *bts = vty->index;
2673 int rc, type;
2674
2675 type = get_string_value(osmo_sitype_strs, argv[0]);
2676 if (type < 0) {
2677 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2678 return CMD_WARNING;
2679 }
2680
2681 if (!(bts->si_mode_static & (1 << type))) {
2682 vty_out(vty, "SI Type %s is not configured in static mode%s",
2683 get_value_string(osmo_sitype_strs, type), VTY_NEWLINE);
2684 return CMD_WARNING;
2685 }
2686
Harald Welte290aaed2010-07-30 11:53:18 +02002687 /* Fill buffer with padding pattern */
2688 memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type]));
2689
2690 /* Parse the user-specified SI in hex format, [partially] overwriting padding */
Pablo Neira Ayusoc0d17f22011-05-07 12:12:48 +02002691 rc = osmo_hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0]));
Harald Welte9fbff4a2010-07-30 11:50:09 +02002692 if (rc < 0 || rc > sizeof(bts->si_buf[0])) {
2693 vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
2694 return CMD_WARNING;
2695 }
2696
2697 /* Mark this SI as present */
2698 bts->si_valid |= (1 << type);
2699
2700 return CMD_SUCCESS;
2701}
2702
Harald Welte42def722017-01-13 00:10:32 +01002703DEFUN(cfg_bts_early_cm, cfg_bts_early_cm_cmd,
2704 "early-classmark-sending (allowed|forbidden)",
2705 "Early Classmark Sending\n"
2706 "Early Classmark Sending is allowed\n"
2707 "Early Classmark Sending is forbidden\n")
2708{
2709 struct gsm_bts *bts = vty->index;
Harald Welte42def722017-01-13 00:10:32 +01002710
2711 if (!strcmp(argv[0], "allowed"))
2712 bts->early_classmark_allowed = true;
2713 else
2714 bts->early_classmark_allowed = false;
2715
2716 return CMD_SUCCESS;
2717}
2718
Harald Welte32c09622011-01-11 23:44:56 +01002719DEFUN(cfg_bts_neigh_mode, cfg_bts_neigh_mode_cmd,
Harald Welte64c07d22011-02-15 11:43:27 +01002720 "neighbor-list mode (automatic|manual|manual-si5)",
Harald Welte32c09622011-01-11 23:44:56 +01002721 "Neighbor List\n" "Mode of Neighbor List generation\n"
Harald Welte64c07d22011-02-15 11:43:27 +01002722 "Automatically from all BTS in this OpenBSC\n" "Manual\n"
2723 "Manual with different lists for SI2 and SI5\n")
Harald Welte32c09622011-01-11 23:44:56 +01002724{
2725 struct gsm_bts *bts = vty->index;
Harald Welte64c07d22011-02-15 11:43:27 +01002726 int mode = get_string_value(bts_neigh_mode_strs, argv[0]);
Harald Welte32c09622011-01-11 23:44:56 +01002727
Harald Welte64c07d22011-02-15 11:43:27 +01002728 switch (mode) {
2729 case NL_MODE_MANUAL_SI5SEP:
2730 case NL_MODE_MANUAL:
Harald Welte32c09622011-01-11 23:44:56 +01002731 /* make sure we clear the current list when switching to
2732 * manual mode */
2733 if (bts->neigh_list_manual_mode == 0)
2734 memset(&bts->si_common.data.neigh_list, 0,
2735 sizeof(bts->si_common.data.neigh_list));
Harald Welte64c07d22011-02-15 11:43:27 +01002736 break;
2737 default:
2738 break;
2739 }
2740
2741 bts->neigh_list_manual_mode = mode;
Harald Welte32c09622011-01-11 23:44:56 +01002742
2743 return CMD_SUCCESS;
2744}
2745
2746DEFUN(cfg_bts_neigh, cfg_bts_neigh_cmd,
Harald Welte1fe73a12012-01-29 13:24:12 +01002747 "neighbor-list (add|del) arfcn <0-1023>",
Harald Welte32c09622011-01-11 23:44:56 +01002748 "Neighbor List\n" "Add to manual neighbor list\n"
2749 "Delete from manual neighbor list\n" "ARFCN of neighbor\n"
2750 "ARFCN of neighbor\n")
2751{
2752 struct gsm_bts *bts = vty->index;
2753 struct bitvec *bv = &bts->si_common.neigh_list;
2754 uint16_t arfcn = atoi(argv[1]);
2755
2756 if (!bts->neigh_list_manual_mode) {
2757 vty_out(vty, "%% Cannot configure neighbor list in "
2758 "automatic mode%s", VTY_NEWLINE);
2759 return CMD_WARNING;
2760 }
2761
2762 if (!strcmp(argv[0], "add"))
2763 bitvec_set_bit_pos(bv, arfcn, 1);
2764 else
2765 bitvec_set_bit_pos(bv, arfcn, 0);
2766
2767 return CMD_SUCCESS;
2768}
2769
Max59a1bf32016-04-15 16:04:46 +02002770DEFUN(cfg_bts_si2quater_neigh_add, cfg_bts_si2quater_neigh_add_cmd,
Max2c16bee2017-02-15 13:51:37 +01002771 "si2quater neighbor-list add earfcn <0-65535> thresh-hi <0-31> "
2772 "thresh-lo <0-32> prio <0-8> qrxlv <0-32> meas <0-8>",
2773 "SI2quater Neighbor List\n" "SI2quater Neighbor List\n"
2774 "Add to manual SI2quater neighbor list\n"
2775 "EARFCN of neighbor\n" "EARFCN of neighbor\n"
2776 "threshold high bits\n" "threshold high bits\n"
2777 "threshold low bits\n" "threshold low bits (32 means NA)\n"
2778 "priority\n" "priority (8 means NA)\n"
2779 "QRXLEVMIN\n" "QRXLEVMIN (32 means NA)\n"
2780 "measurement bandwidth\n" "measurement bandwidth (8 means NA)\n")
Max59a1bf32016-04-15 16:04:46 +02002781{
2782 struct gsm_bts *bts = vty->index;
2783 struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list;
2784 uint16_t arfcn = atoi(argv[0]);
Max2c16bee2017-02-15 13:51:37 +01002785 uint8_t thresh_hi = atoi(argv[1]), thresh_lo = atoi(argv[2]),
2786 prio = atoi(argv[3]), qrx = atoi(argv[4]), meas = atoi(argv[5]);
2787 int r = osmo_earfcn_add(e, arfcn,
2788 (meas < 8) ? meas : OSMO_EARFCN_MEAS_INVALID);
Max59a1bf32016-04-15 16:04:46 +02002789
2790 if (r < 0) {
Max2c16bee2017-02-15 13:51:37 +01002791 vty_out(vty, "Unable to add ARFCN %u: %s%s", arfcn, strerror(-r),
Max59a1bf32016-04-15 16:04:46 +02002792 VTY_NEWLINE);
2793 return CMD_WARNING;
2794 }
2795
Max2c16bee2017-02-15 13:51:37 +01002796 if (e->thresh_hi && thresh_hi != e->thresh_hi)
2797 vty_out(vty, "Warning: multiple threshold-high are not "
2798 "supported, overriding previous threshold %u%s",
2799 e->thresh_hi, VTY_NEWLINE);
2800
2801 e->thresh_hi = thresh_hi;
2802
2803 if (thresh_lo != 32) {
2804 if (e->thresh_lo_valid && e->thresh_lo != thresh_lo)
2805 vty_out(vty, "Warning: multiple threshold-low are not "
2806 "supported, overriding previous threshold %u%s",
2807 e->thresh_lo, VTY_NEWLINE);
2808 e->thresh_lo = thresh_lo;
2809 e->thresh_lo_valid = true;
Maxaafff962016-04-20 15:57:14 +02002810 }
Max2c16bee2017-02-15 13:51:37 +01002811
2812 if (qrx != 32) {
2813 if (e->qrxlm_valid && e->qrxlm != qrx)
2814 vty_out(vty, "Warning: multiple QRXLEVMIN are not "
2815 "supported, overriding previous value %u%s",
2816 e->qrxlm, VTY_NEWLINE);
2817 e->qrxlm = qrx;
2818 e->qrxlm_valid = true;
2819 }
2820
2821 if (prio != 8) {
2822 if (e->prio_valid && e->prio != prio)
2823 vty_out(vty, "Warning: multiple priorities are not "
2824 "supported, overriding previous value %u%s",
2825 e->prio, VTY_NEWLINE);
2826 e->prio = prio;
2827 e->prio_valid = true;
2828 }
2829
2830 if (si2q_size_check(bts))
2831 return CMD_SUCCESS;
2832
2833 vty_out(vty, "Warning: not enough space in SI2quater for a given EARFCN "
2834 "%u%s", arfcn, VTY_NEWLINE);
Maxaafff962016-04-20 15:57:14 +02002835 osmo_earfcn_del(e, arfcn);
Max2c16bee2017-02-15 13:51:37 +01002836
Maxaafff962016-04-20 15:57:14 +02002837 return CMD_WARNING;
Max59a1bf32016-04-15 16:04:46 +02002838}
2839
2840DEFUN(cfg_bts_si2quater_neigh_del, cfg_bts_si2quater_neigh_del_cmd,
Max35697b92016-04-29 12:51:31 +02002841 "si2quater neighbor-list del earfcn <0-65535>",
Max59a1bf32016-04-15 16:04:46 +02002842 "SI2quater Neighbor List\n"
2843 "SI2quater Neighbor List\n"
2844 "Delete from SI2quater manual neighbor list\n"
Max36212f22016-04-20 12:06:05 +02002845 "EARFCN of neighbor\n"
2846 "EARFCN\n")
Max59a1bf32016-04-15 16:04:46 +02002847{
2848 struct gsm_bts *bts = vty->index;
2849 struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list;
Max0c1bc262016-04-20 12:06:06 +02002850 uint16_t arfcn = atoi(argv[0]);
Max59a1bf32016-04-15 16:04:46 +02002851 int r = osmo_earfcn_del(e, arfcn);
2852 if (r < 0) {
2853 vty_out(vty, "Unable to delete arfcn %u: %s%s", arfcn,
Max0c1bc262016-04-20 12:06:06 +02002854 strerror(-r), VTY_NEWLINE);
Max59a1bf32016-04-15 16:04:46 +02002855 return CMD_WARNING;
2856 }
2857
2858 return CMD_SUCCESS;
2859}
2860
Max26679e02016-04-20 15:57:13 +02002861DEFUN(cfg_bts_si2quater_uarfcn_add, cfg_bts_si2quater_uarfcn_add_cmd,
Max35697b92016-04-29 12:51:31 +02002862 "si2quater neighbor-list add uarfcn <0-16383> <0-511> <0-1>",
Max26679e02016-04-20 15:57:13 +02002863 "SI2quater Neighbor List\n"
2864 "SI2quater Neighbor List\n" "Add to manual SI2quater neighbor list\n"
2865 "UARFCN of neighbor\n" "UARFCN of neighbor\n" "scrambling code\n"
2866 "diversity bit\n")
2867{
2868 struct gsm_bts *bts = vty->index;
2869 uint16_t arfcn = atoi(argv[0]), scramble = atoi(argv[1]);
2870
2871 switch(bts_uarfcn_add(bts, arfcn, scramble, atoi(argv[2]))) {
2872 case -ENOMEM:
2873 vty_out(vty, "Unable to add arfcn: max number of UARFCNs (%u) "
2874 "reached%s", MAX_EARFCN_LIST, VTY_NEWLINE);
Harald Weltea191dcd2016-11-26 15:06:37 +01002875 return CMD_WARNING;
Maxaafff962016-04-20 15:57:14 +02002876 case -ENOSPC:
2877 vty_out(vty, "Warning: not enough space in si2quater for a "
2878 "given arfcn%s", VTY_NEWLINE);
Harald Weltea191dcd2016-11-26 15:06:37 +01002879 return CMD_WARNING;
Max26679e02016-04-20 15:57:13 +02002880 case -EADDRINUSE:
2881 vty_out(vty, "Unable to add arfcn: (%u, %u) is already added%s",
2882 arfcn, scramble, VTY_NEWLINE);
2883 return CMD_WARNING;
2884 }
2885
2886 return CMD_SUCCESS;
2887}
2888
2889DEFUN(cfg_bts_si2quater_uarfcn_del, cfg_bts_si2quater_uarfcn_del_cmd,
Max35697b92016-04-29 12:51:31 +02002890 "si2quater neighbor-list del uarfcn <0-16383> <0-511>",
Max26679e02016-04-20 15:57:13 +02002891 "SI2quater Neighbor List\n"
2892 "SI2quater Neighbor List\n"
2893 "Delete from SI2quater manual neighbor list\n"
2894 "UARFCN of neighbor\n"
2895 "UARFCN\n"
2896 "scrambling code\n")
2897{
2898 struct gsm_bts *bts = vty->index;
2899
2900 if (bts_uarfcn_del(bts, atoi(argv[0]), atoi(argv[1])) < 0) {
2901 vty_out(vty, "Unable to delete uarfcn: pair not found%s",
2902 VTY_NEWLINE);
2903 return CMD_WARNING;
2904 }
2905
2906 return CMD_SUCCESS;
2907}
2908
Harald Welte64c07d22011-02-15 11:43:27 +01002909DEFUN(cfg_bts_si5_neigh, cfg_bts_si5_neigh_cmd,
Harald Welte1fe73a12012-01-29 13:24:12 +01002910 "si5 neighbor-list (add|del) arfcn <0-1023>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002911 "SI5 Neighbor List\n"
Harald Welte64c07d22011-02-15 11:43:27 +01002912 "SI5 Neighbor List\n" "Add to manual SI5 neighbor list\n"
2913 "Delete from SI5 manual neighbor list\n" "ARFCN of neighbor\n"
2914 "ARFCN of neighbor\n")
2915{
2916 struct gsm_bts *bts = vty->index;
2917 struct bitvec *bv = &bts->si_common.si5_neigh_list;
2918 uint16_t arfcn = atoi(argv[1]);
2919
2920 if (!bts->neigh_list_manual_mode) {
2921 vty_out(vty, "%% Cannot configure neighbor list in "
2922 "automatic mode%s", VTY_NEWLINE);
2923 return CMD_WARNING;
2924 }
2925
2926 if (!strcmp(argv[0], "add"))
2927 bitvec_set_bit_pos(bv, arfcn, 1);
2928 else
2929 bitvec_set_bit_pos(bv, arfcn, 0);
2930
2931 return CMD_SUCCESS;
2932}
Harald Welte9fbff4a2010-07-30 11:50:09 +02002933
Holger Hans Peter Freythere30d40d2012-07-20 10:27:31 +02002934#define EXCL_RFLOCK_STR "Exclude this BTS from the global RF Lock\n"
2935
2936DEFUN(cfg_bts_excl_rf_lock,
2937 cfg_bts_excl_rf_lock_cmd,
2938 "rf-lock-exclude",
2939 EXCL_RFLOCK_STR)
2940{
2941 struct gsm_bts *bts = vty->index;
2942 bts->excl_from_rf_lock = 1;
2943 return CMD_SUCCESS;
2944}
2945
2946DEFUN(cfg_bts_no_excl_rf_lock,
2947 cfg_bts_no_excl_rf_lock_cmd,
2948 "no rf-lock-exclude",
2949 NO_STR EXCL_RFLOCK_STR)
2950{
2951 struct gsm_bts *bts = vty->index;
2952 bts->excl_from_rf_lock = 0;
2953 return CMD_SUCCESS;
2954}
2955
Jacob Erlbeck65d114f2014-01-16 11:02:14 +01002956#define FORCE_COMB_SI_STR "Force the generation of a single SI (no ter/bis)\n"
2957
2958DEFUN(cfg_bts_force_comb_si,
2959 cfg_bts_force_comb_si_cmd,
2960 "force-combined-si",
2961 FORCE_COMB_SI_STR)
2962{
2963 struct gsm_bts *bts = vty->index;
2964 bts->force_combined_si = 1;
2965 return CMD_SUCCESS;
2966}
2967
2968DEFUN(cfg_bts_no_force_comb_si,
2969 cfg_bts_no_force_comb_si_cmd,
2970 "no force-combined-si",
2971 NO_STR FORCE_COMB_SI_STR)
2972{
2973 struct gsm_bts *bts = vty->index;
2974 bts->force_combined_si = 0;
2975 return CMD_SUCCESS;
2976}
2977
Andreas Eversberga83d5112013-12-07 18:32:28 +01002978static void _get_codec_from_arg(struct vty *vty, int argc, const char *argv[])
2979{
2980 struct gsm_bts *bts = vty->index;
2981 struct bts_codec_conf *codec = &bts->codec;
2982 int i;
2983
2984 codec->hr = 0;
2985 codec->efr = 0;
2986 codec->amr = 0;
2987 for (i = 0; i < argc; i++) {
2988 if (!strcmp(argv[i], "hr"))
2989 codec->hr = 1;
2990 if (!strcmp(argv[i], "efr"))
2991 codec->efr = 1;
2992 if (!strcmp(argv[i], "amr"))
2993 codec->amr = 1;
2994 }
2995}
2996
2997#define CODEC_PAR_STR " (hr|efr|amr)"
2998#define CODEC_HELP_STR "Half Rate\n" \
2999 "Enhanced Full Rate\nAdaptive Multirate\n"
3000
3001DEFUN(cfg_bts_codec0, cfg_bts_codec0_cmd,
3002 "codec-support fr",
3003 "Codec Support settings\nFullrate\n")
3004{
3005 _get_codec_from_arg(vty, 0, argv);
3006 return CMD_SUCCESS;
3007}
3008
3009DEFUN(cfg_bts_codec1, cfg_bts_codec1_cmd,
3010 "codec-support fr" CODEC_PAR_STR,
3011 "Codec Support settings\nFullrate\n"
3012 CODEC_HELP_STR)
3013{
3014 _get_codec_from_arg(vty, 1, argv);
3015 return CMD_SUCCESS;
3016}
3017
3018DEFUN(cfg_bts_codec2, cfg_bts_codec2_cmd,
3019 "codec-support fr" CODEC_PAR_STR CODEC_PAR_STR,
3020 "Codec Support settings\nFullrate\n"
3021 CODEC_HELP_STR CODEC_HELP_STR)
3022{
3023 _get_codec_from_arg(vty, 2, argv);
3024 return CMD_SUCCESS;
3025}
3026
3027DEFUN(cfg_bts_codec3, cfg_bts_codec3_cmd,
3028 "codec-support fr" CODEC_PAR_STR CODEC_PAR_STR CODEC_PAR_STR,
3029 "Codec Support settings\nFullrate\n"
3030 CODEC_HELP_STR CODEC_HELP_STR CODEC_HELP_STR)
3031{
3032 _get_codec_from_arg(vty, 3, argv);
3033 return CMD_SUCCESS;
3034}
3035
3036DEFUN(cfg_bts_codec4, cfg_bts_codec4_cmd,
3037 "codec-support fr" CODEC_PAR_STR CODEC_PAR_STR CODEC_PAR_STR CODEC_PAR_STR,
3038 "Codec Support settings\nFullrate\n"
3039 CODEC_HELP_STR CODEC_HELP_STR CODEC_HELP_STR CODEC_HELP_STR)
3040{
3041 _get_codec_from_arg(vty, 4, argv);
3042 return CMD_SUCCESS;
3043}
3044
Holger Hans Peter Freytherc22930e2014-12-17 14:46:17 +01003045DEFUN(cfg_bts_depends_on, cfg_bts_depends_on_cmd,
3046 "depends-on-bts <0-255>",
3047 "This BTS can only be started if another one is up\n" "BTS Number\n")
3048{
3049 struct gsm_bts *bts = vty->index;
3050 struct gsm_bts *other_bts;
3051 int dep = atoi(argv[0]);
3052
3053
3054 if (!is_ipaccess_bts(bts)) {
3055 vty_out(vty, "This feature is only available for IP systems.%s",
3056 VTY_NEWLINE);
3057 return CMD_WARNING;
3058 }
3059
3060 other_bts = gsm_bts_num(bts->network, dep);
3061 if (!other_bts || !is_ipaccess_bts(other_bts)) {
3062 vty_out(vty, "This feature is only available for IP systems.%s",
3063 VTY_NEWLINE);
3064 return CMD_WARNING;
3065 }
3066
3067 if (dep >= bts->nr) {
3068 vty_out(vty, "%%Need to depend on an already declared unit.%s",
3069 VTY_NEWLINE);
3070 return CMD_WARNING;
3071 }
3072
3073 bts_depend_mark(bts, dep);
3074 return CMD_SUCCESS;
3075}
3076
3077DEFUN(cfg_bts_no_depends_on, cfg_bts_no_depends_on_cmd,
3078 "depeneds-on-bts <0-255>",
3079 NO_STR "This BTS can only be started if another one is up\n"
3080 "BTS Number\n")
3081{
3082 struct gsm_bts *bts = vty->index;
3083 int dep = atoi(argv[0]);
3084
3085 bts_depend_clear(bts, dep);
3086 return CMD_SUCCESS;
3087}
3088
Andreas Eversberg73266522014-01-19 11:47:44 +01003089#define AMR_TEXT "Adaptive Multi Rate settings\n"
3090#define AMR_MODE_TEXT "Codec modes to use with AMR codec\n"
3091#define AMR_START_TEXT "Initial codec to use with AMR\n" \
3092 "Automatically\nFirst codec\nSecond codec\nThird codec\nFourth codec\n"
3093#define AMR_TH_TEXT "AMR threshold between codecs\nMS side\nBTS side\n"
3094#define AMR_HY_TEXT "AMR hysteresis between codecs\nMS side\nBTS side\n"
3095
3096static void get_amr_from_arg(struct vty *vty, int argc, const char *argv[], int full)
3097{
3098 struct gsm_bts *bts = vty->index;
3099 struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half;
3100 struct gsm48_multi_rate_conf *mr_conf =
3101 (struct gsm48_multi_rate_conf *) mr->gsm48_ie;
3102 int i;
3103
3104 mr->gsm48_ie[1] = 0;
3105 for (i = 0; i < argc; i++)
3106 mr->gsm48_ie[1] |= 1 << atoi(argv[i]);
3107 mr_conf->icmi = 0;
3108}
3109
3110static void get_amr_th_from_arg(struct vty *vty, int argc, const char *argv[], int full)
3111{
3112 struct gsm_bts *bts = vty->index;
3113 struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half;
Holger Hans Peter Freythera174a472015-09-24 11:39:38 +02003114 struct amr_mode *modes;
Andreas Eversberg73266522014-01-19 11:47:44 +01003115 int i;
3116
Holger Hans Peter Freythera174a472015-09-24 11:39:38 +02003117 modes = argv[0][0]=='m' ? mr->ms_mode : mr->bts_mode;
3118 for (i = 0; i < argc - 1; i++)
3119 modes[i].threshold = atoi(argv[i + 1]);
Andreas Eversberg73266522014-01-19 11:47:44 +01003120}
3121
3122static void get_amr_hy_from_arg(struct vty *vty, int argc, const char *argv[], int full)
3123{
3124 struct gsm_bts *bts = vty->index;
3125 struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half;
Holger Hans Peter Freythera174a472015-09-24 11:39:38 +02003126 struct amr_mode *modes;
Andreas Eversberg73266522014-01-19 11:47:44 +01003127 int i;
3128
Holger Hans Peter Freythera174a472015-09-24 11:39:38 +02003129 modes = argv[0][0]=='m' ? mr->ms_mode : mr->bts_mode;
3130 for (i = 0; i < argc - 1; i++)
3131 modes[i].hysteresis = atoi(argv[i + 1]);
Andreas Eversberg73266522014-01-19 11:47:44 +01003132}
3133
3134static void get_amr_start_from_arg(struct vty *vty, const char *argv[], int full)
3135{
3136 struct gsm_bts *bts = vty->index;
3137 struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half;
3138 struct gsm48_multi_rate_conf *mr_conf =
3139 (struct gsm48_multi_rate_conf *) mr->gsm48_ie;
3140 int num = 0, i;
3141
3142 for (i = 0; i < ((full) ? 8 : 6); i++) {
3143 if ((mr->gsm48_ie[1] & (1 << i))) {
3144 num++;
3145 }
3146 }
3147
3148 if (argv[0][0] == 'a' || num == 0)
3149 mr_conf->icmi = 0;
3150 else {
3151 mr_conf->icmi = 1;
3152 if (num < atoi(argv[0]))
3153 mr_conf->smod = num - 1;
3154 else
3155 mr_conf->smod = atoi(argv[0]) - 1;
3156 }
3157}
3158
3159#define AMR_TCHF_PAR_STR " (0|1|2|3|4|5|6|7)"
3160#define AMR_TCHF_HELP_STR "4,75k\n5,15k\n5,90k\n6,70k\n7,40k\n7,95k\n" \
3161 "10,2k\n12,2k\n"
3162
3163#define AMR_TCHH_PAR_STR " (0|1|2|3|4|5)"
3164#define AMR_TCHH_HELP_STR "4,75k\n5,15k\n5,90k\n6,70k\n7,40k\n7,95k\n"
3165
3166#define AMR_TH_HELP_STR "Threshold between codec 1 and 2\n"
3167#define AMR_HY_HELP_STR "Hysteresis between codec 1 and 2\n"
3168
3169DEFUN(cfg_bts_amr_fr_modes1, cfg_bts_amr_fr_modes1_cmd,
3170 "amr tch-f modes" AMR_TCHF_PAR_STR,
3171 AMR_TEXT "Full Rate\n" AMR_MODE_TEXT
3172 AMR_TCHF_HELP_STR)
3173{
3174 get_amr_from_arg(vty, 1, argv, 1);
3175 return CMD_SUCCESS;
3176}
3177
3178DEFUN(cfg_bts_amr_fr_modes2, cfg_bts_amr_fr_modes2_cmd,
3179 "amr tch-f modes" AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR,
3180 AMR_TEXT "Full Rate\n" AMR_MODE_TEXT
3181 AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR)
3182{
3183 get_amr_from_arg(vty, 2, argv, 1);
3184 return CMD_SUCCESS;
3185}
3186
3187DEFUN(cfg_bts_amr_fr_modes3, cfg_bts_amr_fr_modes3_cmd,
3188 "amr tch-f modes" AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR,
3189 AMR_TEXT "Full Rate\n" AMR_MODE_TEXT
3190 AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR)
3191{
3192 get_amr_from_arg(vty, 3, argv, 1);
3193 return CMD_SUCCESS;
3194}
3195
3196DEFUN(cfg_bts_amr_fr_modes4, cfg_bts_amr_fr_modes4_cmd,
3197 "amr tch-f modes" AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR,
3198 AMR_TEXT "Full Rate\n" AMR_MODE_TEXT
3199 AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR)
3200{
3201 get_amr_from_arg(vty, 4, argv, 1);
3202 return CMD_SUCCESS;
3203}
3204
3205DEFUN(cfg_bts_amr_fr_start_mode, cfg_bts_amr_fr_start_mode_cmd,
3206 "amr tch-f start-mode (auto|1|2|3|4)",
3207 AMR_TEXT "Full Rate\n" AMR_START_TEXT)
3208{
3209 get_amr_start_from_arg(vty, argv, 1);
3210 return CMD_SUCCESS;
3211}
3212
3213DEFUN(cfg_bts_amr_fr_thres1, cfg_bts_amr_fr_thres1_cmd,
3214 "amr tch-f threshold (ms|bts) <0-63>",
3215 AMR_TEXT "Full Rate\n" AMR_TH_TEXT
3216 AMR_TH_HELP_STR)
3217{
3218 get_amr_th_from_arg(vty, 2, argv, 1);
3219 return CMD_SUCCESS;
3220}
3221
3222DEFUN(cfg_bts_amr_fr_thres2, cfg_bts_amr_fr_thres2_cmd,
3223 "amr tch-f threshold (ms|bts) <0-63> <0-63>",
3224 AMR_TEXT "Full Rate\n" AMR_TH_TEXT
3225 AMR_TH_HELP_STR AMR_TH_HELP_STR)
3226{
3227 get_amr_th_from_arg(vty, 3, argv, 1);
3228 return CMD_SUCCESS;
3229}
3230
3231DEFUN(cfg_bts_amr_fr_thres3, cfg_bts_amr_fr_thres3_cmd,
3232 "amr tch-f threshold (ms|bts) <0-63> <0-63> <0-63>",
3233 AMR_TEXT "Full Rate\n" AMR_TH_TEXT
3234 AMR_TH_HELP_STR AMR_TH_HELP_STR AMR_TH_HELP_STR)
3235{
3236 get_amr_th_from_arg(vty, 4, argv, 1);
3237 return CMD_SUCCESS;
3238}
3239
3240DEFUN(cfg_bts_amr_fr_hyst1, cfg_bts_amr_fr_hyst1_cmd,
3241 "amr tch-f hysteresis (ms|bts) <0-15>",
3242 AMR_TEXT "Full Rate\n" AMR_HY_TEXT
3243 AMR_HY_HELP_STR)
3244{
3245 get_amr_hy_from_arg(vty, 2, argv, 1);
3246 return CMD_SUCCESS;
3247}
3248
3249DEFUN(cfg_bts_amr_fr_hyst2, cfg_bts_amr_fr_hyst2_cmd,
3250 "amr tch-f hysteresis (ms|bts) <0-15> <0-15>",
3251 AMR_TEXT "Full Rate\n" AMR_HY_TEXT
3252 AMR_HY_HELP_STR AMR_HY_HELP_STR)
3253{
3254 get_amr_hy_from_arg(vty, 3, argv, 1);
3255 return CMD_SUCCESS;
3256}
3257
3258DEFUN(cfg_bts_amr_fr_hyst3, cfg_bts_amr_fr_hyst3_cmd,
3259 "amr tch-f hysteresis (ms|bts) <0-15> <0-15> <0-15>",
3260 AMR_TEXT "Full Rate\n" AMR_HY_TEXT
3261 AMR_HY_HELP_STR AMR_HY_HELP_STR AMR_HY_HELP_STR)
3262{
3263 get_amr_hy_from_arg(vty, 4, argv, 1);
3264 return CMD_SUCCESS;
3265}
3266
3267DEFUN(cfg_bts_amr_hr_modes1, cfg_bts_amr_hr_modes1_cmd,
3268 "amr tch-h modes" AMR_TCHH_PAR_STR,
3269 AMR_TEXT "Half Rate\n" AMR_MODE_TEXT
3270 AMR_TCHH_HELP_STR)
3271{
3272 get_amr_from_arg(vty, 1, argv, 0);
3273 return CMD_SUCCESS;
3274}
3275
3276DEFUN(cfg_bts_amr_hr_modes2, cfg_bts_amr_hr_modes2_cmd,
3277 "amr tch-h modes" AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR,
3278 AMR_TEXT "Half Rate\n" AMR_MODE_TEXT
3279 AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR)
3280{
3281 get_amr_from_arg(vty, 2, argv, 0);
3282 return CMD_SUCCESS;
3283}
3284
3285DEFUN(cfg_bts_amr_hr_modes3, cfg_bts_amr_hr_modes3_cmd,
3286 "amr tch-h modes" AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR,
3287 AMR_TEXT "Half Rate\n" AMR_MODE_TEXT
3288 AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR)
3289{
3290 get_amr_from_arg(vty, 3, argv, 0);
3291 return CMD_SUCCESS;
3292}
3293
3294DEFUN(cfg_bts_amr_hr_modes4, cfg_bts_amr_hr_modes4_cmd,
3295 "amr tch-h modes" AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR,
3296 AMR_TEXT "Half Rate\n" AMR_MODE_TEXT
3297 AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR)
3298{
3299 get_amr_from_arg(vty, 4, argv, 0);
3300 return CMD_SUCCESS;
3301}
3302
3303DEFUN(cfg_bts_amr_hr_start_mode, cfg_bts_amr_hr_start_mode_cmd,
3304 "amr tch-h start-mode (auto|1|2|3|4)",
3305 AMR_TEXT "Half Rate\n" AMR_START_TEXT)
3306{
3307 get_amr_start_from_arg(vty, argv, 0);
3308 return CMD_SUCCESS;
3309}
3310
3311DEFUN(cfg_bts_amr_hr_thres1, cfg_bts_amr_hr_thres1_cmd,
3312 "amr tch-h threshold (ms|bts) <0-63>",
3313 AMR_TEXT "Half Rate\n" AMR_TH_TEXT
3314 AMR_TH_HELP_STR)
3315{
3316 get_amr_th_from_arg(vty, 2, argv, 0);
3317 return CMD_SUCCESS;
3318}
3319
3320DEFUN(cfg_bts_amr_hr_thres2, cfg_bts_amr_hr_thres2_cmd,
3321 "amr tch-h threshold (ms|bts) <0-63> <0-63>",
3322 AMR_TEXT "Half Rate\n" AMR_TH_TEXT
3323 AMR_TH_HELP_STR AMR_TH_HELP_STR)
3324{
3325 get_amr_th_from_arg(vty, 3, argv, 0);
3326 return CMD_SUCCESS;
3327}
3328
3329DEFUN(cfg_bts_amr_hr_thres3, cfg_bts_amr_hr_thres3_cmd,
3330 "amr tch-h threshold (ms|bts) <0-63> <0-63> <0-63>",
3331 AMR_TEXT "Half Rate\n" AMR_TH_TEXT
3332 AMR_TH_HELP_STR AMR_TH_HELP_STR AMR_TH_HELP_STR)
3333{
3334 get_amr_th_from_arg(vty, 4, argv, 0);
3335 return CMD_SUCCESS;
3336}
3337
3338DEFUN(cfg_bts_amr_hr_hyst1, cfg_bts_amr_hr_hyst1_cmd,
3339 "amr tch-h hysteresis (ms|bts) <0-15>",
3340 AMR_TEXT "Half Rate\n" AMR_HY_TEXT
3341 AMR_HY_HELP_STR)
3342{
3343 get_amr_hy_from_arg(vty, 2, argv, 0);
3344 return CMD_SUCCESS;
3345}
3346
3347DEFUN(cfg_bts_amr_hr_hyst2, cfg_bts_amr_hr_hyst2_cmd,
3348 "amr tch-h hysteresis (ms|bts) <0-15> <0-15>",
3349 AMR_TEXT "Half Rate\n" AMR_HY_TEXT
3350 AMR_HY_HELP_STR AMR_HY_HELP_STR)
3351{
3352 get_amr_hy_from_arg(vty, 3, argv, 0);
3353 return CMD_SUCCESS;
3354}
3355
3356DEFUN(cfg_bts_amr_hr_hyst3, cfg_bts_amr_hr_hyst3_cmd,
3357 "amr tch-h hysteresis (ms|bts) <0-15> <0-15> <0-15>",
3358 AMR_TEXT "Half Rate\n" AMR_HY_TEXT
3359 AMR_HY_HELP_STR AMR_HY_HELP_STR AMR_HY_HELP_STR)
3360{
3361 get_amr_hy_from_arg(vty, 4, argv, 0);
3362 return CMD_SUCCESS;
3363}
3364
Harald Welte8f0ed552010-05-11 21:53:49 +02003365#define TRX_TEXT "Radio Transceiver\n"
Harald Welte7a8fa412009-08-10 13:48:16 +02003366
Harald Welte5258fc42009-03-28 19:07:53 +00003367/* per TRX configuration */
3368DEFUN(cfg_trx,
3369 cfg_trx_cmd,
Harald Welte57e07242012-08-17 12:50:14 +02003370 "trx <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02003371 TRX_TEXT
Harald Welte5258fc42009-03-28 19:07:53 +00003372 "Select a TRX to configure")
3373{
3374 int trx_nr = atoi(argv[0]);
3375 struct gsm_bts *bts = vty->index;
3376 struct gsm_bts_trx *trx;
3377
Harald Weltee441d9c2009-06-21 16:17:15 +02003378 if (trx_nr > bts->num_trx) {
3379 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
3380 bts->num_trx, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00003381 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02003382 } else if (trx_nr == bts->num_trx) {
3383 /* we need to allocate a new one */
3384 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02003385 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02003386 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02003387
Harald Weltee441d9c2009-06-21 16:17:15 +02003388 if (!trx)
3389 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +00003390
3391 vty->index = trx;
Harald Welte197dea92010-05-14 17:59:53 +02003392 vty->index_sub = &trx->description;
Harald Welte5258fc42009-03-28 19:07:53 +00003393 vty->node = TRX_NODE;
3394
3395 return CMD_SUCCESS;
3396}
3397
3398DEFUN(cfg_trx_arfcn,
3399 cfg_trx_arfcn_cmd,
Harald Welte1fe73a12012-01-29 13:24:12 +01003400 "arfcn <0-1023>",
Harald Welte13fe2192012-08-17 09:57:25 +02003401 "Set the ARFCN for this TRX\n"
3402 "Absolute Radio Frequency Channel Number\n")
Harald Welte5258fc42009-03-28 19:07:53 +00003403{
3404 int arfcn = atoi(argv[0]);
3405 struct gsm_bts_trx *trx = vty->index;
3406
3407 /* FIXME: check if this ARFCN is supported by this TRX */
3408
3409 trx->arfcn = arfcn;
3410
3411 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
3412 /* FIXME: use OML layer to update the ARFCN */
3413 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
3414
3415 return CMD_SUCCESS;
3416}
3417
Harald Welte (local)7b37d972009-12-27 20:56:38 +01003418DEFUN(cfg_trx_nominal_power,
3419 cfg_trx_nominal_power_cmd,
3420 "nominal power <0-100>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02003421 "Nominal TRX RF Power in dBm\n"
3422 "Nominal TRX RF Power in dBm\n"
3423 "Nominal TRX RF Power in dBm\n")
Harald Welte (local)7b37d972009-12-27 20:56:38 +01003424{
3425 struct gsm_bts_trx *trx = vty->index;
3426
3427 trx->nominal_power = atoi(argv[0]);
3428
3429 return CMD_SUCCESS;
3430}
3431
Harald Weltefcd24452009-06-20 18:15:19 +02003432DEFUN(cfg_trx_max_power_red,
3433 cfg_trx_max_power_red_cmd,
3434 "max_power_red <0-100>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02003435 "Reduction of maximum BS RF Power (relative to nominal power)\n"
Harald Weltefcd24452009-06-20 18:15:19 +02003436 "Reduction of maximum BS RF Power in dB\n")
3437{
3438 int maxpwr_r = atoi(argv[0]);
3439 struct gsm_bts_trx *trx = vty->index;
Harald Welte61a83b22009-11-18 09:20:22 +01003440 int upper_limit = 24; /* default 12.21 max power red. */
Harald Weltefcd24452009-06-20 18:15:19 +02003441
3442 /* FIXME: check if our BTS type supports more than 12 */
3443 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
3444 vty_out(vty, "%% Power %d dB is not in the valid range%s",
3445 maxpwr_r, VTY_NEWLINE);
3446 return CMD_WARNING;
3447 }
3448 if (maxpwr_r & 1) {
3449 vty_out(vty, "%% Power %d dB is not an even value%s",
3450 maxpwr_r, VTY_NEWLINE);
3451 return CMD_WARNING;
3452 }
3453
3454 trx->max_power_red = maxpwr_r;
3455
3456 /* FIXME: make sure we update this using OML */
3457
3458 return CMD_SUCCESS;
3459}
3460
Harald Welte42581822009-08-08 16:12:58 +02003461DEFUN(cfg_trx_rsl_e1,
3462 cfg_trx_rsl_e1_cmd,
3463 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltecfaabbb2012-08-16 23:23:50 +02003464 "RSL Parameters\n"
3465 "E1/T1 interface to be used for RSL\n"
3466 "E1/T1 interface to be used for RSL\n"
3467 "E1/T1 Line Number to be used for RSL\n"
3468 "E1/T1 Timeslot to be used for RSL\n"
3469 "E1/T1 Timeslot to be used for RSL\n"
3470 "E1/T1 Sub-slot to be used for RSL\n"
3471 "E1/T1 Sub-slot 0 is to be used for RSL\n"
3472 "E1/T1 Sub-slot 1 is to be used for RSL\n"
3473 "E1/T1 Sub-slot 2 is to be used for RSL\n"
3474 "E1/T1 Sub-slot 3 is to be used for RSL\n"
3475 "E1/T1 full timeslot is to be used for RSL\n")
Harald Welte42581822009-08-08 16:12:58 +02003476{
3477 struct gsm_bts_trx *trx = vty->index;
3478
3479 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
3480
3481 return CMD_SUCCESS;
3482}
3483
3484DEFUN(cfg_trx_rsl_e1_tei,
3485 cfg_trx_rsl_e1_tei_cmd,
3486 "rsl e1 tei <0-63>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02003487 "RSL Parameters\n"
3488 "Set the TEI to be used for RSL\n"
3489 "Set the TEI to be used for RSL\n"
3490 "TEI to be used for RSL\n")
Harald Welte42581822009-08-08 16:12:58 +02003491{
3492 struct gsm_bts_trx *trx = vty->index;
3493
3494 trx->rsl_tei = atoi(argv[0]);
3495
3496 return CMD_SUCCESS;
3497}
3498
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01003499DEFUN(cfg_trx_rf_locked,
3500 cfg_trx_rf_locked_cmd,
3501 "rf_locked (0|1)",
Harald Weltecfaabbb2012-08-16 23:23:50 +02003502 "Set or unset the RF Locking (Turn off RF of the TRX)\n"
3503 "TRX is NOT RF locked (active)\n"
3504 "TRX is RF locked (turned off)\n")
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01003505{
3506 int locked = atoi(argv[0]);
3507 struct gsm_bts_trx *trx = vty->index;
3508
3509 gsm_trx_lock_rf(trx, locked);
3510 return CMD_SUCCESS;
3511}
Harald Welte42581822009-08-08 16:12:58 +02003512
Harald Welte5258fc42009-03-28 19:07:53 +00003513/* per TS configuration */
3514DEFUN(cfg_ts,
3515 cfg_ts_cmd,
Harald Welte42581822009-08-08 16:12:58 +02003516 "timeslot <0-7>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02003517 "Select a Timeslot to configure\n"
3518 "Timeslot number\n")
Harald Welte5258fc42009-03-28 19:07:53 +00003519{
3520 int ts_nr = atoi(argv[0]);
3521 struct gsm_bts_trx *trx = vty->index;
3522 struct gsm_bts_trx_ts *ts;
3523
3524 if (ts_nr >= TRX_NR_TS) {
3525 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
3526 TRX_NR_TS, VTY_NEWLINE);
3527 return CMD_WARNING;
3528 }
3529
3530 ts = &trx->ts[ts_nr];
3531
3532 vty->index = ts;
3533 vty->node = TS_NODE;
3534
3535 return CMD_SUCCESS;
3536}
3537
Harald Weltea6fd58e2009-08-07 00:25:23 +02003538DEFUN(cfg_ts_pchan,
3539 cfg_ts_pchan_cmd,
Harald Welte4ab9d7c2012-08-17 12:42:06 +02003540 "phys_chan_config PCHAN", /* dynamically generated! */
Holger Hans Peter Freyther63b0e442013-03-03 09:32:08 +01003541 "Physical Channel configuration (TCH/SDCCH/...)\n" "Physical Channel\n")
Harald Welte4ab9d7c2012-08-17 12:42:06 +02003542{
3543 struct gsm_bts_trx_ts *ts = vty->index;
3544 int pchanc;
3545
3546 pchanc = gsm_pchan_parse(argv[0]);
3547 if (pchanc < 0)
3548 return CMD_WARNING;
3549
3550 ts->pchan = pchanc;
3551
3552 return CMD_SUCCESS;
3553}
3554
3555/* used for backwards compatibility with old config files that still
3556 * have uppercase pchan type names */
3557DEFUN_HIDDEN(cfg_ts_pchan_compat,
3558 cfg_ts_pchan_compat_cmd,
Harald Weltea6fd58e2009-08-07 00:25:23 +02003559 "phys_chan_config PCHAN",
Holger Hans Peter Freyther63b0e442013-03-03 09:32:08 +01003560 "Physical Channel configuration (TCH/SDCCH/...)\n" "Physical Channel\n")
Harald Weltea6fd58e2009-08-07 00:25:23 +02003561{
3562 struct gsm_bts_trx_ts *ts = vty->index;
3563 int pchanc;
3564
3565 pchanc = gsm_pchan_parse(argv[0]);
3566 if (pchanc < 0)
3567 return CMD_WARNING;
3568
3569 ts->pchan = pchanc;
3570
3571 return CMD_SUCCESS;
3572}
3573
Harald Welte4ab9d7c2012-08-17 12:42:06 +02003574
3575
Harald Welte135a6482011-05-30 12:09:13 +02003576DEFUN(cfg_ts_tsc,
3577 cfg_ts_tsc_cmd,
3578 "training_sequence_code <0-7>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02003579 "Training Sequence Code of the Timeslot\n" "TSC\n")
Harald Welte135a6482011-05-30 12:09:13 +02003580{
3581 struct gsm_bts_trx_ts *ts = vty->index;
3582
Harald Welte903aaea2014-01-19 17:10:50 +01003583 if (!gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_MULTI_TSC)) {
3584 vty_out(vty, "%% This BTS does not support a TSC != BCC, "
3585 "falling back to BCC%s", VTY_NEWLINE);
3586 ts->tsc = -1;
3587 return CMD_WARNING;
3588 }
3589
Harald Welte135a6482011-05-30 12:09:13 +02003590 ts->tsc = atoi(argv[0]);
3591
3592 return CMD_SUCCESS;
3593}
3594
Harald Weltea39b0f22010-06-14 22:26:10 +02003595#define HOPPING_STR "Configure frequency hopping\n"
3596
3597DEFUN(cfg_ts_hopping,
3598 cfg_ts_hopping_cmd,
3599 "hopping enabled (0|1)",
3600 HOPPING_STR "Enable or disable frequency hopping\n"
3601 "Disable frequency hopping\n" "Enable frequency hopping\n")
3602{
3603 struct gsm_bts_trx_ts *ts = vty->index;
Harald Weltec2fb3d02010-06-14 22:47:37 +02003604 int enabled = atoi(argv[0]);
Harald Weltea39b0f22010-06-14 22:26:10 +02003605
Harald Weltec2fb3d02010-06-14 22:47:37 +02003606 if (enabled && !gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_HOPPING)) {
3607 vty_out(vty, "BTS model does not support hopping%s",
3608 VTY_NEWLINE);
3609 return CMD_WARNING;
3610 }
3611
3612 ts->hopping.enabled = enabled;
Harald Weltea39b0f22010-06-14 22:26:10 +02003613
3614 return CMD_SUCCESS;
3615}
3616
Harald Welte6e0cd042009-09-12 13:05:33 +02003617DEFUN(cfg_ts_hsn,
3618 cfg_ts_hsn_cmd,
Harald Weltea39b0f22010-06-14 22:26:10 +02003619 "hopping sequence-number <0-63>",
3620 HOPPING_STR
Harald Weltecfaabbb2012-08-16 23:23:50 +02003621 "Which hopping sequence to use for this channel\n"
3622 "Hopping Sequence Number (HSN)\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02003623{
3624 struct gsm_bts_trx_ts *ts = vty->index;
3625
3626 ts->hopping.hsn = atoi(argv[0]);
3627
3628 return CMD_SUCCESS;
3629}
3630
3631DEFUN(cfg_ts_maio,
3632 cfg_ts_maio_cmd,
3633 "hopping maio <0-63>",
Harald Weltea39b0f22010-06-14 22:26:10 +02003634 HOPPING_STR
Harald Weltecfaabbb2012-08-16 23:23:50 +02003635 "Which hopping MAIO to use for this channel\n"
3636 "Mobile Allocation Index Offset (MAIO)\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02003637{
3638 struct gsm_bts_trx_ts *ts = vty->index;
3639
3640 ts->hopping.maio = atoi(argv[0]);
3641
3642 return CMD_SUCCESS;
3643}
3644
3645DEFUN(cfg_ts_arfcn_add,
3646 cfg_ts_arfcn_add_cmd,
3647 "hopping arfcn add <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02003648 HOPPING_STR "Configure hopping ARFCN list\n"
3649 "Add an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02003650{
3651 struct gsm_bts_trx_ts *ts = vty->index;
3652 int arfcn = atoi(argv[0]);
3653
Harald Weltea39b0f22010-06-14 22:26:10 +02003654 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1);
3655
Harald Welte6e0cd042009-09-12 13:05:33 +02003656 return CMD_SUCCESS;
3657}
3658
3659DEFUN(cfg_ts_arfcn_del,
3660 cfg_ts_arfcn_del_cmd,
3661 "hopping arfcn del <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02003662 HOPPING_STR "Configure hopping ARFCN list\n"
3663 "Delete an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02003664{
3665 struct gsm_bts_trx_ts *ts = vty->index;
3666 int arfcn = atoi(argv[0]);
3667
Harald Weltea39b0f22010-06-14 22:26:10 +02003668 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0);
3669
Harald Welte6e0cd042009-09-12 13:05:33 +02003670 return CMD_SUCCESS;
3671}
3672
Harald Weltea6fd58e2009-08-07 00:25:23 +02003673DEFUN(cfg_ts_e1_subslot,
3674 cfg_ts_e1_subslot_cmd,
Harald Welte42581822009-08-08 16:12:58 +02003675 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltecfaabbb2012-08-16 23:23:50 +02003676 "E1/T1 channel connected to this on-air timeslot\n"
3677 "E1/T1 channel connected to this on-air timeslot\n"
3678 "E1/T1 line connected to this on-air timeslot\n"
Harald Welted13e0cd2012-08-17 09:52:03 +02003679 "E1/T1 timeslot connected to this on-air timeslot\n"
3680 "E1/T1 timeslot connected to this on-air timeslot\n"
Harald Weltecfaabbb2012-08-16 23:23:50 +02003681 "E1/T1 sub-slot connected to this on-air timeslot\n"
3682 "E1/T1 sub-slot 0 connected to this on-air timeslot\n"
3683 "E1/T1 sub-slot 1 connected to this on-air timeslot\n"
3684 "E1/T1 sub-slot 2 connected to this on-air timeslot\n"
3685 "E1/T1 sub-slot 3 connected to this on-air timeslot\n"
3686 "Full E1/T1 timeslot connected to this on-air timeslot\n")
Harald Weltea6fd58e2009-08-07 00:25:23 +02003687{
3688 struct gsm_bts_trx_ts *ts = vty->index;
3689
Harald Welte42581822009-08-08 16:12:58 +02003690 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Weltea6fd58e2009-08-07 00:25:23 +02003691
3692 return CMD_SUCCESS;
3693}
Harald Welte5258fc42009-03-28 19:07:53 +00003694
Harald Welte4f10c252010-05-16 21:47:13 +02003695void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
3696{
3697 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
Alexander Couzensb847a212016-08-02 11:34:11 +02003698 net->bsc_ctrs->ctr[BSC_CTR_CHREQ_TOTAL].current,
3699 net->bsc_ctrs->ctr[BSC_CTR_CHREQ_NO_CHANNEL].current,
Alexander Couzens20423ea2016-07-12 15:42:02 +02003700 VTY_NEWLINE);
Harald Welte4f10c252010-05-16 21:47:13 +02003701 vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
Alexander Couzensb847a212016-08-02 11:34:11 +02003702 net->bsc_ctrs->ctr[BSC_CTR_CHAN_RF_FAIL].current,
3703 net->bsc_ctrs->ctr[BSC_CTR_CHAN_RLL_ERR].current,
Alexander Couzens20423ea2016-07-12 15:42:02 +02003704 VTY_NEWLINE);
Harald Welte4f10c252010-05-16 21:47:13 +02003705 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
Alexander Couzensb847a212016-08-02 11:34:11 +02003706 net->bsc_ctrs->ctr[BSC_CTR_PAGING_ATTEMPTED].current,
3707 net->bsc_ctrs->ctr[BSC_CTR_PAGING_COMPLETED].current,
3708 net->bsc_ctrs->ctr[BSC_CTR_PAGING_EXPIRED].current,
Alexander Couzens20423ea2016-07-12 15:42:02 +02003709 VTY_NEWLINE);
Harald Welte4f10c252010-05-16 21:47:13 +02003710 vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
Alexander Couzensb847a212016-08-02 11:34:11 +02003711 net->bsc_ctrs->ctr[BSC_CTR_BTS_OML_FAIL].current,
3712 net->bsc_ctrs->ctr[BSC_CTR_BTS_RSL_FAIL].current,
Alexander Couzens20423ea2016-07-12 15:42:02 +02003713 VTY_NEWLINE);
Harald Welte4f10c252010-05-16 21:47:13 +02003714}
3715
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02003716DEFUN(drop_bts,
3717 drop_bts_cmd,
Holger Hans Peter Freyther0586b0f2010-04-11 12:46:45 +02003718 "drop bts connection <0-65535> (oml|rsl)",
Harald Weltecfaabbb2012-08-16 23:23:50 +02003719 "Debug/Simulation command to drop Abis/IP BTS\n"
3720 "Debug/Simulation command to drop Abis/IP BTS\n"
3721 "Debug/Simulation command to drop Abis/IP BTS\n"
3722 "BTS NR\n" "Drop OML Connection\n" "Drop RSL Connection\n")
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02003723{
3724 struct gsm_network *gsmnet;
3725 struct gsm_bts_trx *trx;
3726 struct gsm_bts *bts;
3727 unsigned int bts_nr;
3728
3729 gsmnet = gsmnet_from_vty(vty);
3730
3731 bts_nr = atoi(argv[0]);
3732 if (bts_nr >= gsmnet->num_bts) {
3733 vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s",
3734 gsmnet->num_bts, bts_nr, VTY_NEWLINE);
3735 return CMD_WARNING;
3736 }
3737
3738 bts = gsm_bts_num(gsmnet, bts_nr);
3739 if (!bts) {
3740 vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE);
3741 return CMD_WARNING;
3742 }
3743
3744 if (!is_ipaccess_bts(bts)) {
3745 vty_out(vty, "This command only works for ipaccess.%s", VTY_NEWLINE);
3746 return CMD_WARNING;
3747 }
3748
3749
3750 /* close all connections */
3751 if (strcmp(argv[1], "oml") == 0) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01003752 ipaccess_drop_oml(bts);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02003753 } else if (strcmp(argv[1], "rsl") == 0) {
3754 /* close all rsl connections */
3755 llist_for_each_entry(trx, &bts->trx_list, list) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01003756 ipaccess_drop_rsl(trx);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02003757 }
3758 } else {
3759 vty_out(vty, "Argument must be 'oml# or 'rsl'.%s", VTY_NEWLINE);
3760 return CMD_WARNING;
3761 }
3762
3763 return CMD_SUCCESS;
3764}
3765
Holger Hans Peter Freyther740e65f2016-03-16 13:45:23 +01003766DEFUN(restart_bts, restart_bts_cmd,
3767 "restart-bts <0-65535>",
3768 "Restart ip.access nanoBTS through OML\n"
3769 "BTS Number\n")
3770{
3771 struct gsm_network *gsmnet;
3772 struct gsm_bts_trx *trx;
3773 struct gsm_bts *bts;
3774 unsigned int bts_nr;
3775
3776 gsmnet = gsmnet_from_vty(vty);
3777
3778 bts_nr = atoi(argv[0]);
3779 if (bts_nr >= gsmnet->num_bts) {
3780 vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s",
3781 gsmnet->num_bts, bts_nr, VTY_NEWLINE);
3782 return CMD_WARNING;
3783 }
3784
3785 bts = gsm_bts_num(gsmnet, bts_nr);
3786 if (!bts) {
3787 vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE);
3788 return CMD_WARNING;
3789 }
3790
3791 if (!is_ipaccess_bts(bts) || is_sysmobts_v2(bts)) {
3792 vty_out(vty, "This command only works for ipaccess nanoBTS.%s",
3793 VTY_NEWLINE);
3794 return CMD_WARNING;
3795 }
3796
3797 /* go from last TRX to c0 */
3798 llist_for_each_entry_reverse(trx, &bts->trx_list, list)
3799 abis_nm_ipaccess_restart(trx);
3800
3801 return CMD_SUCCESS;
3802}
3803
Harald Welte30f1f372014-12-28 15:00:45 +01003804DEFUN(smscb_cmd, smscb_cmd_cmd,
3805 "bts <0-255> smscb-command <1-4> HEXSTRING",
3806 "BTS related commands\n" "BTS Number\n"
3807 "SMS Cell Broadcast\n" "Last Valid Block\n"
3808 "Hex Encoded SMSCB message (up to 88 octets)\n")
3809{
3810 struct gsm_bts *bts;
3811 int bts_nr = atoi(argv[0]);
3812 int last_block = atoi(argv[1]);
3813 struct rsl_ie_cb_cmd_type cb_cmd;
3814 uint8_t buf[88];
3815 int rc;
3816
Neels Hofmeyrb90eabf2016-05-11 18:48:39 +02003817 bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr);
Harald Welte30f1f372014-12-28 15:00:45 +01003818 if (!bts) {
3819 vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE);
3820 return CMD_WARNING;
3821 }
3822 rc = osmo_hexparse(argv[2], buf, sizeof(buf));
3823 if (rc < 0 || rc > sizeof(buf)) {
3824 vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
3825 return CMD_WARNING;
3826 }
3827
3828 cb_cmd.spare = 0;
3829 cb_cmd.def_bcast = 0;
3830 cb_cmd.command = RSL_CB_CMD_TYPE_NORMAL;
3831
3832 switch (last_block) {
3833 case 1:
3834 cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_1;
3835 break;
3836 case 2:
3837 cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_2;
3838 break;
3839 case 3:
3840 cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_3;
3841 break;
3842 case 4:
3843 cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_4;
3844 break;
3845 }
3846
3847 rsl_sms_cb_command(bts, RSL_CHAN_SDCCH4_ACCH, cb_cmd, buf, rc);
3848
3849 return CMD_SUCCESS;
3850}
3851
3852
Harald Welted0d2b0b2010-12-23 13:18:07 +01003853DEFUN(pdch_act, pdch_act_cmd,
3854 "bts <0-255> trx <0-255> timeslot <0-7> pdch (activate|deactivate)",
3855 "BTS related commands\n" "BTS Number\n" "Transceiver\n" "Transceiver Number\n"
3856 "TRX Timeslot\n" "Timeslot Number\n" "Packet Data Channel\n"
3857 "Activate Dynamic PDCH/TCH (-> PDCH mode)\n"
3858 "Deactivate Dynamic PDCH/TCH (-> TCH mode)\n")
3859{
3860 struct gsm_bts *bts;
3861 struct gsm_bts_trx *trx;
3862 struct gsm_bts_trx_ts *ts;
3863 int bts_nr = atoi(argv[0]);
3864 int trx_nr = atoi(argv[1]);
3865 int ts_nr = atoi(argv[2]);
3866 int activate;
3867
Neels Hofmeyrb90eabf2016-05-11 18:48:39 +02003868 bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr);
Harald Welted0d2b0b2010-12-23 13:18:07 +01003869 if (!bts) {
3870 vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE);
3871 return CMD_WARNING;
3872 }
3873
3874 if (!is_ipaccess_bts(bts)) {
3875 vty_out(vty, "%% This command only works for ipaccess BTS%s",
3876 VTY_NEWLINE);
3877 return CMD_WARNING;
3878 }
3879
3880 trx = gsm_bts_trx_num(bts, trx_nr);
3881 if (!trx) {
3882 vty_out(vty, "%% No such TRX (%d)%s", trx_nr, VTY_NEWLINE);
3883 return CMD_WARNING;
3884 }
3885
3886 ts = &trx->ts[ts_nr];
3887 if (ts->pchan != GSM_PCHAN_TCH_F_PDCH) {
3888 vty_out(vty, "%% Timeslot %u is not in dynamic TCH_F/PDCH "
3889 "mode%s", ts_nr, VTY_NEWLINE);
3890 return CMD_WARNING;
3891 }
3892
3893 if (!strcmp(argv[3], "activate"))
3894 activate = 1;
3895 else
3896 activate = 0;
3897
3898 rsl_ipacc_pdch_activate(ts, activate);
3899
3900 return CMD_SUCCESS;
3901
3902}
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02003903
Harald Weltedcccb182010-05-16 20:52:23 +02003904extern int bsc_vty_init_extra(void);
Holger Hans Peter Freythere1ffc082010-04-10 00:08:28 +02003905
Maxdb0e3802017-01-12 19:35:11 +01003906int bsc_vty_init(struct gsm_network *network)
Harald Welte68628e82009-03-10 12:17:57 +00003907{
Harald Welte4ab9d7c2012-08-17 12:42:06 +02003908 cfg_ts_pchan_cmd.string =
3909 vty_cmd_string_from_valstr(tall_bsc_ctx,
3910 gsm_pchant_names,
3911 "phys_chan_config (", "|", ")",
3912 VTY_DO_LOWER);
3913 cfg_ts_pchan_cmd.doc =
3914 vty_cmd_string_from_valstr(tall_bsc_ctx,
3915 gsm_pchant_descs,
3916 "Physical Channel Combination\n",
3917 "\n", "", 0);
3918
Harald Weltee555c2b2012-08-17 13:02:12 +02003919 cfg_bts_type_cmd.string =
3920 vty_cmd_string_from_valstr(tall_bsc_ctx,
3921 bts_type_names,
3922 "type (", "|", ")",
3923 VTY_DO_LOWER);
3924 cfg_bts_type_cmd.doc =
3925 vty_cmd_string_from_valstr(tall_bsc_ctx,
3926 bts_type_descs,
3927 "BTS Vendor/Type\n",
3928 "\n", "", 0);
3929
Neels Hofmeyr06d39fd2016-05-12 01:16:58 +02003930 common_cs_vty_init(network, config_write_net);
Harald Weltee555c2b2012-08-17 13:02:12 +02003931
Neels Hofmeyrea11bf82016-05-12 01:53:23 +02003932 install_element_ve(&bsc_show_net_cmd);
Harald Welteb4d5b172010-05-12 16:10:35 +00003933 install_element_ve(&show_bts_cmd);
3934 install_element_ve(&show_trx_cmd);
3935 install_element_ve(&show_ts_cmd);
3936 install_element_ve(&show_lchan_cmd);
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08003937 install_element_ve(&show_lchan_summary_cmd);
Harald Welte1bc77352009-03-10 19:47:51 +00003938
Harald Welteb4d5b172010-05-12 16:10:35 +00003939 install_element_ve(&show_paging_cmd);
Holger Hans Peter Freytherec37bb22013-02-05 09:39:09 +01003940 install_element_ve(&show_paging_group_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00003941
Maxdb0e3802017-01-12 19:35:11 +01003942 logging_vty_add_cmds(NULL);
Jacob Erlbeck64630cc2015-10-26 16:25:37 +01003943 osmo_stats_vty_add_cmds();
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +01003944
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01003945 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Weltebc814502009-12-19 21:41:52 +01003946 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Welteb720bd32009-12-21 16:51:50 +01003947 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
3948 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
3949 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
3950 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
3951 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
3952 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01003953 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01003954 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
3955 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
3956 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
3957 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
3958 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
3959 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
3960 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
3961 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
3962 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
Harald Weltec9f499f2010-12-23 22:53:50 +01003963 install_element(GSMNET_NODE, &cfg_net_T3122_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01003964 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08003965 install_element(GSMNET_NODE, &cfg_net_dtx_cmd);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08003966 install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02003967
3968 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte67ce0732009-08-06 19:06:46 +02003969 install_node(&bts_node, config_write_bts);
Jacob Erlbeck36722e12013-10-29 09:30:30 +01003970 vty_install_default(BTS_NODE);
Harald Welte5258fc42009-03-28 19:07:53 +00003971 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02003972 install_element(BTS_NODE, &cfg_description_cmd);
3973 install_element(BTS_NODE, &cfg_no_description_cmd);
Harald Weltefcd24452009-06-20 18:15:19 +02003974 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02003975 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Maxc08ee712016-05-11 12:45:13 +02003976 install_element(BTS_NODE, &cfg_bts_dtxu_cmd);
3977 install_element(BTS_NODE, &cfg_bts_dtxd_cmd);
3978 install_element(BTS_NODE, &cfg_bts_no_dtxu_cmd);
3979 install_element(BTS_NODE, &cfg_bts_no_dtxd_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00003980 install_element(BTS_NODE, &cfg_bts_lac_cmd);
3981 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte42581822009-08-08 16:12:58 +02003982 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte4cc34222009-05-01 15:12:31 +00003983 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte8b291802013-03-12 13:57:05 +01003984 install_element(BTS_NODE, &cfg_bts_rsl_ip_cmd);
Sylvain Munautc9519462011-10-17 14:04:55 +02003985 install_element(BTS_NODE, &cfg_bts_nokia_site_skip_reset_cmd);
Andreas Eversberg7d8fa342013-12-05 13:25:06 +01003986 install_element(BTS_NODE, &cfg_bts_nokia_site_no_loc_rel_cnf_cmd);
Sipos Csaba56e17662015-02-07 13:27:36 +01003987 install_element(BTS_NODE, &cfg_bts_nokia_site_bts_reset_timer_cnf_cmd);
Harald Welte8175e952009-10-20 00:22:00 +02003988 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte42581822009-08-08 16:12:58 +02003989 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
3990 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02003991 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01003992 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
3993 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Andreas Eversberg2ee7ecd2012-10-13 07:27:47 +02003994 install_element(BTS_NODE, &cfg_bts_chan_desc_att_cmd);
3995 install_element(BTS_NODE, &cfg_bts_chan_desc_bs_pa_mfrms_cmd);
3996 install_element(BTS_NODE, &cfg_bts_chan_desc_bs_ag_blks_res_cmd);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08003997 install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd);
3998 install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02003999 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08004000 install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd);
Ivan Kluchnikov67920592013-09-16 13:13:04 +04004001 install_element(BTS_NODE, &cfg_bts_rach_ac_class_cmd);
Harald Welte (local)0e451d02009-08-13 10:14:26 +02004002 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)efc92312009-08-14 23:09:25 +02004003 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Holger Hans Peter Freytherc63f6f12013-07-27 21:07:57 +02004004 install_element(BTS_NODE, &cfg_bts_no_per_loc_upd_cmd);
Harald Welte73225282009-12-12 18:17:25 +01004005 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
4006 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Sylvain Munaute0b06b02010-11-28 18:17:28 +01004007 install_element(BTS_NODE, &cfg_bts_cell_bar_qualify_cmd);
4008 install_element(BTS_NODE, &cfg_bts_cell_resel_ofs_cmd);
4009 install_element(BTS_NODE, &cfg_bts_temp_ofs_cmd);
4010 install_element(BTS_NODE, &cfg_bts_temp_ofs_inf_cmd);
4011 install_element(BTS_NODE, &cfg_bts_penalty_time_cmd);
4012 install_element(BTS_NODE, &cfg_bts_penalty_time_rsvd_cmd);
Andreas Eversberg4d4944a2013-03-10 11:49:35 +01004013 install_element(BTS_NODE, &cfg_bts_radio_link_timeout_cmd);
Harald Welte4511d892010-04-18 15:51:20 +02004014 install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
bhargava350533c2016-07-21 11:14:34 +05304015 install_element(BTS_NODE, &cfg_bts_gprs_11bit_rach_support_for_egprs_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02004016 install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08004017 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
Andreas Eversberg0c8f9ca2013-03-16 16:31:26 +01004018 install_element(BTS_NODE, &cfg_bts_gprs_net_ctrl_ord_cmd);
Max292ec582016-07-28 11:55:37 +02004019 install_element(BTS_NODE, &cfg_bts_gprs_ctrl_ack_cmd);
4020 install_element(BTS_NODE, &cfg_no_bts_gprs_ctrl_ack_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08004021 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02004022 install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
Harald Weltea5731cf2010-03-22 11:48:36 +08004023 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08004024 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welteaf387632010-03-14 23:30:30 +08004025 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
4026 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
4027 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08004028 install_element(BTS_NODE, &cfg_bts_pag_free_cmd);
Harald Welte9fbff4a2010-07-30 11:50:09 +02004029 install_element(BTS_NODE, &cfg_bts_si_mode_cmd);
4030 install_element(BTS_NODE, &cfg_bts_si_static_cmd);
Harald Welte42def722017-01-13 00:10:32 +01004031 install_element(BTS_NODE, &cfg_bts_early_cm_cmd);
Harald Welte32c09622011-01-11 23:44:56 +01004032 install_element(BTS_NODE, &cfg_bts_neigh_mode_cmd);
4033 install_element(BTS_NODE, &cfg_bts_neigh_cmd);
Harald Welte64c07d22011-02-15 11:43:27 +01004034 install_element(BTS_NODE, &cfg_bts_si5_neigh_cmd);
Max59a1bf32016-04-15 16:04:46 +02004035 install_element(BTS_NODE, &cfg_bts_si2quater_neigh_add_cmd);
4036 install_element(BTS_NODE, &cfg_bts_si2quater_neigh_del_cmd);
Max26679e02016-04-20 15:57:13 +02004037 install_element(BTS_NODE, &cfg_bts_si2quater_uarfcn_add_cmd);
4038 install_element(BTS_NODE, &cfg_bts_si2quater_uarfcn_del_cmd);
Holger Hans Peter Freythere30d40d2012-07-20 10:27:31 +02004039 install_element(BTS_NODE, &cfg_bts_excl_rf_lock_cmd);
4040 install_element(BTS_NODE, &cfg_bts_no_excl_rf_lock_cmd);
Jacob Erlbeck65d114f2014-01-16 11:02:14 +01004041 install_element(BTS_NODE, &cfg_bts_force_comb_si_cmd);
4042 install_element(BTS_NODE, &cfg_bts_no_force_comb_si_cmd);
Andreas Eversberga83d5112013-12-07 18:32:28 +01004043 install_element(BTS_NODE, &cfg_bts_codec0_cmd);
4044 install_element(BTS_NODE, &cfg_bts_codec1_cmd);
4045 install_element(BTS_NODE, &cfg_bts_codec2_cmd);
4046 install_element(BTS_NODE, &cfg_bts_codec3_cmd);
4047 install_element(BTS_NODE, &cfg_bts_codec4_cmd);
Holger Hans Peter Freytherc22930e2014-12-17 14:46:17 +01004048 install_element(BTS_NODE, &cfg_bts_depends_on_cmd);
4049 install_element(BTS_NODE, &cfg_bts_no_depends_on_cmd);
Andreas Eversberg73266522014-01-19 11:47:44 +01004050 install_element(BTS_NODE, &cfg_bts_amr_fr_modes1_cmd);
4051 install_element(BTS_NODE, &cfg_bts_amr_fr_modes2_cmd);
4052 install_element(BTS_NODE, &cfg_bts_amr_fr_modes3_cmd);
4053 install_element(BTS_NODE, &cfg_bts_amr_fr_modes4_cmd);
4054 install_element(BTS_NODE, &cfg_bts_amr_fr_thres1_cmd);
4055 install_element(BTS_NODE, &cfg_bts_amr_fr_thres2_cmd);
4056 install_element(BTS_NODE, &cfg_bts_amr_fr_thres3_cmd);
4057 install_element(BTS_NODE, &cfg_bts_amr_fr_hyst1_cmd);
4058 install_element(BTS_NODE, &cfg_bts_amr_fr_hyst2_cmd);
4059 install_element(BTS_NODE, &cfg_bts_amr_fr_hyst3_cmd);
4060 install_element(BTS_NODE, &cfg_bts_amr_fr_start_mode_cmd);
4061 install_element(BTS_NODE, &cfg_bts_amr_hr_modes1_cmd);
4062 install_element(BTS_NODE, &cfg_bts_amr_hr_modes2_cmd);
4063 install_element(BTS_NODE, &cfg_bts_amr_hr_modes3_cmd);
4064 install_element(BTS_NODE, &cfg_bts_amr_hr_modes4_cmd);
4065 install_element(BTS_NODE, &cfg_bts_amr_hr_thres1_cmd);
4066 install_element(BTS_NODE, &cfg_bts_amr_hr_thres2_cmd);
4067 install_element(BTS_NODE, &cfg_bts_amr_hr_thres3_cmd);
4068 install_element(BTS_NODE, &cfg_bts_amr_hr_hyst1_cmd);
4069 install_element(BTS_NODE, &cfg_bts_amr_hr_hyst2_cmd);
4070 install_element(BTS_NODE, &cfg_bts_amr_hr_hyst3_cmd);
4071 install_element(BTS_NODE, &cfg_bts_amr_hr_start_mode_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00004072
Harald Welte5258fc42009-03-28 19:07:53 +00004073 install_element(BTS_NODE, &cfg_trx_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00004074 install_node(&trx_node, dummy_config_write);
Jacob Erlbeck36722e12013-10-29 09:30:30 +01004075 vty_install_default(TRX_NODE);
Harald Welte5258fc42009-03-28 19:07:53 +00004076 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02004077 install_element(TRX_NODE, &cfg_description_cmd);
4078 install_element(TRX_NODE, &cfg_no_description_cmd);
Harald Welte (local)7b37d972009-12-27 20:56:38 +01004079 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte879dc972009-06-20 22:36:12 +02004080 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte42581822009-08-08 16:12:58 +02004081 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
4082 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01004083 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00004084
Harald Welte5258fc42009-03-28 19:07:53 +00004085 install_element(TRX_NODE, &cfg_ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00004086 install_node(&ts_node, dummy_config_write);
Jacob Erlbeck36722e12013-10-29 09:30:30 +01004087 vty_install_default(TS_NODE);
Harald Weltea6fd58e2009-08-07 00:25:23 +02004088 install_element(TS_NODE, &cfg_ts_pchan_cmd);
Harald Welte4ab9d7c2012-08-17 12:42:06 +02004089 install_element(TS_NODE, &cfg_ts_pchan_compat_cmd);
Harald Welte135a6482011-05-30 12:09:13 +02004090 install_element(TS_NODE, &cfg_ts_tsc_cmd);
Harald Weltea39b0f22010-06-14 22:26:10 +02004091 install_element(TS_NODE, &cfg_ts_hopping_cmd);
Harald Welte6e0cd042009-09-12 13:05:33 +02004092 install_element(TS_NODE, &cfg_ts_hsn_cmd);
4093 install_element(TS_NODE, &cfg_ts_maio_cmd);
4094 install_element(TS_NODE, &cfg_ts_arfcn_add_cmd);
4095 install_element(TS_NODE, &cfg_ts_arfcn_del_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02004096 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00004097
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02004098 install_element(ENABLE_NODE, &drop_bts_cmd);
Holger Hans Peter Freyther740e65f2016-03-16 13:45:23 +01004099 install_element(ENABLE_NODE, &restart_bts_cmd);
Harald Welted0d2b0b2010-12-23 13:18:07 +01004100 install_element(ENABLE_NODE, &pdch_act_cmd);
Harald Welte30f1f372014-12-28 15:00:45 +01004101 install_element(ENABLE_NODE, &smscb_cmd_cmd);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02004102
Harald Welte81c9b9c2010-05-31 16:40:40 +02004103 abis_nm_vty_init();
Harald Weltee1d5eca2011-02-12 14:42:59 +01004104 abis_om2k_vty_init();
Harald Welte3016d9f2011-02-05 13:54:41 +01004105 e1inp_vty_init();
Harald Welte42def722017-01-13 00:10:32 +01004106 osmo_fsm_vty_add_cmds();
Harald Welte81c9b9c2010-05-31 16:40:40 +02004107
Harald Weltedcccb182010-05-16 20:52:23 +02004108 bsc_vty_init_extra();
Harald Welte40f82892009-05-23 17:31:39 +00004109
Harald Welte68628e82009-03-10 12:17:57 +00004110 return 0;
4111}