blob: 0a55cf4cf7a39eb49d67a494f4a894898f8fd7cc [file] [log] [blame]
Harald Welte59b04682009-06-10 05:40:52 +08001/* OpenBSC interface to quagga VTY */
Harald Welte410575a2010-03-14 23:30:30 +08002/* (C) 2009-2010 by Harald Welte <laforge@gnumonks.org>
Harald Welte59b04682009-06-10 05:40:52 +08003 * All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
Harald Welte0e3e88e2011-01-01 15:25:50 +01006 * it under the terms of the GNU Affero General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
Harald Welte59b04682009-06-10 05:40:52 +08008 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Harald Welte0e3e88e2011-01-01 15:25:50 +010013 * GNU Affero General Public License for more details.
Harald Welte59b04682009-06-10 05:40:52 +080014 *
Harald Welte0e3e88e2011-01-01 15:25:50 +010015 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
Harald Welte59b04682009-06-10 05:40:52 +080017 *
18 */
19
20#include <stdlib.h>
Max3d94aca2016-05-11 12:45:13 +020021#include <stdbool.h>
Harald Welte59b04682009-06-10 05:40:52 +080022#include <unistd.h>
Harald Welte59b04682009-06-10 05:40:52 +080023
Harald Weltebd9591f2010-05-19 19:45:32 +020024#include <osmocom/vty/command.h>
25#include <osmocom/vty/buffer.h>
26#include <osmocom/vty/vty.h>
27#include <osmocom/vty/logging.h>
Jacob Erlbeck63fac682015-10-26 16:25:37 +010028#include <osmocom/vty/stats.h>
Harald Weltebd9591f2010-05-19 19:45:32 +020029#include <osmocom/vty/telnet_interface.h>
Harald Welte2addf852012-08-17 12:42:06 +020030#include <osmocom/vty/misc.h>
Max3d94aca2016-05-11 12:45:13 +020031#include <osmocom/gsm/protocol/gsm_04_08.h>
Holger Hans Peter Freyther35e6fbb2013-02-05 09:39:09 +010032#include <osmocom/gsm/gsm0502.h>
33
Harald Welte59b04682009-06-10 05:40:52 +080034#include <arpa/inet.h>
35
Pablo Neira Ayusodd5fff42011-03-22 16:47:59 +010036#include <osmocom/core/linuxlist.h>
Harald Welte59b04682009-06-10 05:40:52 +080037#include <openbsc/gsm_data.h>
Pablo Neira Ayuso42e41df2011-08-17 22:44:07 +020038#include <osmocom/abis/e1_input.h>
Harald Welte59b04682009-06-10 05:40:52 +080039#include <openbsc/abis_nm.h>
Harald Welte30f93fb2011-02-19 16:48:17 +010040#include <openbsc/abis_om2000.h>
Pablo Neira Ayusodd5fff42011-03-22 16:47:59 +010041#include <osmocom/core/utils.h>
42#include <osmocom/gsm/gsm_utils.h>
Harald Welte73e69942011-05-23 20:42:26 +020043#include <osmocom/gsm/abis_nm.h>
Harald Weltefe96f382009-12-22 13:09:29 +010044#include <openbsc/chan_alloc.h>
Harald Welte44007742009-12-22 21:43:14 +010045#include <openbsc/meas_rep.h>
Harald Welte59b04682009-06-10 05:40:52 +080046#include <openbsc/db.h>
Holger Hans Peter Freytherb70d45b2010-04-06 11:55:37 +020047#include <openbsc/vty.h>
Harald Weltecfb6b282012-06-16 14:59:56 +080048#include <osmocom/gprs/gprs_ns.h>
Harald Welted8acf142010-07-30 11:50:09 +020049#include <openbsc/system_information.h>
Harald Welte682ee5f2010-05-16 22:02:16 +020050#include <openbsc/debug.h>
Holger Hans Peter Freyther25176f12010-11-09 17:00:42 +010051#include <openbsc/paging.h>
Harald Welte64fcd772011-08-20 18:25:02 +020052#include <openbsc/ipaccess.h>
Harald Welte5213e992010-12-23 13:18:07 +010053#include <openbsc/abis_rsl.h>
Neels Hofmeyr38639352017-02-23 21:49:55 +010054#include <openbsc/bsc_msc_data.h>
Holger Hans Peter Freytherd0146922011-02-24 14:19:14 +010055#include <openbsc/osmo_bsc_rf.h>
Harald Welte59b04682009-06-10 05:40:52 +080056
Neels Hofmeyrbfe27272016-05-12 01:16:58 +020057#include <openbsc/common_cs.h>
58
Holger Hans Peter Freyther35e6fbb2013-02-05 09:39:09 +010059#include <inttypes.h>
60
Harald Welted9dea592011-03-04 13:53:51 +010061#include "../../bscconfig.h"
Harald Welte10c29f62010-05-16 19:20:24 +020062
Holger Hans Peter Freythere8127042011-10-03 23:42:06 +020063
Holger Hans Peter Freythere8127042011-10-03 23:42:06 +020064#define LCHAN_NR_STR "Logical Channel Number\n"
65
66
Harald Welted6b62e32010-05-12 17:19:53 +000067/* FIXME: this should go to some common file */
68static const struct value_string gprs_ns_timer_strs[] = {
Harald Weltea9251762010-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 Welted6b62e32010-05-12 17:19:53 +000079static const struct value_string gprs_bssgp_cfg_strs[] = {
Harald Weltea9251762010-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 Weltef989b782011-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 Willmann2c9540c2012-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 Welte59b04682009-06-10 05:40:52 +0800108struct cmd_node bts_node = {
109 BTS_NODE,
Harald Welte45362bb2012-08-17 13:16:10 +0200110 "%s(config-net-bts)# ",
Harald Welte59b04682009-06-10 05:40:52 +0800111 1,
112};
113
114struct cmd_node trx_node = {
115 TRX_NODE,
Harald Welte45362bb2012-08-17 13:16:10 +0200116 "%s(config-net-bts-trx)# ",
Harald Welte59b04682009-06-10 05:40:52 +0800117 1,
118};
119
120struct cmd_node ts_node = {
121 TS_NODE,
Harald Welte45362bb2012-08-17 13:16:10 +0200122 "%s(config-net-bts-trx-ts)# ",
Harald Welte59b04682009-06-10 05:40:52 +0800123 1,
124};
125
Harald Welte59b04682009-06-10 05:40:52 +0800126static 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 Weltee7b751c2013-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 Welte306a8892011-05-23 20:30:39 +0200136 abis_nm_avail_name(nms->availability), VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800137}
138
Harald Weltefe96f382009-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 Welte59b04682009-06-10 05:40:52 +0800159static void net_dump_vty(struct vty *vty, struct gsm_network *net)
160{
Harald Weltefe96f382009-12-22 13:09:29 +0100161 struct pchan_load pl;
162
Harald Welte59b04682009-06-10 05:40:52 +0800163 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);
166 vty_out(vty, " Long network name: '%s'%s",
167 net->name_long, VTY_NEWLINE);
168 vty_out(vty, " Short network name: '%s'%s",
169 net->name_short, VTY_NEWLINE);
Max0a378ba2016-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);
Max58726412016-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 Welte59936d72009-11-18 20:33:19 +0100179 vty_out(vty, " Location updating reject cause: %u%s",
180 net->reject_cause, VTY_NEWLINE);
Harald Weltecca253a2009-08-30 15:47:06 +0900181 vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption,
182 VTY_NEWLINE);
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +0100183 vty_out(vty, " NECI (TCH/H): %u%s", net->neci,
184 VTY_NEWLINE);
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +0800185 vty_out(vty, " Use TCH for Paging any: %d%s", net->pag_any_tch,
186 VTY_NEWLINE);
Harald Welte52af1952009-12-13 10:53:12 +0100187 vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode),
188 VTY_NEWLINE);
Harald Weltea310f3e2009-12-14 09:00:24 +0100189 vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off",
190 VTY_NEWLINE);
Harald Welte0af9c9f2009-12-19 21:41:52 +0100191 vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off",
192 VTY_NEWLINE);
Harald Weltefe96f382009-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 Freytherd0146922011-02-24 14:19:14 +0100196
197 /* show rf */
Holger Hans Peter Freytherab25ee42014-02-08 12:12:03 +0100198 if (net->bsc_data)
Holger Hans Peter Freytherd0146922011-02-24 14:19:14 +0100199 vty_out(vty, " Last RF Command: %s%s",
Holger Hans Peter Freyther4d614172011-08-15 15:53:00 +0200200 net->bsc_data->rf_ctrl->last_state_command,
Holger Hans Peter Freytherd0146922011-02-24 14:19:14 +0100201 VTY_NEWLINE);
Holger Hans Peter Freytherab25ee42014-02-08 12:12:03 +0100202 if (net->bsc_data)
Jacob Erlbeckdcce8e82013-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 Welte59b04682009-06-10 05:40:52 +0800206}
207
Neels Hofmeyrd416b482016-05-12 01:53:23 +0200208DEFUN(bsc_show_net, bsc_show_net_cmd, "show network",
Harald Welte59b04682009-06-10 05:40:52 +0800209 SHOW_STR "Display information about a GSM NETWORK\n")
210{
Harald Welte40152872010-05-16 20:52:23 +0200211 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800212 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{
219 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,
230 e1inp_signtype_name(e1l->type), VTY_NEWLINE);
231 vty_out(vty, " E1 TEI %u, SAPI %u%s",
232 e1l->tei, e1l->sapi, VTY_NEWLINE);
233}
234
235static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
236{
Harald Weltefe96f382009-12-22 13:09:29 +0100237 struct pchan_load pl;
238
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +0200239 vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
Harald Welte4d4a2a22015-11-20 10:50:24 +0100240 "BSIC %u (NCC=%u, BCC=%u) and %u TRX%s",
Harald Welte91afe4c2009-06-20 18:15:19 +0200241 bts->nr, btstype2str(bts->type), gsm_band_name(bts->band),
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +0200242 bts->cell_identity,
Harald Welte7bb55f32015-11-20 10:43:31 +0100243 bts->location_area_code, bts->bsic,
Harald Welte4d4a2a22015-11-20 10:50:24 +0100244 bts->bsic >> 3, bts->bsic & 7,
Harald Welte91afe4c2009-06-20 18:15:19 +0200245 bts->num_trx, VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200246 vty_out(vty, "Description: %s%s",
247 bts->description ? bts->description : "(null)", VTY_NEWLINE);
Harald Welte8e9d1792009-12-12 15:38:16 +0100248 vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100249 vty_out(vty, "Minimum Rx Level for Access: %i dBm%s",
Harald Welte8e9d1792009-12-12 15:38:16 +0100250 rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min),
251 VTY_NEWLINE);
252 vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s",
Harald Welteb761bf82009-12-12 18:17:25 +0100253 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +0100254 vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer,
255 VTY_NEWLINE);
256 vty_out(vty, "RACH Max transmissions: %u%s",
257 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
258 VTY_NEWLINE);
Harald Welte8c973ba2009-12-21 23:08:18 +0100259 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)e19be3f2009-08-12 13:28:23 +0200260 vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE);
Max3d94aca2016-05-11 12:45:13 +0200261 if (bts->dtxu != GSM48_DTX_SHALL_NOT_BE_USED)
262 vty_out(vty, "Uplink DTX: %s%s",
263 (bts->dtxu != GSM48_DTX_SHALL_BE_USED) ?
264 "enabled" : "forced", VTY_NEWLINE);
265 else
266 vty_out(vty, "Uplink DTX: not enabled%s", VTY_NEWLINE);
267 vty_out(vty, "Downlink DTX: %senabled%s", bts->dtxd ? "" : "not ",
268 VTY_NEWLINE);
Andreas Eversberg14e12f22012-10-13 07:27:47 +0200269 vty_out(vty, "Channel Description Attachment: %s%s",
270 (bts->si_common.chan_desc.att) ? "yes" : "no", VTY_NEWLINE);
271 vty_out(vty, "Channel Description BS-PA-MFRMS: %u%s",
272 bts->si_common.chan_desc.bs_pa_mfrms + 2, VTY_NEWLINE);
273 vty_out(vty, "Channel Description BS-AG_BLKS-RES: %u%s",
274 bts->si_common.chan_desc.bs_ag_blks_res, VTY_NEWLINE);
Harald Welted8acf142010-07-30 11:50:09 +0200275 vty_out(vty, "System Information present: 0x%08x, static: 0x%08x%s",
276 bts->si_valid, bts->si_mode_static, VTY_NEWLINE);
Harald Welte44ccb0d2017-01-13 00:10:32 +0100277 vty_out(vty, "Early Classmark Sending: %s%s",
278 bts->early_classmark_allowed ? "allowed" : "forbidden",
279 VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800280 if (is_ipaccess_bts(bts))
Harald Welte25572872009-10-20 00:22:00 +0200281 vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s",
Harald Welte59b04682009-06-10 05:40:52 +0800282 bts->ip_access.site_id, bts->ip_access.bts_id,
Harald Welte25572872009-10-20 00:22:00 +0200283 bts->oml_tei, VTY_NEWLINE);
Sylvain Munautcb8e8432011-10-17 14:04:55 +0200284 else if (bts->type == GSM_BTS_TYPE_NOKIA_SITE)
285 vty_out(vty, " Skip Reset: %d%s",
286 bts->nokia.skip_reset, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800287 vty_out(vty, " NM State: ");
Harald Welte69f6f812011-05-30 12:07:53 +0200288 net_dump_nmstate(vty, &bts->mo.nm_state);
Harald Welte59b04682009-06-10 05:40:52 +0800289 vty_out(vty, " Site Mgr NM State: ");
Harald Welte69f6f812011-05-30 12:07:53 +0200290 net_dump_nmstate(vty, &bts->site_mgr.mo.nm_state);
Holger Hans Peter Freyther03d80af2013-05-29 16:22:09 +0200291 vty_out(vty, " GPRS NSE: ");
292 net_dump_nmstate(vty, &bts->gprs.nse.mo.nm_state);
293 vty_out(vty, " GPRS CELL: ");
294 net_dump_nmstate(vty, &bts->gprs.cell.mo.nm_state);
295 vty_out(vty, " GPRS NSVC0: ");
296 net_dump_nmstate(vty, &bts->gprs.nsvc[0].mo.nm_state);
297 vty_out(vty, " GPRS NSVC1: ");
298 net_dump_nmstate(vty, &bts->gprs.nsvc[1].mo.nm_state);
Holger Hans Peter Freyther914ff192011-04-26 15:52:34 +0200299 vty_out(vty, " Paging: %u pending requests, %u free slots%s",
300 paging_pending_requests_nr(bts),
Harald Welte59b04682009-06-10 05:40:52 +0800301 bts->paging.available_slots, VTY_NEWLINE);
Holger Hans Peter Freytherb5c79c92010-11-25 16:28:45 +0100302 if (is_ipaccess_bts(bts)) {
303 vty_out(vty, " OML Link state: %s.%s",
304 bts->oml_link ? "connected" : "disconnected", VTY_NEWLINE);
305 } else {
Harald Welte25572872009-10-20 00:22:00 +0200306 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
307 e1isl_dump_vty(vty, bts->oml_link);
308 }
Holger Hans Peter Freytherb5c79c92010-11-25 16:28:45 +0100309
310 /* FIXME: chan_desc */
Harald Weltefe96f382009-12-22 13:09:29 +0100311 memset(&pl, 0, sizeof(pl));
Neels Hofmeyr7c0b45b2016-09-25 17:01:20 +0200312 bts_chan_load(&pl, bts);
Harald Weltefe96f382009-12-22 13:09:29 +0100313 vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
314 dump_pchan_load_vty(vty, " ", &pl);
Harald Welte59b04682009-06-10 05:40:52 +0800315}
316
Sylvain Munaut1ad96282012-12-28 12:15:11 +0100317DEFUN(show_bts, show_bts_cmd, "show bts [<0-255>]",
Harald Welte59b04682009-06-10 05:40:52 +0800318 SHOW_STR "Display information about a BTS\n"
319 "BTS number")
320{
Harald Welte40152872010-05-16 20:52:23 +0200321 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800322 int bts_nr;
323
324 if (argc != 0) {
325 /* use the BTS number that the user has specified */
326 bts_nr = atoi(argv[0]);
Harald Welteda5db862010-12-24 12:24:03 +0100327 if (bts_nr >= net->num_bts) {
Harald Welte59b04682009-06-10 05:40:52 +0800328 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
329 VTY_NEWLINE);
330 return CMD_WARNING;
331 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200332 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte59b04682009-06-10 05:40:52 +0800333 return CMD_SUCCESS;
334 }
335 /* print all BTS's */
336 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
Harald Weltee712a5f2009-06-21 16:17:15 +0200337 bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
Harald Welte59b04682009-06-10 05:40:52 +0800338
339 return CMD_SUCCESS;
340}
341
Harald Welte62868882009-08-08 16:12:58 +0200342/* utility functions */
343static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
344 const char *ts, const char *ss)
345{
346 e1_link->e1_nr = atoi(line);
347 e1_link->e1_ts = atoi(ts);
348 if (!strcmp(ss, "full"))
349 e1_link->e1_ts_ss = 255;
350 else
351 e1_link->e1_ts_ss = atoi(ss);
352}
353
354static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,
355 const char *prefix)
356{
357 if (!e1_link->e1_ts)
358 return;
359
360 if (e1_link->e1_ts_ss == 255)
361 vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s",
362 prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE);
363 else
364 vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s",
365 prefix, e1_link->e1_nr, e1_link->e1_ts,
366 e1_link->e1_ts_ss, VTY_NEWLINE);
367}
368
369
Harald Welte97ceef92009-08-06 19:06:46 +0200370static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
371{
Neels Hofmeyr0aec2f92016-01-27 14:20:29 +0100372 vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
Harald Welte7bb55f32015-11-20 10:43:31 +0100373 if (ts->tsc != -1)
Neels Hofmeyr0aec2f92016-01-27 14:20:29 +0100374 vty_out(vty, " training_sequence_code %u%s", ts->tsc, VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200375 if (ts->pchan != GSM_PCHAN_NONE)
Neels Hofmeyr0aec2f92016-01-27 14:20:29 +0100376 vty_out(vty, " phys_chan_config %s%s",
Harald Welte62868882009-08-08 16:12:58 +0200377 gsm_pchan_name(ts->pchan), VTY_NEWLINE);
Neels Hofmeyr0aec2f92016-01-27 14:20:29 +0100378 vty_out(vty, " hopping enabled %u%s",
Harald Weltea42a93f2010-06-14 22:26:10 +0200379 ts->hopping.enabled, VTY_NEWLINE);
380 if (ts->hopping.enabled) {
381 unsigned int i;
Neels Hofmeyr0aec2f92016-01-27 14:20:29 +0100382 vty_out(vty, " hopping sequence-number %u%s",
Harald Welte67104d12009-09-12 13:05:33 +0200383 ts->hopping.hsn, VTY_NEWLINE);
Neels Hofmeyr0aec2f92016-01-27 14:20:29 +0100384 vty_out(vty, " hopping maio %u%s",
Harald Welte67104d12009-09-12 13:05:33 +0200385 ts->hopping.maio, VTY_NEWLINE);
Harald Weltea42a93f2010-06-14 22:26:10 +0200386 for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) {
387 if (!bitvec_get_bit_pos(&ts->hopping.arfcns, i))
388 continue;
Neels Hofmeyr0aec2f92016-01-27 14:20:29 +0100389 vty_out(vty, " hopping arfcn add %u%s",
Harald Weltea42a93f2010-06-14 22:26:10 +0200390 i, VTY_NEWLINE);
391 }
Harald Welteff598092010-12-24 12:07:07 +0100392 }
Neels Hofmeyr0aec2f92016-01-27 14:20:29 +0100393 config_write_e1_link(vty, &ts->e1_link, " ");
Harald Weltec02789e2011-02-14 16:15:21 +0100394
395 if (ts->trx->bts->model->config_write_ts)
396 ts->trx->bts->model->config_write_ts(vty, ts);
Harald Welte97ceef92009-08-06 19:06:46 +0200397}
398
399static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
400{
401 int i;
402
Harald Weltee87eb462009-08-07 13:29:14 +0200403 vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200404 if (trx->description)
405 vty_out(vty, " description %s%s", trx->description,
406 VTY_NEWLINE);
Holger Hans Peter Freyther32be2aa2010-04-17 06:42:07 +0200407 vty_out(vty, " rf_locked %u%s",
Harald Welte69f6f812011-05-30 12:07:53 +0200408 trx->mo.nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
Holger Hans Peter Freyther32be2aa2010-04-17 06:42:07 +0200409 VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200410 vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
Harald Welte (local)b709bfe2009-12-27 20:56:38 +0100411 vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200412 vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200413 config_write_e1_link(vty, &trx->rsl_e1_link, " rsl ");
414 vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE);
Harald Welte97ceef92009-08-06 19:06:46 +0200415
Harald Weltec02789e2011-02-14 16:15:21 +0100416 if (trx->bts->model->config_write_trx)
417 trx->bts->model->config_write_trx(vty, trx);
418
Harald Welte97ceef92009-08-06 19:06:46 +0200419 for (i = 0; i < TRX_NR_TS; i++)
420 config_write_ts_single(vty, &trx->ts[i]);
421}
422
Harald Weltea9251762010-05-11 23:50:21 +0200423static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
424{
425 unsigned int i;
426 vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode),
427 VTY_NEWLINE);
428 if (bts->gprs.mode == BTS_GPRS_NONE)
429 return;
430
bhargava612722c2016-07-21 11:14:34 +0530431 vty_out(vty, " gprs 11bit_rach_support_for_egprs %u%s",
432 bts->gprs.supports_egprs_11bit_rach, VTY_NEWLINE);
433
Harald Weltea9251762010-05-11 23:50:21 +0200434 vty_out(vty, " gprs routing area %u%s", bts->gprs.rac,
435 VTY_NEWLINE);
Andreas Eversberga4fa21c2013-03-16 16:31:26 +0100436 vty_out(vty, " gprs network-control-order nc%u%s",
437 bts->gprs.net_ctrl_ord, VTY_NEWLINE);
Max88bdcd42016-07-28 11:55:37 +0200438 if (!bts->gprs.ctrl_ack_type_use_block)
439 vty_out(vty, " gprs control-ack-type-rach%s", VTY_NEWLINE);
Harald Weltea9251762010-05-11 23:50:21 +0200440 vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
441 VTY_NEWLINE);
442 for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++)
443 vty_out(vty, " gprs cell timer %s %u%s",
444 get_value_string(gprs_bssgp_cfg_strs, i),
445 bts->gprs.cell.timer[i], VTY_NEWLINE);
446 vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei,
447 VTY_NEWLINE);
448 for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++)
449 vty_out(vty, " gprs ns timer %s %u%s",
450 get_value_string(gprs_ns_timer_strs, i),
451 bts->gprs.nse.timer[i], VTY_NEWLINE);
452 for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
453 struct gsm_bts_gprs_nsvc *nsvc =
454 &bts->gprs.nsvc[i];
455 struct in_addr ia;
456
457 ia.s_addr = htonl(nsvc->remote_ip);
458 vty_out(vty, " gprs nsvc %u nsvci %u%s", i,
459 nsvc->nsvci, VTY_NEWLINE);
460 vty_out(vty, " gprs nsvc %u local udp port %u%s", i,
461 nsvc->local_port, VTY_NEWLINE);
462 vty_out(vty, " gprs nsvc %u remote udp port %u%s", i,
463 nsvc->remote_port, VTY_NEWLINE);
464 vty_out(vty, " gprs nsvc %u remote ip %s%s", i,
465 inet_ntoa(ia), VTY_NEWLINE);
466 }
467}
468
Holger Hans Peter Freyther38c56672013-09-15 17:23:34 +0200469/* Write the model data if there is one */
470static void config_write_bts_model(struct vty *vty, struct gsm_bts *bts)
Harald Welte97ceef92009-08-06 19:06:46 +0200471{
472 struct gsm_bts_trx *trx;
Holger Hans Peter Freyther38c56672013-09-15 17:23:34 +0200473
474 if (!bts->model)
475 return;
476
477 if (bts->model->config_write_bts)
478 bts->model->config_write_bts(vty, bts);
479
480 llist_for_each_entry(trx, &bts->trx_list, list)
481 config_write_trx_single(vty, trx);
482}
483
Holger Hans Peter Freyther8083cc92015-09-24 11:39:38 +0200484static void write_amr_modes(struct vty *vty, const char *prefix,
485 const char *name, struct amr_mode *modes, int num)
486{
487 int i;
488
489 vty_out(vty, " %s threshold %s", prefix, name);
490 for (i = 0; i < num - 1; i++)
491 vty_out(vty, " %d", modes[i].threshold);
492 vty_out(vty, "%s", VTY_NEWLINE);
493 vty_out(vty, " %s hysteresis %s", prefix, name);
494 for (i = 0; i < num - 1; i++)
495 vty_out(vty, " %d", modes[i].hysteresis);
496 vty_out(vty, "%s", VTY_NEWLINE);
497}
498
Andreas Eversbergfa163e82014-01-19 11:47:44 +0100499static void config_write_bts_amr(struct vty *vty, struct gsm_bts *bts,
500 struct amr_multirate_conf *mr, int full)
501{
502 struct gsm48_multi_rate_conf *mr_conf;
503 const char *prefix = (full) ? "amr tch-f" : "amr tch-h";
504 int i, num;
505
506 if (!(mr->gsm48_ie[1]))
507 return;
508
509 mr_conf = (struct gsm48_multi_rate_conf *) mr->gsm48_ie;
510
511 num = 0;
512 vty_out(vty, " %s modes", prefix);
513 for (i = 0; i < ((full) ? 8 : 6); i++) {
514 if ((mr->gsm48_ie[1] & (1 << i))) {
515 vty_out(vty, " %d", i);
516 num++;
517 }
518 }
519 vty_out(vty, "%s", VTY_NEWLINE);
520 if (num > 4)
521 num = 4;
522 if (num > 1) {
Holger Hans Peter Freyther8083cc92015-09-24 11:39:38 +0200523 write_amr_modes(vty, prefix, "ms", mr->ms_mode, num);
524 write_amr_modes(vty, prefix, "bts", mr->bts_mode, num);
Andreas Eversbergfa163e82014-01-19 11:47:44 +0100525 }
526 vty_out(vty, " %s start-mode ", prefix);
527 if (mr_conf->icmi) {
528 num = 0;
529 for (i = 0; i < ((full) ? 8 : 6) && num < 4; i++) {
530 if ((mr->gsm48_ie[1] & (1 << i)))
531 num++;
532 if (mr_conf->smod == num - 1) {
533 vty_out(vty, "%d%s", num, VTY_NEWLINE);
534 break;
535 }
536 }
537 } else
538 vty_out(vty, "auto%s", VTY_NEWLINE);
539}
540
Holger Hans Peter Freyther38c56672013-09-15 17:23:34 +0200541static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
542{
Harald Welted8acf142010-07-30 11:50:09 +0200543 int i;
Maxeee605b2017-02-15 13:51:37 +0100544 uint8_t tmp;
Harald Welte97ceef92009-08-06 19:06:46 +0200545
Harald Weltee87eb462009-08-07 13:29:14 +0200546 vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE);
547 vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200548 if (bts->description)
549 vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200550 vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE);
Holger Hans Peter Freyther6d82b7c2009-11-19 16:38:49 +0100551 vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200552 vty_out(vty, " location_area_code %u%s", bts->location_area_code,
Harald Welte97ceef92009-08-06 19:06:46 +0200553 VTY_NEWLINE);
Max3d94aca2016-05-11 12:45:13 +0200554 if (bts->dtxu != GSM48_DTX_SHALL_NOT_BE_USED)
555 vty_out(vty, " dtx uplink%s%s",
556 (bts->dtxu != GSM48_DTX_SHALL_BE_USED) ? "" : " force",
557 VTY_NEWLINE);
558 if (bts->dtxd)
559 vty_out(vty, " dtx downlink%s", VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200560 vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
Harald Welte (local)cbd46102009-08-13 10:14:26 +0200561 vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +0100562 vty_out(vty, " cell reselection hysteresis %u%s",
563 bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
564 vty_out(vty, " rxlev access min %u%s",
565 bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE);
Sylvain Munaut00d71462010-11-28 18:17:28 +0100566
567 if (bts->si_common.cell_ro_sel_par.present) {
568 struct gsm48_si_selection_params *sp;
569 sp = &bts->si_common.cell_ro_sel_par;
570
571 if (sp->cbq)
572 vty_out(vty, " cell bar qualify %u%s",
573 sp->cbq, VTY_NEWLINE);
574
575 if (sp->cell_resel_off)
576 vty_out(vty, " cell reselection offset %u%s",
577 sp->cell_resel_off*2, VTY_NEWLINE);
578
579 if (sp->temp_offs == 7)
580 vty_out(vty, " temporary offset infinite%s",
581 VTY_NEWLINE);
582 else if (sp->temp_offs)
583 vty_out(vty, " temporary offset %u%s",
584 sp->temp_offs*10, VTY_NEWLINE);
585
586 if (sp->penalty_time == 31)
587 vty_out(vty, " penalty time reserved%s",
588 VTY_NEWLINE);
589 else if (sp->penalty_time)
590 vty_out(vty, " penalty time %u%s",
591 (sp->penalty_time*20)+20, VTY_NEWLINE);
592 }
593
Holger Hans Peter Freyther2fb8ebf2013-07-27 21:07:57 +0200594 /* Is periodic LU enabled or disabled? */
595 if (bts->si_common.chan_desc.t3212 == 0)
596 vty_out(vty, " no periodic location update%s", VTY_NEWLINE);
597 else
598 vty_out(vty, " periodic location update %u%s",
599 bts->si_common.chan_desc.t3212 * 6, VTY_NEWLINE);
600
Andreas Eversbergf9248d92013-03-10 11:49:35 +0100601 vty_out(vty, " radio-link-timeout %d%s",
602 get_radio_link_timeout(&bts->si_common.cell_options),
603 VTY_NEWLINE);
Harald Welte3e774612009-08-10 13:48:16 +0200604 vty_out(vty, " channel allocator %s%s",
605 bts->chan_alloc_reverse ? "descending" : "ascending",
606 VTY_NEWLINE);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +0100607 vty_out(vty, " rach tx integer %u%s",
608 bts->si_common.rach_control.tx_integer, VTY_NEWLINE);
609 vty_out(vty, " rach max transmission %u%s",
610 rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
611 VTY_NEWLINE);
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +0800612
Andreas Eversberg14e12f22012-10-13 07:27:47 +0200613 vty_out(vty, " channel-descrption attach %u%s",
614 bts->si_common.chan_desc.att, VTY_NEWLINE);
615 vty_out(vty, " channel-descrption bs-pa-mfrms %u%s",
616 bts->si_common.chan_desc.bs_pa_mfrms + 2, VTY_NEWLINE);
617 vty_out(vty, " channel-descrption bs-ag-blks-res %u%s",
618 bts->si_common.chan_desc.bs_ag_blks_res, VTY_NEWLINE);
619
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +0800620 if (bts->rach_b_thresh != -1)
621 vty_out(vty, " rach nm busy threshold %u%s",
622 bts->rach_b_thresh, VTY_NEWLINE);
623 if (bts->rach_ldavg_slots != -1)
624 vty_out(vty, " rach nm load average %u%s",
625 bts->rach_ldavg_slots, VTY_NEWLINE);
Harald Welte8c973ba2009-12-21 23:08:18 +0100626 if (bts->si_common.rach_control.cell_bar)
Harald Welte (local)e19be3f2009-08-12 13:28:23 +0200627 vty_out(vty, " cell barred 1%s", VTY_NEWLINE);
Holger Hans Peter Freyther440984b2010-05-14 00:39:19 +0800628 if ((bts->si_common.rach_control.t2 & 0x4) == 0)
629 vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE);
Ivan Kluchnikov80d58432013-09-16 13:13:04 +0400630 if ((bts->si_common.rach_control.t3) != 0)
631 for (i = 0; i < 8; i++)
632 if (bts->si_common.rach_control.t3 & (0x1 << i))
633 vty_out(vty, " rach access-control-class %d barred%s", i, VTY_NEWLINE);
634 if ((bts->si_common.rach_control.t2 & 0xfb) != 0)
635 for (i = 0; i < 8; i++)
636 if ((i != 2) && (bts->si_common.rach_control.t2 & (0x1 << i)))
637 vty_out(vty, " rach access-control-class %d barred%s", i+8, VTY_NEWLINE);
Harald Welted8acf142010-07-30 11:50:09 +0200638 for (i = SYSINFO_TYPE_1; i < _MAX_SYSINFO_TYPE; i++) {
639 if (bts->si_mode_static & (1 << i)) {
640 vty_out(vty, " system-information %s mode static%s",
641 get_value_string(osmo_sitype_strs, i), VTY_NEWLINE);
642 vty_out(vty, " system-information %s static %s%s",
643 get_value_string(osmo_sitype_strs, i),
Sylvain Munaut79eae142011-11-13 23:05:23 +0100644 osmo_hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])),
Harald Welted8acf142010-07-30 11:50:09 +0200645 VTY_NEWLINE);
646 }
647 }
Harald Welte44ccb0d2017-01-13 00:10:32 +0100648 vty_out(vty, " early-classmark-sending %s%s",
649 bts->early_classmark_allowed ? "allowed" : "forbidden", VTY_NEWLINE);
Harald Welte08011e22011-03-04 13:41:31 +0100650 switch (bts->type) {
651 case GSM_BTS_TYPE_NANOBTS:
Harald Welte35ac0e42012-07-02 19:51:55 +0200652 case GSM_BTS_TYPE_OSMO_SYSMO:
Harald Weltee87eb462009-08-07 13:29:14 +0200653 vty_out(vty, " ip.access unit_id %u %u%s",
Harald Welte3ffe1b32009-08-07 00:25:23 +0200654 bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
Harald Welte8b3c5952013-03-12 13:57:05 +0100655 if (bts->ip_access.rsl_ip) {
656 struct in_addr ia;
657 ia.s_addr = htonl(bts->ip_access.rsl_ip);
658 vty_out(vty, " ip.access rsl-ip %s%s", inet_ntoa(ia),
659 VTY_NEWLINE);
660 }
Pablo Neira Ayuso42e41df2011-08-17 22:44:07 +0200661 vty_out(vty, " oml ip.access stream_id %u line %u%s",
662 bts->oml_tei, bts->oml_e1_link.e1_nr, VTY_NEWLINE);
Harald Welte08011e22011-03-04 13:41:31 +0100663 break;
Sylvain Munautcb8e8432011-10-17 14:04:55 +0200664 case GSM_BTS_TYPE_NOKIA_SITE:
665 vty_out(vty, " nokia_site skip-reset %d%s", bts->nokia.skip_reset, VTY_NEWLINE);
Andreas Eversbergac27b952013-12-05 13:25:06 +0100666 vty_out(vty, " nokia_site no-local-rel-conf %d%s",
667 bts->nokia.no_loc_rel_cnf, VTY_NEWLINE);
Sipos Csabadef87b42015-02-07 13:27:36 +0100668 vty_out(vty, " nokia_site bts-reset-timer %d%s", bts->nokia.bts_reset_timer_cnf, VTY_NEWLINE);
Andreas Eversbergc3daa0f2013-12-05 16:02:37 +0100669 /* fall through: Nokia requires "oml e1" parameters also */
Harald Welte08011e22011-03-04 13:41:31 +0100670 default:
Harald Welte62868882009-08-08 16:12:58 +0200671 config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
672 vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
Harald Welte08011e22011-03-04 13:41:31 +0100673 break;
Harald Welte62868882009-08-08 16:12:58 +0200674 }
Holger Hans Peter Freyther3112f672010-09-06 10:11:25 +0800675
676 /* if we have a limit, write it */
677 if (bts->paging.free_chans_need >= 0)
678 vty_out(vty, " paging free %d%s", bts->paging.free_chans_need, VTY_NEWLINE);
679
Harald Welteca46eff2011-01-11 23:44:56 +0100680 vty_out(vty, " neighbor-list mode %s%s",
Harald Weltef989b782011-02-15 11:43:27 +0100681 get_value_string(bts_neigh_mode_strs, bts->neigh_list_manual_mode), VTY_NEWLINE);
682 if (bts->neigh_list_manual_mode != NL_MODE_AUTOMATIC) {
Harald Welteca46eff2011-01-11 23:44:56 +0100683 for (i = 0; i < 1024; i++) {
684 if (bitvec_get_bit_pos(&bts->si_common.neigh_list, i))
685 vty_out(vty, " neighbor-list add arfcn %u%s",
686 i, VTY_NEWLINE);
687 }
688 }
Harald Weltef989b782011-02-15 11:43:27 +0100689 if (bts->neigh_list_manual_mode == NL_MODE_MANUAL_SI5SEP) {
690 for (i = 0; i < 1024; i++) {
691 if (bitvec_get_bit_pos(&bts->si_common.si5_neigh_list, i))
692 vty_out(vty, " si5 neighbor-list add arfcn %u%s",
693 i, VTY_NEWLINE);
694 }
695 }
Harald Welteca46eff2011-01-11 23:44:56 +0100696
Max88ddcaa2016-04-15 16:04:46 +0200697 for (i = 0; i < MAX_EARFCN_LIST; i++) {
Maxeee605b2017-02-15 13:51:37 +0100698 struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list;
699 if (e->arfcn[i] != OSMO_EARFCN_INVALID) {
700 vty_out(vty, " si2quater neighbor-list add earfcn %u "
701 "thresh-hi %u", e->arfcn[i], e->thresh_hi);
702
703 vty_out(vty, " thresh-lo %u",
704 e->thresh_lo_valid ? e->thresh_lo : 32);
705
706 vty_out(vty, " prio %u",
707 e->prio_valid ? e->prio : 8);
708
709 vty_out(vty, " qrxlv %u",
710 e->qrxlm_valid ? e->qrxlm : 32);
711
712 tmp = e->meas_bw[i];
713 vty_out(vty, " meas %u",
714 (tmp != OSMO_EARFCN_MEAS_INVALID) ? tmp : 8);
Max88ddcaa2016-04-15 16:04:46 +0200715
716 vty_out(vty, "%s", VTY_NEWLINE);
717 }
718 }
719
Maxeaf196c2016-04-20 15:57:13 +0200720 for (i = 0; i < bts->si_common.uarfcn_length; i++) {
721 vty_out(vty, " si2quater neighbor-list add uarfcn %u %u %u%s",
722 bts->si_common.data.uarfcn_list[i],
723 bts->si_common.data.scramble_list[i] & ~(1 << 9),
724 (bts->si_common.data.scramble_list[i] >> 9) & 1,
725 VTY_NEWLINE);
726 }
727
Andreas Eversberg976493b2013-12-07 18:32:28 +0100728 vty_out(vty, " codec-support fr");
729 if (bts->codec.hr)
730 vty_out(vty, " hr");
731 if (bts->codec.efr)
732 vty_out(vty, " efr");
733 if (bts->codec.amr)
734 vty_out(vty, " amr");
735 vty_out(vty, "%s", VTY_NEWLINE);
736
Andreas Eversbergfa163e82014-01-19 11:47:44 +0100737 config_write_bts_amr(vty, bts, &bts->mr_full, 1);
738 config_write_bts_amr(vty, bts, &bts->mr_half, 0);
739
Harald Weltea9251762010-05-11 23:50:21 +0200740 config_write_bts_gprs(vty, bts);
Harald Welte97ceef92009-08-06 19:06:46 +0200741
Holger Hans Peter Freyther10799162012-07-20 10:27:31 +0200742 if (bts->excl_from_rf_lock)
743 vty_out(vty, " rf-lock-exclude%s", VTY_NEWLINE);
744
Jacob Erlbeck8f8e5bf2014-01-16 11:02:14 +0100745 vty_out(vty, " %sforce-combined-si%s",
746 bts->force_combined_si ? "" : "no ", VTY_NEWLINE);
747
Holger Hans Peter Freyther15152612014-12-17 14:46:17 +0100748 for (i = 0; i < ARRAY_SIZE(bts->depends_on); ++i) {
749 int j;
750
751 if (bts->depends_on[i] == 0)
752 continue;
753
754 for (j = 0; j < sizeof(bts->depends_on[i]) * 8; ++j) {
755 int bts_nr;
756
757 if ((bts->depends_on[i] & (1<<j)) == 0)
758 continue;
759
760 bts_nr = (i * sizeof(bts->depends_on[i]) * 8) + j;
761 vty_out(vty, " depends-on-bts %d%s", bts_nr, VTY_NEWLINE);
762 }
763 }
764
Holger Hans Peter Freyther38c56672013-09-15 17:23:34 +0200765 config_write_bts_model(vty, bts);
Harald Welte97ceef92009-08-06 19:06:46 +0200766}
767
768static int config_write_bts(struct vty *v)
769{
Harald Welte40152872010-05-16 20:52:23 +0200770 struct gsm_network *gsmnet = gsmnet_from_vty(v);
Harald Welte97ceef92009-08-06 19:06:46 +0200771 struct gsm_bts *bts;
772
773 llist_for_each_entry(bts, &gsmnet->bts_list, list)
774 config_write_bts_single(v, bts);
775
776 return CMD_SUCCESS;
777}
778
Harald Weltee87eb462009-08-07 13:29:14 +0200779static int config_write_net(struct vty *vty)
780{
Harald Welte40152872010-05-16 20:52:23 +0200781 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
782
Harald Weltee87eb462009-08-07 13:29:14 +0200783 vty_out(vty, "network%s", VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200784 vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE);
Harald Weltee87eb462009-08-07 13:29:14 +0200785 vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE);
Harald Welte62868882009-08-08 16:12:58 +0200786 vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
787 vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
Harald Welte (local)a59a27e2009-08-12 14:42:23 +0200788 vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
Max0a378ba2016-05-24 14:23:27 +0200789 if (gsmnet->authorized_reg_str)
790 vty_out(vty, " authorized-regexp %s%s", gsmnet->authorized_reg_str, VTY_NEWLINE);
Harald Welte59936d72009-11-18 20:33:19 +0100791 vty_out(vty, " location updating reject cause %u%s",
792 gsmnet->reject_cause, VTY_NEWLINE);
Harald Weltecca253a2009-08-30 15:47:06 +0900793 vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE);
Holger Hans Peter Freyther6b4f5462009-11-19 16:37:48 +0100794 vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE);
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +0800795 vty_out(vty, " paging any use tch %d%s", gsmnet->pag_any_tch, VTY_NEWLINE);
Harald Welte52af1952009-12-13 10:53:12 +0100796 vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
797 VTY_NEWLINE);
Harald Weltea310f3e2009-12-14 09:00:24 +0100798 vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
Harald Welte0af9c9f2009-12-19 21:41:52 +0100799 vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
Harald Weltea8062f12009-12-21 16:51:50 +0100800 vty_out(vty, " handover window rxlev averaging %u%s",
801 gsmnet->handover.win_rxlev_avg, VTY_NEWLINE);
802 vty_out(vty, " handover window rxqual averaging %u%s",
803 gsmnet->handover.win_rxqual_avg, VTY_NEWLINE);
804 vty_out(vty, " handover window rxlev neighbor averaging %u%s",
805 gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE);
806 vty_out(vty, " handover power budget interval %u%s",
807 gsmnet->handover.pwr_interval, VTY_NEWLINE);
808 vty_out(vty, " handover power budget hysteresis %u%s",
809 gsmnet->handover.pwr_hysteresis, VTY_NEWLINE);
810 vty_out(vty, " handover maximum distance %u%s",
811 gsmnet->handover.max_distance, VTY_NEWLINE);
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +0100812 vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +0100813 vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
814 vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
815 vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE);
816 vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE);
817 vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE);
818 vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE);
819 vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE);
820 vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE);
821 vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE);
Harald Weltea00fdd72010-12-23 14:39:29 +0100822 vty_out(vty, " timer t3122 %u%s", gsmnet->T3122, VTY_NEWLINE);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +0100823 vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE);
Holger Hans Peter Freyther68b21e12010-12-22 16:26:04 +0100824 vty_out(vty, " subscriber-keep-in-ram %d%s",
Jacob Erlbeckda8770b2014-12-03 09:28:24 +0100825 gsmnet->subscr_group->keep_subscr, VTY_NEWLINE);
Neels Hofmeyr21edaef2016-05-10 13:29:33 +0200826 if (gsmnet->tz.override != 0) {
827 if (gsmnet->tz.dst)
828 vty_out(vty, " timezone %d %d %d%s",
829 gsmnet->tz.hr, gsmnet->tz.mn, gsmnet->tz.dst,
830 VTY_NEWLINE);
831 else
832 vty_out(vty, " timezone %d %d%s",
833 gsmnet->tz.hr, gsmnet->tz.mn, VTY_NEWLINE);
834 }
Harald Weltee87eb462009-08-07 13:29:14 +0200835
836 return CMD_SUCCESS;
837}
Harald Welte97ceef92009-08-06 19:06:46 +0200838
Harald Welte59b04682009-06-10 05:40:52 +0800839static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
840{
841 vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
842 trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
Harald Welte8791dac2010-05-14 17:59:53 +0200843 vty_out(vty, "Description: %s%s",
844 trx->description ? trx->description : "(null)", VTY_NEWLINE);
Harald Welte91afe4c2009-06-20 18:15:19 +0200845 vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, "
Harald Welte62868882009-08-08 16:12:58 +0200846 "resulting BS power: %d dBm%s",
Harald Welte91afe4c2009-06-20 18:15:19 +0200847 trx->nominal_power, trx->max_power_red,
Harald Welte62868882009-08-08 16:12:58 +0200848 trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800849 vty_out(vty, " NM State: ");
Harald Welte69f6f812011-05-30 12:07:53 +0200850 net_dump_nmstate(vty, &trx->mo.nm_state);
Harald Welte59b04682009-06-10 05:40:52 +0800851 vty_out(vty, " Baseband Transceiver NM State: ");
Harald Welte69f6f812011-05-30 12:07:53 +0200852 net_dump_nmstate(vty, &trx->bb_transc.mo.nm_state);
Harald Welte25572872009-10-20 00:22:00 +0200853 if (is_ipaccess_bts(trx->bts)) {
854 vty_out(vty, " ip.access stream ID: 0x%02x%s",
855 trx->rsl_tei, VTY_NEWLINE);
856 } else {
857 vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
858 e1isl_dump_vty(vty, trx->rsl_link);
859 }
Harald Welte59b04682009-06-10 05:40:52 +0800860}
861
862DEFUN(show_trx,
863 show_trx_cmd,
Sylvain Munaut1ad96282012-12-28 12:15:11 +0100864 "show trx [<0-255>] [<0-255>]",
Harald Welte9e002452010-05-11 21:53:49 +0200865 SHOW_STR "Display information about a TRX\n"
866 "BTS Number\n"
867 "TRX Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800868{
Harald Welte40152872010-05-16 20:52:23 +0200869 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +0800870 struct gsm_bts *bts = NULL;
871 struct gsm_bts_trx *trx;
872 int bts_nr, trx_nr;
873
874 if (argc >= 1) {
875 /* use the BTS number that the user has specified */
876 bts_nr = atoi(argv[0]);
877 if (bts_nr >= net->num_bts) {
878 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
879 VTY_NEWLINE);
880 return CMD_WARNING;
881 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200882 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800883 }
884 if (argc >= 2) {
885 trx_nr = atoi(argv[1]);
886 if (trx_nr >= bts->num_trx) {
887 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
888 VTY_NEWLINE);
889 return CMD_WARNING;
890 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200891 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800892 trx_dump_vty(vty, trx);
893 return CMD_SUCCESS;
894 }
895 if (bts) {
896 /* print all TRX in this BTS */
897 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200898 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800899 trx_dump_vty(vty, trx);
900 }
901 return CMD_SUCCESS;
902 }
903
904 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200905 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800906 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200907 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800908 trx_dump_vty(vty, trx);
909 }
910 }
911
912 return CMD_SUCCESS;
913}
914
Harald Welte97ceef92009-08-06 19:06:46 +0200915
Harald Welte59b04682009-06-10 05:40:52 +0800916static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
917{
Harald Welte85771a42011-05-30 12:09:13 +0200918 vty_out(vty, "BTS %u, TRX %u, Timeslot %u, phys cfg %s, TSC %u",
Harald Weltee3bd0c02010-12-24 12:12:10 +0100919 ts->trx->bts->nr, ts->trx->nr, ts->nr,
Harald Welte025e6c92014-01-19 17:18:21 +0100920 gsm_pchan_name(ts->pchan), gsm_ts_tsc(ts));
Harald Welte98d2bb82010-12-24 12:14:52 +0100921 if (ts->pchan == GSM_PCHAN_TCH_F_PDCH)
Harald Welte81c2ed32010-12-24 12:26:13 +0100922 vty_out(vty, " (%s mode)",
Neels Hofmeyr5a3c23c2016-06-14 14:08:35 +0200923 ts->flags & TS_F_PDCH_ACTIVE ? "PDCH" : "TCH/F");
Harald Welte98d2bb82010-12-24 12:14:52 +0100924 vty_out(vty, "%s", VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800925 vty_out(vty, " NM State: ");
Harald Welte69f6f812011-05-30 12:07:53 +0200926 net_dump_nmstate(vty, &ts->mo.nm_state);
Harald Welte87504212009-12-02 01:56:49 +0530927 if (!is_ipaccess_bts(ts->trx->bts))
Harald Welte59b04682009-06-10 05:40:52 +0800928 vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
929 ts->e1_link.e1_nr, ts->e1_link.e1_ts,
930 ts->e1_link.e1_ts_ss, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +0800931}
932
933DEFUN(show_ts,
934 show_ts_cmd,
Sylvain Munaut1ad96282012-12-28 12:15:11 +0100935 "show timeslot [<0-255>] [<0-255>] [<0-7>]",
Harald Welte9e002452010-05-11 21:53:49 +0200936 SHOW_STR "Display information about a TS\n"
937 "BTS Number\n" "TRX Number\n" "Timeslot Number\n")
Harald Welte59b04682009-06-10 05:40:52 +0800938{
Harald Welte40152872010-05-16 20:52:23 +0200939 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte06868382010-12-24 12:05:03 +0100940 struct gsm_bts *bts = NULL;
941 struct gsm_bts_trx *trx = NULL;
942 struct gsm_bts_trx_ts *ts = NULL;
Harald Welte59b04682009-06-10 05:40:52 +0800943 int bts_nr, trx_nr, ts_nr;
944
945 if (argc >= 1) {
946 /* use the BTS number that the user has specified */
947 bts_nr = atoi(argv[0]);
948 if (bts_nr >= net->num_bts) {
949 vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
950 VTY_NEWLINE);
951 return CMD_WARNING;
952 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200953 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800954 }
955 if (argc >= 2) {
956 trx_nr = atoi(argv[1]);
957 if (trx_nr >= bts->num_trx) {
958 vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
959 VTY_NEWLINE);
960 return CMD_WARNING;
961 }
Harald Weltee712a5f2009-06-21 16:17:15 +0200962 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800963 }
964 if (argc >= 3) {
965 ts_nr = atoi(argv[2]);
966 if (ts_nr >= TRX_NR_TS) {
967 vty_out(vty, "%% can't find TS '%s'%s", argv[2],
968 VTY_NEWLINE);
969 return CMD_WARNING;
970 }
Harald Welte06868382010-12-24 12:05:03 +0100971 /* Fully Specified: print and exit */
Harald Welte59b04682009-06-10 05:40:52 +0800972 ts = &trx->ts[ts_nr];
973 ts_dump_vty(vty, ts);
974 return CMD_SUCCESS;
975 }
Harald Welte06868382010-12-24 12:05:03 +0100976
977 if (bts && trx) {
978 /* Iterate over all TS in this TRX */
979 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
980 ts = &trx->ts[ts_nr];
981 ts_dump_vty(vty, ts);
982 }
983 } else if (bts) {
984 /* Iterate over all TRX in this BTS, TS in each TRX */
Harald Welte59b04682009-06-10 05:40:52 +0800985 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +0200986 trx = gsm_bts_trx_num(bts, trx_nr);
Harald Welte59b04682009-06-10 05:40:52 +0800987 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
988 ts = &trx->ts[ts_nr];
989 ts_dump_vty(vty, ts);
990 }
991 }
Harald Welte06868382010-12-24 12:05:03 +0100992 } else {
993 /* Iterate over all BTS, TRX in each BTS, TS in each TRX */
994 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
995 bts = gsm_bts_num(net, bts_nr);
996 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
997 trx = gsm_bts_trx_num(bts, trx_nr);
998 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
999 ts = &trx->ts[ts_nr];
1000 ts_dump_vty(vty, ts);
1001 }
1002 }
1003 }
Harald Welte59b04682009-06-10 05:40:52 +08001004 }
1005
1006 return CMD_SUCCESS;
1007}
1008
Holger Hans Peter Freyther1dd0a1b2010-01-06 06:00:40 +01001009static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
Harald Welte59b04682009-06-10 05:40:52 +08001010{
Harald Welte91afe4c2009-06-20 18:15:19 +02001011 vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id,
Harald Welte59b04682009-06-10 05:40:52 +08001012 subscr->authorized, VTY_NEWLINE);
Holger Hans Peter Freyther7d552fc2013-12-12 15:45:41 +01001013 if (strlen(subscr->name))
Harald Welte59b04682009-06-10 05:40:52 +08001014 vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE);
Holger Hans Peter Freyther4fcba8e2014-04-04 11:53:18 +02001015 if (strlen(subscr->extension))
Harald Welte59b04682009-06-10 05:40:52 +08001016 vty_out(vty, " Extension: %s%s", subscr->extension,
1017 VTY_NEWLINE);
Holger Hans Peter Freytherb0be39b2013-07-14 08:38:24 +02001018 vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
Holger Hans Peter Freythercd8bacf2009-08-19 12:53:57 +02001019 if (subscr->tmsi != GSM_RESERVED_TMSI)
1020 vty_out(vty, " TMSI: %08X%s", subscr->tmsi,
Harald Welte270c06c2009-08-15 03:24:51 +02001021 VTY_NEWLINE);
Sylvain Munaute5863a22009-12-27 19:29:28 +01001022
Harald Welte (local)02d5efa2009-08-14 20:27:16 +02001023 vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +08001024}
1025
Harald Welte44007742009-12-22 21:43:14 +01001026static void meas_rep_dump_uni_vty(struct vty *vty,
1027 struct gsm_meas_rep_unidir *mru,
1028 const char *prefix,
1029 const char *dir)
1030{
1031 vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ",
1032 prefix, dir, rxlev2dbm(mru->full.rx_lev),
1033 dir, rxlev2dbm(mru->sub.rx_lev));
1034 vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s",
1035 dir, mru->full.rx_qual, dir, mru->sub.rx_qual,
1036 VTY_NEWLINE);
1037}
1038
1039static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr,
1040 const char *prefix)
1041{
1042 vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE);
1043 vty_out(vty, "%s Flags: %s%s%s%s%s", prefix,
1044 mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "",
1045 mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "",
1046 mr->flags & MEAS_REP_F_FPC ? "FPC " : "",
1047 mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ",
1048 VTY_NEWLINE);
1049 if (mr->flags & MEAS_REP_F_MS_TO)
1050 vty_out(vty, "%s MS Timing Offset: %u%s", prefix,
1051 mr->ms_timing_offset, VTY_NEWLINE);
1052 if (mr->flags & MEAS_REP_F_MS_L1)
1053 vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s",
1054 prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE);
1055 if (mr->flags & MEAS_REP_F_DL_VALID)
1056 meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl");
1057 meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
1058}
1059
Harald Weltee9db0242015-12-05 17:22:49 +01001060/* FIXME: move this to libosmogsm */
1061static const struct value_string gsm48_cmode_names[] = {
1062 { GSM48_CMODE_SIGN, "signalling" },
1063 { GSM48_CMODE_SPEECH_V1, "FR or HR" },
1064 { GSM48_CMODE_SPEECH_EFR, "EFR" },
1065 { GSM48_CMODE_SPEECH_AMR, "AMR" },
1066 { GSM48_CMODE_DATA_14k5, "CSD(14k5)" },
1067 { GSM48_CMODE_DATA_12k0, "CSD(12k0)" },
1068 { GSM48_CMODE_DATA_6k0, "CSD(6k0)" },
1069 { GSM48_CMODE_DATA_3k6, "CSD(3k6)" },
1070 { 0, NULL }
1071};
1072
Neels Hofmeyra7488ae2016-11-02 14:28:15 +01001073/* call vty_out() to print a string like " as TCH/H" for dynamic timeslots.
1074 * Don't do anything if the ts is not dynamic. */
1075static void vty_out_dyn_ts_status(struct vty *vty, struct gsm_bts_trx_ts *ts)
1076{
1077 switch (ts->pchan) {
1078 case GSM_PCHAN_TCH_F_TCH_H_PDCH:
1079 if (ts->dyn.pchan_is == ts->dyn.pchan_want)
1080 vty_out(vty, " as %s",
1081 gsm_pchan_name(ts->dyn.pchan_is));
1082 else
1083 vty_out(vty, " switching %s -> %s",
1084 gsm_pchan_name(ts->dyn.pchan_is),
1085 gsm_pchan_name(ts->dyn.pchan_want));
1086 break;
1087 case GSM_PCHAN_TCH_F_PDCH:
1088 if ((ts->flags & TS_F_PDCH_PENDING_MASK) == 0)
1089 vty_out(vty, " as %s",
1090 (ts->flags & TS_F_PDCH_ACTIVE)? "PDCH"
1091 : "TCH/F");
1092 else
1093 vty_out(vty, " switching %s -> %s",
1094 (ts->flags & TS_F_PDCH_ACTIVE)? "PDCH"
1095 : "TCH/F",
1096 (ts->flags & TS_F_PDCH_ACT_PENDING)? "PDCH"
1097 : "TCH/F");
1098 break;
1099 default:
1100 /* no dyn ts */
1101 break;
1102 }
1103}
1104
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +08001105static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
Harald Welte59b04682009-06-10 05:40:52 +08001106{
Harald Welte44007742009-12-22 21:43:14 +01001107 int idx;
1108
Harald Weltef62dad62010-12-24 12:22:34 +01001109 vty_out(vty, "BTS %u, TRX %u, Timeslot %u, Lchan %u: Type %s%s",
1110 lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
1111 lchan->nr, gsm_lchant_name(lchan->type), VTY_NEWLINE);
Neels Hofmeyra7488ae2016-11-02 14:28:15 +01001112 /* show dyn TS details, if applicable */
1113 switch (lchan->ts->pchan) {
1114 case GSM_PCHAN_TCH_F_TCH_H_PDCH:
1115 vty_out(vty, " Osmocom Dyn TS:");
1116 vty_out_dyn_ts_status(vty, lchan->ts);
1117 vty_out(vty, VTY_NEWLINE);
1118 break;
1119 case GSM_PCHAN_TCH_F_PDCH:
1120 vty_out(vty, " IPACC Dyn PDCH TS:");
1121 vty_out_dyn_ts_status(vty, lchan->ts);
1122 vty_out(vty, VTY_NEWLINE);
1123 break;
1124 default:
1125 /* no dyn ts */
1126 break;
1127 }
Holger Hans Peter Freyther960adfe2014-12-28 12:08:28 +01001128 vty_out(vty, " Connection: %u, State: %s%s%s%s",
Holger Hans Peter Freyther6e5c50f2010-06-28 17:09:29 +08001129 lchan->conn ? 1: 0,
Holger Hans Peter Freyther960adfe2014-12-28 12:08:28 +01001130 gsm_lchans_name(lchan->state),
1131 lchan->state == LCHAN_S_BROKEN ? " Error reason: " : "",
1132 lchan->state == LCHAN_S_BROKEN ? lchan->broken_reason : "",
1133 VTY_NEWLINE);
Harald Welteb761bf82009-12-12 18:17:25 +01001134 vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s",
1135 lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
1136 - lchan->bs_power*2,
1137 ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
1138 VTY_NEWLINE);
Harald Weltee9db0242015-12-05 17:22:49 +01001139 vty_out(vty, " Channel Mode / Codec: %s%s",
1140 get_value_string(gsm48_cmode_names, lchan->tch_mode),
1141 VTY_NEWLINE);
Holger Hans Peter Freyther1a95fa82010-06-28 15:47:12 +08001142 if (lchan->conn && lchan->conn->subscr) {
Harald Welte59b04682009-06-10 05:40:52 +08001143 vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
Holger Hans Peter Freyther1a95fa82010-06-28 15:47:12 +08001144 subscr_dump_vty(vty, lchan->conn->subscr);
Harald Welte59b04682009-06-10 05:40:52 +08001145 } else
1146 vty_out(vty, " No Subscriber%s", VTY_NEWLINE);
Harald Welte87504212009-12-02 01:56:49 +05301147 if (is_ipaccess_bts(lchan->ts->trx->bts)) {
1148 struct in_addr ia;
Holger Hans Peter Freythercec1ec52010-04-07 15:39:16 +02001149 ia.s_addr = htonl(lchan->abis_ip.bound_ip);
Harald Welte87504212009-12-02 01:56:49 +05301150 vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s",
1151 inet_ntoa(ia), lchan->abis_ip.bound_port,
1152 lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id,
1153 VTY_NEWLINE);
1154 }
Harald Welte44007742009-12-22 21:43:14 +01001155
1156 /* we want to report the last measurement report */
1157 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
1158 lchan->meas_rep_idx, 1);
1159 meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " ");
Harald Welte59b04682009-06-10 05:40:52 +08001160}
1161
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +08001162static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
1163{
Holger Hans Peter Freythercf13a922010-05-14 01:57:02 +08001164 struct gsm_meas_rep *mr;
1165 int idx;
1166
1167 /* we want to report the last measurement report */
1168 idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
1169 lchan->meas_rep_idx, 1);
1170 mr = &lchan->meas_rep[idx];
1171
Neels Hofmeyra7488ae2016-11-02 14:28:15 +01001172 vty_out(vty, "BTS %u, TRX %u, Timeslot %u %s",
Harald Weltef62dad62010-12-24 12:22:34 +01001173 lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
Neels Hofmeyra7488ae2016-11-02 14:28:15 +01001174 gsm_pchan_name(lchan->ts->pchan));
1175 vty_out_dyn_ts_status(vty, lchan->ts);
1176 vty_out(vty, ", Lchan %u, Type %s, State %s - "
1177 "L1 MS Power: %u dBm RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
Neels Hofmeyr73208e02016-06-14 01:31:38 +02001178 lchan->nr,
1179 gsm_lchant_name(lchan->type), gsm_lchans_name(lchan->state),
1180 mr->ms_l1.pwr,
Holger Hans Peter Freythercf13a922010-05-14 01:57:02 +08001181 rxlev2dbm(mr->dl.full.rx_lev),
1182 rxlev2dbm(mr->ul.full.rx_lev),
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +08001183 VTY_NEWLINE);
1184}
1185
Holger Hans Peter Freyther86bbcbd2011-12-27 16:34:12 +01001186
1187static int dump_lchan_trx_ts(struct gsm_bts_trx_ts *ts, struct vty *vty,
1188 void (*dump_cb)(struct vty *, struct gsm_lchan *))
1189{
1190 int lchan_nr;
1191 for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN; lchan_nr++) {
1192 struct gsm_lchan *lchan = &ts->lchan[lchan_nr];
1193 if ((lchan->type == GSM_LCHAN_NONE) && (lchan->state == LCHAN_S_NONE))
1194 continue;
1195 dump_cb(vty, lchan);
1196 }
1197
1198 return CMD_SUCCESS;
1199}
1200
1201static int dump_lchan_trx(struct gsm_bts_trx *trx, struct vty *vty,
1202 void (*dump_cb)(struct vty *, struct gsm_lchan *))
1203{
1204 int ts_nr;
1205
1206 for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
1207 struct gsm_bts_trx_ts *ts = &trx->ts[ts_nr];
1208 dump_lchan_trx_ts(ts, vty, dump_cb);
1209 }
1210
1211 return CMD_SUCCESS;
1212}
1213
1214static int dump_lchan_bts(struct gsm_bts *bts, struct vty *vty,
1215 void (*dump_cb)(struct vty *, struct gsm_lchan *))
1216{
1217 int trx_nr;
1218
1219 for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
1220 struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, trx_nr);
1221 dump_lchan_trx(trx, vty, dump_cb);
1222 }
1223
1224 return CMD_SUCCESS;
1225}
1226
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +08001227static int lchan_summary(struct vty *vty, int argc, const char **argv,
1228 void (*dump_cb)(struct vty *, struct gsm_lchan *))
Harald Welte59b04682009-06-10 05:40:52 +08001229{
Harald Welte40152872010-05-16 20:52:23 +02001230 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +08001231 struct gsm_bts *bts;
1232 struct gsm_bts_trx *trx;
1233 struct gsm_bts_trx_ts *ts;
1234 struct gsm_lchan *lchan;
1235 int bts_nr, trx_nr, ts_nr, lchan_nr;
1236
1237 if (argc >= 1) {
1238 /* use the BTS number that the user has specified */
1239 bts_nr = atoi(argv[0]);
1240 if (bts_nr >= net->num_bts) {
1241 vty_out(vty, "%% can't find BTS %s%s", argv[0],
1242 VTY_NEWLINE);
1243 return CMD_WARNING;
1244 }
Harald Weltee712a5f2009-06-21 16:17:15 +02001245 bts = gsm_bts_num(net, bts_nr);
Holger Hans Peter Freyther86bbcbd2011-12-27 16:34:12 +01001246
1247 if (argc == 1)
1248 return dump_lchan_bts(bts, vty, dump_cb);
Harald Welte59b04682009-06-10 05:40:52 +08001249 }
1250 if (argc >= 2) {
1251 trx_nr = atoi(argv[1]);
1252 if (trx_nr >= bts->num_trx) {
1253 vty_out(vty, "%% can't find TRX %s%s", argv[1],
1254 VTY_NEWLINE);
1255 return CMD_WARNING;
1256 }
Harald Weltee712a5f2009-06-21 16:17:15 +02001257 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freyther86bbcbd2011-12-27 16:34:12 +01001258
1259 if (argc == 2)
1260 return dump_lchan_trx(trx, vty, dump_cb);
Harald Welte59b04682009-06-10 05:40:52 +08001261 }
1262 if (argc >= 3) {
1263 ts_nr = atoi(argv[2]);
1264 if (ts_nr >= TRX_NR_TS) {
1265 vty_out(vty, "%% can't find TS %s%s", argv[2],
1266 VTY_NEWLINE);
1267 return CMD_WARNING;
1268 }
1269 ts = &trx->ts[ts_nr];
Holger Hans Peter Freyther86bbcbd2011-12-27 16:34:12 +01001270
1271 if (argc == 3)
1272 return dump_lchan_trx_ts(ts, vty, dump_cb);
Harald Welte59b04682009-06-10 05:40:52 +08001273 }
1274 if (argc >= 4) {
1275 lchan_nr = atoi(argv[3]);
1276 if (lchan_nr >= TS_MAX_LCHAN) {
1277 vty_out(vty, "%% can't find LCHAN %s%s", argv[3],
1278 VTY_NEWLINE);
1279 return CMD_WARNING;
1280 }
1281 lchan = &ts->lchan[lchan_nr];
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +08001282 dump_cb(vty, lchan);
Harald Welte59b04682009-06-10 05:40:52 +08001283 return CMD_SUCCESS;
1284 }
Holger Hans Peter Freyther86bbcbd2011-12-27 16:34:12 +01001285
1286
Harald Welte59b04682009-06-10 05:40:52 +08001287 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +02001288 bts = gsm_bts_num(net, bts_nr);
Holger Hans Peter Freyther86bbcbd2011-12-27 16:34:12 +01001289 dump_lchan_bts(bts, vty, dump_cb);
Harald Welte59b04682009-06-10 05:40:52 +08001290 }
1291
1292 return CMD_SUCCESS;
1293}
1294
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +08001295
1296DEFUN(show_lchan,
1297 show_lchan_cmd,
Sylvain Munaut1ad96282012-12-28 12:15:11 +01001298 "show lchan [<0-255>] [<0-255>] [<0-7>] [lchan_nr]",
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +08001299 SHOW_STR "Display information about a logical channel\n"
1300 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
Holger Hans Peter Freythere8127042011-10-03 23:42:06 +02001301 LCHAN_NR_STR)
Holger Hans Peter Freyther5424e022010-05-14 02:03:16 +08001302
1303{
1304 return lchan_summary(vty, argc, argv, lchan_dump_full_vty);
1305}
1306
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +08001307DEFUN(show_lchan_summary,
1308 show_lchan_summary_cmd,
Sylvain Munaut1ad96282012-12-28 12:15:11 +01001309 "show lchan summary [<0-255>] [<0-255>] [<0-7>] [lchan_nr]",
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +08001310 SHOW_STR "Display information about a logical channel\n"
Holger Hans Peter Freythere8127042011-10-03 23:42:06 +02001311 "Short summary\n"
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +08001312 "BTS Number\n" "TRX Number\n" "Timeslot Number\n"
Holger Hans Peter Freythere8127042011-10-03 23:42:06 +02001313 LCHAN_NR_STR)
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +08001314{
1315 return lchan_summary(vty, argc, argv, lchan_dump_short_vty);
1316}
1317
Harald Welte59b04682009-06-10 05:40:52 +08001318static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag)
1319{
1320 vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE);
1321 subscr_dump_vty(vty, pag->subscr);
1322}
1323
1324static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts)
1325{
1326 struct gsm_paging_request *pag;
1327
Holger Hans Peter Freyther9372d9c2013-03-03 11:03:17 +01001328 if (!bts->paging.bts)
1329 return;
1330
Harald Welte59b04682009-06-10 05:40:52 +08001331 llist_for_each_entry(pag, &bts->paging.pending_requests, entry)
1332 paging_dump_vty(vty, pag);
1333}
1334
1335DEFUN(show_paging,
1336 show_paging_cmd,
Sylvain Munaut1ad96282012-12-28 12:15:11 +01001337 "show paging [<0-255>]",
Harald Welte9e002452010-05-11 21:53:49 +02001338 SHOW_STR "Display information about paging reuqests of a BTS\n"
1339 "BTS Number\n")
Harald Welte59b04682009-06-10 05:40:52 +08001340{
Harald Welte40152872010-05-16 20:52:23 +02001341 struct gsm_network *net = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +08001342 struct gsm_bts *bts;
1343 int bts_nr;
1344
1345 if (argc >= 1) {
1346 /* use the BTS number that the user has specified */
1347 bts_nr = atoi(argv[0]);
1348 if (bts_nr >= net->num_bts) {
1349 vty_out(vty, "%% can't find BTS %s%s", argv[0],
1350 VTY_NEWLINE);
1351 return CMD_WARNING;
1352 }
Harald Weltee712a5f2009-06-21 16:17:15 +02001353 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +08001354 bts_paging_dump_vty(vty, bts);
1355
1356 return CMD_SUCCESS;
1357 }
1358 for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
Harald Weltee712a5f2009-06-21 16:17:15 +02001359 bts = gsm_bts_num(net, bts_nr);
Harald Welte59b04682009-06-10 05:40:52 +08001360 bts_paging_dump_vty(vty, bts);
1361 }
1362
1363 return CMD_SUCCESS;
1364}
1365
Holger Hans Peter Freyther35e6fbb2013-02-05 09:39:09 +01001366DEFUN(show_paging_group,
1367 show_paging_group_cmd,
1368 "show paging-group <0-255> IMSI",
1369 SHOW_STR "Display the paging group\n"
1370 "BTS Number\n" "IMSI\n")
1371{
1372 struct gsm_network *net = gsmnet_from_vty(vty);
1373 struct gsm_bts *bts;
1374 unsigned int page_group;
1375 int bts_nr = atoi(argv[0]);
1376
1377 if (bts_nr >= net->num_bts) {
1378 vty_out(vty, "%% can't find BTS %s%s", argv[0], VTY_NEWLINE);
1379 return CMD_WARNING;
1380 }
1381
1382 bts = gsm_bts_num(net, bts_nr);
1383 if (!bts) {
1384 vty_out(vty, "%% can't find BTS %s%s", argv[0], VTY_NEWLINE);
1385 return CMD_WARNING;
1386 }
1387
1388 page_group = gsm0502_calc_paging_group(&bts->si_common.chan_desc,
1389 str_to_imsi(argv[1]));
1390 vty_out(vty, "%%Paging group for IMSI %" PRIu64 " on BTS #%d is %u%s",
1391 str_to_imsi(argv[1]), bts->nr,
1392 page_group, VTY_NEWLINE);
1393 return CMD_SUCCESS;
1394}
1395
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001396DEFUN(cfg_net_neci,
1397 cfg_net_neci_cmd,
1398 "neci (0|1)",
Harald Welte18ce31c2010-05-14 20:05:17 +02001399 "New Establish Cause Indication\n"
1400 "Don't set the NECI bit\n" "Set the NECI bit\n")
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001401{
Harald Welte40152872010-05-16 20:52:23 +02001402 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
1403
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001404 gsmnet->neci = atoi(argv[0]);
Holger Hans Peter Freytherf0f37f12010-09-06 09:36:02 +08001405 gsm_net_update_ctype(gsmnet);
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01001406 return CMD_SUCCESS;
1407}
1408
Harald Welte9e002452010-05-11 21:53:49 +02001409#define HANDOVER_STR "Handover Options\n"
1410
Harald Welte0af9c9f2009-12-19 21:41:52 +01001411DEFUN(cfg_net_handover, cfg_net_handover_cmd,
1412 "handover (0|1)",
Harald Welte9e002452010-05-11 21:53:49 +02001413 HANDOVER_STR
1414 "Don't perform in-call handover\n"
1415 "Perform in-call handover\n")
Harald Welte0af9c9f2009-12-19 21:41:52 +01001416{
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001417 int enable = atoi(argv[0]);
Harald Welte40152872010-05-16 20:52:23 +02001418 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001419
1420 if (enable && ipacc_rtp_direct) {
Harald Welteaa2c3032009-12-20 13:51:01 +01001421 vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode "
1422 "is enabled by using the -P command line option%s",
1423 VTY_NEWLINE);
1424 return CMD_WARNING;
1425 }
Holger Hans Peter Freyther3524d4b2010-01-07 16:14:38 +01001426 gsmnet->handover.active = enable;
Harald Welte0af9c9f2009-12-19 21:41:52 +01001427
1428 return CMD_SUCCESS;
1429}
1430
Harald Welte9e002452010-05-11 21:53:49 +02001431#define HO_WIN_STR HANDOVER_STR "Measurement Window\n"
1432#define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n"
1433#define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n"
1434#define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n"
Holger Hans Peter Freythere8127042011-10-03 23:42:06 +02001435#define HO_AVG_COUNT_STR "Amount to use for Averaging\n"
Harald Welte9e002452010-05-11 21:53:49 +02001436
Harald Weltea8062f12009-12-21 16:51:50 +01001437DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd,
1438 "handover window rxlev averaging <1-10>",
Harald Welte9e002452010-05-11 21:53:49 +02001439 HO_WIN_RXLEV_STR
Holger Hans Peter Freythere8127042011-10-03 23:42:06 +02001440 "How many RxLev measurements are used for averaging\n"
1441 HO_AVG_COUNT_STR)
Harald Weltea8062f12009-12-21 16:51:50 +01001442{
Harald Welte40152872010-05-16 20:52:23 +02001443 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001444 gsmnet->handover.win_rxlev_avg = atoi(argv[0]);
1445 return CMD_SUCCESS;
1446}
1447
1448DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd,
1449 "handover window rxqual averaging <1-10>",
Harald Welte9e002452010-05-11 21:53:49 +02001450 HO_WIN_RXQUAL_STR
Holger Hans Peter Freythere8127042011-10-03 23:42:06 +02001451 "How many RxQual measurements are used for averaging\n"
1452 HO_AVG_COUNT_STR)
Harald Weltea8062f12009-12-21 16:51:50 +01001453{
Harald Welte40152872010-05-16 20:52:23 +02001454 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001455 gsmnet->handover.win_rxqual_avg = atoi(argv[0]);
1456 return CMD_SUCCESS;
1457}
1458
1459DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd,
1460 "handover window rxlev neighbor averaging <1-10>",
Holger Hans Peter Freythere8127042011-10-03 23:42:06 +02001461 HO_WIN_RXLEV_STR "Neighbor\n"
1462 "How many RxQual measurements are used for averaging\n"
1463 HO_AVG_COUNT_STR)
Harald Weltea8062f12009-12-21 16:51:50 +01001464{
Harald Welte40152872010-05-16 20:52:23 +02001465 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001466 gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]);
1467 return CMD_SUCCESS;
1468}
1469
1470DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd,
1471 "handover power budget interval <1-99>",
Harald Welte9e002452010-05-11 21:53:49 +02001472 HO_PBUDGET_STR
Holger Hans Peter Freythere8127042011-10-03 23:42:06 +02001473 "How often to check if we have a better cell (SACCH frames)\n"
1474 "Interval\n" "Number\n")
Harald Weltea8062f12009-12-21 16:51:50 +01001475{
Harald Welte40152872010-05-16 20:52:23 +02001476 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001477 gsmnet->handover.pwr_interval = atoi(argv[0]);
1478 return CMD_SUCCESS;
1479}
1480
1481DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd,
1482 "handover power budget hysteresis <0-999>",
Harald Welte9e002452010-05-11 21:53:49 +02001483 HO_PBUDGET_STR
Holger Hans Peter Freythere8127042011-10-03 23:42:06 +02001484 "How many dB does a neighbor to be stronger to become a HO candidate\n"
1485 "Hysteresis\n" "Number\n")
Harald Weltea8062f12009-12-21 16:51:50 +01001486{
Harald Welte40152872010-05-16 20:52:23 +02001487 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001488 gsmnet->handover.pwr_hysteresis = atoi(argv[0]);
1489 return CMD_SUCCESS;
1490}
1491
1492DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd,
1493 "handover maximum distance <0-9999>",
Harald Welte9e002452010-05-11 21:53:49 +02001494 HANDOVER_STR
Holger Hans Peter Freythere8127042011-10-03 23:42:06 +02001495 "How big is the maximum timing advance before HO is forced\n"
1496 "Distance\n" "Number\n")
Harald Weltea8062f12009-12-21 16:51:50 +01001497{
Harald Welte40152872010-05-16 20:52:23 +02001498 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Weltea8062f12009-12-21 16:51:50 +01001499 gsmnet->handover.max_distance = atoi(argv[0]);
1500 return CMD_SUCCESS;
1501}
Harald Welte0af9c9f2009-12-19 21:41:52 +01001502
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +08001503DEFUN(cfg_net_pag_any_tch,
1504 cfg_net_pag_any_tch_cmd,
1505 "paging any use tch (0|1)",
Holger Hans Peter Freythere8127042011-10-03 23:42:06 +02001506 "Assign a TCH when receiving a Paging Any request\n"
1507 "Any Channel\n" "Use\n" "TCH\n"
1508 "Do not use TCH for Paging Request Any\n"
1509 "Do use TCH for Paging Request Any\n")
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +08001510{
Holger Hans Peter Freytherc5628882010-09-06 10:09:19 +08001511 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +08001512 gsmnet->pag_any_tch = atoi(argv[0]);
1513 gsm_net_update_ctype(gsmnet);
1514 return CMD_SUCCESS;
1515}
1516
Holger Hans Peter Freyther13ae9802009-12-22 08:27:21 +01001517#define DECLARE_TIMER(number, doc) \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001518 DEFUN(cfg_net_T##number, \
1519 cfg_net_T##number##_cmd, \
1520 "timer t" #number " <0-65535>", \
Harald Welte9e002452010-05-11 21:53:49 +02001521 "Configure GSM Timers\n" \
Holger Hans Peter Freyther18dd1a32014-04-11 19:30:27 +02001522 doc "Timer Value in seconds\n") \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001523{ \
Harald Welte40152872010-05-16 20:52:23 +02001524 struct gsm_network *gsmnet = gsmnet_from_vty(vty); \
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001525 int value = atoi(argv[0]); \
1526 \
1527 if (value < 0 || value > 65535) { \
1528 vty_out(vty, "Timer value %s out of range.%s", \
1529 argv[0], VTY_NEWLINE); \
1530 return CMD_WARNING; \
1531 } \
1532 \
1533 gsmnet->T##number = value; \
1534 return CMD_SUCCESS; \
1535}
1536
Holger Hans Peter Freythere8127042011-10-03 23:42:06 +02001537DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.\n")
1538DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.\n")
Harald Welte9b77f612012-06-03 13:01:47 +02001539DECLARE_TIMER(3105, "Set the timer for repetition of PHYSICAL INFORMATION.\n")
Holger Hans Peter Freythere8127042011-10-03 23:42:06 +02001540DECLARE_TIMER(3107, "Currently not used.\n")
Holger Hans Peter Freyther969a4052011-12-28 16:21:05 +01001541DECLARE_TIMER(3109, "Set the RSL SACCH deactivation timeout.\n")
Holger Hans Peter Freythere8127042011-10-03 23:42:06 +02001542DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel.\n")
1543DECLARE_TIMER(3113, "Set the time to try paging a subscriber.\n")
1544DECLARE_TIMER(3115, "Currently not used.\n")
1545DECLARE_TIMER(3117, "Currently not used.\n")
1546DECLARE_TIMER(3119, "Currently not used.\n")
1547DECLARE_TIMER(3122, "Waiting time (seconds) after IMM ASS REJECT\n")
1548DECLARE_TIMER(3141, "Currently not used.\n")
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001549
Max3d94aca2016-05-11 12:45:13 +02001550DEFUN_DEPRECATED(cfg_net_dtx,
1551 cfg_net_dtx_cmd,
1552 "dtx-used (0|1)",
1553 ".HIDDEN\n""Obsolete\n""Obsolete\n")
Holger Hans Peter Freyther21d63ff2010-09-06 09:25:48 +08001554{
Max3d94aca2016-05-11 12:45:13 +02001555 vty_out(vty, "%% 'dtx-used' is now deprecated: use dtx * "
1556 "configuration options of BTS instead%s", VTY_NEWLINE);
1557 return CMD_SUCCESS;
Holger Hans Peter Freyther21d63ff2010-09-06 09:25:48 +08001558}
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01001559
Harald Welte59b04682009-06-10 05:40:52 +08001560/* per-BTS configuration */
1561DEFUN(cfg_bts,
1562 cfg_bts_cmd,
Harald Welte2af06cb2012-08-17 12:50:14 +02001563 "bts <0-255>",
Harald Welte9e002452010-05-11 21:53:49 +02001564 "Select a BTS to configure\n"
1565 "BTS Number\n")
Harald Welte59b04682009-06-10 05:40:52 +08001566{
Harald Welte40152872010-05-16 20:52:23 +02001567 struct gsm_network *gsmnet = gsmnet_from_vty(vty);
Harald Welte59b04682009-06-10 05:40:52 +08001568 int bts_nr = atoi(argv[0]);
1569 struct gsm_bts *bts;
1570
Harald Weltee712a5f2009-06-21 16:17:15 +02001571 if (bts_nr > gsmnet->num_bts) {
1572 vty_out(vty, "%% The next unused BTS number is %u%s",
1573 gsmnet->num_bts, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +08001574 return CMD_WARNING;
Harald Weltee712a5f2009-06-21 16:17:15 +02001575 } else if (bts_nr == gsmnet->num_bts) {
1576 /* allocate a new one */
Harald Weltec7881282011-06-05 13:31:33 +02001577 bts = gsm_bts_alloc_register(gsmnet, GSM_BTS_TYPE_UNKNOWN,
Harald Welte7bb55f32015-11-20 10:43:31 +01001578 HARDCODED_BSIC);
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +02001579 } else
Harald Weltee712a5f2009-06-21 16:17:15 +02001580 bts = gsm_bts_num(gsmnet, bts_nr);
1581
Daniel Willmann580085f2010-01-11 13:43:07 +01001582 if (!bts) {
1583 vty_out(vty, "%% Unable to allocate BTS %u%s",
1584 gsmnet->num_bts, VTY_NEWLINE);
Harald Weltee712a5f2009-06-21 16:17:15 +02001585 return CMD_WARNING;
Daniel Willmann580085f2010-01-11 13:43:07 +01001586 }
Harald Welte59b04682009-06-10 05:40:52 +08001587
1588 vty->index = bts;
Harald Welte8791dac2010-05-14 17:59:53 +02001589 vty->index_sub = &bts->description;
Harald Welte59b04682009-06-10 05:40:52 +08001590 vty->node = BTS_NODE;
1591
1592 return CMD_SUCCESS;
1593}
1594
1595DEFUN(cfg_bts_type,
1596 cfg_bts_type_cmd,
Harald Welte85a77b12012-08-17 13:02:12 +02001597 "type TYPE", /* dynamically created */
Holger Hans Peter Freythere8127042011-10-03 23:42:06 +02001598 "Set the BTS type\n" "Type\n")
Harald Welte59b04682009-06-10 05:40:52 +08001599{
1600 struct gsm_bts *bts = vty->index;
Harald Welte59698fb2010-01-10 18:01:52 +01001601 int rc;
Harald Welte59b04682009-06-10 05:40:52 +08001602
Harald Welte59698fb2010-01-10 18:01:52 +01001603 rc = gsm_set_bts_type(bts, parse_btstype(argv[0]));
1604 if (rc < 0)
1605 return CMD_WARNING;
Harald Welte25572872009-10-20 00:22:00 +02001606
Harald Welte59b04682009-06-10 05:40:52 +08001607 return CMD_SUCCESS;
1608}
1609
Harald Welte91afe4c2009-06-20 18:15:19 +02001610DEFUN(cfg_bts_band,
1611 cfg_bts_band_cmd,
1612 "band BAND",
Holger Hans Peter Freythere8127042011-10-03 23:42:06 +02001613 "Set the frequency band of this BTS\n" "Frequency band\n")
Harald Welte91afe4c2009-06-20 18:15:19 +02001614{
1615 struct gsm_bts *bts = vty->index;
Harald Welte62868882009-08-08 16:12:58 +02001616 int band = gsm_band_parse(argv[0]);
Harald Welte91afe4c2009-06-20 18:15:19 +02001617
1618 if (band < 0) {
1619 vty_out(vty, "%% BAND %d is not a valid GSM band%s",
1620 band, VTY_NEWLINE);
1621 return CMD_WARNING;
1622 }
1623
1624 bts->band = band;
1625
1626 return CMD_SUCCESS;
1627}
1628
Max3d94aca2016-05-11 12:45:13 +02001629DEFUN(cfg_bts_dtxu, cfg_bts_dtxu_cmd, "dtx uplink [force]",
1630 "Configure discontinuous transmission\n"
1631 "Enable Uplink DTX for this BTS\n"
1632 "MS 'shall' use DTXu instead of 'may' use (might not be supported by "
1633 "older phones).\n")
1634{
1635 struct gsm_bts *bts = vty->index;
1636
1637 bts->dtxu = (argc > 0) ? GSM48_DTX_SHALL_BE_USED : GSM48_DTX_MAY_BE_USED;
Max032beff2016-06-06 11:30:57 +02001638 if (!is_ipaccess_bts(bts))
1639 vty_out(vty, "%% DTX enabled on non-IP BTS: this configuration "
1640 "neither supported nor tested!%s", VTY_NEWLINE);
Max3d94aca2016-05-11 12:45:13 +02001641 return CMD_SUCCESS;
1642}
1643
1644DEFUN(cfg_bts_no_dtxu, cfg_bts_no_dtxu_cmd, "no dtx uplink",
1645 NO_STR
1646 "Configure discontinuous transmission\n"
1647 "Disable Uplink DTX for this BTS\n")
1648{
1649 struct gsm_bts *bts = vty->index;
1650
1651 bts->dtxu = GSM48_DTX_SHALL_NOT_BE_USED;
1652
1653 return CMD_SUCCESS;
1654}
1655
1656DEFUN(cfg_bts_dtxd, cfg_bts_dtxd_cmd, "dtx downlink",
1657 "Configure discontinuous transmission\n"
1658 "Enable Downlink DTX for this BTS\n")
1659{
1660 struct gsm_bts *bts = vty->index;
1661
1662 bts->dtxd = true;
Max032beff2016-06-06 11:30:57 +02001663 if (!is_ipaccess_bts(bts))
1664 vty_out(vty, "%% DTX enabled on non-IP BTS: this configuration "
1665 "neither supported nor tested!%s", VTY_NEWLINE);
Max3d94aca2016-05-11 12:45:13 +02001666 return CMD_SUCCESS;
1667}
1668
1669DEFUN(cfg_bts_no_dtxd, cfg_bts_no_dtxd_cmd, "no dtx downlink",
1670 NO_STR
1671 "Configure discontinuous transmission\n"
1672 "Disable Downlink DTX for this BTS\n")
1673{
1674 struct gsm_bts *bts = vty->index;
1675
1676 bts->dtxd = false;
1677
1678 return CMD_SUCCESS;
1679}
1680
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +02001681DEFUN(cfg_bts_ci,
1682 cfg_bts_ci_cmd,
1683 "cell_identity <0-65535>",
Holger Hans Peter Freyther29844222012-07-21 00:27:10 +02001684 "Set the Cell identity of this BTS\n" "Cell Identity\n")
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +02001685{
1686 struct gsm_bts *bts = vty->index;
1687 int ci = atoi(argv[0]);
1688
1689 if (ci < 0 || ci > 0xffff) {
1690 vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s",
1691 ci, VTY_NEWLINE);
1692 return CMD_WARNING;
1693 }
1694 bts->cell_identity = ci;
1695
1696 return CMD_SUCCESS;
1697}
1698
Harald Welte59b04682009-06-10 05:40:52 +08001699DEFUN(cfg_bts_lac,
1700 cfg_bts_lac_cmd,
Holger Hans Peter Freyther54a22832009-09-29 14:02:33 +02001701 "location_area_code <0-65535>",
Holger Hans Peter Freyther29844222012-07-21 00:27:10 +02001702 "Set the Location Area Code (LAC) of this BTS\n" "LAC\n")
Harald Welte59b04682009-06-10 05:40:52 +08001703{
1704 struct gsm_bts *bts = vty->index;
1705 int lac = atoi(argv[0]);
1706
Holger Hans Peter Freyther54a22832009-09-29 14:02:33 +02001707 if (lac < 0 || lac > 0xffff) {
1708 vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s",
Harald Welte59b04682009-06-10 05:40:52 +08001709 lac, VTY_NEWLINE);
1710 return CMD_WARNING;
1711 }
Holger Hans Peter Freyther6c6ab862009-10-01 04:07:15 +02001712
1713 if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
1714 vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
1715 lac, VTY_NEWLINE);
1716 return CMD_WARNING;
1717 }
1718
Harald Welte59b04682009-06-10 05:40:52 +08001719 bts->location_area_code = lac;
1720
1721 return CMD_SUCCESS;
1722}
1723
Harald Weltea54a2bb2009-12-01 18:04:30 +05301724
Harald Welte7bb55f32015-11-20 10:43:31 +01001725/* compatibility wrapper for old config files */
1726DEFUN_HIDDEN(cfg_bts_tsc,
Harald Welte59b04682009-06-10 05:40:52 +08001727 cfg_bts_tsc_cmd,
Harald Weltede896da2012-05-31 10:57:08 +02001728 "training_sequence_code <0-7>",
Holger Hans Peter Freyther29844222012-07-21 00:27:10 +02001729 "Set the Training Sequence Code (TSC) of this BTS\n" "TSC\n")
Harald Welte59b04682009-06-10 05:40:52 +08001730{
Harald Welte59b04682009-06-10 05:40:52 +08001731 return CMD_SUCCESS;
1732}
1733
1734DEFUN(cfg_bts_bsic,
1735 cfg_bts_bsic_cmd,
1736 "base_station_id_code <0-63>",
Harald Welte557f3992012-08-16 23:23:50 +02001737 "Set the Base Station Identity Code (BSIC) of this BTS\n"
1738 "BSIC of this BTS\n")
Harald Welte59b04682009-06-10 05:40:52 +08001739{
1740 struct gsm_bts *bts = vty->index;
1741 int bsic = atoi(argv[0]);
1742
1743 if (bsic < 0 || bsic > 0x3f) {
Harald Welte62868882009-08-08 16:12:58 +02001744 vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s",
Harald Welte59b04682009-06-10 05:40:52 +08001745 bsic, VTY_NEWLINE);
1746 return CMD_WARNING;
1747 }
1748 bts->bsic = bsic;
1749
1750 return CMD_SUCCESS;
1751}
1752
Harald Welte59b04682009-06-10 05:40:52 +08001753DEFUN(cfg_bts_unit_id,
1754 cfg_bts_unit_id_cmd,
Harald Weltef515aa02009-08-07 13:27:09 +02001755 "ip.access unit_id <0-65534> <0-255>",
Harald Welte557f3992012-08-16 23:23:50 +02001756 "Abis/IP specific options\n"
1757 "Set the IPA BTS Unit ID\n"
1758 "Unit ID (Site)\n"
1759 "Unit ID (BTS)\n")
Harald Welte59b04682009-06-10 05:40:52 +08001760{
1761 struct gsm_bts *bts = vty->index;
1762 int site_id = atoi(argv[0]);
1763 int bts_id = atoi(argv[1]);
1764
Harald Weltef515aa02009-08-07 13:27:09 +02001765 if (!is_ipaccess_bts(bts)) {
1766 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1767 return CMD_WARNING;
1768 }
1769
Harald Welte59b04682009-06-10 05:40:52 +08001770 bts->ip_access.site_id = site_id;
1771 bts->ip_access.bts_id = bts_id;
1772
1773 return CMD_SUCCESS;
1774}
1775
Harald Welte8b3c5952013-03-12 13:57:05 +01001776DEFUN(cfg_bts_rsl_ip,
1777 cfg_bts_rsl_ip_cmd,
1778 "ip.access rsl-ip A.B.C.D",
1779 "Abis/IP specific options\n"
1780 "Set the IPA RSL IP Address of the BSC\n"
1781 "Destination IP address for RSL connection\n")
1782{
1783 struct gsm_bts *bts = vty->index;
1784 struct in_addr ia;
1785
1786 if (!is_ipaccess_bts(bts)) {
1787 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1788 return CMD_WARNING;
1789 }
1790
1791 inet_aton(argv[0], &ia);
1792 bts->ip_access.rsl_ip = ntohl(ia.s_addr);
1793
1794 return CMD_SUCCESS;
1795}
1796
Andreas Eversbergac27b952013-12-05 13:25:06 +01001797#define NOKIA_STR "Nokia *Site related commands\n"
Harald Welte8b3c5952013-03-12 13:57:05 +01001798
Sylvain Munautcb8e8432011-10-17 14:04:55 +02001799DEFUN(cfg_bts_nokia_site_skip_reset,
1800 cfg_bts_nokia_site_skip_reset_cmd,
1801 "nokia_site skip-reset (0|1)",
Andreas Eversbergac27b952013-12-05 13:25:06 +01001802 NOKIA_STR
Harald Welte557f3992012-08-16 23:23:50 +02001803 "Skip the reset step during bootstrap process of this BTS\n"
1804 "Do NOT skip the reset\n" "Skip the reset\n")
Sylvain Munautcb8e8432011-10-17 14:04:55 +02001805{
1806 struct gsm_bts *bts = vty->index;
1807
1808 if (bts->type != GSM_BTS_TYPE_NOKIA_SITE) {
1809 vty_out(vty, "%% BTS is not of Nokia *Site type%s", VTY_NEWLINE);
1810 return CMD_WARNING;
1811 }
1812
1813 bts->nokia.skip_reset = atoi(argv[0]);
1814
1815 return CMD_SUCCESS;
1816}
1817
Andreas Eversbergac27b952013-12-05 13:25:06 +01001818DEFUN(cfg_bts_nokia_site_no_loc_rel_cnf,
1819 cfg_bts_nokia_site_no_loc_rel_cnf_cmd,
1820 "nokia_site no-local-rel-conf (0|1)",
1821 NOKIA_STR
1822 "Do not wait for RELease CONFirm message when releasing channel locally\n"
1823 "Wait for RELease CONFirm\n" "Do not wait for RELease CONFirm\n")
1824{
1825 struct gsm_bts *bts = vty->index;
1826
1827 if (!is_nokia_bts(bts)) {
1828 vty_out(vty, "%% BTS is not of Nokia *Site type%s",
1829 VTY_NEWLINE);
1830 return CMD_WARNING;
1831 }
1832
1833 bts->nokia.no_loc_rel_cnf = atoi(argv[0]);
1834
1835 return CMD_SUCCESS;
1836}
1837
Sipos Csabadef87b42015-02-07 13:27:36 +01001838DEFUN(cfg_bts_nokia_site_bts_reset_timer_cnf,
1839 cfg_bts_nokia_site_bts_reset_timer_cnf_cmd,
1840 "nokia_site bts-reset-timer <15-100>",
1841 NOKIA_STR
1842 "The amount of time (in sec.) between BTS_RESET is sent,\n"
1843 "and the BTS is being bootstrapped.\n")
1844{
1845 struct gsm_bts *bts = vty->index;
1846
1847 if (!is_nokia_bts(bts)) {
1848 vty_out(vty, "%% BTS is not of Nokia *Site type%s",
1849 VTY_NEWLINE);
1850 return CMD_WARNING;
1851 }
1852
1853 bts->nokia.bts_reset_timer_cnf = atoi(argv[0]);
1854
1855 return CMD_SUCCESS;
1856}
Harald Welte9e002452010-05-11 21:53:49 +02001857#define OML_STR "Organization & Maintenance Link\n"
Harald Welte557f3992012-08-16 23:23:50 +02001858#define IPA_STR "A-bis/IP Specific Options\n"
Harald Welte9e002452010-05-11 21:53:49 +02001859
Harald Welte25572872009-10-20 00:22:00 +02001860DEFUN(cfg_bts_stream_id,
1861 cfg_bts_stream_id_cmd,
Pablo Neira Ayuso42e41df2011-08-17 22:44:07 +02001862 "oml ip.access stream_id <0-255> line E1_LINE",
Harald Welte9e002452010-05-11 21:53:49 +02001863 OML_STR IPA_STR
Harald Welte557f3992012-08-16 23:23:50 +02001864 "Set the ip.access Stream ID of the OML link of this BTS\n"
1865 "Stream Identifier\n" "Virtual E1 Line Number\n" "Virtual E1 Line Number\n")
Harald Welte25572872009-10-20 00:22:00 +02001866{
1867 struct gsm_bts *bts = vty->index;
Pablo Neira Ayuso42e41df2011-08-17 22:44:07 +02001868 int stream_id = atoi(argv[0]), linenr = atoi(argv[1]);
Harald Welte25572872009-10-20 00:22:00 +02001869
1870 if (!is_ipaccess_bts(bts)) {
1871 vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
1872 return CMD_WARNING;
1873 }
1874
1875 bts->oml_tei = stream_id;
Pablo Neira Ayuso42e41df2011-08-17 22:44:07 +02001876 /* This is used by e1inp_bind_ops callback for each BTS model. */
1877 bts->oml_e1_link.e1_nr = linenr;
1878
1879 return CMD_SUCCESS;
1880}
1881
Harald Weltefa2015f2012-08-17 09:52:03 +02001882#define OML_E1_STR OML_STR "OML E1/T1 Configuration\n"
Harald Welte25572872009-10-20 00:22:00 +02001883
Harald Welte62868882009-08-08 16:12:58 +02001884DEFUN(cfg_bts_oml_e1,
1885 cfg_bts_oml_e1_cmd,
1886 "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Weltefa2015f2012-08-17 09:52:03 +02001887 OML_E1_STR
1888 "E1/T1 line number to be used for OML\n"
Harald Welte557f3992012-08-16 23:23:50 +02001889 "E1/T1 line number to be used for OML\n"
1890 "E1/T1 timeslot to be used for OML\n"
1891 "E1/T1 timeslot to be used for OML\n"
1892 "E1/T1 sub-slot to be used for OML\n"
1893 "Use E1/T1 sub-slot 0\n"
1894 "Use E1/T1 sub-slot 1\n"
1895 "Use E1/T1 sub-slot 2\n"
1896 "Use E1/T1 sub-slot 3\n"
1897 "Use full E1 slot 3\n"
1898 )
Harald Welte62868882009-08-08 16:12:58 +02001899{
1900 struct gsm_bts *bts = vty->index;
1901
1902 parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]);
1903
1904 return CMD_SUCCESS;
1905}
1906
1907
1908DEFUN(cfg_bts_oml_e1_tei,
1909 cfg_bts_oml_e1_tei_cmd,
1910 "oml e1 tei <0-63>",
Harald Welte9e002452010-05-11 21:53:49 +02001911 OML_E1_STR
Harald Welte557f3992012-08-16 23:23:50 +02001912 "Set the TEI to be used for OML\n"
1913 "TEI Number\n")
Harald Welte62868882009-08-08 16:12:58 +02001914{
1915 struct gsm_bts *bts = vty->index;
1916
1917 bts->oml_tei = atoi(argv[0]);
1918
1919 return CMD_SUCCESS;
1920}
1921
Harald Welte3e774612009-08-10 13:48:16 +02001922DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd,
1923 "channel allocator (ascending|descending)",
Harald Welte9e002452010-05-11 21:53:49 +02001924 "Channnel Allocator\n" "Channel Allocator\n"
1925 "Allocate Timeslots and Transceivers in ascending order\n"
1926 "Allocate Timeslots and Transceivers in descending order\n")
Harald Welte3e774612009-08-10 13:48:16 +02001927{
1928 struct gsm_bts *bts = vty->index;
1929
1930 if (!strcmp(argv[0], "ascending"))
1931 bts->chan_alloc_reverse = 0;
1932 else
1933 bts->chan_alloc_reverse = 1;
1934
1935 return CMD_SUCCESS;
1936}
1937
Harald Welte9e002452010-05-11 21:53:49 +02001938#define RACH_STR "Random Access Control Channel\n"
1939
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001940DEFUN(cfg_bts_rach_tx_integer,
1941 cfg_bts_rach_tx_integer_cmd,
1942 "rach tx integer <0-15>",
Harald Welte9e002452010-05-11 21:53:49 +02001943 RACH_STR
Harald Welte557f3992012-08-16 23:23:50 +02001944 "Set the raw tx integer value in RACH Control parameters IE\n"
1945 "Set the raw tx integer value in RACH Control parameters IE\n"
1946 "Raw tx integer value in RACH Control parameters IE\n")
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001947{
1948 struct gsm_bts *bts = vty->index;
1949 bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf;
1950 return CMD_SUCCESS;
1951}
1952
1953DEFUN(cfg_bts_rach_max_trans,
1954 cfg_bts_rach_max_trans_cmd,
1955 "rach max transmission (1|2|4|7)",
Harald Welte9e002452010-05-11 21:53:49 +02001956 RACH_STR
Harald Welte557f3992012-08-16 23:23:50 +02001957 "Set the maximum number of RACH burst transmissions\n"
1958 "Set the maximum number of RACH burst transmissions\n"
Harald Weltefa2015f2012-08-17 09:52:03 +02001959 "Maximum number of 1 RACH burst transmissions\n"
1960 "Maximum number of 2 RACH burst transmissions\n"
1961 "Maximum number of 4 RACH burst transmissions\n"
1962 "Maximum number of 7 RACH burst transmissions\n")
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01001963{
1964 struct gsm_bts *bts = vty->index;
1965 bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0]));
1966 return CMD_SUCCESS;
1967}
1968
Andreas Eversberg14e12f22012-10-13 07:27:47 +02001969#define CD_STR "Channel Description\n"
1970
1971DEFUN(cfg_bts_chan_desc_att,
1972 cfg_bts_chan_desc_att_cmd,
1973 "channel-descrption attach (0|1)",
1974 CD_STR
1975 "Set if attachment is required\n"
1976 "Attachment is NOT required\n"
1977 "Attachment is required (standard)\n")
1978{
1979 struct gsm_bts *bts = vty->index;
1980 bts->si_common.chan_desc.att = atoi(argv[0]);
1981 return CMD_SUCCESS;
1982}
1983
1984DEFUN(cfg_bts_chan_desc_bs_pa_mfrms,
1985 cfg_bts_chan_desc_bs_pa_mfrms_cmd,
1986 "channel-descrption bs-pa-mfrms <2-9>",
1987 CD_STR
1988 "Set number of multiframe periods for paging groups\n"
1989 "Number of multiframe periods for paging groups\n")
1990{
1991 struct gsm_bts *bts = vty->index;
1992 int bs_pa_mfrms = atoi(argv[0]);
1993
1994 bts->si_common.chan_desc.bs_pa_mfrms = bs_pa_mfrms - 2;
1995 return CMD_SUCCESS;
1996}
1997
1998DEFUN(cfg_bts_chan_desc_bs_ag_blks_res,
1999 cfg_bts_chan_desc_bs_ag_blks_res_cmd,
2000 "channel-descrption bs-ag-blks-res <0-7>",
2001 CD_STR
2002 "Set number of blocks reserved for access grant\n"
2003 "Number of blocks reserved for access grant\n")
2004{
2005 struct gsm_bts *bts = vty->index;
2006 int bs_ag_blks_res = atoi(argv[0]);
2007
2008 bts->si_common.chan_desc.bs_ag_blks_res = bs_ag_blks_res;
2009 return CMD_SUCCESS;
2010}
2011
Harald Welte9e002452010-05-11 21:53:49 +02002012#define NM_STR "Network Management\n"
2013
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08002014DEFUN(cfg_bts_rach_nm_b_thresh,
2015 cfg_bts_rach_nm_b_thresh_cmd,
2016 "rach nm busy threshold <0-255>",
Harald Welte9e002452010-05-11 21:53:49 +02002017 RACH_STR NM_STR
Harald Welte557f3992012-08-16 23:23:50 +02002018 "Set the NM Busy Threshold\n"
2019 "Set the NM Busy Threshold\n"
2020 "NM Busy Threshold in dB")
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08002021{
2022 struct gsm_bts *bts = vty->index;
2023 bts->rach_b_thresh = atoi(argv[0]);
2024 return CMD_SUCCESS;
2025}
2026
2027DEFUN(cfg_bts_rach_nm_ldavg,
2028 cfg_bts_rach_nm_ldavg_cmd,
2029 "rach nm load average <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02002030 RACH_STR NM_STR
Harald Welte557f3992012-08-16 23:23:50 +02002031 "Set the NM Loadaverage Slots value\n"
2032 "Set the NM Loadaverage Slots value\n"
2033 "NM Loadaverage Slots value\n")
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08002034{
2035 struct gsm_bts *bts = vty->index;
2036 bts->rach_ldavg_slots = atoi(argv[0]);
2037 return CMD_SUCCESS;
2038}
2039
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02002040DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd,
2041 "cell barred (0|1)",
Harald Welte557f3992012-08-16 23:23:50 +02002042 "Should this cell be barred from access?\n"
2043 "Should this cell be barred from access?\n"
2044 "Cell should NOT be barred\n"
2045 "Cell should be barred\n")
2046
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02002047{
2048 struct gsm_bts *bts = vty->index;
2049
Harald Welte8c973ba2009-12-21 23:08:18 +01002050 bts->si_common.rach_control.cell_bar = atoi(argv[0]);
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02002051
2052 return CMD_SUCCESS;
2053}
2054
Holger Hans Peter Freyther440984b2010-05-14 00:39:19 +08002055DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd,
2056 "rach emergency call allowed (0|1)",
Harald Welte557f3992012-08-16 23:23:50 +02002057 RACH_STR
2058 "Should this cell allow emergency calls?\n"
2059 "Should this cell allow emergency calls?\n"
2060 "Should this cell allow emergency calls?\n"
2061 "Do NOT allow emergency calls\n"
2062 "Allow emergency calls\n")
Holger Hans Peter Freyther440984b2010-05-14 00:39:19 +08002063{
2064 struct gsm_bts *bts = vty->index;
2065
2066 if (atoi(argv[0]) == 0)
2067 bts->si_common.rach_control.t2 |= 0x4;
2068 else
2069 bts->si_common.rach_control.t2 &= ~0x4;
2070
2071 return CMD_SUCCESS;
2072}
2073
Ivan Kluchnikov80d58432013-09-16 13:13:04 +04002074DEFUN(cfg_bts_rach_ac_class, cfg_bts_rach_ac_class_cmd,
2075 "rach access-control-class (0|1|2|3|4|5|6|7|8|9|11|12|13|14|15) (barred|allowed)",
2076 RACH_STR
2077 "Set access control class\n"
2078 "Access control class 0\n"
2079 "Access control class 1\n"
2080 "Access control class 2\n"
2081 "Access control class 3\n"
2082 "Access control class 4\n"
2083 "Access control class 5\n"
2084 "Access control class 6\n"
2085 "Access control class 7\n"
2086 "Access control class 8\n"
2087 "Access control class 9\n"
2088 "Access control class 11 for PLMN use\n"
2089 "Access control class 12 for security services\n"
2090 "Access control class 13 for public utilities (e.g. water/gas suppliers)\n"
2091 "Access control class 14 for emergency services\n"
2092 "Access control class 15 for PLMN staff\n"
2093 "barred to use access control class\n"
2094 "allowed to use access control class\n")
2095{
2096 struct gsm_bts *bts = vty->index;
2097
2098 uint8_t control_class;
2099 uint8_t allowed = 0;
2100
2101 if (strcmp(argv[1], "allowed") == 0)
2102 allowed = 1;
2103
2104 control_class = atoi(argv[0]);
2105 if (control_class < 8)
2106 if (allowed)
2107 bts->si_common.rach_control.t3 &= ~(0x1 << control_class);
2108 else
2109 bts->si_common.rach_control.t3 |= (0x1 << control_class);
2110 else
2111 if (allowed)
2112 bts->si_common.rach_control.t2 &= ~(0x1 << (control_class - 8));
2113 else
2114 bts->si_common.rach_control.t2 |= (0x1 << (control_class - 8));
2115
2116 return CMD_SUCCESS;
2117}
2118
Harald Welte (local)cbd46102009-08-13 10:14:26 +02002119DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd,
2120 "ms max power <0-40>",
Harald Welte557f3992012-08-16 23:23:50 +02002121 "MS Options\n"
Harald Weltefa2015f2012-08-17 09:52:03 +02002122 "Maximum transmit power of the MS\n"
2123 "Maximum transmit power of the MS\n"
Harald Welte557f3992012-08-16 23:23:50 +02002124 "Maximum transmit power of the MS in dBm")
Harald Welte (local)cbd46102009-08-13 10:14:26 +02002125{
2126 struct gsm_bts *bts = vty->index;
2127
2128 bts->ms_max_power = atoi(argv[0]);
2129
2130 return CMD_SUCCESS;
2131}
2132
Harald Welte557f3992012-08-16 23:23:50 +02002133#define CELL_STR "Cell Parameters\n"
2134
Harald Welteb761bf82009-12-12 18:17:25 +01002135DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd,
2136 "cell reselection hysteresis <0-14>",
Harald Welte557f3992012-08-16 23:23:50 +02002137 CELL_STR "Cell re-selection parameters\n"
2138 "Cell Re-Selection Hysteresis in dB\n"
Harald Welteb761bf82009-12-12 18:17:25 +01002139 "Cell Re-Selection Hysteresis in dB")
2140{
2141 struct gsm_bts *bts = vty->index;
2142
2143 bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2;
2144
2145 return CMD_SUCCESS;
2146}
2147
2148DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd,
2149 "rxlev access min <0-63>",
Harald Welte557f3992012-08-16 23:23:50 +02002150 "Minimum RxLev needed for cell access\n"
2151 "Minimum RxLev needed for cell access\n"
2152 "Minimum RxLev needed for cell access\n"
Harald Welteb761bf82009-12-12 18:17:25 +01002153 "Minimum RxLev needed for cell access (better than -110dBm)")
2154{
2155 struct gsm_bts *bts = vty->index;
2156
2157 bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]);
2158
2159 return CMD_SUCCESS;
2160}
2161
Sylvain Munaut00d71462010-11-28 18:17:28 +01002162DEFUN(cfg_bts_cell_bar_qualify, cfg_bts_cell_bar_qualify_cmd,
2163 "cell bar qualify (0|1)",
Harald Welte557f3992012-08-16 23:23:50 +02002164 CELL_STR "Cell Bar Qualify\n" "Cell Bar Qualify\n"
2165 "Set CBQ to 0\n" "Set CBQ to 1\n")
Sylvain Munaut00d71462010-11-28 18:17:28 +01002166{
2167 struct gsm_bts *bts = vty->index;
2168
2169 bts->si_common.cell_ro_sel_par.present = 1;
2170 bts->si_common.cell_ro_sel_par.cbq = atoi(argv[0]);
2171
2172 return CMD_SUCCESS;
2173}
2174
2175DEFUN(cfg_bts_cell_resel_ofs, cfg_bts_cell_resel_ofs_cmd,
2176 "cell reselection offset <0-126>",
Harald Welte557f3992012-08-16 23:23:50 +02002177 CELL_STR "Cell Re-Selection Parameters\n"
2178 "Cell Re-Selection Offset (CRO) in dB\n"
2179 "Cell Re-Selection Offset (CRO) in dB\n"
2180 )
Sylvain Munaut00d71462010-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.cell_resel_off = atoi(argv[0])/2;
2186
2187 return CMD_SUCCESS;
2188}
2189
2190DEFUN(cfg_bts_temp_ofs, cfg_bts_temp_ofs_cmd,
2191 "temporary offset <0-60>",
Harald Welte557f3992012-08-16 23:23:50 +02002192 "Cell selection temporary negative offset\n"
2193 "Cell selection temporary negative offset\n"
Sylvain Munaut00d71462010-11-28 18:17:28 +01002194 "Cell selection temporary negative offset in dB")
2195{
2196 struct gsm_bts *bts = vty->index;
2197
2198 bts->si_common.cell_ro_sel_par.present = 1;
2199 bts->si_common.cell_ro_sel_par.temp_offs = atoi(argv[0])/10;
2200
2201 return CMD_SUCCESS;
2202}
2203
2204DEFUN(cfg_bts_temp_ofs_inf, cfg_bts_temp_ofs_inf_cmd,
2205 "temporary offset infinite",
Harald Welte557f3992012-08-16 23:23:50 +02002206 "Cell selection temporary negative offset\n"
2207 "Cell selection temporary negative offset\n"
Sylvain Munaut00d71462010-11-28 18:17:28 +01002208 "Sets cell selection temporary negative offset to infinity")
2209{
2210 struct gsm_bts *bts = vty->index;
2211
2212 bts->si_common.cell_ro_sel_par.present = 1;
2213 bts->si_common.cell_ro_sel_par.temp_offs = 7;
2214
2215 return CMD_SUCCESS;
2216}
2217
2218DEFUN(cfg_bts_penalty_time, cfg_bts_penalty_time_cmd,
2219 "penalty time <20-620>",
Harald Welte557f3992012-08-16 23:23:50 +02002220 "Cell selection penalty time\n"
2221 "Cell selection penalty time\n"
2222 "Cell selection penalty time in seconds (by 20s increments)\n")
Sylvain Munaut00d71462010-11-28 18:17:28 +01002223{
2224 struct gsm_bts *bts = vty->index;
2225
2226 bts->si_common.cell_ro_sel_par.present = 1;
2227 bts->si_common.cell_ro_sel_par.penalty_time = (atoi(argv[0])-20)/20;
2228
2229 return CMD_SUCCESS;
2230}
2231
2232DEFUN(cfg_bts_penalty_time_rsvd, cfg_bts_penalty_time_rsvd_cmd,
2233 "penalty time reserved",
Harald Welte557f3992012-08-16 23:23:50 +02002234 "Cell selection penalty time\n"
2235 "Cell selection penalty time\n"
2236 "Set cell selection penalty time to reserved value 31, "
Sylvain Munaut00d71462010-11-28 18:17:28 +01002237 "(indicate that CELL_RESELECT_OFFSET is subtracted from C2 "
2238 "and TEMPORARY_OFFSET is ignored)")
2239{
2240 struct gsm_bts *bts = vty->index;
2241
2242 bts->si_common.cell_ro_sel_par.present = 1;
2243 bts->si_common.cell_ro_sel_par.penalty_time = 31;
2244
2245 return CMD_SUCCESS;
2246}
2247
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02002248DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd,
Daniel Willmann3e7db9e2012-12-27 00:02:01 +01002249 "periodic location update <6-1530>",
Harald Welte557f3992012-08-16 23:23:50 +02002250 "Periodic Location Updating Interval\n"
2251 "Periodic Location Updating Interval\n"
2252 "Periodic Location Updating Interval\n"
2253 "Periodic Location Updating Interval in Minutes\n")
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02002254{
2255 struct gsm_bts *bts = vty->index;
2256
Dieter Spaarb0f746d2010-10-05 21:10:55 +02002257 bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 6;
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02002258
2259 return CMD_SUCCESS;
2260}
2261
Holger Hans Peter Freyther2fb8ebf2013-07-27 21:07:57 +02002262DEFUN(cfg_bts_no_per_loc_upd, cfg_bts_no_per_loc_upd_cmd,
2263 "no periodic location update",
2264 NO_STR
2265 "Periodic Location Updating Interval\n"
2266 "Periodic Location Updating Interval\n"
2267 "Periodic Location Updating Interval\n")
2268{
2269 struct gsm_bts *bts = vty->index;
2270
2271 bts->si_common.chan_desc.t3212 = 0;
Andreas Eversbergf9248d92013-03-10 11:49:35 +01002272
2273 return CMD_SUCCESS;
2274}
2275
2276DEFUN(cfg_bts_radio_link_timeout, cfg_bts_radio_link_timeout_cmd,
2277 "radio-link-timeout <4-64>",
2278 "Radio link timeout criterion (BTS side)\n"
2279 "Radio link timeout value (lost SACCH block)\n")
2280{
2281 struct gsm_bts *bts = vty->index;
2282
2283 set_radio_link_timeout(&bts->si_common.cell_options, atoi(argv[0]));
2284
Holger Hans Peter Freyther2fb8ebf2013-07-27 21:07:57 +02002285 return CMD_SUCCESS;
2286}
2287
Harald Welte9e002452010-05-11 21:53:49 +02002288#define GPRS_TEXT "GPRS Packet Network\n"
2289
Harald Welte410575a2010-03-14 23:30:30 +08002290DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
Harald Welteb42fe342010-04-18 14:00:26 +02002291 "gprs cell bvci <2-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02002292 GPRS_TEXT
2293 "GPRS Cell Settings\n"
Harald Welte557f3992012-08-16 23:23:50 +02002294 "GPRS BSSGP VC Identifier\n"
Harald Welte3055e332010-03-14 15:37:43 +08002295 "GPRS BSSGP VC Identifier")
2296{
2297 struct gsm_bts *bts = vty->index;
2298
Harald Weltecb20b7a2010-04-18 15:51:20 +02002299 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08002300 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2301 return CMD_WARNING;
2302 }
2303
Harald Welte3055e332010-03-14 15:37:43 +08002304 bts->gprs.cell.bvci = atoi(argv[0]);
2305
2306 return CMD_SUCCESS;
2307}
2308
Harald Welte4a048c52010-03-22 11:48:36 +08002309DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
2310 "gprs nsei <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02002311 GPRS_TEXT
Harald Welte557f3992012-08-16 23:23:50 +02002312 "GPRS NS Entity Identifier\n"
Harald Welte4a048c52010-03-22 11:48:36 +08002313 "GPRS NS Entity Identifier")
2314{
2315 struct gsm_bts *bts = vty->index;
2316
Harald Weltecb20b7a2010-04-18 15:51:20 +02002317 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Welte4a048c52010-03-22 11:48:36 +08002318 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2319 return CMD_WARNING;
2320 }
2321
2322 bts->gprs.nse.nsei = atoi(argv[0]);
2323
2324 return CMD_SUCCESS;
2325}
2326
Harald Welte9e002452010-05-11 21:53:49 +02002327#define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \
2328 "NSVC Logical Number\n"
Harald Welte4a048c52010-03-22 11:48:36 +08002329
Harald Welte3055e332010-03-14 15:37:43 +08002330DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
2331 "gprs nsvc <0-1> nsvci <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02002332 GPRS_TEXT NSVC_TEXT
2333 "NS Virtual Connection Identifier\n"
Harald Welte3055e332010-03-14 15:37:43 +08002334 "GPRS NS VC Identifier")
2335{
2336 struct gsm_bts *bts = vty->index;
2337 int idx = atoi(argv[0]);
2338
Harald Weltecb20b7a2010-04-18 15:51:20 +02002339 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08002340 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2341 return CMD_WARNING;
2342 }
2343
Harald Welte3055e332010-03-14 15:37:43 +08002344 bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
2345
2346 return CMD_SUCCESS;
2347}
2348
Harald Welte410575a2010-03-14 23:30:30 +08002349DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
2350 "gprs nsvc <0-1> local udp port <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02002351 GPRS_TEXT NSVC_TEXT
Harald Welte557f3992012-08-16 23:23:50 +02002352 "GPRS NS Local UDP Port\n"
2353 "GPRS NS Local UDP Port\n"
2354 "GPRS NS Local UDP Port\n"
Harald Welte764c8e12012-08-17 09:57:25 +02002355 "GPRS NS Local UDP Port Number\n")
Harald Welte410575a2010-03-14 23:30:30 +08002356{
2357 struct gsm_bts *bts = vty->index;
2358 int idx = atoi(argv[0]);
2359
Harald Weltecb20b7a2010-04-18 15:51:20 +02002360 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08002361 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2362 return CMD_WARNING;
2363 }
2364
Harald Welte410575a2010-03-14 23:30:30 +08002365 bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
2366
2367 return CMD_SUCCESS;
2368}
2369
2370DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
2371 "gprs nsvc <0-1> remote udp port <0-65535>",
Harald Welte9e002452010-05-11 21:53:49 +02002372 GPRS_TEXT NSVC_TEXT
Harald Welte557f3992012-08-16 23:23:50 +02002373 "GPRS NS Remote UDP Port\n"
2374 "GPRS NS Remote UDP Port\n"
Harald Welte764c8e12012-08-17 09:57:25 +02002375 "GPRS NS Remote UDP Port\n"
2376 "GPRS NS Remote UDP Port Number\n")
Harald Welte410575a2010-03-14 23:30:30 +08002377{
2378 struct gsm_bts *bts = vty->index;
2379 int idx = atoi(argv[0]);
2380
Harald Weltecb20b7a2010-04-18 15:51:20 +02002381 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08002382 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2383 return CMD_WARNING;
2384 }
2385
Harald Welte410575a2010-03-14 23:30:30 +08002386 bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
2387
2388 return CMD_SUCCESS;
2389}
2390
2391DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
2392 "gprs nsvc <0-1> remote ip A.B.C.D",
Harald Welte9e002452010-05-11 21:53:49 +02002393 GPRS_TEXT NSVC_TEXT
Harald Welte557f3992012-08-16 23:23:50 +02002394 "GPRS NS Remote IP Address\n"
2395 "GPRS NS Remote IP Address\n"
2396 "GPRS NS Remote IP Address\n")
Harald Welte410575a2010-03-14 23:30:30 +08002397{
2398 struct gsm_bts *bts = vty->index;
2399 int idx = atoi(argv[0]);
2400 struct in_addr ia;
2401
Harald Weltecb20b7a2010-04-18 15:51:20 +02002402 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08002403 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2404 return CMD_WARNING;
2405 }
2406
Harald Welte410575a2010-03-14 23:30:30 +08002407 inet_aton(argv[1], &ia);
2408 bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
2409
2410 return CMD_SUCCESS;
2411}
2412
Holger Hans Peter Freyther3112f672010-09-06 10:11:25 +08002413DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd,
Harald Welte557f3992012-08-16 23:23:50 +02002414 "paging free <-1-1024>",
2415 "Paging options\n"
2416 "Only page when having a certain amount of free slots\n"
2417 "amount of required free paging slots. -1 to disable\n")
Holger Hans Peter Freyther3112f672010-09-06 10:11:25 +08002418{
2419 struct gsm_bts *bts = vty->index;
2420
2421 bts->paging.free_chans_need = atoi(argv[0]);
2422 return CMD_SUCCESS;
2423}
2424
Harald Weltea9251762010-05-11 23:50:21 +02002425DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd,
2426 "gprs ns timer " NS_TIMERS " <0-255>",
2427 GPRS_TEXT "Network Service\n"
2428 "Network Service Timer\n"
2429 NS_TIMERS_HELP "Timer Value\n")
2430{
2431 struct gsm_bts *bts = vty->index;
2432 int idx = get_string_value(gprs_ns_timer_strs, argv[0]);
2433 int val = atoi(argv[1]);
2434
2435 if (bts->gprs.mode == BTS_GPRS_NONE) {
2436 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2437 return CMD_WARNING;
2438 }
2439
2440 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
2441 return CMD_WARNING;
2442
2443 bts->gprs.nse.timer[idx] = val;
2444
2445 return CMD_SUCCESS;
2446}
2447
2448#define BSSGP_TIMERS "(blocking-timer|blocking-retries|unblocking-retries|reset-timer|reset-retries|suspend-timer|suspend-retries|resume-timer|resume-retries|capability-update-timer|capability-update-retries)"
Harald Welte18ce31c2010-05-14 20:05:17 +02002449#define BSSGP_TIMERS_HELP \
2450 "Tbvc-block timeout\n" \
2451 "Tbvc-block retries\n" \
2452 "Tbvc-unblock retries\n" \
2453 "Tbvcc-reset timeout\n" \
2454 "Tbvc-reset retries\n" \
2455 "Tbvc-suspend timeout\n" \
2456 "Tbvc-suspend retries\n" \
2457 "Tbvc-resume timeout\n" \
2458 "Tbvc-resume retries\n" \
2459 "Tbvc-capa-update timeout\n" \
2460 "Tbvc-capa-update retries\n"
Harald Weltea9251762010-05-11 23:50:21 +02002461
2462DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd,
2463 "gprs cell timer " BSSGP_TIMERS " <0-255>",
2464 GPRS_TEXT "Cell / BSSGP\n"
2465 "Cell/BSSGP Timer\n"
2466 BSSGP_TIMERS_HELP "Timer Value\n")
2467{
2468 struct gsm_bts *bts = vty->index;
2469 int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
2470 int val = atoi(argv[1]);
2471
2472 if (bts->gprs.mode == BTS_GPRS_NONE) {
2473 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2474 return CMD_WARNING;
2475 }
2476
2477 if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer))
2478 return CMD_WARNING;
2479
2480 bts->gprs.cell.timer[idx] = val;
2481
2482 return CMD_SUCCESS;
2483}
2484
Harald Welte3055e332010-03-14 15:37:43 +08002485DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
2486 "gprs routing area <0-255>",
Harald Welte9e002452010-05-11 21:53:49 +02002487 GPRS_TEXT
Harald Welte557f3992012-08-16 23:23:50 +02002488 "GPRS Routing Area Code\n"
2489 "GPRS Routing Area Code\n"
2490 "GPRS Routing Area Code\n")
Harald Welte3055e332010-03-14 15:37:43 +08002491{
2492 struct gsm_bts *bts = vty->index;
2493
Harald Weltecb20b7a2010-04-18 15:51:20 +02002494 if (bts->gprs.mode == BTS_GPRS_NONE) {
Harald Weltec05a4b12010-03-14 23:56:56 +08002495 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2496 return CMD_WARNING;
2497 }
2498
Harald Welte3055e332010-03-14 15:37:43 +08002499 bts->gprs.rac = atoi(argv[0]);
2500
2501 return CMD_SUCCESS;
2502}
2503
Max88bdcd42016-07-28 11:55:37 +02002504DEFUN(cfg_bts_gprs_ctrl_ack, cfg_bts_gprs_ctrl_ack_cmd,
2505 "gprs control-ack-type-rach", GPRS_TEXT
2506 "Set GPRS Control Ack Type for PACKET CONTROL ACKNOWLEDGMENT message to "
2507 "four access bursts format instead of default RLC/MAC control block\n")
2508{
2509 struct gsm_bts *bts = vty->index;
2510
2511 if (bts->gprs.mode == BTS_GPRS_NONE) {
2512 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2513 return CMD_WARNING;
2514 }
2515
2516 bts->gprs.ctrl_ack_type_use_block = false;
2517
2518 return CMD_SUCCESS;
2519}
2520
2521DEFUN(cfg_no_bts_gprs_ctrl_ack, cfg_no_bts_gprs_ctrl_ack_cmd,
2522 "no gprs control-ack-type-rach", NO_STR GPRS_TEXT
2523 "Set GPRS Control Ack Type for PACKET CONTROL ACKNOWLEDGMENT message to "
2524 "four access bursts format instead of default RLC/MAC control block\n")
2525{
2526 struct gsm_bts *bts = vty->index;
2527
2528 if (bts->gprs.mode == BTS_GPRS_NONE) {
2529 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2530 return CMD_WARNING;
2531 }
2532
2533 bts->gprs.ctrl_ack_type_use_block = true;
2534
2535 return CMD_SUCCESS;
2536}
2537
Andreas Eversberga4fa21c2013-03-16 16:31:26 +01002538DEFUN(cfg_bts_gprs_net_ctrl_ord, cfg_bts_gprs_net_ctrl_ord_cmd,
2539 "gprs network-control-order (nc0|nc1|nc2)",
2540 GPRS_TEXT
2541 "GPRS Network Control Order\n"
2542 "MS controlled cell re-selection, no measurement reporting\n"
2543 "MS controlled cell re-selection, MS sends measurement reports\n"
2544 "Network controlled cell re-selection, MS sends measurement reports\n")
2545{
2546 struct gsm_bts *bts = vty->index;
2547
2548 if (bts->gprs.mode == BTS_GPRS_NONE) {
2549 vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
2550 return CMD_WARNING;
2551 }
2552
2553 bts->gprs.net_ctrl_ord = atoi(argv[0] + 2);
2554
2555 return CMD_SUCCESS;
2556}
2557
Harald Weltecb20b7a2010-04-18 15:51:20 +02002558DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
2559 "gprs mode (none|gprs|egprs)",
Harald Welte9e002452010-05-11 21:53:49 +02002560 GPRS_TEXT
2561 "GPRS Mode for this BTS\n"
2562 "GPRS Disabled on this BTS\n"
2563 "GPRS Enabled on this BTS\n"
2564 "EGPRS (EDGE) Enabled on this BTS\n")
Harald Welte410575a2010-03-14 23:30:30 +08002565{
2566 struct gsm_bts *bts = vty->index;
Holger Hans Peter Freyther611f7752015-01-31 22:16:00 +01002567 enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0], NULL);
Harald Welte410575a2010-03-14 23:30:30 +08002568
Holger Hans Peter Freyther611f7752015-01-31 22:16:00 +01002569 if (!bts_gprs_mode_is_compat(bts, mode)) {
Harald Welte20e275a2010-06-14 22:44:42 +02002570 vty_out(vty, "This BTS type does not support %s%s", argv[0],
2571 VTY_NEWLINE);
2572 return CMD_WARNING;
2573 }
2574
2575 bts->gprs.mode = mode;
Harald Welte410575a2010-03-14 23:30:30 +08002576
2577 return CMD_SUCCESS;
2578}
2579
bhargava612722c2016-07-21 11:14:34 +05302580DEFUN(cfg_bts_gprs_11bit_rach_support_for_egprs,
2581 cfg_bts_gprs_11bit_rach_support_for_egprs_cmd,
2582 "gprs 11bit_rach_support_for_egprs (0|1)",
2583 GPRS_TEXT "11 bit RACH options\n"
2584 "Disable 11 bit RACH for EGPRS\n"
2585 "Enable 11 bit RACH for EGPRS")
2586{
2587 struct gsm_bts *bts = vty->index;
2588
2589 bts->gprs.supports_egprs_11bit_rach = atoi(argv[0]);
2590
2591 if (bts->gprs.supports_egprs_11bit_rach > 1) {
2592 vty_out(vty, "Error in RACH type%s", VTY_NEWLINE);
2593 return CMD_WARNING;
2594 }
2595
2596 if ((bts->gprs.mode == BTS_GPRS_NONE) &&
2597 (bts->gprs.supports_egprs_11bit_rach == 1)) {
2598 vty_out(vty, "Error:gprs mode is none and 11bit rach is"
2599 " enabled%s", VTY_NEWLINE);
2600 return CMD_WARNING;
2601 }
2602
2603 return CMD_SUCCESS;
2604}
2605
Harald Welted8acf142010-07-30 11:50:09 +02002606#define SI_TEXT "System Information Messages\n"
2607#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)"
2608#define SI_TYPE_HELP "System Information Type 1\n" \
2609 "System Information Type 2\n" \
2610 "System Information Type 3\n" \
2611 "System Information Type 4\n" \
2612 "System Information Type 5\n" \
2613 "System Information Type 6\n" \
2614 "System Information Type 7\n" \
2615 "System Information Type 8\n" \
2616 "System Information Type 9\n" \
2617 "System Information Type 10\n" \
2618 "System Information Type 13\n" \
2619 "System Information Type 16\n" \
2620 "System Information Type 17\n" \
2621 "System Information Type 18\n" \
2622 "System Information Type 19\n" \
2623 "System Information Type 20\n" \
2624 "System Information Type 2bis\n" \
2625 "System Information Type 2ter\n" \
2626 "System Information Type 2quater\n" \
2627 "System Information Type 5bis\n" \
2628 "System Information Type 5ter\n"
2629
2630DEFUN(cfg_bts_si_mode, cfg_bts_si_mode_cmd,
2631 "system-information " SI_TYPE_TEXT " mode (static|computed)",
2632 SI_TEXT SI_TYPE_HELP
2633 "System Information Mode\n"
2634 "Static user-specified\n"
2635 "Dynamic, BSC-computed\n")
2636{
2637 struct gsm_bts *bts = vty->index;
2638 int type;
2639
2640 type = get_string_value(osmo_sitype_strs, argv[0]);
2641 if (type < 0) {
2642 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2643 return CMD_WARNING;
2644 }
2645
2646 if (!strcmp(argv[1], "static"))
2647 bts->si_mode_static |= (1 << type);
2648 else
2649 bts->si_mode_static &= ~(1 << type);
2650
2651 return CMD_SUCCESS;
2652}
2653
2654DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd,
2655 "system-information " SI_TYPE_TEXT " static HEXSTRING",
2656 SI_TEXT SI_TYPE_HELP
2657 "Static System Information filling\n"
2658 "Static user-specified SI content in HEX notation\n")
2659{
2660 struct gsm_bts *bts = vty->index;
2661 int rc, type;
2662
2663 type = get_string_value(osmo_sitype_strs, argv[0]);
2664 if (type < 0) {
2665 vty_out(vty, "Error SI Type%s", VTY_NEWLINE);
2666 return CMD_WARNING;
2667 }
2668
2669 if (!(bts->si_mode_static & (1 << type))) {
2670 vty_out(vty, "SI Type %s is not configured in static mode%s",
2671 get_value_string(osmo_sitype_strs, type), VTY_NEWLINE);
2672 return CMD_WARNING;
2673 }
2674
Harald Welte9f09ac32010-07-30 11:53:18 +02002675 /* Fill buffer with padding pattern */
2676 memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type]));
2677
2678 /* Parse the user-specified SI in hex format, [partially] overwriting padding */
Pablo Neira Ayusob1d5a692011-05-07 12:12:48 +02002679 rc = osmo_hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0]));
Harald Welted8acf142010-07-30 11:50:09 +02002680 if (rc < 0 || rc > sizeof(bts->si_buf[0])) {
2681 vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
2682 return CMD_WARNING;
2683 }
2684
2685 /* Mark this SI as present */
2686 bts->si_valid |= (1 << type);
2687
2688 return CMD_SUCCESS;
2689}
2690
Harald Welte44ccb0d2017-01-13 00:10:32 +01002691DEFUN(cfg_bts_early_cm, cfg_bts_early_cm_cmd,
2692 "early-classmark-sending (allowed|forbidden)",
2693 "Early Classmark Sending\n"
2694 "Early Classmark Sending is allowed\n"
2695 "Early Classmark Sending is forbidden\n")
2696{
2697 struct gsm_bts *bts = vty->index;
Harald Welte44ccb0d2017-01-13 00:10:32 +01002698
2699 if (!strcmp(argv[0], "allowed"))
2700 bts->early_classmark_allowed = true;
2701 else
2702 bts->early_classmark_allowed = false;
2703
2704 return CMD_SUCCESS;
2705}
2706
Harald Welteca46eff2011-01-11 23:44:56 +01002707DEFUN(cfg_bts_neigh_mode, cfg_bts_neigh_mode_cmd,
Harald Weltef989b782011-02-15 11:43:27 +01002708 "neighbor-list mode (automatic|manual|manual-si5)",
Harald Welteca46eff2011-01-11 23:44:56 +01002709 "Neighbor List\n" "Mode of Neighbor List generation\n"
Harald Weltef989b782011-02-15 11:43:27 +01002710 "Automatically from all BTS in this OpenBSC\n" "Manual\n"
2711 "Manual with different lists for SI2 and SI5\n")
Harald Welteca46eff2011-01-11 23:44:56 +01002712{
2713 struct gsm_bts *bts = vty->index;
Harald Weltef989b782011-02-15 11:43:27 +01002714 int mode = get_string_value(bts_neigh_mode_strs, argv[0]);
Harald Welteca46eff2011-01-11 23:44:56 +01002715
Harald Weltef989b782011-02-15 11:43:27 +01002716 switch (mode) {
2717 case NL_MODE_MANUAL_SI5SEP:
2718 case NL_MODE_MANUAL:
Harald Welteca46eff2011-01-11 23:44:56 +01002719 /* make sure we clear the current list when switching to
2720 * manual mode */
2721 if (bts->neigh_list_manual_mode == 0)
2722 memset(&bts->si_common.data.neigh_list, 0,
2723 sizeof(bts->si_common.data.neigh_list));
Harald Weltef989b782011-02-15 11:43:27 +01002724 break;
2725 default:
2726 break;
2727 }
2728
2729 bts->neigh_list_manual_mode = mode;
Harald Welteca46eff2011-01-11 23:44:56 +01002730
2731 return CMD_SUCCESS;
2732}
2733
2734DEFUN(cfg_bts_neigh, cfg_bts_neigh_cmd,
Harald Welte09e4fad2012-01-29 13:24:12 +01002735 "neighbor-list (add|del) arfcn <0-1023>",
Harald Welteca46eff2011-01-11 23:44:56 +01002736 "Neighbor List\n" "Add to manual neighbor list\n"
2737 "Delete from manual neighbor list\n" "ARFCN of neighbor\n"
2738 "ARFCN of neighbor\n")
2739{
2740 struct gsm_bts *bts = vty->index;
2741 struct bitvec *bv = &bts->si_common.neigh_list;
2742 uint16_t arfcn = atoi(argv[1]);
2743
2744 if (!bts->neigh_list_manual_mode) {
2745 vty_out(vty, "%% Cannot configure neighbor list in "
2746 "automatic mode%s", VTY_NEWLINE);
2747 return CMD_WARNING;
2748 }
2749
2750 if (!strcmp(argv[0], "add"))
2751 bitvec_set_bit_pos(bv, arfcn, 1);
2752 else
2753 bitvec_set_bit_pos(bv, arfcn, 0);
2754
2755 return CMD_SUCCESS;
2756}
2757
Max88ddcaa2016-04-15 16:04:46 +02002758DEFUN(cfg_bts_si2quater_neigh_add, cfg_bts_si2quater_neigh_add_cmd,
Maxeee605b2017-02-15 13:51:37 +01002759 "si2quater neighbor-list add earfcn <0-65535> thresh-hi <0-31> "
2760 "thresh-lo <0-32> prio <0-8> qrxlv <0-32> meas <0-8>",
2761 "SI2quater Neighbor List\n" "SI2quater Neighbor List\n"
2762 "Add to manual SI2quater neighbor list\n"
2763 "EARFCN of neighbor\n" "EARFCN of neighbor\n"
2764 "threshold high bits\n" "threshold high bits\n"
2765 "threshold low bits\n" "threshold low bits (32 means NA)\n"
2766 "priority\n" "priority (8 means NA)\n"
2767 "QRXLEVMIN\n" "QRXLEVMIN (32 means NA)\n"
2768 "measurement bandwidth\n" "measurement bandwidth (8 means NA)\n")
Max88ddcaa2016-04-15 16:04:46 +02002769{
2770 struct gsm_bts *bts = vty->index;
2771 struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list;
2772 uint16_t arfcn = atoi(argv[0]);
Maxeee605b2017-02-15 13:51:37 +01002773 uint8_t thresh_hi = atoi(argv[1]), thresh_lo = atoi(argv[2]),
2774 prio = atoi(argv[3]), qrx = atoi(argv[4]), meas = atoi(argv[5]);
2775 int r = osmo_earfcn_add(e, arfcn,
2776 (meas < 8) ? meas : OSMO_EARFCN_MEAS_INVALID);
Max88ddcaa2016-04-15 16:04:46 +02002777
2778 if (r < 0) {
Maxeee605b2017-02-15 13:51:37 +01002779 vty_out(vty, "Unable to add ARFCN %u: %s%s", arfcn, strerror(-r),
Max88ddcaa2016-04-15 16:04:46 +02002780 VTY_NEWLINE);
2781 return CMD_WARNING;
2782 }
2783
Maxeee605b2017-02-15 13:51:37 +01002784 if (e->thresh_hi && thresh_hi != e->thresh_hi)
2785 vty_out(vty, "Warning: multiple threshold-high are not "
2786 "supported, overriding previous threshold %u%s",
2787 e->thresh_hi, VTY_NEWLINE);
2788
2789 e->thresh_hi = thresh_hi;
2790
2791 if (thresh_lo != 32) {
2792 if (e->thresh_lo_valid && e->thresh_lo != thresh_lo)
2793 vty_out(vty, "Warning: multiple threshold-low are not "
2794 "supported, overriding previous threshold %u%s",
2795 e->thresh_lo, VTY_NEWLINE);
2796 e->thresh_lo = thresh_lo;
2797 e->thresh_lo_valid = true;
Maxcc0e5002016-04-20 15:57:14 +02002798 }
Maxeee605b2017-02-15 13:51:37 +01002799
2800 if (qrx != 32) {
2801 if (e->qrxlm_valid && e->qrxlm != qrx)
2802 vty_out(vty, "Warning: multiple QRXLEVMIN are not "
2803 "supported, overriding previous value %u%s",
2804 e->qrxlm, VTY_NEWLINE);
2805 e->qrxlm = qrx;
2806 e->qrxlm_valid = true;
2807 }
2808
2809 if (prio != 8) {
2810 if (e->prio_valid && e->prio != prio)
2811 vty_out(vty, "Warning: multiple priorities are not "
2812 "supported, overriding previous value %u%s",
2813 e->prio, VTY_NEWLINE);
2814 e->prio = prio;
2815 e->prio_valid = true;
2816 }
2817
2818 if (si2q_size_check(bts))
2819 return CMD_SUCCESS;
2820
2821 vty_out(vty, "Warning: not enough space in SI2quater for a given EARFCN "
2822 "%u%s", arfcn, VTY_NEWLINE);
Maxcc0e5002016-04-20 15:57:14 +02002823 osmo_earfcn_del(e, arfcn);
Maxeee605b2017-02-15 13:51:37 +01002824
Maxcc0e5002016-04-20 15:57:14 +02002825 return CMD_WARNING;
Max88ddcaa2016-04-15 16:04:46 +02002826}
2827
2828DEFUN(cfg_bts_si2quater_neigh_del, cfg_bts_si2quater_neigh_del_cmd,
Max33220d02016-04-29 12:51:31 +02002829 "si2quater neighbor-list del earfcn <0-65535>",
Max88ddcaa2016-04-15 16:04:46 +02002830 "SI2quater Neighbor List\n"
2831 "SI2quater Neighbor List\n"
2832 "Delete from SI2quater manual neighbor list\n"
Max303753e2016-04-20 12:06:05 +02002833 "EARFCN of neighbor\n"
2834 "EARFCN\n")
Max88ddcaa2016-04-15 16:04:46 +02002835{
2836 struct gsm_bts *bts = vty->index;
2837 struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list;
Max2befab12016-04-20 12:06:06 +02002838 uint16_t arfcn = atoi(argv[0]);
Max88ddcaa2016-04-15 16:04:46 +02002839 int r = osmo_earfcn_del(e, arfcn);
2840 if (r < 0) {
2841 vty_out(vty, "Unable to delete arfcn %u: %s%s", arfcn,
Max2befab12016-04-20 12:06:06 +02002842 strerror(-r), VTY_NEWLINE);
Max88ddcaa2016-04-15 16:04:46 +02002843 return CMD_WARNING;
2844 }
2845
2846 return CMD_SUCCESS;
2847}
2848
Maxeaf196c2016-04-20 15:57:13 +02002849DEFUN(cfg_bts_si2quater_uarfcn_add, cfg_bts_si2quater_uarfcn_add_cmd,
Max33220d02016-04-29 12:51:31 +02002850 "si2quater neighbor-list add uarfcn <0-16383> <0-511> <0-1>",
Maxeaf196c2016-04-20 15:57:13 +02002851 "SI2quater Neighbor List\n"
2852 "SI2quater Neighbor List\n" "Add to manual SI2quater neighbor list\n"
2853 "UARFCN of neighbor\n" "UARFCN of neighbor\n" "scrambling code\n"
2854 "diversity bit\n")
2855{
2856 struct gsm_bts *bts = vty->index;
2857 uint16_t arfcn = atoi(argv[0]), scramble = atoi(argv[1]);
2858
2859 switch(bts_uarfcn_add(bts, arfcn, scramble, atoi(argv[2]))) {
2860 case -ENOMEM:
2861 vty_out(vty, "Unable to add arfcn: max number of UARFCNs (%u) "
2862 "reached%s", MAX_EARFCN_LIST, VTY_NEWLINE);
Harald Welte365b2302016-11-26 15:06:37 +01002863 return CMD_WARNING;
Maxcc0e5002016-04-20 15:57:14 +02002864 case -ENOSPC:
2865 vty_out(vty, "Warning: not enough space in si2quater for a "
2866 "given arfcn%s", VTY_NEWLINE);
Harald Welte365b2302016-11-26 15:06:37 +01002867 return CMD_WARNING;
Maxeaf196c2016-04-20 15:57:13 +02002868 case -EADDRINUSE:
2869 vty_out(vty, "Unable to add arfcn: (%u, %u) is already added%s",
2870 arfcn, scramble, VTY_NEWLINE);
2871 return CMD_WARNING;
2872 }
2873
2874 return CMD_SUCCESS;
2875}
2876
2877DEFUN(cfg_bts_si2quater_uarfcn_del, cfg_bts_si2quater_uarfcn_del_cmd,
Max33220d02016-04-29 12:51:31 +02002878 "si2quater neighbor-list del uarfcn <0-16383> <0-511>",
Maxeaf196c2016-04-20 15:57:13 +02002879 "SI2quater Neighbor List\n"
2880 "SI2quater Neighbor List\n"
2881 "Delete from SI2quater manual neighbor list\n"
2882 "UARFCN of neighbor\n"
2883 "UARFCN\n"
2884 "scrambling code\n")
2885{
2886 struct gsm_bts *bts = vty->index;
2887
2888 if (bts_uarfcn_del(bts, atoi(argv[0]), atoi(argv[1])) < 0) {
2889 vty_out(vty, "Unable to delete uarfcn: pair not found%s",
2890 VTY_NEWLINE);
2891 return CMD_WARNING;
2892 }
2893
2894 return CMD_SUCCESS;
2895}
2896
Harald Weltef989b782011-02-15 11:43:27 +01002897DEFUN(cfg_bts_si5_neigh, cfg_bts_si5_neigh_cmd,
Harald Welte09e4fad2012-01-29 13:24:12 +01002898 "si5 neighbor-list (add|del) arfcn <0-1023>",
Harald Welte557f3992012-08-16 23:23:50 +02002899 "SI5 Neighbor List\n"
Harald Weltef989b782011-02-15 11:43:27 +01002900 "SI5 Neighbor List\n" "Add to manual SI5 neighbor list\n"
2901 "Delete from SI5 manual neighbor list\n" "ARFCN of neighbor\n"
2902 "ARFCN of neighbor\n")
2903{
2904 struct gsm_bts *bts = vty->index;
2905 struct bitvec *bv = &bts->si_common.si5_neigh_list;
2906 uint16_t arfcn = atoi(argv[1]);
2907
2908 if (!bts->neigh_list_manual_mode) {
2909 vty_out(vty, "%% Cannot configure neighbor list in "
2910 "automatic mode%s", VTY_NEWLINE);
2911 return CMD_WARNING;
2912 }
2913
2914 if (!strcmp(argv[0], "add"))
2915 bitvec_set_bit_pos(bv, arfcn, 1);
2916 else
2917 bitvec_set_bit_pos(bv, arfcn, 0);
2918
2919 return CMD_SUCCESS;
2920}
Harald Welted8acf142010-07-30 11:50:09 +02002921
Holger Hans Peter Freyther10799162012-07-20 10:27:31 +02002922#define EXCL_RFLOCK_STR "Exclude this BTS from the global RF Lock\n"
2923
2924DEFUN(cfg_bts_excl_rf_lock,
2925 cfg_bts_excl_rf_lock_cmd,
2926 "rf-lock-exclude",
2927 EXCL_RFLOCK_STR)
2928{
2929 struct gsm_bts *bts = vty->index;
2930 bts->excl_from_rf_lock = 1;
2931 return CMD_SUCCESS;
2932}
2933
2934DEFUN(cfg_bts_no_excl_rf_lock,
2935 cfg_bts_no_excl_rf_lock_cmd,
2936 "no rf-lock-exclude",
2937 NO_STR EXCL_RFLOCK_STR)
2938{
2939 struct gsm_bts *bts = vty->index;
2940 bts->excl_from_rf_lock = 0;
2941 return CMD_SUCCESS;
2942}
2943
Jacob Erlbeck8f8e5bf2014-01-16 11:02:14 +01002944#define FORCE_COMB_SI_STR "Force the generation of a single SI (no ter/bis)\n"
2945
2946DEFUN(cfg_bts_force_comb_si,
2947 cfg_bts_force_comb_si_cmd,
2948 "force-combined-si",
2949 FORCE_COMB_SI_STR)
2950{
2951 struct gsm_bts *bts = vty->index;
2952 bts->force_combined_si = 1;
2953 return CMD_SUCCESS;
2954}
2955
2956DEFUN(cfg_bts_no_force_comb_si,
2957 cfg_bts_no_force_comb_si_cmd,
2958 "no force-combined-si",
2959 NO_STR FORCE_COMB_SI_STR)
2960{
2961 struct gsm_bts *bts = vty->index;
2962 bts->force_combined_si = 0;
2963 return CMD_SUCCESS;
2964}
2965
Andreas Eversberg976493b2013-12-07 18:32:28 +01002966static void _get_codec_from_arg(struct vty *vty, int argc, const char *argv[])
2967{
2968 struct gsm_bts *bts = vty->index;
2969 struct bts_codec_conf *codec = &bts->codec;
2970 int i;
2971
2972 codec->hr = 0;
2973 codec->efr = 0;
2974 codec->amr = 0;
2975 for (i = 0; i < argc; i++) {
2976 if (!strcmp(argv[i], "hr"))
2977 codec->hr = 1;
2978 if (!strcmp(argv[i], "efr"))
2979 codec->efr = 1;
2980 if (!strcmp(argv[i], "amr"))
2981 codec->amr = 1;
2982 }
2983}
2984
2985#define CODEC_PAR_STR " (hr|efr|amr)"
2986#define CODEC_HELP_STR "Half Rate\n" \
2987 "Enhanced Full Rate\nAdaptive Multirate\n"
2988
2989DEFUN(cfg_bts_codec0, cfg_bts_codec0_cmd,
2990 "codec-support fr",
2991 "Codec Support settings\nFullrate\n")
2992{
2993 _get_codec_from_arg(vty, 0, argv);
2994 return CMD_SUCCESS;
2995}
2996
2997DEFUN(cfg_bts_codec1, cfg_bts_codec1_cmd,
2998 "codec-support fr" CODEC_PAR_STR,
2999 "Codec Support settings\nFullrate\n"
3000 CODEC_HELP_STR)
3001{
3002 _get_codec_from_arg(vty, 1, argv);
3003 return CMD_SUCCESS;
3004}
3005
3006DEFUN(cfg_bts_codec2, cfg_bts_codec2_cmd,
3007 "codec-support fr" CODEC_PAR_STR CODEC_PAR_STR,
3008 "Codec Support settings\nFullrate\n"
3009 CODEC_HELP_STR CODEC_HELP_STR)
3010{
3011 _get_codec_from_arg(vty, 2, argv);
3012 return CMD_SUCCESS;
3013}
3014
3015DEFUN(cfg_bts_codec3, cfg_bts_codec3_cmd,
3016 "codec-support fr" CODEC_PAR_STR CODEC_PAR_STR CODEC_PAR_STR,
3017 "Codec Support settings\nFullrate\n"
3018 CODEC_HELP_STR CODEC_HELP_STR CODEC_HELP_STR)
3019{
3020 _get_codec_from_arg(vty, 3, argv);
3021 return CMD_SUCCESS;
3022}
3023
3024DEFUN(cfg_bts_codec4, cfg_bts_codec4_cmd,
3025 "codec-support fr" CODEC_PAR_STR CODEC_PAR_STR CODEC_PAR_STR CODEC_PAR_STR,
3026 "Codec Support settings\nFullrate\n"
3027 CODEC_HELP_STR CODEC_HELP_STR CODEC_HELP_STR CODEC_HELP_STR)
3028{
3029 _get_codec_from_arg(vty, 4, argv);
3030 return CMD_SUCCESS;
3031}
3032
Holger Hans Peter Freyther15152612014-12-17 14:46:17 +01003033DEFUN(cfg_bts_depends_on, cfg_bts_depends_on_cmd,
3034 "depends-on-bts <0-255>",
3035 "This BTS can only be started if another one is up\n" "BTS Number\n")
3036{
3037 struct gsm_bts *bts = vty->index;
3038 struct gsm_bts *other_bts;
3039 int dep = atoi(argv[0]);
3040
3041
3042 if (!is_ipaccess_bts(bts)) {
3043 vty_out(vty, "This feature is only available for IP systems.%s",
3044 VTY_NEWLINE);
3045 return CMD_WARNING;
3046 }
3047
3048 other_bts = gsm_bts_num(bts->network, dep);
3049 if (!other_bts || !is_ipaccess_bts(other_bts)) {
3050 vty_out(vty, "This feature is only available for IP systems.%s",
3051 VTY_NEWLINE);
3052 return CMD_WARNING;
3053 }
3054
3055 if (dep >= bts->nr) {
3056 vty_out(vty, "%%Need to depend on an already declared unit.%s",
3057 VTY_NEWLINE);
3058 return CMD_WARNING;
3059 }
3060
3061 bts_depend_mark(bts, dep);
3062 return CMD_SUCCESS;
3063}
3064
3065DEFUN(cfg_bts_no_depends_on, cfg_bts_no_depends_on_cmd,
3066 "depeneds-on-bts <0-255>",
3067 NO_STR "This BTS can only be started if another one is up\n"
3068 "BTS Number\n")
3069{
3070 struct gsm_bts *bts = vty->index;
3071 int dep = atoi(argv[0]);
3072
3073 bts_depend_clear(bts, dep);
3074 return CMD_SUCCESS;
3075}
3076
Andreas Eversbergfa163e82014-01-19 11:47:44 +01003077#define AMR_TEXT "Adaptive Multi Rate settings\n"
3078#define AMR_MODE_TEXT "Codec modes to use with AMR codec\n"
3079#define AMR_START_TEXT "Initial codec to use with AMR\n" \
3080 "Automatically\nFirst codec\nSecond codec\nThird codec\nFourth codec\n"
3081#define AMR_TH_TEXT "AMR threshold between codecs\nMS side\nBTS side\n"
3082#define AMR_HY_TEXT "AMR hysteresis between codecs\nMS side\nBTS side\n"
3083
3084static void get_amr_from_arg(struct vty *vty, int argc, const char *argv[], int full)
3085{
3086 struct gsm_bts *bts = vty->index;
3087 struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half;
3088 struct gsm48_multi_rate_conf *mr_conf =
3089 (struct gsm48_multi_rate_conf *) mr->gsm48_ie;
3090 int i;
3091
3092 mr->gsm48_ie[1] = 0;
3093 for (i = 0; i < argc; i++)
3094 mr->gsm48_ie[1] |= 1 << atoi(argv[i]);
3095 mr_conf->icmi = 0;
3096}
3097
3098static void get_amr_th_from_arg(struct vty *vty, int argc, const char *argv[], int full)
3099{
3100 struct gsm_bts *bts = vty->index;
3101 struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half;
Holger Hans Peter Freyther8083cc92015-09-24 11:39:38 +02003102 struct amr_mode *modes;
Andreas Eversbergfa163e82014-01-19 11:47:44 +01003103 int i;
3104
Holger Hans Peter Freyther8083cc92015-09-24 11:39:38 +02003105 modes = argv[0][0]=='m' ? mr->ms_mode : mr->bts_mode;
3106 for (i = 0; i < argc - 1; i++)
3107 modes[i].threshold = atoi(argv[i + 1]);
Andreas Eversbergfa163e82014-01-19 11:47:44 +01003108}
3109
3110static void get_amr_hy_from_arg(struct vty *vty, int argc, const char *argv[], int full)
3111{
3112 struct gsm_bts *bts = vty->index;
3113 struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half;
Holger Hans Peter Freyther8083cc92015-09-24 11:39:38 +02003114 struct amr_mode *modes;
Andreas Eversbergfa163e82014-01-19 11:47:44 +01003115 int i;
3116
Holger Hans Peter Freyther8083cc92015-09-24 11:39:38 +02003117 modes = argv[0][0]=='m' ? mr->ms_mode : mr->bts_mode;
3118 for (i = 0; i < argc - 1; i++)
3119 modes[i].hysteresis = atoi(argv[i + 1]);
Andreas Eversbergfa163e82014-01-19 11:47:44 +01003120}
3121
3122static void get_amr_start_from_arg(struct vty *vty, const char *argv[], int full)
3123{
3124 struct gsm_bts *bts = vty->index;
3125 struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half;
3126 struct gsm48_multi_rate_conf *mr_conf =
3127 (struct gsm48_multi_rate_conf *) mr->gsm48_ie;
3128 int num = 0, i;
3129
3130 for (i = 0; i < ((full) ? 8 : 6); i++) {
3131 if ((mr->gsm48_ie[1] & (1 << i))) {
3132 num++;
3133 }
3134 }
3135
3136 if (argv[0][0] == 'a' || num == 0)
3137 mr_conf->icmi = 0;
3138 else {
3139 mr_conf->icmi = 1;
3140 if (num < atoi(argv[0]))
3141 mr_conf->smod = num - 1;
3142 else
3143 mr_conf->smod = atoi(argv[0]) - 1;
3144 }
3145}
3146
3147#define AMR_TCHF_PAR_STR " (0|1|2|3|4|5|6|7)"
3148#define AMR_TCHF_HELP_STR "4,75k\n5,15k\n5,90k\n6,70k\n7,40k\n7,95k\n" \
3149 "10,2k\n12,2k\n"
3150
3151#define AMR_TCHH_PAR_STR " (0|1|2|3|4|5)"
3152#define AMR_TCHH_HELP_STR "4,75k\n5,15k\n5,90k\n6,70k\n7,40k\n7,95k\n"
3153
3154#define AMR_TH_HELP_STR "Threshold between codec 1 and 2\n"
3155#define AMR_HY_HELP_STR "Hysteresis between codec 1 and 2\n"
3156
3157DEFUN(cfg_bts_amr_fr_modes1, cfg_bts_amr_fr_modes1_cmd,
3158 "amr tch-f modes" AMR_TCHF_PAR_STR,
3159 AMR_TEXT "Full Rate\n" AMR_MODE_TEXT
3160 AMR_TCHF_HELP_STR)
3161{
3162 get_amr_from_arg(vty, 1, argv, 1);
3163 return CMD_SUCCESS;
3164}
3165
3166DEFUN(cfg_bts_amr_fr_modes2, cfg_bts_amr_fr_modes2_cmd,
3167 "amr tch-f modes" AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR,
3168 AMR_TEXT "Full Rate\n" AMR_MODE_TEXT
3169 AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR)
3170{
3171 get_amr_from_arg(vty, 2, argv, 1);
3172 return CMD_SUCCESS;
3173}
3174
3175DEFUN(cfg_bts_amr_fr_modes3, cfg_bts_amr_fr_modes3_cmd,
3176 "amr tch-f modes" AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR,
3177 AMR_TEXT "Full Rate\n" AMR_MODE_TEXT
3178 AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR)
3179{
3180 get_amr_from_arg(vty, 3, argv, 1);
3181 return CMD_SUCCESS;
3182}
3183
3184DEFUN(cfg_bts_amr_fr_modes4, cfg_bts_amr_fr_modes4_cmd,
3185 "amr tch-f modes" AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR,
3186 AMR_TEXT "Full Rate\n" AMR_MODE_TEXT
3187 AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR)
3188{
3189 get_amr_from_arg(vty, 4, argv, 1);
3190 return CMD_SUCCESS;
3191}
3192
3193DEFUN(cfg_bts_amr_fr_start_mode, cfg_bts_amr_fr_start_mode_cmd,
3194 "amr tch-f start-mode (auto|1|2|3|4)",
3195 AMR_TEXT "Full Rate\n" AMR_START_TEXT)
3196{
3197 get_amr_start_from_arg(vty, argv, 1);
3198 return CMD_SUCCESS;
3199}
3200
3201DEFUN(cfg_bts_amr_fr_thres1, cfg_bts_amr_fr_thres1_cmd,
3202 "amr tch-f threshold (ms|bts) <0-63>",
3203 AMR_TEXT "Full Rate\n" AMR_TH_TEXT
3204 AMR_TH_HELP_STR)
3205{
3206 get_amr_th_from_arg(vty, 2, argv, 1);
3207 return CMD_SUCCESS;
3208}
3209
3210DEFUN(cfg_bts_amr_fr_thres2, cfg_bts_amr_fr_thres2_cmd,
3211 "amr tch-f threshold (ms|bts) <0-63> <0-63>",
3212 AMR_TEXT "Full Rate\n" AMR_TH_TEXT
3213 AMR_TH_HELP_STR AMR_TH_HELP_STR)
3214{
3215 get_amr_th_from_arg(vty, 3, argv, 1);
3216 return CMD_SUCCESS;
3217}
3218
3219DEFUN(cfg_bts_amr_fr_thres3, cfg_bts_amr_fr_thres3_cmd,
3220 "amr tch-f threshold (ms|bts) <0-63> <0-63> <0-63>",
3221 AMR_TEXT "Full Rate\n" AMR_TH_TEXT
3222 AMR_TH_HELP_STR AMR_TH_HELP_STR AMR_TH_HELP_STR)
3223{
3224 get_amr_th_from_arg(vty, 4, argv, 1);
3225 return CMD_SUCCESS;
3226}
3227
3228DEFUN(cfg_bts_amr_fr_hyst1, cfg_bts_amr_fr_hyst1_cmd,
3229 "amr tch-f hysteresis (ms|bts) <0-15>",
3230 AMR_TEXT "Full Rate\n" AMR_HY_TEXT
3231 AMR_HY_HELP_STR)
3232{
3233 get_amr_hy_from_arg(vty, 2, argv, 1);
3234 return CMD_SUCCESS;
3235}
3236
3237DEFUN(cfg_bts_amr_fr_hyst2, cfg_bts_amr_fr_hyst2_cmd,
3238 "amr tch-f hysteresis (ms|bts) <0-15> <0-15>",
3239 AMR_TEXT "Full Rate\n" AMR_HY_TEXT
3240 AMR_HY_HELP_STR AMR_HY_HELP_STR)
3241{
3242 get_amr_hy_from_arg(vty, 3, argv, 1);
3243 return CMD_SUCCESS;
3244}
3245
3246DEFUN(cfg_bts_amr_fr_hyst3, cfg_bts_amr_fr_hyst3_cmd,
3247 "amr tch-f hysteresis (ms|bts) <0-15> <0-15> <0-15>",
3248 AMR_TEXT "Full Rate\n" AMR_HY_TEXT
3249 AMR_HY_HELP_STR AMR_HY_HELP_STR AMR_HY_HELP_STR)
3250{
3251 get_amr_hy_from_arg(vty, 4, argv, 1);
3252 return CMD_SUCCESS;
3253}
3254
3255DEFUN(cfg_bts_amr_hr_modes1, cfg_bts_amr_hr_modes1_cmd,
3256 "amr tch-h modes" AMR_TCHH_PAR_STR,
3257 AMR_TEXT "Half Rate\n" AMR_MODE_TEXT
3258 AMR_TCHH_HELP_STR)
3259{
3260 get_amr_from_arg(vty, 1, argv, 0);
3261 return CMD_SUCCESS;
3262}
3263
3264DEFUN(cfg_bts_amr_hr_modes2, cfg_bts_amr_hr_modes2_cmd,
3265 "amr tch-h modes" AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR,
3266 AMR_TEXT "Half Rate\n" AMR_MODE_TEXT
3267 AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR)
3268{
3269 get_amr_from_arg(vty, 2, argv, 0);
3270 return CMD_SUCCESS;
3271}
3272
3273DEFUN(cfg_bts_amr_hr_modes3, cfg_bts_amr_hr_modes3_cmd,
3274 "amr tch-h modes" AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR,
3275 AMR_TEXT "Half Rate\n" AMR_MODE_TEXT
3276 AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR)
3277{
3278 get_amr_from_arg(vty, 3, argv, 0);
3279 return CMD_SUCCESS;
3280}
3281
3282DEFUN(cfg_bts_amr_hr_modes4, cfg_bts_amr_hr_modes4_cmd,
3283 "amr tch-h modes" AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR,
3284 AMR_TEXT "Half Rate\n" AMR_MODE_TEXT
3285 AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR)
3286{
3287 get_amr_from_arg(vty, 4, argv, 0);
3288 return CMD_SUCCESS;
3289}
3290
3291DEFUN(cfg_bts_amr_hr_start_mode, cfg_bts_amr_hr_start_mode_cmd,
3292 "amr tch-h start-mode (auto|1|2|3|4)",
3293 AMR_TEXT "Half Rate\n" AMR_START_TEXT)
3294{
3295 get_amr_start_from_arg(vty, argv, 0);
3296 return CMD_SUCCESS;
3297}
3298
3299DEFUN(cfg_bts_amr_hr_thres1, cfg_bts_amr_hr_thres1_cmd,
3300 "amr tch-h threshold (ms|bts) <0-63>",
3301 AMR_TEXT "Half Rate\n" AMR_TH_TEXT
3302 AMR_TH_HELP_STR)
3303{
3304 get_amr_th_from_arg(vty, 2, argv, 0);
3305 return CMD_SUCCESS;
3306}
3307
3308DEFUN(cfg_bts_amr_hr_thres2, cfg_bts_amr_hr_thres2_cmd,
3309 "amr tch-h threshold (ms|bts) <0-63> <0-63>",
3310 AMR_TEXT "Half Rate\n" AMR_TH_TEXT
3311 AMR_TH_HELP_STR AMR_TH_HELP_STR)
3312{
3313 get_amr_th_from_arg(vty, 3, argv, 0);
3314 return CMD_SUCCESS;
3315}
3316
3317DEFUN(cfg_bts_amr_hr_thres3, cfg_bts_amr_hr_thres3_cmd,
3318 "amr tch-h threshold (ms|bts) <0-63> <0-63> <0-63>",
3319 AMR_TEXT "Half Rate\n" AMR_TH_TEXT
3320 AMR_TH_HELP_STR AMR_TH_HELP_STR AMR_TH_HELP_STR)
3321{
3322 get_amr_th_from_arg(vty, 4, argv, 0);
3323 return CMD_SUCCESS;
3324}
3325
3326DEFUN(cfg_bts_amr_hr_hyst1, cfg_bts_amr_hr_hyst1_cmd,
3327 "amr tch-h hysteresis (ms|bts) <0-15>",
3328 AMR_TEXT "Half Rate\n" AMR_HY_TEXT
3329 AMR_HY_HELP_STR)
3330{
3331 get_amr_hy_from_arg(vty, 2, argv, 0);
3332 return CMD_SUCCESS;
3333}
3334
3335DEFUN(cfg_bts_amr_hr_hyst2, cfg_bts_amr_hr_hyst2_cmd,
3336 "amr tch-h hysteresis (ms|bts) <0-15> <0-15>",
3337 AMR_TEXT "Half Rate\n" AMR_HY_TEXT
3338 AMR_HY_HELP_STR AMR_HY_HELP_STR)
3339{
3340 get_amr_hy_from_arg(vty, 3, argv, 0);
3341 return CMD_SUCCESS;
3342}
3343
3344DEFUN(cfg_bts_amr_hr_hyst3, cfg_bts_amr_hr_hyst3_cmd,
3345 "amr tch-h hysteresis (ms|bts) <0-15> <0-15> <0-15>",
3346 AMR_TEXT "Half Rate\n" AMR_HY_TEXT
3347 AMR_HY_HELP_STR AMR_HY_HELP_STR AMR_HY_HELP_STR)
3348{
3349 get_amr_hy_from_arg(vty, 4, argv, 0);
3350 return CMD_SUCCESS;
3351}
3352
Harald Welte9e002452010-05-11 21:53:49 +02003353#define TRX_TEXT "Radio Transceiver\n"
Harald Welte3e774612009-08-10 13:48:16 +02003354
Harald Welte59b04682009-06-10 05:40:52 +08003355/* per TRX configuration */
3356DEFUN(cfg_trx,
3357 cfg_trx_cmd,
Harald Welte2af06cb2012-08-17 12:50:14 +02003358 "trx <0-255>",
Harald Welte9e002452010-05-11 21:53:49 +02003359 TRX_TEXT
Harald Welte59b04682009-06-10 05:40:52 +08003360 "Select a TRX to configure")
3361{
3362 int trx_nr = atoi(argv[0]);
3363 struct gsm_bts *bts = vty->index;
3364 struct gsm_bts_trx *trx;
3365
Harald Weltee712a5f2009-06-21 16:17:15 +02003366 if (trx_nr > bts->num_trx) {
3367 vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
3368 bts->num_trx, VTY_NEWLINE);
Harald Welte59b04682009-06-10 05:40:52 +08003369 return CMD_WARNING;
Harald Weltee712a5f2009-06-21 16:17:15 +02003370 } else if (trx_nr == bts->num_trx) {
3371 /* we need to allocate a new one */
3372 trx = gsm_bts_trx_alloc(bts);
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +02003373 } else
Harald Weltee712a5f2009-06-21 16:17:15 +02003374 trx = gsm_bts_trx_num(bts, trx_nr);
Holger Hans Peter Freyther71135142010-03-29 08:47:44 +02003375
Harald Weltee712a5f2009-06-21 16:17:15 +02003376 if (!trx)
3377 return CMD_WARNING;
Harald Welte59b04682009-06-10 05:40:52 +08003378
3379 vty->index = trx;
Harald Welte8791dac2010-05-14 17:59:53 +02003380 vty->index_sub = &trx->description;
Harald Welte59b04682009-06-10 05:40:52 +08003381 vty->node = TRX_NODE;
3382
3383 return CMD_SUCCESS;
3384}
3385
3386DEFUN(cfg_trx_arfcn,
3387 cfg_trx_arfcn_cmd,
Harald Welte09e4fad2012-01-29 13:24:12 +01003388 "arfcn <0-1023>",
Harald Welte764c8e12012-08-17 09:57:25 +02003389 "Set the ARFCN for this TRX\n"
3390 "Absolute Radio Frequency Channel Number\n")
Harald Welte59b04682009-06-10 05:40:52 +08003391{
3392 int arfcn = atoi(argv[0]);
3393 struct gsm_bts_trx *trx = vty->index;
3394
3395 /* FIXME: check if this ARFCN is supported by this TRX */
3396
3397 trx->arfcn = arfcn;
3398
3399 /* FIXME: patch ARFCN into SYSTEM INFORMATION */
3400 /* FIXME: use OML layer to update the ARFCN */
3401 /* FIXME: use RSL layer to update SYSTEM INFORMATION */
3402
3403 return CMD_SUCCESS;
3404}
3405
Harald Welte (local)b709bfe2009-12-27 20:56:38 +01003406DEFUN(cfg_trx_nominal_power,
3407 cfg_trx_nominal_power_cmd,
3408 "nominal power <0-100>",
Harald Welte557f3992012-08-16 23:23:50 +02003409 "Nominal TRX RF Power in dBm\n"
3410 "Nominal TRX RF Power in dBm\n"
3411 "Nominal TRX RF Power in dBm\n")
Harald Welte (local)b709bfe2009-12-27 20:56:38 +01003412{
3413 struct gsm_bts_trx *trx = vty->index;
3414
3415 trx->nominal_power = atoi(argv[0]);
3416
3417 return CMD_SUCCESS;
3418}
3419
Harald Welte91afe4c2009-06-20 18:15:19 +02003420DEFUN(cfg_trx_max_power_red,
3421 cfg_trx_max_power_red_cmd,
3422 "max_power_red <0-100>",
Harald Welte557f3992012-08-16 23:23:50 +02003423 "Reduction of maximum BS RF Power (relative to nominal power)\n"
Harald Welte91afe4c2009-06-20 18:15:19 +02003424 "Reduction of maximum BS RF Power in dB\n")
3425{
3426 int maxpwr_r = atoi(argv[0]);
3427 struct gsm_bts_trx *trx = vty->index;
Harald Welte01acd742009-11-18 09:20:22 +01003428 int upper_limit = 24; /* default 12.21 max power red. */
Harald Welte91afe4c2009-06-20 18:15:19 +02003429
3430 /* FIXME: check if our BTS type supports more than 12 */
3431 if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
3432 vty_out(vty, "%% Power %d dB is not in the valid range%s",
3433 maxpwr_r, VTY_NEWLINE);
3434 return CMD_WARNING;
3435 }
3436 if (maxpwr_r & 1) {
3437 vty_out(vty, "%% Power %d dB is not an even value%s",
3438 maxpwr_r, VTY_NEWLINE);
3439 return CMD_WARNING;
3440 }
3441
3442 trx->max_power_red = maxpwr_r;
3443
3444 /* FIXME: make sure we update this using OML */
3445
3446 return CMD_SUCCESS;
3447}
3448
Harald Welte62868882009-08-08 16:12:58 +02003449DEFUN(cfg_trx_rsl_e1,
3450 cfg_trx_rsl_e1_cmd,
3451 "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte557f3992012-08-16 23:23:50 +02003452 "RSL Parameters\n"
3453 "E1/T1 interface to be used for RSL\n"
3454 "E1/T1 interface to be used for RSL\n"
3455 "E1/T1 Line Number to be used for RSL\n"
3456 "E1/T1 Timeslot to be used for RSL\n"
3457 "E1/T1 Timeslot to be used for RSL\n"
3458 "E1/T1 Sub-slot to be used for RSL\n"
3459 "E1/T1 Sub-slot 0 is to be used for RSL\n"
3460 "E1/T1 Sub-slot 1 is to be used for RSL\n"
3461 "E1/T1 Sub-slot 2 is to be used for RSL\n"
3462 "E1/T1 Sub-slot 3 is to be used for RSL\n"
3463 "E1/T1 full timeslot is to be used for RSL\n")
Harald Welte62868882009-08-08 16:12:58 +02003464{
3465 struct gsm_bts_trx *trx = vty->index;
3466
3467 parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]);
3468
3469 return CMD_SUCCESS;
3470}
3471
3472DEFUN(cfg_trx_rsl_e1_tei,
3473 cfg_trx_rsl_e1_tei_cmd,
3474 "rsl e1 tei <0-63>",
Harald Welte557f3992012-08-16 23:23:50 +02003475 "RSL Parameters\n"
3476 "Set the TEI to be used for RSL\n"
3477 "Set the TEI to be used for RSL\n"
3478 "TEI to be used for RSL\n")
Harald Welte62868882009-08-08 16:12:58 +02003479{
3480 struct gsm_bts_trx *trx = vty->index;
3481
3482 trx->rsl_tei = atoi(argv[0]);
3483
3484 return CMD_SUCCESS;
3485}
3486
Holger Hans Peter Freyther1c8b4802009-11-11 11:54:24 +01003487DEFUN(cfg_trx_rf_locked,
3488 cfg_trx_rf_locked_cmd,
3489 "rf_locked (0|1)",
Harald Welte557f3992012-08-16 23:23:50 +02003490 "Set or unset the RF Locking (Turn off RF of the TRX)\n"
3491 "TRX is NOT RF locked (active)\n"
3492 "TRX is RF locked (turned off)\n")
Holger Hans Peter Freyther1c8b4802009-11-11 11:54:24 +01003493{
3494 int locked = atoi(argv[0]);
3495 struct gsm_bts_trx *trx = vty->index;
3496
3497 gsm_trx_lock_rf(trx, locked);
3498 return CMD_SUCCESS;
3499}
Harald Welte62868882009-08-08 16:12:58 +02003500
Harald Welte59b04682009-06-10 05:40:52 +08003501/* per TS configuration */
3502DEFUN(cfg_ts,
3503 cfg_ts_cmd,
Harald Welte62868882009-08-08 16:12:58 +02003504 "timeslot <0-7>",
Harald Welte557f3992012-08-16 23:23:50 +02003505 "Select a Timeslot to configure\n"
3506 "Timeslot number\n")
Harald Welte59b04682009-06-10 05:40:52 +08003507{
3508 int ts_nr = atoi(argv[0]);
3509 struct gsm_bts_trx *trx = vty->index;
3510 struct gsm_bts_trx_ts *ts;
3511
3512 if (ts_nr >= TRX_NR_TS) {
3513 vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s",
3514 TRX_NR_TS, VTY_NEWLINE);
3515 return CMD_WARNING;
3516 }
3517
3518 ts = &trx->ts[ts_nr];
3519
3520 vty->index = ts;
3521 vty->node = TS_NODE;
3522
3523 return CMD_SUCCESS;
3524}
3525
Harald Welte3ffe1b32009-08-07 00:25:23 +02003526DEFUN(cfg_ts_pchan,
3527 cfg_ts_pchan_cmd,
Harald Welte2addf852012-08-17 12:42:06 +02003528 "phys_chan_config PCHAN", /* dynamically generated! */
Holger Hans Peter Freytherebe37252013-03-03 09:32:08 +01003529 "Physical Channel configuration (TCH/SDCCH/...)\n" "Physical Channel\n")
Harald Welte2addf852012-08-17 12:42:06 +02003530{
3531 struct gsm_bts_trx_ts *ts = vty->index;
3532 int pchanc;
3533
3534 pchanc = gsm_pchan_parse(argv[0]);
3535 if (pchanc < 0)
3536 return CMD_WARNING;
3537
3538 ts->pchan = pchanc;
3539
3540 return CMD_SUCCESS;
3541}
3542
3543/* used for backwards compatibility with old config files that still
3544 * have uppercase pchan type names */
3545DEFUN_HIDDEN(cfg_ts_pchan_compat,
3546 cfg_ts_pchan_compat_cmd,
Harald Welte3ffe1b32009-08-07 00:25:23 +02003547 "phys_chan_config PCHAN",
Holger Hans Peter Freytherebe37252013-03-03 09:32:08 +01003548 "Physical Channel configuration (TCH/SDCCH/...)\n" "Physical Channel\n")
Harald Welte3ffe1b32009-08-07 00:25:23 +02003549{
3550 struct gsm_bts_trx_ts *ts = vty->index;
3551 int pchanc;
3552
3553 pchanc = gsm_pchan_parse(argv[0]);
3554 if (pchanc < 0)
3555 return CMD_WARNING;
3556
3557 ts->pchan = pchanc;
3558
3559 return CMD_SUCCESS;
3560}
3561
Harald Welte2addf852012-08-17 12:42:06 +02003562
3563
Harald Welte85771a42011-05-30 12:09:13 +02003564DEFUN(cfg_ts_tsc,
3565 cfg_ts_tsc_cmd,
3566 "training_sequence_code <0-7>",
Harald Welte557f3992012-08-16 23:23:50 +02003567 "Training Sequence Code of the Timeslot\n" "TSC\n")
Harald Welte85771a42011-05-30 12:09:13 +02003568{
3569 struct gsm_bts_trx_ts *ts = vty->index;
3570
Harald Welte499cd252014-01-19 17:10:50 +01003571 if (!gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_MULTI_TSC)) {
3572 vty_out(vty, "%% This BTS does not support a TSC != BCC, "
3573 "falling back to BCC%s", VTY_NEWLINE);
3574 ts->tsc = -1;
3575 return CMD_WARNING;
3576 }
3577
Harald Welte85771a42011-05-30 12:09:13 +02003578 ts->tsc = atoi(argv[0]);
3579
3580 return CMD_SUCCESS;
3581}
3582
Harald Weltea42a93f2010-06-14 22:26:10 +02003583#define HOPPING_STR "Configure frequency hopping\n"
3584
3585DEFUN(cfg_ts_hopping,
3586 cfg_ts_hopping_cmd,
3587 "hopping enabled (0|1)",
3588 HOPPING_STR "Enable or disable frequency hopping\n"
3589 "Disable frequency hopping\n" "Enable frequency hopping\n")
3590{
3591 struct gsm_bts_trx_ts *ts = vty->index;
Harald Welte059c1ef2010-06-14 22:47:37 +02003592 int enabled = atoi(argv[0]);
Harald Weltea42a93f2010-06-14 22:26:10 +02003593
Harald Welte059c1ef2010-06-14 22:47:37 +02003594 if (enabled && !gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_HOPPING)) {
3595 vty_out(vty, "BTS model does not support hopping%s",
3596 VTY_NEWLINE);
3597 return CMD_WARNING;
3598 }
3599
3600 ts->hopping.enabled = enabled;
Harald Weltea42a93f2010-06-14 22:26:10 +02003601
3602 return CMD_SUCCESS;
3603}
3604
Harald Welte67104d12009-09-12 13:05:33 +02003605DEFUN(cfg_ts_hsn,
3606 cfg_ts_hsn_cmd,
Harald Weltea42a93f2010-06-14 22:26:10 +02003607 "hopping sequence-number <0-63>",
3608 HOPPING_STR
Harald Welte557f3992012-08-16 23:23:50 +02003609 "Which hopping sequence to use for this channel\n"
3610 "Hopping Sequence Number (HSN)\n")
Harald Welte67104d12009-09-12 13:05:33 +02003611{
3612 struct gsm_bts_trx_ts *ts = vty->index;
3613
3614 ts->hopping.hsn = atoi(argv[0]);
3615
3616 return CMD_SUCCESS;
3617}
3618
3619DEFUN(cfg_ts_maio,
3620 cfg_ts_maio_cmd,
3621 "hopping maio <0-63>",
Harald Weltea42a93f2010-06-14 22:26:10 +02003622 HOPPING_STR
Harald Welte557f3992012-08-16 23:23:50 +02003623 "Which hopping MAIO to use for this channel\n"
3624 "Mobile Allocation Index Offset (MAIO)\n")
Harald Welte67104d12009-09-12 13:05:33 +02003625{
3626 struct gsm_bts_trx_ts *ts = vty->index;
3627
3628 ts->hopping.maio = atoi(argv[0]);
3629
3630 return CMD_SUCCESS;
3631}
3632
3633DEFUN(cfg_ts_arfcn_add,
3634 cfg_ts_arfcn_add_cmd,
3635 "hopping arfcn add <0-1023>",
Harald Weltea42a93f2010-06-14 22:26:10 +02003636 HOPPING_STR "Configure hopping ARFCN list\n"
3637 "Add an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte67104d12009-09-12 13:05:33 +02003638{
3639 struct gsm_bts_trx_ts *ts = vty->index;
3640 int arfcn = atoi(argv[0]);
3641
Harald Weltea42a93f2010-06-14 22:26:10 +02003642 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1);
3643
Harald Welte67104d12009-09-12 13:05:33 +02003644 return CMD_SUCCESS;
3645}
3646
3647DEFUN(cfg_ts_arfcn_del,
3648 cfg_ts_arfcn_del_cmd,
3649 "hopping arfcn del <0-1023>",
Harald Weltea42a93f2010-06-14 22:26:10 +02003650 HOPPING_STR "Configure hopping ARFCN list\n"
3651 "Delete an entry to the hopping ARFCN list\n" "ARFCN\n")
Harald Welte67104d12009-09-12 13:05:33 +02003652{
3653 struct gsm_bts_trx_ts *ts = vty->index;
3654 int arfcn = atoi(argv[0]);
3655
Harald Weltea42a93f2010-06-14 22:26:10 +02003656 bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0);
3657
Harald Welte67104d12009-09-12 13:05:33 +02003658 return CMD_SUCCESS;
3659}
3660
Harald Welte3ffe1b32009-08-07 00:25:23 +02003661DEFUN(cfg_ts_e1_subslot,
3662 cfg_ts_e1_subslot_cmd,
Harald Welte62868882009-08-08 16:12:58 +02003663 "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)",
Harald Welte557f3992012-08-16 23:23:50 +02003664 "E1/T1 channel connected to this on-air timeslot\n"
3665 "E1/T1 channel connected to this on-air timeslot\n"
3666 "E1/T1 line connected to this on-air timeslot\n"
Harald Weltefa2015f2012-08-17 09:52:03 +02003667 "E1/T1 timeslot connected to this on-air timeslot\n"
3668 "E1/T1 timeslot connected to this on-air timeslot\n"
Harald Welte557f3992012-08-16 23:23:50 +02003669 "E1/T1 sub-slot connected to this on-air timeslot\n"
3670 "E1/T1 sub-slot 0 connected to this on-air timeslot\n"
3671 "E1/T1 sub-slot 1 connected to this on-air timeslot\n"
3672 "E1/T1 sub-slot 2 connected to this on-air timeslot\n"
3673 "E1/T1 sub-slot 3 connected to this on-air timeslot\n"
3674 "Full E1/T1 timeslot connected to this on-air timeslot\n")
Harald Welte3ffe1b32009-08-07 00:25:23 +02003675{
3676 struct gsm_bts_trx_ts *ts = vty->index;
3677
Harald Welte62868882009-08-08 16:12:58 +02003678 parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]);
Harald Welte3ffe1b32009-08-07 00:25:23 +02003679
3680 return CMD_SUCCESS;
3681}
Harald Welte59b04682009-06-10 05:40:52 +08003682
Harald Weltea5b1dae2010-05-16 21:47:13 +02003683void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
3684{
3685 vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
Alexander Couzensd8aad3a2016-08-02 11:34:11 +02003686 net->bsc_ctrs->ctr[BSC_CTR_CHREQ_TOTAL].current,
3687 net->bsc_ctrs->ctr[BSC_CTR_CHREQ_NO_CHANNEL].current,
Alexander Couzens65bfd762016-07-12 15:42:02 +02003688 VTY_NEWLINE);
Harald Weltea5b1dae2010-05-16 21:47:13 +02003689 vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
Alexander Couzensd8aad3a2016-08-02 11:34:11 +02003690 net->bsc_ctrs->ctr[BSC_CTR_CHAN_RF_FAIL].current,
3691 net->bsc_ctrs->ctr[BSC_CTR_CHAN_RLL_ERR].current,
Alexander Couzens65bfd762016-07-12 15:42:02 +02003692 VTY_NEWLINE);
Harald Weltea5b1dae2010-05-16 21:47:13 +02003693 vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
Alexander Couzensd8aad3a2016-08-02 11:34:11 +02003694 net->bsc_ctrs->ctr[BSC_CTR_PAGING_ATTEMPTED].current,
3695 net->bsc_ctrs->ctr[BSC_CTR_PAGING_COMPLETED].current,
3696 net->bsc_ctrs->ctr[BSC_CTR_PAGING_EXPIRED].current,
Alexander Couzens65bfd762016-07-12 15:42:02 +02003697 VTY_NEWLINE);
Harald Weltea5b1dae2010-05-16 21:47:13 +02003698 vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
Alexander Couzensd8aad3a2016-08-02 11:34:11 +02003699 net->bsc_ctrs->ctr[BSC_CTR_BTS_OML_FAIL].current,
3700 net->bsc_ctrs->ctr[BSC_CTR_BTS_RSL_FAIL].current,
Alexander Couzens65bfd762016-07-12 15:42:02 +02003701 VTY_NEWLINE);
Harald Weltea5b1dae2010-05-16 21:47:13 +02003702}
3703
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02003704DEFUN(drop_bts,
3705 drop_bts_cmd,
Holger Hans Peter Freythere4ac0e42010-04-11 12:46:45 +02003706 "drop bts connection <0-65535> (oml|rsl)",
Harald Welte557f3992012-08-16 23:23:50 +02003707 "Debug/Simulation command to drop Abis/IP BTS\n"
3708 "Debug/Simulation command to drop Abis/IP BTS\n"
3709 "Debug/Simulation command to drop Abis/IP BTS\n"
3710 "BTS NR\n" "Drop OML Connection\n" "Drop RSL Connection\n")
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02003711{
3712 struct gsm_network *gsmnet;
3713 struct gsm_bts_trx *trx;
3714 struct gsm_bts *bts;
3715 unsigned int bts_nr;
3716
3717 gsmnet = gsmnet_from_vty(vty);
3718
3719 bts_nr = atoi(argv[0]);
3720 if (bts_nr >= gsmnet->num_bts) {
3721 vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s",
3722 gsmnet->num_bts, bts_nr, VTY_NEWLINE);
3723 return CMD_WARNING;
3724 }
3725
3726 bts = gsm_bts_num(gsmnet, bts_nr);
3727 if (!bts) {
3728 vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE);
3729 return CMD_WARNING;
3730 }
3731
3732 if (!is_ipaccess_bts(bts)) {
3733 vty_out(vty, "This command only works for ipaccess.%s", VTY_NEWLINE);
3734 return CMD_WARNING;
3735 }
3736
3737
3738 /* close all connections */
3739 if (strcmp(argv[1], "oml") == 0) {
Holger Hans Peter Freyther03f17d02010-11-15 20:29:46 +01003740 ipaccess_drop_oml(bts);
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02003741 } else if (strcmp(argv[1], "rsl") == 0) {
3742 /* close all rsl connections */
3743 llist_for_each_entry(trx, &bts->trx_list, list) {
Holger Hans Peter Freyther03f17d02010-11-15 20:29:46 +01003744 ipaccess_drop_rsl(trx);
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02003745 }
3746 } else {
3747 vty_out(vty, "Argument must be 'oml# or 'rsl'.%s", VTY_NEWLINE);
3748 return CMD_WARNING;
3749 }
3750
3751 return CMD_SUCCESS;
3752}
3753
Holger Hans Peter Freyther8ab66e82016-03-16 13:45:23 +01003754DEFUN(restart_bts, restart_bts_cmd,
3755 "restart-bts <0-65535>",
3756 "Restart ip.access nanoBTS through OML\n"
3757 "BTS Number\n")
3758{
3759 struct gsm_network *gsmnet;
3760 struct gsm_bts_trx *trx;
3761 struct gsm_bts *bts;
3762 unsigned int bts_nr;
3763
3764 gsmnet = gsmnet_from_vty(vty);
3765
3766 bts_nr = atoi(argv[0]);
3767 if (bts_nr >= gsmnet->num_bts) {
3768 vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s",
3769 gsmnet->num_bts, bts_nr, VTY_NEWLINE);
3770 return CMD_WARNING;
3771 }
3772
3773 bts = gsm_bts_num(gsmnet, bts_nr);
3774 if (!bts) {
3775 vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE);
3776 return CMD_WARNING;
3777 }
3778
3779 if (!is_ipaccess_bts(bts) || is_sysmobts_v2(bts)) {
3780 vty_out(vty, "This command only works for ipaccess nanoBTS.%s",
3781 VTY_NEWLINE);
3782 return CMD_WARNING;
3783 }
3784
3785 /* go from last TRX to c0 */
3786 llist_for_each_entry_reverse(trx, &bts->trx_list, list)
3787 abis_nm_ipaccess_restart(trx);
3788
3789 return CMD_SUCCESS;
3790}
3791
Harald Weltebf4ba722014-12-28 15:00:45 +01003792DEFUN(smscb_cmd, smscb_cmd_cmd,
3793 "bts <0-255> smscb-command <1-4> HEXSTRING",
3794 "BTS related commands\n" "BTS Number\n"
3795 "SMS Cell Broadcast\n" "Last Valid Block\n"
3796 "Hex Encoded SMSCB message (up to 88 octets)\n")
3797{
3798 struct gsm_bts *bts;
3799 int bts_nr = atoi(argv[0]);
3800 int last_block = atoi(argv[1]);
3801 struct rsl_ie_cb_cmd_type cb_cmd;
3802 uint8_t buf[88];
3803 int rc;
3804
Neels Hofmeyr191933d2016-05-11 18:48:39 +02003805 bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr);
Harald Weltebf4ba722014-12-28 15:00:45 +01003806 if (!bts) {
3807 vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE);
3808 return CMD_WARNING;
3809 }
3810 rc = osmo_hexparse(argv[2], buf, sizeof(buf));
3811 if (rc < 0 || rc > sizeof(buf)) {
3812 vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
3813 return CMD_WARNING;
3814 }
3815
3816 cb_cmd.spare = 0;
3817 cb_cmd.def_bcast = 0;
3818 cb_cmd.command = RSL_CB_CMD_TYPE_NORMAL;
3819
3820 switch (last_block) {
3821 case 1:
3822 cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_1;
3823 break;
3824 case 2:
3825 cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_2;
3826 break;
3827 case 3:
3828 cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_3;
3829 break;
3830 case 4:
3831 cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_4;
3832 break;
3833 }
3834
3835 rsl_sms_cb_command(bts, RSL_CHAN_SDCCH4_ACCH, cb_cmd, buf, rc);
3836
3837 return CMD_SUCCESS;
3838}
3839
3840
Harald Welte5213e992010-12-23 13:18:07 +01003841DEFUN(pdch_act, pdch_act_cmd,
3842 "bts <0-255> trx <0-255> timeslot <0-7> pdch (activate|deactivate)",
3843 "BTS related commands\n" "BTS Number\n" "Transceiver\n" "Transceiver Number\n"
3844 "TRX Timeslot\n" "Timeslot Number\n" "Packet Data Channel\n"
3845 "Activate Dynamic PDCH/TCH (-> PDCH mode)\n"
3846 "Deactivate Dynamic PDCH/TCH (-> TCH mode)\n")
3847{
3848 struct gsm_bts *bts;
3849 struct gsm_bts_trx *trx;
3850 struct gsm_bts_trx_ts *ts;
3851 int bts_nr = atoi(argv[0]);
3852 int trx_nr = atoi(argv[1]);
3853 int ts_nr = atoi(argv[2]);
3854 int activate;
3855
Neels Hofmeyr191933d2016-05-11 18:48:39 +02003856 bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr);
Harald Welte5213e992010-12-23 13:18:07 +01003857 if (!bts) {
3858 vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE);
3859 return CMD_WARNING;
3860 }
3861
3862 if (!is_ipaccess_bts(bts)) {
3863 vty_out(vty, "%% This command only works for ipaccess BTS%s",
3864 VTY_NEWLINE);
3865 return CMD_WARNING;
3866 }
3867
3868 trx = gsm_bts_trx_num(bts, trx_nr);
3869 if (!trx) {
3870 vty_out(vty, "%% No such TRX (%d)%s", trx_nr, VTY_NEWLINE);
3871 return CMD_WARNING;
3872 }
3873
3874 ts = &trx->ts[ts_nr];
3875 if (ts->pchan != GSM_PCHAN_TCH_F_PDCH) {
3876 vty_out(vty, "%% Timeslot %u is not in dynamic TCH_F/PDCH "
3877 "mode%s", ts_nr, VTY_NEWLINE);
3878 return CMD_WARNING;
3879 }
3880
3881 if (!strcmp(argv[3], "activate"))
3882 activate = 1;
3883 else
3884 activate = 0;
3885
3886 rsl_ipacc_pdch_activate(ts, activate);
3887
3888 return CMD_SUCCESS;
3889
3890}
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02003891
Harald Welte40152872010-05-16 20:52:23 +02003892extern int bsc_vty_init_extra(void);
Holger Hans Peter Freytherc48a2a12010-04-10 00:08:28 +02003893
Max09c26f12017-01-12 19:35:11 +01003894int bsc_vty_init(struct gsm_network *network)
Harald Welte59b04682009-06-10 05:40:52 +08003895{
Harald Welte2addf852012-08-17 12:42:06 +02003896 cfg_ts_pchan_cmd.string =
3897 vty_cmd_string_from_valstr(tall_bsc_ctx,
3898 gsm_pchant_names,
3899 "phys_chan_config (", "|", ")",
3900 VTY_DO_LOWER);
3901 cfg_ts_pchan_cmd.doc =
3902 vty_cmd_string_from_valstr(tall_bsc_ctx,
3903 gsm_pchant_descs,
3904 "Physical Channel Combination\n",
3905 "\n", "", 0);
3906
Harald Welte85a77b12012-08-17 13:02:12 +02003907 cfg_bts_type_cmd.string =
3908 vty_cmd_string_from_valstr(tall_bsc_ctx,
3909 bts_type_names,
3910 "type (", "|", ")",
3911 VTY_DO_LOWER);
3912 cfg_bts_type_cmd.doc =
3913 vty_cmd_string_from_valstr(tall_bsc_ctx,
3914 bts_type_descs,
3915 "BTS Vendor/Type\n",
3916 "\n", "", 0);
3917
Neels Hofmeyrbfe27272016-05-12 01:16:58 +02003918 common_cs_vty_init(network, config_write_net);
Harald Welte85a77b12012-08-17 13:02:12 +02003919
Neels Hofmeyrd416b482016-05-12 01:53:23 +02003920 install_element_ve(&bsc_show_net_cmd);
Harald Welte7bc28f62010-05-12 16:10:35 +00003921 install_element_ve(&show_bts_cmd);
3922 install_element_ve(&show_trx_cmd);
3923 install_element_ve(&show_ts_cmd);
3924 install_element_ve(&show_lchan_cmd);
Holger Hans Peter Freythere959b4e2010-05-14 02:08:49 +08003925 install_element_ve(&show_lchan_summary_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08003926
Harald Welte7bc28f62010-05-12 16:10:35 +00003927 install_element_ve(&show_paging_cmd);
Holger Hans Peter Freyther35e6fbb2013-02-05 09:39:09 +01003928 install_element_ve(&show_paging_group_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08003929
Max09c26f12017-01-12 19:35:11 +01003930 logging_vty_add_cmds(NULL);
Jacob Erlbeck63fac682015-10-26 16:25:37 +01003931 osmo_stats_vty_add_cmds();
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +01003932
Holger Hans Peter Freyther96c89822009-11-16 17:12:38 +01003933 install_element(GSMNET_NODE, &cfg_net_neci_cmd);
Harald Welte0af9c9f2009-12-19 21:41:52 +01003934 install_element(GSMNET_NODE, &cfg_net_handover_cmd);
Harald Weltea8062f12009-12-21 16:51:50 +01003935 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd);
3936 install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd);
3937 install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd);
3938 install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd);
3939 install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd);
3940 install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd);
Holger Hans Peter Freyther26ba2e72009-11-21 21:18:38 +01003941 install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +01003942 install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
3943 install_element(GSMNET_NODE, &cfg_net_T3105_cmd);
3944 install_element(GSMNET_NODE, &cfg_net_T3107_cmd);
3945 install_element(GSMNET_NODE, &cfg_net_T3109_cmd);
3946 install_element(GSMNET_NODE, &cfg_net_T3111_cmd);
3947 install_element(GSMNET_NODE, &cfg_net_T3113_cmd);
3948 install_element(GSMNET_NODE, &cfg_net_T3115_cmd);
3949 install_element(GSMNET_NODE, &cfg_net_T3117_cmd);
3950 install_element(GSMNET_NODE, &cfg_net_T3119_cmd);
Harald Weltee2aaf442010-12-23 22:53:50 +01003951 install_element(GSMNET_NODE, &cfg_net_T3122_cmd);
Holger Hans Peter Freyther89733862009-11-21 21:42:26 +01003952 install_element(GSMNET_NODE, &cfg_net_T3141_cmd);
Holger Hans Peter Freyther21d63ff2010-09-06 09:25:48 +08003953 install_element(GSMNET_NODE, &cfg_net_dtx_cmd);
Holger Hans Peter Freytherb6b9d702010-09-06 09:41:50 +08003954 install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd);
Harald Weltee87eb462009-08-07 13:29:14 +02003955
3956 install_element(GSMNET_NODE, &cfg_bts_cmd);
Harald Welte97ceef92009-08-06 19:06:46 +02003957 install_node(&bts_node, config_write_bts);
Jacob Erlbeckf414e852013-10-29 09:30:30 +01003958 vty_install_default(BTS_NODE);
Harald Welte59b04682009-06-10 05:40:52 +08003959 install_element(BTS_NODE, &cfg_bts_type_cmd);
Harald Welte8791dac2010-05-14 17:59:53 +02003960 install_element(BTS_NODE, &cfg_description_cmd);
3961 install_element(BTS_NODE, &cfg_no_description_cmd);
Harald Welte91afe4c2009-06-20 18:15:19 +02003962 install_element(BTS_NODE, &cfg_bts_band_cmd);
Holger Hans Peter Freythera098dfb2009-08-21 14:44:12 +02003963 install_element(BTS_NODE, &cfg_bts_ci_cmd);
Max3d94aca2016-05-11 12:45:13 +02003964 install_element(BTS_NODE, &cfg_bts_dtxu_cmd);
3965 install_element(BTS_NODE, &cfg_bts_dtxd_cmd);
3966 install_element(BTS_NODE, &cfg_bts_no_dtxu_cmd);
3967 install_element(BTS_NODE, &cfg_bts_no_dtxd_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08003968 install_element(BTS_NODE, &cfg_bts_lac_cmd);
3969 install_element(BTS_NODE, &cfg_bts_tsc_cmd);
Harald Welte62868882009-08-08 16:12:58 +02003970 install_element(BTS_NODE, &cfg_bts_bsic_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08003971 install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
Harald Welte8b3c5952013-03-12 13:57:05 +01003972 install_element(BTS_NODE, &cfg_bts_rsl_ip_cmd);
Sylvain Munautcb8e8432011-10-17 14:04:55 +02003973 install_element(BTS_NODE, &cfg_bts_nokia_site_skip_reset_cmd);
Andreas Eversbergac27b952013-12-05 13:25:06 +01003974 install_element(BTS_NODE, &cfg_bts_nokia_site_no_loc_rel_cnf_cmd);
Sipos Csabadef87b42015-02-07 13:27:36 +01003975 install_element(BTS_NODE, &cfg_bts_nokia_site_bts_reset_timer_cnf_cmd);
Harald Welte25572872009-10-20 00:22:00 +02003976 install_element(BTS_NODE, &cfg_bts_stream_id_cmd);
Harald Welte62868882009-08-08 16:12:58 +02003977 install_element(BTS_NODE, &cfg_bts_oml_e1_cmd);
3978 install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd);
Harald Welte3e774612009-08-10 13:48:16 +02003979 install_element(BTS_NODE, &cfg_bts_challoc_cmd);
Sylvain Munaut8e2d8de2009-12-22 13:43:26 +01003980 install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
3981 install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
Andreas Eversberg14e12f22012-10-13 07:27:47 +02003982 install_element(BTS_NODE, &cfg_bts_chan_desc_att_cmd);
3983 install_element(BTS_NODE, &cfg_bts_chan_desc_bs_pa_mfrms_cmd);
3984 install_element(BTS_NODE, &cfg_bts_chan_desc_bs_ag_blks_res_cmd);
Holger Hans Peter Freyther697ed2b2010-04-25 23:08:39 +08003985 install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd);
3986 install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd);
Harald Welte (local)e19be3f2009-08-12 13:28:23 +02003987 install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
Holger Hans Peter Freyther440984b2010-05-14 00:39:19 +08003988 install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd);
Ivan Kluchnikov80d58432013-09-16 13:13:04 +04003989 install_element(BTS_NODE, &cfg_bts_rach_ac_class_cmd);
Harald Welte (local)cbd46102009-08-13 10:14:26 +02003990 install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd);
Harald Welte (local)b6ea7f72009-08-14 23:09:25 +02003991 install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
Holger Hans Peter Freyther2fb8ebf2013-07-27 21:07:57 +02003992 install_element(BTS_NODE, &cfg_bts_no_per_loc_upd_cmd);
Harald Welteb761bf82009-12-12 18:17:25 +01003993 install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
3994 install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
Sylvain Munaut00d71462010-11-28 18:17:28 +01003995 install_element(BTS_NODE, &cfg_bts_cell_bar_qualify_cmd);
3996 install_element(BTS_NODE, &cfg_bts_cell_resel_ofs_cmd);
3997 install_element(BTS_NODE, &cfg_bts_temp_ofs_cmd);
3998 install_element(BTS_NODE, &cfg_bts_temp_ofs_inf_cmd);
3999 install_element(BTS_NODE, &cfg_bts_penalty_time_cmd);
4000 install_element(BTS_NODE, &cfg_bts_penalty_time_rsvd_cmd);
Andreas Eversbergf9248d92013-03-10 11:49:35 +01004001 install_element(BTS_NODE, &cfg_bts_radio_link_timeout_cmd);
Harald Weltecb20b7a2010-04-18 15:51:20 +02004002 install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
bhargava612722c2016-07-21 11:14:34 +05304003 install_element(BTS_NODE, &cfg_bts_gprs_11bit_rach_support_for_egprs_cmd);
Harald Weltea9251762010-05-11 23:50:21 +02004004 install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd);
Harald Welte3055e332010-03-14 15:37:43 +08004005 install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
Andreas Eversberga4fa21c2013-03-16 16:31:26 +01004006 install_element(BTS_NODE, &cfg_bts_gprs_net_ctrl_ord_cmd);
Max88bdcd42016-07-28 11:55:37 +02004007 install_element(BTS_NODE, &cfg_bts_gprs_ctrl_ack_cmd);
4008 install_element(BTS_NODE, &cfg_no_bts_gprs_ctrl_ack_cmd);
Harald Welte3055e332010-03-14 15:37:43 +08004009 install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
Harald Weltea9251762010-05-11 23:50:21 +02004010 install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
Harald Welte4a048c52010-03-22 11:48:36 +08004011 install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
Harald Welte3055e332010-03-14 15:37:43 +08004012 install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd);
Harald Welte410575a2010-03-14 23:30:30 +08004013 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd);
4014 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd);
4015 install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd);
Holger Hans Peter Freyther3112f672010-09-06 10:11:25 +08004016 install_element(BTS_NODE, &cfg_bts_pag_free_cmd);
Harald Welted8acf142010-07-30 11:50:09 +02004017 install_element(BTS_NODE, &cfg_bts_si_mode_cmd);
4018 install_element(BTS_NODE, &cfg_bts_si_static_cmd);
Harald Welte44ccb0d2017-01-13 00:10:32 +01004019 install_element(BTS_NODE, &cfg_bts_early_cm_cmd);
Harald Welteca46eff2011-01-11 23:44:56 +01004020 install_element(BTS_NODE, &cfg_bts_neigh_mode_cmd);
4021 install_element(BTS_NODE, &cfg_bts_neigh_cmd);
Harald Weltef989b782011-02-15 11:43:27 +01004022 install_element(BTS_NODE, &cfg_bts_si5_neigh_cmd);
Max88ddcaa2016-04-15 16:04:46 +02004023 install_element(BTS_NODE, &cfg_bts_si2quater_neigh_add_cmd);
4024 install_element(BTS_NODE, &cfg_bts_si2quater_neigh_del_cmd);
Maxeaf196c2016-04-20 15:57:13 +02004025 install_element(BTS_NODE, &cfg_bts_si2quater_uarfcn_add_cmd);
4026 install_element(BTS_NODE, &cfg_bts_si2quater_uarfcn_del_cmd);
Holger Hans Peter Freyther10799162012-07-20 10:27:31 +02004027 install_element(BTS_NODE, &cfg_bts_excl_rf_lock_cmd);
4028 install_element(BTS_NODE, &cfg_bts_no_excl_rf_lock_cmd);
Jacob Erlbeck8f8e5bf2014-01-16 11:02:14 +01004029 install_element(BTS_NODE, &cfg_bts_force_comb_si_cmd);
4030 install_element(BTS_NODE, &cfg_bts_no_force_comb_si_cmd);
Andreas Eversberg976493b2013-12-07 18:32:28 +01004031 install_element(BTS_NODE, &cfg_bts_codec0_cmd);
4032 install_element(BTS_NODE, &cfg_bts_codec1_cmd);
4033 install_element(BTS_NODE, &cfg_bts_codec2_cmd);
4034 install_element(BTS_NODE, &cfg_bts_codec3_cmd);
4035 install_element(BTS_NODE, &cfg_bts_codec4_cmd);
Holger Hans Peter Freyther15152612014-12-17 14:46:17 +01004036 install_element(BTS_NODE, &cfg_bts_depends_on_cmd);
4037 install_element(BTS_NODE, &cfg_bts_no_depends_on_cmd);
Andreas Eversbergfa163e82014-01-19 11:47:44 +01004038 install_element(BTS_NODE, &cfg_bts_amr_fr_modes1_cmd);
4039 install_element(BTS_NODE, &cfg_bts_amr_fr_modes2_cmd);
4040 install_element(BTS_NODE, &cfg_bts_amr_fr_modes3_cmd);
4041 install_element(BTS_NODE, &cfg_bts_amr_fr_modes4_cmd);
4042 install_element(BTS_NODE, &cfg_bts_amr_fr_thres1_cmd);
4043 install_element(BTS_NODE, &cfg_bts_amr_fr_thres2_cmd);
4044 install_element(BTS_NODE, &cfg_bts_amr_fr_thres3_cmd);
4045 install_element(BTS_NODE, &cfg_bts_amr_fr_hyst1_cmd);
4046 install_element(BTS_NODE, &cfg_bts_amr_fr_hyst2_cmd);
4047 install_element(BTS_NODE, &cfg_bts_amr_fr_hyst3_cmd);
4048 install_element(BTS_NODE, &cfg_bts_amr_fr_start_mode_cmd);
4049 install_element(BTS_NODE, &cfg_bts_amr_hr_modes1_cmd);
4050 install_element(BTS_NODE, &cfg_bts_amr_hr_modes2_cmd);
4051 install_element(BTS_NODE, &cfg_bts_amr_hr_modes3_cmd);
4052 install_element(BTS_NODE, &cfg_bts_amr_hr_modes4_cmd);
4053 install_element(BTS_NODE, &cfg_bts_amr_hr_thres1_cmd);
4054 install_element(BTS_NODE, &cfg_bts_amr_hr_thres2_cmd);
4055 install_element(BTS_NODE, &cfg_bts_amr_hr_thres3_cmd);
4056 install_element(BTS_NODE, &cfg_bts_amr_hr_hyst1_cmd);
4057 install_element(BTS_NODE, &cfg_bts_amr_hr_hyst2_cmd);
4058 install_element(BTS_NODE, &cfg_bts_amr_hr_hyst3_cmd);
4059 install_element(BTS_NODE, &cfg_bts_amr_hr_start_mode_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08004060
4061 install_element(BTS_NODE, &cfg_trx_cmd);
4062 install_node(&trx_node, dummy_config_write);
Jacob Erlbeckf414e852013-10-29 09:30:30 +01004063 vty_install_default(TRX_NODE);
Harald Welte59b04682009-06-10 05:40:52 +08004064 install_element(TRX_NODE, &cfg_trx_arfcn_cmd);
Harald Welte8791dac2010-05-14 17:59:53 +02004065 install_element(TRX_NODE, &cfg_description_cmd);
4066 install_element(TRX_NODE, &cfg_no_description_cmd);
Harald Welte (local)b709bfe2009-12-27 20:56:38 +01004067 install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
Harald Welte7f597bc2009-06-20 22:36:12 +02004068 install_element(TRX_NODE, &cfg_trx_max_power_red_cmd);
Harald Welte62868882009-08-08 16:12:58 +02004069 install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd);
4070 install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd);
Holger Hans Peter Freyther1c8b4802009-11-11 11:54:24 +01004071 install_element(TRX_NODE, &cfg_trx_rf_locked_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08004072
4073 install_element(TRX_NODE, &cfg_ts_cmd);
4074 install_node(&ts_node, dummy_config_write);
Jacob Erlbeckf414e852013-10-29 09:30:30 +01004075 vty_install_default(TS_NODE);
Harald Welte3ffe1b32009-08-07 00:25:23 +02004076 install_element(TS_NODE, &cfg_ts_pchan_cmd);
Harald Welte2addf852012-08-17 12:42:06 +02004077 install_element(TS_NODE, &cfg_ts_pchan_compat_cmd);
Harald Welte85771a42011-05-30 12:09:13 +02004078 install_element(TS_NODE, &cfg_ts_tsc_cmd);
Harald Weltea42a93f2010-06-14 22:26:10 +02004079 install_element(TS_NODE, &cfg_ts_hopping_cmd);
Harald Welte67104d12009-09-12 13:05:33 +02004080 install_element(TS_NODE, &cfg_ts_hsn_cmd);
4081 install_element(TS_NODE, &cfg_ts_maio_cmd);
4082 install_element(TS_NODE, &cfg_ts_arfcn_add_cmd);
4083 install_element(TS_NODE, &cfg_ts_arfcn_del_cmd);
Harald Welte3ffe1b32009-08-07 00:25:23 +02004084 install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
Harald Welte59b04682009-06-10 05:40:52 +08004085
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02004086 install_element(ENABLE_NODE, &drop_bts_cmd);
Holger Hans Peter Freyther8ab66e82016-03-16 13:45:23 +01004087 install_element(ENABLE_NODE, &restart_bts_cmd);
Harald Welte5213e992010-12-23 13:18:07 +01004088 install_element(ENABLE_NODE, &pdch_act_cmd);
Harald Weltebf4ba722014-12-28 15:00:45 +01004089 install_element(ENABLE_NODE, &smscb_cmd_cmd);
Holger Hans Peter Freyther07ff1c32010-10-26 09:40:13 +02004090
Harald Welte63b964e2010-05-31 16:40:40 +02004091 abis_nm_vty_init();
Harald Welte1d5a2062011-02-12 14:42:59 +01004092 abis_om2k_vty_init();
Harald Weltee76bea02011-02-05 13:54:41 +01004093 e1inp_vty_init();
Harald Welte44ccb0d2017-01-13 00:10:32 +01004094 osmo_fsm_vty_add_cmds();
Harald Welte63b964e2010-05-31 16:40:40 +02004095
Harald Welte40152872010-05-16 20:52:23 +02004096 bsc_vty_init_extra();
Harald Welte59b04682009-06-10 05:40:52 +08004097
4098 return 0;
4099}