blob: c1882fcf472530e6d2ec8e4f60ba63328b5c3be3 [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);
Maxf9685c12017-03-23 12:01:07 +0100248 if (strnlen(bts->pcu_version, MAX_VERSION_LENGTH))
249 vty_out(vty, "PCU version %s connected%s", bts->pcu_version,
250 VTY_NEWLINE);
Harald Welte1d8dbc42009-12-12 15:38:16 +0100251 vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100252 vty_out(vty, "Minimum Rx Level for Access: %i dBm%s",
Harald Welte1d8dbc42009-12-12 15:38:16 +0100253 rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min),
254 VTY_NEWLINE);
255 vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s",
Harald Welte73225282009-12-12 18:17:25 +0100256 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100257 vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer,
258 VTY_NEWLINE);
259 vty_out(vty, "RACH Max transmissions: %u%s",
260 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
261 VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100262 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200263 vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE);
Maxc08ee712016-05-11 12:45:13 +0200264 if (bts->dtxu != GSM48_DTX_SHALL_NOT_BE_USED)
265 vty_out(vty, "Uplink DTX: %s%s",
266 (bts->dtxu != GSM48_DTX_SHALL_BE_USED) ?
267 "enabled" : "forced", VTY_NEWLINE);
268 else
269 vty_out(vty, "Uplink DTX: not enabled%s", VTY_NEWLINE);
270 vty_out(vty, "Downlink DTX: %senabled%s", bts->dtxd ? "" : "not ",
271 VTY_NEWLINE);
Andreas Eversberg2ee7ecd2012-10-13 07:27:47 +0200272 vty_out(vty, "Channel Description Attachment: %s%s",
273 (bts->si_common.chan_desc.att) ? "yes" : "no", VTY_NEWLINE);
274 vty_out(vty, "Channel Description BS-PA-MFRMS: %u%s",
275 bts->si_common.chan_desc.bs_pa_mfrms + 2, VTY_NEWLINE);
276 vty_out(vty, "Channel Description BS-AG_BLKS-RES: %u%s",
277 bts->si_common.chan_desc.bs_ag_blks_res, VTY_NEWLINE);
Harald Welte9fbff4a2010-07-30 11:50:09 +0200278 vty_out(vty, "System Information present: 0x%08x, static: 0x%08x%s",
279 bts->si_valid, bts->si_mode_static, VTY_NEWLINE);
Harald Welte42def722017-01-13 00:10:32 +0100280 vty_out(vty, "Early Classmark Sending: %s%s",
281 bts->early_classmark_allowed ? "allowed" : "forbidden",
282 VTY_NEWLINE);
Harald Welte4cc34222009-05-01 15:12:31 +0000283 if (is_ipaccess_bts(bts))
Harald Welte8175e952009-10-20 00:22:00 +0200284 vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
Harald Welte4cc34222009-05-01 15:12:31 +0000285 bts->ip_access.site_id, bts->ip_access.bts_id,
Harald Welte8175e952009-10-20 00:22:00 +0200286 bts->oml_tei, VTY_NEWLINE);
Sylvain Munautc9519462011-10-17 14:04:55 +0200287 else if (bts->type == GSM_BTS_TYPE_NOKIA_SITE)
288 vty_out(vty, " Skip Reset: %d%s",
289 bts->nokia.skip_reset, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000290 vty_out(vty, " NM State: ");
Harald Welted64c0bc2011-05-30 12:07:53 +0200291 net_dump_nmstate(vty, &bts->mo.nm_state);
Harald Welte68628e82009-03-10 12:17:57 +0000292 vty_out(vty, " Site Mgr NM State: ");
Harald Welted64c0bc2011-05-30 12:07:53 +0200293 net_dump_nmstate(vty, &bts->site_mgr.mo.nm_state);
Holger Hans Peter Freyther846d8dc2013-05-29 16:22:09 +0200294 vty_out(vty, " GPRS NSE: ");
295 net_dump_nmstate(vty, &bts->gprs.nse.mo.nm_state);
296 vty_out(vty, " GPRS CELL: ");
297 net_dump_nmstate(vty, &bts->gprs.cell.mo.nm_state);
298 vty_out(vty, " GPRS NSVC0: ");
299 net_dump_nmstate(vty, &bts->gprs.nsvc[0].mo.nm_state);
300 vty_out(vty, " GPRS NSVC1: ");
301 net_dump_nmstate(vty, &bts->gprs.nsvc[1].mo.nm_state);
Holger Hans Peter Freyther66e14cd2011-04-26 15:52:34 +0200302 vty_out(vty, " Paging: %u pending requests, %u free slots%s",
303 paging_pending_requests_nr(bts),
Harald Welte68628e82009-03-10 12:17:57 +0000304 bts->paging.available_slots, VTY_NEWLINE);
Holger Hans Peter Freytherd283db42010-11-25 16:28:45 +0100305 if (is_ipaccess_bts(bts)) {
306 vty_out(vty, " OML Link state: %s.%s",
307 bts->oml_link ? "connected" : "disconnected", VTY_NEWLINE);
308 } else {
Harald Welte8175e952009-10-20 00:22:00 +0200309 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
310 e1isl_dump_vty(vty, bts->oml_link);
311 }
Holger Hans Peter Freytherd283db42010-11-25 16:28:45 +0100312
313 /* FIXME: chan_desc */
Harald Welteb908cb72009-12-22 13:09:29 +0100314 memset(&pl, 0, sizeof(pl));
Neels Hofmeyr2afffd52016-09-25 17:01:20 +0200315 bts_chan_load(&pl, bts);
Harald Welteb908cb72009-12-22 13:09:29 +0100316 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
317 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte68628e82009-03-10 12:17:57 +0000318}
319
Sylvain Munaut39c31de2012-12-28 12:15:11 +0100320DEFUN(show_bts, show_bts_cmd, "show bts [<0-255>]",
Harald Welte68628e82009-03-10 12:17:57 +0000321 SHOW_STR "Display information about a BTS\n"
322 "BTS number")
323{
Harald Weltedcccb182010-05-16 20:52:23 +0200324 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000325 int bts_nr;
326
327 if (argc != 0) {
328 /* use the BTS number that the user has specified */
329 bts_nr = atoi(argv[0]);
Harald Welte712ddbc2010-12-24 12:24:03 +0100330 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000331 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000332 VTY_NEWLINE);
333 return CMD_WARNING;
334 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200335 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000336 return CMD_SUCCESS;
337 }
338 /* print all BTS's */
339 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee441d9c2009-06-21 16:17:15 +0200340 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte68628e82009-03-10 12:17:57 +0000341
342 return CMD_SUCCESS;
343}
344
Harald Welte42581822009-08-08 16:12:58 +0200345/* utility functions */
346static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
347 const char *ts, const char *ss)
348{
349 e1_link->e1_nr = atoi(line);
350 e1_link->e1_ts = atoi(ts);
351 if (!strcmp(ss, "full"))
352 e1_link->e1_ts_ss = 255;
353 else
354 e1_link->e1_ts_ss = atoi(ss);
355}
356
357static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,
358 const char *prefix)
359{
360 if (!e1_link->e1_ts)
361 return;
362
363 if (e1_link->e1_ts_ss == 255)
364 vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s",
365 prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE);
366 else
367 vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s",
368 prefix, e1_link->e1_nr, e1_link->e1_ts,
369 e1_link->e1_ts_ss, VTY_NEWLINE);
370}
371
372
Harald Welte67ce0732009-08-06 19:06:46 +0200373static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
374{
Neels Hofmeyr9c4f1d62016-01-27 14:20:29 +0100375 vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
Harald Weltea2bbc5e2015-11-20 10:43:31 +0100376 if (ts->tsc != -1)
Neels Hofmeyr9c4f1d62016-01-27 14:20:29 +0100377 vty_out(vty, " training_sequence_code %u%s", ts->tsc, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200378 if (ts->pchan != GSM_PCHAN_NONE)
Neels Hofmeyr9c4f1d62016-01-27 14:20:29 +0100379 vty_out(vty, " phys_chan_config %s%s",
Harald Welte42581822009-08-08 16:12:58 +0200380 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
Neels Hofmeyr9c4f1d62016-01-27 14:20:29 +0100381 vty_out(vty, " hopping enabled %u%s",
Harald Weltea39b0f22010-06-14 22:26:10 +0200382 ts->hopping.enabled, VTY_NEWLINE);
383 if (ts->hopping.enabled) {
384 unsigned int i;
Neels Hofmeyr9c4f1d62016-01-27 14:20:29 +0100385 vty_out(vty, " hopping sequence-number %u%s",
Harald Welte6e0cd042009-09-12 13:05:33 +0200386 ts->hopping.hsn, VTY_NEWLINE);
Neels Hofmeyr9c4f1d62016-01-27 14:20:29 +0100387 vty_out(vty, " hopping maio %u%s",
Harald Welte6e0cd042009-09-12 13:05:33 +0200388 ts->hopping.maio, VTY_NEWLINE);
Harald Weltea39b0f22010-06-14 22:26:10 +0200389 for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) {
390 if (!bitvec_get_bit_pos(&ts->hopping.arfcns, i))
391 continue;
Neels Hofmeyr9c4f1d62016-01-27 14:20:29 +0100392 vty_out(vty, " hopping arfcn add %u%s",
Harald Weltea39b0f22010-06-14 22:26:10 +0200393 i, VTY_NEWLINE);
394 }
Harald Welte127af342010-12-24 12:07:07 +0100395 }
Neels Hofmeyr9c4f1d62016-01-27 14:20:29 +0100396 config_write_e1_link(vty, &ts->e1_link, " ");
Harald Welteface7ed2011-02-14 16:15:21 +0100397
398 if (ts->trx->bts->model->config_write_ts)
399 ts->trx->bts->model->config_write_ts(vty, ts);
Harald Welte67ce0732009-08-06 19:06:46 +0200400}
401
402static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
403{
404 int i;
405
Harald Welte5013b2a2009-08-07 13:29:14 +0200406 vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200407 if (trx->description)
408 vty_out(vty, " description %s%s", trx->description,
409 VTY_NEWLINE);
Holger Hans Peter Freyther2ba40af2010-04-17 06:42:07 +0200410 vty_out(vty, " rf_locked %u%s",
Harald Welted64c0bc2011-05-30 12:07:53 +0200411 trx->mo.nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
Holger Hans Peter Freyther2ba40af2010-04-17 06:42:07 +0200412 VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200413 vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
Harald Welte (local)7b37d972009-12-27 20:56:38 +0100414 vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200415 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200416 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
417 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte67ce0732009-08-06 19:06:46 +0200418
Harald Welteface7ed2011-02-14 16:15:21 +0100419 if (trx->bts->model->config_write_trx)
420 trx->bts->model->config_write_trx(vty, trx);
421
Harald Welte67ce0732009-08-06 19:06:46 +0200422 for (i = 0; i < TRX_NR_TS; i++)
423 config_write_ts_single(vty, &trx->ts[i]);
424}
425
Harald Welte615e9562010-05-11 23:50:21 +0200426static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
427{
428 unsigned int i;
429 vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode),
430 VTY_NEWLINE);
431 if (bts->gprs.mode == BTS_GPRS_NONE)
432 return;
433
bhargava350533c2016-07-21 11:14:34 +0530434 vty_out(vty, " gprs 11bit_rach_support_for_egprs %u%s",
435 bts->gprs.supports_egprs_11bit_rach, VTY_NEWLINE);
436
Harald Welte615e9562010-05-11 23:50:21 +0200437 vty_out(vty, " gprs routing area %u%s", bts->gprs.rac,
438 VTY_NEWLINE);
Andreas Eversberg0c8f9ca2013-03-16 16:31:26 +0100439 vty_out(vty, " gprs network-control-order nc%u%s",
440 bts->gprs.net_ctrl_ord, VTY_NEWLINE);
Max292ec582016-07-28 11:55:37 +0200441 if (!bts->gprs.ctrl_ack_type_use_block)
442 vty_out(vty, " gprs control-ack-type-rach%s", VTY_NEWLINE);
Harald Welte615e9562010-05-11 23:50:21 +0200443 vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
444 VTY_NEWLINE);
445 for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++)
446 vty_out(vty, " gprs cell timer %s %u%s",
447 get_value_string(gprs_bssgp_cfg_strs, i),
448 bts->gprs.cell.timer[i], VTY_NEWLINE);
449 vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei,
450 VTY_NEWLINE);
451 for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++)
452 vty_out(vty, " gprs ns timer %s %u%s",
453 get_value_string(gprs_ns_timer_strs, i),
454 bts->gprs.nse.timer[i], VTY_NEWLINE);
455 for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
456 struct gsm_bts_gprs_nsvc *nsvc =
457 &bts->gprs.nsvc[i];
458 struct in_addr ia;
459
460 ia.s_addr = htonl(nsvc->remote_ip);
461 vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
462 nsvc->nsvci, VTY_NEWLINE);
463 vty_out(vty, " gprs nsvc %u local udp port %u%s", i,
464 nsvc->local_port, VTY_NEWLINE);
465 vty_out(vty, " gprs nsvc %u remote udp port %u%s", i,
466 nsvc->remote_port, VTY_NEWLINE);
467 vty_out(vty, " gprs nsvc %u remote ip %s%s", i,
468 inet_ntoa(ia), VTY_NEWLINE);
469 }
470}
471
Holger Hans Peter Freythercd40fb42013-09-15 17:23:34 +0200472/* Write the model data if there is one */
473static void config_write_bts_model(struct vty *vty, struct gsm_bts *bts)
Harald Welte67ce0732009-08-06 19:06:46 +0200474{
475 struct gsm_bts_trx *trx;
Holger Hans Peter Freythercd40fb42013-09-15 17:23:34 +0200476
477 if (!bts->model)
478 return;
479
480 if (bts->model->config_write_bts)
481 bts->model->config_write_bts(vty, bts);
482
483 llist_for_each_entry(trx, &bts->trx_list, list)
484 config_write_trx_single(vty, trx);
485}
486
Holger Hans Peter Freythera174a472015-09-24 11:39:38 +0200487static void write_amr_modes(struct vty *vty, const char *prefix,
488 const char *name, struct amr_mode *modes, int num)
489{
490 int i;
491
492 vty_out(vty, " %s threshold %s", prefix, name);
493 for (i = 0; i < num - 1; i++)
494 vty_out(vty, " %d", modes[i].threshold);
495 vty_out(vty, "%s", VTY_NEWLINE);
496 vty_out(vty, " %s hysteresis %s", prefix, name);
497 for (i = 0; i < num - 1; i++)
498 vty_out(vty, " %d", modes[i].hysteresis);
499 vty_out(vty, "%s", VTY_NEWLINE);
500}
501
Andreas Eversberg73266522014-01-19 11:47:44 +0100502static void config_write_bts_amr(struct vty *vty, struct gsm_bts *bts,
503 struct amr_multirate_conf *mr, int full)
504{
505 struct gsm48_multi_rate_conf *mr_conf;
506 const char *prefix = (full) ? "amr tch-f" : "amr tch-h";
507 int i, num;
508
509 if (!(mr->gsm48_ie[1]))
510 return;
511
512 mr_conf = (struct gsm48_multi_rate_conf *) mr->gsm48_ie;
513
514 num = 0;
515 vty_out(vty, " %s modes", prefix);
516 for (i = 0; i < ((full) ? 8 : 6); i++) {
517 if ((mr->gsm48_ie[1] & (1 << i))) {
518 vty_out(vty, " %d", i);
519 num++;
520 }
521 }
522 vty_out(vty, "%s", VTY_NEWLINE);
523 if (num > 4)
524 num = 4;
525 if (num > 1) {
Holger Hans Peter Freythera174a472015-09-24 11:39:38 +0200526 write_amr_modes(vty, prefix, "ms", mr->ms_mode, num);
527 write_amr_modes(vty, prefix, "bts", mr->bts_mode, num);
Andreas Eversberg73266522014-01-19 11:47:44 +0100528 }
529 vty_out(vty, " %s start-mode ", prefix);
530 if (mr_conf->icmi) {
531 num = 0;
532 for (i = 0; i < ((full) ? 8 : 6) && num < 4; i++) {
533 if ((mr->gsm48_ie[1] & (1 << i)))
534 num++;
535 if (mr_conf->smod == num - 1) {
536 vty_out(vty, "%d%s", num, VTY_NEWLINE);
537 break;
538 }
539 }
540 } else
541 vty_out(vty, "auto%s", VTY_NEWLINE);
542}
543
Holger Hans Peter Freythercd40fb42013-09-15 17:23:34 +0200544static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
545{
Harald Welte9fbff4a2010-07-30 11:50:09 +0200546 int i;
Max2c16bee2017-02-15 13:51:37 +0100547 uint8_t tmp;
Harald Welte67ce0732009-08-06 19:06:46 +0200548
Harald Welte5013b2a2009-08-07 13:29:14 +0200549 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
550 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200551 if (bts->description)
552 vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200553 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freytherf926ed62009-11-19 16:38:49 +0100554 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200555 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte67ce0732009-08-06 19:06:46 +0200556 VTY_NEWLINE);
Maxc08ee712016-05-11 12:45:13 +0200557 if (bts->dtxu != GSM48_DTX_SHALL_NOT_BE_USED)
558 vty_out(vty, " dtx uplink%s%s",
559 (bts->dtxu != GSM48_DTX_SHALL_BE_USED) ? "" : " force",
560 VTY_NEWLINE);
561 if (bts->dtxd)
562 vty_out(vty, " dtx downlink%s", VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200563 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)0e451d02009-08-13 10:14:26 +0200564 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +0100565 vty_out(vty, " cell reselection hysteresis %u%s",
566 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
567 vty_out(vty, " rxlev access min %u%s",
568 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Sylvain Munaute0b06b02010-11-28 18:17:28 +0100569
570 if (bts->si_common.cell_ro_sel_par.present) {
571 struct gsm48_si_selection_params *sp;
572 sp = &bts->si_common.cell_ro_sel_par;
573
574 if (sp->cbq)
575 vty_out(vty, " cell bar qualify %u%s",
576 sp->cbq, VTY_NEWLINE);
577
578 if (sp->cell_resel_off)
579 vty_out(vty, " cell reselection offset %u%s",
580 sp->cell_resel_off*2, VTY_NEWLINE);
581
582 if (sp->temp_offs == 7)
583 vty_out(vty, " temporary offset infinite%s",
584 VTY_NEWLINE);
585 else if (sp->temp_offs)
586 vty_out(vty, " temporary offset %u%s",
587 sp->temp_offs*10, VTY_NEWLINE);
588
589 if (sp->penalty_time == 31)
590 vty_out(vty, " penalty time reserved%s",
591 VTY_NEWLINE);
592 else if (sp->penalty_time)
593 vty_out(vty, " penalty time %u%s",
594 (sp->penalty_time*20)+20, VTY_NEWLINE);
595 }
596
Holger Hans Peter Freytherc63f6f12013-07-27 21:07:57 +0200597 /* Is periodic LU enabled or disabled? */
598 if (bts->si_common.chan_desc.t3212 == 0)
599 vty_out(vty, " no periodic location update%s", VTY_NEWLINE);
600 else
601 vty_out(vty, " periodic location update %u%s",
602 bts->si_common.chan_desc.t3212 * 6, VTY_NEWLINE);
603
Andreas Eversberg4d4944a2013-03-10 11:49:35 +0100604 vty_out(vty, " radio-link-timeout %d%s",
605 get_radio_link_timeout(&bts->si_common.cell_options),
606 VTY_NEWLINE);
Harald Welte7a8fa412009-08-10 13:48:16 +0200607 vty_out(vty, " channel allocator %s%s",
608 bts->chan_alloc_reverse ? "descending" : "ascending",
609 VTY_NEWLINE);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +0100610 vty_out(vty, " rach tx integer %u%s",
611 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
612 vty_out(vty, " rach max transmission %u%s",
613 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
614 VTY_NEWLINE);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +0800615
Andreas Eversberg2ee7ecd2012-10-13 07:27:47 +0200616 vty_out(vty, " channel-descrption attach %u%s",
617 bts->si_common.chan_desc.att, VTY_NEWLINE);
618 vty_out(vty, " channel-descrption bs-pa-mfrms %u%s",
619 bts->si_common.chan_desc.bs_pa_mfrms + 2, VTY_NEWLINE);
620 vty_out(vty, " channel-descrption bs-ag-blks-res %u%s",
621 bts->si_common.chan_desc.bs_ag_blks_res, VTY_NEWLINE);
622
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +0800623 if (bts->rach_b_thresh != -1)
624 vty_out(vty, " rach nm busy threshold %u%s",
625 bts->rach_b_thresh, VTY_NEWLINE);
626 if (bts->rach_ldavg_slots != -1)
627 vty_out(vty, " rach nm load average %u%s",
628 bts->rach_ldavg_slots, VTY_NEWLINE);
Harald Welte71355012009-12-21 23:08:18 +0100629 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200630 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +0800631 if ((bts->si_common.rach_control.t2 & 0x4) == 0)
632 vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE);
Ivan Kluchnikov67920592013-09-16 13:13:04 +0400633 if ((bts->si_common.rach_control.t3) != 0)
634 for (i = 0; i < 8; i++)
635 if (bts->si_common.rach_control.t3 & (0x1 << i))
636 vty_out(vty, " rach access-control-class %d barred%s", i, VTY_NEWLINE);
637 if ((bts->si_common.rach_control.t2 & 0xfb) != 0)
638 for (i = 0; i < 8; i++)
639 if ((i != 2) && (bts->si_common.rach_control.t2 & (0x1 << i)))
640 vty_out(vty, " rach access-control-class %d barred%s", i+8, VTY_NEWLINE);
Harald Welte9fbff4a2010-07-30 11:50:09 +0200641 for (i = SYSINFO_TYPE_1; i < _MAX_SYSINFO_TYPE; i++) {
642 if (bts->si_mode_static & (1 << i)) {
643 vty_out(vty, " system-information %s mode static%s",
644 get_value_string(osmo_sitype_strs, i), VTY_NEWLINE);
645 vty_out(vty, " system-information %s static %s%s",
646 get_value_string(osmo_sitype_strs, i),
Sylvain Munaut63ef2152011-11-13 23:05:23 +0100647 osmo_hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])),
Harald Welte9fbff4a2010-07-30 11:50:09 +0200648 VTY_NEWLINE);
649 }
650 }
Harald Welte42def722017-01-13 00:10:32 +0100651 vty_out(vty, " early-classmark-sending %s%s",
652 bts->early_classmark_allowed ? "allowed" : "forbidden", VTY_NEWLINE);
Harald Weltefd355a32011-03-04 13:41:31 +0100653 switch (bts->type) {
654 case GSM_BTS_TYPE_NANOBTS:
Maxf9685c12017-03-23 12:01:07 +0100655 case GSM_BTS_TYPE_OSMOBTS:
Harald Welte5013b2a2009-08-07 13:29:14 +0200656 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Weltea6fd58e2009-08-07 00:25:23 +0200657 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte8b291802013-03-12 13:57:05 +0100658 if (bts->ip_access.rsl_ip) {
659 struct in_addr ia;
660 ia.s_addr = htonl(bts->ip_access.rsl_ip);
661 vty_out(vty, " ip.access rsl-ip %s%s", inet_ntoa(ia),
662 VTY_NEWLINE);
663 }
Pablo Neira Ayusoed5cacb2011-08-17 22:44:07 +0200664 vty_out(vty, " oml ip.access stream_id %u line %u%s",
665 bts->oml_tei, bts->oml_e1_link.e1_nr, VTY_NEWLINE);
Harald Weltefd355a32011-03-04 13:41:31 +0100666 break;
Sylvain Munautc9519462011-10-17 14:04:55 +0200667 case GSM_BTS_TYPE_NOKIA_SITE:
668 vty_out(vty, " nokia_site skip-reset %d%s", bts->nokia.skip_reset, VTY_NEWLINE);
Andreas Eversberg7d8fa342013-12-05 13:25:06 +0100669 vty_out(vty, " nokia_site no-local-rel-conf %d%s",
670 bts->nokia.no_loc_rel_cnf, VTY_NEWLINE);
Sipos Csaba56e17662015-02-07 13:27:36 +0100671 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 +0100672 /* fall through: Nokia requires "oml e1" parameters also */
Harald Weltefd355a32011-03-04 13:41:31 +0100673 default:
Harald Welte42581822009-08-08 16:12:58 +0200674 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
675 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
Harald Weltefd355a32011-03-04 13:41:31 +0100676 break;
Harald Welte42581822009-08-08 16:12:58 +0200677 }
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +0800678
679 /* if we have a limit, write it */
680 if (bts->paging.free_chans_need >= 0)
681 vty_out(vty, " paging free %d%s", bts->paging.free_chans_need, VTY_NEWLINE);
682
Harald Welte32c09622011-01-11 23:44:56 +0100683 vty_out(vty, " neighbor-list mode %s%s",
Harald Welte64c07d22011-02-15 11:43:27 +0100684 get_value_string(bts_neigh_mode_strs, bts->neigh_list_manual_mode), VTY_NEWLINE);
685 if (bts->neigh_list_manual_mode != NL_MODE_AUTOMATIC) {
Harald Welte32c09622011-01-11 23:44:56 +0100686 for (i = 0; i < 1024; i++) {
687 if (bitvec_get_bit_pos(&bts->si_common.neigh_list, i))
688 vty_out(vty, " neighbor-list add arfcn %u%s",
689 i, VTY_NEWLINE);
690 }
691 }
Harald Welte64c07d22011-02-15 11:43:27 +0100692 if (bts->neigh_list_manual_mode == NL_MODE_MANUAL_SI5SEP) {
693 for (i = 0; i < 1024; i++) {
694 if (bitvec_get_bit_pos(&bts->si_common.si5_neigh_list, i))
695 vty_out(vty, " si5 neighbor-list add arfcn %u%s",
696 i, VTY_NEWLINE);
697 }
698 }
Harald Welte32c09622011-01-11 23:44:56 +0100699
Max59a1bf32016-04-15 16:04:46 +0200700 for (i = 0; i < MAX_EARFCN_LIST; i++) {
Max2c16bee2017-02-15 13:51:37 +0100701 struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list;
702 if (e->arfcn[i] != OSMO_EARFCN_INVALID) {
703 vty_out(vty, " si2quater neighbor-list add earfcn %u "
704 "thresh-hi %u", e->arfcn[i], e->thresh_hi);
705
706 vty_out(vty, " thresh-lo %u",
707 e->thresh_lo_valid ? e->thresh_lo : 32);
708
709 vty_out(vty, " prio %u",
710 e->prio_valid ? e->prio : 8);
711
712 vty_out(vty, " qrxlv %u",
713 e->qrxlm_valid ? e->qrxlm : 32);
714
715 tmp = e->meas_bw[i];
716 vty_out(vty, " meas %u",
717 (tmp != OSMO_EARFCN_MEAS_INVALID) ? tmp : 8);
Max59a1bf32016-04-15 16:04:46 +0200718
719 vty_out(vty, "%s", VTY_NEWLINE);
720 }
721 }
722
Max26679e02016-04-20 15:57:13 +0200723 for (i = 0; i < bts->si_common.uarfcn_length; i++) {
724 vty_out(vty, " si2quater neighbor-list add uarfcn %u %u %u%s",
725 bts->si_common.data.uarfcn_list[i],
726 bts->si_common.data.scramble_list[i] & ~(1 << 9),
727 (bts->si_common.data.scramble_list[i] >> 9) & 1,
728 VTY_NEWLINE);
729 }
730
Andreas Eversberga83d5112013-12-07 18:32:28 +0100731 vty_out(vty, " codec-support fr");
732 if (bts->codec.hr)
733 vty_out(vty, " hr");
734 if (bts->codec.efr)
735 vty_out(vty, " efr");
736 if (bts->codec.amr)
737 vty_out(vty, " amr");
738 vty_out(vty, "%s", VTY_NEWLINE);
739
Andreas Eversberg73266522014-01-19 11:47:44 +0100740 config_write_bts_amr(vty, bts, &bts->mr_full, 1);
741 config_write_bts_amr(vty, bts, &bts->mr_half, 0);
742
Harald Welte615e9562010-05-11 23:50:21 +0200743 config_write_bts_gprs(vty, bts);
Harald Welte67ce0732009-08-06 19:06:46 +0200744
Holger Hans Peter Freythere30d40d2012-07-20 10:27:31 +0200745 if (bts->excl_from_rf_lock)
746 vty_out(vty, " rf-lock-exclude%s", VTY_NEWLINE);
747
Jacob Erlbeck65d114f2014-01-16 11:02:14 +0100748 vty_out(vty, " %sforce-combined-si%s",
749 bts->force_combined_si ? "" : "no ", VTY_NEWLINE);
750
Holger Hans Peter Freytherc22930e2014-12-17 14:46:17 +0100751 for (i = 0; i < ARRAY_SIZE(bts->depends_on); ++i) {
752 int j;
753
754 if (bts->depends_on[i] == 0)
755 continue;
756
757 for (j = 0; j < sizeof(bts->depends_on[i]) * 8; ++j) {
758 int bts_nr;
759
760 if ((bts->depends_on[i] & (1<<j)) == 0)
761 continue;
762
763 bts_nr = (i * sizeof(bts->depends_on[i]) * 8) + j;
764 vty_out(vty, " depends-on-bts %d%s", bts_nr, VTY_NEWLINE);
765 }
766 }
767
Holger Hans Peter Freythercd40fb42013-09-15 17:23:34 +0200768 config_write_bts_model(vty, bts);
Harald Welte67ce0732009-08-06 19:06:46 +0200769}
770
771static int config_write_bts(struct vty *v)
772{
Harald Weltedcccb182010-05-16 20:52:23 +0200773 struct gsm_network *gsmnet = gsmnet_from_vty(v);
Harald Welte67ce0732009-08-06 19:06:46 +0200774 struct gsm_bts *bts;
775
776 llist_for_each_entry(bts, &gsmnet->bts_list, list)
777 config_write_bts_single(v, bts);
778
779 return CMD_SUCCESS;
780}
781
Harald Welte5013b2a2009-08-07 13:29:14 +0200782static int config_write_net(struct vty *vty)
783{
Harald Weltedcccb182010-05-16 20:52:23 +0200784 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
785
Harald Welte5013b2a2009-08-07 13:29:14 +0200786 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200787 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Welte5013b2a2009-08-07 13:29:14 +0200788 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte42581822009-08-08 16:12:58 +0200789 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
790 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)69de3972009-08-12 14:42:23 +0200791 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Maxddee01f2016-05-24 14:23:27 +0200792 if (gsmnet->authorized_reg_str)
793 vty_out(vty, " authorized-regexp %s%s", gsmnet->authorized_reg_str, VTY_NEWLINE);
Harald Welte1085c092009-11-18 20:33:19 +0100794 vty_out(vty, " location updating reject cause %u%s",
795 gsmnet->reject_cause, VTY_NEWLINE);
Harald Welte4381cfe2009-08-30 15:47:06 +0900796 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freytherd54c3372009-11-19 16:37:48 +0100797 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +0800798 vty_out(vty, " paging any use tch %d%s", gsmnet->pag_any_tch, VTY_NEWLINE);
Harald Welteeab84a12009-12-13 10:53:12 +0100799 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
800 VTY_NEWLINE);
Harald Welte648b6ce2009-12-14 09:00:24 +0100801 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Weltebc814502009-12-19 21:41:52 +0100802 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Welteb720bd32009-12-21 16:51:50 +0100803 vty_out(vty, " handover window rxlev averaging %u%s",
804 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
805 vty_out(vty, " handover window rxqual averaging %u%s",
806 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
807 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
808 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
809 vty_out(vty, " handover power budget interval %u%s",
810 gsmnet->handover.pwr_interval, VTY_NEWLINE);
811 vty_out(vty, " handover power budget hysteresis %u%s",
812 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
813 vty_out(vty, " handover maximum distance %u%s",
814 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +0100815 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100816 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
817 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
818 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
819 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
820 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
821 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
822 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
823 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
824 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
Harald Welte2862dca2010-12-23 14:39:29 +0100825 vty_out(vty, " timer t3122 %u%s", gsmnet->T3122, VTY_NEWLINE);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100826 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Vadim Yanitskiy7f3724e2017-03-31 23:27:44 +0700827 vty_out(vty, " dyn_ts_allow_tch_f %d%s",
828 gsmnet->dyn_ts_allow_tch_f ? 1 : 0, VTY_NEWLINE);
Holger Hans Peter Freytherae9006a2010-12-22 16:26:04 +0100829 vty_out(vty, " subscriber-keep-in-ram %d%s",
Jacob Erlbeck1e30a282014-12-03 09:28:24 +0100830 gsmnet->subscr_group->keep_subscr, VTY_NEWLINE);
Neels Hofmeyr73983952016-05-10 13:29:33 +0200831 if (gsmnet->tz.override != 0) {
832 if (gsmnet->tz.dst)
833 vty_out(vty, " timezone %d %d %d%s",
834 gsmnet->tz.hr, gsmnet->tz.mn, gsmnet->tz.dst,
835 VTY_NEWLINE);
836 else
837 vty_out(vty, " timezone %d %d%s",
838 gsmnet->tz.hr, gsmnet->tz.mn, VTY_NEWLINE);
839 }
Harald Welte5013b2a2009-08-07 13:29:14 +0200840
841 return CMD_SUCCESS;
842}
Harald Welte67ce0732009-08-06 19:06:46 +0200843
Harald Welte68628e82009-03-10 12:17:57 +0000844static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
845{
846 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
847 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Welte197dea92010-05-14 17:59:53 +0200848 vty_out(vty, "Description: %s%s",
849 trx->description ? trx->description : "(null)", VTY_NEWLINE);
Harald Weltefcd24452009-06-20 18:15:19 +0200850 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte42581822009-08-08 16:12:58 +0200851 "resulting BS power: %d dBm%s",
Harald Weltefcd24452009-06-20 18:15:19 +0200852 trx->nominal_power, trx->max_power_red,
Harald Welte42581822009-08-08 16:12:58 +0200853 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000854 vty_out(vty, " NM State: ");
Harald Welted64c0bc2011-05-30 12:07:53 +0200855 net_dump_nmstate(vty, &trx->mo.nm_state);
Harald Welte68628e82009-03-10 12:17:57 +0000856 vty_out(vty, " Baseband Transceiver NM State: ");
Harald Welted64c0bc2011-05-30 12:07:53 +0200857 net_dump_nmstate(vty, &trx->bb_transc.mo.nm_state);
Harald Welte8175e952009-10-20 00:22:00 +0200858 if (is_ipaccess_bts(trx->bts)) {
859 vty_out(vty, " ip.access stream ID: 0x%02x%s",
860 trx->rsl_tei, VTY_NEWLINE);
861 } else {
862 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
863 e1isl_dump_vty(vty, trx->rsl_link);
864 }
Harald Welte68628e82009-03-10 12:17:57 +0000865}
866
867DEFUN(show_trx,
868 show_trx_cmd,
Sylvain Munaut39c31de2012-12-28 12:15:11 +0100869 "show trx [<0-255>] [<0-255>]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200870 SHOW_STR "Display information about a TRX\n"
871 "BTS Number\n"
872 "TRX Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000873{
Harald Weltedcccb182010-05-16 20:52:23 +0200874 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +0000875 struct gsm_bts *bts = NULL;
876 struct gsm_bts_trx *trx;
877 int bts_nr, trx_nr;
878
879 if (argc >= 1) {
880 /* use the BTS number that the user has specified */
881 bts_nr = atoi(argv[0]);
882 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000883 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000884 VTY_NEWLINE);
885 return CMD_WARNING;
886 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200887 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000888 }
889 if (argc >= 2) {
890 trx_nr = atoi(argv[1]);
891 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000892 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000893 VTY_NEWLINE);
894 return CMD_WARNING;
895 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200896 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000897 trx_dump_vty(vty, trx);
898 return CMD_SUCCESS;
899 }
900 if (bts) {
901 /* print all TRX in this BTS */
902 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200903 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000904 trx_dump_vty(vty, trx);
905 }
906 return CMD_SUCCESS;
907 }
908
909 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200910 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000911 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200912 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000913 trx_dump_vty(vty, trx);
914 }
915 }
916
917 return CMD_SUCCESS;
918}
919
Harald Welte67ce0732009-08-06 19:06:46 +0200920
Harald Welte68628e82009-03-10 12:17:57 +0000921static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
922{
Harald Welte135a6482011-05-30 12:09:13 +0200923 vty_out(vty, "BTS %u, TRX %u, Timeslot %u, phys cfg %s, TSC %u",
Harald Welte026b4ca2010-12-24 12:12:10 +0100924 ts->trx->bts->nr, ts->trx->nr, ts->nr,
Harald Welte1fe24122014-01-19 17:18:21 +0100925 gsm_pchan_name(ts->pchan), gsm_ts_tsc(ts));
Harald Weltecd103a92010-12-24 12:14:52 +0100926 if (ts->pchan == GSM_PCHAN_TCH_F_PDCH)
Harald Welteb29cea12010-12-24 12:26:13 +0100927 vty_out(vty, " (%s mode)",
Neels Hofmeyr2ebacce2016-06-14 14:08:35 +0200928 ts->flags & TS_F_PDCH_ACTIVE ? "PDCH" : "TCH/F");
Harald Weltecd103a92010-12-24 12:14:52 +0100929 vty_out(vty, "%s", VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000930 vty_out(vty, " NM State: ");
Harald Welted64c0bc2011-05-30 12:07:53 +0200931 net_dump_nmstate(vty, &ts->mo.nm_state);
Harald Welte2c828992009-12-02 01:56:49 +0530932 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welteef235b52009-03-10 12:34:02 +0000933 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
934 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
935 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +0000936}
937
938DEFUN(show_ts,
939 show_ts_cmd,
Sylvain Munaut39c31de2012-12-28 12:15:11 +0100940 "show timeslot [<0-255>] [<0-255>] [<0-7>]",
Harald Welte8f0ed552010-05-11 21:53:49 +0200941 SHOW_STR "Display information about a TS\n"
942 "BTS Number\n" "TRX Number\n" "Timeslot Number\n")
Harald Welte68628e82009-03-10 12:17:57 +0000943{
Harald Weltedcccb182010-05-16 20:52:23 +0200944 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte274d0152010-12-24 12:05:03 +0100945 struct gsm_bts *bts = NULL;
946 struct gsm_bts_trx *trx = NULL;
947 struct gsm_bts_trx_ts *ts = NULL;
Harald Welte68628e82009-03-10 12:17:57 +0000948 int bts_nr, trx_nr, ts_nr;
949
950 if (argc >= 1) {
951 /* use the BTS number that the user has specified */
952 bts_nr = atoi(argv[0]);
953 if (bts_nr >= net->num_bts) {
Harald Welte1bc77352009-03-10 19:47:51 +0000954 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
Harald Welte68628e82009-03-10 12:17:57 +0000955 VTY_NEWLINE);
956 return CMD_WARNING;
957 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200958 bts = gsm_bts_num(net, bts_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000959 }
960 if (argc >= 2) {
961 trx_nr = atoi(argv[1]);
962 if (trx_nr >= bts->num_trx) {
Harald Welte1bc77352009-03-10 19:47:51 +0000963 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
Harald Welte68628e82009-03-10 12:17:57 +0000964 VTY_NEWLINE);
965 return CMD_WARNING;
966 }
Harald Weltee441d9c2009-06-21 16:17:15 +0200967 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000968 }
969 if (argc >= 3) {
970 ts_nr = atoi(argv[2]);
971 if (ts_nr >= TRX_NR_TS) {
Harald Welte1bc77352009-03-10 19:47:51 +0000972 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
Harald Welte68628e82009-03-10 12:17:57 +0000973 VTY_NEWLINE);
974 return CMD_WARNING;
975 }
Harald Welte274d0152010-12-24 12:05:03 +0100976 /* Fully Specified: print and exit */
Harald Welte68628e82009-03-10 12:17:57 +0000977 ts = &trx->ts[ts_nr];
978 ts_dump_vty(vty, ts);
979 return CMD_SUCCESS;
980 }
Harald Welte274d0152010-12-24 12:05:03 +0100981
982 if (bts && trx) {
983 /* Iterate over all TS in this TRX */
984 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
985 ts = &trx->ts[ts_nr];
986 ts_dump_vty(vty, ts);
987 }
988 } else if (bts) {
989 /* Iterate over all TRX in this BTS, TS in each TRX */
Harald Welte68628e82009-03-10 12:17:57 +0000990 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +0200991 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte68628e82009-03-10 12:17:57 +0000992 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
993 ts = &trx->ts[ts_nr];
994 ts_dump_vty(vty, ts);
995 }
996 }
Harald Welte274d0152010-12-24 12:05:03 +0100997 } else {
998 /* Iterate over all BTS, TRX in each BTS, TS in each TRX */
999 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
1000 bts = gsm_bts_num(net, bts_nr);
1001 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
1002 trx = gsm_bts_trx_num(bts, trx_nr);
1003 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
1004 ts = &trx->ts[ts_nr];
1005 ts_dump_vty(vty, ts);
1006 }
1007 }
1008 }
Harald Welte68628e82009-03-10 12:17:57 +00001009 }
1010
1011 return CMD_SUCCESS;
1012}
1013
Holger Hans Peter Freyther424c4f02010-01-06 06:00:40 +01001014static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte68628e82009-03-10 12:17:57 +00001015{
Harald Weltefcd24452009-06-20 18:15:19 +02001016 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte40f82892009-05-23 17:31:39 +00001017 subscr->authorized, VTY_NEWLINE);
Holger Hans Peter Freyther7f180e82013-12-12 15:45:41 +01001018 if (strlen(subscr->name))
Harald Welte1bc77352009-03-10 19:47:51 +00001019 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
Holger Hans Peter Freytherbd30cd32014-04-04 11:53:18 +02001020 if (strlen(subscr->extension))
Harald Welte68628e82009-03-10 12:17:57 +00001021 vty_out(vty, " Extension: %s%s", subscr->extension,
1022 VTY_NEWLINE);
Holger Hans Peter Freyther5ccd0152013-07-14 08:38:24 +02001023 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freyther22230252009-08-19 12:53:57 +02001024 if (subscr->tmsi != GSM_RESERVED_TMSI)
1025 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte731fd912009-08-15 03:24:51 +02001026 VTY_NEWLINE);
Sylvain Munautaf292642009-12-27 19:29:28 +01001027
Harald Welte (local)15920de2009-08-14 20:27:16 +02001028 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte68628e82009-03-10 12:17:57 +00001029}
1030
Neels Hofmeyr6d804b12017-02-18 22:20:46 +01001031static void bsc_subscr_dump_vty(struct vty *vty, struct bsc_subscr *bsub)
1032{
1033 if (strlen(bsub->imsi))
1034 vty_out(vty, " IMSI: %s%s", bsub->imsi, VTY_NEWLINE);
1035 if (bsub->tmsi != GSM_RESERVED_TMSI)
1036 vty_out(vty, " TMSI: 0x%08x%s", bsub->tmsi,
1037 VTY_NEWLINE);
1038 vty_out(vty, " Use count: %d%s", bsub->use_count, VTY_NEWLINE);
1039}
1040
Harald Welte8387a492009-12-22 21:43:14 +01001041static void meas_rep_dump_uni_vty(struct vty *vty,
1042 struct gsm_meas_rep_unidir *mru,
1043 const char *prefix,
1044 const char *dir)
1045{
1046 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
1047 prefix, dir, rxlev2dbm(mru->full.rx_lev),
1048 dir, rxlev2dbm(mru->sub.rx_lev));
1049 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
1050 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
1051 VTY_NEWLINE);
1052}
1053
1054static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
1055 const char *prefix)
1056{
1057 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
1058 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
1059 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
1060 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
1061 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
1062 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
1063 VTY_NEWLINE);
1064 if (mr->flags & MEAS_REP_F_MS_TO)
1065 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
1066 mr->ms_timing_offset, VTY_NEWLINE);
1067 if (mr->flags & MEAS_REP_F_MS_L1)
1068 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
1069 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
1070 if (mr->flags & MEAS_REP_F_DL_VALID)
1071 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
1072 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
1073}
1074
Harald Welte0a8cf322015-12-05 17:22:49 +01001075/* FIXME: move this to libosmogsm */
1076static const struct value_string gsm48_cmode_names[] = {
1077 { GSM48_CMODE_SIGN, "signalling" },
1078 { GSM48_CMODE_SPEECH_V1, "FR or HR" },
1079 { GSM48_CMODE_SPEECH_EFR, "EFR" },
1080 { GSM48_CMODE_SPEECH_AMR, "AMR" },
1081 { GSM48_CMODE_DATA_14k5, "CSD(14k5)" },
1082 { GSM48_CMODE_DATA_12k0, "CSD(12k0)" },
1083 { GSM48_CMODE_DATA_6k0, "CSD(6k0)" },
1084 { GSM48_CMODE_DATA_3k6, "CSD(3k6)" },
1085 { 0, NULL }
1086};
1087
Neels Hofmeyrb7480122016-11-02 14:28:15 +01001088/* call vty_out() to print a string like " as TCH/H" for dynamic timeslots.
1089 * Don't do anything if the ts is not dynamic. */
1090static void vty_out_dyn_ts_status(struct vty *vty, struct gsm_bts_trx_ts *ts)
1091{
1092 switch (ts->pchan) {
1093 case GSM_PCHAN_TCH_F_TCH_H_PDCH:
1094 if (ts->dyn.pchan_is == ts->dyn.pchan_want)
1095 vty_out(vty, " as %s",
1096 gsm_pchan_name(ts->dyn.pchan_is));
1097 else
1098 vty_out(vty, " switching %s -> %s",
1099 gsm_pchan_name(ts->dyn.pchan_is),
1100 gsm_pchan_name(ts->dyn.pchan_want));
1101 break;
1102 case GSM_PCHAN_TCH_F_PDCH:
1103 if ((ts->flags & TS_F_PDCH_PENDING_MASK) == 0)
1104 vty_out(vty, " as %s",
1105 (ts->flags & TS_F_PDCH_ACTIVE)? "PDCH"
1106 : "TCH/F");
1107 else
1108 vty_out(vty, " switching %s -> %s",
1109 (ts->flags & TS_F_PDCH_ACTIVE)? "PDCH"
1110 : "TCH/F",
1111 (ts->flags & TS_F_PDCH_ACT_PENDING)? "PDCH"
1112 : "TCH/F");
1113 break;
1114 default:
1115 /* no dyn ts */
1116 break;
1117 }
1118}
1119
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +08001120static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
Harald Welte68628e82009-03-10 12:17:57 +00001121{
Harald Welte8387a492009-12-22 21:43:14 +01001122 int idx;
1123
Harald Welte85bded82010-12-24 12:22:34 +01001124 vty_out(vty, "BTS %u, TRX %u, Timeslot %u, Lchan %u: Type %s%s",
1125 lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
1126 lchan->nr, gsm_lchant_name(lchan->type), VTY_NEWLINE);
Neels Hofmeyrb7480122016-11-02 14:28:15 +01001127 /* show dyn TS details, if applicable */
1128 switch (lchan->ts->pchan) {
1129 case GSM_PCHAN_TCH_F_TCH_H_PDCH:
1130 vty_out(vty, " Osmocom Dyn TS:");
1131 vty_out_dyn_ts_status(vty, lchan->ts);
1132 vty_out(vty, VTY_NEWLINE);
1133 break;
1134 case GSM_PCHAN_TCH_F_PDCH:
1135 vty_out(vty, " IPACC Dyn PDCH TS:");
1136 vty_out_dyn_ts_status(vty, lchan->ts);
1137 vty_out(vty, VTY_NEWLINE);
1138 break;
1139 default:
1140 /* no dyn ts */
1141 break;
1142 }
Holger Hans Peter Freyther454140e2014-12-28 12:08:28 +01001143 vty_out(vty, " Connection: %u, State: %s%s%s%s",
Holger Hans Peter Freyther40494552010-06-28 17:09:29 +08001144 lchan->conn ? 1: 0,
Holger Hans Peter Freyther454140e2014-12-28 12:08:28 +01001145 gsm_lchans_name(lchan->state),
1146 lchan->state == LCHAN_S_BROKEN ? " Error reason: " : "",
1147 lchan->state == LCHAN_S_BROKEN ? lchan->broken_reason : "",
1148 VTY_NEWLINE);
Harald Welte73225282009-12-12 18:17:25 +01001149 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
1150 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
1151 - lchan->bs_power*2,
1152 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
1153 VTY_NEWLINE);
Harald Welte0a8cf322015-12-05 17:22:49 +01001154 vty_out(vty, " Channel Mode / Codec: %s%s",
1155 get_value_string(gsm48_cmode_names, lchan->tch_mode),
1156 VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +08001157 if (lchan->conn && lchan->conn->subscr) {
Harald Welte68628e82009-03-10 12:17:57 +00001158 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +08001159 subscr_dump_vty(vty, lchan->conn->subscr);
Harald Welte68628e82009-03-10 12:17:57 +00001160 } else
1161 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte2c828992009-12-02 01:56:49 +05301162 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
1163 struct in_addr ia;
Holger Hans Peter Freyther54fa7992010-04-07 15:39:16 +02001164 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte2c828992009-12-02 01:56:49 +05301165 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
1166 inet_ntoa(ia), lchan->abis_ip.bound_port,
1167 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
1168 VTY_NEWLINE);
1169 }
Harald Welte8387a492009-12-22 21:43:14 +01001170
1171 /* we want to report the last measurement report */
1172 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
1173 lchan->meas_rep_idx, 1);
1174 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte68628e82009-03-10 12:17:57 +00001175}
1176
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08001177static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
1178{
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +08001179 struct gsm_meas_rep *mr;
1180 int idx;
1181
1182 /* we want to report the last measurement report */
1183 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
1184 lchan->meas_rep_idx, 1);
1185 mr = &lchan->meas_rep[idx];
1186
Neels Hofmeyrb7480122016-11-02 14:28:15 +01001187 vty_out(vty, "BTS %u, TRX %u, Timeslot %u %s",
Harald Welte85bded82010-12-24 12:22:34 +01001188 lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
Neels Hofmeyrb7480122016-11-02 14:28:15 +01001189 gsm_pchan_name(lchan->ts->pchan));
1190 vty_out_dyn_ts_status(vty, lchan->ts);
1191 vty_out(vty, ", Lchan %u, Type %s, State %s - "
1192 "L1 MS Power: %u dBm RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
Neels Hofmeyrefedf802016-06-14 01:31:38 +02001193 lchan->nr,
1194 gsm_lchant_name(lchan->type), gsm_lchans_name(lchan->state),
1195 mr->ms_l1.pwr,
Holger Hans Peter Freythercf5cc5b2010-05-14 01:57:02 +08001196 rxlev2dbm(mr->dl.full.rx_lev),
1197 rxlev2dbm(mr->ul.full.rx_lev),
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08001198 VTY_NEWLINE);
1199}
1200
Holger Hans Peter Freyther7173f632011-12-27 16:34:12 +01001201
1202static int dump_lchan_trx_ts(struct gsm_bts_trx_ts *ts, struct vty *vty,
1203 void (*dump_cb)(struct vty *, struct gsm_lchan *))
1204{
1205 int lchan_nr;
1206 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN; lchan_nr++) {
1207 struct gsm_lchan *lchan = &ts->lchan[lchan_nr];
1208 if ((lchan->type == GSM_LCHAN_NONE) && (lchan->state == LCHAN_S_NONE))
1209 continue;
1210 dump_cb(vty, lchan);
1211 }
1212
1213 return CMD_SUCCESS;
1214}
1215
1216static int dump_lchan_trx(struct gsm_bts_trx *trx, struct vty *vty,
1217 void (*dump_cb)(struct vty *, struct gsm_lchan *))
1218{
1219 int ts_nr;
1220
1221 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
1222 struct gsm_bts_trx_ts *ts = &trx->ts[ts_nr];
1223 dump_lchan_trx_ts(ts, vty, dump_cb);
1224 }
1225
1226 return CMD_SUCCESS;
1227}
1228
1229static int dump_lchan_bts(struct gsm_bts *bts, struct vty *vty,
1230 void (*dump_cb)(struct vty *, struct gsm_lchan *))
1231{
1232 int trx_nr;
1233
1234 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
1235 struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, trx_nr);
1236 dump_lchan_trx(trx, vty, dump_cb);
1237 }
1238
1239 return CMD_SUCCESS;
1240}
1241
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +08001242static int lchan_summary(struct vty *vty, int argc, const char **argv,
1243 void (*dump_cb)(struct vty *, struct gsm_lchan *))
Harald Welte68628e82009-03-10 12:17:57 +00001244{
Harald Weltedcccb182010-05-16 20:52:23 +02001245 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte68628e82009-03-10 12:17:57 +00001246 struct gsm_bts *bts;
1247 struct gsm_bts_trx *trx;
1248 struct gsm_bts_trx_ts *ts;
1249 struct gsm_lchan *lchan;
1250 int bts_nr, trx_nr, ts_nr, lchan_nr;
1251
1252 if (argc >= 1) {
1253 /* use the BTS number that the user has specified */
1254 bts_nr = atoi(argv[0]);
1255 if (bts_nr >= net->num_bts) {
1256 vty_out(vty, "%% can't find BTS %s%s", argv[0],
1257 VTY_NEWLINE);
1258 return CMD_WARNING;
1259 }
Harald Weltee441d9c2009-06-21 16:17:15 +02001260 bts = gsm_bts_num(net, bts_nr);
Holger Hans Peter Freyther7173f632011-12-27 16:34:12 +01001261
1262 if (argc == 1)
1263 return dump_lchan_bts(bts, vty, dump_cb);
Harald Welte68628e82009-03-10 12:17:57 +00001264 }
1265 if (argc >= 2) {
1266 trx_nr = atoi(argv[1]);
1267 if (trx_nr >= bts->num_trx) {
1268 vty_out(vty, "%% can't find TRX %s%s", argv[1],
1269 VTY_NEWLINE);
1270 return CMD_WARNING;
1271 }
Harald Weltee441d9c2009-06-21 16:17:15 +02001272 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freyther7173f632011-12-27 16:34:12 +01001273
1274 if (argc == 2)
1275 return dump_lchan_trx(trx, vty, dump_cb);
Harald Welte68628e82009-03-10 12:17:57 +00001276 }
1277 if (argc >= 3) {
1278 ts_nr = atoi(argv[2]);
1279 if (ts_nr >= TRX_NR_TS) {
1280 vty_out(vty, "%% can't find TS %s%s", argv[2],
1281 VTY_NEWLINE);
1282 return CMD_WARNING;
1283 }
1284 ts = &trx->ts[ts_nr];
Holger Hans Peter Freyther7173f632011-12-27 16:34:12 +01001285
1286 if (argc == 3)
1287 return dump_lchan_trx_ts(ts, vty, dump_cb);
Harald Welte68628e82009-03-10 12:17:57 +00001288 }
1289 if (argc >= 4) {
1290 lchan_nr = atoi(argv[3]);
1291 if (lchan_nr >= TS_MAX_LCHAN) {
1292 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
1293 VTY_NEWLINE);
1294 return CMD_WARNING;
1295 }
1296 lchan = &ts->lchan[lchan_nr];
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +08001297 dump_cb(vty, lchan);
Harald Welte68628e82009-03-10 12:17:57 +00001298 return CMD_SUCCESS;
1299 }
Holger Hans Peter Freyther7173f632011-12-27 16:34:12 +01001300
1301
Harald Welte68628e82009-03-10 12:17:57 +00001302 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +02001303 bts = gsm_bts_num(net, bts_nr);
Holger Hans Peter Freyther7173f632011-12-27 16:34:12 +01001304 dump_lchan_bts(bts, vty, dump_cb);
Harald Welte68628e82009-03-10 12:17:57 +00001305 }
1306
1307 return CMD_SUCCESS;
1308}
1309
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +08001310
1311DEFUN(show_lchan,
1312 show_lchan_cmd,
Sylvain Munaut39c31de2012-12-28 12:15:11 +01001313 "show lchan [<0-255>] [<0-255>] [<0-7>] [lchan_nr]",
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +08001314 SHOW_STR "Display information about a logical channel\n"
1315 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001316 LCHAN_NR_STR)
Holger Hans Peter Freyther029235e2010-05-14 02:03:16 +08001317
1318{
1319 return lchan_summary(vty, argc, argv, lchan_dump_full_vty);
1320}
1321
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08001322DEFUN(show_lchan_summary,
1323 show_lchan_summary_cmd,
Sylvain Munaut39c31de2012-12-28 12:15:11 +01001324 "show lchan summary [<0-255>] [<0-255>] [<0-7>] [lchan_nr]",
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08001325 SHOW_STR "Display information about a logical channel\n"
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001326 "Short summary\n"
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08001327 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001328 LCHAN_NR_STR)
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08001329{
1330 return lchan_summary(vty, argc, argv, lchan_dump_short_vty);
1331}
1332
Harald Weltebe4b7302009-05-23 16:59:33 +00001333static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
Harald Weltef5025b62009-03-28 16:55:11 +00001334{
1335 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
Neels Hofmeyr6d804b12017-02-18 22:20:46 +01001336 bsc_subscr_dump_vty(vty, pag->bsub);
Harald Weltef5025b62009-03-28 16:55:11 +00001337}
1338
Harald Weltebe4b7302009-05-23 16:59:33 +00001339static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
Harald Weltef5025b62009-03-28 16:55:11 +00001340{
1341 struct gsm_paging_request *pag;
1342
Holger Hans Peter Freyther9b5192b2013-03-03 11:03:17 +01001343 if (!bts->paging.bts)
1344 return;
1345
Harald Weltef5025b62009-03-28 16:55:11 +00001346 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
1347 paging_dump_vty(vty, pag);
1348}
1349
1350DEFUN(show_paging,
1351 show_paging_cmd,
Sylvain Munaut39c31de2012-12-28 12:15:11 +01001352 "show paging [<0-255>]",
Harald Welte8f0ed552010-05-11 21:53:49 +02001353 SHOW_STR "Display information about paging reuqests of a BTS\n"
1354 "BTS Number\n")
Harald Weltef5025b62009-03-28 16:55:11 +00001355{
Harald Weltedcccb182010-05-16 20:52:23 +02001356 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Weltef5025b62009-03-28 16:55:11 +00001357 struct gsm_bts *bts;
1358 int bts_nr;
1359
1360 if (argc >= 1) {
1361 /* use the BTS number that the user has specified */
1362 bts_nr = atoi(argv[0]);
1363 if (bts_nr >= net->num_bts) {
1364 vty_out(vty, "%% can't find BTS %s%s", argv[0],
1365 VTY_NEWLINE);
1366 return CMD_WARNING;
1367 }
Harald Weltee441d9c2009-06-21 16:17:15 +02001368 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001369 bts_paging_dump_vty(vty, bts);
1370
1371 return CMD_SUCCESS;
1372 }
1373 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee441d9c2009-06-21 16:17:15 +02001374 bts = gsm_bts_num(net, bts_nr);
Harald Weltef5025b62009-03-28 16:55:11 +00001375 bts_paging_dump_vty(vty, bts);
1376 }
1377
1378 return CMD_SUCCESS;
1379}
1380
Holger Hans Peter Freytherec37bb22013-02-05 09:39:09 +01001381DEFUN(show_paging_group,
1382 show_paging_group_cmd,
1383 "show paging-group <0-255> IMSI",
1384 SHOW_STR "Display the paging group\n"
1385 "BTS Number\n" "IMSI\n")
1386{
1387 struct gsm_network *net = gsmnet_from_vty(vty);
1388 struct gsm_bts *bts;
1389 unsigned int page_group;
1390 int bts_nr = atoi(argv[0]);
1391
1392 if (bts_nr >= net->num_bts) {
1393 vty_out(vty, "%% can't find BTS %s%s", argv[0], VTY_NEWLINE);
1394 return CMD_WARNING;
1395 }
1396
1397 bts = gsm_bts_num(net, bts_nr);
1398 if (!bts) {
1399 vty_out(vty, "%% can't find BTS %s%s", argv[0], VTY_NEWLINE);
1400 return CMD_WARNING;
1401 }
1402
1403 page_group = gsm0502_calc_paging_group(&bts->si_common.chan_desc,
1404 str_to_imsi(argv[1]));
1405 vty_out(vty, "%%Paging group for IMSI %" PRIu64 " on BTS #%d is %u%s",
1406 str_to_imsi(argv[1]), bts->nr,
1407 page_group, VTY_NEWLINE);
1408 return CMD_SUCCESS;
1409}
1410
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001411DEFUN(cfg_net_neci,
1412 cfg_net_neci_cmd,
1413 "neci (0|1)",
Harald Welte28326062010-05-14 20:05:17 +02001414 "New Establish Cause Indication\n"
1415 "Don't set the NECI bit\n" "Set the NECI bit\n")
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001416{
Harald Weltedcccb182010-05-16 20:52:23 +02001417 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1418
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001419 gsmnet->neci = atoi(argv[0]);
Holger Hans Peter Freyther78891072010-09-06 09:36:02 +08001420 gsm_net_update_ctype(gsmnet);
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01001421 return CMD_SUCCESS;
1422}
1423
Harald Welte8f0ed552010-05-11 21:53:49 +02001424#define HANDOVER_STR "Handover Options\n"
1425
Harald Weltebc814502009-12-19 21:41:52 +01001426DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1427 "handover (0|1)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001428 HANDOVER_STR
1429 "Don't perform in-call handover\n"
1430 "Perform in-call handover\n")
Harald Weltebc814502009-12-19 21:41:52 +01001431{
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001432 int enable = atoi(argv[0]);
Harald Weltedcccb182010-05-16 20:52:23 +02001433 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001434
1435 if (enable && ipacc_rtp_direct) {
Harald Weltefe03f0d2009-12-20 13:51:01 +01001436 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1437 "is enabled by using the -P command line option%s",
1438 VTY_NEWLINE);
1439 return CMD_WARNING;
1440 }
Holger Hans Peter Freythercbcfe242010-01-07 16:14:38 +01001441 gsmnet->handover.active = enable;
Harald Weltebc814502009-12-19 21:41:52 +01001442
1443 return CMD_SUCCESS;
1444}
1445
Harald Welte8f0ed552010-05-11 21:53:49 +02001446#define HO_WIN_STR HANDOVER_STR "Measurement Window\n"
1447#define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n"
1448#define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n"
1449#define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n"
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001450#define HO_AVG_COUNT_STR "Amount to use for Averaging\n"
Harald Welte8f0ed552010-05-11 21:53:49 +02001451
Harald Welteb720bd32009-12-21 16:51:50 +01001452DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1453 "handover window rxlev averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001454 HO_WIN_RXLEV_STR
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001455 "How many RxLev measurements are used for averaging\n"
1456 HO_AVG_COUNT_STR)
Harald Welteb720bd32009-12-21 16:51:50 +01001457{
Harald Weltedcccb182010-05-16 20:52:23 +02001458 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001459 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1460 return CMD_SUCCESS;
1461}
1462
1463DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1464 "handover window rxqual averaging <1-10>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001465 HO_WIN_RXQUAL_STR
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001466 "How many RxQual measurements are used for averaging\n"
1467 HO_AVG_COUNT_STR)
Harald Welteb720bd32009-12-21 16:51:50 +01001468{
Harald Weltedcccb182010-05-16 20:52:23 +02001469 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001470 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1471 return CMD_SUCCESS;
1472}
1473
1474DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1475 "handover window rxlev neighbor averaging <1-10>",
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001476 HO_WIN_RXLEV_STR "Neighbor\n"
1477 "How many RxQual measurements are used for averaging\n"
1478 HO_AVG_COUNT_STR)
Harald Welteb720bd32009-12-21 16:51:50 +01001479{
Harald Weltedcccb182010-05-16 20:52:23 +02001480 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001481 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1482 return CMD_SUCCESS;
1483}
1484
1485DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1486 "handover power budget interval <1-99>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001487 HO_PBUDGET_STR
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001488 "How often to check if we have a better cell (SACCH frames)\n"
1489 "Interval\n" "Number\n")
Harald Welteb720bd32009-12-21 16:51:50 +01001490{
Harald Weltedcccb182010-05-16 20:52:23 +02001491 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001492 gsmnet->handover.pwr_interval = atoi(argv[0]);
1493 return CMD_SUCCESS;
1494}
1495
1496DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1497 "handover power budget hysteresis <0-999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001498 HO_PBUDGET_STR
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001499 "How many dB does a neighbor to be stronger to become a HO candidate\n"
1500 "Hysteresis\n" "Number\n")
Harald Welteb720bd32009-12-21 16:51:50 +01001501{
Harald Weltedcccb182010-05-16 20:52:23 +02001502 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001503 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1504 return CMD_SUCCESS;
1505}
1506
1507DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1508 "handover maximum distance <0-9999>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001509 HANDOVER_STR
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001510 "How big is the maximum timing advance before HO is forced\n"
1511 "Distance\n" "Number\n")
Harald Welteb720bd32009-12-21 16:51:50 +01001512{
Harald Weltedcccb182010-05-16 20:52:23 +02001513 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welteb720bd32009-12-21 16:51:50 +01001514 gsmnet->handover.max_distance = atoi(argv[0]);
1515 return CMD_SUCCESS;
1516}
Harald Weltebc814502009-12-19 21:41:52 +01001517
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001518DEFUN(cfg_net_pag_any_tch,
1519 cfg_net_pag_any_tch_cmd,
1520 "paging any use tch (0|1)",
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001521 "Assign a TCH when receiving a Paging Any request\n"
1522 "Any Channel\n" "Use\n" "TCH\n"
1523 "Do not use TCH for Paging Request Any\n"
1524 "Do use TCH for Paging Request Any\n")
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001525{
Holger Hans Peter Freytherb0e88b82010-09-06 10:09:19 +08001526 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08001527 gsmnet->pag_any_tch = atoi(argv[0]);
1528 gsm_net_update_ctype(gsmnet);
1529 return CMD_SUCCESS;
1530}
1531
Holger Hans Peter Freytherc8021062009-12-22 08:27:21 +01001532#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001533 DEFUN(cfg_net_T##number, \
1534 cfg_net_T##number##_cmd, \
1535 "timer t" #number " <0-65535>", \
Harald Welte8f0ed552010-05-11 21:53:49 +02001536 "Configure GSM Timers\n" \
Holger Hans Peter Freyther5dd295f2014-04-11 19:30:27 +02001537 doc "Timer Value in seconds\n") \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001538{ \
Harald Weltedcccb182010-05-16 20:52:23 +02001539 struct gsm_network *gsmnet = gsmnet_from_vty(vty); \
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001540 int value = atoi(argv[0]); \
1541 \
1542 if (value < 0 || value > 65535) { \
1543 vty_out(vty, "Timer value %s out of range.%s", \
1544 argv[0], VTY_NEWLINE); \
1545 return CMD_WARNING; \
1546 } \
1547 \
1548 gsmnet->T##number = value; \
1549 return CMD_SUCCESS; \
1550}
1551
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001552DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.\n")
1553DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.\n")
Harald Welte67161f22012-06-03 13:01:47 +02001554DECLARE_TIMER(3105, "Set the timer for repetition of PHYSICAL INFORMATION.\n")
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001555DECLARE_TIMER(3107, "Currently not used.\n")
Holger Hans Peter Freytherb3489392011-12-28 16:21:05 +01001556DECLARE_TIMER(3109, "Set the RSL SACCH deactivation timeout.\n")
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001557DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel.\n")
1558DECLARE_TIMER(3113, "Set the time to try paging a subscriber.\n")
1559DECLARE_TIMER(3115, "Currently not used.\n")
1560DECLARE_TIMER(3117, "Currently not used.\n")
1561DECLARE_TIMER(3119, "Currently not used.\n")
1562DECLARE_TIMER(3122, "Waiting time (seconds) after IMM ASS REJECT\n")
1563DECLARE_TIMER(3141, "Currently not used.\n")
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001564
Maxc08ee712016-05-11 12:45:13 +02001565DEFUN_DEPRECATED(cfg_net_dtx,
1566 cfg_net_dtx_cmd,
1567 "dtx-used (0|1)",
1568 ".HIDDEN\n""Obsolete\n""Obsolete\n")
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08001569{
Maxc08ee712016-05-11 12:45:13 +02001570 vty_out(vty, "%% 'dtx-used' is now deprecated: use dtx * "
1571 "configuration options of BTS instead%s", VTY_NEWLINE);
1572 return CMD_SUCCESS;
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08001573}
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01001574
Harald Welte5258fc42009-03-28 19:07:53 +00001575/* per-BTS configuration */
1576DEFUN(cfg_bts,
1577 cfg_bts_cmd,
Harald Welte57e07242012-08-17 12:50:14 +02001578 "bts <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001579 "Select a BTS to configure\n"
1580 "BTS Number\n")
Harald Welte5258fc42009-03-28 19:07:53 +00001581{
Harald Weltedcccb182010-05-16 20:52:23 +02001582 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte5258fc42009-03-28 19:07:53 +00001583 int bts_nr = atoi(argv[0]);
1584 struct gsm_bts *bts;
1585
Harald Weltee441d9c2009-06-21 16:17:15 +02001586 if (bts_nr > gsmnet->num_bts) {
1587 vty_out(vty, "%% The next unused BTS number is %u%s",
1588 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00001589 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02001590 } else if (bts_nr == gsmnet->num_bts) {
1591 /* allocate a new one */
Harald Welte3300c012011-06-05 13:31:33 +02001592 bts = gsm_bts_alloc_register(gsmnet, GSM_BTS_TYPE_UNKNOWN,
Harald Weltea2bbc5e2015-11-20 10:43:31 +01001593 HARDCODED_BSIC);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02001594 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02001595 bts = gsm_bts_num(gsmnet, bts_nr);
1596
Daniel Willmannf15c2762010-01-11 13:43:07 +01001597 if (!bts) {
1598 vty_out(vty, "%% Unable to allocate BTS %u%s",
1599 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee441d9c2009-06-21 16:17:15 +02001600 return CMD_WARNING;
Daniel Willmannf15c2762010-01-11 13:43:07 +01001601 }
Harald Welte5258fc42009-03-28 19:07:53 +00001602
1603 vty->index = bts;
Harald Welte197dea92010-05-14 17:59:53 +02001604 vty->index_sub = &bts->description;
Harald Welte5258fc42009-03-28 19:07:53 +00001605 vty->node = BTS_NODE;
1606
1607 return CMD_SUCCESS;
1608}
1609
1610DEFUN(cfg_bts_type,
1611 cfg_bts_type_cmd,
Harald Weltee555c2b2012-08-17 13:02:12 +02001612 "type TYPE", /* dynamically created */
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001613 "Set the BTS type\n" "Type\n")
Harald Welte5258fc42009-03-28 19:07:53 +00001614{
1615 struct gsm_bts *bts = vty->index;
Harald Welte39315c42010-01-10 18:01:52 +01001616 int rc;
Harald Welte5258fc42009-03-28 19:07:53 +00001617
Harald Welte39315c42010-01-10 18:01:52 +01001618 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1619 if (rc < 0)
1620 return CMD_WARNING;
Harald Welte8175e952009-10-20 00:22:00 +02001621
Harald Welte5258fc42009-03-28 19:07:53 +00001622 return CMD_SUCCESS;
1623}
1624
Harald Weltefcd24452009-06-20 18:15:19 +02001625DEFUN(cfg_bts_band,
1626 cfg_bts_band_cmd,
1627 "band BAND",
Holger Hans Peter Freyther08542562011-10-03 23:42:06 +02001628 "Set the frequency band of this BTS\n" "Frequency band\n")
Harald Weltefcd24452009-06-20 18:15:19 +02001629{
1630 struct gsm_bts *bts = vty->index;
Harald Welte42581822009-08-08 16:12:58 +02001631 int band = gsm_band_parse(argv[0]);
Harald Weltefcd24452009-06-20 18:15:19 +02001632
1633 if (band < 0) {
1634 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1635 band, VTY_NEWLINE);
1636 return CMD_WARNING;
1637 }
1638
1639 bts->band = band;
1640
1641 return CMD_SUCCESS;
1642}
1643
Maxc08ee712016-05-11 12:45:13 +02001644DEFUN(cfg_bts_dtxu, cfg_bts_dtxu_cmd, "dtx uplink [force]",
1645 "Configure discontinuous transmission\n"
1646 "Enable Uplink DTX for this BTS\n"
1647 "MS 'shall' use DTXu instead of 'may' use (might not be supported by "
1648 "older phones).\n")
1649{
1650 struct gsm_bts *bts = vty->index;
1651
1652 bts->dtxu = (argc > 0) ? GSM48_DTX_SHALL_BE_USED : GSM48_DTX_MAY_BE_USED;
Max60795282016-06-06 11:30:57 +02001653 if (!is_ipaccess_bts(bts))
1654 vty_out(vty, "%% DTX enabled on non-IP BTS: this configuration "
1655 "neither supported nor tested!%s", VTY_NEWLINE);
Maxc08ee712016-05-11 12:45:13 +02001656 return CMD_SUCCESS;
1657}
1658
1659DEFUN(cfg_bts_no_dtxu, cfg_bts_no_dtxu_cmd, "no dtx uplink",
1660 NO_STR
1661 "Configure discontinuous transmission\n"
1662 "Disable Uplink DTX for this BTS\n")
1663{
1664 struct gsm_bts *bts = vty->index;
1665
1666 bts->dtxu = GSM48_DTX_SHALL_NOT_BE_USED;
1667
1668 return CMD_SUCCESS;
1669}
1670
1671DEFUN(cfg_bts_dtxd, cfg_bts_dtxd_cmd, "dtx downlink",
1672 "Configure discontinuous transmission\n"
1673 "Enable Downlink DTX for this BTS\n")
1674{
1675 struct gsm_bts *bts = vty->index;
1676
1677 bts->dtxd = true;
Max60795282016-06-06 11:30:57 +02001678 if (!is_ipaccess_bts(bts))
1679 vty_out(vty, "%% DTX enabled on non-IP BTS: this configuration "
1680 "neither supported nor tested!%s", VTY_NEWLINE);
Maxc08ee712016-05-11 12:45:13 +02001681 return CMD_SUCCESS;
1682}
1683
1684DEFUN(cfg_bts_no_dtxd, cfg_bts_no_dtxd_cmd, "no dtx downlink",
1685 NO_STR
1686 "Configure discontinuous transmission\n"
1687 "Disable Downlink DTX for this BTS\n")
1688{
1689 struct gsm_bts *bts = vty->index;
1690
1691 bts->dtxd = false;
1692
1693 return CMD_SUCCESS;
1694}
1695
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001696DEFUN(cfg_bts_ci,
1697 cfg_bts_ci_cmd,
1698 "cell_identity <0-65535>",
Holger Hans Peter Freyther64c17fa2012-07-21 00:27:10 +02001699 "Set the Cell identity of this BTS\n" "Cell Identity\n")
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02001700{
1701 struct gsm_bts *bts = vty->index;
1702 int ci = atoi(argv[0]);
1703
1704 if (ci < 0 || ci > 0xffff) {
1705 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1706 ci, VTY_NEWLINE);
1707 return CMD_WARNING;
1708 }
1709 bts->cell_identity = ci;
1710
1711 return CMD_SUCCESS;
1712}
1713
Harald Welte5258fc42009-03-28 19:07:53 +00001714DEFUN(cfg_bts_lac,
1715 cfg_bts_lac_cmd,
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001716 "location_area_code <0-65535>",
Holger Hans Peter Freyther64c17fa2012-07-21 00:27:10 +02001717 "Set the Location Area Code (LAC) of this BTS\n" "LAC\n")
Harald Welte5258fc42009-03-28 19:07:53 +00001718{
1719 struct gsm_bts *bts = vty->index;
1720 int lac = atoi(argv[0]);
1721
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +02001722 if (lac < 0 || lac > 0xffff) {
1723 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte5258fc42009-03-28 19:07:53 +00001724 lac, VTY_NEWLINE);
1725 return CMD_WARNING;
1726 }
Holger Hans Peter Freythere48b9562009-10-01 04:07:15 +02001727
1728 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1729 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1730 lac, VTY_NEWLINE);
1731 return CMD_WARNING;
1732 }
1733
Harald Welte5258fc42009-03-28 19:07:53 +00001734 bts->location_area_code = lac;
1735
1736 return CMD_SUCCESS;
1737}
1738
Harald Weltea43f7892009-12-01 18:04:30 +05301739
Harald Weltea2bbc5e2015-11-20 10:43:31 +01001740/* compatibility wrapper for old config files */
1741DEFUN_HIDDEN(cfg_bts_tsc,
Harald Welte5258fc42009-03-28 19:07:53 +00001742 cfg_bts_tsc_cmd,
Harald Weltec513ded2012-05-31 10:57:08 +02001743 "training_sequence_code <0-7>",
Holger Hans Peter Freyther64c17fa2012-07-21 00:27:10 +02001744 "Set the Training Sequence Code (TSC) of this BTS\n" "TSC\n")
Harald Welte5258fc42009-03-28 19:07:53 +00001745{
Harald Welte5258fc42009-03-28 19:07:53 +00001746 return CMD_SUCCESS;
1747}
1748
Harald Welte78f2f502009-05-23 16:56:52 +00001749DEFUN(cfg_bts_bsic,
1750 cfg_bts_bsic_cmd,
1751 "base_station_id_code <0-63>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02001752 "Set the Base Station Identity Code (BSIC) of this BTS\n"
1753 "BSIC of this BTS\n")
Harald Welte78f2f502009-05-23 16:56:52 +00001754{
1755 struct gsm_bts *bts = vty->index;
1756 int bsic = atoi(argv[0]);
1757
1758 if (bsic < 0 || bsic > 0x3f) {
Harald Welte42581822009-08-08 16:12:58 +02001759 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte78f2f502009-05-23 16:56:52 +00001760 bsic, VTY_NEWLINE);
1761 return CMD_WARNING;
1762 }
1763 bts->bsic = bsic;
1764
1765 return CMD_SUCCESS;
1766}
1767
Harald Welte4cc34222009-05-01 15:12:31 +00001768DEFUN(cfg_bts_unit_id,
1769 cfg_bts_unit_id_cmd,
Harald Welte07dc73d2009-08-07 13:27:09 +02001770 "ip.access unit_id <0-65534> <0-255>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02001771 "Abis/IP specific options\n"
1772 "Set the IPA BTS Unit ID\n"
1773 "Unit ID (Site)\n"
1774 "Unit ID (BTS)\n")
Harald Welte4cc34222009-05-01 15:12:31 +00001775{
1776 struct gsm_bts *bts = vty->index;
1777 int site_id = atoi(argv[0]);
1778 int bts_id = atoi(argv[1]);
1779
Harald Welte07dc73d2009-08-07 13:27:09 +02001780 if (!is_ipaccess_bts(bts)) {
1781 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1782 return CMD_WARNING;
1783 }
1784
Harald Welte4cc34222009-05-01 15:12:31 +00001785 bts->ip_access.site_id = site_id;
1786 bts->ip_access.bts_id = bts_id;
1787
1788 return CMD_SUCCESS;
1789}
1790
Harald Welte8b291802013-03-12 13:57:05 +01001791DEFUN(cfg_bts_rsl_ip,
1792 cfg_bts_rsl_ip_cmd,
1793 "ip.access rsl-ip A.B.C.D",
1794 "Abis/IP specific options\n"
1795 "Set the IPA RSL IP Address of the BSC\n"
1796 "Destination IP address for RSL connection\n")
1797{
1798 struct gsm_bts *bts = vty->index;
1799 struct in_addr ia;
1800
1801 if (!is_ipaccess_bts(bts)) {
1802 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1803 return CMD_WARNING;
1804 }
1805
1806 inet_aton(argv[0], &ia);
1807 bts->ip_access.rsl_ip = ntohl(ia.s_addr);
1808
1809 return CMD_SUCCESS;
1810}
1811
Andreas Eversberg7d8fa342013-12-05 13:25:06 +01001812#define NOKIA_STR "Nokia *Site related commands\n"
Harald Welte8b291802013-03-12 13:57:05 +01001813
Sylvain Munautc9519462011-10-17 14:04:55 +02001814DEFUN(cfg_bts_nokia_site_skip_reset,
1815 cfg_bts_nokia_site_skip_reset_cmd,
1816 "nokia_site skip-reset (0|1)",
Andreas Eversberg7d8fa342013-12-05 13:25:06 +01001817 NOKIA_STR
Harald Weltecfaabbb2012-08-16 23:23:50 +02001818 "Skip the reset step during bootstrap process of this BTS\n"
1819 "Do NOT skip the reset\n" "Skip the reset\n")
Sylvain Munautc9519462011-10-17 14:04:55 +02001820{
1821 struct gsm_bts *bts = vty->index;
1822
1823 if (bts->type != GSM_BTS_TYPE_NOKIA_SITE) {
1824 vty_out(vty, "%% BTS is not of Nokia *Site type%s", VTY_NEWLINE);
1825 return CMD_WARNING;
1826 }
1827
1828 bts->nokia.skip_reset = atoi(argv[0]);
1829
1830 return CMD_SUCCESS;
1831}
1832
Andreas Eversberg7d8fa342013-12-05 13:25:06 +01001833DEFUN(cfg_bts_nokia_site_no_loc_rel_cnf,
1834 cfg_bts_nokia_site_no_loc_rel_cnf_cmd,
1835 "nokia_site no-local-rel-conf (0|1)",
1836 NOKIA_STR
1837 "Do not wait for RELease CONFirm message when releasing channel locally\n"
1838 "Wait for RELease CONFirm\n" "Do not wait for RELease CONFirm\n")
1839{
1840 struct gsm_bts *bts = vty->index;
1841
1842 if (!is_nokia_bts(bts)) {
1843 vty_out(vty, "%% BTS is not of Nokia *Site type%s",
1844 VTY_NEWLINE);
1845 return CMD_WARNING;
1846 }
1847
1848 bts->nokia.no_loc_rel_cnf = atoi(argv[0]);
1849
1850 return CMD_SUCCESS;
1851}
1852
Sipos Csaba56e17662015-02-07 13:27:36 +01001853DEFUN(cfg_bts_nokia_site_bts_reset_timer_cnf,
1854 cfg_bts_nokia_site_bts_reset_timer_cnf_cmd,
1855 "nokia_site bts-reset-timer <15-100>",
1856 NOKIA_STR
1857 "The amount of time (in sec.) between BTS_RESET is sent,\n"
1858 "and the BTS is being bootstrapped.\n")
1859{
1860 struct gsm_bts *bts = vty->index;
1861
1862 if (!is_nokia_bts(bts)) {
1863 vty_out(vty, "%% BTS is not of Nokia *Site type%s",
1864 VTY_NEWLINE);
1865 return CMD_WARNING;
1866 }
1867
1868 bts->nokia.bts_reset_timer_cnf = atoi(argv[0]);
1869
1870 return CMD_SUCCESS;
1871}
Harald Welte8f0ed552010-05-11 21:53:49 +02001872#define OML_STR "Organization & Maintenance Link\n"
Harald Weltecfaabbb2012-08-16 23:23:50 +02001873#define IPA_STR "A-bis/IP Specific Options\n"
Harald Welte8f0ed552010-05-11 21:53:49 +02001874
Harald Welte8175e952009-10-20 00:22:00 +02001875DEFUN(cfg_bts_stream_id,
1876 cfg_bts_stream_id_cmd,
Pablo Neira Ayusoed5cacb2011-08-17 22:44:07 +02001877 "oml ip.access stream_id <0-255> line E1_LINE",
Harald Welte8f0ed552010-05-11 21:53:49 +02001878 OML_STR IPA_STR
Harald Weltecfaabbb2012-08-16 23:23:50 +02001879 "Set the ip.access Stream ID of the OML link of this BTS\n"
1880 "Stream Identifier\n" "Virtual E1 Line Number\n" "Virtual E1 Line Number\n")
Harald Welte8175e952009-10-20 00:22:00 +02001881{
1882 struct gsm_bts *bts = vty->index;
Pablo Neira Ayusoed5cacb2011-08-17 22:44:07 +02001883 int stream_id = atoi(argv[0]), linenr = atoi(argv[1]);
Harald Welte8175e952009-10-20 00:22:00 +02001884
1885 if (!is_ipaccess_bts(bts)) {
1886 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1887 return CMD_WARNING;
1888 }
1889
1890 bts->oml_tei = stream_id;
Pablo Neira Ayusoed5cacb2011-08-17 22:44:07 +02001891 /* This is used by e1inp_bind_ops callback for each BTS model. */
1892 bts->oml_e1_link.e1_nr = linenr;
1893
1894 return CMD_SUCCESS;
1895}
1896
Harald Welted13e0cd2012-08-17 09:52:03 +02001897#define OML_E1_STR OML_STR "OML E1/T1 Configuration\n"
Harald Welte8175e952009-10-20 00:22:00 +02001898
Harald Welte42581822009-08-08 16:12:58 +02001899DEFUN(cfg_bts_oml_e1,
1900 cfg_bts_oml_e1_cmd,
1901 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welted13e0cd2012-08-17 09:52:03 +02001902 OML_E1_STR
1903 "E1/T1 line number to be used for OML\n"
Harald Weltecfaabbb2012-08-16 23:23:50 +02001904 "E1/T1 line number to be used for OML\n"
1905 "E1/T1 timeslot to be used for OML\n"
1906 "E1/T1 timeslot to be used for OML\n"
1907 "E1/T1 sub-slot to be used for OML\n"
1908 "Use E1/T1 sub-slot 0\n"
1909 "Use E1/T1 sub-slot 1\n"
1910 "Use E1/T1 sub-slot 2\n"
1911 "Use E1/T1 sub-slot 3\n"
1912 "Use full E1 slot 3\n"
1913 )
Harald Welte42581822009-08-08 16:12:58 +02001914{
1915 struct gsm_bts *bts = vty->index;
1916
1917 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1918
1919 return CMD_SUCCESS;
1920}
1921
1922
1923DEFUN(cfg_bts_oml_e1_tei,
1924 cfg_bts_oml_e1_tei_cmd,
1925 "oml e1 tei <0-63>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001926 OML_E1_STR
Harald Weltecfaabbb2012-08-16 23:23:50 +02001927 "Set the TEI to be used for OML\n"
1928 "TEI Number\n")
Harald Welte42581822009-08-08 16:12:58 +02001929{
1930 struct gsm_bts *bts = vty->index;
1931
1932 bts->oml_tei = atoi(argv[0]);
1933
1934 return CMD_SUCCESS;
1935}
1936
Harald Welte7a8fa412009-08-10 13:48:16 +02001937DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1938 "channel allocator (ascending|descending)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001939 "Channnel Allocator\n" "Channel Allocator\n"
1940 "Allocate Timeslots and Transceivers in ascending order\n"
1941 "Allocate Timeslots and Transceivers in descending order\n")
Harald Welte7a8fa412009-08-10 13:48:16 +02001942{
1943 struct gsm_bts *bts = vty->index;
1944
1945 if (!strcmp(argv[0], "ascending"))
1946 bts->chan_alloc_reverse = 0;
1947 else
1948 bts->chan_alloc_reverse = 1;
1949
1950 return CMD_SUCCESS;
1951}
1952
Harald Welte8f0ed552010-05-11 21:53:49 +02001953#define RACH_STR "Random Access Control Channel\n"
1954
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001955DEFUN(cfg_bts_rach_tx_integer,
1956 cfg_bts_rach_tx_integer_cmd,
1957 "rach tx integer <0-15>",
Harald Welte8f0ed552010-05-11 21:53:49 +02001958 RACH_STR
Harald Weltecfaabbb2012-08-16 23:23:50 +02001959 "Set the raw tx integer value in RACH Control parameters IE\n"
1960 "Set the raw tx integer value in RACH Control parameters IE\n"
1961 "Raw tx integer value in RACH Control parameters IE\n")
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001962{
1963 struct gsm_bts *bts = vty->index;
1964 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1965 return CMD_SUCCESS;
1966}
1967
1968DEFUN(cfg_bts_rach_max_trans,
1969 cfg_bts_rach_max_trans_cmd,
1970 "rach max transmission (1|2|4|7)",
Harald Welte8f0ed552010-05-11 21:53:49 +02001971 RACH_STR
Harald Weltecfaabbb2012-08-16 23:23:50 +02001972 "Set the maximum number of RACH burst transmissions\n"
1973 "Set the maximum number of RACH burst transmissions\n"
Harald Welted13e0cd2012-08-17 09:52:03 +02001974 "Maximum number of 1 RACH burst transmissions\n"
1975 "Maximum number of 2 RACH burst transmissions\n"
1976 "Maximum number of 4 RACH burst transmissions\n"
1977 "Maximum number of 7 RACH burst transmissions\n")
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01001978{
1979 struct gsm_bts *bts = vty->index;
1980 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1981 return CMD_SUCCESS;
1982}
1983
Andreas Eversberg2ee7ecd2012-10-13 07:27:47 +02001984#define CD_STR "Channel Description\n"
1985
1986DEFUN(cfg_bts_chan_desc_att,
1987 cfg_bts_chan_desc_att_cmd,
1988 "channel-descrption attach (0|1)",
1989 CD_STR
1990 "Set if attachment is required\n"
1991 "Attachment is NOT required\n"
1992 "Attachment is required (standard)\n")
1993{
1994 struct gsm_bts *bts = vty->index;
1995 bts->si_common.chan_desc.att = atoi(argv[0]);
1996 return CMD_SUCCESS;
1997}
1998
1999DEFUN(cfg_bts_chan_desc_bs_pa_mfrms,
2000 cfg_bts_chan_desc_bs_pa_mfrms_cmd,
2001 "channel-descrption bs-pa-mfrms <2-9>",
2002 CD_STR
2003 "Set number of multiframe periods for paging groups\n"
2004 "Number of multiframe periods for paging groups\n")
2005{
2006 struct gsm_bts *bts = vty->index;
2007 int bs_pa_mfrms = atoi(argv[0]);
2008
2009 bts->si_common.chan_desc.bs_pa_mfrms = bs_pa_mfrms - 2;
2010 return CMD_SUCCESS;
2011}
2012
2013DEFUN(cfg_bts_chan_desc_bs_ag_blks_res,
2014 cfg_bts_chan_desc_bs_ag_blks_res_cmd,
2015 "channel-descrption bs-ag-blks-res <0-7>",
2016 CD_STR
2017 "Set number of blocks reserved for access grant\n"
2018 "Number of blocks reserved for access grant\n")
2019{
2020 struct gsm_bts *bts = vty->index;
2021 int bs_ag_blks_res = atoi(argv[0]);
2022
2023 bts->si_common.chan_desc.bs_ag_blks_res = bs_ag_blks_res;
2024 return CMD_SUCCESS;
2025}
2026
Harald Welte8f0ed552010-05-11 21:53:49 +02002027#define NM_STR "Network Management\n"
2028
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08002029DEFUN(cfg_bts_rach_nm_b_thresh,
2030 cfg_bts_rach_nm_b_thresh_cmd,
2031 "rach nm busy threshold <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02002032 RACH_STR NM_STR
Harald Weltecfaabbb2012-08-16 23:23:50 +02002033 "Set the NM Busy Threshold\n"
2034 "Set the NM Busy Threshold\n"
2035 "NM Busy Threshold in dB")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08002036{
2037 struct gsm_bts *bts = vty->index;
2038 bts->rach_b_thresh = atoi(argv[0]);
2039 return CMD_SUCCESS;
2040}
2041
2042DEFUN(cfg_bts_rach_nm_ldavg,
2043 cfg_bts_rach_nm_ldavg_cmd,
2044 "rach nm load average <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02002045 RACH_STR NM_STR
Harald Weltecfaabbb2012-08-16 23:23:50 +02002046 "Set the NM Loadaverage Slots value\n"
2047 "Set the NM Loadaverage Slots value\n"
2048 "NM Loadaverage Slots value\n")
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08002049{
2050 struct gsm_bts *bts = vty->index;
2051 bts->rach_ldavg_slots = atoi(argv[0]);
2052 return CMD_SUCCESS;
2053}
2054
Harald Welte (local)5dececf2009-08-12 13:28:23 +02002055DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
2056 "cell barred (0|1)",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002057 "Should this cell be barred from access?\n"
2058 "Should this cell be barred from access?\n"
2059 "Cell should NOT be barred\n"
2060 "Cell should be barred\n")
2061
Harald Welte (local)5dececf2009-08-12 13:28:23 +02002062{
2063 struct gsm_bts *bts = vty->index;
2064
Harald Welte71355012009-12-21 23:08:18 +01002065 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02002066
2067 return CMD_SUCCESS;
2068}
2069
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08002070DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd,
2071 "rach emergency call allowed (0|1)",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002072 RACH_STR
2073 "Should this cell allow emergency calls?\n"
2074 "Should this cell allow emergency calls?\n"
2075 "Should this cell allow emergency calls?\n"
2076 "Do NOT allow emergency calls\n"
2077 "Allow emergency calls\n")
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08002078{
2079 struct gsm_bts *bts = vty->index;
2080
2081 if (atoi(argv[0]) == 0)
2082 bts->si_common.rach_control.t2 |= 0x4;
2083 else
2084 bts->si_common.rach_control.t2 &= ~0x4;
2085
2086 return CMD_SUCCESS;
2087}
2088
Ivan Kluchnikov67920592013-09-16 13:13:04 +04002089DEFUN(cfg_bts_rach_ac_class, cfg_bts_rach_ac_class_cmd,
2090 "rach access-control-class (0|1|2|3|4|5|6|7|8|9|11|12|13|14|15) (barred|allowed)",
2091 RACH_STR
2092 "Set access control class\n"
2093 "Access control class 0\n"
2094 "Access control class 1\n"
2095 "Access control class 2\n"
2096 "Access control class 3\n"
2097 "Access control class 4\n"
2098 "Access control class 5\n"
2099 "Access control class 6\n"
2100 "Access control class 7\n"
2101 "Access control class 8\n"
2102 "Access control class 9\n"
2103 "Access control class 11 for PLMN use\n"
2104 "Access control class 12 for security services\n"
2105 "Access control class 13 for public utilities (e.g. water/gas suppliers)\n"
2106 "Access control class 14 for emergency services\n"
2107 "Access control class 15 for PLMN staff\n"
2108 "barred to use access control class\n"
2109 "allowed to use access control class\n")
2110{
2111 struct gsm_bts *bts = vty->index;
2112
2113 uint8_t control_class;
2114 uint8_t allowed = 0;
2115
2116 if (strcmp(argv[1], "allowed") == 0)
2117 allowed = 1;
2118
2119 control_class = atoi(argv[0]);
2120 if (control_class < 8)
2121 if (allowed)
2122 bts->si_common.rach_control.t3 &= ~(0x1 << control_class);
2123 else
2124 bts->si_common.rach_control.t3 |= (0x1 << control_class);
2125 else
2126 if (allowed)
2127 bts->si_common.rach_control.t2 &= ~(0x1 << (control_class - 8));
2128 else
2129 bts->si_common.rach_control.t2 |= (0x1 << (control_class - 8));
2130
2131 return CMD_SUCCESS;
2132}
2133
Harald Welte (local)0e451d02009-08-13 10:14:26 +02002134DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
2135 "ms max power <0-40>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002136 "MS Options\n"
Harald Welted13e0cd2012-08-17 09:52:03 +02002137 "Maximum transmit power of the MS\n"
2138 "Maximum transmit power of the MS\n"
Harald Weltecfaabbb2012-08-16 23:23:50 +02002139 "Maximum transmit power of the MS in dBm")
Harald Welte (local)0e451d02009-08-13 10:14:26 +02002140{
2141 struct gsm_bts *bts = vty->index;
2142
2143 bts->ms_max_power = atoi(argv[0]);
2144
2145 return CMD_SUCCESS;
2146}
2147
Harald Weltecfaabbb2012-08-16 23:23:50 +02002148#define CELL_STR "Cell Parameters\n"
2149
Harald Welte73225282009-12-12 18:17:25 +01002150DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
2151 "cell reselection hysteresis <0-14>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002152 CELL_STR "Cell re-selection parameters\n"
2153 "Cell Re-Selection Hysteresis in dB\n"
Harald Welte73225282009-12-12 18:17:25 +01002154 "Cell Re-Selection Hysteresis in dB")
2155{
2156 struct gsm_bts *bts = vty->index;
2157
2158 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
2159
2160 return CMD_SUCCESS;
2161}
2162
2163DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
2164 "rxlev access min <0-63>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002165 "Minimum RxLev needed for cell access\n"
2166 "Minimum RxLev needed for cell access\n"
2167 "Minimum RxLev needed for cell access\n"
Harald Welte73225282009-12-12 18:17:25 +01002168 "Minimum RxLev needed for cell access (better than -110dBm)")
2169{
2170 struct gsm_bts *bts = vty->index;
2171
2172 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
2173
2174 return CMD_SUCCESS;
2175}
2176
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002177DEFUN(cfg_bts_cell_bar_qualify, cfg_bts_cell_bar_qualify_cmd,
2178 "cell bar qualify (0|1)",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002179 CELL_STR "Cell Bar Qualify\n" "Cell Bar Qualify\n"
2180 "Set CBQ to 0\n" "Set CBQ to 1\n")
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002181{
2182 struct gsm_bts *bts = vty->index;
2183
2184 bts->si_common.cell_ro_sel_par.present = 1;
2185 bts->si_common.cell_ro_sel_par.cbq = atoi(argv[0]);
2186
2187 return CMD_SUCCESS;
2188}
2189
2190DEFUN(cfg_bts_cell_resel_ofs, cfg_bts_cell_resel_ofs_cmd,
2191 "cell reselection offset <0-126>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002192 CELL_STR "Cell Re-Selection Parameters\n"
2193 "Cell Re-Selection Offset (CRO) in dB\n"
2194 "Cell Re-Selection Offset (CRO) in dB\n"
2195 )
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002196{
2197 struct gsm_bts *bts = vty->index;
2198
2199 bts->si_common.cell_ro_sel_par.present = 1;
2200 bts->si_common.cell_ro_sel_par.cell_resel_off = atoi(argv[0])/2;
2201
2202 return CMD_SUCCESS;
2203}
2204
2205DEFUN(cfg_bts_temp_ofs, cfg_bts_temp_ofs_cmd,
2206 "temporary offset <0-60>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002207 "Cell selection temporary negative offset\n"
2208 "Cell selection temporary negative offset\n"
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002209 "Cell selection temporary negative offset in dB")
2210{
2211 struct gsm_bts *bts = vty->index;
2212
2213 bts->si_common.cell_ro_sel_par.present = 1;
2214 bts->si_common.cell_ro_sel_par.temp_offs = atoi(argv[0])/10;
2215
2216 return CMD_SUCCESS;
2217}
2218
2219DEFUN(cfg_bts_temp_ofs_inf, cfg_bts_temp_ofs_inf_cmd,
2220 "temporary offset infinite",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002221 "Cell selection temporary negative offset\n"
2222 "Cell selection temporary negative offset\n"
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002223 "Sets cell selection temporary negative offset to infinity")
2224{
2225 struct gsm_bts *bts = vty->index;
2226
2227 bts->si_common.cell_ro_sel_par.present = 1;
2228 bts->si_common.cell_ro_sel_par.temp_offs = 7;
2229
2230 return CMD_SUCCESS;
2231}
2232
2233DEFUN(cfg_bts_penalty_time, cfg_bts_penalty_time_cmd,
2234 "penalty time <20-620>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002235 "Cell selection penalty time\n"
2236 "Cell selection penalty time\n"
2237 "Cell selection penalty time in seconds (by 20s increments)\n")
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002238{
2239 struct gsm_bts *bts = vty->index;
2240
2241 bts->si_common.cell_ro_sel_par.present = 1;
2242 bts->si_common.cell_ro_sel_par.penalty_time = (atoi(argv[0])-20)/20;
2243
2244 return CMD_SUCCESS;
2245}
2246
2247DEFUN(cfg_bts_penalty_time_rsvd, cfg_bts_penalty_time_rsvd_cmd,
2248 "penalty time reserved",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002249 "Cell selection penalty time\n"
2250 "Cell selection penalty time\n"
2251 "Set cell selection penalty time to reserved value 31, "
Sylvain Munaute0b06b02010-11-28 18:17:28 +01002252 "(indicate that CELL_RESELECT_OFFSET is subtracted from C2 "
2253 "and TEMPORARY_OFFSET is ignored)")
2254{
2255 struct gsm_bts *bts = vty->index;
2256
2257 bts->si_common.cell_ro_sel_par.present = 1;
2258 bts->si_common.cell_ro_sel_par.penalty_time = 31;
2259
2260 return CMD_SUCCESS;
2261}
2262
Harald Welte (local)efc92312009-08-14 23:09:25 +02002263DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
Daniel Willmann4d62d632012-12-27 00:02:01 +01002264 "periodic location update <6-1530>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002265 "Periodic Location Updating Interval\n"
2266 "Periodic Location Updating Interval\n"
2267 "Periodic Location Updating Interval\n"
2268 "Periodic Location Updating Interval in Minutes\n")
Harald Welte (local)efc92312009-08-14 23:09:25 +02002269{
2270 struct gsm_bts *bts = vty->index;
2271
Dieter Spaard6613e02010-10-05 21:10:55 +02002272 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 6;
Harald Welte (local)efc92312009-08-14 23:09:25 +02002273
2274 return CMD_SUCCESS;
2275}
2276
Holger Hans Peter Freytherc63f6f12013-07-27 21:07:57 +02002277DEFUN(cfg_bts_no_per_loc_upd, cfg_bts_no_per_loc_upd_cmd,
2278 "no periodic location update",
2279 NO_STR
2280 "Periodic Location Updating Interval\n"
2281 "Periodic Location Updating Interval\n"
2282 "Periodic Location Updating Interval\n")
2283{
2284 struct gsm_bts *bts = vty->index;
2285
2286 bts->si_common.chan_desc.t3212 = 0;
Andreas Eversberg4d4944a2013-03-10 11:49:35 +01002287
2288 return CMD_SUCCESS;
2289}
2290
2291DEFUN(cfg_bts_radio_link_timeout, cfg_bts_radio_link_timeout_cmd,
2292 "radio-link-timeout <4-64>",
2293 "Radio link timeout criterion (BTS side)\n"
2294 "Radio link timeout value (lost SACCH block)\n")
2295{
2296 struct gsm_bts *bts = vty->index;
2297
2298 set_radio_link_timeout(&bts->si_common.cell_options, atoi(argv[0]));
2299
Holger Hans Peter Freytherc63f6f12013-07-27 21:07:57 +02002300 return CMD_SUCCESS;
2301}
2302
Harald Welte8f0ed552010-05-11 21:53:49 +02002303#define GPRS_TEXT "GPRS Packet Network\n"
2304
Harald Welteaf387632010-03-14 23:30:30 +08002305DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welte57ba7e32010-04-18 14:00:26 +02002306 "gprs cell bvci <2-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02002307 GPRS_TEXT
2308 "GPRS Cell Settings\n"
Harald Weltecfaabbb2012-08-16 23:23:50 +02002309 "GPRS BSSGP VC Identifier\n"
Harald Welte97a282b2010-03-14 15:37:43 +08002310 "GPRS BSSGP VC Identifier")
2311{
2312 struct gsm_bts *bts = vty->index;
2313
Harald Welte4511d892010-04-18 15:51:20 +02002314 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08002315 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2316 return CMD_WARNING;
2317 }
2318
Harald Welte97a282b2010-03-14 15:37:43 +08002319 bts->gprs.cell.bvci = atoi(argv[0]);
2320
2321 return CMD_SUCCESS;
2322}
2323
Harald Weltea5731cf2010-03-22 11:48:36 +08002324DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
2325 "gprs nsei <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02002326 GPRS_TEXT
Harald Weltecfaabbb2012-08-16 23:23:50 +02002327 "GPRS NS Entity Identifier\n"
Harald Weltea5731cf2010-03-22 11:48:36 +08002328 "GPRS NS Entity Identifier")
2329{
2330 struct gsm_bts *bts = vty->index;
2331
Harald Welte4511d892010-04-18 15:51:20 +02002332 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltea5731cf2010-03-22 11:48:36 +08002333 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2334 return CMD_WARNING;
2335 }
2336
2337 bts->gprs.nse.nsei = atoi(argv[0]);
2338
2339 return CMD_SUCCESS;
2340}
2341
Harald Welte8f0ed552010-05-11 21:53:49 +02002342#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
2343 "NSVC Logical Number\n"
Harald Weltea5731cf2010-03-22 11:48:36 +08002344
Harald Welte97a282b2010-03-14 15:37:43 +08002345DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
2346 "gprs nsvc <0-1> nsvci <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02002347 GPRS_TEXT NSVC_TEXT
2348 "NS Virtual Connection Identifier\n"
Harald Welte97a282b2010-03-14 15:37:43 +08002349 "GPRS NS VC Identifier")
2350{
2351 struct gsm_bts *bts = vty->index;
2352 int idx = atoi(argv[0]);
2353
Harald Welte4511d892010-04-18 15:51:20 +02002354 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08002355 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2356 return CMD_WARNING;
2357 }
2358
Harald Welte97a282b2010-03-14 15:37:43 +08002359 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
2360
2361 return CMD_SUCCESS;
2362}
2363
Harald Welteaf387632010-03-14 23:30:30 +08002364DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
2365 "gprs nsvc <0-1> local udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02002366 GPRS_TEXT NSVC_TEXT
Harald Weltecfaabbb2012-08-16 23:23:50 +02002367 "GPRS NS Local UDP Port\n"
2368 "GPRS NS Local UDP Port\n"
2369 "GPRS NS Local UDP Port\n"
Harald Welte13fe2192012-08-17 09:57:25 +02002370 "GPRS NS Local UDP Port Number\n")
Harald Welteaf387632010-03-14 23:30:30 +08002371{
2372 struct gsm_bts *bts = vty->index;
2373 int idx = atoi(argv[0]);
2374
Harald Welte4511d892010-04-18 15:51:20 +02002375 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08002376 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2377 return CMD_WARNING;
2378 }
2379
Harald Welteaf387632010-03-14 23:30:30 +08002380 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
2381
2382 return CMD_SUCCESS;
2383}
2384
2385DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
2386 "gprs nsvc <0-1> remote udp port <0-65535>",
Harald Welte8f0ed552010-05-11 21:53:49 +02002387 GPRS_TEXT NSVC_TEXT
Harald Weltecfaabbb2012-08-16 23:23:50 +02002388 "GPRS NS Remote UDP Port\n"
2389 "GPRS NS Remote UDP Port\n"
Harald Welte13fe2192012-08-17 09:57:25 +02002390 "GPRS NS Remote UDP Port\n"
2391 "GPRS NS Remote UDP Port Number\n")
Harald Welteaf387632010-03-14 23:30:30 +08002392{
2393 struct gsm_bts *bts = vty->index;
2394 int idx = atoi(argv[0]);
2395
Harald Welte4511d892010-04-18 15:51:20 +02002396 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08002397 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2398 return CMD_WARNING;
2399 }
2400
Harald Welteaf387632010-03-14 23:30:30 +08002401 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
2402
2403 return CMD_SUCCESS;
2404}
2405
2406DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
2407 "gprs nsvc <0-1> remote ip A.B.C.D",
Harald Welte8f0ed552010-05-11 21:53:49 +02002408 GPRS_TEXT NSVC_TEXT
Harald Weltecfaabbb2012-08-16 23:23:50 +02002409 "GPRS NS Remote IP Address\n"
2410 "GPRS NS Remote IP Address\n"
2411 "GPRS NS Remote IP Address\n")
Harald Welteaf387632010-03-14 23:30:30 +08002412{
2413 struct gsm_bts *bts = vty->index;
2414 int idx = atoi(argv[0]);
2415 struct in_addr ia;
2416
Harald Welte4511d892010-04-18 15:51:20 +02002417 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08002418 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2419 return CMD_WARNING;
2420 }
2421
Harald Welteaf387632010-03-14 23:30:30 +08002422 inet_aton(argv[1], &ia);
2423 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
2424
2425 return CMD_SUCCESS;
2426}
2427
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08002428DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd,
Harald Weltecfaabbb2012-08-16 23:23:50 +02002429 "paging free <-1-1024>",
2430 "Paging options\n"
2431 "Only page when having a certain amount of free slots\n"
2432 "amount of required free paging slots. -1 to disable\n")
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08002433{
2434 struct gsm_bts *bts = vty->index;
2435
2436 bts->paging.free_chans_need = atoi(argv[0]);
2437 return CMD_SUCCESS;
2438}
2439
Harald Welte615e9562010-05-11 23:50:21 +02002440DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd,
2441 "gprs ns timer " NS_TIMERS " <0-255>",
2442 GPRS_TEXT "Network Service\n"
2443 "Network Service Timer\n"
2444 NS_TIMERS_HELP "Timer Value\n")
2445{
2446 struct gsm_bts *bts = vty->index;
2447 int idx = get_string_value(gprs_ns_timer_strs, argv[0]);
2448 int val = atoi(argv[1]);
2449
2450 if (bts->gprs.mode == BTS_GPRS_NONE) {
2451 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2452 return CMD_WARNING;
2453 }
2454
2455 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
2456 return CMD_WARNING;
2457
2458 bts->gprs.nse.timer[idx] = val;
2459
2460 return CMD_SUCCESS;
2461}
2462
2463#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 +02002464#define BSSGP_TIMERS_HELP \
2465 "Tbvc-block timeout\n" \
2466 "Tbvc-block retries\n" \
2467 "Tbvc-unblock retries\n" \
2468 "Tbvcc-reset timeout\n" \
2469 "Tbvc-reset retries\n" \
2470 "Tbvc-suspend timeout\n" \
2471 "Tbvc-suspend retries\n" \
2472 "Tbvc-resume timeout\n" \
2473 "Tbvc-resume retries\n" \
2474 "Tbvc-capa-update timeout\n" \
2475 "Tbvc-capa-update retries\n"
Harald Welte615e9562010-05-11 23:50:21 +02002476
2477DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd,
2478 "gprs cell timer " BSSGP_TIMERS " <0-255>",
2479 GPRS_TEXT "Cell / BSSGP\n"
2480 "Cell/BSSGP Timer\n"
2481 BSSGP_TIMERS_HELP "Timer Value\n")
2482{
2483 struct gsm_bts *bts = vty->index;
2484 int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
2485 int val = atoi(argv[1]);
2486
2487 if (bts->gprs.mode == BTS_GPRS_NONE) {
2488 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2489 return CMD_WARNING;
2490 }
2491
2492 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer))
2493 return CMD_WARNING;
2494
2495 bts->gprs.cell.timer[idx] = val;
2496
2497 return CMD_SUCCESS;
2498}
2499
Harald Welte97a282b2010-03-14 15:37:43 +08002500DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
2501 "gprs routing area <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02002502 GPRS_TEXT
Harald Weltecfaabbb2012-08-16 23:23:50 +02002503 "GPRS Routing Area Code\n"
2504 "GPRS Routing Area Code\n"
2505 "GPRS Routing Area Code\n")
Harald Welte97a282b2010-03-14 15:37:43 +08002506{
2507 struct gsm_bts *bts = vty->index;
2508
Harald Welte4511d892010-04-18 15:51:20 +02002509 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte94036702010-03-14 23:56:56 +08002510 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2511 return CMD_WARNING;
2512 }
2513
Harald Welte97a282b2010-03-14 15:37:43 +08002514 bts->gprs.rac = atoi(argv[0]);
2515
2516 return CMD_SUCCESS;
2517}
2518
Max292ec582016-07-28 11:55:37 +02002519DEFUN(cfg_bts_gprs_ctrl_ack, cfg_bts_gprs_ctrl_ack_cmd,
2520 "gprs control-ack-type-rach", GPRS_TEXT
2521 "Set GPRS Control Ack Type for PACKET CONTROL ACKNOWLEDGMENT message to "
2522 "four access bursts format instead of default RLC/MAC control block\n")
2523{
2524 struct gsm_bts *bts = vty->index;
2525
2526 if (bts->gprs.mode == BTS_GPRS_NONE) {
2527 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2528 return CMD_WARNING;
2529 }
2530
2531 bts->gprs.ctrl_ack_type_use_block = false;
2532
2533 return CMD_SUCCESS;
2534}
2535
2536DEFUN(cfg_no_bts_gprs_ctrl_ack, cfg_no_bts_gprs_ctrl_ack_cmd,
2537 "no gprs control-ack-type-rach", NO_STR GPRS_TEXT
2538 "Set GPRS Control Ack Type for PACKET CONTROL ACKNOWLEDGMENT message to "
2539 "four access bursts format instead of default RLC/MAC control block\n")
2540{
2541 struct gsm_bts *bts = vty->index;
2542
2543 if (bts->gprs.mode == BTS_GPRS_NONE) {
2544 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2545 return CMD_WARNING;
2546 }
2547
2548 bts->gprs.ctrl_ack_type_use_block = true;
2549
2550 return CMD_SUCCESS;
2551}
2552
Andreas Eversberg0c8f9ca2013-03-16 16:31:26 +01002553DEFUN(cfg_bts_gprs_net_ctrl_ord, cfg_bts_gprs_net_ctrl_ord_cmd,
2554 "gprs network-control-order (nc0|nc1|nc2)",
2555 GPRS_TEXT
2556 "GPRS Network Control Order\n"
2557 "MS controlled cell re-selection, no measurement reporting\n"
2558 "MS controlled cell re-selection, MS sends measurement reports\n"
2559 "Network controlled cell re-selection, MS sends measurement reports\n")
2560{
2561 struct gsm_bts *bts = vty->index;
2562
2563 if (bts->gprs.mode == BTS_GPRS_NONE) {
2564 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2565 return CMD_WARNING;
2566 }
2567
2568 bts->gprs.net_ctrl_ord = atoi(argv[0] + 2);
2569
2570 return CMD_SUCCESS;
2571}
2572
Harald Welte4511d892010-04-18 15:51:20 +02002573DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
2574 "gprs mode (none|gprs|egprs)",
Harald Welte8f0ed552010-05-11 21:53:49 +02002575 GPRS_TEXT
2576 "GPRS Mode for this BTS\n"
2577 "GPRS Disabled on this BTS\n"
2578 "GPRS Enabled on this BTS\n"
2579 "EGPRS (EDGE) Enabled on this BTS\n")
Harald Welteaf387632010-03-14 23:30:30 +08002580{
2581 struct gsm_bts *bts = vty->index;
Holger Hans Peter Freyther4e13a8f2015-01-31 22:16:00 +01002582 enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0], NULL);
Harald Welteaf387632010-03-14 23:30:30 +08002583
Holger Hans Peter Freyther4e13a8f2015-01-31 22:16:00 +01002584 if (!bts_gprs_mode_is_compat(bts, mode)) {
Harald Weltef3d8e922010-06-14 22:44:42 +02002585 vty_out(vty, "This BTS type does not support %s%s", argv[0],
2586 VTY_NEWLINE);
2587 return CMD_WARNING;
2588 }
2589
2590 bts->gprs.mode = mode;
Harald Welteaf387632010-03-14 23:30:30 +08002591
2592 return CMD_SUCCESS;
2593}
2594
bhargava350533c2016-07-21 11:14:34 +05302595DEFUN(cfg_bts_gprs_11bit_rach_support_for_egprs,
2596 cfg_bts_gprs_11bit_rach_support_for_egprs_cmd,
2597 "gprs 11bit_rach_support_for_egprs (0|1)",
2598 GPRS_TEXT "11 bit RACH options\n"
2599 "Disable 11 bit RACH for EGPRS\n"
2600 "Enable 11 bit RACH for EGPRS")
2601{
2602 struct gsm_bts *bts = vty->index;
2603
2604 bts->gprs.supports_egprs_11bit_rach = atoi(argv[0]);
2605
2606 if (bts->gprs.supports_egprs_11bit_rach > 1) {
2607 vty_out(vty, "Error in RACH type%s", VTY_NEWLINE);
2608 return CMD_WARNING;
2609 }
2610
2611 if ((bts->gprs.mode == BTS_GPRS_NONE) &&
2612 (bts->gprs.supports_egprs_11bit_rach == 1)) {
2613 vty_out(vty, "Error:gprs mode is none and 11bit rach is"
2614 " enabled%s", VTY_NEWLINE);
2615 return CMD_WARNING;
2616 }
2617
2618 return CMD_SUCCESS;
2619}
2620
Harald Welte9fbff4a2010-07-30 11:50:09 +02002621#define SI_TEXT "System Information Messages\n"
2622#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)"
2623#define SI_TYPE_HELP "System Information Type 1\n" \
2624 "System Information Type 2\n" \
2625 "System Information Type 3\n" \
2626 "System Information Type 4\n" \
2627 "System Information Type 5\n" \
2628 "System Information Type 6\n" \
2629 "System Information Type 7\n" \
2630 "System Information Type 8\n" \
2631 "System Information Type 9\n" \
2632 "System Information Type 10\n" \
2633 "System Information Type 13\n" \
2634 "System Information Type 16\n" \
2635 "System Information Type 17\n" \
2636 "System Information Type 18\n" \
2637 "System Information Type 19\n" \
2638 "System Information Type 20\n" \
2639 "System Information Type 2bis\n" \
2640 "System Information Type 2ter\n" \
2641 "System Information Type 2quater\n" \
2642 "System Information Type 5bis\n" \
2643 "System Information Type 5ter\n"
2644
2645DEFUN(cfg_bts_si_mode, cfg_bts_si_mode_cmd,
2646 "system-information " SI_TYPE_TEXT " mode (static|computed)",
2647 SI_TEXT SI_TYPE_HELP
2648 "System Information Mode\n"
2649 "Static user-specified\n"
2650 "Dynamic, BSC-computed\n")
2651{
2652 struct gsm_bts *bts = vty->index;
2653 int type;
2654
2655 type = get_string_value(osmo_sitype_strs, argv[0]);
2656 if (type < 0) {
2657 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2658 return CMD_WARNING;
2659 }
2660
2661 if (!strcmp(argv[1], "static"))
2662 bts->si_mode_static |= (1 << type);
2663 else
2664 bts->si_mode_static &= ~(1 << type);
2665
2666 return CMD_SUCCESS;
2667}
2668
2669DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd,
2670 "system-information " SI_TYPE_TEXT " static HEXSTRING",
2671 SI_TEXT SI_TYPE_HELP
2672 "Static System Information filling\n"
2673 "Static user-specified SI content in HEX notation\n")
2674{
2675 struct gsm_bts *bts = vty->index;
2676 int rc, type;
2677
2678 type = get_string_value(osmo_sitype_strs, argv[0]);
2679 if (type < 0) {
2680 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2681 return CMD_WARNING;
2682 }
2683
2684 if (!(bts->si_mode_static & (1 << type))) {
2685 vty_out(vty, "SI Type %s is not configured in static mode%s",
2686 get_value_string(osmo_sitype_strs, type), VTY_NEWLINE);
2687 return CMD_WARNING;
2688 }
2689
Harald Welte290aaed2010-07-30 11:53:18 +02002690 /* Fill buffer with padding pattern */
2691 memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type]));
2692
2693 /* Parse the user-specified SI in hex format, [partially] overwriting padding */
Pablo Neira Ayusoc0d17f22011-05-07 12:12:48 +02002694 rc = osmo_hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0]));
Harald Welte9fbff4a2010-07-30 11:50:09 +02002695 if (rc < 0 || rc > sizeof(bts->si_buf[0])) {
2696 vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
2697 return CMD_WARNING;
2698 }
2699
2700 /* Mark this SI as present */
2701 bts->si_valid |= (1 << type);
2702
2703 return CMD_SUCCESS;
2704}
2705
Harald Welte42def722017-01-13 00:10:32 +01002706DEFUN(cfg_bts_early_cm, cfg_bts_early_cm_cmd,
2707 "early-classmark-sending (allowed|forbidden)",
2708 "Early Classmark Sending\n"
2709 "Early Classmark Sending is allowed\n"
2710 "Early Classmark Sending is forbidden\n")
2711{
2712 struct gsm_bts *bts = vty->index;
Harald Welte42def722017-01-13 00:10:32 +01002713
2714 if (!strcmp(argv[0], "allowed"))
2715 bts->early_classmark_allowed = true;
2716 else
2717 bts->early_classmark_allowed = false;
2718
2719 return CMD_SUCCESS;
2720}
2721
Harald Welte32c09622011-01-11 23:44:56 +01002722DEFUN(cfg_bts_neigh_mode, cfg_bts_neigh_mode_cmd,
Harald Welte64c07d22011-02-15 11:43:27 +01002723 "neighbor-list mode (automatic|manual|manual-si5)",
Harald Welte32c09622011-01-11 23:44:56 +01002724 "Neighbor List\n" "Mode of Neighbor List generation\n"
Harald Welte64c07d22011-02-15 11:43:27 +01002725 "Automatically from all BTS in this OpenBSC\n" "Manual\n"
2726 "Manual with different lists for SI2 and SI5\n")
Harald Welte32c09622011-01-11 23:44:56 +01002727{
2728 struct gsm_bts *bts = vty->index;
Harald Welte64c07d22011-02-15 11:43:27 +01002729 int mode = get_string_value(bts_neigh_mode_strs, argv[0]);
Harald Welte32c09622011-01-11 23:44:56 +01002730
Harald Welte64c07d22011-02-15 11:43:27 +01002731 switch (mode) {
2732 case NL_MODE_MANUAL_SI5SEP:
2733 case NL_MODE_MANUAL:
Harald Welte32c09622011-01-11 23:44:56 +01002734 /* make sure we clear the current list when switching to
2735 * manual mode */
2736 if (bts->neigh_list_manual_mode == 0)
2737 memset(&bts->si_common.data.neigh_list, 0,
2738 sizeof(bts->si_common.data.neigh_list));
Harald Welte64c07d22011-02-15 11:43:27 +01002739 break;
2740 default:
2741 break;
2742 }
2743
2744 bts->neigh_list_manual_mode = mode;
Harald Welte32c09622011-01-11 23:44:56 +01002745
2746 return CMD_SUCCESS;
2747}
2748
2749DEFUN(cfg_bts_neigh, cfg_bts_neigh_cmd,
Harald Welte1fe73a12012-01-29 13:24:12 +01002750 "neighbor-list (add|del) arfcn <0-1023>",
Harald Welte32c09622011-01-11 23:44:56 +01002751 "Neighbor List\n" "Add to manual neighbor list\n"
2752 "Delete from manual neighbor list\n" "ARFCN of neighbor\n"
2753 "ARFCN of neighbor\n")
2754{
2755 struct gsm_bts *bts = vty->index;
2756 struct bitvec *bv = &bts->si_common.neigh_list;
2757 uint16_t arfcn = atoi(argv[1]);
2758
2759 if (!bts->neigh_list_manual_mode) {
2760 vty_out(vty, "%% Cannot configure neighbor list in "
2761 "automatic mode%s", VTY_NEWLINE);
2762 return CMD_WARNING;
2763 }
2764
2765 if (!strcmp(argv[0], "add"))
2766 bitvec_set_bit_pos(bv, arfcn, 1);
2767 else
2768 bitvec_set_bit_pos(bv, arfcn, 0);
2769
2770 return CMD_SUCCESS;
2771}
2772
Max59a1bf32016-04-15 16:04:46 +02002773DEFUN(cfg_bts_si2quater_neigh_add, cfg_bts_si2quater_neigh_add_cmd,
Max2c16bee2017-02-15 13:51:37 +01002774 "si2quater neighbor-list add earfcn <0-65535> thresh-hi <0-31> "
2775 "thresh-lo <0-32> prio <0-8> qrxlv <0-32> meas <0-8>",
2776 "SI2quater Neighbor List\n" "SI2quater Neighbor List\n"
2777 "Add to manual SI2quater neighbor list\n"
2778 "EARFCN of neighbor\n" "EARFCN of neighbor\n"
2779 "threshold high bits\n" "threshold high bits\n"
2780 "threshold low bits\n" "threshold low bits (32 means NA)\n"
2781 "priority\n" "priority (8 means NA)\n"
2782 "QRXLEVMIN\n" "QRXLEVMIN (32 means NA)\n"
2783 "measurement bandwidth\n" "measurement bandwidth (8 means NA)\n")
Max59a1bf32016-04-15 16:04:46 +02002784{
2785 struct gsm_bts *bts = vty->index;
2786 struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list;
2787 uint16_t arfcn = atoi(argv[0]);
Max2c16bee2017-02-15 13:51:37 +01002788 uint8_t thresh_hi = atoi(argv[1]), thresh_lo = atoi(argv[2]),
2789 prio = atoi(argv[3]), qrx = atoi(argv[4]), meas = atoi(argv[5]);
2790 int r = osmo_earfcn_add(e, arfcn,
2791 (meas < 8) ? meas : OSMO_EARFCN_MEAS_INVALID);
Max59a1bf32016-04-15 16:04:46 +02002792
2793 if (r < 0) {
Max2c16bee2017-02-15 13:51:37 +01002794 vty_out(vty, "Unable to add ARFCN %u: %s%s", arfcn, strerror(-r),
Max59a1bf32016-04-15 16:04:46 +02002795 VTY_NEWLINE);
2796 return CMD_WARNING;
2797 }
2798
Max2c16bee2017-02-15 13:51:37 +01002799 if (e->thresh_hi && thresh_hi != e->thresh_hi)
2800 vty_out(vty, "Warning: multiple threshold-high are not "
2801 "supported, overriding previous threshold %u%s",
2802 e->thresh_hi, VTY_NEWLINE);
2803
2804 e->thresh_hi = thresh_hi;
2805
2806 if (thresh_lo != 32) {
2807 if (e->thresh_lo_valid && e->thresh_lo != thresh_lo)
2808 vty_out(vty, "Warning: multiple threshold-low are not "
2809 "supported, overriding previous threshold %u%s",
2810 e->thresh_lo, VTY_NEWLINE);
2811 e->thresh_lo = thresh_lo;
2812 e->thresh_lo_valid = true;
Maxaafff962016-04-20 15:57:14 +02002813 }
Max2c16bee2017-02-15 13:51:37 +01002814
2815 if (qrx != 32) {
2816 if (e->qrxlm_valid && e->qrxlm != qrx)
2817 vty_out(vty, "Warning: multiple QRXLEVMIN are not "
2818 "supported, overriding previous value %u%s",
2819 e->qrxlm, VTY_NEWLINE);
2820 e->qrxlm = qrx;
2821 e->qrxlm_valid = true;
2822 }
2823
2824 if (prio != 8) {
2825 if (e->prio_valid && e->prio != prio)
2826 vty_out(vty, "Warning: multiple priorities are not "
2827 "supported, overriding previous value %u%s",
2828 e->prio, VTY_NEWLINE);
2829 e->prio = prio;
2830 e->prio_valid = true;
2831 }
2832
2833 if (si2q_size_check(bts))
2834 return CMD_SUCCESS;
2835
2836 vty_out(vty, "Warning: not enough space in SI2quater for a given EARFCN "
2837 "%u%s", arfcn, VTY_NEWLINE);
Maxaafff962016-04-20 15:57:14 +02002838 osmo_earfcn_del(e, arfcn);
Max2c16bee2017-02-15 13:51:37 +01002839
Maxaafff962016-04-20 15:57:14 +02002840 return CMD_WARNING;
Max59a1bf32016-04-15 16:04:46 +02002841}
2842
2843DEFUN(cfg_bts_si2quater_neigh_del, cfg_bts_si2quater_neigh_del_cmd,
Max35697b92016-04-29 12:51:31 +02002844 "si2quater neighbor-list del earfcn <0-65535>",
Max59a1bf32016-04-15 16:04:46 +02002845 "SI2quater Neighbor List\n"
2846 "SI2quater Neighbor List\n"
2847 "Delete from SI2quater manual neighbor list\n"
Max36212f22016-04-20 12:06:05 +02002848 "EARFCN of neighbor\n"
2849 "EARFCN\n")
Max59a1bf32016-04-15 16:04:46 +02002850{
2851 struct gsm_bts *bts = vty->index;
2852 struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list;
Max0c1bc262016-04-20 12:06:06 +02002853 uint16_t arfcn = atoi(argv[0]);
Max59a1bf32016-04-15 16:04:46 +02002854 int r = osmo_earfcn_del(e, arfcn);
2855 if (r < 0) {
2856 vty_out(vty, "Unable to delete arfcn %u: %s%s", arfcn,
Max0c1bc262016-04-20 12:06:06 +02002857 strerror(-r), VTY_NEWLINE);
Max59a1bf32016-04-15 16:04:46 +02002858 return CMD_WARNING;
2859 }
2860
2861 return CMD_SUCCESS;
2862}
2863
Max26679e02016-04-20 15:57:13 +02002864DEFUN(cfg_bts_si2quater_uarfcn_add, cfg_bts_si2quater_uarfcn_add_cmd,
Max35697b92016-04-29 12:51:31 +02002865 "si2quater neighbor-list add uarfcn <0-16383> <0-511> <0-1>",
Max26679e02016-04-20 15:57:13 +02002866 "SI2quater Neighbor List\n"
2867 "SI2quater Neighbor List\n" "Add to manual SI2quater neighbor list\n"
2868 "UARFCN of neighbor\n" "UARFCN of neighbor\n" "scrambling code\n"
2869 "diversity bit\n")
2870{
2871 struct gsm_bts *bts = vty->index;
2872 uint16_t arfcn = atoi(argv[0]), scramble = atoi(argv[1]);
2873
2874 switch(bts_uarfcn_add(bts, arfcn, scramble, atoi(argv[2]))) {
2875 case -ENOMEM:
2876 vty_out(vty, "Unable to add arfcn: max number of UARFCNs (%u) "
2877 "reached%s", MAX_EARFCN_LIST, VTY_NEWLINE);
Harald Weltea191dcd2016-11-26 15:06:37 +01002878 return CMD_WARNING;
Maxaafff962016-04-20 15:57:14 +02002879 case -ENOSPC:
2880 vty_out(vty, "Warning: not enough space in si2quater for a "
2881 "given arfcn%s", VTY_NEWLINE);
Harald Weltea191dcd2016-11-26 15:06:37 +01002882 return CMD_WARNING;
Max26679e02016-04-20 15:57:13 +02002883 case -EADDRINUSE:
2884 vty_out(vty, "Unable to add arfcn: (%u, %u) is already added%s",
2885 arfcn, scramble, VTY_NEWLINE);
2886 return CMD_WARNING;
2887 }
2888
2889 return CMD_SUCCESS;
2890}
2891
2892DEFUN(cfg_bts_si2quater_uarfcn_del, cfg_bts_si2quater_uarfcn_del_cmd,
Max35697b92016-04-29 12:51:31 +02002893 "si2quater neighbor-list del uarfcn <0-16383> <0-511>",
Max26679e02016-04-20 15:57:13 +02002894 "SI2quater Neighbor List\n"
2895 "SI2quater Neighbor List\n"
2896 "Delete from SI2quater manual neighbor list\n"
2897 "UARFCN of neighbor\n"
2898 "UARFCN\n"
2899 "scrambling code\n")
2900{
2901 struct gsm_bts *bts = vty->index;
2902
2903 if (bts_uarfcn_del(bts, atoi(argv[0]), atoi(argv[1])) < 0) {
2904 vty_out(vty, "Unable to delete uarfcn: pair not found%s",
2905 VTY_NEWLINE);
2906 return CMD_WARNING;
2907 }
2908
2909 return CMD_SUCCESS;
2910}
2911
Harald Welte64c07d22011-02-15 11:43:27 +01002912DEFUN(cfg_bts_si5_neigh, cfg_bts_si5_neigh_cmd,
Harald Welte1fe73a12012-01-29 13:24:12 +01002913 "si5 neighbor-list (add|del) arfcn <0-1023>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02002914 "SI5 Neighbor List\n"
Harald Welte64c07d22011-02-15 11:43:27 +01002915 "SI5 Neighbor List\n" "Add to manual SI5 neighbor list\n"
2916 "Delete from SI5 manual neighbor list\n" "ARFCN of neighbor\n"
2917 "ARFCN of neighbor\n")
2918{
2919 struct gsm_bts *bts = vty->index;
2920 struct bitvec *bv = &bts->si_common.si5_neigh_list;
2921 uint16_t arfcn = atoi(argv[1]);
2922
2923 if (!bts->neigh_list_manual_mode) {
2924 vty_out(vty, "%% Cannot configure neighbor list in "
2925 "automatic mode%s", VTY_NEWLINE);
2926 return CMD_WARNING;
2927 }
2928
2929 if (!strcmp(argv[0], "add"))
2930 bitvec_set_bit_pos(bv, arfcn, 1);
2931 else
2932 bitvec_set_bit_pos(bv, arfcn, 0);
2933
2934 return CMD_SUCCESS;
2935}
Harald Welte9fbff4a2010-07-30 11:50:09 +02002936
Holger Hans Peter Freythere30d40d2012-07-20 10:27:31 +02002937#define EXCL_RFLOCK_STR "Exclude this BTS from the global RF Lock\n"
2938
2939DEFUN(cfg_bts_excl_rf_lock,
2940 cfg_bts_excl_rf_lock_cmd,
2941 "rf-lock-exclude",
2942 EXCL_RFLOCK_STR)
2943{
2944 struct gsm_bts *bts = vty->index;
2945 bts->excl_from_rf_lock = 1;
2946 return CMD_SUCCESS;
2947}
2948
2949DEFUN(cfg_bts_no_excl_rf_lock,
2950 cfg_bts_no_excl_rf_lock_cmd,
2951 "no rf-lock-exclude",
2952 NO_STR EXCL_RFLOCK_STR)
2953{
2954 struct gsm_bts *bts = vty->index;
2955 bts->excl_from_rf_lock = 0;
2956 return CMD_SUCCESS;
2957}
2958
Jacob Erlbeck65d114f2014-01-16 11:02:14 +01002959#define FORCE_COMB_SI_STR "Force the generation of a single SI (no ter/bis)\n"
2960
2961DEFUN(cfg_bts_force_comb_si,
2962 cfg_bts_force_comb_si_cmd,
2963 "force-combined-si",
2964 FORCE_COMB_SI_STR)
2965{
2966 struct gsm_bts *bts = vty->index;
2967 bts->force_combined_si = 1;
2968 return CMD_SUCCESS;
2969}
2970
2971DEFUN(cfg_bts_no_force_comb_si,
2972 cfg_bts_no_force_comb_si_cmd,
2973 "no force-combined-si",
2974 NO_STR FORCE_COMB_SI_STR)
2975{
2976 struct gsm_bts *bts = vty->index;
2977 bts->force_combined_si = 0;
2978 return CMD_SUCCESS;
2979}
2980
Andreas Eversberga83d5112013-12-07 18:32:28 +01002981static void _get_codec_from_arg(struct vty *vty, int argc, const char *argv[])
2982{
2983 struct gsm_bts *bts = vty->index;
2984 struct bts_codec_conf *codec = &bts->codec;
2985 int i;
2986
2987 codec->hr = 0;
2988 codec->efr = 0;
2989 codec->amr = 0;
2990 for (i = 0; i < argc; i++) {
2991 if (!strcmp(argv[i], "hr"))
2992 codec->hr = 1;
2993 if (!strcmp(argv[i], "efr"))
2994 codec->efr = 1;
2995 if (!strcmp(argv[i], "amr"))
2996 codec->amr = 1;
2997 }
2998}
2999
3000#define CODEC_PAR_STR " (hr|efr|amr)"
3001#define CODEC_HELP_STR "Half Rate\n" \
3002 "Enhanced Full Rate\nAdaptive Multirate\n"
3003
3004DEFUN(cfg_bts_codec0, cfg_bts_codec0_cmd,
3005 "codec-support fr",
3006 "Codec Support settings\nFullrate\n")
3007{
3008 _get_codec_from_arg(vty, 0, argv);
3009 return CMD_SUCCESS;
3010}
3011
3012DEFUN(cfg_bts_codec1, cfg_bts_codec1_cmd,
3013 "codec-support fr" CODEC_PAR_STR,
3014 "Codec Support settings\nFullrate\n"
3015 CODEC_HELP_STR)
3016{
3017 _get_codec_from_arg(vty, 1, argv);
3018 return CMD_SUCCESS;
3019}
3020
3021DEFUN(cfg_bts_codec2, cfg_bts_codec2_cmd,
3022 "codec-support fr" CODEC_PAR_STR CODEC_PAR_STR,
3023 "Codec Support settings\nFullrate\n"
3024 CODEC_HELP_STR CODEC_HELP_STR)
3025{
3026 _get_codec_from_arg(vty, 2, argv);
3027 return CMD_SUCCESS;
3028}
3029
3030DEFUN(cfg_bts_codec3, cfg_bts_codec3_cmd,
3031 "codec-support fr" CODEC_PAR_STR CODEC_PAR_STR CODEC_PAR_STR,
3032 "Codec Support settings\nFullrate\n"
3033 CODEC_HELP_STR CODEC_HELP_STR CODEC_HELP_STR)
3034{
3035 _get_codec_from_arg(vty, 3, argv);
3036 return CMD_SUCCESS;
3037}
3038
3039DEFUN(cfg_bts_codec4, cfg_bts_codec4_cmd,
3040 "codec-support fr" CODEC_PAR_STR CODEC_PAR_STR CODEC_PAR_STR CODEC_PAR_STR,
3041 "Codec Support settings\nFullrate\n"
3042 CODEC_HELP_STR CODEC_HELP_STR CODEC_HELP_STR CODEC_HELP_STR)
3043{
3044 _get_codec_from_arg(vty, 4, argv);
3045 return CMD_SUCCESS;
3046}
3047
Holger Hans Peter Freytherc22930e2014-12-17 14:46:17 +01003048DEFUN(cfg_bts_depends_on, cfg_bts_depends_on_cmd,
3049 "depends-on-bts <0-255>",
3050 "This BTS can only be started if another one is up\n" "BTS Number\n")
3051{
3052 struct gsm_bts *bts = vty->index;
3053 struct gsm_bts *other_bts;
3054 int dep = atoi(argv[0]);
3055
3056
3057 if (!is_ipaccess_bts(bts)) {
3058 vty_out(vty, "This feature is only available for IP systems.%s",
3059 VTY_NEWLINE);
3060 return CMD_WARNING;
3061 }
3062
3063 other_bts = gsm_bts_num(bts->network, dep);
3064 if (!other_bts || !is_ipaccess_bts(other_bts)) {
3065 vty_out(vty, "This feature is only available for IP systems.%s",
3066 VTY_NEWLINE);
3067 return CMD_WARNING;
3068 }
3069
3070 if (dep >= bts->nr) {
3071 vty_out(vty, "%%Need to depend on an already declared unit.%s",
3072 VTY_NEWLINE);
3073 return CMD_WARNING;
3074 }
3075
3076 bts_depend_mark(bts, dep);
3077 return CMD_SUCCESS;
3078}
3079
3080DEFUN(cfg_bts_no_depends_on, cfg_bts_no_depends_on_cmd,
3081 "depeneds-on-bts <0-255>",
3082 NO_STR "This BTS can only be started if another one is up\n"
3083 "BTS Number\n")
3084{
3085 struct gsm_bts *bts = vty->index;
3086 int dep = atoi(argv[0]);
3087
3088 bts_depend_clear(bts, dep);
3089 return CMD_SUCCESS;
3090}
3091
Andreas Eversberg73266522014-01-19 11:47:44 +01003092#define AMR_TEXT "Adaptive Multi Rate settings\n"
3093#define AMR_MODE_TEXT "Codec modes to use with AMR codec\n"
3094#define AMR_START_TEXT "Initial codec to use with AMR\n" \
3095 "Automatically\nFirst codec\nSecond codec\nThird codec\nFourth codec\n"
3096#define AMR_TH_TEXT "AMR threshold between codecs\nMS side\nBTS side\n"
3097#define AMR_HY_TEXT "AMR hysteresis between codecs\nMS side\nBTS side\n"
3098
3099static void get_amr_from_arg(struct vty *vty, int argc, const char *argv[], int full)
3100{
3101 struct gsm_bts *bts = vty->index;
3102 struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half;
3103 struct gsm48_multi_rate_conf *mr_conf =
3104 (struct gsm48_multi_rate_conf *) mr->gsm48_ie;
3105 int i;
3106
3107 mr->gsm48_ie[1] = 0;
3108 for (i = 0; i < argc; i++)
3109 mr->gsm48_ie[1] |= 1 << atoi(argv[i]);
3110 mr_conf->icmi = 0;
3111}
3112
3113static void get_amr_th_from_arg(struct vty *vty, int argc, const char *argv[], int full)
3114{
3115 struct gsm_bts *bts = vty->index;
3116 struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half;
Holger Hans Peter Freythera174a472015-09-24 11:39:38 +02003117 struct amr_mode *modes;
Andreas Eversberg73266522014-01-19 11:47:44 +01003118 int i;
3119
Holger Hans Peter Freythera174a472015-09-24 11:39:38 +02003120 modes = argv[0][0]=='m' ? mr->ms_mode : mr->bts_mode;
3121 for (i = 0; i < argc - 1; i++)
3122 modes[i].threshold = atoi(argv[i + 1]);
Andreas Eversberg73266522014-01-19 11:47:44 +01003123}
3124
3125static void get_amr_hy_from_arg(struct vty *vty, int argc, const char *argv[], int full)
3126{
3127 struct gsm_bts *bts = vty->index;
3128 struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half;
Holger Hans Peter Freythera174a472015-09-24 11:39:38 +02003129 struct amr_mode *modes;
Andreas Eversberg73266522014-01-19 11:47:44 +01003130 int i;
3131
Holger Hans Peter Freythera174a472015-09-24 11:39:38 +02003132 modes = argv[0][0]=='m' ? mr->ms_mode : mr->bts_mode;
3133 for (i = 0; i < argc - 1; i++)
3134 modes[i].hysteresis = atoi(argv[i + 1]);
Andreas Eversberg73266522014-01-19 11:47:44 +01003135}
3136
3137static void get_amr_start_from_arg(struct vty *vty, const char *argv[], int full)
3138{
3139 struct gsm_bts *bts = vty->index;
3140 struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half;
3141 struct gsm48_multi_rate_conf *mr_conf =
3142 (struct gsm48_multi_rate_conf *) mr->gsm48_ie;
3143 int num = 0, i;
3144
3145 for (i = 0; i < ((full) ? 8 : 6); i++) {
3146 if ((mr->gsm48_ie[1] & (1 << i))) {
3147 num++;
3148 }
3149 }
3150
3151 if (argv[0][0] == 'a' || num == 0)
3152 mr_conf->icmi = 0;
3153 else {
3154 mr_conf->icmi = 1;
3155 if (num < atoi(argv[0]))
3156 mr_conf->smod = num - 1;
3157 else
3158 mr_conf->smod = atoi(argv[0]) - 1;
3159 }
3160}
3161
3162#define AMR_TCHF_PAR_STR " (0|1|2|3|4|5|6|7)"
3163#define AMR_TCHF_HELP_STR "4,75k\n5,15k\n5,90k\n6,70k\n7,40k\n7,95k\n" \
3164 "10,2k\n12,2k\n"
3165
3166#define AMR_TCHH_PAR_STR " (0|1|2|3|4|5)"
3167#define AMR_TCHH_HELP_STR "4,75k\n5,15k\n5,90k\n6,70k\n7,40k\n7,95k\n"
3168
3169#define AMR_TH_HELP_STR "Threshold between codec 1 and 2\n"
3170#define AMR_HY_HELP_STR "Hysteresis between codec 1 and 2\n"
3171
3172DEFUN(cfg_bts_amr_fr_modes1, cfg_bts_amr_fr_modes1_cmd,
3173 "amr tch-f modes" AMR_TCHF_PAR_STR,
3174 AMR_TEXT "Full Rate\n" AMR_MODE_TEXT
3175 AMR_TCHF_HELP_STR)
3176{
3177 get_amr_from_arg(vty, 1, argv, 1);
3178 return CMD_SUCCESS;
3179}
3180
3181DEFUN(cfg_bts_amr_fr_modes2, cfg_bts_amr_fr_modes2_cmd,
3182 "amr tch-f modes" AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR,
3183 AMR_TEXT "Full Rate\n" AMR_MODE_TEXT
3184 AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR)
3185{
3186 get_amr_from_arg(vty, 2, argv, 1);
3187 return CMD_SUCCESS;
3188}
3189
3190DEFUN(cfg_bts_amr_fr_modes3, cfg_bts_amr_fr_modes3_cmd,
3191 "amr tch-f modes" AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR,
3192 AMR_TEXT "Full Rate\n" AMR_MODE_TEXT
3193 AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR)
3194{
3195 get_amr_from_arg(vty, 3, argv, 1);
3196 return CMD_SUCCESS;
3197}
3198
3199DEFUN(cfg_bts_amr_fr_modes4, cfg_bts_amr_fr_modes4_cmd,
3200 "amr tch-f modes" AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR,
3201 AMR_TEXT "Full Rate\n" AMR_MODE_TEXT
3202 AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR)
3203{
3204 get_amr_from_arg(vty, 4, argv, 1);
3205 return CMD_SUCCESS;
3206}
3207
3208DEFUN(cfg_bts_amr_fr_start_mode, cfg_bts_amr_fr_start_mode_cmd,
3209 "amr tch-f start-mode (auto|1|2|3|4)",
3210 AMR_TEXT "Full Rate\n" AMR_START_TEXT)
3211{
3212 get_amr_start_from_arg(vty, argv, 1);
3213 return CMD_SUCCESS;
3214}
3215
3216DEFUN(cfg_bts_amr_fr_thres1, cfg_bts_amr_fr_thres1_cmd,
3217 "amr tch-f threshold (ms|bts) <0-63>",
3218 AMR_TEXT "Full Rate\n" AMR_TH_TEXT
3219 AMR_TH_HELP_STR)
3220{
3221 get_amr_th_from_arg(vty, 2, argv, 1);
3222 return CMD_SUCCESS;
3223}
3224
3225DEFUN(cfg_bts_amr_fr_thres2, cfg_bts_amr_fr_thres2_cmd,
3226 "amr tch-f threshold (ms|bts) <0-63> <0-63>",
3227 AMR_TEXT "Full Rate\n" AMR_TH_TEXT
3228 AMR_TH_HELP_STR AMR_TH_HELP_STR)
3229{
3230 get_amr_th_from_arg(vty, 3, argv, 1);
3231 return CMD_SUCCESS;
3232}
3233
3234DEFUN(cfg_bts_amr_fr_thres3, cfg_bts_amr_fr_thres3_cmd,
3235 "amr tch-f threshold (ms|bts) <0-63> <0-63> <0-63>",
3236 AMR_TEXT "Full Rate\n" AMR_TH_TEXT
3237 AMR_TH_HELP_STR AMR_TH_HELP_STR AMR_TH_HELP_STR)
3238{
3239 get_amr_th_from_arg(vty, 4, argv, 1);
3240 return CMD_SUCCESS;
3241}
3242
3243DEFUN(cfg_bts_amr_fr_hyst1, cfg_bts_amr_fr_hyst1_cmd,
3244 "amr tch-f hysteresis (ms|bts) <0-15>",
3245 AMR_TEXT "Full Rate\n" AMR_HY_TEXT
3246 AMR_HY_HELP_STR)
3247{
3248 get_amr_hy_from_arg(vty, 2, argv, 1);
3249 return CMD_SUCCESS;
3250}
3251
3252DEFUN(cfg_bts_amr_fr_hyst2, cfg_bts_amr_fr_hyst2_cmd,
3253 "amr tch-f hysteresis (ms|bts) <0-15> <0-15>",
3254 AMR_TEXT "Full Rate\n" AMR_HY_TEXT
3255 AMR_HY_HELP_STR AMR_HY_HELP_STR)
3256{
3257 get_amr_hy_from_arg(vty, 3, argv, 1);
3258 return CMD_SUCCESS;
3259}
3260
3261DEFUN(cfg_bts_amr_fr_hyst3, cfg_bts_amr_fr_hyst3_cmd,
3262 "amr tch-f hysteresis (ms|bts) <0-15> <0-15> <0-15>",
3263 AMR_TEXT "Full Rate\n" AMR_HY_TEXT
3264 AMR_HY_HELP_STR AMR_HY_HELP_STR AMR_HY_HELP_STR)
3265{
3266 get_amr_hy_from_arg(vty, 4, argv, 1);
3267 return CMD_SUCCESS;
3268}
3269
3270DEFUN(cfg_bts_amr_hr_modes1, cfg_bts_amr_hr_modes1_cmd,
3271 "amr tch-h modes" AMR_TCHH_PAR_STR,
3272 AMR_TEXT "Half Rate\n" AMR_MODE_TEXT
3273 AMR_TCHH_HELP_STR)
3274{
3275 get_amr_from_arg(vty, 1, argv, 0);
3276 return CMD_SUCCESS;
3277}
3278
3279DEFUN(cfg_bts_amr_hr_modes2, cfg_bts_amr_hr_modes2_cmd,
3280 "amr tch-h modes" AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR,
3281 AMR_TEXT "Half Rate\n" AMR_MODE_TEXT
3282 AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR)
3283{
3284 get_amr_from_arg(vty, 2, argv, 0);
3285 return CMD_SUCCESS;
3286}
3287
3288DEFUN(cfg_bts_amr_hr_modes3, cfg_bts_amr_hr_modes3_cmd,
3289 "amr tch-h modes" AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR,
3290 AMR_TEXT "Half Rate\n" AMR_MODE_TEXT
3291 AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR)
3292{
3293 get_amr_from_arg(vty, 3, argv, 0);
3294 return CMD_SUCCESS;
3295}
3296
3297DEFUN(cfg_bts_amr_hr_modes4, cfg_bts_amr_hr_modes4_cmd,
3298 "amr tch-h modes" AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR,
3299 AMR_TEXT "Half Rate\n" AMR_MODE_TEXT
3300 AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR)
3301{
3302 get_amr_from_arg(vty, 4, argv, 0);
3303 return CMD_SUCCESS;
3304}
3305
3306DEFUN(cfg_bts_amr_hr_start_mode, cfg_bts_amr_hr_start_mode_cmd,
3307 "amr tch-h start-mode (auto|1|2|3|4)",
3308 AMR_TEXT "Half Rate\n" AMR_START_TEXT)
3309{
3310 get_amr_start_from_arg(vty, argv, 0);
3311 return CMD_SUCCESS;
3312}
3313
3314DEFUN(cfg_bts_amr_hr_thres1, cfg_bts_amr_hr_thres1_cmd,
3315 "amr tch-h threshold (ms|bts) <0-63>",
3316 AMR_TEXT "Half Rate\n" AMR_TH_TEXT
3317 AMR_TH_HELP_STR)
3318{
3319 get_amr_th_from_arg(vty, 2, argv, 0);
3320 return CMD_SUCCESS;
3321}
3322
3323DEFUN(cfg_bts_amr_hr_thres2, cfg_bts_amr_hr_thres2_cmd,
3324 "amr tch-h threshold (ms|bts) <0-63> <0-63>",
3325 AMR_TEXT "Half Rate\n" AMR_TH_TEXT
3326 AMR_TH_HELP_STR AMR_TH_HELP_STR)
3327{
3328 get_amr_th_from_arg(vty, 3, argv, 0);
3329 return CMD_SUCCESS;
3330}
3331
3332DEFUN(cfg_bts_amr_hr_thres3, cfg_bts_amr_hr_thres3_cmd,
3333 "amr tch-h threshold (ms|bts) <0-63> <0-63> <0-63>",
3334 AMR_TEXT "Half Rate\n" AMR_TH_TEXT
3335 AMR_TH_HELP_STR AMR_TH_HELP_STR AMR_TH_HELP_STR)
3336{
3337 get_amr_th_from_arg(vty, 4, argv, 0);
3338 return CMD_SUCCESS;
3339}
3340
3341DEFUN(cfg_bts_amr_hr_hyst1, cfg_bts_amr_hr_hyst1_cmd,
3342 "amr tch-h hysteresis (ms|bts) <0-15>",
3343 AMR_TEXT "Half Rate\n" AMR_HY_TEXT
3344 AMR_HY_HELP_STR)
3345{
3346 get_amr_hy_from_arg(vty, 2, argv, 0);
3347 return CMD_SUCCESS;
3348}
3349
3350DEFUN(cfg_bts_amr_hr_hyst2, cfg_bts_amr_hr_hyst2_cmd,
3351 "amr tch-h hysteresis (ms|bts) <0-15> <0-15>",
3352 AMR_TEXT "Half Rate\n" AMR_HY_TEXT
3353 AMR_HY_HELP_STR AMR_HY_HELP_STR)
3354{
3355 get_amr_hy_from_arg(vty, 3, argv, 0);
3356 return CMD_SUCCESS;
3357}
3358
3359DEFUN(cfg_bts_amr_hr_hyst3, cfg_bts_amr_hr_hyst3_cmd,
3360 "amr tch-h hysteresis (ms|bts) <0-15> <0-15> <0-15>",
3361 AMR_TEXT "Half Rate\n" AMR_HY_TEXT
3362 AMR_HY_HELP_STR AMR_HY_HELP_STR AMR_HY_HELP_STR)
3363{
3364 get_amr_hy_from_arg(vty, 4, argv, 0);
3365 return CMD_SUCCESS;
3366}
3367
Harald Welte8f0ed552010-05-11 21:53:49 +02003368#define TRX_TEXT "Radio Transceiver\n"
Harald Welte7a8fa412009-08-10 13:48:16 +02003369
Harald Welte5258fc42009-03-28 19:07:53 +00003370/* per TRX configuration */
3371DEFUN(cfg_trx,
3372 cfg_trx_cmd,
Harald Welte57e07242012-08-17 12:50:14 +02003373 "trx <0-255>",
Harald Welte8f0ed552010-05-11 21:53:49 +02003374 TRX_TEXT
Harald Welte5258fc42009-03-28 19:07:53 +00003375 "Select a TRX to configure")
3376{
3377 int trx_nr = atoi(argv[0]);
3378 struct gsm_bts *bts = vty->index;
3379 struct gsm_bts_trx *trx;
3380
Harald Weltee441d9c2009-06-21 16:17:15 +02003381 if (trx_nr > bts->num_trx) {
3382 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
3383 bts->num_trx, VTY_NEWLINE);
Harald Welte5258fc42009-03-28 19:07:53 +00003384 return CMD_WARNING;
Harald Weltee441d9c2009-06-21 16:17:15 +02003385 } else if (trx_nr == bts->num_trx) {
3386 /* we need to allocate a new one */
3387 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02003388 } else
Harald Weltee441d9c2009-06-21 16:17:15 +02003389 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freytheracf8a0c2010-03-29 08:47:44 +02003390
Harald Weltee441d9c2009-06-21 16:17:15 +02003391 if (!trx)
3392 return CMD_WARNING;
Harald Welte5258fc42009-03-28 19:07:53 +00003393
3394 vty->index = trx;
Harald Welte197dea92010-05-14 17:59:53 +02003395 vty->index_sub = &trx->description;
Harald Welte5258fc42009-03-28 19:07:53 +00003396 vty->node = TRX_NODE;
3397
3398 return CMD_SUCCESS;
3399}
3400
3401DEFUN(cfg_trx_arfcn,
3402 cfg_trx_arfcn_cmd,
Harald Welte1fe73a12012-01-29 13:24:12 +01003403 "arfcn <0-1023>",
Harald Welte13fe2192012-08-17 09:57:25 +02003404 "Set the ARFCN for this TRX\n"
3405 "Absolute Radio Frequency Channel Number\n")
Harald Welte5258fc42009-03-28 19:07:53 +00003406{
3407 int arfcn = atoi(argv[0]);
3408 struct gsm_bts_trx *trx = vty->index;
3409
3410 /* FIXME: check if this ARFCN is supported by this TRX */
3411
3412 trx->arfcn = arfcn;
3413
3414 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
3415 /* FIXME: use OML layer to update the ARFCN */
3416 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
3417
3418 return CMD_SUCCESS;
3419}
3420
Harald Welte (local)7b37d972009-12-27 20:56:38 +01003421DEFUN(cfg_trx_nominal_power,
3422 cfg_trx_nominal_power_cmd,
3423 "nominal power <0-100>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02003424 "Nominal TRX RF Power in dBm\n"
3425 "Nominal TRX RF Power in dBm\n"
3426 "Nominal TRX RF Power in dBm\n")
Harald Welte (local)7b37d972009-12-27 20:56:38 +01003427{
3428 struct gsm_bts_trx *trx = vty->index;
3429
3430 trx->nominal_power = atoi(argv[0]);
3431
3432 return CMD_SUCCESS;
3433}
3434
Harald Weltefcd24452009-06-20 18:15:19 +02003435DEFUN(cfg_trx_max_power_red,
3436 cfg_trx_max_power_red_cmd,
3437 "max_power_red <0-100>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02003438 "Reduction of maximum BS RF Power (relative to nominal power)\n"
Harald Weltefcd24452009-06-20 18:15:19 +02003439 "Reduction of maximum BS RF Power in dB\n")
3440{
3441 int maxpwr_r = atoi(argv[0]);
3442 struct gsm_bts_trx *trx = vty->index;
Harald Welte61a83b22009-11-18 09:20:22 +01003443 int upper_limit = 24; /* default 12.21 max power red. */
Harald Weltefcd24452009-06-20 18:15:19 +02003444
3445 /* FIXME: check if our BTS type supports more than 12 */
3446 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
3447 vty_out(vty, "%% Power %d dB is not in the valid range%s",
3448 maxpwr_r, VTY_NEWLINE);
3449 return CMD_WARNING;
3450 }
3451 if (maxpwr_r & 1) {
3452 vty_out(vty, "%% Power %d dB is not an even value%s",
3453 maxpwr_r, VTY_NEWLINE);
3454 return CMD_WARNING;
3455 }
3456
3457 trx->max_power_red = maxpwr_r;
3458
3459 /* FIXME: make sure we update this using OML */
3460
3461 return CMD_SUCCESS;
3462}
3463
Harald Welte42581822009-08-08 16:12:58 +02003464DEFUN(cfg_trx_rsl_e1,
3465 cfg_trx_rsl_e1_cmd,
3466 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltecfaabbb2012-08-16 23:23:50 +02003467 "RSL Parameters\n"
3468 "E1/T1 interface to be used for RSL\n"
3469 "E1/T1 interface to be used for RSL\n"
3470 "E1/T1 Line Number to be used for RSL\n"
3471 "E1/T1 Timeslot to be used for RSL\n"
3472 "E1/T1 Timeslot to be used for RSL\n"
3473 "E1/T1 Sub-slot to be used for RSL\n"
3474 "E1/T1 Sub-slot 0 is to be used for RSL\n"
3475 "E1/T1 Sub-slot 1 is to be used for RSL\n"
3476 "E1/T1 Sub-slot 2 is to be used for RSL\n"
3477 "E1/T1 Sub-slot 3 is to be used for RSL\n"
3478 "E1/T1 full timeslot is to be used for RSL\n")
Harald Welte42581822009-08-08 16:12:58 +02003479{
3480 struct gsm_bts_trx *trx = vty->index;
3481
3482 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
3483
3484 return CMD_SUCCESS;
3485}
3486
3487DEFUN(cfg_trx_rsl_e1_tei,
3488 cfg_trx_rsl_e1_tei_cmd,
3489 "rsl e1 tei <0-63>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02003490 "RSL Parameters\n"
3491 "Set the TEI to be used for RSL\n"
3492 "Set the TEI to be used for RSL\n"
3493 "TEI to be used for RSL\n")
Harald Welte42581822009-08-08 16:12:58 +02003494{
3495 struct gsm_bts_trx *trx = vty->index;
3496
3497 trx->rsl_tei = atoi(argv[0]);
3498
3499 return CMD_SUCCESS;
3500}
3501
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01003502DEFUN(cfg_trx_rf_locked,
3503 cfg_trx_rf_locked_cmd,
3504 "rf_locked (0|1)",
Harald Weltecfaabbb2012-08-16 23:23:50 +02003505 "Set or unset the RF Locking (Turn off RF of the TRX)\n"
3506 "TRX is NOT RF locked (active)\n"
3507 "TRX is RF locked (turned off)\n")
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01003508{
3509 int locked = atoi(argv[0]);
3510 struct gsm_bts_trx *trx = vty->index;
3511
3512 gsm_trx_lock_rf(trx, locked);
3513 return CMD_SUCCESS;
3514}
Harald Welte42581822009-08-08 16:12:58 +02003515
Harald Welte5258fc42009-03-28 19:07:53 +00003516/* per TS configuration */
3517DEFUN(cfg_ts,
3518 cfg_ts_cmd,
Harald Welte42581822009-08-08 16:12:58 +02003519 "timeslot <0-7>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02003520 "Select a Timeslot to configure\n"
3521 "Timeslot number\n")
Harald Welte5258fc42009-03-28 19:07:53 +00003522{
3523 int ts_nr = atoi(argv[0]);
3524 struct gsm_bts_trx *trx = vty->index;
3525 struct gsm_bts_trx_ts *ts;
3526
3527 if (ts_nr >= TRX_NR_TS) {
3528 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
3529 TRX_NR_TS, VTY_NEWLINE);
3530 return CMD_WARNING;
3531 }
3532
3533 ts = &trx->ts[ts_nr];
3534
3535 vty->index = ts;
3536 vty->node = TS_NODE;
3537
3538 return CMD_SUCCESS;
3539}
3540
Harald Weltea6fd58e2009-08-07 00:25:23 +02003541DEFUN(cfg_ts_pchan,
3542 cfg_ts_pchan_cmd,
Harald Welte4ab9d7c2012-08-17 12:42:06 +02003543 "phys_chan_config PCHAN", /* dynamically generated! */
Holger Hans Peter Freyther63b0e442013-03-03 09:32:08 +01003544 "Physical Channel configuration (TCH/SDCCH/...)\n" "Physical Channel\n")
Harald Welte4ab9d7c2012-08-17 12:42:06 +02003545{
3546 struct gsm_bts_trx_ts *ts = vty->index;
3547 int pchanc;
3548
3549 pchanc = gsm_pchan_parse(argv[0]);
3550 if (pchanc < 0)
3551 return CMD_WARNING;
3552
3553 ts->pchan = pchanc;
3554
3555 return CMD_SUCCESS;
3556}
3557
3558/* used for backwards compatibility with old config files that still
3559 * have uppercase pchan type names */
3560DEFUN_HIDDEN(cfg_ts_pchan_compat,
3561 cfg_ts_pchan_compat_cmd,
Harald Weltea6fd58e2009-08-07 00:25:23 +02003562 "phys_chan_config PCHAN",
Holger Hans Peter Freyther63b0e442013-03-03 09:32:08 +01003563 "Physical Channel configuration (TCH/SDCCH/...)\n" "Physical Channel\n")
Harald Weltea6fd58e2009-08-07 00:25:23 +02003564{
3565 struct gsm_bts_trx_ts *ts = vty->index;
3566 int pchanc;
3567
3568 pchanc = gsm_pchan_parse(argv[0]);
3569 if (pchanc < 0)
3570 return CMD_WARNING;
3571
3572 ts->pchan = pchanc;
3573
3574 return CMD_SUCCESS;
3575}
3576
Harald Welte4ab9d7c2012-08-17 12:42:06 +02003577
3578
Harald Welte135a6482011-05-30 12:09:13 +02003579DEFUN(cfg_ts_tsc,
3580 cfg_ts_tsc_cmd,
3581 "training_sequence_code <0-7>",
Harald Weltecfaabbb2012-08-16 23:23:50 +02003582 "Training Sequence Code of the Timeslot\n" "TSC\n")
Harald Welte135a6482011-05-30 12:09:13 +02003583{
3584 struct gsm_bts_trx_ts *ts = vty->index;
3585
Harald Welte903aaea2014-01-19 17:10:50 +01003586 if (!gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_MULTI_TSC)) {
3587 vty_out(vty, "%% This BTS does not support a TSC != BCC, "
3588 "falling back to BCC%s", VTY_NEWLINE);
3589 ts->tsc = -1;
3590 return CMD_WARNING;
3591 }
3592
Harald Welte135a6482011-05-30 12:09:13 +02003593 ts->tsc = atoi(argv[0]);
3594
3595 return CMD_SUCCESS;
3596}
3597
Harald Weltea39b0f22010-06-14 22:26:10 +02003598#define HOPPING_STR "Configure frequency hopping\n"
3599
3600DEFUN(cfg_ts_hopping,
3601 cfg_ts_hopping_cmd,
3602 "hopping enabled (0|1)",
3603 HOPPING_STR "Enable or disable frequency hopping\n"
3604 "Disable frequency hopping\n" "Enable frequency hopping\n")
3605{
3606 struct gsm_bts_trx_ts *ts = vty->index;
Harald Weltec2fb3d02010-06-14 22:47:37 +02003607 int enabled = atoi(argv[0]);
Harald Weltea39b0f22010-06-14 22:26:10 +02003608
Harald Weltec2fb3d02010-06-14 22:47:37 +02003609 if (enabled && !gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_HOPPING)) {
3610 vty_out(vty, "BTS model does not support hopping%s",
3611 VTY_NEWLINE);
3612 return CMD_WARNING;
3613 }
3614
3615 ts->hopping.enabled = enabled;
Harald Weltea39b0f22010-06-14 22:26:10 +02003616
3617 return CMD_SUCCESS;
3618}
3619
Harald Welte6e0cd042009-09-12 13:05:33 +02003620DEFUN(cfg_ts_hsn,
3621 cfg_ts_hsn_cmd,
Harald Weltea39b0f22010-06-14 22:26:10 +02003622 "hopping sequence-number <0-63>",
3623 HOPPING_STR
Harald Weltecfaabbb2012-08-16 23:23:50 +02003624 "Which hopping sequence to use for this channel\n"
3625 "Hopping Sequence Number (HSN)\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02003626{
3627 struct gsm_bts_trx_ts *ts = vty->index;
3628
3629 ts->hopping.hsn = atoi(argv[0]);
3630
3631 return CMD_SUCCESS;
3632}
3633
3634DEFUN(cfg_ts_maio,
3635 cfg_ts_maio_cmd,
3636 "hopping maio <0-63>",
Harald Weltea39b0f22010-06-14 22:26:10 +02003637 HOPPING_STR
Harald Weltecfaabbb2012-08-16 23:23:50 +02003638 "Which hopping MAIO to use for this channel\n"
3639 "Mobile Allocation Index Offset (MAIO)\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02003640{
3641 struct gsm_bts_trx_ts *ts = vty->index;
3642
3643 ts->hopping.maio = atoi(argv[0]);
3644
3645 return CMD_SUCCESS;
3646}
3647
3648DEFUN(cfg_ts_arfcn_add,
3649 cfg_ts_arfcn_add_cmd,
3650 "hopping arfcn add <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02003651 HOPPING_STR "Configure hopping ARFCN list\n"
3652 "Add an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02003653{
3654 struct gsm_bts_trx_ts *ts = vty->index;
3655 int arfcn = atoi(argv[0]);
3656
Harald Weltea39b0f22010-06-14 22:26:10 +02003657 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1);
3658
Harald Welte6e0cd042009-09-12 13:05:33 +02003659 return CMD_SUCCESS;
3660}
3661
3662DEFUN(cfg_ts_arfcn_del,
3663 cfg_ts_arfcn_del_cmd,
3664 "hopping arfcn del <0-1023>",
Harald Weltea39b0f22010-06-14 22:26:10 +02003665 HOPPING_STR "Configure hopping ARFCN list\n"
3666 "Delete an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte6e0cd042009-09-12 13:05:33 +02003667{
3668 struct gsm_bts_trx_ts *ts = vty->index;
3669 int arfcn = atoi(argv[0]);
3670
Harald Weltea39b0f22010-06-14 22:26:10 +02003671 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0);
3672
Harald Welte6e0cd042009-09-12 13:05:33 +02003673 return CMD_SUCCESS;
3674}
3675
Harald Weltea6fd58e2009-08-07 00:25:23 +02003676DEFUN(cfg_ts_e1_subslot,
3677 cfg_ts_e1_subslot_cmd,
Harald Welte42581822009-08-08 16:12:58 +02003678 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltecfaabbb2012-08-16 23:23:50 +02003679 "E1/T1 channel connected to this on-air timeslot\n"
3680 "E1/T1 channel connected to this on-air timeslot\n"
3681 "E1/T1 line connected to this on-air timeslot\n"
Harald Welted13e0cd2012-08-17 09:52:03 +02003682 "E1/T1 timeslot connected to this on-air timeslot\n"
3683 "E1/T1 timeslot connected to this on-air timeslot\n"
Harald Weltecfaabbb2012-08-16 23:23:50 +02003684 "E1/T1 sub-slot connected to this on-air timeslot\n"
3685 "E1/T1 sub-slot 0 connected to this on-air timeslot\n"
3686 "E1/T1 sub-slot 1 connected to this on-air timeslot\n"
3687 "E1/T1 sub-slot 2 connected to this on-air timeslot\n"
3688 "E1/T1 sub-slot 3 connected to this on-air timeslot\n"
3689 "Full E1/T1 timeslot connected to this on-air timeslot\n")
Harald Weltea6fd58e2009-08-07 00:25:23 +02003690{
3691 struct gsm_bts_trx_ts *ts = vty->index;
3692
Harald Welte42581822009-08-08 16:12:58 +02003693 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Weltea6fd58e2009-08-07 00:25:23 +02003694
3695 return CMD_SUCCESS;
3696}
Harald Welte5258fc42009-03-28 19:07:53 +00003697
Harald Welte4f10c252010-05-16 21:47:13 +02003698void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
3699{
3700 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
Alexander Couzensb847a212016-08-02 11:34:11 +02003701 net->bsc_ctrs->ctr[BSC_CTR_CHREQ_TOTAL].current,
3702 net->bsc_ctrs->ctr[BSC_CTR_CHREQ_NO_CHANNEL].current,
Alexander Couzens20423ea2016-07-12 15:42:02 +02003703 VTY_NEWLINE);
Harald Welte4f10c252010-05-16 21:47:13 +02003704 vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
Alexander Couzensb847a212016-08-02 11:34:11 +02003705 net->bsc_ctrs->ctr[BSC_CTR_CHAN_RF_FAIL].current,
3706 net->bsc_ctrs->ctr[BSC_CTR_CHAN_RLL_ERR].current,
Alexander Couzens20423ea2016-07-12 15:42:02 +02003707 VTY_NEWLINE);
Harald Welte4f10c252010-05-16 21:47:13 +02003708 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
Alexander Couzensb847a212016-08-02 11:34:11 +02003709 net->bsc_ctrs->ctr[BSC_CTR_PAGING_ATTEMPTED].current,
3710 net->bsc_ctrs->ctr[BSC_CTR_PAGING_COMPLETED].current,
3711 net->bsc_ctrs->ctr[BSC_CTR_PAGING_EXPIRED].current,
Alexander Couzens20423ea2016-07-12 15:42:02 +02003712 VTY_NEWLINE);
Harald Welte4f10c252010-05-16 21:47:13 +02003713 vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
Alexander Couzensb847a212016-08-02 11:34:11 +02003714 net->bsc_ctrs->ctr[BSC_CTR_BTS_OML_FAIL].current,
3715 net->bsc_ctrs->ctr[BSC_CTR_BTS_RSL_FAIL].current,
Alexander Couzens20423ea2016-07-12 15:42:02 +02003716 VTY_NEWLINE);
Harald Welte4f10c252010-05-16 21:47:13 +02003717}
3718
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02003719DEFUN(drop_bts,
3720 drop_bts_cmd,
Holger Hans Peter Freyther0586b0f2010-04-11 12:46:45 +02003721 "drop bts connection <0-65535> (oml|rsl)",
Harald Weltecfaabbb2012-08-16 23:23:50 +02003722 "Debug/Simulation command to drop Abis/IP BTS\n"
3723 "Debug/Simulation command to drop Abis/IP BTS\n"
3724 "Debug/Simulation command to drop Abis/IP BTS\n"
3725 "BTS NR\n" "Drop OML Connection\n" "Drop RSL Connection\n")
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02003726{
3727 struct gsm_network *gsmnet;
3728 struct gsm_bts_trx *trx;
3729 struct gsm_bts *bts;
3730 unsigned int bts_nr;
3731
3732 gsmnet = gsmnet_from_vty(vty);
3733
3734 bts_nr = atoi(argv[0]);
3735 if (bts_nr >= gsmnet->num_bts) {
3736 vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s",
3737 gsmnet->num_bts, bts_nr, VTY_NEWLINE);
3738 return CMD_WARNING;
3739 }
3740
3741 bts = gsm_bts_num(gsmnet, bts_nr);
3742 if (!bts) {
3743 vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE);
3744 return CMD_WARNING;
3745 }
3746
3747 if (!is_ipaccess_bts(bts)) {
3748 vty_out(vty, "This command only works for ipaccess.%s", VTY_NEWLINE);
3749 return CMD_WARNING;
3750 }
3751
3752
3753 /* close all connections */
3754 if (strcmp(argv[1], "oml") == 0) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01003755 ipaccess_drop_oml(bts);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02003756 } else if (strcmp(argv[1], "rsl") == 0) {
3757 /* close all rsl connections */
3758 llist_for_each_entry(trx, &bts->trx_list, list) {
Holger Hans Peter Freytherdab8e272010-11-15 20:29:46 +01003759 ipaccess_drop_rsl(trx);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02003760 }
3761 } else {
3762 vty_out(vty, "Argument must be 'oml# or 'rsl'.%s", VTY_NEWLINE);
3763 return CMD_WARNING;
3764 }
3765
3766 return CMD_SUCCESS;
3767}
3768
Holger Hans Peter Freyther740e65f2016-03-16 13:45:23 +01003769DEFUN(restart_bts, restart_bts_cmd,
3770 "restart-bts <0-65535>",
3771 "Restart ip.access nanoBTS through OML\n"
3772 "BTS Number\n")
3773{
3774 struct gsm_network *gsmnet;
3775 struct gsm_bts_trx *trx;
3776 struct gsm_bts *bts;
3777 unsigned int bts_nr;
3778
3779 gsmnet = gsmnet_from_vty(vty);
3780
3781 bts_nr = atoi(argv[0]);
3782 if (bts_nr >= gsmnet->num_bts) {
3783 vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s",
3784 gsmnet->num_bts, bts_nr, VTY_NEWLINE);
3785 return CMD_WARNING;
3786 }
3787
3788 bts = gsm_bts_num(gsmnet, bts_nr);
3789 if (!bts) {
3790 vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE);
3791 return CMD_WARNING;
3792 }
3793
3794 if (!is_ipaccess_bts(bts) || is_sysmobts_v2(bts)) {
3795 vty_out(vty, "This command only works for ipaccess nanoBTS.%s",
3796 VTY_NEWLINE);
3797 return CMD_WARNING;
3798 }
3799
3800 /* go from last TRX to c0 */
3801 llist_for_each_entry_reverse(trx, &bts->trx_list, list)
3802 abis_nm_ipaccess_restart(trx);
3803
3804 return CMD_SUCCESS;
3805}
3806
Harald Welte30f1f372014-12-28 15:00:45 +01003807DEFUN(smscb_cmd, smscb_cmd_cmd,
3808 "bts <0-255> smscb-command <1-4> HEXSTRING",
3809 "BTS related commands\n" "BTS Number\n"
3810 "SMS Cell Broadcast\n" "Last Valid Block\n"
3811 "Hex Encoded SMSCB message (up to 88 octets)\n")
3812{
3813 struct gsm_bts *bts;
3814 int bts_nr = atoi(argv[0]);
3815 int last_block = atoi(argv[1]);
3816 struct rsl_ie_cb_cmd_type cb_cmd;
3817 uint8_t buf[88];
3818 int rc;
3819
Neels Hofmeyrb90eabf2016-05-11 18:48:39 +02003820 bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr);
Harald Welte30f1f372014-12-28 15:00:45 +01003821 if (!bts) {
3822 vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE);
3823 return CMD_WARNING;
3824 }
3825 rc = osmo_hexparse(argv[2], buf, sizeof(buf));
3826 if (rc < 0 || rc > sizeof(buf)) {
3827 vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
3828 return CMD_WARNING;
3829 }
3830
3831 cb_cmd.spare = 0;
3832 cb_cmd.def_bcast = 0;
3833 cb_cmd.command = RSL_CB_CMD_TYPE_NORMAL;
3834
3835 switch (last_block) {
3836 case 1:
3837 cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_1;
3838 break;
3839 case 2:
3840 cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_2;
3841 break;
3842 case 3:
3843 cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_3;
3844 break;
3845 case 4:
3846 cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_4;
3847 break;
3848 }
3849
3850 rsl_sms_cb_command(bts, RSL_CHAN_SDCCH4_ACCH, cb_cmd, buf, rc);
3851
3852 return CMD_SUCCESS;
3853}
3854
3855
Harald Welted0d2b0b2010-12-23 13:18:07 +01003856DEFUN(pdch_act, pdch_act_cmd,
3857 "bts <0-255> trx <0-255> timeslot <0-7> pdch (activate|deactivate)",
3858 "BTS related commands\n" "BTS Number\n" "Transceiver\n" "Transceiver Number\n"
3859 "TRX Timeslot\n" "Timeslot Number\n" "Packet Data Channel\n"
3860 "Activate Dynamic PDCH/TCH (-> PDCH mode)\n"
3861 "Deactivate Dynamic PDCH/TCH (-> TCH mode)\n")
3862{
3863 struct gsm_bts *bts;
3864 struct gsm_bts_trx *trx;
3865 struct gsm_bts_trx_ts *ts;
3866 int bts_nr = atoi(argv[0]);
3867 int trx_nr = atoi(argv[1]);
3868 int ts_nr = atoi(argv[2]);
3869 int activate;
3870
Neels Hofmeyrb90eabf2016-05-11 18:48:39 +02003871 bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr);
Harald Welted0d2b0b2010-12-23 13:18:07 +01003872 if (!bts) {
3873 vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE);
3874 return CMD_WARNING;
3875 }
3876
3877 if (!is_ipaccess_bts(bts)) {
3878 vty_out(vty, "%% This command only works for ipaccess BTS%s",
3879 VTY_NEWLINE);
3880 return CMD_WARNING;
3881 }
3882
3883 trx = gsm_bts_trx_num(bts, trx_nr);
3884 if (!trx) {
3885 vty_out(vty, "%% No such TRX (%d)%s", trx_nr, VTY_NEWLINE);
3886 return CMD_WARNING;
3887 }
3888
3889 ts = &trx->ts[ts_nr];
3890 if (ts->pchan != GSM_PCHAN_TCH_F_PDCH) {
3891 vty_out(vty, "%% Timeslot %u is not in dynamic TCH_F/PDCH "
3892 "mode%s", ts_nr, VTY_NEWLINE);
3893 return CMD_WARNING;
3894 }
3895
3896 if (!strcmp(argv[3], "activate"))
3897 activate = 1;
3898 else
3899 activate = 0;
3900
3901 rsl_ipacc_pdch_activate(ts, activate);
3902
3903 return CMD_SUCCESS;
3904
3905}
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02003906
Harald Weltedcccb182010-05-16 20:52:23 +02003907extern int bsc_vty_init_extra(void);
Holger Hans Peter Freythere1ffc082010-04-10 00:08:28 +02003908
Maxdb0e3802017-01-12 19:35:11 +01003909int bsc_vty_init(struct gsm_network *network)
Harald Welte68628e82009-03-10 12:17:57 +00003910{
Harald Welte4ab9d7c2012-08-17 12:42:06 +02003911 cfg_ts_pchan_cmd.string =
3912 vty_cmd_string_from_valstr(tall_bsc_ctx,
3913 gsm_pchant_names,
3914 "phys_chan_config (", "|", ")",
3915 VTY_DO_LOWER);
3916 cfg_ts_pchan_cmd.doc =
3917 vty_cmd_string_from_valstr(tall_bsc_ctx,
3918 gsm_pchant_descs,
3919 "Physical Channel Combination\n",
3920 "\n", "", 0);
3921
Harald Weltee555c2b2012-08-17 13:02:12 +02003922 cfg_bts_type_cmd.string =
3923 vty_cmd_string_from_valstr(tall_bsc_ctx,
3924 bts_type_names,
3925 "type (", "|", ")",
3926 VTY_DO_LOWER);
3927 cfg_bts_type_cmd.doc =
3928 vty_cmd_string_from_valstr(tall_bsc_ctx,
3929 bts_type_descs,
3930 "BTS Vendor/Type\n",
3931 "\n", "", 0);
3932
Neels Hofmeyr06d39fd2016-05-12 01:16:58 +02003933 common_cs_vty_init(network, config_write_net);
Harald Weltee555c2b2012-08-17 13:02:12 +02003934
Neels Hofmeyrea11bf82016-05-12 01:53:23 +02003935 install_element_ve(&bsc_show_net_cmd);
Harald Welteb4d5b172010-05-12 16:10:35 +00003936 install_element_ve(&show_bts_cmd);
3937 install_element_ve(&show_trx_cmd);
3938 install_element_ve(&show_ts_cmd);
3939 install_element_ve(&show_lchan_cmd);
Holger Hans Peter Freyther3d6a5d62010-05-14 02:08:49 +08003940 install_element_ve(&show_lchan_summary_cmd);
Harald Welte1bc77352009-03-10 19:47:51 +00003941
Harald Welteb4d5b172010-05-12 16:10:35 +00003942 install_element_ve(&show_paging_cmd);
Holger Hans Peter Freytherec37bb22013-02-05 09:39:09 +01003943 install_element_ve(&show_paging_group_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00003944
Maxdb0e3802017-01-12 19:35:11 +01003945 logging_vty_add_cmds(NULL);
Jacob Erlbeck64630cc2015-10-26 16:25:37 +01003946 osmo_stats_vty_add_cmds();
Holger Hans Peter Freytherb61e3b22009-12-22 22:32:51 +01003947
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +01003948 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Weltebc814502009-12-19 21:41:52 +01003949 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Welteb720bd32009-12-21 16:51:50 +01003950 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
3951 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
3952 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
3953 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
3954 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
3955 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +01003956 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01003957 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
3958 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
3959 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
3960 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
3961 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
3962 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
3963 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
3964 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
3965 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
Harald Weltec9f499f2010-12-23 22:53:50 +01003966 install_element(GSMNET_NODE, &cfg_net_T3122_cmd);
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +01003967 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +08003968 install_element(GSMNET_NODE, &cfg_net_dtx_cmd);
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +08003969 install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd);
Harald Welte5013b2a2009-08-07 13:29:14 +02003970
3971 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte67ce0732009-08-06 19:06:46 +02003972 install_node(&bts_node, config_write_bts);
Jacob Erlbeck36722e12013-10-29 09:30:30 +01003973 vty_install_default(BTS_NODE);
Harald Welte5258fc42009-03-28 19:07:53 +00003974 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02003975 install_element(BTS_NODE, &cfg_description_cmd);
3976 install_element(BTS_NODE, &cfg_no_description_cmd);
Harald Weltefcd24452009-06-20 18:15:19 +02003977 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +02003978 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Maxc08ee712016-05-11 12:45:13 +02003979 install_element(BTS_NODE, &cfg_bts_dtxu_cmd);
3980 install_element(BTS_NODE, &cfg_bts_dtxd_cmd);
3981 install_element(BTS_NODE, &cfg_bts_no_dtxu_cmd);
3982 install_element(BTS_NODE, &cfg_bts_no_dtxd_cmd);
Harald Welte5258fc42009-03-28 19:07:53 +00003983 install_element(BTS_NODE, &cfg_bts_lac_cmd);
3984 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte42581822009-08-08 16:12:58 +02003985 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte4cc34222009-05-01 15:12:31 +00003986 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte8b291802013-03-12 13:57:05 +01003987 install_element(BTS_NODE, &cfg_bts_rsl_ip_cmd);
Sylvain Munautc9519462011-10-17 14:04:55 +02003988 install_element(BTS_NODE, &cfg_bts_nokia_site_skip_reset_cmd);
Andreas Eversberg7d8fa342013-12-05 13:25:06 +01003989 install_element(BTS_NODE, &cfg_bts_nokia_site_no_loc_rel_cnf_cmd);
Sipos Csaba56e17662015-02-07 13:27:36 +01003990 install_element(BTS_NODE, &cfg_bts_nokia_site_bts_reset_timer_cnf_cmd);
Harald Welte8175e952009-10-20 00:22:00 +02003991 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte42581822009-08-08 16:12:58 +02003992 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
3993 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte7a8fa412009-08-10 13:48:16 +02003994 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut4010f1e2009-12-22 13:43:26 +01003995 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
3996 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Andreas Eversberg2ee7ecd2012-10-13 07:27:47 +02003997 install_element(BTS_NODE, &cfg_bts_chan_desc_att_cmd);
3998 install_element(BTS_NODE, &cfg_bts_chan_desc_bs_pa_mfrms_cmd);
3999 install_element(BTS_NODE, &cfg_bts_chan_desc_bs_ag_blks_res_cmd);
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +08004000 install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd);
4001 install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd);
Harald Welte (local)5dececf2009-08-12 13:28:23 +02004002 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Holger Hans Peter Freyther3a0a4632010-05-14 00:39:19 +08004003 install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd);
Ivan Kluchnikov67920592013-09-16 13:13:04 +04004004 install_element(BTS_NODE, &cfg_bts_rach_ac_class_cmd);
Harald Welte (local)0e451d02009-08-13 10:14:26 +02004005 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)efc92312009-08-14 23:09:25 +02004006 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Holger Hans Peter Freytherc63f6f12013-07-27 21:07:57 +02004007 install_element(BTS_NODE, &cfg_bts_no_per_loc_upd_cmd);
Harald Welte73225282009-12-12 18:17:25 +01004008 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
4009 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Sylvain Munaute0b06b02010-11-28 18:17:28 +01004010 install_element(BTS_NODE, &cfg_bts_cell_bar_qualify_cmd);
4011 install_element(BTS_NODE, &cfg_bts_cell_resel_ofs_cmd);
4012 install_element(BTS_NODE, &cfg_bts_temp_ofs_cmd);
4013 install_element(BTS_NODE, &cfg_bts_temp_ofs_inf_cmd);
4014 install_element(BTS_NODE, &cfg_bts_penalty_time_cmd);
4015 install_element(BTS_NODE, &cfg_bts_penalty_time_rsvd_cmd);
Andreas Eversberg4d4944a2013-03-10 11:49:35 +01004016 install_element(BTS_NODE, &cfg_bts_radio_link_timeout_cmd);
Harald Welte4511d892010-04-18 15:51:20 +02004017 install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
bhargava350533c2016-07-21 11:14:34 +05304018 install_element(BTS_NODE, &cfg_bts_gprs_11bit_rach_support_for_egprs_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02004019 install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08004020 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
Andreas Eversberg0c8f9ca2013-03-16 16:31:26 +01004021 install_element(BTS_NODE, &cfg_bts_gprs_net_ctrl_ord_cmd);
Max292ec582016-07-28 11:55:37 +02004022 install_element(BTS_NODE, &cfg_bts_gprs_ctrl_ack_cmd);
4023 install_element(BTS_NODE, &cfg_no_bts_gprs_ctrl_ack_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08004024 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Welte615e9562010-05-11 23:50:21 +02004025 install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
Harald Weltea5731cf2010-03-22 11:48:36 +08004026 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte97a282b2010-03-14 15:37:43 +08004027 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welteaf387632010-03-14 23:30:30 +08004028 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
4029 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
4030 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +08004031 install_element(BTS_NODE, &cfg_bts_pag_free_cmd);
Harald Welte9fbff4a2010-07-30 11:50:09 +02004032 install_element(BTS_NODE, &cfg_bts_si_mode_cmd);
4033 install_element(BTS_NODE, &cfg_bts_si_static_cmd);
Harald Welte42def722017-01-13 00:10:32 +01004034 install_element(BTS_NODE, &cfg_bts_early_cm_cmd);
Harald Welte32c09622011-01-11 23:44:56 +01004035 install_element(BTS_NODE, &cfg_bts_neigh_mode_cmd);
4036 install_element(BTS_NODE, &cfg_bts_neigh_cmd);
Harald Welte64c07d22011-02-15 11:43:27 +01004037 install_element(BTS_NODE, &cfg_bts_si5_neigh_cmd);
Max59a1bf32016-04-15 16:04:46 +02004038 install_element(BTS_NODE, &cfg_bts_si2quater_neigh_add_cmd);
4039 install_element(BTS_NODE, &cfg_bts_si2quater_neigh_del_cmd);
Max26679e02016-04-20 15:57:13 +02004040 install_element(BTS_NODE, &cfg_bts_si2quater_uarfcn_add_cmd);
4041 install_element(BTS_NODE, &cfg_bts_si2quater_uarfcn_del_cmd);
Holger Hans Peter Freythere30d40d2012-07-20 10:27:31 +02004042 install_element(BTS_NODE, &cfg_bts_excl_rf_lock_cmd);
4043 install_element(BTS_NODE, &cfg_bts_no_excl_rf_lock_cmd);
Jacob Erlbeck65d114f2014-01-16 11:02:14 +01004044 install_element(BTS_NODE, &cfg_bts_force_comb_si_cmd);
4045 install_element(BTS_NODE, &cfg_bts_no_force_comb_si_cmd);
Andreas Eversberga83d5112013-12-07 18:32:28 +01004046 install_element(BTS_NODE, &cfg_bts_codec0_cmd);
4047 install_element(BTS_NODE, &cfg_bts_codec1_cmd);
4048 install_element(BTS_NODE, &cfg_bts_codec2_cmd);
4049 install_element(BTS_NODE, &cfg_bts_codec3_cmd);
4050 install_element(BTS_NODE, &cfg_bts_codec4_cmd);
Holger Hans Peter Freytherc22930e2014-12-17 14:46:17 +01004051 install_element(BTS_NODE, &cfg_bts_depends_on_cmd);
4052 install_element(BTS_NODE, &cfg_bts_no_depends_on_cmd);
Andreas Eversberg73266522014-01-19 11:47:44 +01004053 install_element(BTS_NODE, &cfg_bts_amr_fr_modes1_cmd);
4054 install_element(BTS_NODE, &cfg_bts_amr_fr_modes2_cmd);
4055 install_element(BTS_NODE, &cfg_bts_amr_fr_modes3_cmd);
4056 install_element(BTS_NODE, &cfg_bts_amr_fr_modes4_cmd);
4057 install_element(BTS_NODE, &cfg_bts_amr_fr_thres1_cmd);
4058 install_element(BTS_NODE, &cfg_bts_amr_fr_thres2_cmd);
4059 install_element(BTS_NODE, &cfg_bts_amr_fr_thres3_cmd);
4060 install_element(BTS_NODE, &cfg_bts_amr_fr_hyst1_cmd);
4061 install_element(BTS_NODE, &cfg_bts_amr_fr_hyst2_cmd);
4062 install_element(BTS_NODE, &cfg_bts_amr_fr_hyst3_cmd);
4063 install_element(BTS_NODE, &cfg_bts_amr_fr_start_mode_cmd);
4064 install_element(BTS_NODE, &cfg_bts_amr_hr_modes1_cmd);
4065 install_element(BTS_NODE, &cfg_bts_amr_hr_modes2_cmd);
4066 install_element(BTS_NODE, &cfg_bts_amr_hr_modes3_cmd);
4067 install_element(BTS_NODE, &cfg_bts_amr_hr_modes4_cmd);
4068 install_element(BTS_NODE, &cfg_bts_amr_hr_thres1_cmd);
4069 install_element(BTS_NODE, &cfg_bts_amr_hr_thres2_cmd);
4070 install_element(BTS_NODE, &cfg_bts_amr_hr_thres3_cmd);
4071 install_element(BTS_NODE, &cfg_bts_amr_hr_hyst1_cmd);
4072 install_element(BTS_NODE, &cfg_bts_amr_hr_hyst2_cmd);
4073 install_element(BTS_NODE, &cfg_bts_amr_hr_hyst3_cmd);
4074 install_element(BTS_NODE, &cfg_bts_amr_hr_start_mode_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00004075
Harald Welte5258fc42009-03-28 19:07:53 +00004076 install_element(BTS_NODE, &cfg_trx_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00004077 install_node(&trx_node, dummy_config_write);
Jacob Erlbeck36722e12013-10-29 09:30:30 +01004078 vty_install_default(TRX_NODE);
Harald Welte5258fc42009-03-28 19:07:53 +00004079 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte197dea92010-05-14 17:59:53 +02004080 install_element(TRX_NODE, &cfg_description_cmd);
4081 install_element(TRX_NODE, &cfg_no_description_cmd);
Harald Welte (local)7b37d972009-12-27 20:56:38 +01004082 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte879dc972009-06-20 22:36:12 +02004083 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte42581822009-08-08 16:12:58 +02004084 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
4085 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +01004086 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00004087
Harald Welte5258fc42009-03-28 19:07:53 +00004088 install_element(TRX_NODE, &cfg_ts_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00004089 install_node(&ts_node, dummy_config_write);
Jacob Erlbeck36722e12013-10-29 09:30:30 +01004090 vty_install_default(TS_NODE);
Harald Weltea6fd58e2009-08-07 00:25:23 +02004091 install_element(TS_NODE, &cfg_ts_pchan_cmd);
Harald Welte4ab9d7c2012-08-17 12:42:06 +02004092 install_element(TS_NODE, &cfg_ts_pchan_compat_cmd);
Harald Welte135a6482011-05-30 12:09:13 +02004093 install_element(TS_NODE, &cfg_ts_tsc_cmd);
Harald Weltea39b0f22010-06-14 22:26:10 +02004094 install_element(TS_NODE, &cfg_ts_hopping_cmd);
Harald Welte6e0cd042009-09-12 13:05:33 +02004095 install_element(TS_NODE, &cfg_ts_hsn_cmd);
4096 install_element(TS_NODE, &cfg_ts_maio_cmd);
4097 install_element(TS_NODE, &cfg_ts_arfcn_add_cmd);
4098 install_element(TS_NODE, &cfg_ts_arfcn_del_cmd);
Harald Weltea6fd58e2009-08-07 00:25:23 +02004099 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte68628e82009-03-10 12:17:57 +00004100
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02004101 install_element(ENABLE_NODE, &drop_bts_cmd);
Holger Hans Peter Freyther740e65f2016-03-16 13:45:23 +01004102 install_element(ENABLE_NODE, &restart_bts_cmd);
Harald Welted0d2b0b2010-12-23 13:18:07 +01004103 install_element(ENABLE_NODE, &pdch_act_cmd);
Harald Welte30f1f372014-12-28 15:00:45 +01004104 install_element(ENABLE_NODE, &smscb_cmd_cmd);
Holger Hans Peter Freyther2484ceb2010-10-26 09:40:13 +02004105
Harald Welte81c9b9c2010-05-31 16:40:40 +02004106 abis_nm_vty_init();
Harald Weltee1d5eca2011-02-12 14:42:59 +01004107 abis_om2k_vty_init();
Harald Welte3016d9f2011-02-05 13:54:41 +01004108 e1inp_vty_init();
Harald Welte42def722017-01-13 00:10:32 +01004109 osmo_fsm_vty_add_cmds();
Harald Welte81c9b9c2010-05-31 16:40:40 +02004110
Harald Weltedcccb182010-05-16 20:52:23 +02004111 bsc_vty_init_extra();
Harald Welte40f82892009-05-23 17:31:39 +00004112
Harald Welte68628e82009-03-10 12:17:57 +00004113 return 0;
4114}