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> |
| 21 | #include <unistd.h> |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 22 | |
Harald Welte | 4b037e4 | 2010-05-19 19:45:32 +0200 | [diff] [blame] | 23 | #include <osmocom/vty/command.h> |
| 24 | #include <osmocom/vty/buffer.h> |
| 25 | #include <osmocom/vty/vty.h> |
| 26 | #include <osmocom/vty/logging.h> |
| 27 | #include <osmocom/vty/telnet_interface.h> |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 28 | #include <osmocom/vty/misc.h> |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 29 | |
| 30 | #include <arpa/inet.h> |
| 31 | |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 32 | #include <osmocom/core/linuxlist.h> |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 33 | #include <openbsc/gsm_data.h> |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 34 | #include <osmocom/abis/e1_input.h> |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 35 | #include <openbsc/abis_nm.h> |
Harald Welte | 4d54d0b | 2011-02-19 16:48:17 +0100 | [diff] [blame] | 36 | #include <openbsc/abis_om2000.h> |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 37 | #include <osmocom/core/utils.h> |
| 38 | #include <osmocom/gsm/gsm_utils.h> |
Harald Welte | cdc59ff | 2011-05-23 20:42:26 +0200 | [diff] [blame] | 39 | #include <osmocom/gsm/abis_nm.h> |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 40 | #include <openbsc/chan_alloc.h> |
Harald Welte | 8387a49 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 41 | #include <openbsc/meas_rep.h> |
Harald Welte | 40f8289 | 2009-05-23 17:31:39 +0000 | [diff] [blame] | 42 | #include <openbsc/db.h> |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 43 | #include <osmocom/core/talloc.h> |
Holger Hans Peter Freyther | 3c71232 | 2010-04-06 11:55:37 +0200 | [diff] [blame] | 44 | #include <openbsc/vty.h> |
Harald Welte | ea34a4e | 2012-06-16 14:59:56 +0800 | [diff] [blame] | 45 | #include <osmocom/gprs/gprs_ns.h> |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 46 | #include <openbsc/system_information.h> |
Harald Welte | 5bc61dc | 2010-05-16 22:02:16 +0200 | [diff] [blame] | 47 | #include <openbsc/debug.h> |
Holger Hans Peter Freyther | 85334f1 | 2010-11-09 17:00:42 +0100 | [diff] [blame] | 48 | #include <openbsc/paging.h> |
Harald Welte | f7a2b19 | 2011-08-20 18:25:02 +0200 | [diff] [blame] | 49 | #include <openbsc/ipaccess.h> |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 50 | #include <openbsc/abis_rsl.h> |
Holger Hans Peter Freyther | 37ac420 | 2011-02-24 14:19:14 +0100 | [diff] [blame] | 51 | #include <openbsc/osmo_msc_data.h> |
| 52 | #include <openbsc/osmo_bsc_rf.h> |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 53 | |
Harald Welte | c08e8be | 2011-03-04 13:53:51 +0100 | [diff] [blame] | 54 | #include "../../bscconfig.h" |
Harald Welte | 1353f96 | 2010-05-16 19:20:24 +0200 | [diff] [blame] | 55 | |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 56 | |
| 57 | #define NETWORK_STR "Configure the GSM network\n" |
| 58 | #define CODE_CMD_STR "Code commands\n" |
| 59 | #define NAME_CMD_STR "Name Commands\n" |
| 60 | #define NAME_STR "Name to use\n" |
| 61 | #define LCHAN_NR_STR "Logical Channel Number\n" |
| 62 | |
| 63 | |
Harald Welte | ea4647d | 2010-05-12 17:19:53 +0000 | [diff] [blame] | 64 | /* FIXME: this should go to some common file */ |
| 65 | static const struct value_string gprs_ns_timer_strs[] = { |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 66 | { 0, "tns-block" }, |
| 67 | { 1, "tns-block-retries" }, |
| 68 | { 2, "tns-reset" }, |
| 69 | { 3, "tns-reset-retries" }, |
| 70 | { 4, "tns-test" }, |
| 71 | { 5, "tns-alive" }, |
| 72 | { 6, "tns-alive-retries" }, |
| 73 | { 0, NULL } |
| 74 | }; |
| 75 | |
Harald Welte | ea4647d | 2010-05-12 17:19:53 +0000 | [diff] [blame] | 76 | static const struct value_string gprs_bssgp_cfg_strs[] = { |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 77 | { 0, "blocking-timer" }, |
| 78 | { 1, "blocking-retries" }, |
| 79 | { 2, "unblocking-retries" }, |
| 80 | { 3, "reset-timer" }, |
| 81 | { 4, "reset-retries" }, |
| 82 | { 5, "suspend-timer" }, |
| 83 | { 6, "suspend-retries" }, |
| 84 | { 7, "resume-timer" }, |
| 85 | { 8, "resume-retries" }, |
| 86 | { 9, "capability-update-timer" }, |
| 87 | { 10, "capability-update-retries" }, |
| 88 | { 0, NULL } |
| 89 | }; |
| 90 | |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 91 | static const struct value_string bts_neigh_mode_strs[] = { |
| 92 | { NL_MODE_AUTOMATIC, "automatic" }, |
| 93 | { NL_MODE_MANUAL, "manual" }, |
| 94 | { NL_MODE_MANUAL_SI5SEP, "manual-si5" }, |
| 95 | { 0, NULL } |
| 96 | }; |
| 97 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 98 | struct cmd_node net_node = { |
| 99 | GSMNET_NODE, |
Harald Welte | 570ce24 | 2012-08-17 13:16:10 +0200 | [diff] [blame] | 100 | "%s(config-net)# ", |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 101 | 1, |
| 102 | }; |
| 103 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 104 | struct cmd_node bts_node = { |
| 105 | BTS_NODE, |
Harald Welte | 570ce24 | 2012-08-17 13:16:10 +0200 | [diff] [blame] | 106 | "%s(config-net-bts)# ", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 107 | 1, |
| 108 | }; |
| 109 | |
| 110 | struct cmd_node trx_node = { |
| 111 | TRX_NODE, |
Harald Welte | 570ce24 | 2012-08-17 13:16:10 +0200 | [diff] [blame] | 112 | "%s(config-net-bts-trx)# ", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 113 | 1, |
| 114 | }; |
| 115 | |
| 116 | struct cmd_node ts_node = { |
| 117 | TS_NODE, |
Harald Welte | 570ce24 | 2012-08-17 13:16:10 +0200 | [diff] [blame] | 118 | "%s(config-net-bts-trx-ts)# ", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 119 | 1, |
| 120 | }; |
| 121 | |
Harald Welte | 3923115 | 2010-05-27 13:39:40 +0200 | [diff] [blame] | 122 | extern struct gsm_network *bsc_gsmnet; |
| 123 | |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 124 | struct gsm_network *gsmnet_from_vty(struct vty *v) |
| 125 | { |
Harald Welte | 3923115 | 2010-05-27 13:39:40 +0200 | [diff] [blame] | 126 | /* In case we read from the config file, the vty->priv cannot |
| 127 | * point to a struct telnet_connection, and thus conn->priv |
| 128 | * will not point to the gsm_network structure */ |
| 129 | #if 0 |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 130 | struct telnet_connection *conn = v->priv; |
| 131 | return (struct gsm_network *) conn->priv; |
Harald Welte | 3923115 | 2010-05-27 13:39:40 +0200 | [diff] [blame] | 132 | #else |
| 133 | return bsc_gsmnet; |
| 134 | #endif |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 135 | } |
| 136 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 137 | static int dummy_config_write(struct vty *v) |
| 138 | { |
| 139 | return CMD_SUCCESS; |
| 140 | } |
| 141 | |
| 142 | static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms) |
| 143 | { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 144 | vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s", |
Harald Welte | 867d9f3 | 2011-05-23 20:30:39 +0200 | [diff] [blame] | 145 | abis_nm_opstate_name(nms->operational), nms->administrative, |
| 146 | abis_nm_avail_name(nms->availability), VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 147 | } |
| 148 | |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 149 | static void dump_pchan_load_vty(struct vty *vty, char *prefix, |
| 150 | const struct pchan_load *pl) |
| 151 | { |
| 152 | int i; |
| 153 | |
| 154 | for (i = 0; i < ARRAY_SIZE(pl->pchan); i++) { |
| 155 | const struct load_counter *lc = &pl->pchan[i]; |
| 156 | unsigned int percent; |
| 157 | |
| 158 | if (lc->total == 0) |
| 159 | continue; |
| 160 | |
| 161 | percent = (lc->used * 100) / lc->total; |
| 162 | |
| 163 | vty_out(vty, "%s%20s: %3u%% (%u/%u)%s", prefix, |
| 164 | gsm_pchan_name(i), percent, lc->used, lc->total, |
| 165 | VTY_NEWLINE); |
| 166 | } |
| 167 | } |
| 168 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 169 | static void net_dump_vty(struct vty *vty, struct gsm_network *net) |
| 170 | { |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 171 | struct pchan_load pl; |
| 172 | |
Harald Welte | ef235b5 | 2009-03-10 12:34:02 +0000 | [diff] [blame] | 173 | vty_out(vty, "BSC is on Country Code %u, Network Code %u " |
| 174 | "and has %u BTS%s", net->country_code, net->network_code, |
| 175 | net->num_bts, VTY_NEWLINE); |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 176 | vty_out(vty, " Long network name: '%s'%s", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 177 | net->name_long, VTY_NEWLINE); |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 178 | vty_out(vty, " Short network name: '%s'%s", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 179 | net->name_short, VTY_NEWLINE); |
Harald Welte (local) | 69de397 | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 180 | vty_out(vty, " Authentication policy: %s%s", |
| 181 | gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE); |
Harald Welte | 1085c09 | 2009-11-18 20:33:19 +0100 | [diff] [blame] | 182 | vty_out(vty, " Location updating reject cause: %u%s", |
| 183 | net->reject_cause, VTY_NEWLINE); |
Harald Welte | 4381cfe | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 184 | vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption, |
| 185 | VTY_NEWLINE); |
Holger Hans Peter Freyther | f7d752f | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 186 | vty_out(vty, " NECI (TCH/H): %u%s", net->neci, |
| 187 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 188 | vty_out(vty, " Use TCH for Paging any: %d%s", net->pag_any_tch, |
| 189 | VTY_NEWLINE); |
Harald Welte | eab84a1 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 190 | vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode), |
| 191 | VTY_NEWLINE); |
Harald Welte | 648b6ce | 2009-12-14 09:00:24 +0100 | [diff] [blame] | 192 | vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off", |
| 193 | VTY_NEWLINE); |
Harald Welte | bc81450 | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 194 | vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off", |
| 195 | VTY_NEWLINE); |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 196 | network_chan_load(&pl, net); |
| 197 | vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE); |
| 198 | dump_pchan_load_vty(vty, " ", &pl); |
Holger Hans Peter Freyther | 37ac420 | 2011-02-24 14:19:14 +0100 | [diff] [blame] | 199 | |
| 200 | /* show rf */ |
Holger Hans Peter Freyther | 8ec4952 | 2011-08-15 15:53:00 +0200 | [diff] [blame] | 201 | if (net->bsc_data && net->bsc_data->rf_ctrl) |
Holger Hans Peter Freyther | 37ac420 | 2011-02-24 14:19:14 +0100 | [diff] [blame] | 202 | vty_out(vty, " Last RF Command: %s%s", |
Holger Hans Peter Freyther | 8ec4952 | 2011-08-15 15:53:00 +0200 | [diff] [blame] | 203 | net->bsc_data->rf_ctrl->last_state_command, |
Holger Hans Peter Freyther | 37ac420 | 2011-02-24 14:19:14 +0100 | [diff] [blame] | 204 | VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 205 | } |
| 206 | |
| 207 | DEFUN(show_net, show_net_cmd, "show network", |
| 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 | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 239 | "BSIC %u, TSC %u and %u TRX%s", |
| 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, |
Holger Hans Peter Freyther | acf8a0c | 2010-03-29 08:47:44 +0200 | [diff] [blame] | 242 | bts->location_area_code, bts->bsic, bts->tsc, |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 243 | bts->num_trx, VTY_NEWLINE); |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 244 | vty_out(vty, "Description: %s%s", |
| 245 | bts->description ? bts->description : "(null)", VTY_NEWLINE); |
Harald Welte | 1d8dbc4 | 2009-12-12 15:38:16 +0100 | [diff] [blame] | 246 | 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] | 247 | vty_out(vty, "Minimum Rx Level for Access: %i dBm%s", |
Harald Welte | 1d8dbc4 | 2009-12-12 15:38:16 +0100 | [diff] [blame] | 248 | rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min), |
| 249 | VTY_NEWLINE); |
| 250 | vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s", |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 251 | bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE); |
Sylvain Munaut | 4010f1e | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 252 | vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer, |
| 253 | VTY_NEWLINE); |
| 254 | vty_out(vty, "RACH Max transmissions: %u%s", |
| 255 | rach_max_trans_raw2val(bts->si_common.rach_control.max_trans), |
| 256 | VTY_NEWLINE); |
Harald Welte | 7135501 | 2009-12-21 23:08:18 +0100 | [diff] [blame] | 257 | if (bts->si_common.rach_control.cell_bar) |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 258 | vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE); |
Andreas Eversberg | 2ee7ecd | 2012-10-13 07:27:47 +0200 | [diff] [blame] | 259 | vty_out(vty, "Channel Description Attachment: %s%s", |
| 260 | (bts->si_common.chan_desc.att) ? "yes" : "no", VTY_NEWLINE); |
| 261 | vty_out(vty, "Channel Description BS-PA-MFRMS: %u%s", |
| 262 | bts->si_common.chan_desc.bs_pa_mfrms + 2, VTY_NEWLINE); |
| 263 | vty_out(vty, "Channel Description BS-AG_BLKS-RES: %u%s", |
| 264 | bts->si_common.chan_desc.bs_ag_blks_res, VTY_NEWLINE); |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 265 | vty_out(vty, "System Information present: 0x%08x, static: 0x%08x%s", |
| 266 | bts->si_valid, bts->si_mode_static, VTY_NEWLINE); |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 267 | if (is_ipaccess_bts(bts)) |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 268 | 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] | 269 | bts->ip_access.site_id, bts->ip_access.bts_id, |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 270 | bts->oml_tei, VTY_NEWLINE); |
Harald Welte | fd355a3 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 271 | else if (bts->type == GSM_BTS_TYPE_HSL_FEMTO) |
| 272 | vty_out(vty, " Serial Number: %lu%s", bts->hsl.serno, VTY_NEWLINE); |
Sylvain Munaut | c951946 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 273 | else if (bts->type == GSM_BTS_TYPE_NOKIA_SITE) |
| 274 | vty_out(vty, " Skip Reset: %d%s", |
| 275 | bts->nokia.skip_reset, VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 276 | vty_out(vty, " NM State: "); |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 277 | net_dump_nmstate(vty, &bts->mo.nm_state); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 278 | vty_out(vty, " Site Mgr NM State: "); |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 279 | net_dump_nmstate(vty, &bts->site_mgr.mo.nm_state); |
Holger Hans Peter Freyther | 66e14cd | 2011-04-26 15:52:34 +0200 | [diff] [blame] | 280 | vty_out(vty, " Paging: %u pending requests, %u free slots%s", |
| 281 | paging_pending_requests_nr(bts), |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 282 | bts->paging.available_slots, VTY_NEWLINE); |
Holger Hans Peter Freyther | d283db4 | 2010-11-25 16:28:45 +0100 | [diff] [blame] | 283 | if (is_ipaccess_bts(bts)) { |
| 284 | vty_out(vty, " OML Link state: %s.%s", |
| 285 | bts->oml_link ? "connected" : "disconnected", VTY_NEWLINE); |
| 286 | } else { |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 287 | vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE); |
| 288 | e1isl_dump_vty(vty, bts->oml_link); |
| 289 | } |
Holger Hans Peter Freyther | d283db4 | 2010-11-25 16:28:45 +0100 | [diff] [blame] | 290 | |
| 291 | /* FIXME: chan_desc */ |
Harald Welte | b908cb7 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 292 | memset(&pl, 0, sizeof(pl)); |
| 293 | bts_chan_load(&pl, bts); |
| 294 | vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE); |
| 295 | dump_pchan_load_vty(vty, " ", &pl); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 296 | } |
| 297 | |
Harald Welte | 57e0724 | 2012-08-17 12:50:14 +0200 | [diff] [blame] | 298 | DEFUN(show_bts, show_bts_cmd, "show bts <0-255>", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 299 | SHOW_STR "Display information about a BTS\n" |
| 300 | "BTS number") |
| 301 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 302 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 303 | int bts_nr; |
| 304 | |
| 305 | if (argc != 0) { |
| 306 | /* use the BTS number that the user has specified */ |
| 307 | bts_nr = atoi(argv[0]); |
Harald Welte | 712ddbc | 2010-12-24 12:24:03 +0100 | [diff] [blame] | 308 | if (bts_nr >= net->num_bts) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 309 | vty_out(vty, "%% can't find BTS '%s'%s", argv[0], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 310 | VTY_NEWLINE); |
| 311 | return CMD_WARNING; |
| 312 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 313 | bts_dump_vty(vty, gsm_bts_num(net, bts_nr)); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 314 | return CMD_SUCCESS; |
| 315 | } |
| 316 | /* print all BTS's */ |
| 317 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 318 | bts_dump_vty(vty, gsm_bts_num(net, bts_nr)); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 319 | |
| 320 | return CMD_SUCCESS; |
| 321 | } |
| 322 | |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 323 | /* utility functions */ |
| 324 | static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line, |
| 325 | const char *ts, const char *ss) |
| 326 | { |
| 327 | e1_link->e1_nr = atoi(line); |
| 328 | e1_link->e1_ts = atoi(ts); |
| 329 | if (!strcmp(ss, "full")) |
| 330 | e1_link->e1_ts_ss = 255; |
| 331 | else |
| 332 | e1_link->e1_ts_ss = atoi(ss); |
| 333 | } |
| 334 | |
| 335 | static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link, |
| 336 | const char *prefix) |
| 337 | { |
| 338 | if (!e1_link->e1_ts) |
| 339 | return; |
| 340 | |
| 341 | if (e1_link->e1_ts_ss == 255) |
| 342 | vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s", |
| 343 | prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE); |
| 344 | else |
| 345 | vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s", |
| 346 | prefix, e1_link->e1_nr, e1_link->e1_ts, |
| 347 | e1_link->e1_ts_ss, VTY_NEWLINE); |
| 348 | } |
| 349 | |
| 350 | |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 351 | static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts) |
| 352 | { |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 353 | vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE); |
Harald Welte | 135a648 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 354 | if (ts->tsc != -1 && ts->tsc != ts->trx->bts->tsc) |
| 355 | vty_out(vty, " training_sequence_code %u%s", ts->tsc, VTY_NEWLINE); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 356 | if (ts->pchan != GSM_PCHAN_NONE) |
| 357 | vty_out(vty, " phys_chan_config %s%s", |
| 358 | gsm_pchan_name(ts->pchan), VTY_NEWLINE); |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 359 | vty_out(vty, " hopping enabled %u%s", |
| 360 | ts->hopping.enabled, VTY_NEWLINE); |
| 361 | if (ts->hopping.enabled) { |
| 362 | unsigned int i; |
| 363 | vty_out(vty, " hopping sequence-number %u%s", |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 364 | ts->hopping.hsn, VTY_NEWLINE); |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 365 | vty_out(vty, " hopping maio %u%s", |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 366 | ts->hopping.maio, VTY_NEWLINE); |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 367 | for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) { |
| 368 | if (!bitvec_get_bit_pos(&ts->hopping.arfcns, i)) |
| 369 | continue; |
| 370 | vty_out(vty, " hopping arfcn add %u%s", |
| 371 | i, VTY_NEWLINE); |
| 372 | } |
Harald Welte | 127af34 | 2010-12-24 12:07:07 +0100 | [diff] [blame] | 373 | } |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 374 | config_write_e1_link(vty, &ts->e1_link, " "); |
Harald Welte | face7ed | 2011-02-14 16:15:21 +0100 | [diff] [blame] | 375 | |
| 376 | if (ts->trx->bts->model->config_write_ts) |
| 377 | ts->trx->bts->model->config_write_ts(vty, ts); |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 378 | } |
| 379 | |
| 380 | static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx) |
| 381 | { |
| 382 | int i; |
| 383 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 384 | vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE); |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 385 | if (trx->description) |
| 386 | vty_out(vty, " description %s%s", trx->description, |
| 387 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 2ba40af | 2010-04-17 06:42:07 +0200 | [diff] [blame] | 388 | vty_out(vty, " rf_locked %u%s", |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 389 | trx->mo.nm_state.administrative == NM_STATE_LOCKED ? 1 : 0, |
Holger Hans Peter Freyther | 2ba40af | 2010-04-17 06:42:07 +0200 | [diff] [blame] | 390 | VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 391 | vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE); |
Harald Welte (local) | 7b37d97 | 2009-12-27 20:56:38 +0100 | [diff] [blame] | 392 | vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 393 | 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] | 394 | config_write_e1_link(vty, &trx->rsl_e1_link, " rsl "); |
| 395 | 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] | 396 | |
Harald Welte | face7ed | 2011-02-14 16:15:21 +0100 | [diff] [blame] | 397 | if (trx->bts->model->config_write_trx) |
| 398 | trx->bts->model->config_write_trx(vty, trx); |
| 399 | |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 400 | for (i = 0; i < TRX_NR_TS; i++) |
| 401 | config_write_ts_single(vty, &trx->ts[i]); |
| 402 | } |
| 403 | |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 404 | static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts) |
| 405 | { |
| 406 | unsigned int i; |
| 407 | vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode), |
| 408 | VTY_NEWLINE); |
| 409 | if (bts->gprs.mode == BTS_GPRS_NONE) |
| 410 | return; |
| 411 | |
| 412 | vty_out(vty, " gprs routing area %u%s", bts->gprs.rac, |
| 413 | VTY_NEWLINE); |
| 414 | vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci, |
| 415 | VTY_NEWLINE); |
| 416 | for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++) |
| 417 | vty_out(vty, " gprs cell timer %s %u%s", |
| 418 | get_value_string(gprs_bssgp_cfg_strs, i), |
| 419 | bts->gprs.cell.timer[i], VTY_NEWLINE); |
| 420 | vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei, |
| 421 | VTY_NEWLINE); |
| 422 | for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++) |
| 423 | vty_out(vty, " gprs ns timer %s %u%s", |
| 424 | get_value_string(gprs_ns_timer_strs, i), |
| 425 | bts->gprs.nse.timer[i], VTY_NEWLINE); |
| 426 | for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) { |
| 427 | struct gsm_bts_gprs_nsvc *nsvc = |
| 428 | &bts->gprs.nsvc[i]; |
| 429 | struct in_addr ia; |
| 430 | |
| 431 | ia.s_addr = htonl(nsvc->remote_ip); |
| 432 | vty_out(vty, " gprs nsvc %u nsvci %u%s", i, |
| 433 | nsvc->nsvci, VTY_NEWLINE); |
| 434 | vty_out(vty, " gprs nsvc %u local udp port %u%s", i, |
| 435 | nsvc->local_port, VTY_NEWLINE); |
| 436 | vty_out(vty, " gprs nsvc %u remote udp port %u%s", i, |
| 437 | nsvc->remote_port, VTY_NEWLINE); |
| 438 | vty_out(vty, " gprs nsvc %u remote ip %s%s", i, |
| 439 | inet_ntoa(ia), VTY_NEWLINE); |
| 440 | } |
| 441 | } |
| 442 | |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 443 | static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) |
| 444 | { |
| 445 | struct gsm_bts_trx *trx; |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 446 | int i; |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 447 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 448 | vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE); |
| 449 | vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE); |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 450 | if (bts->description) |
| 451 | vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 452 | 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] | 453 | vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 454 | vty_out(vty, " location_area_code %u%s", bts->location_area_code, |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 455 | VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 456 | vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE); |
| 457 | vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE); |
Harald Welte | 45f9171 | 2012-07-08 16:48:11 +0200 | [diff] [blame] | 458 | if (bts->tz.override != 0) |
| 459 | vty_out(vty, " timezone %d %d%s", bts->tz.hr, bts->tz.mn, VTY_NEWLINE); |
Harald Welte (local) | 0e451d0 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 460 | 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] | 461 | vty_out(vty, " cell reselection hysteresis %u%s", |
| 462 | bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE); |
| 463 | vty_out(vty, " rxlev access min %u%s", |
| 464 | bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE); |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 465 | |
| 466 | if (bts->si_common.cell_ro_sel_par.present) { |
| 467 | struct gsm48_si_selection_params *sp; |
| 468 | sp = &bts->si_common.cell_ro_sel_par; |
| 469 | |
| 470 | if (sp->cbq) |
| 471 | vty_out(vty, " cell bar qualify %u%s", |
| 472 | sp->cbq, VTY_NEWLINE); |
| 473 | |
| 474 | if (sp->cell_resel_off) |
| 475 | vty_out(vty, " cell reselection offset %u%s", |
| 476 | sp->cell_resel_off*2, VTY_NEWLINE); |
| 477 | |
| 478 | if (sp->temp_offs == 7) |
| 479 | vty_out(vty, " temporary offset infinite%s", |
| 480 | VTY_NEWLINE); |
| 481 | else if (sp->temp_offs) |
| 482 | vty_out(vty, " temporary offset %u%s", |
| 483 | sp->temp_offs*10, VTY_NEWLINE); |
| 484 | |
| 485 | if (sp->penalty_time == 31) |
| 486 | vty_out(vty, " penalty time reserved%s", |
| 487 | VTY_NEWLINE); |
| 488 | else if (sp->penalty_time) |
| 489 | vty_out(vty, " penalty time %u%s", |
| 490 | (sp->penalty_time*20)+20, VTY_NEWLINE); |
| 491 | } |
| 492 | |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 493 | if (bts->si_common.chan_desc.t3212) |
Harald Welte (local) | efc9231 | 2009-08-14 23:09:25 +0200 | [diff] [blame] | 494 | vty_out(vty, " periodic location update %u%s", |
Dieter Spaar | d6613e0 | 2010-10-05 21:10:55 +0200 | [diff] [blame] | 495 | bts->si_common.chan_desc.t3212 * 6, VTY_NEWLINE); |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 496 | vty_out(vty, " channel allocator %s%s", |
| 497 | bts->chan_alloc_reverse ? "descending" : "ascending", |
| 498 | VTY_NEWLINE); |
Sylvain Munaut | 4010f1e | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 499 | vty_out(vty, " rach tx integer %u%s", |
| 500 | bts->si_common.rach_control.tx_integer, VTY_NEWLINE); |
| 501 | vty_out(vty, " rach max transmission %u%s", |
| 502 | rach_max_trans_raw2val(bts->si_common.rach_control.max_trans), |
| 503 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 95c2290 | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 504 | |
Andreas Eversberg | 2ee7ecd | 2012-10-13 07:27:47 +0200 | [diff] [blame] | 505 | vty_out(vty, " channel-descrption attach %u%s", |
| 506 | bts->si_common.chan_desc.att, VTY_NEWLINE); |
| 507 | vty_out(vty, " channel-descrption bs-pa-mfrms %u%s", |
| 508 | bts->si_common.chan_desc.bs_pa_mfrms + 2, VTY_NEWLINE); |
| 509 | vty_out(vty, " channel-descrption bs-ag-blks-res %u%s", |
| 510 | bts->si_common.chan_desc.bs_ag_blks_res, VTY_NEWLINE); |
| 511 | |
Holger Hans Peter Freyther | 95c2290 | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 512 | if (bts->rach_b_thresh != -1) |
| 513 | vty_out(vty, " rach nm busy threshold %u%s", |
| 514 | bts->rach_b_thresh, VTY_NEWLINE); |
| 515 | if (bts->rach_ldavg_slots != -1) |
| 516 | vty_out(vty, " rach nm load average %u%s", |
| 517 | bts->rach_ldavg_slots, VTY_NEWLINE); |
Harald Welte | 7135501 | 2009-12-21 23:08:18 +0100 | [diff] [blame] | 518 | if (bts->si_common.rach_control.cell_bar) |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 519 | vty_out(vty, " cell barred 1%s", VTY_NEWLINE); |
Holger Hans Peter Freyther | 3a0a463 | 2010-05-14 00:39:19 +0800 | [diff] [blame] | 520 | if ((bts->si_common.rach_control.t2 & 0x4) == 0) |
| 521 | vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE); |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 522 | for (i = SYSINFO_TYPE_1; i < _MAX_SYSINFO_TYPE; i++) { |
| 523 | if (bts->si_mode_static & (1 << i)) { |
| 524 | vty_out(vty, " system-information %s mode static%s", |
| 525 | get_value_string(osmo_sitype_strs, i), VTY_NEWLINE); |
| 526 | vty_out(vty, " system-information %s static %s%s", |
| 527 | get_value_string(osmo_sitype_strs, i), |
Sylvain Munaut | 63ef215 | 2011-11-13 23:05:23 +0100 | [diff] [blame] | 528 | osmo_hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])), |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 529 | VTY_NEWLINE); |
| 530 | } |
| 531 | } |
Harald Welte | fd355a3 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 532 | switch (bts->type) { |
| 533 | case GSM_BTS_TYPE_NANOBTS: |
Harald Welte | f383aa1 | 2012-07-02 19:51:55 +0200 | [diff] [blame] | 534 | case GSM_BTS_TYPE_OSMO_SYSMO: |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 535 | vty_out(vty, " ip.access unit_id %u %u%s", |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 536 | bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE); |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 537 | vty_out(vty, " oml ip.access stream_id %u line %u%s", |
| 538 | bts->oml_tei, bts->oml_e1_link.e1_nr, VTY_NEWLINE); |
Harald Welte | fd355a3 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 539 | break; |
| 540 | case GSM_BTS_TYPE_HSL_FEMTO: |
| 541 | vty_out(vty, " hsl serial-number %lu%s", bts->hsl.serno, VTY_NEWLINE); |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 542 | vty_out(vty, " oml hsl line %u%s", |
| 543 | bts->oml_e1_link.e1_nr, VTY_NEWLINE); |
Harald Welte | fd355a3 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 544 | break; |
Sylvain Munaut | c951946 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 545 | case GSM_BTS_TYPE_NOKIA_SITE: |
| 546 | vty_out(vty, " nokia_site skip-reset %d%s", bts->nokia.skip_reset, VTY_NEWLINE); |
| 547 | break; |
Harald Welte | fd355a3 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 548 | default: |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 549 | config_write_e1_link(vty, &bts->oml_e1_link, " oml "); |
| 550 | 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] | 551 | break; |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 552 | } |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 553 | |
| 554 | /* if we have a limit, write it */ |
| 555 | if (bts->paging.free_chans_need >= 0) |
| 556 | vty_out(vty, " paging free %d%s", bts->paging.free_chans_need, VTY_NEWLINE); |
| 557 | |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 558 | vty_out(vty, " neighbor-list mode %s%s", |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 559 | get_value_string(bts_neigh_mode_strs, bts->neigh_list_manual_mode), VTY_NEWLINE); |
| 560 | if (bts->neigh_list_manual_mode != NL_MODE_AUTOMATIC) { |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 561 | for (i = 0; i < 1024; i++) { |
| 562 | if (bitvec_get_bit_pos(&bts->si_common.neigh_list, i)) |
| 563 | vty_out(vty, " neighbor-list add arfcn %u%s", |
| 564 | i, VTY_NEWLINE); |
| 565 | } |
| 566 | } |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 567 | if (bts->neigh_list_manual_mode == NL_MODE_MANUAL_SI5SEP) { |
| 568 | for (i = 0; i < 1024; i++) { |
| 569 | if (bitvec_get_bit_pos(&bts->si_common.si5_neigh_list, i)) |
| 570 | vty_out(vty, " si5 neighbor-list add arfcn %u%s", |
| 571 | i, VTY_NEWLINE); |
| 572 | } |
| 573 | } |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 574 | |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 575 | config_write_bts_gprs(vty, bts); |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 576 | |
Harald Welte | face7ed | 2011-02-14 16:15:21 +0100 | [diff] [blame] | 577 | if (bts->model->config_write_bts) |
| 578 | bts->model->config_write_bts(vty, bts); |
| 579 | |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 580 | llist_for_each_entry(trx, &bts->trx_list, list) |
| 581 | config_write_trx_single(vty, trx); |
| 582 | } |
| 583 | |
| 584 | static int config_write_bts(struct vty *v) |
| 585 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 586 | struct gsm_network *gsmnet = gsmnet_from_vty(v); |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 587 | struct gsm_bts *bts; |
| 588 | |
| 589 | llist_for_each_entry(bts, &gsmnet->bts_list, list) |
| 590 | config_write_bts_single(v, bts); |
| 591 | |
| 592 | return CMD_SUCCESS; |
| 593 | } |
| 594 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 595 | static int config_write_net(struct vty *vty) |
| 596 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 597 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 598 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 599 | vty_out(vty, "network%s", VTY_NEWLINE); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 600 | 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] | 601 | 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] | 602 | vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE); |
| 603 | 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] | 604 | vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE); |
Harald Welte | 1085c09 | 2009-11-18 20:33:19 +0100 | [diff] [blame] | 605 | vty_out(vty, " location updating reject cause %u%s", |
| 606 | gsmnet->reject_cause, VTY_NEWLINE); |
Harald Welte | 4381cfe | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 607 | vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE); |
Holger Hans Peter Freyther | d54c337 | 2009-11-19 16:37:48 +0100 | [diff] [blame] | 608 | vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE); |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 609 | 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] | 610 | vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode), |
| 611 | VTY_NEWLINE); |
Harald Welte | 648b6ce | 2009-12-14 09:00:24 +0100 | [diff] [blame] | 612 | 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] | 613 | vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE); |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 614 | vty_out(vty, " handover window rxlev averaging %u%s", |
| 615 | gsmnet->handover.win_rxlev_avg, VTY_NEWLINE); |
| 616 | vty_out(vty, " handover window rxqual averaging %u%s", |
| 617 | gsmnet->handover.win_rxqual_avg, VTY_NEWLINE); |
| 618 | vty_out(vty, " handover window rxlev neighbor averaging %u%s", |
| 619 | gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE); |
| 620 | vty_out(vty, " handover power budget interval %u%s", |
| 621 | gsmnet->handover.pwr_interval, VTY_NEWLINE); |
| 622 | vty_out(vty, " handover power budget hysteresis %u%s", |
| 623 | gsmnet->handover.pwr_hysteresis, VTY_NEWLINE); |
| 624 | vty_out(vty, " handover maximum distance %u%s", |
| 625 | gsmnet->handover.max_distance, VTY_NEWLINE); |
Holger Hans Peter Freyther | c4d88ad | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 626 | vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE); |
Holger Hans Peter Freyther | 23975e7 | 2009-11-21 21:42:26 +0100 | [diff] [blame] | 627 | vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE); |
| 628 | vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE); |
| 629 | vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE); |
| 630 | vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE); |
| 631 | vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE); |
| 632 | vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE); |
| 633 | vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE); |
| 634 | vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE); |
| 635 | vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE); |
Harald Welte | 2862dca | 2010-12-23 14:39:29 +0100 | [diff] [blame] | 636 | vty_out(vty, " timer t3122 %u%s", gsmnet->T3122, VTY_NEWLINE); |
Holger Hans Peter Freyther | 23975e7 | 2009-11-21 21:42:26 +0100 | [diff] [blame] | 637 | vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE); |
Harald Welte | 63dbfc6 | 2010-12-15 15:34:23 +0100 | [diff] [blame] | 638 | vty_out(vty, " dtx-used %u%s", gsmnet->dtx_enabled, VTY_NEWLINE); |
Holger Hans Peter Freyther | ae9006a | 2010-12-22 16:26:04 +0100 | [diff] [blame] | 639 | vty_out(vty, " subscriber-keep-in-ram %d%s", |
| 640 | gsmnet->keep_subscr, VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 641 | |
| 642 | return CMD_SUCCESS; |
| 643 | } |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 644 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 645 | static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx) |
| 646 | { |
| 647 | vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s", |
| 648 | trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE); |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 649 | vty_out(vty, "Description: %s%s", |
| 650 | trx->description ? trx->description : "(null)", VTY_NEWLINE); |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 651 | vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, " |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 652 | "resulting BS power: %d dBm%s", |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 653 | trx->nominal_power, trx->max_power_red, |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 654 | trx->nominal_power - trx->max_power_red, VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 655 | vty_out(vty, " NM State: "); |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 656 | net_dump_nmstate(vty, &trx->mo.nm_state); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 657 | vty_out(vty, " Baseband Transceiver NM State: "); |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 658 | net_dump_nmstate(vty, &trx->bb_transc.mo.nm_state); |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 659 | if (is_ipaccess_bts(trx->bts)) { |
| 660 | vty_out(vty, " ip.access stream ID: 0x%02x%s", |
| 661 | trx->rsl_tei, VTY_NEWLINE); |
| 662 | } else { |
| 663 | vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE); |
| 664 | e1isl_dump_vty(vty, trx->rsl_link); |
| 665 | } |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 666 | } |
| 667 | |
| 668 | DEFUN(show_trx, |
| 669 | show_trx_cmd, |
Harald Welte | 57e0724 | 2012-08-17 12:50:14 +0200 | [diff] [blame] | 670 | "show trx <0-255> <0-255>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 671 | SHOW_STR "Display information about a TRX\n" |
| 672 | "BTS Number\n" |
| 673 | "TRX Number\n") |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 674 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 675 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 676 | struct gsm_bts *bts = NULL; |
| 677 | struct gsm_bts_trx *trx; |
| 678 | int bts_nr, trx_nr; |
| 679 | |
| 680 | if (argc >= 1) { |
| 681 | /* use the BTS number that the user has specified */ |
| 682 | bts_nr = atoi(argv[0]); |
| 683 | if (bts_nr >= net->num_bts) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 684 | vty_out(vty, "%% can't find BTS '%s'%s", argv[0], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 685 | VTY_NEWLINE); |
| 686 | return CMD_WARNING; |
| 687 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 688 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 689 | } |
| 690 | if (argc >= 2) { |
| 691 | trx_nr = atoi(argv[1]); |
| 692 | if (trx_nr >= bts->num_trx) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 693 | vty_out(vty, "%% can't find TRX '%s'%s", argv[1], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 694 | VTY_NEWLINE); |
| 695 | return CMD_WARNING; |
| 696 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 697 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 698 | trx_dump_vty(vty, trx); |
| 699 | return CMD_SUCCESS; |
| 700 | } |
| 701 | if (bts) { |
| 702 | /* print all TRX in this BTS */ |
| 703 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 704 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 705 | trx_dump_vty(vty, trx); |
| 706 | } |
| 707 | return CMD_SUCCESS; |
| 708 | } |
| 709 | |
| 710 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 711 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 712 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 713 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 714 | trx_dump_vty(vty, trx); |
| 715 | } |
| 716 | } |
| 717 | |
| 718 | return CMD_SUCCESS; |
| 719 | } |
| 720 | |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 721 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 722 | static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts) |
| 723 | { |
Harald Welte | 135a648 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 724 | 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] | 725 | ts->trx->bts->nr, ts->trx->nr, ts->nr, |
Harald Welte | 135a648 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 726 | gsm_pchan_name(ts->pchan), ts->tsc); |
Harald Welte | cd103a9 | 2010-12-24 12:14:52 +0100 | [diff] [blame] | 727 | if (ts->pchan == GSM_PCHAN_TCH_F_PDCH) |
Harald Welte | b29cea1 | 2010-12-24 12:26:13 +0100 | [diff] [blame] | 728 | vty_out(vty, " (%s mode)", |
Harald Welte | cd103a9 | 2010-12-24 12:14:52 +0100 | [diff] [blame] | 729 | ts->flags & TS_F_PDCH_MODE ? "PDCH" : "TCH/F"); |
| 730 | vty_out(vty, "%s", VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 731 | vty_out(vty, " NM State: "); |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 732 | net_dump_nmstate(vty, &ts->mo.nm_state); |
Harald Welte | 2c82899 | 2009-12-02 01:56:49 +0530 | [diff] [blame] | 733 | if (!is_ipaccess_bts(ts->trx->bts)) |
Harald Welte | ef235b5 | 2009-03-10 12:34:02 +0000 | [diff] [blame] | 734 | vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s", |
| 735 | ts->e1_link.e1_nr, ts->e1_link.e1_ts, |
| 736 | ts->e1_link.e1_ts_ss, VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 737 | } |
| 738 | |
| 739 | DEFUN(show_ts, |
| 740 | show_ts_cmd, |
Harald Welte | 57e0724 | 2012-08-17 12:50:14 +0200 | [diff] [blame] | 741 | "show timeslot <0-255> <0-255> <0-7>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 742 | SHOW_STR "Display information about a TS\n" |
| 743 | "BTS Number\n" "TRX Number\n" "Timeslot Number\n") |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 744 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 745 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 274d015 | 2010-12-24 12:05:03 +0100 | [diff] [blame] | 746 | struct gsm_bts *bts = NULL; |
| 747 | struct gsm_bts_trx *trx = NULL; |
| 748 | struct gsm_bts_trx_ts *ts = NULL; |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 749 | int bts_nr, trx_nr, ts_nr; |
| 750 | |
| 751 | if (argc >= 1) { |
| 752 | /* use the BTS number that the user has specified */ |
| 753 | bts_nr = atoi(argv[0]); |
| 754 | if (bts_nr >= net->num_bts) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 755 | vty_out(vty, "%% can't find BTS '%s'%s", argv[0], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 756 | VTY_NEWLINE); |
| 757 | return CMD_WARNING; |
| 758 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 759 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 760 | } |
| 761 | if (argc >= 2) { |
| 762 | trx_nr = atoi(argv[1]); |
| 763 | if (trx_nr >= bts->num_trx) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 764 | vty_out(vty, "%% can't find TRX '%s'%s", argv[1], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 765 | VTY_NEWLINE); |
| 766 | return CMD_WARNING; |
| 767 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 768 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 769 | } |
| 770 | if (argc >= 3) { |
| 771 | ts_nr = atoi(argv[2]); |
| 772 | if (ts_nr >= TRX_NR_TS) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 773 | vty_out(vty, "%% can't find TS '%s'%s", argv[2], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 774 | VTY_NEWLINE); |
| 775 | return CMD_WARNING; |
| 776 | } |
Harald Welte | 274d015 | 2010-12-24 12:05:03 +0100 | [diff] [blame] | 777 | /* Fully Specified: print and exit */ |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 778 | ts = &trx->ts[ts_nr]; |
| 779 | ts_dump_vty(vty, ts); |
| 780 | return CMD_SUCCESS; |
| 781 | } |
Harald Welte | 274d015 | 2010-12-24 12:05:03 +0100 | [diff] [blame] | 782 | |
| 783 | if (bts && trx) { |
| 784 | /* Iterate over all TS in this TRX */ |
| 785 | for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) { |
| 786 | ts = &trx->ts[ts_nr]; |
| 787 | ts_dump_vty(vty, ts); |
| 788 | } |
| 789 | } else if (bts) { |
| 790 | /* Iterate over all TRX in this BTS, TS in each TRX */ |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 791 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 792 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 793 | for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) { |
| 794 | ts = &trx->ts[ts_nr]; |
| 795 | ts_dump_vty(vty, ts); |
| 796 | } |
| 797 | } |
Harald Welte | 274d015 | 2010-12-24 12:05:03 +0100 | [diff] [blame] | 798 | } else { |
| 799 | /* Iterate over all BTS, TRX in each BTS, TS in each TRX */ |
| 800 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
| 801 | bts = gsm_bts_num(net, bts_nr); |
| 802 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
| 803 | trx = gsm_bts_trx_num(bts, trx_nr); |
| 804 | for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) { |
| 805 | ts = &trx->ts[ts_nr]; |
| 806 | ts_dump_vty(vty, ts); |
| 807 | } |
| 808 | } |
| 809 | } |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 810 | } |
| 811 | |
| 812 | return CMD_SUCCESS; |
| 813 | } |
| 814 | |
Holger Hans Peter Freyther | 424c4f0 | 2010-01-06 06:00:40 +0100 | [diff] [blame] | 815 | static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr) |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 816 | { |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 817 | vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id, |
Harald Welte | 40f8289 | 2009-05-23 17:31:39 +0000 | [diff] [blame] | 818 | subscr->authorized, VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 819 | if (subscr->name) |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 820 | vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 821 | if (subscr->extension) |
| 822 | vty_out(vty, " Extension: %s%s", subscr->extension, |
| 823 | VTY_NEWLINE); |
| 824 | if (subscr->imsi) |
| 825 | vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE); |
Holger Hans Peter Freyther | 2223025 | 2009-08-19 12:53:57 +0200 | [diff] [blame] | 826 | if (subscr->tmsi != GSM_RESERVED_TMSI) |
| 827 | vty_out(vty, " TMSI: %08X%s", subscr->tmsi, |
Harald Welte | 731fd91 | 2009-08-15 03:24:51 +0200 | [diff] [blame] | 828 | VTY_NEWLINE); |
Sylvain Munaut | af29264 | 2009-12-27 19:29:28 +0100 | [diff] [blame] | 829 | |
Harald Welte (local) | 15920de | 2009-08-14 20:27:16 +0200 | [diff] [blame] | 830 | vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 831 | } |
| 832 | |
Harald Welte | 8387a49 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 833 | static void meas_rep_dump_uni_vty(struct vty *vty, |
| 834 | struct gsm_meas_rep_unidir *mru, |
| 835 | const char *prefix, |
| 836 | const char *dir) |
| 837 | { |
| 838 | vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ", |
| 839 | prefix, dir, rxlev2dbm(mru->full.rx_lev), |
| 840 | dir, rxlev2dbm(mru->sub.rx_lev)); |
| 841 | vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s", |
| 842 | dir, mru->full.rx_qual, dir, mru->sub.rx_qual, |
| 843 | VTY_NEWLINE); |
| 844 | } |
| 845 | |
| 846 | static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr, |
| 847 | const char *prefix) |
| 848 | { |
| 849 | vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE); |
| 850 | vty_out(vty, "%s Flags: %s%s%s%s%s", prefix, |
| 851 | mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "", |
| 852 | mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "", |
| 853 | mr->flags & MEAS_REP_F_FPC ? "FPC " : "", |
| 854 | mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ", |
| 855 | VTY_NEWLINE); |
| 856 | if (mr->flags & MEAS_REP_F_MS_TO) |
| 857 | vty_out(vty, "%s MS Timing Offset: %u%s", prefix, |
| 858 | mr->ms_timing_offset, VTY_NEWLINE); |
| 859 | if (mr->flags & MEAS_REP_F_MS_L1) |
| 860 | vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s", |
| 861 | prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE); |
| 862 | if (mr->flags & MEAS_REP_F_DL_VALID) |
| 863 | meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl"); |
| 864 | meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul"); |
| 865 | } |
| 866 | |
Holger Hans Peter Freyther | 029235e | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 867 | 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] | 868 | { |
Harald Welte | 8387a49 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 869 | int idx; |
| 870 | |
Harald Welte | 85bded8 | 2010-12-24 12:22:34 +0100 | [diff] [blame] | 871 | vty_out(vty, "BTS %u, TRX %u, Timeslot %u, Lchan %u: Type %s%s", |
| 872 | lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr, |
| 873 | lchan->nr, gsm_lchant_name(lchan->type), VTY_NEWLINE); |
Holger Hans Peter Freyther | 4049455 | 2010-06-28 17:09:29 +0800 | [diff] [blame] | 874 | vty_out(vty, " Connection: %u, State: %s%s", |
| 875 | lchan->conn ? 1: 0, |
Harald Welte | 1887f9d | 2009-12-29 10:52:38 +0100 | [diff] [blame] | 876 | gsm_lchans_name(lchan->state), VTY_NEWLINE); |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 877 | vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s", |
| 878 | lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red |
| 879 | - lchan->bs_power*2, |
| 880 | ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power), |
| 881 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 2412a07 | 2010-06-28 15:47:12 +0800 | [diff] [blame] | 882 | if (lchan->conn && lchan->conn->subscr) { |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 883 | vty_out(vty, " Subscriber:%s", VTY_NEWLINE); |
Holger Hans Peter Freyther | 2412a07 | 2010-06-28 15:47:12 +0800 | [diff] [blame] | 884 | subscr_dump_vty(vty, lchan->conn->subscr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 885 | } else |
| 886 | vty_out(vty, " No Subscriber%s", VTY_NEWLINE); |
Harald Welte | 2c82899 | 2009-12-02 01:56:49 +0530 | [diff] [blame] | 887 | if (is_ipaccess_bts(lchan->ts->trx->bts)) { |
| 888 | struct in_addr ia; |
Holger Hans Peter Freyther | 54fa799 | 2010-04-07 15:39:16 +0200 | [diff] [blame] | 889 | ia.s_addr = htonl(lchan->abis_ip.bound_ip); |
Harald Welte | 2c82899 | 2009-12-02 01:56:49 +0530 | [diff] [blame] | 890 | vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s", |
| 891 | inet_ntoa(ia), lchan->abis_ip.bound_port, |
| 892 | lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id, |
| 893 | VTY_NEWLINE); |
| 894 | } |
Harald Welte | 8387a49 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 895 | |
| 896 | /* we want to report the last measurement report */ |
| 897 | idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep), |
| 898 | lchan->meas_rep_idx, 1); |
| 899 | meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " "); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 900 | } |
| 901 | |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 902 | static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan) |
| 903 | { |
Holger Hans Peter Freyther | cf5cc5b | 2010-05-14 01:57:02 +0800 | [diff] [blame] | 904 | struct gsm_meas_rep *mr; |
| 905 | int idx; |
| 906 | |
| 907 | /* we want to report the last measurement report */ |
| 908 | idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep), |
| 909 | lchan->meas_rep_idx, 1); |
| 910 | mr = &lchan->meas_rep[idx]; |
| 911 | |
Harald Welte | 85bded8 | 2010-12-24 12:22:34 +0100 | [diff] [blame] | 912 | vty_out(vty, "BTS %u, TRX %u, Timeslot %u, Lchan %u, Type %s - " |
| 913 | "L1 MS Power: %u dBm RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s", |
| 914 | lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr, |
Harald Welte | b29cea1 | 2010-12-24 12:26:13 +0100 | [diff] [blame] | 915 | lchan->nr, gsm_lchant_name(lchan->type), mr->ms_l1.pwr, |
Holger Hans Peter Freyther | cf5cc5b | 2010-05-14 01:57:02 +0800 | [diff] [blame] | 916 | rxlev2dbm(mr->dl.full.rx_lev), |
| 917 | rxlev2dbm(mr->ul.full.rx_lev), |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 918 | VTY_NEWLINE); |
| 919 | } |
| 920 | |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 921 | |
| 922 | static int dump_lchan_trx_ts(struct gsm_bts_trx_ts *ts, struct vty *vty, |
| 923 | void (*dump_cb)(struct vty *, struct gsm_lchan *)) |
| 924 | { |
| 925 | int lchan_nr; |
| 926 | for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN; lchan_nr++) { |
| 927 | struct gsm_lchan *lchan = &ts->lchan[lchan_nr]; |
| 928 | if ((lchan->type == GSM_LCHAN_NONE) && (lchan->state == LCHAN_S_NONE)) |
| 929 | continue; |
| 930 | dump_cb(vty, lchan); |
| 931 | } |
| 932 | |
| 933 | return CMD_SUCCESS; |
| 934 | } |
| 935 | |
| 936 | static int dump_lchan_trx(struct gsm_bts_trx *trx, struct vty *vty, |
| 937 | void (*dump_cb)(struct vty *, struct gsm_lchan *)) |
| 938 | { |
| 939 | int ts_nr; |
| 940 | |
| 941 | for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) { |
| 942 | struct gsm_bts_trx_ts *ts = &trx->ts[ts_nr]; |
| 943 | dump_lchan_trx_ts(ts, vty, dump_cb); |
| 944 | } |
| 945 | |
| 946 | return CMD_SUCCESS; |
| 947 | } |
| 948 | |
| 949 | static int dump_lchan_bts(struct gsm_bts *bts, struct vty *vty, |
| 950 | void (*dump_cb)(struct vty *, struct gsm_lchan *)) |
| 951 | { |
| 952 | int trx_nr; |
| 953 | |
| 954 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
| 955 | struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, trx_nr); |
| 956 | dump_lchan_trx(trx, vty, dump_cb); |
| 957 | } |
| 958 | |
| 959 | return CMD_SUCCESS; |
| 960 | } |
| 961 | |
Holger Hans Peter Freyther | 029235e | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 962 | static int lchan_summary(struct vty *vty, int argc, const char **argv, |
| 963 | void (*dump_cb)(struct vty *, struct gsm_lchan *)) |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 964 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 965 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 966 | struct gsm_bts *bts; |
| 967 | struct gsm_bts_trx *trx; |
| 968 | struct gsm_bts_trx_ts *ts; |
| 969 | struct gsm_lchan *lchan; |
| 970 | int bts_nr, trx_nr, ts_nr, lchan_nr; |
| 971 | |
| 972 | if (argc >= 1) { |
| 973 | /* use the BTS number that the user has specified */ |
| 974 | bts_nr = atoi(argv[0]); |
| 975 | if (bts_nr >= net->num_bts) { |
| 976 | vty_out(vty, "%% can't find BTS %s%s", argv[0], |
| 977 | VTY_NEWLINE); |
| 978 | return CMD_WARNING; |
| 979 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 980 | bts = gsm_bts_num(net, bts_nr); |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 981 | |
| 982 | if (argc == 1) |
| 983 | return dump_lchan_bts(bts, vty, dump_cb); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 984 | } |
| 985 | if (argc >= 2) { |
| 986 | trx_nr = atoi(argv[1]); |
| 987 | if (trx_nr >= bts->num_trx) { |
| 988 | vty_out(vty, "%% can't find TRX %s%s", argv[1], |
| 989 | VTY_NEWLINE); |
| 990 | return CMD_WARNING; |
| 991 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 992 | trx = gsm_bts_trx_num(bts, trx_nr); |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 993 | |
| 994 | if (argc == 2) |
| 995 | return dump_lchan_trx(trx, vty, dump_cb); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 996 | } |
| 997 | if (argc >= 3) { |
| 998 | ts_nr = atoi(argv[2]); |
| 999 | if (ts_nr >= TRX_NR_TS) { |
| 1000 | vty_out(vty, "%% can't find TS %s%s", argv[2], |
| 1001 | VTY_NEWLINE); |
| 1002 | return CMD_WARNING; |
| 1003 | } |
| 1004 | ts = &trx->ts[ts_nr]; |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1005 | |
| 1006 | if (argc == 3) |
| 1007 | return dump_lchan_trx_ts(ts, vty, dump_cb); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1008 | } |
| 1009 | if (argc >= 4) { |
| 1010 | lchan_nr = atoi(argv[3]); |
| 1011 | if (lchan_nr >= TS_MAX_LCHAN) { |
| 1012 | vty_out(vty, "%% can't find LCHAN %s%s", argv[3], |
| 1013 | VTY_NEWLINE); |
| 1014 | return CMD_WARNING; |
| 1015 | } |
| 1016 | lchan = &ts->lchan[lchan_nr]; |
Holger Hans Peter Freyther | 029235e | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1017 | dump_cb(vty, lchan); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1018 | return CMD_SUCCESS; |
| 1019 | } |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1020 | |
| 1021 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1022 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1023 | bts = gsm_bts_num(net, bts_nr); |
Holger Hans Peter Freyther | 7173f63 | 2011-12-27 16:34:12 +0100 | [diff] [blame] | 1024 | dump_lchan_bts(bts, vty, dump_cb); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1025 | } |
| 1026 | |
| 1027 | return CMD_SUCCESS; |
| 1028 | } |
| 1029 | |
Holger Hans Peter Freyther | 029235e | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1030 | |
| 1031 | DEFUN(show_lchan, |
| 1032 | show_lchan_cmd, |
Harald Welte | 57e0724 | 2012-08-17 12:50:14 +0200 | [diff] [blame] | 1033 | "show lchan <0-255> <0-255> <0-7> [lchan_nr]", |
Holger Hans Peter Freyther | 029235e | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1034 | SHOW_STR "Display information about a logical channel\n" |
| 1035 | "BTS Number\n" "TRX Number\n" "Timeslot Number\n" |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1036 | LCHAN_NR_STR) |
Holger Hans Peter Freyther | 029235e | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 1037 | |
| 1038 | { |
| 1039 | return lchan_summary(vty, argc, argv, lchan_dump_full_vty); |
| 1040 | } |
| 1041 | |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1042 | DEFUN(show_lchan_summary, |
| 1043 | show_lchan_summary_cmd, |
Harald Welte | 57e0724 | 2012-08-17 12:50:14 +0200 | [diff] [blame] | 1044 | "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] | 1045 | SHOW_STR "Display information about a logical channel\n" |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1046 | "Short summary\n" |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1047 | "BTS Number\n" "TRX Number\n" "Timeslot Number\n" |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1048 | LCHAN_NR_STR) |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 1049 | { |
| 1050 | return lchan_summary(vty, argc, argv, lchan_dump_short_vty); |
| 1051 | } |
| 1052 | |
Harald Welte | be4b730 | 2009-05-23 16:59:33 +0000 | [diff] [blame] | 1053 | 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] | 1054 | { |
| 1055 | vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE); |
| 1056 | subscr_dump_vty(vty, pag->subscr); |
| 1057 | } |
| 1058 | |
Harald Welte | be4b730 | 2009-05-23 16:59:33 +0000 | [diff] [blame] | 1059 | 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] | 1060 | { |
| 1061 | struct gsm_paging_request *pag; |
| 1062 | |
| 1063 | llist_for_each_entry(pag, &bts->paging.pending_requests, entry) |
| 1064 | paging_dump_vty(vty, pag); |
| 1065 | } |
| 1066 | |
| 1067 | DEFUN(show_paging, |
| 1068 | show_paging_cmd, |
Harald Welte | 57e0724 | 2012-08-17 12:50:14 +0200 | [diff] [blame] | 1069 | "show paging <0-255>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1070 | SHOW_STR "Display information about paging reuqests of a BTS\n" |
| 1071 | "BTS Number\n") |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1072 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1073 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1074 | struct gsm_bts *bts; |
| 1075 | int bts_nr; |
| 1076 | |
| 1077 | if (argc >= 1) { |
| 1078 | /* use the BTS number that the user has specified */ |
| 1079 | bts_nr = atoi(argv[0]); |
| 1080 | if (bts_nr >= net->num_bts) { |
| 1081 | vty_out(vty, "%% can't find BTS %s%s", argv[0], |
| 1082 | VTY_NEWLINE); |
| 1083 | return CMD_WARNING; |
| 1084 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1085 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1086 | bts_paging_dump_vty(vty, bts); |
| 1087 | |
| 1088 | return CMD_SUCCESS; |
| 1089 | } |
| 1090 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1091 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1092 | bts_paging_dump_vty(vty, bts); |
| 1093 | } |
| 1094 | |
| 1095 | return CMD_SUCCESS; |
| 1096 | } |
| 1097 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1098 | DEFUN(cfg_net, |
| 1099 | cfg_net_cmd, |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1100 | "network", NETWORK_STR) |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1101 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1102 | vty->index = gsmnet_from_vty(vty); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1103 | vty->node = GSMNET_NODE; |
| 1104 | |
| 1105 | return CMD_SUCCESS; |
| 1106 | } |
| 1107 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1108 | DEFUN(cfg_net_ncc, |
| 1109 | cfg_net_ncc_cmd, |
| 1110 | "network country code <1-999>", |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1111 | "Set the GSM network country code\n" |
| 1112 | "Country commands\n" |
| 1113 | CODE_CMD_STR |
| 1114 | "Network Country Code to use\n") |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1115 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1116 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1117 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1118 | gsmnet->country_code = atoi(argv[0]); |
| 1119 | |
| 1120 | return CMD_SUCCESS; |
| 1121 | } |
| 1122 | |
| 1123 | DEFUN(cfg_net_mnc, |
| 1124 | cfg_net_mnc_cmd, |
Dieter Spaar | 402cced | 2011-07-27 23:43:56 +0200 | [diff] [blame] | 1125 | "mobile network code <0-999>", |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1126 | "Set the GSM mobile network code\n" |
| 1127 | "Network Commands\n" |
| 1128 | CODE_CMD_STR |
| 1129 | "Mobile Network Code to use\n") |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1130 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1131 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1132 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1133 | gsmnet->network_code = atoi(argv[0]); |
| 1134 | |
| 1135 | return CMD_SUCCESS; |
| 1136 | } |
| 1137 | |
| 1138 | DEFUN(cfg_net_name_short, |
| 1139 | cfg_net_name_short_cmd, |
| 1140 | "short name NAME", |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1141 | "Set the short GSM network name\n" NAME_CMD_STR NAME_STR) |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1142 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1143 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1144 | |
Holger Hans Peter Freyther | 3e9a7f8 | 2010-10-12 23:21:54 +0200 | [diff] [blame] | 1145 | bsc_replace_string(gsmnet, &gsmnet->name_short, argv[0]); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1146 | return CMD_SUCCESS; |
| 1147 | } |
| 1148 | |
| 1149 | DEFUN(cfg_net_name_long, |
| 1150 | cfg_net_name_long_cmd, |
| 1151 | "long name NAME", |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1152 | "Set the long GSM network name\n" NAME_CMD_STR NAME_STR) |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1153 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1154 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1155 | |
Holger Hans Peter Freyther | 3e9a7f8 | 2010-10-12 23:21:54 +0200 | [diff] [blame] | 1156 | bsc_replace_string(gsmnet, &gsmnet->name_long, argv[0]); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1157 | return CMD_SUCCESS; |
| 1158 | } |
Harald Welte | 40f8289 | 2009-05-23 17:31:39 +0000 | [diff] [blame] | 1159 | |
Harald Welte (local) | 69de397 | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 1160 | DEFUN(cfg_net_auth_policy, |
| 1161 | cfg_net_auth_policy_cmd, |
| 1162 | "auth policy (closed|accept-all|token)", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1163 | "Authentication (not cryptographic)\n" |
| 1164 | "Set the GSM network authentication policy\n" |
| 1165 | "Require the MS to be activated in HLR\n" |
| 1166 | "Accept all MS, whether in HLR or not\n" |
| 1167 | "Use SMS-token based authentication\n") |
Harald Welte (local) | 69de397 | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 1168 | { |
| 1169 | enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]); |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1170 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte (local) | 69de397 | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 1171 | |
| 1172 | gsmnet->auth_policy = policy; |
| 1173 | |
| 1174 | return CMD_SUCCESS; |
| 1175 | } |
| 1176 | |
Harald Welte | 1085c09 | 2009-11-18 20:33:19 +0100 | [diff] [blame] | 1177 | DEFUN(cfg_net_reject_cause, |
| 1178 | cfg_net_reject_cause_cmd, |
| 1179 | "location updating reject cause <2-111>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1180 | "Set the reject cause of location updating reject\n" |
| 1181 | "Set the reject cause of location updating reject\n" |
| 1182 | "Set the reject cause of location updating reject\n" |
| 1183 | "Set the reject cause of location updating reject\n" |
| 1184 | "Cause Value as Per GSM TS 04.08\n") |
Harald Welte | 1085c09 | 2009-11-18 20:33:19 +0100 | [diff] [blame] | 1185 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1186 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1187 | |
Harald Welte | 1085c09 | 2009-11-18 20:33:19 +0100 | [diff] [blame] | 1188 | gsmnet->reject_cause = atoi(argv[0]); |
| 1189 | |
| 1190 | return CMD_SUCCESS; |
| 1191 | } |
| 1192 | |
Harald Welte | 4381cfe | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 1193 | DEFUN(cfg_net_encryption, |
| 1194 | cfg_net_encryption_cmd, |
Harald Welte | ad66a2d | 2012-07-04 21:37:56 +0200 | [diff] [blame] | 1195 | "encryption a5 (0|1|2|3)", |
Harald Welte | 2832606 | 2010-05-14 20:05:17 +0200 | [diff] [blame] | 1196 | "Encryption options\n" |
| 1197 | "A5 encryption\n" "A5/0: No encryption\n" |
Harald Welte | ad66a2d | 2012-07-04 21:37:56 +0200 | [diff] [blame] | 1198 | "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n" |
| 1199 | "A5/3: 'New' Secure Encryption\n") |
Harald Welte | 4381cfe | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 1200 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1201 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1202 | |
Andreas.Eversberg | 1059deb | 2009-11-17 09:55:26 +0100 | [diff] [blame] | 1203 | gsmnet->a5_encryption= atoi(argv[0]); |
Harald Welte | 4381cfe | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 1204 | |
| 1205 | return CMD_SUCCESS; |
| 1206 | } |
| 1207 | |
Holger Hans Peter Freyther | f7d752f | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 1208 | DEFUN(cfg_net_neci, |
| 1209 | cfg_net_neci_cmd, |
| 1210 | "neci (0|1)", |
Harald Welte | 2832606 | 2010-05-14 20:05:17 +0200 | [diff] [blame] | 1211 | "New Establish Cause Indication\n" |
| 1212 | "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] | 1213 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1214 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1215 | |
Holger Hans Peter Freyther | f7d752f | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 1216 | gsmnet->neci = atoi(argv[0]); |
Holger Hans Peter Freyther | 7889107 | 2010-09-06 09:36:02 +0800 | [diff] [blame] | 1217 | gsm_net_update_ctype(gsmnet); |
Holger Hans Peter Freyther | f7d752f | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 1218 | return CMD_SUCCESS; |
| 1219 | } |
| 1220 | |
Harald Welte | eab84a1 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 1221 | DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd, |
| 1222 | "rrlp mode (none|ms-based|ms-preferred|ass-preferred)", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1223 | "Radio Resource Location Protocol\n" |
| 1224 | "Set the Radio Resource Location Protocol Mode\n" |
| 1225 | "Don't send RRLP request\n" |
| 1226 | "Request MS-based location\n" |
| 1227 | "Request any location, prefer MS-based\n" |
| 1228 | "Request any location, prefer MS-assisted\n") |
Harald Welte | eab84a1 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 1229 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1230 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1231 | |
Harald Welte | eab84a1 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 1232 | gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]); |
| 1233 | |
| 1234 | return CMD_SUCCESS; |
| 1235 | } |
| 1236 | |
Harald Welte | 648b6ce | 2009-12-14 09:00:24 +0100 | [diff] [blame] | 1237 | DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd, |
| 1238 | "mm info (0|1)", |
Holger Hans Peter Freyther | 64c17fa | 2012-07-21 00:27:10 +0200 | [diff] [blame] | 1239 | "Mobility Management\n" |
| 1240 | "Send MM INFO after LOC UPD ACCEPT\n" |
| 1241 | "Disable\n" "Enable\n") |
Harald Welte | 648b6ce | 2009-12-14 09:00:24 +0100 | [diff] [blame] | 1242 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1243 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1244 | |
Harald Welte | 648b6ce | 2009-12-14 09:00:24 +0100 | [diff] [blame] | 1245 | gsmnet->send_mm_info = atoi(argv[0]); |
| 1246 | |
| 1247 | return CMD_SUCCESS; |
| 1248 | } |
| 1249 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1250 | #define HANDOVER_STR "Handover Options\n" |
| 1251 | |
Harald Welte | bc81450 | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 1252 | DEFUN(cfg_net_handover, cfg_net_handover_cmd, |
| 1253 | "handover (0|1)", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1254 | HANDOVER_STR |
| 1255 | "Don't perform in-call handover\n" |
| 1256 | "Perform in-call handover\n") |
Harald Welte | bc81450 | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 1257 | { |
Holger Hans Peter Freyther | cbcfe24 | 2010-01-07 16:14:38 +0100 | [diff] [blame] | 1258 | int enable = atoi(argv[0]); |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1259 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Holger Hans Peter Freyther | cbcfe24 | 2010-01-07 16:14:38 +0100 | [diff] [blame] | 1260 | |
| 1261 | if (enable && ipacc_rtp_direct) { |
Harald Welte | fe03f0d | 2009-12-20 13:51:01 +0100 | [diff] [blame] | 1262 | vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode " |
| 1263 | "is enabled by using the -P command line option%s", |
| 1264 | VTY_NEWLINE); |
| 1265 | return CMD_WARNING; |
| 1266 | } |
Holger Hans Peter Freyther | cbcfe24 | 2010-01-07 16:14:38 +0100 | [diff] [blame] | 1267 | gsmnet->handover.active = enable; |
Harald Welte | bc81450 | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 1268 | |
| 1269 | return CMD_SUCCESS; |
| 1270 | } |
| 1271 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1272 | #define HO_WIN_STR HANDOVER_STR "Measurement Window\n" |
| 1273 | #define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n" |
| 1274 | #define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n" |
| 1275 | #define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n" |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1276 | #define HO_AVG_COUNT_STR "Amount to use for Averaging\n" |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1277 | |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1278 | DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd, |
| 1279 | "handover window rxlev averaging <1-10>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1280 | HO_WIN_RXLEV_STR |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1281 | "How many RxLev measurements are used for averaging\n" |
| 1282 | HO_AVG_COUNT_STR) |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1283 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1284 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1285 | gsmnet->handover.win_rxlev_avg = atoi(argv[0]); |
| 1286 | return CMD_SUCCESS; |
| 1287 | } |
| 1288 | |
| 1289 | DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd, |
| 1290 | "handover window rxqual averaging <1-10>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1291 | HO_WIN_RXQUAL_STR |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1292 | "How many RxQual measurements are used for averaging\n" |
| 1293 | HO_AVG_COUNT_STR) |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1294 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1295 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1296 | gsmnet->handover.win_rxqual_avg = atoi(argv[0]); |
| 1297 | return CMD_SUCCESS; |
| 1298 | } |
| 1299 | |
| 1300 | DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd, |
| 1301 | "handover window rxlev neighbor averaging <1-10>", |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1302 | HO_WIN_RXLEV_STR "Neighbor\n" |
| 1303 | "How many RxQual measurements are used for averaging\n" |
| 1304 | HO_AVG_COUNT_STR) |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1305 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1306 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1307 | gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]); |
| 1308 | return CMD_SUCCESS; |
| 1309 | } |
| 1310 | |
| 1311 | DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd, |
| 1312 | "handover power budget interval <1-99>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1313 | HO_PBUDGET_STR |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1314 | "How often to check if we have a better cell (SACCH frames)\n" |
| 1315 | "Interval\n" "Number\n") |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1316 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1317 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1318 | gsmnet->handover.pwr_interval = atoi(argv[0]); |
| 1319 | return CMD_SUCCESS; |
| 1320 | } |
| 1321 | |
| 1322 | DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd, |
| 1323 | "handover power budget hysteresis <0-999>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1324 | HO_PBUDGET_STR |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1325 | "How many dB does a neighbor to be stronger to become a HO candidate\n" |
| 1326 | "Hysteresis\n" "Number\n") |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1327 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1328 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1329 | gsmnet->handover.pwr_hysteresis = atoi(argv[0]); |
| 1330 | return CMD_SUCCESS; |
| 1331 | } |
| 1332 | |
| 1333 | DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd, |
| 1334 | "handover maximum distance <0-9999>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1335 | HANDOVER_STR |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1336 | "How big is the maximum timing advance before HO is forced\n" |
| 1337 | "Distance\n" "Number\n") |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1338 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1339 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1340 | gsmnet->handover.max_distance = atoi(argv[0]); |
| 1341 | return CMD_SUCCESS; |
| 1342 | } |
Harald Welte | bc81450 | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 1343 | |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 1344 | DEFUN(cfg_net_pag_any_tch, |
| 1345 | cfg_net_pag_any_tch_cmd, |
| 1346 | "paging any use tch (0|1)", |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1347 | "Assign a TCH when receiving a Paging Any request\n" |
| 1348 | "Any Channel\n" "Use\n" "TCH\n" |
| 1349 | "Do not use TCH for Paging Request Any\n" |
| 1350 | "Do use TCH for Paging Request Any\n") |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 1351 | { |
Holger Hans Peter Freyther | b0e88b8 | 2010-09-06 10:09:19 +0800 | [diff] [blame] | 1352 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 1353 | gsmnet->pag_any_tch = atoi(argv[0]); |
| 1354 | gsm_net_update_ctype(gsmnet); |
| 1355 | return CMD_SUCCESS; |
| 1356 | } |
| 1357 | |
Holger Hans Peter Freyther | c802106 | 2009-12-22 08:27:21 +0100 | [diff] [blame] | 1358 | #define DECLARE_TIMER(number, doc) \ |
Holger Hans Peter Freyther | c4d88ad | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1359 | DEFUN(cfg_net_T##number, \ |
| 1360 | cfg_net_T##number##_cmd, \ |
| 1361 | "timer t" #number " <0-65535>", \ |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1362 | "Configure GSM Timers\n" \ |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1363 | doc "Timer Value\n") \ |
Holger Hans Peter Freyther | c4d88ad | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1364 | { \ |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1365 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); \ |
Holger Hans Peter Freyther | c4d88ad | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1366 | int value = atoi(argv[0]); \ |
| 1367 | \ |
| 1368 | if (value < 0 || value > 65535) { \ |
| 1369 | vty_out(vty, "Timer value %s out of range.%s", \ |
| 1370 | argv[0], VTY_NEWLINE); \ |
| 1371 | return CMD_WARNING; \ |
| 1372 | } \ |
| 1373 | \ |
| 1374 | gsmnet->T##number = value; \ |
| 1375 | return CMD_SUCCESS; \ |
| 1376 | } |
| 1377 | |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1378 | DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.\n") |
| 1379 | DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.\n") |
Harald Welte | 67161f2 | 2012-06-03 13:01:47 +0200 | [diff] [blame] | 1380 | DECLARE_TIMER(3105, "Set the timer for repetition of PHYSICAL INFORMATION.\n") |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1381 | DECLARE_TIMER(3107, "Currently not used.\n") |
| 1382 | DECLARE_TIMER(3109, "Currently not used.\n") |
| 1383 | DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel.\n") |
| 1384 | DECLARE_TIMER(3113, "Set the time to try paging a subscriber.\n") |
| 1385 | DECLARE_TIMER(3115, "Currently not used.\n") |
| 1386 | DECLARE_TIMER(3117, "Currently not used.\n") |
| 1387 | DECLARE_TIMER(3119, "Currently not used.\n") |
| 1388 | DECLARE_TIMER(3122, "Waiting time (seconds) after IMM ASS REJECT\n") |
| 1389 | DECLARE_TIMER(3141, "Currently not used.\n") |
Holger Hans Peter Freyther | c4d88ad | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1390 | |
Holger Hans Peter Freyther | 5a3a61d | 2010-09-06 09:25:48 +0800 | [diff] [blame] | 1391 | DEFUN(cfg_net_dtx, |
| 1392 | cfg_net_dtx_cmd, |
| 1393 | "dtx-used (0|1)", |
| 1394 | "Enable the usage of DTX.\n" |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1395 | "DTX is disabled\n" "DTX is enabled\n") |
Holger Hans Peter Freyther | 5a3a61d | 2010-09-06 09:25:48 +0800 | [diff] [blame] | 1396 | { |
| 1397 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1398 | gsmnet->dtx_enabled = atoi(argv[0]); |
| 1399 | return CMD_SUCCESS; |
| 1400 | } |
Holger Hans Peter Freyther | c4d88ad | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1401 | |
Holger Hans Peter Freyther | ae9006a | 2010-12-22 16:26:04 +0100 | [diff] [blame] | 1402 | DEFUN(cfg_net_subscr_keep, |
| 1403 | cfg_net_subscr_keep_cmd, |
| 1404 | "subscriber-keep-in-ram (0|1)", |
| 1405 | "Keep unused subscribers in RAM.\n" |
| 1406 | "Delete unused subscribers\n" "Keep unused subscribers\n") |
| 1407 | { |
| 1408 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1409 | gsmnet->keep_subscr = atoi(argv[0]); |
| 1410 | return CMD_SUCCESS; |
| 1411 | } |
| 1412 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1413 | /* per-BTS configuration */ |
| 1414 | DEFUN(cfg_bts, |
| 1415 | cfg_bts_cmd, |
Harald Welte | 57e0724 | 2012-08-17 12:50:14 +0200 | [diff] [blame] | 1416 | "bts <0-255>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1417 | "Select a BTS to configure\n" |
| 1418 | "BTS Number\n") |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1419 | { |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1420 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1421 | int bts_nr = atoi(argv[0]); |
| 1422 | struct gsm_bts *bts; |
| 1423 | |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1424 | if (bts_nr > gsmnet->num_bts) { |
| 1425 | vty_out(vty, "%% The next unused BTS number is %u%s", |
| 1426 | gsmnet->num_bts, VTY_NEWLINE); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1427 | return CMD_WARNING; |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1428 | } else if (bts_nr == gsmnet->num_bts) { |
| 1429 | /* allocate a new one */ |
Harald Welte | 3300c01 | 2011-06-05 13:31:33 +0200 | [diff] [blame] | 1430 | bts = gsm_bts_alloc_register(gsmnet, GSM_BTS_TYPE_UNKNOWN, |
| 1431 | HARDCODED_TSC, HARDCODED_BSIC); |
Holger Hans Peter Freyther | acf8a0c | 2010-03-29 08:47:44 +0200 | [diff] [blame] | 1432 | } else |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1433 | bts = gsm_bts_num(gsmnet, bts_nr); |
| 1434 | |
Daniel Willmann | f15c276 | 2010-01-11 13:43:07 +0100 | [diff] [blame] | 1435 | if (!bts) { |
| 1436 | vty_out(vty, "%% Unable to allocate BTS %u%s", |
| 1437 | gsmnet->num_bts, VTY_NEWLINE); |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1438 | return CMD_WARNING; |
Daniel Willmann | f15c276 | 2010-01-11 13:43:07 +0100 | [diff] [blame] | 1439 | } |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1440 | |
| 1441 | vty->index = bts; |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 1442 | vty->index_sub = &bts->description; |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1443 | vty->node = BTS_NODE; |
| 1444 | |
| 1445 | return CMD_SUCCESS; |
| 1446 | } |
| 1447 | |
| 1448 | DEFUN(cfg_bts_type, |
| 1449 | cfg_bts_type_cmd, |
Harald Welte | e555c2b | 2012-08-17 13:02:12 +0200 | [diff] [blame] | 1450 | "type TYPE", /* dynamically created */ |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1451 | "Set the BTS type\n" "Type\n") |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1452 | { |
| 1453 | struct gsm_bts *bts = vty->index; |
Harald Welte | 39315c4 | 2010-01-10 18:01:52 +0100 | [diff] [blame] | 1454 | int rc; |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1455 | |
Harald Welte | 39315c4 | 2010-01-10 18:01:52 +0100 | [diff] [blame] | 1456 | rc = gsm_set_bts_type(bts, parse_btstype(argv[0])); |
| 1457 | if (rc < 0) |
| 1458 | return CMD_WARNING; |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1459 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1460 | return CMD_SUCCESS; |
| 1461 | } |
| 1462 | |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 1463 | DEFUN(cfg_bts_band, |
| 1464 | cfg_bts_band_cmd, |
| 1465 | "band BAND", |
Holger Hans Peter Freyther | 0854256 | 2011-10-03 23:42:06 +0200 | [diff] [blame] | 1466 | "Set the frequency band of this BTS\n" "Frequency band\n") |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 1467 | { |
| 1468 | struct gsm_bts *bts = vty->index; |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1469 | int band = gsm_band_parse(argv[0]); |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 1470 | |
| 1471 | if (band < 0) { |
| 1472 | vty_out(vty, "%% BAND %d is not a valid GSM band%s", |
| 1473 | band, VTY_NEWLINE); |
| 1474 | return CMD_WARNING; |
| 1475 | } |
| 1476 | |
| 1477 | bts->band = band; |
| 1478 | |
| 1479 | return CMD_SUCCESS; |
| 1480 | } |
| 1481 | |
Holger Hans Peter Freyther | c4a49e3 | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 1482 | DEFUN(cfg_bts_ci, |
| 1483 | cfg_bts_ci_cmd, |
| 1484 | "cell_identity <0-65535>", |
Holger Hans Peter Freyther | 64c17fa | 2012-07-21 00:27:10 +0200 | [diff] [blame] | 1485 | "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] | 1486 | { |
| 1487 | struct gsm_bts *bts = vty->index; |
| 1488 | int ci = atoi(argv[0]); |
| 1489 | |
| 1490 | if (ci < 0 || ci > 0xffff) { |
| 1491 | vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s", |
| 1492 | ci, VTY_NEWLINE); |
| 1493 | return CMD_WARNING; |
| 1494 | } |
| 1495 | bts->cell_identity = ci; |
| 1496 | |
| 1497 | return CMD_SUCCESS; |
| 1498 | } |
| 1499 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1500 | DEFUN(cfg_bts_lac, |
| 1501 | cfg_bts_lac_cmd, |
Holger Hans Peter Freyther | 0b7f4b3 | 2009-09-29 14:02:33 +0200 | [diff] [blame] | 1502 | "location_area_code <0-65535>", |
Holger Hans Peter Freyther | 64c17fa | 2012-07-21 00:27:10 +0200 | [diff] [blame] | 1503 | "Set the Location Area Code (LAC) of this BTS\n" "LAC\n") |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1504 | { |
| 1505 | struct gsm_bts *bts = vty->index; |
| 1506 | int lac = atoi(argv[0]); |
| 1507 | |
Holger Hans Peter Freyther | 0b7f4b3 | 2009-09-29 14:02:33 +0200 | [diff] [blame] | 1508 | if (lac < 0 || lac > 0xffff) { |
| 1509 | 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] | 1510 | lac, VTY_NEWLINE); |
| 1511 | return CMD_WARNING; |
| 1512 | } |
Holger Hans Peter Freyther | e48b956 | 2009-10-01 04:07:15 +0200 | [diff] [blame] | 1513 | |
| 1514 | if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) { |
| 1515 | vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s", |
| 1516 | lac, VTY_NEWLINE); |
| 1517 | return CMD_WARNING; |
| 1518 | } |
| 1519 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1520 | bts->location_area_code = lac; |
| 1521 | |
| 1522 | return CMD_SUCCESS; |
| 1523 | } |
| 1524 | |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 1525 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1526 | DEFUN(cfg_bts_tsc, |
| 1527 | cfg_bts_tsc_cmd, |
Harald Welte | c513ded | 2012-05-31 10:57:08 +0200 | [diff] [blame] | 1528 | "training_sequence_code <0-7>", |
Holger Hans Peter Freyther | 64c17fa | 2012-07-21 00:27:10 +0200 | [diff] [blame] | 1529 | "Set the Training Sequence Code (TSC) of this BTS\n" "TSC\n") |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1530 | { |
| 1531 | struct gsm_bts *bts = vty->index; |
| 1532 | int tsc = atoi(argv[0]); |
| 1533 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1534 | bts->tsc = tsc; |
| 1535 | |
| 1536 | return CMD_SUCCESS; |
| 1537 | } |
| 1538 | |
Harald Welte | 78f2f50 | 2009-05-23 16:56:52 +0000 | [diff] [blame] | 1539 | DEFUN(cfg_bts_bsic, |
| 1540 | cfg_bts_bsic_cmd, |
| 1541 | "base_station_id_code <0-63>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1542 | "Set the Base Station Identity Code (BSIC) of this BTS\n" |
| 1543 | "BSIC of this BTS\n") |
Harald Welte | 78f2f50 | 2009-05-23 16:56:52 +0000 | [diff] [blame] | 1544 | { |
| 1545 | struct gsm_bts *bts = vty->index; |
| 1546 | int bsic = atoi(argv[0]); |
| 1547 | |
| 1548 | if (bsic < 0 || bsic > 0x3f) { |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1549 | 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] | 1550 | bsic, VTY_NEWLINE); |
| 1551 | return CMD_WARNING; |
| 1552 | } |
| 1553 | bts->bsic = bsic; |
| 1554 | |
| 1555 | return CMD_SUCCESS; |
| 1556 | } |
| 1557 | |
Gus Bourg | 1c5dd2c | 2011-12-02 10:18:17 +0100 | [diff] [blame] | 1558 | DEFUN(cfg_bts_timezone, |
| 1559 | cfg_bts_timezone_cmd, |
| 1560 | "timezone <-19-19> (0|15|30|45)", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1561 | "Set the Timezone Offset of this BTS\n" |
| 1562 | "Timezone offset (hours)\n" |
| 1563 | "Timezone offset (00 minutes)\n" |
| 1564 | "Timezone offset (15 minutes)\n" |
| 1565 | "Timezone offset (30 minutes)\n" |
Harald Welte | d13e0cd | 2012-08-17 09:52:03 +0200 | [diff] [blame] | 1566 | "Timezone offset (45 minutes)\n" |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1567 | ) |
Gus Bourg | 1c5dd2c | 2011-12-02 10:18:17 +0100 | [diff] [blame] | 1568 | { |
| 1569 | struct gsm_bts *bts = vty->index; |
| 1570 | int tzhr = atoi(argv[0]); |
| 1571 | int tzmn = atoi(argv[1]); |
| 1572 | |
Harald Welte | 45f9171 | 2012-07-08 16:48:11 +0200 | [diff] [blame] | 1573 | bts->tz.hr = tzhr; |
| 1574 | bts->tz.mn = tzmn; |
| 1575 | bts->tz.override = 1; |
Gus Bourg | 1c5dd2c | 2011-12-02 10:18:17 +0100 | [diff] [blame] | 1576 | |
| 1577 | return CMD_SUCCESS; |
| 1578 | } |
| 1579 | |
| 1580 | DEFUN(cfg_bts_no_timezone, |
| 1581 | cfg_bts_no_timezone_cmd, |
| 1582 | "no timezone", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1583 | NO_STR |
| 1584 | "Disable BTS specific timezone\n") |
Gus Bourg | 1c5dd2c | 2011-12-02 10:18:17 +0100 | [diff] [blame] | 1585 | { |
| 1586 | struct gsm_bts *bts = vty->index; |
Harald Welte | 45f9171 | 2012-07-08 16:48:11 +0200 | [diff] [blame] | 1587 | |
| 1588 | bts->tz.override = 0; |
| 1589 | |
Gus Bourg | 1c5dd2c | 2011-12-02 10:18:17 +0100 | [diff] [blame] | 1590 | return CMD_SUCCESS; |
| 1591 | } |
Harald Welte | 78f2f50 | 2009-05-23 16:56:52 +0000 | [diff] [blame] | 1592 | |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 1593 | DEFUN(cfg_bts_unit_id, |
| 1594 | cfg_bts_unit_id_cmd, |
Harald Welte | 07dc73d | 2009-08-07 13:27:09 +0200 | [diff] [blame] | 1595 | "ip.access unit_id <0-65534> <0-255>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1596 | "Abis/IP specific options\n" |
| 1597 | "Set the IPA BTS Unit ID\n" |
| 1598 | "Unit ID (Site)\n" |
| 1599 | "Unit ID (BTS)\n") |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 1600 | { |
| 1601 | struct gsm_bts *bts = vty->index; |
| 1602 | int site_id = atoi(argv[0]); |
| 1603 | int bts_id = atoi(argv[1]); |
| 1604 | |
Harald Welte | 07dc73d | 2009-08-07 13:27:09 +0200 | [diff] [blame] | 1605 | if (!is_ipaccess_bts(bts)) { |
| 1606 | vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE); |
| 1607 | return CMD_WARNING; |
| 1608 | } |
| 1609 | |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 1610 | bts->ip_access.site_id = site_id; |
| 1611 | bts->ip_access.bts_id = bts_id; |
| 1612 | |
| 1613 | return CMD_SUCCESS; |
| 1614 | } |
| 1615 | |
Harald Welte | fd355a3 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 1616 | DEFUN(cfg_bts_serno, |
| 1617 | cfg_bts_serno_cmd, |
| 1618 | "hsl serial-number STRING", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1619 | "HSL BTS specific options\n" |
| 1620 | "Set the HSL Serial Number of this BTS\n" |
| 1621 | "Serial Number of this HSL BTS\n") |
Harald Welte | fd355a3 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 1622 | { |
| 1623 | struct gsm_bts *bts = vty->index; |
| 1624 | |
| 1625 | if (bts->type != GSM_BTS_TYPE_HSL_FEMTO) { |
| 1626 | vty_out(vty, "%% BTS is not of HSL type%s", VTY_NEWLINE); |
| 1627 | return CMD_WARNING; |
| 1628 | } |
| 1629 | |
| 1630 | bts->hsl.serno = strtoul(argv[0], NULL, 10); |
| 1631 | |
| 1632 | return CMD_SUCCESS; |
| 1633 | } |
| 1634 | |
Sylvain Munaut | c951946 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 1635 | DEFUN(cfg_bts_nokia_site_skip_reset, |
| 1636 | cfg_bts_nokia_site_skip_reset_cmd, |
| 1637 | "nokia_site skip-reset (0|1)", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1638 | "Nokia *Site related commands\n" |
| 1639 | "Skip the reset step during bootstrap process of this BTS\n" |
| 1640 | "Do NOT skip the reset\n" "Skip the reset\n") |
Sylvain Munaut | c951946 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 1641 | { |
| 1642 | struct gsm_bts *bts = vty->index; |
| 1643 | |
| 1644 | if (bts->type != GSM_BTS_TYPE_NOKIA_SITE) { |
| 1645 | vty_out(vty, "%% BTS is not of Nokia *Site type%s", VTY_NEWLINE); |
| 1646 | return CMD_WARNING; |
| 1647 | } |
| 1648 | |
| 1649 | bts->nokia.skip_reset = atoi(argv[0]); |
| 1650 | |
| 1651 | return CMD_SUCCESS; |
| 1652 | } |
| 1653 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1654 | #define OML_STR "Organization & Maintenance Link\n" |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1655 | #define IPA_STR "A-bis/IP Specific Options\n" |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1656 | |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1657 | DEFUN(cfg_bts_stream_id, |
| 1658 | cfg_bts_stream_id_cmd, |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 1659 | "oml ip.access stream_id <0-255> line E1_LINE", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1660 | OML_STR IPA_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1661 | "Set the ip.access Stream ID of the OML link of this BTS\n" |
| 1662 | "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] | 1663 | { |
| 1664 | struct gsm_bts *bts = vty->index; |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 1665 | int stream_id = atoi(argv[0]), linenr = atoi(argv[1]); |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1666 | |
| 1667 | if (!is_ipaccess_bts(bts)) { |
| 1668 | vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE); |
| 1669 | return CMD_WARNING; |
| 1670 | } |
| 1671 | |
| 1672 | bts->oml_tei = stream_id; |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 1673 | /* This is used by e1inp_bind_ops callback for each BTS model. */ |
| 1674 | bts->oml_e1_link.e1_nr = linenr; |
| 1675 | |
| 1676 | return CMD_SUCCESS; |
| 1677 | } |
| 1678 | |
| 1679 | DEFUN(cfg_bts_hsl_oml, |
| 1680 | cfg_bts_hsl_oml_cmd, |
| 1681 | "oml hsl line E1_LINE", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1682 | OML_STR "HSL femto Specific Options\n" |
Harald Welte | 13fe219 | 2012-08-17 09:57:25 +0200 | [diff] [blame] | 1683 | "Set OML link of this HSL femto BTS\n" |
| 1684 | "Virtual E1/T1 line number\n") |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 1685 | { |
| 1686 | struct gsm_bts *bts = vty->index; |
| 1687 | int linenr = atoi(argv[0]); |
| 1688 | |
| 1689 | if (!(bts->type == GSM_BTS_TYPE_HSL_FEMTO)) { |
| 1690 | vty_out(vty, "%% BTS is not of HSL type%s", VTY_NEWLINE); |
| 1691 | return CMD_WARNING; |
| 1692 | } |
| 1693 | |
| 1694 | bts->oml_e1_link.e1_nr = linenr; |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1695 | |
| 1696 | return CMD_SUCCESS; |
| 1697 | } |
| 1698 | |
Harald Welte | d13e0cd | 2012-08-17 09:52:03 +0200 | [diff] [blame] | 1699 | #define OML_E1_STR OML_STR "OML E1/T1 Configuration\n" |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1700 | |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1701 | DEFUN(cfg_bts_oml_e1, |
| 1702 | cfg_bts_oml_e1_cmd, |
| 1703 | "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] | 1704 | OML_E1_STR |
| 1705 | "E1/T1 line number to be used for OML\n" |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1706 | "E1/T1 line number to be used for OML\n" |
| 1707 | "E1/T1 timeslot to be used for OML\n" |
| 1708 | "E1/T1 timeslot to be used for OML\n" |
| 1709 | "E1/T1 sub-slot to be used for OML\n" |
| 1710 | "Use E1/T1 sub-slot 0\n" |
| 1711 | "Use E1/T1 sub-slot 1\n" |
| 1712 | "Use E1/T1 sub-slot 2\n" |
| 1713 | "Use E1/T1 sub-slot 3\n" |
| 1714 | "Use full E1 slot 3\n" |
| 1715 | ) |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1716 | { |
| 1717 | struct gsm_bts *bts = vty->index; |
| 1718 | |
| 1719 | parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]); |
| 1720 | |
| 1721 | return CMD_SUCCESS; |
| 1722 | } |
| 1723 | |
| 1724 | |
| 1725 | DEFUN(cfg_bts_oml_e1_tei, |
| 1726 | cfg_bts_oml_e1_tei_cmd, |
| 1727 | "oml e1 tei <0-63>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1728 | OML_E1_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1729 | "Set the TEI to be used for OML\n" |
| 1730 | "TEI Number\n") |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1731 | { |
| 1732 | struct gsm_bts *bts = vty->index; |
| 1733 | |
| 1734 | bts->oml_tei = atoi(argv[0]); |
| 1735 | |
| 1736 | return CMD_SUCCESS; |
| 1737 | } |
| 1738 | |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 1739 | DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd, |
| 1740 | "channel allocator (ascending|descending)", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1741 | "Channnel Allocator\n" "Channel Allocator\n" |
| 1742 | "Allocate Timeslots and Transceivers in ascending order\n" |
| 1743 | "Allocate Timeslots and Transceivers in descending order\n") |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 1744 | { |
| 1745 | struct gsm_bts *bts = vty->index; |
| 1746 | |
| 1747 | if (!strcmp(argv[0], "ascending")) |
| 1748 | bts->chan_alloc_reverse = 0; |
| 1749 | else |
| 1750 | bts->chan_alloc_reverse = 1; |
| 1751 | |
| 1752 | return CMD_SUCCESS; |
| 1753 | } |
| 1754 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1755 | #define RACH_STR "Random Access Control Channel\n" |
| 1756 | |
Sylvain Munaut | 4010f1e | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 1757 | DEFUN(cfg_bts_rach_tx_integer, |
| 1758 | cfg_bts_rach_tx_integer_cmd, |
| 1759 | "rach tx integer <0-15>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1760 | RACH_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1761 | "Set the raw tx integer value in RACH Control parameters IE\n" |
| 1762 | "Set the raw tx integer value in RACH Control parameters IE\n" |
| 1763 | "Raw tx integer value in RACH Control parameters IE\n") |
Sylvain Munaut | 4010f1e | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 1764 | { |
| 1765 | struct gsm_bts *bts = vty->index; |
| 1766 | bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf; |
| 1767 | return CMD_SUCCESS; |
| 1768 | } |
| 1769 | |
| 1770 | DEFUN(cfg_bts_rach_max_trans, |
| 1771 | cfg_bts_rach_max_trans_cmd, |
| 1772 | "rach max transmission (1|2|4|7)", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1773 | RACH_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1774 | "Set the maximum number of RACH burst transmissions\n" |
| 1775 | "Set the maximum number of RACH burst transmissions\n" |
Harald Welte | d13e0cd | 2012-08-17 09:52:03 +0200 | [diff] [blame] | 1776 | "Maximum number of 1 RACH burst transmissions\n" |
| 1777 | "Maximum number of 2 RACH burst transmissions\n" |
| 1778 | "Maximum number of 4 RACH burst transmissions\n" |
| 1779 | "Maximum number of 7 RACH burst transmissions\n") |
Sylvain Munaut | 4010f1e | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 1780 | { |
| 1781 | struct gsm_bts *bts = vty->index; |
| 1782 | bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0])); |
| 1783 | return CMD_SUCCESS; |
| 1784 | } |
| 1785 | |
Andreas Eversberg | 2ee7ecd | 2012-10-13 07:27:47 +0200 | [diff] [blame] | 1786 | #define CD_STR "Channel Description\n" |
| 1787 | |
| 1788 | DEFUN(cfg_bts_chan_desc_att, |
| 1789 | cfg_bts_chan_desc_att_cmd, |
| 1790 | "channel-descrption attach (0|1)", |
| 1791 | CD_STR |
| 1792 | "Set if attachment is required\n" |
| 1793 | "Attachment is NOT required\n" |
| 1794 | "Attachment is required (standard)\n") |
| 1795 | { |
| 1796 | struct gsm_bts *bts = vty->index; |
| 1797 | bts->si_common.chan_desc.att = atoi(argv[0]); |
| 1798 | return CMD_SUCCESS; |
| 1799 | } |
| 1800 | |
| 1801 | DEFUN(cfg_bts_chan_desc_bs_pa_mfrms, |
| 1802 | cfg_bts_chan_desc_bs_pa_mfrms_cmd, |
| 1803 | "channel-descrption bs-pa-mfrms <2-9>", |
| 1804 | CD_STR |
| 1805 | "Set number of multiframe periods for paging groups\n" |
| 1806 | "Number of multiframe periods for paging groups\n") |
| 1807 | { |
| 1808 | struct gsm_bts *bts = vty->index; |
| 1809 | int bs_pa_mfrms = atoi(argv[0]); |
| 1810 | |
| 1811 | bts->si_common.chan_desc.bs_pa_mfrms = bs_pa_mfrms - 2; |
| 1812 | return CMD_SUCCESS; |
| 1813 | } |
| 1814 | |
| 1815 | DEFUN(cfg_bts_chan_desc_bs_ag_blks_res, |
| 1816 | cfg_bts_chan_desc_bs_ag_blks_res_cmd, |
| 1817 | "channel-descrption bs-ag-blks-res <0-7>", |
| 1818 | CD_STR |
| 1819 | "Set number of blocks reserved for access grant\n" |
| 1820 | "Number of blocks reserved for access grant\n") |
| 1821 | { |
| 1822 | struct gsm_bts *bts = vty->index; |
| 1823 | int bs_ag_blks_res = atoi(argv[0]); |
| 1824 | |
| 1825 | bts->si_common.chan_desc.bs_ag_blks_res = bs_ag_blks_res; |
| 1826 | return CMD_SUCCESS; |
| 1827 | } |
| 1828 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1829 | #define NM_STR "Network Management\n" |
| 1830 | |
Holger Hans Peter Freyther | 95c2290 | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 1831 | DEFUN(cfg_bts_rach_nm_b_thresh, |
| 1832 | cfg_bts_rach_nm_b_thresh_cmd, |
| 1833 | "rach nm busy threshold <0-255>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1834 | RACH_STR NM_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1835 | "Set the NM Busy Threshold\n" |
| 1836 | "Set the NM Busy Threshold\n" |
| 1837 | "NM Busy Threshold in dB") |
Holger Hans Peter Freyther | 95c2290 | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 1838 | { |
| 1839 | struct gsm_bts *bts = vty->index; |
| 1840 | bts->rach_b_thresh = atoi(argv[0]); |
| 1841 | return CMD_SUCCESS; |
| 1842 | } |
| 1843 | |
| 1844 | DEFUN(cfg_bts_rach_nm_ldavg, |
| 1845 | cfg_bts_rach_nm_ldavg_cmd, |
| 1846 | "rach nm load average <0-65535>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1847 | RACH_STR NM_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1848 | "Set the NM Loadaverage Slots value\n" |
| 1849 | "Set the NM Loadaverage Slots value\n" |
| 1850 | "NM Loadaverage Slots value\n") |
Holger Hans Peter Freyther | 95c2290 | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 1851 | { |
| 1852 | struct gsm_bts *bts = vty->index; |
| 1853 | bts->rach_ldavg_slots = atoi(argv[0]); |
| 1854 | return CMD_SUCCESS; |
| 1855 | } |
| 1856 | |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 1857 | DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd, |
| 1858 | "cell barred (0|1)", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1859 | "Should this cell be barred from access?\n" |
| 1860 | "Should this cell be barred from access?\n" |
| 1861 | "Cell should NOT be barred\n" |
| 1862 | "Cell should be barred\n") |
| 1863 | |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 1864 | { |
| 1865 | struct gsm_bts *bts = vty->index; |
| 1866 | |
Harald Welte | 7135501 | 2009-12-21 23:08:18 +0100 | [diff] [blame] | 1867 | bts->si_common.rach_control.cell_bar = atoi(argv[0]); |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 1868 | |
| 1869 | return CMD_SUCCESS; |
| 1870 | } |
| 1871 | |
Holger Hans Peter Freyther | 3a0a463 | 2010-05-14 00:39:19 +0800 | [diff] [blame] | 1872 | DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd, |
| 1873 | "rach emergency call allowed (0|1)", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1874 | RACH_STR |
| 1875 | "Should this cell allow emergency calls?\n" |
| 1876 | "Should this cell allow emergency calls?\n" |
| 1877 | "Should this cell allow emergency calls?\n" |
| 1878 | "Do NOT allow emergency calls\n" |
| 1879 | "Allow emergency calls\n") |
Holger Hans Peter Freyther | 3a0a463 | 2010-05-14 00:39:19 +0800 | [diff] [blame] | 1880 | { |
| 1881 | struct gsm_bts *bts = vty->index; |
| 1882 | |
| 1883 | if (atoi(argv[0]) == 0) |
| 1884 | bts->si_common.rach_control.t2 |= 0x4; |
| 1885 | else |
| 1886 | bts->si_common.rach_control.t2 &= ~0x4; |
| 1887 | |
| 1888 | return CMD_SUCCESS; |
| 1889 | } |
| 1890 | |
Harald Welte (local) | 0e451d0 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 1891 | DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd, |
| 1892 | "ms max power <0-40>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1893 | "MS Options\n" |
Harald Welte | d13e0cd | 2012-08-17 09:52:03 +0200 | [diff] [blame] | 1894 | "Maximum transmit power of the MS\n" |
| 1895 | "Maximum transmit power of the MS\n" |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1896 | "Maximum transmit power of the MS in dBm") |
Harald Welte (local) | 0e451d0 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 1897 | { |
| 1898 | struct gsm_bts *bts = vty->index; |
| 1899 | |
| 1900 | bts->ms_max_power = atoi(argv[0]); |
| 1901 | |
| 1902 | return CMD_SUCCESS; |
| 1903 | } |
| 1904 | |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1905 | #define CELL_STR "Cell Parameters\n" |
| 1906 | |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 1907 | DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd, |
| 1908 | "cell reselection hysteresis <0-14>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1909 | CELL_STR "Cell re-selection parameters\n" |
| 1910 | "Cell Re-Selection Hysteresis in dB\n" |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 1911 | "Cell Re-Selection Hysteresis in dB") |
| 1912 | { |
| 1913 | struct gsm_bts *bts = vty->index; |
| 1914 | |
| 1915 | bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2; |
| 1916 | |
| 1917 | return CMD_SUCCESS; |
| 1918 | } |
| 1919 | |
| 1920 | DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd, |
| 1921 | "rxlev access min <0-63>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1922 | "Minimum RxLev needed for cell access\n" |
| 1923 | "Minimum RxLev needed for cell access\n" |
| 1924 | "Minimum RxLev needed for cell access\n" |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 1925 | "Minimum RxLev needed for cell access (better than -110dBm)") |
| 1926 | { |
| 1927 | struct gsm_bts *bts = vty->index; |
| 1928 | |
| 1929 | bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]); |
| 1930 | |
| 1931 | return CMD_SUCCESS; |
| 1932 | } |
| 1933 | |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 1934 | DEFUN(cfg_bts_cell_bar_qualify, cfg_bts_cell_bar_qualify_cmd, |
| 1935 | "cell bar qualify (0|1)", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1936 | CELL_STR "Cell Bar Qualify\n" "Cell Bar Qualify\n" |
| 1937 | "Set CBQ to 0\n" "Set CBQ to 1\n") |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 1938 | { |
| 1939 | struct gsm_bts *bts = vty->index; |
| 1940 | |
| 1941 | bts->si_common.cell_ro_sel_par.present = 1; |
| 1942 | bts->si_common.cell_ro_sel_par.cbq = atoi(argv[0]); |
| 1943 | |
| 1944 | return CMD_SUCCESS; |
| 1945 | } |
| 1946 | |
| 1947 | DEFUN(cfg_bts_cell_resel_ofs, cfg_bts_cell_resel_ofs_cmd, |
| 1948 | "cell reselection offset <0-126>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1949 | CELL_STR "Cell Re-Selection Parameters\n" |
| 1950 | "Cell Re-Selection Offset (CRO) in dB\n" |
| 1951 | "Cell Re-Selection Offset (CRO) in dB\n" |
| 1952 | ) |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 1953 | { |
| 1954 | struct gsm_bts *bts = vty->index; |
| 1955 | |
| 1956 | bts->si_common.cell_ro_sel_par.present = 1; |
| 1957 | bts->si_common.cell_ro_sel_par.cell_resel_off = atoi(argv[0])/2; |
| 1958 | |
| 1959 | return CMD_SUCCESS; |
| 1960 | } |
| 1961 | |
| 1962 | DEFUN(cfg_bts_temp_ofs, cfg_bts_temp_ofs_cmd, |
| 1963 | "temporary offset <0-60>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1964 | "Cell selection temporary negative offset\n" |
| 1965 | "Cell selection temporary negative offset\n" |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 1966 | "Cell selection temporary negative offset in dB") |
| 1967 | { |
| 1968 | struct gsm_bts *bts = vty->index; |
| 1969 | |
| 1970 | bts->si_common.cell_ro_sel_par.present = 1; |
| 1971 | bts->si_common.cell_ro_sel_par.temp_offs = atoi(argv[0])/10; |
| 1972 | |
| 1973 | return CMD_SUCCESS; |
| 1974 | } |
| 1975 | |
| 1976 | DEFUN(cfg_bts_temp_ofs_inf, cfg_bts_temp_ofs_inf_cmd, |
| 1977 | "temporary offset infinite", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1978 | "Cell selection temporary negative offset\n" |
| 1979 | "Cell selection temporary negative offset\n" |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 1980 | "Sets cell selection temporary negative offset to infinity") |
| 1981 | { |
| 1982 | struct gsm_bts *bts = vty->index; |
| 1983 | |
| 1984 | bts->si_common.cell_ro_sel_par.present = 1; |
| 1985 | bts->si_common.cell_ro_sel_par.temp_offs = 7; |
| 1986 | |
| 1987 | return CMD_SUCCESS; |
| 1988 | } |
| 1989 | |
| 1990 | DEFUN(cfg_bts_penalty_time, cfg_bts_penalty_time_cmd, |
| 1991 | "penalty time <20-620>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 1992 | "Cell selection penalty time\n" |
| 1993 | "Cell selection penalty time\n" |
| 1994 | "Cell selection penalty time in seconds (by 20s increments)\n") |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 1995 | { |
| 1996 | struct gsm_bts *bts = vty->index; |
| 1997 | |
| 1998 | bts->si_common.cell_ro_sel_par.present = 1; |
| 1999 | bts->si_common.cell_ro_sel_par.penalty_time = (atoi(argv[0])-20)/20; |
| 2000 | |
| 2001 | return CMD_SUCCESS; |
| 2002 | } |
| 2003 | |
| 2004 | DEFUN(cfg_bts_penalty_time_rsvd, cfg_bts_penalty_time_rsvd_cmd, |
| 2005 | "penalty time reserved", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2006 | "Cell selection penalty time\n" |
| 2007 | "Cell selection penalty time\n" |
| 2008 | "Set cell selection penalty time to reserved value 31, " |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 2009 | "(indicate that CELL_RESELECT_OFFSET is subtracted from C2 " |
| 2010 | "and TEMPORARY_OFFSET is ignored)") |
| 2011 | { |
| 2012 | struct gsm_bts *bts = vty->index; |
| 2013 | |
| 2014 | bts->si_common.cell_ro_sel_par.present = 1; |
| 2015 | bts->si_common.cell_ro_sel_par.penalty_time = 31; |
| 2016 | |
| 2017 | return CMD_SUCCESS; |
| 2018 | } |
| 2019 | |
Harald Welte (local) | efc9231 | 2009-08-14 23:09:25 +0200 | [diff] [blame] | 2020 | DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd, |
| 2021 | "periodic location update <0-1530>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2022 | "Periodic Location Updating Interval\n" |
| 2023 | "Periodic Location Updating Interval\n" |
| 2024 | "Periodic Location Updating Interval\n" |
| 2025 | "Periodic Location Updating Interval in Minutes\n") |
Harald Welte (local) | efc9231 | 2009-08-14 23:09:25 +0200 | [diff] [blame] | 2026 | { |
| 2027 | struct gsm_bts *bts = vty->index; |
| 2028 | |
Dieter Spaar | d6613e0 | 2010-10-05 21:10:55 +0200 | [diff] [blame] | 2029 | bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 6; |
Harald Welte (local) | efc9231 | 2009-08-14 23:09:25 +0200 | [diff] [blame] | 2030 | |
| 2031 | return CMD_SUCCESS; |
| 2032 | } |
| 2033 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2034 | #define GPRS_TEXT "GPRS Packet Network\n" |
| 2035 | |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2036 | DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd, |
Harald Welte | 57ba7e3 | 2010-04-18 14:00:26 +0200 | [diff] [blame] | 2037 | "gprs cell bvci <2-65535>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2038 | GPRS_TEXT |
| 2039 | "GPRS Cell Settings\n" |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2040 | "GPRS BSSGP VC Identifier\n" |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2041 | "GPRS BSSGP VC Identifier") |
| 2042 | { |
| 2043 | struct gsm_bts *bts = vty->index; |
| 2044 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2045 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | 9403670 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2046 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2047 | return CMD_WARNING; |
| 2048 | } |
| 2049 | |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2050 | bts->gprs.cell.bvci = atoi(argv[0]); |
| 2051 | |
| 2052 | return CMD_SUCCESS; |
| 2053 | } |
| 2054 | |
Harald Welte | a5731cf | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 2055 | DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd, |
| 2056 | "gprs nsei <0-65535>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2057 | GPRS_TEXT |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2058 | "GPRS NS Entity Identifier\n" |
Harald Welte | a5731cf | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 2059 | "GPRS NS Entity Identifier") |
| 2060 | { |
| 2061 | struct gsm_bts *bts = vty->index; |
| 2062 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2063 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | a5731cf | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 2064 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2065 | return CMD_WARNING; |
| 2066 | } |
| 2067 | |
| 2068 | bts->gprs.nse.nsei = atoi(argv[0]); |
| 2069 | |
| 2070 | return CMD_SUCCESS; |
| 2071 | } |
| 2072 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2073 | #define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \ |
| 2074 | "NSVC Logical Number\n" |
Harald Welte | a5731cf | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 2075 | |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2076 | DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd, |
| 2077 | "gprs nsvc <0-1> nsvci <0-65535>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2078 | GPRS_TEXT NSVC_TEXT |
| 2079 | "NS Virtual Connection Identifier\n" |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2080 | "GPRS NS VC Identifier") |
| 2081 | { |
| 2082 | struct gsm_bts *bts = vty->index; |
| 2083 | int idx = atoi(argv[0]); |
| 2084 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2085 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | 9403670 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2086 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2087 | return CMD_WARNING; |
| 2088 | } |
| 2089 | |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2090 | bts->gprs.nsvc[idx].nsvci = atoi(argv[1]); |
| 2091 | |
| 2092 | return CMD_SUCCESS; |
| 2093 | } |
| 2094 | |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2095 | DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd, |
| 2096 | "gprs nsvc <0-1> local udp port <0-65535>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2097 | GPRS_TEXT NSVC_TEXT |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2098 | "GPRS NS Local UDP Port\n" |
| 2099 | "GPRS NS Local UDP Port\n" |
| 2100 | "GPRS NS Local UDP Port\n" |
Harald Welte | 13fe219 | 2012-08-17 09:57:25 +0200 | [diff] [blame] | 2101 | "GPRS NS Local UDP Port Number\n") |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2102 | { |
| 2103 | struct gsm_bts *bts = vty->index; |
| 2104 | int idx = atoi(argv[0]); |
| 2105 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2106 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | 9403670 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2107 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2108 | return CMD_WARNING; |
| 2109 | } |
| 2110 | |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2111 | bts->gprs.nsvc[idx].local_port = atoi(argv[1]); |
| 2112 | |
| 2113 | return CMD_SUCCESS; |
| 2114 | } |
| 2115 | |
| 2116 | DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd, |
| 2117 | "gprs nsvc <0-1> remote udp port <0-65535>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2118 | GPRS_TEXT NSVC_TEXT |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2119 | "GPRS NS Remote UDP Port\n" |
| 2120 | "GPRS NS Remote UDP Port\n" |
Harald Welte | 13fe219 | 2012-08-17 09:57:25 +0200 | [diff] [blame] | 2121 | "GPRS NS Remote UDP Port\n" |
| 2122 | "GPRS NS Remote UDP Port Number\n") |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2123 | { |
| 2124 | struct gsm_bts *bts = vty->index; |
| 2125 | int idx = atoi(argv[0]); |
| 2126 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2127 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | 9403670 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2128 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2129 | return CMD_WARNING; |
| 2130 | } |
| 2131 | |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2132 | bts->gprs.nsvc[idx].remote_port = atoi(argv[1]); |
| 2133 | |
| 2134 | return CMD_SUCCESS; |
| 2135 | } |
| 2136 | |
| 2137 | DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd, |
| 2138 | "gprs nsvc <0-1> remote ip A.B.C.D", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2139 | GPRS_TEXT NSVC_TEXT |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2140 | "GPRS NS Remote IP Address\n" |
| 2141 | "GPRS NS Remote IP Address\n" |
| 2142 | "GPRS NS Remote IP Address\n") |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2143 | { |
| 2144 | struct gsm_bts *bts = vty->index; |
| 2145 | int idx = atoi(argv[0]); |
| 2146 | struct in_addr ia; |
| 2147 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2148 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | 9403670 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2149 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2150 | return CMD_WARNING; |
| 2151 | } |
| 2152 | |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2153 | inet_aton(argv[1], &ia); |
| 2154 | bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr); |
| 2155 | |
| 2156 | return CMD_SUCCESS; |
| 2157 | } |
| 2158 | |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 2159 | DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd, |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2160 | "paging free <-1-1024>", |
| 2161 | "Paging options\n" |
| 2162 | "Only page when having a certain amount of free slots\n" |
| 2163 | "amount of required free paging slots. -1 to disable\n") |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 2164 | { |
| 2165 | struct gsm_bts *bts = vty->index; |
| 2166 | |
| 2167 | bts->paging.free_chans_need = atoi(argv[0]); |
| 2168 | return CMD_SUCCESS; |
| 2169 | } |
| 2170 | |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 2171 | DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd, |
| 2172 | "gprs ns timer " NS_TIMERS " <0-255>", |
| 2173 | GPRS_TEXT "Network Service\n" |
| 2174 | "Network Service Timer\n" |
| 2175 | NS_TIMERS_HELP "Timer Value\n") |
| 2176 | { |
| 2177 | struct gsm_bts *bts = vty->index; |
| 2178 | int idx = get_string_value(gprs_ns_timer_strs, argv[0]); |
| 2179 | int val = atoi(argv[1]); |
| 2180 | |
| 2181 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
| 2182 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2183 | return CMD_WARNING; |
| 2184 | } |
| 2185 | |
| 2186 | if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer)) |
| 2187 | return CMD_WARNING; |
| 2188 | |
| 2189 | bts->gprs.nse.timer[idx] = val; |
| 2190 | |
| 2191 | return CMD_SUCCESS; |
| 2192 | } |
| 2193 | |
| 2194 | #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] | 2195 | #define BSSGP_TIMERS_HELP \ |
| 2196 | "Tbvc-block timeout\n" \ |
| 2197 | "Tbvc-block retries\n" \ |
| 2198 | "Tbvc-unblock retries\n" \ |
| 2199 | "Tbvcc-reset timeout\n" \ |
| 2200 | "Tbvc-reset retries\n" \ |
| 2201 | "Tbvc-suspend timeout\n" \ |
| 2202 | "Tbvc-suspend retries\n" \ |
| 2203 | "Tbvc-resume timeout\n" \ |
| 2204 | "Tbvc-resume retries\n" \ |
| 2205 | "Tbvc-capa-update timeout\n" \ |
| 2206 | "Tbvc-capa-update retries\n" |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 2207 | |
| 2208 | DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd, |
| 2209 | "gprs cell timer " BSSGP_TIMERS " <0-255>", |
| 2210 | GPRS_TEXT "Cell / BSSGP\n" |
| 2211 | "Cell/BSSGP Timer\n" |
| 2212 | BSSGP_TIMERS_HELP "Timer Value\n") |
| 2213 | { |
| 2214 | struct gsm_bts *bts = vty->index; |
| 2215 | int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]); |
| 2216 | int val = atoi(argv[1]); |
| 2217 | |
| 2218 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
| 2219 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2220 | return CMD_WARNING; |
| 2221 | } |
| 2222 | |
| 2223 | if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer)) |
| 2224 | return CMD_WARNING; |
| 2225 | |
| 2226 | bts->gprs.cell.timer[idx] = val; |
| 2227 | |
| 2228 | return CMD_SUCCESS; |
| 2229 | } |
| 2230 | |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2231 | DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd, |
| 2232 | "gprs routing area <0-255>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2233 | GPRS_TEXT |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2234 | "GPRS Routing Area Code\n" |
| 2235 | "GPRS Routing Area Code\n" |
| 2236 | "GPRS Routing Area Code\n") |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2237 | { |
| 2238 | struct gsm_bts *bts = vty->index; |
| 2239 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2240 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | 9403670 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 2241 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 2242 | return CMD_WARNING; |
| 2243 | } |
| 2244 | |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2245 | bts->gprs.rac = atoi(argv[0]); |
| 2246 | |
| 2247 | return CMD_SUCCESS; |
| 2248 | } |
| 2249 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2250 | DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd, |
| 2251 | "gprs mode (none|gprs|egprs)", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2252 | GPRS_TEXT |
| 2253 | "GPRS Mode for this BTS\n" |
| 2254 | "GPRS Disabled on this BTS\n" |
| 2255 | "GPRS Enabled on this BTS\n" |
| 2256 | "EGPRS (EDGE) Enabled on this BTS\n") |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2257 | { |
| 2258 | struct gsm_bts *bts = vty->index; |
Harald Welte | f3d8e92 | 2010-06-14 22:44:42 +0200 | [diff] [blame] | 2259 | enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0]); |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2260 | |
Harald Welte | f3d8e92 | 2010-06-14 22:44:42 +0200 | [diff] [blame] | 2261 | if (mode != BTS_GPRS_NONE && |
| 2262 | !gsm_bts_has_feature(bts, BTS_FEAT_GPRS)) { |
| 2263 | vty_out(vty, "This BTS type does not support %s%s", argv[0], |
| 2264 | VTY_NEWLINE); |
| 2265 | return CMD_WARNING; |
| 2266 | } |
| 2267 | if (mode == BTS_GPRS_EGPRS && |
| 2268 | !gsm_bts_has_feature(bts, BTS_FEAT_EGPRS)) { |
| 2269 | vty_out(vty, "This BTS type does not support %s%s", argv[0], |
| 2270 | VTY_NEWLINE); |
| 2271 | return CMD_WARNING; |
| 2272 | } |
| 2273 | |
| 2274 | bts->gprs.mode = mode; |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2275 | |
| 2276 | return CMD_SUCCESS; |
| 2277 | } |
| 2278 | |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 2279 | #define SI_TEXT "System Information Messages\n" |
| 2280 | #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)" |
| 2281 | #define SI_TYPE_HELP "System Information Type 1\n" \ |
| 2282 | "System Information Type 2\n" \ |
| 2283 | "System Information Type 3\n" \ |
| 2284 | "System Information Type 4\n" \ |
| 2285 | "System Information Type 5\n" \ |
| 2286 | "System Information Type 6\n" \ |
| 2287 | "System Information Type 7\n" \ |
| 2288 | "System Information Type 8\n" \ |
| 2289 | "System Information Type 9\n" \ |
| 2290 | "System Information Type 10\n" \ |
| 2291 | "System Information Type 13\n" \ |
| 2292 | "System Information Type 16\n" \ |
| 2293 | "System Information Type 17\n" \ |
| 2294 | "System Information Type 18\n" \ |
| 2295 | "System Information Type 19\n" \ |
| 2296 | "System Information Type 20\n" \ |
| 2297 | "System Information Type 2bis\n" \ |
| 2298 | "System Information Type 2ter\n" \ |
| 2299 | "System Information Type 2quater\n" \ |
| 2300 | "System Information Type 5bis\n" \ |
| 2301 | "System Information Type 5ter\n" |
| 2302 | |
| 2303 | DEFUN(cfg_bts_si_mode, cfg_bts_si_mode_cmd, |
| 2304 | "system-information " SI_TYPE_TEXT " mode (static|computed)", |
| 2305 | SI_TEXT SI_TYPE_HELP |
| 2306 | "System Information Mode\n" |
| 2307 | "Static user-specified\n" |
| 2308 | "Dynamic, BSC-computed\n") |
| 2309 | { |
| 2310 | struct gsm_bts *bts = vty->index; |
| 2311 | int type; |
| 2312 | |
| 2313 | type = get_string_value(osmo_sitype_strs, argv[0]); |
| 2314 | if (type < 0) { |
| 2315 | vty_out(vty, "Error SI Type%s", VTY_NEWLINE); |
| 2316 | return CMD_WARNING; |
| 2317 | } |
| 2318 | |
| 2319 | if (!strcmp(argv[1], "static")) |
| 2320 | bts->si_mode_static |= (1 << type); |
| 2321 | else |
| 2322 | bts->si_mode_static &= ~(1 << type); |
| 2323 | |
| 2324 | return CMD_SUCCESS; |
| 2325 | } |
| 2326 | |
| 2327 | DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd, |
| 2328 | "system-information " SI_TYPE_TEXT " static HEXSTRING", |
| 2329 | SI_TEXT SI_TYPE_HELP |
| 2330 | "Static System Information filling\n" |
| 2331 | "Static user-specified SI content in HEX notation\n") |
| 2332 | { |
| 2333 | struct gsm_bts *bts = vty->index; |
| 2334 | int rc, type; |
| 2335 | |
| 2336 | type = get_string_value(osmo_sitype_strs, argv[0]); |
| 2337 | if (type < 0) { |
| 2338 | vty_out(vty, "Error SI Type%s", VTY_NEWLINE); |
| 2339 | return CMD_WARNING; |
| 2340 | } |
| 2341 | |
| 2342 | if (!(bts->si_mode_static & (1 << type))) { |
| 2343 | vty_out(vty, "SI Type %s is not configured in static mode%s", |
| 2344 | get_value_string(osmo_sitype_strs, type), VTY_NEWLINE); |
| 2345 | return CMD_WARNING; |
| 2346 | } |
| 2347 | |
Harald Welte | 290aaed | 2010-07-30 11:53:18 +0200 | [diff] [blame] | 2348 | /* Fill buffer with padding pattern */ |
| 2349 | memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type])); |
| 2350 | |
| 2351 | /* Parse the user-specified SI in hex format, [partially] overwriting padding */ |
Pablo Neira Ayuso | c0d17f2 | 2011-05-07 12:12:48 +0200 | [diff] [blame] | 2352 | rc = osmo_hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0])); |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 2353 | if (rc < 0 || rc > sizeof(bts->si_buf[0])) { |
| 2354 | vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE); |
| 2355 | return CMD_WARNING; |
| 2356 | } |
| 2357 | |
| 2358 | /* Mark this SI as present */ |
| 2359 | bts->si_valid |= (1 << type); |
| 2360 | |
| 2361 | return CMD_SUCCESS; |
| 2362 | } |
| 2363 | |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2364 | DEFUN(cfg_bts_neigh_mode, cfg_bts_neigh_mode_cmd, |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2365 | "neighbor-list mode (automatic|manual|manual-si5)", |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2366 | "Neighbor List\n" "Mode of Neighbor List generation\n" |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2367 | "Automatically from all BTS in this OpenBSC\n" "Manual\n" |
| 2368 | "Manual with different lists for SI2 and SI5\n") |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2369 | { |
| 2370 | struct gsm_bts *bts = vty->index; |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2371 | int mode = get_string_value(bts_neigh_mode_strs, argv[0]); |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2372 | |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2373 | switch (mode) { |
| 2374 | case NL_MODE_MANUAL_SI5SEP: |
| 2375 | case NL_MODE_MANUAL: |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2376 | /* make sure we clear the current list when switching to |
| 2377 | * manual mode */ |
| 2378 | if (bts->neigh_list_manual_mode == 0) |
| 2379 | memset(&bts->si_common.data.neigh_list, 0, |
| 2380 | sizeof(bts->si_common.data.neigh_list)); |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2381 | break; |
| 2382 | default: |
| 2383 | break; |
| 2384 | } |
| 2385 | |
| 2386 | bts->neigh_list_manual_mode = mode; |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2387 | |
| 2388 | return CMD_SUCCESS; |
| 2389 | } |
| 2390 | |
| 2391 | DEFUN(cfg_bts_neigh, cfg_bts_neigh_cmd, |
Harald Welte | 1fe73a1 | 2012-01-29 13:24:12 +0100 | [diff] [blame] | 2392 | "neighbor-list (add|del) arfcn <0-1023>", |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 2393 | "Neighbor List\n" "Add to manual neighbor list\n" |
| 2394 | "Delete from manual neighbor list\n" "ARFCN of neighbor\n" |
| 2395 | "ARFCN of neighbor\n") |
| 2396 | { |
| 2397 | struct gsm_bts *bts = vty->index; |
| 2398 | struct bitvec *bv = &bts->si_common.neigh_list; |
| 2399 | uint16_t arfcn = atoi(argv[1]); |
| 2400 | |
| 2401 | if (!bts->neigh_list_manual_mode) { |
| 2402 | vty_out(vty, "%% Cannot configure neighbor list in " |
| 2403 | "automatic mode%s", VTY_NEWLINE); |
| 2404 | return CMD_WARNING; |
| 2405 | } |
| 2406 | |
| 2407 | if (!strcmp(argv[0], "add")) |
| 2408 | bitvec_set_bit_pos(bv, arfcn, 1); |
| 2409 | else |
| 2410 | bitvec_set_bit_pos(bv, arfcn, 0); |
| 2411 | |
| 2412 | return CMD_SUCCESS; |
| 2413 | } |
| 2414 | |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2415 | DEFUN(cfg_bts_si5_neigh, cfg_bts_si5_neigh_cmd, |
Harald Welte | 1fe73a1 | 2012-01-29 13:24:12 +0100 | [diff] [blame] | 2416 | "si5 neighbor-list (add|del) arfcn <0-1023>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2417 | "SI5 Neighbor List\n" |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 2418 | "SI5 Neighbor List\n" "Add to manual SI5 neighbor list\n" |
| 2419 | "Delete from SI5 manual neighbor list\n" "ARFCN of neighbor\n" |
| 2420 | "ARFCN of neighbor\n") |
| 2421 | { |
| 2422 | struct gsm_bts *bts = vty->index; |
| 2423 | struct bitvec *bv = &bts->si_common.si5_neigh_list; |
| 2424 | uint16_t arfcn = atoi(argv[1]); |
| 2425 | |
| 2426 | if (!bts->neigh_list_manual_mode) { |
| 2427 | vty_out(vty, "%% Cannot configure neighbor list in " |
| 2428 | "automatic mode%s", VTY_NEWLINE); |
| 2429 | return CMD_WARNING; |
| 2430 | } |
| 2431 | |
| 2432 | if (!strcmp(argv[0], "add")) |
| 2433 | bitvec_set_bit_pos(bv, arfcn, 1); |
| 2434 | else |
| 2435 | bitvec_set_bit_pos(bv, arfcn, 0); |
| 2436 | |
| 2437 | return CMD_SUCCESS; |
| 2438 | } |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 2439 | |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2440 | #define TRX_TEXT "Radio Transceiver\n" |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 2441 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2442 | /* per TRX configuration */ |
| 2443 | DEFUN(cfg_trx, |
| 2444 | cfg_trx_cmd, |
Harald Welte | 57e0724 | 2012-08-17 12:50:14 +0200 | [diff] [blame] | 2445 | "trx <0-255>", |
Harald Welte | 8f0ed55 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 2446 | TRX_TEXT |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2447 | "Select a TRX to configure") |
| 2448 | { |
| 2449 | int trx_nr = atoi(argv[0]); |
| 2450 | struct gsm_bts *bts = vty->index; |
| 2451 | struct gsm_bts_trx *trx; |
| 2452 | |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 2453 | if (trx_nr > bts->num_trx) { |
| 2454 | vty_out(vty, "%% The next unused TRX number in this BTS is %u%s", |
| 2455 | bts->num_trx, VTY_NEWLINE); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2456 | return CMD_WARNING; |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 2457 | } else if (trx_nr == bts->num_trx) { |
| 2458 | /* we need to allocate a new one */ |
| 2459 | trx = gsm_bts_trx_alloc(bts); |
Holger Hans Peter Freyther | acf8a0c | 2010-03-29 08:47:44 +0200 | [diff] [blame] | 2460 | } else |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 2461 | trx = gsm_bts_trx_num(bts, trx_nr); |
Holger Hans Peter Freyther | acf8a0c | 2010-03-29 08:47:44 +0200 | [diff] [blame] | 2462 | |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 2463 | if (!trx) |
| 2464 | return CMD_WARNING; |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2465 | |
| 2466 | vty->index = trx; |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 2467 | vty->index_sub = &trx->description; |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2468 | vty->node = TRX_NODE; |
| 2469 | |
| 2470 | return CMD_SUCCESS; |
| 2471 | } |
| 2472 | |
| 2473 | DEFUN(cfg_trx_arfcn, |
| 2474 | cfg_trx_arfcn_cmd, |
Harald Welte | 1fe73a1 | 2012-01-29 13:24:12 +0100 | [diff] [blame] | 2475 | "arfcn <0-1023>", |
Harald Welte | 13fe219 | 2012-08-17 09:57:25 +0200 | [diff] [blame] | 2476 | "Set the ARFCN for this TRX\n" |
| 2477 | "Absolute Radio Frequency Channel Number\n") |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2478 | { |
| 2479 | int arfcn = atoi(argv[0]); |
| 2480 | struct gsm_bts_trx *trx = vty->index; |
| 2481 | |
| 2482 | /* FIXME: check if this ARFCN is supported by this TRX */ |
| 2483 | |
| 2484 | trx->arfcn = arfcn; |
| 2485 | |
| 2486 | /* FIXME: patch ARFCN into SYSTEM INFORMATION */ |
| 2487 | /* FIXME: use OML layer to update the ARFCN */ |
| 2488 | /* FIXME: use RSL layer to update SYSTEM INFORMATION */ |
| 2489 | |
| 2490 | return CMD_SUCCESS; |
| 2491 | } |
| 2492 | |
Harald Welte (local) | 7b37d97 | 2009-12-27 20:56:38 +0100 | [diff] [blame] | 2493 | DEFUN(cfg_trx_nominal_power, |
| 2494 | cfg_trx_nominal_power_cmd, |
| 2495 | "nominal power <0-100>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2496 | "Nominal TRX RF Power in dBm\n" |
| 2497 | "Nominal TRX RF Power in dBm\n" |
| 2498 | "Nominal TRX RF Power in dBm\n") |
Harald Welte (local) | 7b37d97 | 2009-12-27 20:56:38 +0100 | [diff] [blame] | 2499 | { |
| 2500 | struct gsm_bts_trx *trx = vty->index; |
| 2501 | |
| 2502 | trx->nominal_power = atoi(argv[0]); |
| 2503 | |
| 2504 | return CMD_SUCCESS; |
| 2505 | } |
| 2506 | |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 2507 | DEFUN(cfg_trx_max_power_red, |
| 2508 | cfg_trx_max_power_red_cmd, |
| 2509 | "max_power_red <0-100>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2510 | "Reduction of maximum BS RF Power (relative to nominal power)\n" |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 2511 | "Reduction of maximum BS RF Power in dB\n") |
| 2512 | { |
| 2513 | int maxpwr_r = atoi(argv[0]); |
| 2514 | struct gsm_bts_trx *trx = vty->index; |
Harald Welte | 61a83b2 | 2009-11-18 09:20:22 +0100 | [diff] [blame] | 2515 | int upper_limit = 24; /* default 12.21 max power red. */ |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 2516 | |
| 2517 | /* FIXME: check if our BTS type supports more than 12 */ |
| 2518 | if (maxpwr_r < 0 || maxpwr_r > upper_limit) { |
| 2519 | vty_out(vty, "%% Power %d dB is not in the valid range%s", |
| 2520 | maxpwr_r, VTY_NEWLINE); |
| 2521 | return CMD_WARNING; |
| 2522 | } |
| 2523 | if (maxpwr_r & 1) { |
| 2524 | vty_out(vty, "%% Power %d dB is not an even value%s", |
| 2525 | maxpwr_r, VTY_NEWLINE); |
| 2526 | return CMD_WARNING; |
| 2527 | } |
| 2528 | |
| 2529 | trx->max_power_red = maxpwr_r; |
| 2530 | |
| 2531 | /* FIXME: make sure we update this using OML */ |
| 2532 | |
| 2533 | return CMD_SUCCESS; |
| 2534 | } |
| 2535 | |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2536 | DEFUN(cfg_trx_rsl_e1, |
| 2537 | cfg_trx_rsl_e1_cmd, |
| 2538 | "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] | 2539 | "RSL Parameters\n" |
| 2540 | "E1/T1 interface to be used for RSL\n" |
| 2541 | "E1/T1 interface to be used for RSL\n" |
| 2542 | "E1/T1 Line Number to be used for RSL\n" |
| 2543 | "E1/T1 Timeslot to be used for RSL\n" |
| 2544 | "E1/T1 Timeslot to be used for RSL\n" |
| 2545 | "E1/T1 Sub-slot to be used for RSL\n" |
| 2546 | "E1/T1 Sub-slot 0 is to be used for RSL\n" |
| 2547 | "E1/T1 Sub-slot 1 is to be used for RSL\n" |
| 2548 | "E1/T1 Sub-slot 2 is to be used for RSL\n" |
| 2549 | "E1/T1 Sub-slot 3 is to be used for RSL\n" |
| 2550 | "E1/T1 full timeslot is to be used for RSL\n") |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2551 | { |
| 2552 | struct gsm_bts_trx *trx = vty->index; |
| 2553 | |
| 2554 | parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]); |
| 2555 | |
| 2556 | return CMD_SUCCESS; |
| 2557 | } |
| 2558 | |
| 2559 | DEFUN(cfg_trx_rsl_e1_tei, |
| 2560 | cfg_trx_rsl_e1_tei_cmd, |
| 2561 | "rsl e1 tei <0-63>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2562 | "RSL Parameters\n" |
| 2563 | "Set the TEI to be used for RSL\n" |
| 2564 | "Set the TEI to be used for RSL\n" |
| 2565 | "TEI to be used for RSL\n") |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2566 | { |
| 2567 | struct gsm_bts_trx *trx = vty->index; |
| 2568 | |
| 2569 | trx->rsl_tei = atoi(argv[0]); |
| 2570 | |
| 2571 | return CMD_SUCCESS; |
| 2572 | } |
| 2573 | |
Holger Hans Peter Freyther | 2d501ea | 2009-11-11 11:54:24 +0100 | [diff] [blame] | 2574 | DEFUN(cfg_trx_rf_locked, |
| 2575 | cfg_trx_rf_locked_cmd, |
| 2576 | "rf_locked (0|1)", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2577 | "Set or unset the RF Locking (Turn off RF of the TRX)\n" |
| 2578 | "TRX is NOT RF locked (active)\n" |
| 2579 | "TRX is RF locked (turned off)\n") |
Holger Hans Peter Freyther | 2d501ea | 2009-11-11 11:54:24 +0100 | [diff] [blame] | 2580 | { |
| 2581 | int locked = atoi(argv[0]); |
| 2582 | struct gsm_bts_trx *trx = vty->index; |
| 2583 | |
| 2584 | gsm_trx_lock_rf(trx, locked); |
| 2585 | return CMD_SUCCESS; |
| 2586 | } |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2587 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2588 | /* per TS configuration */ |
| 2589 | DEFUN(cfg_ts, |
| 2590 | cfg_ts_cmd, |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2591 | "timeslot <0-7>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2592 | "Select a Timeslot to configure\n" |
| 2593 | "Timeslot number\n") |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2594 | { |
| 2595 | int ts_nr = atoi(argv[0]); |
| 2596 | struct gsm_bts_trx *trx = vty->index; |
| 2597 | struct gsm_bts_trx_ts *ts; |
| 2598 | |
| 2599 | if (ts_nr >= TRX_NR_TS) { |
| 2600 | vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s", |
| 2601 | TRX_NR_TS, VTY_NEWLINE); |
| 2602 | return CMD_WARNING; |
| 2603 | } |
| 2604 | |
| 2605 | ts = &trx->ts[ts_nr]; |
| 2606 | |
| 2607 | vty->index = ts; |
| 2608 | vty->node = TS_NODE; |
| 2609 | |
| 2610 | return CMD_SUCCESS; |
| 2611 | } |
| 2612 | |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 2613 | DEFUN(cfg_ts_pchan, |
| 2614 | cfg_ts_pchan_cmd, |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 2615 | "phys_chan_config PCHAN", /* dynamically generated! */ |
| 2616 | "Physical Channel configuration (TCH/SDCCH/...)") |
| 2617 | { |
| 2618 | struct gsm_bts_trx_ts *ts = vty->index; |
| 2619 | int pchanc; |
| 2620 | |
| 2621 | pchanc = gsm_pchan_parse(argv[0]); |
| 2622 | if (pchanc < 0) |
| 2623 | return CMD_WARNING; |
| 2624 | |
| 2625 | ts->pchan = pchanc; |
| 2626 | |
| 2627 | return CMD_SUCCESS; |
| 2628 | } |
| 2629 | |
| 2630 | /* used for backwards compatibility with old config files that still |
| 2631 | * have uppercase pchan type names */ |
| 2632 | DEFUN_HIDDEN(cfg_ts_pchan_compat, |
| 2633 | cfg_ts_pchan_compat_cmd, |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 2634 | "phys_chan_config PCHAN", |
| 2635 | "Physical Channel configuration (TCH/SDCCH/...)") |
| 2636 | { |
| 2637 | struct gsm_bts_trx_ts *ts = vty->index; |
| 2638 | int pchanc; |
| 2639 | |
| 2640 | pchanc = gsm_pchan_parse(argv[0]); |
| 2641 | if (pchanc < 0) |
| 2642 | return CMD_WARNING; |
| 2643 | |
| 2644 | ts->pchan = pchanc; |
| 2645 | |
| 2646 | return CMD_SUCCESS; |
| 2647 | } |
| 2648 | |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 2649 | |
| 2650 | |
Harald Welte | 135a648 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 2651 | DEFUN(cfg_ts_tsc, |
| 2652 | cfg_ts_tsc_cmd, |
| 2653 | "training_sequence_code <0-7>", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2654 | "Training Sequence Code of the Timeslot\n" "TSC\n") |
Harald Welte | 135a648 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 2655 | { |
| 2656 | struct gsm_bts_trx_ts *ts = vty->index; |
| 2657 | |
| 2658 | ts->tsc = atoi(argv[0]); |
| 2659 | |
| 2660 | return CMD_SUCCESS; |
| 2661 | } |
| 2662 | |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 2663 | #define HOPPING_STR "Configure frequency hopping\n" |
| 2664 | |
| 2665 | DEFUN(cfg_ts_hopping, |
| 2666 | cfg_ts_hopping_cmd, |
| 2667 | "hopping enabled (0|1)", |
| 2668 | HOPPING_STR "Enable or disable frequency hopping\n" |
| 2669 | "Disable frequency hopping\n" "Enable frequency hopping\n") |
| 2670 | { |
| 2671 | struct gsm_bts_trx_ts *ts = vty->index; |
Harald Welte | c2fb3d0 | 2010-06-14 22:47:37 +0200 | [diff] [blame] | 2672 | int enabled = atoi(argv[0]); |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 2673 | |
Harald Welte | c2fb3d0 | 2010-06-14 22:47:37 +0200 | [diff] [blame] | 2674 | if (enabled && !gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_HOPPING)) { |
| 2675 | vty_out(vty, "BTS model does not support hopping%s", |
| 2676 | VTY_NEWLINE); |
| 2677 | return CMD_WARNING; |
| 2678 | } |
| 2679 | |
| 2680 | ts->hopping.enabled = enabled; |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 2681 | |
| 2682 | return CMD_SUCCESS; |
| 2683 | } |
| 2684 | |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 2685 | DEFUN(cfg_ts_hsn, |
| 2686 | cfg_ts_hsn_cmd, |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 2687 | "hopping sequence-number <0-63>", |
| 2688 | HOPPING_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2689 | "Which hopping sequence to use for this channel\n" |
| 2690 | "Hopping Sequence Number (HSN)\n") |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 2691 | { |
| 2692 | struct gsm_bts_trx_ts *ts = vty->index; |
| 2693 | |
| 2694 | ts->hopping.hsn = atoi(argv[0]); |
| 2695 | |
| 2696 | return CMD_SUCCESS; |
| 2697 | } |
| 2698 | |
| 2699 | DEFUN(cfg_ts_maio, |
| 2700 | cfg_ts_maio_cmd, |
| 2701 | "hopping maio <0-63>", |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 2702 | HOPPING_STR |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2703 | "Which hopping MAIO to use for this channel\n" |
| 2704 | "Mobile Allocation Index Offset (MAIO)\n") |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 2705 | { |
| 2706 | struct gsm_bts_trx_ts *ts = vty->index; |
| 2707 | |
| 2708 | ts->hopping.maio = atoi(argv[0]); |
| 2709 | |
| 2710 | return CMD_SUCCESS; |
| 2711 | } |
| 2712 | |
| 2713 | DEFUN(cfg_ts_arfcn_add, |
| 2714 | cfg_ts_arfcn_add_cmd, |
| 2715 | "hopping arfcn add <0-1023>", |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 2716 | HOPPING_STR "Configure hopping ARFCN list\n" |
| 2717 | "Add an entry to the hopping ARFCN list\n" "ARFCN\n") |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 2718 | { |
| 2719 | struct gsm_bts_trx_ts *ts = vty->index; |
| 2720 | int arfcn = atoi(argv[0]); |
| 2721 | |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 2722 | bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1); |
| 2723 | |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 2724 | return CMD_SUCCESS; |
| 2725 | } |
| 2726 | |
| 2727 | DEFUN(cfg_ts_arfcn_del, |
| 2728 | cfg_ts_arfcn_del_cmd, |
| 2729 | "hopping arfcn del <0-1023>", |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 2730 | HOPPING_STR "Configure hopping ARFCN list\n" |
| 2731 | "Delete an entry to the hopping ARFCN list\n" "ARFCN\n") |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 2732 | { |
| 2733 | struct gsm_bts_trx_ts *ts = vty->index; |
| 2734 | int arfcn = atoi(argv[0]); |
| 2735 | |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 2736 | bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0); |
| 2737 | |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 2738 | return CMD_SUCCESS; |
| 2739 | } |
| 2740 | |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 2741 | DEFUN(cfg_ts_e1_subslot, |
| 2742 | cfg_ts_e1_subslot_cmd, |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2743 | "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] | 2744 | "E1/T1 channel connected to this on-air timeslot\n" |
| 2745 | "E1/T1 channel connected to this on-air timeslot\n" |
| 2746 | "E1/T1 line connected to this on-air timeslot\n" |
Harald Welte | d13e0cd | 2012-08-17 09:52:03 +0200 | [diff] [blame] | 2747 | "E1/T1 timeslot connected to this on-air timeslot\n" |
| 2748 | "E1/T1 timeslot connected to this on-air timeslot\n" |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2749 | "E1/T1 sub-slot connected to this on-air timeslot\n" |
| 2750 | "E1/T1 sub-slot 0 connected to this on-air timeslot\n" |
| 2751 | "E1/T1 sub-slot 1 connected to this on-air timeslot\n" |
| 2752 | "E1/T1 sub-slot 2 connected to this on-air timeslot\n" |
| 2753 | "E1/T1 sub-slot 3 connected to this on-air timeslot\n" |
| 2754 | "Full E1/T1 timeslot connected to this on-air timeslot\n") |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 2755 | { |
| 2756 | struct gsm_bts_trx_ts *ts = vty->index; |
| 2757 | |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2758 | parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]); |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 2759 | |
| 2760 | return CMD_SUCCESS; |
| 2761 | } |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2762 | |
Harald Welte | 4f10c25 | 2010-05-16 21:47:13 +0200 | [diff] [blame] | 2763 | void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net) |
| 2764 | { |
| 2765 | vty_out(vty, "Channel Requests : %lu total, %lu no channel%s", |
Pablo Neira Ayuso | dfb342c | 2011-05-06 12:13:10 +0200 | [diff] [blame] | 2766 | osmo_counter_get(net->stats.chreq.total), |
| 2767 | osmo_counter_get(net->stats.chreq.no_channel), VTY_NEWLINE); |
Harald Welte | 4f10c25 | 2010-05-16 21:47:13 +0200 | [diff] [blame] | 2768 | vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s", |
Pablo Neira Ayuso | dfb342c | 2011-05-06 12:13:10 +0200 | [diff] [blame] | 2769 | osmo_counter_get(net->stats.chan.rf_fail), |
| 2770 | osmo_counter_get(net->stats.chan.rll_err), VTY_NEWLINE); |
Harald Welte | 4f10c25 | 2010-05-16 21:47:13 +0200 | [diff] [blame] | 2771 | vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s", |
Pablo Neira Ayuso | dfb342c | 2011-05-06 12:13:10 +0200 | [diff] [blame] | 2772 | osmo_counter_get(net->stats.paging.attempted), |
| 2773 | osmo_counter_get(net->stats.paging.completed), |
| 2774 | osmo_counter_get(net->stats.paging.expired), VTY_NEWLINE); |
Harald Welte | 4f10c25 | 2010-05-16 21:47:13 +0200 | [diff] [blame] | 2775 | vty_out(vty, "BTS failures : %lu OML, %lu RSL%s", |
Pablo Neira Ayuso | dfb342c | 2011-05-06 12:13:10 +0200 | [diff] [blame] | 2776 | osmo_counter_get(net->stats.bts.oml_fail), |
| 2777 | osmo_counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE); |
Harald Welte | 4f10c25 | 2010-05-16 21:47:13 +0200 | [diff] [blame] | 2778 | } |
| 2779 | |
Harald Welte | 5bc61dc | 2010-05-16 22:02:16 +0200 | [diff] [blame] | 2780 | DEFUN(logging_fltr_imsi, |
| 2781 | logging_fltr_imsi_cmd, |
| 2782 | "logging filter imsi IMSI", |
| 2783 | LOGGING_STR FILTER_STR |
| 2784 | "Filter log messages by IMSI\n" "IMSI to be used as filter\n") |
| 2785 | { |
Harald Welte | 8dcebd3 | 2011-02-18 21:10:05 +0100 | [diff] [blame] | 2786 | struct log_target *tgt = osmo_log_vty2tgt(vty); |
Harald Welte | 5bc61dc | 2010-05-16 22:02:16 +0200 | [diff] [blame] | 2787 | |
Harald Welte | 8dcebd3 | 2011-02-18 21:10:05 +0100 | [diff] [blame] | 2788 | if (!tgt) |
Harald Welte | 5bc61dc | 2010-05-16 22:02:16 +0200 | [diff] [blame] | 2789 | return CMD_WARNING; |
Harald Welte | 5bc61dc | 2010-05-16 22:02:16 +0200 | [diff] [blame] | 2790 | |
Harald Welte | 8dcebd3 | 2011-02-18 21:10:05 +0100 | [diff] [blame] | 2791 | log_set_imsi_filter(tgt, argv[0]); |
Harald Welte | 5bc61dc | 2010-05-16 22:02:16 +0200 | [diff] [blame] | 2792 | return CMD_SUCCESS; |
| 2793 | } |
| 2794 | |
Harald Welte | 8dcebd3 | 2011-02-18 21:10:05 +0100 | [diff] [blame] | 2795 | |
Holger Hans Peter Freyther | 2484ceb | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 2796 | DEFUN(drop_bts, |
| 2797 | drop_bts_cmd, |
Holger Hans Peter Freyther | 0586b0f | 2010-04-11 12:46:45 +0200 | [diff] [blame] | 2798 | "drop bts connection <0-65535> (oml|rsl)", |
Harald Welte | cfaabbb | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 2799 | "Debug/Simulation command to drop Abis/IP BTS\n" |
| 2800 | "Debug/Simulation command to drop Abis/IP BTS\n" |
| 2801 | "Debug/Simulation command to drop Abis/IP BTS\n" |
| 2802 | "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] | 2803 | { |
| 2804 | struct gsm_network *gsmnet; |
| 2805 | struct gsm_bts_trx *trx; |
| 2806 | struct gsm_bts *bts; |
| 2807 | unsigned int bts_nr; |
| 2808 | |
| 2809 | gsmnet = gsmnet_from_vty(vty); |
| 2810 | |
| 2811 | bts_nr = atoi(argv[0]); |
| 2812 | if (bts_nr >= gsmnet->num_bts) { |
| 2813 | vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s", |
| 2814 | gsmnet->num_bts, bts_nr, VTY_NEWLINE); |
| 2815 | return CMD_WARNING; |
| 2816 | } |
| 2817 | |
| 2818 | bts = gsm_bts_num(gsmnet, bts_nr); |
| 2819 | if (!bts) { |
| 2820 | vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE); |
| 2821 | return CMD_WARNING; |
| 2822 | } |
| 2823 | |
| 2824 | if (!is_ipaccess_bts(bts)) { |
| 2825 | vty_out(vty, "This command only works for ipaccess.%s", VTY_NEWLINE); |
| 2826 | return CMD_WARNING; |
| 2827 | } |
| 2828 | |
| 2829 | |
| 2830 | /* close all connections */ |
| 2831 | if (strcmp(argv[1], "oml") == 0) { |
Holger Hans Peter Freyther | dab8e27 | 2010-11-15 20:29:46 +0100 | [diff] [blame] | 2832 | ipaccess_drop_oml(bts); |
Holger Hans Peter Freyther | 2484ceb | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 2833 | } else if (strcmp(argv[1], "rsl") == 0) { |
| 2834 | /* close all rsl connections */ |
| 2835 | llist_for_each_entry(trx, &bts->trx_list, list) { |
Holger Hans Peter Freyther | dab8e27 | 2010-11-15 20:29:46 +0100 | [diff] [blame] | 2836 | ipaccess_drop_rsl(trx); |
Holger Hans Peter Freyther | 2484ceb | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 2837 | } |
| 2838 | } else { |
| 2839 | vty_out(vty, "Argument must be 'oml# or 'rsl'.%s", VTY_NEWLINE); |
| 2840 | return CMD_WARNING; |
| 2841 | } |
| 2842 | |
| 2843 | return CMD_SUCCESS; |
| 2844 | } |
| 2845 | |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 2846 | DEFUN(pdch_act, pdch_act_cmd, |
| 2847 | "bts <0-255> trx <0-255> timeslot <0-7> pdch (activate|deactivate)", |
| 2848 | "BTS related commands\n" "BTS Number\n" "Transceiver\n" "Transceiver Number\n" |
| 2849 | "TRX Timeslot\n" "Timeslot Number\n" "Packet Data Channel\n" |
| 2850 | "Activate Dynamic PDCH/TCH (-> PDCH mode)\n" |
| 2851 | "Deactivate Dynamic PDCH/TCH (-> TCH mode)\n") |
| 2852 | { |
| 2853 | struct gsm_bts *bts; |
| 2854 | struct gsm_bts_trx *trx; |
| 2855 | struct gsm_bts_trx_ts *ts; |
| 2856 | int bts_nr = atoi(argv[0]); |
| 2857 | int trx_nr = atoi(argv[1]); |
| 2858 | int ts_nr = atoi(argv[2]); |
| 2859 | int activate; |
| 2860 | |
| 2861 | bts = gsm_bts_num(bsc_gsmnet, bts_nr); |
| 2862 | if (!bts) { |
| 2863 | vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE); |
| 2864 | return CMD_WARNING; |
| 2865 | } |
| 2866 | |
| 2867 | if (!is_ipaccess_bts(bts)) { |
| 2868 | vty_out(vty, "%% This command only works for ipaccess BTS%s", |
| 2869 | VTY_NEWLINE); |
| 2870 | return CMD_WARNING; |
| 2871 | } |
| 2872 | |
| 2873 | trx = gsm_bts_trx_num(bts, trx_nr); |
| 2874 | if (!trx) { |
| 2875 | vty_out(vty, "%% No such TRX (%d)%s", trx_nr, VTY_NEWLINE); |
| 2876 | return CMD_WARNING; |
| 2877 | } |
| 2878 | |
| 2879 | ts = &trx->ts[ts_nr]; |
| 2880 | if (ts->pchan != GSM_PCHAN_TCH_F_PDCH) { |
| 2881 | vty_out(vty, "%% Timeslot %u is not in dynamic TCH_F/PDCH " |
| 2882 | "mode%s", ts_nr, VTY_NEWLINE); |
| 2883 | return CMD_WARNING; |
| 2884 | } |
| 2885 | |
| 2886 | if (!strcmp(argv[3], "activate")) |
| 2887 | activate = 1; |
| 2888 | else |
| 2889 | activate = 0; |
| 2890 | |
| 2891 | rsl_ipacc_pdch_activate(ts, activate); |
| 2892 | |
| 2893 | return CMD_SUCCESS; |
| 2894 | |
| 2895 | } |
Holger Hans Peter Freyther | 2484ceb | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 2896 | |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 2897 | extern int bsc_vty_init_extra(void); |
Harald Welte | 1353f96 | 2010-05-16 19:20:24 +0200 | [diff] [blame] | 2898 | extern const char *openbsc_copyright; |
Holger Hans Peter Freyther | e1ffc08 | 2010-04-10 00:08:28 +0200 | [diff] [blame] | 2899 | |
Pablo Neira Ayuso | 739a566 | 2011-03-09 13:36:32 +0100 | [diff] [blame] | 2900 | int bsc_vty_init(const struct log_info *cat) |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 2901 | { |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 2902 | cfg_ts_pchan_cmd.string = |
| 2903 | vty_cmd_string_from_valstr(tall_bsc_ctx, |
| 2904 | gsm_pchant_names, |
| 2905 | "phys_chan_config (", "|", ")", |
| 2906 | VTY_DO_LOWER); |
| 2907 | cfg_ts_pchan_cmd.doc = |
| 2908 | vty_cmd_string_from_valstr(tall_bsc_ctx, |
| 2909 | gsm_pchant_descs, |
| 2910 | "Physical Channel Combination\n", |
| 2911 | "\n", "", 0); |
| 2912 | |
Harald Welte | e555c2b | 2012-08-17 13:02:12 +0200 | [diff] [blame] | 2913 | cfg_bts_type_cmd.string = |
| 2914 | vty_cmd_string_from_valstr(tall_bsc_ctx, |
| 2915 | bts_type_names, |
| 2916 | "type (", "|", ")", |
| 2917 | VTY_DO_LOWER); |
| 2918 | cfg_bts_type_cmd.doc = |
| 2919 | vty_cmd_string_from_valstr(tall_bsc_ctx, |
| 2920 | bts_type_descs, |
| 2921 | "BTS Vendor/Type\n", |
| 2922 | "\n", "", 0); |
| 2923 | |
| 2924 | |
Harald Welte | b4d5b17 | 2010-05-12 16:10:35 +0000 | [diff] [blame] | 2925 | install_element_ve(&show_net_cmd); |
| 2926 | install_element_ve(&show_bts_cmd); |
| 2927 | install_element_ve(&show_trx_cmd); |
| 2928 | install_element_ve(&show_ts_cmd); |
| 2929 | install_element_ve(&show_lchan_cmd); |
Holger Hans Peter Freyther | 3d6a5d6 | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 2930 | install_element_ve(&show_lchan_summary_cmd); |
Harald Welte | 5bc61dc | 2010-05-16 22:02:16 +0200 | [diff] [blame] | 2931 | install_element_ve(&logging_fltr_imsi_cmd); |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 2932 | |
Harald Welte | b4d5b17 | 2010-05-12 16:10:35 +0000 | [diff] [blame] | 2933 | install_element_ve(&show_paging_cmd); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2934 | |
Pablo Neira Ayuso | 739a566 | 2011-03-09 13:36:32 +0100 | [diff] [blame] | 2935 | logging_vty_add_cmds(cat); |
Harald Welte | 8dcebd3 | 2011-02-18 21:10:05 +0100 | [diff] [blame] | 2936 | install_element(CFG_LOG_NODE, &logging_fltr_imsi_cmd); |
Holger Hans Peter Freyther | b61e3b2 | 2009-12-22 22:32:51 +0100 | [diff] [blame] | 2937 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 2938 | install_element(CONFIG_NODE, &cfg_net_cmd); |
| 2939 | install_node(&net_node, config_write_net); |
| 2940 | install_default(GSMNET_NODE); |
Harald Welte | 62ab20c | 2010-05-14 18:59:17 +0200 | [diff] [blame] | 2941 | install_element(GSMNET_NODE, &ournode_exit_cmd); |
Harald Welte | 54f7424 | 2010-05-14 19:11:04 +0200 | [diff] [blame] | 2942 | install_element(GSMNET_NODE, &ournode_end_cmd); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2943 | install_element(GSMNET_NODE, &cfg_net_ncc_cmd); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 2944 | install_element(GSMNET_NODE, &cfg_net_mnc_cmd); |
| 2945 | install_element(GSMNET_NODE, &cfg_net_name_short_cmd); |
| 2946 | install_element(GSMNET_NODE, &cfg_net_name_long_cmd); |
Harald Welte (local) | 69de397 | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 2947 | install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd); |
Harald Welte | 1085c09 | 2009-11-18 20:33:19 +0100 | [diff] [blame] | 2948 | install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd); |
Harald Welte | 4381cfe | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 2949 | install_element(GSMNET_NODE, &cfg_net_encryption_cmd); |
Holger Hans Peter Freyther | f7d752f | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 2950 | install_element(GSMNET_NODE, &cfg_net_neci_cmd); |
Harald Welte | eab84a1 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 2951 | install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd); |
Harald Welte | 3d23db4 | 2009-12-14 17:49:15 +0100 | [diff] [blame] | 2952 | install_element(GSMNET_NODE, &cfg_net_mm_info_cmd); |
Harald Welte | bc81450 | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 2953 | install_element(GSMNET_NODE, &cfg_net_handover_cmd); |
Harald Welte | b720bd3 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 2954 | install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd); |
| 2955 | install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd); |
| 2956 | install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd); |
| 2957 | install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd); |
| 2958 | install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd); |
| 2959 | install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd); |
Holger Hans Peter Freyther | c4d88ad | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 2960 | install_element(GSMNET_NODE, &cfg_net_T3101_cmd); |
Holger Hans Peter Freyther | 23975e7 | 2009-11-21 21:42:26 +0100 | [diff] [blame] | 2961 | install_element(GSMNET_NODE, &cfg_net_T3103_cmd); |
| 2962 | install_element(GSMNET_NODE, &cfg_net_T3105_cmd); |
| 2963 | install_element(GSMNET_NODE, &cfg_net_T3107_cmd); |
| 2964 | install_element(GSMNET_NODE, &cfg_net_T3109_cmd); |
| 2965 | install_element(GSMNET_NODE, &cfg_net_T3111_cmd); |
| 2966 | install_element(GSMNET_NODE, &cfg_net_T3113_cmd); |
| 2967 | install_element(GSMNET_NODE, &cfg_net_T3115_cmd); |
| 2968 | install_element(GSMNET_NODE, &cfg_net_T3117_cmd); |
| 2969 | install_element(GSMNET_NODE, &cfg_net_T3119_cmd); |
Harald Welte | c9f499f | 2010-12-23 22:53:50 +0100 | [diff] [blame] | 2970 | install_element(GSMNET_NODE, &cfg_net_T3122_cmd); |
Holger Hans Peter Freyther | 23975e7 | 2009-11-21 21:42:26 +0100 | [diff] [blame] | 2971 | install_element(GSMNET_NODE, &cfg_net_T3141_cmd); |
Holger Hans Peter Freyther | 5a3a61d | 2010-09-06 09:25:48 +0800 | [diff] [blame] | 2972 | install_element(GSMNET_NODE, &cfg_net_dtx_cmd); |
Holger Hans Peter Freyther | ae9006a | 2010-12-22 16:26:04 +0100 | [diff] [blame] | 2973 | install_element(GSMNET_NODE, &cfg_net_subscr_keep_cmd); |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 2974 | install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 2975 | |
| 2976 | install_element(GSMNET_NODE, &cfg_bts_cmd); |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 2977 | install_node(&bts_node, config_write_bts); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 2978 | install_default(BTS_NODE); |
Harald Welte | 62ab20c | 2010-05-14 18:59:17 +0200 | [diff] [blame] | 2979 | install_element(BTS_NODE, &ournode_exit_cmd); |
Harald Welte | 54f7424 | 2010-05-14 19:11:04 +0200 | [diff] [blame] | 2980 | install_element(BTS_NODE, &ournode_end_cmd); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2981 | install_element(BTS_NODE, &cfg_bts_type_cmd); |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 2982 | install_element(BTS_NODE, &cfg_description_cmd); |
| 2983 | install_element(BTS_NODE, &cfg_no_description_cmd); |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 2984 | install_element(BTS_NODE, &cfg_bts_band_cmd); |
Holger Hans Peter Freyther | c4a49e3 | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 2985 | install_element(BTS_NODE, &cfg_bts_ci_cmd); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 2986 | install_element(BTS_NODE, &cfg_bts_lac_cmd); |
| 2987 | install_element(BTS_NODE, &cfg_bts_tsc_cmd); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2988 | install_element(BTS_NODE, &cfg_bts_bsic_cmd); |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 2989 | install_element(BTS_NODE, &cfg_bts_unit_id_cmd); |
Gus Bourg | 1c5dd2c | 2011-12-02 10:18:17 +0100 | [diff] [blame] | 2990 | install_element(BTS_NODE, &cfg_bts_timezone_cmd); |
| 2991 | install_element(BTS_NODE, &cfg_bts_no_timezone_cmd); |
Harald Welte | fd355a3 | 2011-03-04 13:41:31 +0100 | [diff] [blame] | 2992 | install_element(BTS_NODE, &cfg_bts_serno_cmd); |
Sylvain Munaut | c951946 | 2011-10-17 14:04:55 +0200 | [diff] [blame] | 2993 | install_element(BTS_NODE, &cfg_bts_nokia_site_skip_reset_cmd); |
Harald Welte | 8175e95 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 2994 | install_element(BTS_NODE, &cfg_bts_stream_id_cmd); |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 2995 | install_element(BTS_NODE, &cfg_bts_hsl_oml_cmd); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2996 | install_element(BTS_NODE, &cfg_bts_oml_e1_cmd); |
| 2997 | install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd); |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 2998 | install_element(BTS_NODE, &cfg_bts_challoc_cmd); |
Sylvain Munaut | 4010f1e | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 2999 | install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd); |
| 3000 | install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd); |
Andreas Eversberg | 2ee7ecd | 2012-10-13 07:27:47 +0200 | [diff] [blame] | 3001 | install_element(BTS_NODE, &cfg_bts_chan_desc_att_cmd); |
| 3002 | install_element(BTS_NODE, &cfg_bts_chan_desc_bs_pa_mfrms_cmd); |
| 3003 | 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] | 3004 | install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd); |
| 3005 | install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd); |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 3006 | install_element(BTS_NODE, &cfg_bts_cell_barred_cmd); |
Holger Hans Peter Freyther | 3a0a463 | 2010-05-14 00:39:19 +0800 | [diff] [blame] | 3007 | install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd); |
Harald Welte (local) | 0e451d0 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 3008 | install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd); |
Harald Welte (local) | efc9231 | 2009-08-14 23:09:25 +0200 | [diff] [blame] | 3009 | install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd); |
Harald Welte | 7322528 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 3010 | install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd); |
| 3011 | install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd); |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 3012 | install_element(BTS_NODE, &cfg_bts_cell_bar_qualify_cmd); |
| 3013 | install_element(BTS_NODE, &cfg_bts_cell_resel_ofs_cmd); |
| 3014 | install_element(BTS_NODE, &cfg_bts_temp_ofs_cmd); |
| 3015 | install_element(BTS_NODE, &cfg_bts_temp_ofs_inf_cmd); |
| 3016 | install_element(BTS_NODE, &cfg_bts_penalty_time_cmd); |
| 3017 | install_element(BTS_NODE, &cfg_bts_penalty_time_rsvd_cmd); |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 3018 | install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd); |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 3019 | install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd); |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 3020 | install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd); |
| 3021 | install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd); |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 3022 | install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd); |
Harald Welte | a5731cf | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 3023 | install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd); |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 3024 | install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd); |
Harald Welte | af38763 | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 3025 | install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd); |
| 3026 | install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd); |
| 3027 | install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd); |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 3028 | install_element(BTS_NODE, &cfg_bts_pag_free_cmd); |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 3029 | install_element(BTS_NODE, &cfg_bts_si_mode_cmd); |
| 3030 | install_element(BTS_NODE, &cfg_bts_si_static_cmd); |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 3031 | install_element(BTS_NODE, &cfg_bts_neigh_mode_cmd); |
| 3032 | install_element(BTS_NODE, &cfg_bts_neigh_cmd); |
Harald Welte | 64c07d2 | 2011-02-15 11:43:27 +0100 | [diff] [blame] | 3033 | install_element(BTS_NODE, &cfg_bts_si5_neigh_cmd); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 3034 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 3035 | install_element(BTS_NODE, &cfg_trx_cmd); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 3036 | install_node(&trx_node, dummy_config_write); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 3037 | install_default(TRX_NODE); |
Harald Welte | 62ab20c | 2010-05-14 18:59:17 +0200 | [diff] [blame] | 3038 | install_element(TRX_NODE, &ournode_exit_cmd); |
Harald Welte | 54f7424 | 2010-05-14 19:11:04 +0200 | [diff] [blame] | 3039 | install_element(TRX_NODE, &ournode_end_cmd); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 3040 | install_element(TRX_NODE, &cfg_trx_arfcn_cmd); |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 3041 | install_element(TRX_NODE, &cfg_description_cmd); |
| 3042 | install_element(TRX_NODE, &cfg_no_description_cmd); |
Harald Welte (local) | 7b37d97 | 2009-12-27 20:56:38 +0100 | [diff] [blame] | 3043 | install_element(TRX_NODE, &cfg_trx_nominal_power_cmd); |
Harald Welte | 879dc97 | 2009-06-20 22:36:12 +0200 | [diff] [blame] | 3044 | install_element(TRX_NODE, &cfg_trx_max_power_red_cmd); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 3045 | install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd); |
| 3046 | install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd); |
Holger Hans Peter Freyther | 2d501ea | 2009-11-11 11:54:24 +0100 | [diff] [blame] | 3047 | install_element(TRX_NODE, &cfg_trx_rf_locked_cmd); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 3048 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 3049 | install_element(TRX_NODE, &cfg_ts_cmd); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 3050 | install_node(&ts_node, dummy_config_write); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 3051 | install_default(TS_NODE); |
Harald Welte | 62ab20c | 2010-05-14 18:59:17 +0200 | [diff] [blame] | 3052 | install_element(TS_NODE, &ournode_exit_cmd); |
Harald Welte | 54f7424 | 2010-05-14 19:11:04 +0200 | [diff] [blame] | 3053 | install_element(TS_NODE, &ournode_end_cmd); |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 3054 | install_element(TS_NODE, &cfg_ts_pchan_cmd); |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 3055 | install_element(TS_NODE, &cfg_ts_pchan_compat_cmd); |
Harald Welte | 135a648 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 3056 | install_element(TS_NODE, &cfg_ts_tsc_cmd); |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 3057 | install_element(TS_NODE, &cfg_ts_hopping_cmd); |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 3058 | install_element(TS_NODE, &cfg_ts_hsn_cmd); |
| 3059 | install_element(TS_NODE, &cfg_ts_maio_cmd); |
| 3060 | install_element(TS_NODE, &cfg_ts_arfcn_add_cmd); |
| 3061 | install_element(TS_NODE, &cfg_ts_arfcn_del_cmd); |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 3062 | install_element(TS_NODE, &cfg_ts_e1_subslot_cmd); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 3063 | |
Holger Hans Peter Freyther | 2484ceb | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 3064 | install_element(ENABLE_NODE, &drop_bts_cmd); |
Harald Welte | d0d2b0b | 2010-12-23 13:18:07 +0100 | [diff] [blame] | 3065 | install_element(ENABLE_NODE, &pdch_act_cmd); |
Holger Hans Peter Freyther | 2484ceb | 2010-10-26 09:40:13 +0200 | [diff] [blame] | 3066 | |
Harald Welte | 81c9b9c | 2010-05-31 16:40:40 +0200 | [diff] [blame] | 3067 | abis_nm_vty_init(); |
Harald Welte | e1d5eca | 2011-02-12 14:42:59 +0100 | [diff] [blame] | 3068 | abis_om2k_vty_init(); |
Harald Welte | 3016d9f | 2011-02-05 13:54:41 +0100 | [diff] [blame] | 3069 | e1inp_vty_init(); |
Harald Welte | 81c9b9c | 2010-05-31 16:40:40 +0200 | [diff] [blame] | 3070 | |
Harald Welte | dcccb18 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 3071 | bsc_vty_init_extra(); |
Harald Welte | 40f8289 | 2009-05-23 17:31:39 +0000 | [diff] [blame] | 3072 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 3073 | return 0; |
| 3074 | } |