Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1 | /* OpenBSC interface to quagga VTY */ |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2 | /* (C) 2009-2010 by Harald Welte <laforge@gnumonks.org> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 3 | * All Rights Reserved |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
Harald Welte | 0e3e88e | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 6 | * 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 Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Harald Welte | 0e3e88e | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 13 | * GNU Affero General Public License for more details. |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 14 | * |
Harald Welte | 0e3e88e | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 15 | * 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 Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 17 | * |
| 18 | */ |
| 19 | |
| 20 | #include <stdlib.h> |
Max | 3d94aca | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 21 | #include <stdbool.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 22 | #include <unistd.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 23 | |
Harald Welte | bd9591f | 2010-05-19 19:45:32 +0200 | [diff] [blame] | 24 | #include <osmocom/vty/command.h> |
| 25 | #include <osmocom/vty/buffer.h> |
| 26 | #include <osmocom/vty/vty.h> |
| 27 | #include <osmocom/vty/logging.h> |
Jacob Erlbeck | 63fac68 | 2015-10-26 16:25:37 +0100 | [diff] [blame] | 28 | #include <osmocom/vty/stats.h> |
Harald Welte | bd9591f | 2010-05-19 19:45:32 +0200 | [diff] [blame] | 29 | #include <osmocom/vty/telnet_interface.h> |
Harald Welte | 2addf85 | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 30 | #include <osmocom/vty/misc.h> |
Max | 3d94aca | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 31 | #include <osmocom/gsm/protocol/gsm_04_08.h> |
Holger Hans Peter Freyther | 35e6fbb | 2013-02-05 09:39:09 +0100 | [diff] [blame] | 32 | #include <osmocom/gsm/gsm0502.h> |
| 33 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 34 | #include <arpa/inet.h> |
| 35 | |
Pablo Neira Ayuso | dd5fff4 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 36 | #include <osmocom/core/linuxlist.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 37 | #include <openbsc/gsm_data.h> |
Pablo Neira Ayuso | 42e41df | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 38 | #include <osmocom/abis/e1_input.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 39 | #include <openbsc/abis_nm.h> |
Harald Welte | 30f93fb | 2011-02-19 16:48:17 +0100 | [diff] [blame] | 40 | #include <openbsc/abis_om2000.h> |
Pablo Neira Ayuso | dd5fff4 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 41 | #include <osmocom/core/utils.h> |
| 42 | #include <osmocom/gsm/gsm_utils.h> |
Harald Welte | 73e6994 | 2011-05-23 20:42:26 +0200 | [diff] [blame] | 43 | #include <osmocom/gsm/abis_nm.h> |
Harald Welte | fe96f38 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 44 | #include <openbsc/chan_alloc.h> |
Harald Welte | 4400774 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 45 | #include <openbsc/meas_rep.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 46 | #include <openbsc/db.h> |
Holger Hans Peter Freyther | b70d45b | 2010-04-06 11:55:37 +0200 | [diff] [blame] | 47 | #include <openbsc/vty.h> |
Harald Welte | cfb6b28 | 2012-06-16 14:59:56 +0800 | [diff] [blame] | 48 | #include <osmocom/gprs/gprs_ns.h> |
Harald Welte | d8acf14 | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 49 | #include <openbsc/system_information.h> |
Harald Welte | 682ee5f | 2010-05-16 22:02:16 +0200 | [diff] [blame] | 50 | #include <openbsc/debug.h> |
Holger Hans Peter Freyther | 25176f1 | 2010-11-09 17:00:42 +0100 | [diff] [blame] | 51 | #include <openbsc/paging.h> |
Harald Welte | 64fcd77 | 2011-08-20 18:25:02 +0200 | [diff] [blame] | 52 | #include <openbsc/ipaccess.h> |
Harald Welte | 5213e99 | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 53 | #include <openbsc/abis_rsl.h> |
Neels Hofmeyr | 3863935 | 2017-02-23 21:49:55 +0100 | [diff] [blame^] | 54 | #include <openbsc/bsc_msc_data.h> |
Holger Hans Peter Freyther | d014692 | 2011-02-24 14:19:14 +0100 | [diff] [blame] | 55 | #include <openbsc/osmo_bsc_rf.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 56 | |
Neels Hofmeyr | bfe2727 | 2016-05-12 01:16:58 +0200 | [diff] [blame] | 57 | #include <openbsc/common_cs.h> |
| 58 | |
Holger Hans Peter Freyther | 35e6fbb | 2013-02-05 09:39:09 +0100 | [diff] [blame] | 59 | #include <inttypes.h> |
| 60 | |
Harald Welte | d9dea59 | 2011-03-04 13:53:51 +0100 | [diff] [blame] | 61 | #include "../../bscconfig.h" |
Harald Welte | 10c29f6 | 2010-05-16 19:20:24 +0200 | [diff] [blame] | 62 | |
Holger Hans Peter Freyther | e812704 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 63 | |
Holger Hans Peter Freyther | e812704 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 64 | #define LCHAN_NR_STR "Logical Channel Number\n" |
| 65 | |
| 66 | |
Harald Welte | d6b62e3 | 2010-05-12 17:19:53 +0000 | [diff] [blame] | 67 | /* FIXME: this should go to some common file */ |
| 68 | static const struct value_string gprs_ns_timer_strs[] = { |
Harald Welte | a925176 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 69 | { 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 Welte | d6b62e3 | 2010-05-12 17:19:53 +0000 | [diff] [blame] | 79 | static const struct value_string gprs_bssgp_cfg_strs[] = { |
Harald Welte | a925176 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 80 | { 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 Welte | f989b78 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 94 | static 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 Willmann | 2c9540c | 2012-05-14 18:43:23 +0200 | [diff] [blame] | 101 | const 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 Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 108 | struct cmd_node bts_node = { |
| 109 | BTS_NODE, |
Harald Welte | 45362bb | 2012-08-17 13:16:10 +0200 | [diff] [blame] | 110 | "%s(config-net-bts)# ", |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 111 | 1, |
| 112 | }; |
| 113 | |
| 114 | struct cmd_node trx_node = { |
| 115 | TRX_NODE, |
Harald Welte | 45362bb | 2012-08-17 13:16:10 +0200 | [diff] [blame] | 116 | "%s(config-net-bts-trx)# ", |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 117 | 1, |
| 118 | }; |
| 119 | |
| 120 | struct cmd_node ts_node = { |
| 121 | TS_NODE, |
Harald Welte | 45362bb | 2012-08-17 13:16:10 +0200 | [diff] [blame] | 122 | "%s(config-net-bts-trx-ts)# ", |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 123 | 1, |
| 124 | }; |
| 125 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 126 | static int dummy_config_write(struct vty *v) |
| 127 | { |
| 128 | return CMD_SUCCESS; |
| 129 | } |
| 130 | |
| 131 | static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms) |
| 132 | { |
Harald Welte | e7b751c | 2013-03-15 16:57:33 +0100 | [diff] [blame] | 133 | 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 Welte | 306a889 | 2011-05-23 20:30:39 +0200 | [diff] [blame] | 136 | abis_nm_avail_name(nms->availability), VTY_NEWLINE); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 137 | } |
| 138 | |
Harald Welte | fe96f38 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 139 | static 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 Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 159 | static void net_dump_vty(struct vty *vty, struct gsm_network *net) |
| 160 | { |
Harald Welte | fe96f38 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 161 | struct pchan_load pl; |
| 162 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 163 | 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); |
Max | 0a378ba | 2016-05-24 14:23:27 +0200 | [diff] [blame] | 170 | 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); |
Max | 5872641 | 2016-06-30 10:25:49 +0200 | [diff] [blame] | 175 | 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 Welte | 59936d7 | 2009-11-18 20:33:19 +0100 | [diff] [blame] | 179 | vty_out(vty, " Location updating reject cause: %u%s", |
| 180 | net->reject_cause, VTY_NEWLINE); |
Harald Welte | cca253a | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 181 | vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption, |
| 182 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 96c8982 | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 183 | vty_out(vty, " NECI (TCH/H): %u%s", net->neci, |
| 184 | VTY_NEWLINE); |
Holger Hans Peter Freyther | b6b9d70 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 185 | vty_out(vty, " Use TCH for Paging any: %d%s", net->pag_any_tch, |
| 186 | VTY_NEWLINE); |
Harald Welte | 52af195 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 187 | vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode), |
| 188 | VTY_NEWLINE); |
Harald Welte | a310f3e | 2009-12-14 09:00:24 +0100 | [diff] [blame] | 189 | vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off", |
| 190 | VTY_NEWLINE); |
Harald Welte | 0af9c9f | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 191 | vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off", |
| 192 | VTY_NEWLINE); |
Harald Welte | fe96f38 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 193 | 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 Freyther | d014692 | 2011-02-24 14:19:14 +0100 | [diff] [blame] | 196 | |
| 197 | /* show rf */ |
Holger Hans Peter Freyther | ab25ee4 | 2014-02-08 12:12:03 +0100 | [diff] [blame] | 198 | if (net->bsc_data) |
Holger Hans Peter Freyther | d014692 | 2011-02-24 14:19:14 +0100 | [diff] [blame] | 199 | vty_out(vty, " Last RF Command: %s%s", |
Holger Hans Peter Freyther | 4d61417 | 2011-08-15 15:53:00 +0200 | [diff] [blame] | 200 | net->bsc_data->rf_ctrl->last_state_command, |
Holger Hans Peter Freyther | d014692 | 2011-02-24 14:19:14 +0100 | [diff] [blame] | 201 | VTY_NEWLINE); |
Holger Hans Peter Freyther | ab25ee4 | 2014-02-08 12:12:03 +0100 | [diff] [blame] | 202 | if (net->bsc_data) |
Jacob Erlbeck | dcce8e8 | 2013-09-11 10:46:57 +0200 | [diff] [blame] | 203 | vty_out(vty, " Last RF Lock Command: %s%s", |
| 204 | net->bsc_data->rf_ctrl->last_rf_lock_ctrl_command, |
| 205 | VTY_NEWLINE); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 206 | } |
| 207 | |
Neels Hofmeyr | d416b48 | 2016-05-12 01:53:23 +0200 | [diff] [blame] | 208 | DEFUN(bsc_show_net, bsc_show_net_cmd, "show network", |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 209 | SHOW_STR "Display information about a GSM NETWORK\n") |
| 210 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 211 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 212 | net_dump_vty(vty, net); |
| 213 | |
| 214 | return CMD_SUCCESS; |
| 215 | } |
| 216 | |
| 217 | static 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 | |
| 235 | static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts) |
| 236 | { |
Harald Welte | fe96f38 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 237 | struct pchan_load pl; |
| 238 | |
Holger Hans Peter Freyther | a098dfb | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 239 | vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, " |
Harald Welte | 4d4a2a2 | 2015-11-20 10:50:24 +0100 | [diff] [blame] | 240 | "BSIC %u (NCC=%u, BCC=%u) and %u TRX%s", |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 241 | bts->nr, btstype2str(bts->type), gsm_band_name(bts->band), |
Holger Hans Peter Freyther | a098dfb | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 242 | bts->cell_identity, |
Harald Welte | 7bb55f3 | 2015-11-20 10:43:31 +0100 | [diff] [blame] | 243 | bts->location_area_code, bts->bsic, |
Harald Welte | 4d4a2a2 | 2015-11-20 10:50:24 +0100 | [diff] [blame] | 244 | bts->bsic >> 3, bts->bsic & 7, |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 245 | bts->num_trx, VTY_NEWLINE); |
Harald Welte | 8791dac | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 246 | vty_out(vty, "Description: %s%s", |
| 247 | bts->description ? bts->description : "(null)", VTY_NEWLINE); |
Harald Welte | 8e9d179 | 2009-12-12 15:38:16 +0100 | [diff] [blame] | 248 | vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE); |
Harald Welte | b761bf8 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 249 | vty_out(vty, "Minimum Rx Level for Access: %i dBm%s", |
Harald Welte | 8e9d179 | 2009-12-12 15:38:16 +0100 | [diff] [blame] | 250 | rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min), |
| 251 | VTY_NEWLINE); |
| 252 | vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s", |
Harald Welte | b761bf8 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 253 | bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE); |
Sylvain Munaut | 8e2d8de | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 254 | 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 Welte | 8c973ba | 2009-12-21 23:08:18 +0100 | [diff] [blame] | 259 | if (bts->si_common.rach_control.cell_bar) |
Harald Welte (local) | e19be3f | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 260 | vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE); |
Max | 3d94aca | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 261 | 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 Eversberg | 14e12f2 | 2012-10-13 07:27:47 +0200 | [diff] [blame] | 269 | 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 Welte | d8acf14 | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 275 | vty_out(vty, "System Information present: 0x%08x, static: 0x%08x%s", |
| 276 | bts->si_valid, bts->si_mode_static, VTY_NEWLINE); |
Harald Welte | 44ccb0d | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 277 | vty_out(vty, "Early Classmark Sending: %s%s", |
| 278 | bts->early_classmark_allowed ? "allowed" : "forbidden", |
| 279 | VTY_NEWLINE); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 280 | if (is_ipaccess_bts(bts)) |
Harald Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 281 | vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s", |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 282 | bts->ip_access.site_id, bts->ip_access.bts_id, |
Harald Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 283 | bts->oml_tei, VTY_NEWLINE); |
Sylvain Munaut | cb8e843 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 284 | 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 Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 287 | vty_out(vty, " NM State: "); |
Harald Welte | 69f6f81 | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 288 | net_dump_nmstate(vty, &bts->mo.nm_state); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 289 | vty_out(vty, " Site Mgr NM State: "); |
Harald Welte | 69f6f81 | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 290 | net_dump_nmstate(vty, &bts->site_mgr.mo.nm_state); |
Holger Hans Peter Freyther | 03d80af | 2013-05-29 16:22:09 +0200 | [diff] [blame] | 291 | 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 Freyther | 914ff19 | 2011-04-26 15:52:34 +0200 | [diff] [blame] | 299 | vty_out(vty, " Paging: %u pending requests, %u free slots%s", |
| 300 | paging_pending_requests_nr(bts), |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 301 | bts->paging.available_slots, VTY_NEWLINE); |
Holger Hans Peter Freyther | b5c79c9 | 2010-11-25 16:28:45 +0100 | [diff] [blame] | 302 | 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 Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 306 | vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE); |
| 307 | e1isl_dump_vty(vty, bts->oml_link); |
| 308 | } |
Holger Hans Peter Freyther | b5c79c9 | 2010-11-25 16:28:45 +0100 | [diff] [blame] | 309 | |
| 310 | /* FIXME: chan_desc */ |
Harald Welte | fe96f38 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 311 | memset(&pl, 0, sizeof(pl)); |
Neels Hofmeyr | 7c0b45b | 2016-09-25 17:01:20 +0200 | [diff] [blame] | 312 | bts_chan_load(&pl, bts); |
Harald Welte | fe96f38 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 313 | vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE); |
| 314 | dump_pchan_load_vty(vty, " ", &pl); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 315 | } |
| 316 | |
Sylvain Munaut | 1ad9628 | 2012-12-28 12:15:11 +0100 | [diff] [blame] | 317 | DEFUN(show_bts, show_bts_cmd, "show bts [<0-255>]", |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 318 | SHOW_STR "Display information about a BTS\n" |
| 319 | "BTS number") |
| 320 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 321 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 322 | 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 Welte | da5db86 | 2010-12-24 12:24:03 +0100 | [diff] [blame] | 327 | if (bts_nr >= net->num_bts) { |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 328 | vty_out(vty, "%% can't find BTS '%s'%s", argv[0], |
| 329 | VTY_NEWLINE); |
| 330 | return CMD_WARNING; |
| 331 | } |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 332 | bts_dump_vty(vty, gsm_bts_num(net, bts_nr)); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 333 | return CMD_SUCCESS; |
| 334 | } |
| 335 | /* print all BTS's */ |
| 336 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 337 | bts_dump_vty(vty, gsm_bts_num(net, bts_nr)); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 338 | |
| 339 | return CMD_SUCCESS; |
| 340 | } |
| 341 | |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 342 | /* utility functions */ |
| 343 | static 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 | |
| 354 | static 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 Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 370 | static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts) |
| 371 | { |
Neels Hofmeyr | 0aec2f9 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 372 | vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE); |
Harald Welte | 7bb55f3 | 2015-11-20 10:43:31 +0100 | [diff] [blame] | 373 | if (ts->tsc != -1) |
Neels Hofmeyr | 0aec2f9 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 374 | vty_out(vty, " training_sequence_code %u%s", ts->tsc, VTY_NEWLINE); |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 375 | if (ts->pchan != GSM_PCHAN_NONE) |
Neels Hofmeyr | 0aec2f9 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 376 | vty_out(vty, " phys_chan_config %s%s", |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 377 | gsm_pchan_name(ts->pchan), VTY_NEWLINE); |
Neels Hofmeyr | 0aec2f9 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 378 | vty_out(vty, " hopping enabled %u%s", |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 379 | ts->hopping.enabled, VTY_NEWLINE); |
| 380 | if (ts->hopping.enabled) { |
| 381 | unsigned int i; |
Neels Hofmeyr | 0aec2f9 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 382 | vty_out(vty, " hopping sequence-number %u%s", |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 383 | ts->hopping.hsn, VTY_NEWLINE); |
Neels Hofmeyr | 0aec2f9 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 384 | vty_out(vty, " hopping maio %u%s", |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 385 | ts->hopping.maio, VTY_NEWLINE); |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 386 | for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) { |
| 387 | if (!bitvec_get_bit_pos(&ts->hopping.arfcns, i)) |
| 388 | continue; |
Neels Hofmeyr | 0aec2f9 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 389 | vty_out(vty, " hopping arfcn add %u%s", |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 390 | i, VTY_NEWLINE); |
| 391 | } |
Harald Welte | ff59809 | 2010-12-24 12:07:07 +0100 | [diff] [blame] | 392 | } |
Neels Hofmeyr | 0aec2f9 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 393 | config_write_e1_link(vty, &ts->e1_link, " "); |
Harald Welte | c02789e | 2011-02-14 16:15:21 +0100 | [diff] [blame] | 394 | |
| 395 | if (ts->trx->bts->model->config_write_ts) |
| 396 | ts->trx->bts->model->config_write_ts(vty, ts); |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 397 | } |
| 398 | |
| 399 | static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx) |
| 400 | { |
| 401 | int i; |
| 402 | |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 403 | vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE); |
Harald Welte | 8791dac | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 404 | if (trx->description) |
| 405 | vty_out(vty, " description %s%s", trx->description, |
| 406 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 32be2aa | 2010-04-17 06:42:07 +0200 | [diff] [blame] | 407 | vty_out(vty, " rf_locked %u%s", |
Harald Welte | 69f6f81 | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 408 | trx->mo.nm_state.administrative == NM_STATE_LOCKED ? 1 : 0, |
Holger Hans Peter Freyther | 32be2aa | 2010-04-17 06:42:07 +0200 | [diff] [blame] | 409 | VTY_NEWLINE); |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 410 | vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE); |
Harald Welte (local) | b709bfe | 2009-12-27 20:56:38 +0100 | [diff] [blame] | 411 | vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE); |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 412 | vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE); |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 413 | 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 Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 415 | |
Harald Welte | c02789e | 2011-02-14 16:15:21 +0100 | [diff] [blame] | 416 | if (trx->bts->model->config_write_trx) |
| 417 | trx->bts->model->config_write_trx(vty, trx); |
| 418 | |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 419 | for (i = 0; i < TRX_NR_TS; i++) |
| 420 | config_write_ts_single(vty, &trx->ts[i]); |
| 421 | } |
| 422 | |
Harald Welte | a925176 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 423 | static 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 | |
bhargava | 612722c | 2016-07-21 11:14:34 +0530 | [diff] [blame] | 431 | vty_out(vty, " gprs 11bit_rach_support_for_egprs %u%s", |
| 432 | bts->gprs.supports_egprs_11bit_rach, VTY_NEWLINE); |
| 433 | |
Harald Welte | a925176 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 434 | vty_out(vty, " gprs routing area %u%s", bts->gprs.rac, |
| 435 | VTY_NEWLINE); |
Andreas Eversberg | a4fa21c | 2013-03-16 16:31:26 +0100 | [diff] [blame] | 436 | vty_out(vty, " gprs network-control-order nc%u%s", |
| 437 | bts->gprs.net_ctrl_ord, VTY_NEWLINE); |
Max | 88bdcd4 | 2016-07-28 11:55:37 +0200 | [diff] [blame] | 438 | if (!bts->gprs.ctrl_ack_type_use_block) |
| 439 | vty_out(vty, " gprs control-ack-type-rach%s", VTY_NEWLINE); |
Harald Welte | a925176 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 440 | 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 Freyther | 38c5667 | 2013-09-15 17:23:34 +0200 | [diff] [blame] | 469 | /* Write the model data if there is one */ |
| 470 | static void config_write_bts_model(struct vty *vty, struct gsm_bts *bts) |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 471 | { |
| 472 | struct gsm_bts_trx *trx; |
Holger Hans Peter Freyther | 38c5667 | 2013-09-15 17:23:34 +0200 | [diff] [blame] | 473 | |
| 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 Freyther | 8083cc9 | 2015-09-24 11:39:38 +0200 | [diff] [blame] | 484 | static 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 Eversberg | fa163e8 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 499 | static 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 Freyther | 8083cc9 | 2015-09-24 11:39:38 +0200 | [diff] [blame] | 523 | write_amr_modes(vty, prefix, "ms", mr->ms_mode, num); |
| 524 | write_amr_modes(vty, prefix, "bts", mr->bts_mode, num); |
Andreas Eversberg | fa163e8 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 525 | } |
| 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 Freyther | 38c5667 | 2013-09-15 17:23:34 +0200 | [diff] [blame] | 541 | static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) |
| 542 | { |
Harald Welte | d8acf14 | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 543 | int i; |
Max | eee605b | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 544 | uint8_t tmp; |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 545 | |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 546 | vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE); |
| 547 | vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE); |
Harald Welte | 8791dac | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 548 | if (bts->description) |
| 549 | vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE); |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 550 | vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE); |
Holger Hans Peter Freyther | 6d82b7c | 2009-11-19 16:38:49 +0100 | [diff] [blame] | 551 | vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE); |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 552 | vty_out(vty, " location_area_code %u%s", bts->location_area_code, |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 553 | VTY_NEWLINE); |
Max | 3d94aca | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 554 | 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 Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 560 | vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE); |
Harald Welte (local) | cbd4610 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 561 | vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE); |
Harald Welte | b761bf8 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 562 | 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 Munaut | 00d7146 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 566 | |
| 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 Freyther | 2fb8ebf | 2013-07-27 21:07:57 +0200 | [diff] [blame] | 594 | /* 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 Eversberg | f9248d9 | 2013-03-10 11:49:35 +0100 | [diff] [blame] | 601 | vty_out(vty, " radio-link-timeout %d%s", |
| 602 | get_radio_link_timeout(&bts->si_common.cell_options), |
| 603 | VTY_NEWLINE); |
Harald Welte | 3e77461 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 604 | vty_out(vty, " channel allocator %s%s", |
| 605 | bts->chan_alloc_reverse ? "descending" : "ascending", |
| 606 | VTY_NEWLINE); |
Sylvain Munaut | 8e2d8de | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 607 | 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 Freyther | 697ed2b | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 612 | |
Andreas Eversberg | 14e12f2 | 2012-10-13 07:27:47 +0200 | [diff] [blame] | 613 | 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 Freyther | 697ed2b | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 620 | 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 Welte | 8c973ba | 2009-12-21 23:08:18 +0100 | [diff] [blame] | 626 | if (bts->si_common.rach_control.cell_bar) |
Harald Welte (local) | e19be3f | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 627 | vty_out(vty, " cell barred 1%s", VTY_NEWLINE); |
Holger Hans Peter Freyther | 440984b | 2010-05-14 00:39:19 +0800 | [diff] [blame] | 628 | if ((bts->si_common.rach_control.t2 & 0x4) == 0) |
| 629 | vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE); |
Ivan Kluchnikov | 80d5843 | 2013-09-16 13:13:04 +0400 | [diff] [blame] | 630 | 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 Welte | d8acf14 | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 638 | 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 Munaut | 79eae14 | 2011-11-13 23:05:23 +0100 | [diff] [blame] | 644 | osmo_hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])), |
Harald Welte | d8acf14 | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 645 | VTY_NEWLINE); |
| 646 | } |
| 647 | } |
Harald Welte | 44ccb0d | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 648 | vty_out(vty, " early-classmark-sending %s%s", |
| 649 | bts->early_classmark_allowed ? "allowed" : "forbidden", VTY_NEWLINE); |
Harald Welte | 08011e2 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 650 | switch (bts->type) { |
| 651 | case GSM_BTS_TYPE_NANOBTS: |
Harald Welte | 35ac0e4 | 2012-07-02 19:51:55 +0200 | [diff] [blame] | 652 | case GSM_BTS_TYPE_OSMO_SYSMO: |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 653 | vty_out(vty, " ip.access unit_id %u %u%s", |
Harald Welte | 3ffe1b3 | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 654 | bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE); |
Harald Welte | 8b3c595 | 2013-03-12 13:57:05 +0100 | [diff] [blame] | 655 | 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 Ayuso | 42e41df | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 661 | 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 Welte | 08011e2 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 663 | break; |
Sylvain Munaut | cb8e843 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 664 | case GSM_BTS_TYPE_NOKIA_SITE: |
| 665 | vty_out(vty, " nokia_site skip-reset %d%s", bts->nokia.skip_reset, VTY_NEWLINE); |
Andreas Eversberg | ac27b95 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 666 | vty_out(vty, " nokia_site no-local-rel-conf %d%s", |
| 667 | bts->nokia.no_loc_rel_cnf, VTY_NEWLINE); |
Sipos Csaba | def87b4 | 2015-02-07 13:27:36 +0100 | [diff] [blame] | 668 | vty_out(vty, " nokia_site bts-reset-timer %d%s", bts->nokia.bts_reset_timer_cnf, VTY_NEWLINE); |
Andreas Eversberg | c3daa0f | 2013-12-05 16:02:37 +0100 | [diff] [blame] | 669 | /* fall through: Nokia requires "oml e1" parameters also */ |
Harald Welte | 08011e2 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 670 | default: |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 671 | 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 Welte | 08011e2 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 673 | break; |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 674 | } |
Holger Hans Peter Freyther | 3112f67 | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 675 | |
| 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 Welte | ca46eff | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 680 | vty_out(vty, " neighbor-list mode %s%s", |
Harald Welte | f989b78 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 681 | 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 Welte | ca46eff | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 683 | 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 Welte | f989b78 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 689 | 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 Welte | ca46eff | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 696 | |
Max | 88ddcaa | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 697 | for (i = 0; i < MAX_EARFCN_LIST; i++) { |
Max | eee605b | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 698 | 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); |
Max | 88ddcaa | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 715 | |
| 716 | vty_out(vty, "%s", VTY_NEWLINE); |
| 717 | } |
| 718 | } |
| 719 | |
Max | eaf196c | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 720 | 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 Eversberg | 976493b | 2013-12-07 18:32:28 +0100 | [diff] [blame] | 728 | 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 Eversberg | fa163e8 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 737 | config_write_bts_amr(vty, bts, &bts->mr_full, 1); |
| 738 | config_write_bts_amr(vty, bts, &bts->mr_half, 0); |
| 739 | |
Harald Welte | a925176 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 740 | config_write_bts_gprs(vty, bts); |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 741 | |
Holger Hans Peter Freyther | 1079916 | 2012-07-20 10:27:31 +0200 | [diff] [blame] | 742 | if (bts->excl_from_rf_lock) |
| 743 | vty_out(vty, " rf-lock-exclude%s", VTY_NEWLINE); |
| 744 | |
Jacob Erlbeck | 8f8e5bf | 2014-01-16 11:02:14 +0100 | [diff] [blame] | 745 | vty_out(vty, " %sforce-combined-si%s", |
| 746 | bts->force_combined_si ? "" : "no ", VTY_NEWLINE); |
| 747 | |
Holger Hans Peter Freyther | 1515261 | 2014-12-17 14:46:17 +0100 | [diff] [blame] | 748 | 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 Freyther | 38c5667 | 2013-09-15 17:23:34 +0200 | [diff] [blame] | 765 | config_write_bts_model(vty, bts); |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 766 | } |
| 767 | |
| 768 | static int config_write_bts(struct vty *v) |
| 769 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 770 | struct gsm_network *gsmnet = gsmnet_from_vty(v); |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 771 | 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 Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 779 | static int config_write_net(struct vty *vty) |
| 780 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 781 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 782 | |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 783 | vty_out(vty, "network%s", VTY_NEWLINE); |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 784 | vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE); |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 785 | vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE); |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 786 | 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) | a59a27e | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 788 | vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE); |
Max | 0a378ba | 2016-05-24 14:23:27 +0200 | [diff] [blame] | 789 | if (gsmnet->authorized_reg_str) |
| 790 | vty_out(vty, " authorized-regexp %s%s", gsmnet->authorized_reg_str, VTY_NEWLINE); |
Harald Welte | 59936d7 | 2009-11-18 20:33:19 +0100 | [diff] [blame] | 791 | vty_out(vty, " location updating reject cause %u%s", |
| 792 | gsmnet->reject_cause, VTY_NEWLINE); |
Harald Welte | cca253a | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 793 | vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE); |
Holger Hans Peter Freyther | 6b4f546 | 2009-11-19 16:37:48 +0100 | [diff] [blame] | 794 | vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE); |
Holger Hans Peter Freyther | b6b9d70 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 795 | vty_out(vty, " paging any use tch %d%s", gsmnet->pag_any_tch, VTY_NEWLINE); |
Harald Welte | 52af195 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 796 | vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode), |
| 797 | VTY_NEWLINE); |
Harald Welte | a310f3e | 2009-12-14 09:00:24 +0100 | [diff] [blame] | 798 | vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE); |
Harald Welte | 0af9c9f | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 799 | vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE); |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 800 | 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 Freyther | 26ba2e7 | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 812 | vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE); |
Holger Hans Peter Freyther | 8973386 | 2009-11-21 21:42:26 +0100 | [diff] [blame] | 813 | 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 Welte | a00fdd7 | 2010-12-23 14:39:29 +0100 | [diff] [blame] | 822 | vty_out(vty, " timer t3122 %u%s", gsmnet->T3122, VTY_NEWLINE); |
Holger Hans Peter Freyther | 8973386 | 2009-11-21 21:42:26 +0100 | [diff] [blame] | 823 | vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE); |
Holger Hans Peter Freyther | 68b21e1 | 2010-12-22 16:26:04 +0100 | [diff] [blame] | 824 | vty_out(vty, " subscriber-keep-in-ram %d%s", |
Jacob Erlbeck | da8770b | 2014-12-03 09:28:24 +0100 | [diff] [blame] | 825 | gsmnet->subscr_group->keep_subscr, VTY_NEWLINE); |
Neels Hofmeyr | 21edaef | 2016-05-10 13:29:33 +0200 | [diff] [blame] | 826 | 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 Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 835 | |
| 836 | return CMD_SUCCESS; |
| 837 | } |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 838 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 839 | static 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 Welte | 8791dac | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 843 | vty_out(vty, "Description: %s%s", |
| 844 | trx->description ? trx->description : "(null)", VTY_NEWLINE); |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 845 | vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, " |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 846 | "resulting BS power: %d dBm%s", |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 847 | trx->nominal_power, trx->max_power_red, |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 848 | trx->nominal_power - trx->max_power_red, VTY_NEWLINE); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 849 | vty_out(vty, " NM State: "); |
Harald Welte | 69f6f81 | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 850 | net_dump_nmstate(vty, &trx->mo.nm_state); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 851 | vty_out(vty, " Baseband Transceiver NM State: "); |
Harald Welte | 69f6f81 | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 852 | net_dump_nmstate(vty, &trx->bb_transc.mo.nm_state); |
Harald Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 853 | 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 Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 860 | } |
| 861 | |
| 862 | DEFUN(show_trx, |
| 863 | show_trx_cmd, |
Sylvain Munaut | 1ad9628 | 2012-12-28 12:15:11 +0100 | [diff] [blame] | 864 | "show trx [<0-255>] [<0-255>]", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 865 | SHOW_STR "Display information about a TRX\n" |
| 866 | "BTS Number\n" |
| 867 | "TRX Number\n") |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 868 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 869 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 870 | 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 Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 882 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 883 | } |
| 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 Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 891 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 892 | 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 Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 898 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 899 | 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 Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 905 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 906 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 907 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 908 | trx_dump_vty(vty, trx); |
| 909 | } |
| 910 | } |
| 911 | |
| 912 | return CMD_SUCCESS; |
| 913 | } |
| 914 | |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 915 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 916 | static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts) |
| 917 | { |
Harald Welte | 85771a4 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 918 | vty_out(vty, "BTS %u, TRX %u, Timeslot %u, phys cfg %s, TSC %u", |
Harald Welte | e3bd0c0 | 2010-12-24 12:12:10 +0100 | [diff] [blame] | 919 | ts->trx->bts->nr, ts->trx->nr, ts->nr, |
Harald Welte | 025e6c9 | 2014-01-19 17:18:21 +0100 | [diff] [blame] | 920 | gsm_pchan_name(ts->pchan), gsm_ts_tsc(ts)); |
Harald Welte | 98d2bb8 | 2010-12-24 12:14:52 +0100 | [diff] [blame] | 921 | if (ts->pchan == GSM_PCHAN_TCH_F_PDCH) |
Harald Welte | 81c2ed3 | 2010-12-24 12:26:13 +0100 | [diff] [blame] | 922 | vty_out(vty, " (%s mode)", |
Neels Hofmeyr | 5a3c23c | 2016-06-14 14:08:35 +0200 | [diff] [blame] | 923 | ts->flags & TS_F_PDCH_ACTIVE ? "PDCH" : "TCH/F"); |
Harald Welte | 98d2bb8 | 2010-12-24 12:14:52 +0100 | [diff] [blame] | 924 | vty_out(vty, "%s", VTY_NEWLINE); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 925 | vty_out(vty, " NM State: "); |
Harald Welte | 69f6f81 | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 926 | net_dump_nmstate(vty, &ts->mo.nm_state); |
Harald Welte | 8750421 | 2009-12-02 01:56:49 +0530 | [diff] [blame] | 927 | if (!is_ipaccess_bts(ts->trx->bts)) |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 928 | 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 Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 931 | } |
| 932 | |
| 933 | DEFUN(show_ts, |
| 934 | show_ts_cmd, |
Sylvain Munaut | 1ad9628 | 2012-12-28 12:15:11 +0100 | [diff] [blame] | 935 | "show timeslot [<0-255>] [<0-255>] [<0-7>]", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 936 | SHOW_STR "Display information about a TS\n" |
| 937 | "BTS Number\n" "TRX Number\n" "Timeslot Number\n") |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 938 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 939 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 0686838 | 2010-12-24 12:05:03 +0100 | [diff] [blame] | 940 | struct gsm_bts *bts = NULL; |
| 941 | struct gsm_bts_trx *trx = NULL; |
| 942 | struct gsm_bts_trx_ts *ts = NULL; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 943 | 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 Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 953 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 954 | } |
| 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 Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 962 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 963 | } |
| 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 Welte | 0686838 | 2010-12-24 12:05:03 +0100 | [diff] [blame] | 971 | /* Fully Specified: print and exit */ |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 972 | ts = &trx->ts[ts_nr]; |
| 973 | ts_dump_vty(vty, ts); |
| 974 | return CMD_SUCCESS; |
| 975 | } |
Harald Welte | 0686838 | 2010-12-24 12:05:03 +0100 | [diff] [blame] | 976 | |
| 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 Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 985 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 986 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 987 | 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 Welte | 0686838 | 2010-12-24 12:05:03 +0100 | [diff] [blame] | 992 | } 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 Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1004 | } |
| 1005 | |
| 1006 | return CMD_SUCCESS; |
| 1007 | } |
| 1008 | |
Holger Hans Peter Freyther | 1dd0a1b | 2010-01-06 06:00:40 +0100 | [diff] [blame] | 1009 | static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr) |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1010 | { |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 1011 | vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id, |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1012 | subscr->authorized, VTY_NEWLINE); |
Holger Hans Peter Freyther | 7d552fc | 2013-12-12 15:45:41 +0100 | [diff] [blame] | 1013 | if (strlen(subscr->name)) |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1014 | vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE); |
Holger Hans Peter Freyther | 4fcba8e | 2014-04-04 11:53:18 +0200 | [diff] [blame] | 1015 | if (strlen(subscr->extension)) |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1016 | vty_out(vty, " Extension: %s%s", subscr->extension, |
| 1017 | VTY_NEWLINE); |
Holger Hans Peter Freyther | b0be39b | 2013-07-14 08:38:24 +0200 | [diff] [blame] | 1018 | vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE); |
Holger Hans Peter Freyther | cd8bacf | 2009-08-19 12:53:57 +0200 | [diff] [blame] | 1019 | if (subscr->tmsi != GSM_RESERVED_TMSI) |
| 1020 | vty_out(vty, " TMSI: %08X%s", subscr->tmsi, |
Harald Welte | 270c06c | 2009-08-15 03:24:51 +0200 | [diff] [blame] | 1021 | VTY_NEWLINE); |
Sylvain Munaut | e5863a2 | 2009-12-27 19:29:28 +0100 | [diff] [blame] | 1022 | |
Harald Welte (local) | 02d5efa | 2009-08-14 20:27:16 +0200 | [diff] [blame] | 1023 | vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1024 | } |
| 1025 | |
Harald Welte | 4400774 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 1026 | static 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 | |
| 1039 | static 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 Welte | e9db024 | 2015-12-05 17:22:49 +0100 | [diff] [blame] | 1060 | /* FIXME: move this to libosmogsm */ |
| 1061 | static 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 Hofmeyr | a7488ae | 2016-11-02 14:28:15 +0100 | [diff] [blame] | 1073 | /* 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. */ |
| 1075 | static 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 Freyther | 5424e02 | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1105 | static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan) |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1106 | { |
Harald Welte | 4400774 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 1107 | int idx; |
| 1108 | |
Harald Welte | f62dad6 | 2010-12-24 12:22:34 +0100 | [diff] [blame] | 1109 | 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 Hofmeyr | a7488ae | 2016-11-02 14:28:15 +0100 | [diff] [blame] | 1112 | /* 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 Freyther | 960adfe | 2014-12-28 12:08:28 +0100 | [diff] [blame] | 1128 | vty_out(vty, " Connection: %u, State: %s%s%s%s", |
Holger Hans Peter Freyther | 6e5c50f | 2010-06-28 17:09:29 +0800 | [diff] [blame] | 1129 | lchan->conn ? 1: 0, |
Holger Hans Peter Freyther | 960adfe | 2014-12-28 12:08:28 +0100 | [diff] [blame] | 1130 | 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 Welte | b761bf8 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 1134 | 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 Welte | e9db024 | 2015-12-05 17:22:49 +0100 | [diff] [blame] | 1139 | vty_out(vty, " Channel Mode / Codec: %s%s", |
| 1140 | get_value_string(gsm48_cmode_names, lchan->tch_mode), |
| 1141 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 1a95fa8 | 2010-06-28 15:47:12 +0800 | [diff] [blame] | 1142 | if (lchan->conn && lchan->conn->subscr) { |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1143 | vty_out(vty, " Subscriber:%s", VTY_NEWLINE); |
Holger Hans Peter Freyther | 1a95fa8 | 2010-06-28 15:47:12 +0800 | [diff] [blame] | 1144 | subscr_dump_vty(vty, lchan->conn->subscr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1145 | } else |
| 1146 | vty_out(vty, " No Subscriber%s", VTY_NEWLINE); |
Harald Welte | 8750421 | 2009-12-02 01:56:49 +0530 | [diff] [blame] | 1147 | if (is_ipaccess_bts(lchan->ts->trx->bts)) { |
| 1148 | struct in_addr ia; |
Holger Hans Peter Freyther | cec1ec5 | 2010-04-07 15:39:16 +0200 | [diff] [blame] | 1149 | ia.s_addr = htonl(lchan->abis_ip.bound_ip); |
Harald Welte | 8750421 | 2009-12-02 01:56:49 +0530 | [diff] [blame] | 1150 | 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 Welte | 4400774 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 1155 | |
| 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 Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1160 | } |
| 1161 | |
Holger Hans Peter Freyther | e959b4e | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1162 | static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan) |
| 1163 | { |
Holger Hans Peter Freyther | cf13a92 | 2010-05-14 01:57:02 +0800 | [diff] [blame] | 1164 | 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 Hofmeyr | a7488ae | 2016-11-02 14:28:15 +0100 | [diff] [blame] | 1172 | vty_out(vty, "BTS %u, TRX %u, Timeslot %u %s", |
Harald Welte | f62dad6 | 2010-12-24 12:22:34 +0100 | [diff] [blame] | 1173 | lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr, |
Neels Hofmeyr | a7488ae | 2016-11-02 14:28:15 +0100 | [diff] [blame] | 1174 | 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 Hofmeyr | 73208e0 | 2016-06-14 01:31:38 +0200 | [diff] [blame] | 1178 | lchan->nr, |
| 1179 | gsm_lchant_name(lchan->type), gsm_lchans_name(lchan->state), |
| 1180 | mr->ms_l1.pwr, |
Holger Hans Peter Freyther | cf13a92 | 2010-05-14 01:57:02 +0800 | [diff] [blame] | 1181 | rxlev2dbm(mr->dl.full.rx_lev), |
| 1182 | rxlev2dbm(mr->ul.full.rx_lev), |
Holger Hans Peter Freyther | e959b4e | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1183 | VTY_NEWLINE); |
| 1184 | } |
| 1185 | |
Holger Hans Peter Freyther | 86bbcbd | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1186 | |
| 1187 | static 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 | |
| 1201 | static 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 | |
| 1214 | static 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 Freyther | 5424e02 | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1227 | static int lchan_summary(struct vty *vty, int argc, const char **argv, |
| 1228 | void (*dump_cb)(struct vty *, struct gsm_lchan *)) |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1229 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1230 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1231 | 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 Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1245 | bts = gsm_bts_num(net, bts_nr); |
Holger Hans Peter Freyther | 86bbcbd | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1246 | |
| 1247 | if (argc == 1) |
| 1248 | return dump_lchan_bts(bts, vty, dump_cb); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1249 | } |
| 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 Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1257 | trx = gsm_bts_trx_num(bts, trx_nr); |
Holger Hans Peter Freyther | 86bbcbd | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1258 | |
| 1259 | if (argc == 2) |
| 1260 | return dump_lchan_trx(trx, vty, dump_cb); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1261 | } |
| 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 Freyther | 86bbcbd | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1270 | |
| 1271 | if (argc == 3) |
| 1272 | return dump_lchan_trx_ts(ts, vty, dump_cb); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1273 | } |
| 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 Freyther | 5424e02 | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1282 | dump_cb(vty, lchan); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1283 | return CMD_SUCCESS; |
| 1284 | } |
Holger Hans Peter Freyther | 86bbcbd | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1285 | |
| 1286 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1287 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1288 | bts = gsm_bts_num(net, bts_nr); |
Holger Hans Peter Freyther | 86bbcbd | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1289 | dump_lchan_bts(bts, vty, dump_cb); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1290 | } |
| 1291 | |
| 1292 | return CMD_SUCCESS; |
| 1293 | } |
| 1294 | |
Holger Hans Peter Freyther | 5424e02 | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1295 | |
| 1296 | DEFUN(show_lchan, |
| 1297 | show_lchan_cmd, |
Sylvain Munaut | 1ad9628 | 2012-12-28 12:15:11 +0100 | [diff] [blame] | 1298 | "show lchan [<0-255>] [<0-255>] [<0-7>] [lchan_nr]", |
Holger Hans Peter Freyther | 5424e02 | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1299 | SHOW_STR "Display information about a logical channel\n" |
| 1300 | "BTS Number\n" "TRX Number\n" "Timeslot Number\n" |
Holger Hans Peter Freyther | e812704 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1301 | LCHAN_NR_STR) |
Holger Hans Peter Freyther | 5424e02 | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1302 | |
| 1303 | { |
| 1304 | return lchan_summary(vty, argc, argv, lchan_dump_full_vty); |
| 1305 | } |
| 1306 | |
Holger Hans Peter Freyther | e959b4e | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1307 | DEFUN(show_lchan_summary, |
| 1308 | show_lchan_summary_cmd, |
Sylvain Munaut | 1ad9628 | 2012-12-28 12:15:11 +0100 | [diff] [blame] | 1309 | "show lchan summary [<0-255>] [<0-255>] [<0-7>] [lchan_nr]", |
Holger Hans Peter Freyther | e959b4e | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1310 | SHOW_STR "Display information about a logical channel\n" |
Holger Hans Peter Freyther | e812704 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1311 | "Short summary\n" |
Holger Hans Peter Freyther | e959b4e | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1312 | "BTS Number\n" "TRX Number\n" "Timeslot Number\n" |
Holger Hans Peter Freyther | e812704 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1313 | LCHAN_NR_STR) |
Holger Hans Peter Freyther | e959b4e | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1314 | { |
| 1315 | return lchan_summary(vty, argc, argv, lchan_dump_short_vty); |
| 1316 | } |
| 1317 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1318 | static 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 | |
| 1324 | static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts) |
| 1325 | { |
| 1326 | struct gsm_paging_request *pag; |
| 1327 | |
Holger Hans Peter Freyther | 9372d9c | 2013-03-03 11:03:17 +0100 | [diff] [blame] | 1328 | if (!bts->paging.bts) |
| 1329 | return; |
| 1330 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1331 | llist_for_each_entry(pag, &bts->paging.pending_requests, entry) |
| 1332 | paging_dump_vty(vty, pag); |
| 1333 | } |
| 1334 | |
| 1335 | DEFUN(show_paging, |
| 1336 | show_paging_cmd, |
Sylvain Munaut | 1ad9628 | 2012-12-28 12:15:11 +0100 | [diff] [blame] | 1337 | "show paging [<0-255>]", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1338 | SHOW_STR "Display information about paging reuqests of a BTS\n" |
| 1339 | "BTS Number\n") |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1340 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1341 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1342 | 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 Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1353 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1354 | 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 Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1359 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1360 | bts_paging_dump_vty(vty, bts); |
| 1361 | } |
| 1362 | |
| 1363 | return CMD_SUCCESS; |
| 1364 | } |
| 1365 | |
Holger Hans Peter Freyther | 35e6fbb | 2013-02-05 09:39:09 +0100 | [diff] [blame] | 1366 | DEFUN(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 Freyther | 96c8982 | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 1396 | DEFUN(cfg_net_neci, |
| 1397 | cfg_net_neci_cmd, |
| 1398 | "neci (0|1)", |
Harald Welte | 18ce31c | 2010-05-14 20:05:17 +0200 | [diff] [blame] | 1399 | "New Establish Cause Indication\n" |
| 1400 | "Don't set the NECI bit\n" "Set the NECI bit\n") |
Holger Hans Peter Freyther | 96c8982 | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 1401 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1402 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1403 | |
Holger Hans Peter Freyther | 96c8982 | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 1404 | gsmnet->neci = atoi(argv[0]); |
Holger Hans Peter Freyther | f0f37f1 | 2010-09-06 09:36:02 +0800 | [diff] [blame] | 1405 | gsm_net_update_ctype(gsmnet); |
Holger Hans Peter Freyther | 96c8982 | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 1406 | return CMD_SUCCESS; |
| 1407 | } |
| 1408 | |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1409 | #define HANDOVER_STR "Handover Options\n" |
| 1410 | |
Harald Welte | 0af9c9f | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 1411 | DEFUN(cfg_net_handover, cfg_net_handover_cmd, |
| 1412 | "handover (0|1)", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1413 | HANDOVER_STR |
| 1414 | "Don't perform in-call handover\n" |
| 1415 | "Perform in-call handover\n") |
Harald Welte | 0af9c9f | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 1416 | { |
Holger Hans Peter Freyther | 3524d4b | 2010-01-07 16:14:38 +0100 | [diff] [blame] | 1417 | int enable = atoi(argv[0]); |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1418 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Holger Hans Peter Freyther | 3524d4b | 2010-01-07 16:14:38 +0100 | [diff] [blame] | 1419 | |
| 1420 | if (enable && ipacc_rtp_direct) { |
Harald Welte | aa2c303 | 2009-12-20 13:51:01 +0100 | [diff] [blame] | 1421 | 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 Freyther | 3524d4b | 2010-01-07 16:14:38 +0100 | [diff] [blame] | 1426 | gsmnet->handover.active = enable; |
Harald Welte | 0af9c9f | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 1427 | |
| 1428 | return CMD_SUCCESS; |
| 1429 | } |
| 1430 | |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1431 | #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 Freyther | e812704 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1435 | #define HO_AVG_COUNT_STR "Amount to use for Averaging\n" |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1436 | |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1437 | DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd, |
| 1438 | "handover window rxlev averaging <1-10>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1439 | HO_WIN_RXLEV_STR |
Holger Hans Peter Freyther | e812704 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1440 | "How many RxLev measurements are used for averaging\n" |
| 1441 | HO_AVG_COUNT_STR) |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1442 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1443 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1444 | gsmnet->handover.win_rxlev_avg = atoi(argv[0]); |
| 1445 | return CMD_SUCCESS; |
| 1446 | } |
| 1447 | |
| 1448 | DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd, |
| 1449 | "handover window rxqual averaging <1-10>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1450 | HO_WIN_RXQUAL_STR |
Holger Hans Peter Freyther | e812704 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1451 | "How many RxQual measurements are used for averaging\n" |
| 1452 | HO_AVG_COUNT_STR) |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1453 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1454 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1455 | gsmnet->handover.win_rxqual_avg = atoi(argv[0]); |
| 1456 | return CMD_SUCCESS; |
| 1457 | } |
| 1458 | |
| 1459 | DEFUN(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 Freyther | e812704 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1461 | HO_WIN_RXLEV_STR "Neighbor\n" |
| 1462 | "How many RxQual measurements are used for averaging\n" |
| 1463 | HO_AVG_COUNT_STR) |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1464 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1465 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1466 | gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]); |
| 1467 | return CMD_SUCCESS; |
| 1468 | } |
| 1469 | |
| 1470 | DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd, |
| 1471 | "handover power budget interval <1-99>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1472 | HO_PBUDGET_STR |
Holger Hans Peter Freyther | e812704 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1473 | "How often to check if we have a better cell (SACCH frames)\n" |
| 1474 | "Interval\n" "Number\n") |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1475 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1476 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1477 | gsmnet->handover.pwr_interval = atoi(argv[0]); |
| 1478 | return CMD_SUCCESS; |
| 1479 | } |
| 1480 | |
| 1481 | DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd, |
| 1482 | "handover power budget hysteresis <0-999>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1483 | HO_PBUDGET_STR |
Holger Hans Peter Freyther | e812704 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1484 | "How many dB does a neighbor to be stronger to become a HO candidate\n" |
| 1485 | "Hysteresis\n" "Number\n") |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1486 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1487 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1488 | gsmnet->handover.pwr_hysteresis = atoi(argv[0]); |
| 1489 | return CMD_SUCCESS; |
| 1490 | } |
| 1491 | |
| 1492 | DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd, |
| 1493 | "handover maximum distance <0-9999>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1494 | HANDOVER_STR |
Holger Hans Peter Freyther | e812704 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1495 | "How big is the maximum timing advance before HO is forced\n" |
| 1496 | "Distance\n" "Number\n") |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1497 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1498 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1499 | gsmnet->handover.max_distance = atoi(argv[0]); |
| 1500 | return CMD_SUCCESS; |
| 1501 | } |
Harald Welte | 0af9c9f | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 1502 | |
Holger Hans Peter Freyther | b6b9d70 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 1503 | DEFUN(cfg_net_pag_any_tch, |
| 1504 | cfg_net_pag_any_tch_cmd, |
| 1505 | "paging any use tch (0|1)", |
Holger Hans Peter Freyther | e812704 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1506 | "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 Freyther | b6b9d70 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 1510 | { |
Holger Hans Peter Freyther | c562888 | 2010-09-06 10:09:19 +0800 | [diff] [blame] | 1511 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Holger Hans Peter Freyther | b6b9d70 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 1512 | gsmnet->pag_any_tch = atoi(argv[0]); |
| 1513 | gsm_net_update_ctype(gsmnet); |
| 1514 | return CMD_SUCCESS; |
| 1515 | } |
| 1516 | |
Holger Hans Peter Freyther | 13ae980 | 2009-12-22 08:27:21 +0100 | [diff] [blame] | 1517 | #define DECLARE_TIMER(number, doc) \ |
Holger Hans Peter Freyther | 26ba2e7 | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1518 | DEFUN(cfg_net_T##number, \ |
| 1519 | cfg_net_T##number##_cmd, \ |
| 1520 | "timer t" #number " <0-65535>", \ |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1521 | "Configure GSM Timers\n" \ |
Holger Hans Peter Freyther | 18dd1a3 | 2014-04-11 19:30:27 +0200 | [diff] [blame] | 1522 | doc "Timer Value in seconds\n") \ |
Holger Hans Peter Freyther | 26ba2e7 | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1523 | { \ |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1524 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); \ |
Holger Hans Peter Freyther | 26ba2e7 | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1525 | 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 Freyther | e812704 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1537 | DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.\n") |
| 1538 | DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.\n") |
Harald Welte | 9b77f61 | 2012-06-03 13:01:47 +0200 | [diff] [blame] | 1539 | DECLARE_TIMER(3105, "Set the timer for repetition of PHYSICAL INFORMATION.\n") |
Holger Hans Peter Freyther | e812704 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1540 | DECLARE_TIMER(3107, "Currently not used.\n") |
Holger Hans Peter Freyther | 969a405 | 2011-12-28 16:21:05 +0100 | [diff] [blame] | 1541 | DECLARE_TIMER(3109, "Set the RSL SACCH deactivation timeout.\n") |
Holger Hans Peter Freyther | e812704 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1542 | DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel.\n") |
| 1543 | DECLARE_TIMER(3113, "Set the time to try paging a subscriber.\n") |
| 1544 | DECLARE_TIMER(3115, "Currently not used.\n") |
| 1545 | DECLARE_TIMER(3117, "Currently not used.\n") |
| 1546 | DECLARE_TIMER(3119, "Currently not used.\n") |
| 1547 | DECLARE_TIMER(3122, "Waiting time (seconds) after IMM ASS REJECT\n") |
| 1548 | DECLARE_TIMER(3141, "Currently not used.\n") |
Holger Hans Peter Freyther | 26ba2e7 | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1549 | |
Max | 3d94aca | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 1550 | DEFUN_DEPRECATED(cfg_net_dtx, |
| 1551 | cfg_net_dtx_cmd, |
| 1552 | "dtx-used (0|1)", |
| 1553 | ".HIDDEN\n""Obsolete\n""Obsolete\n") |
Holger Hans Peter Freyther | 21d63ff | 2010-09-06 09:25:48 +0800 | [diff] [blame] | 1554 | { |
Max | 3d94aca | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 1555 | 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 Freyther | 21d63ff | 2010-09-06 09:25:48 +0800 | [diff] [blame] | 1558 | } |
Holger Hans Peter Freyther | 26ba2e7 | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1559 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1560 | /* per-BTS configuration */ |
| 1561 | DEFUN(cfg_bts, |
| 1562 | cfg_bts_cmd, |
Harald Welte | 2af06cb | 2012-08-17 12:50:14 +0200 | [diff] [blame] | 1563 | "bts <0-255>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1564 | "Select a BTS to configure\n" |
| 1565 | "BTS Number\n") |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1566 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1567 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1568 | int bts_nr = atoi(argv[0]); |
| 1569 | struct gsm_bts *bts; |
| 1570 | |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1571 | 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 Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1574 | return CMD_WARNING; |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1575 | } else if (bts_nr == gsmnet->num_bts) { |
| 1576 | /* allocate a new one */ |
Harald Welte | c788128 | 2011-06-05 13:31:33 +0200 | [diff] [blame] | 1577 | bts = gsm_bts_alloc_register(gsmnet, GSM_BTS_TYPE_UNKNOWN, |
Harald Welte | 7bb55f3 | 2015-11-20 10:43:31 +0100 | [diff] [blame] | 1578 | HARDCODED_BSIC); |
Holger Hans Peter Freyther | 7113514 | 2010-03-29 08:47:44 +0200 | [diff] [blame] | 1579 | } else |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1580 | bts = gsm_bts_num(gsmnet, bts_nr); |
| 1581 | |
Daniel Willmann | 580085f | 2010-01-11 13:43:07 +0100 | [diff] [blame] | 1582 | if (!bts) { |
| 1583 | vty_out(vty, "%% Unable to allocate BTS %u%s", |
| 1584 | gsmnet->num_bts, VTY_NEWLINE); |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1585 | return CMD_WARNING; |
Daniel Willmann | 580085f | 2010-01-11 13:43:07 +0100 | [diff] [blame] | 1586 | } |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1587 | |
| 1588 | vty->index = bts; |
Harald Welte | 8791dac | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 1589 | vty->index_sub = &bts->description; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1590 | vty->node = BTS_NODE; |
| 1591 | |
| 1592 | return CMD_SUCCESS; |
| 1593 | } |
| 1594 | |
| 1595 | DEFUN(cfg_bts_type, |
| 1596 | cfg_bts_type_cmd, |
Harald Welte | 85a77b1 | 2012-08-17 13:02:12 +0200 | [diff] [blame] | 1597 | "type TYPE", /* dynamically created */ |
Holger Hans Peter Freyther | e812704 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1598 | "Set the BTS type\n" "Type\n") |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1599 | { |
| 1600 | struct gsm_bts *bts = vty->index; |
Harald Welte | 59698fb | 2010-01-10 18:01:52 +0100 | [diff] [blame] | 1601 | int rc; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1602 | |
Harald Welte | 59698fb | 2010-01-10 18:01:52 +0100 | [diff] [blame] | 1603 | rc = gsm_set_bts_type(bts, parse_btstype(argv[0])); |
| 1604 | if (rc < 0) |
| 1605 | return CMD_WARNING; |
Harald Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1606 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1607 | return CMD_SUCCESS; |
| 1608 | } |
| 1609 | |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 1610 | DEFUN(cfg_bts_band, |
| 1611 | cfg_bts_band_cmd, |
| 1612 | "band BAND", |
Holger Hans Peter Freyther | e812704 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1613 | "Set the frequency band of this BTS\n" "Frequency band\n") |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 1614 | { |
| 1615 | struct gsm_bts *bts = vty->index; |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1616 | int band = gsm_band_parse(argv[0]); |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 1617 | |
| 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 | |
Max | 3d94aca | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 1629 | DEFUN(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; |
Max | 032beff | 2016-06-06 11:30:57 +0200 | [diff] [blame] | 1638 | 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); |
Max | 3d94aca | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 1641 | return CMD_SUCCESS; |
| 1642 | } |
| 1643 | |
| 1644 | DEFUN(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 | |
| 1656 | DEFUN(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; |
Max | 032beff | 2016-06-06 11:30:57 +0200 | [diff] [blame] | 1663 | 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); |
Max | 3d94aca | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 1666 | return CMD_SUCCESS; |
| 1667 | } |
| 1668 | |
| 1669 | DEFUN(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 Freyther | a098dfb | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 1681 | DEFUN(cfg_bts_ci, |
| 1682 | cfg_bts_ci_cmd, |
| 1683 | "cell_identity <0-65535>", |
Holger Hans Peter Freyther | 2984422 | 2012-07-21 00:27:10 +0200 | [diff] [blame] | 1684 | "Set the Cell identity of this BTS\n" "Cell Identity\n") |
Holger Hans Peter Freyther | a098dfb | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 1685 | { |
| 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 Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1699 | DEFUN(cfg_bts_lac, |
| 1700 | cfg_bts_lac_cmd, |
Holger Hans Peter Freyther | 54a2283 | 2009-09-29 14:02:33 +0200 | [diff] [blame] | 1701 | "location_area_code <0-65535>", |
Holger Hans Peter Freyther | 2984422 | 2012-07-21 00:27:10 +0200 | [diff] [blame] | 1702 | "Set the Location Area Code (LAC) of this BTS\n" "LAC\n") |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1703 | { |
| 1704 | struct gsm_bts *bts = vty->index; |
| 1705 | int lac = atoi(argv[0]); |
| 1706 | |
Holger Hans Peter Freyther | 54a2283 | 2009-09-29 14:02:33 +0200 | [diff] [blame] | 1707 | if (lac < 0 || lac > 0xffff) { |
| 1708 | vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s", |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1709 | lac, VTY_NEWLINE); |
| 1710 | return CMD_WARNING; |
| 1711 | } |
Holger Hans Peter Freyther | 6c6ab86 | 2009-10-01 04:07:15 +0200 | [diff] [blame] | 1712 | |
| 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 Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1719 | bts->location_area_code = lac; |
| 1720 | |
| 1721 | return CMD_SUCCESS; |
| 1722 | } |
| 1723 | |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 1724 | |
Harald Welte | 7bb55f3 | 2015-11-20 10:43:31 +0100 | [diff] [blame] | 1725 | /* compatibility wrapper for old config files */ |
| 1726 | DEFUN_HIDDEN(cfg_bts_tsc, |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1727 | cfg_bts_tsc_cmd, |
Harald Welte | de896da | 2012-05-31 10:57:08 +0200 | [diff] [blame] | 1728 | "training_sequence_code <0-7>", |
Holger Hans Peter Freyther | 2984422 | 2012-07-21 00:27:10 +0200 | [diff] [blame] | 1729 | "Set the Training Sequence Code (TSC) of this BTS\n" "TSC\n") |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1730 | { |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1731 | return CMD_SUCCESS; |
| 1732 | } |
| 1733 | |
| 1734 | DEFUN(cfg_bts_bsic, |
| 1735 | cfg_bts_bsic_cmd, |
| 1736 | "base_station_id_code <0-63>", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1737 | "Set the Base Station Identity Code (BSIC) of this BTS\n" |
| 1738 | "BSIC of this BTS\n") |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1739 | { |
| 1740 | struct gsm_bts *bts = vty->index; |
| 1741 | int bsic = atoi(argv[0]); |
| 1742 | |
| 1743 | if (bsic < 0 || bsic > 0x3f) { |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1744 | vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s", |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1745 | bsic, VTY_NEWLINE); |
| 1746 | return CMD_WARNING; |
| 1747 | } |
| 1748 | bts->bsic = bsic; |
| 1749 | |
| 1750 | return CMD_SUCCESS; |
| 1751 | } |
| 1752 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1753 | DEFUN(cfg_bts_unit_id, |
| 1754 | cfg_bts_unit_id_cmd, |
Harald Welte | f515aa0 | 2009-08-07 13:27:09 +0200 | [diff] [blame] | 1755 | "ip.access unit_id <0-65534> <0-255>", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1756 | "Abis/IP specific options\n" |
| 1757 | "Set the IPA BTS Unit ID\n" |
| 1758 | "Unit ID (Site)\n" |
| 1759 | "Unit ID (BTS)\n") |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1760 | { |
| 1761 | struct gsm_bts *bts = vty->index; |
| 1762 | int site_id = atoi(argv[0]); |
| 1763 | int bts_id = atoi(argv[1]); |
| 1764 | |
Harald Welte | f515aa0 | 2009-08-07 13:27:09 +0200 | [diff] [blame] | 1765 | 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 Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1770 | bts->ip_access.site_id = site_id; |
| 1771 | bts->ip_access.bts_id = bts_id; |
| 1772 | |
| 1773 | return CMD_SUCCESS; |
| 1774 | } |
| 1775 | |
Harald Welte | 8b3c595 | 2013-03-12 13:57:05 +0100 | [diff] [blame] | 1776 | DEFUN(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 Eversberg | ac27b95 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 1797 | #define NOKIA_STR "Nokia *Site related commands\n" |
Harald Welte | 8b3c595 | 2013-03-12 13:57:05 +0100 | [diff] [blame] | 1798 | |
Sylvain Munaut | cb8e843 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 1799 | DEFUN(cfg_bts_nokia_site_skip_reset, |
| 1800 | cfg_bts_nokia_site_skip_reset_cmd, |
| 1801 | "nokia_site skip-reset (0|1)", |
Andreas Eversberg | ac27b95 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 1802 | NOKIA_STR |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1803 | "Skip the reset step during bootstrap process of this BTS\n" |
| 1804 | "Do NOT skip the reset\n" "Skip the reset\n") |
Sylvain Munaut | cb8e843 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 1805 | { |
| 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 Eversberg | ac27b95 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 1818 | DEFUN(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 Csaba | def87b4 | 2015-02-07 13:27:36 +0100 | [diff] [blame] | 1838 | DEFUN(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 Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1857 | #define OML_STR "Organization & Maintenance Link\n" |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1858 | #define IPA_STR "A-bis/IP Specific Options\n" |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1859 | |
Harald Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1860 | DEFUN(cfg_bts_stream_id, |
| 1861 | cfg_bts_stream_id_cmd, |
Pablo Neira Ayuso | 42e41df | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 1862 | "oml ip.access stream_id <0-255> line E1_LINE", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1863 | OML_STR IPA_STR |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1864 | "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 Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1866 | { |
| 1867 | struct gsm_bts *bts = vty->index; |
Pablo Neira Ayuso | 42e41df | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 1868 | int stream_id = atoi(argv[0]), linenr = atoi(argv[1]); |
Harald Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1869 | |
| 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 Ayuso | 42e41df | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 1876 | /* 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 Welte | fa2015f | 2012-08-17 09:52:03 +0200 | [diff] [blame] | 1882 | #define OML_E1_STR OML_STR "OML E1/T1 Configuration\n" |
Harald Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1883 | |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1884 | DEFUN(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 Welte | fa2015f | 2012-08-17 09:52:03 +0200 | [diff] [blame] | 1887 | OML_E1_STR |
| 1888 | "E1/T1 line number to be used for OML\n" |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1889 | "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 Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1899 | { |
| 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 | |
| 1908 | DEFUN(cfg_bts_oml_e1_tei, |
| 1909 | cfg_bts_oml_e1_tei_cmd, |
| 1910 | "oml e1 tei <0-63>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1911 | OML_E1_STR |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1912 | "Set the TEI to be used for OML\n" |
| 1913 | "TEI Number\n") |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1914 | { |
| 1915 | struct gsm_bts *bts = vty->index; |
| 1916 | |
| 1917 | bts->oml_tei = atoi(argv[0]); |
| 1918 | |
| 1919 | return CMD_SUCCESS; |
| 1920 | } |
| 1921 | |
Harald Welte | 3e77461 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 1922 | DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd, |
| 1923 | "channel allocator (ascending|descending)", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1924 | "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 Welte | 3e77461 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 1927 | { |
| 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 Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1938 | #define RACH_STR "Random Access Control Channel\n" |
| 1939 | |
Sylvain Munaut | 8e2d8de | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 1940 | DEFUN(cfg_bts_rach_tx_integer, |
| 1941 | cfg_bts_rach_tx_integer_cmd, |
| 1942 | "rach tx integer <0-15>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1943 | RACH_STR |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1944 | "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 Munaut | 8e2d8de | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 1947 | { |
| 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 | |
| 1953 | DEFUN(cfg_bts_rach_max_trans, |
| 1954 | cfg_bts_rach_max_trans_cmd, |
| 1955 | "rach max transmission (1|2|4|7)", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1956 | RACH_STR |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1957 | "Set the maximum number of RACH burst transmissions\n" |
| 1958 | "Set the maximum number of RACH burst transmissions\n" |
Harald Welte | fa2015f | 2012-08-17 09:52:03 +0200 | [diff] [blame] | 1959 | "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 Munaut | 8e2d8de | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 1963 | { |
| 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 Eversberg | 14e12f2 | 2012-10-13 07:27:47 +0200 | [diff] [blame] | 1969 | #define CD_STR "Channel Description\n" |
| 1970 | |
| 1971 | DEFUN(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 | |
| 1984 | DEFUN(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 | |
| 1998 | DEFUN(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 Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2012 | #define NM_STR "Network Management\n" |
| 2013 | |
Holger Hans Peter Freyther | 697ed2b | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 2014 | DEFUN(cfg_bts_rach_nm_b_thresh, |
| 2015 | cfg_bts_rach_nm_b_thresh_cmd, |
| 2016 | "rach nm busy threshold <0-255>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2017 | RACH_STR NM_STR |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2018 | "Set the NM Busy Threshold\n" |
| 2019 | "Set the NM Busy Threshold\n" |
| 2020 | "NM Busy Threshold in dB") |
Holger Hans Peter Freyther | 697ed2b | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 2021 | { |
| 2022 | struct gsm_bts *bts = vty->index; |
| 2023 | bts->rach_b_thresh = atoi(argv[0]); |
| 2024 | return CMD_SUCCESS; |
| 2025 | } |
| 2026 | |
| 2027 | DEFUN(cfg_bts_rach_nm_ldavg, |
| 2028 | cfg_bts_rach_nm_ldavg_cmd, |
| 2029 | "rach nm load average <0-65535>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2030 | RACH_STR NM_STR |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2031 | "Set the NM Loadaverage Slots value\n" |
| 2032 | "Set the NM Loadaverage Slots value\n" |
| 2033 | "NM Loadaverage Slots value\n") |
Holger Hans Peter Freyther | 697ed2b | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 2034 | { |
| 2035 | struct gsm_bts *bts = vty->index; |
| 2036 | bts->rach_ldavg_slots = atoi(argv[0]); |
| 2037 | return CMD_SUCCESS; |
| 2038 | } |
| 2039 | |
Harald Welte (local) | e19be3f | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 2040 | DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd, |
| 2041 | "cell barred (0|1)", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2042 | "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) | e19be3f | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 2047 | { |
| 2048 | struct gsm_bts *bts = vty->index; |
| 2049 | |
Harald Welte | 8c973ba | 2009-12-21 23:08:18 +0100 | [diff] [blame] | 2050 | bts->si_common.rach_control.cell_bar = atoi(argv[0]); |
Harald Welte (local) | e19be3f | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 2051 | |
| 2052 | return CMD_SUCCESS; |
| 2053 | } |
| 2054 | |
Holger Hans Peter Freyther | 440984b | 2010-05-14 00:39:19 +0800 | [diff] [blame] | 2055 | DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd, |
| 2056 | "rach emergency call allowed (0|1)", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2057 | 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 Freyther | 440984b | 2010-05-14 00:39:19 +0800 | [diff] [blame] | 2063 | { |
| 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 Kluchnikov | 80d5843 | 2013-09-16 13:13:04 +0400 | [diff] [blame] | 2074 | DEFUN(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) | cbd4610 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 2119 | DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd, |
| 2120 | "ms max power <0-40>", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2121 | "MS Options\n" |
Harald Welte | fa2015f | 2012-08-17 09:52:03 +0200 | [diff] [blame] | 2122 | "Maximum transmit power of the MS\n" |
| 2123 | "Maximum transmit power of the MS\n" |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2124 | "Maximum transmit power of the MS in dBm") |
Harald Welte (local) | cbd4610 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 2125 | { |
| 2126 | struct gsm_bts *bts = vty->index; |
| 2127 | |
| 2128 | bts->ms_max_power = atoi(argv[0]); |
| 2129 | |
| 2130 | return CMD_SUCCESS; |
| 2131 | } |
| 2132 | |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2133 | #define CELL_STR "Cell Parameters\n" |
| 2134 | |
Harald Welte | b761bf8 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 2135 | DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd, |
| 2136 | "cell reselection hysteresis <0-14>", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2137 | CELL_STR "Cell re-selection parameters\n" |
| 2138 | "Cell Re-Selection Hysteresis in dB\n" |
Harald Welte | b761bf8 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 2139 | "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 | |
| 2148 | DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd, |
| 2149 | "rxlev access min <0-63>", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2150 | "Minimum RxLev needed for cell access\n" |
| 2151 | "Minimum RxLev needed for cell access\n" |
| 2152 | "Minimum RxLev needed for cell access\n" |
Harald Welte | b761bf8 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 2153 | "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 Munaut | 00d7146 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2162 | DEFUN(cfg_bts_cell_bar_qualify, cfg_bts_cell_bar_qualify_cmd, |
| 2163 | "cell bar qualify (0|1)", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2164 | CELL_STR "Cell Bar Qualify\n" "Cell Bar Qualify\n" |
| 2165 | "Set CBQ to 0\n" "Set CBQ to 1\n") |
Sylvain Munaut | 00d7146 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2166 | { |
| 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 | |
| 2175 | DEFUN(cfg_bts_cell_resel_ofs, cfg_bts_cell_resel_ofs_cmd, |
| 2176 | "cell reselection offset <0-126>", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2177 | 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 Munaut | 00d7146 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2181 | { |
| 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 | |
| 2190 | DEFUN(cfg_bts_temp_ofs, cfg_bts_temp_ofs_cmd, |
| 2191 | "temporary offset <0-60>", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2192 | "Cell selection temporary negative offset\n" |
| 2193 | "Cell selection temporary negative offset\n" |
Sylvain Munaut | 00d7146 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2194 | "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 | |
| 2204 | DEFUN(cfg_bts_temp_ofs_inf, cfg_bts_temp_ofs_inf_cmd, |
| 2205 | "temporary offset infinite", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2206 | "Cell selection temporary negative offset\n" |
| 2207 | "Cell selection temporary negative offset\n" |
Sylvain Munaut | 00d7146 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2208 | "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 | |
| 2218 | DEFUN(cfg_bts_penalty_time, cfg_bts_penalty_time_cmd, |
| 2219 | "penalty time <20-620>", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2220 | "Cell selection penalty time\n" |
| 2221 | "Cell selection penalty time\n" |
| 2222 | "Cell selection penalty time in seconds (by 20s increments)\n") |
Sylvain Munaut | 00d7146 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2223 | { |
| 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 | |
| 2232 | DEFUN(cfg_bts_penalty_time_rsvd, cfg_bts_penalty_time_rsvd_cmd, |
| 2233 | "penalty time reserved", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2234 | "Cell selection penalty time\n" |
| 2235 | "Cell selection penalty time\n" |
| 2236 | "Set cell selection penalty time to reserved value 31, " |
Sylvain Munaut | 00d7146 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2237 | "(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) | b6ea7f7 | 2009-08-14 23:09:25 +0200 | [diff] [blame] | 2248 | DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd, |
Daniel Willmann | 3e7db9e | 2012-12-27 00:02:01 +0100 | [diff] [blame] | 2249 | "periodic location update <6-1530>", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2250 | "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) | b6ea7f7 | 2009-08-14 23:09:25 +0200 | [diff] [blame] | 2254 | { |
| 2255 | struct gsm_bts *bts = vty->index; |
| 2256 | |
Dieter Spaar | b0f746d | 2010-10-05 21:10:55 +0200 | [diff] [blame] | 2257 | bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 6; |
Harald Welte (local) | b6ea7f7 | 2009-08-14 23:09:25 +0200 | [diff] [blame] | 2258 | |
| 2259 | return CMD_SUCCESS; |
| 2260 | } |
| 2261 | |
Holger Hans Peter Freyther | 2fb8ebf | 2013-07-27 21:07:57 +0200 | [diff] [blame] | 2262 | DEFUN(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 Eversberg | f9248d9 | 2013-03-10 11:49:35 +0100 | [diff] [blame] | 2272 | |
| 2273 | return CMD_SUCCESS; |
| 2274 | } |
| 2275 | |
| 2276 | DEFUN(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 Freyther | 2fb8ebf | 2013-07-27 21:07:57 +0200 | [diff] [blame] | 2285 | return CMD_SUCCESS; |
| 2286 | } |
| 2287 | |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2288 | #define GPRS_TEXT "GPRS Packet Network\n" |
| 2289 | |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2290 | DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd, |
Harald Welte | b42fe34 | 2010-04-18 14:00:26 +0200 | [diff] [blame] | 2291 | "gprs cell bvci <2-65535>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2292 | GPRS_TEXT |
| 2293 | "GPRS Cell Settings\n" |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2294 | "GPRS BSSGP VC Identifier\n" |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2295 | "GPRS BSSGP VC Identifier") |
| 2296 | { |
| 2297 | struct gsm_bts *bts = vty->index; |
| 2298 | |
Harald Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2299 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | c05a4b1 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2300 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2301 | return CMD_WARNING; |
| 2302 | } |
| 2303 | |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2304 | bts->gprs.cell.bvci = atoi(argv[0]); |
| 2305 | |
| 2306 | return CMD_SUCCESS; |
| 2307 | } |
| 2308 | |
Harald Welte | 4a048c5 | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 2309 | DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd, |
| 2310 | "gprs nsei <0-65535>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2311 | GPRS_TEXT |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2312 | "GPRS NS Entity Identifier\n" |
Harald Welte | 4a048c5 | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 2313 | "GPRS NS Entity Identifier") |
| 2314 | { |
| 2315 | struct gsm_bts *bts = vty->index; |
| 2316 | |
Harald Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2317 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | 4a048c5 | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 2318 | 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 Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2327 | #define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \ |
| 2328 | "NSVC Logical Number\n" |
Harald Welte | 4a048c5 | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 2329 | |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2330 | DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd, |
| 2331 | "gprs nsvc <0-1> nsvci <0-65535>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2332 | GPRS_TEXT NSVC_TEXT |
| 2333 | "NS Virtual Connection Identifier\n" |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2334 | "GPRS NS VC Identifier") |
| 2335 | { |
| 2336 | struct gsm_bts *bts = vty->index; |
| 2337 | int idx = atoi(argv[0]); |
| 2338 | |
Harald Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2339 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | c05a4b1 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2340 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2341 | return CMD_WARNING; |
| 2342 | } |
| 2343 | |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2344 | bts->gprs.nsvc[idx].nsvci = atoi(argv[1]); |
| 2345 | |
| 2346 | return CMD_SUCCESS; |
| 2347 | } |
| 2348 | |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2349 | DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd, |
| 2350 | "gprs nsvc <0-1> local udp port <0-65535>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2351 | GPRS_TEXT NSVC_TEXT |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2352 | "GPRS NS Local UDP Port\n" |
| 2353 | "GPRS NS Local UDP Port\n" |
| 2354 | "GPRS NS Local UDP Port\n" |
Harald Welte | 764c8e1 | 2012-08-17 09:57:25 +0200 | [diff] [blame] | 2355 | "GPRS NS Local UDP Port Number\n") |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2356 | { |
| 2357 | struct gsm_bts *bts = vty->index; |
| 2358 | int idx = atoi(argv[0]); |
| 2359 | |
Harald Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2360 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | c05a4b1 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2361 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2362 | return CMD_WARNING; |
| 2363 | } |
| 2364 | |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2365 | bts->gprs.nsvc[idx].local_port = atoi(argv[1]); |
| 2366 | |
| 2367 | return CMD_SUCCESS; |
| 2368 | } |
| 2369 | |
| 2370 | DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd, |
| 2371 | "gprs nsvc <0-1> remote udp port <0-65535>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2372 | GPRS_TEXT NSVC_TEXT |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2373 | "GPRS NS Remote UDP Port\n" |
| 2374 | "GPRS NS Remote UDP Port\n" |
Harald Welte | 764c8e1 | 2012-08-17 09:57:25 +0200 | [diff] [blame] | 2375 | "GPRS NS Remote UDP Port\n" |
| 2376 | "GPRS NS Remote UDP Port Number\n") |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2377 | { |
| 2378 | struct gsm_bts *bts = vty->index; |
| 2379 | int idx = atoi(argv[0]); |
| 2380 | |
Harald Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2381 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | c05a4b1 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2382 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2383 | return CMD_WARNING; |
| 2384 | } |
| 2385 | |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2386 | bts->gprs.nsvc[idx].remote_port = atoi(argv[1]); |
| 2387 | |
| 2388 | return CMD_SUCCESS; |
| 2389 | } |
| 2390 | |
| 2391 | DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd, |
| 2392 | "gprs nsvc <0-1> remote ip A.B.C.D", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2393 | GPRS_TEXT NSVC_TEXT |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2394 | "GPRS NS Remote IP Address\n" |
| 2395 | "GPRS NS Remote IP Address\n" |
| 2396 | "GPRS NS Remote IP Address\n") |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2397 | { |
| 2398 | struct gsm_bts *bts = vty->index; |
| 2399 | int idx = atoi(argv[0]); |
| 2400 | struct in_addr ia; |
| 2401 | |
Harald Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2402 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | c05a4b1 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2403 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2404 | return CMD_WARNING; |
| 2405 | } |
| 2406 | |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2407 | 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 Freyther | 3112f67 | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 2413 | DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd, |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2414 | "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 Freyther | 3112f67 | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 2418 | { |
| 2419 | struct gsm_bts *bts = vty->index; |
| 2420 | |
| 2421 | bts->paging.free_chans_need = atoi(argv[0]); |
| 2422 | return CMD_SUCCESS; |
| 2423 | } |
| 2424 | |
Harald Welte | a925176 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 2425 | DEFUN(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 Welte | 18ce31c | 2010-05-14 20:05:17 +0200 | [diff] [blame] | 2449 | #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 Welte | a925176 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 2461 | |
| 2462 | DEFUN(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 Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2485 | DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd, |
| 2486 | "gprs routing area <0-255>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2487 | GPRS_TEXT |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2488 | "GPRS Routing Area Code\n" |
| 2489 | "GPRS Routing Area Code\n" |
| 2490 | "GPRS Routing Area Code\n") |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2491 | { |
| 2492 | struct gsm_bts *bts = vty->index; |
| 2493 | |
Harald Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2494 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | c05a4b1 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2495 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2496 | return CMD_WARNING; |
| 2497 | } |
| 2498 | |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2499 | bts->gprs.rac = atoi(argv[0]); |
| 2500 | |
| 2501 | return CMD_SUCCESS; |
| 2502 | } |
| 2503 | |
Max | 88bdcd4 | 2016-07-28 11:55:37 +0200 | [diff] [blame] | 2504 | DEFUN(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 | |
| 2521 | DEFUN(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 Eversberg | a4fa21c | 2013-03-16 16:31:26 +0100 | [diff] [blame] | 2538 | DEFUN(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 Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2558 | DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd, |
| 2559 | "gprs mode (none|gprs|egprs)", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2560 | 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 Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2565 | { |
| 2566 | struct gsm_bts *bts = vty->index; |
Holger Hans Peter Freyther | 611f775 | 2015-01-31 22:16:00 +0100 | [diff] [blame] | 2567 | enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0], NULL); |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2568 | |
Holger Hans Peter Freyther | 611f775 | 2015-01-31 22:16:00 +0100 | [diff] [blame] | 2569 | if (!bts_gprs_mode_is_compat(bts, mode)) { |
Harald Welte | 20e275a | 2010-06-14 22:44:42 +0200 | [diff] [blame] | 2570 | 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 Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2576 | |
| 2577 | return CMD_SUCCESS; |
| 2578 | } |
| 2579 | |
bhargava | 612722c | 2016-07-21 11:14:34 +0530 | [diff] [blame] | 2580 | DEFUN(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 Welte | d8acf14 | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 2606 | #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 | |
| 2630 | DEFUN(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 | |
| 2654 | DEFUN(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 Welte | 9f09ac3 | 2010-07-30 11:53:18 +0200 | [diff] [blame] | 2675 | /* 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 Ayuso | b1d5a69 | 2011-05-07 12:12:48 +0200 | [diff] [blame] | 2679 | rc = osmo_hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0])); |
Harald Welte | d8acf14 | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 2680 | 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 Welte | 44ccb0d | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 2691 | DEFUN(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 Welte | 44ccb0d | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 2698 | |
| 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 Welte | ca46eff | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2707 | DEFUN(cfg_bts_neigh_mode, cfg_bts_neigh_mode_cmd, |
Harald Welte | f989b78 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2708 | "neighbor-list mode (automatic|manual|manual-si5)", |
Harald Welte | ca46eff | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2709 | "Neighbor List\n" "Mode of Neighbor List generation\n" |
Harald Welte | f989b78 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2710 | "Automatically from all BTS in this OpenBSC\n" "Manual\n" |
| 2711 | "Manual with different lists for SI2 and SI5\n") |
Harald Welte | ca46eff | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2712 | { |
| 2713 | struct gsm_bts *bts = vty->index; |
Harald Welte | f989b78 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2714 | int mode = get_string_value(bts_neigh_mode_strs, argv[0]); |
Harald Welte | ca46eff | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2715 | |
Harald Welte | f989b78 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2716 | switch (mode) { |
| 2717 | case NL_MODE_MANUAL_SI5SEP: |
| 2718 | case NL_MODE_MANUAL: |
Harald Welte | ca46eff | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2719 | /* 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 Welte | f989b78 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2724 | break; |
| 2725 | default: |
| 2726 | break; |
| 2727 | } |
| 2728 | |
| 2729 | bts->neigh_list_manual_mode = mode; |
Harald Welte | ca46eff | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2730 | |
| 2731 | return CMD_SUCCESS; |
| 2732 | } |
| 2733 | |
| 2734 | DEFUN(cfg_bts_neigh, cfg_bts_neigh_cmd, |
Harald Welte | 09e4fad | 2012-01-29 13:24:12 +0100 | [diff] [blame] | 2735 | "neighbor-list (add|del) arfcn <0-1023>", |
Harald Welte | ca46eff | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2736 | "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 | |
Max | 88ddcaa | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 2758 | DEFUN(cfg_bts_si2quater_neigh_add, cfg_bts_si2quater_neigh_add_cmd, |
Max | eee605b | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 2759 | "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") |
Max | 88ddcaa | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 2769 | { |
| 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]); |
Max | eee605b | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 2773 | 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); |
Max | 88ddcaa | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 2777 | |
| 2778 | if (r < 0) { |
Max | eee605b | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 2779 | vty_out(vty, "Unable to add ARFCN %u: %s%s", arfcn, strerror(-r), |
Max | 88ddcaa | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 2780 | VTY_NEWLINE); |
| 2781 | return CMD_WARNING; |
| 2782 | } |
| 2783 | |
Max | eee605b | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 2784 | 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; |
Max | cc0e500 | 2016-04-20 15:57:14 +0200 | [diff] [blame] | 2798 | } |
Max | eee605b | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 2799 | |
| 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); |
Max | cc0e500 | 2016-04-20 15:57:14 +0200 | [diff] [blame] | 2823 | osmo_earfcn_del(e, arfcn); |
Max | eee605b | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 2824 | |
Max | cc0e500 | 2016-04-20 15:57:14 +0200 | [diff] [blame] | 2825 | return CMD_WARNING; |
Max | 88ddcaa | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 2826 | } |
| 2827 | |
| 2828 | DEFUN(cfg_bts_si2quater_neigh_del, cfg_bts_si2quater_neigh_del_cmd, |
Max | 33220d0 | 2016-04-29 12:51:31 +0200 | [diff] [blame] | 2829 | "si2quater neighbor-list del earfcn <0-65535>", |
Max | 88ddcaa | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 2830 | "SI2quater Neighbor List\n" |
| 2831 | "SI2quater Neighbor List\n" |
| 2832 | "Delete from SI2quater manual neighbor list\n" |
Max | 303753e | 2016-04-20 12:06:05 +0200 | [diff] [blame] | 2833 | "EARFCN of neighbor\n" |
| 2834 | "EARFCN\n") |
Max | 88ddcaa | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 2835 | { |
| 2836 | struct gsm_bts *bts = vty->index; |
| 2837 | struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list; |
Max | 2befab1 | 2016-04-20 12:06:06 +0200 | [diff] [blame] | 2838 | uint16_t arfcn = atoi(argv[0]); |
Max | 88ddcaa | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 2839 | int r = osmo_earfcn_del(e, arfcn); |
| 2840 | if (r < 0) { |
| 2841 | vty_out(vty, "Unable to delete arfcn %u: %s%s", arfcn, |
Max | 2befab1 | 2016-04-20 12:06:06 +0200 | [diff] [blame] | 2842 | strerror(-r), VTY_NEWLINE); |
Max | 88ddcaa | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 2843 | return CMD_WARNING; |
| 2844 | } |
| 2845 | |
| 2846 | return CMD_SUCCESS; |
| 2847 | } |
| 2848 | |
Max | eaf196c | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 2849 | DEFUN(cfg_bts_si2quater_uarfcn_add, cfg_bts_si2quater_uarfcn_add_cmd, |
Max | 33220d0 | 2016-04-29 12:51:31 +0200 | [diff] [blame] | 2850 | "si2quater neighbor-list add uarfcn <0-16383> <0-511> <0-1>", |
Max | eaf196c | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 2851 | "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 Welte | 365b230 | 2016-11-26 15:06:37 +0100 | [diff] [blame] | 2863 | return CMD_WARNING; |
Max | cc0e500 | 2016-04-20 15:57:14 +0200 | [diff] [blame] | 2864 | case -ENOSPC: |
| 2865 | vty_out(vty, "Warning: not enough space in si2quater for a " |
| 2866 | "given arfcn%s", VTY_NEWLINE); |
Harald Welte | 365b230 | 2016-11-26 15:06:37 +0100 | [diff] [blame] | 2867 | return CMD_WARNING; |
Max | eaf196c | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 2868 | 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 | |
| 2877 | DEFUN(cfg_bts_si2quater_uarfcn_del, cfg_bts_si2quater_uarfcn_del_cmd, |
Max | 33220d0 | 2016-04-29 12:51:31 +0200 | [diff] [blame] | 2878 | "si2quater neighbor-list del uarfcn <0-16383> <0-511>", |
Max | eaf196c | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 2879 | "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 Welte | f989b78 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2897 | DEFUN(cfg_bts_si5_neigh, cfg_bts_si5_neigh_cmd, |
Harald Welte | 09e4fad | 2012-01-29 13:24:12 +0100 | [diff] [blame] | 2898 | "si5 neighbor-list (add|del) arfcn <0-1023>", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2899 | "SI5 Neighbor List\n" |
Harald Welte | f989b78 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2900 | "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 Welte | d8acf14 | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 2921 | |
Holger Hans Peter Freyther | 1079916 | 2012-07-20 10:27:31 +0200 | [diff] [blame] | 2922 | #define EXCL_RFLOCK_STR "Exclude this BTS from the global RF Lock\n" |
| 2923 | |
| 2924 | DEFUN(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 | |
| 2934 | DEFUN(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 Erlbeck | 8f8e5bf | 2014-01-16 11:02:14 +0100 | [diff] [blame] | 2944 | #define FORCE_COMB_SI_STR "Force the generation of a single SI (no ter/bis)\n" |
| 2945 | |
| 2946 | DEFUN(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 | |
| 2956 | DEFUN(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 Eversberg | 976493b | 2013-12-07 18:32:28 +0100 | [diff] [blame] | 2966 | static 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 | |
| 2989 | DEFUN(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 | |
| 2997 | DEFUN(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 | |
| 3006 | DEFUN(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 | |
| 3015 | DEFUN(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 | |
| 3024 | DEFUN(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 Freyther | 1515261 | 2014-12-17 14:46:17 +0100 | [diff] [blame] | 3033 | DEFUN(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 | |
| 3065 | DEFUN(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 Eversberg | fa163e8 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3077 | #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 | |
| 3084 | static 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 | |
| 3098 | static 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 Freyther | 8083cc9 | 2015-09-24 11:39:38 +0200 | [diff] [blame] | 3102 | struct amr_mode *modes; |
Andreas Eversberg | fa163e8 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3103 | int i; |
| 3104 | |
Holger Hans Peter Freyther | 8083cc9 | 2015-09-24 11:39:38 +0200 | [diff] [blame] | 3105 | 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 Eversberg | fa163e8 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3108 | } |
| 3109 | |
| 3110 | static 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 Freyther | 8083cc9 | 2015-09-24 11:39:38 +0200 | [diff] [blame] | 3114 | struct amr_mode *modes; |
Andreas Eversberg | fa163e8 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3115 | int i; |
| 3116 | |
Holger Hans Peter Freyther | 8083cc9 | 2015-09-24 11:39:38 +0200 | [diff] [blame] | 3117 | 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 Eversberg | fa163e8 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3120 | } |
| 3121 | |
| 3122 | static 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 | |
| 3157 | DEFUN(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 | |
| 3166 | DEFUN(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 | |
| 3175 | DEFUN(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 | |
| 3184 | DEFUN(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 | |
| 3193 | DEFUN(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 | |
| 3201 | DEFUN(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 | |
| 3210 | DEFUN(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 | |
| 3219 | DEFUN(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 | |
| 3228 | DEFUN(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 | |
| 3237 | DEFUN(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 | |
| 3246 | DEFUN(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 | |
| 3255 | DEFUN(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 | |
| 3264 | DEFUN(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 | |
| 3273 | DEFUN(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 | |
| 3282 | DEFUN(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 | |
| 3291 | DEFUN(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 | |
| 3299 | DEFUN(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 | |
| 3308 | DEFUN(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 | |
| 3317 | DEFUN(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 | |
| 3326 | DEFUN(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 | |
| 3335 | DEFUN(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 | |
| 3344 | DEFUN(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 Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 3353 | #define TRX_TEXT "Radio Transceiver\n" |
Harald Welte | 3e77461 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 3354 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 3355 | /* per TRX configuration */ |
| 3356 | DEFUN(cfg_trx, |
| 3357 | cfg_trx_cmd, |
Harald Welte | 2af06cb | 2012-08-17 12:50:14 +0200 | [diff] [blame] | 3358 | "trx <0-255>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 3359 | TRX_TEXT |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 3360 | "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 Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 3366 | 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 Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 3369 | return CMD_WARNING; |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 3370 | } 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 Freyther | 7113514 | 2010-03-29 08:47:44 +0200 | [diff] [blame] | 3373 | } else |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 3374 | trx = gsm_bts_trx_num(bts, trx_nr); |
Holger Hans Peter Freyther | 7113514 | 2010-03-29 08:47:44 +0200 | [diff] [blame] | 3375 | |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 3376 | if (!trx) |
| 3377 | return CMD_WARNING; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 3378 | |
| 3379 | vty->index = trx; |
Harald Welte | 8791dac | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 3380 | vty->index_sub = &trx->description; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 3381 | vty->node = TRX_NODE; |
| 3382 | |
| 3383 | return CMD_SUCCESS; |
| 3384 | } |
| 3385 | |
| 3386 | DEFUN(cfg_trx_arfcn, |
| 3387 | cfg_trx_arfcn_cmd, |
Harald Welte | 09e4fad | 2012-01-29 13:24:12 +0100 | [diff] [blame] | 3388 | "arfcn <0-1023>", |
Harald Welte | 764c8e1 | 2012-08-17 09:57:25 +0200 | [diff] [blame] | 3389 | "Set the ARFCN for this TRX\n" |
| 3390 | "Absolute Radio Frequency Channel Number\n") |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 3391 | { |
| 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) | b709bfe | 2009-12-27 20:56:38 +0100 | [diff] [blame] | 3406 | DEFUN(cfg_trx_nominal_power, |
| 3407 | cfg_trx_nominal_power_cmd, |
| 3408 | "nominal power <0-100>", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3409 | "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) | b709bfe | 2009-12-27 20:56:38 +0100 | [diff] [blame] | 3412 | { |
| 3413 | struct gsm_bts_trx *trx = vty->index; |
| 3414 | |
| 3415 | trx->nominal_power = atoi(argv[0]); |
| 3416 | |
| 3417 | return CMD_SUCCESS; |
| 3418 | } |
| 3419 | |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 3420 | DEFUN(cfg_trx_max_power_red, |
| 3421 | cfg_trx_max_power_red_cmd, |
| 3422 | "max_power_red <0-100>", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3423 | "Reduction of maximum BS RF Power (relative to nominal power)\n" |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 3424 | "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 Welte | 01acd74 | 2009-11-18 09:20:22 +0100 | [diff] [blame] | 3428 | int upper_limit = 24; /* default 12.21 max power red. */ |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 3429 | |
| 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 Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 3449 | DEFUN(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 Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3452 | "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 Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 3464 | { |
| 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 | |
| 3472 | DEFUN(cfg_trx_rsl_e1_tei, |
| 3473 | cfg_trx_rsl_e1_tei_cmd, |
| 3474 | "rsl e1 tei <0-63>", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3475 | "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 Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 3479 | { |
| 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 Freyther | 1c8b480 | 2009-11-11 11:54:24 +0100 | [diff] [blame] | 3487 | DEFUN(cfg_trx_rf_locked, |
| 3488 | cfg_trx_rf_locked_cmd, |
| 3489 | "rf_locked (0|1)", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3490 | "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 Freyther | 1c8b480 | 2009-11-11 11:54:24 +0100 | [diff] [blame] | 3493 | { |
| 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 Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 3500 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 3501 | /* per TS configuration */ |
| 3502 | DEFUN(cfg_ts, |
| 3503 | cfg_ts_cmd, |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 3504 | "timeslot <0-7>", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3505 | "Select a Timeslot to configure\n" |
| 3506 | "Timeslot number\n") |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 3507 | { |
| 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 Welte | 3ffe1b3 | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 3526 | DEFUN(cfg_ts_pchan, |
| 3527 | cfg_ts_pchan_cmd, |
Harald Welte | 2addf85 | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 3528 | "phys_chan_config PCHAN", /* dynamically generated! */ |
Holger Hans Peter Freyther | ebe3725 | 2013-03-03 09:32:08 +0100 | [diff] [blame] | 3529 | "Physical Channel configuration (TCH/SDCCH/...)\n" "Physical Channel\n") |
Harald Welte | 2addf85 | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 3530 | { |
| 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 */ |
| 3545 | DEFUN_HIDDEN(cfg_ts_pchan_compat, |
| 3546 | cfg_ts_pchan_compat_cmd, |
Harald Welte | 3ffe1b3 | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 3547 | "phys_chan_config PCHAN", |
Holger Hans Peter Freyther | ebe3725 | 2013-03-03 09:32:08 +0100 | [diff] [blame] | 3548 | "Physical Channel configuration (TCH/SDCCH/...)\n" "Physical Channel\n") |
Harald Welte | 3ffe1b3 | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 3549 | { |
| 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 Welte | 2addf85 | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 3562 | |
| 3563 | |
Harald Welte | 85771a4 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 3564 | DEFUN(cfg_ts_tsc, |
| 3565 | cfg_ts_tsc_cmd, |
| 3566 | "training_sequence_code <0-7>", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3567 | "Training Sequence Code of the Timeslot\n" "TSC\n") |
Harald Welte | 85771a4 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 3568 | { |
| 3569 | struct gsm_bts_trx_ts *ts = vty->index; |
| 3570 | |
Harald Welte | 499cd25 | 2014-01-19 17:10:50 +0100 | [diff] [blame] | 3571 | 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 Welte | 85771a4 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 3578 | ts->tsc = atoi(argv[0]); |
| 3579 | |
| 3580 | return CMD_SUCCESS; |
| 3581 | } |
| 3582 | |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 3583 | #define HOPPING_STR "Configure frequency hopping\n" |
| 3584 | |
| 3585 | DEFUN(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 Welte | 059c1ef | 2010-06-14 22:47:37 +0200 | [diff] [blame] | 3592 | int enabled = atoi(argv[0]); |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 3593 | |
Harald Welte | 059c1ef | 2010-06-14 22:47:37 +0200 | [diff] [blame] | 3594 | 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 Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 3601 | |
| 3602 | return CMD_SUCCESS; |
| 3603 | } |
| 3604 | |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 3605 | DEFUN(cfg_ts_hsn, |
| 3606 | cfg_ts_hsn_cmd, |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 3607 | "hopping sequence-number <0-63>", |
| 3608 | HOPPING_STR |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3609 | "Which hopping sequence to use for this channel\n" |
| 3610 | "Hopping Sequence Number (HSN)\n") |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 3611 | { |
| 3612 | struct gsm_bts_trx_ts *ts = vty->index; |
| 3613 | |
| 3614 | ts->hopping.hsn = atoi(argv[0]); |
| 3615 | |
| 3616 | return CMD_SUCCESS; |
| 3617 | } |
| 3618 | |
| 3619 | DEFUN(cfg_ts_maio, |
| 3620 | cfg_ts_maio_cmd, |
| 3621 | "hopping maio <0-63>", |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 3622 | HOPPING_STR |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3623 | "Which hopping MAIO to use for this channel\n" |
| 3624 | "Mobile Allocation Index Offset (MAIO)\n") |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 3625 | { |
| 3626 | struct gsm_bts_trx_ts *ts = vty->index; |
| 3627 | |
| 3628 | ts->hopping.maio = atoi(argv[0]); |
| 3629 | |
| 3630 | return CMD_SUCCESS; |
| 3631 | } |
| 3632 | |
| 3633 | DEFUN(cfg_ts_arfcn_add, |
| 3634 | cfg_ts_arfcn_add_cmd, |
| 3635 | "hopping arfcn add <0-1023>", |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 3636 | HOPPING_STR "Configure hopping ARFCN list\n" |
| 3637 | "Add an entry to the hopping ARFCN list\n" "ARFCN\n") |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 3638 | { |
| 3639 | struct gsm_bts_trx_ts *ts = vty->index; |
| 3640 | int arfcn = atoi(argv[0]); |
| 3641 | |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 3642 | bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1); |
| 3643 | |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 3644 | return CMD_SUCCESS; |
| 3645 | } |
| 3646 | |
| 3647 | DEFUN(cfg_ts_arfcn_del, |
| 3648 | cfg_ts_arfcn_del_cmd, |
| 3649 | "hopping arfcn del <0-1023>", |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 3650 | HOPPING_STR "Configure hopping ARFCN list\n" |
| 3651 | "Delete an entry to the hopping ARFCN list\n" "ARFCN\n") |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 3652 | { |
| 3653 | struct gsm_bts_trx_ts *ts = vty->index; |
| 3654 | int arfcn = atoi(argv[0]); |
| 3655 | |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 3656 | bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0); |
| 3657 | |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 3658 | return CMD_SUCCESS; |
| 3659 | } |
| 3660 | |
Harald Welte | 3ffe1b3 | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 3661 | DEFUN(cfg_ts_e1_subslot, |
| 3662 | cfg_ts_e1_subslot_cmd, |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 3663 | "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3664 | "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 Welte | fa2015f | 2012-08-17 09:52:03 +0200 | [diff] [blame] | 3667 | "E1/T1 timeslot connected to this on-air timeslot\n" |
| 3668 | "E1/T1 timeslot connected to this on-air timeslot\n" |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3669 | "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 Welte | 3ffe1b3 | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 3675 | { |
| 3676 | struct gsm_bts_trx_ts *ts = vty->index; |
| 3677 | |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 3678 | parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]); |
Harald Welte | 3ffe1b3 | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 3679 | |
| 3680 | return CMD_SUCCESS; |
| 3681 | } |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 3682 | |
Harald Welte | a5b1dae | 2010-05-16 21:47:13 +0200 | [diff] [blame] | 3683 | void 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 Couzens | d8aad3a | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 3686 | net->bsc_ctrs->ctr[BSC_CTR_CHREQ_TOTAL].current, |
| 3687 | net->bsc_ctrs->ctr[BSC_CTR_CHREQ_NO_CHANNEL].current, |
Alexander Couzens | 65bfd76 | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 3688 | VTY_NEWLINE); |
Harald Welte | a5b1dae | 2010-05-16 21:47:13 +0200 | [diff] [blame] | 3689 | vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s", |
Alexander Couzens | d8aad3a | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 3690 | net->bsc_ctrs->ctr[BSC_CTR_CHAN_RF_FAIL].current, |
| 3691 | net->bsc_ctrs->ctr[BSC_CTR_CHAN_RLL_ERR].current, |
Alexander Couzens | 65bfd76 | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 3692 | VTY_NEWLINE); |
Harald Welte | a5b1dae | 2010-05-16 21:47:13 +0200 | [diff] [blame] | 3693 | vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s", |
Alexander Couzens | d8aad3a | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 3694 | 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 Couzens | 65bfd76 | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 3697 | VTY_NEWLINE); |
Harald Welte | a5b1dae | 2010-05-16 21:47:13 +0200 | [diff] [blame] | 3698 | vty_out(vty, "BTS failures : %lu OML, %lu RSL%s", |
Alexander Couzens | d8aad3a | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 3699 | net->bsc_ctrs->ctr[BSC_CTR_BTS_OML_FAIL].current, |
| 3700 | net->bsc_ctrs->ctr[BSC_CTR_BTS_RSL_FAIL].current, |
Alexander Couzens | 65bfd76 | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 3701 | VTY_NEWLINE); |
Harald Welte | a5b1dae | 2010-05-16 21:47:13 +0200 | [diff] [blame] | 3702 | } |
| 3703 | |
Holger Hans Peter Freyther | 07ff1c3 | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 3704 | DEFUN(drop_bts, |
| 3705 | drop_bts_cmd, |
Holger Hans Peter Freyther | e4ac0e4 | 2010-04-11 12:46:45 +0200 | [diff] [blame] | 3706 | "drop bts connection <0-65535> (oml|rsl)", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3707 | "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 Freyther | 07ff1c3 | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 3711 | { |
| 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 Freyther | 03f17d0 | 2010-11-15 20:29:46 +0100 | [diff] [blame] | 3740 | ipaccess_drop_oml(bts); |
Holger Hans Peter Freyther | 07ff1c3 | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 3741 | } 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 Freyther | 03f17d0 | 2010-11-15 20:29:46 +0100 | [diff] [blame] | 3744 | ipaccess_drop_rsl(trx); |
Holger Hans Peter Freyther | 07ff1c3 | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 3745 | } |
| 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 Freyther | 8ab66e8 | 2016-03-16 13:45:23 +0100 | [diff] [blame] | 3754 | DEFUN(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 Welte | bf4ba72 | 2014-12-28 15:00:45 +0100 | [diff] [blame] | 3792 | DEFUN(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 Hofmeyr | 191933d | 2016-05-11 18:48:39 +0200 | [diff] [blame] | 3805 | bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr); |
Harald Welte | bf4ba72 | 2014-12-28 15:00:45 +0100 | [diff] [blame] | 3806 | 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 Welte | 5213e99 | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 3841 | DEFUN(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 Hofmeyr | 191933d | 2016-05-11 18:48:39 +0200 | [diff] [blame] | 3856 | bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr); |
Harald Welte | 5213e99 | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 3857 | 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 Freyther | 07ff1c3 | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 3891 | |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 3892 | extern int bsc_vty_init_extra(void); |
Holger Hans Peter Freyther | c48a2a1 | 2010-04-10 00:08:28 +0200 | [diff] [blame] | 3893 | |
Max | 09c26f1 | 2017-01-12 19:35:11 +0100 | [diff] [blame] | 3894 | int bsc_vty_init(struct gsm_network *network) |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 3895 | { |
Harald Welte | 2addf85 | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 3896 | 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 Welte | 85a77b1 | 2012-08-17 13:02:12 +0200 | [diff] [blame] | 3907 | 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 Hofmeyr | bfe2727 | 2016-05-12 01:16:58 +0200 | [diff] [blame] | 3918 | common_cs_vty_init(network, config_write_net); |
Harald Welte | 85a77b1 | 2012-08-17 13:02:12 +0200 | [diff] [blame] | 3919 | |
Neels Hofmeyr | d416b48 | 2016-05-12 01:53:23 +0200 | [diff] [blame] | 3920 | install_element_ve(&bsc_show_net_cmd); |
Harald Welte | 7bc28f6 | 2010-05-12 16:10:35 +0000 | [diff] [blame] | 3921 | 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 Freyther | e959b4e | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 3925 | install_element_ve(&show_lchan_summary_cmd); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 3926 | |
Harald Welte | 7bc28f6 | 2010-05-12 16:10:35 +0000 | [diff] [blame] | 3927 | install_element_ve(&show_paging_cmd); |
Holger Hans Peter Freyther | 35e6fbb | 2013-02-05 09:39:09 +0100 | [diff] [blame] | 3928 | install_element_ve(&show_paging_group_cmd); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 3929 | |
Max | 09c26f1 | 2017-01-12 19:35:11 +0100 | [diff] [blame] | 3930 | logging_vty_add_cmds(NULL); |
Jacob Erlbeck | 63fac68 | 2015-10-26 16:25:37 +0100 | [diff] [blame] | 3931 | osmo_stats_vty_add_cmds(); |
Holger Hans Peter Freyther | c8d862e | 2009-12-22 22:32:51 +0100 | [diff] [blame] | 3932 | |
Holger Hans Peter Freyther | 96c8982 | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 3933 | install_element(GSMNET_NODE, &cfg_net_neci_cmd); |
Harald Welte | 0af9c9f | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 3934 | install_element(GSMNET_NODE, &cfg_net_handover_cmd); |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 3935 | 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 Freyther | 26ba2e7 | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 3941 | install_element(GSMNET_NODE, &cfg_net_T3101_cmd); |
Holger Hans Peter Freyther | 8973386 | 2009-11-21 21:42:26 +0100 | [diff] [blame] | 3942 | 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 Welte | e2aaf44 | 2010-12-23 22:53:50 +0100 | [diff] [blame] | 3951 | install_element(GSMNET_NODE, &cfg_net_T3122_cmd); |
Holger Hans Peter Freyther | 8973386 | 2009-11-21 21:42:26 +0100 | [diff] [blame] | 3952 | install_element(GSMNET_NODE, &cfg_net_T3141_cmd); |
Holger Hans Peter Freyther | 21d63ff | 2010-09-06 09:25:48 +0800 | [diff] [blame] | 3953 | install_element(GSMNET_NODE, &cfg_net_dtx_cmd); |
Holger Hans Peter Freyther | b6b9d70 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 3954 | install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd); |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 3955 | |
| 3956 | install_element(GSMNET_NODE, &cfg_bts_cmd); |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 3957 | install_node(&bts_node, config_write_bts); |
Jacob Erlbeck | f414e85 | 2013-10-29 09:30:30 +0100 | [diff] [blame] | 3958 | vty_install_default(BTS_NODE); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 3959 | install_element(BTS_NODE, &cfg_bts_type_cmd); |
Harald Welte | 8791dac | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 3960 | install_element(BTS_NODE, &cfg_description_cmd); |
| 3961 | install_element(BTS_NODE, &cfg_no_description_cmd); |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 3962 | install_element(BTS_NODE, &cfg_bts_band_cmd); |
Holger Hans Peter Freyther | a098dfb | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 3963 | install_element(BTS_NODE, &cfg_bts_ci_cmd); |
Max | 3d94aca | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 3964 | 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 Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 3968 | install_element(BTS_NODE, &cfg_bts_lac_cmd); |
| 3969 | install_element(BTS_NODE, &cfg_bts_tsc_cmd); |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 3970 | install_element(BTS_NODE, &cfg_bts_bsic_cmd); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 3971 | install_element(BTS_NODE, &cfg_bts_unit_id_cmd); |
Harald Welte | 8b3c595 | 2013-03-12 13:57:05 +0100 | [diff] [blame] | 3972 | install_element(BTS_NODE, &cfg_bts_rsl_ip_cmd); |
Sylvain Munaut | cb8e843 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 3973 | install_element(BTS_NODE, &cfg_bts_nokia_site_skip_reset_cmd); |
Andreas Eversberg | ac27b95 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 3974 | install_element(BTS_NODE, &cfg_bts_nokia_site_no_loc_rel_cnf_cmd); |
Sipos Csaba | def87b4 | 2015-02-07 13:27:36 +0100 | [diff] [blame] | 3975 | install_element(BTS_NODE, &cfg_bts_nokia_site_bts_reset_timer_cnf_cmd); |
Harald Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 3976 | install_element(BTS_NODE, &cfg_bts_stream_id_cmd); |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 3977 | install_element(BTS_NODE, &cfg_bts_oml_e1_cmd); |
| 3978 | install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd); |
Harald Welte | 3e77461 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 3979 | install_element(BTS_NODE, &cfg_bts_challoc_cmd); |
Sylvain Munaut | 8e2d8de | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 3980 | install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd); |
| 3981 | install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd); |
Andreas Eversberg | 14e12f2 | 2012-10-13 07:27:47 +0200 | [diff] [blame] | 3982 | 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 Freyther | 697ed2b | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 3985 | 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) | e19be3f | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 3987 | install_element(BTS_NODE, &cfg_bts_cell_barred_cmd); |
Holger Hans Peter Freyther | 440984b | 2010-05-14 00:39:19 +0800 | [diff] [blame] | 3988 | install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd); |
Ivan Kluchnikov | 80d5843 | 2013-09-16 13:13:04 +0400 | [diff] [blame] | 3989 | install_element(BTS_NODE, &cfg_bts_rach_ac_class_cmd); |
Harald Welte (local) | cbd4610 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 3990 | install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd); |
Harald Welte (local) | b6ea7f7 | 2009-08-14 23:09:25 +0200 | [diff] [blame] | 3991 | install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd); |
Holger Hans Peter Freyther | 2fb8ebf | 2013-07-27 21:07:57 +0200 | [diff] [blame] | 3992 | install_element(BTS_NODE, &cfg_bts_no_per_loc_upd_cmd); |
Harald Welte | b761bf8 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 3993 | install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd); |
| 3994 | install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd); |
Sylvain Munaut | 00d7146 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 3995 | 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 Eversberg | f9248d9 | 2013-03-10 11:49:35 +0100 | [diff] [blame] | 4001 | install_element(BTS_NODE, &cfg_bts_radio_link_timeout_cmd); |
Harald Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 4002 | install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd); |
bhargava | 612722c | 2016-07-21 11:14:34 +0530 | [diff] [blame] | 4003 | install_element(BTS_NODE, &cfg_bts_gprs_11bit_rach_support_for_egprs_cmd); |
Harald Welte | a925176 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 4004 | install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd); |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 4005 | install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd); |
Andreas Eversberg | a4fa21c | 2013-03-16 16:31:26 +0100 | [diff] [blame] | 4006 | install_element(BTS_NODE, &cfg_bts_gprs_net_ctrl_ord_cmd); |
Max | 88bdcd4 | 2016-07-28 11:55:37 +0200 | [diff] [blame] | 4007 | install_element(BTS_NODE, &cfg_bts_gprs_ctrl_ack_cmd); |
| 4008 | install_element(BTS_NODE, &cfg_no_bts_gprs_ctrl_ack_cmd); |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 4009 | install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd); |
Harald Welte | a925176 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 4010 | install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd); |
Harald Welte | 4a048c5 | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 4011 | install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd); |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 4012 | install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd); |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 4013 | 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 Freyther | 3112f67 | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 4016 | install_element(BTS_NODE, &cfg_bts_pag_free_cmd); |
Harald Welte | d8acf14 | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 4017 | install_element(BTS_NODE, &cfg_bts_si_mode_cmd); |
| 4018 | install_element(BTS_NODE, &cfg_bts_si_static_cmd); |
Harald Welte | 44ccb0d | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 4019 | install_element(BTS_NODE, &cfg_bts_early_cm_cmd); |
Harald Welte | ca46eff | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 4020 | install_element(BTS_NODE, &cfg_bts_neigh_mode_cmd); |
| 4021 | install_element(BTS_NODE, &cfg_bts_neigh_cmd); |
Harald Welte | f989b78 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 4022 | install_element(BTS_NODE, &cfg_bts_si5_neigh_cmd); |
Max | 88ddcaa | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 4023 | install_element(BTS_NODE, &cfg_bts_si2quater_neigh_add_cmd); |
| 4024 | install_element(BTS_NODE, &cfg_bts_si2quater_neigh_del_cmd); |
Max | eaf196c | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 4025 | install_element(BTS_NODE, &cfg_bts_si2quater_uarfcn_add_cmd); |
| 4026 | install_element(BTS_NODE, &cfg_bts_si2quater_uarfcn_del_cmd); |
Holger Hans Peter Freyther | 1079916 | 2012-07-20 10:27:31 +0200 | [diff] [blame] | 4027 | install_element(BTS_NODE, &cfg_bts_excl_rf_lock_cmd); |
| 4028 | install_element(BTS_NODE, &cfg_bts_no_excl_rf_lock_cmd); |
Jacob Erlbeck | 8f8e5bf | 2014-01-16 11:02:14 +0100 | [diff] [blame] | 4029 | install_element(BTS_NODE, &cfg_bts_force_comb_si_cmd); |
| 4030 | install_element(BTS_NODE, &cfg_bts_no_force_comb_si_cmd); |
Andreas Eversberg | 976493b | 2013-12-07 18:32:28 +0100 | [diff] [blame] | 4031 | 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 Freyther | 1515261 | 2014-12-17 14:46:17 +0100 | [diff] [blame] | 4036 | install_element(BTS_NODE, &cfg_bts_depends_on_cmd); |
| 4037 | install_element(BTS_NODE, &cfg_bts_no_depends_on_cmd); |
Andreas Eversberg | fa163e8 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 4038 | 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 Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 4060 | |
| 4061 | install_element(BTS_NODE, &cfg_trx_cmd); |
| 4062 | install_node(&trx_node, dummy_config_write); |
Jacob Erlbeck | f414e85 | 2013-10-29 09:30:30 +0100 | [diff] [blame] | 4063 | vty_install_default(TRX_NODE); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 4064 | install_element(TRX_NODE, &cfg_trx_arfcn_cmd); |
Harald Welte | 8791dac | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 4065 | install_element(TRX_NODE, &cfg_description_cmd); |
| 4066 | install_element(TRX_NODE, &cfg_no_description_cmd); |
Harald Welte (local) | b709bfe | 2009-12-27 20:56:38 +0100 | [diff] [blame] | 4067 | install_element(TRX_NODE, &cfg_trx_nominal_power_cmd); |
Harald Welte | 7f597bc | 2009-06-20 22:36:12 +0200 | [diff] [blame] | 4068 | install_element(TRX_NODE, &cfg_trx_max_power_red_cmd); |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 4069 | install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd); |
| 4070 | install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd); |
Holger Hans Peter Freyther | 1c8b480 | 2009-11-11 11:54:24 +0100 | [diff] [blame] | 4071 | install_element(TRX_NODE, &cfg_trx_rf_locked_cmd); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 4072 | |
| 4073 | install_element(TRX_NODE, &cfg_ts_cmd); |
| 4074 | install_node(&ts_node, dummy_config_write); |
Jacob Erlbeck | f414e85 | 2013-10-29 09:30:30 +0100 | [diff] [blame] | 4075 | vty_install_default(TS_NODE); |
Harald Welte | 3ffe1b3 | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 4076 | install_element(TS_NODE, &cfg_ts_pchan_cmd); |
Harald Welte | 2addf85 | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 4077 | install_element(TS_NODE, &cfg_ts_pchan_compat_cmd); |
Harald Welte | 85771a4 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 4078 | install_element(TS_NODE, &cfg_ts_tsc_cmd); |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 4079 | install_element(TS_NODE, &cfg_ts_hopping_cmd); |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 4080 | 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 Welte | 3ffe1b3 | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 4084 | install_element(TS_NODE, &cfg_ts_e1_subslot_cmd); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 4085 | |
Holger Hans Peter Freyther | 07ff1c3 | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 4086 | install_element(ENABLE_NODE, &drop_bts_cmd); |
Holger Hans Peter Freyther | 8ab66e8 | 2016-03-16 13:45:23 +0100 | [diff] [blame] | 4087 | install_element(ENABLE_NODE, &restart_bts_cmd); |
Harald Welte | 5213e99 | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 4088 | install_element(ENABLE_NODE, &pdch_act_cmd); |
Harald Welte | bf4ba72 | 2014-12-28 15:00:45 +0100 | [diff] [blame] | 4089 | install_element(ENABLE_NODE, &smscb_cmd_cmd); |
Holger Hans Peter Freyther | 07ff1c3 | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 4090 | |
Harald Welte | 63b964e | 2010-05-31 16:40:40 +0200 | [diff] [blame] | 4091 | abis_nm_vty_init(); |
Harald Welte | 1d5a206 | 2011-02-12 14:42:59 +0100 | [diff] [blame] | 4092 | abis_om2k_vty_init(); |
Harald Welte | e76bea0 | 2011-02-05 13:54:41 +0100 | [diff] [blame] | 4093 | e1inp_vty_init(); |
Harald Welte | 44ccb0d | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 4094 | osmo_fsm_vty_add_cmds(); |
Harald Welte | 63b964e | 2010-05-31 16:40:40 +0200 | [diff] [blame] | 4095 | |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 4096 | bsc_vty_init_extra(); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 4097 | |
| 4098 | return 0; |
| 4099 | } |