Daniel Willmann | 2dcdf44 | 2019-04-15 16:50:46 +0200 | [diff] [blame] | 1 | /* OsmoBSC interface to quagga VTY */ |
Harald Welte | 51e4bf3 | 2017-12-23 17:30:18 +0100 | [diff] [blame] | 2 | /* (C) 2009-2017 by Harald Welte <laforge@gnumonks.org> |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 3 | * All Rights Reserved |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
Harald Welte | 9af6ddf | 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 | 68628e8 | 2009-03-10 12:17:57 +0000 | [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 | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 13 | * GNU Affero General Public License for more details. |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 14 | * |
Harald Welte | 9af6ddf | 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 | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 17 | * |
| 18 | */ |
| 19 | |
| 20 | #include <stdlib.h> |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 21 | #include <stdbool.h> |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 22 | #include <unistd.h> |
Max | d1f70ed | 2017-09-21 16:15:32 +0200 | [diff] [blame] | 23 | #include <time.h> |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 24 | |
Harald Welte | 4b037e4 | 2010-05-19 19:45:32 +0200 | [diff] [blame] | 25 | #include <osmocom/vty/command.h> |
| 26 | #include <osmocom/vty/buffer.h> |
| 27 | #include <osmocom/vty/vty.h> |
| 28 | #include <osmocom/vty/logging.h> |
Jacob Erlbeck | 64630cc | 2015-10-26 16:25:37 +0100 | [diff] [blame] | 29 | #include <osmocom/vty/stats.h> |
Harald Welte | 4b037e4 | 2010-05-19 19:45:32 +0200 | [diff] [blame] | 30 | #include <osmocom/vty/telnet_interface.h> |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 31 | #include <osmocom/vty/misc.h> |
Neels Hofmeyr | a6078fe | 2019-01-28 03:52:14 +0100 | [diff] [blame] | 32 | #include <osmocom/vty/tdef_vty.h> |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 33 | #include <osmocom/gsm/protocol/gsm_04_08.h> |
Holger Hans Peter Freyther | ec37bb2 | 2013-02-05 09:39:09 +0100 | [diff] [blame] | 34 | #include <osmocom/gsm/gsm0502.h> |
Harald Welte | b71147a | 2017-07-18 19:11:49 +0200 | [diff] [blame] | 35 | #include <osmocom/ctrl/control_if.h> |
Neels Hofmeyr | 7b65688 | 2017-07-09 22:09:18 +0200 | [diff] [blame] | 36 | #include <osmocom/gsm/gsm48.h> |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 37 | #include <osmocom/gsm/gsm0808.h> |
Holger Hans Peter Freyther | ec37bb2 | 2013-02-05 09:39:09 +0100 | [diff] [blame] | 38 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 39 | #include <arpa/inet.h> |
| 40 | |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 41 | #include <osmocom/core/linuxlist.h> |
Oliver Smith | f105190 | 2018-10-09 15:24:06 +0200 | [diff] [blame] | 42 | #include <osmocom/core/socket.h> |
Neels Hofmeyr | c016479 | 2017-09-04 15:15:32 +0200 | [diff] [blame] | 43 | #include <osmocom/bsc/gsm_data.h> |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 44 | #include <osmocom/abis/e1_input.h> |
Neels Hofmeyr | c016479 | 2017-09-04 15:15:32 +0200 | [diff] [blame] | 45 | #include <osmocom/bsc/abis_nm.h> |
| 46 | #include <osmocom/bsc/abis_om2000.h> |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 47 | #include <osmocom/core/utils.h> |
| 48 | #include <osmocom/gsm/gsm_utils.h> |
Harald Welte | cdc59ff | 2011-05-23 20:42:26 +0200 | [diff] [blame] | 49 | #include <osmocom/gsm/abis_nm.h> |
Neels Hofmeyr | c016479 | 2017-09-04 15:15:32 +0200 | [diff] [blame] | 50 | #include <osmocom/bsc/chan_alloc.h> |
| 51 | #include <osmocom/bsc/meas_rep.h> |
| 52 | #include <osmocom/bsc/vty.h> |
Harald Welte | ea34a4e | 2012-06-16 14:59:56 +0800 | [diff] [blame] | 53 | #include <osmocom/gprs/gprs_ns.h> |
Neels Hofmeyr | c016479 | 2017-09-04 15:15:32 +0200 | [diff] [blame] | 54 | #include <osmocom/bsc/system_information.h> |
| 55 | #include <osmocom/bsc/debug.h> |
| 56 | #include <osmocom/bsc/paging.h> |
| 57 | #include <osmocom/bsc/ipaccess.h> |
| 58 | #include <osmocom/bsc/abis_rsl.h> |
| 59 | #include <osmocom/bsc/bsc_msc_data.h> |
| 60 | #include <osmocom/bsc/osmo_bsc_rf.h> |
| 61 | #include <osmocom/bsc/pcu_if.h> |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 62 | #include <osmocom/bsc/handover_fsm.h> |
Neels Hofmeyr | e25018b | 2017-11-27 21:29:33 +0100 | [diff] [blame] | 63 | #include <osmocom/bsc/handover_cfg.h> |
| 64 | #include <osmocom/bsc/handover_vty.h> |
Neels Hofmeyr | 6242742 | 2018-07-24 16:18:15 +0200 | [diff] [blame] | 65 | #include <osmocom/bsc/gsm_04_08_rr.h> |
Stefan Sperling | 6442e43 | 2018-02-06 14:44:54 +0100 | [diff] [blame] | 66 | #include <osmocom/bsc/acc_ramp.h> |
Neels Hofmeyr | f28f1ef | 2018-04-20 15:53:53 +0200 | [diff] [blame] | 67 | #include <osmocom/bsc/meas_feed.h> |
Neels Hofmeyr | 19bed23 | 2018-03-22 04:54:57 +0100 | [diff] [blame] | 68 | #include <osmocom/bsc/neighbor_ident.h> |
| 69 | #include <osmocom/bsc/handover.h> |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 70 | #include <osmocom/bsc/timeslot_fsm.h> |
| 71 | #include <osmocom/bsc/lchan_fsm.h> |
Neels Hofmeyr | a07b667 | 2018-07-12 05:00:55 +0200 | [diff] [blame] | 72 | #include <osmocom/bsc/lchan_select.h> |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 73 | #include <osmocom/mgcp_client/mgcp_client_endpoint_fsm.h> |
Neels Hofmeyr | 06d39fd | 2016-05-12 01:16:58 +0200 | [diff] [blame] | 74 | |
Holger Hans Peter Freyther | ec37bb2 | 2013-02-05 09:39:09 +0100 | [diff] [blame] | 75 | #include <inttypes.h> |
| 76 | |
Harald Welte | c08e8be | 2011-03-04 13:53:51 +0100 | [diff] [blame] | 77 | #include "../../bscconfig.h" |
Harald Welte | 1353f96 | 2010-05-16 19:20:24 +0200 | [diff] [blame] | 78 | |
Neels Hofmeyr | 70c5fd2 | 2018-01-19 15:55:14 +0100 | [diff] [blame] | 79 | #define BTS_NR_STR "BTS Number\n" |
| 80 | #define TRX_NR_STR "TRX Number\n" |
| 81 | #define TS_NR_STR "Timeslot Number\n" |
Harald Welte | 0bfd8d9 | 2018-02-12 18:06:53 +0100 | [diff] [blame] | 82 | #define SS_NR_STR "Sub-slot Number\n" |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 83 | #define LCHAN_NR_STR "Logical Channel Number\n" |
Neels Hofmeyr | 70c5fd2 | 2018-01-19 15:55:14 +0100 | [diff] [blame] | 84 | #define BTS_TRX_STR BTS_NR_STR TRX_NR_STR |
| 85 | #define BTS_TRX_TS_STR BTS_TRX_STR TS_NR_STR |
| 86 | #define BTS_TRX_TS_LCHAN_STR BTS_TRX_TS_STR LCHAN_NR_STR |
Harald Welte | 0bfd8d9 | 2018-02-12 18:06:53 +0100 | [diff] [blame] | 87 | #define BTS_NR_TRX_TS_STR2 \ |
| 88 | "BTS for manual command\n" BTS_NR_STR \ |
| 89 | "TRX for manual command\n" TRX_NR_STR \ |
| 90 | "Timeslot for manual command\n" TS_NR_STR |
| 91 | #define BTS_NR_TRX_TS_SS_STR2 \ |
| 92 | BTS_NR_TRX_TS_STR2 \ |
| 93 | "Sub-slot for manual command\n" SS_NR_STR |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 94 | |
Harald Welte | ea4647d | 2010-05-12 17:19:53 +0000 | [diff] [blame] | 95 | /* FIXME: this should go to some common file */ |
| 96 | static const struct value_string gprs_ns_timer_strs[] = { |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 97 | { 0, "tns-block" }, |
| 98 | { 1, "tns-block-retries" }, |
| 99 | { 2, "tns-reset" }, |
| 100 | { 3, "tns-reset-retries" }, |
| 101 | { 4, "tns-test" }, |
| 102 | { 5, "tns-alive" }, |
| 103 | { 6, "tns-alive-retries" }, |
| 104 | { 0, NULL } |
| 105 | }; |
| 106 | |
Harald Welte | ea4647d | 2010-05-12 17:19:53 +0000 | [diff] [blame] | 107 | static const struct value_string gprs_bssgp_cfg_strs[] = { |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 108 | { 0, "blocking-timer" }, |
| 109 | { 1, "blocking-retries" }, |
| 110 | { 2, "unblocking-retries" }, |
| 111 | { 3, "reset-timer" }, |
| 112 | { 4, "reset-retries" }, |
| 113 | { 5, "suspend-timer" }, |
| 114 | { 6, "suspend-retries" }, |
| 115 | { 7, "resume-timer" }, |
| 116 | { 8, "resume-retries" }, |
| 117 | { 9, "capability-update-timer" }, |
| 118 | { 10, "capability-update-retries" }, |
| 119 | { 0, NULL } |
| 120 | }; |
| 121 | |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 122 | static const struct value_string bts_neigh_mode_strs[] = { |
| 123 | { NL_MODE_AUTOMATIC, "automatic" }, |
| 124 | { NL_MODE_MANUAL, "manual" }, |
| 125 | { NL_MODE_MANUAL_SI5SEP, "manual-si5" }, |
| 126 | { 0, NULL } |
| 127 | }; |
| 128 | |
Daniel Willmann | 7d10983 | 2012-05-14 18:43:23 +0200 | [diff] [blame] | 129 | const struct value_string bts_loc_fix_names[] = { |
| 130 | { BTS_LOC_FIX_INVALID, "invalid" }, |
| 131 | { BTS_LOC_FIX_2D, "fix2d" }, |
| 132 | { BTS_LOC_FIX_3D, "fix3d" }, |
| 133 | { 0, NULL } |
| 134 | }; |
| 135 | |
Neels Hofmeyr | 6dd5a9b | 2018-02-14 00:06:19 +0100 | [diff] [blame] | 136 | struct cmd_node net_node = { |
| 137 | GSMNET_NODE, |
| 138 | "%s(config-net)# ", |
| 139 | 1, |
| 140 | }; |
| 141 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 142 | struct cmd_node bts_node = { |
| 143 | BTS_NODE, |
Harald Welte | 570ce24 | 2012-08-17 13:16:10 +0200 | [diff] [blame] | 144 | "%s(config-net-bts)# ", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 145 | 1, |
| 146 | }; |
| 147 | |
| 148 | struct cmd_node trx_node = { |
| 149 | TRX_NODE, |
Harald Welte | 570ce24 | 2012-08-17 13:16:10 +0200 | [diff] [blame] | 150 | "%s(config-net-bts-trx)# ", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 151 | 1, |
| 152 | }; |
| 153 | |
| 154 | struct cmd_node ts_node = { |
| 155 | TS_NODE, |
Harald Welte | 570ce24 | 2012-08-17 13:16:10 +0200 | [diff] [blame] | 156 | "%s(config-net-bts-trx-ts)# ", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 157 | 1, |
| 158 | }; |
| 159 | |
Neels Hofmeyr | 6dd5a9b | 2018-02-14 00:06:19 +0100 | [diff] [blame] | 160 | static struct gsm_network *vty_global_gsm_network = NULL; |
| 161 | |
| 162 | struct gsm_network *gsmnet_from_vty(struct vty *v) |
| 163 | { |
| 164 | /* It can't hurt to force callers to continue to pass the vty instance |
| 165 | * to this function, in case we'd like to retrieve the global |
| 166 | * gsm_network instance from the vty at some point in the future. But |
| 167 | * until then, just return the global pointer, which should have been |
| 168 | * initialized by common_cs_vty_init(). |
| 169 | */ |
| 170 | OSMO_ASSERT(vty_global_gsm_network); |
| 171 | return vty_global_gsm_network; |
| 172 | } |
| 173 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 174 | static int dummy_config_write(struct vty *v) |
| 175 | { |
| 176 | return CMD_SUCCESS; |
| 177 | } |
| 178 | |
| 179 | static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms) |
| 180 | { |
Harald Welte | 1304b35 | 2013-03-15 16:57:33 +0100 | [diff] [blame] | 181 | vty_out(vty,"Oper '%s', Admin '%s', Avail '%s'%s", |
| 182 | abis_nm_opstate_name(nms->operational), |
| 183 | get_value_string(abis_nm_adm_state_names, nms->administrative), |
Harald Welte | 867d9f3 | 2011-05-23 20:30:39 +0200 | [diff] [blame] | 184 | abis_nm_avail_name(nms->availability), VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 185 | } |
| 186 | |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 187 | static void dump_pchan_load_vty(struct vty *vty, char *prefix, |
| 188 | const struct pchan_load *pl) |
| 189 | { |
| 190 | int i; |
Neels Hofmeyr | 9abc652 | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 191 | int dumped = 0; |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 192 | |
| 193 | for (i = 0; i < ARRAY_SIZE(pl->pchan); i++) { |
| 194 | const struct load_counter *lc = &pl->pchan[i]; |
| 195 | unsigned int percent; |
| 196 | |
| 197 | if (lc->total == 0) |
| 198 | continue; |
| 199 | |
| 200 | percent = (lc->used * 100) / lc->total; |
| 201 | |
| 202 | vty_out(vty, "%s%20s: %3u%% (%u/%u)%s", prefix, |
| 203 | gsm_pchan_name(i), percent, lc->used, lc->total, |
| 204 | VTY_NEWLINE); |
Neels Hofmeyr | 9abc652 | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 205 | dumped ++; |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 206 | } |
Neels Hofmeyr | 9abc652 | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 207 | if (!dumped) |
| 208 | vty_out(vty, "%s(none)%s", prefix, VTY_NEWLINE); |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 209 | } |
| 210 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 211 | static void net_dump_vty(struct vty *vty, struct gsm_network *net) |
| 212 | { |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 213 | struct pchan_load pl; |
Harald Welte | 51e4bf3 | 2017-12-23 17:30:18 +0100 | [diff] [blame] | 214 | int i; |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 215 | |
Neels Hofmeyr | f93970b | 2018-03-05 02:09:40 +0100 | [diff] [blame] | 216 | vty_out(vty, "BSC is on MCC-MNC %s and has %u BTS%s", |
| 217 | osmo_plmn_name(&net->plmn), net->num_bts, VTY_NEWLINE); |
Max | ddee01f | 2016-05-24 14:23:27 +0200 | [diff] [blame] | 218 | vty_out(vty, "%s", VTY_NEWLINE); |
Harald Welte | 51e4bf3 | 2017-12-23 17:30:18 +0100 | [diff] [blame] | 219 | vty_out(vty, " Encryption:"); |
| 220 | for (i = 0; i < 8; i++) { |
| 221 | if (net->a5_encryption_mask & (1 << i)) |
| 222 | vty_out(vty, " A5/%u", i); |
| 223 | } |
| 224 | vty_out(vty, "%s", VTY_NEWLINE); |
Holger Hans Peter Freyther | f7d752f | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 225 | vty_out(vty, " NECI (TCH/H): %u%s", net->neci, |
| 226 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 227 | vty_out(vty, " Use TCH for Paging any: %d%s", net->pag_any_tch, |
| 228 | VTY_NEWLINE); |
Neels Hofmeyr | e25018b | 2017-11-27 21:29:33 +0100 | [diff] [blame] | 229 | |
| 230 | { |
| 231 | struct gsm_bts *bts; |
| 232 | unsigned int ho_active_count = 0; |
| 233 | unsigned int ho_inactive_count = 0; |
| 234 | |
| 235 | llist_for_each_entry(bts, &net->bts_list, list) { |
| 236 | if (ho_get_ho_active(bts->ho)) |
| 237 | ho_active_count ++; |
| 238 | else |
| 239 | ho_inactive_count ++; |
| 240 | } |
| 241 | |
| 242 | if (ho_active_count && ho_inactive_count) |
| 243 | vty_out(vty, " Handover: On at %u BTS, Off at %u BTS%s", |
| 244 | ho_active_count, ho_inactive_count, VTY_NEWLINE); |
| 245 | else |
| 246 | vty_out(vty, " Handover: %s%s", ho_active_count ? "On" : "Off", |
| 247 | VTY_NEWLINE); |
| 248 | } |
| 249 | |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 250 | network_chan_load(&pl, net); |
| 251 | vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE); |
| 252 | dump_pchan_load_vty(vty, " ", &pl); |
Holger Hans Peter Freyther | 37ac420 | 2011-02-24 14:19:14 +0100 | [diff] [blame] | 253 | |
| 254 | /* show rf */ |
Holger Hans Peter Freyther | a9fae1a | 2014-02-08 12:12:03 +0100 | [diff] [blame] | 255 | if (net->bsc_data) |
Holger Hans Peter Freyther | 37ac420 | 2011-02-24 14:19:14 +0100 | [diff] [blame] | 256 | vty_out(vty, " Last RF Command: %s%s", |
Holger Hans Peter Freyther | 8ec4952 | 2011-08-15 15:53:00 +0200 | [diff] [blame] | 257 | net->bsc_data->rf_ctrl->last_state_command, |
Holger Hans Peter Freyther | 37ac420 | 2011-02-24 14:19:14 +0100 | [diff] [blame] | 258 | VTY_NEWLINE); |
Holger Hans Peter Freyther | a9fae1a | 2014-02-08 12:12:03 +0100 | [diff] [blame] | 259 | if (net->bsc_data) |
Jacob Erlbeck | 779a728 | 2013-09-11 10:46:57 +0200 | [diff] [blame] | 260 | vty_out(vty, " Last RF Lock Command: %s%s", |
| 261 | net->bsc_data->rf_ctrl->last_rf_lock_ctrl_command, |
| 262 | VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 263 | } |
| 264 | |
Neels Hofmeyr | ea11bf8 | 2016-05-12 01:53:23 +0200 | [diff] [blame] | 265 | DEFUN(bsc_show_net, bsc_show_net_cmd, "show network", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 266 | SHOW_STR "Display information about a GSM NETWORK\n") |
| 267 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 268 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 269 | net_dump_vty(vty, net); |
| 270 | |
| 271 | return CMD_SUCCESS; |
| 272 | } |
| 273 | |
| 274 | static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l) |
| 275 | { |
Harald Welte | edb3778 | 2009-05-01 14:59:07 +0000 | [diff] [blame] | 276 | struct e1inp_line *line; |
| 277 | |
| 278 | if (!e1l) { |
| 279 | vty_out(vty, " None%s", VTY_NEWLINE); |
| 280 | return; |
| 281 | } |
| 282 | |
| 283 | line = e1l->ts->line; |
| 284 | |
| 285 | vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s", |
| 286 | line->num, line->driver->name, e1l->ts->num, |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 287 | e1inp_signtype_name(e1l->type), VTY_NEWLINE); |
Harald Welte | edb3778 | 2009-05-01 14:59:07 +0000 | [diff] [blame] | 288 | vty_out(vty, " E1 TEI %u, SAPI %u%s", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 289 | e1l->tei, e1l->sapi, VTY_NEWLINE); |
| 290 | } |
| 291 | |
Oliver Smith | f105190 | 2018-10-09 15:24:06 +0200 | [diff] [blame] | 292 | /*! Dump the IP addresses and ports of the input signal link's timeslot. |
| 293 | * This only makes sense for links connected with ipaccess. |
| 294 | * Example output: "(r=10.1.42.1:55416<->l=10.1.42.123:3003)" */ |
| 295 | static void e1isl_dump_vty_tcp(struct vty *vty, const struct e1inp_sign_link *e1l) |
| 296 | { |
| 297 | if (e1l) { |
| 298 | char *name = osmo_sock_get_name(NULL, e1l->ts->driver.ipaccess.fd.fd); |
| 299 | vty_out(vty, "%s", name); |
| 300 | talloc_free(name); |
| 301 | } |
| 302 | vty_out(vty, "%s", VTY_NEWLINE); |
| 303 | } |
| 304 | |
Neels Hofmeyr | c1db52f | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 305 | static void vty_out_neigh_list(struct vty *vty, struct bitvec *bv) |
| 306 | { |
| 307 | int count = 0; |
| 308 | int i; |
| 309 | for (i = 0; i < 1024; i++) { |
| 310 | if (!bitvec_get_bit_pos(bv, i)) |
| 311 | continue; |
| 312 | vty_out(vty, " %u", i); |
| 313 | count ++; |
| 314 | } |
| 315 | if (!count) |
| 316 | vty_out(vty, " (none)"); |
| 317 | else |
| 318 | vty_out(vty, " (%d)", count); |
| 319 | } |
| 320 | |
Philipp Maier | f27dbc5 | 2018-02-21 13:25:57 +0100 | [diff] [blame] | 321 | static void bts_dump_vty_features(struct vty *vty, struct gsm_bts *bts) |
| 322 | { |
| 323 | unsigned int i; |
| 324 | bool no_features = true; |
| 325 | vty_out(vty, " Features:%s", VTY_NEWLINE); |
| 326 | |
| 327 | for (i = 0; i < _NUM_BTS_FEAT; i++) { |
| 328 | if (osmo_bts_has_feature(&bts->features, i)) { |
| 329 | vty_out(vty, " %03u ", i); |
| 330 | vty_out(vty, "%-40s%s", osmo_bts_feature_name(i), VTY_NEWLINE); |
| 331 | no_features = false; |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | if (no_features) |
| 336 | vty_out(vty, " (not available)%s", VTY_NEWLINE); |
| 337 | } |
| 338 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 339 | static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts) |
| 340 | { |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 341 | struct pchan_load pl; |
Max | d1f70ed | 2017-09-21 16:15:32 +0200 | [diff] [blame] | 342 | unsigned long long sec; |
Neels Hofmeyr | 097a6e7 | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 343 | struct gsm_bts_trx *trx; |
| 344 | int ts_hopping_total; |
| 345 | int ts_non_hopping_total; |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 346 | |
Holger Hans Peter Freyther | c4a49e3 | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 347 | vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, " |
Harald Welte | 557c84e | 2015-11-20 10:50:24 +0100 | [diff] [blame] | 348 | "BSIC %u (NCC=%u, BCC=%u) and %u TRX%s", |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 349 | bts->nr, btstype2str(bts->type), gsm_band_name(bts->band), |
Holger Hans Peter Freyther | c4a49e3 | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 350 | bts->cell_identity, |
Harald Welte | a2bbc5e | 2015-11-20 10:43:31 +0100 | [diff] [blame] | 351 | bts->location_area_code, bts->bsic, |
Harald Welte | 557c84e | 2015-11-20 10:50:24 +0100 | [diff] [blame] | 352 | bts->bsic >> 3, bts->bsic & 7, |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 353 | bts->num_trx, VTY_NEWLINE); |
Neels Hofmeyr | 97d110e | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 354 | vty_out(vty, " Description: %s%s", |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 355 | bts->description ? bts->description : "(null)", VTY_NEWLINE); |
Neels Hofmeyr | 097a6e7 | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 356 | |
| 357 | vty_out(vty, " ARFCNs:"); |
| 358 | ts_hopping_total = 0; |
| 359 | ts_non_hopping_total = 0; |
| 360 | llist_for_each_entry(trx, &bts->trx_list, list) { |
| 361 | int ts_nr; |
| 362 | int ts_hopping = 0; |
| 363 | int ts_non_hopping = 0; |
| 364 | for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) { |
| 365 | struct gsm_bts_trx_ts *ts = &trx->ts[ts_nr]; |
| 366 | if (ts->hopping.enabled) |
| 367 | ts_hopping++; |
| 368 | else |
| 369 | ts_non_hopping++; |
| 370 | } |
| 371 | |
| 372 | if (ts_non_hopping) |
| 373 | vty_out(vty, " %u", trx->arfcn); |
| 374 | ts_hopping_total += ts_hopping; |
| 375 | ts_non_hopping_total += ts_non_hopping; |
| 376 | } |
| 377 | if (ts_hopping_total) { |
| 378 | if (ts_non_hopping_total) |
| 379 | vty_out(vty, " / Hopping on %d of %d timeslots", |
| 380 | ts_hopping_total, ts_hopping_total + ts_non_hopping_total); |
| 381 | else |
| 382 | vty_out(vty, " Hopping on all %d timeslots", ts_hopping_total); |
| 383 | } |
| 384 | vty_out(vty, "%s", VTY_NEWLINE); |
| 385 | |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 386 | if (strnlen(bts->pcu_version, MAX_VERSION_LENGTH)) |
Neels Hofmeyr | 97d110e | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 387 | vty_out(vty, " PCU version %s connected%s", bts->pcu_version, |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 388 | VTY_NEWLINE); |
Neels Hofmeyr | 97d110e | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 389 | vty_out(vty, " MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE); |
| 390 | vty_out(vty, " Minimum Rx Level for Access: %i dBm%s", |
Harald Welte | 1d8dbc4 | 2009-12-12 15:38:16 +0100 | [diff] [blame] | 391 | rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min), |
| 392 | VTY_NEWLINE); |
Neels Hofmeyr | 97d110e | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 393 | vty_out(vty, " Cell Reselection Hysteresis: %u dBm%s", |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 394 | bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE); |
Stefan Sperling | 6442e43 | 2018-02-06 14:44:54 +0100 | [diff] [blame] | 395 | vty_out(vty, " Access Control Class ramping: %senabled%s", |
| 396 | acc_ramp_is_enabled(&bts->acc_ramp) ? "" : "not ", VTY_NEWLINE); |
| 397 | if (acc_ramp_is_enabled(&bts->acc_ramp)) { |
| 398 | if (!acc_ramp_step_interval_is_dynamic(&bts->acc_ramp)) |
| 399 | vty_out(vty, " Access Control Class ramping step interval: %u seconds%s", |
| 400 | acc_ramp_get_step_interval(&bts->acc_ramp), VTY_NEWLINE); |
| 401 | else |
| 402 | vty_out(vty, " Access Control Class ramping step interval: dynamic%s", VTY_NEWLINE); |
| 403 | vty_out(vty, " enabling %u Access Control Class%s per ramping step%s", |
| 404 | acc_ramp_get_step_size(&bts->acc_ramp), |
| 405 | acc_ramp_get_step_size(&bts->acc_ramp) > 1 ? "es" : "", VTY_NEWLINE); |
| 406 | } |
Neels Hofmeyr | 97d110e | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 407 | vty_out(vty, " RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer, |
Sylvain Munaut | 4010f1e | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 408 | VTY_NEWLINE); |
Neels Hofmeyr | 97d110e | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 409 | vty_out(vty, " RACH Max transmissions: %u%s", |
Sylvain Munaut | 4010f1e | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 410 | rach_max_trans_raw2val(bts->si_common.rach_control.max_trans), |
| 411 | VTY_NEWLINE); |
Harald Welte | 7135501 | 2009-12-21 23:08:18 +0100 | [diff] [blame] | 412 | if (bts->si_common.rach_control.cell_bar) |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 413 | vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE); |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 414 | if (bts->dtxu != GSM48_DTX_SHALL_NOT_BE_USED) |
Neels Hofmeyr | 97d110e | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 415 | vty_out(vty, " Uplink DTX: %s%s", |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 416 | (bts->dtxu != GSM48_DTX_SHALL_BE_USED) ? |
| 417 | "enabled" : "forced", VTY_NEWLINE); |
| 418 | else |
Neels Hofmeyr | 97d110e | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 419 | vty_out(vty, " Uplink DTX: not enabled%s", VTY_NEWLINE); |
| 420 | vty_out(vty, " Downlink DTX: %senabled%s", bts->dtxd ? "" : "not ", |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 421 | VTY_NEWLINE); |
Neels Hofmeyr | 97d110e | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 422 | vty_out(vty, " Channel Description Attachment: %s%s", |
Andreas Eversberg | 2ee7ecd | 2012-10-13 07:27:47 +0200 | [diff] [blame] | 423 | (bts->si_common.chan_desc.att) ? "yes" : "no", VTY_NEWLINE); |
Neels Hofmeyr | 97d110e | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 424 | vty_out(vty, " Channel Description BS-PA-MFRMS: %u%s", |
Andreas Eversberg | 2ee7ecd | 2012-10-13 07:27:47 +0200 | [diff] [blame] | 425 | bts->si_common.chan_desc.bs_pa_mfrms + 2, VTY_NEWLINE); |
Neels Hofmeyr | 97d110e | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 426 | vty_out(vty, " Channel Description BS-AG_BLKS-RES: %u%s", |
Andreas Eversberg | 2ee7ecd | 2012-10-13 07:27:47 +0200 | [diff] [blame] | 427 | bts->si_common.chan_desc.bs_ag_blks_res, VTY_NEWLINE); |
Neels Hofmeyr | 97d110e | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 428 | vty_out(vty, " System Information present: 0x%08x, static: 0x%08x%s", |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 429 | bts->si_valid, bts->si_mode_static, VTY_NEWLINE); |
Neels Hofmeyr | 97d110e | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 430 | vty_out(vty, " Early Classmark Sending: 2G %s, 3G %s%s%s", |
Harald Welte | 42def72 | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 431 | bts->early_classmark_allowed ? "allowed" : "forbidden", |
Pau Espin Pedrol | e8dda5f | 2017-11-23 19:06:09 +0100 | [diff] [blame] | 432 | bts->early_classmark_allowed_3g ? "allowed" : "forbidden", |
| 433 | bts->early_classmark_allowed_3g && !bts->early_classmark_allowed ? |
| 434 | " (forbidden by 2G bit)" : "", |
Harald Welte | 42def72 | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 435 | VTY_NEWLINE); |
Harald Welte | 8254cf7 | 2017-05-29 13:42:19 +0200 | [diff] [blame] | 436 | if (bts->pcu_sock_path) |
Neels Hofmeyr | 97d110e | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 437 | vty_out(vty, " PCU Socket Path: %s%s", bts->pcu_sock_path, VTY_NEWLINE); |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 438 | if (is_ipaccess_bts(bts)) |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 439 | vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s", |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 440 | bts->ip_access.site_id, bts->ip_access.bts_id, |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 441 | bts->oml_tei, VTY_NEWLINE); |
Sylvain Munaut | c951946 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 442 | else if (bts->type == GSM_BTS_TYPE_NOKIA_SITE) |
| 443 | vty_out(vty, " Skip Reset: %d%s", |
| 444 | bts->nokia.skip_reset, VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 445 | vty_out(vty, " NM State: "); |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 446 | net_dump_nmstate(vty, &bts->mo.nm_state); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 447 | vty_out(vty, " Site Mgr NM State: "); |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 448 | net_dump_nmstate(vty, &bts->site_mgr.mo.nm_state); |
Max | 366f727 | 2018-11-06 15:08:30 +0100 | [diff] [blame] | 449 | |
| 450 | if (bts->gprs.mode != BTS_GPRS_NONE) { |
| 451 | vty_out(vty, " GPRS NSE: "); |
| 452 | net_dump_nmstate(vty, &bts->gprs.nse.mo.nm_state); |
| 453 | vty_out(vty, " GPRS CELL: "); |
| 454 | net_dump_nmstate(vty, &bts->gprs.cell.mo.nm_state); |
| 455 | vty_out(vty, " GPRS NSVC0: "); |
| 456 | net_dump_nmstate(vty, &bts->gprs.nsvc[0].mo.nm_state); |
| 457 | vty_out(vty, " GPRS NSVC1: "); |
| 458 | net_dump_nmstate(vty, &bts->gprs.nsvc[1].mo.nm_state); |
| 459 | } else |
| 460 | vty_out(vty, " GPRS: not configured%s", VTY_NEWLINE); |
| 461 | |
Holger Hans Peter Freyther | 66e14cd | 2011-04-26 15:52:34 +0200 | [diff] [blame] | 462 | vty_out(vty, " Paging: %u pending requests, %u free slots%s", |
| 463 | paging_pending_requests_nr(bts), |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 464 | bts->paging.available_slots, VTY_NEWLINE); |
Holger Hans Peter Freyther | d283db4 | 2010-11-25 16:28:45 +0100 | [diff] [blame] | 465 | if (is_ipaccess_bts(bts)) { |
Oliver Smith | f105190 | 2018-10-09 15:24:06 +0200 | [diff] [blame] | 466 | vty_out(vty, " OML Link: "); |
| 467 | e1isl_dump_vty_tcp(vty, bts->oml_link); |
Max | 3d049d2 | 2017-10-09 17:12:53 +0200 | [diff] [blame] | 468 | vty_out(vty, " OML Link state: %s", get_model_oml_status(bts)); |
Max | 25cc407 | 2017-10-10 14:50:35 +0200 | [diff] [blame] | 469 | sec = bts_uptime(bts); |
| 470 | if (sec) |
Max | ff3fad1 | 2018-01-07 16:50:42 +0100 | [diff] [blame] | 471 | vty_out(vty, " %llu days %llu hours %llu min. %llu sec.", |
| 472 | OSMO_SEC2DAY(sec), OSMO_SEC2HRS(sec), OSMO_SEC2MIN(sec), sec % 60); |
| 473 | vty_out(vty, "%s", VTY_NEWLINE); |
Holger Hans Peter Freyther | d283db4 | 2010-11-25 16:28:45 +0100 | [diff] [blame] | 474 | } else { |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 475 | vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE); |
| 476 | e1isl_dump_vty(vty, bts->oml_link); |
| 477 | } |
Holger Hans Peter Freyther | d283db4 | 2010-11-25 16:28:45 +0100 | [diff] [blame] | 478 | |
Neels Hofmeyr | c1db52f | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 479 | vty_out(vty, " Neighbor Cells: "); |
| 480 | switch (bts->neigh_list_manual_mode) { |
| 481 | default: |
| 482 | case NL_MODE_AUTOMATIC: |
| 483 | vty_out(vty, "Automatic"); |
| 484 | /* generate_bcch_chan_list() should populate si_common.neigh_list */ |
| 485 | break; |
| 486 | case NL_MODE_MANUAL: |
| 487 | vty_out(vty, "Manual"); |
| 488 | break; |
| 489 | case NL_MODE_MANUAL_SI5SEP: |
| 490 | vty_out(vty, "Manual/separate SI5"); |
| 491 | break; |
| 492 | } |
| 493 | vty_out(vty, ", ARFCNs:"); |
| 494 | vty_out_neigh_list(vty, &bts->si_common.neigh_list); |
| 495 | if (bts->neigh_list_manual_mode == NL_MODE_MANUAL_SI5SEP) { |
| 496 | vty_out(vty, " SI5:"); |
| 497 | vty_out_neigh_list(vty, &bts->si_common.si5_neigh_list); |
| 498 | } |
| 499 | vty_out(vty, "%s", VTY_NEWLINE); |
| 500 | |
Holger Hans Peter Freyther | d283db4 | 2010-11-25 16:28:45 +0100 | [diff] [blame] | 501 | /* FIXME: chan_desc */ |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 502 | memset(&pl, 0, sizeof(pl)); |
Neels Hofmeyr | 2afffd5 | 2016-09-25 17:01:20 +0200 | [diff] [blame] | 503 | bts_chan_load(&pl, bts); |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 504 | vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE); |
| 505 | dump_pchan_load_vty(vty, " ", &pl); |
Harald Welte | d82101e | 2017-12-09 23:07:38 +0100 | [diff] [blame] | 506 | |
Neels Hofmeyr | 97d110e | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 507 | vty_out(vty, " Channel Requests : %"PRIu64" total, %"PRIu64" no channel%s", |
Harald Welte | d82101e | 2017-12-09 23:07:38 +0100 | [diff] [blame] | 508 | bts->bts_ctrs->ctr[BTS_CTR_CHREQ_TOTAL].current, |
| 509 | bts->bts_ctrs->ctr[BTS_CTR_CHREQ_NO_CHANNEL].current, |
| 510 | VTY_NEWLINE); |
Neels Hofmeyr | 97d110e | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 511 | vty_out(vty, " Channel Failures : %"PRIu64" rf_failures, %"PRIu64" rll failures%s", |
Harald Welte | d82101e | 2017-12-09 23:07:38 +0100 | [diff] [blame] | 512 | bts->bts_ctrs->ctr[BTS_CTR_CHAN_RF_FAIL].current, |
| 513 | bts->bts_ctrs->ctr[BTS_CTR_CHAN_RLL_ERR].current, |
| 514 | VTY_NEWLINE); |
Neels Hofmeyr | 97d110e | 2018-01-19 00:59:33 +0100 | [diff] [blame] | 515 | vty_out(vty, " BTS failures : %"PRIu64" OML, %"PRIu64" RSL%s", |
Harald Welte | d82101e | 2017-12-09 23:07:38 +0100 | [diff] [blame] | 516 | bts->bts_ctrs->ctr[BTS_CTR_BTS_OML_FAIL].current, |
| 517 | bts->bts_ctrs->ctr[BTS_CTR_BTS_RSL_FAIL].current, |
| 518 | VTY_NEWLINE); |
Philipp Maier | f27dbc5 | 2018-02-21 13:25:57 +0100 | [diff] [blame] | 519 | |
Harald Welte | aae00e4 | 2019-05-24 09:36:30 +0200 | [diff] [blame] | 520 | vty_out_stat_item_group(vty, " ", bts->bts_statg); |
| 521 | |
Philipp Maier | f27dbc5 | 2018-02-21 13:25:57 +0100 | [diff] [blame] | 522 | bts_dump_vty_features(vty, bts); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 523 | } |
| 524 | |
Sylvain Munaut | 39c31de | 2012-12-28 12:15:11 +0100 | [diff] [blame] | 525 | DEFUN(show_bts, show_bts_cmd, "show bts [<0-255>]", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 526 | SHOW_STR "Display information about a BTS\n" |
| 527 | "BTS number") |
| 528 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 529 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 530 | int bts_nr; |
| 531 | |
| 532 | if (argc != 0) { |
| 533 | /* use the BTS number that the user has specified */ |
| 534 | bts_nr = atoi(argv[0]); |
Harald Welte | 712ddbc | 2010-12-24 12:24:03 +0100 | [diff] [blame] | 535 | if (bts_nr >= net->num_bts) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 536 | vty_out(vty, "%% can't find BTS '%s'%s", argv[0], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 537 | VTY_NEWLINE); |
| 538 | return CMD_WARNING; |
| 539 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 540 | bts_dump_vty(vty, gsm_bts_num(net, bts_nr)); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 541 | return CMD_SUCCESS; |
| 542 | } |
| 543 | /* print all BTS's */ |
| 544 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 545 | bts_dump_vty(vty, gsm_bts_num(net, bts_nr)); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 546 | |
| 547 | return CMD_SUCCESS; |
| 548 | } |
| 549 | |
Oliver Smith | 8d8d710 | 2018-10-23 15:35:43 +0200 | [diff] [blame] | 550 | DEFUN(show_rejected_bts, show_rejected_bts_cmd, "show rejected-bts", |
| 551 | SHOW_STR "Display recently rejected BTS devices\n") |
| 552 | { |
| 553 | struct gsm_bts_rejected *pos; |
| 554 | |
| 555 | /* empty list */ |
| 556 | struct llist_head *rejected = &gsmnet_from_vty(vty)->bts_rejected; |
| 557 | if (llist_empty(rejected)) { |
| 558 | vty_out(vty, "No BTS has been rejected.%s", VTY_NEWLINE); |
| 559 | return CMD_SUCCESS; |
| 560 | } |
| 561 | |
| 562 | /* table head */ |
| 563 | vty_out(vty, "Date Site ID BTS ID IP%s", VTY_NEWLINE); |
| 564 | vty_out(vty, "------------------- ------- ------ ---------------%s", VTY_NEWLINE); |
| 565 | |
| 566 | /* table body */ |
| 567 | llist_for_each_entry(pos, rejected, list) { |
| 568 | /* timestamp formatted like: "2018-10-24 15:04:52" */ |
| 569 | char buf[20]; |
| 570 | strftime(buf, sizeof(buf), "%F %T", localtime(&pos->time)); |
| 571 | |
| 572 | vty_out(vty, "%s %7u %6u %15s%s", buf, pos->site_id, pos->bts_id, pos->ip, VTY_NEWLINE); |
| 573 | } |
| 574 | return CMD_SUCCESS; |
| 575 | } |
| 576 | |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 577 | /* utility functions */ |
| 578 | static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line, |
| 579 | const char *ts, const char *ss) |
| 580 | { |
| 581 | e1_link->e1_nr = atoi(line); |
| 582 | e1_link->e1_ts = atoi(ts); |
| 583 | if (!strcmp(ss, "full")) |
| 584 | e1_link->e1_ts_ss = 255; |
| 585 | else |
| 586 | e1_link->e1_ts_ss = atoi(ss); |
| 587 | } |
| 588 | |
| 589 | static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link, |
| 590 | const char *prefix) |
| 591 | { |
| 592 | if (!e1_link->e1_ts) |
| 593 | return; |
| 594 | |
| 595 | if (e1_link->e1_ts_ss == 255) |
| 596 | vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s", |
| 597 | prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE); |
| 598 | else |
| 599 | vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s", |
| 600 | prefix, e1_link->e1_nr, e1_link->e1_ts, |
| 601 | e1_link->e1_ts_ss, VTY_NEWLINE); |
| 602 | } |
| 603 | |
| 604 | |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 605 | static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts) |
| 606 | { |
Neels Hofmeyr | 9c4f1d6 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 607 | vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE); |
Harald Welte | a2bbc5e | 2015-11-20 10:43:31 +0100 | [diff] [blame] | 608 | if (ts->tsc != -1) |
Neels Hofmeyr | 9c4f1d6 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 609 | vty_out(vty, " training_sequence_code %u%s", ts->tsc, VTY_NEWLINE); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 610 | if (ts->pchan_from_config != GSM_PCHAN_NONE) |
Neels Hofmeyr | 9c4f1d6 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 611 | vty_out(vty, " phys_chan_config %s%s", |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 612 | gsm_pchan_name(ts->pchan_from_config), VTY_NEWLINE); |
Neels Hofmeyr | 9c4f1d6 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 613 | vty_out(vty, " hopping enabled %u%s", |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 614 | ts->hopping.enabled, VTY_NEWLINE); |
| 615 | if (ts->hopping.enabled) { |
| 616 | unsigned int i; |
Neels Hofmeyr | 9c4f1d6 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 617 | vty_out(vty, " hopping sequence-number %u%s", |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 618 | ts->hopping.hsn, VTY_NEWLINE); |
Neels Hofmeyr | 9c4f1d6 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 619 | vty_out(vty, " hopping maio %u%s", |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 620 | ts->hopping.maio, VTY_NEWLINE); |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 621 | for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) { |
| 622 | if (!bitvec_get_bit_pos(&ts->hopping.arfcns, i)) |
| 623 | continue; |
Neels Hofmeyr | 9c4f1d6 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 624 | vty_out(vty, " hopping arfcn add %u%s", |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 625 | i, VTY_NEWLINE); |
| 626 | } |
Harald Welte | 127af34 | 2010-12-24 12:07:07 +0100 | [diff] [blame] | 627 | } |
Neels Hofmeyr | 9c4f1d6 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 628 | config_write_e1_link(vty, &ts->e1_link, " "); |
Harald Welte | face7ed | 2011-02-14 16:15:21 +0100 | [diff] [blame] | 629 | |
| 630 | if (ts->trx->bts->model->config_write_ts) |
| 631 | ts->trx->bts->model->config_write_ts(vty, ts); |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 632 | } |
| 633 | |
| 634 | static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx) |
| 635 | { |
| 636 | int i; |
| 637 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 638 | vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE); |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 639 | if (trx->description) |
| 640 | vty_out(vty, " description %s%s", trx->description, |
| 641 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 2ba40af | 2010-04-17 06:42:07 +0200 | [diff] [blame] | 642 | vty_out(vty, " rf_locked %u%s", |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 643 | trx->mo.nm_state.administrative == NM_STATE_LOCKED ? 1 : 0, |
Holger Hans Peter Freyther | 2ba40af | 2010-04-17 06:42:07 +0200 | [diff] [blame] | 644 | VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 645 | vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE); |
Harald Welte (local) | 7b37d97 | 2009-12-27 20:56:38 +0100 | [diff] [blame] | 646 | vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 647 | vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 648 | config_write_e1_link(vty, &trx->rsl_e1_link, " rsl "); |
| 649 | vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE); |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 650 | |
Harald Welte | face7ed | 2011-02-14 16:15:21 +0100 | [diff] [blame] | 651 | if (trx->bts->model->config_write_trx) |
| 652 | trx->bts->model->config_write_trx(vty, trx); |
| 653 | |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 654 | for (i = 0; i < TRX_NR_TS; i++) |
| 655 | config_write_ts_single(vty, &trx->ts[i]); |
| 656 | } |
| 657 | |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 658 | static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts) |
| 659 | { |
| 660 | unsigned int i; |
| 661 | vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode), |
| 662 | VTY_NEWLINE); |
| 663 | if (bts->gprs.mode == BTS_GPRS_NONE) |
| 664 | return; |
| 665 | |
bhargava | 350533c | 2016-07-21 11:14:34 +0530 | [diff] [blame] | 666 | vty_out(vty, " gprs 11bit_rach_support_for_egprs %u%s", |
| 667 | bts->gprs.supports_egprs_11bit_rach, VTY_NEWLINE); |
| 668 | |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 669 | vty_out(vty, " gprs routing area %u%s", bts->gprs.rac, |
| 670 | VTY_NEWLINE); |
Andreas Eversberg | 0c8f9ca | 2013-03-16 16:31:26 +0100 | [diff] [blame] | 671 | vty_out(vty, " gprs network-control-order nc%u%s", |
| 672 | bts->gprs.net_ctrl_ord, VTY_NEWLINE); |
Max | 292ec58 | 2016-07-28 11:55:37 +0200 | [diff] [blame] | 673 | if (!bts->gprs.ctrl_ack_type_use_block) |
| 674 | vty_out(vty, " gprs control-ack-type-rach%s", VTY_NEWLINE); |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 675 | vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci, |
| 676 | VTY_NEWLINE); |
| 677 | for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++) |
| 678 | vty_out(vty, " gprs cell timer %s %u%s", |
| 679 | get_value_string(gprs_bssgp_cfg_strs, i), |
| 680 | bts->gprs.cell.timer[i], VTY_NEWLINE); |
| 681 | vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei, |
| 682 | VTY_NEWLINE); |
| 683 | for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++) |
| 684 | vty_out(vty, " gprs ns timer %s %u%s", |
| 685 | get_value_string(gprs_ns_timer_strs, i), |
| 686 | bts->gprs.nse.timer[i], VTY_NEWLINE); |
| 687 | for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) { |
| 688 | struct gsm_bts_gprs_nsvc *nsvc = |
| 689 | &bts->gprs.nsvc[i]; |
| 690 | struct in_addr ia; |
| 691 | |
| 692 | ia.s_addr = htonl(nsvc->remote_ip); |
| 693 | vty_out(vty, " gprs nsvc %u nsvci %u%s", i, |
| 694 | nsvc->nsvci, VTY_NEWLINE); |
| 695 | vty_out(vty, " gprs nsvc %u local udp port %u%s", i, |
| 696 | nsvc->local_port, VTY_NEWLINE); |
| 697 | vty_out(vty, " gprs nsvc %u remote udp port %u%s", i, |
| 698 | nsvc->remote_port, VTY_NEWLINE); |
| 699 | vty_out(vty, " gprs nsvc %u remote ip %s%s", i, |
| 700 | inet_ntoa(ia), VTY_NEWLINE); |
| 701 | } |
| 702 | } |
| 703 | |
Holger Hans Peter Freyther | cd40fb4 | 2013-09-15 17:23:34 +0200 | [diff] [blame] | 704 | /* Write the model data if there is one */ |
| 705 | static void config_write_bts_model(struct vty *vty, struct gsm_bts *bts) |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 706 | { |
| 707 | struct gsm_bts_trx *trx; |
Holger Hans Peter Freyther | cd40fb4 | 2013-09-15 17:23:34 +0200 | [diff] [blame] | 708 | |
| 709 | if (!bts->model) |
| 710 | return; |
| 711 | |
| 712 | if (bts->model->config_write_bts) |
| 713 | bts->model->config_write_bts(vty, bts); |
| 714 | |
| 715 | llist_for_each_entry(trx, &bts->trx_list, list) |
| 716 | config_write_trx_single(vty, trx); |
| 717 | } |
| 718 | |
Holger Hans Peter Freyther | a174a47 | 2015-09-24 11:39:38 +0200 | [diff] [blame] | 719 | static void write_amr_modes(struct vty *vty, const char *prefix, |
| 720 | const char *name, struct amr_mode *modes, int num) |
| 721 | { |
| 722 | int i; |
| 723 | |
| 724 | vty_out(vty, " %s threshold %s", prefix, name); |
| 725 | for (i = 0; i < num - 1; i++) |
| 726 | vty_out(vty, " %d", modes[i].threshold); |
| 727 | vty_out(vty, "%s", VTY_NEWLINE); |
| 728 | vty_out(vty, " %s hysteresis %s", prefix, name); |
| 729 | for (i = 0; i < num - 1; i++) |
| 730 | vty_out(vty, " %d", modes[i].hysteresis); |
| 731 | vty_out(vty, "%s", VTY_NEWLINE); |
| 732 | } |
| 733 | |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 734 | static void config_write_bts_amr(struct vty *vty, struct gsm_bts *bts, |
| 735 | struct amr_multirate_conf *mr, int full) |
| 736 | { |
| 737 | struct gsm48_multi_rate_conf *mr_conf; |
| 738 | const char *prefix = (full) ? "amr tch-f" : "amr tch-h"; |
| 739 | int i, num; |
| 740 | |
| 741 | if (!(mr->gsm48_ie[1])) |
| 742 | return; |
| 743 | |
| 744 | mr_conf = (struct gsm48_multi_rate_conf *) mr->gsm48_ie; |
| 745 | |
| 746 | num = 0; |
| 747 | vty_out(vty, " %s modes", prefix); |
| 748 | for (i = 0; i < ((full) ? 8 : 6); i++) { |
| 749 | if ((mr->gsm48_ie[1] & (1 << i))) { |
| 750 | vty_out(vty, " %d", i); |
| 751 | num++; |
| 752 | } |
| 753 | } |
| 754 | vty_out(vty, "%s", VTY_NEWLINE); |
| 755 | if (num > 4) |
| 756 | num = 4; |
| 757 | if (num > 1) { |
Holger Hans Peter Freyther | a174a47 | 2015-09-24 11:39:38 +0200 | [diff] [blame] | 758 | write_amr_modes(vty, prefix, "ms", mr->ms_mode, num); |
| 759 | write_amr_modes(vty, prefix, "bts", mr->bts_mode, num); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 760 | } |
| 761 | vty_out(vty, " %s start-mode ", prefix); |
| 762 | if (mr_conf->icmi) { |
| 763 | num = 0; |
| 764 | for (i = 0; i < ((full) ? 8 : 6) && num < 4; i++) { |
| 765 | if ((mr->gsm48_ie[1] & (1 << i))) |
| 766 | num++; |
| 767 | if (mr_conf->smod == num - 1) { |
| 768 | vty_out(vty, "%d%s", num, VTY_NEWLINE); |
| 769 | break; |
| 770 | } |
| 771 | } |
| 772 | } else |
| 773 | vty_out(vty, "auto%s", VTY_NEWLINE); |
| 774 | } |
| 775 | |
Holger Hans Peter Freyther | cd40fb4 | 2013-09-15 17:23:34 +0200 | [diff] [blame] | 776 | static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) |
| 777 | { |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 778 | int i; |
Max | 2c16bee | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 779 | uint8_t tmp; |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 780 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 781 | vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE); |
| 782 | vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE); |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 783 | if (bts->description) |
| 784 | vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 785 | vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE); |
Holger Hans Peter Freyther | f926ed6 | 2009-11-19 16:38:49 +0100 | [diff] [blame] | 786 | vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 787 | vty_out(vty, " location_area_code %u%s", bts->location_area_code, |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 788 | VTY_NEWLINE); |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 789 | if (bts->dtxu != GSM48_DTX_SHALL_NOT_BE_USED) |
| 790 | vty_out(vty, " dtx uplink%s%s", |
| 791 | (bts->dtxu != GSM48_DTX_SHALL_BE_USED) ? "" : " force", |
| 792 | VTY_NEWLINE); |
| 793 | if (bts->dtxd) |
| 794 | vty_out(vty, " dtx downlink%s", VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 795 | vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE); |
Harald Welte (local) | 0e451d0 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 796 | vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE); |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 797 | vty_out(vty, " cell reselection hysteresis %u%s", |
| 798 | bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE); |
| 799 | vty_out(vty, " rxlev access min %u%s", |
| 800 | bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE); |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 801 | |
| 802 | if (bts->si_common.cell_ro_sel_par.present) { |
| 803 | struct gsm48_si_selection_params *sp; |
| 804 | sp = &bts->si_common.cell_ro_sel_par; |
| 805 | |
| 806 | if (sp->cbq) |
| 807 | vty_out(vty, " cell bar qualify %u%s", |
| 808 | sp->cbq, VTY_NEWLINE); |
| 809 | |
| 810 | if (sp->cell_resel_off) |
| 811 | vty_out(vty, " cell reselection offset %u%s", |
| 812 | sp->cell_resel_off*2, VTY_NEWLINE); |
| 813 | |
| 814 | if (sp->temp_offs == 7) |
| 815 | vty_out(vty, " temporary offset infinite%s", |
| 816 | VTY_NEWLINE); |
| 817 | else if (sp->temp_offs) |
| 818 | vty_out(vty, " temporary offset %u%s", |
| 819 | sp->temp_offs*10, VTY_NEWLINE); |
| 820 | |
| 821 | if (sp->penalty_time == 31) |
| 822 | vty_out(vty, " penalty time reserved%s", |
| 823 | VTY_NEWLINE); |
| 824 | else if (sp->penalty_time) |
| 825 | vty_out(vty, " penalty time %u%s", |
| 826 | (sp->penalty_time*20)+20, VTY_NEWLINE); |
| 827 | } |
| 828 | |
Harald Welte | 2f8b9d2 | 2017-06-18 11:12:13 +0300 | [diff] [blame] | 829 | if (gsm_bts_get_radio_link_timeout(bts) < 0) |
| 830 | vty_out(vty, " radio-link-timeout infinite%s", VTY_NEWLINE); |
| 831 | else |
| 832 | vty_out(vty, " radio-link-timeout %d%s", |
| 833 | gsm_bts_get_radio_link_timeout(bts), VTY_NEWLINE); |
Pau Espin Pedrol | c5a8416 | 2017-11-28 15:04:26 +0100 | [diff] [blame] | 834 | |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 835 | vty_out(vty, " channel allocator %s%s", |
| 836 | bts->chan_alloc_reverse ? "descending" : "ascending", |
| 837 | VTY_NEWLINE); |
Sylvain Munaut | 4010f1e | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 838 | vty_out(vty, " rach tx integer %u%s", |
| 839 | bts->si_common.rach_control.tx_integer, VTY_NEWLINE); |
| 840 | vty_out(vty, " rach max transmission %u%s", |
| 841 | rach_max_trans_raw2val(bts->si_common.rach_control.max_trans), |
| 842 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 95c2290 | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 843 | |
Andreas Eversberg | 2ee7ecd | 2012-10-13 07:27:47 +0200 | [diff] [blame] | 844 | vty_out(vty, " channel-descrption attach %u%s", |
| 845 | bts->si_common.chan_desc.att, VTY_NEWLINE); |
| 846 | vty_out(vty, " channel-descrption bs-pa-mfrms %u%s", |
| 847 | bts->si_common.chan_desc.bs_pa_mfrms + 2, VTY_NEWLINE); |
| 848 | vty_out(vty, " channel-descrption bs-ag-blks-res %u%s", |
| 849 | bts->si_common.chan_desc.bs_ag_blks_res, VTY_NEWLINE); |
| 850 | |
Harald Welte | 1540025 | 2019-05-24 11:56:23 +0200 | [diff] [blame] | 851 | if (bts->ccch_load_ind_thresh != 10) |
| 852 | vty_out(vty, " ccch load-indication-threshold %u%s", |
| 853 | bts->ccch_load_ind_thresh, VTY_NEWLINE); |
Holger Hans Peter Freyther | 95c2290 | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 854 | if (bts->rach_b_thresh != -1) |
| 855 | vty_out(vty, " rach nm busy threshold %u%s", |
| 856 | bts->rach_b_thresh, VTY_NEWLINE); |
| 857 | if (bts->rach_ldavg_slots != -1) |
| 858 | vty_out(vty, " rach nm load average %u%s", |
| 859 | bts->rach_ldavg_slots, VTY_NEWLINE); |
Harald Welte | 7135501 | 2009-12-21 23:08:18 +0100 | [diff] [blame] | 860 | if (bts->si_common.rach_control.cell_bar) |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 861 | vty_out(vty, " cell barred 1%s", VTY_NEWLINE); |
Holger Hans Peter Freyther | 3a0a463 | 2010-05-14 00:39:19 +0800 | [diff] [blame] | 862 | if ((bts->si_common.rach_control.t2 & 0x4) == 0) |
| 863 | vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE); |
Ivan Kluchnikov | 6792059 | 2013-09-16 13:13:04 +0400 | [diff] [blame] | 864 | if ((bts->si_common.rach_control.t3) != 0) |
| 865 | for (i = 0; i < 8; i++) |
| 866 | if (bts->si_common.rach_control.t3 & (0x1 << i)) |
| 867 | vty_out(vty, " rach access-control-class %d barred%s", i, VTY_NEWLINE); |
| 868 | if ((bts->si_common.rach_control.t2 & 0xfb) != 0) |
| 869 | for (i = 0; i < 8; i++) |
| 870 | if ((i != 2) && (bts->si_common.rach_control.t2 & (0x1 << i))) |
| 871 | vty_out(vty, " rach access-control-class %d barred%s", i+8, VTY_NEWLINE); |
Stefan Sperling | 6442e43 | 2018-02-06 14:44:54 +0100 | [diff] [blame] | 872 | vty_out(vty, " %saccess-control-class-ramping%s", acc_ramp_is_enabled(&bts->acc_ramp) ? "" : "no ", VTY_NEWLINE); |
| 873 | if (!acc_ramp_step_interval_is_dynamic(&bts->acc_ramp)) { |
| 874 | vty_out(vty, " access-control-class-ramping-step-interval %u%s", |
| 875 | acc_ramp_get_step_interval(&bts->acc_ramp), VTY_NEWLINE); |
| 876 | } else { |
| 877 | vty_out(vty, " access-control-class-ramping-step-interval dynamic%s", VTY_NEWLINE); |
| 878 | } |
| 879 | vty_out(vty, " access-control-class-ramping-step-size %u%s", acc_ramp_get_step_size(&bts->acc_ramp), |
| 880 | VTY_NEWLINE); |
Pau Espin Pedrol | 1cf21de | 2018-12-05 13:38:10 +0100 | [diff] [blame] | 881 | if (!bts->si_unused_send_empty) |
| 882 | vty_out(vty, " no system-information unused-send-empty%s", VTY_NEWLINE); |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 883 | for (i = SYSINFO_TYPE_1; i < _MAX_SYSINFO_TYPE; i++) { |
| 884 | if (bts->si_mode_static & (1 << i)) { |
| 885 | vty_out(vty, " system-information %s mode static%s", |
| 886 | get_value_string(osmo_sitype_strs, i), VTY_NEWLINE); |
| 887 | vty_out(vty, " system-information %s static %s%s", |
| 888 | get_value_string(osmo_sitype_strs, i), |
Max | 6f0e50c | 2017-04-12 15:30:54 +0200 | [diff] [blame] | 889 | osmo_hexdump_nospc(GSM_BTS_SI(bts, i), GSM_MACBLOCK_LEN), |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 890 | VTY_NEWLINE); |
| 891 | } |
| 892 | } |
Harald Welte | 42def72 | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 893 | vty_out(vty, " early-classmark-sending %s%s", |
| 894 | bts->early_classmark_allowed ? "allowed" : "forbidden", VTY_NEWLINE); |
Pau Espin Pedrol | e8dda5f | 2017-11-23 19:06:09 +0100 | [diff] [blame] | 895 | vty_out(vty, " early-classmark-sending-3g %s%s", |
| 896 | bts->early_classmark_allowed_3g ? "allowed" : "forbidden", VTY_NEWLINE); |
Harald Welte | fd355a3 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 897 | switch (bts->type) { |
| 898 | case GSM_BTS_TYPE_NANOBTS: |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 899 | case GSM_BTS_TYPE_OSMOBTS: |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 900 | vty_out(vty, " ip.access unit_id %u %u%s", |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 901 | bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE); |
Harald Welte | 8b29180 | 2013-03-12 13:57:05 +0100 | [diff] [blame] | 902 | if (bts->ip_access.rsl_ip) { |
| 903 | struct in_addr ia; |
| 904 | ia.s_addr = htonl(bts->ip_access.rsl_ip); |
| 905 | vty_out(vty, " ip.access rsl-ip %s%s", inet_ntoa(ia), |
| 906 | VTY_NEWLINE); |
| 907 | } |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 908 | vty_out(vty, " oml ip.access stream_id %u line %u%s", |
| 909 | bts->oml_tei, bts->oml_e1_link.e1_nr, VTY_NEWLINE); |
Harald Welte | fd355a3 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 910 | break; |
Sylvain Munaut | c951946 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 911 | case GSM_BTS_TYPE_NOKIA_SITE: |
| 912 | vty_out(vty, " nokia_site skip-reset %d%s", bts->nokia.skip_reset, VTY_NEWLINE); |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 913 | vty_out(vty, " nokia_site no-local-rel-conf %d%s", |
| 914 | bts->nokia.no_loc_rel_cnf, VTY_NEWLINE); |
Sipos Csaba | 56e1766 | 2015-02-07 13:27:36 +0100 | [diff] [blame] | 915 | vty_out(vty, " nokia_site bts-reset-timer %d%s", bts->nokia.bts_reset_timer_cnf, VTY_NEWLINE); |
Andreas Eversberg | b6f9516 | 2013-12-05 16:02:37 +0100 | [diff] [blame] | 916 | /* fall through: Nokia requires "oml e1" parameters also */ |
Harald Welte | fd355a3 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 917 | default: |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 918 | config_write_e1_link(vty, &bts->oml_e1_link, " oml "); |
| 919 | vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE); |
Harald Welte | fd355a3 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 920 | break; |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 921 | } |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 922 | |
| 923 | /* if we have a limit, write it */ |
| 924 | if (bts->paging.free_chans_need >= 0) |
| 925 | vty_out(vty, " paging free %d%s", bts->paging.free_chans_need, VTY_NEWLINE); |
| 926 | |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 927 | vty_out(vty, " neighbor-list mode %s%s", |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 928 | get_value_string(bts_neigh_mode_strs, bts->neigh_list_manual_mode), VTY_NEWLINE); |
| 929 | if (bts->neigh_list_manual_mode != NL_MODE_AUTOMATIC) { |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 930 | for (i = 0; i < 1024; i++) { |
| 931 | if (bitvec_get_bit_pos(&bts->si_common.neigh_list, i)) |
| 932 | vty_out(vty, " neighbor-list add arfcn %u%s", |
| 933 | i, VTY_NEWLINE); |
| 934 | } |
| 935 | } |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 936 | if (bts->neigh_list_manual_mode == NL_MODE_MANUAL_SI5SEP) { |
| 937 | for (i = 0; i < 1024; i++) { |
| 938 | if (bitvec_get_bit_pos(&bts->si_common.si5_neigh_list, i)) |
| 939 | vty_out(vty, " si5 neighbor-list add arfcn %u%s", |
| 940 | i, VTY_NEWLINE); |
| 941 | } |
| 942 | } |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 943 | |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 944 | for (i = 0; i < MAX_EARFCN_LIST; i++) { |
Max | 2c16bee | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 945 | struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list; |
| 946 | if (e->arfcn[i] != OSMO_EARFCN_INVALID) { |
| 947 | vty_out(vty, " si2quater neighbor-list add earfcn %u " |
| 948 | "thresh-hi %u", e->arfcn[i], e->thresh_hi); |
| 949 | |
| 950 | vty_out(vty, " thresh-lo %u", |
| 951 | e->thresh_lo_valid ? e->thresh_lo : 32); |
| 952 | |
| 953 | vty_out(vty, " prio %u", |
| 954 | e->prio_valid ? e->prio : 8); |
| 955 | |
| 956 | vty_out(vty, " qrxlv %u", |
| 957 | e->qrxlm_valid ? e->qrxlm : 32); |
| 958 | |
| 959 | tmp = e->meas_bw[i]; |
| 960 | vty_out(vty, " meas %u", |
| 961 | (tmp != OSMO_EARFCN_MEAS_INVALID) ? tmp : 8); |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 962 | |
| 963 | vty_out(vty, "%s", VTY_NEWLINE); |
| 964 | } |
| 965 | } |
| 966 | |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 967 | for (i = 0; i < bts->si_common.uarfcn_length; i++) { |
| 968 | vty_out(vty, " si2quater neighbor-list add uarfcn %u %u %u%s", |
| 969 | bts->si_common.data.uarfcn_list[i], |
| 970 | bts->si_common.data.scramble_list[i] & ~(1 << 9), |
| 971 | (bts->si_common.data.scramble_list[i] >> 9) & 1, |
| 972 | VTY_NEWLINE); |
| 973 | } |
| 974 | |
Neels Hofmeyr | 19bed23 | 2018-03-22 04:54:57 +0100 | [diff] [blame] | 975 | neighbor_ident_vty_write(vty, " ", bts); |
| 976 | |
Andreas Eversberg | a83d511 | 2013-12-07 18:32:28 +0100 | [diff] [blame] | 977 | vty_out(vty, " codec-support fr"); |
| 978 | if (bts->codec.hr) |
| 979 | vty_out(vty, " hr"); |
| 980 | if (bts->codec.efr) |
| 981 | vty_out(vty, " efr"); |
| 982 | if (bts->codec.amr) |
| 983 | vty_out(vty, " amr"); |
| 984 | vty_out(vty, "%s", VTY_NEWLINE); |
| 985 | |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 986 | config_write_bts_amr(vty, bts, &bts->mr_full, 1); |
| 987 | config_write_bts_amr(vty, bts, &bts->mr_half, 0); |
| 988 | |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 989 | config_write_bts_gprs(vty, bts); |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 990 | |
Holger Hans Peter Freyther | e30d40d | 2012-07-20 10:27:31 +0200 | [diff] [blame] | 991 | if (bts->excl_from_rf_lock) |
| 992 | vty_out(vty, " rf-lock-exclude%s", VTY_NEWLINE); |
| 993 | |
Pau Espin Pedrol | 167cb82 | 2018-11-19 17:48:17 +0100 | [diff] [blame] | 994 | if (bts->force_combined_si_set) |
| 995 | vty_out(vty, " %sforce-combined-si%s", |
| 996 | bts->force_combined_si ? "" : "no ", VTY_NEWLINE); |
Jacob Erlbeck | 65d114f | 2014-01-16 11:02:14 +0100 | [diff] [blame] | 997 | |
Holger Hans Peter Freyther | c22930e | 2014-12-17 14:46:17 +0100 | [diff] [blame] | 998 | for (i = 0; i < ARRAY_SIZE(bts->depends_on); ++i) { |
| 999 | int j; |
| 1000 | |
| 1001 | if (bts->depends_on[i] == 0) |
| 1002 | continue; |
| 1003 | |
| 1004 | for (j = 0; j < sizeof(bts->depends_on[i]) * 8; ++j) { |
| 1005 | int bts_nr; |
| 1006 | |
| 1007 | if ((bts->depends_on[i] & (1<<j)) == 0) |
| 1008 | continue; |
| 1009 | |
| 1010 | bts_nr = (i * sizeof(bts->depends_on[i]) * 8) + j; |
| 1011 | vty_out(vty, " depends-on-bts %d%s", bts_nr, VTY_NEWLINE); |
| 1012 | } |
| 1013 | } |
Harald Welte | 8254cf7 | 2017-05-29 13:42:19 +0200 | [diff] [blame] | 1014 | if (bts->pcu_sock_path) |
| 1015 | vty_out(vty, " pcu-socket %s%s", bts->pcu_sock_path, VTY_NEWLINE); |
Holger Hans Peter Freyther | c22930e | 2014-12-17 14:46:17 +0100 | [diff] [blame] | 1016 | |
Neels Hofmeyr | dfd36da | 2018-02-12 16:48:45 +0100 | [diff] [blame] | 1017 | ho_vty_write_bts(vty, bts); |
Neels Hofmeyr | e25018b | 2017-11-27 21:29:33 +0100 | [diff] [blame] | 1018 | |
Holger Hans Peter Freyther | cd40fb4 | 2013-09-15 17:23:34 +0200 | [diff] [blame] | 1019 | config_write_bts_model(vty, bts); |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 1020 | } |
| 1021 | |
| 1022 | static int config_write_bts(struct vty *v) |
| 1023 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1024 | struct gsm_network *gsmnet = gsmnet_from_vty(v); |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 1025 | struct gsm_bts *bts; |
| 1026 | |
| 1027 | llist_for_each_entry(bts, &gsmnet->bts_list, list) |
| 1028 | config_write_bts_single(v, bts); |
| 1029 | |
| 1030 | return CMD_SUCCESS; |
| 1031 | } |
| 1032 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1033 | static int config_write_net(struct vty *vty) |
| 1034 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1035 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | 51e4bf3 | 2017-12-23 17:30:18 +0100 | [diff] [blame] | 1036 | int i; |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1037 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1038 | vty_out(vty, "network%s", VTY_NEWLINE); |
Neels Hofmeyr | f93970b | 2018-03-05 02:09:40 +0100 | [diff] [blame] | 1039 | vty_out(vty, " network country code %s%s", osmo_mcc_name(gsmnet->plmn.mcc), VTY_NEWLINE); |
| 1040 | vty_out(vty, " mobile network code %s%s", |
| 1041 | osmo_mnc_name(gsmnet->plmn.mnc, gsmnet->plmn.mnc_3_digits), VTY_NEWLINE); |
Harald Welte | 51e4bf3 | 2017-12-23 17:30:18 +0100 | [diff] [blame] | 1042 | vty_out(vty, " encryption a5"); |
| 1043 | for (i = 0; i < 8; i++) { |
| 1044 | if (gsmnet->a5_encryption_mask & (1 << i)) |
| 1045 | vty_out(vty, " %u", i); |
| 1046 | } |
| 1047 | vty_out(vty, "%s", VTY_NEWLINE); |
Holger Hans Peter Freyther | d54c337 | 2009-11-19 16:37:48 +0100 | [diff] [blame] | 1048 | vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE); |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 1049 | vty_out(vty, " paging any use tch %d%s", gsmnet->pag_any_tch, VTY_NEWLINE); |
Neels Hofmeyr | e25018b | 2017-11-27 21:29:33 +0100 | [diff] [blame] | 1050 | |
Neels Hofmeyr | dfd36da | 2018-02-12 16:48:45 +0100 | [diff] [blame] | 1051 | ho_vty_write_net(vty, gsmnet); |
Neels Hofmeyr | e25018b | 2017-11-27 21:29:33 +0100 | [diff] [blame] | 1052 | |
Neels Hofmeyr | a6078fe | 2019-01-28 03:52:14 +0100 | [diff] [blame] | 1053 | osmo_tdef_vty_write(vty, gsmnet->T_defs, " "); |
Neels Hofmeyr | 0abe84e | 2018-05-14 18:14:29 +0200 | [diff] [blame] | 1054 | |
Neels Hofmeyr | 78faf70 | 2018-05-10 05:22:50 +0200 | [diff] [blame] | 1055 | if (!gsmnet->dyn_ts_allow_tch_f) |
| 1056 | vty_out(vty, " dyn_ts_allow_tch_f 0%s", VTY_NEWLINE); |
Neels Hofmeyr | 7398395 | 2016-05-10 13:29:33 +0200 | [diff] [blame] | 1057 | if (gsmnet->tz.override != 0) { |
| 1058 | if (gsmnet->tz.dst) |
| 1059 | vty_out(vty, " timezone %d %d %d%s", |
| 1060 | gsmnet->tz.hr, gsmnet->tz.mn, gsmnet->tz.dst, |
| 1061 | VTY_NEWLINE); |
| 1062 | else |
| 1063 | vty_out(vty, " timezone %d %d%s", |
| 1064 | gsmnet->tz.hr, gsmnet->tz.mn, VTY_NEWLINE); |
| 1065 | } |
Neels Hofmeyr | 596c402 | 2018-06-16 19:29:50 +0200 | [diff] [blame] | 1066 | |
Neels Hofmeyr | a6078fe | 2019-01-28 03:52:14 +0100 | [diff] [blame] | 1067 | osmo_tdef_vty_write(vty, gsmnet->T_defs, " timer "); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1068 | |
Neels Hofmeyr | f28f1ef | 2018-04-20 15:53:53 +0200 | [diff] [blame] | 1069 | { |
| 1070 | uint16_t meas_port; |
| 1071 | char *meas_host; |
| 1072 | const char *meas_scenario; |
| 1073 | |
| 1074 | meas_feed_cfg_get(&meas_host, &meas_port); |
| 1075 | meas_scenario = meas_feed_scenario_get(); |
| 1076 | |
| 1077 | if (meas_port) |
| 1078 | vty_out(vty, " meas-feed destination %s %u%s", |
| 1079 | meas_host, meas_port, VTY_NEWLINE); |
| 1080 | if (strlen(meas_scenario) > 0) |
| 1081 | vty_out(vty, " meas-feed scenario %s%s", |
| 1082 | meas_scenario, VTY_NEWLINE); |
| 1083 | } |
| 1084 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1085 | return CMD_SUCCESS; |
| 1086 | } |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 1087 | |
Max | 6f379ba | 2018-11-19 14:05:04 +0100 | [diff] [blame] | 1088 | static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx, bool print_rsl, bool show_connected) |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1089 | { |
Max | 6f379ba | 2018-11-19 14:05:04 +0100 | [diff] [blame] | 1090 | if (show_connected && !trx->rsl_link) |
| 1091 | return; |
| 1092 | |
| 1093 | if (!show_connected && trx->rsl_link) |
| 1094 | return; |
| 1095 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1096 | vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s", |
| 1097 | trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE); |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 1098 | vty_out(vty, "Description: %s%s", |
| 1099 | trx->description ? trx->description : "(null)", VTY_NEWLINE); |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 1100 | vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, " |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1101 | "resulting BS power: %d dBm%s", |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 1102 | trx->nominal_power, trx->max_power_red, |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1103 | trx->nominal_power - trx->max_power_red, VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1104 | vty_out(vty, " NM State: "); |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 1105 | net_dump_nmstate(vty, &trx->mo.nm_state); |
Max | 6f379ba | 2018-11-19 14:05:04 +0100 | [diff] [blame] | 1106 | if (print_rsl) |
| 1107 | vty_out(vty, " RSL State: %s%s", trx->rsl_link? "connected" : "disconnected", VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1108 | vty_out(vty, " Baseband Transceiver NM State: "); |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 1109 | net_dump_nmstate(vty, &trx->bb_transc.mo.nm_state); |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1110 | if (is_ipaccess_bts(trx->bts)) { |
Oliver Smith | f105190 | 2018-10-09 15:24:06 +0200 | [diff] [blame] | 1111 | vty_out(vty, " ip.access stream ID: 0x%02x ", trx->rsl_tei); |
| 1112 | e1isl_dump_vty_tcp(vty, trx->rsl_link); |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1113 | } else { |
| 1114 | vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE); |
| 1115 | e1isl_dump_vty(vty, trx->rsl_link); |
| 1116 | } |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1117 | } |
| 1118 | |
Max | 6f379ba | 2018-11-19 14:05:04 +0100 | [diff] [blame] | 1119 | static void trx_dump_vty_all(struct vty *vty, struct gsm_bts_trx *trx) |
| 1120 | { |
| 1121 | trx_dump_vty(vty, trx, true, true); |
| 1122 | trx_dump_vty(vty, trx, true, false); |
| 1123 | } |
| 1124 | |
Max | 6e4f184 | 2018-01-07 16:45:42 +0100 | [diff] [blame] | 1125 | static inline void print_all_trx(struct vty *vty, const struct gsm_bts *bts) |
| 1126 | { |
| 1127 | uint8_t trx_nr; |
| 1128 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) |
Max | 6f379ba | 2018-11-19 14:05:04 +0100 | [diff] [blame] | 1129 | trx_dump_vty_all(vty, gsm_bts_trx_num(bts, trx_nr)); |
Max | 6e4f184 | 2018-01-07 16:45:42 +0100 | [diff] [blame] | 1130 | } |
| 1131 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1132 | DEFUN(show_trx, |
| 1133 | show_trx_cmd, |
Sylvain Munaut | 39c31de | 2012-12-28 12:15:11 +0100 | [diff] [blame] | 1134 | "show trx [<0-255>] [<0-255>]", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1135 | SHOW_STR "Display information about a TRX\n" |
Neels Hofmeyr | 70c5fd2 | 2018-01-19 15:55:14 +0100 | [diff] [blame] | 1136 | BTS_TRX_STR) |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1137 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1138 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1139 | struct gsm_bts *bts = NULL; |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1140 | int bts_nr, trx_nr; |
| 1141 | |
| 1142 | if (argc >= 1) { |
| 1143 | /* use the BTS number that the user has specified */ |
| 1144 | bts_nr = atoi(argv[0]); |
| 1145 | if (bts_nr >= net->num_bts) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 1146 | vty_out(vty, "%% can't find BTS '%s'%s", argv[0], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1147 | VTY_NEWLINE); |
| 1148 | return CMD_WARNING; |
| 1149 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1150 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1151 | } |
| 1152 | if (argc >= 2) { |
| 1153 | trx_nr = atoi(argv[1]); |
| 1154 | if (trx_nr >= bts->num_trx) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 1155 | vty_out(vty, "%% can't find TRX '%s'%s", argv[1], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1156 | VTY_NEWLINE); |
| 1157 | return CMD_WARNING; |
| 1158 | } |
Max | 6f379ba | 2018-11-19 14:05:04 +0100 | [diff] [blame] | 1159 | trx_dump_vty_all(vty, gsm_bts_trx_num(bts, trx_nr)); |
| 1160 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1161 | return CMD_SUCCESS; |
| 1162 | } |
| 1163 | if (bts) { |
| 1164 | /* print all TRX in this BTS */ |
Max | 6e4f184 | 2018-01-07 16:45:42 +0100 | [diff] [blame] | 1165 | print_all_trx(vty, bts); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1166 | return CMD_SUCCESS; |
| 1167 | } |
| 1168 | |
Max | 6e4f184 | 2018-01-07 16:45:42 +0100 | [diff] [blame] | 1169 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) |
| 1170 | print_all_trx(vty, gsm_bts_num(net, bts_nr)); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1171 | |
| 1172 | return CMD_SUCCESS; |
| 1173 | } |
| 1174 | |
Stefan Sperling | c459699 | 2018-11-13 13:59:51 +0100 | [diff] [blame] | 1175 | /* call vty_out() to print a string like " as TCH/H" for dynamic timeslots. |
| 1176 | * Don't do anything if the ts is not dynamic. */ |
| 1177 | static void vty_out_dyn_ts_status(struct vty *vty, struct gsm_bts_trx_ts *ts) |
| 1178 | { |
| 1179 | enum gsm_phys_chan_config target; |
| 1180 | if (ts_is_pchan_switching(ts, &target)) { |
| 1181 | vty_out(vty, " switching %s -> %s", gsm_pchan_name(ts->pchan_is), |
| 1182 | gsm_pchan_name(target)); |
| 1183 | } else if (ts->pchan_is != ts->pchan_on_init) { |
| 1184 | vty_out(vty, " as %s", gsm_pchan_name(ts->pchan_is)); |
| 1185 | } |
| 1186 | } |
| 1187 | |
| 1188 | static void vty_out_dyn_ts_details(struct vty *vty, struct gsm_bts_trx_ts *ts) |
| 1189 | { |
| 1190 | /* show dyn TS details, if applicable */ |
| 1191 | switch (ts->pchan_on_init) { |
| 1192 | case GSM_PCHAN_TCH_F_TCH_H_PDCH: |
| 1193 | vty_out(vty, " Osmocom Dyn TS:"); |
| 1194 | vty_out_dyn_ts_status(vty, ts); |
| 1195 | vty_out(vty, VTY_NEWLINE); |
| 1196 | break; |
| 1197 | case GSM_PCHAN_TCH_F_PDCH: |
| 1198 | vty_out(vty, " IPACC Dyn PDCH TS:"); |
| 1199 | vty_out_dyn_ts_status(vty, ts); |
| 1200 | vty_out(vty, VTY_NEWLINE); |
| 1201 | break; |
| 1202 | default: |
| 1203 | /* no dyn ts */ |
| 1204 | break; |
| 1205 | } |
| 1206 | } |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 1207 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1208 | static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts) |
| 1209 | { |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1210 | vty_out(vty, "BTS %u, TRX %u, Timeslot %u, phys cfg %s", |
Harald Welte | 026b4ca | 2010-12-24 12:12:10 +0100 | [diff] [blame] | 1211 | ts->trx->bts->nr, ts->trx->nr, ts->nr, |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1212 | gsm_pchan_name(ts->pchan_on_init)); |
| 1213 | if (ts->pchan_is != ts->pchan_on_init) |
| 1214 | vty_out(vty, " (%s mode)", gsm_pchan_name(ts->pchan_is)); |
| 1215 | vty_out(vty, ", TSC %u%s NM State: ", gsm_ts_tsc(ts), VTY_NEWLINE); |
Stefan Sperling | c459699 | 2018-11-13 13:59:51 +0100 | [diff] [blame] | 1216 | vty_out_dyn_ts_details(vty, ts); |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 1217 | net_dump_nmstate(vty, &ts->mo.nm_state); |
Harald Welte | 2c82899 | 2009-12-02 01:56:49 +0530 | [diff] [blame] | 1218 | if (!is_ipaccess_bts(ts->trx->bts)) |
Harald Welte | ef235b5 | 2009-03-10 12:34:02 +0000 | [diff] [blame] | 1219 | vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s", |
| 1220 | ts->e1_link.e1_nr, ts->e1_link.e1_ts, |
| 1221 | ts->e1_link.e1_ts_ss, VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1222 | } |
| 1223 | |
| 1224 | DEFUN(show_ts, |
| 1225 | show_ts_cmd, |
Sylvain Munaut | 39c31de | 2012-12-28 12:15:11 +0100 | [diff] [blame] | 1226 | "show timeslot [<0-255>] [<0-255>] [<0-7>]", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1227 | SHOW_STR "Display information about a TS\n" |
Neels Hofmeyr | 70c5fd2 | 2018-01-19 15:55:14 +0100 | [diff] [blame] | 1228 | BTS_TRX_TS_STR) |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1229 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1230 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 274d015 | 2010-12-24 12:05:03 +0100 | [diff] [blame] | 1231 | struct gsm_bts *bts = NULL; |
| 1232 | struct gsm_bts_trx *trx = NULL; |
| 1233 | struct gsm_bts_trx_ts *ts = NULL; |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1234 | int bts_nr, trx_nr, ts_nr; |
| 1235 | |
| 1236 | if (argc >= 1) { |
| 1237 | /* use the BTS number that the user has specified */ |
| 1238 | bts_nr = atoi(argv[0]); |
| 1239 | if (bts_nr >= net->num_bts) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 1240 | vty_out(vty, "%% can't find BTS '%s'%s", argv[0], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1241 | VTY_NEWLINE); |
| 1242 | return CMD_WARNING; |
| 1243 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1244 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1245 | } |
| 1246 | if (argc >= 2) { |
| 1247 | trx_nr = atoi(argv[1]); |
| 1248 | if (trx_nr >= bts->num_trx) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 1249 | vty_out(vty, "%% can't find TRX '%s'%s", argv[1], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1250 | VTY_NEWLINE); |
| 1251 | return CMD_WARNING; |
| 1252 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1253 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1254 | } |
| 1255 | if (argc >= 3) { |
| 1256 | ts_nr = atoi(argv[2]); |
| 1257 | if (ts_nr >= TRX_NR_TS) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 1258 | vty_out(vty, "%% can't find TS '%s'%s", argv[2], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1259 | VTY_NEWLINE); |
| 1260 | return CMD_WARNING; |
| 1261 | } |
Harald Welte | 274d015 | 2010-12-24 12:05:03 +0100 | [diff] [blame] | 1262 | /* Fully Specified: print and exit */ |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1263 | ts = &trx->ts[ts_nr]; |
| 1264 | ts_dump_vty(vty, ts); |
| 1265 | return CMD_SUCCESS; |
| 1266 | } |
Harald Welte | 274d015 | 2010-12-24 12:05:03 +0100 | [diff] [blame] | 1267 | |
| 1268 | if (bts && trx) { |
| 1269 | /* Iterate over all TS in this TRX */ |
| 1270 | for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) { |
| 1271 | ts = &trx->ts[ts_nr]; |
| 1272 | ts_dump_vty(vty, ts); |
| 1273 | } |
| 1274 | } else if (bts) { |
| 1275 | /* Iterate over all TRX in this BTS, TS in each TRX */ |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1276 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1277 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1278 | for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) { |
| 1279 | ts = &trx->ts[ts_nr]; |
| 1280 | ts_dump_vty(vty, ts); |
| 1281 | } |
| 1282 | } |
Harald Welte | 274d015 | 2010-12-24 12:05:03 +0100 | [diff] [blame] | 1283 | } else { |
| 1284 | /* Iterate over all BTS, TRX in each BTS, TS in each TRX */ |
| 1285 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
| 1286 | bts = gsm_bts_num(net, bts_nr); |
| 1287 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
| 1288 | trx = gsm_bts_trx_num(bts, trx_nr); |
| 1289 | for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) { |
| 1290 | ts = &trx->ts[ts_nr]; |
| 1291 | ts_dump_vty(vty, ts); |
| 1292 | } |
| 1293 | } |
| 1294 | } |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1295 | } |
| 1296 | |
| 1297 | return CMD_SUCCESS; |
| 1298 | } |
| 1299 | |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 1300 | static void bsc_subscr_dump_vty(struct vty *vty, struct bsc_subscr *bsub) |
| 1301 | { |
| 1302 | if (strlen(bsub->imsi)) |
| 1303 | vty_out(vty, " IMSI: %s%s", bsub->imsi, VTY_NEWLINE); |
| 1304 | if (bsub->tmsi != GSM_RESERVED_TMSI) |
| 1305 | vty_out(vty, " TMSI: 0x%08x%s", bsub->tmsi, |
| 1306 | VTY_NEWLINE); |
| 1307 | vty_out(vty, " Use count: %d%s", bsub->use_count, VTY_NEWLINE); |
| 1308 | } |
| 1309 | |
Harald Welte | 8387a49 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 1310 | static void meas_rep_dump_uni_vty(struct vty *vty, |
| 1311 | struct gsm_meas_rep_unidir *mru, |
| 1312 | const char *prefix, |
| 1313 | const char *dir) |
| 1314 | { |
| 1315 | vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ", |
| 1316 | prefix, dir, rxlev2dbm(mru->full.rx_lev), |
| 1317 | dir, rxlev2dbm(mru->sub.rx_lev)); |
| 1318 | vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s", |
| 1319 | dir, mru->full.rx_qual, dir, mru->sub.rx_qual, |
| 1320 | VTY_NEWLINE); |
| 1321 | } |
| 1322 | |
| 1323 | static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr, |
| 1324 | const char *prefix) |
| 1325 | { |
| 1326 | vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE); |
| 1327 | vty_out(vty, "%s Flags: %s%s%s%s%s", prefix, |
| 1328 | mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "", |
| 1329 | mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "", |
| 1330 | mr->flags & MEAS_REP_F_FPC ? "FPC " : "", |
| 1331 | mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ", |
| 1332 | VTY_NEWLINE); |
| 1333 | if (mr->flags & MEAS_REP_F_MS_TO) |
Max | 11e4e41 | 2017-04-20 13:07:58 +0200 | [diff] [blame] | 1334 | vty_out(vty, "%s MS Timing Offset: %d%s", prefix, mr->ms_timing_offset, VTY_NEWLINE); |
Harald Welte | 8387a49 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 1335 | if (mr->flags & MEAS_REP_F_MS_L1) |
| 1336 | vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s", |
| 1337 | prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE); |
| 1338 | if (mr->flags & MEAS_REP_F_DL_VALID) |
| 1339 | meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl"); |
| 1340 | meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul"); |
| 1341 | } |
| 1342 | |
Max | 6f379ba | 2018-11-19 14:05:04 +0100 | [diff] [blame] | 1343 | static inline void print_all_trx_ext(struct vty *vty, bool show_connected) |
| 1344 | { |
| 1345 | struct gsm_network *net = gsmnet_from_vty(vty); |
| 1346 | struct gsm_bts *bts = NULL; |
| 1347 | uint8_t bts_nr; |
| 1348 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
| 1349 | uint8_t trx_nr; |
| 1350 | bts = gsm_bts_num(net, bts_nr); |
| 1351 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) |
| 1352 | trx_dump_vty(vty, gsm_bts_trx_num(bts, trx_nr), false, show_connected); |
| 1353 | } |
| 1354 | } |
| 1355 | |
| 1356 | DEFUN(show_trx_con, |
| 1357 | show_trx_con_cmd, |
| 1358 | "show trx (connected|disconnected)", |
| 1359 | SHOW_STR "Display information about a TRX\n" |
| 1360 | "Show TRX with RSL connected\n" |
| 1361 | "Show TRX with RSL disconnected\n") |
| 1362 | { |
| 1363 | if (!strcmp(argv[0], "connected")) |
| 1364 | print_all_trx_ext(vty, true); |
| 1365 | else |
| 1366 | print_all_trx_ext(vty, false); |
| 1367 | |
| 1368 | return CMD_SUCCESS; |
| 1369 | } |
Harald Welte | 0a8cf32 | 2015-12-05 17:22:49 +0100 | [diff] [blame] | 1370 | |
Holger Hans Peter Freyther | 029235e | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1371 | static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan) |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1372 | { |
Harald Welte | 8387a49 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 1373 | int idx; |
| 1374 | |
Harald Welte | 85bded8 | 2010-12-24 12:22:34 +0100 | [diff] [blame] | 1375 | vty_out(vty, "BTS %u, TRX %u, Timeslot %u, Lchan %u: Type %s%s", |
| 1376 | lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr, |
| 1377 | lchan->nr, gsm_lchant_name(lchan->type), VTY_NEWLINE); |
Stefan Sperling | c459699 | 2018-11-13 13:59:51 +0100 | [diff] [blame] | 1378 | vty_out_dyn_ts_details(vty, lchan->ts); |
Holger Hans Peter Freyther | 454140e | 2014-12-28 12:08:28 +0100 | [diff] [blame] | 1379 | vty_out(vty, " Connection: %u, State: %s%s%s%s", |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1380 | lchan->conn ? 1: 0, lchan_state_name(lchan), |
| 1381 | lchan->fi && lchan->fi->state == LCHAN_ST_BORKEN ? " Error reason: " : "", |
| 1382 | lchan->fi && lchan->fi->state == LCHAN_ST_BORKEN ? lchan->last_error : "", |
Holger Hans Peter Freyther | 454140e | 2014-12-28 12:08:28 +0100 | [diff] [blame] | 1383 | VTY_NEWLINE); |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 1384 | vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s", |
| 1385 | lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red |
| 1386 | - lchan->bs_power*2, |
| 1387 | ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power), |
| 1388 | VTY_NEWLINE); |
Harald Welte | 0a8cf32 | 2015-12-05 17:22:49 +0100 | [diff] [blame] | 1389 | vty_out(vty, " Channel Mode / Codec: %s%s", |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1390 | gsm48_chan_mode_name(lchan->tch_mode), |
Harald Welte | 0a8cf32 | 2015-12-05 17:22:49 +0100 | [diff] [blame] | 1391 | VTY_NEWLINE); |
Neels Hofmeyr | 7b65688 | 2017-07-09 22:09:18 +0200 | [diff] [blame] | 1392 | if (lchan->conn && lchan->conn->bsub) { |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1393 | vty_out(vty, " Subscriber:%s", VTY_NEWLINE); |
Neels Hofmeyr | 7b65688 | 2017-07-09 22:09:18 +0200 | [diff] [blame] | 1394 | bsc_subscr_dump_vty(vty, lchan->conn->bsub); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1395 | } else |
| 1396 | vty_out(vty, " No Subscriber%s", VTY_NEWLINE); |
Harald Welte | 2c82899 | 2009-12-02 01:56:49 +0530 | [diff] [blame] | 1397 | if (is_ipaccess_bts(lchan->ts->trx->bts)) { |
| 1398 | struct in_addr ia; |
Harald Welte | 5f45a4a | 2018-02-05 21:33:34 +0100 | [diff] [blame] | 1399 | if (lchan->abis_ip.bound_ip) { |
| 1400 | ia.s_addr = htonl(lchan->abis_ip.bound_ip); |
| 1401 | vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s", |
| 1402 | inet_ntoa(ia), lchan->abis_ip.bound_port, |
| 1403 | lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id, |
| 1404 | VTY_NEWLINE); |
| 1405 | } |
| 1406 | if (lchan->abis_ip.connect_ip) { |
| 1407 | ia.s_addr = htonl(lchan->abis_ip.connect_ip); |
| 1408 | vty_out(vty, " Conn. IP: %s Port %u RTP_TYPE=%u SPEECH_MODE=0x%02x%s", |
| 1409 | inet_ntoa(ia), lchan->abis_ip.connect_port, |
| 1410 | lchan->abis_ip.rtp_payload, lchan->abis_ip.speech_mode, |
| 1411 | VTY_NEWLINE); |
| 1412 | } |
| 1413 | |
Harald Welte | 2c82899 | 2009-12-02 01:56:49 +0530 | [diff] [blame] | 1414 | } |
Harald Welte | 8387a49 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 1415 | |
| 1416 | /* we want to report the last measurement report */ |
| 1417 | idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep), |
| 1418 | lchan->meas_rep_idx, 1); |
| 1419 | meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " "); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1420 | } |
| 1421 | |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1422 | static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan) |
| 1423 | { |
Holger Hans Peter Freyther | cf5cc5b | 2010-05-14 01:57:02 +0800 | [diff] [blame] | 1424 | struct gsm_meas_rep *mr; |
| 1425 | int idx; |
| 1426 | |
| 1427 | /* we want to report the last measurement report */ |
| 1428 | idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep), |
| 1429 | lchan->meas_rep_idx, 1); |
| 1430 | mr = &lchan->meas_rep[idx]; |
| 1431 | |
Neels Hofmeyr | b748012 | 2016-11-02 14:28:15 +0100 | [diff] [blame] | 1432 | vty_out(vty, "BTS %u, TRX %u, Timeslot %u %s", |
Harald Welte | 85bded8 | 2010-12-24 12:22:34 +0100 | [diff] [blame] | 1433 | lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr, |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1434 | gsm_pchan_name(lchan->ts->pchan_on_init)); |
Neels Hofmeyr | b748012 | 2016-11-02 14:28:15 +0100 | [diff] [blame] | 1435 | vty_out_dyn_ts_status(vty, lchan->ts); |
| 1436 | vty_out(vty, ", Lchan %u, Type %s, State %s - " |
| 1437 | "L1 MS Power: %u dBm RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s", |
Neels Hofmeyr | efedf80 | 2016-06-14 01:31:38 +0200 | [diff] [blame] | 1438 | lchan->nr, |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1439 | gsm_lchant_name(lchan->type), lchan_state_name(lchan), |
Neels Hofmeyr | efedf80 | 2016-06-14 01:31:38 +0200 | [diff] [blame] | 1440 | mr->ms_l1.pwr, |
Holger Hans Peter Freyther | cf5cc5b | 2010-05-14 01:57:02 +0800 | [diff] [blame] | 1441 | rxlev2dbm(mr->dl.full.rx_lev), |
| 1442 | rxlev2dbm(mr->ul.full.rx_lev), |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1443 | VTY_NEWLINE); |
| 1444 | } |
| 1445 | |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1446 | |
| 1447 | static int dump_lchan_trx_ts(struct gsm_bts_trx_ts *ts, struct vty *vty, |
Philipp Maier | 761fa13 | 2019-01-22 10:25:05 +0100 | [diff] [blame] | 1448 | void (*dump_cb)(struct vty *, struct gsm_lchan *), |
| 1449 | bool all) |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1450 | { |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1451 | struct gsm_lchan *lchan; |
| 1452 | ts_for_each_lchan(lchan, ts) { |
Philipp Maier | 761fa13 | 2019-01-22 10:25:05 +0100 | [diff] [blame] | 1453 | if (lchan_state_is(lchan, LCHAN_ST_UNUSED) && all == false) |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1454 | continue; |
| 1455 | dump_cb(vty, lchan); |
| 1456 | } |
| 1457 | |
| 1458 | return CMD_SUCCESS; |
| 1459 | } |
| 1460 | |
| 1461 | static int dump_lchan_trx(struct gsm_bts_trx *trx, struct vty *vty, |
Philipp Maier | 761fa13 | 2019-01-22 10:25:05 +0100 | [diff] [blame] | 1462 | void (*dump_cb)(struct vty *, struct gsm_lchan *), |
| 1463 | bool all) |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1464 | { |
| 1465 | int ts_nr; |
| 1466 | |
| 1467 | for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) { |
| 1468 | struct gsm_bts_trx_ts *ts = &trx->ts[ts_nr]; |
Philipp Maier | 761fa13 | 2019-01-22 10:25:05 +0100 | [diff] [blame] | 1469 | dump_lchan_trx_ts(ts, vty, dump_cb, all); |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1470 | } |
| 1471 | |
| 1472 | return CMD_SUCCESS; |
| 1473 | } |
| 1474 | |
| 1475 | static int dump_lchan_bts(struct gsm_bts *bts, struct vty *vty, |
Philipp Maier | 761fa13 | 2019-01-22 10:25:05 +0100 | [diff] [blame] | 1476 | void (*dump_cb)(struct vty *, struct gsm_lchan *), |
| 1477 | bool all) |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1478 | { |
| 1479 | int trx_nr; |
| 1480 | |
| 1481 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
| 1482 | struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, trx_nr); |
Philipp Maier | 761fa13 | 2019-01-22 10:25:05 +0100 | [diff] [blame] | 1483 | dump_lchan_trx(trx, vty, dump_cb, all); |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1484 | } |
| 1485 | |
| 1486 | return CMD_SUCCESS; |
| 1487 | } |
| 1488 | |
Holger Hans Peter Freyther | 029235e | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1489 | static int lchan_summary(struct vty *vty, int argc, const char **argv, |
Philipp Maier | 761fa13 | 2019-01-22 10:25:05 +0100 | [diff] [blame] | 1490 | void (*dump_cb)(struct vty *, struct gsm_lchan *), |
| 1491 | bool all) |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1492 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1493 | struct gsm_network *net = gsmnet_from_vty(vty); |
Pau Espin Pedrol | cf48c54 | 2018-03-26 18:20:34 +0200 | [diff] [blame] | 1494 | struct gsm_bts *bts = NULL; |
| 1495 | struct gsm_bts_trx *trx = NULL; |
| 1496 | struct gsm_bts_trx_ts *ts = NULL; |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1497 | struct gsm_lchan *lchan; |
| 1498 | int bts_nr, trx_nr, ts_nr, lchan_nr; |
| 1499 | |
| 1500 | if (argc >= 1) { |
| 1501 | /* use the BTS number that the user has specified */ |
| 1502 | bts_nr = atoi(argv[0]); |
| 1503 | if (bts_nr >= net->num_bts) { |
| 1504 | vty_out(vty, "%% can't find BTS %s%s", argv[0], |
| 1505 | VTY_NEWLINE); |
| 1506 | return CMD_WARNING; |
| 1507 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1508 | bts = gsm_bts_num(net, bts_nr); |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1509 | |
| 1510 | if (argc == 1) |
Philipp Maier | 761fa13 | 2019-01-22 10:25:05 +0100 | [diff] [blame] | 1511 | return dump_lchan_bts(bts, vty, dump_cb, all); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1512 | } |
| 1513 | if (argc >= 2) { |
| 1514 | trx_nr = atoi(argv[1]); |
| 1515 | if (trx_nr >= bts->num_trx) { |
| 1516 | vty_out(vty, "%% can't find TRX %s%s", argv[1], |
| 1517 | VTY_NEWLINE); |
| 1518 | return CMD_WARNING; |
| 1519 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1520 | trx = gsm_bts_trx_num(bts, trx_nr); |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1521 | |
| 1522 | if (argc == 2) |
Philipp Maier | 761fa13 | 2019-01-22 10:25:05 +0100 | [diff] [blame] | 1523 | return dump_lchan_trx(trx, vty, dump_cb, all); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1524 | } |
| 1525 | if (argc >= 3) { |
| 1526 | ts_nr = atoi(argv[2]); |
| 1527 | if (ts_nr >= TRX_NR_TS) { |
| 1528 | vty_out(vty, "%% can't find TS %s%s", argv[2], |
| 1529 | VTY_NEWLINE); |
| 1530 | return CMD_WARNING; |
| 1531 | } |
| 1532 | ts = &trx->ts[ts_nr]; |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1533 | |
| 1534 | if (argc == 3) |
Philipp Maier | 761fa13 | 2019-01-22 10:25:05 +0100 | [diff] [blame] | 1535 | return dump_lchan_trx_ts(ts, vty, dump_cb, all); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1536 | } |
| 1537 | if (argc >= 4) { |
| 1538 | lchan_nr = atoi(argv[3]); |
| 1539 | if (lchan_nr >= TS_MAX_LCHAN) { |
| 1540 | vty_out(vty, "%% can't find LCHAN %s%s", argv[3], |
| 1541 | VTY_NEWLINE); |
| 1542 | return CMD_WARNING; |
| 1543 | } |
| 1544 | lchan = &ts->lchan[lchan_nr]; |
Holger Hans Peter Freyther | 029235e | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1545 | dump_cb(vty, lchan); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1546 | return CMD_SUCCESS; |
| 1547 | } |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1548 | |
| 1549 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1550 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1551 | bts = gsm_bts_num(net, bts_nr); |
Philipp Maier | 761fa13 | 2019-01-22 10:25:05 +0100 | [diff] [blame] | 1552 | dump_lchan_bts(bts, vty, dump_cb, all); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1553 | } |
| 1554 | |
| 1555 | return CMD_SUCCESS; |
| 1556 | } |
| 1557 | |
Holger Hans Peter Freyther | 029235e | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1558 | |
| 1559 | DEFUN(show_lchan, |
| 1560 | show_lchan_cmd, |
Neels Hofmeyr | e5b5a89 | 2018-01-19 15:41:24 +0100 | [diff] [blame] | 1561 | "show lchan [<0-255>] [<0-255>] [<0-7>] [<0-7>]", |
Holger Hans Peter Freyther | 029235e | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1562 | SHOW_STR "Display information about a logical channel\n" |
Neels Hofmeyr | 70c5fd2 | 2018-01-19 15:55:14 +0100 | [diff] [blame] | 1563 | BTS_TRX_TS_LCHAN_STR) |
Holger Hans Peter Freyther | 029235e | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1564 | { |
Philipp Maier | 761fa13 | 2019-01-22 10:25:05 +0100 | [diff] [blame] | 1565 | return lchan_summary(vty, argc, argv, lchan_dump_full_vty, true); |
Holger Hans Peter Freyther | 029235e | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1566 | } |
| 1567 | |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1568 | DEFUN(show_lchan_summary, |
| 1569 | show_lchan_summary_cmd, |
Neels Hofmeyr | e5b5a89 | 2018-01-19 15:41:24 +0100 | [diff] [blame] | 1570 | "show lchan summary [<0-255>] [<0-255>] [<0-7>] [<0-7>]", |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1571 | SHOW_STR "Display information about a logical channel\n" |
Philipp Maier | 761fa13 | 2019-01-22 10:25:05 +0100 | [diff] [blame] | 1572 | "Short summary (used lchans)\n" |
Neels Hofmeyr | 70c5fd2 | 2018-01-19 15:55:14 +0100 | [diff] [blame] | 1573 | BTS_TRX_TS_LCHAN_STR) |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1574 | { |
Philipp Maier | 761fa13 | 2019-01-22 10:25:05 +0100 | [diff] [blame] | 1575 | return lchan_summary(vty, argc, argv, lchan_dump_short_vty, false); |
| 1576 | } |
| 1577 | |
| 1578 | DEFUN(show_lchan_summary_all, |
| 1579 | show_lchan_summary_all_cmd, |
| 1580 | "show lchan summary-all [<0-255>] [<0-255>] [<0-7>] [<0-7>]", |
| 1581 | SHOW_STR "Display information about a logical channel\n" |
| 1582 | "Short summary (all lchans)\n" |
| 1583 | BTS_TRX_TS_LCHAN_STR) |
| 1584 | { |
| 1585 | return lchan_summary(vty, argc, argv, lchan_dump_short_vty, true); |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1586 | } |
| 1587 | |
Harald Welte | 00965dc | 2018-05-30 23:45:53 +0200 | [diff] [blame] | 1588 | static void dump_one_subscr_conn(struct vty *vty, const struct gsm_subscriber_connection *conn) |
| 1589 | { |
Philipp Maier | ef121b2 | 2018-09-12 16:48:53 +0200 | [diff] [blame] | 1590 | vty_out(vty, "conn ID=%u, MSC=%u, hodec2_fail=%d, mgw_ep=%s%s", |
Harald Welte | 00965dc | 2018-05-30 23:45:53 +0200 | [diff] [blame] | 1591 | conn->sccp.conn_id, conn->sccp.msc->nr, conn->hodec2.failures, |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 1592 | osmo_mgcpc_ep_name(conn->user_plane.mgw_endpoint), VTY_NEWLINE); |
Harald Welte | c997ceb | 2018-05-30 01:39:43 +0200 | [diff] [blame] | 1593 | if (conn->lcls.global_call_ref_len) { |
| 1594 | vty_out(vty, " LCLS GCR: %s%s", |
| 1595 | osmo_hexdump_nospc(conn->lcls.global_call_ref, conn->lcls.global_call_ref_len), |
| 1596 | VTY_NEWLINE); |
Max | ec4de9c | 2018-11-16 20:36:12 +0100 | [diff] [blame] | 1597 | vty_out(vty, " LCLS Config: %s, LCLS Control: %s, LCLS BSS Status: %s%s", |
| 1598 | gsm0808_lcls_config_name(conn->lcls.config), |
| 1599 | gsm0808_lcls_control_name(conn->lcls.control), |
| 1600 | osmo_fsm_inst_state_name(conn->lcls.fi), |
Harald Welte | c997ceb | 2018-05-30 01:39:43 +0200 | [diff] [blame] | 1601 | VTY_NEWLINE); |
| 1602 | } |
Harald Welte | 00965dc | 2018-05-30 23:45:53 +0200 | [diff] [blame] | 1603 | if (conn->lchan) |
| 1604 | lchan_dump_full_vty(vty, conn->lchan); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1605 | if (conn->assignment.new_lchan) |
| 1606 | lchan_dump_full_vty(vty, conn->assignment.new_lchan); |
Harald Welte | 00965dc | 2018-05-30 23:45:53 +0200 | [diff] [blame] | 1607 | } |
| 1608 | |
Philipp Maier | 39f62bb | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 1609 | DEFUN(show_subscr_conn, |
| 1610 | show_subscr_conn_cmd, |
| 1611 | "show conns", |
| 1612 | SHOW_STR "Display currently active subscriber connections\n") |
| 1613 | { |
| 1614 | struct gsm_subscriber_connection *conn; |
| 1615 | struct gsm_network *net = gsmnet_from_vty(vty); |
| 1616 | bool no_conns = true; |
| 1617 | unsigned int count = 0; |
| 1618 | |
| 1619 | vty_out(vty, "Active subscriber connections: %s", VTY_NEWLINE); |
| 1620 | |
| 1621 | llist_for_each_entry(conn, &net->subscr_conns, entry) { |
Harald Welte | 00965dc | 2018-05-30 23:45:53 +0200 | [diff] [blame] | 1622 | dump_one_subscr_conn(vty, conn); |
Philipp Maier | 39f62bb | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 1623 | no_conns = false; |
| 1624 | count++; |
| 1625 | } |
| 1626 | |
| 1627 | if (no_conns) |
| 1628 | vty_out(vty, "None%s", VTY_NEWLINE); |
| 1629 | |
| 1630 | return CMD_SUCCESS; |
| 1631 | } |
| 1632 | |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1633 | static int trigger_ho_or_as(struct vty *vty, struct gsm_lchan *from_lchan, struct gsm_bts *to_bts) |
| 1634 | { |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1635 | if (!to_bts || from_lchan->ts->trx->bts == to_bts) { |
| 1636 | LOGP(DHO, LOGL_NOTICE, "%s Manually triggering Assignment from VTY\n", |
| 1637 | gsm_lchan_name(from_lchan)); |
| 1638 | to_bts = from_lchan->ts->trx->bts; |
| 1639 | } else |
| 1640 | LOGP(DHO, LOGL_NOTICE, "%s (ARFCN %u) --> BTS %u Manually triggering Handover from VTY\n", |
| 1641 | gsm_lchan_name(from_lchan), from_lchan->ts->trx->arfcn, to_bts->nr); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1642 | { |
| 1643 | struct handover_out_req req = { |
| 1644 | .from_hodec_id = HODEC_USER, |
| 1645 | .old_lchan = from_lchan, |
| 1646 | .target_nik = *bts_ident_key(to_bts), |
| 1647 | }; |
| 1648 | handover_request(&req); |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1649 | } |
| 1650 | return CMD_SUCCESS; |
| 1651 | } |
| 1652 | |
| 1653 | static int ho_or_as(struct vty *vty, const char *argv[], int argc) |
Philipp Maier | 39f62bb | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 1654 | { |
| 1655 | struct gsm_network *net = gsmnet_from_vty(vty); |
| 1656 | struct gsm_subscriber_connection *conn; |
| 1657 | struct gsm_bts *bts; |
| 1658 | struct gsm_bts *new_bts = NULL; |
| 1659 | unsigned int bts_nr = atoi(argv[0]); |
| 1660 | unsigned int trx_nr = atoi(argv[1]); |
| 1661 | unsigned int ts_nr = atoi(argv[2]); |
| 1662 | unsigned int ss_nr = atoi(argv[3]); |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1663 | unsigned int bts_nr_new; |
| 1664 | const char *action; |
Philipp Maier | 39f62bb | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 1665 | |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1666 | if (argc > 4) { |
| 1667 | bts_nr_new = atoi(argv[4]); |
| 1668 | |
| 1669 | /* Lookup the BTS where we want to handover to */ |
| 1670 | llist_for_each_entry(bts, &net->bts_list, list) { |
| 1671 | if (bts->nr == bts_nr_new) { |
| 1672 | new_bts = bts; |
| 1673 | break; |
| 1674 | } |
| 1675 | } |
| 1676 | |
| 1677 | if (!new_bts) { |
| 1678 | vty_out(vty, "Unable to trigger handover, specified bts #%u does not exist %s", |
| 1679 | bts_nr_new, VTY_NEWLINE); |
| 1680 | return CMD_WARNING; |
Philipp Maier | 39f62bb | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 1681 | } |
| 1682 | } |
| 1683 | |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1684 | action = new_bts ? "handover" : "assignment"; |
Philipp Maier | 39f62bb | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 1685 | |
| 1686 | /* Find the connection/lchan that we want to handover */ |
| 1687 | llist_for_each_entry(conn, &net->subscr_conns, entry) { |
Harald Welte | 148ee36 | 2017-12-18 18:44:25 +0100 | [diff] [blame] | 1688 | if (conn_get_bts(conn)->nr == bts_nr && |
Philipp Maier | 39f62bb | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 1689 | conn->lchan->ts->trx->nr == trx_nr && |
| 1690 | conn->lchan->ts->nr == ts_nr && conn->lchan->nr == ss_nr) { |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1691 | vty_out(vty, "starting %s for lchan %s...%s", action, conn->lchan->name, VTY_NEWLINE); |
Philipp Maier | 39f62bb | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 1692 | lchan_dump_full_vty(vty, conn->lchan); |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1693 | return trigger_ho_or_as(vty, conn->lchan, new_bts); |
Philipp Maier | 39f62bb | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 1694 | } |
| 1695 | } |
| 1696 | |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1697 | vty_out(vty, "Unable to trigger %s, specified connection (bts=%u,trx=%u,ts=%u,ss=%u) does not exist%s", |
| 1698 | action, bts_nr, trx_nr, ts_nr, ss_nr, VTY_NEWLINE); |
Philipp Maier | 39f62bb | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 1699 | |
| 1700 | return CMD_WARNING; |
| 1701 | } |
| 1702 | |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1703 | #define MANUAL_HANDOVER_STR "Manually trigger handover (for debugging)\n" |
| 1704 | #define MANUAL_ASSIGNMENT_STR "Manually trigger assignment (for debugging)\n" |
| 1705 | |
| 1706 | DEFUN(handover_subscr_conn, |
| 1707 | handover_subscr_conn_cmd, |
Harald Welte | b22dcb8 | 2018-02-12 17:57:57 +0100 | [diff] [blame] | 1708 | "bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7> handover <0-255>", |
Harald Welte | 0bfd8d9 | 2018-02-12 18:06:53 +0100 | [diff] [blame] | 1709 | BTS_NR_TRX_TS_SS_STR2 |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1710 | MANUAL_HANDOVER_STR |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1711 | "New " BTS_NR_STR) |
| 1712 | { |
| 1713 | return ho_or_as(vty, argv, argc); |
| 1714 | } |
| 1715 | |
| 1716 | DEFUN(assignment_subscr_conn, |
| 1717 | assignment_subscr_conn_cmd, |
Harald Welte | b22dcb8 | 2018-02-12 17:57:57 +0100 | [diff] [blame] | 1718 | "bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7> assignment", |
Harald Welte | 0bfd8d9 | 2018-02-12 18:06:53 +0100 | [diff] [blame] | 1719 | BTS_NR_TRX_TS_SS_STR2 |
Harald Welte | b22dcb8 | 2018-02-12 17:57:57 +0100 | [diff] [blame] | 1720 | MANUAL_ASSIGNMENT_STR) |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1721 | { |
| 1722 | return ho_or_as(vty, argv, argc); |
| 1723 | } |
| 1724 | |
Neels Hofmeyr | a07b667 | 2018-07-12 05:00:55 +0200 | [diff] [blame] | 1725 | static struct gsm_lchan *find_used_voice_lchan(struct vty *vty, int random_idx) |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1726 | { |
| 1727 | struct gsm_bts *bts; |
| 1728 | struct gsm_network *network = gsmnet_from_vty(vty); |
| 1729 | |
Neels Hofmeyr | a07b667 | 2018-07-12 05:00:55 +0200 | [diff] [blame] | 1730 | while (1) { |
| 1731 | int count = 0; |
| 1732 | llist_for_each_entry(bts, &network->bts_list, list) { |
| 1733 | struct gsm_bts_trx *trx; |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1734 | |
Neels Hofmeyr | a07b667 | 2018-07-12 05:00:55 +0200 | [diff] [blame] | 1735 | llist_for_each_entry(trx, &bts->trx_list, list) { |
| 1736 | int i; |
| 1737 | for (i = 0; i < ARRAY_SIZE(trx->ts); i++) { |
| 1738 | struct gsm_bts_trx_ts *ts = &trx->ts[i]; |
| 1739 | struct gsm_lchan *lchan; |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1740 | |
Neels Hofmeyr | a07b667 | 2018-07-12 05:00:55 +0200 | [diff] [blame] | 1741 | if (ts->fi->state != TS_ST_IN_USE) |
| 1742 | continue; |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1743 | |
Neels Hofmeyr | a07b667 | 2018-07-12 05:00:55 +0200 | [diff] [blame] | 1744 | ts_for_each_lchan(lchan, ts) { |
| 1745 | if (lchan_state_is(lchan, LCHAN_ST_ESTABLISHED) |
| 1746 | && (lchan->type == GSM_LCHAN_TCH_F |
| 1747 | || lchan->type == GSM_LCHAN_TCH_H)) { |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1748 | |
Neels Hofmeyr | a07b667 | 2018-07-12 05:00:55 +0200 | [diff] [blame] | 1749 | if (count == random_idx) { |
| 1750 | vty_out(vty, "Found voice call: %s%s", |
| 1751 | gsm_lchan_name(lchan), |
| 1752 | VTY_NEWLINE); |
| 1753 | lchan_dump_full_vty(vty, lchan); |
| 1754 | return lchan; |
| 1755 | } |
| 1756 | count ++; |
| 1757 | } |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1758 | } |
| 1759 | } |
| 1760 | } |
| 1761 | } |
Neels Hofmeyr | a07b667 | 2018-07-12 05:00:55 +0200 | [diff] [blame] | 1762 | |
| 1763 | if (!count) |
| 1764 | break; |
| 1765 | /* there are used lchans, but random_idx is > count. Iterate again. */ |
| 1766 | random_idx %= count; |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1767 | } |
| 1768 | |
| 1769 | vty_out(vty, "Cannot find any ongoing voice calls%s", VTY_NEWLINE); |
| 1770 | return NULL; |
| 1771 | } |
| 1772 | |
| 1773 | static struct gsm_bts *find_other_bts_with_free_slots(struct vty *vty, struct gsm_bts *not_this_bts, |
Neels Hofmeyr | a07b667 | 2018-07-12 05:00:55 +0200 | [diff] [blame] | 1774 | enum gsm_chan_t free_type) |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1775 | { |
| 1776 | struct gsm_bts *bts; |
| 1777 | struct gsm_network *network = gsmnet_from_vty(vty); |
| 1778 | |
| 1779 | llist_for_each_entry(bts, &network->bts_list, list) { |
| 1780 | struct gsm_bts_trx *trx; |
| 1781 | |
| 1782 | if (bts == not_this_bts) |
| 1783 | continue; |
| 1784 | |
| 1785 | llist_for_each_entry(trx, &bts->trx_list, list) { |
Neels Hofmeyr | a07b667 | 2018-07-12 05:00:55 +0200 | [diff] [blame] | 1786 | struct gsm_lchan *lchan = lchan_select_by_type(bts, free_type); |
| 1787 | if (!lchan) |
| 1788 | continue; |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1789 | |
Neels Hofmeyr | a07b667 | 2018-07-12 05:00:55 +0200 | [diff] [blame] | 1790 | vty_out(vty, "Found unused %s slot: %s%s", |
| 1791 | gsm_lchant_name(free_type), gsm_lchan_name(lchan), VTY_NEWLINE); |
| 1792 | lchan_dump_full_vty(vty, lchan); |
| 1793 | return bts; |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1794 | } |
| 1795 | } |
| 1796 | vty_out(vty, "Cannot find any BTS (other than BTS %u) with free %s lchan%s", |
| 1797 | not_this_bts? not_this_bts->nr : 255, gsm_lchant_name(free_type), VTY_NEWLINE); |
| 1798 | return NULL; |
| 1799 | } |
| 1800 | |
| 1801 | DEFUN(handover_any, handover_any_cmd, |
| 1802 | "handover any", |
| 1803 | MANUAL_HANDOVER_STR |
| 1804 | "Pick any actively used TCH/F or TCH/H lchan and handover to any other BTS." |
| 1805 | " This is likely to fail if not all BTS are guaranteed to be reachable by the MS.\n") |
| 1806 | { |
| 1807 | struct gsm_lchan *from_lchan; |
| 1808 | struct gsm_bts *to_bts; |
| 1809 | |
Neels Hofmeyr | a07b667 | 2018-07-12 05:00:55 +0200 | [diff] [blame] | 1810 | from_lchan = find_used_voice_lchan(vty, random()); |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1811 | if (!from_lchan) |
| 1812 | return CMD_WARNING; |
| 1813 | |
Neels Hofmeyr | a07b667 | 2018-07-12 05:00:55 +0200 | [diff] [blame] | 1814 | to_bts = find_other_bts_with_free_slots(vty, from_lchan->ts->trx->bts, from_lchan->type); |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1815 | if (!to_bts) |
| 1816 | return CMD_WARNING; |
| 1817 | |
| 1818 | return trigger_ho_or_as(vty, from_lchan, to_bts); |
| 1819 | } |
| 1820 | |
| 1821 | DEFUN(assignment_any, assignment_any_cmd, |
| 1822 | "assignment any", |
| 1823 | MANUAL_ASSIGNMENT_STR |
| 1824 | "Pick any actively used TCH/F or TCH/H lchan and re-assign within the same BTS." |
| 1825 | " This will fail if no lchans of the same type are available besides the used one.\n") |
| 1826 | { |
| 1827 | struct gsm_lchan *from_lchan; |
| 1828 | |
Neels Hofmeyr | a07b667 | 2018-07-12 05:00:55 +0200 | [diff] [blame] | 1829 | from_lchan = find_used_voice_lchan(vty, random()); |
Neels Hofmeyr | b99e025 | 2017-12-05 02:10:15 +0100 | [diff] [blame] | 1830 | if (!from_lchan) |
| 1831 | return CMD_WARNING; |
| 1832 | |
| 1833 | return trigger_ho_or_as(vty, from_lchan, NULL); |
| 1834 | } |
| 1835 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1836 | DEFUN(handover_any_to_arfcn_bsic, handover_any_to_arfcn_bsic_cmd, |
| 1837 | "handover any to " NEIGHBOR_IDENT_VTY_KEY_PARAMS, |
| 1838 | MANUAL_HANDOVER_STR |
| 1839 | "Pick any actively used TCH/F or TCH/H lchan to handover to another cell." |
| 1840 | " This is likely to fail outside of a lab setup where you are certain that" |
| 1841 | " all MS are able to see the target cell.\n" |
| 1842 | "'to'\n" |
| 1843 | NEIGHBOR_IDENT_VTY_KEY_DOC) |
| 1844 | { |
| 1845 | struct handover_out_req req; |
| 1846 | struct gsm_lchan *from_lchan; |
| 1847 | |
Neels Hofmeyr | a07b667 | 2018-07-12 05:00:55 +0200 | [diff] [blame] | 1848 | from_lchan = find_used_voice_lchan(vty, random()); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1849 | if (!from_lchan) |
| 1850 | return CMD_WARNING; |
| 1851 | |
| 1852 | req = (struct handover_out_req){ |
| 1853 | .from_hodec_id = HODEC_USER, |
| 1854 | .old_lchan = from_lchan, |
| 1855 | }; |
| 1856 | |
| 1857 | if (!neighbor_ident_bts_parse_key_params(vty, from_lchan->ts->trx->bts, |
| 1858 | argv, &req.target_nik)) { |
| 1859 | vty_out(vty, "%% BTS %u does not know about this neighbor%s", |
| 1860 | from_lchan->ts->trx->bts->nr, VTY_NEWLINE); |
| 1861 | return CMD_WARNING; |
| 1862 | } |
| 1863 | |
| 1864 | handover_request(&req); |
| 1865 | return CMD_SUCCESS; |
| 1866 | } |
| 1867 | |
Harald Welte | be4b730 | 2009-05-23 16:59:33 +0000 | [diff] [blame] | 1868 | static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag) |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1869 | { |
| 1870 | vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE); |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 1871 | bsc_subscr_dump_vty(vty, pag->bsub); |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1872 | } |
| 1873 | |
Harald Welte | be4b730 | 2009-05-23 16:59:33 +0000 | [diff] [blame] | 1874 | static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts) |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1875 | { |
| 1876 | struct gsm_paging_request *pag; |
| 1877 | |
Holger Hans Peter Freyther | 9b5192b | 2013-03-03 11:03:17 +0100 | [diff] [blame] | 1878 | if (!bts->paging.bts) |
| 1879 | return; |
| 1880 | |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1881 | llist_for_each_entry(pag, &bts->paging.pending_requests, entry) |
| 1882 | paging_dump_vty(vty, pag); |
| 1883 | } |
| 1884 | |
| 1885 | DEFUN(show_paging, |
| 1886 | show_paging_cmd, |
Sylvain Munaut | 39c31de | 2012-12-28 12:15:11 +0100 | [diff] [blame] | 1887 | "show paging [<0-255>]", |
Martin Hauke | a82fc59 | 2018-09-30 20:51:43 +0200 | [diff] [blame] | 1888 | SHOW_STR "Display information about paging requests of a BTS\n" |
Neels Hofmeyr | 70c5fd2 | 2018-01-19 15:55:14 +0100 | [diff] [blame] | 1889 | BTS_NR_STR) |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1890 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1891 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1892 | struct gsm_bts *bts; |
| 1893 | int bts_nr; |
| 1894 | |
| 1895 | if (argc >= 1) { |
| 1896 | /* use the BTS number that the user has specified */ |
| 1897 | bts_nr = atoi(argv[0]); |
| 1898 | if (bts_nr >= net->num_bts) { |
| 1899 | vty_out(vty, "%% can't find BTS %s%s", argv[0], |
| 1900 | VTY_NEWLINE); |
| 1901 | return CMD_WARNING; |
| 1902 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1903 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1904 | bts_paging_dump_vty(vty, bts); |
Pau Espin Pedrol | c5a8416 | 2017-11-28 15:04:26 +0100 | [diff] [blame] | 1905 | |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1906 | return CMD_SUCCESS; |
| 1907 | } |
| 1908 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1909 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1910 | bts_paging_dump_vty(vty, bts); |
| 1911 | } |
| 1912 | |
| 1913 | return CMD_SUCCESS; |
| 1914 | } |
| 1915 | |
Holger Hans Peter Freyther | ec37bb2 | 2013-02-05 09:39:09 +0100 | [diff] [blame] | 1916 | DEFUN(show_paging_group, |
| 1917 | show_paging_group_cmd, |
| 1918 | "show paging-group <0-255> IMSI", |
| 1919 | SHOW_STR "Display the paging group\n" |
Neels Hofmeyr | 70c5fd2 | 2018-01-19 15:55:14 +0100 | [diff] [blame] | 1920 | BTS_NR_STR "IMSI\n") |
Holger Hans Peter Freyther | ec37bb2 | 2013-02-05 09:39:09 +0100 | [diff] [blame] | 1921 | { |
| 1922 | struct gsm_network *net = gsmnet_from_vty(vty); |
| 1923 | struct gsm_bts *bts; |
| 1924 | unsigned int page_group; |
| 1925 | int bts_nr = atoi(argv[0]); |
| 1926 | |
| 1927 | if (bts_nr >= net->num_bts) { |
| 1928 | vty_out(vty, "%% can't find BTS %s%s", argv[0], VTY_NEWLINE); |
| 1929 | return CMD_WARNING; |
| 1930 | } |
| 1931 | |
| 1932 | bts = gsm_bts_num(net, bts_nr); |
| 1933 | if (!bts) { |
| 1934 | vty_out(vty, "%% can't find BTS %s%s", argv[0], VTY_NEWLINE); |
| 1935 | return CMD_WARNING; |
| 1936 | } |
| 1937 | |
| 1938 | page_group = gsm0502_calc_paging_group(&bts->si_common.chan_desc, |
| 1939 | str_to_imsi(argv[1])); |
| 1940 | vty_out(vty, "%%Paging group for IMSI %" PRIu64 " on BTS #%d is %u%s", |
| 1941 | str_to_imsi(argv[1]), bts->nr, |
| 1942 | page_group, VTY_NEWLINE); |
| 1943 | return CMD_SUCCESS; |
| 1944 | } |
| 1945 | |
Holger Hans Peter Freyther | f7d752f | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 1946 | DEFUN(cfg_net_neci, |
| 1947 | cfg_net_neci_cmd, |
| 1948 | "neci (0|1)", |
Harald Welte | 2832606 | 2010-05-14 20:05:17 +0200 | [diff] [blame] | 1949 | "New Establish Cause Indication\n" |
| 1950 | "Don't set the NECI bit\n" "Set the NECI bit\n") |
Holger Hans Peter Freyther | f7d752f | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 1951 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1952 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1953 | |
Holger Hans Peter Freyther | f7d752f | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 1954 | gsmnet->neci = atoi(argv[0]); |
Holger Hans Peter Freyther | 7889107 | 2010-09-06 09:36:02 +0800 | [diff] [blame] | 1955 | gsm_net_update_ctype(gsmnet); |
Holger Hans Peter Freyther | f7d752f | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 1956 | return CMD_SUCCESS; |
| 1957 | } |
| 1958 | |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 1959 | DEFUN(cfg_net_pag_any_tch, |
| 1960 | cfg_net_pag_any_tch_cmd, |
| 1961 | "paging any use tch (0|1)", |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1962 | "Assign a TCH when receiving a Paging Any request\n" |
| 1963 | "Any Channel\n" "Use\n" "TCH\n" |
| 1964 | "Do not use TCH for Paging Request Any\n" |
| 1965 | "Do use TCH for Paging Request Any\n") |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 1966 | { |
Holger Hans Peter Freyther | b0e88b8 | 2010-09-06 10:09:19 +0800 | [diff] [blame] | 1967 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 1968 | gsmnet->pag_any_tch = atoi(argv[0]); |
| 1969 | gsm_net_update_ctype(gsmnet); |
| 1970 | return CMD_SUCCESS; |
| 1971 | } |
| 1972 | |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 1973 | DEFUN_DEPRECATED(cfg_net_dtx, |
| 1974 | cfg_net_dtx_cmd, |
| 1975 | "dtx-used (0|1)", |
| 1976 | ".HIDDEN\n""Obsolete\n""Obsolete\n") |
Holger Hans Peter Freyther | 5a3a61d | 2010-09-06 09:25:48 +0800 | [diff] [blame] | 1977 | { |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 1978 | vty_out(vty, "%% 'dtx-used' is now deprecated: use dtx * " |
| 1979 | "configuration options of BTS instead%s", VTY_NEWLINE); |
| 1980 | return CMD_SUCCESS; |
Holger Hans Peter Freyther | 5a3a61d | 2010-09-06 09:25:48 +0800 | [diff] [blame] | 1981 | } |
Holger Hans Peter Freyther | c4d88ad | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1982 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1983 | /* per-BTS configuration */ |
| 1984 | DEFUN(cfg_bts, |
| 1985 | cfg_bts_cmd, |
Harald Welte | 57e0724 | 2012-08-17 12:50:14 +0200 | [diff] [blame] | 1986 | "bts <0-255>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1987 | "Select a BTS to configure\n" |
Neels Hofmeyr | 70c5fd2 | 2018-01-19 15:55:14 +0100 | [diff] [blame] | 1988 | BTS_NR_STR) |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1989 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1990 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1991 | int bts_nr = atoi(argv[0]); |
| 1992 | struct gsm_bts *bts; |
| 1993 | |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1994 | if (bts_nr > gsmnet->num_bts) { |
| 1995 | vty_out(vty, "%% The next unused BTS number is %u%s", |
| 1996 | gsmnet->num_bts, VTY_NEWLINE); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1997 | return CMD_WARNING; |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1998 | } else if (bts_nr == gsmnet->num_bts) { |
| 1999 | /* allocate a new one */ |
Neels Hofmeyr | 958f259 | 2018-05-27 01:26:31 +0200 | [diff] [blame] | 2000 | bts = bsc_bts_alloc_register(gsmnet, GSM_BTS_TYPE_UNKNOWN, |
Harald Welte | a2bbc5e | 2015-11-20 10:43:31 +0100 | [diff] [blame] | 2001 | HARDCODED_BSIC); |
Stefan Sperling | 6442e43 | 2018-02-06 14:44:54 +0100 | [diff] [blame] | 2002 | /* |
| 2003 | * Initalize bts->acc_ramp here. Else we could segfault while |
| 2004 | * processing a configuration file with ACC ramping settings. |
| 2005 | */ |
Stefan Sperling | ea33341 | 2018-04-10 16:36:54 +0200 | [diff] [blame] | 2006 | acc_ramp_init(&bts->acc_ramp, bts); |
Holger Hans Peter Freyther | acf8a0c | 2010-03-29 08:47:44 +0200 | [diff] [blame] | 2007 | } else |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 2008 | bts = gsm_bts_num(gsmnet, bts_nr); |
| 2009 | |
Daniel Willmann | f15c276 | 2010-01-11 13:43:07 +0100 | [diff] [blame] | 2010 | if (!bts) { |
| 2011 | vty_out(vty, "%% Unable to allocate BTS %u%s", |
| 2012 | gsmnet->num_bts, VTY_NEWLINE); |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 2013 | return CMD_WARNING; |
Daniel Willmann | f15c276 | 2010-01-11 13:43:07 +0100 | [diff] [blame] | 2014 | } |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2015 | |
| 2016 | vty->index = bts; |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 2017 | vty->index_sub = &bts->description; |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2018 | vty->node = BTS_NODE; |
| 2019 | |
| 2020 | return CMD_SUCCESS; |
| 2021 | } |
| 2022 | |
| 2023 | DEFUN(cfg_bts_type, |
| 2024 | cfg_bts_type_cmd, |
Harald Welte | e555c2b | 2012-08-17 13:02:12 +0200 | [diff] [blame] | 2025 | "type TYPE", /* dynamically created */ |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 2026 | "Set the BTS type\n" "Type\n") |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2027 | { |
| 2028 | struct gsm_bts *bts = vty->index; |
Harald Welte | 39315c4 | 2010-01-10 18:01:52 +0100 | [diff] [blame] | 2029 | int rc; |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2030 | |
Max | 7507aef | 2017-04-10 13:59:14 +0200 | [diff] [blame] | 2031 | rc = gsm_set_bts_type(bts, str2btstype(argv[0])); |
Harald Welte | 39315c4 | 2010-01-10 18:01:52 +0100 | [diff] [blame] | 2032 | if (rc < 0) |
| 2033 | return CMD_WARNING; |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 2034 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2035 | return CMD_SUCCESS; |
| 2036 | } |
| 2037 | |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 2038 | DEFUN(cfg_bts_band, |
| 2039 | cfg_bts_band_cmd, |
| 2040 | "band BAND", |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 2041 | "Set the frequency band of this BTS\n" "Frequency band\n") |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 2042 | { |
| 2043 | struct gsm_bts *bts = vty->index; |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2044 | int band = gsm_band_parse(argv[0]); |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 2045 | |
| 2046 | if (band < 0) { |
| 2047 | vty_out(vty, "%% BAND %d is not a valid GSM band%s", |
| 2048 | band, VTY_NEWLINE); |
| 2049 | return CMD_WARNING; |
| 2050 | } |
| 2051 | |
| 2052 | bts->band = band; |
| 2053 | |
| 2054 | return CMD_SUCCESS; |
| 2055 | } |
| 2056 | |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 2057 | DEFUN(cfg_bts_dtxu, cfg_bts_dtxu_cmd, "dtx uplink [force]", |
| 2058 | "Configure discontinuous transmission\n" |
| 2059 | "Enable Uplink DTX for this BTS\n" |
| 2060 | "MS 'shall' use DTXu instead of 'may' use (might not be supported by " |
| 2061 | "older phones).\n") |
| 2062 | { |
| 2063 | struct gsm_bts *bts = vty->index; |
| 2064 | |
| 2065 | bts->dtxu = (argc > 0) ? GSM48_DTX_SHALL_BE_USED : GSM48_DTX_MAY_BE_USED; |
Max | 6079528 | 2016-06-06 11:30:57 +0200 | [diff] [blame] | 2066 | if (!is_ipaccess_bts(bts)) |
| 2067 | vty_out(vty, "%% DTX enabled on non-IP BTS: this configuration " |
| 2068 | "neither supported nor tested!%s", VTY_NEWLINE); |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 2069 | return CMD_SUCCESS; |
| 2070 | } |
| 2071 | |
| 2072 | DEFUN(cfg_bts_no_dtxu, cfg_bts_no_dtxu_cmd, "no dtx uplink", |
| 2073 | NO_STR |
| 2074 | "Configure discontinuous transmission\n" |
| 2075 | "Disable Uplink DTX for this BTS\n") |
| 2076 | { |
| 2077 | struct gsm_bts *bts = vty->index; |
| 2078 | |
| 2079 | bts->dtxu = GSM48_DTX_SHALL_NOT_BE_USED; |
| 2080 | |
| 2081 | return CMD_SUCCESS; |
| 2082 | } |
| 2083 | |
| 2084 | DEFUN(cfg_bts_dtxd, cfg_bts_dtxd_cmd, "dtx downlink", |
| 2085 | "Configure discontinuous transmission\n" |
| 2086 | "Enable Downlink DTX for this BTS\n") |
| 2087 | { |
| 2088 | struct gsm_bts *bts = vty->index; |
| 2089 | |
| 2090 | bts->dtxd = true; |
Max | 6079528 | 2016-06-06 11:30:57 +0200 | [diff] [blame] | 2091 | if (!is_ipaccess_bts(bts)) |
| 2092 | vty_out(vty, "%% DTX enabled on non-IP BTS: this configuration " |
| 2093 | "neither supported nor tested!%s", VTY_NEWLINE); |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 2094 | return CMD_SUCCESS; |
| 2095 | } |
| 2096 | |
| 2097 | DEFUN(cfg_bts_no_dtxd, cfg_bts_no_dtxd_cmd, "no dtx downlink", |
| 2098 | NO_STR |
| 2099 | "Configure discontinuous transmission\n" |
| 2100 | "Disable Downlink DTX for this BTS\n") |
| 2101 | { |
| 2102 | struct gsm_bts *bts = vty->index; |
| 2103 | |
| 2104 | bts->dtxd = false; |
| 2105 | |
| 2106 | return CMD_SUCCESS; |
| 2107 | } |
| 2108 | |
Holger Hans Peter Freyther | c4a49e3 | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 2109 | DEFUN(cfg_bts_ci, |
| 2110 | cfg_bts_ci_cmd, |
| 2111 | "cell_identity <0-65535>", |
Holger Hans Peter Freyther | 64c17fa | 2012-07-21 00:27:10 +0200 | [diff] [blame] | 2112 | "Set the Cell identity of this BTS\n" "Cell Identity\n") |
Holger Hans Peter Freyther | c4a49e3 | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 2113 | { |
| 2114 | struct gsm_bts *bts = vty->index; |
| 2115 | int ci = atoi(argv[0]); |
| 2116 | |
| 2117 | if (ci < 0 || ci > 0xffff) { |
| 2118 | vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s", |
| 2119 | ci, VTY_NEWLINE); |
| 2120 | return CMD_WARNING; |
| 2121 | } |
| 2122 | bts->cell_identity = ci; |
| 2123 | |
| 2124 | return CMD_SUCCESS; |
| 2125 | } |
| 2126 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2127 | DEFUN(cfg_bts_lac, |
| 2128 | cfg_bts_lac_cmd, |
Holger Hans Peter Freyther | 0b7f4b3 | 2009-09-29 14:02:33 +0200 | [diff] [blame] | 2129 | "location_area_code <0-65535>", |
Holger Hans Peter Freyther | 64c17fa | 2012-07-21 00:27:10 +0200 | [diff] [blame] | 2130 | "Set the Location Area Code (LAC) of this BTS\n" "LAC\n") |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2131 | { |
| 2132 | struct gsm_bts *bts = vty->index; |
| 2133 | int lac = atoi(argv[0]); |
| 2134 | |
Holger Hans Peter Freyther | 0b7f4b3 | 2009-09-29 14:02:33 +0200 | [diff] [blame] | 2135 | if (lac < 0 || lac > 0xffff) { |
| 2136 | vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s", |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2137 | lac, VTY_NEWLINE); |
| 2138 | return CMD_WARNING; |
| 2139 | } |
Holger Hans Peter Freyther | e48b956 | 2009-10-01 04:07:15 +0200 | [diff] [blame] | 2140 | |
| 2141 | if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) { |
| 2142 | vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s", |
| 2143 | lac, VTY_NEWLINE); |
| 2144 | return CMD_WARNING; |
| 2145 | } |
| 2146 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2147 | bts->location_area_code = lac; |
| 2148 | |
| 2149 | return CMD_SUCCESS; |
| 2150 | } |
| 2151 | |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 2152 | |
Harald Welte | a2bbc5e | 2015-11-20 10:43:31 +0100 | [diff] [blame] | 2153 | /* compatibility wrapper for old config files */ |
| 2154 | DEFUN_HIDDEN(cfg_bts_tsc, |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2155 | cfg_bts_tsc_cmd, |
Harald Welte | c513ded | 2012-05-31 10:57:08 +0200 | [diff] [blame] | 2156 | "training_sequence_code <0-7>", |
Holger Hans Peter Freyther | 64c17fa | 2012-07-21 00:27:10 +0200 | [diff] [blame] | 2157 | "Set the Training Sequence Code (TSC) of this BTS\n" "TSC\n") |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2158 | { |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2159 | return CMD_SUCCESS; |
| 2160 | } |
| 2161 | |
Harald Welte | 78f2f50 | 2009-05-23 16:56:52 +0000 | [diff] [blame] | 2162 | DEFUN(cfg_bts_bsic, |
| 2163 | cfg_bts_bsic_cmd, |
| 2164 | "base_station_id_code <0-63>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2165 | "Set the Base Station Identity Code (BSIC) of this BTS\n" |
| 2166 | "BSIC of this BTS\n") |
Harald Welte | 78f2f50 | 2009-05-23 16:56:52 +0000 | [diff] [blame] | 2167 | { |
| 2168 | struct gsm_bts *bts = vty->index; |
| 2169 | int bsic = atoi(argv[0]); |
| 2170 | |
| 2171 | if (bsic < 0 || bsic > 0x3f) { |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2172 | vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s", |
Harald Welte | 78f2f50 | 2009-05-23 16:56:52 +0000 | [diff] [blame] | 2173 | bsic, VTY_NEWLINE); |
| 2174 | return CMD_WARNING; |
| 2175 | } |
| 2176 | bts->bsic = bsic; |
| 2177 | |
| 2178 | return CMD_SUCCESS; |
| 2179 | } |
| 2180 | |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 2181 | DEFUN(cfg_bts_unit_id, |
| 2182 | cfg_bts_unit_id_cmd, |
Harald Welte | 07dc73d | 2009-08-07 13:27:09 +0200 | [diff] [blame] | 2183 | "ip.access unit_id <0-65534> <0-255>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2184 | "Abis/IP specific options\n" |
| 2185 | "Set the IPA BTS Unit ID\n" |
| 2186 | "Unit ID (Site)\n" |
| 2187 | "Unit ID (BTS)\n") |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 2188 | { |
| 2189 | struct gsm_bts *bts = vty->index; |
| 2190 | int site_id = atoi(argv[0]); |
| 2191 | int bts_id = atoi(argv[1]); |
| 2192 | |
Harald Welte | 07dc73d | 2009-08-07 13:27:09 +0200 | [diff] [blame] | 2193 | if (!is_ipaccess_bts(bts)) { |
| 2194 | vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE); |
| 2195 | return CMD_WARNING; |
| 2196 | } |
| 2197 | |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 2198 | bts->ip_access.site_id = site_id; |
| 2199 | bts->ip_access.bts_id = bts_id; |
| 2200 | |
| 2201 | return CMD_SUCCESS; |
| 2202 | } |
| 2203 | |
Harald Welte | 8b29180 | 2013-03-12 13:57:05 +0100 | [diff] [blame] | 2204 | DEFUN(cfg_bts_rsl_ip, |
| 2205 | cfg_bts_rsl_ip_cmd, |
| 2206 | "ip.access rsl-ip A.B.C.D", |
| 2207 | "Abis/IP specific options\n" |
| 2208 | "Set the IPA RSL IP Address of the BSC\n" |
| 2209 | "Destination IP address for RSL connection\n") |
| 2210 | { |
| 2211 | struct gsm_bts *bts = vty->index; |
| 2212 | struct in_addr ia; |
| 2213 | |
| 2214 | if (!is_ipaccess_bts(bts)) { |
| 2215 | vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE); |
| 2216 | return CMD_WARNING; |
| 2217 | } |
| 2218 | |
| 2219 | inet_aton(argv[0], &ia); |
| 2220 | bts->ip_access.rsl_ip = ntohl(ia.s_addr); |
| 2221 | |
| 2222 | return CMD_SUCCESS; |
| 2223 | } |
| 2224 | |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 2225 | #define NOKIA_STR "Nokia *Site related commands\n" |
Harald Welte | 8b29180 | 2013-03-12 13:57:05 +0100 | [diff] [blame] | 2226 | |
Sylvain Munaut | c951946 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 2227 | DEFUN(cfg_bts_nokia_site_skip_reset, |
| 2228 | cfg_bts_nokia_site_skip_reset_cmd, |
| 2229 | "nokia_site skip-reset (0|1)", |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 2230 | NOKIA_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2231 | "Skip the reset step during bootstrap process of this BTS\n" |
| 2232 | "Do NOT skip the reset\n" "Skip the reset\n") |
Sylvain Munaut | c951946 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 2233 | { |
| 2234 | struct gsm_bts *bts = vty->index; |
| 2235 | |
| 2236 | if (bts->type != GSM_BTS_TYPE_NOKIA_SITE) { |
| 2237 | vty_out(vty, "%% BTS is not of Nokia *Site type%s", VTY_NEWLINE); |
| 2238 | return CMD_WARNING; |
| 2239 | } |
| 2240 | |
| 2241 | bts->nokia.skip_reset = atoi(argv[0]); |
| 2242 | |
| 2243 | return CMD_SUCCESS; |
| 2244 | } |
| 2245 | |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 2246 | DEFUN(cfg_bts_nokia_site_no_loc_rel_cnf, |
| 2247 | cfg_bts_nokia_site_no_loc_rel_cnf_cmd, |
| 2248 | "nokia_site no-local-rel-conf (0|1)", |
| 2249 | NOKIA_STR |
| 2250 | "Do not wait for RELease CONFirm message when releasing channel locally\n" |
| 2251 | "Wait for RELease CONFirm\n" "Do not wait for RELease CONFirm\n") |
| 2252 | { |
| 2253 | struct gsm_bts *bts = vty->index; |
| 2254 | |
| 2255 | if (!is_nokia_bts(bts)) { |
| 2256 | vty_out(vty, "%% BTS is not of Nokia *Site type%s", |
| 2257 | VTY_NEWLINE); |
| 2258 | return CMD_WARNING; |
| 2259 | } |
| 2260 | |
| 2261 | bts->nokia.no_loc_rel_cnf = atoi(argv[0]); |
| 2262 | |
| 2263 | return CMD_SUCCESS; |
| 2264 | } |
| 2265 | |
Sipos Csaba | 56e1766 | 2015-02-07 13:27:36 +0100 | [diff] [blame] | 2266 | DEFUN(cfg_bts_nokia_site_bts_reset_timer_cnf, |
| 2267 | cfg_bts_nokia_site_bts_reset_timer_cnf_cmd, |
| 2268 | "nokia_site bts-reset-timer <15-100>", |
| 2269 | NOKIA_STR |
| 2270 | "The amount of time (in sec.) between BTS_RESET is sent,\n" |
| 2271 | "and the BTS is being bootstrapped.\n") |
| 2272 | { |
| 2273 | struct gsm_bts *bts = vty->index; |
| 2274 | |
| 2275 | if (!is_nokia_bts(bts)) { |
| 2276 | vty_out(vty, "%% BTS is not of Nokia *Site type%s", |
| 2277 | VTY_NEWLINE); |
| 2278 | return CMD_WARNING; |
| 2279 | } |
| 2280 | |
| 2281 | bts->nokia.bts_reset_timer_cnf = atoi(argv[0]); |
| 2282 | |
| 2283 | return CMD_SUCCESS; |
| 2284 | } |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2285 | #define OML_STR "Organization & Maintenance Link\n" |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2286 | #define IPA_STR "A-bis/IP Specific Options\n" |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2287 | |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 2288 | DEFUN(cfg_bts_stream_id, |
| 2289 | cfg_bts_stream_id_cmd, |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 2290 | "oml ip.access stream_id <0-255> line E1_LINE", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2291 | OML_STR IPA_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2292 | "Set the ip.access Stream ID of the OML link of this BTS\n" |
| 2293 | "Stream Identifier\n" "Virtual E1 Line Number\n" "Virtual E1 Line Number\n") |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 2294 | { |
| 2295 | struct gsm_bts *bts = vty->index; |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 2296 | int stream_id = atoi(argv[0]), linenr = atoi(argv[1]); |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 2297 | |
| 2298 | if (!is_ipaccess_bts(bts)) { |
| 2299 | vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE); |
| 2300 | return CMD_WARNING; |
| 2301 | } |
| 2302 | |
| 2303 | bts->oml_tei = stream_id; |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 2304 | /* This is used by e1inp_bind_ops callback for each BTS model. */ |
| 2305 | bts->oml_e1_link.e1_nr = linenr; |
| 2306 | |
| 2307 | return CMD_SUCCESS; |
| 2308 | } |
| 2309 | |
Harald Welte | d13e0cd | 2012-08-17 09:52:03 +0200 | [diff] [blame] | 2310 | #define OML_E1_STR OML_STR "OML E1/T1 Configuration\n" |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 2311 | |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2312 | DEFUN(cfg_bts_oml_e1, |
| 2313 | cfg_bts_oml_e1_cmd, |
| 2314 | "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)", |
Harald Welte | d13e0cd | 2012-08-17 09:52:03 +0200 | [diff] [blame] | 2315 | OML_E1_STR |
| 2316 | "E1/T1 line number to be used for OML\n" |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2317 | "E1/T1 line number to be used for OML\n" |
| 2318 | "E1/T1 timeslot to be used for OML\n" |
| 2319 | "E1/T1 timeslot to be used for OML\n" |
| 2320 | "E1/T1 sub-slot to be used for OML\n" |
| 2321 | "Use E1/T1 sub-slot 0\n" |
| 2322 | "Use E1/T1 sub-slot 1\n" |
| 2323 | "Use E1/T1 sub-slot 2\n" |
| 2324 | "Use E1/T1 sub-slot 3\n" |
| 2325 | "Use full E1 slot 3\n" |
| 2326 | ) |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2327 | { |
| 2328 | struct gsm_bts *bts = vty->index; |
| 2329 | |
| 2330 | parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]); |
| 2331 | |
| 2332 | return CMD_SUCCESS; |
| 2333 | } |
| 2334 | |
| 2335 | |
| 2336 | DEFUN(cfg_bts_oml_e1_tei, |
| 2337 | cfg_bts_oml_e1_tei_cmd, |
| 2338 | "oml e1 tei <0-63>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2339 | OML_E1_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2340 | "Set the TEI to be used for OML\n" |
| 2341 | "TEI Number\n") |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2342 | { |
| 2343 | struct gsm_bts *bts = vty->index; |
| 2344 | |
| 2345 | bts->oml_tei = atoi(argv[0]); |
| 2346 | |
| 2347 | return CMD_SUCCESS; |
| 2348 | } |
| 2349 | |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 2350 | DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd, |
| 2351 | "channel allocator (ascending|descending)", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2352 | "Channnel Allocator\n" "Channel Allocator\n" |
| 2353 | "Allocate Timeslots and Transceivers in ascending order\n" |
| 2354 | "Allocate Timeslots and Transceivers in descending order\n") |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 2355 | { |
| 2356 | struct gsm_bts *bts = vty->index; |
| 2357 | |
| 2358 | if (!strcmp(argv[0], "ascending")) |
| 2359 | bts->chan_alloc_reverse = 0; |
| 2360 | else |
| 2361 | bts->chan_alloc_reverse = 1; |
| 2362 | |
| 2363 | return CMD_SUCCESS; |
| 2364 | } |
| 2365 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2366 | #define RACH_STR "Random Access Control Channel\n" |
| 2367 | |
Sylvain Munaut | 4010f1e | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 2368 | DEFUN(cfg_bts_rach_tx_integer, |
| 2369 | cfg_bts_rach_tx_integer_cmd, |
| 2370 | "rach tx integer <0-15>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2371 | RACH_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2372 | "Set the raw tx integer value in RACH Control parameters IE\n" |
| 2373 | "Set the raw tx integer value in RACH Control parameters IE\n" |
| 2374 | "Raw tx integer value in RACH Control parameters IE\n") |
Sylvain Munaut | 4010f1e | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 2375 | { |
| 2376 | struct gsm_bts *bts = vty->index; |
| 2377 | bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf; |
| 2378 | return CMD_SUCCESS; |
| 2379 | } |
| 2380 | |
| 2381 | DEFUN(cfg_bts_rach_max_trans, |
| 2382 | cfg_bts_rach_max_trans_cmd, |
| 2383 | "rach max transmission (1|2|4|7)", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2384 | RACH_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2385 | "Set the maximum number of RACH burst transmissions\n" |
| 2386 | "Set the maximum number of RACH burst transmissions\n" |
Harald Welte | d13e0cd | 2012-08-17 09:52:03 +0200 | [diff] [blame] | 2387 | "Maximum number of 1 RACH burst transmissions\n" |
| 2388 | "Maximum number of 2 RACH burst transmissions\n" |
| 2389 | "Maximum number of 4 RACH burst transmissions\n" |
| 2390 | "Maximum number of 7 RACH burst transmissions\n") |
Sylvain Munaut | 4010f1e | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 2391 | { |
| 2392 | struct gsm_bts *bts = vty->index; |
| 2393 | bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0])); |
| 2394 | return CMD_SUCCESS; |
| 2395 | } |
| 2396 | |
Andreas Eversberg | 2ee7ecd | 2012-10-13 07:27:47 +0200 | [diff] [blame] | 2397 | #define CD_STR "Channel Description\n" |
| 2398 | |
| 2399 | DEFUN(cfg_bts_chan_desc_att, |
| 2400 | cfg_bts_chan_desc_att_cmd, |
| 2401 | "channel-descrption attach (0|1)", |
| 2402 | CD_STR |
| 2403 | "Set if attachment is required\n" |
| 2404 | "Attachment is NOT required\n" |
| 2405 | "Attachment is required (standard)\n") |
| 2406 | { |
| 2407 | struct gsm_bts *bts = vty->index; |
| 2408 | bts->si_common.chan_desc.att = atoi(argv[0]); |
| 2409 | return CMD_SUCCESS; |
| 2410 | } |
| 2411 | |
| 2412 | DEFUN(cfg_bts_chan_desc_bs_pa_mfrms, |
| 2413 | cfg_bts_chan_desc_bs_pa_mfrms_cmd, |
| 2414 | "channel-descrption bs-pa-mfrms <2-9>", |
| 2415 | CD_STR |
| 2416 | "Set number of multiframe periods for paging groups\n" |
| 2417 | "Number of multiframe periods for paging groups\n") |
| 2418 | { |
| 2419 | struct gsm_bts *bts = vty->index; |
| 2420 | int bs_pa_mfrms = atoi(argv[0]); |
| 2421 | |
| 2422 | bts->si_common.chan_desc.bs_pa_mfrms = bs_pa_mfrms - 2; |
| 2423 | return CMD_SUCCESS; |
| 2424 | } |
| 2425 | |
| 2426 | DEFUN(cfg_bts_chan_desc_bs_ag_blks_res, |
| 2427 | cfg_bts_chan_desc_bs_ag_blks_res_cmd, |
| 2428 | "channel-descrption bs-ag-blks-res <0-7>", |
| 2429 | CD_STR |
| 2430 | "Set number of blocks reserved for access grant\n" |
| 2431 | "Number of blocks reserved for access grant\n") |
| 2432 | { |
| 2433 | struct gsm_bts *bts = vty->index; |
| 2434 | int bs_ag_blks_res = atoi(argv[0]); |
| 2435 | |
| 2436 | bts->si_common.chan_desc.bs_ag_blks_res = bs_ag_blks_res; |
| 2437 | return CMD_SUCCESS; |
| 2438 | } |
| 2439 | |
Harald Welte | 1540025 | 2019-05-24 11:56:23 +0200 | [diff] [blame] | 2440 | #define CCCH_STR "Common Control Channel\n" |
| 2441 | |
| 2442 | DEFUN(cfg_bts_ccch_load_ind_thresh, |
| 2443 | cfg_bts_ccch_load_ind_thresh_cmd, |
| 2444 | "ccch load-indication-threshold <0-100>", |
| 2445 | CCCH_STR |
| 2446 | "Percentage of CCCH load at which BTS sends RSL CCCH LOAD IND\n" |
| 2447 | "CCCH Load Threshold in percent (Default: 10)") |
| 2448 | { |
| 2449 | struct gsm_bts *bts = vty->index; |
| 2450 | bts->ccch_load_ind_thresh = atoi(argv[0]); |
| 2451 | return CMD_SUCCESS; |
| 2452 | } |
| 2453 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2454 | #define NM_STR "Network Management\n" |
| 2455 | |
Holger Hans Peter Freyther | 95c2290 | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 2456 | DEFUN(cfg_bts_rach_nm_b_thresh, |
| 2457 | cfg_bts_rach_nm_b_thresh_cmd, |
| 2458 | "rach nm busy threshold <0-255>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2459 | RACH_STR NM_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2460 | "Set the NM Busy Threshold\n" |
| 2461 | "Set the NM Busy Threshold\n" |
| 2462 | "NM Busy Threshold in dB") |
Holger Hans Peter Freyther | 95c2290 | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 2463 | { |
| 2464 | struct gsm_bts *bts = vty->index; |
| 2465 | bts->rach_b_thresh = atoi(argv[0]); |
| 2466 | return CMD_SUCCESS; |
| 2467 | } |
| 2468 | |
| 2469 | DEFUN(cfg_bts_rach_nm_ldavg, |
| 2470 | cfg_bts_rach_nm_ldavg_cmd, |
| 2471 | "rach nm load average <0-65535>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2472 | RACH_STR NM_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2473 | "Set the NM Loadaverage Slots value\n" |
| 2474 | "Set the NM Loadaverage Slots value\n" |
| 2475 | "NM Loadaverage Slots value\n") |
Holger Hans Peter Freyther | 95c2290 | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 2476 | { |
| 2477 | struct gsm_bts *bts = vty->index; |
| 2478 | bts->rach_ldavg_slots = atoi(argv[0]); |
| 2479 | return CMD_SUCCESS; |
| 2480 | } |
| 2481 | |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 2482 | DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd, |
| 2483 | "cell barred (0|1)", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2484 | "Should this cell be barred from access?\n" |
| 2485 | "Should this cell be barred from access?\n" |
| 2486 | "Cell should NOT be barred\n" |
| 2487 | "Cell should be barred\n") |
| 2488 | |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 2489 | { |
| 2490 | struct gsm_bts *bts = vty->index; |
| 2491 | |
Harald Welte | 7135501 | 2009-12-21 23:08:18 +0100 | [diff] [blame] | 2492 | bts->si_common.rach_control.cell_bar = atoi(argv[0]); |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 2493 | |
| 2494 | return CMD_SUCCESS; |
| 2495 | } |
| 2496 | |
Holger Hans Peter Freyther | 3a0a463 | 2010-05-14 00:39:19 +0800 | [diff] [blame] | 2497 | DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd, |
| 2498 | "rach emergency call allowed (0|1)", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2499 | RACH_STR |
| 2500 | "Should this cell allow emergency calls?\n" |
| 2501 | "Should this cell allow emergency calls?\n" |
| 2502 | "Should this cell allow emergency calls?\n" |
| 2503 | "Do NOT allow emergency calls\n" |
| 2504 | "Allow emergency calls\n") |
Holger Hans Peter Freyther | 3a0a463 | 2010-05-14 00:39:19 +0800 | [diff] [blame] | 2505 | { |
| 2506 | struct gsm_bts *bts = vty->index; |
| 2507 | |
| 2508 | if (atoi(argv[0]) == 0) |
| 2509 | bts->si_common.rach_control.t2 |= 0x4; |
| 2510 | else |
| 2511 | bts->si_common.rach_control.t2 &= ~0x4; |
| 2512 | |
| 2513 | return CMD_SUCCESS; |
| 2514 | } |
| 2515 | |
Ivan Kluchnikov | 6792059 | 2013-09-16 13:13:04 +0400 | [diff] [blame] | 2516 | DEFUN(cfg_bts_rach_ac_class, cfg_bts_rach_ac_class_cmd, |
| 2517 | "rach access-control-class (0|1|2|3|4|5|6|7|8|9|11|12|13|14|15) (barred|allowed)", |
| 2518 | RACH_STR |
| 2519 | "Set access control class\n" |
| 2520 | "Access control class 0\n" |
| 2521 | "Access control class 1\n" |
| 2522 | "Access control class 2\n" |
| 2523 | "Access control class 3\n" |
| 2524 | "Access control class 4\n" |
| 2525 | "Access control class 5\n" |
| 2526 | "Access control class 6\n" |
| 2527 | "Access control class 7\n" |
| 2528 | "Access control class 8\n" |
| 2529 | "Access control class 9\n" |
| 2530 | "Access control class 11 for PLMN use\n" |
| 2531 | "Access control class 12 for security services\n" |
| 2532 | "Access control class 13 for public utilities (e.g. water/gas suppliers)\n" |
| 2533 | "Access control class 14 for emergency services\n" |
| 2534 | "Access control class 15 for PLMN staff\n" |
| 2535 | "barred to use access control class\n" |
| 2536 | "allowed to use access control class\n") |
| 2537 | { |
| 2538 | struct gsm_bts *bts = vty->index; |
| 2539 | |
| 2540 | uint8_t control_class; |
| 2541 | uint8_t allowed = 0; |
| 2542 | |
| 2543 | if (strcmp(argv[1], "allowed") == 0) |
| 2544 | allowed = 1; |
| 2545 | |
| 2546 | control_class = atoi(argv[0]); |
| 2547 | if (control_class < 8) |
| 2548 | if (allowed) |
| 2549 | bts->si_common.rach_control.t3 &= ~(0x1 << control_class); |
| 2550 | else |
| 2551 | bts->si_common.rach_control.t3 |= (0x1 << control_class); |
| 2552 | else |
| 2553 | if (allowed) |
| 2554 | bts->si_common.rach_control.t2 &= ~(0x1 << (control_class - 8)); |
| 2555 | else |
| 2556 | bts->si_common.rach_control.t2 |= (0x1 << (control_class - 8)); |
| 2557 | |
| 2558 | return CMD_SUCCESS; |
| 2559 | } |
| 2560 | |
Harald Welte (local) | 0e451d0 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 2561 | DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd, |
| 2562 | "ms max power <0-40>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2563 | "MS Options\n" |
Harald Welte | d13e0cd | 2012-08-17 09:52:03 +0200 | [diff] [blame] | 2564 | "Maximum transmit power of the MS\n" |
| 2565 | "Maximum transmit power of the MS\n" |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2566 | "Maximum transmit power of the MS in dBm") |
Harald Welte (local) | 0e451d0 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 2567 | { |
| 2568 | struct gsm_bts *bts = vty->index; |
| 2569 | |
| 2570 | bts->ms_max_power = atoi(argv[0]); |
| 2571 | |
| 2572 | return CMD_SUCCESS; |
| 2573 | } |
| 2574 | |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2575 | #define CELL_STR "Cell Parameters\n" |
| 2576 | |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 2577 | DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd, |
| 2578 | "cell reselection hysteresis <0-14>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2579 | CELL_STR "Cell re-selection parameters\n" |
| 2580 | "Cell Re-Selection Hysteresis in dB\n" |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 2581 | "Cell Re-Selection Hysteresis in dB") |
| 2582 | { |
| 2583 | struct gsm_bts *bts = vty->index; |
| 2584 | |
| 2585 | bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2; |
| 2586 | |
| 2587 | return CMD_SUCCESS; |
| 2588 | } |
| 2589 | |
| 2590 | DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd, |
| 2591 | "rxlev access min <0-63>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2592 | "Minimum RxLev needed for cell access\n" |
| 2593 | "Minimum RxLev needed for cell access\n" |
| 2594 | "Minimum RxLev needed for cell access\n" |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 2595 | "Minimum RxLev needed for cell access (better than -110dBm)") |
| 2596 | { |
| 2597 | struct gsm_bts *bts = vty->index; |
| 2598 | |
| 2599 | bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]); |
| 2600 | |
| 2601 | return CMD_SUCCESS; |
| 2602 | } |
| 2603 | |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2604 | DEFUN(cfg_bts_cell_bar_qualify, cfg_bts_cell_bar_qualify_cmd, |
| 2605 | "cell bar qualify (0|1)", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2606 | CELL_STR "Cell Bar Qualify\n" "Cell Bar Qualify\n" |
| 2607 | "Set CBQ to 0\n" "Set CBQ to 1\n") |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2608 | { |
| 2609 | struct gsm_bts *bts = vty->index; |
| 2610 | |
| 2611 | bts->si_common.cell_ro_sel_par.present = 1; |
| 2612 | bts->si_common.cell_ro_sel_par.cbq = atoi(argv[0]); |
| 2613 | |
| 2614 | return CMD_SUCCESS; |
| 2615 | } |
| 2616 | |
| 2617 | DEFUN(cfg_bts_cell_resel_ofs, cfg_bts_cell_resel_ofs_cmd, |
| 2618 | "cell reselection offset <0-126>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2619 | CELL_STR "Cell Re-Selection Parameters\n" |
| 2620 | "Cell Re-Selection Offset (CRO) in dB\n" |
| 2621 | "Cell Re-Selection Offset (CRO) in dB\n" |
| 2622 | ) |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2623 | { |
| 2624 | struct gsm_bts *bts = vty->index; |
| 2625 | |
| 2626 | bts->si_common.cell_ro_sel_par.present = 1; |
| 2627 | bts->si_common.cell_ro_sel_par.cell_resel_off = atoi(argv[0])/2; |
| 2628 | |
| 2629 | return CMD_SUCCESS; |
| 2630 | } |
| 2631 | |
| 2632 | DEFUN(cfg_bts_temp_ofs, cfg_bts_temp_ofs_cmd, |
| 2633 | "temporary offset <0-60>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2634 | "Cell selection temporary negative offset\n" |
| 2635 | "Cell selection temporary negative offset\n" |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2636 | "Cell selection temporary negative offset in dB") |
| 2637 | { |
| 2638 | struct gsm_bts *bts = vty->index; |
| 2639 | |
| 2640 | bts->si_common.cell_ro_sel_par.present = 1; |
| 2641 | bts->si_common.cell_ro_sel_par.temp_offs = atoi(argv[0])/10; |
| 2642 | |
| 2643 | return CMD_SUCCESS; |
| 2644 | } |
| 2645 | |
| 2646 | DEFUN(cfg_bts_temp_ofs_inf, cfg_bts_temp_ofs_inf_cmd, |
| 2647 | "temporary offset infinite", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2648 | "Cell selection temporary negative offset\n" |
| 2649 | "Cell selection temporary negative offset\n" |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2650 | "Sets cell selection temporary negative offset to infinity") |
| 2651 | { |
| 2652 | struct gsm_bts *bts = vty->index; |
| 2653 | |
| 2654 | bts->si_common.cell_ro_sel_par.present = 1; |
| 2655 | bts->si_common.cell_ro_sel_par.temp_offs = 7; |
| 2656 | |
| 2657 | return CMD_SUCCESS; |
| 2658 | } |
| 2659 | |
| 2660 | DEFUN(cfg_bts_penalty_time, cfg_bts_penalty_time_cmd, |
| 2661 | "penalty time <20-620>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2662 | "Cell selection penalty time\n" |
| 2663 | "Cell selection penalty time\n" |
| 2664 | "Cell selection penalty time in seconds (by 20s increments)\n") |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2665 | { |
| 2666 | struct gsm_bts *bts = vty->index; |
| 2667 | |
| 2668 | bts->si_common.cell_ro_sel_par.present = 1; |
| 2669 | bts->si_common.cell_ro_sel_par.penalty_time = (atoi(argv[0])-20)/20; |
| 2670 | |
| 2671 | return CMD_SUCCESS; |
| 2672 | } |
| 2673 | |
| 2674 | DEFUN(cfg_bts_penalty_time_rsvd, cfg_bts_penalty_time_rsvd_cmd, |
| 2675 | "penalty time reserved", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2676 | "Cell selection penalty time\n" |
| 2677 | "Cell selection penalty time\n" |
| 2678 | "Set cell selection penalty time to reserved value 31, " |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2679 | "(indicate that CELL_RESELECT_OFFSET is subtracted from C2 " |
| 2680 | "and TEMPORARY_OFFSET is ignored)") |
| 2681 | { |
| 2682 | struct gsm_bts *bts = vty->index; |
| 2683 | |
| 2684 | bts->si_common.cell_ro_sel_par.present = 1; |
| 2685 | bts->si_common.cell_ro_sel_par.penalty_time = 31; |
| 2686 | |
| 2687 | return CMD_SUCCESS; |
| 2688 | } |
| 2689 | |
Andreas Eversberg | 4d4944a | 2013-03-10 11:49:35 +0100 | [diff] [blame] | 2690 | DEFUN(cfg_bts_radio_link_timeout, cfg_bts_radio_link_timeout_cmd, |
| 2691 | "radio-link-timeout <4-64>", |
| 2692 | "Radio link timeout criterion (BTS side)\n" |
| 2693 | "Radio link timeout value (lost SACCH block)\n") |
| 2694 | { |
| 2695 | struct gsm_bts *bts = vty->index; |
| 2696 | |
Harald Welte | 2f8b9d2 | 2017-06-18 11:12:13 +0300 | [diff] [blame] | 2697 | gsm_bts_set_radio_link_timeout(bts, atoi(argv[0])); |
| 2698 | |
| 2699 | return CMD_SUCCESS; |
| 2700 | } |
| 2701 | |
| 2702 | DEFUN(cfg_bts_radio_link_timeout_inf, cfg_bts_radio_link_timeout_inf_cmd, |
| 2703 | "radio-link-timeout infinite", |
| 2704 | "Radio link timeout criterion (BTS side)\n" |
| 2705 | "Infinite Radio link timeout value (use only for BTS RF testing)\n") |
| 2706 | { |
| 2707 | struct gsm_bts *bts = vty->index; |
| 2708 | |
| 2709 | if (bts->type != GSM_BTS_TYPE_OSMOBTS) { |
| 2710 | vty_out(vty, "%% infinite radio link timeout not supported by this BTS%s", VTY_NEWLINE); |
| 2711 | return CMD_WARNING; |
| 2712 | } |
| 2713 | |
| 2714 | vty_out(vty, "%% INFINITE RADIO LINK TIMEOUT, USE ONLY FOR BTS RF TESTING%s", VTY_NEWLINE); |
| 2715 | gsm_bts_set_radio_link_timeout(bts, -1); |
Andreas Eversberg | 4d4944a | 2013-03-10 11:49:35 +0100 | [diff] [blame] | 2716 | |
Holger Hans Peter Freyther | c63f6f1 | 2013-07-27 21:07:57 +0200 | [diff] [blame] | 2717 | return CMD_SUCCESS; |
| 2718 | } |
| 2719 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2720 | #define GPRS_TEXT "GPRS Packet Network\n" |
| 2721 | |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2722 | DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd, |
Harald Welte | 57ba7e3 | 2010-04-18 14:00:26 +0200 | [diff] [blame] | 2723 | "gprs cell bvci <2-65535>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2724 | GPRS_TEXT |
| 2725 | "GPRS Cell Settings\n" |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2726 | "GPRS BSSGP VC Identifier\n" |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2727 | "GPRS BSSGP VC Identifier") |
| 2728 | { |
Pau Espin Pedrol | 8c209c9 | 2017-11-28 15:05:08 +0100 | [diff] [blame] | 2729 | /* ETSI TS 101 343: values 0 and 1 are reserved for signalling and PTM */ |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2730 | struct gsm_bts *bts = vty->index; |
| 2731 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2732 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Max | 413846e | 2019-01-14 11:08:35 +0100 | [diff] [blame] | 2733 | vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE); |
Harald Welte | 9403670 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2734 | return CMD_WARNING; |
| 2735 | } |
| 2736 | |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2737 | bts->gprs.cell.bvci = atoi(argv[0]); |
| 2738 | |
| 2739 | return CMD_SUCCESS; |
| 2740 | } |
| 2741 | |
Harald Welte | a5731cf | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 2742 | DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd, |
| 2743 | "gprs nsei <0-65535>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2744 | GPRS_TEXT |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2745 | "GPRS NS Entity Identifier\n" |
Harald Welte | a5731cf | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 2746 | "GPRS NS Entity Identifier") |
| 2747 | { |
| 2748 | struct gsm_bts *bts = vty->index; |
| 2749 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2750 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Max | 413846e | 2019-01-14 11:08:35 +0100 | [diff] [blame] | 2751 | vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE); |
Harald Welte | a5731cf | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 2752 | return CMD_WARNING; |
| 2753 | } |
| 2754 | |
| 2755 | bts->gprs.nse.nsei = atoi(argv[0]); |
| 2756 | |
| 2757 | return CMD_SUCCESS; |
| 2758 | } |
| 2759 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2760 | #define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \ |
| 2761 | "NSVC Logical Number\n" |
Harald Welte | a5731cf | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 2762 | |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2763 | DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd, |
| 2764 | "gprs nsvc <0-1> nsvci <0-65535>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2765 | GPRS_TEXT NSVC_TEXT |
| 2766 | "NS Virtual Connection Identifier\n" |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2767 | "GPRS NS VC Identifier") |
| 2768 | { |
| 2769 | struct gsm_bts *bts = vty->index; |
| 2770 | int idx = atoi(argv[0]); |
| 2771 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2772 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Max | 413846e | 2019-01-14 11:08:35 +0100 | [diff] [blame] | 2773 | vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE); |
Harald Welte | 9403670 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2774 | return CMD_WARNING; |
| 2775 | } |
| 2776 | |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2777 | bts->gprs.nsvc[idx].nsvci = atoi(argv[1]); |
| 2778 | |
| 2779 | return CMD_SUCCESS; |
| 2780 | } |
| 2781 | |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2782 | DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd, |
| 2783 | "gprs nsvc <0-1> local udp port <0-65535>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2784 | GPRS_TEXT NSVC_TEXT |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2785 | "GPRS NS Local UDP Port\n" |
| 2786 | "GPRS NS Local UDP Port\n" |
| 2787 | "GPRS NS Local UDP Port\n" |
Harald Welte | 13fe219 | 2012-08-17 09:57:25 +0200 | [diff] [blame] | 2788 | "GPRS NS Local UDP Port Number\n") |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2789 | { |
| 2790 | struct gsm_bts *bts = vty->index; |
| 2791 | int idx = atoi(argv[0]); |
| 2792 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2793 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Max | 413846e | 2019-01-14 11:08:35 +0100 | [diff] [blame] | 2794 | vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE); |
Harald Welte | 9403670 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2795 | return CMD_WARNING; |
| 2796 | } |
| 2797 | |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2798 | bts->gprs.nsvc[idx].local_port = atoi(argv[1]); |
| 2799 | |
| 2800 | return CMD_SUCCESS; |
| 2801 | } |
| 2802 | |
| 2803 | DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd, |
| 2804 | "gprs nsvc <0-1> remote udp port <0-65535>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2805 | GPRS_TEXT NSVC_TEXT |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2806 | "GPRS NS Remote UDP Port\n" |
| 2807 | "GPRS NS Remote UDP Port\n" |
Harald Welte | 13fe219 | 2012-08-17 09:57:25 +0200 | [diff] [blame] | 2808 | "GPRS NS Remote UDP Port\n" |
| 2809 | "GPRS NS Remote UDP Port Number\n") |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2810 | { |
| 2811 | struct gsm_bts *bts = vty->index; |
| 2812 | int idx = atoi(argv[0]); |
| 2813 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2814 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Max | 413846e | 2019-01-14 11:08:35 +0100 | [diff] [blame] | 2815 | vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE); |
Harald Welte | 9403670 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2816 | return CMD_WARNING; |
| 2817 | } |
| 2818 | |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2819 | bts->gprs.nsvc[idx].remote_port = atoi(argv[1]); |
| 2820 | |
| 2821 | return CMD_SUCCESS; |
| 2822 | } |
| 2823 | |
| 2824 | DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd, |
| 2825 | "gprs nsvc <0-1> remote ip A.B.C.D", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2826 | GPRS_TEXT NSVC_TEXT |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2827 | "GPRS NS Remote IP Address\n" |
| 2828 | "GPRS NS Remote IP Address\n" |
| 2829 | "GPRS NS Remote IP Address\n") |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2830 | { |
| 2831 | struct gsm_bts *bts = vty->index; |
| 2832 | int idx = atoi(argv[0]); |
| 2833 | struct in_addr ia; |
| 2834 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2835 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Max | 413846e | 2019-01-14 11:08:35 +0100 | [diff] [blame] | 2836 | vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE); |
Harald Welte | 9403670 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2837 | return CMD_WARNING; |
| 2838 | } |
| 2839 | |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2840 | inet_aton(argv[1], &ia); |
| 2841 | bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr); |
| 2842 | |
| 2843 | return CMD_SUCCESS; |
| 2844 | } |
| 2845 | |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 2846 | DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd, |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2847 | "paging free <-1-1024>", |
| 2848 | "Paging options\n" |
| 2849 | "Only page when having a certain amount of free slots\n" |
| 2850 | "amount of required free paging slots. -1 to disable\n") |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 2851 | { |
| 2852 | struct gsm_bts *bts = vty->index; |
| 2853 | |
| 2854 | bts->paging.free_chans_need = atoi(argv[0]); |
| 2855 | return CMD_SUCCESS; |
| 2856 | } |
| 2857 | |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 2858 | DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd, |
| 2859 | "gprs ns timer " NS_TIMERS " <0-255>", |
| 2860 | GPRS_TEXT "Network Service\n" |
| 2861 | "Network Service Timer\n" |
| 2862 | NS_TIMERS_HELP "Timer Value\n") |
| 2863 | { |
| 2864 | struct gsm_bts *bts = vty->index; |
| 2865 | int idx = get_string_value(gprs_ns_timer_strs, argv[0]); |
| 2866 | int val = atoi(argv[1]); |
| 2867 | |
| 2868 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Max | 413846e | 2019-01-14 11:08:35 +0100 | [diff] [blame] | 2869 | vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE); |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 2870 | return CMD_WARNING; |
| 2871 | } |
| 2872 | |
| 2873 | if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer)) |
| 2874 | return CMD_WARNING; |
| 2875 | |
| 2876 | bts->gprs.nse.timer[idx] = val; |
| 2877 | |
| 2878 | return CMD_SUCCESS; |
| 2879 | } |
| 2880 | |
| 2881 | #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 | 2832606 | 2010-05-14 20:05:17 +0200 | [diff] [blame] | 2882 | #define BSSGP_TIMERS_HELP \ |
| 2883 | "Tbvc-block timeout\n" \ |
| 2884 | "Tbvc-block retries\n" \ |
| 2885 | "Tbvc-unblock retries\n" \ |
| 2886 | "Tbvcc-reset timeout\n" \ |
| 2887 | "Tbvc-reset retries\n" \ |
| 2888 | "Tbvc-suspend timeout\n" \ |
| 2889 | "Tbvc-suspend retries\n" \ |
| 2890 | "Tbvc-resume timeout\n" \ |
| 2891 | "Tbvc-resume retries\n" \ |
| 2892 | "Tbvc-capa-update timeout\n" \ |
| 2893 | "Tbvc-capa-update retries\n" |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 2894 | |
| 2895 | DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd, |
| 2896 | "gprs cell timer " BSSGP_TIMERS " <0-255>", |
| 2897 | GPRS_TEXT "Cell / BSSGP\n" |
| 2898 | "Cell/BSSGP Timer\n" |
| 2899 | BSSGP_TIMERS_HELP "Timer Value\n") |
| 2900 | { |
| 2901 | struct gsm_bts *bts = vty->index; |
| 2902 | int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]); |
| 2903 | int val = atoi(argv[1]); |
| 2904 | |
| 2905 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Max | 413846e | 2019-01-14 11:08:35 +0100 | [diff] [blame] | 2906 | vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE); |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 2907 | return CMD_WARNING; |
| 2908 | } |
| 2909 | |
| 2910 | if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer)) |
| 2911 | return CMD_WARNING; |
| 2912 | |
| 2913 | bts->gprs.cell.timer[idx] = val; |
| 2914 | |
| 2915 | return CMD_SUCCESS; |
| 2916 | } |
| 2917 | |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2918 | DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd, |
| 2919 | "gprs routing area <0-255>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2920 | GPRS_TEXT |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2921 | "GPRS Routing Area Code\n" |
| 2922 | "GPRS Routing Area Code\n" |
| 2923 | "GPRS Routing Area Code\n") |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2924 | { |
| 2925 | struct gsm_bts *bts = vty->index; |
| 2926 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2927 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Max | 413846e | 2019-01-14 11:08:35 +0100 | [diff] [blame] | 2928 | vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE); |
Harald Welte | 9403670 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2929 | return CMD_WARNING; |
| 2930 | } |
| 2931 | |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2932 | bts->gprs.rac = atoi(argv[0]); |
| 2933 | |
| 2934 | return CMD_SUCCESS; |
| 2935 | } |
| 2936 | |
Max | 292ec58 | 2016-07-28 11:55:37 +0200 | [diff] [blame] | 2937 | DEFUN(cfg_bts_gprs_ctrl_ack, cfg_bts_gprs_ctrl_ack_cmd, |
| 2938 | "gprs control-ack-type-rach", GPRS_TEXT |
| 2939 | "Set GPRS Control Ack Type for PACKET CONTROL ACKNOWLEDGMENT message to " |
| 2940 | "four access bursts format instead of default RLC/MAC control block\n") |
| 2941 | { |
| 2942 | struct gsm_bts *bts = vty->index; |
| 2943 | |
| 2944 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Max | 413846e | 2019-01-14 11:08:35 +0100 | [diff] [blame] | 2945 | vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE); |
Max | 292ec58 | 2016-07-28 11:55:37 +0200 | [diff] [blame] | 2946 | return CMD_WARNING; |
| 2947 | } |
| 2948 | |
| 2949 | bts->gprs.ctrl_ack_type_use_block = false; |
| 2950 | |
| 2951 | return CMD_SUCCESS; |
| 2952 | } |
| 2953 | |
| 2954 | DEFUN(cfg_no_bts_gprs_ctrl_ack, cfg_no_bts_gprs_ctrl_ack_cmd, |
| 2955 | "no gprs control-ack-type-rach", NO_STR GPRS_TEXT |
| 2956 | "Set GPRS Control Ack Type for PACKET CONTROL ACKNOWLEDGMENT message to " |
| 2957 | "four access bursts format instead of default RLC/MAC control block\n") |
| 2958 | { |
| 2959 | struct gsm_bts *bts = vty->index; |
| 2960 | |
| 2961 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Max | 413846e | 2019-01-14 11:08:35 +0100 | [diff] [blame] | 2962 | vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE); |
Max | 292ec58 | 2016-07-28 11:55:37 +0200 | [diff] [blame] | 2963 | return CMD_WARNING; |
| 2964 | } |
| 2965 | |
| 2966 | bts->gprs.ctrl_ack_type_use_block = true; |
| 2967 | |
| 2968 | return CMD_SUCCESS; |
| 2969 | } |
| 2970 | |
Andreas Eversberg | 0c8f9ca | 2013-03-16 16:31:26 +0100 | [diff] [blame] | 2971 | DEFUN(cfg_bts_gprs_net_ctrl_ord, cfg_bts_gprs_net_ctrl_ord_cmd, |
| 2972 | "gprs network-control-order (nc0|nc1|nc2)", |
| 2973 | GPRS_TEXT |
| 2974 | "GPRS Network Control Order\n" |
| 2975 | "MS controlled cell re-selection, no measurement reporting\n" |
| 2976 | "MS controlled cell re-selection, MS sends measurement reports\n" |
| 2977 | "Network controlled cell re-selection, MS sends measurement reports\n") |
| 2978 | { |
| 2979 | struct gsm_bts *bts = vty->index; |
| 2980 | |
| 2981 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Max | 413846e | 2019-01-14 11:08:35 +0100 | [diff] [blame] | 2982 | vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE); |
Andreas Eversberg | 0c8f9ca | 2013-03-16 16:31:26 +0100 | [diff] [blame] | 2983 | return CMD_WARNING; |
| 2984 | } |
| 2985 | |
| 2986 | bts->gprs.net_ctrl_ord = atoi(argv[0] + 2); |
| 2987 | |
| 2988 | return CMD_SUCCESS; |
| 2989 | } |
| 2990 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2991 | DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd, |
| 2992 | "gprs mode (none|gprs|egprs)", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2993 | GPRS_TEXT |
| 2994 | "GPRS Mode for this BTS\n" |
| 2995 | "GPRS Disabled on this BTS\n" |
| 2996 | "GPRS Enabled on this BTS\n" |
| 2997 | "EGPRS (EDGE) Enabled on this BTS\n") |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2998 | { |
| 2999 | struct gsm_bts *bts = vty->index; |
Holger Hans Peter Freyther | 4e13a8f | 2015-01-31 22:16:00 +0100 | [diff] [blame] | 3000 | enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0], NULL); |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 3001 | |
Holger Hans Peter Freyther | 4e13a8f | 2015-01-31 22:16:00 +0100 | [diff] [blame] | 3002 | if (!bts_gprs_mode_is_compat(bts, mode)) { |
Harald Welte | f3d8e92 | 2010-06-14 22:44:42 +0200 | [diff] [blame] | 3003 | vty_out(vty, "This BTS type does not support %s%s", argv[0], |
| 3004 | VTY_NEWLINE); |
| 3005 | return CMD_WARNING; |
| 3006 | } |
| 3007 | |
| 3008 | bts->gprs.mode = mode; |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 3009 | |
| 3010 | return CMD_SUCCESS; |
| 3011 | } |
| 3012 | |
bhargava | 350533c | 2016-07-21 11:14:34 +0530 | [diff] [blame] | 3013 | DEFUN(cfg_bts_gprs_11bit_rach_support_for_egprs, |
| 3014 | cfg_bts_gprs_11bit_rach_support_for_egprs_cmd, |
| 3015 | "gprs 11bit_rach_support_for_egprs (0|1)", |
| 3016 | GPRS_TEXT "11 bit RACH options\n" |
| 3017 | "Disable 11 bit RACH for EGPRS\n" |
| 3018 | "Enable 11 bit RACH for EGPRS") |
| 3019 | { |
| 3020 | struct gsm_bts *bts = vty->index; |
| 3021 | |
| 3022 | bts->gprs.supports_egprs_11bit_rach = atoi(argv[0]); |
| 3023 | |
| 3024 | if (bts->gprs.supports_egprs_11bit_rach > 1) { |
| 3025 | vty_out(vty, "Error in RACH type%s", VTY_NEWLINE); |
| 3026 | return CMD_WARNING; |
| 3027 | } |
| 3028 | |
| 3029 | if ((bts->gprs.mode == BTS_GPRS_NONE) && |
| 3030 | (bts->gprs.supports_egprs_11bit_rach == 1)) { |
| 3031 | vty_out(vty, "Error:gprs mode is none and 11bit rach is" |
| 3032 | " enabled%s", VTY_NEWLINE); |
| 3033 | return CMD_WARNING; |
| 3034 | } |
| 3035 | |
| 3036 | return CMD_SUCCESS; |
| 3037 | } |
| 3038 | |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 3039 | #define SI_TEXT "System Information Messages\n" |
| 3040 | #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)" |
| 3041 | #define SI_TYPE_HELP "System Information Type 1\n" \ |
| 3042 | "System Information Type 2\n" \ |
| 3043 | "System Information Type 3\n" \ |
| 3044 | "System Information Type 4\n" \ |
| 3045 | "System Information Type 5\n" \ |
| 3046 | "System Information Type 6\n" \ |
| 3047 | "System Information Type 7\n" \ |
| 3048 | "System Information Type 8\n" \ |
| 3049 | "System Information Type 9\n" \ |
| 3050 | "System Information Type 10\n" \ |
| 3051 | "System Information Type 13\n" \ |
| 3052 | "System Information Type 16\n" \ |
| 3053 | "System Information Type 17\n" \ |
| 3054 | "System Information Type 18\n" \ |
| 3055 | "System Information Type 19\n" \ |
| 3056 | "System Information Type 20\n" \ |
| 3057 | "System Information Type 2bis\n" \ |
| 3058 | "System Information Type 2ter\n" \ |
| 3059 | "System Information Type 2quater\n" \ |
| 3060 | "System Information Type 5bis\n" \ |
| 3061 | "System Information Type 5ter\n" |
| 3062 | |
| 3063 | DEFUN(cfg_bts_si_mode, cfg_bts_si_mode_cmd, |
| 3064 | "system-information " SI_TYPE_TEXT " mode (static|computed)", |
| 3065 | SI_TEXT SI_TYPE_HELP |
| 3066 | "System Information Mode\n" |
| 3067 | "Static user-specified\n" |
| 3068 | "Dynamic, BSC-computed\n") |
| 3069 | { |
| 3070 | struct gsm_bts *bts = vty->index; |
| 3071 | int type; |
| 3072 | |
| 3073 | type = get_string_value(osmo_sitype_strs, argv[0]); |
| 3074 | if (type < 0) { |
| 3075 | vty_out(vty, "Error SI Type%s", VTY_NEWLINE); |
| 3076 | return CMD_WARNING; |
| 3077 | } |
| 3078 | |
| 3079 | if (!strcmp(argv[1], "static")) |
| 3080 | bts->si_mode_static |= (1 << type); |
| 3081 | else |
| 3082 | bts->si_mode_static &= ~(1 << type); |
| 3083 | |
| 3084 | return CMD_SUCCESS; |
| 3085 | } |
| 3086 | |
| 3087 | DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd, |
| 3088 | "system-information " SI_TYPE_TEXT " static HEXSTRING", |
| 3089 | SI_TEXT SI_TYPE_HELP |
| 3090 | "Static System Information filling\n" |
| 3091 | "Static user-specified SI content in HEX notation\n") |
| 3092 | { |
| 3093 | struct gsm_bts *bts = vty->index; |
| 3094 | int rc, type; |
| 3095 | |
| 3096 | type = get_string_value(osmo_sitype_strs, argv[0]); |
| 3097 | if (type < 0) { |
| 3098 | vty_out(vty, "Error SI Type%s", VTY_NEWLINE); |
| 3099 | return CMD_WARNING; |
| 3100 | } |
| 3101 | |
| 3102 | if (!(bts->si_mode_static & (1 << type))) { |
| 3103 | vty_out(vty, "SI Type %s is not configured in static mode%s", |
| 3104 | get_value_string(osmo_sitype_strs, type), VTY_NEWLINE); |
| 3105 | return CMD_WARNING; |
| 3106 | } |
| 3107 | |
Harald Welte | 290aaed | 2010-07-30 11:53:18 +0200 | [diff] [blame] | 3108 | /* Fill buffer with padding pattern */ |
Max | 6f0e50c | 2017-04-12 15:30:54 +0200 | [diff] [blame] | 3109 | memset(GSM_BTS_SI(bts, type), 0x2b, GSM_MACBLOCK_LEN); |
Harald Welte | 290aaed | 2010-07-30 11:53:18 +0200 | [diff] [blame] | 3110 | |
| 3111 | /* Parse the user-specified SI in hex format, [partially] overwriting padding */ |
Max | 6f0e50c | 2017-04-12 15:30:54 +0200 | [diff] [blame] | 3112 | rc = osmo_hexparse(argv[1], GSM_BTS_SI(bts, type), GSM_MACBLOCK_LEN); |
| 3113 | if (rc < 0 || rc > GSM_MACBLOCK_LEN) { |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 3114 | vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE); |
| 3115 | return CMD_WARNING; |
| 3116 | } |
| 3117 | |
| 3118 | /* Mark this SI as present */ |
| 3119 | bts->si_valid |= (1 << type); |
| 3120 | |
| 3121 | return CMD_SUCCESS; |
| 3122 | } |
| 3123 | |
Pau Espin Pedrol | 1cf21de | 2018-12-05 13:38:10 +0100 | [diff] [blame] | 3124 | DEFUN(cfg_bts_si_unused_send_empty, cfg_bts_si_unused_send_empty_cmd, |
| 3125 | "system-information unused-send-empty", |
| 3126 | SI_TEXT |
| 3127 | "Send BCCH Info with empty 'Full BCCH Info' TLV to notify disabled SI. " |
| 3128 | "Some nanoBTS fw versions are known to fail upon receival of these messages.\n") |
| 3129 | { |
| 3130 | struct gsm_bts *bts = vty->index; |
| 3131 | |
| 3132 | bts->si_unused_send_empty = true; |
| 3133 | |
| 3134 | return CMD_SUCCESS; |
| 3135 | } |
| 3136 | |
| 3137 | DEFUN(cfg_bts_no_si_unused_send_empty, cfg_bts_no_si_unused_send_empty_cmd, |
| 3138 | "no system-information unused-send-empty", |
| 3139 | NO_STR SI_TEXT |
| 3140 | "Avoid sending BCCH Info with empty 'Full BCCH Info' TLV to notify disabled SI. " |
| 3141 | "Some nanoBTS fw versions are known to fail upon receival of these messages.\n") |
| 3142 | { |
| 3143 | struct gsm_bts *bts = vty->index; |
| 3144 | |
| 3145 | if (!is_ipaccess_bts(bts) || is_sysmobts_v2(bts)) { |
| 3146 | vty_out(vty, "This command is only intended for ipaccess nanoBTS. See OS#3707.%s", |
| 3147 | VTY_NEWLINE); |
| 3148 | return CMD_WARNING; |
| 3149 | } |
| 3150 | |
| 3151 | bts->si_unused_send_empty = false; |
| 3152 | |
| 3153 | return CMD_SUCCESS; |
| 3154 | } |
| 3155 | |
Harald Welte | 42def72 | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 3156 | DEFUN(cfg_bts_early_cm, cfg_bts_early_cm_cmd, |
| 3157 | "early-classmark-sending (allowed|forbidden)", |
| 3158 | "Early Classmark Sending\n" |
| 3159 | "Early Classmark Sending is allowed\n" |
| 3160 | "Early Classmark Sending is forbidden\n") |
| 3161 | { |
| 3162 | struct gsm_bts *bts = vty->index; |
Harald Welte | 42def72 | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 3163 | |
| 3164 | if (!strcmp(argv[0], "allowed")) |
| 3165 | bts->early_classmark_allowed = true; |
| 3166 | else |
| 3167 | bts->early_classmark_allowed = false; |
| 3168 | |
| 3169 | return CMD_SUCCESS; |
| 3170 | } |
| 3171 | |
Pau Espin Pedrol | e8dda5f | 2017-11-23 19:06:09 +0100 | [diff] [blame] | 3172 | DEFUN(cfg_bts_early_cm_3g, cfg_bts_early_cm_3g_cmd, |
| 3173 | "early-classmark-sending-3g (allowed|forbidden)", |
| 3174 | "3G Early Classmark Sending\n" |
| 3175 | "3G Early Classmark Sending is allowed\n" |
| 3176 | "3G Early Classmark Sending is forbidden\n") |
| 3177 | { |
| 3178 | struct gsm_bts *bts = vty->index; |
| 3179 | |
| 3180 | if (!strcmp(argv[0], "allowed")) |
| 3181 | bts->early_classmark_allowed_3g = true; |
| 3182 | else |
| 3183 | bts->early_classmark_allowed_3g = false; |
| 3184 | |
| 3185 | return CMD_SUCCESS; |
| 3186 | } |
| 3187 | |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 3188 | DEFUN(cfg_bts_neigh_mode, cfg_bts_neigh_mode_cmd, |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 3189 | "neighbor-list mode (automatic|manual|manual-si5)", |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 3190 | "Neighbor List\n" "Mode of Neighbor List generation\n" |
Daniel Willmann | 2dcdf44 | 2019-04-15 16:50:46 +0200 | [diff] [blame] | 3191 | "Automatically from all BTS in this BSC\n" "Manual\n" |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 3192 | "Manual with different lists for SI2 and SI5\n") |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 3193 | { |
| 3194 | struct gsm_bts *bts = vty->index; |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 3195 | int mode = get_string_value(bts_neigh_mode_strs, argv[0]); |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 3196 | |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 3197 | switch (mode) { |
| 3198 | case NL_MODE_MANUAL_SI5SEP: |
| 3199 | case NL_MODE_MANUAL: |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 3200 | /* make sure we clear the current list when switching to |
| 3201 | * manual mode */ |
| 3202 | if (bts->neigh_list_manual_mode == 0) |
| 3203 | memset(&bts->si_common.data.neigh_list, 0, |
| 3204 | sizeof(bts->si_common.data.neigh_list)); |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 3205 | break; |
| 3206 | default: |
| 3207 | break; |
| 3208 | } |
| 3209 | |
| 3210 | bts->neigh_list_manual_mode = mode; |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 3211 | |
| 3212 | return CMD_SUCCESS; |
| 3213 | } |
| 3214 | |
| 3215 | DEFUN(cfg_bts_neigh, cfg_bts_neigh_cmd, |
Harald Welte | 1fe73a1 | 2012-01-29 13:24:12 +0100 | [diff] [blame] | 3216 | "neighbor-list (add|del) arfcn <0-1023>", |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 3217 | "Neighbor List\n" "Add to manual neighbor list\n" |
| 3218 | "Delete from manual neighbor list\n" "ARFCN of neighbor\n" |
| 3219 | "ARFCN of neighbor\n") |
| 3220 | { |
| 3221 | struct gsm_bts *bts = vty->index; |
| 3222 | struct bitvec *bv = &bts->si_common.neigh_list; |
| 3223 | uint16_t arfcn = atoi(argv[1]); |
Pau Espin Pedrol | 33ca613 | 2018-11-16 14:12:31 +0100 | [diff] [blame] | 3224 | enum gsm_band unused; |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 3225 | |
Pau Espin Pedrol | f1e31ca | 2018-11-15 12:56:36 +0100 | [diff] [blame] | 3226 | if (bts->neigh_list_manual_mode == NL_MODE_AUTOMATIC) { |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 3227 | vty_out(vty, "%% Cannot configure neighbor list in " |
| 3228 | "automatic mode%s", VTY_NEWLINE); |
| 3229 | return CMD_WARNING; |
| 3230 | } |
| 3231 | |
Pau Espin Pedrol | 33ca613 | 2018-11-16 14:12:31 +0100 | [diff] [blame] | 3232 | if (gsm_arfcn2band_rc(arfcn, &unused) < 0) { |
| 3233 | vty_out(vty, "%% Invalid arfcn %" PRIu16 " detected%s", arfcn, VTY_NEWLINE); |
| 3234 | return CMD_WARNING; |
| 3235 | } |
| 3236 | |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 3237 | if (!strcmp(argv[0], "add")) |
| 3238 | bitvec_set_bit_pos(bv, arfcn, 1); |
| 3239 | else |
| 3240 | bitvec_set_bit_pos(bv, arfcn, 0); |
| 3241 | |
| 3242 | return CMD_SUCCESS; |
| 3243 | } |
| 3244 | |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 3245 | /* help text should be kept in sync with EARFCN_*_INVALID defines */ |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 3246 | DEFUN(cfg_bts_si2quater_neigh_add, cfg_bts_si2quater_neigh_add_cmd, |
Max | 2c16bee | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 3247 | "si2quater neighbor-list add earfcn <0-65535> thresh-hi <0-31> " |
| 3248 | "thresh-lo <0-32> prio <0-8> qrxlv <0-32> meas <0-8>", |
| 3249 | "SI2quater Neighbor List\n" "SI2quater Neighbor List\n" |
| 3250 | "Add to manual SI2quater neighbor list\n" |
| 3251 | "EARFCN of neighbor\n" "EARFCN of neighbor\n" |
| 3252 | "threshold high bits\n" "threshold high bits\n" |
| 3253 | "threshold low bits\n" "threshold low bits (32 means NA)\n" |
| 3254 | "priority\n" "priority (8 means NA)\n" |
| 3255 | "QRXLEVMIN\n" "QRXLEVMIN (32 means NA)\n" |
| 3256 | "measurement bandwidth\n" "measurement bandwidth (8 means NA)\n") |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 3257 | { |
| 3258 | struct gsm_bts *bts = vty->index; |
| 3259 | struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list; |
| 3260 | uint16_t arfcn = atoi(argv[0]); |
Max | 2c16bee | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 3261 | uint8_t thresh_hi = atoi(argv[1]), thresh_lo = atoi(argv[2]), |
| 3262 | prio = atoi(argv[3]), qrx = atoi(argv[4]), meas = atoi(argv[5]); |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 3263 | int r = bts_earfcn_add(bts, arfcn, thresh_hi, thresh_lo, prio, qrx, meas); |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 3264 | |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 3265 | switch (r) { |
| 3266 | case 1: |
| 3267 | vty_out(vty, "Warning: multiple threshold-high are not supported, overriding with %u%s", |
| 3268 | thresh_hi, VTY_NEWLINE); |
| 3269 | break; |
| 3270 | case EARFCN_THRESH_LOW_INVALID: |
| 3271 | vty_out(vty, "Warning: multiple threshold-low are not supported, overriding with %u%s", |
| 3272 | thresh_lo, VTY_NEWLINE); |
| 3273 | break; |
| 3274 | case EARFCN_QRXLV_INVALID + 1: |
| 3275 | vty_out(vty, "Warning: multiple QRXLEVMIN are not supported, overriding with %u%s", |
| 3276 | qrx, VTY_NEWLINE); |
| 3277 | break; |
| 3278 | case EARFCN_PRIO_INVALID: |
| 3279 | vty_out(vty, "Warning: multiple priorities are not supported, overriding with %u%s", |
| 3280 | prio, VTY_NEWLINE); |
| 3281 | break; |
| 3282 | default: |
| 3283 | if (r < 0) { |
| 3284 | vty_out(vty, "Unable to add ARFCN %u: %s%s", arfcn, strerror(-r), VTY_NEWLINE); |
| 3285 | return CMD_WARNING; |
| 3286 | } |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 3287 | } |
| 3288 | |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 3289 | if (si2q_num(bts) <= SI2Q_MAX_NUM) |
Max | 2c16bee | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 3290 | return CMD_SUCCESS; |
| 3291 | |
Max | f39d03a | 2017-05-12 17:00:30 +0200 | [diff] [blame] | 3292 | vty_out(vty, "Warning: not enough space in SI2quater (%u/%u used) for a given EARFCN %u%s", |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 3293 | bts->si2q_count, SI2Q_MAX_NUM, arfcn, VTY_NEWLINE); |
Max | aafff96 | 2016-04-20 15:57:14 +0200 | [diff] [blame] | 3294 | osmo_earfcn_del(e, arfcn); |
Max | 2c16bee | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 3295 | |
Max | aafff96 | 2016-04-20 15:57:14 +0200 | [diff] [blame] | 3296 | return CMD_WARNING; |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 3297 | } |
| 3298 | |
| 3299 | DEFUN(cfg_bts_si2quater_neigh_del, cfg_bts_si2quater_neigh_del_cmd, |
Max | 35697b9 | 2016-04-29 12:51:31 +0200 | [diff] [blame] | 3300 | "si2quater neighbor-list del earfcn <0-65535>", |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 3301 | "SI2quater Neighbor List\n" |
| 3302 | "SI2quater Neighbor List\n" |
| 3303 | "Delete from SI2quater manual neighbor list\n" |
Max | 36212f2 | 2016-04-20 12:06:05 +0200 | [diff] [blame] | 3304 | "EARFCN of neighbor\n" |
| 3305 | "EARFCN\n") |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 3306 | { |
| 3307 | struct gsm_bts *bts = vty->index; |
| 3308 | struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list; |
Max | 0c1bc26 | 2016-04-20 12:06:06 +0200 | [diff] [blame] | 3309 | uint16_t arfcn = atoi(argv[0]); |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 3310 | int r = osmo_earfcn_del(e, arfcn); |
| 3311 | if (r < 0) { |
| 3312 | vty_out(vty, "Unable to delete arfcn %u: %s%s", arfcn, |
Max | 0c1bc26 | 2016-04-20 12:06:06 +0200 | [diff] [blame] | 3313 | strerror(-r), VTY_NEWLINE); |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 3314 | return CMD_WARNING; |
| 3315 | } |
| 3316 | |
| 3317 | return CMD_SUCCESS; |
| 3318 | } |
| 3319 | |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 3320 | DEFUN(cfg_bts_si2quater_uarfcn_add, cfg_bts_si2quater_uarfcn_add_cmd, |
Max | 35697b9 | 2016-04-29 12:51:31 +0200 | [diff] [blame] | 3321 | "si2quater neighbor-list add uarfcn <0-16383> <0-511> <0-1>", |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 3322 | "SI2quater Neighbor List\n" |
| 3323 | "SI2quater Neighbor List\n" "Add to manual SI2quater neighbor list\n" |
| 3324 | "UARFCN of neighbor\n" "UARFCN of neighbor\n" "scrambling code\n" |
| 3325 | "diversity bit\n") |
| 3326 | { |
| 3327 | struct gsm_bts *bts = vty->index; |
| 3328 | uint16_t arfcn = atoi(argv[0]), scramble = atoi(argv[1]); |
| 3329 | |
| 3330 | switch(bts_uarfcn_add(bts, arfcn, scramble, atoi(argv[2]))) { |
| 3331 | case -ENOMEM: |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 3332 | vty_out(vty, "Unable to add UARFCN: max number of UARFCNs (%u) reached%s", MAX_EARFCN_LIST, VTY_NEWLINE); |
Harald Welte | a191dcd | 2016-11-26 15:06:37 +0100 | [diff] [blame] | 3333 | return CMD_WARNING; |
Max | aafff96 | 2016-04-20 15:57:14 +0200 | [diff] [blame] | 3334 | case -ENOSPC: |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 3335 | vty_out(vty, "Warning: not enough space in SI2quater for a given UARFCN (%u, %u)%s", |
| 3336 | arfcn, scramble, VTY_NEWLINE); |
Harald Welte | a191dcd | 2016-11-26 15:06:37 +0100 | [diff] [blame] | 3337 | return CMD_WARNING; |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 3338 | case -EADDRINUSE: |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 3339 | vty_out(vty, "Unable to add UARFCN: (%u, %u) is already added%s", arfcn, scramble, VTY_NEWLINE); |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 3340 | return CMD_WARNING; |
| 3341 | } |
| 3342 | |
| 3343 | return CMD_SUCCESS; |
| 3344 | } |
| 3345 | |
| 3346 | DEFUN(cfg_bts_si2quater_uarfcn_del, cfg_bts_si2quater_uarfcn_del_cmd, |
Max | 35697b9 | 2016-04-29 12:51:31 +0200 | [diff] [blame] | 3347 | "si2quater neighbor-list del uarfcn <0-16383> <0-511>", |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 3348 | "SI2quater Neighbor List\n" |
| 3349 | "SI2quater Neighbor List\n" |
| 3350 | "Delete from SI2quater manual neighbor list\n" |
| 3351 | "UARFCN of neighbor\n" |
| 3352 | "UARFCN\n" |
| 3353 | "scrambling code\n") |
| 3354 | { |
| 3355 | struct gsm_bts *bts = vty->index; |
| 3356 | |
| 3357 | if (bts_uarfcn_del(bts, atoi(argv[0]), atoi(argv[1])) < 0) { |
| 3358 | vty_out(vty, "Unable to delete uarfcn: pair not found%s", |
| 3359 | VTY_NEWLINE); |
| 3360 | return CMD_WARNING; |
| 3361 | } |
| 3362 | |
| 3363 | return CMD_SUCCESS; |
| 3364 | } |
| 3365 | |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 3366 | DEFUN(cfg_bts_si5_neigh, cfg_bts_si5_neigh_cmd, |
Harald Welte | 1fe73a1 | 2012-01-29 13:24:12 +0100 | [diff] [blame] | 3367 | "si5 neighbor-list (add|del) arfcn <0-1023>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3368 | "SI5 Neighbor List\n" |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 3369 | "SI5 Neighbor List\n" "Add to manual SI5 neighbor list\n" |
| 3370 | "Delete from SI5 manual neighbor list\n" "ARFCN of neighbor\n" |
| 3371 | "ARFCN of neighbor\n") |
| 3372 | { |
Pau Espin Pedrol | 33ca613 | 2018-11-16 14:12:31 +0100 | [diff] [blame] | 3373 | enum gsm_band unused; |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 3374 | struct gsm_bts *bts = vty->index; |
| 3375 | struct bitvec *bv = &bts->si_common.si5_neigh_list; |
| 3376 | uint16_t arfcn = atoi(argv[1]); |
| 3377 | |
| 3378 | if (!bts->neigh_list_manual_mode) { |
| 3379 | vty_out(vty, "%% Cannot configure neighbor list in " |
| 3380 | "automatic mode%s", VTY_NEWLINE); |
| 3381 | return CMD_WARNING; |
| 3382 | } |
| 3383 | |
Pau Espin Pedrol | 33ca613 | 2018-11-16 14:12:31 +0100 | [diff] [blame] | 3384 | if (gsm_arfcn2band_rc(arfcn, &unused) < 0) { |
| 3385 | vty_out(vty, "%% Invalid arfcn %" PRIu16 " detected%s", arfcn, VTY_NEWLINE); |
| 3386 | return CMD_WARNING; |
| 3387 | } |
| 3388 | |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 3389 | if (!strcmp(argv[0], "add")) |
| 3390 | bitvec_set_bit_pos(bv, arfcn, 1); |
| 3391 | else |
| 3392 | bitvec_set_bit_pos(bv, arfcn, 0); |
| 3393 | |
| 3394 | return CMD_SUCCESS; |
| 3395 | } |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 3396 | |
Harald Welte | 8254cf7 | 2017-05-29 13:42:19 +0200 | [diff] [blame] | 3397 | DEFUN(cfg_bts_pcu_sock, cfg_bts_pcu_sock_cmd, |
| 3398 | "pcu-socket PATH", |
| 3399 | "PCU Socket Path for using OsmoPCU co-located with BSC (legacy BTS)\n" |
| 3400 | "Path in the file system for the unix-domain PCU socket\n") |
| 3401 | { |
| 3402 | struct gsm_bts *bts = vty->index; |
| 3403 | int rc; |
| 3404 | |
Harald Welte | 4a824ca | 2017-05-29 13:54:27 +0200 | [diff] [blame] | 3405 | osmo_talloc_replace_string(bts, &bts->pcu_sock_path, argv[0]); |
Harald Welte | 8254cf7 | 2017-05-29 13:42:19 +0200 | [diff] [blame] | 3406 | pcu_sock_exit(bts); |
| 3407 | rc = pcu_sock_init(bts->pcu_sock_path, bts); |
| 3408 | if (rc < 0) { |
| 3409 | vty_out(vty, "%% Error creating PCU socket `%s' for BTS %u%s", |
| 3410 | bts->pcu_sock_path, bts->nr, VTY_NEWLINE); |
| 3411 | return CMD_WARNING; |
| 3412 | } |
| 3413 | |
| 3414 | return CMD_SUCCESS; |
| 3415 | } |
| 3416 | |
Stefan Sperling | 6442e43 | 2018-02-06 14:44:54 +0100 | [diff] [blame] | 3417 | DEFUN(cfg_bts_acc_ramping, |
| 3418 | cfg_bts_acc_ramping_cmd, |
| 3419 | "access-control-class-ramping", |
| 3420 | "Enable Access Control Class ramping\n") |
| 3421 | { |
| 3422 | struct gsm_bts *bts = vty->index; |
| 3423 | |
Stefan Sperling | ea33341 | 2018-04-10 16:36:54 +0200 | [diff] [blame] | 3424 | if (!acc_ramp_is_enabled(&bts->acc_ramp)) |
| 3425 | acc_ramp_set_enabled(&bts->acc_ramp, true); |
Stefan Sperling | 6442e43 | 2018-02-06 14:44:54 +0100 | [diff] [blame] | 3426 | |
Stefan Sperling | 60ecdef | 2018-04-10 17:55:08 +0200 | [diff] [blame] | 3427 | /* |
| 3428 | * ACC ramping takes effect either when the BTS reconnects RSL, |
| 3429 | * or when RF administrative state changes to 'unlocked'. |
| 3430 | */ |
Stefan Sperling | 6442e43 | 2018-02-06 14:44:54 +0100 | [diff] [blame] | 3431 | return CMD_SUCCESS; |
| 3432 | } |
| 3433 | |
| 3434 | DEFUN(cfg_bts_no_acc_ramping, cfg_bts_no_acc_ramping_cmd, |
| 3435 | "no access-control-class-ramping", |
| 3436 | NO_STR |
| 3437 | "Disable Access Control Class ramping\n") |
| 3438 | { |
| 3439 | struct gsm_bts *bts = vty->index; |
| 3440 | |
| 3441 | if (acc_ramp_is_enabled(&bts->acc_ramp)) { |
| 3442 | acc_ramp_abort(&bts->acc_ramp); |
Stefan Sperling | ea33341 | 2018-04-10 16:36:54 +0200 | [diff] [blame] | 3443 | acc_ramp_set_enabled(&bts->acc_ramp, false); |
Stefan Sperling | 6442e43 | 2018-02-06 14:44:54 +0100 | [diff] [blame] | 3444 | gsm_bts_set_system_infos(bts); |
| 3445 | } |
| 3446 | |
| 3447 | return CMD_SUCCESS; |
| 3448 | } |
| 3449 | |
| 3450 | DEFUN(cfg_bts_acc_ramping_step_interval, |
| 3451 | cfg_bts_acc_ramping_step_interval_cmd, |
| 3452 | "access-control-class-ramping-step-interval (<" |
| 3453 | OSMO_STRINGIFY_VAL(ACC_RAMP_STEP_INTERVAL_MIN) "-" |
| 3454 | OSMO_STRINGIFY_VAL(ACC_RAMP_STEP_INTERVAL_MAX) ">|dynamic)", |
| 3455 | "Configure Access Control Class ramping step interval\n" |
| 3456 | "Set a fixed step interval (in seconds)\n" |
| 3457 | "Use dynamic step interval based on BTS channel load\n") |
| 3458 | { |
| 3459 | struct gsm_bts *bts = vty->index; |
| 3460 | bool dynamic = (strcmp(argv[0], "dynamic") == 0); |
| 3461 | int error; |
| 3462 | |
| 3463 | if (dynamic) { |
| 3464 | acc_ramp_set_step_interval_dynamic(&bts->acc_ramp); |
| 3465 | return CMD_SUCCESS; |
| 3466 | } |
| 3467 | |
| 3468 | error = acc_ramp_set_step_interval(&bts->acc_ramp, atoi(argv[0])); |
| 3469 | if (error != 0) { |
| 3470 | if (error == -ERANGE) |
| 3471 | vty_out(vty, "Unable to set ACC ramp step interval: value out of range%s", VTY_NEWLINE); |
| 3472 | else |
| 3473 | vty_out(vty, "Unable to set ACC ramp step interval: unknown error%s", VTY_NEWLINE); |
| 3474 | return CMD_WARNING; |
| 3475 | } |
| 3476 | |
| 3477 | return CMD_SUCCESS; |
| 3478 | } |
| 3479 | |
| 3480 | DEFUN(cfg_bts_acc_ramping_step_size, |
| 3481 | cfg_bts_acc_ramping_step_size_cmd, |
| 3482 | "access-control-class-ramping-step-size (<" |
| 3483 | OSMO_STRINGIFY_VAL(ACC_RAMP_STEP_SIZE_MIN) "-" |
| 3484 | OSMO_STRINGIFY_VAL(ACC_RAMP_STEP_SIZE_MAX) ">)", |
| 3485 | "Configure Access Control Class ramping step size\n" |
| 3486 | "Set the number of Access Control Classes to enable per ramping step\n") |
| 3487 | { |
| 3488 | struct gsm_bts *bts = vty->index; |
| 3489 | int error; |
| 3490 | |
| 3491 | error = acc_ramp_set_step_size(&bts->acc_ramp, atoi(argv[0])); |
| 3492 | if (error != 0) { |
| 3493 | if (error == -ERANGE) |
| 3494 | vty_out(vty, "Unable to set ACC ramp step size: value out of range%s", VTY_NEWLINE); |
| 3495 | else |
| 3496 | vty_out(vty, "Unable to set ACC ramp step size: unknown error%s", VTY_NEWLINE); |
| 3497 | return CMD_WARNING; |
| 3498 | } |
| 3499 | |
| 3500 | return CMD_SUCCESS; |
| 3501 | } |
| 3502 | |
Holger Hans Peter Freyther | e30d40d | 2012-07-20 10:27:31 +0200 | [diff] [blame] | 3503 | #define EXCL_RFLOCK_STR "Exclude this BTS from the global RF Lock\n" |
| 3504 | |
| 3505 | DEFUN(cfg_bts_excl_rf_lock, |
| 3506 | cfg_bts_excl_rf_lock_cmd, |
| 3507 | "rf-lock-exclude", |
| 3508 | EXCL_RFLOCK_STR) |
| 3509 | { |
| 3510 | struct gsm_bts *bts = vty->index; |
| 3511 | bts->excl_from_rf_lock = 1; |
| 3512 | return CMD_SUCCESS; |
| 3513 | } |
| 3514 | |
| 3515 | DEFUN(cfg_bts_no_excl_rf_lock, |
| 3516 | cfg_bts_no_excl_rf_lock_cmd, |
| 3517 | "no rf-lock-exclude", |
| 3518 | NO_STR EXCL_RFLOCK_STR) |
| 3519 | { |
| 3520 | struct gsm_bts *bts = vty->index; |
| 3521 | bts->excl_from_rf_lock = 0; |
| 3522 | return CMD_SUCCESS; |
| 3523 | } |
| 3524 | |
Jacob Erlbeck | 65d114f | 2014-01-16 11:02:14 +0100 | [diff] [blame] | 3525 | #define FORCE_COMB_SI_STR "Force the generation of a single SI (no ter/bis)\n" |
| 3526 | |
| 3527 | DEFUN(cfg_bts_force_comb_si, |
| 3528 | cfg_bts_force_comb_si_cmd, |
| 3529 | "force-combined-si", |
| 3530 | FORCE_COMB_SI_STR) |
| 3531 | { |
| 3532 | struct gsm_bts *bts = vty->index; |
| 3533 | bts->force_combined_si = 1; |
Pau Espin Pedrol | 167cb82 | 2018-11-19 17:48:17 +0100 | [diff] [blame] | 3534 | bts->force_combined_si_set = true; |
Jacob Erlbeck | 65d114f | 2014-01-16 11:02:14 +0100 | [diff] [blame] | 3535 | return CMD_SUCCESS; |
| 3536 | } |
| 3537 | |
| 3538 | DEFUN(cfg_bts_no_force_comb_si, |
| 3539 | cfg_bts_no_force_comb_si_cmd, |
| 3540 | "no force-combined-si", |
| 3541 | NO_STR FORCE_COMB_SI_STR) |
| 3542 | { |
| 3543 | struct gsm_bts *bts = vty->index; |
| 3544 | bts->force_combined_si = 0; |
Pau Espin Pedrol | 167cb82 | 2018-11-19 17:48:17 +0100 | [diff] [blame] | 3545 | bts->force_combined_si_set = true; |
Jacob Erlbeck | 65d114f | 2014-01-16 11:02:14 +0100 | [diff] [blame] | 3546 | return CMD_SUCCESS; |
| 3547 | } |
| 3548 | |
Andreas Eversberg | a83d511 | 2013-12-07 18:32:28 +0100 | [diff] [blame] | 3549 | static void _get_codec_from_arg(struct vty *vty, int argc, const char *argv[]) |
| 3550 | { |
| 3551 | struct gsm_bts *bts = vty->index; |
| 3552 | struct bts_codec_conf *codec = &bts->codec; |
| 3553 | int i; |
| 3554 | |
| 3555 | codec->hr = 0; |
| 3556 | codec->efr = 0; |
| 3557 | codec->amr = 0; |
| 3558 | for (i = 0; i < argc; i++) { |
| 3559 | if (!strcmp(argv[i], "hr")) |
| 3560 | codec->hr = 1; |
| 3561 | if (!strcmp(argv[i], "efr")) |
| 3562 | codec->efr = 1; |
| 3563 | if (!strcmp(argv[i], "amr")) |
| 3564 | codec->amr = 1; |
| 3565 | } |
| 3566 | } |
| 3567 | |
| 3568 | #define CODEC_PAR_STR " (hr|efr|amr)" |
| 3569 | #define CODEC_HELP_STR "Half Rate\n" \ |
| 3570 | "Enhanced Full Rate\nAdaptive Multirate\n" |
| 3571 | |
| 3572 | DEFUN(cfg_bts_codec0, cfg_bts_codec0_cmd, |
| 3573 | "codec-support fr", |
| 3574 | "Codec Support settings\nFullrate\n") |
| 3575 | { |
| 3576 | _get_codec_from_arg(vty, 0, argv); |
| 3577 | return CMD_SUCCESS; |
| 3578 | } |
| 3579 | |
| 3580 | DEFUN(cfg_bts_codec1, cfg_bts_codec1_cmd, |
| 3581 | "codec-support fr" CODEC_PAR_STR, |
| 3582 | "Codec Support settings\nFullrate\n" |
| 3583 | CODEC_HELP_STR) |
| 3584 | { |
| 3585 | _get_codec_from_arg(vty, 1, argv); |
| 3586 | return CMD_SUCCESS; |
| 3587 | } |
| 3588 | |
| 3589 | DEFUN(cfg_bts_codec2, cfg_bts_codec2_cmd, |
| 3590 | "codec-support fr" CODEC_PAR_STR CODEC_PAR_STR, |
| 3591 | "Codec Support settings\nFullrate\n" |
| 3592 | CODEC_HELP_STR CODEC_HELP_STR) |
| 3593 | { |
| 3594 | _get_codec_from_arg(vty, 2, argv); |
| 3595 | return CMD_SUCCESS; |
| 3596 | } |
| 3597 | |
| 3598 | DEFUN(cfg_bts_codec3, cfg_bts_codec3_cmd, |
| 3599 | "codec-support fr" CODEC_PAR_STR CODEC_PAR_STR CODEC_PAR_STR, |
| 3600 | "Codec Support settings\nFullrate\n" |
| 3601 | CODEC_HELP_STR CODEC_HELP_STR CODEC_HELP_STR) |
| 3602 | { |
| 3603 | _get_codec_from_arg(vty, 3, argv); |
| 3604 | return CMD_SUCCESS; |
| 3605 | } |
| 3606 | |
| 3607 | DEFUN(cfg_bts_codec4, cfg_bts_codec4_cmd, |
| 3608 | "codec-support fr" CODEC_PAR_STR CODEC_PAR_STR CODEC_PAR_STR CODEC_PAR_STR, |
| 3609 | "Codec Support settings\nFullrate\n" |
| 3610 | CODEC_HELP_STR CODEC_HELP_STR CODEC_HELP_STR CODEC_HELP_STR) |
| 3611 | { |
| 3612 | _get_codec_from_arg(vty, 4, argv); |
| 3613 | return CMD_SUCCESS; |
| 3614 | } |
| 3615 | |
Holger Hans Peter Freyther | c22930e | 2014-12-17 14:46:17 +0100 | [diff] [blame] | 3616 | DEFUN(cfg_bts_depends_on, cfg_bts_depends_on_cmd, |
| 3617 | "depends-on-bts <0-255>", |
Neels Hofmeyr | 70c5fd2 | 2018-01-19 15:55:14 +0100 | [diff] [blame] | 3618 | "This BTS can only be started if another one is up\n" |
| 3619 | BTS_NR_STR) |
Holger Hans Peter Freyther | c22930e | 2014-12-17 14:46:17 +0100 | [diff] [blame] | 3620 | { |
| 3621 | struct gsm_bts *bts = vty->index; |
| 3622 | struct gsm_bts *other_bts; |
| 3623 | int dep = atoi(argv[0]); |
| 3624 | |
| 3625 | |
| 3626 | if (!is_ipaccess_bts(bts)) { |
| 3627 | vty_out(vty, "This feature is only available for IP systems.%s", |
| 3628 | VTY_NEWLINE); |
| 3629 | return CMD_WARNING; |
| 3630 | } |
| 3631 | |
| 3632 | other_bts = gsm_bts_num(bts->network, dep); |
| 3633 | if (!other_bts || !is_ipaccess_bts(other_bts)) { |
| 3634 | vty_out(vty, "This feature is only available for IP systems.%s", |
| 3635 | VTY_NEWLINE); |
| 3636 | return CMD_WARNING; |
| 3637 | } |
| 3638 | |
| 3639 | if (dep >= bts->nr) { |
| 3640 | vty_out(vty, "%%Need to depend on an already declared unit.%s", |
| 3641 | VTY_NEWLINE); |
| 3642 | return CMD_WARNING; |
| 3643 | } |
| 3644 | |
| 3645 | bts_depend_mark(bts, dep); |
| 3646 | return CMD_SUCCESS; |
| 3647 | } |
| 3648 | |
| 3649 | DEFUN(cfg_bts_no_depends_on, cfg_bts_no_depends_on_cmd, |
| 3650 | "depeneds-on-bts <0-255>", |
| 3651 | NO_STR "This BTS can only be started if another one is up\n" |
Neels Hofmeyr | 70c5fd2 | 2018-01-19 15:55:14 +0100 | [diff] [blame] | 3652 | BTS_NR_STR) |
Holger Hans Peter Freyther | c22930e | 2014-12-17 14:46:17 +0100 | [diff] [blame] | 3653 | { |
| 3654 | struct gsm_bts *bts = vty->index; |
| 3655 | int dep = atoi(argv[0]); |
| 3656 | |
| 3657 | bts_depend_clear(bts, dep); |
| 3658 | return CMD_SUCCESS; |
| 3659 | } |
| 3660 | |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3661 | #define AMR_TEXT "Adaptive Multi Rate settings\n" |
| 3662 | #define AMR_MODE_TEXT "Codec modes to use with AMR codec\n" |
| 3663 | #define AMR_START_TEXT "Initial codec to use with AMR\n" \ |
| 3664 | "Automatically\nFirst codec\nSecond codec\nThird codec\nFourth codec\n" |
| 3665 | #define AMR_TH_TEXT "AMR threshold between codecs\nMS side\nBTS side\n" |
| 3666 | #define AMR_HY_TEXT "AMR hysteresis between codecs\nMS side\nBTS side\n" |
| 3667 | |
| 3668 | static void get_amr_from_arg(struct vty *vty, int argc, const char *argv[], int full) |
| 3669 | { |
| 3670 | struct gsm_bts *bts = vty->index; |
| 3671 | struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half; |
| 3672 | struct gsm48_multi_rate_conf *mr_conf = |
| 3673 | (struct gsm48_multi_rate_conf *) mr->gsm48_ie; |
| 3674 | int i; |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3675 | int mode; |
| 3676 | int mode_prev = -1; |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3677 | |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3678 | /* Check if mode parameters are in order */ |
| 3679 | for (i = 0; i < argc; i++) { |
| 3680 | mode = atoi(argv[i]); |
| 3681 | if (mode_prev > mode) { |
| 3682 | vty_out(vty, "Modes must be listed in order%s", |
| 3683 | VTY_NEWLINE); |
| 3684 | return; |
| 3685 | } |
| 3686 | |
| 3687 | if (mode_prev == mode) { |
| 3688 | vty_out(vty, "Modes must be unique %s", VTY_NEWLINE); |
| 3689 | return; |
| 3690 | } |
| 3691 | mode_prev = mode; |
| 3692 | } |
| 3693 | |
| 3694 | /* Prepare the multirate configuration IE */ |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3695 | mr->gsm48_ie[1] = 0; |
| 3696 | for (i = 0; i < argc; i++) |
| 3697 | mr->gsm48_ie[1] |= 1 << atoi(argv[i]); |
| 3698 | mr_conf->icmi = 0; |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3699 | |
| 3700 | /* Store actual mode identifier values */ |
| 3701 | for (i = 0; i < argc; i++) { |
| 3702 | mr->ms_mode[i].mode = atoi(argv[i]); |
| 3703 | mr->bts_mode[i].mode = atoi(argv[i]); |
| 3704 | } |
| 3705 | mr->num_modes = argc; |
| 3706 | |
| 3707 | /* Trim excess threshold and hysteresis values from previous config */ |
| 3708 | for (i = argc - 1; i < 4; i++) { |
| 3709 | mr->ms_mode[i].threshold = 0; |
| 3710 | mr->bts_mode[i].threshold = 0; |
| 3711 | mr->ms_mode[i].hysteresis = 0; |
| 3712 | mr->bts_mode[i].hysteresis = 0; |
| 3713 | } |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3714 | } |
| 3715 | |
| 3716 | static void get_amr_th_from_arg(struct vty *vty, int argc, const char *argv[], int full) |
| 3717 | { |
| 3718 | struct gsm_bts *bts = vty->index; |
| 3719 | struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half; |
Holger Hans Peter Freyther | a174a47 | 2015-09-24 11:39:38 +0200 | [diff] [blame] | 3720 | struct amr_mode *modes; |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3721 | int i; |
| 3722 | |
Holger Hans Peter Freyther | a174a47 | 2015-09-24 11:39:38 +0200 | [diff] [blame] | 3723 | modes = argv[0][0]=='m' ? mr->ms_mode : mr->bts_mode; |
| 3724 | for (i = 0; i < argc - 1; i++) |
| 3725 | modes[i].threshold = atoi(argv[i + 1]); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3726 | } |
| 3727 | |
| 3728 | static void get_amr_hy_from_arg(struct vty *vty, int argc, const char *argv[], int full) |
| 3729 | { |
| 3730 | struct gsm_bts *bts = vty->index; |
| 3731 | struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half; |
Holger Hans Peter Freyther | a174a47 | 2015-09-24 11:39:38 +0200 | [diff] [blame] | 3732 | struct amr_mode *modes; |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3733 | int i; |
| 3734 | |
Holger Hans Peter Freyther | a174a47 | 2015-09-24 11:39:38 +0200 | [diff] [blame] | 3735 | modes = argv[0][0]=='m' ? mr->ms_mode : mr->bts_mode; |
| 3736 | for (i = 0; i < argc - 1; i++) |
| 3737 | modes[i].hysteresis = atoi(argv[i + 1]); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3738 | } |
| 3739 | |
| 3740 | static void get_amr_start_from_arg(struct vty *vty, const char *argv[], int full) |
| 3741 | { |
| 3742 | struct gsm_bts *bts = vty->index; |
| 3743 | struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half; |
| 3744 | struct gsm48_multi_rate_conf *mr_conf = |
| 3745 | (struct gsm48_multi_rate_conf *) mr->gsm48_ie; |
| 3746 | int num = 0, i; |
| 3747 | |
| 3748 | for (i = 0; i < ((full) ? 8 : 6); i++) { |
| 3749 | if ((mr->gsm48_ie[1] & (1 << i))) { |
| 3750 | num++; |
| 3751 | } |
| 3752 | } |
| 3753 | |
| 3754 | if (argv[0][0] == 'a' || num == 0) |
| 3755 | mr_conf->icmi = 0; |
| 3756 | else { |
| 3757 | mr_conf->icmi = 1; |
| 3758 | if (num < atoi(argv[0])) |
| 3759 | mr_conf->smod = num - 1; |
| 3760 | else |
| 3761 | mr_conf->smod = atoi(argv[0]) - 1; |
| 3762 | } |
| 3763 | } |
| 3764 | |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3765 | /* Give the current amr configuration a final consistency chack by feeding the |
| 3766 | * the configuration into the gsm48 multirate IE generator function */ |
| 3767 | static int check_amr_config(struct vty *vty) |
| 3768 | { |
| 3769 | int rc = 0; |
| 3770 | struct amr_multirate_conf *mr; |
| 3771 | const struct gsm48_multi_rate_conf *mr_conf; |
| 3772 | struct gsm_bts *bts = vty->index; |
| 3773 | int vty_rc = CMD_SUCCESS; |
| 3774 | |
| 3775 | mr = &bts->mr_full; |
| 3776 | mr_conf = (struct gsm48_multi_rate_conf*) mr->gsm48_ie; |
| 3777 | rc = gsm48_multirate_config(NULL, mr_conf, mr->ms_mode, mr->num_modes); |
| 3778 | if (rc != 0) { |
| 3779 | vty_out(vty, |
| 3780 | "Invalid AMR multirate configuration (tch-f, ms) - check parameters%s", |
| 3781 | VTY_NEWLINE); |
| 3782 | vty_rc = CMD_WARNING; |
| 3783 | } |
| 3784 | |
| 3785 | rc = gsm48_multirate_config(NULL, mr_conf, mr->bts_mode, mr->num_modes); |
| 3786 | if (rc != 0) { |
| 3787 | vty_out(vty, |
| 3788 | "Invalid AMR multirate configuration (tch-f, bts) - check parameters%s", |
| 3789 | VTY_NEWLINE); |
| 3790 | vty_rc = CMD_WARNING; |
| 3791 | } |
| 3792 | |
| 3793 | mr = &bts->mr_half; |
| 3794 | mr_conf = (struct gsm48_multi_rate_conf*) mr->gsm48_ie; |
| 3795 | rc = gsm48_multirate_config(NULL, mr_conf, mr->ms_mode, mr->num_modes); |
| 3796 | if (rc != 0) { |
| 3797 | vty_out(vty, |
| 3798 | "Invalid AMR multirate configuration (tch-h, ms) - check parameters%s", |
| 3799 | VTY_NEWLINE); |
| 3800 | vty_rc = CMD_WARNING; |
| 3801 | } |
| 3802 | |
| 3803 | rc = gsm48_multirate_config(NULL, mr_conf, mr->bts_mode, mr->num_modes); |
| 3804 | if (rc != 0) { |
| 3805 | vty_out(vty, |
| 3806 | "Invalid AMR multirate configuration (tch-h, bts) - check parameters%s", |
| 3807 | VTY_NEWLINE); |
| 3808 | vty_rc = CMD_WARNING; |
| 3809 | } |
| 3810 | |
| 3811 | return vty_rc; |
| 3812 | } |
| 3813 | |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3814 | #define AMR_TCHF_PAR_STR " (0|1|2|3|4|5|6|7)" |
| 3815 | #define AMR_TCHF_HELP_STR "4,75k\n5,15k\n5,90k\n6,70k\n7,40k\n7,95k\n" \ |
| 3816 | "10,2k\n12,2k\n" |
| 3817 | |
| 3818 | #define AMR_TCHH_PAR_STR " (0|1|2|3|4|5)" |
| 3819 | #define AMR_TCHH_HELP_STR "4,75k\n5,15k\n5,90k\n6,70k\n7,40k\n7,95k\n" |
| 3820 | |
| 3821 | #define AMR_TH_HELP_STR "Threshold between codec 1 and 2\n" |
| 3822 | #define AMR_HY_HELP_STR "Hysteresis between codec 1 and 2\n" |
| 3823 | |
| 3824 | DEFUN(cfg_bts_amr_fr_modes1, cfg_bts_amr_fr_modes1_cmd, |
| 3825 | "amr tch-f modes" AMR_TCHF_PAR_STR, |
| 3826 | AMR_TEXT "Full Rate\n" AMR_MODE_TEXT |
| 3827 | AMR_TCHF_HELP_STR) |
| 3828 | { |
| 3829 | get_amr_from_arg(vty, 1, argv, 1); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3830 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3831 | } |
| 3832 | |
| 3833 | DEFUN(cfg_bts_amr_fr_modes2, cfg_bts_amr_fr_modes2_cmd, |
| 3834 | "amr tch-f modes" AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR, |
| 3835 | AMR_TEXT "Full Rate\n" AMR_MODE_TEXT |
| 3836 | AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR) |
| 3837 | { |
| 3838 | get_amr_from_arg(vty, 2, argv, 1); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3839 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3840 | } |
| 3841 | |
| 3842 | DEFUN(cfg_bts_amr_fr_modes3, cfg_bts_amr_fr_modes3_cmd, |
| 3843 | "amr tch-f modes" AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR, |
| 3844 | AMR_TEXT "Full Rate\n" AMR_MODE_TEXT |
| 3845 | AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR) |
| 3846 | { |
| 3847 | get_amr_from_arg(vty, 3, argv, 1); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3848 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3849 | } |
| 3850 | |
| 3851 | DEFUN(cfg_bts_amr_fr_modes4, cfg_bts_amr_fr_modes4_cmd, |
| 3852 | "amr tch-f modes" AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR, |
| 3853 | AMR_TEXT "Full Rate\n" AMR_MODE_TEXT |
| 3854 | AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR) |
| 3855 | { |
| 3856 | get_amr_from_arg(vty, 4, argv, 1); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3857 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3858 | } |
| 3859 | |
| 3860 | DEFUN(cfg_bts_amr_fr_start_mode, cfg_bts_amr_fr_start_mode_cmd, |
| 3861 | "amr tch-f start-mode (auto|1|2|3|4)", |
| 3862 | AMR_TEXT "Full Rate\n" AMR_START_TEXT) |
| 3863 | { |
| 3864 | get_amr_start_from_arg(vty, argv, 1); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3865 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3866 | } |
| 3867 | |
| 3868 | DEFUN(cfg_bts_amr_fr_thres1, cfg_bts_amr_fr_thres1_cmd, |
| 3869 | "amr tch-f threshold (ms|bts) <0-63>", |
| 3870 | AMR_TEXT "Full Rate\n" AMR_TH_TEXT |
| 3871 | AMR_TH_HELP_STR) |
| 3872 | { |
| 3873 | get_amr_th_from_arg(vty, 2, argv, 1); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3874 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3875 | } |
| 3876 | |
| 3877 | DEFUN(cfg_bts_amr_fr_thres2, cfg_bts_amr_fr_thres2_cmd, |
| 3878 | "amr tch-f threshold (ms|bts) <0-63> <0-63>", |
| 3879 | AMR_TEXT "Full Rate\n" AMR_TH_TEXT |
| 3880 | AMR_TH_HELP_STR AMR_TH_HELP_STR) |
| 3881 | { |
| 3882 | get_amr_th_from_arg(vty, 3, argv, 1); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3883 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3884 | } |
| 3885 | |
| 3886 | DEFUN(cfg_bts_amr_fr_thres3, cfg_bts_amr_fr_thres3_cmd, |
| 3887 | "amr tch-f threshold (ms|bts) <0-63> <0-63> <0-63>", |
| 3888 | AMR_TEXT "Full Rate\n" AMR_TH_TEXT |
| 3889 | AMR_TH_HELP_STR AMR_TH_HELP_STR AMR_TH_HELP_STR) |
| 3890 | { |
| 3891 | get_amr_th_from_arg(vty, 4, argv, 1); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3892 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3893 | } |
| 3894 | |
| 3895 | DEFUN(cfg_bts_amr_fr_hyst1, cfg_bts_amr_fr_hyst1_cmd, |
| 3896 | "amr tch-f hysteresis (ms|bts) <0-15>", |
| 3897 | AMR_TEXT "Full Rate\n" AMR_HY_TEXT |
| 3898 | AMR_HY_HELP_STR) |
| 3899 | { |
| 3900 | get_amr_hy_from_arg(vty, 2, argv, 1); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3901 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3902 | } |
| 3903 | |
| 3904 | DEFUN(cfg_bts_amr_fr_hyst2, cfg_bts_amr_fr_hyst2_cmd, |
| 3905 | "amr tch-f hysteresis (ms|bts) <0-15> <0-15>", |
| 3906 | AMR_TEXT "Full Rate\n" AMR_HY_TEXT |
| 3907 | AMR_HY_HELP_STR AMR_HY_HELP_STR) |
| 3908 | { |
| 3909 | get_amr_hy_from_arg(vty, 3, argv, 1); |
| 3910 | return CMD_SUCCESS; |
| 3911 | } |
| 3912 | |
| 3913 | DEFUN(cfg_bts_amr_fr_hyst3, cfg_bts_amr_fr_hyst3_cmd, |
| 3914 | "amr tch-f hysteresis (ms|bts) <0-15> <0-15> <0-15>", |
| 3915 | AMR_TEXT "Full Rate\n" AMR_HY_TEXT |
| 3916 | AMR_HY_HELP_STR AMR_HY_HELP_STR AMR_HY_HELP_STR) |
| 3917 | { |
| 3918 | get_amr_hy_from_arg(vty, 4, argv, 1); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3919 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3920 | } |
| 3921 | |
| 3922 | DEFUN(cfg_bts_amr_hr_modes1, cfg_bts_amr_hr_modes1_cmd, |
| 3923 | "amr tch-h modes" AMR_TCHH_PAR_STR, |
| 3924 | AMR_TEXT "Half Rate\n" AMR_MODE_TEXT |
| 3925 | AMR_TCHH_HELP_STR) |
| 3926 | { |
| 3927 | get_amr_from_arg(vty, 1, argv, 0); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3928 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3929 | } |
| 3930 | |
| 3931 | DEFUN(cfg_bts_amr_hr_modes2, cfg_bts_amr_hr_modes2_cmd, |
| 3932 | "amr tch-h modes" AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR, |
| 3933 | AMR_TEXT "Half Rate\n" AMR_MODE_TEXT |
| 3934 | AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR) |
| 3935 | { |
| 3936 | get_amr_from_arg(vty, 2, argv, 0); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3937 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3938 | } |
| 3939 | |
| 3940 | DEFUN(cfg_bts_amr_hr_modes3, cfg_bts_amr_hr_modes3_cmd, |
| 3941 | "amr tch-h modes" AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR, |
| 3942 | AMR_TEXT "Half Rate\n" AMR_MODE_TEXT |
| 3943 | AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR) |
| 3944 | { |
| 3945 | get_amr_from_arg(vty, 3, argv, 0); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3946 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3947 | } |
| 3948 | |
| 3949 | DEFUN(cfg_bts_amr_hr_modes4, cfg_bts_amr_hr_modes4_cmd, |
| 3950 | "amr tch-h modes" AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR, |
| 3951 | AMR_TEXT "Half Rate\n" AMR_MODE_TEXT |
| 3952 | AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR) |
| 3953 | { |
| 3954 | get_amr_from_arg(vty, 4, argv, 0); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3955 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3956 | } |
| 3957 | |
| 3958 | DEFUN(cfg_bts_amr_hr_start_mode, cfg_bts_amr_hr_start_mode_cmd, |
| 3959 | "amr tch-h start-mode (auto|1|2|3|4)", |
| 3960 | AMR_TEXT "Half Rate\n" AMR_START_TEXT) |
| 3961 | { |
| 3962 | get_amr_start_from_arg(vty, argv, 0); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3963 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3964 | } |
| 3965 | |
| 3966 | DEFUN(cfg_bts_amr_hr_thres1, cfg_bts_amr_hr_thres1_cmd, |
| 3967 | "amr tch-h threshold (ms|bts) <0-63>", |
| 3968 | AMR_TEXT "Half Rate\n" AMR_TH_TEXT |
| 3969 | AMR_TH_HELP_STR) |
| 3970 | { |
| 3971 | get_amr_th_from_arg(vty, 2, argv, 0); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3972 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3973 | } |
| 3974 | |
| 3975 | DEFUN(cfg_bts_amr_hr_thres2, cfg_bts_amr_hr_thres2_cmd, |
| 3976 | "amr tch-h threshold (ms|bts) <0-63> <0-63>", |
| 3977 | AMR_TEXT "Half Rate\n" AMR_TH_TEXT |
| 3978 | AMR_TH_HELP_STR AMR_TH_HELP_STR) |
| 3979 | { |
| 3980 | get_amr_th_from_arg(vty, 3, argv, 0); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3981 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3982 | } |
| 3983 | |
| 3984 | DEFUN(cfg_bts_amr_hr_thres3, cfg_bts_amr_hr_thres3_cmd, |
| 3985 | "amr tch-h threshold (ms|bts) <0-63> <0-63> <0-63>", |
| 3986 | AMR_TEXT "Half Rate\n" AMR_TH_TEXT |
| 3987 | AMR_TH_HELP_STR AMR_TH_HELP_STR AMR_TH_HELP_STR) |
| 3988 | { |
| 3989 | get_amr_th_from_arg(vty, 4, argv, 0); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3990 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3991 | } |
| 3992 | |
| 3993 | DEFUN(cfg_bts_amr_hr_hyst1, cfg_bts_amr_hr_hyst1_cmd, |
| 3994 | "amr tch-h hysteresis (ms|bts) <0-15>", |
| 3995 | AMR_TEXT "Half Rate\n" AMR_HY_TEXT |
| 3996 | AMR_HY_HELP_STR) |
| 3997 | { |
| 3998 | get_amr_hy_from_arg(vty, 2, argv, 0); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 3999 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 4000 | } |
| 4001 | |
| 4002 | DEFUN(cfg_bts_amr_hr_hyst2, cfg_bts_amr_hr_hyst2_cmd, |
| 4003 | "amr tch-h hysteresis (ms|bts) <0-15> <0-15>", |
| 4004 | AMR_TEXT "Half Rate\n" AMR_HY_TEXT |
| 4005 | AMR_HY_HELP_STR AMR_HY_HELP_STR) |
| 4006 | { |
| 4007 | get_amr_hy_from_arg(vty, 3, argv, 0); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 4008 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 4009 | } |
| 4010 | |
| 4011 | DEFUN(cfg_bts_amr_hr_hyst3, cfg_bts_amr_hr_hyst3_cmd, |
| 4012 | "amr tch-h hysteresis (ms|bts) <0-15> <0-15> <0-15>", |
| 4013 | AMR_TEXT "Half Rate\n" AMR_HY_TEXT |
| 4014 | AMR_HY_HELP_STR AMR_HY_HELP_STR AMR_HY_HELP_STR) |
| 4015 | { |
| 4016 | get_amr_hy_from_arg(vty, 4, argv, 0); |
Philipp Maier | e4faf59 | 2018-10-22 14:28:00 +0200 | [diff] [blame] | 4017 | return check_amr_config(vty); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 4018 | } |
| 4019 | |
Pau Espin Pedrol | 1b96334 | 2018-11-07 14:19:32 +0100 | [diff] [blame] | 4020 | #define TNUM_STR "T-number, optionally preceded by 't' or 'T'\n" |
| 4021 | DEFUN(cfg_bts_t3113_dynamic, cfg_bts_t3113_dynamic_cmd, |
| 4022 | "timer-dynamic TNNNN", |
| 4023 | "Calculate T3113 dynamically based on channel config and load\n" |
| 4024 | TNUM_STR) |
| 4025 | { |
Neels Hofmeyr | a6078fe | 2019-01-28 03:52:14 +0100 | [diff] [blame] | 4026 | struct osmo_tdef *d; |
Pau Espin Pedrol | 1b96334 | 2018-11-07 14:19:32 +0100 | [diff] [blame] | 4027 | struct gsm_bts *bts = vty->index; |
Neels Hofmeyr | a6078fe | 2019-01-28 03:52:14 +0100 | [diff] [blame] | 4028 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Pau Espin Pedrol | 1b96334 | 2018-11-07 14:19:32 +0100 | [diff] [blame] | 4029 | |
Neels Hofmeyr | a6078fe | 2019-01-28 03:52:14 +0100 | [diff] [blame] | 4030 | d = osmo_tdef_vty_parse_T_arg(vty, gsmnet->T_defs, argv[0]); |
Pau Espin Pedrol | 1b96334 | 2018-11-07 14:19:32 +0100 | [diff] [blame] | 4031 | if (!d) |
| 4032 | return CMD_WARNING; |
| 4033 | |
| 4034 | switch (d->T) { |
| 4035 | case 3113: |
| 4036 | bts->T3113_dynamic = true; |
| 4037 | break; |
| 4038 | default: |
| 4039 | vty_out(vty, "T%d cannot be set to dynamic%s", d->T, VTY_NEWLINE); |
| 4040 | return CMD_WARNING; |
| 4041 | } |
| 4042 | |
| 4043 | return CMD_SUCCESS; |
| 4044 | } |
| 4045 | |
| 4046 | DEFUN(cfg_bts_no_t3113_dynamic, cfg_bts_no_t3113_dynamic_cmd, |
| 4047 | "no timer-dynamic TNNNN", |
| 4048 | NO_STR |
| 4049 | "Set given timer to non-dynamic and use the default or user provided fixed value\n" |
| 4050 | TNUM_STR) |
| 4051 | { |
Neels Hofmeyr | a6078fe | 2019-01-28 03:52:14 +0100 | [diff] [blame] | 4052 | struct osmo_tdef *d; |
Pau Espin Pedrol | 1b96334 | 2018-11-07 14:19:32 +0100 | [diff] [blame] | 4053 | struct gsm_bts *bts = vty->index; |
Neels Hofmeyr | a6078fe | 2019-01-28 03:52:14 +0100 | [diff] [blame] | 4054 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Pau Espin Pedrol | 1b96334 | 2018-11-07 14:19:32 +0100 | [diff] [blame] | 4055 | |
Neels Hofmeyr | a6078fe | 2019-01-28 03:52:14 +0100 | [diff] [blame] | 4056 | d = osmo_tdef_vty_parse_T_arg(vty, gsmnet->T_defs, argv[0]); |
Pau Espin Pedrol | 1b96334 | 2018-11-07 14:19:32 +0100 | [diff] [blame] | 4057 | if (!d) |
| 4058 | return CMD_WARNING; |
| 4059 | |
| 4060 | switch (d->T) { |
| 4061 | case 3113: |
| 4062 | bts->T3113_dynamic = false; |
| 4063 | break; |
| 4064 | default: |
| 4065 | vty_out(vty, "T%d already is non-dynamic%s", d->T, VTY_NEWLINE); |
| 4066 | return CMD_WARNING; |
| 4067 | } |
| 4068 | |
| 4069 | return CMD_SUCCESS; |
| 4070 | } |
| 4071 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 4072 | #define TRX_TEXT "Radio Transceiver\n" |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 4073 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 4074 | /* per TRX configuration */ |
| 4075 | DEFUN(cfg_trx, |
| 4076 | cfg_trx_cmd, |
Harald Welte | 57e0724 | 2012-08-17 12:50:14 +0200 | [diff] [blame] | 4077 | "trx <0-255>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 4078 | TRX_TEXT |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 4079 | "Select a TRX to configure") |
| 4080 | { |
| 4081 | int trx_nr = atoi(argv[0]); |
| 4082 | struct gsm_bts *bts = vty->index; |
| 4083 | struct gsm_bts_trx *trx; |
| 4084 | |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 4085 | if (trx_nr > bts->num_trx) { |
| 4086 | vty_out(vty, "%% The next unused TRX number in this BTS is %u%s", |
| 4087 | bts->num_trx, VTY_NEWLINE); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 4088 | return CMD_WARNING; |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 4089 | } else if (trx_nr == bts->num_trx) { |
| 4090 | /* we need to allocate a new one */ |
| 4091 | trx = gsm_bts_trx_alloc(bts); |
Holger Hans Peter Freyther | acf8a0c | 2010-03-29 08:47:44 +0200 | [diff] [blame] | 4092 | } else |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 4093 | trx = gsm_bts_trx_num(bts, trx_nr); |
Holger Hans Peter Freyther | acf8a0c | 2010-03-29 08:47:44 +0200 | [diff] [blame] | 4094 | |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 4095 | if (!trx) |
| 4096 | return CMD_WARNING; |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 4097 | |
| 4098 | vty->index = trx; |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 4099 | vty->index_sub = &trx->description; |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 4100 | vty->node = TRX_NODE; |
| 4101 | |
| 4102 | return CMD_SUCCESS; |
| 4103 | } |
| 4104 | |
| 4105 | DEFUN(cfg_trx_arfcn, |
| 4106 | cfg_trx_arfcn_cmd, |
Harald Welte | 1fe73a1 | 2012-01-29 13:24:12 +0100 | [diff] [blame] | 4107 | "arfcn <0-1023>", |
Harald Welte | 13fe219 | 2012-08-17 09:57:25 +0200 | [diff] [blame] | 4108 | "Set the ARFCN for this TRX\n" |
| 4109 | "Absolute Radio Frequency Channel Number\n") |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 4110 | { |
Pau Espin Pedrol | 33ca613 | 2018-11-16 14:12:31 +0100 | [diff] [blame] | 4111 | enum gsm_band unused; |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 4112 | struct gsm_bts_trx *trx = vty->index; |
Pau Espin Pedrol | 33ca613 | 2018-11-16 14:12:31 +0100 | [diff] [blame] | 4113 | int arfcn = atoi(argv[0]); |
| 4114 | |
| 4115 | if (gsm_arfcn2band_rc(arfcn, &unused) < 0) { |
| 4116 | vty_out(vty, "%% Invalid arfcn %" PRIu16 " detected%s", arfcn, VTY_NEWLINE); |
| 4117 | return CMD_WARNING; |
| 4118 | } |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 4119 | |
| 4120 | /* FIXME: check if this ARFCN is supported by this TRX */ |
| 4121 | |
| 4122 | trx->arfcn = arfcn; |
| 4123 | |
| 4124 | /* FIXME: patch ARFCN into SYSTEM INFORMATION */ |
| 4125 | /* FIXME: use OML layer to update the ARFCN */ |
| 4126 | /* FIXME: use RSL layer to update SYSTEM INFORMATION */ |
| 4127 | |
| 4128 | return CMD_SUCCESS; |
| 4129 | } |
| 4130 | |
Harald Welte (local) | 7b37d97 | 2009-12-27 20:56:38 +0100 | [diff] [blame] | 4131 | DEFUN(cfg_trx_nominal_power, |
| 4132 | cfg_trx_nominal_power_cmd, |
| 4133 | "nominal power <0-100>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 4134 | "Nominal TRX RF Power in dBm\n" |
| 4135 | "Nominal TRX RF Power in dBm\n" |
| 4136 | "Nominal TRX RF Power in dBm\n") |
Harald Welte (local) | 7b37d97 | 2009-12-27 20:56:38 +0100 | [diff] [blame] | 4137 | { |
| 4138 | struct gsm_bts_trx *trx = vty->index; |
| 4139 | |
| 4140 | trx->nominal_power = atoi(argv[0]); |
| 4141 | |
| 4142 | return CMD_SUCCESS; |
| 4143 | } |
| 4144 | |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 4145 | DEFUN(cfg_trx_max_power_red, |
| 4146 | cfg_trx_max_power_red_cmd, |
| 4147 | "max_power_red <0-100>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 4148 | "Reduction of maximum BS RF Power (relative to nominal power)\n" |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 4149 | "Reduction of maximum BS RF Power in dB\n") |
| 4150 | { |
| 4151 | int maxpwr_r = atoi(argv[0]); |
| 4152 | struct gsm_bts_trx *trx = vty->index; |
Harald Welte | 61a83b2 | 2009-11-18 09:20:22 +0100 | [diff] [blame] | 4153 | int upper_limit = 24; /* default 12.21 max power red. */ |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 4154 | |
| 4155 | /* FIXME: check if our BTS type supports more than 12 */ |
| 4156 | if (maxpwr_r < 0 || maxpwr_r > upper_limit) { |
| 4157 | vty_out(vty, "%% Power %d dB is not in the valid range%s", |
| 4158 | maxpwr_r, VTY_NEWLINE); |
| 4159 | return CMD_WARNING; |
| 4160 | } |
| 4161 | if (maxpwr_r & 1) { |
| 4162 | vty_out(vty, "%% Power %d dB is not an even value%s", |
| 4163 | maxpwr_r, VTY_NEWLINE); |
| 4164 | return CMD_WARNING; |
| 4165 | } |
| 4166 | |
| 4167 | trx->max_power_red = maxpwr_r; |
| 4168 | |
| 4169 | /* FIXME: make sure we update this using OML */ |
| 4170 | |
| 4171 | return CMD_SUCCESS; |
| 4172 | } |
| 4173 | |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 4174 | DEFUN(cfg_trx_rsl_e1, |
| 4175 | cfg_trx_rsl_e1_cmd, |
| 4176 | "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 4177 | "RSL Parameters\n" |
| 4178 | "E1/T1 interface to be used for RSL\n" |
| 4179 | "E1/T1 interface to be used for RSL\n" |
| 4180 | "E1/T1 Line Number to be used for RSL\n" |
| 4181 | "E1/T1 Timeslot to be used for RSL\n" |
| 4182 | "E1/T1 Timeslot to be used for RSL\n" |
| 4183 | "E1/T1 Sub-slot to be used for RSL\n" |
| 4184 | "E1/T1 Sub-slot 0 is to be used for RSL\n" |
| 4185 | "E1/T1 Sub-slot 1 is to be used for RSL\n" |
| 4186 | "E1/T1 Sub-slot 2 is to be used for RSL\n" |
| 4187 | "E1/T1 Sub-slot 3 is to be used for RSL\n" |
| 4188 | "E1/T1 full timeslot is to be used for RSL\n") |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 4189 | { |
| 4190 | struct gsm_bts_trx *trx = vty->index; |
| 4191 | |
| 4192 | parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]); |
| 4193 | |
| 4194 | return CMD_SUCCESS; |
| 4195 | } |
| 4196 | |
| 4197 | DEFUN(cfg_trx_rsl_e1_tei, |
| 4198 | cfg_trx_rsl_e1_tei_cmd, |
| 4199 | "rsl e1 tei <0-63>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 4200 | "RSL Parameters\n" |
| 4201 | "Set the TEI to be used for RSL\n" |
| 4202 | "Set the TEI to be used for RSL\n" |
| 4203 | "TEI to be used for RSL\n") |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 4204 | { |
| 4205 | struct gsm_bts_trx *trx = vty->index; |
| 4206 | |
| 4207 | trx->rsl_tei = atoi(argv[0]); |
| 4208 | |
| 4209 | return CMD_SUCCESS; |
| 4210 | } |
| 4211 | |
Holger Hans Peter Freyther | 2d501ea | 2009-11-11 11:54:24 +0100 | [diff] [blame] | 4212 | DEFUN(cfg_trx_rf_locked, |
| 4213 | cfg_trx_rf_locked_cmd, |
| 4214 | "rf_locked (0|1)", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 4215 | "Set or unset the RF Locking (Turn off RF of the TRX)\n" |
| 4216 | "TRX is NOT RF locked (active)\n" |
| 4217 | "TRX is RF locked (turned off)\n") |
Holger Hans Peter Freyther | 2d501ea | 2009-11-11 11:54:24 +0100 | [diff] [blame] | 4218 | { |
| 4219 | int locked = atoi(argv[0]); |
| 4220 | struct gsm_bts_trx *trx = vty->index; |
| 4221 | |
Max | be356ed | 2017-09-07 19:10:09 +0200 | [diff] [blame] | 4222 | gsm_trx_lock_rf(trx, locked, "vty"); |
Holger Hans Peter Freyther | 2d501ea | 2009-11-11 11:54:24 +0100 | [diff] [blame] | 4223 | return CMD_SUCCESS; |
| 4224 | } |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 4225 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 4226 | /* per TS configuration */ |
| 4227 | DEFUN(cfg_ts, |
| 4228 | cfg_ts_cmd, |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 4229 | "timeslot <0-7>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 4230 | "Select a Timeslot to configure\n" |
| 4231 | "Timeslot number\n") |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 4232 | { |
| 4233 | int ts_nr = atoi(argv[0]); |
| 4234 | struct gsm_bts_trx *trx = vty->index; |
| 4235 | struct gsm_bts_trx_ts *ts; |
| 4236 | |
| 4237 | if (ts_nr >= TRX_NR_TS) { |
| 4238 | vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s", |
| 4239 | TRX_NR_TS, VTY_NEWLINE); |
| 4240 | return CMD_WARNING; |
| 4241 | } |
| 4242 | |
| 4243 | ts = &trx->ts[ts_nr]; |
| 4244 | |
| 4245 | vty->index = ts; |
| 4246 | vty->node = TS_NODE; |
| 4247 | |
| 4248 | return CMD_SUCCESS; |
| 4249 | } |
| 4250 | |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 4251 | DEFUN(cfg_ts_pchan, |
| 4252 | cfg_ts_pchan_cmd, |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 4253 | "phys_chan_config PCHAN", /* dynamically generated! */ |
Holger Hans Peter Freyther | 63b0e44 | 2013-03-03 09:32:08 +0100 | [diff] [blame] | 4254 | "Physical Channel configuration (TCH/SDCCH/...)\n" "Physical Channel\n") |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 4255 | { |
| 4256 | struct gsm_bts_trx_ts *ts = vty->index; |
| 4257 | int pchanc; |
| 4258 | |
| 4259 | pchanc = gsm_pchan_parse(argv[0]); |
| 4260 | if (pchanc < 0) |
| 4261 | return CMD_WARNING; |
| 4262 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 4263 | ts->pchan_from_config = pchanc; |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 4264 | |
| 4265 | return CMD_SUCCESS; |
| 4266 | } |
| 4267 | |
| 4268 | /* used for backwards compatibility with old config files that still |
| 4269 | * have uppercase pchan type names */ |
| 4270 | DEFUN_HIDDEN(cfg_ts_pchan_compat, |
| 4271 | cfg_ts_pchan_compat_cmd, |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 4272 | "phys_chan_config PCHAN", |
Holger Hans Peter Freyther | 63b0e44 | 2013-03-03 09:32:08 +0100 | [diff] [blame] | 4273 | "Physical Channel configuration (TCH/SDCCH/...)\n" "Physical Channel\n") |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 4274 | { |
| 4275 | struct gsm_bts_trx_ts *ts = vty->index; |
| 4276 | int pchanc; |
| 4277 | |
| 4278 | pchanc = gsm_pchan_parse(argv[0]); |
Stefan Sperling | e67ebf0 | 2018-07-17 16:03:07 +0200 | [diff] [blame] | 4279 | if (pchanc < 0) { |
| 4280 | vty_out(vty, "Unknown physical channel name '%s'%s", argv[0], VTY_NEWLINE); |
| 4281 | return CMD_ERR_NO_MATCH; |
| 4282 | } |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 4283 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 4284 | ts->pchan_from_config = pchanc; |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 4285 | |
| 4286 | return CMD_SUCCESS; |
| 4287 | } |
| 4288 | |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 4289 | |
| 4290 | |
Harald Welte | 135a648 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 4291 | DEFUN(cfg_ts_tsc, |
| 4292 | cfg_ts_tsc_cmd, |
| 4293 | "training_sequence_code <0-7>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 4294 | "Training Sequence Code of the Timeslot\n" "TSC\n") |
Harald Welte | 135a648 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 4295 | { |
| 4296 | struct gsm_bts_trx_ts *ts = vty->index; |
| 4297 | |
Philipp Maier | 8c498fc | 2018-02-21 13:24:36 +0100 | [diff] [blame] | 4298 | if (!osmo_bts_has_feature(&ts->trx->bts->model->features, BTS_FEAT_MULTI_TSC)) { |
Harald Welte | 903aaea | 2014-01-19 17:10:50 +0100 | [diff] [blame] | 4299 | vty_out(vty, "%% This BTS does not support a TSC != BCC, " |
| 4300 | "falling back to BCC%s", VTY_NEWLINE); |
| 4301 | ts->tsc = -1; |
| 4302 | return CMD_WARNING; |
| 4303 | } |
| 4304 | |
Harald Welte | 135a648 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 4305 | ts->tsc = atoi(argv[0]); |
| 4306 | |
| 4307 | return CMD_SUCCESS; |
| 4308 | } |
| 4309 | |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 4310 | #define HOPPING_STR "Configure frequency hopping\n" |
| 4311 | |
| 4312 | DEFUN(cfg_ts_hopping, |
| 4313 | cfg_ts_hopping_cmd, |
| 4314 | "hopping enabled (0|1)", |
| 4315 | HOPPING_STR "Enable or disable frequency hopping\n" |
| 4316 | "Disable frequency hopping\n" "Enable frequency hopping\n") |
| 4317 | { |
| 4318 | struct gsm_bts_trx_ts *ts = vty->index; |
Harald Welte | c2fb3d0 | 2010-06-14 22:47:37 +0200 | [diff] [blame] | 4319 | int enabled = atoi(argv[0]); |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 4320 | |
Philipp Maier | 8c498fc | 2018-02-21 13:24:36 +0100 | [diff] [blame] | 4321 | if (enabled && !osmo_bts_has_feature(&ts->trx->bts->model->features, BTS_FEAT_HOPPING)) { |
Harald Welte | c2fb3d0 | 2010-06-14 22:47:37 +0200 | [diff] [blame] | 4322 | vty_out(vty, "BTS model does not support hopping%s", |
| 4323 | VTY_NEWLINE); |
| 4324 | return CMD_WARNING; |
| 4325 | } |
| 4326 | |
| 4327 | ts->hopping.enabled = enabled; |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 4328 | |
| 4329 | return CMD_SUCCESS; |
| 4330 | } |
| 4331 | |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 4332 | DEFUN(cfg_ts_hsn, |
| 4333 | cfg_ts_hsn_cmd, |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 4334 | "hopping sequence-number <0-63>", |
| 4335 | HOPPING_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 4336 | "Which hopping sequence to use for this channel\n" |
| 4337 | "Hopping Sequence Number (HSN)\n") |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 4338 | { |
| 4339 | struct gsm_bts_trx_ts *ts = vty->index; |
| 4340 | |
| 4341 | ts->hopping.hsn = atoi(argv[0]); |
| 4342 | |
| 4343 | return CMD_SUCCESS; |
| 4344 | } |
| 4345 | |
| 4346 | DEFUN(cfg_ts_maio, |
| 4347 | cfg_ts_maio_cmd, |
| 4348 | "hopping maio <0-63>", |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 4349 | HOPPING_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 4350 | "Which hopping MAIO to use for this channel\n" |
| 4351 | "Mobile Allocation Index Offset (MAIO)\n") |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 4352 | { |
| 4353 | struct gsm_bts_trx_ts *ts = vty->index; |
| 4354 | |
| 4355 | ts->hopping.maio = atoi(argv[0]); |
| 4356 | |
| 4357 | return CMD_SUCCESS; |
| 4358 | } |
| 4359 | |
| 4360 | DEFUN(cfg_ts_arfcn_add, |
| 4361 | cfg_ts_arfcn_add_cmd, |
| 4362 | "hopping arfcn add <0-1023>", |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 4363 | HOPPING_STR "Configure hopping ARFCN list\n" |
| 4364 | "Add an entry to the hopping ARFCN list\n" "ARFCN\n") |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 4365 | { |
Pau Espin Pedrol | 33ca613 | 2018-11-16 14:12:31 +0100 | [diff] [blame] | 4366 | enum gsm_band unused; |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 4367 | struct gsm_bts_trx_ts *ts = vty->index; |
| 4368 | int arfcn = atoi(argv[0]); |
| 4369 | |
Pau Espin Pedrol | 33ca613 | 2018-11-16 14:12:31 +0100 | [diff] [blame] | 4370 | if (gsm_arfcn2band_rc(arfcn, &unused) < 0) { |
| 4371 | vty_out(vty, "%% Invalid arfcn %" PRIu16 " detected%s", arfcn, VTY_NEWLINE); |
| 4372 | return CMD_WARNING; |
| 4373 | } |
| 4374 | |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 4375 | bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1); |
| 4376 | |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 4377 | return CMD_SUCCESS; |
| 4378 | } |
| 4379 | |
| 4380 | DEFUN(cfg_ts_arfcn_del, |
| 4381 | cfg_ts_arfcn_del_cmd, |
| 4382 | "hopping arfcn del <0-1023>", |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 4383 | HOPPING_STR "Configure hopping ARFCN list\n" |
| 4384 | "Delete an entry to the hopping ARFCN list\n" "ARFCN\n") |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 4385 | { |
Pau Espin Pedrol | 33ca613 | 2018-11-16 14:12:31 +0100 | [diff] [blame] | 4386 | enum gsm_band unused; |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 4387 | struct gsm_bts_trx_ts *ts = vty->index; |
| 4388 | int arfcn = atoi(argv[0]); |
| 4389 | |
Pau Espin Pedrol | 33ca613 | 2018-11-16 14:12:31 +0100 | [diff] [blame] | 4390 | if (gsm_arfcn2band_rc(arfcn, &unused) < 0) { |
| 4391 | vty_out(vty, "%% Invalid arfcn %" PRIu16 " detected%s", arfcn, VTY_NEWLINE); |
| 4392 | return CMD_WARNING; |
| 4393 | } |
| 4394 | |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 4395 | bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0); |
| 4396 | |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 4397 | return CMD_SUCCESS; |
| 4398 | } |
| 4399 | |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 4400 | DEFUN(cfg_ts_e1_subslot, |
| 4401 | cfg_ts_e1_subslot_cmd, |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 4402 | "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 4403 | "E1/T1 channel connected to this on-air timeslot\n" |
| 4404 | "E1/T1 channel connected to this on-air timeslot\n" |
| 4405 | "E1/T1 line connected to this on-air timeslot\n" |
Harald Welte | d13e0cd | 2012-08-17 09:52:03 +0200 | [diff] [blame] | 4406 | "E1/T1 timeslot connected to this on-air timeslot\n" |
| 4407 | "E1/T1 timeslot connected to this on-air timeslot\n" |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 4408 | "E1/T1 sub-slot connected to this on-air timeslot\n" |
| 4409 | "E1/T1 sub-slot 0 connected to this on-air timeslot\n" |
| 4410 | "E1/T1 sub-slot 1 connected to this on-air timeslot\n" |
| 4411 | "E1/T1 sub-slot 2 connected to this on-air timeslot\n" |
| 4412 | "E1/T1 sub-slot 3 connected to this on-air timeslot\n" |
| 4413 | "Full E1/T1 timeslot connected to this on-air timeslot\n") |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 4414 | { |
| 4415 | struct gsm_bts_trx_ts *ts = vty->index; |
| 4416 | |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 4417 | parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]); |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 4418 | |
| 4419 | return CMD_SUCCESS; |
| 4420 | } |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 4421 | |
Stefan Sperling | 71d524c | 2018-05-17 14:38:27 +0200 | [diff] [blame] | 4422 | int print_counter(struct rate_ctr_group *bsc_ctrs, struct rate_ctr *ctr, const struct rate_ctr_desc *desc, void *data) |
| 4423 | { |
| 4424 | struct vty *vty = data; |
| 4425 | vty_out(vty, "%25s: %10"PRIu64" %s%s", desc->name, ctr->current, desc->description, VTY_NEWLINE); |
| 4426 | return 0; |
| 4427 | } |
| 4428 | |
Harald Welte | 4f10c25 | 2010-05-16 21:47:13 +0200 | [diff] [blame] | 4429 | void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net) |
| 4430 | { |
Stefan Sperling | 71d524c | 2018-05-17 14:38:27 +0200 | [diff] [blame] | 4431 | rate_ctr_for_each_counter(net->bsc_ctrs, print_counter, vty); |
Harald Welte | 4f10c25 | 2010-05-16 21:47:13 +0200 | [diff] [blame] | 4432 | } |
| 4433 | |
Holger Hans Peter Freyther | 2484ceb | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 4434 | DEFUN(drop_bts, |
| 4435 | drop_bts_cmd, |
Holger Hans Peter Freyther | 0586b0f | 2010-04-11 12:46:45 +0200 | [diff] [blame] | 4436 | "drop bts connection <0-65535> (oml|rsl)", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 4437 | "Debug/Simulation command to drop Abis/IP BTS\n" |
| 4438 | "Debug/Simulation command to drop Abis/IP BTS\n" |
| 4439 | "Debug/Simulation command to drop Abis/IP BTS\n" |
| 4440 | "BTS NR\n" "Drop OML Connection\n" "Drop RSL Connection\n") |
Holger Hans Peter Freyther | 2484ceb | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 4441 | { |
| 4442 | struct gsm_network *gsmnet; |
| 4443 | struct gsm_bts_trx *trx; |
| 4444 | struct gsm_bts *bts; |
| 4445 | unsigned int bts_nr; |
| 4446 | |
| 4447 | gsmnet = gsmnet_from_vty(vty); |
| 4448 | |
| 4449 | bts_nr = atoi(argv[0]); |
| 4450 | if (bts_nr >= gsmnet->num_bts) { |
| 4451 | vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s", |
| 4452 | gsmnet->num_bts, bts_nr, VTY_NEWLINE); |
| 4453 | return CMD_WARNING; |
| 4454 | } |
| 4455 | |
| 4456 | bts = gsm_bts_num(gsmnet, bts_nr); |
| 4457 | if (!bts) { |
| 4458 | vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE); |
| 4459 | return CMD_WARNING; |
| 4460 | } |
| 4461 | |
| 4462 | if (!is_ipaccess_bts(bts)) { |
| 4463 | vty_out(vty, "This command only works for ipaccess.%s", VTY_NEWLINE); |
| 4464 | return CMD_WARNING; |
| 4465 | } |
| 4466 | |
| 4467 | |
| 4468 | /* close all connections */ |
| 4469 | if (strcmp(argv[1], "oml") == 0) { |
Max | 4586737 | 2019-01-02 15:28:17 +0100 | [diff] [blame] | 4470 | ipaccess_drop_oml(bts, "vty"); |
Holger Hans Peter Freyther | 2484ceb | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 4471 | } else if (strcmp(argv[1], "rsl") == 0) { |
| 4472 | /* close all rsl connections */ |
| 4473 | llist_for_each_entry(trx, &bts->trx_list, list) { |
Max | 4586737 | 2019-01-02 15:28:17 +0100 | [diff] [blame] | 4474 | ipaccess_drop_rsl(trx, "vty"); |
Holger Hans Peter Freyther | 2484ceb | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 4475 | } |
| 4476 | } else { |
| 4477 | vty_out(vty, "Argument must be 'oml# or 'rsl'.%s", VTY_NEWLINE); |
| 4478 | return CMD_WARNING; |
| 4479 | } |
| 4480 | |
| 4481 | return CMD_SUCCESS; |
| 4482 | } |
| 4483 | |
Holger Hans Peter Freyther | 740e65f | 2016-03-16 13:45:23 +0100 | [diff] [blame] | 4484 | DEFUN(restart_bts, restart_bts_cmd, |
| 4485 | "restart-bts <0-65535>", |
| 4486 | "Restart ip.access nanoBTS through OML\n" |
Neels Hofmeyr | 70c5fd2 | 2018-01-19 15:55:14 +0100 | [diff] [blame] | 4487 | BTS_NR_STR) |
Holger Hans Peter Freyther | 740e65f | 2016-03-16 13:45:23 +0100 | [diff] [blame] | 4488 | { |
| 4489 | struct gsm_network *gsmnet; |
| 4490 | struct gsm_bts_trx *trx; |
| 4491 | struct gsm_bts *bts; |
| 4492 | unsigned int bts_nr; |
| 4493 | |
| 4494 | gsmnet = gsmnet_from_vty(vty); |
| 4495 | |
| 4496 | bts_nr = atoi(argv[0]); |
| 4497 | if (bts_nr >= gsmnet->num_bts) { |
| 4498 | vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s", |
| 4499 | gsmnet->num_bts, bts_nr, VTY_NEWLINE); |
| 4500 | return CMD_WARNING; |
| 4501 | } |
| 4502 | |
| 4503 | bts = gsm_bts_num(gsmnet, bts_nr); |
| 4504 | if (!bts) { |
| 4505 | vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE); |
| 4506 | return CMD_WARNING; |
| 4507 | } |
| 4508 | |
| 4509 | if (!is_ipaccess_bts(bts) || is_sysmobts_v2(bts)) { |
| 4510 | vty_out(vty, "This command only works for ipaccess nanoBTS.%s", |
| 4511 | VTY_NEWLINE); |
| 4512 | return CMD_WARNING; |
| 4513 | } |
| 4514 | |
| 4515 | /* go from last TRX to c0 */ |
| 4516 | llist_for_each_entry_reverse(trx, &bts->trx_list, list) |
| 4517 | abis_nm_ipaccess_restart(trx); |
| 4518 | |
| 4519 | return CMD_SUCCESS; |
| 4520 | } |
| 4521 | |
Harald Welte | 8e2e22f | 2017-07-10 20:25:10 +0200 | [diff] [blame] | 4522 | DEFUN(bts_resend, bts_resend_cmd, |
| 4523 | "bts <0-255> resend-system-information", |
Neels Hofmeyr | 70c5fd2 | 2018-01-19 15:55:14 +0100 | [diff] [blame] | 4524 | "BTS Specific Commands\n" BTS_NR_STR |
Harald Welte | 8e2e22f | 2017-07-10 20:25:10 +0200 | [diff] [blame] | 4525 | "Re-generate + re-send BCCH SYSTEM INFORMATION\n") |
| 4526 | { |
| 4527 | struct gsm_network *gsmnet; |
| 4528 | struct gsm_bts_trx *trx; |
| 4529 | struct gsm_bts *bts; |
| 4530 | unsigned int bts_nr; |
| 4531 | |
| 4532 | gsmnet = gsmnet_from_vty(vty); |
| 4533 | |
| 4534 | bts_nr = atoi(argv[0]); |
| 4535 | if (bts_nr >= gsmnet->num_bts) { |
| 4536 | vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s", |
| 4537 | gsmnet->num_bts, bts_nr, VTY_NEWLINE); |
| 4538 | return CMD_WARNING; |
| 4539 | } |
| 4540 | |
| 4541 | bts = gsm_bts_num(gsmnet, bts_nr); |
| 4542 | if (!bts) { |
| 4543 | vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE); |
| 4544 | return CMD_WARNING; |
| 4545 | } |
| 4546 | |
| 4547 | llist_for_each_entry_reverse(trx, &bts->trx_list, list) |
| 4548 | gsm_bts_trx_set_system_infos(trx); |
| 4549 | |
| 4550 | return CMD_SUCCESS; |
| 4551 | } |
| 4552 | |
| 4553 | |
Harald Welte | 30f1f37 | 2014-12-28 15:00:45 +0100 | [diff] [blame] | 4554 | DEFUN(smscb_cmd, smscb_cmd_cmd, |
Harald Welte | 228daad | 2019-05-21 23:37:09 +0200 | [diff] [blame] | 4555 | "bts <0-255> smscb-command (normal|schedule|default) <1-4> HEXSTRING", |
Neels Hofmeyr | 70c5fd2 | 2018-01-19 15:55:14 +0100 | [diff] [blame] | 4556 | "BTS related commands\n" BTS_NR_STR |
Harald Welte | 228daad | 2019-05-21 23:37:09 +0200 | [diff] [blame] | 4557 | "SMS Cell Broadcast\n" |
| 4558 | "Normal (one-shot) SMSCB Message; sent once over Abis+Um\n" |
| 4559 | "Schedule (one-shot) SMSCB Messag; sent once over Abis+Um\n" |
| 4560 | "Default (repeating) SMSCB Message; sent once over Abis, unlimited ovrer Um\n" |
| 4561 | "Last Valid Block\n" |
Harald Welte | 30f1f37 | 2014-12-28 15:00:45 +0100 | [diff] [blame] | 4562 | "Hex Encoded SMSCB message (up to 88 octets)\n") |
| 4563 | { |
| 4564 | struct gsm_bts *bts; |
| 4565 | int bts_nr = atoi(argv[0]); |
Harald Welte | 228daad | 2019-05-21 23:37:09 +0200 | [diff] [blame] | 4566 | const char *type_str = argv[1]; |
| 4567 | int last_block = atoi(argv[2]); |
Harald Welte | 30f1f37 | 2014-12-28 15:00:45 +0100 | [diff] [blame] | 4568 | struct rsl_ie_cb_cmd_type cb_cmd; |
| 4569 | uint8_t buf[88]; |
| 4570 | int rc; |
| 4571 | |
Neels Hofmeyr | b90eabf | 2016-05-11 18:48:39 +0200 | [diff] [blame] | 4572 | bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr); |
Harald Welte | 30f1f37 | 2014-12-28 15:00:45 +0100 | [diff] [blame] | 4573 | if (!bts) { |
| 4574 | vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE); |
| 4575 | return CMD_WARNING; |
| 4576 | } |
Harald Welte | 0bc5365 | 2018-09-09 14:50:59 +0200 | [diff] [blame] | 4577 | if (!gsm_bts_get_cbch(bts)) { |
| 4578 | vty_out(vty, "%% BTS %d doesn't have a CBCH%s", bts_nr, VTY_NEWLINE); |
| 4579 | return CMD_WARNING; |
| 4580 | } |
Harald Welte | 228daad | 2019-05-21 23:37:09 +0200 | [diff] [blame] | 4581 | rc = osmo_hexparse(argv[3], buf, sizeof(buf)); |
Harald Welte | 30f1f37 | 2014-12-28 15:00:45 +0100 | [diff] [blame] | 4582 | if (rc < 0 || rc > sizeof(buf)) { |
| 4583 | vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE); |
| 4584 | return CMD_WARNING; |
| 4585 | } |
| 4586 | |
| 4587 | cb_cmd.spare = 0; |
| 4588 | cb_cmd.def_bcast = 0; |
Harald Welte | 228daad | 2019-05-21 23:37:09 +0200 | [diff] [blame] | 4589 | if (!strcmp(type_str, "normal")) |
| 4590 | cb_cmd.command = RSL_CB_CMD_TYPE_NORMAL; |
| 4591 | else if (!strcmp(type_str, "schedule")) |
| 4592 | cb_cmd.command = RSL_CB_CMD_TYPE_SCHEDULE; |
| 4593 | else if (!strcmp(type_str, "default")) |
| 4594 | cb_cmd.command = RSL_CB_CMD_TYPE_DEFAULT; |
| 4595 | else { |
| 4596 | vty_out(vty, "Error parsing type%s", VTY_NEWLINE); |
| 4597 | return CMD_WARNING; |
| 4598 | } |
Harald Welte | 30f1f37 | 2014-12-28 15:00:45 +0100 | [diff] [blame] | 4599 | |
| 4600 | switch (last_block) { |
| 4601 | case 1: |
| 4602 | cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_1; |
| 4603 | break; |
| 4604 | case 2: |
| 4605 | cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_2; |
| 4606 | break; |
| 4607 | case 3: |
| 4608 | cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_3; |
| 4609 | break; |
| 4610 | case 4: |
| 4611 | cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_4; |
| 4612 | break; |
Vadim Yanitskiy | 56dec0c | 2018-03-06 17:18:25 +0700 | [diff] [blame] | 4613 | default: |
| 4614 | vty_out(vty, "Error parsing LASTBLOCK%s", VTY_NEWLINE); |
| 4615 | return CMD_WARNING; |
Harald Welte | 30f1f37 | 2014-12-28 15:00:45 +0100 | [diff] [blame] | 4616 | } |
| 4617 | |
Harald Welte | ae46685 | 2019-05-21 23:25:30 +0200 | [diff] [blame] | 4618 | rsl_sms_cb_command(bts, RSL_CHAN_SDCCH4_ACCH, cb_cmd, false, buf, rc); |
Harald Welte | 30f1f37 | 2014-12-28 15:00:45 +0100 | [diff] [blame] | 4619 | |
| 4620 | return CMD_SUCCESS; |
| 4621 | } |
| 4622 | |
Harald Welte | 7fe00fb | 2017-05-27 14:09:50 +0200 | [diff] [blame] | 4623 | /* resolve a gsm_bts_trx_ts basd on the given numeric identifiers */ |
Harald Welte | 645eb62 | 2017-05-27 15:52:58 +0200 | [diff] [blame] | 4624 | static struct gsm_bts_trx_ts *vty_get_ts(struct vty *vty, const char *bts_str, const char *trx_str, |
| 4625 | const char *ts_str) |
Harald Welte | 7fe00fb | 2017-05-27 14:09:50 +0200 | [diff] [blame] | 4626 | { |
Harald Welte | 645eb62 | 2017-05-27 15:52:58 +0200 | [diff] [blame] | 4627 | int bts_nr = atoi(bts_str); |
| 4628 | int trx_nr = atoi(trx_str); |
| 4629 | int ts_nr = atoi(ts_str); |
Harald Welte | 7fe00fb | 2017-05-27 14:09:50 +0200 | [diff] [blame] | 4630 | struct gsm_bts *bts; |
| 4631 | struct gsm_bts_trx *trx; |
| 4632 | struct gsm_bts_trx_ts *ts; |
| 4633 | |
| 4634 | bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr); |
| 4635 | if (!bts) { |
| 4636 | vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE); |
| 4637 | return NULL; |
| 4638 | } |
| 4639 | |
| 4640 | trx = gsm_bts_trx_num(bts, trx_nr); |
| 4641 | if (!trx) { |
| 4642 | vty_out(vty, "%% No such TRX (%d)%s", trx_nr, VTY_NEWLINE); |
| 4643 | return NULL; |
| 4644 | } |
| 4645 | |
| 4646 | ts = &trx->ts[ts_nr]; |
| 4647 | |
| 4648 | return ts; |
| 4649 | } |
Harald Welte | 30f1f37 | 2014-12-28 15:00:45 +0100 | [diff] [blame] | 4650 | |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 4651 | DEFUN(pdch_act, pdch_act_cmd, |
| 4652 | "bts <0-255> trx <0-255> timeslot <0-7> pdch (activate|deactivate)", |
Harald Welte | 0bfd8d9 | 2018-02-12 18:06:53 +0100 | [diff] [blame] | 4653 | BTS_NR_TRX_TS_STR2 |
| 4654 | "Packet Data Channel\n" |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 4655 | "Activate Dynamic PDCH/TCH (-> PDCH mode)\n" |
| 4656 | "Deactivate Dynamic PDCH/TCH (-> TCH mode)\n") |
| 4657 | { |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 4658 | struct gsm_bts_trx_ts *ts; |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 4659 | int activate; |
| 4660 | |
Harald Welte | 645eb62 | 2017-05-27 15:52:58 +0200 | [diff] [blame] | 4661 | ts = vty_get_ts(vty, argv[0], argv[1], argv[2]); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 4662 | if (!ts || !ts->fi || ts->fi->state == TS_ST_NOT_INITIALIZED || ts->fi->state == TS_ST_BORKEN) { |
| 4663 | vty_out(vty, "%% Timeslot is not usable%s", VTY_NEWLINE); |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 4664 | return CMD_WARNING; |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 4665 | } |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 4666 | |
Harald Welte | 7fe00fb | 2017-05-27 14:09:50 +0200 | [diff] [blame] | 4667 | if (!is_ipaccess_bts(ts->trx->bts)) { |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 4668 | vty_out(vty, "%% This command only works for ipaccess BTS%s", |
| 4669 | VTY_NEWLINE); |
| 4670 | return CMD_WARNING; |
| 4671 | } |
| 4672 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 4673 | if (ts->pchan_on_init != GSM_PCHAN_TCH_F_TCH_H_PDCH |
| 4674 | && ts->pchan_on_init != GSM_PCHAN_TCH_F_PDCH) { |
| 4675 | vty_out(vty, "%% Timeslot %u is not dynamic TCH/F_TCH/H_PDCH or TCH/F_PDCH%s", |
| 4676 | ts->nr, VTY_NEWLINE); |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 4677 | return CMD_WARNING; |
| 4678 | } |
| 4679 | |
| 4680 | if (!strcmp(argv[3], "activate")) |
| 4681 | activate = 1; |
| 4682 | else |
| 4683 | activate = 0; |
| 4684 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 4685 | if (activate && ts->fi->state != TS_ST_UNUSED) { |
| 4686 | vty_out(vty, "%% Timeslot %u is still in use%s", |
| 4687 | ts->nr, VTY_NEWLINE); |
| 4688 | return CMD_WARNING; |
| 4689 | } else if (!activate && ts->fi->state != TS_ST_PDCH) { |
| 4690 | vty_out(vty, "%% Timeslot %u is not in PDCH mode%s", |
| 4691 | ts->nr, VTY_NEWLINE); |
| 4692 | return CMD_WARNING; |
| 4693 | } |
| 4694 | |
| 4695 | LOG_TS(ts, LOGL_NOTICE, "telnet VTY user asks to %s\n", activate ? "PDCH ACT" : "PDCH DEACT"); |
| 4696 | ts->pdch_act_allowed = activate; |
| 4697 | osmo_fsm_inst_state_chg(ts->fi, activate ? TS_ST_WAIT_PDCH_ACT : TS_ST_WAIT_PDCH_DEACT, 4, 0); |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 4698 | |
| 4699 | return CMD_SUCCESS; |
| 4700 | |
| 4701 | } |
Holger Hans Peter Freyther | 2484ceb | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 4702 | |
Harald Welte | 2abd5e1 | 2017-05-27 14:10:40 +0200 | [diff] [blame] | 4703 | /* configure the lchan for a single AMR mode (as specified) */ |
Stefan Sperling | 42f59d5 | 2018-11-06 14:24:56 +0100 | [diff] [blame] | 4704 | static int lchan_set_single_amr_mode(struct vty *vty, struct gsm_lchan *lchan, uint8_t amr_mode) |
Harald Welte | 2abd5e1 | 2017-05-27 14:10:40 +0200 | [diff] [blame] | 4705 | { |
| 4706 | struct amr_multirate_conf mr; |
| 4707 | struct gsm48_multi_rate_conf *mr_conf; |
Stefan Sperling | 42f59d5 | 2018-11-06 14:24:56 +0100 | [diff] [blame] | 4708 | int rc, vty_rc = CMD_SUCCESS; |
Harald Welte | 2abd5e1 | 2017-05-27 14:10:40 +0200 | [diff] [blame] | 4709 | mr_conf = (struct gsm48_multi_rate_conf *) &mr.gsm48_ie; |
| 4710 | |
| 4711 | if (amr_mode > 7) |
| 4712 | return -1; |
| 4713 | |
| 4714 | memset(&mr, 0, sizeof(mr)); |
| 4715 | mr_conf->ver = 1; |
| 4716 | /* bit-mask of supported modes, only one bit is set. Reflects |
| 4717 | * Figure 10.5.2.47a where there are no thershold and only a |
| 4718 | * single mode */ |
| 4719 | mr.gsm48_ie[1] = 1 << amr_mode; |
| 4720 | |
| 4721 | mr.ms_mode[0].mode = amr_mode; |
| 4722 | mr.bts_mode[0].mode = amr_mode; |
Philipp Maier | 3b9dcb3 | 2018-10-22 14:21:57 +0200 | [diff] [blame] | 4723 | mr.num_modes = 1; |
Harald Welte | 2abd5e1 | 2017-05-27 14:10:40 +0200 | [diff] [blame] | 4724 | |
| 4725 | /* encode this configuration into the lchan for both uplink and |
| 4726 | * downlink direction */ |
Stefan Sperling | 42f59d5 | 2018-11-06 14:24:56 +0100 | [diff] [blame] | 4727 | rc = gsm48_multirate_config(lchan->mr_ms_lv, mr_conf, mr.ms_mode, mr.num_modes); |
| 4728 | if (rc != 0) { |
| 4729 | vty_out(vty, |
| 4730 | "Invalid AMR multirate configuration (%s, amr mode %d, ms) - check parameters%s", |
| 4731 | gsm_lchant_name(lchan->type), amr_mode, VTY_NEWLINE); |
| 4732 | vty_rc = CMD_WARNING; |
| 4733 | } |
| 4734 | rc = gsm48_multirate_config(lchan->mr_bts_lv, mr_conf, mr.bts_mode, mr.num_modes); |
| 4735 | if (rc != 0) { |
| 4736 | vty_out(vty, |
| 4737 | "Invalid AMR multirate configuration (%s, amr mode %d, bts) - check parameters%s", |
| 4738 | gsm_lchant_name(lchan->type), amr_mode, VTY_NEWLINE); |
| 4739 | vty_rc = CMD_WARNING; |
| 4740 | } |
Harald Welte | 2abd5e1 | 2017-05-27 14:10:40 +0200 | [diff] [blame] | 4741 | |
Stefan Sperling | 42f59d5 | 2018-11-06 14:24:56 +0100 | [diff] [blame] | 4742 | return vty_rc; |
Harald Welte | 2abd5e1 | 2017-05-27 14:10:40 +0200 | [diff] [blame] | 4743 | } |
| 4744 | |
| 4745 | /* Debug/Measurement command to activate a given logical channel |
| 4746 | * manually in a given mode/codec. This is useful for receiver |
| 4747 | * performance testing (FER/RBER/...) */ |
| 4748 | DEFUN(lchan_act, lchan_act_cmd, |
| 4749 | "bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7> (activate|deactivate) (hr|fr|efr|amr) [<0-7>]", |
Harald Welte | 0bfd8d9 | 2018-02-12 18:06:53 +0100 | [diff] [blame] | 4750 | BTS_NR_TRX_TS_SS_STR2 |
Harald Welte | 2abd5e1 | 2017-05-27 14:10:40 +0200 | [diff] [blame] | 4751 | "Manual Channel Activation (e.g. for BER test)\n" |
| 4752 | "Manual Channel Deactivation (e.g. for BER test)\n" |
| 4753 | "Half-Rate v1\n" "Full-Rate\n" "Enhanced Full Rate\n" "Adaptive Multi-Rate\n" "AMR Mode\n") |
| 4754 | { |
| 4755 | struct gsm_bts_trx_ts *ts; |
| 4756 | struct gsm_lchan *lchan; |
| 4757 | int ss_nr = atoi(argv[3]); |
| 4758 | const char *act_str = argv[4]; |
| 4759 | const char *codec_str = argv[5]; |
| 4760 | int activate; |
| 4761 | |
| 4762 | ts = vty_get_ts(vty, argv[0], argv[1], argv[2]); |
| 4763 | if (!ts) |
| 4764 | return CMD_WARNING; |
| 4765 | |
| 4766 | lchan = &ts->lchan[ss_nr]; |
| 4767 | |
| 4768 | if (!strcmp(act_str, "activate")) |
| 4769 | activate = 1; |
| 4770 | else |
| 4771 | activate = 0; |
| 4772 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 4773 | /* FIXME: allow dynamic channels with switchover, lchan_activate(lchan, FOR_VTY) */ |
| 4774 | if (ss_nr >= pchan_subslots(ts->pchan_is)) { |
| 4775 | vty_out(vty, "%% subslot index %d too large for physical channel %s (%u slots)%s", |
| 4776 | ss_nr, gsm_pchan_name(ts->pchan_is), pchan_subslots(ts->pchan_is), |
| 4777 | VTY_NEWLINE); |
Harald Welte | 2abd5e1 | 2017-05-27 14:10:40 +0200 | [diff] [blame] | 4778 | return CMD_WARNING; |
| 4779 | } |
| 4780 | |
| 4781 | if (activate) { |
| 4782 | int lchan_t; |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 4783 | if (lchan->fi->state != LCHAN_ST_UNUSED) { |
Harald Welte | 2abd5e1 | 2017-05-27 14:10:40 +0200 | [diff] [blame] | 4784 | vty_out(vty, "%% Cannot activate: Channel busy!%s", VTY_NEWLINE); |
| 4785 | return CMD_WARNING; |
| 4786 | } |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 4787 | lchan_t = gsm_lchan_type_by_pchan(ts->pchan_is); |
Harald Welte | 2abd5e1 | 2017-05-27 14:10:40 +0200 | [diff] [blame] | 4788 | if (lchan_t < 0) |
| 4789 | return CMD_WARNING; |
| 4790 | /* configure the lchan */ |
| 4791 | lchan->type = lchan_t; |
| 4792 | lchan->rsl_cmode = RSL_CMOD_SPD_SPEECH; |
| 4793 | if (!strcmp(codec_str, "hr") || !strcmp(codec_str, "fr")) |
| 4794 | lchan->tch_mode = GSM48_CMODE_SPEECH_V1; |
| 4795 | else if (!strcmp(codec_str, "efr")) |
| 4796 | lchan->tch_mode = GSM48_CMODE_SPEECH_EFR; |
| 4797 | else if (!strcmp(codec_str, "amr")) { |
Stefan Sperling | 42f59d5 | 2018-11-06 14:24:56 +0100 | [diff] [blame] | 4798 | int amr_mode, vty_rc; |
Harald Welte | 2abd5e1 | 2017-05-27 14:10:40 +0200 | [diff] [blame] | 4799 | if (argc < 7) { |
| 4800 | vty_out(vty, "%% AMR requires specification of AMR mode%s", VTY_NEWLINE); |
| 4801 | return CMD_WARNING; |
| 4802 | } |
| 4803 | amr_mode = atoi(argv[6]); |
| 4804 | lchan->tch_mode = GSM48_CMODE_SPEECH_AMR; |
Stefan Sperling | 42f59d5 | 2018-11-06 14:24:56 +0100 | [diff] [blame] | 4805 | vty_rc = lchan_set_single_amr_mode(vty, lchan, amr_mode); |
| 4806 | if (vty_rc != CMD_SUCCESS) |
| 4807 | return vty_rc; |
Harald Welte | 2abd5e1 | 2017-05-27 14:10:40 +0200 | [diff] [blame] | 4808 | } |
| 4809 | vty_out(vty, "%% activating lchan %s%s", gsm_lchan_name(lchan), VTY_NEWLINE); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 4810 | rsl_tx_chan_activ(lchan, RSL_ACT_TYPE_INITIAL, 0); |
| 4811 | rsl_tx_ipacc_crcx(lchan); |
Harald Welte | 2abd5e1 | 2017-05-27 14:10:40 +0200 | [diff] [blame] | 4812 | } else { |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 4813 | if (!lchan->fi) { |
| 4814 | vty_out(vty, "%% Cannot release: Channel not initialized%s", VTY_NEWLINE); |
| 4815 | return CMD_WARNING; |
| 4816 | } |
| 4817 | vty_out(vty, "%% Asking for release of %s in state %s%s", gsm_lchan_name(lchan), |
| 4818 | osmo_fsm_inst_state_name(lchan->fi), VTY_NEWLINE); |
Neels Hofmeyr | 5b1a7d1 | 2018-11-06 22:24:07 +0100 | [diff] [blame] | 4819 | lchan_release(lchan, !!(lchan->conn), false, 0); |
Harald Welte | 2abd5e1 | 2017-05-27 14:10:40 +0200 | [diff] [blame] | 4820 | } |
| 4821 | |
| 4822 | return CMD_SUCCESS; |
| 4823 | } |
| 4824 | |
Philipp Maier | fad4bbc | 2019-01-28 16:28:42 +0100 | [diff] [blame] | 4825 | /* Debug command to send lchans from state LCHAN_ST_UNUSED to state |
| 4826 | * LCHAN_ST_BORKEN and vice versa. */ |
| 4827 | DEFUN_HIDDEN(lchan_set_borken, lchan_set_borken_cmd, |
| 4828 | "bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7> (borken|unused)", |
| 4829 | BTS_NR_TRX_TS_SS_STR2 |
| 4830 | "send lchan to state LCHAN_ST_BORKEN (for debugging)\n" |
| 4831 | "send lchan to state LCHAN_ST_UNUSED (for debugging)\n") |
| 4832 | { |
| 4833 | struct gsm_bts_trx_ts *ts; |
| 4834 | struct gsm_lchan *lchan; |
| 4835 | int ss_nr = atoi(argv[3]); |
| 4836 | ts = vty_get_ts(vty, argv[0], argv[1], argv[2]); |
| 4837 | if (!ts) |
| 4838 | return CMD_WARNING; |
Philipp Maier | bb66d10 | 2019-01-22 11:29:06 +0100 | [diff] [blame] | 4839 | |
Philipp Maier | fad4bbc | 2019-01-28 16:28:42 +0100 | [diff] [blame] | 4840 | lchan = &ts->lchan[ss_nr]; |
| 4841 | if (!lchan->fi) |
| 4842 | return CMD_WARNING; |
| 4843 | |
| 4844 | if (!strcmp(argv[4], "borken")) { |
| 4845 | if (lchan->fi->state == LCHAN_ST_UNUSED) |
| 4846 | osmo_fsm_inst_state_chg(lchan->fi, LCHAN_ST_BORKEN, 0, 0); |
| 4847 | else { |
| 4848 | vty_out(vty, |
| 4849 | "%% lchan is in state %s, only lchans that are in state %s may be moved to state %s manually%s", |
| 4850 | osmo_fsm_state_name(lchan->fi->fsm, lchan->fi->state), |
| 4851 | osmo_fsm_state_name(lchan->fi->fsm, LCHAN_ST_UNUSED), |
| 4852 | osmo_fsm_state_name(lchan->fi->fsm, LCHAN_ST_BORKEN), VTY_NEWLINE); |
| 4853 | return CMD_WARNING; |
| 4854 | } |
| 4855 | } else { |
| 4856 | if (lchan->fi->state == LCHAN_ST_BORKEN) |
| 4857 | osmo_fsm_inst_state_chg(lchan->fi, LCHAN_ST_UNUSED, 0, 0); |
| 4858 | else { |
| 4859 | vty_out(vty, |
| 4860 | "%% lchan is in state %s, only lchans that are in state %s may be moved to state %s manually%s", |
| 4861 | osmo_fsm_state_name(lchan->fi->fsm, lchan->fi->state), |
| 4862 | osmo_fsm_state_name(lchan->fi->fsm, LCHAN_ST_BORKEN), |
| 4863 | osmo_fsm_state_name(lchan->fi->fsm, LCHAN_ST_UNUSED), VTY_NEWLINE); |
| 4864 | return CMD_WARNING; |
| 4865 | } |
| 4866 | } |
| 4867 | |
| 4868 | return CMD_SUCCESS; |
| 4869 | } |
| 4870 | |
Harald Welte | 3f86c52 | 2017-05-27 15:53:28 +0200 | [diff] [blame] | 4871 | DEFUN(lchan_mdcx, lchan_mdcx_cmd, |
| 4872 | "bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7> mdcx A.B.C.D <0-65535>", |
Harald Welte | 0bfd8d9 | 2018-02-12 18:06:53 +0100 | [diff] [blame] | 4873 | BTS_NR_TRX_TS_SS_STR2 |
Harald Welte | 3f86c52 | 2017-05-27 15:53:28 +0200 | [diff] [blame] | 4874 | "Modify RTP Connection\n" "MGW IP Address\n" "MGW UDP Port\n") |
| 4875 | { |
| 4876 | struct gsm_bts_trx_ts *ts; |
| 4877 | struct gsm_lchan *lchan; |
| 4878 | int ss_nr = atoi(argv[3]); |
| 4879 | int port = atoi(argv[5]); |
| 4880 | struct in_addr ia; |
| 4881 | inet_aton(argv[4], &ia); |
| 4882 | |
| 4883 | ts = vty_get_ts(vty, argv[0], argv[1], argv[2]); |
| 4884 | if (!ts) |
| 4885 | return CMD_WARNING; |
| 4886 | |
| 4887 | lchan = &ts->lchan[ss_nr]; |
| 4888 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 4889 | if (ss_nr >= pchan_subslots(ts->pchan_is)) { |
| 4890 | vty_out(vty, "%% subslot index %d too large for physical channel %s (%u slots)%s", |
| 4891 | ss_nr, gsm_pchan_name(ts->pchan_is), pchan_subslots(ts->pchan_is), |
| 4892 | VTY_NEWLINE); |
Harald Welte | 3f86c52 | 2017-05-27 15:53:28 +0200 | [diff] [blame] | 4893 | return CMD_WARNING; |
| 4894 | } |
| 4895 | |
| 4896 | vty_out(vty, "%% connecting RTP of %s to %s:%u%s", gsm_lchan_name(lchan), |
| 4897 | inet_ntoa(ia), port, VTY_NEWLINE); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 4898 | lchan->abis_ip.connect_ip = ia.s_addr; |
| 4899 | lchan->abis_ip.connect_port = port; |
| 4900 | rsl_tx_ipacc_mdcx(lchan); |
Harald Welte | 3f86c52 | 2017-05-27 15:53:28 +0200 | [diff] [blame] | 4901 | return CMD_SUCCESS; |
| 4902 | } |
Harald Welte | b71147a | 2017-07-18 19:11:49 +0200 | [diff] [blame] | 4903 | |
| 4904 | DEFUN(ctrl_trap, ctrl_trap_cmd, |
| 4905 | "ctrl-interface generate-trap TRAP VALUE", |
| 4906 | "Commands related to the CTRL Interface\n" |
| 4907 | "Generate a TRAP for test purpose\n" |
| 4908 | "Identity/Name of the TRAP variable\n" |
| 4909 | "Value of the TRAP variable\n") |
| 4910 | { |
| 4911 | struct gsm_network *net = gsmnet_from_vty(vty); |
| 4912 | |
| 4913 | ctrl_cmd_send_trap(net->ctrl, argv[0], (char *) argv[1]); |
| 4914 | return CMD_SUCCESS; |
| 4915 | } |
| 4916 | |
Neels Hofmeyr | 6dd5a9b | 2018-02-14 00:06:19 +0100 | [diff] [blame] | 4917 | #define NETWORK_STR "Configure the GSM network\n" |
| 4918 | #define CODE_CMD_STR "Code commands\n" |
| 4919 | #define NAME_CMD_STR "Name Commands\n" |
| 4920 | #define NAME_STR "Name to use\n" |
| 4921 | |
| 4922 | DEFUN(cfg_net, |
| 4923 | cfg_net_cmd, |
| 4924 | "network", NETWORK_STR) |
| 4925 | { |
| 4926 | vty->index = gsmnet_from_vty(vty); |
| 4927 | vty->node = GSMNET_NODE; |
| 4928 | |
| 4929 | return CMD_SUCCESS; |
| 4930 | } |
| 4931 | |
| 4932 | DEFUN(cfg_net_ncc, |
| 4933 | cfg_net_ncc_cmd, |
| 4934 | "network country code <1-999>", |
| 4935 | "Set the GSM network country code\n" |
| 4936 | "Country commands\n" |
| 4937 | CODE_CMD_STR |
| 4938 | "Network Country Code to use\n") |
| 4939 | { |
| 4940 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Neels Hofmeyr | f93970b | 2018-03-05 02:09:40 +0100 | [diff] [blame] | 4941 | uint16_t mcc; |
Neels Hofmeyr | 6dd5a9b | 2018-02-14 00:06:19 +0100 | [diff] [blame] | 4942 | |
Neels Hofmeyr | f93970b | 2018-03-05 02:09:40 +0100 | [diff] [blame] | 4943 | if (osmo_mcc_from_str(argv[0], &mcc)) { |
| 4944 | vty_out(vty, "%% Error decoding MCC: %s%s", argv[0], VTY_NEWLINE); |
| 4945 | return CMD_WARNING; |
| 4946 | } |
| 4947 | |
| 4948 | gsmnet->plmn.mcc = mcc; |
Neels Hofmeyr | 6dd5a9b | 2018-02-14 00:06:19 +0100 | [diff] [blame] | 4949 | |
| 4950 | return CMD_SUCCESS; |
| 4951 | } |
| 4952 | |
| 4953 | DEFUN(cfg_net_mnc, |
| 4954 | cfg_net_mnc_cmd, |
| 4955 | "mobile network code <0-999>", |
| 4956 | "Set the GSM mobile network code\n" |
| 4957 | "Network Commands\n" |
| 4958 | CODE_CMD_STR |
| 4959 | "Mobile Network Code to use\n") |
| 4960 | { |
| 4961 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Neels Hofmeyr | f93970b | 2018-03-05 02:09:40 +0100 | [diff] [blame] | 4962 | uint16_t mnc; |
| 4963 | bool mnc_3_digits; |
Neels Hofmeyr | 6dd5a9b | 2018-02-14 00:06:19 +0100 | [diff] [blame] | 4964 | |
Neels Hofmeyr | f93970b | 2018-03-05 02:09:40 +0100 | [diff] [blame] | 4965 | if (osmo_mnc_from_str(argv[0], &mnc, &mnc_3_digits)) { |
| 4966 | vty_out(vty, "%% Error decoding MNC: %s%s", argv[0], VTY_NEWLINE); |
| 4967 | return CMD_WARNING; |
| 4968 | } |
| 4969 | |
| 4970 | gsmnet->plmn.mnc = mnc; |
| 4971 | gsmnet->plmn.mnc_3_digits = mnc_3_digits; |
Neels Hofmeyr | 6dd5a9b | 2018-02-14 00:06:19 +0100 | [diff] [blame] | 4972 | |
| 4973 | return CMD_SUCCESS; |
| 4974 | } |
| 4975 | |
| 4976 | DEFUN(cfg_net_encryption, |
| 4977 | cfg_net_encryption_cmd, |
Harald Welte | 51e4bf3 | 2017-12-23 17:30:18 +0100 | [diff] [blame] | 4978 | "encryption a5 <0-3> [<0-3>] [<0-3>] [<0-3>]", |
| 4979 | "Encryption options\n" |
| 4980 | "GSM A5 Air Interface Encryption\n" |
| 4981 | "A5/n Algorithm Number\n" |
| 4982 | "A5/n Algorithm Number\n" |
| 4983 | "A5/n Algorithm Number\n" |
| 4984 | "A5/n Algorithm Number\n") |
Neels Hofmeyr | 6dd5a9b | 2018-02-14 00:06:19 +0100 | [diff] [blame] | 4985 | { |
| 4986 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | 51e4bf3 | 2017-12-23 17:30:18 +0100 | [diff] [blame] | 4987 | unsigned int i; |
Neels Hofmeyr | 6dd5a9b | 2018-02-14 00:06:19 +0100 | [diff] [blame] | 4988 | |
Harald Welte | 51e4bf3 | 2017-12-23 17:30:18 +0100 | [diff] [blame] | 4989 | gsmnet->a5_encryption_mask = 0; |
| 4990 | for (i = 0; i < argc; i++) |
| 4991 | gsmnet->a5_encryption_mask |= (1 << atoi(argv[i])); |
Neels Hofmeyr | 6dd5a9b | 2018-02-14 00:06:19 +0100 | [diff] [blame] | 4992 | |
| 4993 | return CMD_SUCCESS; |
| 4994 | } |
| 4995 | |
Neels Hofmeyr | 78faf70 | 2018-05-10 05:22:50 +0200 | [diff] [blame] | 4996 | DEFUN_DEPRECATED(cfg_net_dyn_ts_allow_tch_f, |
Neels Hofmeyr | 6dd5a9b | 2018-02-14 00:06:19 +0100 | [diff] [blame] | 4997 | cfg_net_dyn_ts_allow_tch_f_cmd, |
| 4998 | "dyn_ts_allow_tch_f (0|1)", |
| 4999 | "Allow or disallow allocating TCH/F on TCH_F_TCH_H_PDCH timeslots\n" |
| 5000 | "Disallow TCH/F on TCH_F_TCH_H_PDCH (default)\n" |
| 5001 | "Allow TCH/F on TCH_F_TCH_H_PDCH\n") |
| 5002 | { |
| 5003 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 5004 | gsmnet->dyn_ts_allow_tch_f = atoi(argv[0]) ? true : false; |
Neels Hofmeyr | 78faf70 | 2018-05-10 05:22:50 +0200 | [diff] [blame] | 5005 | vty_out(vty, "%% dyn_ts_allow_tch_f is deprecated, rather use msc/codec-list to pick codecs%s", |
| 5006 | VTY_NEWLINE); |
Neels Hofmeyr | 6dd5a9b | 2018-02-14 00:06:19 +0100 | [diff] [blame] | 5007 | return CMD_SUCCESS; |
| 5008 | } |
| 5009 | |
| 5010 | DEFUN(cfg_net_timezone, |
| 5011 | cfg_net_timezone_cmd, |
| 5012 | "timezone <-19-19> (0|15|30|45)", |
| 5013 | "Set the Timezone Offset of the network\n" |
| 5014 | "Timezone offset (hours)\n" |
| 5015 | "Timezone offset (00 minutes)\n" |
| 5016 | "Timezone offset (15 minutes)\n" |
| 5017 | "Timezone offset (30 minutes)\n" |
| 5018 | "Timezone offset (45 minutes)\n" |
| 5019 | ) |
| 5020 | { |
| 5021 | struct gsm_network *net = vty->index; |
| 5022 | int tzhr = atoi(argv[0]); |
| 5023 | int tzmn = atoi(argv[1]); |
| 5024 | |
| 5025 | net->tz.hr = tzhr; |
| 5026 | net->tz.mn = tzmn; |
| 5027 | net->tz.dst = 0; |
| 5028 | net->tz.override = 1; |
| 5029 | |
| 5030 | return CMD_SUCCESS; |
| 5031 | } |
| 5032 | |
| 5033 | DEFUN(cfg_net_timezone_dst, |
| 5034 | cfg_net_timezone_dst_cmd, |
| 5035 | "timezone <-19-19> (0|15|30|45) <0-2>", |
| 5036 | "Set the Timezone Offset of the network\n" |
| 5037 | "Timezone offset (hours)\n" |
| 5038 | "Timezone offset (00 minutes)\n" |
| 5039 | "Timezone offset (15 minutes)\n" |
| 5040 | "Timezone offset (30 minutes)\n" |
| 5041 | "Timezone offset (45 minutes)\n" |
| 5042 | "DST offset (hours)\n" |
| 5043 | ) |
| 5044 | { |
| 5045 | struct gsm_network *net = vty->index; |
| 5046 | int tzhr = atoi(argv[0]); |
| 5047 | int tzmn = atoi(argv[1]); |
| 5048 | int tzdst = atoi(argv[2]); |
| 5049 | |
| 5050 | net->tz.hr = tzhr; |
| 5051 | net->tz.mn = tzmn; |
| 5052 | net->tz.dst = tzdst; |
| 5053 | net->tz.override = 1; |
| 5054 | |
| 5055 | return CMD_SUCCESS; |
| 5056 | } |
| 5057 | |
| 5058 | DEFUN(cfg_net_no_timezone, |
| 5059 | cfg_net_no_timezone_cmd, |
| 5060 | "no timezone", |
| 5061 | NO_STR |
| 5062 | "Disable network timezone override, use system tz\n") |
| 5063 | { |
| 5064 | struct gsm_network *net = vty->index; |
| 5065 | |
| 5066 | net->tz.override = 0; |
| 5067 | |
| 5068 | return CMD_SUCCESS; |
| 5069 | } |
| 5070 | |
| 5071 | DEFUN(cfg_net_per_loc_upd, cfg_net_per_loc_upd_cmd, |
| 5072 | "periodic location update <6-1530>", |
| 5073 | "Periodic Location Updating Interval\n" |
| 5074 | "Periodic Location Updating Interval\n" |
| 5075 | "Periodic Location Updating Interval\n" |
| 5076 | "Periodic Location Updating Interval in Minutes\n") |
| 5077 | { |
| 5078 | struct gsm_network *net = vty->index; |
Neels Hofmeyr | a6078fe | 2019-01-28 03:52:14 +0100 | [diff] [blame] | 5079 | struct osmo_tdef *d = osmo_tdef_get_entry(net->T_defs, 3212); |
Neels Hofmeyr | 6dd5a9b | 2018-02-14 00:06:19 +0100 | [diff] [blame] | 5080 | |
Neels Hofmeyr | 596c402 | 2018-06-16 19:29:50 +0200 | [diff] [blame] | 5081 | OSMO_ASSERT(d); |
| 5082 | d->val = atoi(argv[0]) / 6; |
Neels Hofmeyr | a6078fe | 2019-01-28 03:52:14 +0100 | [diff] [blame] | 5083 | vty_out(vty, "T%d = %lu %s (%s)%s", d->T, d->val, "* 6min", d->desc, VTY_NEWLINE); |
Neels Hofmeyr | 6dd5a9b | 2018-02-14 00:06:19 +0100 | [diff] [blame] | 5084 | return CMD_SUCCESS; |
| 5085 | } |
| 5086 | |
| 5087 | DEFUN(cfg_net_no_per_loc_upd, cfg_net_no_per_loc_upd_cmd, |
| 5088 | "no periodic location update", |
| 5089 | NO_STR |
| 5090 | "Periodic Location Updating Interval\n" |
| 5091 | "Periodic Location Updating Interval\n" |
| 5092 | "Periodic Location Updating Interval\n") |
| 5093 | { |
| 5094 | struct gsm_network *net = vty->index; |
Neels Hofmeyr | a6078fe | 2019-01-28 03:52:14 +0100 | [diff] [blame] | 5095 | struct osmo_tdef *d = osmo_tdef_get_entry(net->T_defs, 3212); |
Neels Hofmeyr | 6dd5a9b | 2018-02-14 00:06:19 +0100 | [diff] [blame] | 5096 | |
Neels Hofmeyr | 596c402 | 2018-06-16 19:29:50 +0200 | [diff] [blame] | 5097 | OSMO_ASSERT(d); |
| 5098 | d->val = 0; |
Neels Hofmeyr | a6078fe | 2019-01-28 03:52:14 +0100 | [diff] [blame] | 5099 | vty_out(vty, "T%d = %lu %s (%s)%s", d->T, d->val, "* 6min", d->desc, VTY_NEWLINE); |
Neels Hofmeyr | 6dd5a9b | 2018-02-14 00:06:19 +0100 | [diff] [blame] | 5100 | return CMD_SUCCESS; |
| 5101 | } |
| 5102 | |
Neels Hofmeyr | f28f1ef | 2018-04-20 15:53:53 +0200 | [diff] [blame] | 5103 | #define MEAS_FEED_STR "Measurement Report export\n" |
| 5104 | |
| 5105 | DEFUN(cfg_net_meas_feed_dest, cfg_net_meas_feed_dest_cmd, |
| 5106 | "meas-feed destination ADDR <0-65535>", |
| 5107 | MEAS_FEED_STR "Where to forward Measurement Report feeds\n" "address or hostname\n" "port number\n") |
| 5108 | { |
| 5109 | int rc; |
| 5110 | const char *host = argv[0]; |
| 5111 | uint16_t port = atoi(argv[1]); |
| 5112 | |
| 5113 | rc = meas_feed_cfg_set(host, port); |
| 5114 | if (rc < 0) |
| 5115 | return CMD_WARNING; |
| 5116 | |
| 5117 | return CMD_SUCCESS; |
| 5118 | } |
| 5119 | |
| 5120 | DEFUN(cfg_net_meas_feed_scenario, cfg_net_meas_feed_scenario_cmd, |
| 5121 | "meas-feed scenario NAME", |
| 5122 | MEAS_FEED_STR "Set a name to include in the Measurement Report feeds\n" "Name string, up to 31 characters\n") |
| 5123 | { |
| 5124 | meas_feed_scenario_set(argv[0]); |
| 5125 | |
| 5126 | return CMD_SUCCESS; |
| 5127 | } |
| 5128 | |
Neels Hofmeyr | a6078fe | 2019-01-28 03:52:14 +0100 | [diff] [blame] | 5129 | DEFUN(show_timer, show_timer_cmd, |
| 5130 | "show timer " OSMO_TDEF_VTY_ARG_T_OPTIONAL, |
| 5131 | SHOW_STR "Show timers\n" |
| 5132 | OSMO_TDEF_VTY_DOC_T) |
| 5133 | { |
| 5134 | struct gsm_network *net = gsmnet_from_vty(vty); |
| 5135 | const char *T_arg = argc > 0 ? argv[0] : NULL; |
| 5136 | return osmo_tdef_vty_show_cmd(vty, net->T_defs, T_arg, NULL); |
| 5137 | } |
| 5138 | |
| 5139 | DEFUN(cfg_net_timer, cfg_net_timer_cmd, |
| 5140 | "timer " OSMO_TDEF_VTY_ARG_SET_OPTIONAL, |
| 5141 | "Configure or show timers\n" |
| 5142 | OSMO_TDEF_VTY_DOC_SET) |
| 5143 | { |
| 5144 | struct gsm_network *net = gsmnet_from_vty(vty); |
| 5145 | /* If any arguments are missing, redirect to 'show' */ |
| 5146 | if (argc < 2) |
| 5147 | return show_timer(self, vty, argc, argv); |
| 5148 | return osmo_tdef_vty_set_cmd(vty, net->T_defs, argv); |
| 5149 | } |
| 5150 | |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 5151 | extern int bsc_vty_init_extra(void); |
Holger Hans Peter Freyther | e1ffc08 | 2010-04-10 00:08:28 +0200 | [diff] [blame] | 5152 | |
Max | db0e380 | 2017-01-12 19:35:11 +0100 | [diff] [blame] | 5153 | int bsc_vty_init(struct gsm_network *network) |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 5154 | { |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 5155 | cfg_ts_pchan_cmd.string = |
| 5156 | vty_cmd_string_from_valstr(tall_bsc_ctx, |
| 5157 | gsm_pchant_names, |
| 5158 | "phys_chan_config (", "|", ")", |
| 5159 | VTY_DO_LOWER); |
| 5160 | cfg_ts_pchan_cmd.doc = |
| 5161 | vty_cmd_string_from_valstr(tall_bsc_ctx, |
| 5162 | gsm_pchant_descs, |
| 5163 | "Physical Channel Combination\n", |
| 5164 | "\n", "", 0); |
| 5165 | |
Harald Welte | e555c2b | 2012-08-17 13:02:12 +0200 | [diff] [blame] | 5166 | cfg_bts_type_cmd.string = |
| 5167 | vty_cmd_string_from_valstr(tall_bsc_ctx, |
| 5168 | bts_type_names, |
| 5169 | "type (", "|", ")", |
| 5170 | VTY_DO_LOWER); |
| 5171 | cfg_bts_type_cmd.doc = |
| 5172 | vty_cmd_string_from_valstr(tall_bsc_ctx, |
| 5173 | bts_type_descs, |
| 5174 | "BTS Vendor/Type\n", |
| 5175 | "\n", "", 0); |
| 5176 | |
Neels Hofmeyr | 6dd5a9b | 2018-02-14 00:06:19 +0100 | [diff] [blame] | 5177 | OSMO_ASSERT(vty_global_gsm_network == NULL); |
| 5178 | vty_global_gsm_network = network; |
| 5179 | |
| 5180 | osmo_stats_vty_add_cmds(); |
| 5181 | |
| 5182 | install_element(CONFIG_NODE, &cfg_net_cmd); |
| 5183 | install_node(&net_node, config_write_net); |
| 5184 | install_element(GSMNET_NODE, &cfg_net_ncc_cmd); |
| 5185 | install_element(GSMNET_NODE, &cfg_net_mnc_cmd); |
| 5186 | install_element(GSMNET_NODE, &cfg_net_encryption_cmd); |
| 5187 | install_element(GSMNET_NODE, &cfg_net_timezone_cmd); |
| 5188 | install_element(GSMNET_NODE, &cfg_net_timezone_dst_cmd); |
| 5189 | install_element(GSMNET_NODE, &cfg_net_no_timezone_cmd); |
| 5190 | install_element(GSMNET_NODE, &cfg_net_per_loc_upd_cmd); |
| 5191 | install_element(GSMNET_NODE, &cfg_net_no_per_loc_upd_cmd); |
| 5192 | install_element(GSMNET_NODE, &cfg_net_dyn_ts_allow_tch_f_cmd); |
Neels Hofmeyr | f28f1ef | 2018-04-20 15:53:53 +0200 | [diff] [blame] | 5193 | install_element(GSMNET_NODE, &cfg_net_meas_feed_dest_cmd); |
| 5194 | install_element(GSMNET_NODE, &cfg_net_meas_feed_scenario_cmd); |
Neels Hofmeyr | a6078fe | 2019-01-28 03:52:14 +0100 | [diff] [blame] | 5195 | install_element(GSMNET_NODE, &cfg_net_timer_cmd); |
Harald Welte | e555c2b | 2012-08-17 13:02:12 +0200 | [diff] [blame] | 5196 | |
Neels Hofmeyr | ea11bf8 | 2016-05-12 01:53:23 +0200 | [diff] [blame] | 5197 | install_element_ve(&bsc_show_net_cmd); |
Harald Welte | b4d5b17 | 2010-05-12 16:10:35 +0000 | [diff] [blame] | 5198 | install_element_ve(&show_bts_cmd); |
Oliver Smith | 8d8d710 | 2018-10-23 15:35:43 +0200 | [diff] [blame] | 5199 | install_element_ve(&show_rejected_bts_cmd); |
Harald Welte | b4d5b17 | 2010-05-12 16:10:35 +0000 | [diff] [blame] | 5200 | install_element_ve(&show_trx_cmd); |
Max | 6f379ba | 2018-11-19 14:05:04 +0100 | [diff] [blame] | 5201 | install_element_ve(&show_trx_con_cmd); |
Harald Welte | b4d5b17 | 2010-05-12 16:10:35 +0000 | [diff] [blame] | 5202 | install_element_ve(&show_ts_cmd); |
| 5203 | install_element_ve(&show_lchan_cmd); |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 5204 | install_element_ve(&show_lchan_summary_cmd); |
Philipp Maier | 761fa13 | 2019-01-22 10:25:05 +0100 | [diff] [blame] | 5205 | install_element_ve(&show_lchan_summary_all_cmd); |
Neels Hofmeyr | a6078fe | 2019-01-28 03:52:14 +0100 | [diff] [blame] | 5206 | install_element_ve(&show_timer_cmd); |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 5207 | |
Philipp Maier | 39f62bb | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 5208 | install_element_ve(&show_subscr_conn_cmd); |
Philipp Maier | 39f62bb | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 5209 | |
Harald Welte | b4d5b17 | 2010-05-12 16:10:35 +0000 | [diff] [blame] | 5210 | install_element_ve(&show_paging_cmd); |
Holger Hans Peter Freyther | ec37bb2 | 2013-02-05 09:39:09 +0100 | [diff] [blame] | 5211 | install_element_ve(&show_paging_group_cmd); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 5212 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 5213 | install_element(ENABLE_NODE, &handover_any_cmd); |
| 5214 | install_element(ENABLE_NODE, &assignment_any_cmd); |
| 5215 | install_element(ENABLE_NODE, &handover_any_to_arfcn_bsic_cmd); |
| 5216 | |
Max | db0e380 | 2017-01-12 19:35:11 +0100 | [diff] [blame] | 5217 | logging_vty_add_cmds(NULL); |
Harald Welte | 2f4f4b8 | 2018-02-14 00:50:27 +0100 | [diff] [blame] | 5218 | osmo_talloc_vty_add_cmds(); |
Holger Hans Peter Freyther | b61e3b2 | 2009-12-22 22:32:51 +0100 | [diff] [blame] | 5219 | |
Holger Hans Peter Freyther | f7d752f | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 5220 | install_element(GSMNET_NODE, &cfg_net_neci_cmd); |
Holger Hans Peter Freyther | 5a3a61d | 2010-09-06 09:25:48 +0800 | [diff] [blame] | 5221 | install_element(GSMNET_NODE, &cfg_net_dtx_cmd); |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 5222 | install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd); |
Neels Hofmeyr | e25018b | 2017-11-27 21:29:33 +0100 | [diff] [blame] | 5223 | /* See also handover commands added on net level from handover_vty.c */ |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 5224 | |
| 5225 | install_element(GSMNET_NODE, &cfg_bts_cmd); |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 5226 | install_node(&bts_node, config_write_bts); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 5227 | install_element(BTS_NODE, &cfg_bts_type_cmd); |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 5228 | install_element(BTS_NODE, &cfg_description_cmd); |
| 5229 | install_element(BTS_NODE, &cfg_no_description_cmd); |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 5230 | install_element(BTS_NODE, &cfg_bts_band_cmd); |
Holger Hans Peter Freyther | c4a49e3 | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 5231 | install_element(BTS_NODE, &cfg_bts_ci_cmd); |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 5232 | install_element(BTS_NODE, &cfg_bts_dtxu_cmd); |
| 5233 | install_element(BTS_NODE, &cfg_bts_dtxd_cmd); |
| 5234 | install_element(BTS_NODE, &cfg_bts_no_dtxu_cmd); |
| 5235 | install_element(BTS_NODE, &cfg_bts_no_dtxd_cmd); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 5236 | install_element(BTS_NODE, &cfg_bts_lac_cmd); |
| 5237 | install_element(BTS_NODE, &cfg_bts_tsc_cmd); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 5238 | install_element(BTS_NODE, &cfg_bts_bsic_cmd); |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 5239 | install_element(BTS_NODE, &cfg_bts_unit_id_cmd); |
Harald Welte | 8b29180 | 2013-03-12 13:57:05 +0100 | [diff] [blame] | 5240 | install_element(BTS_NODE, &cfg_bts_rsl_ip_cmd); |
Sylvain Munaut | c951946 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 5241 | install_element(BTS_NODE, &cfg_bts_nokia_site_skip_reset_cmd); |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 5242 | install_element(BTS_NODE, &cfg_bts_nokia_site_no_loc_rel_cnf_cmd); |
Sipos Csaba | 56e1766 | 2015-02-07 13:27:36 +0100 | [diff] [blame] | 5243 | install_element(BTS_NODE, &cfg_bts_nokia_site_bts_reset_timer_cnf_cmd); |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 5244 | install_element(BTS_NODE, &cfg_bts_stream_id_cmd); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 5245 | install_element(BTS_NODE, &cfg_bts_oml_e1_cmd); |
| 5246 | install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd); |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 5247 | install_element(BTS_NODE, &cfg_bts_challoc_cmd); |
Sylvain Munaut | 4010f1e | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 5248 | install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd); |
| 5249 | install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd); |
Andreas Eversberg | 2ee7ecd | 2012-10-13 07:27:47 +0200 | [diff] [blame] | 5250 | install_element(BTS_NODE, &cfg_bts_chan_desc_att_cmd); |
| 5251 | install_element(BTS_NODE, &cfg_bts_chan_desc_bs_pa_mfrms_cmd); |
| 5252 | install_element(BTS_NODE, &cfg_bts_chan_desc_bs_ag_blks_res_cmd); |
Harald Welte | 1540025 | 2019-05-24 11:56:23 +0200 | [diff] [blame] | 5253 | install_element(BTS_NODE, &cfg_bts_ccch_load_ind_thresh_cmd); |
Holger Hans Peter Freyther | 95c2290 | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 5254 | install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd); |
| 5255 | install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd); |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 5256 | install_element(BTS_NODE, &cfg_bts_cell_barred_cmd); |
Holger Hans Peter Freyther | 3a0a463 | 2010-05-14 00:39:19 +0800 | [diff] [blame] | 5257 | install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd); |
Ivan Kluchnikov | 6792059 | 2013-09-16 13:13:04 +0400 | [diff] [blame] | 5258 | install_element(BTS_NODE, &cfg_bts_rach_ac_class_cmd); |
Harald Welte (local) | 0e451d0 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 5259 | install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd); |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 5260 | install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd); |
| 5261 | install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd); |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 5262 | install_element(BTS_NODE, &cfg_bts_cell_bar_qualify_cmd); |
| 5263 | install_element(BTS_NODE, &cfg_bts_cell_resel_ofs_cmd); |
| 5264 | install_element(BTS_NODE, &cfg_bts_temp_ofs_cmd); |
| 5265 | install_element(BTS_NODE, &cfg_bts_temp_ofs_inf_cmd); |
| 5266 | install_element(BTS_NODE, &cfg_bts_penalty_time_cmd); |
| 5267 | install_element(BTS_NODE, &cfg_bts_penalty_time_rsvd_cmd); |
Andreas Eversberg | 4d4944a | 2013-03-10 11:49:35 +0100 | [diff] [blame] | 5268 | install_element(BTS_NODE, &cfg_bts_radio_link_timeout_cmd); |
Harald Welte | 2f8b9d2 | 2017-06-18 11:12:13 +0300 | [diff] [blame] | 5269 | install_element(BTS_NODE, &cfg_bts_radio_link_timeout_inf_cmd); |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 5270 | install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd); |
bhargava | 350533c | 2016-07-21 11:14:34 +0530 | [diff] [blame] | 5271 | install_element(BTS_NODE, &cfg_bts_gprs_11bit_rach_support_for_egprs_cmd); |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 5272 | install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd); |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 5273 | install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd); |
Andreas Eversberg | 0c8f9ca | 2013-03-16 16:31:26 +0100 | [diff] [blame] | 5274 | install_element(BTS_NODE, &cfg_bts_gprs_net_ctrl_ord_cmd); |
Max | 292ec58 | 2016-07-28 11:55:37 +0200 | [diff] [blame] | 5275 | install_element(BTS_NODE, &cfg_bts_gprs_ctrl_ack_cmd); |
| 5276 | install_element(BTS_NODE, &cfg_no_bts_gprs_ctrl_ack_cmd); |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 5277 | install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd); |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 5278 | install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd); |
Harald Welte | a5731cf | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 5279 | install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd); |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 5280 | install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd); |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 5281 | install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd); |
| 5282 | install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd); |
| 5283 | install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd); |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 5284 | install_element(BTS_NODE, &cfg_bts_pag_free_cmd); |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 5285 | install_element(BTS_NODE, &cfg_bts_si_mode_cmd); |
| 5286 | install_element(BTS_NODE, &cfg_bts_si_static_cmd); |
Pau Espin Pedrol | 1cf21de | 2018-12-05 13:38:10 +0100 | [diff] [blame] | 5287 | install_element(BTS_NODE, &cfg_bts_si_unused_send_empty_cmd); |
| 5288 | install_element(BTS_NODE, &cfg_bts_no_si_unused_send_empty_cmd); |
Harald Welte | 42def72 | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 5289 | install_element(BTS_NODE, &cfg_bts_early_cm_cmd); |
Pau Espin Pedrol | e8dda5f | 2017-11-23 19:06:09 +0100 | [diff] [blame] | 5290 | install_element(BTS_NODE, &cfg_bts_early_cm_3g_cmd); |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 5291 | install_element(BTS_NODE, &cfg_bts_neigh_mode_cmd); |
| 5292 | install_element(BTS_NODE, &cfg_bts_neigh_cmd); |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 5293 | install_element(BTS_NODE, &cfg_bts_si5_neigh_cmd); |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 5294 | install_element(BTS_NODE, &cfg_bts_si2quater_neigh_add_cmd); |
| 5295 | install_element(BTS_NODE, &cfg_bts_si2quater_neigh_del_cmd); |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 5296 | install_element(BTS_NODE, &cfg_bts_si2quater_uarfcn_add_cmd); |
| 5297 | install_element(BTS_NODE, &cfg_bts_si2quater_uarfcn_del_cmd); |
Holger Hans Peter Freyther | e30d40d | 2012-07-20 10:27:31 +0200 | [diff] [blame] | 5298 | install_element(BTS_NODE, &cfg_bts_excl_rf_lock_cmd); |
| 5299 | install_element(BTS_NODE, &cfg_bts_no_excl_rf_lock_cmd); |
Jacob Erlbeck | 65d114f | 2014-01-16 11:02:14 +0100 | [diff] [blame] | 5300 | install_element(BTS_NODE, &cfg_bts_force_comb_si_cmd); |
| 5301 | install_element(BTS_NODE, &cfg_bts_no_force_comb_si_cmd); |
Andreas Eversberg | a83d511 | 2013-12-07 18:32:28 +0100 | [diff] [blame] | 5302 | install_element(BTS_NODE, &cfg_bts_codec0_cmd); |
| 5303 | install_element(BTS_NODE, &cfg_bts_codec1_cmd); |
| 5304 | install_element(BTS_NODE, &cfg_bts_codec2_cmd); |
| 5305 | install_element(BTS_NODE, &cfg_bts_codec3_cmd); |
| 5306 | install_element(BTS_NODE, &cfg_bts_codec4_cmd); |
Holger Hans Peter Freyther | c22930e | 2014-12-17 14:46:17 +0100 | [diff] [blame] | 5307 | install_element(BTS_NODE, &cfg_bts_depends_on_cmd); |
| 5308 | install_element(BTS_NODE, &cfg_bts_no_depends_on_cmd); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 5309 | install_element(BTS_NODE, &cfg_bts_amr_fr_modes1_cmd); |
| 5310 | install_element(BTS_NODE, &cfg_bts_amr_fr_modes2_cmd); |
| 5311 | install_element(BTS_NODE, &cfg_bts_amr_fr_modes3_cmd); |
| 5312 | install_element(BTS_NODE, &cfg_bts_amr_fr_modes4_cmd); |
| 5313 | install_element(BTS_NODE, &cfg_bts_amr_fr_thres1_cmd); |
| 5314 | install_element(BTS_NODE, &cfg_bts_amr_fr_thres2_cmd); |
| 5315 | install_element(BTS_NODE, &cfg_bts_amr_fr_thres3_cmd); |
| 5316 | install_element(BTS_NODE, &cfg_bts_amr_fr_hyst1_cmd); |
| 5317 | install_element(BTS_NODE, &cfg_bts_amr_fr_hyst2_cmd); |
| 5318 | install_element(BTS_NODE, &cfg_bts_amr_fr_hyst3_cmd); |
| 5319 | install_element(BTS_NODE, &cfg_bts_amr_fr_start_mode_cmd); |
| 5320 | install_element(BTS_NODE, &cfg_bts_amr_hr_modes1_cmd); |
| 5321 | install_element(BTS_NODE, &cfg_bts_amr_hr_modes2_cmd); |
| 5322 | install_element(BTS_NODE, &cfg_bts_amr_hr_modes3_cmd); |
| 5323 | install_element(BTS_NODE, &cfg_bts_amr_hr_modes4_cmd); |
| 5324 | install_element(BTS_NODE, &cfg_bts_amr_hr_thres1_cmd); |
| 5325 | install_element(BTS_NODE, &cfg_bts_amr_hr_thres2_cmd); |
| 5326 | install_element(BTS_NODE, &cfg_bts_amr_hr_thres3_cmd); |
| 5327 | install_element(BTS_NODE, &cfg_bts_amr_hr_hyst1_cmd); |
| 5328 | install_element(BTS_NODE, &cfg_bts_amr_hr_hyst2_cmd); |
| 5329 | install_element(BTS_NODE, &cfg_bts_amr_hr_hyst3_cmd); |
| 5330 | install_element(BTS_NODE, &cfg_bts_amr_hr_start_mode_cmd); |
Harald Welte | 8254cf7 | 2017-05-29 13:42:19 +0200 | [diff] [blame] | 5331 | install_element(BTS_NODE, &cfg_bts_pcu_sock_cmd); |
Stefan Sperling | 6442e43 | 2018-02-06 14:44:54 +0100 | [diff] [blame] | 5332 | install_element(BTS_NODE, &cfg_bts_acc_ramping_cmd); |
| 5333 | install_element(BTS_NODE, &cfg_bts_no_acc_ramping_cmd); |
| 5334 | install_element(BTS_NODE, &cfg_bts_acc_ramping_step_interval_cmd); |
| 5335 | install_element(BTS_NODE, &cfg_bts_acc_ramping_step_size_cmd); |
Pau Espin Pedrol | 1b96334 | 2018-11-07 14:19:32 +0100 | [diff] [blame] | 5336 | install_element(BTS_NODE, &cfg_bts_t3113_dynamic_cmd); |
| 5337 | install_element(BTS_NODE, &cfg_bts_no_t3113_dynamic_cmd); |
Neels Hofmeyr | 19bed23 | 2018-03-22 04:54:57 +0100 | [diff] [blame] | 5338 | neighbor_ident_vty_init(network, network->neighbor_bss_cells); |
Neels Hofmeyr | e25018b | 2017-11-27 21:29:33 +0100 | [diff] [blame] | 5339 | /* See also handover commands added on bts level from handover_vty.c */ |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 5340 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 5341 | install_element(BTS_NODE, &cfg_trx_cmd); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 5342 | install_node(&trx_node, dummy_config_write); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 5343 | install_element(TRX_NODE, &cfg_trx_arfcn_cmd); |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 5344 | install_element(TRX_NODE, &cfg_description_cmd); |
| 5345 | install_element(TRX_NODE, &cfg_no_description_cmd); |
Harald Welte (local) | 7b37d97 | 2009-12-27 20:56:38 +0100 | [diff] [blame] | 5346 | install_element(TRX_NODE, &cfg_trx_nominal_power_cmd); |
Harald Welte | 879dc97 | 2009-06-20 22:36:12 +0200 | [diff] [blame] | 5347 | install_element(TRX_NODE, &cfg_trx_max_power_red_cmd); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 5348 | install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd); |
| 5349 | install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd); |
Holger Hans Peter Freyther | 2d501ea | 2009-11-11 11:54:24 +0100 | [diff] [blame] | 5350 | install_element(TRX_NODE, &cfg_trx_rf_locked_cmd); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 5351 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 5352 | install_element(TRX_NODE, &cfg_ts_cmd); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 5353 | install_node(&ts_node, dummy_config_write); |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 5354 | install_element(TS_NODE, &cfg_ts_pchan_cmd); |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 5355 | install_element(TS_NODE, &cfg_ts_pchan_compat_cmd); |
Harald Welte | 135a648 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 5356 | install_element(TS_NODE, &cfg_ts_tsc_cmd); |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 5357 | install_element(TS_NODE, &cfg_ts_hopping_cmd); |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 5358 | install_element(TS_NODE, &cfg_ts_hsn_cmd); |
| 5359 | install_element(TS_NODE, &cfg_ts_maio_cmd); |
| 5360 | install_element(TS_NODE, &cfg_ts_arfcn_add_cmd); |
| 5361 | install_element(TS_NODE, &cfg_ts_arfcn_del_cmd); |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 5362 | install_element(TS_NODE, &cfg_ts_e1_subslot_cmd); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 5363 | |
Holger Hans Peter Freyther | 2484ceb | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 5364 | install_element(ENABLE_NODE, &drop_bts_cmd); |
Holger Hans Peter Freyther | 740e65f | 2016-03-16 13:45:23 +0100 | [diff] [blame] | 5365 | install_element(ENABLE_NODE, &restart_bts_cmd); |
Harald Welte | 8e2e22f | 2017-07-10 20:25:10 +0200 | [diff] [blame] | 5366 | install_element(ENABLE_NODE, &bts_resend_cmd); |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 5367 | install_element(ENABLE_NODE, &pdch_act_cmd); |
Harald Welte | 2abd5e1 | 2017-05-27 14:10:40 +0200 | [diff] [blame] | 5368 | install_element(ENABLE_NODE, &lchan_act_cmd); |
Harald Welte | 3f86c52 | 2017-05-27 15:53:28 +0200 | [diff] [blame] | 5369 | install_element(ENABLE_NODE, &lchan_mdcx_cmd); |
Philipp Maier | fad4bbc | 2019-01-28 16:28:42 +0100 | [diff] [blame] | 5370 | install_element(ENABLE_NODE, &lchan_set_borken_cmd); |
| 5371 | |
Harald Welte | b22dcb8 | 2018-02-12 17:57:57 +0100 | [diff] [blame] | 5372 | install_element(ENABLE_NODE, &handover_subscr_conn_cmd); |
| 5373 | install_element(ENABLE_NODE, &assignment_subscr_conn_cmd); |
Harald Welte | 30f1f37 | 2014-12-28 15:00:45 +0100 | [diff] [blame] | 5374 | install_element(ENABLE_NODE, &smscb_cmd_cmd); |
Harald Welte | b71147a | 2017-07-18 19:11:49 +0200 | [diff] [blame] | 5375 | install_element(ENABLE_NODE, &ctrl_trap_cmd); |
Holger Hans Peter Freyther | 2484ceb | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 5376 | |
Harald Welte | 81c9b9c | 2010-05-31 16:40:40 +0200 | [diff] [blame] | 5377 | abis_nm_vty_init(); |
Harald Welte | e1d5eca | 2011-02-12 14:42:59 +0100 | [diff] [blame] | 5378 | abis_om2k_vty_init(); |
Harald Welte | 3016d9f | 2011-02-05 13:54:41 +0100 | [diff] [blame] | 5379 | e1inp_vty_init(); |
Harald Welte | 42def72 | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 5380 | osmo_fsm_vty_add_cmds(); |
Harald Welte | 81c9b9c | 2010-05-31 16:40:40 +0200 | [diff] [blame] | 5381 | |
Neels Hofmeyr | e25018b | 2017-11-27 21:29:33 +0100 | [diff] [blame] | 5382 | ho_vty_init(); |
| 5383 | |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 5384 | bsc_vty_init_extra(); |
Harald Welte | 40f8289 | 2009-05-23 17:31:39 +0000 | [diff] [blame] | 5385 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 5386 | return 0; |
| 5387 | } |