Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1 | /* OpenBSC interface to quagga VTY */ |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2 | /* (C) 2009-2010 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> |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 23 | |
Harald Welte | 4b037e4 | 2010-05-19 19:45:32 +0200 | [diff] [blame] | 24 | #include <osmocom/vty/command.h> |
| 25 | #include <osmocom/vty/buffer.h> |
| 26 | #include <osmocom/vty/vty.h> |
| 27 | #include <osmocom/vty/logging.h> |
Jacob Erlbeck | 64630cc | 2015-10-26 16:25:37 +0100 | [diff] [blame] | 28 | #include <osmocom/vty/stats.h> |
Harald Welte | 4b037e4 | 2010-05-19 19:45:32 +0200 | [diff] [blame] | 29 | #include <osmocom/vty/telnet_interface.h> |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 30 | #include <osmocom/vty/misc.h> |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 31 | #include <osmocom/gsm/protocol/gsm_04_08.h> |
Holger Hans Peter Freyther | ec37bb2 | 2013-02-05 09:39:09 +0100 | [diff] [blame] | 32 | #include <osmocom/gsm/gsm0502.h> |
Harald Welte | 1f7fe3c | 2017-07-18 19:11:49 +0200 | [diff] [blame] | 33 | #include <osmocom/ctrl/control_if.h> |
Holger Hans Peter Freyther | ec37bb2 | 2013-02-05 09:39:09 +0100 | [diff] [blame] | 34 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 35 | #include <arpa/inet.h> |
| 36 | |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 37 | #include <osmocom/core/linuxlist.h> |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 38 | #include <openbsc/gsm_data.h> |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 39 | #include <osmocom/abis/e1_input.h> |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 40 | #include <openbsc/abis_nm.h> |
Harald Welte | 4d54d0b | 2011-02-19 16:48:17 +0100 | [diff] [blame] | 41 | #include <openbsc/abis_om2000.h> |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 42 | #include <osmocom/core/utils.h> |
| 43 | #include <osmocom/gsm/gsm_utils.h> |
Harald Welte | cdc59ff | 2011-05-23 20:42:26 +0200 | [diff] [blame] | 44 | #include <osmocom/gsm/abis_nm.h> |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 45 | #include <openbsc/chan_alloc.h> |
Harald Welte | 8387a49 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 46 | #include <openbsc/meas_rep.h> |
Harald Welte | 40f8289 | 2009-05-23 17:31:39 +0000 | [diff] [blame] | 47 | #include <openbsc/db.h> |
Holger Hans Peter Freyther | 3c71232 | 2010-04-06 11:55:37 +0200 | [diff] [blame] | 48 | #include <openbsc/vty.h> |
Harald Welte | ea34a4e | 2012-06-16 14:59:56 +0800 | [diff] [blame] | 49 | #include <osmocom/gprs/gprs_ns.h> |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 50 | #include <openbsc/system_information.h> |
Harald Welte | 5bc61dc | 2010-05-16 22:02:16 +0200 | [diff] [blame] | 51 | #include <openbsc/debug.h> |
Holger Hans Peter Freyther | 85334f1 | 2010-11-09 17:00:42 +0100 | [diff] [blame] | 52 | #include <openbsc/paging.h> |
Harald Welte | f7a2b19 | 2011-08-20 18:25:02 +0200 | [diff] [blame] | 53 | #include <openbsc/ipaccess.h> |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 54 | #include <openbsc/abis_rsl.h> |
Neels Hofmeyr | a42855f | 2017-02-23 21:49:55 +0100 | [diff] [blame] | 55 | #include <openbsc/bsc_msc_data.h> |
Holger Hans Peter Freyther | 37ac420 | 2011-02-24 14:19:14 +0100 | [diff] [blame] | 56 | #include <openbsc/osmo_bsc_rf.h> |
Harald Welte | 8254cf7 | 2017-05-29 13:42:19 +0200 | [diff] [blame] | 57 | #include <openbsc/pcu_if.h> |
Neels Hofmeyr | 06d39fd | 2016-05-12 01:16:58 +0200 | [diff] [blame] | 58 | #include <openbsc/common_cs.h> |
Harald Welte | 2483f1b | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 59 | #include <openbsc/vlr.h> |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 60 | #include <openbsc/handover.h> |
Neels Hofmeyr | 06d39fd | 2016-05-12 01:16:58 +0200 | [diff] [blame] | 61 | |
Holger Hans Peter Freyther | ec37bb2 | 2013-02-05 09:39:09 +0100 | [diff] [blame] | 62 | #include <inttypes.h> |
| 63 | |
Harald Welte | c08e8be | 2011-03-04 13:53:51 +0100 | [diff] [blame] | 64 | #include "../../bscconfig.h" |
Harald Welte | 1353f96 | 2010-05-16 19:20:24 +0200 | [diff] [blame] | 65 | |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 66 | |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 67 | #define LCHAN_NR_STR "Logical Channel Number\n" |
| 68 | |
| 69 | |
Harald Welte | ea4647d | 2010-05-12 17:19:53 +0000 | [diff] [blame] | 70 | /* FIXME: this should go to some common file */ |
| 71 | static const struct value_string gprs_ns_timer_strs[] = { |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 72 | { 0, "tns-block" }, |
| 73 | { 1, "tns-block-retries" }, |
| 74 | { 2, "tns-reset" }, |
| 75 | { 3, "tns-reset-retries" }, |
| 76 | { 4, "tns-test" }, |
| 77 | { 5, "tns-alive" }, |
| 78 | { 6, "tns-alive-retries" }, |
| 79 | { 0, NULL } |
| 80 | }; |
| 81 | |
Harald Welte | ea4647d | 2010-05-12 17:19:53 +0000 | [diff] [blame] | 82 | static const struct value_string gprs_bssgp_cfg_strs[] = { |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 83 | { 0, "blocking-timer" }, |
| 84 | { 1, "blocking-retries" }, |
| 85 | { 2, "unblocking-retries" }, |
| 86 | { 3, "reset-timer" }, |
| 87 | { 4, "reset-retries" }, |
| 88 | { 5, "suspend-timer" }, |
| 89 | { 6, "suspend-retries" }, |
| 90 | { 7, "resume-timer" }, |
| 91 | { 8, "resume-retries" }, |
| 92 | { 9, "capability-update-timer" }, |
| 93 | { 10, "capability-update-retries" }, |
| 94 | { 0, NULL } |
| 95 | }; |
| 96 | |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 97 | static const struct value_string bts_neigh_mode_strs[] = { |
| 98 | { NL_MODE_AUTOMATIC, "automatic" }, |
| 99 | { NL_MODE_MANUAL, "manual" }, |
| 100 | { NL_MODE_MANUAL_SI5SEP, "manual-si5" }, |
| 101 | { 0, NULL } |
| 102 | }; |
| 103 | |
Daniel Willmann | 7d10983 | 2012-05-14 18:43:23 +0200 | [diff] [blame] | 104 | const struct value_string bts_loc_fix_names[] = { |
| 105 | { BTS_LOC_FIX_INVALID, "invalid" }, |
| 106 | { BTS_LOC_FIX_2D, "fix2d" }, |
| 107 | { BTS_LOC_FIX_3D, "fix3d" }, |
| 108 | { 0, NULL } |
| 109 | }; |
| 110 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 111 | struct cmd_node bts_node = { |
| 112 | BTS_NODE, |
Harald Welte | 570ce24 | 2012-08-17 13:16:10 +0200 | [diff] [blame] | 113 | "%s(config-net-bts)# ", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 114 | 1, |
| 115 | }; |
| 116 | |
| 117 | struct cmd_node trx_node = { |
| 118 | TRX_NODE, |
Harald Welte | 570ce24 | 2012-08-17 13:16:10 +0200 | [diff] [blame] | 119 | "%s(config-net-bts-trx)# ", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 120 | 1, |
| 121 | }; |
| 122 | |
| 123 | struct cmd_node ts_node = { |
| 124 | TS_NODE, |
Harald Welte | 570ce24 | 2012-08-17 13:16:10 +0200 | [diff] [blame] | 125 | "%s(config-net-bts-trx-ts)# ", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 126 | 1, |
| 127 | }; |
| 128 | |
| 129 | static int dummy_config_write(struct vty *v) |
| 130 | { |
| 131 | return CMD_SUCCESS; |
| 132 | } |
| 133 | |
| 134 | static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms) |
| 135 | { |
Harald Welte | 1304b35 | 2013-03-15 16:57:33 +0100 | [diff] [blame] | 136 | vty_out(vty,"Oper '%s', Admin '%s', Avail '%s'%s", |
| 137 | abis_nm_opstate_name(nms->operational), |
| 138 | get_value_string(abis_nm_adm_state_names, nms->administrative), |
Harald Welte | 867d9f3 | 2011-05-23 20:30:39 +0200 | [diff] [blame] | 139 | abis_nm_avail_name(nms->availability), VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 140 | } |
| 141 | |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 142 | static void dump_pchan_load_vty(struct vty *vty, char *prefix, |
| 143 | const struct pchan_load *pl) |
| 144 | { |
| 145 | int i; |
| 146 | |
| 147 | for (i = 0; i < ARRAY_SIZE(pl->pchan); i++) { |
| 148 | const struct load_counter *lc = &pl->pchan[i]; |
| 149 | unsigned int percent; |
| 150 | |
| 151 | if (lc->total == 0) |
| 152 | continue; |
| 153 | |
| 154 | percent = (lc->used * 100) / lc->total; |
| 155 | |
| 156 | vty_out(vty, "%s%20s: %3u%% (%u/%u)%s", prefix, |
| 157 | gsm_pchan_name(i), percent, lc->used, lc->total, |
| 158 | VTY_NEWLINE); |
| 159 | } |
| 160 | } |
| 161 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 162 | static void net_dump_vty(struct vty *vty, struct gsm_network *net) |
| 163 | { |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 164 | struct pchan_load pl; |
| 165 | |
Harald Welte | ef235b5 | 2009-03-10 12:34:02 +0000 | [diff] [blame] | 166 | vty_out(vty, "BSC is on Country Code %u, Network Code %u " |
| 167 | "and has %u BTS%s", net->country_code, net->network_code, |
| 168 | net->num_bts, VTY_NEWLINE); |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 169 | vty_out(vty, " Long network name: '%s'%s", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 170 | net->name_long, VTY_NEWLINE); |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 171 | vty_out(vty, " Short network name: '%s'%s", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 172 | net->name_short, VTY_NEWLINE); |
Max | ddee01f | 2016-05-24 14:23:27 +0200 | [diff] [blame] | 173 | vty_out(vty, " Authentication policy: %s", |
| 174 | gsm_auth_policy_name(net->auth_policy)); |
| 175 | if (net->authorized_reg_str) |
| 176 | vty_out(vty, ", authorized regexp: %s", net->authorized_reg_str); |
| 177 | vty_out(vty, "%s", VTY_NEWLINE); |
Harald Welte | 1085c09 | 2009-11-18 20:33:19 +0100 | [diff] [blame] | 178 | vty_out(vty, " Location updating reject cause: %u%s", |
| 179 | net->reject_cause, VTY_NEWLINE); |
Harald Welte | 4381cfe | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 180 | vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption, |
| 181 | VTY_NEWLINE); |
Holger Hans Peter Freyther | f7d752f | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 182 | vty_out(vty, " NECI (TCH/H): %u%s", net->neci, |
| 183 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 184 | vty_out(vty, " Use TCH for Paging any: %d%s", net->pag_any_tch, |
| 185 | VTY_NEWLINE); |
Harald Welte | eab84a1 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 186 | vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode), |
| 187 | VTY_NEWLINE); |
Harald Welte | 648b6ce | 2009-12-14 09:00:24 +0100 | [diff] [blame] | 188 | vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off", |
| 189 | VTY_NEWLINE); |
Harald Welte | bc81450 | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 190 | vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off", |
| 191 | VTY_NEWLINE); |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 192 | network_chan_load(&pl, net); |
| 193 | vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE); |
| 194 | dump_pchan_load_vty(vty, " ", &pl); |
Holger Hans Peter Freyther | 37ac420 | 2011-02-24 14:19:14 +0100 | [diff] [blame] | 195 | |
| 196 | /* show rf */ |
Holger Hans Peter Freyther | a9fae1a | 2014-02-08 12:12:03 +0100 | [diff] [blame] | 197 | if (net->bsc_data) |
Holger Hans Peter Freyther | 37ac420 | 2011-02-24 14:19:14 +0100 | [diff] [blame] | 198 | vty_out(vty, " Last RF Command: %s%s", |
Holger Hans Peter Freyther | 8ec4952 | 2011-08-15 15:53:00 +0200 | [diff] [blame] | 199 | net->bsc_data->rf_ctrl->last_state_command, |
Holger Hans Peter Freyther | 37ac420 | 2011-02-24 14:19:14 +0100 | [diff] [blame] | 200 | VTY_NEWLINE); |
Holger Hans Peter Freyther | a9fae1a | 2014-02-08 12:12:03 +0100 | [diff] [blame] | 201 | if (net->bsc_data) |
Jacob Erlbeck | 779a728 | 2013-09-11 10:46:57 +0200 | [diff] [blame] | 202 | vty_out(vty, " Last RF Lock Command: %s%s", |
| 203 | net->bsc_data->rf_ctrl->last_rf_lock_ctrl_command, |
| 204 | VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 205 | } |
| 206 | |
Neels Hofmeyr | ea11bf8 | 2016-05-12 01:53:23 +0200 | [diff] [blame] | 207 | DEFUN(bsc_show_net, bsc_show_net_cmd, "show network", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 208 | SHOW_STR "Display information about a GSM NETWORK\n") |
| 209 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 210 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 211 | net_dump_vty(vty, net); |
| 212 | |
| 213 | return CMD_SUCCESS; |
| 214 | } |
| 215 | |
| 216 | static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l) |
| 217 | { |
Harald Welte | edb3778 | 2009-05-01 14:59:07 +0000 | [diff] [blame] | 218 | struct e1inp_line *line; |
| 219 | |
| 220 | if (!e1l) { |
| 221 | vty_out(vty, " None%s", VTY_NEWLINE); |
| 222 | return; |
| 223 | } |
| 224 | |
| 225 | line = e1l->ts->line; |
| 226 | |
| 227 | vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s", |
| 228 | line->num, line->driver->name, e1l->ts->num, |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 229 | e1inp_signtype_name(e1l->type), VTY_NEWLINE); |
Harald Welte | edb3778 | 2009-05-01 14:59:07 +0000 | [diff] [blame] | 230 | vty_out(vty, " E1 TEI %u, SAPI %u%s", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 231 | e1l->tei, e1l->sapi, VTY_NEWLINE); |
| 232 | } |
| 233 | |
| 234 | static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts) |
| 235 | { |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 236 | struct pchan_load pl; |
| 237 | |
Holger Hans Peter Freyther | c4a49e3 | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 238 | 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] | 239 | "BSIC %u (NCC=%u, BCC=%u) and %u TRX%s", |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 240 | bts->nr, btstype2str(bts->type), gsm_band_name(bts->band), |
Holger Hans Peter Freyther | c4a49e3 | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 241 | bts->cell_identity, |
Harald Welte | a2bbc5e | 2015-11-20 10:43:31 +0100 | [diff] [blame] | 242 | bts->location_area_code, bts->bsic, |
Harald Welte | 557c84e | 2015-11-20 10:50:24 +0100 | [diff] [blame] | 243 | bts->bsic >> 3, bts->bsic & 7, |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 244 | bts->num_trx, VTY_NEWLINE); |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 245 | vty_out(vty, "Description: %s%s", |
| 246 | bts->description ? bts->description : "(null)", VTY_NEWLINE); |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 247 | if (strnlen(bts->pcu_version, MAX_VERSION_LENGTH)) |
| 248 | vty_out(vty, "PCU version %s connected%s", bts->pcu_version, |
| 249 | VTY_NEWLINE); |
Harald Welte | 1d8dbc4 | 2009-12-12 15:38:16 +0100 | [diff] [blame] | 250 | vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE); |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 251 | vty_out(vty, "Minimum Rx Level for Access: %i dBm%s", |
Harald Welte | 1d8dbc4 | 2009-12-12 15:38:16 +0100 | [diff] [blame] | 252 | rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min), |
| 253 | VTY_NEWLINE); |
| 254 | vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s", |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 255 | bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE); |
Sylvain Munaut | 4010f1e | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 256 | vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer, |
| 257 | VTY_NEWLINE); |
| 258 | vty_out(vty, "RACH Max transmissions: %u%s", |
| 259 | rach_max_trans_raw2val(bts->si_common.rach_control.max_trans), |
| 260 | VTY_NEWLINE); |
Harald Welte | 7135501 | 2009-12-21 23:08:18 +0100 | [diff] [blame] | 261 | if (bts->si_common.rach_control.cell_bar) |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 262 | vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE); |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 263 | if (bts->dtxu != GSM48_DTX_SHALL_NOT_BE_USED) |
| 264 | vty_out(vty, "Uplink DTX: %s%s", |
| 265 | (bts->dtxu != GSM48_DTX_SHALL_BE_USED) ? |
| 266 | "enabled" : "forced", VTY_NEWLINE); |
| 267 | else |
| 268 | vty_out(vty, "Uplink DTX: not enabled%s", VTY_NEWLINE); |
| 269 | vty_out(vty, "Downlink DTX: %senabled%s", bts->dtxd ? "" : "not ", |
| 270 | VTY_NEWLINE); |
Andreas Eversberg | 2ee7ecd | 2012-10-13 07:27:47 +0200 | [diff] [blame] | 271 | vty_out(vty, "Channel Description Attachment: %s%s", |
| 272 | (bts->si_common.chan_desc.att) ? "yes" : "no", VTY_NEWLINE); |
| 273 | vty_out(vty, "Channel Description BS-PA-MFRMS: %u%s", |
| 274 | bts->si_common.chan_desc.bs_pa_mfrms + 2, VTY_NEWLINE); |
| 275 | vty_out(vty, "Channel Description BS-AG_BLKS-RES: %u%s", |
| 276 | bts->si_common.chan_desc.bs_ag_blks_res, VTY_NEWLINE); |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 277 | vty_out(vty, "System Information present: 0x%08x, static: 0x%08x%s", |
| 278 | bts->si_valid, bts->si_mode_static, VTY_NEWLINE); |
Harald Welte | 42def72 | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 279 | vty_out(vty, "Early Classmark Sending: %s%s", |
| 280 | bts->early_classmark_allowed ? "allowed" : "forbidden", |
| 281 | VTY_NEWLINE); |
Harald Welte | 8254cf7 | 2017-05-29 13:42:19 +0200 | [diff] [blame] | 282 | if (bts->pcu_sock_path) |
| 283 | 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] | 284 | if (is_ipaccess_bts(bts)) |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 285 | 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] | 286 | bts->ip_access.site_id, bts->ip_access.bts_id, |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 287 | bts->oml_tei, VTY_NEWLINE); |
Sylvain Munaut | c951946 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 288 | else if (bts->type == GSM_BTS_TYPE_NOKIA_SITE) |
| 289 | vty_out(vty, " Skip Reset: %d%s", |
| 290 | bts->nokia.skip_reset, VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 291 | vty_out(vty, " NM State: "); |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 292 | net_dump_nmstate(vty, &bts->mo.nm_state); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 293 | vty_out(vty, " Site Mgr NM State: "); |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 294 | net_dump_nmstate(vty, &bts->site_mgr.mo.nm_state); |
Holger Hans Peter Freyther | 846d8dc | 2013-05-29 16:22:09 +0200 | [diff] [blame] | 295 | vty_out(vty, " GPRS NSE: "); |
| 296 | net_dump_nmstate(vty, &bts->gprs.nse.mo.nm_state); |
| 297 | vty_out(vty, " GPRS CELL: "); |
| 298 | net_dump_nmstate(vty, &bts->gprs.cell.mo.nm_state); |
| 299 | vty_out(vty, " GPRS NSVC0: "); |
| 300 | net_dump_nmstate(vty, &bts->gprs.nsvc[0].mo.nm_state); |
| 301 | vty_out(vty, " GPRS NSVC1: "); |
| 302 | net_dump_nmstate(vty, &bts->gprs.nsvc[1].mo.nm_state); |
Holger Hans Peter Freyther | 66e14cd | 2011-04-26 15:52:34 +0200 | [diff] [blame] | 303 | vty_out(vty, " Paging: %u pending requests, %u free slots%s", |
| 304 | paging_pending_requests_nr(bts), |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 305 | bts->paging.available_slots, VTY_NEWLINE); |
Holger Hans Peter Freyther | d283db4 | 2010-11-25 16:28:45 +0100 | [diff] [blame] | 306 | if (is_ipaccess_bts(bts)) { |
| 307 | vty_out(vty, " OML Link state: %s.%s", |
| 308 | bts->oml_link ? "connected" : "disconnected", VTY_NEWLINE); |
| 309 | } else { |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 310 | vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE); |
| 311 | e1isl_dump_vty(vty, bts->oml_link); |
| 312 | } |
Holger Hans Peter Freyther | d283db4 | 2010-11-25 16:28:45 +0100 | [diff] [blame] | 313 | |
| 314 | /* FIXME: chan_desc */ |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 315 | memset(&pl, 0, sizeof(pl)); |
Neels Hofmeyr | 2afffd5 | 2016-09-25 17:01:20 +0200 | [diff] [blame] | 316 | bts_chan_load(&pl, bts); |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 317 | vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE); |
| 318 | dump_pchan_load_vty(vty, " ", &pl); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 319 | } |
| 320 | |
Sylvain Munaut | 39c31de | 2012-12-28 12:15:11 +0100 | [diff] [blame] | 321 | DEFUN(show_bts, show_bts_cmd, "show bts [<0-255>]", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 322 | SHOW_STR "Display information about a BTS\n" |
| 323 | "BTS number") |
| 324 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 325 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 326 | int bts_nr; |
| 327 | |
| 328 | if (argc != 0) { |
| 329 | /* use the BTS number that the user has specified */ |
| 330 | bts_nr = atoi(argv[0]); |
Harald Welte | 712ddbc | 2010-12-24 12:24:03 +0100 | [diff] [blame] | 331 | if (bts_nr >= net->num_bts) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 332 | vty_out(vty, "%% can't find BTS '%s'%s", argv[0], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 333 | VTY_NEWLINE); |
| 334 | return CMD_WARNING; |
| 335 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 336 | bts_dump_vty(vty, gsm_bts_num(net, bts_nr)); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 337 | return CMD_SUCCESS; |
| 338 | } |
| 339 | /* print all BTS's */ |
| 340 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 341 | bts_dump_vty(vty, gsm_bts_num(net, bts_nr)); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 342 | |
| 343 | return CMD_SUCCESS; |
| 344 | } |
| 345 | |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 346 | /* utility functions */ |
| 347 | static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line, |
| 348 | const char *ts, const char *ss) |
| 349 | { |
| 350 | e1_link->e1_nr = atoi(line); |
| 351 | e1_link->e1_ts = atoi(ts); |
| 352 | if (!strcmp(ss, "full")) |
| 353 | e1_link->e1_ts_ss = 255; |
| 354 | else |
| 355 | e1_link->e1_ts_ss = atoi(ss); |
| 356 | } |
| 357 | |
| 358 | static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link, |
| 359 | const char *prefix) |
| 360 | { |
| 361 | if (!e1_link->e1_ts) |
| 362 | return; |
| 363 | |
| 364 | if (e1_link->e1_ts_ss == 255) |
| 365 | vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s", |
| 366 | prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE); |
| 367 | else |
| 368 | vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s", |
| 369 | prefix, e1_link->e1_nr, e1_link->e1_ts, |
| 370 | e1_link->e1_ts_ss, VTY_NEWLINE); |
| 371 | } |
| 372 | |
| 373 | |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 374 | static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts) |
| 375 | { |
Neels Hofmeyr | 9c4f1d6 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 376 | vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE); |
Harald Welte | a2bbc5e | 2015-11-20 10:43:31 +0100 | [diff] [blame] | 377 | if (ts->tsc != -1) |
Neels Hofmeyr | 9c4f1d6 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 378 | vty_out(vty, " training_sequence_code %u%s", ts->tsc, VTY_NEWLINE); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 379 | if (ts->pchan != GSM_PCHAN_NONE) |
Neels Hofmeyr | 9c4f1d6 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 380 | vty_out(vty, " phys_chan_config %s%s", |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 381 | gsm_pchan_name(ts->pchan), VTY_NEWLINE); |
Neels Hofmeyr | 9c4f1d6 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 382 | vty_out(vty, " hopping enabled %u%s", |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 383 | ts->hopping.enabled, VTY_NEWLINE); |
| 384 | if (ts->hopping.enabled) { |
| 385 | unsigned int i; |
Neels Hofmeyr | 9c4f1d6 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 386 | vty_out(vty, " hopping sequence-number %u%s", |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 387 | ts->hopping.hsn, VTY_NEWLINE); |
Neels Hofmeyr | 9c4f1d6 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 388 | vty_out(vty, " hopping maio %u%s", |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 389 | ts->hopping.maio, VTY_NEWLINE); |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 390 | for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) { |
| 391 | if (!bitvec_get_bit_pos(&ts->hopping.arfcns, i)) |
| 392 | continue; |
Neels Hofmeyr | 9c4f1d6 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 393 | vty_out(vty, " hopping arfcn add %u%s", |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 394 | i, VTY_NEWLINE); |
| 395 | } |
Harald Welte | 127af34 | 2010-12-24 12:07:07 +0100 | [diff] [blame] | 396 | } |
Neels Hofmeyr | 9c4f1d6 | 2016-01-27 14:20:29 +0100 | [diff] [blame] | 397 | config_write_e1_link(vty, &ts->e1_link, " "); |
Harald Welte | face7ed | 2011-02-14 16:15:21 +0100 | [diff] [blame] | 398 | |
| 399 | if (ts->trx->bts->model->config_write_ts) |
| 400 | ts->trx->bts->model->config_write_ts(vty, ts); |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 401 | } |
| 402 | |
| 403 | static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx) |
| 404 | { |
| 405 | int i; |
| 406 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 407 | vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE); |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 408 | if (trx->description) |
| 409 | vty_out(vty, " description %s%s", trx->description, |
| 410 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 2ba40af | 2010-04-17 06:42:07 +0200 | [diff] [blame] | 411 | vty_out(vty, " rf_locked %u%s", |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 412 | trx->mo.nm_state.administrative == NM_STATE_LOCKED ? 1 : 0, |
Holger Hans Peter Freyther | 2ba40af | 2010-04-17 06:42:07 +0200 | [diff] [blame] | 413 | VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 414 | vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE); |
Harald Welte (local) | 7b37d97 | 2009-12-27 20:56:38 +0100 | [diff] [blame] | 415 | vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 416 | 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] | 417 | config_write_e1_link(vty, &trx->rsl_e1_link, " rsl "); |
| 418 | 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] | 419 | |
Harald Welte | face7ed | 2011-02-14 16:15:21 +0100 | [diff] [blame] | 420 | if (trx->bts->model->config_write_trx) |
| 421 | trx->bts->model->config_write_trx(vty, trx); |
| 422 | |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 423 | for (i = 0; i < TRX_NR_TS; i++) |
| 424 | config_write_ts_single(vty, &trx->ts[i]); |
| 425 | } |
| 426 | |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 427 | static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts) |
| 428 | { |
| 429 | unsigned int i; |
| 430 | vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode), |
| 431 | VTY_NEWLINE); |
| 432 | if (bts->gprs.mode == BTS_GPRS_NONE) |
| 433 | return; |
| 434 | |
bhargava | 350533c | 2016-07-21 11:14:34 +0530 | [diff] [blame] | 435 | vty_out(vty, " gprs 11bit_rach_support_for_egprs %u%s", |
| 436 | bts->gprs.supports_egprs_11bit_rach, VTY_NEWLINE); |
| 437 | |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 438 | vty_out(vty, " gprs routing area %u%s", bts->gprs.rac, |
| 439 | VTY_NEWLINE); |
Andreas Eversberg | 0c8f9ca | 2013-03-16 16:31:26 +0100 | [diff] [blame] | 440 | vty_out(vty, " gprs network-control-order nc%u%s", |
| 441 | bts->gprs.net_ctrl_ord, VTY_NEWLINE); |
Max | 292ec58 | 2016-07-28 11:55:37 +0200 | [diff] [blame] | 442 | if (!bts->gprs.ctrl_ack_type_use_block) |
| 443 | vty_out(vty, " gprs control-ack-type-rach%s", VTY_NEWLINE); |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 444 | vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci, |
| 445 | VTY_NEWLINE); |
| 446 | for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++) |
| 447 | vty_out(vty, " gprs cell timer %s %u%s", |
| 448 | get_value_string(gprs_bssgp_cfg_strs, i), |
| 449 | bts->gprs.cell.timer[i], VTY_NEWLINE); |
| 450 | vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei, |
| 451 | VTY_NEWLINE); |
| 452 | for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++) |
| 453 | vty_out(vty, " gprs ns timer %s %u%s", |
| 454 | get_value_string(gprs_ns_timer_strs, i), |
| 455 | bts->gprs.nse.timer[i], VTY_NEWLINE); |
| 456 | for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) { |
| 457 | struct gsm_bts_gprs_nsvc *nsvc = |
| 458 | &bts->gprs.nsvc[i]; |
| 459 | struct in_addr ia; |
| 460 | |
| 461 | ia.s_addr = htonl(nsvc->remote_ip); |
| 462 | vty_out(vty, " gprs nsvc %u nsvci %u%s", i, |
| 463 | nsvc->nsvci, VTY_NEWLINE); |
| 464 | vty_out(vty, " gprs nsvc %u local udp port %u%s", i, |
| 465 | nsvc->local_port, VTY_NEWLINE); |
| 466 | vty_out(vty, " gprs nsvc %u remote udp port %u%s", i, |
| 467 | nsvc->remote_port, VTY_NEWLINE); |
| 468 | vty_out(vty, " gprs nsvc %u remote ip %s%s", i, |
| 469 | inet_ntoa(ia), VTY_NEWLINE); |
| 470 | } |
| 471 | } |
| 472 | |
Holger Hans Peter Freyther | cd40fb4 | 2013-09-15 17:23:34 +0200 | [diff] [blame] | 473 | /* Write the model data if there is one */ |
| 474 | 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] | 475 | { |
| 476 | struct gsm_bts_trx *trx; |
Holger Hans Peter Freyther | cd40fb4 | 2013-09-15 17:23:34 +0200 | [diff] [blame] | 477 | |
| 478 | if (!bts->model) |
| 479 | return; |
| 480 | |
| 481 | if (bts->model->config_write_bts) |
| 482 | bts->model->config_write_bts(vty, bts); |
| 483 | |
| 484 | llist_for_each_entry(trx, &bts->trx_list, list) |
| 485 | config_write_trx_single(vty, trx); |
| 486 | } |
| 487 | |
Holger Hans Peter Freyther | a174a47 | 2015-09-24 11:39:38 +0200 | [diff] [blame] | 488 | static void write_amr_modes(struct vty *vty, const char *prefix, |
| 489 | const char *name, struct amr_mode *modes, int num) |
| 490 | { |
| 491 | int i; |
| 492 | |
| 493 | vty_out(vty, " %s threshold %s", prefix, name); |
| 494 | for (i = 0; i < num - 1; i++) |
| 495 | vty_out(vty, " %d", modes[i].threshold); |
| 496 | vty_out(vty, "%s", VTY_NEWLINE); |
| 497 | vty_out(vty, " %s hysteresis %s", prefix, name); |
| 498 | for (i = 0; i < num - 1; i++) |
| 499 | vty_out(vty, " %d", modes[i].hysteresis); |
| 500 | vty_out(vty, "%s", VTY_NEWLINE); |
| 501 | } |
| 502 | |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 503 | static void config_write_bts_amr(struct vty *vty, struct gsm_bts *bts, |
| 504 | struct amr_multirate_conf *mr, int full) |
| 505 | { |
| 506 | struct gsm48_multi_rate_conf *mr_conf; |
| 507 | const char *prefix = (full) ? "amr tch-f" : "amr tch-h"; |
| 508 | int i, num; |
| 509 | |
| 510 | if (!(mr->gsm48_ie[1])) |
| 511 | return; |
| 512 | |
| 513 | mr_conf = (struct gsm48_multi_rate_conf *) mr->gsm48_ie; |
| 514 | |
| 515 | num = 0; |
| 516 | vty_out(vty, " %s modes", prefix); |
| 517 | for (i = 0; i < ((full) ? 8 : 6); i++) { |
| 518 | if ((mr->gsm48_ie[1] & (1 << i))) { |
| 519 | vty_out(vty, " %d", i); |
| 520 | num++; |
| 521 | } |
| 522 | } |
| 523 | vty_out(vty, "%s", VTY_NEWLINE); |
| 524 | if (num > 4) |
| 525 | num = 4; |
| 526 | if (num > 1) { |
Holger Hans Peter Freyther | a174a47 | 2015-09-24 11:39:38 +0200 | [diff] [blame] | 527 | write_amr_modes(vty, prefix, "ms", mr->ms_mode, num); |
| 528 | write_amr_modes(vty, prefix, "bts", mr->bts_mode, num); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 529 | } |
| 530 | vty_out(vty, " %s start-mode ", prefix); |
| 531 | if (mr_conf->icmi) { |
| 532 | num = 0; |
| 533 | for (i = 0; i < ((full) ? 8 : 6) && num < 4; i++) { |
| 534 | if ((mr->gsm48_ie[1] & (1 << i))) |
| 535 | num++; |
| 536 | if (mr_conf->smod == num - 1) { |
| 537 | vty_out(vty, "%d%s", num, VTY_NEWLINE); |
| 538 | break; |
| 539 | } |
| 540 | } |
| 541 | } else |
| 542 | vty_out(vty, "auto%s", VTY_NEWLINE); |
| 543 | } |
| 544 | |
Holger Hans Peter Freyther | cd40fb4 | 2013-09-15 17:23:34 +0200 | [diff] [blame] | 545 | static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) |
| 546 | { |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 547 | int i; |
Max | 2c16bee | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 548 | uint8_t tmp; |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 549 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 550 | vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE); |
| 551 | vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE); |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 552 | if (bts->description) |
| 553 | vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 554 | 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] | 555 | vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 556 | vty_out(vty, " location_area_code %u%s", bts->location_area_code, |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 557 | VTY_NEWLINE); |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 558 | if (bts->dtxu != GSM48_DTX_SHALL_NOT_BE_USED) |
| 559 | vty_out(vty, " dtx uplink%s%s", |
| 560 | (bts->dtxu != GSM48_DTX_SHALL_BE_USED) ? "" : " force", |
| 561 | VTY_NEWLINE); |
| 562 | if (bts->dtxd) |
| 563 | vty_out(vty, " dtx downlink%s", VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 564 | 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] | 565 | 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] | 566 | vty_out(vty, " cell reselection hysteresis %u%s", |
| 567 | bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE); |
| 568 | vty_out(vty, " rxlev access min %u%s", |
| 569 | bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE); |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 570 | |
| 571 | if (bts->si_common.cell_ro_sel_par.present) { |
| 572 | struct gsm48_si_selection_params *sp; |
| 573 | sp = &bts->si_common.cell_ro_sel_par; |
| 574 | |
| 575 | if (sp->cbq) |
| 576 | vty_out(vty, " cell bar qualify %u%s", |
| 577 | sp->cbq, VTY_NEWLINE); |
| 578 | |
| 579 | if (sp->cell_resel_off) |
| 580 | vty_out(vty, " cell reselection offset %u%s", |
| 581 | sp->cell_resel_off*2, VTY_NEWLINE); |
| 582 | |
| 583 | if (sp->temp_offs == 7) |
| 584 | vty_out(vty, " temporary offset infinite%s", |
| 585 | VTY_NEWLINE); |
| 586 | else if (sp->temp_offs) |
| 587 | vty_out(vty, " temporary offset %u%s", |
| 588 | sp->temp_offs*10, VTY_NEWLINE); |
| 589 | |
| 590 | if (sp->penalty_time == 31) |
| 591 | vty_out(vty, " penalty time reserved%s", |
| 592 | VTY_NEWLINE); |
| 593 | else if (sp->penalty_time) |
| 594 | vty_out(vty, " penalty time %u%s", |
| 595 | (sp->penalty_time*20)+20, VTY_NEWLINE); |
| 596 | } |
| 597 | |
Harald Welte | 2f8b9d2 | 2017-06-18 11:12:13 +0300 | [diff] [blame] | 598 | if (gsm_bts_get_radio_link_timeout(bts) < 0) |
| 599 | vty_out(vty, " radio-link-timeout infinite%s", VTY_NEWLINE); |
| 600 | else |
| 601 | vty_out(vty, " radio-link-timeout %d%s", |
| 602 | gsm_bts_get_radio_link_timeout(bts), VTY_NEWLINE); |
Neels Hofmeyr | e2f24d5 | 2017-05-08 15:12:20 +0200 | [diff] [blame] | 603 | |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 604 | vty_out(vty, " channel allocator %s%s", |
| 605 | bts->chan_alloc_reverse ? "descending" : "ascending", |
| 606 | VTY_NEWLINE); |
Sylvain Munaut | 4010f1e | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 607 | vty_out(vty, " rach tx integer %u%s", |
| 608 | bts->si_common.rach_control.tx_integer, VTY_NEWLINE); |
| 609 | vty_out(vty, " rach max transmission %u%s", |
| 610 | rach_max_trans_raw2val(bts->si_common.rach_control.max_trans), |
| 611 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 95c2290 | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 612 | |
Andreas Eversberg | 2ee7ecd | 2012-10-13 07:27:47 +0200 | [diff] [blame] | 613 | vty_out(vty, " channel-descrption attach %u%s", |
| 614 | bts->si_common.chan_desc.att, VTY_NEWLINE); |
| 615 | vty_out(vty, " channel-descrption bs-pa-mfrms %u%s", |
| 616 | bts->si_common.chan_desc.bs_pa_mfrms + 2, VTY_NEWLINE); |
| 617 | vty_out(vty, " channel-descrption bs-ag-blks-res %u%s", |
| 618 | bts->si_common.chan_desc.bs_ag_blks_res, VTY_NEWLINE); |
| 619 | |
Holger Hans Peter Freyther | 95c2290 | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 620 | if (bts->rach_b_thresh != -1) |
| 621 | vty_out(vty, " rach nm busy threshold %u%s", |
| 622 | bts->rach_b_thresh, VTY_NEWLINE); |
| 623 | if (bts->rach_ldavg_slots != -1) |
| 624 | vty_out(vty, " rach nm load average %u%s", |
| 625 | bts->rach_ldavg_slots, VTY_NEWLINE); |
Harald Welte | 7135501 | 2009-12-21 23:08:18 +0100 | [diff] [blame] | 626 | if (bts->si_common.rach_control.cell_bar) |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 627 | vty_out(vty, " cell barred 1%s", VTY_NEWLINE); |
Holger Hans Peter Freyther | 3a0a463 | 2010-05-14 00:39:19 +0800 | [diff] [blame] | 628 | if ((bts->si_common.rach_control.t2 & 0x4) == 0) |
| 629 | vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE); |
Ivan Kluchnikov | 6792059 | 2013-09-16 13:13:04 +0400 | [diff] [blame] | 630 | if ((bts->si_common.rach_control.t3) != 0) |
| 631 | for (i = 0; i < 8; i++) |
| 632 | if (bts->si_common.rach_control.t3 & (0x1 << i)) |
| 633 | vty_out(vty, " rach access-control-class %d barred%s", i, VTY_NEWLINE); |
| 634 | if ((bts->si_common.rach_control.t2 & 0xfb) != 0) |
| 635 | for (i = 0; i < 8; i++) |
| 636 | if ((i != 2) && (bts->si_common.rach_control.t2 & (0x1 << i))) |
| 637 | vty_out(vty, " rach access-control-class %d barred%s", i+8, VTY_NEWLINE); |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 638 | for (i = SYSINFO_TYPE_1; i < _MAX_SYSINFO_TYPE; i++) { |
| 639 | if (bts->si_mode_static & (1 << i)) { |
| 640 | vty_out(vty, " system-information %s mode static%s", |
| 641 | get_value_string(osmo_sitype_strs, i), VTY_NEWLINE); |
| 642 | vty_out(vty, " system-information %s static %s%s", |
| 643 | get_value_string(osmo_sitype_strs, i), |
Max | 6f0e50c | 2017-04-12 15:30:54 +0200 | [diff] [blame] | 644 | osmo_hexdump_nospc(GSM_BTS_SI(bts, i), GSM_MACBLOCK_LEN), |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 645 | VTY_NEWLINE); |
| 646 | } |
| 647 | } |
Harald Welte | 42def72 | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 648 | vty_out(vty, " early-classmark-sending %s%s", |
| 649 | bts->early_classmark_allowed ? "allowed" : "forbidden", VTY_NEWLINE); |
Harald Welte | fd355a3 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 650 | switch (bts->type) { |
| 651 | case GSM_BTS_TYPE_NANOBTS: |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 652 | case GSM_BTS_TYPE_OSMOBTS: |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 653 | vty_out(vty, " ip.access unit_id %u %u%s", |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 654 | bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE); |
Harald Welte | 8b29180 | 2013-03-12 13:57:05 +0100 | [diff] [blame] | 655 | if (bts->ip_access.rsl_ip) { |
| 656 | struct in_addr ia; |
| 657 | ia.s_addr = htonl(bts->ip_access.rsl_ip); |
| 658 | vty_out(vty, " ip.access rsl-ip %s%s", inet_ntoa(ia), |
| 659 | VTY_NEWLINE); |
| 660 | } |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 661 | vty_out(vty, " oml ip.access stream_id %u line %u%s", |
| 662 | bts->oml_tei, bts->oml_e1_link.e1_nr, VTY_NEWLINE); |
Harald Welte | fd355a3 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 663 | break; |
Sylvain Munaut | c951946 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 664 | case GSM_BTS_TYPE_NOKIA_SITE: |
| 665 | vty_out(vty, " nokia_site skip-reset %d%s", bts->nokia.skip_reset, VTY_NEWLINE); |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 666 | vty_out(vty, " nokia_site no-local-rel-conf %d%s", |
| 667 | bts->nokia.no_loc_rel_cnf, VTY_NEWLINE); |
Sipos Csaba | 56e1766 | 2015-02-07 13:27:36 +0100 | [diff] [blame] | 668 | vty_out(vty, " nokia_site bts-reset-timer %d%s", bts->nokia.bts_reset_timer_cnf, VTY_NEWLINE); |
Andreas Eversberg | b6f9516 | 2013-12-05 16:02:37 +0100 | [diff] [blame] | 669 | /* fall through: Nokia requires "oml e1" parameters also */ |
Harald Welte | fd355a3 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 670 | default: |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 671 | config_write_e1_link(vty, &bts->oml_e1_link, " oml "); |
| 672 | vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE); |
Harald Welte | fd355a3 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 673 | break; |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 674 | } |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 675 | |
| 676 | /* if we have a limit, write it */ |
| 677 | if (bts->paging.free_chans_need >= 0) |
| 678 | vty_out(vty, " paging free %d%s", bts->paging.free_chans_need, VTY_NEWLINE); |
| 679 | |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 680 | vty_out(vty, " neighbor-list mode %s%s", |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 681 | get_value_string(bts_neigh_mode_strs, bts->neigh_list_manual_mode), VTY_NEWLINE); |
| 682 | if (bts->neigh_list_manual_mode != NL_MODE_AUTOMATIC) { |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 683 | for (i = 0; i < 1024; i++) { |
| 684 | if (bitvec_get_bit_pos(&bts->si_common.neigh_list, i)) |
| 685 | vty_out(vty, " neighbor-list add arfcn %u%s", |
| 686 | i, VTY_NEWLINE); |
| 687 | } |
| 688 | } |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 689 | if (bts->neigh_list_manual_mode == NL_MODE_MANUAL_SI5SEP) { |
| 690 | for (i = 0; i < 1024; i++) { |
| 691 | if (bitvec_get_bit_pos(&bts->si_common.si5_neigh_list, i)) |
| 692 | vty_out(vty, " si5 neighbor-list add arfcn %u%s", |
| 693 | i, VTY_NEWLINE); |
| 694 | } |
| 695 | } |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 696 | |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 697 | for (i = 0; i < MAX_EARFCN_LIST; i++) { |
Max | 2c16bee | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 698 | struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list; |
| 699 | if (e->arfcn[i] != OSMO_EARFCN_INVALID) { |
| 700 | vty_out(vty, " si2quater neighbor-list add earfcn %u " |
| 701 | "thresh-hi %u", e->arfcn[i], e->thresh_hi); |
| 702 | |
| 703 | vty_out(vty, " thresh-lo %u", |
| 704 | e->thresh_lo_valid ? e->thresh_lo : 32); |
| 705 | |
| 706 | vty_out(vty, " prio %u", |
| 707 | e->prio_valid ? e->prio : 8); |
| 708 | |
| 709 | vty_out(vty, " qrxlv %u", |
| 710 | e->qrxlm_valid ? e->qrxlm : 32); |
| 711 | |
| 712 | tmp = e->meas_bw[i]; |
| 713 | vty_out(vty, " meas %u", |
| 714 | (tmp != OSMO_EARFCN_MEAS_INVALID) ? tmp : 8); |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 715 | |
| 716 | vty_out(vty, "%s", VTY_NEWLINE); |
| 717 | } |
| 718 | } |
| 719 | |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 720 | for (i = 0; i < bts->si_common.uarfcn_length; i++) { |
| 721 | vty_out(vty, " si2quater neighbor-list add uarfcn %u %u %u%s", |
| 722 | bts->si_common.data.uarfcn_list[i], |
| 723 | bts->si_common.data.scramble_list[i] & ~(1 << 9), |
| 724 | (bts->si_common.data.scramble_list[i] >> 9) & 1, |
| 725 | VTY_NEWLINE); |
| 726 | } |
| 727 | |
Andreas Eversberg | a83d511 | 2013-12-07 18:32:28 +0100 | [diff] [blame] | 728 | vty_out(vty, " codec-support fr"); |
| 729 | if (bts->codec.hr) |
| 730 | vty_out(vty, " hr"); |
| 731 | if (bts->codec.efr) |
| 732 | vty_out(vty, " efr"); |
| 733 | if (bts->codec.amr) |
| 734 | vty_out(vty, " amr"); |
| 735 | vty_out(vty, "%s", VTY_NEWLINE); |
| 736 | |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 737 | config_write_bts_amr(vty, bts, &bts->mr_full, 1); |
| 738 | config_write_bts_amr(vty, bts, &bts->mr_half, 0); |
| 739 | |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 740 | config_write_bts_gprs(vty, bts); |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 741 | |
Holger Hans Peter Freyther | e30d40d | 2012-07-20 10:27:31 +0200 | [diff] [blame] | 742 | if (bts->excl_from_rf_lock) |
| 743 | vty_out(vty, " rf-lock-exclude%s", VTY_NEWLINE); |
| 744 | |
Jacob Erlbeck | 65d114f | 2014-01-16 11:02:14 +0100 | [diff] [blame] | 745 | vty_out(vty, " %sforce-combined-si%s", |
| 746 | bts->force_combined_si ? "" : "no ", VTY_NEWLINE); |
| 747 | |
Holger Hans Peter Freyther | c22930e | 2014-12-17 14:46:17 +0100 | [diff] [blame] | 748 | for (i = 0; i < ARRAY_SIZE(bts->depends_on); ++i) { |
| 749 | int j; |
| 750 | |
| 751 | if (bts->depends_on[i] == 0) |
| 752 | continue; |
| 753 | |
| 754 | for (j = 0; j < sizeof(bts->depends_on[i]) * 8; ++j) { |
| 755 | int bts_nr; |
| 756 | |
| 757 | if ((bts->depends_on[i] & (1<<j)) == 0) |
| 758 | continue; |
| 759 | |
| 760 | bts_nr = (i * sizeof(bts->depends_on[i]) * 8) + j; |
| 761 | vty_out(vty, " depends-on-bts %d%s", bts_nr, VTY_NEWLINE); |
| 762 | } |
| 763 | } |
Harald Welte | 8254cf7 | 2017-05-29 13:42:19 +0200 | [diff] [blame] | 764 | if (bts->pcu_sock_path) |
| 765 | 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] | 766 | |
Holger Hans Peter Freyther | cd40fb4 | 2013-09-15 17:23:34 +0200 | [diff] [blame] | 767 | config_write_bts_model(vty, bts); |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 768 | } |
| 769 | |
| 770 | static int config_write_bts(struct vty *v) |
| 771 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 772 | struct gsm_network *gsmnet = gsmnet_from_vty(v); |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 773 | struct gsm_bts *bts; |
| 774 | |
| 775 | llist_for_each_entry(bts, &gsmnet->bts_list, list) |
| 776 | config_write_bts_single(v, bts); |
| 777 | |
| 778 | return CMD_SUCCESS; |
| 779 | } |
| 780 | |
Harald Welte | 5d1fa89 | 2017-07-20 01:47:39 +0200 | [diff] [blame] | 781 | /* small helper macro for conditional dumping of timer */ |
| 782 | #define VTY_OUT_TIMER(number) \ |
| 783 | if (gsmnet->T##number != GSM_T##number##_DEFAULT) \ |
| 784 | vty_out(vty, " timer t"#number" %u%s", gsmnet->T##number, VTY_NEWLINE) |
| 785 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 786 | static int config_write_net(struct vty *vty) |
| 787 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 788 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 789 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 790 | vty_out(vty, "network%s", VTY_NEWLINE); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 791 | vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 792 | vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 793 | vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE); |
| 794 | vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE); |
Harald Welte (local) | 69de397 | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 795 | vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE); |
Max | ddee01f | 2016-05-24 14:23:27 +0200 | [diff] [blame] | 796 | if (gsmnet->authorized_reg_str) |
| 797 | vty_out(vty, " authorized-regexp %s%s", gsmnet->authorized_reg_str, VTY_NEWLINE); |
Harald Welte | 1085c09 | 2009-11-18 20:33:19 +0100 | [diff] [blame] | 798 | vty_out(vty, " location updating reject cause %u%s", |
| 799 | gsmnet->reject_cause, VTY_NEWLINE); |
Harald Welte | 4381cfe | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 800 | vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE); |
Harald Welte | 2483f1b | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 801 | vty_out(vty, " authentication %s%s", |
| 802 | gsmnet->authentication_required ? "required" : "optional", |
| 803 | VTY_NEWLINE); |
Holger Hans Peter Freyther | d54c337 | 2009-11-19 16:37:48 +0100 | [diff] [blame] | 804 | vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE); |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 805 | vty_out(vty, " paging any use tch %d%s", gsmnet->pag_any_tch, VTY_NEWLINE); |
Harald Welte | eab84a1 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 806 | vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode), |
| 807 | VTY_NEWLINE); |
Harald Welte | 648b6ce | 2009-12-14 09:00:24 +0100 | [diff] [blame] | 808 | vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE); |
Harald Welte | bc81450 | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 809 | vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE); |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 810 | vty_out(vty, " handover window rxlev averaging %u%s", |
| 811 | gsmnet->handover.win_rxlev_avg, VTY_NEWLINE); |
| 812 | vty_out(vty, " handover window rxqual averaging %u%s", |
| 813 | gsmnet->handover.win_rxqual_avg, VTY_NEWLINE); |
| 814 | vty_out(vty, " handover window rxlev neighbor averaging %u%s", |
| 815 | gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE); |
| 816 | vty_out(vty, " handover power budget interval %u%s", |
| 817 | gsmnet->handover.pwr_interval, VTY_NEWLINE); |
| 818 | vty_out(vty, " handover power budget hysteresis %u%s", |
| 819 | gsmnet->handover.pwr_hysteresis, VTY_NEWLINE); |
| 820 | vty_out(vty, " handover maximum distance %u%s", |
| 821 | gsmnet->handover.max_distance, VTY_NEWLINE); |
Harald Welte | 5d1fa89 | 2017-07-20 01:47:39 +0200 | [diff] [blame] | 822 | VTY_OUT_TIMER(3101); |
| 823 | VTY_OUT_TIMER(3103); |
| 824 | VTY_OUT_TIMER(3105); |
| 825 | VTY_OUT_TIMER(3107); |
| 826 | VTY_OUT_TIMER(3109); |
| 827 | VTY_OUT_TIMER(3111); |
| 828 | VTY_OUT_TIMER(3113); |
| 829 | VTY_OUT_TIMER(3115); |
| 830 | VTY_OUT_TIMER(3117); |
| 831 | VTY_OUT_TIMER(3119); |
| 832 | VTY_OUT_TIMER(3122); |
| 833 | VTY_OUT_TIMER(3141); |
Vadim Yanitskiy | 7f3724e | 2017-03-31 23:27:44 +0700 | [diff] [blame] | 834 | vty_out(vty, " dyn_ts_allow_tch_f %d%s", |
| 835 | gsmnet->dyn_ts_allow_tch_f ? 1 : 0, VTY_NEWLINE); |
Neels Hofmeyr | 7398395 | 2016-05-10 13:29:33 +0200 | [diff] [blame] | 836 | if (gsmnet->tz.override != 0) { |
| 837 | if (gsmnet->tz.dst) |
| 838 | vty_out(vty, " timezone %d %d %d%s", |
| 839 | gsmnet->tz.hr, gsmnet->tz.mn, gsmnet->tz.dst, |
| 840 | VTY_NEWLINE); |
| 841 | else |
| 842 | vty_out(vty, " timezone %d %d%s", |
| 843 | gsmnet->tz.hr, gsmnet->tz.mn, VTY_NEWLINE); |
| 844 | } |
Neels Hofmeyr | e2f24d5 | 2017-05-08 15:12:20 +0200 | [diff] [blame] | 845 | if (gsmnet->t3212 == 0) |
| 846 | vty_out(vty, " no periodic location update%s", VTY_NEWLINE); |
| 847 | else |
| 848 | vty_out(vty, " periodic location update %u%s", |
| 849 | gsmnet->t3212 * 6, VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 850 | |
| 851 | return CMD_SUCCESS; |
| 852 | } |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 853 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 854 | static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx) |
| 855 | { |
| 856 | vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s", |
| 857 | trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE); |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 858 | vty_out(vty, "Description: %s%s", |
| 859 | trx->description ? trx->description : "(null)", VTY_NEWLINE); |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 860 | vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, " |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 861 | "resulting BS power: %d dBm%s", |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 862 | trx->nominal_power, trx->max_power_red, |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 863 | trx->nominal_power - trx->max_power_red, VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 864 | vty_out(vty, " NM State: "); |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 865 | net_dump_nmstate(vty, &trx->mo.nm_state); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 866 | vty_out(vty, " Baseband Transceiver NM State: "); |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 867 | net_dump_nmstate(vty, &trx->bb_transc.mo.nm_state); |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 868 | if (is_ipaccess_bts(trx->bts)) { |
| 869 | vty_out(vty, " ip.access stream ID: 0x%02x%s", |
| 870 | trx->rsl_tei, VTY_NEWLINE); |
| 871 | } else { |
| 872 | vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE); |
| 873 | e1isl_dump_vty(vty, trx->rsl_link); |
| 874 | } |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 875 | } |
| 876 | |
| 877 | DEFUN(show_trx, |
| 878 | show_trx_cmd, |
Sylvain Munaut | 39c31de | 2012-12-28 12:15:11 +0100 | [diff] [blame] | 879 | "show trx [<0-255>] [<0-255>]", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 880 | SHOW_STR "Display information about a TRX\n" |
| 881 | "BTS Number\n" |
| 882 | "TRX Number\n") |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 883 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 884 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 885 | struct gsm_bts *bts = NULL; |
| 886 | struct gsm_bts_trx *trx; |
| 887 | int bts_nr, trx_nr; |
| 888 | |
| 889 | if (argc >= 1) { |
| 890 | /* use the BTS number that the user has specified */ |
| 891 | bts_nr = atoi(argv[0]); |
| 892 | if (bts_nr >= net->num_bts) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 893 | vty_out(vty, "%% can't find BTS '%s'%s", argv[0], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 894 | VTY_NEWLINE); |
| 895 | return CMD_WARNING; |
| 896 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 897 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 898 | } |
| 899 | if (argc >= 2) { |
| 900 | trx_nr = atoi(argv[1]); |
| 901 | if (trx_nr >= bts->num_trx) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 902 | vty_out(vty, "%% can't find TRX '%s'%s", argv[1], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 903 | VTY_NEWLINE); |
| 904 | return CMD_WARNING; |
| 905 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 906 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 907 | trx_dump_vty(vty, trx); |
| 908 | return CMD_SUCCESS; |
| 909 | } |
| 910 | if (bts) { |
| 911 | /* print all TRX in this BTS */ |
| 912 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 913 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 914 | trx_dump_vty(vty, trx); |
| 915 | } |
| 916 | return CMD_SUCCESS; |
| 917 | } |
| 918 | |
| 919 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 920 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 921 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 922 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 923 | trx_dump_vty(vty, trx); |
| 924 | } |
| 925 | } |
| 926 | |
| 927 | return CMD_SUCCESS; |
| 928 | } |
| 929 | |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 930 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 931 | static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts) |
| 932 | { |
Harald Welte | 135a648 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 933 | vty_out(vty, "BTS %u, TRX %u, Timeslot %u, phys cfg %s, TSC %u", |
Harald Welte | 026b4ca | 2010-12-24 12:12:10 +0100 | [diff] [blame] | 934 | ts->trx->bts->nr, ts->trx->nr, ts->nr, |
Harald Welte | 1fe2412 | 2014-01-19 17:18:21 +0100 | [diff] [blame] | 935 | gsm_pchan_name(ts->pchan), gsm_ts_tsc(ts)); |
Harald Welte | cd103a9 | 2010-12-24 12:14:52 +0100 | [diff] [blame] | 936 | if (ts->pchan == GSM_PCHAN_TCH_F_PDCH) |
Harald Welte | b29cea1 | 2010-12-24 12:26:13 +0100 | [diff] [blame] | 937 | vty_out(vty, " (%s mode)", |
Neels Hofmeyr | 2ebacce | 2016-06-14 14:08:35 +0200 | [diff] [blame] | 938 | ts->flags & TS_F_PDCH_ACTIVE ? "PDCH" : "TCH/F"); |
Harald Welte | cd103a9 | 2010-12-24 12:14:52 +0100 | [diff] [blame] | 939 | vty_out(vty, "%s", VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 940 | vty_out(vty, " NM State: "); |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 941 | net_dump_nmstate(vty, &ts->mo.nm_state); |
Harald Welte | 2c82899 | 2009-12-02 01:56:49 +0530 | [diff] [blame] | 942 | if (!is_ipaccess_bts(ts->trx->bts)) |
Harald Welte | ef235b5 | 2009-03-10 12:34:02 +0000 | [diff] [blame] | 943 | vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s", |
| 944 | ts->e1_link.e1_nr, ts->e1_link.e1_ts, |
| 945 | ts->e1_link.e1_ts_ss, VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 946 | } |
| 947 | |
| 948 | DEFUN(show_ts, |
| 949 | show_ts_cmd, |
Sylvain Munaut | 39c31de | 2012-12-28 12:15:11 +0100 | [diff] [blame] | 950 | "show timeslot [<0-255>] [<0-255>] [<0-7>]", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 951 | SHOW_STR "Display information about a TS\n" |
| 952 | "BTS Number\n" "TRX Number\n" "Timeslot Number\n") |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 953 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 954 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 274d015 | 2010-12-24 12:05:03 +0100 | [diff] [blame] | 955 | struct gsm_bts *bts = NULL; |
| 956 | struct gsm_bts_trx *trx = NULL; |
| 957 | struct gsm_bts_trx_ts *ts = NULL; |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 958 | int bts_nr, trx_nr, ts_nr; |
| 959 | |
| 960 | if (argc >= 1) { |
| 961 | /* use the BTS number that the user has specified */ |
| 962 | bts_nr = atoi(argv[0]); |
| 963 | if (bts_nr >= net->num_bts) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 964 | vty_out(vty, "%% can't find BTS '%s'%s", argv[0], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 965 | VTY_NEWLINE); |
| 966 | return CMD_WARNING; |
| 967 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 968 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 969 | } |
| 970 | if (argc >= 2) { |
| 971 | trx_nr = atoi(argv[1]); |
| 972 | if (trx_nr >= bts->num_trx) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 973 | vty_out(vty, "%% can't find TRX '%s'%s", argv[1], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 974 | VTY_NEWLINE); |
| 975 | return CMD_WARNING; |
| 976 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 977 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 978 | } |
| 979 | if (argc >= 3) { |
| 980 | ts_nr = atoi(argv[2]); |
| 981 | if (ts_nr >= TRX_NR_TS) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 982 | vty_out(vty, "%% can't find TS '%s'%s", argv[2], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 983 | VTY_NEWLINE); |
| 984 | return CMD_WARNING; |
| 985 | } |
Harald Welte | 274d015 | 2010-12-24 12:05:03 +0100 | [diff] [blame] | 986 | /* Fully Specified: print and exit */ |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 987 | ts = &trx->ts[ts_nr]; |
| 988 | ts_dump_vty(vty, ts); |
| 989 | return CMD_SUCCESS; |
| 990 | } |
Harald Welte | 274d015 | 2010-12-24 12:05:03 +0100 | [diff] [blame] | 991 | |
| 992 | if (bts && trx) { |
| 993 | /* Iterate over all TS in this TRX */ |
| 994 | for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) { |
| 995 | ts = &trx->ts[ts_nr]; |
| 996 | ts_dump_vty(vty, ts); |
| 997 | } |
| 998 | } else if (bts) { |
| 999 | /* Iterate over all TRX in this BTS, TS in each TRX */ |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1000 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1001 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1002 | for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) { |
| 1003 | ts = &trx->ts[ts_nr]; |
| 1004 | ts_dump_vty(vty, ts); |
| 1005 | } |
| 1006 | } |
Harald Welte | 274d015 | 2010-12-24 12:05:03 +0100 | [diff] [blame] | 1007 | } else { |
| 1008 | /* Iterate over all BTS, TRX in each BTS, TS in each TRX */ |
| 1009 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
| 1010 | bts = gsm_bts_num(net, bts_nr); |
| 1011 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
| 1012 | trx = gsm_bts_trx_num(bts, trx_nr); |
| 1013 | for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) { |
| 1014 | ts = &trx->ts[ts_nr]; |
| 1015 | ts_dump_vty(vty, ts); |
| 1016 | } |
| 1017 | } |
| 1018 | } |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1019 | } |
| 1020 | |
| 1021 | return CMD_SUCCESS; |
| 1022 | } |
| 1023 | |
Harald Welte | 2483f1b | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 1024 | static void subscr_dump_vty(struct vty *vty, struct vlr_subscr *vsub) |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1025 | { |
Harald Welte | 2483f1b | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 1026 | OSMO_ASSERT(vsub); |
| 1027 | if (strlen(vsub->name)) |
| 1028 | vty_out(vty, " Name: '%s'%s", vsub->name, VTY_NEWLINE); |
| 1029 | if (strlen(vsub->msisdn)) |
| 1030 | vty_out(vty, " Extension: %s%s", vsub->msisdn, |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1031 | VTY_NEWLINE); |
Harald Welte | 2483f1b | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 1032 | if (strlen(vsub->imsi)) |
| 1033 | vty_out(vty, " IMSI: %s%s", vsub->imsi, VTY_NEWLINE); |
| 1034 | if (vsub->tmsi != GSM_RESERVED_TMSI) |
| 1035 | vty_out(vty, " TMSI: %08X%s", vsub->tmsi, |
| 1036 | VTY_NEWLINE); |
| 1037 | if (vsub->tmsi_new != GSM_RESERVED_TMSI) |
| 1038 | vty_out(vty, " new TMSI: %08X%s", vsub->tmsi_new, |
Harald Welte | 731fd91 | 2009-08-15 03:24:51 +0200 | [diff] [blame] | 1039 | VTY_NEWLINE); |
Sylvain Munaut | af29264 | 2009-12-27 19:29:28 +0100 | [diff] [blame] | 1040 | |
Harald Welte | 2483f1b | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 1041 | vty_out(vty, " Use count: %u%s", vsub->use_count, VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1042 | } |
| 1043 | |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 1044 | static void bsc_subscr_dump_vty(struct vty *vty, struct bsc_subscr *bsub) |
| 1045 | { |
| 1046 | if (strlen(bsub->imsi)) |
| 1047 | vty_out(vty, " IMSI: %s%s", bsub->imsi, VTY_NEWLINE); |
| 1048 | if (bsub->tmsi != GSM_RESERVED_TMSI) |
| 1049 | vty_out(vty, " TMSI: 0x%08x%s", bsub->tmsi, |
| 1050 | VTY_NEWLINE); |
| 1051 | vty_out(vty, " Use count: %d%s", bsub->use_count, VTY_NEWLINE); |
| 1052 | } |
| 1053 | |
Harald Welte | 8387a49 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 1054 | static void meas_rep_dump_uni_vty(struct vty *vty, |
| 1055 | struct gsm_meas_rep_unidir *mru, |
| 1056 | const char *prefix, |
| 1057 | const char *dir) |
| 1058 | { |
| 1059 | vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ", |
| 1060 | prefix, dir, rxlev2dbm(mru->full.rx_lev), |
| 1061 | dir, rxlev2dbm(mru->sub.rx_lev)); |
| 1062 | vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s", |
| 1063 | dir, mru->full.rx_qual, dir, mru->sub.rx_qual, |
| 1064 | VTY_NEWLINE); |
| 1065 | } |
| 1066 | |
| 1067 | static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr, |
| 1068 | const char *prefix) |
| 1069 | { |
| 1070 | vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE); |
| 1071 | vty_out(vty, "%s Flags: %s%s%s%s%s", prefix, |
| 1072 | mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "", |
| 1073 | mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "", |
| 1074 | mr->flags & MEAS_REP_F_FPC ? "FPC " : "", |
| 1075 | mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ", |
| 1076 | VTY_NEWLINE); |
| 1077 | if (mr->flags & MEAS_REP_F_MS_TO) |
Max | 11e4e41 | 2017-04-20 13:07:58 +0200 | [diff] [blame] | 1078 | 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] | 1079 | if (mr->flags & MEAS_REP_F_MS_L1) |
| 1080 | vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s", |
| 1081 | prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE); |
| 1082 | if (mr->flags & MEAS_REP_F_DL_VALID) |
| 1083 | meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl"); |
| 1084 | meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul"); |
| 1085 | } |
| 1086 | |
Harald Welte | 0a8cf32 | 2015-12-05 17:22:49 +0100 | [diff] [blame] | 1087 | /* FIXME: move this to libosmogsm */ |
| 1088 | static const struct value_string gsm48_cmode_names[] = { |
| 1089 | { GSM48_CMODE_SIGN, "signalling" }, |
| 1090 | { GSM48_CMODE_SPEECH_V1, "FR or HR" }, |
| 1091 | { GSM48_CMODE_SPEECH_EFR, "EFR" }, |
| 1092 | { GSM48_CMODE_SPEECH_AMR, "AMR" }, |
| 1093 | { GSM48_CMODE_DATA_14k5, "CSD(14k5)" }, |
| 1094 | { GSM48_CMODE_DATA_12k0, "CSD(12k0)" }, |
| 1095 | { GSM48_CMODE_DATA_6k0, "CSD(6k0)" }, |
| 1096 | { GSM48_CMODE_DATA_3k6, "CSD(3k6)" }, |
| 1097 | { 0, NULL } |
| 1098 | }; |
| 1099 | |
Neels Hofmeyr | b748012 | 2016-11-02 14:28:15 +0100 | [diff] [blame] | 1100 | /* call vty_out() to print a string like " as TCH/H" for dynamic timeslots. |
| 1101 | * Don't do anything if the ts is not dynamic. */ |
| 1102 | static void vty_out_dyn_ts_status(struct vty *vty, struct gsm_bts_trx_ts *ts) |
| 1103 | { |
| 1104 | switch (ts->pchan) { |
| 1105 | case GSM_PCHAN_TCH_F_TCH_H_PDCH: |
| 1106 | if (ts->dyn.pchan_is == ts->dyn.pchan_want) |
| 1107 | vty_out(vty, " as %s", |
| 1108 | gsm_pchan_name(ts->dyn.pchan_is)); |
| 1109 | else |
| 1110 | vty_out(vty, " switching %s -> %s", |
| 1111 | gsm_pchan_name(ts->dyn.pchan_is), |
| 1112 | gsm_pchan_name(ts->dyn.pchan_want)); |
| 1113 | break; |
| 1114 | case GSM_PCHAN_TCH_F_PDCH: |
| 1115 | if ((ts->flags & TS_F_PDCH_PENDING_MASK) == 0) |
| 1116 | vty_out(vty, " as %s", |
| 1117 | (ts->flags & TS_F_PDCH_ACTIVE)? "PDCH" |
| 1118 | : "TCH/F"); |
| 1119 | else |
| 1120 | vty_out(vty, " switching %s -> %s", |
| 1121 | (ts->flags & TS_F_PDCH_ACTIVE)? "PDCH" |
| 1122 | : "TCH/F", |
| 1123 | (ts->flags & TS_F_PDCH_ACT_PENDING)? "PDCH" |
| 1124 | : "TCH/F"); |
| 1125 | break; |
| 1126 | default: |
| 1127 | /* no dyn ts */ |
| 1128 | break; |
| 1129 | } |
| 1130 | } |
| 1131 | |
Holger Hans Peter Freyther | 029235e | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1132 | 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] | 1133 | { |
Harald Welte | 8387a49 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 1134 | int idx; |
| 1135 | |
Harald Welte | 85bded8 | 2010-12-24 12:22:34 +0100 | [diff] [blame] | 1136 | vty_out(vty, "BTS %u, TRX %u, Timeslot %u, Lchan %u: Type %s%s", |
| 1137 | lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr, |
| 1138 | lchan->nr, gsm_lchant_name(lchan->type), VTY_NEWLINE); |
Neels Hofmeyr | b748012 | 2016-11-02 14:28:15 +0100 | [diff] [blame] | 1139 | /* show dyn TS details, if applicable */ |
| 1140 | switch (lchan->ts->pchan) { |
| 1141 | case GSM_PCHAN_TCH_F_TCH_H_PDCH: |
| 1142 | vty_out(vty, " Osmocom Dyn TS:"); |
| 1143 | vty_out_dyn_ts_status(vty, lchan->ts); |
| 1144 | vty_out(vty, VTY_NEWLINE); |
| 1145 | break; |
| 1146 | case GSM_PCHAN_TCH_F_PDCH: |
| 1147 | vty_out(vty, " IPACC Dyn PDCH TS:"); |
| 1148 | vty_out_dyn_ts_status(vty, lchan->ts); |
| 1149 | vty_out(vty, VTY_NEWLINE); |
| 1150 | break; |
| 1151 | default: |
| 1152 | /* no dyn ts */ |
| 1153 | break; |
| 1154 | } |
Holger Hans Peter Freyther | 454140e | 2014-12-28 12:08:28 +0100 | [diff] [blame] | 1155 | vty_out(vty, " Connection: %u, State: %s%s%s%s", |
Holger Hans Peter Freyther | 4049455 | 2010-06-28 17:09:29 +0800 | [diff] [blame] | 1156 | lchan->conn ? 1: 0, |
Holger Hans Peter Freyther | 454140e | 2014-12-28 12:08:28 +0100 | [diff] [blame] | 1157 | gsm_lchans_name(lchan->state), |
| 1158 | lchan->state == LCHAN_S_BROKEN ? " Error reason: " : "", |
| 1159 | lchan->state == LCHAN_S_BROKEN ? lchan->broken_reason : "", |
| 1160 | VTY_NEWLINE); |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 1161 | vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s", |
| 1162 | lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red |
| 1163 | - lchan->bs_power*2, |
| 1164 | ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power), |
| 1165 | VTY_NEWLINE); |
Harald Welte | 0a8cf32 | 2015-12-05 17:22:49 +0100 | [diff] [blame] | 1166 | vty_out(vty, " Channel Mode / Codec: %s%s", |
| 1167 | get_value_string(gsm48_cmode_names, lchan->tch_mode), |
| 1168 | VTY_NEWLINE); |
Harald Welte | 2483f1b | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 1169 | if (lchan->conn && lchan->conn->vsub) { |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1170 | vty_out(vty, " Subscriber:%s", VTY_NEWLINE); |
Harald Welte | 2483f1b | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 1171 | subscr_dump_vty(vty, lchan->conn->vsub); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1172 | } else |
| 1173 | vty_out(vty, " No Subscriber%s", VTY_NEWLINE); |
Harald Welte | 2c82899 | 2009-12-02 01:56:49 +0530 | [diff] [blame] | 1174 | if (is_ipaccess_bts(lchan->ts->trx->bts)) { |
| 1175 | struct in_addr ia; |
Holger Hans Peter Freyther | 54fa799 | 2010-04-07 15:39:16 +0200 | [diff] [blame] | 1176 | ia.s_addr = htonl(lchan->abis_ip.bound_ip); |
Harald Welte | 2c82899 | 2009-12-02 01:56:49 +0530 | [diff] [blame] | 1177 | vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s", |
| 1178 | inet_ntoa(ia), lchan->abis_ip.bound_port, |
| 1179 | lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id, |
| 1180 | VTY_NEWLINE); |
| 1181 | } |
Harald Welte | 8387a49 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 1182 | |
| 1183 | /* we want to report the last measurement report */ |
| 1184 | idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep), |
| 1185 | lchan->meas_rep_idx, 1); |
| 1186 | meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " "); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1187 | } |
| 1188 | |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1189 | static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan) |
| 1190 | { |
Holger Hans Peter Freyther | cf5cc5b | 2010-05-14 01:57:02 +0800 | [diff] [blame] | 1191 | struct gsm_meas_rep *mr; |
| 1192 | int idx; |
| 1193 | |
| 1194 | /* we want to report the last measurement report */ |
| 1195 | idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep), |
| 1196 | lchan->meas_rep_idx, 1); |
| 1197 | mr = &lchan->meas_rep[idx]; |
| 1198 | |
Neels Hofmeyr | b748012 | 2016-11-02 14:28:15 +0100 | [diff] [blame] | 1199 | vty_out(vty, "BTS %u, TRX %u, Timeslot %u %s", |
Harald Welte | 85bded8 | 2010-12-24 12:22:34 +0100 | [diff] [blame] | 1200 | lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr, |
Neels Hofmeyr | b748012 | 2016-11-02 14:28:15 +0100 | [diff] [blame] | 1201 | gsm_pchan_name(lchan->ts->pchan)); |
| 1202 | vty_out_dyn_ts_status(vty, lchan->ts); |
| 1203 | vty_out(vty, ", Lchan %u, Type %s, State %s - " |
| 1204 | "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] | 1205 | lchan->nr, |
| 1206 | gsm_lchant_name(lchan->type), gsm_lchans_name(lchan->state), |
| 1207 | mr->ms_l1.pwr, |
Holger Hans Peter Freyther | cf5cc5b | 2010-05-14 01:57:02 +0800 | [diff] [blame] | 1208 | rxlev2dbm(mr->dl.full.rx_lev), |
| 1209 | rxlev2dbm(mr->ul.full.rx_lev), |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1210 | VTY_NEWLINE); |
| 1211 | } |
| 1212 | |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1213 | |
| 1214 | static int dump_lchan_trx_ts(struct gsm_bts_trx_ts *ts, struct vty *vty, |
| 1215 | void (*dump_cb)(struct vty *, struct gsm_lchan *)) |
| 1216 | { |
| 1217 | int lchan_nr; |
| 1218 | for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN; lchan_nr++) { |
| 1219 | struct gsm_lchan *lchan = &ts->lchan[lchan_nr]; |
| 1220 | if ((lchan->type == GSM_LCHAN_NONE) && (lchan->state == LCHAN_S_NONE)) |
| 1221 | continue; |
| 1222 | dump_cb(vty, lchan); |
| 1223 | } |
| 1224 | |
| 1225 | return CMD_SUCCESS; |
| 1226 | } |
| 1227 | |
| 1228 | static int dump_lchan_trx(struct gsm_bts_trx *trx, struct vty *vty, |
| 1229 | void (*dump_cb)(struct vty *, struct gsm_lchan *)) |
| 1230 | { |
| 1231 | int ts_nr; |
| 1232 | |
| 1233 | for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) { |
| 1234 | struct gsm_bts_trx_ts *ts = &trx->ts[ts_nr]; |
| 1235 | dump_lchan_trx_ts(ts, vty, dump_cb); |
| 1236 | } |
| 1237 | |
| 1238 | return CMD_SUCCESS; |
| 1239 | } |
| 1240 | |
| 1241 | static int dump_lchan_bts(struct gsm_bts *bts, struct vty *vty, |
| 1242 | void (*dump_cb)(struct vty *, struct gsm_lchan *)) |
| 1243 | { |
| 1244 | int trx_nr; |
| 1245 | |
| 1246 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
| 1247 | struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, trx_nr); |
| 1248 | dump_lchan_trx(trx, vty, dump_cb); |
| 1249 | } |
| 1250 | |
| 1251 | return CMD_SUCCESS; |
| 1252 | } |
| 1253 | |
Holger Hans Peter Freyther | 029235e | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1254 | static int lchan_summary(struct vty *vty, int argc, const char **argv, |
| 1255 | void (*dump_cb)(struct vty *, struct gsm_lchan *)) |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1256 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1257 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1258 | struct gsm_bts *bts; |
| 1259 | struct gsm_bts_trx *trx; |
| 1260 | struct gsm_bts_trx_ts *ts; |
| 1261 | struct gsm_lchan *lchan; |
| 1262 | int bts_nr, trx_nr, ts_nr, lchan_nr; |
| 1263 | |
| 1264 | if (argc >= 1) { |
| 1265 | /* use the BTS number that the user has specified */ |
| 1266 | bts_nr = atoi(argv[0]); |
| 1267 | if (bts_nr >= net->num_bts) { |
| 1268 | vty_out(vty, "%% can't find BTS %s%s", argv[0], |
| 1269 | VTY_NEWLINE); |
| 1270 | return CMD_WARNING; |
| 1271 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1272 | bts = gsm_bts_num(net, bts_nr); |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1273 | |
| 1274 | if (argc == 1) |
| 1275 | return dump_lchan_bts(bts, vty, dump_cb); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1276 | } |
| 1277 | if (argc >= 2) { |
| 1278 | trx_nr = atoi(argv[1]); |
| 1279 | if (trx_nr >= bts->num_trx) { |
| 1280 | vty_out(vty, "%% can't find TRX %s%s", argv[1], |
| 1281 | VTY_NEWLINE); |
| 1282 | return CMD_WARNING; |
| 1283 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1284 | trx = gsm_bts_trx_num(bts, trx_nr); |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1285 | |
| 1286 | if (argc == 2) |
| 1287 | return dump_lchan_trx(trx, vty, dump_cb); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1288 | } |
| 1289 | if (argc >= 3) { |
| 1290 | ts_nr = atoi(argv[2]); |
| 1291 | if (ts_nr >= TRX_NR_TS) { |
| 1292 | vty_out(vty, "%% can't find TS %s%s", argv[2], |
| 1293 | VTY_NEWLINE); |
| 1294 | return CMD_WARNING; |
| 1295 | } |
| 1296 | ts = &trx->ts[ts_nr]; |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1297 | |
| 1298 | if (argc == 3) |
| 1299 | return dump_lchan_trx_ts(ts, vty, dump_cb); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1300 | } |
| 1301 | if (argc >= 4) { |
| 1302 | lchan_nr = atoi(argv[3]); |
| 1303 | if (lchan_nr >= TS_MAX_LCHAN) { |
| 1304 | vty_out(vty, "%% can't find LCHAN %s%s", argv[3], |
| 1305 | VTY_NEWLINE); |
| 1306 | return CMD_WARNING; |
| 1307 | } |
| 1308 | lchan = &ts->lchan[lchan_nr]; |
Holger Hans Peter Freyther | 029235e | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1309 | dump_cb(vty, lchan); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1310 | return CMD_SUCCESS; |
| 1311 | } |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1312 | |
| 1313 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1314 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1315 | bts = gsm_bts_num(net, bts_nr); |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1316 | dump_lchan_bts(bts, vty, dump_cb); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1317 | } |
| 1318 | |
| 1319 | return CMD_SUCCESS; |
| 1320 | } |
| 1321 | |
Holger Hans Peter Freyther | 029235e | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1322 | |
| 1323 | DEFUN(show_lchan, |
| 1324 | show_lchan_cmd, |
Sylvain Munaut | 39c31de | 2012-12-28 12:15:11 +0100 | [diff] [blame] | 1325 | "show lchan [<0-255>] [<0-255>] [<0-7>] [lchan_nr]", |
Holger Hans Peter Freyther | 029235e | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1326 | SHOW_STR "Display information about a logical channel\n" |
| 1327 | "BTS Number\n" "TRX Number\n" "Timeslot Number\n" |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1328 | LCHAN_NR_STR) |
Holger Hans Peter Freyther | 029235e | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1329 | |
| 1330 | { |
| 1331 | return lchan_summary(vty, argc, argv, lchan_dump_full_vty); |
| 1332 | } |
| 1333 | |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1334 | DEFUN(show_lchan_summary, |
| 1335 | show_lchan_summary_cmd, |
Sylvain Munaut | 39c31de | 2012-12-28 12:15:11 +0100 | [diff] [blame] | 1336 | "show lchan summary [<0-255>] [<0-255>] [<0-7>] [lchan_nr]", |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1337 | SHOW_STR "Display information about a logical channel\n" |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1338 | "Short summary\n" |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1339 | "BTS Number\n" "TRX Number\n" "Timeslot Number\n" |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1340 | LCHAN_NR_STR) |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1341 | { |
| 1342 | return lchan_summary(vty, argc, argv, lchan_dump_short_vty); |
| 1343 | } |
| 1344 | |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 1345 | DEFUN(show_subscr_conn, |
| 1346 | show_subscr_conn_cmd, |
| 1347 | "show conns", |
| 1348 | SHOW_STR "Display currently active subscriber connections\n") |
| 1349 | { |
| 1350 | struct gsm_subscriber_connection *conn; |
| 1351 | struct gsm_network *net = gsmnet_from_vty(vty); |
| 1352 | bool no_conns = true; |
| 1353 | unsigned int count = 0; |
| 1354 | |
| 1355 | vty_out(vty, "Active subscriber connections: %s", VTY_NEWLINE); |
| 1356 | |
| 1357 | llist_for_each_entry(conn, &net->subscr_conns, entry) { |
| 1358 | vty_out(vty, "conn nr #%u:%s", count, VTY_NEWLINE); |
| 1359 | lchan_dump_full_vty(vty, conn->lchan); |
| 1360 | no_conns = false; |
| 1361 | count++; |
| 1362 | } |
| 1363 | |
| 1364 | if (no_conns) |
| 1365 | vty_out(vty, "None%s", VTY_NEWLINE); |
| 1366 | |
| 1367 | return CMD_SUCCESS; |
| 1368 | } |
| 1369 | |
| 1370 | DEFUN(handover_subscr_conn, |
| 1371 | handover_subscr_conn_cmd, |
| 1372 | "handover <0-255> <0-255> <0-7> LCHAN_NR <0-255>", |
| 1373 | "Handover subscriber connection to other BTS\n" |
| 1374 | "BTS Number (current)\n" "TRX Number\n" "Timeslot Number\n" |
| 1375 | LCHAN_NR_STR "BTS Number (new)\n") |
| 1376 | { |
| 1377 | struct gsm_network *net = gsmnet_from_vty(vty); |
| 1378 | struct gsm_subscriber_connection *conn; |
| 1379 | struct gsm_bts *bts; |
| 1380 | struct gsm_bts *new_bts = NULL; |
| 1381 | unsigned int bts_nr = atoi(argv[0]); |
| 1382 | unsigned int trx_nr = atoi(argv[1]); |
| 1383 | unsigned int ts_nr = atoi(argv[2]); |
| 1384 | unsigned int ss_nr = atoi(argv[3]); |
| 1385 | unsigned int bts_nr_new = atoi(argv[4]); |
| 1386 | |
| 1387 | /* Lookup the BTS where we want to handover to */ |
| 1388 | llist_for_each_entry(bts, &net->bts_list, list) { |
| 1389 | if (bts->nr == bts_nr_new) { |
| 1390 | new_bts = bts; |
| 1391 | break; |
| 1392 | } |
| 1393 | } |
| 1394 | |
| 1395 | if (!new_bts) { |
| 1396 | vty_out(vty, "Unable to trigger handover," |
| 1397 | "specified bts #%u does not exist %s", bts_nr_new, |
| 1398 | VTY_NEWLINE); |
| 1399 | return CMD_WARNING; |
| 1400 | } |
| 1401 | |
| 1402 | /* Find the connection/lchan that we want to handover */ |
| 1403 | llist_for_each_entry(conn, &net->subscr_conns, entry) { |
| 1404 | if (conn->bts->nr == bts_nr && |
| 1405 | conn->lchan->ts->trx->nr == trx_nr && |
| 1406 | conn->lchan->ts->nr == ts_nr && conn->lchan->nr == ss_nr) { |
| 1407 | vty_out(vty, "starting handover for lchan %s...%s", |
| 1408 | conn->lchan->name, VTY_NEWLINE); |
| 1409 | lchan_dump_full_vty(vty, conn->lchan); |
| 1410 | bsc_handover_start(conn->lchan, new_bts); |
| 1411 | return CMD_SUCCESS; |
| 1412 | } |
| 1413 | } |
| 1414 | |
| 1415 | vty_out(vty, "Unable to trigger handover," |
| 1416 | "specified connection (bts=%u,trx=%u,ts=%u,ss=%u) does not exist%s", |
| 1417 | bts_nr, trx_nr, ts_nr, ss_nr, VTY_NEWLINE); |
| 1418 | |
| 1419 | return CMD_WARNING; |
| 1420 | } |
| 1421 | |
Harald Welte | be4b730 | 2009-05-23 16:59:33 +0000 | [diff] [blame] | 1422 | 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] | 1423 | { |
| 1424 | 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] | 1425 | bsc_subscr_dump_vty(vty, pag->bsub); |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1426 | } |
| 1427 | |
Harald Welte | be4b730 | 2009-05-23 16:59:33 +0000 | [diff] [blame] | 1428 | 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] | 1429 | { |
| 1430 | struct gsm_paging_request *pag; |
| 1431 | |
Holger Hans Peter Freyther | 9b5192b | 2013-03-03 11:03:17 +0100 | [diff] [blame] | 1432 | if (!bts->paging.bts) |
| 1433 | return; |
| 1434 | |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1435 | llist_for_each_entry(pag, &bts->paging.pending_requests, entry) |
| 1436 | paging_dump_vty(vty, pag); |
| 1437 | } |
| 1438 | |
| 1439 | DEFUN(show_paging, |
| 1440 | show_paging_cmd, |
Sylvain Munaut | 39c31de | 2012-12-28 12:15:11 +0100 | [diff] [blame] | 1441 | "show paging [<0-255>]", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1442 | SHOW_STR "Display information about paging reuqests of a BTS\n" |
| 1443 | "BTS Number\n") |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1444 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1445 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1446 | struct gsm_bts *bts; |
| 1447 | int bts_nr; |
| 1448 | |
| 1449 | if (argc >= 1) { |
| 1450 | /* use the BTS number that the user has specified */ |
| 1451 | bts_nr = atoi(argv[0]); |
| 1452 | if (bts_nr >= net->num_bts) { |
| 1453 | vty_out(vty, "%% can't find BTS %s%s", argv[0], |
| 1454 | VTY_NEWLINE); |
| 1455 | return CMD_WARNING; |
| 1456 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1457 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1458 | bts_paging_dump_vty(vty, bts); |
| 1459 | |
| 1460 | return CMD_SUCCESS; |
| 1461 | } |
| 1462 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1463 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1464 | bts_paging_dump_vty(vty, bts); |
| 1465 | } |
| 1466 | |
| 1467 | return CMD_SUCCESS; |
| 1468 | } |
| 1469 | |
Holger Hans Peter Freyther | ec37bb2 | 2013-02-05 09:39:09 +0100 | [diff] [blame] | 1470 | DEFUN(show_paging_group, |
| 1471 | show_paging_group_cmd, |
| 1472 | "show paging-group <0-255> IMSI", |
| 1473 | SHOW_STR "Display the paging group\n" |
| 1474 | "BTS Number\n" "IMSI\n") |
| 1475 | { |
| 1476 | struct gsm_network *net = gsmnet_from_vty(vty); |
| 1477 | struct gsm_bts *bts; |
| 1478 | unsigned int page_group; |
| 1479 | int bts_nr = atoi(argv[0]); |
| 1480 | |
| 1481 | if (bts_nr >= net->num_bts) { |
| 1482 | vty_out(vty, "%% can't find BTS %s%s", argv[0], VTY_NEWLINE); |
| 1483 | return CMD_WARNING; |
| 1484 | } |
| 1485 | |
| 1486 | bts = gsm_bts_num(net, bts_nr); |
| 1487 | if (!bts) { |
| 1488 | vty_out(vty, "%% can't find BTS %s%s", argv[0], VTY_NEWLINE); |
| 1489 | return CMD_WARNING; |
| 1490 | } |
| 1491 | |
| 1492 | page_group = gsm0502_calc_paging_group(&bts->si_common.chan_desc, |
| 1493 | str_to_imsi(argv[1])); |
| 1494 | vty_out(vty, "%%Paging group for IMSI %" PRIu64 " on BTS #%d is %u%s", |
| 1495 | str_to_imsi(argv[1]), bts->nr, |
| 1496 | page_group, VTY_NEWLINE); |
| 1497 | return CMD_SUCCESS; |
| 1498 | } |
| 1499 | |
Holger Hans Peter Freyther | f7d752f | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 1500 | DEFUN(cfg_net_neci, |
| 1501 | cfg_net_neci_cmd, |
| 1502 | "neci (0|1)", |
Harald Welte | 2832606 | 2010-05-14 20:05:17 +0200 | [diff] [blame] | 1503 | "New Establish Cause Indication\n" |
| 1504 | "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] | 1505 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1506 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1507 | |
Holger Hans Peter Freyther | f7d752f | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 1508 | gsmnet->neci = atoi(argv[0]); |
Holger Hans Peter Freyther | 7889107 | 2010-09-06 09:36:02 +0800 | [diff] [blame] | 1509 | gsm_net_update_ctype(gsmnet); |
Holger Hans Peter Freyther | f7d752f | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 1510 | return CMD_SUCCESS; |
| 1511 | } |
| 1512 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1513 | #define HANDOVER_STR "Handover Options\n" |
| 1514 | |
Harald Welte | bc81450 | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 1515 | DEFUN(cfg_net_handover, cfg_net_handover_cmd, |
| 1516 | "handover (0|1)", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1517 | HANDOVER_STR |
| 1518 | "Don't perform in-call handover\n" |
| 1519 | "Perform in-call handover\n") |
Harald Welte | bc81450 | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 1520 | { |
Holger Hans Peter Freyther | cbcfe24 | 2010-01-07 16:14:38 +0100 | [diff] [blame] | 1521 | int enable = atoi(argv[0]); |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1522 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Holger Hans Peter Freyther | cbcfe24 | 2010-01-07 16:14:38 +0100 | [diff] [blame] | 1523 | |
| 1524 | if (enable && ipacc_rtp_direct) { |
Harald Welte | fe03f0d | 2009-12-20 13:51:01 +0100 | [diff] [blame] | 1525 | vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode " |
| 1526 | "is enabled by using the -P command line option%s", |
| 1527 | VTY_NEWLINE); |
| 1528 | return CMD_WARNING; |
| 1529 | } |
Holger Hans Peter Freyther | cbcfe24 | 2010-01-07 16:14:38 +0100 | [diff] [blame] | 1530 | gsmnet->handover.active = enable; |
Harald Welte | bc81450 | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 1531 | |
| 1532 | return CMD_SUCCESS; |
| 1533 | } |
| 1534 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1535 | #define HO_WIN_STR HANDOVER_STR "Measurement Window\n" |
| 1536 | #define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n" |
| 1537 | #define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n" |
| 1538 | #define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n" |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1539 | #define HO_AVG_COUNT_STR "Amount to use for Averaging\n" |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1540 | |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1541 | DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd, |
| 1542 | "handover window rxlev averaging <1-10>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1543 | HO_WIN_RXLEV_STR |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1544 | "How many RxLev measurements are used for averaging\n" |
| 1545 | HO_AVG_COUNT_STR) |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1546 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1547 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1548 | gsmnet->handover.win_rxlev_avg = atoi(argv[0]); |
| 1549 | return CMD_SUCCESS; |
| 1550 | } |
| 1551 | |
| 1552 | DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd, |
| 1553 | "handover window rxqual averaging <1-10>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1554 | HO_WIN_RXQUAL_STR |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1555 | "How many RxQual measurements are used for averaging\n" |
| 1556 | HO_AVG_COUNT_STR) |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1557 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1558 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1559 | gsmnet->handover.win_rxqual_avg = atoi(argv[0]); |
| 1560 | return CMD_SUCCESS; |
| 1561 | } |
| 1562 | |
| 1563 | DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd, |
| 1564 | "handover window rxlev neighbor averaging <1-10>", |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1565 | HO_WIN_RXLEV_STR "Neighbor\n" |
| 1566 | "How many RxQual measurements are used for averaging\n" |
| 1567 | HO_AVG_COUNT_STR) |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1568 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1569 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1570 | gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]); |
| 1571 | return CMD_SUCCESS; |
| 1572 | } |
| 1573 | |
| 1574 | DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd, |
| 1575 | "handover power budget interval <1-99>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1576 | HO_PBUDGET_STR |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1577 | "How often to check if we have a better cell (SACCH frames)\n" |
| 1578 | "Interval\n" "Number\n") |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1579 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1580 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1581 | gsmnet->handover.pwr_interval = atoi(argv[0]); |
| 1582 | return CMD_SUCCESS; |
| 1583 | } |
| 1584 | |
| 1585 | DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd, |
| 1586 | "handover power budget hysteresis <0-999>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1587 | HO_PBUDGET_STR |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1588 | "How many dB does a neighbor to be stronger to become a HO candidate\n" |
| 1589 | "Hysteresis\n" "Number\n") |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1590 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1591 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1592 | gsmnet->handover.pwr_hysteresis = atoi(argv[0]); |
| 1593 | return CMD_SUCCESS; |
| 1594 | } |
| 1595 | |
| 1596 | DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd, |
| 1597 | "handover maximum distance <0-9999>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1598 | HANDOVER_STR |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1599 | "How big is the maximum timing advance before HO is forced\n" |
| 1600 | "Distance\n" "Number\n") |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1601 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1602 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1603 | gsmnet->handover.max_distance = atoi(argv[0]); |
| 1604 | return CMD_SUCCESS; |
| 1605 | } |
Harald Welte | bc81450 | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 1606 | |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 1607 | DEFUN(cfg_net_pag_any_tch, |
| 1608 | cfg_net_pag_any_tch_cmd, |
| 1609 | "paging any use tch (0|1)", |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1610 | "Assign a TCH when receiving a Paging Any request\n" |
| 1611 | "Any Channel\n" "Use\n" "TCH\n" |
| 1612 | "Do not use TCH for Paging Request Any\n" |
| 1613 | "Do use TCH for Paging Request Any\n") |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 1614 | { |
Holger Hans Peter Freyther | b0e88b8 | 2010-09-06 10:09:19 +0800 | [diff] [blame] | 1615 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 1616 | gsmnet->pag_any_tch = atoi(argv[0]); |
| 1617 | gsm_net_update_ctype(gsmnet); |
| 1618 | return CMD_SUCCESS; |
| 1619 | } |
| 1620 | |
Neels Hofmeyr | 5541e1d | 2017-07-24 13:06:45 +0200 | [diff] [blame] | 1621 | #define DEFAULT_TIMER(number) GSM_T##number##_DEFAULT |
| 1622 | /* Add another expansion so that DEFAULT_TIMER() becomes its value */ |
| 1623 | #define EXPAND_AND_STRINGIFY(x) OSMO_STRINGIFY(x) |
| 1624 | |
Holger Hans Peter Freyther | c802106 | 2009-12-22 08:27:21 +0100 | [diff] [blame] | 1625 | #define DECLARE_TIMER(number, doc) \ |
Holger Hans Peter Freyther | c4d88ad | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1626 | DEFUN(cfg_net_T##number, \ |
| 1627 | cfg_net_T##number##_cmd, \ |
Neels Hofmeyr | 5541e1d | 2017-07-24 13:06:45 +0200 | [diff] [blame] | 1628 | "timer t" #number " (default|<1-65535>)", \ |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1629 | "Configure GSM Timers\n" \ |
Neels Hofmeyr | 41a5327 | 2017-07-24 13:36:42 +0200 | [diff] [blame] | 1630 | doc " (default: " EXPAND_AND_STRINGIFY(DEFAULT_TIMER(number)) " seconds)\n" \ |
Neels Hofmeyr | 5541e1d | 2017-07-24 13:06:45 +0200 | [diff] [blame] | 1631 | "Set to default timer value" \ |
| 1632 | " (" EXPAND_AND_STRINGIFY(DEFAULT_TIMER(number)) " seconds)\n" \ |
| 1633 | "Timer Value in seconds\n") \ |
Holger Hans Peter Freyther | c4d88ad | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1634 | { \ |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1635 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); \ |
Neels Hofmeyr | 5541e1d | 2017-07-24 13:06:45 +0200 | [diff] [blame] | 1636 | int value; \ |
| 1637 | if (strcmp(argv[0], "default") == 0) \ |
| 1638 | value = DEFAULT_TIMER(number); \ |
| 1639 | else \ |
| 1640 | value = atoi(argv[0]); \ |
Holger Hans Peter Freyther | c4d88ad | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1641 | \ |
Holger Hans Peter Freyther | c4d88ad | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1642 | gsmnet->T##number = value; \ |
| 1643 | return CMD_SUCCESS; \ |
| 1644 | } |
| 1645 | |
Neels Hofmeyr | 41a5327 | 2017-07-24 13:36:42 +0200 | [diff] [blame] | 1646 | DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT") |
| 1647 | DECLARE_TIMER(3103, "Set the timeout value for HANDOVER") |
| 1648 | DECLARE_TIMER(3105, "Set the timer for repetition of PHYSICAL INFORMATION") |
| 1649 | DECLARE_TIMER(3107, "Currently not used") |
| 1650 | DECLARE_TIMER(3109, "Set the RSL SACCH deactivation timeout") |
| 1651 | DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel") |
| 1652 | DECLARE_TIMER(3113, "Set the time to try paging a subscriber") |
| 1653 | DECLARE_TIMER(3115, "Currently not used") |
| 1654 | DECLARE_TIMER(3117, "Currently not used") |
| 1655 | DECLARE_TIMER(3119, "Currently not used") |
| 1656 | DECLARE_TIMER(3122, "Waiting time (seconds) after IMM ASS REJECT") |
| 1657 | DECLARE_TIMER(3141, "Currently not used") |
Holger Hans Peter Freyther | c4d88ad | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1658 | |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 1659 | DEFUN_DEPRECATED(cfg_net_dtx, |
| 1660 | cfg_net_dtx_cmd, |
| 1661 | "dtx-used (0|1)", |
| 1662 | ".HIDDEN\n""Obsolete\n""Obsolete\n") |
Holger Hans Peter Freyther | 5a3a61d | 2010-09-06 09:25:48 +0800 | [diff] [blame] | 1663 | { |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 1664 | vty_out(vty, "%% 'dtx-used' is now deprecated: use dtx * " |
| 1665 | "configuration options of BTS instead%s", VTY_NEWLINE); |
| 1666 | return CMD_SUCCESS; |
Holger Hans Peter Freyther | 5a3a61d | 2010-09-06 09:25:48 +0800 | [diff] [blame] | 1667 | } |
Holger Hans Peter Freyther | c4d88ad | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1668 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1669 | /* per-BTS configuration */ |
| 1670 | DEFUN(cfg_bts, |
| 1671 | cfg_bts_cmd, |
Harald Welte | 57e0724 | 2012-08-17 12:50:14 +0200 | [diff] [blame] | 1672 | "bts <0-255>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1673 | "Select a BTS to configure\n" |
| 1674 | "BTS Number\n") |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1675 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1676 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1677 | int bts_nr = atoi(argv[0]); |
| 1678 | struct gsm_bts *bts; |
| 1679 | |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1680 | if (bts_nr > gsmnet->num_bts) { |
| 1681 | vty_out(vty, "%% The next unused BTS number is %u%s", |
| 1682 | gsmnet->num_bts, VTY_NEWLINE); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1683 | return CMD_WARNING; |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1684 | } else if (bts_nr == gsmnet->num_bts) { |
| 1685 | /* allocate a new one */ |
Harald Welte | 3300c01 | 2011-06-05 13:31:33 +0200 | [diff] [blame] | 1686 | bts = gsm_bts_alloc_register(gsmnet, GSM_BTS_TYPE_UNKNOWN, |
Harald Welte | a2bbc5e | 2015-11-20 10:43:31 +0100 | [diff] [blame] | 1687 | HARDCODED_BSIC); |
Holger Hans Peter Freyther | acf8a0c | 2010-03-29 08:47:44 +0200 | [diff] [blame] | 1688 | } else |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1689 | bts = gsm_bts_num(gsmnet, bts_nr); |
| 1690 | |
Daniel Willmann | f15c276 | 2010-01-11 13:43:07 +0100 | [diff] [blame] | 1691 | if (!bts) { |
| 1692 | vty_out(vty, "%% Unable to allocate BTS %u%s", |
| 1693 | gsmnet->num_bts, VTY_NEWLINE); |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1694 | return CMD_WARNING; |
Daniel Willmann | f15c276 | 2010-01-11 13:43:07 +0100 | [diff] [blame] | 1695 | } |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1696 | |
| 1697 | vty->index = bts; |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 1698 | vty->index_sub = &bts->description; |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1699 | vty->node = BTS_NODE; |
| 1700 | |
| 1701 | return CMD_SUCCESS; |
| 1702 | } |
| 1703 | |
| 1704 | DEFUN(cfg_bts_type, |
| 1705 | cfg_bts_type_cmd, |
Harald Welte | e555c2b | 2012-08-17 13:02:12 +0200 | [diff] [blame] | 1706 | "type TYPE", /* dynamically created */ |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1707 | "Set the BTS type\n" "Type\n") |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1708 | { |
| 1709 | struct gsm_bts *bts = vty->index; |
Harald Welte | 39315c4 | 2010-01-10 18:01:52 +0100 | [diff] [blame] | 1710 | int rc; |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1711 | |
Max | 7507aef | 2017-04-10 13:59:14 +0200 | [diff] [blame] | 1712 | rc = gsm_set_bts_type(bts, str2btstype(argv[0])); |
Harald Welte | 39315c4 | 2010-01-10 18:01:52 +0100 | [diff] [blame] | 1713 | if (rc < 0) |
| 1714 | return CMD_WARNING; |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1715 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1716 | return CMD_SUCCESS; |
| 1717 | } |
| 1718 | |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 1719 | DEFUN(cfg_bts_band, |
| 1720 | cfg_bts_band_cmd, |
| 1721 | "band BAND", |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1722 | "Set the frequency band of this BTS\n" "Frequency band\n") |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 1723 | { |
| 1724 | struct gsm_bts *bts = vty->index; |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1725 | int band = gsm_band_parse(argv[0]); |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 1726 | |
| 1727 | if (band < 0) { |
| 1728 | vty_out(vty, "%% BAND %d is not a valid GSM band%s", |
| 1729 | band, VTY_NEWLINE); |
| 1730 | return CMD_WARNING; |
| 1731 | } |
| 1732 | |
| 1733 | bts->band = band; |
| 1734 | |
| 1735 | return CMD_SUCCESS; |
| 1736 | } |
| 1737 | |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 1738 | DEFUN(cfg_bts_dtxu, cfg_bts_dtxu_cmd, "dtx uplink [force]", |
| 1739 | "Configure discontinuous transmission\n" |
| 1740 | "Enable Uplink DTX for this BTS\n" |
| 1741 | "MS 'shall' use DTXu instead of 'may' use (might not be supported by " |
| 1742 | "older phones).\n") |
| 1743 | { |
| 1744 | struct gsm_bts *bts = vty->index; |
| 1745 | |
| 1746 | 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] | 1747 | if (!is_ipaccess_bts(bts)) |
| 1748 | vty_out(vty, "%% DTX enabled on non-IP BTS: this configuration " |
| 1749 | "neither supported nor tested!%s", VTY_NEWLINE); |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 1750 | return CMD_SUCCESS; |
| 1751 | } |
| 1752 | |
| 1753 | DEFUN(cfg_bts_no_dtxu, cfg_bts_no_dtxu_cmd, "no dtx uplink", |
| 1754 | NO_STR |
| 1755 | "Configure discontinuous transmission\n" |
| 1756 | "Disable Uplink DTX for this BTS\n") |
| 1757 | { |
| 1758 | struct gsm_bts *bts = vty->index; |
| 1759 | |
| 1760 | bts->dtxu = GSM48_DTX_SHALL_NOT_BE_USED; |
| 1761 | |
| 1762 | return CMD_SUCCESS; |
| 1763 | } |
| 1764 | |
| 1765 | DEFUN(cfg_bts_dtxd, cfg_bts_dtxd_cmd, "dtx downlink", |
| 1766 | "Configure discontinuous transmission\n" |
| 1767 | "Enable Downlink DTX for this BTS\n") |
| 1768 | { |
| 1769 | struct gsm_bts *bts = vty->index; |
| 1770 | |
| 1771 | bts->dtxd = true; |
Max | 6079528 | 2016-06-06 11:30:57 +0200 | [diff] [blame] | 1772 | if (!is_ipaccess_bts(bts)) |
| 1773 | vty_out(vty, "%% DTX enabled on non-IP BTS: this configuration " |
| 1774 | "neither supported nor tested!%s", VTY_NEWLINE); |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 1775 | return CMD_SUCCESS; |
| 1776 | } |
| 1777 | |
| 1778 | DEFUN(cfg_bts_no_dtxd, cfg_bts_no_dtxd_cmd, "no dtx downlink", |
| 1779 | NO_STR |
| 1780 | "Configure discontinuous transmission\n" |
| 1781 | "Disable Downlink DTX for this BTS\n") |
| 1782 | { |
| 1783 | struct gsm_bts *bts = vty->index; |
| 1784 | |
| 1785 | bts->dtxd = false; |
| 1786 | |
| 1787 | return CMD_SUCCESS; |
| 1788 | } |
| 1789 | |
Holger Hans Peter Freyther | c4a49e3 | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 1790 | DEFUN(cfg_bts_ci, |
| 1791 | cfg_bts_ci_cmd, |
| 1792 | "cell_identity <0-65535>", |
Holger Hans Peter Freyther | 64c17fa | 2012-07-21 00:27:10 +0200 | [diff] [blame] | 1793 | "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] | 1794 | { |
| 1795 | struct gsm_bts *bts = vty->index; |
| 1796 | int ci = atoi(argv[0]); |
| 1797 | |
| 1798 | if (ci < 0 || ci > 0xffff) { |
| 1799 | vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s", |
| 1800 | ci, VTY_NEWLINE); |
| 1801 | return CMD_WARNING; |
| 1802 | } |
| 1803 | bts->cell_identity = ci; |
| 1804 | |
| 1805 | return CMD_SUCCESS; |
| 1806 | } |
| 1807 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1808 | DEFUN(cfg_bts_lac, |
| 1809 | cfg_bts_lac_cmd, |
Holger Hans Peter Freyther | 0b7f4b3 | 2009-09-29 14:02:33 +0200 | [diff] [blame] | 1810 | "location_area_code <0-65535>", |
Holger Hans Peter Freyther | 64c17fa | 2012-07-21 00:27:10 +0200 | [diff] [blame] | 1811 | "Set the Location Area Code (LAC) of this BTS\n" "LAC\n") |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1812 | { |
| 1813 | struct gsm_bts *bts = vty->index; |
| 1814 | int lac = atoi(argv[0]); |
| 1815 | |
Holger Hans Peter Freyther | 0b7f4b3 | 2009-09-29 14:02:33 +0200 | [diff] [blame] | 1816 | if (lac < 0 || lac > 0xffff) { |
| 1817 | 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] | 1818 | lac, VTY_NEWLINE); |
| 1819 | return CMD_WARNING; |
| 1820 | } |
Holger Hans Peter Freyther | e48b956 | 2009-10-01 04:07:15 +0200 | [diff] [blame] | 1821 | |
| 1822 | if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) { |
| 1823 | vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s", |
| 1824 | lac, VTY_NEWLINE); |
| 1825 | return CMD_WARNING; |
| 1826 | } |
| 1827 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1828 | bts->location_area_code = lac; |
| 1829 | |
| 1830 | return CMD_SUCCESS; |
| 1831 | } |
| 1832 | |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 1833 | |
Harald Welte | a2bbc5e | 2015-11-20 10:43:31 +0100 | [diff] [blame] | 1834 | /* compatibility wrapper for old config files */ |
| 1835 | DEFUN_HIDDEN(cfg_bts_tsc, |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1836 | cfg_bts_tsc_cmd, |
Harald Welte | c513ded | 2012-05-31 10:57:08 +0200 | [diff] [blame] | 1837 | "training_sequence_code <0-7>", |
Holger Hans Peter Freyther | 64c17fa | 2012-07-21 00:27:10 +0200 | [diff] [blame] | 1838 | "Set the Training Sequence Code (TSC) of this BTS\n" "TSC\n") |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1839 | { |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1840 | return CMD_SUCCESS; |
| 1841 | } |
| 1842 | |
Harald Welte | 78f2f50 | 2009-05-23 16:56:52 +0000 | [diff] [blame] | 1843 | DEFUN(cfg_bts_bsic, |
| 1844 | cfg_bts_bsic_cmd, |
| 1845 | "base_station_id_code <0-63>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1846 | "Set the Base Station Identity Code (BSIC) of this BTS\n" |
| 1847 | "BSIC of this BTS\n") |
Harald Welte | 78f2f50 | 2009-05-23 16:56:52 +0000 | [diff] [blame] | 1848 | { |
| 1849 | struct gsm_bts *bts = vty->index; |
| 1850 | int bsic = atoi(argv[0]); |
| 1851 | |
| 1852 | if (bsic < 0 || bsic > 0x3f) { |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1853 | 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] | 1854 | bsic, VTY_NEWLINE); |
| 1855 | return CMD_WARNING; |
| 1856 | } |
| 1857 | bts->bsic = bsic; |
| 1858 | |
| 1859 | return CMD_SUCCESS; |
| 1860 | } |
| 1861 | |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 1862 | DEFUN(cfg_bts_unit_id, |
| 1863 | cfg_bts_unit_id_cmd, |
Harald Welte | 07dc73d | 2009-08-07 13:27:09 +0200 | [diff] [blame] | 1864 | "ip.access unit_id <0-65534> <0-255>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1865 | "Abis/IP specific options\n" |
| 1866 | "Set the IPA BTS Unit ID\n" |
| 1867 | "Unit ID (Site)\n" |
| 1868 | "Unit ID (BTS)\n") |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 1869 | { |
| 1870 | struct gsm_bts *bts = vty->index; |
| 1871 | int site_id = atoi(argv[0]); |
| 1872 | int bts_id = atoi(argv[1]); |
| 1873 | |
Harald Welte | 07dc73d | 2009-08-07 13:27:09 +0200 | [diff] [blame] | 1874 | if (!is_ipaccess_bts(bts)) { |
| 1875 | vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE); |
| 1876 | return CMD_WARNING; |
| 1877 | } |
| 1878 | |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 1879 | bts->ip_access.site_id = site_id; |
| 1880 | bts->ip_access.bts_id = bts_id; |
| 1881 | |
| 1882 | return CMD_SUCCESS; |
| 1883 | } |
| 1884 | |
Harald Welte | 8b29180 | 2013-03-12 13:57:05 +0100 | [diff] [blame] | 1885 | DEFUN(cfg_bts_rsl_ip, |
| 1886 | cfg_bts_rsl_ip_cmd, |
| 1887 | "ip.access rsl-ip A.B.C.D", |
| 1888 | "Abis/IP specific options\n" |
| 1889 | "Set the IPA RSL IP Address of the BSC\n" |
| 1890 | "Destination IP address for RSL connection\n") |
| 1891 | { |
| 1892 | struct gsm_bts *bts = vty->index; |
| 1893 | struct in_addr ia; |
| 1894 | |
| 1895 | if (!is_ipaccess_bts(bts)) { |
| 1896 | vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE); |
| 1897 | return CMD_WARNING; |
| 1898 | } |
| 1899 | |
| 1900 | inet_aton(argv[0], &ia); |
| 1901 | bts->ip_access.rsl_ip = ntohl(ia.s_addr); |
| 1902 | |
| 1903 | return CMD_SUCCESS; |
| 1904 | } |
| 1905 | |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 1906 | #define NOKIA_STR "Nokia *Site related commands\n" |
Harald Welte | 8b29180 | 2013-03-12 13:57:05 +0100 | [diff] [blame] | 1907 | |
Sylvain Munaut | c951946 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 1908 | DEFUN(cfg_bts_nokia_site_skip_reset, |
| 1909 | cfg_bts_nokia_site_skip_reset_cmd, |
| 1910 | "nokia_site skip-reset (0|1)", |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 1911 | NOKIA_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1912 | "Skip the reset step during bootstrap process of this BTS\n" |
| 1913 | "Do NOT skip the reset\n" "Skip the reset\n") |
Sylvain Munaut | c951946 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 1914 | { |
| 1915 | struct gsm_bts *bts = vty->index; |
| 1916 | |
| 1917 | if (bts->type != GSM_BTS_TYPE_NOKIA_SITE) { |
| 1918 | vty_out(vty, "%% BTS is not of Nokia *Site type%s", VTY_NEWLINE); |
| 1919 | return CMD_WARNING; |
| 1920 | } |
| 1921 | |
| 1922 | bts->nokia.skip_reset = atoi(argv[0]); |
| 1923 | |
| 1924 | return CMD_SUCCESS; |
| 1925 | } |
| 1926 | |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 1927 | DEFUN(cfg_bts_nokia_site_no_loc_rel_cnf, |
| 1928 | cfg_bts_nokia_site_no_loc_rel_cnf_cmd, |
| 1929 | "nokia_site no-local-rel-conf (0|1)", |
| 1930 | NOKIA_STR |
| 1931 | "Do not wait for RELease CONFirm message when releasing channel locally\n" |
| 1932 | "Wait for RELease CONFirm\n" "Do not wait for RELease CONFirm\n") |
| 1933 | { |
| 1934 | struct gsm_bts *bts = vty->index; |
| 1935 | |
| 1936 | if (!is_nokia_bts(bts)) { |
| 1937 | vty_out(vty, "%% BTS is not of Nokia *Site type%s", |
| 1938 | VTY_NEWLINE); |
| 1939 | return CMD_WARNING; |
| 1940 | } |
| 1941 | |
| 1942 | bts->nokia.no_loc_rel_cnf = atoi(argv[0]); |
| 1943 | |
| 1944 | return CMD_SUCCESS; |
| 1945 | } |
| 1946 | |
Sipos Csaba | 56e1766 | 2015-02-07 13:27:36 +0100 | [diff] [blame] | 1947 | DEFUN(cfg_bts_nokia_site_bts_reset_timer_cnf, |
| 1948 | cfg_bts_nokia_site_bts_reset_timer_cnf_cmd, |
| 1949 | "nokia_site bts-reset-timer <15-100>", |
| 1950 | NOKIA_STR |
| 1951 | "The amount of time (in sec.) between BTS_RESET is sent,\n" |
| 1952 | "and the BTS is being bootstrapped.\n") |
| 1953 | { |
| 1954 | struct gsm_bts *bts = vty->index; |
| 1955 | |
| 1956 | if (!is_nokia_bts(bts)) { |
| 1957 | vty_out(vty, "%% BTS is not of Nokia *Site type%s", |
| 1958 | VTY_NEWLINE); |
| 1959 | return CMD_WARNING; |
| 1960 | } |
| 1961 | |
| 1962 | bts->nokia.bts_reset_timer_cnf = atoi(argv[0]); |
| 1963 | |
| 1964 | return CMD_SUCCESS; |
| 1965 | } |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1966 | #define OML_STR "Organization & Maintenance Link\n" |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1967 | #define IPA_STR "A-bis/IP Specific Options\n" |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1968 | |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1969 | DEFUN(cfg_bts_stream_id, |
| 1970 | cfg_bts_stream_id_cmd, |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 1971 | "oml ip.access stream_id <0-255> line E1_LINE", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1972 | OML_STR IPA_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1973 | "Set the ip.access Stream ID of the OML link of this BTS\n" |
| 1974 | "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] | 1975 | { |
| 1976 | struct gsm_bts *bts = vty->index; |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 1977 | int stream_id = atoi(argv[0]), linenr = atoi(argv[1]); |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1978 | |
| 1979 | if (!is_ipaccess_bts(bts)) { |
| 1980 | vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE); |
| 1981 | return CMD_WARNING; |
| 1982 | } |
| 1983 | |
| 1984 | bts->oml_tei = stream_id; |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 1985 | /* This is used by e1inp_bind_ops callback for each BTS model. */ |
| 1986 | bts->oml_e1_link.e1_nr = linenr; |
| 1987 | |
| 1988 | return CMD_SUCCESS; |
| 1989 | } |
| 1990 | |
Harald Welte | d13e0cd | 2012-08-17 09:52:03 +0200 | [diff] [blame] | 1991 | #define OML_E1_STR OML_STR "OML E1/T1 Configuration\n" |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1992 | |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1993 | DEFUN(cfg_bts_oml_e1, |
| 1994 | cfg_bts_oml_e1_cmd, |
| 1995 | "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] | 1996 | OML_E1_STR |
| 1997 | "E1/T1 line number to be used for OML\n" |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1998 | "E1/T1 line number to be used for OML\n" |
| 1999 | "E1/T1 timeslot to be used for OML\n" |
| 2000 | "E1/T1 timeslot to be used for OML\n" |
| 2001 | "E1/T1 sub-slot to be used for OML\n" |
| 2002 | "Use E1/T1 sub-slot 0\n" |
| 2003 | "Use E1/T1 sub-slot 1\n" |
| 2004 | "Use E1/T1 sub-slot 2\n" |
| 2005 | "Use E1/T1 sub-slot 3\n" |
| 2006 | "Use full E1 slot 3\n" |
| 2007 | ) |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2008 | { |
| 2009 | struct gsm_bts *bts = vty->index; |
| 2010 | |
| 2011 | parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]); |
| 2012 | |
| 2013 | return CMD_SUCCESS; |
| 2014 | } |
| 2015 | |
| 2016 | |
| 2017 | DEFUN(cfg_bts_oml_e1_tei, |
| 2018 | cfg_bts_oml_e1_tei_cmd, |
| 2019 | "oml e1 tei <0-63>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2020 | OML_E1_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2021 | "Set the TEI to be used for OML\n" |
| 2022 | "TEI Number\n") |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2023 | { |
| 2024 | struct gsm_bts *bts = vty->index; |
| 2025 | |
| 2026 | bts->oml_tei = atoi(argv[0]); |
| 2027 | |
| 2028 | return CMD_SUCCESS; |
| 2029 | } |
| 2030 | |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 2031 | DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd, |
| 2032 | "channel allocator (ascending|descending)", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2033 | "Channnel Allocator\n" "Channel Allocator\n" |
| 2034 | "Allocate Timeslots and Transceivers in ascending order\n" |
| 2035 | "Allocate Timeslots and Transceivers in descending order\n") |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 2036 | { |
| 2037 | struct gsm_bts *bts = vty->index; |
| 2038 | |
| 2039 | if (!strcmp(argv[0], "ascending")) |
| 2040 | bts->chan_alloc_reverse = 0; |
| 2041 | else |
| 2042 | bts->chan_alloc_reverse = 1; |
| 2043 | |
| 2044 | return CMD_SUCCESS; |
| 2045 | } |
| 2046 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2047 | #define RACH_STR "Random Access Control Channel\n" |
| 2048 | |
Sylvain Munaut | 4010f1e | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 2049 | DEFUN(cfg_bts_rach_tx_integer, |
| 2050 | cfg_bts_rach_tx_integer_cmd, |
| 2051 | "rach tx integer <0-15>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2052 | RACH_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2053 | "Set the raw tx integer value in RACH Control parameters IE\n" |
| 2054 | "Set the raw tx integer value in RACH Control parameters IE\n" |
| 2055 | "Raw tx integer value in RACH Control parameters IE\n") |
Sylvain Munaut | 4010f1e | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 2056 | { |
| 2057 | struct gsm_bts *bts = vty->index; |
| 2058 | bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf; |
| 2059 | return CMD_SUCCESS; |
| 2060 | } |
| 2061 | |
| 2062 | DEFUN(cfg_bts_rach_max_trans, |
| 2063 | cfg_bts_rach_max_trans_cmd, |
| 2064 | "rach max transmission (1|2|4|7)", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2065 | RACH_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2066 | "Set the maximum number of RACH burst transmissions\n" |
| 2067 | "Set the maximum number of RACH burst transmissions\n" |
Harald Welte | d13e0cd | 2012-08-17 09:52:03 +0200 | [diff] [blame] | 2068 | "Maximum number of 1 RACH burst transmissions\n" |
| 2069 | "Maximum number of 2 RACH burst transmissions\n" |
| 2070 | "Maximum number of 4 RACH burst transmissions\n" |
| 2071 | "Maximum number of 7 RACH burst transmissions\n") |
Sylvain Munaut | 4010f1e | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 2072 | { |
| 2073 | struct gsm_bts *bts = vty->index; |
| 2074 | bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0])); |
| 2075 | return CMD_SUCCESS; |
| 2076 | } |
| 2077 | |
Andreas Eversberg | 2ee7ecd | 2012-10-13 07:27:47 +0200 | [diff] [blame] | 2078 | #define CD_STR "Channel Description\n" |
| 2079 | |
| 2080 | DEFUN(cfg_bts_chan_desc_att, |
| 2081 | cfg_bts_chan_desc_att_cmd, |
| 2082 | "channel-descrption attach (0|1)", |
| 2083 | CD_STR |
| 2084 | "Set if attachment is required\n" |
| 2085 | "Attachment is NOT required\n" |
| 2086 | "Attachment is required (standard)\n") |
| 2087 | { |
| 2088 | struct gsm_bts *bts = vty->index; |
| 2089 | bts->si_common.chan_desc.att = atoi(argv[0]); |
| 2090 | return CMD_SUCCESS; |
| 2091 | } |
| 2092 | |
| 2093 | DEFUN(cfg_bts_chan_desc_bs_pa_mfrms, |
| 2094 | cfg_bts_chan_desc_bs_pa_mfrms_cmd, |
| 2095 | "channel-descrption bs-pa-mfrms <2-9>", |
| 2096 | CD_STR |
| 2097 | "Set number of multiframe periods for paging groups\n" |
| 2098 | "Number of multiframe periods for paging groups\n") |
| 2099 | { |
| 2100 | struct gsm_bts *bts = vty->index; |
| 2101 | int bs_pa_mfrms = atoi(argv[0]); |
| 2102 | |
| 2103 | bts->si_common.chan_desc.bs_pa_mfrms = bs_pa_mfrms - 2; |
| 2104 | return CMD_SUCCESS; |
| 2105 | } |
| 2106 | |
| 2107 | DEFUN(cfg_bts_chan_desc_bs_ag_blks_res, |
| 2108 | cfg_bts_chan_desc_bs_ag_blks_res_cmd, |
| 2109 | "channel-descrption bs-ag-blks-res <0-7>", |
| 2110 | CD_STR |
| 2111 | "Set number of blocks reserved for access grant\n" |
| 2112 | "Number of blocks reserved for access grant\n") |
| 2113 | { |
| 2114 | struct gsm_bts *bts = vty->index; |
| 2115 | int bs_ag_blks_res = atoi(argv[0]); |
| 2116 | |
| 2117 | bts->si_common.chan_desc.bs_ag_blks_res = bs_ag_blks_res; |
| 2118 | return CMD_SUCCESS; |
| 2119 | } |
| 2120 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2121 | #define NM_STR "Network Management\n" |
| 2122 | |
Holger Hans Peter Freyther | 95c2290 | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 2123 | DEFUN(cfg_bts_rach_nm_b_thresh, |
| 2124 | cfg_bts_rach_nm_b_thresh_cmd, |
| 2125 | "rach nm busy threshold <0-255>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2126 | RACH_STR NM_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2127 | "Set the NM Busy Threshold\n" |
| 2128 | "Set the NM Busy Threshold\n" |
| 2129 | "NM Busy Threshold in dB") |
Holger Hans Peter Freyther | 95c2290 | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 2130 | { |
| 2131 | struct gsm_bts *bts = vty->index; |
| 2132 | bts->rach_b_thresh = atoi(argv[0]); |
| 2133 | return CMD_SUCCESS; |
| 2134 | } |
| 2135 | |
| 2136 | DEFUN(cfg_bts_rach_nm_ldavg, |
| 2137 | cfg_bts_rach_nm_ldavg_cmd, |
| 2138 | "rach nm load average <0-65535>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2139 | RACH_STR NM_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2140 | "Set the NM Loadaverage Slots value\n" |
| 2141 | "Set the NM Loadaverage Slots value\n" |
| 2142 | "NM Loadaverage Slots value\n") |
Holger Hans Peter Freyther | 95c2290 | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 2143 | { |
| 2144 | struct gsm_bts *bts = vty->index; |
| 2145 | bts->rach_ldavg_slots = atoi(argv[0]); |
| 2146 | return CMD_SUCCESS; |
| 2147 | } |
| 2148 | |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 2149 | DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd, |
| 2150 | "cell barred (0|1)", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2151 | "Should this cell be barred from access?\n" |
| 2152 | "Should this cell be barred from access?\n" |
| 2153 | "Cell should NOT be barred\n" |
| 2154 | "Cell should be barred\n") |
| 2155 | |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 2156 | { |
| 2157 | struct gsm_bts *bts = vty->index; |
| 2158 | |
Harald Welte | 7135501 | 2009-12-21 23:08:18 +0100 | [diff] [blame] | 2159 | bts->si_common.rach_control.cell_bar = atoi(argv[0]); |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 2160 | |
| 2161 | return CMD_SUCCESS; |
| 2162 | } |
| 2163 | |
Holger Hans Peter Freyther | 3a0a463 | 2010-05-14 00:39:19 +0800 | [diff] [blame] | 2164 | DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd, |
| 2165 | "rach emergency call allowed (0|1)", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2166 | RACH_STR |
| 2167 | "Should this cell allow emergency calls?\n" |
| 2168 | "Should this cell allow emergency calls?\n" |
| 2169 | "Should this cell allow emergency calls?\n" |
| 2170 | "Do NOT allow emergency calls\n" |
| 2171 | "Allow emergency calls\n") |
Holger Hans Peter Freyther | 3a0a463 | 2010-05-14 00:39:19 +0800 | [diff] [blame] | 2172 | { |
| 2173 | struct gsm_bts *bts = vty->index; |
| 2174 | |
| 2175 | if (atoi(argv[0]) == 0) |
| 2176 | bts->si_common.rach_control.t2 |= 0x4; |
| 2177 | else |
| 2178 | bts->si_common.rach_control.t2 &= ~0x4; |
| 2179 | |
| 2180 | return CMD_SUCCESS; |
| 2181 | } |
| 2182 | |
Ivan Kluchnikov | 6792059 | 2013-09-16 13:13:04 +0400 | [diff] [blame] | 2183 | DEFUN(cfg_bts_rach_ac_class, cfg_bts_rach_ac_class_cmd, |
| 2184 | "rach access-control-class (0|1|2|3|4|5|6|7|8|9|11|12|13|14|15) (barred|allowed)", |
| 2185 | RACH_STR |
| 2186 | "Set access control class\n" |
| 2187 | "Access control class 0\n" |
| 2188 | "Access control class 1\n" |
| 2189 | "Access control class 2\n" |
| 2190 | "Access control class 3\n" |
| 2191 | "Access control class 4\n" |
| 2192 | "Access control class 5\n" |
| 2193 | "Access control class 6\n" |
| 2194 | "Access control class 7\n" |
| 2195 | "Access control class 8\n" |
| 2196 | "Access control class 9\n" |
| 2197 | "Access control class 11 for PLMN use\n" |
| 2198 | "Access control class 12 for security services\n" |
| 2199 | "Access control class 13 for public utilities (e.g. water/gas suppliers)\n" |
| 2200 | "Access control class 14 for emergency services\n" |
| 2201 | "Access control class 15 for PLMN staff\n" |
| 2202 | "barred to use access control class\n" |
| 2203 | "allowed to use access control class\n") |
| 2204 | { |
| 2205 | struct gsm_bts *bts = vty->index; |
| 2206 | |
| 2207 | uint8_t control_class; |
| 2208 | uint8_t allowed = 0; |
| 2209 | |
| 2210 | if (strcmp(argv[1], "allowed") == 0) |
| 2211 | allowed = 1; |
| 2212 | |
| 2213 | control_class = atoi(argv[0]); |
| 2214 | if (control_class < 8) |
| 2215 | if (allowed) |
| 2216 | bts->si_common.rach_control.t3 &= ~(0x1 << control_class); |
| 2217 | else |
| 2218 | bts->si_common.rach_control.t3 |= (0x1 << control_class); |
| 2219 | else |
| 2220 | if (allowed) |
| 2221 | bts->si_common.rach_control.t2 &= ~(0x1 << (control_class - 8)); |
| 2222 | else |
| 2223 | bts->si_common.rach_control.t2 |= (0x1 << (control_class - 8)); |
| 2224 | |
| 2225 | return CMD_SUCCESS; |
| 2226 | } |
| 2227 | |
Harald Welte (local) | 0e451d0 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 2228 | DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd, |
| 2229 | "ms max power <0-40>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2230 | "MS Options\n" |
Harald Welte | d13e0cd | 2012-08-17 09:52:03 +0200 | [diff] [blame] | 2231 | "Maximum transmit power of the MS\n" |
| 2232 | "Maximum transmit power of the MS\n" |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2233 | "Maximum transmit power of the MS in dBm") |
Harald Welte (local) | 0e451d0 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 2234 | { |
| 2235 | struct gsm_bts *bts = vty->index; |
| 2236 | |
| 2237 | bts->ms_max_power = atoi(argv[0]); |
| 2238 | |
| 2239 | return CMD_SUCCESS; |
| 2240 | } |
| 2241 | |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2242 | #define CELL_STR "Cell Parameters\n" |
| 2243 | |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 2244 | DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd, |
| 2245 | "cell reselection hysteresis <0-14>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2246 | CELL_STR "Cell re-selection parameters\n" |
| 2247 | "Cell Re-Selection Hysteresis in dB\n" |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 2248 | "Cell Re-Selection Hysteresis in dB") |
| 2249 | { |
| 2250 | struct gsm_bts *bts = vty->index; |
| 2251 | |
| 2252 | bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2; |
| 2253 | |
| 2254 | return CMD_SUCCESS; |
| 2255 | } |
| 2256 | |
| 2257 | DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd, |
| 2258 | "rxlev access min <0-63>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2259 | "Minimum RxLev needed for cell access\n" |
| 2260 | "Minimum RxLev needed for cell access\n" |
| 2261 | "Minimum RxLev needed for cell access\n" |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 2262 | "Minimum RxLev needed for cell access (better than -110dBm)") |
| 2263 | { |
| 2264 | struct gsm_bts *bts = vty->index; |
| 2265 | |
| 2266 | bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]); |
| 2267 | |
| 2268 | return CMD_SUCCESS; |
| 2269 | } |
| 2270 | |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2271 | DEFUN(cfg_bts_cell_bar_qualify, cfg_bts_cell_bar_qualify_cmd, |
| 2272 | "cell bar qualify (0|1)", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2273 | CELL_STR "Cell Bar Qualify\n" "Cell Bar Qualify\n" |
| 2274 | "Set CBQ to 0\n" "Set CBQ to 1\n") |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2275 | { |
| 2276 | struct gsm_bts *bts = vty->index; |
| 2277 | |
| 2278 | bts->si_common.cell_ro_sel_par.present = 1; |
| 2279 | bts->si_common.cell_ro_sel_par.cbq = atoi(argv[0]); |
| 2280 | |
| 2281 | return CMD_SUCCESS; |
| 2282 | } |
| 2283 | |
| 2284 | DEFUN(cfg_bts_cell_resel_ofs, cfg_bts_cell_resel_ofs_cmd, |
| 2285 | "cell reselection offset <0-126>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2286 | CELL_STR "Cell Re-Selection Parameters\n" |
| 2287 | "Cell Re-Selection Offset (CRO) in dB\n" |
| 2288 | "Cell Re-Selection Offset (CRO) in dB\n" |
| 2289 | ) |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2290 | { |
| 2291 | struct gsm_bts *bts = vty->index; |
| 2292 | |
| 2293 | bts->si_common.cell_ro_sel_par.present = 1; |
| 2294 | bts->si_common.cell_ro_sel_par.cell_resel_off = atoi(argv[0])/2; |
| 2295 | |
| 2296 | return CMD_SUCCESS; |
| 2297 | } |
| 2298 | |
| 2299 | DEFUN(cfg_bts_temp_ofs, cfg_bts_temp_ofs_cmd, |
| 2300 | "temporary offset <0-60>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2301 | "Cell selection temporary negative offset\n" |
| 2302 | "Cell selection temporary negative offset\n" |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2303 | "Cell selection temporary negative offset in dB") |
| 2304 | { |
| 2305 | struct gsm_bts *bts = vty->index; |
| 2306 | |
| 2307 | bts->si_common.cell_ro_sel_par.present = 1; |
| 2308 | bts->si_common.cell_ro_sel_par.temp_offs = atoi(argv[0])/10; |
| 2309 | |
| 2310 | return CMD_SUCCESS; |
| 2311 | } |
| 2312 | |
| 2313 | DEFUN(cfg_bts_temp_ofs_inf, cfg_bts_temp_ofs_inf_cmd, |
| 2314 | "temporary offset infinite", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2315 | "Cell selection temporary negative offset\n" |
| 2316 | "Cell selection temporary negative offset\n" |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2317 | "Sets cell selection temporary negative offset to infinity") |
| 2318 | { |
| 2319 | struct gsm_bts *bts = vty->index; |
| 2320 | |
| 2321 | bts->si_common.cell_ro_sel_par.present = 1; |
| 2322 | bts->si_common.cell_ro_sel_par.temp_offs = 7; |
| 2323 | |
| 2324 | return CMD_SUCCESS; |
| 2325 | } |
| 2326 | |
| 2327 | DEFUN(cfg_bts_penalty_time, cfg_bts_penalty_time_cmd, |
| 2328 | "penalty time <20-620>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2329 | "Cell selection penalty time\n" |
| 2330 | "Cell selection penalty time\n" |
| 2331 | "Cell selection penalty time in seconds (by 20s increments)\n") |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2332 | { |
| 2333 | struct gsm_bts *bts = vty->index; |
| 2334 | |
| 2335 | bts->si_common.cell_ro_sel_par.present = 1; |
| 2336 | bts->si_common.cell_ro_sel_par.penalty_time = (atoi(argv[0])-20)/20; |
| 2337 | |
| 2338 | return CMD_SUCCESS; |
| 2339 | } |
| 2340 | |
| 2341 | DEFUN(cfg_bts_penalty_time_rsvd, cfg_bts_penalty_time_rsvd_cmd, |
| 2342 | "penalty time reserved", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2343 | "Cell selection penalty time\n" |
| 2344 | "Cell selection penalty time\n" |
| 2345 | "Set cell selection penalty time to reserved value 31, " |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2346 | "(indicate that CELL_RESELECT_OFFSET is subtracted from C2 " |
| 2347 | "and TEMPORARY_OFFSET is ignored)") |
| 2348 | { |
| 2349 | struct gsm_bts *bts = vty->index; |
| 2350 | |
| 2351 | bts->si_common.cell_ro_sel_par.present = 1; |
| 2352 | bts->si_common.cell_ro_sel_par.penalty_time = 31; |
| 2353 | |
| 2354 | return CMD_SUCCESS; |
| 2355 | } |
| 2356 | |
Andreas Eversberg | 4d4944a | 2013-03-10 11:49:35 +0100 | [diff] [blame] | 2357 | DEFUN(cfg_bts_radio_link_timeout, cfg_bts_radio_link_timeout_cmd, |
| 2358 | "radio-link-timeout <4-64>", |
| 2359 | "Radio link timeout criterion (BTS side)\n" |
| 2360 | "Radio link timeout value (lost SACCH block)\n") |
| 2361 | { |
| 2362 | struct gsm_bts *bts = vty->index; |
| 2363 | |
Harald Welte | 2f8b9d2 | 2017-06-18 11:12:13 +0300 | [diff] [blame] | 2364 | gsm_bts_set_radio_link_timeout(bts, atoi(argv[0])); |
| 2365 | |
| 2366 | return CMD_SUCCESS; |
| 2367 | } |
| 2368 | |
| 2369 | DEFUN(cfg_bts_radio_link_timeout_inf, cfg_bts_radio_link_timeout_inf_cmd, |
| 2370 | "radio-link-timeout infinite", |
| 2371 | "Radio link timeout criterion (BTS side)\n" |
| 2372 | "Infinite Radio link timeout value (use only for BTS RF testing)\n") |
| 2373 | { |
| 2374 | struct gsm_bts *bts = vty->index; |
| 2375 | |
| 2376 | if (bts->type != GSM_BTS_TYPE_OSMOBTS) { |
| 2377 | vty_out(vty, "%% infinite radio link timeout not supported by this BTS%s", VTY_NEWLINE); |
| 2378 | return CMD_WARNING; |
| 2379 | } |
| 2380 | |
| 2381 | vty_out(vty, "%% INFINITE RADIO LINK TIMEOUT, USE ONLY FOR BTS RF TESTING%s", VTY_NEWLINE); |
| 2382 | gsm_bts_set_radio_link_timeout(bts, -1); |
Andreas Eversberg | 4d4944a | 2013-03-10 11:49:35 +0100 | [diff] [blame] | 2383 | |
Holger Hans Peter Freyther | c63f6f1 | 2013-07-27 21:07:57 +0200 | [diff] [blame] | 2384 | return CMD_SUCCESS; |
| 2385 | } |
| 2386 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2387 | #define GPRS_TEXT "GPRS Packet Network\n" |
| 2388 | |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2389 | DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd, |
Harald Welte | 57ba7e3 | 2010-04-18 14:00:26 +0200 | [diff] [blame] | 2390 | "gprs cell bvci <2-65535>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2391 | GPRS_TEXT |
| 2392 | "GPRS Cell Settings\n" |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2393 | "GPRS BSSGP VC Identifier\n" |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2394 | "GPRS BSSGP VC Identifier") |
| 2395 | { |
| 2396 | struct gsm_bts *bts = vty->index; |
| 2397 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2398 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | 9403670 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2399 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2400 | return CMD_WARNING; |
| 2401 | } |
| 2402 | |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2403 | bts->gprs.cell.bvci = atoi(argv[0]); |
| 2404 | |
| 2405 | return CMD_SUCCESS; |
| 2406 | } |
| 2407 | |
Harald Welte | a5731cf | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 2408 | DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd, |
| 2409 | "gprs nsei <0-65535>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2410 | GPRS_TEXT |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2411 | "GPRS NS Entity Identifier\n" |
Harald Welte | a5731cf | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 2412 | "GPRS NS Entity Identifier") |
| 2413 | { |
| 2414 | struct gsm_bts *bts = vty->index; |
| 2415 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2416 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | a5731cf | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 2417 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2418 | return CMD_WARNING; |
| 2419 | } |
| 2420 | |
| 2421 | bts->gprs.nse.nsei = atoi(argv[0]); |
| 2422 | |
| 2423 | return CMD_SUCCESS; |
| 2424 | } |
| 2425 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2426 | #define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \ |
| 2427 | "NSVC Logical Number\n" |
Harald Welte | a5731cf | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 2428 | |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2429 | DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd, |
| 2430 | "gprs nsvc <0-1> nsvci <0-65535>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2431 | GPRS_TEXT NSVC_TEXT |
| 2432 | "NS Virtual Connection Identifier\n" |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2433 | "GPRS NS VC Identifier") |
| 2434 | { |
| 2435 | struct gsm_bts *bts = vty->index; |
| 2436 | int idx = atoi(argv[0]); |
| 2437 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2438 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | 9403670 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2439 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2440 | return CMD_WARNING; |
| 2441 | } |
| 2442 | |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2443 | bts->gprs.nsvc[idx].nsvci = atoi(argv[1]); |
| 2444 | |
| 2445 | return CMD_SUCCESS; |
| 2446 | } |
| 2447 | |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2448 | DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd, |
| 2449 | "gprs nsvc <0-1> local udp port <0-65535>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2450 | GPRS_TEXT NSVC_TEXT |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2451 | "GPRS NS Local UDP Port\n" |
| 2452 | "GPRS NS Local UDP Port\n" |
| 2453 | "GPRS NS Local UDP Port\n" |
Harald Welte | 13fe219 | 2012-08-17 09:57:25 +0200 | [diff] [blame] | 2454 | "GPRS NS Local UDP Port Number\n") |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2455 | { |
| 2456 | struct gsm_bts *bts = vty->index; |
| 2457 | int idx = atoi(argv[0]); |
| 2458 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2459 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | 9403670 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2460 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2461 | return CMD_WARNING; |
| 2462 | } |
| 2463 | |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2464 | bts->gprs.nsvc[idx].local_port = atoi(argv[1]); |
| 2465 | |
| 2466 | return CMD_SUCCESS; |
| 2467 | } |
| 2468 | |
| 2469 | DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd, |
| 2470 | "gprs nsvc <0-1> remote udp port <0-65535>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2471 | GPRS_TEXT NSVC_TEXT |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2472 | "GPRS NS Remote UDP Port\n" |
| 2473 | "GPRS NS Remote UDP Port\n" |
Harald Welte | 13fe219 | 2012-08-17 09:57:25 +0200 | [diff] [blame] | 2474 | "GPRS NS Remote UDP Port\n" |
| 2475 | "GPRS NS Remote UDP Port Number\n") |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2476 | { |
| 2477 | struct gsm_bts *bts = vty->index; |
| 2478 | int idx = atoi(argv[0]); |
| 2479 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2480 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | 9403670 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2481 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2482 | return CMD_WARNING; |
| 2483 | } |
| 2484 | |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2485 | bts->gprs.nsvc[idx].remote_port = atoi(argv[1]); |
| 2486 | |
| 2487 | return CMD_SUCCESS; |
| 2488 | } |
| 2489 | |
| 2490 | DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd, |
| 2491 | "gprs nsvc <0-1> remote ip A.B.C.D", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2492 | GPRS_TEXT NSVC_TEXT |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2493 | "GPRS NS Remote IP Address\n" |
| 2494 | "GPRS NS Remote IP Address\n" |
| 2495 | "GPRS NS Remote IP Address\n") |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2496 | { |
| 2497 | struct gsm_bts *bts = vty->index; |
| 2498 | int idx = atoi(argv[0]); |
| 2499 | struct in_addr ia; |
| 2500 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2501 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | 9403670 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2502 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2503 | return CMD_WARNING; |
| 2504 | } |
| 2505 | |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2506 | inet_aton(argv[1], &ia); |
| 2507 | bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr); |
| 2508 | |
| 2509 | return CMD_SUCCESS; |
| 2510 | } |
| 2511 | |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 2512 | DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd, |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2513 | "paging free <-1-1024>", |
| 2514 | "Paging options\n" |
| 2515 | "Only page when having a certain amount of free slots\n" |
| 2516 | "amount of required free paging slots. -1 to disable\n") |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 2517 | { |
| 2518 | struct gsm_bts *bts = vty->index; |
| 2519 | |
| 2520 | bts->paging.free_chans_need = atoi(argv[0]); |
| 2521 | return CMD_SUCCESS; |
| 2522 | } |
| 2523 | |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 2524 | DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd, |
| 2525 | "gprs ns timer " NS_TIMERS " <0-255>", |
| 2526 | GPRS_TEXT "Network Service\n" |
| 2527 | "Network Service Timer\n" |
| 2528 | NS_TIMERS_HELP "Timer Value\n") |
| 2529 | { |
| 2530 | struct gsm_bts *bts = vty->index; |
| 2531 | int idx = get_string_value(gprs_ns_timer_strs, argv[0]); |
| 2532 | int val = atoi(argv[1]); |
| 2533 | |
| 2534 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
| 2535 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2536 | return CMD_WARNING; |
| 2537 | } |
| 2538 | |
| 2539 | if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer)) |
| 2540 | return CMD_WARNING; |
| 2541 | |
| 2542 | bts->gprs.nse.timer[idx] = val; |
| 2543 | |
| 2544 | return CMD_SUCCESS; |
| 2545 | } |
| 2546 | |
| 2547 | #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] | 2548 | #define BSSGP_TIMERS_HELP \ |
| 2549 | "Tbvc-block timeout\n" \ |
| 2550 | "Tbvc-block retries\n" \ |
| 2551 | "Tbvc-unblock retries\n" \ |
| 2552 | "Tbvcc-reset timeout\n" \ |
| 2553 | "Tbvc-reset retries\n" \ |
| 2554 | "Tbvc-suspend timeout\n" \ |
| 2555 | "Tbvc-suspend retries\n" \ |
| 2556 | "Tbvc-resume timeout\n" \ |
| 2557 | "Tbvc-resume retries\n" \ |
| 2558 | "Tbvc-capa-update timeout\n" \ |
| 2559 | "Tbvc-capa-update retries\n" |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 2560 | |
| 2561 | DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd, |
| 2562 | "gprs cell timer " BSSGP_TIMERS " <0-255>", |
| 2563 | GPRS_TEXT "Cell / BSSGP\n" |
| 2564 | "Cell/BSSGP Timer\n" |
| 2565 | BSSGP_TIMERS_HELP "Timer Value\n") |
| 2566 | { |
| 2567 | struct gsm_bts *bts = vty->index; |
| 2568 | int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]); |
| 2569 | int val = atoi(argv[1]); |
| 2570 | |
| 2571 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
| 2572 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2573 | return CMD_WARNING; |
| 2574 | } |
| 2575 | |
| 2576 | if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer)) |
| 2577 | return CMD_WARNING; |
| 2578 | |
| 2579 | bts->gprs.cell.timer[idx] = val; |
| 2580 | |
| 2581 | return CMD_SUCCESS; |
| 2582 | } |
| 2583 | |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2584 | DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd, |
| 2585 | "gprs routing area <0-255>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2586 | GPRS_TEXT |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2587 | "GPRS Routing Area Code\n" |
| 2588 | "GPRS Routing Area Code\n" |
| 2589 | "GPRS Routing Area Code\n") |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2590 | { |
| 2591 | struct gsm_bts *bts = vty->index; |
| 2592 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2593 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | 9403670 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2594 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2595 | return CMD_WARNING; |
| 2596 | } |
| 2597 | |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2598 | bts->gprs.rac = atoi(argv[0]); |
| 2599 | |
| 2600 | return CMD_SUCCESS; |
| 2601 | } |
| 2602 | |
Max | 292ec58 | 2016-07-28 11:55:37 +0200 | [diff] [blame] | 2603 | DEFUN(cfg_bts_gprs_ctrl_ack, cfg_bts_gprs_ctrl_ack_cmd, |
| 2604 | "gprs control-ack-type-rach", GPRS_TEXT |
| 2605 | "Set GPRS Control Ack Type for PACKET CONTROL ACKNOWLEDGMENT message to " |
| 2606 | "four access bursts format instead of default RLC/MAC control block\n") |
| 2607 | { |
| 2608 | struct gsm_bts *bts = vty->index; |
| 2609 | |
| 2610 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
| 2611 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2612 | return CMD_WARNING; |
| 2613 | } |
| 2614 | |
| 2615 | bts->gprs.ctrl_ack_type_use_block = false; |
| 2616 | |
| 2617 | return CMD_SUCCESS; |
| 2618 | } |
| 2619 | |
| 2620 | DEFUN(cfg_no_bts_gprs_ctrl_ack, cfg_no_bts_gprs_ctrl_ack_cmd, |
| 2621 | "no gprs control-ack-type-rach", NO_STR GPRS_TEXT |
| 2622 | "Set GPRS Control Ack Type for PACKET CONTROL ACKNOWLEDGMENT message to " |
| 2623 | "four access bursts format instead of default RLC/MAC control block\n") |
| 2624 | { |
| 2625 | struct gsm_bts *bts = vty->index; |
| 2626 | |
| 2627 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
| 2628 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2629 | return CMD_WARNING; |
| 2630 | } |
| 2631 | |
| 2632 | bts->gprs.ctrl_ack_type_use_block = true; |
| 2633 | |
| 2634 | return CMD_SUCCESS; |
| 2635 | } |
| 2636 | |
Andreas Eversberg | 0c8f9ca | 2013-03-16 16:31:26 +0100 | [diff] [blame] | 2637 | DEFUN(cfg_bts_gprs_net_ctrl_ord, cfg_bts_gprs_net_ctrl_ord_cmd, |
| 2638 | "gprs network-control-order (nc0|nc1|nc2)", |
| 2639 | GPRS_TEXT |
| 2640 | "GPRS Network Control Order\n" |
| 2641 | "MS controlled cell re-selection, no measurement reporting\n" |
| 2642 | "MS controlled cell re-selection, MS sends measurement reports\n" |
| 2643 | "Network controlled cell re-selection, MS sends measurement reports\n") |
| 2644 | { |
| 2645 | struct gsm_bts *bts = vty->index; |
| 2646 | |
| 2647 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
| 2648 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2649 | return CMD_WARNING; |
| 2650 | } |
| 2651 | |
| 2652 | bts->gprs.net_ctrl_ord = atoi(argv[0] + 2); |
| 2653 | |
| 2654 | return CMD_SUCCESS; |
| 2655 | } |
| 2656 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2657 | DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd, |
| 2658 | "gprs mode (none|gprs|egprs)", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2659 | GPRS_TEXT |
| 2660 | "GPRS Mode for this BTS\n" |
| 2661 | "GPRS Disabled on this BTS\n" |
| 2662 | "GPRS Enabled on this BTS\n" |
| 2663 | "EGPRS (EDGE) Enabled on this BTS\n") |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2664 | { |
| 2665 | struct gsm_bts *bts = vty->index; |
Holger Hans Peter Freyther | 4e13a8f | 2015-01-31 22:16:00 +0100 | [diff] [blame] | 2666 | enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0], NULL); |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2667 | |
Holger Hans Peter Freyther | 4e13a8f | 2015-01-31 22:16:00 +0100 | [diff] [blame] | 2668 | if (!bts_gprs_mode_is_compat(bts, mode)) { |
Harald Welte | f3d8e92 | 2010-06-14 22:44:42 +0200 | [diff] [blame] | 2669 | vty_out(vty, "This BTS type does not support %s%s", argv[0], |
| 2670 | VTY_NEWLINE); |
| 2671 | return CMD_WARNING; |
| 2672 | } |
| 2673 | |
| 2674 | bts->gprs.mode = mode; |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2675 | |
| 2676 | return CMD_SUCCESS; |
| 2677 | } |
| 2678 | |
bhargava | 350533c | 2016-07-21 11:14:34 +0530 | [diff] [blame] | 2679 | DEFUN(cfg_bts_gprs_11bit_rach_support_for_egprs, |
| 2680 | cfg_bts_gprs_11bit_rach_support_for_egprs_cmd, |
| 2681 | "gprs 11bit_rach_support_for_egprs (0|1)", |
| 2682 | GPRS_TEXT "11 bit RACH options\n" |
| 2683 | "Disable 11 bit RACH for EGPRS\n" |
| 2684 | "Enable 11 bit RACH for EGPRS") |
| 2685 | { |
| 2686 | struct gsm_bts *bts = vty->index; |
| 2687 | |
| 2688 | bts->gprs.supports_egprs_11bit_rach = atoi(argv[0]); |
| 2689 | |
| 2690 | if (bts->gprs.supports_egprs_11bit_rach > 1) { |
| 2691 | vty_out(vty, "Error in RACH type%s", VTY_NEWLINE); |
| 2692 | return CMD_WARNING; |
| 2693 | } |
| 2694 | |
| 2695 | if ((bts->gprs.mode == BTS_GPRS_NONE) && |
| 2696 | (bts->gprs.supports_egprs_11bit_rach == 1)) { |
| 2697 | vty_out(vty, "Error:gprs mode is none and 11bit rach is" |
| 2698 | " enabled%s", VTY_NEWLINE); |
| 2699 | return CMD_WARNING; |
| 2700 | } |
| 2701 | |
| 2702 | return CMD_SUCCESS; |
| 2703 | } |
| 2704 | |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 2705 | #define SI_TEXT "System Information Messages\n" |
| 2706 | #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)" |
| 2707 | #define SI_TYPE_HELP "System Information Type 1\n" \ |
| 2708 | "System Information Type 2\n" \ |
| 2709 | "System Information Type 3\n" \ |
| 2710 | "System Information Type 4\n" \ |
| 2711 | "System Information Type 5\n" \ |
| 2712 | "System Information Type 6\n" \ |
| 2713 | "System Information Type 7\n" \ |
| 2714 | "System Information Type 8\n" \ |
| 2715 | "System Information Type 9\n" \ |
| 2716 | "System Information Type 10\n" \ |
| 2717 | "System Information Type 13\n" \ |
| 2718 | "System Information Type 16\n" \ |
| 2719 | "System Information Type 17\n" \ |
| 2720 | "System Information Type 18\n" \ |
| 2721 | "System Information Type 19\n" \ |
| 2722 | "System Information Type 20\n" \ |
| 2723 | "System Information Type 2bis\n" \ |
| 2724 | "System Information Type 2ter\n" \ |
| 2725 | "System Information Type 2quater\n" \ |
| 2726 | "System Information Type 5bis\n" \ |
| 2727 | "System Information Type 5ter\n" |
| 2728 | |
| 2729 | DEFUN(cfg_bts_si_mode, cfg_bts_si_mode_cmd, |
| 2730 | "system-information " SI_TYPE_TEXT " mode (static|computed)", |
| 2731 | SI_TEXT SI_TYPE_HELP |
| 2732 | "System Information Mode\n" |
| 2733 | "Static user-specified\n" |
| 2734 | "Dynamic, BSC-computed\n") |
| 2735 | { |
| 2736 | struct gsm_bts *bts = vty->index; |
| 2737 | int type; |
| 2738 | |
| 2739 | type = get_string_value(osmo_sitype_strs, argv[0]); |
| 2740 | if (type < 0) { |
| 2741 | vty_out(vty, "Error SI Type%s", VTY_NEWLINE); |
| 2742 | return CMD_WARNING; |
| 2743 | } |
| 2744 | |
| 2745 | if (!strcmp(argv[1], "static")) |
| 2746 | bts->si_mode_static |= (1 << type); |
| 2747 | else |
| 2748 | bts->si_mode_static &= ~(1 << type); |
| 2749 | |
| 2750 | return CMD_SUCCESS; |
| 2751 | } |
| 2752 | |
| 2753 | DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd, |
| 2754 | "system-information " SI_TYPE_TEXT " static HEXSTRING", |
| 2755 | SI_TEXT SI_TYPE_HELP |
| 2756 | "Static System Information filling\n" |
| 2757 | "Static user-specified SI content in HEX notation\n") |
| 2758 | { |
| 2759 | struct gsm_bts *bts = vty->index; |
| 2760 | int rc, type; |
| 2761 | |
| 2762 | type = get_string_value(osmo_sitype_strs, argv[0]); |
| 2763 | if (type < 0) { |
| 2764 | vty_out(vty, "Error SI Type%s", VTY_NEWLINE); |
| 2765 | return CMD_WARNING; |
| 2766 | } |
| 2767 | |
| 2768 | if (!(bts->si_mode_static & (1 << type))) { |
| 2769 | vty_out(vty, "SI Type %s is not configured in static mode%s", |
| 2770 | get_value_string(osmo_sitype_strs, type), VTY_NEWLINE); |
| 2771 | return CMD_WARNING; |
| 2772 | } |
| 2773 | |
Harald Welte | 290aaed | 2010-07-30 11:53:18 +0200 | [diff] [blame] | 2774 | /* Fill buffer with padding pattern */ |
Max | 6f0e50c | 2017-04-12 15:30:54 +0200 | [diff] [blame] | 2775 | memset(GSM_BTS_SI(bts, type), 0x2b, GSM_MACBLOCK_LEN); |
Harald Welte | 290aaed | 2010-07-30 11:53:18 +0200 | [diff] [blame] | 2776 | |
| 2777 | /* Parse the user-specified SI in hex format, [partially] overwriting padding */ |
Max | 6f0e50c | 2017-04-12 15:30:54 +0200 | [diff] [blame] | 2778 | rc = osmo_hexparse(argv[1], GSM_BTS_SI(bts, type), GSM_MACBLOCK_LEN); |
| 2779 | if (rc < 0 || rc > GSM_MACBLOCK_LEN) { |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 2780 | vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE); |
| 2781 | return CMD_WARNING; |
| 2782 | } |
| 2783 | |
| 2784 | /* Mark this SI as present */ |
| 2785 | bts->si_valid |= (1 << type); |
| 2786 | |
| 2787 | return CMD_SUCCESS; |
| 2788 | } |
| 2789 | |
Harald Welte | 42def72 | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 2790 | DEFUN(cfg_bts_early_cm, cfg_bts_early_cm_cmd, |
| 2791 | "early-classmark-sending (allowed|forbidden)", |
| 2792 | "Early Classmark Sending\n" |
| 2793 | "Early Classmark Sending is allowed\n" |
| 2794 | "Early Classmark Sending is forbidden\n") |
| 2795 | { |
| 2796 | struct gsm_bts *bts = vty->index; |
Harald Welte | 42def72 | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 2797 | |
| 2798 | if (!strcmp(argv[0], "allowed")) |
| 2799 | bts->early_classmark_allowed = true; |
| 2800 | else |
| 2801 | bts->early_classmark_allowed = false; |
| 2802 | |
| 2803 | return CMD_SUCCESS; |
| 2804 | } |
| 2805 | |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2806 | DEFUN(cfg_bts_neigh_mode, cfg_bts_neigh_mode_cmd, |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2807 | "neighbor-list mode (automatic|manual|manual-si5)", |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2808 | "Neighbor List\n" "Mode of Neighbor List generation\n" |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2809 | "Automatically from all BTS in this OpenBSC\n" "Manual\n" |
| 2810 | "Manual with different lists for SI2 and SI5\n") |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2811 | { |
| 2812 | struct gsm_bts *bts = vty->index; |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2813 | int mode = get_string_value(bts_neigh_mode_strs, argv[0]); |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2814 | |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2815 | switch (mode) { |
| 2816 | case NL_MODE_MANUAL_SI5SEP: |
| 2817 | case NL_MODE_MANUAL: |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2818 | /* make sure we clear the current list when switching to |
| 2819 | * manual mode */ |
| 2820 | if (bts->neigh_list_manual_mode == 0) |
| 2821 | memset(&bts->si_common.data.neigh_list, 0, |
| 2822 | sizeof(bts->si_common.data.neigh_list)); |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2823 | break; |
| 2824 | default: |
| 2825 | break; |
| 2826 | } |
| 2827 | |
| 2828 | bts->neigh_list_manual_mode = mode; |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2829 | |
| 2830 | return CMD_SUCCESS; |
| 2831 | } |
| 2832 | |
| 2833 | DEFUN(cfg_bts_neigh, cfg_bts_neigh_cmd, |
Harald Welte | 1fe73a1 | 2012-01-29 13:24:12 +0100 | [diff] [blame] | 2834 | "neighbor-list (add|del) arfcn <0-1023>", |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2835 | "Neighbor List\n" "Add to manual neighbor list\n" |
| 2836 | "Delete from manual neighbor list\n" "ARFCN of neighbor\n" |
| 2837 | "ARFCN of neighbor\n") |
| 2838 | { |
| 2839 | struct gsm_bts *bts = vty->index; |
| 2840 | struct bitvec *bv = &bts->si_common.neigh_list; |
| 2841 | uint16_t arfcn = atoi(argv[1]); |
| 2842 | |
| 2843 | if (!bts->neigh_list_manual_mode) { |
| 2844 | vty_out(vty, "%% Cannot configure neighbor list in " |
| 2845 | "automatic mode%s", VTY_NEWLINE); |
| 2846 | return CMD_WARNING; |
| 2847 | } |
| 2848 | |
| 2849 | if (!strcmp(argv[0], "add")) |
| 2850 | bitvec_set_bit_pos(bv, arfcn, 1); |
| 2851 | else |
| 2852 | bitvec_set_bit_pos(bv, arfcn, 0); |
| 2853 | |
| 2854 | return CMD_SUCCESS; |
| 2855 | } |
| 2856 | |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 2857 | /* help text should be kept in sync with EARFCN_*_INVALID defines */ |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 2858 | DEFUN(cfg_bts_si2quater_neigh_add, cfg_bts_si2quater_neigh_add_cmd, |
Max | 2c16bee | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 2859 | "si2quater neighbor-list add earfcn <0-65535> thresh-hi <0-31> " |
| 2860 | "thresh-lo <0-32> prio <0-8> qrxlv <0-32> meas <0-8>", |
| 2861 | "SI2quater Neighbor List\n" "SI2quater Neighbor List\n" |
| 2862 | "Add to manual SI2quater neighbor list\n" |
| 2863 | "EARFCN of neighbor\n" "EARFCN of neighbor\n" |
| 2864 | "threshold high bits\n" "threshold high bits\n" |
| 2865 | "threshold low bits\n" "threshold low bits (32 means NA)\n" |
| 2866 | "priority\n" "priority (8 means NA)\n" |
| 2867 | "QRXLEVMIN\n" "QRXLEVMIN (32 means NA)\n" |
| 2868 | "measurement bandwidth\n" "measurement bandwidth (8 means NA)\n") |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 2869 | { |
| 2870 | struct gsm_bts *bts = vty->index; |
| 2871 | struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list; |
| 2872 | uint16_t arfcn = atoi(argv[0]); |
Max | 2c16bee | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 2873 | uint8_t thresh_hi = atoi(argv[1]), thresh_lo = atoi(argv[2]), |
| 2874 | prio = atoi(argv[3]), qrx = atoi(argv[4]), meas = atoi(argv[5]); |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 2875 | 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] | 2876 | |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 2877 | switch (r) { |
| 2878 | case 1: |
| 2879 | vty_out(vty, "Warning: multiple threshold-high are not supported, overriding with %u%s", |
| 2880 | thresh_hi, VTY_NEWLINE); |
| 2881 | break; |
| 2882 | case EARFCN_THRESH_LOW_INVALID: |
| 2883 | vty_out(vty, "Warning: multiple threshold-low are not supported, overriding with %u%s", |
| 2884 | thresh_lo, VTY_NEWLINE); |
| 2885 | break; |
| 2886 | case EARFCN_QRXLV_INVALID + 1: |
| 2887 | vty_out(vty, "Warning: multiple QRXLEVMIN are not supported, overriding with %u%s", |
| 2888 | qrx, VTY_NEWLINE); |
| 2889 | break; |
| 2890 | case EARFCN_PRIO_INVALID: |
| 2891 | vty_out(vty, "Warning: multiple priorities are not supported, overriding with %u%s", |
| 2892 | prio, VTY_NEWLINE); |
| 2893 | break; |
| 2894 | default: |
| 2895 | if (r < 0) { |
| 2896 | vty_out(vty, "Unable to add ARFCN %u: %s%s", arfcn, strerror(-r), VTY_NEWLINE); |
| 2897 | return CMD_WARNING; |
| 2898 | } |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 2899 | } |
| 2900 | |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 2901 | if (si2q_num(bts) <= SI2Q_MAX_NUM) |
Max | 2c16bee | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 2902 | return CMD_SUCCESS; |
| 2903 | |
Max | f39d03a | 2017-05-12 17:00:30 +0200 | [diff] [blame] | 2904 | 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] | 2905 | bts->si2q_count, SI2Q_MAX_NUM, arfcn, VTY_NEWLINE); |
Max | aafff96 | 2016-04-20 15:57:14 +0200 | [diff] [blame] | 2906 | osmo_earfcn_del(e, arfcn); |
Max | 2c16bee | 2017-02-15 13:51:37 +0100 | [diff] [blame] | 2907 | |
Max | aafff96 | 2016-04-20 15:57:14 +0200 | [diff] [blame] | 2908 | return CMD_WARNING; |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 2909 | } |
| 2910 | |
| 2911 | DEFUN(cfg_bts_si2quater_neigh_del, cfg_bts_si2quater_neigh_del_cmd, |
Max | 35697b9 | 2016-04-29 12:51:31 +0200 | [diff] [blame] | 2912 | "si2quater neighbor-list del earfcn <0-65535>", |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 2913 | "SI2quater Neighbor List\n" |
| 2914 | "SI2quater Neighbor List\n" |
| 2915 | "Delete from SI2quater manual neighbor list\n" |
Max | 36212f2 | 2016-04-20 12:06:05 +0200 | [diff] [blame] | 2916 | "EARFCN of neighbor\n" |
| 2917 | "EARFCN\n") |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 2918 | { |
| 2919 | struct gsm_bts *bts = vty->index; |
| 2920 | struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list; |
Max | 0c1bc26 | 2016-04-20 12:06:06 +0200 | [diff] [blame] | 2921 | uint16_t arfcn = atoi(argv[0]); |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 2922 | int r = osmo_earfcn_del(e, arfcn); |
| 2923 | if (r < 0) { |
| 2924 | vty_out(vty, "Unable to delete arfcn %u: %s%s", arfcn, |
Max | 0c1bc26 | 2016-04-20 12:06:06 +0200 | [diff] [blame] | 2925 | strerror(-r), VTY_NEWLINE); |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 2926 | return CMD_WARNING; |
| 2927 | } |
| 2928 | |
| 2929 | return CMD_SUCCESS; |
| 2930 | } |
| 2931 | |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 2932 | DEFUN(cfg_bts_si2quater_uarfcn_add, cfg_bts_si2quater_uarfcn_add_cmd, |
Max | 35697b9 | 2016-04-29 12:51:31 +0200 | [diff] [blame] | 2933 | "si2quater neighbor-list add uarfcn <0-16383> <0-511> <0-1>", |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 2934 | "SI2quater Neighbor List\n" |
| 2935 | "SI2quater Neighbor List\n" "Add to manual SI2quater neighbor list\n" |
| 2936 | "UARFCN of neighbor\n" "UARFCN of neighbor\n" "scrambling code\n" |
| 2937 | "diversity bit\n") |
| 2938 | { |
| 2939 | struct gsm_bts *bts = vty->index; |
| 2940 | uint16_t arfcn = atoi(argv[0]), scramble = atoi(argv[1]); |
| 2941 | |
| 2942 | switch(bts_uarfcn_add(bts, arfcn, scramble, atoi(argv[2]))) { |
| 2943 | case -ENOMEM: |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 2944 | 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] | 2945 | return CMD_WARNING; |
Max | aafff96 | 2016-04-20 15:57:14 +0200 | [diff] [blame] | 2946 | case -ENOSPC: |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 2947 | vty_out(vty, "Warning: not enough space in SI2quater for a given UARFCN (%u, %u)%s", |
| 2948 | arfcn, scramble, VTY_NEWLINE); |
Harald Welte | a191dcd | 2016-11-26 15:06:37 +0100 | [diff] [blame] | 2949 | return CMD_WARNING; |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 2950 | case -EADDRINUSE: |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 2951 | 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] | 2952 | return CMD_WARNING; |
| 2953 | } |
| 2954 | |
| 2955 | return CMD_SUCCESS; |
| 2956 | } |
| 2957 | |
| 2958 | DEFUN(cfg_bts_si2quater_uarfcn_del, cfg_bts_si2quater_uarfcn_del_cmd, |
Max | 35697b9 | 2016-04-29 12:51:31 +0200 | [diff] [blame] | 2959 | "si2quater neighbor-list del uarfcn <0-16383> <0-511>", |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 2960 | "SI2quater Neighbor List\n" |
| 2961 | "SI2quater Neighbor List\n" |
| 2962 | "Delete from SI2quater manual neighbor list\n" |
| 2963 | "UARFCN of neighbor\n" |
| 2964 | "UARFCN\n" |
| 2965 | "scrambling code\n") |
| 2966 | { |
| 2967 | struct gsm_bts *bts = vty->index; |
| 2968 | |
| 2969 | if (bts_uarfcn_del(bts, atoi(argv[0]), atoi(argv[1])) < 0) { |
| 2970 | vty_out(vty, "Unable to delete uarfcn: pair not found%s", |
| 2971 | VTY_NEWLINE); |
| 2972 | return CMD_WARNING; |
| 2973 | } |
| 2974 | |
| 2975 | return CMD_SUCCESS; |
| 2976 | } |
| 2977 | |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2978 | DEFUN(cfg_bts_si5_neigh, cfg_bts_si5_neigh_cmd, |
Harald Welte | 1fe73a1 | 2012-01-29 13:24:12 +0100 | [diff] [blame] | 2979 | "si5 neighbor-list (add|del) arfcn <0-1023>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2980 | "SI5 Neighbor List\n" |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2981 | "SI5 Neighbor List\n" "Add to manual SI5 neighbor list\n" |
| 2982 | "Delete from SI5 manual neighbor list\n" "ARFCN of neighbor\n" |
| 2983 | "ARFCN of neighbor\n") |
| 2984 | { |
| 2985 | struct gsm_bts *bts = vty->index; |
| 2986 | struct bitvec *bv = &bts->si_common.si5_neigh_list; |
| 2987 | uint16_t arfcn = atoi(argv[1]); |
| 2988 | |
| 2989 | if (!bts->neigh_list_manual_mode) { |
| 2990 | vty_out(vty, "%% Cannot configure neighbor list in " |
| 2991 | "automatic mode%s", VTY_NEWLINE); |
| 2992 | return CMD_WARNING; |
| 2993 | } |
| 2994 | |
| 2995 | if (!strcmp(argv[0], "add")) |
| 2996 | bitvec_set_bit_pos(bv, arfcn, 1); |
| 2997 | else |
| 2998 | bitvec_set_bit_pos(bv, arfcn, 0); |
| 2999 | |
| 3000 | return CMD_SUCCESS; |
| 3001 | } |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 3002 | |
Harald Welte | 8254cf7 | 2017-05-29 13:42:19 +0200 | [diff] [blame] | 3003 | DEFUN(cfg_bts_pcu_sock, cfg_bts_pcu_sock_cmd, |
| 3004 | "pcu-socket PATH", |
| 3005 | "PCU Socket Path for using OsmoPCU co-located with BSC (legacy BTS)\n" |
| 3006 | "Path in the file system for the unix-domain PCU socket\n") |
| 3007 | { |
| 3008 | struct gsm_bts *bts = vty->index; |
| 3009 | int rc; |
| 3010 | |
Harald Welte | 4a824ca | 2017-05-29 13:54:27 +0200 | [diff] [blame] | 3011 | osmo_talloc_replace_string(bts, &bts->pcu_sock_path, argv[0]); |
Harald Welte | 8254cf7 | 2017-05-29 13:42:19 +0200 | [diff] [blame] | 3012 | pcu_sock_exit(bts); |
| 3013 | rc = pcu_sock_init(bts->pcu_sock_path, bts); |
| 3014 | if (rc < 0) { |
| 3015 | vty_out(vty, "%% Error creating PCU socket `%s' for BTS %u%s", |
| 3016 | bts->pcu_sock_path, bts->nr, VTY_NEWLINE); |
| 3017 | return CMD_WARNING; |
| 3018 | } |
| 3019 | |
| 3020 | return CMD_SUCCESS; |
| 3021 | } |
| 3022 | |
Holger Hans Peter Freyther | e30d40d | 2012-07-20 10:27:31 +0200 | [diff] [blame] | 3023 | #define EXCL_RFLOCK_STR "Exclude this BTS from the global RF Lock\n" |
| 3024 | |
| 3025 | DEFUN(cfg_bts_excl_rf_lock, |
| 3026 | cfg_bts_excl_rf_lock_cmd, |
| 3027 | "rf-lock-exclude", |
| 3028 | EXCL_RFLOCK_STR) |
| 3029 | { |
| 3030 | struct gsm_bts *bts = vty->index; |
| 3031 | bts->excl_from_rf_lock = 1; |
| 3032 | return CMD_SUCCESS; |
| 3033 | } |
| 3034 | |
| 3035 | DEFUN(cfg_bts_no_excl_rf_lock, |
| 3036 | cfg_bts_no_excl_rf_lock_cmd, |
| 3037 | "no rf-lock-exclude", |
| 3038 | NO_STR EXCL_RFLOCK_STR) |
| 3039 | { |
| 3040 | struct gsm_bts *bts = vty->index; |
| 3041 | bts->excl_from_rf_lock = 0; |
| 3042 | return CMD_SUCCESS; |
| 3043 | } |
| 3044 | |
Jacob Erlbeck | 65d114f | 2014-01-16 11:02:14 +0100 | [diff] [blame] | 3045 | #define FORCE_COMB_SI_STR "Force the generation of a single SI (no ter/bis)\n" |
| 3046 | |
| 3047 | DEFUN(cfg_bts_force_comb_si, |
| 3048 | cfg_bts_force_comb_si_cmd, |
| 3049 | "force-combined-si", |
| 3050 | FORCE_COMB_SI_STR) |
| 3051 | { |
| 3052 | struct gsm_bts *bts = vty->index; |
| 3053 | bts->force_combined_si = 1; |
| 3054 | return CMD_SUCCESS; |
| 3055 | } |
| 3056 | |
| 3057 | DEFUN(cfg_bts_no_force_comb_si, |
| 3058 | cfg_bts_no_force_comb_si_cmd, |
| 3059 | "no force-combined-si", |
| 3060 | NO_STR FORCE_COMB_SI_STR) |
| 3061 | { |
| 3062 | struct gsm_bts *bts = vty->index; |
| 3063 | bts->force_combined_si = 0; |
| 3064 | return CMD_SUCCESS; |
| 3065 | } |
| 3066 | |
Andreas Eversberg | a83d511 | 2013-12-07 18:32:28 +0100 | [diff] [blame] | 3067 | static void _get_codec_from_arg(struct vty *vty, int argc, const char *argv[]) |
| 3068 | { |
| 3069 | struct gsm_bts *bts = vty->index; |
| 3070 | struct bts_codec_conf *codec = &bts->codec; |
| 3071 | int i; |
| 3072 | |
| 3073 | codec->hr = 0; |
| 3074 | codec->efr = 0; |
| 3075 | codec->amr = 0; |
| 3076 | for (i = 0; i < argc; i++) { |
| 3077 | if (!strcmp(argv[i], "hr")) |
| 3078 | codec->hr = 1; |
| 3079 | if (!strcmp(argv[i], "efr")) |
| 3080 | codec->efr = 1; |
| 3081 | if (!strcmp(argv[i], "amr")) |
| 3082 | codec->amr = 1; |
| 3083 | } |
| 3084 | } |
| 3085 | |
| 3086 | #define CODEC_PAR_STR " (hr|efr|amr)" |
| 3087 | #define CODEC_HELP_STR "Half Rate\n" \ |
| 3088 | "Enhanced Full Rate\nAdaptive Multirate\n" |
| 3089 | |
| 3090 | DEFUN(cfg_bts_codec0, cfg_bts_codec0_cmd, |
| 3091 | "codec-support fr", |
| 3092 | "Codec Support settings\nFullrate\n") |
| 3093 | { |
| 3094 | _get_codec_from_arg(vty, 0, argv); |
| 3095 | return CMD_SUCCESS; |
| 3096 | } |
| 3097 | |
| 3098 | DEFUN(cfg_bts_codec1, cfg_bts_codec1_cmd, |
| 3099 | "codec-support fr" CODEC_PAR_STR, |
| 3100 | "Codec Support settings\nFullrate\n" |
| 3101 | CODEC_HELP_STR) |
| 3102 | { |
| 3103 | _get_codec_from_arg(vty, 1, argv); |
| 3104 | return CMD_SUCCESS; |
| 3105 | } |
| 3106 | |
| 3107 | DEFUN(cfg_bts_codec2, cfg_bts_codec2_cmd, |
| 3108 | "codec-support fr" CODEC_PAR_STR CODEC_PAR_STR, |
| 3109 | "Codec Support settings\nFullrate\n" |
| 3110 | CODEC_HELP_STR CODEC_HELP_STR) |
| 3111 | { |
| 3112 | _get_codec_from_arg(vty, 2, argv); |
| 3113 | return CMD_SUCCESS; |
| 3114 | } |
| 3115 | |
| 3116 | DEFUN(cfg_bts_codec3, cfg_bts_codec3_cmd, |
| 3117 | "codec-support fr" CODEC_PAR_STR CODEC_PAR_STR CODEC_PAR_STR, |
| 3118 | "Codec Support settings\nFullrate\n" |
| 3119 | CODEC_HELP_STR CODEC_HELP_STR CODEC_HELP_STR) |
| 3120 | { |
| 3121 | _get_codec_from_arg(vty, 3, argv); |
| 3122 | return CMD_SUCCESS; |
| 3123 | } |
| 3124 | |
| 3125 | DEFUN(cfg_bts_codec4, cfg_bts_codec4_cmd, |
| 3126 | "codec-support fr" CODEC_PAR_STR CODEC_PAR_STR CODEC_PAR_STR CODEC_PAR_STR, |
| 3127 | "Codec Support settings\nFullrate\n" |
| 3128 | CODEC_HELP_STR CODEC_HELP_STR CODEC_HELP_STR CODEC_HELP_STR) |
| 3129 | { |
| 3130 | _get_codec_from_arg(vty, 4, argv); |
| 3131 | return CMD_SUCCESS; |
| 3132 | } |
| 3133 | |
Holger Hans Peter Freyther | c22930e | 2014-12-17 14:46:17 +0100 | [diff] [blame] | 3134 | DEFUN(cfg_bts_depends_on, cfg_bts_depends_on_cmd, |
| 3135 | "depends-on-bts <0-255>", |
| 3136 | "This BTS can only be started if another one is up\n" "BTS Number\n") |
| 3137 | { |
| 3138 | struct gsm_bts *bts = vty->index; |
| 3139 | struct gsm_bts *other_bts; |
| 3140 | int dep = atoi(argv[0]); |
| 3141 | |
| 3142 | |
| 3143 | if (!is_ipaccess_bts(bts)) { |
| 3144 | vty_out(vty, "This feature is only available for IP systems.%s", |
| 3145 | VTY_NEWLINE); |
| 3146 | return CMD_WARNING; |
| 3147 | } |
| 3148 | |
| 3149 | other_bts = gsm_bts_num(bts->network, dep); |
| 3150 | if (!other_bts || !is_ipaccess_bts(other_bts)) { |
| 3151 | vty_out(vty, "This feature is only available for IP systems.%s", |
| 3152 | VTY_NEWLINE); |
| 3153 | return CMD_WARNING; |
| 3154 | } |
| 3155 | |
| 3156 | if (dep >= bts->nr) { |
| 3157 | vty_out(vty, "%%Need to depend on an already declared unit.%s", |
| 3158 | VTY_NEWLINE); |
| 3159 | return CMD_WARNING; |
| 3160 | } |
| 3161 | |
| 3162 | bts_depend_mark(bts, dep); |
| 3163 | return CMD_SUCCESS; |
| 3164 | } |
| 3165 | |
| 3166 | DEFUN(cfg_bts_no_depends_on, cfg_bts_no_depends_on_cmd, |
| 3167 | "depeneds-on-bts <0-255>", |
| 3168 | NO_STR "This BTS can only be started if another one is up\n" |
| 3169 | "BTS Number\n") |
| 3170 | { |
| 3171 | struct gsm_bts *bts = vty->index; |
| 3172 | int dep = atoi(argv[0]); |
| 3173 | |
| 3174 | bts_depend_clear(bts, dep); |
| 3175 | return CMD_SUCCESS; |
| 3176 | } |
| 3177 | |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3178 | #define AMR_TEXT "Adaptive Multi Rate settings\n" |
| 3179 | #define AMR_MODE_TEXT "Codec modes to use with AMR codec\n" |
| 3180 | #define AMR_START_TEXT "Initial codec to use with AMR\n" \ |
| 3181 | "Automatically\nFirst codec\nSecond codec\nThird codec\nFourth codec\n" |
| 3182 | #define AMR_TH_TEXT "AMR threshold between codecs\nMS side\nBTS side\n" |
| 3183 | #define AMR_HY_TEXT "AMR hysteresis between codecs\nMS side\nBTS side\n" |
| 3184 | |
| 3185 | static void get_amr_from_arg(struct vty *vty, int argc, const char *argv[], int full) |
| 3186 | { |
| 3187 | struct gsm_bts *bts = vty->index; |
| 3188 | struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half; |
| 3189 | struct gsm48_multi_rate_conf *mr_conf = |
| 3190 | (struct gsm48_multi_rate_conf *) mr->gsm48_ie; |
| 3191 | int i; |
| 3192 | |
| 3193 | mr->gsm48_ie[1] = 0; |
| 3194 | for (i = 0; i < argc; i++) |
| 3195 | mr->gsm48_ie[1] |= 1 << atoi(argv[i]); |
| 3196 | mr_conf->icmi = 0; |
| 3197 | } |
| 3198 | |
| 3199 | static void get_amr_th_from_arg(struct vty *vty, int argc, const char *argv[], int full) |
| 3200 | { |
| 3201 | struct gsm_bts *bts = vty->index; |
| 3202 | 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] | 3203 | struct amr_mode *modes; |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3204 | int i; |
| 3205 | |
Holger Hans Peter Freyther | a174a47 | 2015-09-24 11:39:38 +0200 | [diff] [blame] | 3206 | modes = argv[0][0]=='m' ? mr->ms_mode : mr->bts_mode; |
| 3207 | for (i = 0; i < argc - 1; i++) |
| 3208 | modes[i].threshold = atoi(argv[i + 1]); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3209 | } |
| 3210 | |
| 3211 | static void get_amr_hy_from_arg(struct vty *vty, int argc, const char *argv[], int full) |
| 3212 | { |
| 3213 | struct gsm_bts *bts = vty->index; |
| 3214 | 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] | 3215 | struct amr_mode *modes; |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3216 | int i; |
| 3217 | |
Holger Hans Peter Freyther | a174a47 | 2015-09-24 11:39:38 +0200 | [diff] [blame] | 3218 | modes = argv[0][0]=='m' ? mr->ms_mode : mr->bts_mode; |
| 3219 | for (i = 0; i < argc - 1; i++) |
| 3220 | modes[i].hysteresis = atoi(argv[i + 1]); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 3221 | } |
| 3222 | |
| 3223 | static void get_amr_start_from_arg(struct vty *vty, const char *argv[], int full) |
| 3224 | { |
| 3225 | struct gsm_bts *bts = vty->index; |
| 3226 | struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half; |
| 3227 | struct gsm48_multi_rate_conf *mr_conf = |
| 3228 | (struct gsm48_multi_rate_conf *) mr->gsm48_ie; |
| 3229 | int num = 0, i; |
| 3230 | |
| 3231 | for (i = 0; i < ((full) ? 8 : 6); i++) { |
| 3232 | if ((mr->gsm48_ie[1] & (1 << i))) { |
| 3233 | num++; |
| 3234 | } |
| 3235 | } |
| 3236 | |
| 3237 | if (argv[0][0] == 'a' || num == 0) |
| 3238 | mr_conf->icmi = 0; |
| 3239 | else { |
| 3240 | mr_conf->icmi = 1; |
| 3241 | if (num < atoi(argv[0])) |
| 3242 | mr_conf->smod = num - 1; |
| 3243 | else |
| 3244 | mr_conf->smod = atoi(argv[0]) - 1; |
| 3245 | } |
| 3246 | } |
| 3247 | |
| 3248 | #define AMR_TCHF_PAR_STR " (0|1|2|3|4|5|6|7)" |
| 3249 | #define AMR_TCHF_HELP_STR "4,75k\n5,15k\n5,90k\n6,70k\n7,40k\n7,95k\n" \ |
| 3250 | "10,2k\n12,2k\n" |
| 3251 | |
| 3252 | #define AMR_TCHH_PAR_STR " (0|1|2|3|4|5)" |
| 3253 | #define AMR_TCHH_HELP_STR "4,75k\n5,15k\n5,90k\n6,70k\n7,40k\n7,95k\n" |
| 3254 | |
| 3255 | #define AMR_TH_HELP_STR "Threshold between codec 1 and 2\n" |
| 3256 | #define AMR_HY_HELP_STR "Hysteresis between codec 1 and 2\n" |
| 3257 | |
| 3258 | DEFUN(cfg_bts_amr_fr_modes1, cfg_bts_amr_fr_modes1_cmd, |
| 3259 | "amr tch-f modes" AMR_TCHF_PAR_STR, |
| 3260 | AMR_TEXT "Full Rate\n" AMR_MODE_TEXT |
| 3261 | AMR_TCHF_HELP_STR) |
| 3262 | { |
| 3263 | get_amr_from_arg(vty, 1, argv, 1); |
| 3264 | return CMD_SUCCESS; |
| 3265 | } |
| 3266 | |
| 3267 | DEFUN(cfg_bts_amr_fr_modes2, cfg_bts_amr_fr_modes2_cmd, |
| 3268 | "amr tch-f modes" AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR, |
| 3269 | AMR_TEXT "Full Rate\n" AMR_MODE_TEXT |
| 3270 | AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR) |
| 3271 | { |
| 3272 | get_amr_from_arg(vty, 2, argv, 1); |
| 3273 | return CMD_SUCCESS; |
| 3274 | } |
| 3275 | |
| 3276 | DEFUN(cfg_bts_amr_fr_modes3, cfg_bts_amr_fr_modes3_cmd, |
| 3277 | "amr tch-f modes" AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR, |
| 3278 | AMR_TEXT "Full Rate\n" AMR_MODE_TEXT |
| 3279 | AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR) |
| 3280 | { |
| 3281 | get_amr_from_arg(vty, 3, argv, 1); |
| 3282 | return CMD_SUCCESS; |
| 3283 | } |
| 3284 | |
| 3285 | DEFUN(cfg_bts_amr_fr_modes4, cfg_bts_amr_fr_modes4_cmd, |
| 3286 | "amr tch-f modes" AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR AMR_TCHF_PAR_STR, |
| 3287 | AMR_TEXT "Full Rate\n" AMR_MODE_TEXT |
| 3288 | AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR AMR_TCHF_HELP_STR) |
| 3289 | { |
| 3290 | get_amr_from_arg(vty, 4, argv, 1); |
| 3291 | return CMD_SUCCESS; |
| 3292 | } |
| 3293 | |
| 3294 | DEFUN(cfg_bts_amr_fr_start_mode, cfg_bts_amr_fr_start_mode_cmd, |
| 3295 | "amr tch-f start-mode (auto|1|2|3|4)", |
| 3296 | AMR_TEXT "Full Rate\n" AMR_START_TEXT) |
| 3297 | { |
| 3298 | get_amr_start_from_arg(vty, argv, 1); |
| 3299 | return CMD_SUCCESS; |
| 3300 | } |
| 3301 | |
| 3302 | DEFUN(cfg_bts_amr_fr_thres1, cfg_bts_amr_fr_thres1_cmd, |
| 3303 | "amr tch-f threshold (ms|bts) <0-63>", |
| 3304 | AMR_TEXT "Full Rate\n" AMR_TH_TEXT |
| 3305 | AMR_TH_HELP_STR) |
| 3306 | { |
| 3307 | get_amr_th_from_arg(vty, 2, argv, 1); |
| 3308 | return CMD_SUCCESS; |
| 3309 | } |
| 3310 | |
| 3311 | DEFUN(cfg_bts_amr_fr_thres2, cfg_bts_amr_fr_thres2_cmd, |
| 3312 | "amr tch-f threshold (ms|bts) <0-63> <0-63>", |
| 3313 | AMR_TEXT "Full Rate\n" AMR_TH_TEXT |
| 3314 | AMR_TH_HELP_STR AMR_TH_HELP_STR) |
| 3315 | { |
| 3316 | get_amr_th_from_arg(vty, 3, argv, 1); |
| 3317 | return CMD_SUCCESS; |
| 3318 | } |
| 3319 | |
| 3320 | DEFUN(cfg_bts_amr_fr_thres3, cfg_bts_amr_fr_thres3_cmd, |
| 3321 | "amr tch-f threshold (ms|bts) <0-63> <0-63> <0-63>", |
| 3322 | AMR_TEXT "Full Rate\n" AMR_TH_TEXT |
| 3323 | AMR_TH_HELP_STR AMR_TH_HELP_STR AMR_TH_HELP_STR) |
| 3324 | { |
| 3325 | get_amr_th_from_arg(vty, 4, argv, 1); |
| 3326 | return CMD_SUCCESS; |
| 3327 | } |
| 3328 | |
| 3329 | DEFUN(cfg_bts_amr_fr_hyst1, cfg_bts_amr_fr_hyst1_cmd, |
| 3330 | "amr tch-f hysteresis (ms|bts) <0-15>", |
| 3331 | AMR_TEXT "Full Rate\n" AMR_HY_TEXT |
| 3332 | AMR_HY_HELP_STR) |
| 3333 | { |
| 3334 | get_amr_hy_from_arg(vty, 2, argv, 1); |
| 3335 | return CMD_SUCCESS; |
| 3336 | } |
| 3337 | |
| 3338 | DEFUN(cfg_bts_amr_fr_hyst2, cfg_bts_amr_fr_hyst2_cmd, |
| 3339 | "amr tch-f hysteresis (ms|bts) <0-15> <0-15>", |
| 3340 | AMR_TEXT "Full Rate\n" AMR_HY_TEXT |
| 3341 | AMR_HY_HELP_STR AMR_HY_HELP_STR) |
| 3342 | { |
| 3343 | get_amr_hy_from_arg(vty, 3, argv, 1); |
| 3344 | return CMD_SUCCESS; |
| 3345 | } |
| 3346 | |
| 3347 | DEFUN(cfg_bts_amr_fr_hyst3, cfg_bts_amr_fr_hyst3_cmd, |
| 3348 | "amr tch-f hysteresis (ms|bts) <0-15> <0-15> <0-15>", |
| 3349 | AMR_TEXT "Full Rate\n" AMR_HY_TEXT |
| 3350 | AMR_HY_HELP_STR AMR_HY_HELP_STR AMR_HY_HELP_STR) |
| 3351 | { |
| 3352 | get_amr_hy_from_arg(vty, 4, argv, 1); |
| 3353 | return CMD_SUCCESS; |
| 3354 | } |
| 3355 | |
| 3356 | DEFUN(cfg_bts_amr_hr_modes1, cfg_bts_amr_hr_modes1_cmd, |
| 3357 | "amr tch-h modes" AMR_TCHH_PAR_STR, |
| 3358 | AMR_TEXT "Half Rate\n" AMR_MODE_TEXT |
| 3359 | AMR_TCHH_HELP_STR) |
| 3360 | { |
| 3361 | get_amr_from_arg(vty, 1, argv, 0); |
| 3362 | return CMD_SUCCESS; |
| 3363 | } |
| 3364 | |
| 3365 | DEFUN(cfg_bts_amr_hr_modes2, cfg_bts_amr_hr_modes2_cmd, |
| 3366 | "amr tch-h modes" AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR, |
| 3367 | AMR_TEXT "Half Rate\n" AMR_MODE_TEXT |
| 3368 | AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR) |
| 3369 | { |
| 3370 | get_amr_from_arg(vty, 2, argv, 0); |
| 3371 | return CMD_SUCCESS; |
| 3372 | } |
| 3373 | |
| 3374 | DEFUN(cfg_bts_amr_hr_modes3, cfg_bts_amr_hr_modes3_cmd, |
| 3375 | "amr tch-h modes" AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR, |
| 3376 | AMR_TEXT "Half Rate\n" AMR_MODE_TEXT |
| 3377 | AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR) |
| 3378 | { |
| 3379 | get_amr_from_arg(vty, 3, argv, 0); |
| 3380 | return CMD_SUCCESS; |
| 3381 | } |
| 3382 | |
| 3383 | DEFUN(cfg_bts_amr_hr_modes4, cfg_bts_amr_hr_modes4_cmd, |
| 3384 | "amr tch-h modes" AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR AMR_TCHH_PAR_STR, |
| 3385 | AMR_TEXT "Half Rate\n" AMR_MODE_TEXT |
| 3386 | AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR AMR_TCHH_HELP_STR) |
| 3387 | { |
| 3388 | get_amr_from_arg(vty, 4, argv, 0); |
| 3389 | return CMD_SUCCESS; |
| 3390 | } |
| 3391 | |
| 3392 | DEFUN(cfg_bts_amr_hr_start_mode, cfg_bts_amr_hr_start_mode_cmd, |
| 3393 | "amr tch-h start-mode (auto|1|2|3|4)", |
| 3394 | AMR_TEXT "Half Rate\n" AMR_START_TEXT) |
| 3395 | { |
| 3396 | get_amr_start_from_arg(vty, argv, 0); |
| 3397 | return CMD_SUCCESS; |
| 3398 | } |
| 3399 | |
| 3400 | DEFUN(cfg_bts_amr_hr_thres1, cfg_bts_amr_hr_thres1_cmd, |
| 3401 | "amr tch-h threshold (ms|bts) <0-63>", |
| 3402 | AMR_TEXT "Half Rate\n" AMR_TH_TEXT |
| 3403 | AMR_TH_HELP_STR) |
| 3404 | { |
| 3405 | get_amr_th_from_arg(vty, 2, argv, 0); |
| 3406 | return CMD_SUCCESS; |
| 3407 | } |
| 3408 | |
| 3409 | DEFUN(cfg_bts_amr_hr_thres2, cfg_bts_amr_hr_thres2_cmd, |
| 3410 | "amr tch-h threshold (ms|bts) <0-63> <0-63>", |
| 3411 | AMR_TEXT "Half Rate\n" AMR_TH_TEXT |
| 3412 | AMR_TH_HELP_STR AMR_TH_HELP_STR) |
| 3413 | { |
| 3414 | get_amr_th_from_arg(vty, 3, argv, 0); |
| 3415 | return CMD_SUCCESS; |
| 3416 | } |
| 3417 | |
| 3418 | DEFUN(cfg_bts_amr_hr_thres3, cfg_bts_amr_hr_thres3_cmd, |
| 3419 | "amr tch-h threshold (ms|bts) <0-63> <0-63> <0-63>", |
| 3420 | AMR_TEXT "Half Rate\n" AMR_TH_TEXT |
| 3421 | AMR_TH_HELP_STR AMR_TH_HELP_STR AMR_TH_HELP_STR) |
| 3422 | { |
| 3423 | get_amr_th_from_arg(vty, 4, argv, 0); |
| 3424 | return CMD_SUCCESS; |
| 3425 | } |
| 3426 | |
| 3427 | DEFUN(cfg_bts_amr_hr_hyst1, cfg_bts_amr_hr_hyst1_cmd, |
| 3428 | "amr tch-h hysteresis (ms|bts) <0-15>", |
| 3429 | AMR_TEXT "Half Rate\n" AMR_HY_TEXT |
| 3430 | AMR_HY_HELP_STR) |
| 3431 | { |
| 3432 | get_amr_hy_from_arg(vty, 2, argv, 0); |
| 3433 | return CMD_SUCCESS; |
| 3434 | } |
| 3435 | |
| 3436 | DEFUN(cfg_bts_amr_hr_hyst2, cfg_bts_amr_hr_hyst2_cmd, |
| 3437 | "amr tch-h hysteresis (ms|bts) <0-15> <0-15>", |
| 3438 | AMR_TEXT "Half Rate\n" AMR_HY_TEXT |
| 3439 | AMR_HY_HELP_STR AMR_HY_HELP_STR) |
| 3440 | { |
| 3441 | get_amr_hy_from_arg(vty, 3, argv, 0); |
| 3442 | return CMD_SUCCESS; |
| 3443 | } |
| 3444 | |
| 3445 | DEFUN(cfg_bts_amr_hr_hyst3, cfg_bts_amr_hr_hyst3_cmd, |
| 3446 | "amr tch-h hysteresis (ms|bts) <0-15> <0-15> <0-15>", |
| 3447 | AMR_TEXT "Half Rate\n" AMR_HY_TEXT |
| 3448 | AMR_HY_HELP_STR AMR_HY_HELP_STR AMR_HY_HELP_STR) |
| 3449 | { |
| 3450 | get_amr_hy_from_arg(vty, 4, argv, 0); |
| 3451 | return CMD_SUCCESS; |
| 3452 | } |
| 3453 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 3454 | #define TRX_TEXT "Radio Transceiver\n" |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 3455 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 3456 | /* per TRX configuration */ |
| 3457 | DEFUN(cfg_trx, |
| 3458 | cfg_trx_cmd, |
Harald Welte | 57e0724 | 2012-08-17 12:50:14 +0200 | [diff] [blame] | 3459 | "trx <0-255>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 3460 | TRX_TEXT |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 3461 | "Select a TRX to configure") |
| 3462 | { |
| 3463 | int trx_nr = atoi(argv[0]); |
| 3464 | struct gsm_bts *bts = vty->index; |
| 3465 | struct gsm_bts_trx *trx; |
| 3466 | |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 3467 | if (trx_nr > bts->num_trx) { |
| 3468 | vty_out(vty, "%% The next unused TRX number in this BTS is %u%s", |
| 3469 | bts->num_trx, VTY_NEWLINE); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 3470 | return CMD_WARNING; |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 3471 | } else if (trx_nr == bts->num_trx) { |
| 3472 | /* we need to allocate a new one */ |
| 3473 | trx = gsm_bts_trx_alloc(bts); |
Holger Hans Peter Freyther | acf8a0c | 2010-03-29 08:47:44 +0200 | [diff] [blame] | 3474 | } else |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 3475 | trx = gsm_bts_trx_num(bts, trx_nr); |
Holger Hans Peter Freyther | acf8a0c | 2010-03-29 08:47:44 +0200 | [diff] [blame] | 3476 | |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 3477 | if (!trx) |
| 3478 | return CMD_WARNING; |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 3479 | |
| 3480 | vty->index = trx; |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 3481 | vty->index_sub = &trx->description; |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 3482 | vty->node = TRX_NODE; |
| 3483 | |
| 3484 | return CMD_SUCCESS; |
| 3485 | } |
| 3486 | |
| 3487 | DEFUN(cfg_trx_arfcn, |
| 3488 | cfg_trx_arfcn_cmd, |
Harald Welte | 1fe73a1 | 2012-01-29 13:24:12 +0100 | [diff] [blame] | 3489 | "arfcn <0-1023>", |
Harald Welte | 13fe219 | 2012-08-17 09:57:25 +0200 | [diff] [blame] | 3490 | "Set the ARFCN for this TRX\n" |
| 3491 | "Absolute Radio Frequency Channel Number\n") |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 3492 | { |
| 3493 | int arfcn = atoi(argv[0]); |
| 3494 | struct gsm_bts_trx *trx = vty->index; |
| 3495 | |
| 3496 | /* FIXME: check if this ARFCN is supported by this TRX */ |
| 3497 | |
| 3498 | trx->arfcn = arfcn; |
| 3499 | |
| 3500 | /* FIXME: patch ARFCN into SYSTEM INFORMATION */ |
| 3501 | /* FIXME: use OML layer to update the ARFCN */ |
| 3502 | /* FIXME: use RSL layer to update SYSTEM INFORMATION */ |
| 3503 | |
| 3504 | return CMD_SUCCESS; |
| 3505 | } |
| 3506 | |
Harald Welte (local) | 7b37d97 | 2009-12-27 20:56:38 +0100 | [diff] [blame] | 3507 | DEFUN(cfg_trx_nominal_power, |
| 3508 | cfg_trx_nominal_power_cmd, |
| 3509 | "nominal power <0-100>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3510 | "Nominal TRX RF Power in dBm\n" |
| 3511 | "Nominal TRX RF Power in dBm\n" |
| 3512 | "Nominal TRX RF Power in dBm\n") |
Harald Welte (local) | 7b37d97 | 2009-12-27 20:56:38 +0100 | [diff] [blame] | 3513 | { |
| 3514 | struct gsm_bts_trx *trx = vty->index; |
| 3515 | |
| 3516 | trx->nominal_power = atoi(argv[0]); |
| 3517 | |
| 3518 | return CMD_SUCCESS; |
| 3519 | } |
| 3520 | |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 3521 | DEFUN(cfg_trx_max_power_red, |
| 3522 | cfg_trx_max_power_red_cmd, |
| 3523 | "max_power_red <0-100>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3524 | "Reduction of maximum BS RF Power (relative to nominal power)\n" |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 3525 | "Reduction of maximum BS RF Power in dB\n") |
| 3526 | { |
| 3527 | int maxpwr_r = atoi(argv[0]); |
| 3528 | struct gsm_bts_trx *trx = vty->index; |
Harald Welte | 61a83b2 | 2009-11-18 09:20:22 +0100 | [diff] [blame] | 3529 | int upper_limit = 24; /* default 12.21 max power red. */ |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 3530 | |
| 3531 | /* FIXME: check if our BTS type supports more than 12 */ |
| 3532 | if (maxpwr_r < 0 || maxpwr_r > upper_limit) { |
| 3533 | vty_out(vty, "%% Power %d dB is not in the valid range%s", |
| 3534 | maxpwr_r, VTY_NEWLINE); |
| 3535 | return CMD_WARNING; |
| 3536 | } |
| 3537 | if (maxpwr_r & 1) { |
| 3538 | vty_out(vty, "%% Power %d dB is not an even value%s", |
| 3539 | maxpwr_r, VTY_NEWLINE); |
| 3540 | return CMD_WARNING; |
| 3541 | } |
| 3542 | |
| 3543 | trx->max_power_red = maxpwr_r; |
| 3544 | |
| 3545 | /* FIXME: make sure we update this using OML */ |
| 3546 | |
| 3547 | return CMD_SUCCESS; |
| 3548 | } |
| 3549 | |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 3550 | DEFUN(cfg_trx_rsl_e1, |
| 3551 | cfg_trx_rsl_e1_cmd, |
| 3552 | "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] | 3553 | "RSL Parameters\n" |
| 3554 | "E1/T1 interface to be used for RSL\n" |
| 3555 | "E1/T1 interface to be used for RSL\n" |
| 3556 | "E1/T1 Line Number to be used for RSL\n" |
| 3557 | "E1/T1 Timeslot to be used for RSL\n" |
| 3558 | "E1/T1 Timeslot to be used for RSL\n" |
| 3559 | "E1/T1 Sub-slot to be used for RSL\n" |
| 3560 | "E1/T1 Sub-slot 0 is to be used for RSL\n" |
| 3561 | "E1/T1 Sub-slot 1 is to be used for RSL\n" |
| 3562 | "E1/T1 Sub-slot 2 is to be used for RSL\n" |
| 3563 | "E1/T1 Sub-slot 3 is to be used for RSL\n" |
| 3564 | "E1/T1 full timeslot is to be used for RSL\n") |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 3565 | { |
| 3566 | struct gsm_bts_trx *trx = vty->index; |
| 3567 | |
| 3568 | parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]); |
| 3569 | |
| 3570 | return CMD_SUCCESS; |
| 3571 | } |
| 3572 | |
| 3573 | DEFUN(cfg_trx_rsl_e1_tei, |
| 3574 | cfg_trx_rsl_e1_tei_cmd, |
| 3575 | "rsl e1 tei <0-63>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3576 | "RSL Parameters\n" |
| 3577 | "Set the TEI to be used for RSL\n" |
| 3578 | "Set the TEI to be used for RSL\n" |
| 3579 | "TEI to be used for RSL\n") |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 3580 | { |
| 3581 | struct gsm_bts_trx *trx = vty->index; |
| 3582 | |
| 3583 | trx->rsl_tei = atoi(argv[0]); |
| 3584 | |
| 3585 | return CMD_SUCCESS; |
| 3586 | } |
| 3587 | |
Holger Hans Peter Freyther | 2d501ea | 2009-11-11 11:54:24 +0100 | [diff] [blame] | 3588 | DEFUN(cfg_trx_rf_locked, |
| 3589 | cfg_trx_rf_locked_cmd, |
| 3590 | "rf_locked (0|1)", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3591 | "Set or unset the RF Locking (Turn off RF of the TRX)\n" |
| 3592 | "TRX is NOT RF locked (active)\n" |
| 3593 | "TRX is RF locked (turned off)\n") |
Holger Hans Peter Freyther | 2d501ea | 2009-11-11 11:54:24 +0100 | [diff] [blame] | 3594 | { |
| 3595 | int locked = atoi(argv[0]); |
| 3596 | struct gsm_bts_trx *trx = vty->index; |
| 3597 | |
| 3598 | gsm_trx_lock_rf(trx, locked); |
| 3599 | return CMD_SUCCESS; |
| 3600 | } |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 3601 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 3602 | /* per TS configuration */ |
| 3603 | DEFUN(cfg_ts, |
| 3604 | cfg_ts_cmd, |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 3605 | "timeslot <0-7>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3606 | "Select a Timeslot to configure\n" |
| 3607 | "Timeslot number\n") |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 3608 | { |
| 3609 | int ts_nr = atoi(argv[0]); |
| 3610 | struct gsm_bts_trx *trx = vty->index; |
| 3611 | struct gsm_bts_trx_ts *ts; |
| 3612 | |
| 3613 | if (ts_nr >= TRX_NR_TS) { |
| 3614 | vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s", |
| 3615 | TRX_NR_TS, VTY_NEWLINE); |
| 3616 | return CMD_WARNING; |
| 3617 | } |
| 3618 | |
| 3619 | ts = &trx->ts[ts_nr]; |
| 3620 | |
| 3621 | vty->index = ts; |
| 3622 | vty->node = TS_NODE; |
| 3623 | |
| 3624 | return CMD_SUCCESS; |
| 3625 | } |
| 3626 | |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 3627 | DEFUN(cfg_ts_pchan, |
| 3628 | cfg_ts_pchan_cmd, |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 3629 | "phys_chan_config PCHAN", /* dynamically generated! */ |
Holger Hans Peter Freyther | 63b0e44 | 2013-03-03 09:32:08 +0100 | [diff] [blame] | 3630 | "Physical Channel configuration (TCH/SDCCH/...)\n" "Physical Channel\n") |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 3631 | { |
| 3632 | struct gsm_bts_trx_ts *ts = vty->index; |
| 3633 | int pchanc; |
| 3634 | |
| 3635 | pchanc = gsm_pchan_parse(argv[0]); |
| 3636 | if (pchanc < 0) |
| 3637 | return CMD_WARNING; |
| 3638 | |
| 3639 | ts->pchan = pchanc; |
| 3640 | |
| 3641 | return CMD_SUCCESS; |
| 3642 | } |
| 3643 | |
| 3644 | /* used for backwards compatibility with old config files that still |
| 3645 | * have uppercase pchan type names */ |
| 3646 | DEFUN_HIDDEN(cfg_ts_pchan_compat, |
| 3647 | cfg_ts_pchan_compat_cmd, |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 3648 | "phys_chan_config PCHAN", |
Holger Hans Peter Freyther | 63b0e44 | 2013-03-03 09:32:08 +0100 | [diff] [blame] | 3649 | "Physical Channel configuration (TCH/SDCCH/...)\n" "Physical Channel\n") |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 3650 | { |
| 3651 | struct gsm_bts_trx_ts *ts = vty->index; |
| 3652 | int pchanc; |
| 3653 | |
| 3654 | pchanc = gsm_pchan_parse(argv[0]); |
| 3655 | if (pchanc < 0) |
| 3656 | return CMD_WARNING; |
| 3657 | |
| 3658 | ts->pchan = pchanc; |
| 3659 | |
| 3660 | return CMD_SUCCESS; |
| 3661 | } |
| 3662 | |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 3663 | |
| 3664 | |
Harald Welte | 135a648 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 3665 | DEFUN(cfg_ts_tsc, |
| 3666 | cfg_ts_tsc_cmd, |
| 3667 | "training_sequence_code <0-7>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3668 | "Training Sequence Code of the Timeslot\n" "TSC\n") |
Harald Welte | 135a648 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 3669 | { |
| 3670 | struct gsm_bts_trx_ts *ts = vty->index; |
| 3671 | |
Max | 71d082b | 2017-05-30 15:03:38 +0200 | [diff] [blame] | 3672 | if (!gsm_btsmodel_has_feature(ts->trx->bts->model, BTS_FEAT_MULTI_TSC)) { |
Harald Welte | 903aaea | 2014-01-19 17:10:50 +0100 | [diff] [blame] | 3673 | vty_out(vty, "%% This BTS does not support a TSC != BCC, " |
| 3674 | "falling back to BCC%s", VTY_NEWLINE); |
| 3675 | ts->tsc = -1; |
| 3676 | return CMD_WARNING; |
| 3677 | } |
| 3678 | |
Harald Welte | 135a648 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 3679 | ts->tsc = atoi(argv[0]); |
| 3680 | |
| 3681 | return CMD_SUCCESS; |
| 3682 | } |
| 3683 | |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 3684 | #define HOPPING_STR "Configure frequency hopping\n" |
| 3685 | |
| 3686 | DEFUN(cfg_ts_hopping, |
| 3687 | cfg_ts_hopping_cmd, |
| 3688 | "hopping enabled (0|1)", |
| 3689 | HOPPING_STR "Enable or disable frequency hopping\n" |
| 3690 | "Disable frequency hopping\n" "Enable frequency hopping\n") |
| 3691 | { |
| 3692 | struct gsm_bts_trx_ts *ts = vty->index; |
Harald Welte | c2fb3d0 | 2010-06-14 22:47:37 +0200 | [diff] [blame] | 3693 | int enabled = atoi(argv[0]); |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 3694 | |
Max | 71d082b | 2017-05-30 15:03:38 +0200 | [diff] [blame] | 3695 | if (enabled && !gsm_btsmodel_has_feature(ts->trx->bts->model, BTS_FEAT_HOPPING)) { |
Harald Welte | c2fb3d0 | 2010-06-14 22:47:37 +0200 | [diff] [blame] | 3696 | vty_out(vty, "BTS model does not support hopping%s", |
| 3697 | VTY_NEWLINE); |
| 3698 | return CMD_WARNING; |
| 3699 | } |
| 3700 | |
| 3701 | ts->hopping.enabled = enabled; |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 3702 | |
| 3703 | return CMD_SUCCESS; |
| 3704 | } |
| 3705 | |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 3706 | DEFUN(cfg_ts_hsn, |
| 3707 | cfg_ts_hsn_cmd, |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 3708 | "hopping sequence-number <0-63>", |
| 3709 | HOPPING_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3710 | "Which hopping sequence to use for this channel\n" |
| 3711 | "Hopping Sequence Number (HSN)\n") |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 3712 | { |
| 3713 | struct gsm_bts_trx_ts *ts = vty->index; |
| 3714 | |
| 3715 | ts->hopping.hsn = atoi(argv[0]); |
| 3716 | |
| 3717 | return CMD_SUCCESS; |
| 3718 | } |
| 3719 | |
| 3720 | DEFUN(cfg_ts_maio, |
| 3721 | cfg_ts_maio_cmd, |
| 3722 | "hopping maio <0-63>", |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 3723 | HOPPING_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3724 | "Which hopping MAIO to use for this channel\n" |
| 3725 | "Mobile Allocation Index Offset (MAIO)\n") |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 3726 | { |
| 3727 | struct gsm_bts_trx_ts *ts = vty->index; |
| 3728 | |
| 3729 | ts->hopping.maio = atoi(argv[0]); |
| 3730 | |
| 3731 | return CMD_SUCCESS; |
| 3732 | } |
| 3733 | |
| 3734 | DEFUN(cfg_ts_arfcn_add, |
| 3735 | cfg_ts_arfcn_add_cmd, |
| 3736 | "hopping arfcn add <0-1023>", |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 3737 | HOPPING_STR "Configure hopping ARFCN list\n" |
| 3738 | "Add an entry to the hopping ARFCN list\n" "ARFCN\n") |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 3739 | { |
| 3740 | struct gsm_bts_trx_ts *ts = vty->index; |
| 3741 | int arfcn = atoi(argv[0]); |
| 3742 | |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 3743 | bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1); |
| 3744 | |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 3745 | return CMD_SUCCESS; |
| 3746 | } |
| 3747 | |
| 3748 | DEFUN(cfg_ts_arfcn_del, |
| 3749 | cfg_ts_arfcn_del_cmd, |
| 3750 | "hopping arfcn del <0-1023>", |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 3751 | HOPPING_STR "Configure hopping ARFCN list\n" |
| 3752 | "Delete an entry to the hopping ARFCN list\n" "ARFCN\n") |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 3753 | { |
| 3754 | struct gsm_bts_trx_ts *ts = vty->index; |
| 3755 | int arfcn = atoi(argv[0]); |
| 3756 | |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 3757 | bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0); |
| 3758 | |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 3759 | return CMD_SUCCESS; |
| 3760 | } |
| 3761 | |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 3762 | DEFUN(cfg_ts_e1_subslot, |
| 3763 | cfg_ts_e1_subslot_cmd, |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 3764 | "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] | 3765 | "E1/T1 channel connected to this on-air timeslot\n" |
| 3766 | "E1/T1 channel connected to this on-air timeslot\n" |
| 3767 | "E1/T1 line connected to this on-air timeslot\n" |
Harald Welte | d13e0cd | 2012-08-17 09:52:03 +0200 | [diff] [blame] | 3768 | "E1/T1 timeslot connected to this on-air timeslot\n" |
| 3769 | "E1/T1 timeslot connected to this on-air timeslot\n" |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3770 | "E1/T1 sub-slot connected to this on-air timeslot\n" |
| 3771 | "E1/T1 sub-slot 0 connected to this on-air timeslot\n" |
| 3772 | "E1/T1 sub-slot 1 connected to this on-air timeslot\n" |
| 3773 | "E1/T1 sub-slot 2 connected to this on-air timeslot\n" |
| 3774 | "E1/T1 sub-slot 3 connected to this on-air timeslot\n" |
| 3775 | "Full E1/T1 timeslot connected to this on-air timeslot\n") |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 3776 | { |
| 3777 | struct gsm_bts_trx_ts *ts = vty->index; |
| 3778 | |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 3779 | parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]); |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 3780 | |
| 3781 | return CMD_SUCCESS; |
| 3782 | } |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 3783 | |
Harald Welte | 4f10c25 | 2010-05-16 21:47:13 +0200 | [diff] [blame] | 3784 | void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net) |
| 3785 | { |
| 3786 | vty_out(vty, "Channel Requests : %lu total, %lu no channel%s", |
Alexander Couzens | b847a21 | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 3787 | net->bsc_ctrs->ctr[BSC_CTR_CHREQ_TOTAL].current, |
| 3788 | net->bsc_ctrs->ctr[BSC_CTR_CHREQ_NO_CHANNEL].current, |
Alexander Couzens | 20423ea | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 3789 | VTY_NEWLINE); |
Harald Welte | 4f10c25 | 2010-05-16 21:47:13 +0200 | [diff] [blame] | 3790 | vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s", |
Alexander Couzens | b847a21 | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 3791 | net->bsc_ctrs->ctr[BSC_CTR_CHAN_RF_FAIL].current, |
| 3792 | net->bsc_ctrs->ctr[BSC_CTR_CHAN_RLL_ERR].current, |
Alexander Couzens | 20423ea | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 3793 | VTY_NEWLINE); |
Harald Welte | 4f10c25 | 2010-05-16 21:47:13 +0200 | [diff] [blame] | 3794 | vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s", |
Alexander Couzens | b847a21 | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 3795 | net->bsc_ctrs->ctr[BSC_CTR_PAGING_ATTEMPTED].current, |
| 3796 | net->bsc_ctrs->ctr[BSC_CTR_PAGING_COMPLETED].current, |
| 3797 | net->bsc_ctrs->ctr[BSC_CTR_PAGING_EXPIRED].current, |
Alexander Couzens | 20423ea | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 3798 | VTY_NEWLINE); |
Harald Welte | 4f10c25 | 2010-05-16 21:47:13 +0200 | [diff] [blame] | 3799 | vty_out(vty, "BTS failures : %lu OML, %lu RSL%s", |
Alexander Couzens | b847a21 | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 3800 | net->bsc_ctrs->ctr[BSC_CTR_BTS_OML_FAIL].current, |
| 3801 | net->bsc_ctrs->ctr[BSC_CTR_BTS_RSL_FAIL].current, |
Alexander Couzens | 20423ea | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 3802 | VTY_NEWLINE); |
Harald Welte | 4f10c25 | 2010-05-16 21:47:13 +0200 | [diff] [blame] | 3803 | } |
| 3804 | |
Holger Hans Peter Freyther | 2484ceb | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 3805 | DEFUN(drop_bts, |
| 3806 | drop_bts_cmd, |
Holger Hans Peter Freyther | 0586b0f | 2010-04-11 12:46:45 +0200 | [diff] [blame] | 3807 | "drop bts connection <0-65535> (oml|rsl)", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 3808 | "Debug/Simulation command to drop Abis/IP BTS\n" |
| 3809 | "Debug/Simulation command to drop Abis/IP BTS\n" |
| 3810 | "Debug/Simulation command to drop Abis/IP BTS\n" |
| 3811 | "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] | 3812 | { |
| 3813 | struct gsm_network *gsmnet; |
| 3814 | struct gsm_bts_trx *trx; |
| 3815 | struct gsm_bts *bts; |
| 3816 | unsigned int bts_nr; |
| 3817 | |
| 3818 | gsmnet = gsmnet_from_vty(vty); |
| 3819 | |
| 3820 | bts_nr = atoi(argv[0]); |
| 3821 | if (bts_nr >= gsmnet->num_bts) { |
| 3822 | vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s", |
| 3823 | gsmnet->num_bts, bts_nr, VTY_NEWLINE); |
| 3824 | return CMD_WARNING; |
| 3825 | } |
| 3826 | |
| 3827 | bts = gsm_bts_num(gsmnet, bts_nr); |
| 3828 | if (!bts) { |
| 3829 | vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE); |
| 3830 | return CMD_WARNING; |
| 3831 | } |
| 3832 | |
| 3833 | if (!is_ipaccess_bts(bts)) { |
| 3834 | vty_out(vty, "This command only works for ipaccess.%s", VTY_NEWLINE); |
| 3835 | return CMD_WARNING; |
| 3836 | } |
| 3837 | |
| 3838 | |
| 3839 | /* close all connections */ |
| 3840 | if (strcmp(argv[1], "oml") == 0) { |
Holger Hans Peter Freyther | dab8e27 | 2010-11-15 20:29:46 +0100 | [diff] [blame] | 3841 | ipaccess_drop_oml(bts); |
Holger Hans Peter Freyther | 2484ceb | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 3842 | } else if (strcmp(argv[1], "rsl") == 0) { |
| 3843 | /* close all rsl connections */ |
| 3844 | llist_for_each_entry(trx, &bts->trx_list, list) { |
Holger Hans Peter Freyther | dab8e27 | 2010-11-15 20:29:46 +0100 | [diff] [blame] | 3845 | ipaccess_drop_rsl(trx); |
Holger Hans Peter Freyther | 2484ceb | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 3846 | } |
| 3847 | } else { |
| 3848 | vty_out(vty, "Argument must be 'oml# or 'rsl'.%s", VTY_NEWLINE); |
| 3849 | return CMD_WARNING; |
| 3850 | } |
| 3851 | |
| 3852 | return CMD_SUCCESS; |
| 3853 | } |
| 3854 | |
Holger Hans Peter Freyther | 740e65f | 2016-03-16 13:45:23 +0100 | [diff] [blame] | 3855 | DEFUN(restart_bts, restart_bts_cmd, |
| 3856 | "restart-bts <0-65535>", |
| 3857 | "Restart ip.access nanoBTS through OML\n" |
| 3858 | "BTS Number\n") |
| 3859 | { |
| 3860 | struct gsm_network *gsmnet; |
| 3861 | struct gsm_bts_trx *trx; |
| 3862 | struct gsm_bts *bts; |
| 3863 | unsigned int bts_nr; |
| 3864 | |
| 3865 | gsmnet = gsmnet_from_vty(vty); |
| 3866 | |
| 3867 | bts_nr = atoi(argv[0]); |
| 3868 | if (bts_nr >= gsmnet->num_bts) { |
| 3869 | vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s", |
| 3870 | gsmnet->num_bts, bts_nr, VTY_NEWLINE); |
| 3871 | return CMD_WARNING; |
| 3872 | } |
| 3873 | |
| 3874 | bts = gsm_bts_num(gsmnet, bts_nr); |
| 3875 | if (!bts) { |
| 3876 | vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE); |
| 3877 | return CMD_WARNING; |
| 3878 | } |
| 3879 | |
| 3880 | if (!is_ipaccess_bts(bts) || is_sysmobts_v2(bts)) { |
| 3881 | vty_out(vty, "This command only works for ipaccess nanoBTS.%s", |
| 3882 | VTY_NEWLINE); |
| 3883 | return CMD_WARNING; |
| 3884 | } |
| 3885 | |
| 3886 | /* go from last TRX to c0 */ |
| 3887 | llist_for_each_entry_reverse(trx, &bts->trx_list, list) |
| 3888 | abis_nm_ipaccess_restart(trx); |
| 3889 | |
| 3890 | return CMD_SUCCESS; |
| 3891 | } |
| 3892 | |
Harald Welte | e168c12 | 2017-07-10 20:25:10 +0200 | [diff] [blame] | 3893 | DEFUN(bts_resend, bts_resend_cmd, |
| 3894 | "bts <0-255> resend-system-information", |
| 3895 | "BTS Specific Commands\n" "BTS Number\n" |
| 3896 | "Re-generate + re-send BCCH SYSTEM INFORMATION\n") |
| 3897 | { |
| 3898 | struct gsm_network *gsmnet; |
| 3899 | struct gsm_bts_trx *trx; |
| 3900 | struct gsm_bts *bts; |
| 3901 | unsigned int bts_nr; |
| 3902 | |
| 3903 | gsmnet = gsmnet_from_vty(vty); |
| 3904 | |
| 3905 | bts_nr = atoi(argv[0]); |
| 3906 | if (bts_nr >= gsmnet->num_bts) { |
| 3907 | vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s", |
| 3908 | gsmnet->num_bts, bts_nr, VTY_NEWLINE); |
| 3909 | return CMD_WARNING; |
| 3910 | } |
| 3911 | |
| 3912 | bts = gsm_bts_num(gsmnet, bts_nr); |
| 3913 | if (!bts) { |
| 3914 | vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE); |
| 3915 | return CMD_WARNING; |
| 3916 | } |
| 3917 | |
| 3918 | llist_for_each_entry_reverse(trx, &bts->trx_list, list) |
| 3919 | gsm_bts_trx_set_system_infos(trx); |
| 3920 | |
| 3921 | return CMD_SUCCESS; |
| 3922 | } |
| 3923 | |
| 3924 | |
Harald Welte | 30f1f37 | 2014-12-28 15:00:45 +0100 | [diff] [blame] | 3925 | DEFUN(smscb_cmd, smscb_cmd_cmd, |
| 3926 | "bts <0-255> smscb-command <1-4> HEXSTRING", |
| 3927 | "BTS related commands\n" "BTS Number\n" |
| 3928 | "SMS Cell Broadcast\n" "Last Valid Block\n" |
| 3929 | "Hex Encoded SMSCB message (up to 88 octets)\n") |
| 3930 | { |
| 3931 | struct gsm_bts *bts; |
| 3932 | int bts_nr = atoi(argv[0]); |
| 3933 | int last_block = atoi(argv[1]); |
| 3934 | struct rsl_ie_cb_cmd_type cb_cmd; |
| 3935 | uint8_t buf[88]; |
| 3936 | int rc; |
| 3937 | |
Neels Hofmeyr | b90eabf | 2016-05-11 18:48:39 +0200 | [diff] [blame] | 3938 | bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr); |
Harald Welte | 30f1f37 | 2014-12-28 15:00:45 +0100 | [diff] [blame] | 3939 | if (!bts) { |
| 3940 | vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE); |
| 3941 | return CMD_WARNING; |
| 3942 | } |
| 3943 | rc = osmo_hexparse(argv[2], buf, sizeof(buf)); |
| 3944 | if (rc < 0 || rc > sizeof(buf)) { |
| 3945 | vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE); |
| 3946 | return CMD_WARNING; |
| 3947 | } |
| 3948 | |
| 3949 | cb_cmd.spare = 0; |
| 3950 | cb_cmd.def_bcast = 0; |
| 3951 | cb_cmd.command = RSL_CB_CMD_TYPE_NORMAL; |
| 3952 | |
| 3953 | switch (last_block) { |
| 3954 | case 1: |
| 3955 | cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_1; |
| 3956 | break; |
| 3957 | case 2: |
| 3958 | cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_2; |
| 3959 | break; |
| 3960 | case 3: |
| 3961 | cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_3; |
| 3962 | break; |
| 3963 | case 4: |
| 3964 | cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_4; |
| 3965 | break; |
| 3966 | } |
| 3967 | |
| 3968 | rsl_sms_cb_command(bts, RSL_CHAN_SDCCH4_ACCH, cb_cmd, buf, rc); |
| 3969 | |
| 3970 | return CMD_SUCCESS; |
| 3971 | } |
| 3972 | |
Harald Welte | 7fe00fb | 2017-05-27 14:09:50 +0200 | [diff] [blame] | 3973 | /* resolve a gsm_bts_trx_ts basd on the given numeric identifiers */ |
Harald Welte | 645eb62 | 2017-05-27 15:52:58 +0200 | [diff] [blame] | 3974 | static struct gsm_bts_trx_ts *vty_get_ts(struct vty *vty, const char *bts_str, const char *trx_str, |
| 3975 | const char *ts_str) |
Harald Welte | 7fe00fb | 2017-05-27 14:09:50 +0200 | [diff] [blame] | 3976 | { |
Harald Welte | 645eb62 | 2017-05-27 15:52:58 +0200 | [diff] [blame] | 3977 | int bts_nr = atoi(bts_str); |
| 3978 | int trx_nr = atoi(trx_str); |
| 3979 | int ts_nr = atoi(ts_str); |
Harald Welte | 7fe00fb | 2017-05-27 14:09:50 +0200 | [diff] [blame] | 3980 | struct gsm_bts *bts; |
| 3981 | struct gsm_bts_trx *trx; |
| 3982 | struct gsm_bts_trx_ts *ts; |
| 3983 | |
| 3984 | bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr); |
| 3985 | if (!bts) { |
| 3986 | vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE); |
| 3987 | return NULL; |
| 3988 | } |
| 3989 | |
| 3990 | trx = gsm_bts_trx_num(bts, trx_nr); |
| 3991 | if (!trx) { |
| 3992 | vty_out(vty, "%% No such TRX (%d)%s", trx_nr, VTY_NEWLINE); |
| 3993 | return NULL; |
| 3994 | } |
| 3995 | |
| 3996 | ts = &trx->ts[ts_nr]; |
| 3997 | |
| 3998 | return ts; |
| 3999 | } |
Harald Welte | 30f1f37 | 2014-12-28 15:00:45 +0100 | [diff] [blame] | 4000 | |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 4001 | DEFUN(pdch_act, pdch_act_cmd, |
| 4002 | "bts <0-255> trx <0-255> timeslot <0-7> pdch (activate|deactivate)", |
| 4003 | "BTS related commands\n" "BTS Number\n" "Transceiver\n" "Transceiver Number\n" |
| 4004 | "TRX Timeslot\n" "Timeslot Number\n" "Packet Data Channel\n" |
| 4005 | "Activate Dynamic PDCH/TCH (-> PDCH mode)\n" |
| 4006 | "Deactivate Dynamic PDCH/TCH (-> TCH mode)\n") |
| 4007 | { |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 4008 | struct gsm_bts_trx_ts *ts; |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 4009 | int activate; |
| 4010 | |
Harald Welte | 645eb62 | 2017-05-27 15:52:58 +0200 | [diff] [blame] | 4011 | ts = vty_get_ts(vty, argv[0], argv[1], argv[2]); |
Harald Welte | 7fe00fb | 2017-05-27 14:09:50 +0200 | [diff] [blame] | 4012 | if (!ts) |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 4013 | return CMD_WARNING; |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 4014 | |
Harald Welte | 7fe00fb | 2017-05-27 14:09:50 +0200 | [diff] [blame] | 4015 | if (!is_ipaccess_bts(ts->trx->bts)) { |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 4016 | vty_out(vty, "%% This command only works for ipaccess BTS%s", |
| 4017 | VTY_NEWLINE); |
| 4018 | return CMD_WARNING; |
| 4019 | } |
| 4020 | |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 4021 | if (ts->pchan != GSM_PCHAN_TCH_F_PDCH) { |
| 4022 | vty_out(vty, "%% Timeslot %u is not in dynamic TCH_F/PDCH " |
Harald Welte | 645eb62 | 2017-05-27 15:52:58 +0200 | [diff] [blame] | 4023 | "mode%s", ts->nr, VTY_NEWLINE); |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 4024 | return CMD_WARNING; |
| 4025 | } |
| 4026 | |
| 4027 | if (!strcmp(argv[3], "activate")) |
| 4028 | activate = 1; |
| 4029 | else |
| 4030 | activate = 0; |
| 4031 | |
| 4032 | rsl_ipacc_pdch_activate(ts, activate); |
| 4033 | |
| 4034 | return CMD_SUCCESS; |
| 4035 | |
| 4036 | } |
Holger Hans Peter Freyther | 2484ceb | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 4037 | |
Harald Welte | 2abd5e1 | 2017-05-27 14:10:40 +0200 | [diff] [blame] | 4038 | /* determine the logical channel type based on the physical channel type */ |
| 4039 | static int lchan_type_by_pchan(enum gsm_phys_chan_config pchan) |
| 4040 | { |
| 4041 | switch (pchan) { |
| 4042 | case GSM_PCHAN_TCH_F: |
| 4043 | return GSM_LCHAN_TCH_F; |
| 4044 | case GSM_PCHAN_TCH_H: |
| 4045 | return GSM_LCHAN_TCH_H; |
| 4046 | case GSM_PCHAN_SDCCH8_SACCH8C: |
| 4047 | case GSM_PCHAN_SDCCH8_SACCH8C_CBCH: |
| 4048 | case GSM_PCHAN_CCCH_SDCCH4: |
| 4049 | case GSM_PCHAN_CCCH_SDCCH4_CBCH: |
| 4050 | return GSM_LCHAN_SDCCH; |
| 4051 | default: |
| 4052 | return -1; |
| 4053 | } |
| 4054 | } |
| 4055 | |
| 4056 | /* configure the lchan for a single AMR mode (as specified) */ |
| 4057 | static int lchan_set_single_amr_mode(struct gsm_lchan *lchan, uint8_t amr_mode) |
| 4058 | { |
| 4059 | struct amr_multirate_conf mr; |
| 4060 | struct gsm48_multi_rate_conf *mr_conf; |
| 4061 | mr_conf = (struct gsm48_multi_rate_conf *) &mr.gsm48_ie; |
| 4062 | |
| 4063 | if (amr_mode > 7) |
| 4064 | return -1; |
| 4065 | |
| 4066 | memset(&mr, 0, sizeof(mr)); |
| 4067 | mr_conf->ver = 1; |
| 4068 | /* bit-mask of supported modes, only one bit is set. Reflects |
| 4069 | * Figure 10.5.2.47a where there are no thershold and only a |
| 4070 | * single mode */ |
| 4071 | mr.gsm48_ie[1] = 1 << amr_mode; |
| 4072 | |
| 4073 | mr.ms_mode[0].mode = amr_mode; |
| 4074 | mr.bts_mode[0].mode = amr_mode; |
| 4075 | |
| 4076 | /* encode this configuration into the lchan for both uplink and |
| 4077 | * downlink direction */ |
| 4078 | gsm48_multirate_config(lchan->mr_ms_lv, &mr, mr.ms_mode); |
| 4079 | gsm48_multirate_config(lchan->mr_bts_lv, &mr, mr.bts_mode); |
| 4080 | |
| 4081 | return 0; |
| 4082 | } |
| 4083 | |
| 4084 | /* Debug/Measurement command to activate a given logical channel |
| 4085 | * manually in a given mode/codec. This is useful for receiver |
| 4086 | * performance testing (FER/RBER/...) */ |
| 4087 | DEFUN(lchan_act, lchan_act_cmd, |
| 4088 | "bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7> (activate|deactivate) (hr|fr|efr|amr) [<0-7>]", |
| 4089 | "BTS related commands\n" "BTS Number\n" "Transceiver\n" "Transceiver Number\n" |
| 4090 | "TRX Timeslot\n" "Timeslot Number\n" "Sub-Slot Number\n" "Sub-Slot Number\n" |
| 4091 | "Manual Channel Activation (e.g. for BER test)\n" |
| 4092 | "Manual Channel Deactivation (e.g. for BER test)\n" |
| 4093 | "Half-Rate v1\n" "Full-Rate\n" "Enhanced Full Rate\n" "Adaptive Multi-Rate\n" "AMR Mode\n") |
| 4094 | { |
| 4095 | struct gsm_bts_trx_ts *ts; |
| 4096 | struct gsm_lchan *lchan; |
| 4097 | int ss_nr = atoi(argv[3]); |
| 4098 | const char *act_str = argv[4]; |
| 4099 | const char *codec_str = argv[5]; |
| 4100 | int activate; |
| 4101 | |
| 4102 | ts = vty_get_ts(vty, argv[0], argv[1], argv[2]); |
| 4103 | if (!ts) |
| 4104 | return CMD_WARNING; |
| 4105 | |
| 4106 | lchan = &ts->lchan[ss_nr]; |
| 4107 | |
| 4108 | if (!strcmp(act_str, "activate")) |
| 4109 | activate = 1; |
| 4110 | else |
| 4111 | activate = 0; |
| 4112 | |
| 4113 | if (ss_nr >= ts_subslots(ts)) { |
| 4114 | vty_out(vty, "%% subslot %d >= permitted %d for physical channel %s%s", |
| 4115 | ss_nr, ts_subslots(ts), gsm_pchan_name(ts->pchan), VTY_NEWLINE); |
| 4116 | return CMD_WARNING; |
| 4117 | } |
| 4118 | |
| 4119 | if (activate) { |
| 4120 | int lchan_t; |
| 4121 | if (lchan->state != LCHAN_S_NONE) { |
| 4122 | vty_out(vty, "%% Cannot activate: Channel busy!%s", VTY_NEWLINE); |
| 4123 | return CMD_WARNING; |
| 4124 | } |
| 4125 | lchan_t = lchan_type_by_pchan(ts->pchan); |
| 4126 | if (lchan_t < 0) |
| 4127 | return CMD_WARNING; |
| 4128 | /* configure the lchan */ |
| 4129 | lchan->type = lchan_t; |
| 4130 | lchan->rsl_cmode = RSL_CMOD_SPD_SPEECH; |
| 4131 | if (!strcmp(codec_str, "hr") || !strcmp(codec_str, "fr")) |
| 4132 | lchan->tch_mode = GSM48_CMODE_SPEECH_V1; |
| 4133 | else if (!strcmp(codec_str, "efr")) |
| 4134 | lchan->tch_mode = GSM48_CMODE_SPEECH_EFR; |
| 4135 | else if (!strcmp(codec_str, "amr")) { |
| 4136 | int amr_mode; |
| 4137 | if (argc < 7) { |
| 4138 | vty_out(vty, "%% AMR requires specification of AMR mode%s", VTY_NEWLINE); |
| 4139 | return CMD_WARNING; |
| 4140 | } |
| 4141 | amr_mode = atoi(argv[6]); |
| 4142 | lchan->tch_mode = GSM48_CMODE_SPEECH_AMR; |
| 4143 | lchan_set_single_amr_mode(lchan, amr_mode); |
| 4144 | } |
| 4145 | vty_out(vty, "%% activating lchan %s%s", gsm_lchan_name(lchan), VTY_NEWLINE); |
| 4146 | rsl_chan_activate_lchan(lchan, RSL_ACT_TYPE_INITIAL, 0); |
| 4147 | rsl_ipacc_crcx(lchan); |
Harald Welte | 2abd5e1 | 2017-05-27 14:10:40 +0200 | [diff] [blame] | 4148 | } else { |
| 4149 | rsl_direct_rf_release(lchan); |
| 4150 | } |
| 4151 | |
| 4152 | return CMD_SUCCESS; |
| 4153 | } |
| 4154 | |
Harald Welte | 3f86c52 | 2017-05-27 15:53:28 +0200 | [diff] [blame] | 4155 | DEFUN(lchan_mdcx, lchan_mdcx_cmd, |
| 4156 | "bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7> mdcx A.B.C.D <0-65535>", |
| 4157 | "BTS related commands\n" "BTS Number\n" "Transceiver\n" "Transceiver Number\n" |
| 4158 | "TRX Timeslot\n" "Timeslot Number\n" "Sub-Slot\n" "Sub-Slot Number\n" |
| 4159 | "Modify RTP Connection\n" "MGW IP Address\n" "MGW UDP Port\n") |
| 4160 | { |
| 4161 | struct gsm_bts_trx_ts *ts; |
| 4162 | struct gsm_lchan *lchan; |
| 4163 | int ss_nr = atoi(argv[3]); |
| 4164 | int port = atoi(argv[5]); |
| 4165 | struct in_addr ia; |
| 4166 | inet_aton(argv[4], &ia); |
| 4167 | |
| 4168 | ts = vty_get_ts(vty, argv[0], argv[1], argv[2]); |
| 4169 | if (!ts) |
| 4170 | return CMD_WARNING; |
| 4171 | |
| 4172 | lchan = &ts->lchan[ss_nr]; |
| 4173 | |
| 4174 | if (ss_nr >= ts_subslots(ts)) { |
| 4175 | vty_out(vty, "%% subslot %d >= permitted %d for physical channel %s%s", |
| 4176 | ss_nr, ts_subslots(ts), gsm_pchan_name(ts->pchan), VTY_NEWLINE); |
| 4177 | return CMD_WARNING; |
| 4178 | } |
| 4179 | |
| 4180 | vty_out(vty, "%% connecting RTP of %s to %s:%u%s", gsm_lchan_name(lchan), |
| 4181 | inet_ntoa(ia), port, VTY_NEWLINE); |
| 4182 | rsl_ipacc_mdcx(lchan, ntohl(ia.s_addr), port, 0); |
| 4183 | return CMD_SUCCESS; |
| 4184 | } |
Harald Welte | 1f7fe3c | 2017-07-18 19:11:49 +0200 | [diff] [blame] | 4185 | |
| 4186 | DEFUN(ctrl_trap, ctrl_trap_cmd, |
| 4187 | "ctrl-interface generate-trap TRAP VALUE", |
| 4188 | "Commands related to the CTRL Interface\n" |
| 4189 | "Generate a TRAP for test purpose\n" |
| 4190 | "Identity/Name of the TRAP variable\n" |
| 4191 | "Value of the TRAP variable\n") |
| 4192 | { |
| 4193 | struct gsm_network *net = gsmnet_from_vty(vty); |
| 4194 | |
| 4195 | ctrl_cmd_send_trap(net->ctrl, argv[0], (char *) argv[1]); |
| 4196 | return CMD_SUCCESS; |
| 4197 | } |
| 4198 | |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 4199 | extern int bsc_vty_init_extra(void); |
Holger Hans Peter Freyther | e1ffc08 | 2010-04-10 00:08:28 +0200 | [diff] [blame] | 4200 | |
Max | db0e380 | 2017-01-12 19:35:11 +0100 | [diff] [blame] | 4201 | int bsc_vty_init(struct gsm_network *network) |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 4202 | { |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 4203 | cfg_ts_pchan_cmd.string = |
| 4204 | vty_cmd_string_from_valstr(tall_bsc_ctx, |
| 4205 | gsm_pchant_names, |
| 4206 | "phys_chan_config (", "|", ")", |
| 4207 | VTY_DO_LOWER); |
| 4208 | cfg_ts_pchan_cmd.doc = |
| 4209 | vty_cmd_string_from_valstr(tall_bsc_ctx, |
| 4210 | gsm_pchant_descs, |
| 4211 | "Physical Channel Combination\n", |
| 4212 | "\n", "", 0); |
| 4213 | |
Harald Welte | e555c2b | 2012-08-17 13:02:12 +0200 | [diff] [blame] | 4214 | cfg_bts_type_cmd.string = |
| 4215 | vty_cmd_string_from_valstr(tall_bsc_ctx, |
| 4216 | bts_type_names, |
| 4217 | "type (", "|", ")", |
| 4218 | VTY_DO_LOWER); |
| 4219 | cfg_bts_type_cmd.doc = |
| 4220 | vty_cmd_string_from_valstr(tall_bsc_ctx, |
| 4221 | bts_type_descs, |
| 4222 | "BTS Vendor/Type\n", |
| 4223 | "\n", "", 0); |
| 4224 | |
Neels Hofmeyr | 06d39fd | 2016-05-12 01:16:58 +0200 | [diff] [blame] | 4225 | common_cs_vty_init(network, config_write_net); |
Harald Welte | e555c2b | 2012-08-17 13:02:12 +0200 | [diff] [blame] | 4226 | |
Neels Hofmeyr | ea11bf8 | 2016-05-12 01:53:23 +0200 | [diff] [blame] | 4227 | install_element_ve(&bsc_show_net_cmd); |
Harald Welte | b4d5b17 | 2010-05-12 16:10:35 +0000 | [diff] [blame] | 4228 | install_element_ve(&show_bts_cmd); |
| 4229 | install_element_ve(&show_trx_cmd); |
| 4230 | install_element_ve(&show_ts_cmd); |
| 4231 | install_element_ve(&show_lchan_cmd); |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 4232 | install_element_ve(&show_lchan_summary_cmd); |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 4233 | |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 4234 | install_element_ve(&show_subscr_conn_cmd); |
| 4235 | install_element_ve(&handover_subscr_conn_cmd); |
| 4236 | |
Harald Welte | b4d5b17 | 2010-05-12 16:10:35 +0000 | [diff] [blame] | 4237 | install_element_ve(&show_paging_cmd); |
Holger Hans Peter Freyther | ec37bb2 | 2013-02-05 09:39:09 +0100 | [diff] [blame] | 4238 | install_element_ve(&show_paging_group_cmd); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 4239 | |
Max | db0e380 | 2017-01-12 19:35:11 +0100 | [diff] [blame] | 4240 | logging_vty_add_cmds(NULL); |
Holger Hans Peter Freyther | b61e3b2 | 2009-12-22 22:32:51 +0100 | [diff] [blame] | 4241 | |
Holger Hans Peter Freyther | f7d752f | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 4242 | install_element(GSMNET_NODE, &cfg_net_neci_cmd); |
Harald Welte | bc81450 | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 4243 | install_element(GSMNET_NODE, &cfg_net_handover_cmd); |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 4244 | install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd); |
| 4245 | install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd); |
| 4246 | install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd); |
| 4247 | install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd); |
| 4248 | install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd); |
| 4249 | install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd); |
Holger Hans Peter Freyther | c4d88ad | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 4250 | install_element(GSMNET_NODE, &cfg_net_T3101_cmd); |
Holger Hans Peter Freyther | 23975e7 | 2009-11-21 21:42:26 +0100 | [diff] [blame] | 4251 | install_element(GSMNET_NODE, &cfg_net_T3103_cmd); |
| 4252 | install_element(GSMNET_NODE, &cfg_net_T3105_cmd); |
| 4253 | install_element(GSMNET_NODE, &cfg_net_T3107_cmd); |
| 4254 | install_element(GSMNET_NODE, &cfg_net_T3109_cmd); |
| 4255 | install_element(GSMNET_NODE, &cfg_net_T3111_cmd); |
| 4256 | install_element(GSMNET_NODE, &cfg_net_T3113_cmd); |
| 4257 | install_element(GSMNET_NODE, &cfg_net_T3115_cmd); |
| 4258 | install_element(GSMNET_NODE, &cfg_net_T3117_cmd); |
| 4259 | install_element(GSMNET_NODE, &cfg_net_T3119_cmd); |
Harald Welte | c9f499f | 2010-12-23 22:53:50 +0100 | [diff] [blame] | 4260 | install_element(GSMNET_NODE, &cfg_net_T3122_cmd); |
Holger Hans Peter Freyther | 23975e7 | 2009-11-21 21:42:26 +0100 | [diff] [blame] | 4261 | install_element(GSMNET_NODE, &cfg_net_T3141_cmd); |
Holger Hans Peter Freyther | 5a3a61d | 2010-09-06 09:25:48 +0800 | [diff] [blame] | 4262 | install_element(GSMNET_NODE, &cfg_net_dtx_cmd); |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 4263 | install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 4264 | |
| 4265 | install_element(GSMNET_NODE, &cfg_bts_cmd); |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 4266 | install_node(&bts_node, config_write_bts); |
Jacob Erlbeck | 36722e1 | 2013-10-29 09:30:30 +0100 | [diff] [blame] | 4267 | vty_install_default(BTS_NODE); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 4268 | install_element(BTS_NODE, &cfg_bts_type_cmd); |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 4269 | install_element(BTS_NODE, &cfg_description_cmd); |
| 4270 | install_element(BTS_NODE, &cfg_no_description_cmd); |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 4271 | install_element(BTS_NODE, &cfg_bts_band_cmd); |
Holger Hans Peter Freyther | c4a49e3 | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 4272 | install_element(BTS_NODE, &cfg_bts_ci_cmd); |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 4273 | install_element(BTS_NODE, &cfg_bts_dtxu_cmd); |
| 4274 | install_element(BTS_NODE, &cfg_bts_dtxd_cmd); |
| 4275 | install_element(BTS_NODE, &cfg_bts_no_dtxu_cmd); |
| 4276 | install_element(BTS_NODE, &cfg_bts_no_dtxd_cmd); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 4277 | install_element(BTS_NODE, &cfg_bts_lac_cmd); |
| 4278 | install_element(BTS_NODE, &cfg_bts_tsc_cmd); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 4279 | install_element(BTS_NODE, &cfg_bts_bsic_cmd); |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 4280 | install_element(BTS_NODE, &cfg_bts_unit_id_cmd); |
Harald Welte | 8b29180 | 2013-03-12 13:57:05 +0100 | [diff] [blame] | 4281 | install_element(BTS_NODE, &cfg_bts_rsl_ip_cmd); |
Sylvain Munaut | c951946 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 4282 | install_element(BTS_NODE, &cfg_bts_nokia_site_skip_reset_cmd); |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 4283 | 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] | 4284 | 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] | 4285 | install_element(BTS_NODE, &cfg_bts_stream_id_cmd); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 4286 | install_element(BTS_NODE, &cfg_bts_oml_e1_cmd); |
| 4287 | install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd); |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 4288 | install_element(BTS_NODE, &cfg_bts_challoc_cmd); |
Sylvain Munaut | 4010f1e | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 4289 | install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd); |
| 4290 | install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd); |
Andreas Eversberg | 2ee7ecd | 2012-10-13 07:27:47 +0200 | [diff] [blame] | 4291 | install_element(BTS_NODE, &cfg_bts_chan_desc_att_cmd); |
| 4292 | install_element(BTS_NODE, &cfg_bts_chan_desc_bs_pa_mfrms_cmd); |
| 4293 | install_element(BTS_NODE, &cfg_bts_chan_desc_bs_ag_blks_res_cmd); |
Holger Hans Peter Freyther | 95c2290 | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 4294 | install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd); |
| 4295 | install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd); |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 4296 | install_element(BTS_NODE, &cfg_bts_cell_barred_cmd); |
Holger Hans Peter Freyther | 3a0a463 | 2010-05-14 00:39:19 +0800 | [diff] [blame] | 4297 | install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd); |
Ivan Kluchnikov | 6792059 | 2013-09-16 13:13:04 +0400 | [diff] [blame] | 4298 | install_element(BTS_NODE, &cfg_bts_rach_ac_class_cmd); |
Harald Welte (local) | 0e451d0 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 4299 | install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd); |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 4300 | install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd); |
| 4301 | install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd); |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 4302 | install_element(BTS_NODE, &cfg_bts_cell_bar_qualify_cmd); |
| 4303 | install_element(BTS_NODE, &cfg_bts_cell_resel_ofs_cmd); |
| 4304 | install_element(BTS_NODE, &cfg_bts_temp_ofs_cmd); |
| 4305 | install_element(BTS_NODE, &cfg_bts_temp_ofs_inf_cmd); |
| 4306 | install_element(BTS_NODE, &cfg_bts_penalty_time_cmd); |
| 4307 | install_element(BTS_NODE, &cfg_bts_penalty_time_rsvd_cmd); |
Andreas Eversberg | 4d4944a | 2013-03-10 11:49:35 +0100 | [diff] [blame] | 4308 | install_element(BTS_NODE, &cfg_bts_radio_link_timeout_cmd); |
Harald Welte | 2f8b9d2 | 2017-06-18 11:12:13 +0300 | [diff] [blame] | 4309 | install_element(BTS_NODE, &cfg_bts_radio_link_timeout_inf_cmd); |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 4310 | install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd); |
bhargava | 350533c | 2016-07-21 11:14:34 +0530 | [diff] [blame] | 4311 | 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] | 4312 | install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd); |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 4313 | install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd); |
Andreas Eversberg | 0c8f9ca | 2013-03-16 16:31:26 +0100 | [diff] [blame] | 4314 | install_element(BTS_NODE, &cfg_bts_gprs_net_ctrl_ord_cmd); |
Max | 292ec58 | 2016-07-28 11:55:37 +0200 | [diff] [blame] | 4315 | install_element(BTS_NODE, &cfg_bts_gprs_ctrl_ack_cmd); |
| 4316 | install_element(BTS_NODE, &cfg_no_bts_gprs_ctrl_ack_cmd); |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 4317 | install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd); |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 4318 | install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd); |
Harald Welte | a5731cf | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 4319 | install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd); |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 4320 | install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd); |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 4321 | install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd); |
| 4322 | install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd); |
| 4323 | install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd); |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 4324 | install_element(BTS_NODE, &cfg_bts_pag_free_cmd); |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 4325 | install_element(BTS_NODE, &cfg_bts_si_mode_cmd); |
| 4326 | install_element(BTS_NODE, &cfg_bts_si_static_cmd); |
Harald Welte | 42def72 | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 4327 | install_element(BTS_NODE, &cfg_bts_early_cm_cmd); |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 4328 | install_element(BTS_NODE, &cfg_bts_neigh_mode_cmd); |
| 4329 | install_element(BTS_NODE, &cfg_bts_neigh_cmd); |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 4330 | install_element(BTS_NODE, &cfg_bts_si5_neigh_cmd); |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 4331 | install_element(BTS_NODE, &cfg_bts_si2quater_neigh_add_cmd); |
| 4332 | install_element(BTS_NODE, &cfg_bts_si2quater_neigh_del_cmd); |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 4333 | install_element(BTS_NODE, &cfg_bts_si2quater_uarfcn_add_cmd); |
| 4334 | install_element(BTS_NODE, &cfg_bts_si2quater_uarfcn_del_cmd); |
Holger Hans Peter Freyther | e30d40d | 2012-07-20 10:27:31 +0200 | [diff] [blame] | 4335 | install_element(BTS_NODE, &cfg_bts_excl_rf_lock_cmd); |
| 4336 | install_element(BTS_NODE, &cfg_bts_no_excl_rf_lock_cmd); |
Jacob Erlbeck | 65d114f | 2014-01-16 11:02:14 +0100 | [diff] [blame] | 4337 | install_element(BTS_NODE, &cfg_bts_force_comb_si_cmd); |
| 4338 | install_element(BTS_NODE, &cfg_bts_no_force_comb_si_cmd); |
Andreas Eversberg | a83d511 | 2013-12-07 18:32:28 +0100 | [diff] [blame] | 4339 | install_element(BTS_NODE, &cfg_bts_codec0_cmd); |
| 4340 | install_element(BTS_NODE, &cfg_bts_codec1_cmd); |
| 4341 | install_element(BTS_NODE, &cfg_bts_codec2_cmd); |
| 4342 | install_element(BTS_NODE, &cfg_bts_codec3_cmd); |
| 4343 | install_element(BTS_NODE, &cfg_bts_codec4_cmd); |
Holger Hans Peter Freyther | c22930e | 2014-12-17 14:46:17 +0100 | [diff] [blame] | 4344 | install_element(BTS_NODE, &cfg_bts_depends_on_cmd); |
| 4345 | install_element(BTS_NODE, &cfg_bts_no_depends_on_cmd); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 4346 | install_element(BTS_NODE, &cfg_bts_amr_fr_modes1_cmd); |
| 4347 | install_element(BTS_NODE, &cfg_bts_amr_fr_modes2_cmd); |
| 4348 | install_element(BTS_NODE, &cfg_bts_amr_fr_modes3_cmd); |
| 4349 | install_element(BTS_NODE, &cfg_bts_amr_fr_modes4_cmd); |
| 4350 | install_element(BTS_NODE, &cfg_bts_amr_fr_thres1_cmd); |
| 4351 | install_element(BTS_NODE, &cfg_bts_amr_fr_thres2_cmd); |
| 4352 | install_element(BTS_NODE, &cfg_bts_amr_fr_thres3_cmd); |
| 4353 | install_element(BTS_NODE, &cfg_bts_amr_fr_hyst1_cmd); |
| 4354 | install_element(BTS_NODE, &cfg_bts_amr_fr_hyst2_cmd); |
| 4355 | install_element(BTS_NODE, &cfg_bts_amr_fr_hyst3_cmd); |
| 4356 | install_element(BTS_NODE, &cfg_bts_amr_fr_start_mode_cmd); |
| 4357 | install_element(BTS_NODE, &cfg_bts_amr_hr_modes1_cmd); |
| 4358 | install_element(BTS_NODE, &cfg_bts_amr_hr_modes2_cmd); |
| 4359 | install_element(BTS_NODE, &cfg_bts_amr_hr_modes3_cmd); |
| 4360 | install_element(BTS_NODE, &cfg_bts_amr_hr_modes4_cmd); |
| 4361 | install_element(BTS_NODE, &cfg_bts_amr_hr_thres1_cmd); |
| 4362 | install_element(BTS_NODE, &cfg_bts_amr_hr_thres2_cmd); |
| 4363 | install_element(BTS_NODE, &cfg_bts_amr_hr_thres3_cmd); |
| 4364 | install_element(BTS_NODE, &cfg_bts_amr_hr_hyst1_cmd); |
| 4365 | install_element(BTS_NODE, &cfg_bts_amr_hr_hyst2_cmd); |
| 4366 | install_element(BTS_NODE, &cfg_bts_amr_hr_hyst3_cmd); |
| 4367 | install_element(BTS_NODE, &cfg_bts_amr_hr_start_mode_cmd); |
Harald Welte | 8254cf7 | 2017-05-29 13:42:19 +0200 | [diff] [blame] | 4368 | install_element(BTS_NODE, &cfg_bts_pcu_sock_cmd); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 4369 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 4370 | install_element(BTS_NODE, &cfg_trx_cmd); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 4371 | install_node(&trx_node, dummy_config_write); |
Jacob Erlbeck | 36722e1 | 2013-10-29 09:30:30 +0100 | [diff] [blame] | 4372 | vty_install_default(TRX_NODE); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 4373 | install_element(TRX_NODE, &cfg_trx_arfcn_cmd); |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 4374 | install_element(TRX_NODE, &cfg_description_cmd); |
| 4375 | install_element(TRX_NODE, &cfg_no_description_cmd); |
Harald Welte (local) | 7b37d97 | 2009-12-27 20:56:38 +0100 | [diff] [blame] | 4376 | install_element(TRX_NODE, &cfg_trx_nominal_power_cmd); |
Harald Welte | 879dc97 | 2009-06-20 22:36:12 +0200 | [diff] [blame] | 4377 | install_element(TRX_NODE, &cfg_trx_max_power_red_cmd); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 4378 | install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd); |
| 4379 | install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd); |
Holger Hans Peter Freyther | 2d501ea | 2009-11-11 11:54:24 +0100 | [diff] [blame] | 4380 | install_element(TRX_NODE, &cfg_trx_rf_locked_cmd); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 4381 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 4382 | install_element(TRX_NODE, &cfg_ts_cmd); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 4383 | install_node(&ts_node, dummy_config_write); |
Jacob Erlbeck | 36722e1 | 2013-10-29 09:30:30 +0100 | [diff] [blame] | 4384 | vty_install_default(TS_NODE); |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 4385 | install_element(TS_NODE, &cfg_ts_pchan_cmd); |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 4386 | install_element(TS_NODE, &cfg_ts_pchan_compat_cmd); |
Harald Welte | 135a648 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 4387 | install_element(TS_NODE, &cfg_ts_tsc_cmd); |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 4388 | install_element(TS_NODE, &cfg_ts_hopping_cmd); |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 4389 | install_element(TS_NODE, &cfg_ts_hsn_cmd); |
| 4390 | install_element(TS_NODE, &cfg_ts_maio_cmd); |
| 4391 | install_element(TS_NODE, &cfg_ts_arfcn_add_cmd); |
| 4392 | install_element(TS_NODE, &cfg_ts_arfcn_del_cmd); |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 4393 | install_element(TS_NODE, &cfg_ts_e1_subslot_cmd); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 4394 | |
Holger Hans Peter Freyther | 2484ceb | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 4395 | install_element(ENABLE_NODE, &drop_bts_cmd); |
Holger Hans Peter Freyther | 740e65f | 2016-03-16 13:45:23 +0100 | [diff] [blame] | 4396 | install_element(ENABLE_NODE, &restart_bts_cmd); |
Harald Welte | e168c12 | 2017-07-10 20:25:10 +0200 | [diff] [blame] | 4397 | install_element(ENABLE_NODE, &bts_resend_cmd); |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 4398 | install_element(ENABLE_NODE, &pdch_act_cmd); |
Harald Welte | 2abd5e1 | 2017-05-27 14:10:40 +0200 | [diff] [blame] | 4399 | install_element(ENABLE_NODE, &lchan_act_cmd); |
Harald Welte | 3f86c52 | 2017-05-27 15:53:28 +0200 | [diff] [blame] | 4400 | install_element(ENABLE_NODE, &lchan_mdcx_cmd); |
Harald Welte | 30f1f37 | 2014-12-28 15:00:45 +0100 | [diff] [blame] | 4401 | install_element(ENABLE_NODE, &smscb_cmd_cmd); |
Harald Welte | 1f7fe3c | 2017-07-18 19:11:49 +0200 | [diff] [blame] | 4402 | install_element(ENABLE_NODE, &ctrl_trap_cmd); |
Holger Hans Peter Freyther | 2484ceb | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 4403 | |
Harald Welte | 81c9b9c | 2010-05-31 16:40:40 +0200 | [diff] [blame] | 4404 | abis_nm_vty_init(); |
Harald Welte | e1d5eca | 2011-02-12 14:42:59 +0100 | [diff] [blame] | 4405 | abis_om2k_vty_init(); |
Harald Welte | 3016d9f | 2011-02-05 13:54:41 +0100 | [diff] [blame] | 4406 | e1inp_vty_init(); |
Harald Welte | 42def72 | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 4407 | osmo_fsm_vty_add_cmds(); |
Harald Welte | 81c9b9c | 2010-05-31 16:40:40 +0200 | [diff] [blame] | 4408 | |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 4409 | bsc_vty_init_extra(); |
Harald Welte | 40f8289 | 2009-05-23 17:31:39 +0000 | [diff] [blame] | 4410 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 4411 | return 0; |
| 4412 | } |