Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1 | /* OpenBSC interface to quagga VTY */ |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2 | /* (C) 2009-2010 by Harald Welte <laforge@gnumonks.org> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 3 | * All Rights Reserved |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 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 |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License along |
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | #include <stdlib.h> |
| 22 | #include <unistd.h> |
| 23 | #include <sys/types.h> |
| 24 | |
Harald Welte | bd9591f | 2010-05-19 19:45:32 +0200 | [diff] [blame] | 25 | #include <osmocom/vty/command.h> |
| 26 | #include <osmocom/vty/buffer.h> |
| 27 | #include <osmocom/vty/vty.h> |
| 28 | #include <osmocom/vty/logging.h> |
| 29 | #include <osmocom/vty/telnet_interface.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 30 | |
| 31 | #include <arpa/inet.h> |
| 32 | |
Harald Welte | f4625b1 | 2010-02-20 16:24:02 +0100 | [diff] [blame] | 33 | #include <osmocore/linuxlist.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 34 | #include <openbsc/gsm_data.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 35 | #include <openbsc/e1_input.h> |
| 36 | #include <openbsc/abis_nm.h> |
Harald Welte | d8acf14 | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 37 | #include <osmocore/utils.h> |
Harald Welte | f4625b1 | 2010-02-20 16:24:02 +0100 | [diff] [blame] | 38 | #include <osmocore/gsm_utils.h> |
Harald Welte | fe96f38 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 39 | #include <openbsc/chan_alloc.h> |
Harald Welte | 4400774 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 40 | #include <openbsc/meas_rep.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 41 | #include <openbsc/db.h> |
Harald Welte | f4625b1 | 2010-02-20 16:24:02 +0100 | [diff] [blame] | 42 | #include <osmocore/talloc.h> |
Holger Hans Peter Freyther | b70d45b | 2010-04-06 11:55:37 +0200 | [diff] [blame] | 43 | #include <openbsc/vty.h> |
Harald Welte | f45981f | 2010-05-12 20:28:04 +0200 | [diff] [blame] | 44 | #include <openbsc/gprs_ns.h> |
Harald Welte | d8acf14 | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 45 | #include <openbsc/system_information.h> |
Harald Welte | 682ee5f | 2010-05-16 22:02:16 +0200 | [diff] [blame] | 46 | #include <openbsc/debug.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 47 | |
Harald Welte | 10c29f6 | 2010-05-16 19:20:24 +0200 | [diff] [blame] | 48 | #include "../bscconfig.h" |
| 49 | |
Harald Welte | d6b62e3 | 2010-05-12 17:19:53 +0000 | [diff] [blame] | 50 | /* FIXME: this should go to some common file */ |
| 51 | static const struct value_string gprs_ns_timer_strs[] = { |
Harald Welte | a925176 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 52 | { 0, "tns-block" }, |
| 53 | { 1, "tns-block-retries" }, |
| 54 | { 2, "tns-reset" }, |
| 55 | { 3, "tns-reset-retries" }, |
| 56 | { 4, "tns-test" }, |
| 57 | { 5, "tns-alive" }, |
| 58 | { 6, "tns-alive-retries" }, |
| 59 | { 0, NULL } |
| 60 | }; |
| 61 | |
Harald Welte | d6b62e3 | 2010-05-12 17:19:53 +0000 | [diff] [blame] | 62 | static const struct value_string gprs_bssgp_cfg_strs[] = { |
Harald Welte | a925176 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 63 | { 0, "blocking-timer" }, |
| 64 | { 1, "blocking-retries" }, |
| 65 | { 2, "unblocking-retries" }, |
| 66 | { 3, "reset-timer" }, |
| 67 | { 4, "reset-retries" }, |
| 68 | { 5, "suspend-timer" }, |
| 69 | { 6, "suspend-retries" }, |
| 70 | { 7, "resume-timer" }, |
| 71 | { 8, "resume-retries" }, |
| 72 | { 9, "capability-update-timer" }, |
| 73 | { 10, "capability-update-retries" }, |
| 74 | { 0, NULL } |
| 75 | }; |
| 76 | |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 77 | struct cmd_node net_node = { |
| 78 | GSMNET_NODE, |
| 79 | "%s(network)#", |
| 80 | 1, |
| 81 | }; |
| 82 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 83 | struct cmd_node bts_node = { |
| 84 | BTS_NODE, |
| 85 | "%s(bts)#", |
| 86 | 1, |
| 87 | }; |
| 88 | |
| 89 | struct cmd_node trx_node = { |
| 90 | TRX_NODE, |
| 91 | "%s(trx)#", |
| 92 | 1, |
| 93 | }; |
| 94 | |
| 95 | struct cmd_node ts_node = { |
| 96 | TS_NODE, |
| 97 | "%s(ts)#", |
| 98 | 1, |
| 99 | }; |
| 100 | |
Harald Welte | 61daf6d | 2010-05-27 13:39:40 +0200 | [diff] [blame] | 101 | extern struct gsm_network *bsc_gsmnet; |
| 102 | |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 103 | struct gsm_network *gsmnet_from_vty(struct vty *v) |
| 104 | { |
Harald Welte | 61daf6d | 2010-05-27 13:39:40 +0200 | [diff] [blame] | 105 | /* In case we read from the config file, the vty->priv cannot |
| 106 | * point to a struct telnet_connection, and thus conn->priv |
| 107 | * will not point to the gsm_network structure */ |
| 108 | #if 0 |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 109 | struct telnet_connection *conn = v->priv; |
| 110 | return (struct gsm_network *) conn->priv; |
Harald Welte | 61daf6d | 2010-05-27 13:39:40 +0200 | [diff] [blame] | 111 | #else |
| 112 | return bsc_gsmnet; |
| 113 | #endif |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 114 | } |
| 115 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 116 | static int dummy_config_write(struct vty *v) |
| 117 | { |
| 118 | return CMD_SUCCESS; |
| 119 | } |
| 120 | |
| 121 | static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms) |
| 122 | { |
| 123 | vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s", |
| 124 | nm_opstate_name(nms->operational), nms->administrative, |
| 125 | nm_avail_name(nms->availability), VTY_NEWLINE); |
| 126 | } |
| 127 | |
Harald Welte | fe96f38 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 128 | static void dump_pchan_load_vty(struct vty *vty, char *prefix, |
| 129 | const struct pchan_load *pl) |
| 130 | { |
| 131 | int i; |
| 132 | |
| 133 | for (i = 0; i < ARRAY_SIZE(pl->pchan); i++) { |
| 134 | const struct load_counter *lc = &pl->pchan[i]; |
| 135 | unsigned int percent; |
| 136 | |
| 137 | if (lc->total == 0) |
| 138 | continue; |
| 139 | |
| 140 | percent = (lc->used * 100) / lc->total; |
| 141 | |
| 142 | vty_out(vty, "%s%20s: %3u%% (%u/%u)%s", prefix, |
| 143 | gsm_pchan_name(i), percent, lc->used, lc->total, |
| 144 | VTY_NEWLINE); |
| 145 | } |
| 146 | } |
| 147 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 148 | static void net_dump_vty(struct vty *vty, struct gsm_network *net) |
| 149 | { |
Harald Welte | fe96f38 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 150 | struct pchan_load pl; |
| 151 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 152 | vty_out(vty, "BSC is on Country Code %u, Network Code %u " |
| 153 | "and has %u BTS%s", net->country_code, net->network_code, |
| 154 | net->num_bts, VTY_NEWLINE); |
| 155 | vty_out(vty, " Long network name: '%s'%s", |
| 156 | net->name_long, VTY_NEWLINE); |
| 157 | vty_out(vty, " Short network name: '%s'%s", |
| 158 | net->name_short, VTY_NEWLINE); |
Harald Welte (local) | a59a27e | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 159 | vty_out(vty, " Authentication policy: %s%s", |
| 160 | gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE); |
Harald Welte | 59936d7 | 2009-11-18 20:33:19 +0100 | [diff] [blame] | 161 | vty_out(vty, " Location updating reject cause: %u%s", |
| 162 | net->reject_cause, VTY_NEWLINE); |
Harald Welte | cca253a | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 163 | vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption, |
| 164 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 96c8982 | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 165 | vty_out(vty, " NECI (TCH/H): %u%s", net->neci, |
| 166 | VTY_NEWLINE); |
Holger Hans Peter Freyther | b6b9d70 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 167 | vty_out(vty, " Use TCH for Paging any: %d%s", net->pag_any_tch, |
| 168 | VTY_NEWLINE); |
Harald Welte | 52af195 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 169 | vty_out(vty, " RRLP Mode: %s%s", rrlp_mode_name(net->rrlp.mode), |
| 170 | VTY_NEWLINE); |
Harald Welte | a310f3e | 2009-12-14 09:00:24 +0100 | [diff] [blame] | 171 | vty_out(vty, " MM Info: %s%s", net->send_mm_info ? "On" : "Off", |
| 172 | VTY_NEWLINE); |
Harald Welte | 0af9c9f | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 173 | vty_out(vty, " Handover: %s%s", net->handover.active ? "On" : "Off", |
| 174 | VTY_NEWLINE); |
Harald Welte | fe96f38 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 175 | network_chan_load(&pl, net); |
| 176 | vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE); |
| 177 | dump_pchan_load_vty(vty, " ", &pl); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 178 | } |
| 179 | |
| 180 | DEFUN(show_net, show_net_cmd, "show network", |
| 181 | SHOW_STR "Display information about a GSM NETWORK\n") |
| 182 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 183 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 184 | net_dump_vty(vty, net); |
| 185 | |
| 186 | return CMD_SUCCESS; |
| 187 | } |
| 188 | |
| 189 | static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l) |
| 190 | { |
| 191 | struct e1inp_line *line; |
| 192 | |
| 193 | if (!e1l) { |
| 194 | vty_out(vty, " None%s", VTY_NEWLINE); |
| 195 | return; |
| 196 | } |
| 197 | |
| 198 | line = e1l->ts->line; |
| 199 | |
| 200 | vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s", |
| 201 | line->num, line->driver->name, e1l->ts->num, |
| 202 | e1inp_signtype_name(e1l->type), VTY_NEWLINE); |
| 203 | vty_out(vty, " E1 TEI %u, SAPI %u%s", |
| 204 | e1l->tei, e1l->sapi, VTY_NEWLINE); |
| 205 | } |
| 206 | |
| 207 | static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts) |
| 208 | { |
Harald Welte | fe96f38 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 209 | struct pchan_load pl; |
| 210 | |
Holger Hans Peter Freyther | a098dfb | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 211 | vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, " |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 212 | "BSIC %u, TSC %u and %u TRX%s", |
| 213 | bts->nr, btstype2str(bts->type), gsm_band_name(bts->band), |
Holger Hans Peter Freyther | a098dfb | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 214 | bts->cell_identity, |
Holger Hans Peter Freyther | 7113514 | 2010-03-29 08:47:44 +0200 | [diff] [blame] | 215 | bts->location_area_code, bts->bsic, bts->tsc, |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 216 | bts->num_trx, VTY_NEWLINE); |
Harald Welte | 8791dac | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 217 | vty_out(vty, "Description: %s%s", |
| 218 | bts->description ? bts->description : "(null)", VTY_NEWLINE); |
Harald Welte | 8e9d179 | 2009-12-12 15:38:16 +0100 | [diff] [blame] | 219 | vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE); |
Harald Welte | b761bf8 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 220 | vty_out(vty, "Minimum Rx Level for Access: %i dBm%s", |
Harald Welte | 8e9d179 | 2009-12-12 15:38:16 +0100 | [diff] [blame] | 221 | rxlev2dbm(bts->si_common.cell_sel_par.rxlev_acc_min), |
| 222 | VTY_NEWLINE); |
| 223 | vty_out(vty, "Cell Reselection Hysteresis: %u dBm%s", |
Harald Welte | b761bf8 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 224 | bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE); |
Sylvain Munaut | 8e2d8de | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 225 | vty_out(vty, "RACH TX-Integer: %u%s", bts->si_common.rach_control.tx_integer, |
| 226 | VTY_NEWLINE); |
| 227 | vty_out(vty, "RACH Max transmissions: %u%s", |
| 228 | rach_max_trans_raw2val(bts->si_common.rach_control.max_trans), |
| 229 | VTY_NEWLINE); |
Harald Welte | 8c973ba | 2009-12-21 23:08:18 +0100 | [diff] [blame] | 230 | if (bts->si_common.rach_control.cell_bar) |
Harald Welte (local) | e19be3f | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 231 | vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE); |
Harald Welte | d8acf14 | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 232 | vty_out(vty, "System Information present: 0x%08x, static: 0x%08x%s", |
| 233 | bts->si_valid, bts->si_mode_static, VTY_NEWLINE); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 234 | if (is_ipaccess_bts(bts)) |
Harald Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 235 | vty_out(vty, " Unit ID: %u/%u/0, OML Stream ID 0x%02x%s", |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 236 | bts->ip_access.site_id, bts->ip_access.bts_id, |
Harald Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 237 | bts->oml_tei, VTY_NEWLINE); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 238 | vty_out(vty, " NM State: "); |
| 239 | net_dump_nmstate(vty, &bts->nm_state); |
| 240 | vty_out(vty, " Site Mgr NM State: "); |
| 241 | net_dump_nmstate(vty, &bts->site_mgr.nm_state); |
| 242 | vty_out(vty, " Paging: FIXME pending requests, %u free slots%s", |
| 243 | bts->paging.available_slots, VTY_NEWLINE); |
Harald Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 244 | if (!is_ipaccess_bts(bts)) { |
| 245 | vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE); |
| 246 | e1isl_dump_vty(vty, bts->oml_link); |
| 247 | } |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 248 | /* FIXME: oml_link, chan_desc */ |
Harald Welte | fe96f38 | 2009-12-22 13:09:29 +0100 | [diff] [blame] | 249 | memset(&pl, 0, sizeof(pl)); |
| 250 | bts_chan_load(&pl, bts); |
| 251 | vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE); |
| 252 | dump_pchan_load_vty(vty, " ", &pl); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 253 | } |
| 254 | |
| 255 | DEFUN(show_bts, show_bts_cmd, "show bts [number]", |
| 256 | SHOW_STR "Display information about a BTS\n" |
| 257 | "BTS number") |
| 258 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 259 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 260 | int bts_nr; |
| 261 | |
| 262 | if (argc != 0) { |
| 263 | /* use the BTS number that the user has specified */ |
| 264 | bts_nr = atoi(argv[0]); |
| 265 | if (bts_nr > net->num_bts) { |
| 266 | vty_out(vty, "%% can't find BTS '%s'%s", argv[0], |
| 267 | VTY_NEWLINE); |
| 268 | return CMD_WARNING; |
| 269 | } |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 270 | bts_dump_vty(vty, gsm_bts_num(net, bts_nr)); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 271 | return CMD_SUCCESS; |
| 272 | } |
| 273 | /* print all BTS's */ |
| 274 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 275 | bts_dump_vty(vty, gsm_bts_num(net, bts_nr)); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 276 | |
| 277 | return CMD_SUCCESS; |
| 278 | } |
| 279 | |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 280 | /* utility functions */ |
| 281 | static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line, |
| 282 | const char *ts, const char *ss) |
| 283 | { |
| 284 | e1_link->e1_nr = atoi(line); |
| 285 | e1_link->e1_ts = atoi(ts); |
| 286 | if (!strcmp(ss, "full")) |
| 287 | e1_link->e1_ts_ss = 255; |
| 288 | else |
| 289 | e1_link->e1_ts_ss = atoi(ss); |
| 290 | } |
| 291 | |
| 292 | static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link, |
| 293 | const char *prefix) |
| 294 | { |
| 295 | if (!e1_link->e1_ts) |
| 296 | return; |
| 297 | |
| 298 | if (e1_link->e1_ts_ss == 255) |
| 299 | vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s", |
| 300 | prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE); |
| 301 | else |
| 302 | vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s", |
| 303 | prefix, e1_link->e1_nr, e1_link->e1_ts, |
| 304 | e1_link->e1_ts_ss, VTY_NEWLINE); |
| 305 | } |
| 306 | |
| 307 | |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 308 | static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts) |
| 309 | { |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 310 | vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE); |
| 311 | if (ts->pchan != GSM_PCHAN_NONE) |
| 312 | vty_out(vty, " phys_chan_config %s%s", |
| 313 | gsm_pchan_name(ts->pchan), VTY_NEWLINE); |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 314 | vty_out(vty, " hopping enabled %u%s", |
| 315 | ts->hopping.enabled, VTY_NEWLINE); |
| 316 | if (ts->hopping.enabled) { |
| 317 | unsigned int i; |
| 318 | vty_out(vty, " hopping sequence-number %u%s", |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 319 | ts->hopping.hsn, VTY_NEWLINE); |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 320 | vty_out(vty, " hopping maio %u%s", |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 321 | ts->hopping.maio, VTY_NEWLINE); |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 322 | for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) { |
| 323 | if (!bitvec_get_bit_pos(&ts->hopping.arfcns, i)) |
| 324 | continue; |
| 325 | vty_out(vty, " hopping arfcn add %u%s", |
| 326 | i, VTY_NEWLINE); |
| 327 | } |
| 328 | } else |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 329 | config_write_e1_link(vty, &ts->e1_link, " "); |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 330 | } |
| 331 | |
| 332 | static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx) |
| 333 | { |
| 334 | int i; |
| 335 | |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 336 | vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE); |
Harald Welte | 8791dac | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 337 | if (trx->description) |
| 338 | vty_out(vty, " description %s%s", trx->description, |
| 339 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 32be2aa | 2010-04-17 06:42:07 +0200 | [diff] [blame] | 340 | vty_out(vty, " rf_locked %u%s", |
| 341 | trx->nm_state.administrative == NM_STATE_LOCKED ? 1 : 0, |
| 342 | VTY_NEWLINE); |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 343 | vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE); |
Harald Welte (local) | b709bfe | 2009-12-27 20:56:38 +0100 | [diff] [blame] | 344 | vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE); |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 345 | vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE); |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 346 | config_write_e1_link(vty, &trx->rsl_e1_link, " rsl "); |
| 347 | vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE); |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 348 | |
| 349 | for (i = 0; i < TRX_NR_TS; i++) |
| 350 | config_write_ts_single(vty, &trx->ts[i]); |
| 351 | } |
| 352 | |
Harald Welte | a925176 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 353 | static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts) |
| 354 | { |
| 355 | unsigned int i; |
| 356 | vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode), |
| 357 | VTY_NEWLINE); |
| 358 | if (bts->gprs.mode == BTS_GPRS_NONE) |
| 359 | return; |
| 360 | |
| 361 | vty_out(vty, " gprs routing area %u%s", bts->gprs.rac, |
| 362 | VTY_NEWLINE); |
| 363 | vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci, |
| 364 | VTY_NEWLINE); |
| 365 | for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++) |
| 366 | vty_out(vty, " gprs cell timer %s %u%s", |
| 367 | get_value_string(gprs_bssgp_cfg_strs, i), |
| 368 | bts->gprs.cell.timer[i], VTY_NEWLINE); |
| 369 | vty_out(vty, " gprs nsei %u%s", bts->gprs.nse.nsei, |
| 370 | VTY_NEWLINE); |
| 371 | for (i = 0; i < ARRAY_SIZE(bts->gprs.nse.timer); i++) |
| 372 | vty_out(vty, " gprs ns timer %s %u%s", |
| 373 | get_value_string(gprs_ns_timer_strs, i), |
| 374 | bts->gprs.nse.timer[i], VTY_NEWLINE); |
| 375 | for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) { |
| 376 | struct gsm_bts_gprs_nsvc *nsvc = |
| 377 | &bts->gprs.nsvc[i]; |
| 378 | struct in_addr ia; |
| 379 | |
| 380 | ia.s_addr = htonl(nsvc->remote_ip); |
| 381 | vty_out(vty, " gprs nsvc %u nsvci %u%s", i, |
| 382 | nsvc->nsvci, VTY_NEWLINE); |
| 383 | vty_out(vty, " gprs nsvc %u local udp port %u%s", i, |
| 384 | nsvc->local_port, VTY_NEWLINE); |
| 385 | vty_out(vty, " gprs nsvc %u remote udp port %u%s", i, |
| 386 | nsvc->remote_port, VTY_NEWLINE); |
| 387 | vty_out(vty, " gprs nsvc %u remote ip %s%s", i, |
| 388 | inet_ntoa(ia), VTY_NEWLINE); |
| 389 | } |
| 390 | } |
| 391 | |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 392 | static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) |
| 393 | { |
| 394 | struct gsm_bts_trx *trx; |
Harald Welte | d8acf14 | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 395 | int i; |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 396 | |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 397 | vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE); |
| 398 | vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE); |
Harald Welte | 8791dac | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 399 | if (bts->description) |
| 400 | vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE); |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 401 | vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE); |
Holger Hans Peter Freyther | 6d82b7c | 2009-11-19 16:38:49 +0100 | [diff] [blame] | 402 | vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE); |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 403 | vty_out(vty, " location_area_code %u%s", bts->location_area_code, |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 404 | VTY_NEWLINE); |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 405 | vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE); |
| 406 | vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE); |
Harald Welte (local) | cbd4610 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 407 | vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE); |
Harald Welte | b761bf8 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 408 | vty_out(vty, " cell reselection hysteresis %u%s", |
| 409 | bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE); |
| 410 | vty_out(vty, " rxlev access min %u%s", |
| 411 | bts->si_common.cell_sel_par.rxlev_acc_min, VTY_NEWLINE); |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 412 | if (bts->si_common.chan_desc.t3212) |
Harald Welte (local) | b6ea7f7 | 2009-08-14 23:09:25 +0200 | [diff] [blame] | 413 | vty_out(vty, " periodic location update %u%s", |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 414 | bts->si_common.chan_desc.t3212 * 10, VTY_NEWLINE); |
Harald Welte | 3e77461 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 415 | vty_out(vty, " channel allocator %s%s", |
| 416 | bts->chan_alloc_reverse ? "descending" : "ascending", |
| 417 | VTY_NEWLINE); |
Sylvain Munaut | 8e2d8de | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 418 | vty_out(vty, " rach tx integer %u%s", |
| 419 | bts->si_common.rach_control.tx_integer, VTY_NEWLINE); |
| 420 | vty_out(vty, " rach max transmission %u%s", |
| 421 | rach_max_trans_raw2val(bts->si_common.rach_control.max_trans), |
| 422 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 697ed2b | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 423 | |
| 424 | if (bts->rach_b_thresh != -1) |
| 425 | vty_out(vty, " rach nm busy threshold %u%s", |
| 426 | bts->rach_b_thresh, VTY_NEWLINE); |
| 427 | if (bts->rach_ldavg_slots != -1) |
| 428 | vty_out(vty, " rach nm load average %u%s", |
| 429 | bts->rach_ldavg_slots, VTY_NEWLINE); |
Harald Welte | 8c973ba | 2009-12-21 23:08:18 +0100 | [diff] [blame] | 430 | if (bts->si_common.rach_control.cell_bar) |
Harald Welte (local) | e19be3f | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 431 | vty_out(vty, " cell barred 1%s", VTY_NEWLINE); |
Holger Hans Peter Freyther | 440984b | 2010-05-14 00:39:19 +0800 | [diff] [blame] | 432 | if ((bts->si_common.rach_control.t2 & 0x4) == 0) |
| 433 | vty_out(vty, " rach emergency call allowed 1%s", VTY_NEWLINE); |
Harald Welte | d8acf14 | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 434 | for (i = SYSINFO_TYPE_1; i < _MAX_SYSINFO_TYPE; i++) { |
| 435 | if (bts->si_mode_static & (1 << i)) { |
| 436 | vty_out(vty, " system-information %s mode static%s", |
| 437 | get_value_string(osmo_sitype_strs, i), VTY_NEWLINE); |
| 438 | vty_out(vty, " system-information %s static %s%s", |
| 439 | get_value_string(osmo_sitype_strs, i), |
| 440 | hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])), |
| 441 | VTY_NEWLINE); |
| 442 | } |
| 443 | } |
Harald Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 444 | if (is_ipaccess_bts(bts)) { |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 445 | vty_out(vty, " ip.access unit_id %u %u%s", |
Harald Welte | 3ffe1b3 | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 446 | bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE); |
Harald Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 447 | vty_out(vty, " oml ip.access stream_id %u%s", bts->oml_tei, VTY_NEWLINE); |
| 448 | } else { |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 449 | config_write_e1_link(vty, &bts->oml_e1_link, " oml "); |
| 450 | vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE); |
| 451 | } |
Holger Hans Peter Freyther | 3112f67 | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 452 | |
| 453 | /* if we have a limit, write it */ |
| 454 | if (bts->paging.free_chans_need >= 0) |
| 455 | vty_out(vty, " paging free %d%s", bts->paging.free_chans_need, VTY_NEWLINE); |
| 456 | |
Harald Welte | a925176 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 457 | config_write_bts_gprs(vty, bts); |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 458 | |
| 459 | llist_for_each_entry(trx, &bts->trx_list, list) |
| 460 | config_write_trx_single(vty, trx); |
| 461 | } |
| 462 | |
| 463 | static int config_write_bts(struct vty *v) |
| 464 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 465 | struct gsm_network *gsmnet = gsmnet_from_vty(v); |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 466 | struct gsm_bts *bts; |
| 467 | |
| 468 | llist_for_each_entry(bts, &gsmnet->bts_list, list) |
| 469 | config_write_bts_single(v, bts); |
| 470 | |
| 471 | return CMD_SUCCESS; |
| 472 | } |
| 473 | |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 474 | static int config_write_net(struct vty *vty) |
| 475 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 476 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 477 | |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 478 | vty_out(vty, "network%s", VTY_NEWLINE); |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 479 | vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE); |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 480 | vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE); |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 481 | vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE); |
| 482 | vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE); |
Harald Welte (local) | a59a27e | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 483 | vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE); |
Harald Welte | 59936d7 | 2009-11-18 20:33:19 +0100 | [diff] [blame] | 484 | vty_out(vty, " location updating reject cause %u%s", |
| 485 | gsmnet->reject_cause, VTY_NEWLINE); |
Harald Welte | cca253a | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 486 | vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE); |
Holger Hans Peter Freyther | 6b4f546 | 2009-11-19 16:37:48 +0100 | [diff] [blame] | 487 | vty_out(vty, " neci %u%s", gsmnet->neci, VTY_NEWLINE); |
Holger Hans Peter Freyther | b6b9d70 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 488 | vty_out(vty, " paging any use tch %d%s", gsmnet->pag_any_tch, VTY_NEWLINE); |
Harald Welte | 52af195 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 489 | vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode), |
| 490 | VTY_NEWLINE); |
Harald Welte | a310f3e | 2009-12-14 09:00:24 +0100 | [diff] [blame] | 491 | vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE); |
Harald Welte | 0af9c9f | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 492 | vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE); |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 493 | vty_out(vty, " handover window rxlev averaging %u%s", |
| 494 | gsmnet->handover.win_rxlev_avg, VTY_NEWLINE); |
| 495 | vty_out(vty, " handover window rxqual averaging %u%s", |
| 496 | gsmnet->handover.win_rxqual_avg, VTY_NEWLINE); |
| 497 | vty_out(vty, " handover window rxlev neighbor averaging %u%s", |
| 498 | gsmnet->handover.win_rxlev_avg_neigh, VTY_NEWLINE); |
| 499 | vty_out(vty, " handover power budget interval %u%s", |
| 500 | gsmnet->handover.pwr_interval, VTY_NEWLINE); |
| 501 | vty_out(vty, " handover power budget hysteresis %u%s", |
| 502 | gsmnet->handover.pwr_hysteresis, VTY_NEWLINE); |
| 503 | vty_out(vty, " handover maximum distance %u%s", |
| 504 | gsmnet->handover.max_distance, VTY_NEWLINE); |
Holger Hans Peter Freyther | 26ba2e7 | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 505 | vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE); |
Holger Hans Peter Freyther | 8973386 | 2009-11-21 21:42:26 +0100 | [diff] [blame] | 506 | vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE); |
| 507 | vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE); |
| 508 | vty_out(vty, " timer t3107 %u%s", gsmnet->T3107, VTY_NEWLINE); |
| 509 | vty_out(vty, " timer t3109 %u%s", gsmnet->T3109, VTY_NEWLINE); |
| 510 | vty_out(vty, " timer t3111 %u%s", gsmnet->T3111, VTY_NEWLINE); |
| 511 | vty_out(vty, " timer t3113 %u%s", gsmnet->T3113, VTY_NEWLINE); |
| 512 | vty_out(vty, " timer t3115 %u%s", gsmnet->T3115, VTY_NEWLINE); |
| 513 | vty_out(vty, " timer t3117 %u%s", gsmnet->T3117, VTY_NEWLINE); |
| 514 | vty_out(vty, " timer t3119 %u%s", gsmnet->T3119, VTY_NEWLINE); |
| 515 | vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE); |
Holger Hans Peter Freyther | 21d63ff | 2010-09-06 09:25:48 +0800 | [diff] [blame] | 516 | vty_out(vty, " use-dtx %u%s", gsmnet->dtx_enabled, VTY_NEWLINE); |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 517 | |
| 518 | return CMD_SUCCESS; |
| 519 | } |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 520 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 521 | static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx) |
| 522 | { |
| 523 | vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s", |
| 524 | trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE); |
Harald Welte | 8791dac | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 525 | vty_out(vty, "Description: %s%s", |
| 526 | trx->description ? trx->description : "(null)", VTY_NEWLINE); |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 527 | vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, " |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 528 | "resulting BS power: %d dBm%s", |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 529 | trx->nominal_power, trx->max_power_red, |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 530 | trx->nominal_power - trx->max_power_red, VTY_NEWLINE); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 531 | vty_out(vty, " NM State: "); |
| 532 | net_dump_nmstate(vty, &trx->nm_state); |
| 533 | vty_out(vty, " Baseband Transceiver NM State: "); |
| 534 | net_dump_nmstate(vty, &trx->bb_transc.nm_state); |
Harald Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 535 | if (is_ipaccess_bts(trx->bts)) { |
| 536 | vty_out(vty, " ip.access stream ID: 0x%02x%s", |
| 537 | trx->rsl_tei, VTY_NEWLINE); |
| 538 | } else { |
| 539 | vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE); |
| 540 | e1isl_dump_vty(vty, trx->rsl_link); |
| 541 | } |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 542 | } |
| 543 | |
| 544 | DEFUN(show_trx, |
| 545 | show_trx_cmd, |
| 546 | "show trx [bts_nr] [trx_nr]", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 547 | SHOW_STR "Display information about a TRX\n" |
| 548 | "BTS Number\n" |
| 549 | "TRX Number\n") |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 550 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 551 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 552 | struct gsm_bts *bts = NULL; |
| 553 | struct gsm_bts_trx *trx; |
| 554 | int bts_nr, trx_nr; |
| 555 | |
| 556 | if (argc >= 1) { |
| 557 | /* use the BTS number that the user has specified */ |
| 558 | bts_nr = atoi(argv[0]); |
| 559 | if (bts_nr >= net->num_bts) { |
| 560 | vty_out(vty, "%% can't find BTS '%s'%s", argv[0], |
| 561 | VTY_NEWLINE); |
| 562 | return CMD_WARNING; |
| 563 | } |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 564 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 565 | } |
| 566 | if (argc >= 2) { |
| 567 | trx_nr = atoi(argv[1]); |
| 568 | if (trx_nr >= bts->num_trx) { |
| 569 | vty_out(vty, "%% can't find TRX '%s'%s", argv[1], |
| 570 | VTY_NEWLINE); |
| 571 | return CMD_WARNING; |
| 572 | } |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 573 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 574 | trx_dump_vty(vty, trx); |
| 575 | return CMD_SUCCESS; |
| 576 | } |
| 577 | if (bts) { |
| 578 | /* print all TRX in this BTS */ |
| 579 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 580 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 581 | trx_dump_vty(vty, trx); |
| 582 | } |
| 583 | return CMD_SUCCESS; |
| 584 | } |
| 585 | |
| 586 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 587 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 588 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 589 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 590 | trx_dump_vty(vty, trx); |
| 591 | } |
| 592 | } |
| 593 | |
| 594 | return CMD_SUCCESS; |
| 595 | } |
| 596 | |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 597 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 598 | static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts) |
| 599 | { |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 600 | vty_out(vty, "Timeslot %u of TRX %u in BTS %u, phys cfg %s%s", |
| 601 | ts->nr, ts->trx->nr, ts->trx->bts->nr, |
| 602 | gsm_pchan_name(ts->pchan), VTY_NEWLINE); |
| 603 | vty_out(vty, " NM State: "); |
| 604 | net_dump_nmstate(vty, &ts->nm_state); |
Harald Welte | 8750421 | 2009-12-02 01:56:49 +0530 | [diff] [blame] | 605 | if (!is_ipaccess_bts(ts->trx->bts)) |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 606 | vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s", |
| 607 | ts->e1_link.e1_nr, ts->e1_link.e1_ts, |
| 608 | ts->e1_link.e1_ts_ss, VTY_NEWLINE); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 609 | } |
| 610 | |
| 611 | DEFUN(show_ts, |
| 612 | show_ts_cmd, |
| 613 | "show timeslot [bts_nr] [trx_nr] [ts_nr]", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 614 | SHOW_STR "Display information about a TS\n" |
| 615 | "BTS Number\n" "TRX Number\n" "Timeslot Number\n") |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 616 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 617 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 618 | struct gsm_bts *bts; |
| 619 | struct gsm_bts_trx *trx; |
| 620 | struct gsm_bts_trx_ts *ts; |
| 621 | int bts_nr, trx_nr, ts_nr; |
| 622 | |
| 623 | if (argc >= 1) { |
| 624 | /* use the BTS number that the user has specified */ |
| 625 | bts_nr = atoi(argv[0]); |
| 626 | if (bts_nr >= net->num_bts) { |
| 627 | vty_out(vty, "%% can't find BTS '%s'%s", argv[0], |
| 628 | VTY_NEWLINE); |
| 629 | return CMD_WARNING; |
| 630 | } |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 631 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 632 | } |
| 633 | if (argc >= 2) { |
| 634 | trx_nr = atoi(argv[1]); |
| 635 | if (trx_nr >= bts->num_trx) { |
| 636 | vty_out(vty, "%% can't find TRX '%s'%s", argv[1], |
| 637 | VTY_NEWLINE); |
| 638 | return CMD_WARNING; |
| 639 | } |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 640 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 641 | } |
| 642 | if (argc >= 3) { |
| 643 | ts_nr = atoi(argv[2]); |
| 644 | if (ts_nr >= TRX_NR_TS) { |
| 645 | vty_out(vty, "%% can't find TS '%s'%s", argv[2], |
| 646 | VTY_NEWLINE); |
| 647 | return CMD_WARNING; |
| 648 | } |
| 649 | ts = &trx->ts[ts_nr]; |
| 650 | ts_dump_vty(vty, ts); |
| 651 | return CMD_SUCCESS; |
| 652 | } |
| 653 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 654 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 655 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 656 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 657 | for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) { |
| 658 | ts = &trx->ts[ts_nr]; |
| 659 | ts_dump_vty(vty, ts); |
| 660 | } |
| 661 | } |
| 662 | } |
| 663 | |
| 664 | return CMD_SUCCESS; |
| 665 | } |
| 666 | |
Holger Hans Peter Freyther | 1dd0a1b | 2010-01-06 06:00:40 +0100 | [diff] [blame] | 667 | static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr) |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 668 | { |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 669 | vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id, |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 670 | subscr->authorized, VTY_NEWLINE); |
| 671 | if (subscr->name) |
| 672 | vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE); |
| 673 | if (subscr->extension) |
| 674 | vty_out(vty, " Extension: %s%s", subscr->extension, |
| 675 | VTY_NEWLINE); |
| 676 | if (subscr->imsi) |
| 677 | vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE); |
Holger Hans Peter Freyther | cd8bacf | 2009-08-19 12:53:57 +0200 | [diff] [blame] | 678 | if (subscr->tmsi != GSM_RESERVED_TMSI) |
| 679 | vty_out(vty, " TMSI: %08X%s", subscr->tmsi, |
Harald Welte | 270c06c | 2009-08-15 03:24:51 +0200 | [diff] [blame] | 680 | VTY_NEWLINE); |
Sylvain Munaut | e5863a2 | 2009-12-27 19:29:28 +0100 | [diff] [blame] | 681 | |
Harald Welte (local) | 02d5efa | 2009-08-14 20:27:16 +0200 | [diff] [blame] | 682 | vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 683 | } |
| 684 | |
Harald Welte | 4400774 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 685 | static void meas_rep_dump_uni_vty(struct vty *vty, |
| 686 | struct gsm_meas_rep_unidir *mru, |
| 687 | const char *prefix, |
| 688 | const char *dir) |
| 689 | { |
| 690 | vty_out(vty, "%s RXL-FULL-%s: %4d dBm, RXL-SUB-%s: %4d dBm ", |
| 691 | prefix, dir, rxlev2dbm(mru->full.rx_lev), |
| 692 | dir, rxlev2dbm(mru->sub.rx_lev)); |
| 693 | vty_out(vty, "RXQ-FULL-%s: %d, RXQ-SUB-%s: %d%s", |
| 694 | dir, mru->full.rx_qual, dir, mru->sub.rx_qual, |
| 695 | VTY_NEWLINE); |
| 696 | } |
| 697 | |
| 698 | static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr, |
| 699 | const char *prefix) |
| 700 | { |
| 701 | vty_out(vty, "%sMeasurement Report:%s", prefix, VTY_NEWLINE); |
| 702 | vty_out(vty, "%s Flags: %s%s%s%s%s", prefix, |
| 703 | mr->flags & MEAS_REP_F_UL_DTX ? "DTXu " : "", |
| 704 | mr->flags & MEAS_REP_F_DL_DTX ? "DTXd " : "", |
| 705 | mr->flags & MEAS_REP_F_FPC ? "FPC " : "", |
| 706 | mr->flags & MEAS_REP_F_DL_VALID ? " " : "DLinval ", |
| 707 | VTY_NEWLINE); |
| 708 | if (mr->flags & MEAS_REP_F_MS_TO) |
| 709 | vty_out(vty, "%s MS Timing Offset: %u%s", prefix, |
| 710 | mr->ms_timing_offset, VTY_NEWLINE); |
| 711 | if (mr->flags & MEAS_REP_F_MS_L1) |
| 712 | vty_out(vty, "%s L1 MS Power: %u dBm, Timing Advance: %u%s", |
| 713 | prefix, mr->ms_l1.pwr, mr->ms_l1.ta, VTY_NEWLINE); |
| 714 | if (mr->flags & MEAS_REP_F_DL_VALID) |
| 715 | meas_rep_dump_uni_vty(vty, &mr->dl, prefix, "dl"); |
| 716 | meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul"); |
| 717 | } |
| 718 | |
Holger Hans Peter Freyther | 5424e02 | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 719 | static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan) |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 720 | { |
Harald Welte | 4400774 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 721 | int idx; |
| 722 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 723 | vty_out(vty, "Lchan %u in Timeslot %u of TRX %u in BTS %u, Type %s%s", |
Holger Hans Peter Freyther | 7113514 | 2010-03-29 08:47:44 +0200 | [diff] [blame] | 724 | lchan->nr, lchan->ts->nr, lchan->ts->trx->nr, |
Harald Welte (local) | 02204d0 | 2009-12-27 18:05:25 +0100 | [diff] [blame] | 725 | lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type), |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 726 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 6e5c50f | 2010-06-28 17:09:29 +0800 | [diff] [blame] | 727 | vty_out(vty, " Connection: %u, State: %s%s", |
| 728 | lchan->conn ? 1: 0, |
Harald Welte | ab2534c | 2009-12-29 10:52:38 +0100 | [diff] [blame] | 729 | gsm_lchans_name(lchan->state), VTY_NEWLINE); |
Harald Welte | b761bf8 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 730 | vty_out(vty, " BS Power: %u dBm, MS Power: %u dBm%s", |
| 731 | lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red |
| 732 | - lchan->bs_power*2, |
| 733 | ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power), |
| 734 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 1a95fa8 | 2010-06-28 15:47:12 +0800 | [diff] [blame] | 735 | if (lchan->conn && lchan->conn->subscr) { |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 736 | vty_out(vty, " Subscriber:%s", VTY_NEWLINE); |
Holger Hans Peter Freyther | 1a95fa8 | 2010-06-28 15:47:12 +0800 | [diff] [blame] | 737 | subscr_dump_vty(vty, lchan->conn->subscr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 738 | } else |
| 739 | vty_out(vty, " No Subscriber%s", VTY_NEWLINE); |
Harald Welte | 8750421 | 2009-12-02 01:56:49 +0530 | [diff] [blame] | 740 | if (is_ipaccess_bts(lchan->ts->trx->bts)) { |
| 741 | struct in_addr ia; |
Holger Hans Peter Freyther | cec1ec5 | 2010-04-07 15:39:16 +0200 | [diff] [blame] | 742 | ia.s_addr = htonl(lchan->abis_ip.bound_ip); |
Harald Welte | 8750421 | 2009-12-02 01:56:49 +0530 | [diff] [blame] | 743 | vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s", |
| 744 | inet_ntoa(ia), lchan->abis_ip.bound_port, |
| 745 | lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id, |
| 746 | VTY_NEWLINE); |
| 747 | } |
Harald Welte | 4400774 | 2009-12-22 21:43:14 +0100 | [diff] [blame] | 748 | |
| 749 | /* we want to report the last measurement report */ |
| 750 | idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep), |
| 751 | lchan->meas_rep_idx, 1); |
| 752 | meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " "); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 753 | } |
| 754 | |
Holger Hans Peter Freyther | e959b4e | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 755 | static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan) |
| 756 | { |
Holger Hans Peter Freyther | cf13a92 | 2010-05-14 01:57:02 +0800 | [diff] [blame] | 757 | struct gsm_meas_rep *mr; |
| 758 | int idx; |
| 759 | |
| 760 | /* we want to report the last measurement report */ |
| 761 | idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep), |
| 762 | lchan->meas_rep_idx, 1); |
| 763 | mr = &lchan->meas_rep[idx]; |
| 764 | |
| 765 | vty_out(vty, "Lchan: %u Timeslot: %u TRX: %u BTS: %u Type: %s - L1 MS Power: %u dBm " |
| 766 | "RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s", |
Holger Hans Peter Freyther | e959b4e | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 767 | lchan->nr, lchan->ts->nr, lchan->ts->trx->nr, |
| 768 | lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type), |
Holger Hans Peter Freyther | cf13a92 | 2010-05-14 01:57:02 +0800 | [diff] [blame] | 769 | mr->ms_l1.pwr, |
| 770 | rxlev2dbm(mr->dl.full.rx_lev), |
| 771 | rxlev2dbm(mr->ul.full.rx_lev), |
Holger Hans Peter Freyther | e959b4e | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 772 | VTY_NEWLINE); |
| 773 | } |
| 774 | |
Holger Hans Peter Freyther | 5424e02 | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 775 | static int lchan_summary(struct vty *vty, int argc, const char **argv, |
| 776 | void (*dump_cb)(struct vty *, struct gsm_lchan *)) |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 777 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 778 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 779 | struct gsm_bts *bts; |
| 780 | struct gsm_bts_trx *trx; |
| 781 | struct gsm_bts_trx_ts *ts; |
| 782 | struct gsm_lchan *lchan; |
| 783 | int bts_nr, trx_nr, ts_nr, lchan_nr; |
| 784 | |
| 785 | if (argc >= 1) { |
| 786 | /* use the BTS number that the user has specified */ |
| 787 | bts_nr = atoi(argv[0]); |
| 788 | if (bts_nr >= net->num_bts) { |
| 789 | vty_out(vty, "%% can't find BTS %s%s", argv[0], |
| 790 | VTY_NEWLINE); |
| 791 | return CMD_WARNING; |
| 792 | } |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 793 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 794 | } |
| 795 | if (argc >= 2) { |
| 796 | trx_nr = atoi(argv[1]); |
| 797 | if (trx_nr >= bts->num_trx) { |
| 798 | vty_out(vty, "%% can't find TRX %s%s", argv[1], |
| 799 | VTY_NEWLINE); |
| 800 | return CMD_WARNING; |
| 801 | } |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 802 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 803 | } |
| 804 | if (argc >= 3) { |
| 805 | ts_nr = atoi(argv[2]); |
| 806 | if (ts_nr >= TRX_NR_TS) { |
| 807 | vty_out(vty, "%% can't find TS %s%s", argv[2], |
| 808 | VTY_NEWLINE); |
| 809 | return CMD_WARNING; |
| 810 | } |
| 811 | ts = &trx->ts[ts_nr]; |
| 812 | } |
| 813 | if (argc >= 4) { |
| 814 | lchan_nr = atoi(argv[3]); |
| 815 | if (lchan_nr >= TS_MAX_LCHAN) { |
| 816 | vty_out(vty, "%% can't find LCHAN %s%s", argv[3], |
| 817 | VTY_NEWLINE); |
| 818 | return CMD_WARNING; |
| 819 | } |
| 820 | lchan = &ts->lchan[lchan_nr]; |
Holger Hans Peter Freyther | 5424e02 | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 821 | dump_cb(vty, lchan); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 822 | return CMD_SUCCESS; |
| 823 | } |
| 824 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 825 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 826 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 827 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 828 | for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) { |
| 829 | ts = &trx->ts[ts_nr]; |
| 830 | for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN; |
| 831 | lchan_nr++) { |
| 832 | lchan = &ts->lchan[lchan_nr]; |
| 833 | if (lchan->type == GSM_LCHAN_NONE) |
| 834 | continue; |
Holger Hans Peter Freyther | 5424e02 | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 835 | dump_cb(vty, lchan); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 836 | } |
| 837 | } |
| 838 | } |
| 839 | } |
| 840 | |
| 841 | return CMD_SUCCESS; |
| 842 | } |
| 843 | |
Holger Hans Peter Freyther | 5424e02 | 2010-05-14 02:03:16 +0800 | [diff] [blame] | 844 | |
| 845 | DEFUN(show_lchan, |
| 846 | show_lchan_cmd, |
| 847 | "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]", |
| 848 | SHOW_STR "Display information about a logical channel\n" |
| 849 | "BTS Number\n" "TRX Number\n" "Timeslot Number\n" |
| 850 | "Logical Channel Number\n") |
| 851 | |
| 852 | { |
| 853 | return lchan_summary(vty, argc, argv, lchan_dump_full_vty); |
| 854 | } |
| 855 | |
Holger Hans Peter Freyther | e959b4e | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 856 | DEFUN(show_lchan_summary, |
| 857 | show_lchan_summary_cmd, |
| 858 | "show lchan summary [bts_nr] [trx_nr] [ts_nr] [lchan_nr]", |
| 859 | SHOW_STR "Display information about a logical channel\n" |
| 860 | "BTS Number\n" "TRX Number\n" "Timeslot Number\n" |
| 861 | "Logical Channel Number\n") |
| 862 | { |
| 863 | return lchan_summary(vty, argc, argv, lchan_dump_short_vty); |
| 864 | } |
| 865 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 866 | static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv) |
| 867 | { |
| 868 | vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE); |
| 869 | } |
| 870 | |
| 871 | DEFUN(show_e1drv, |
| 872 | show_e1drv_cmd, |
| 873 | "show e1_driver", |
| 874 | SHOW_STR "Display information about available E1 drivers\n") |
| 875 | { |
| 876 | struct e1inp_driver *drv; |
| 877 | |
| 878 | llist_for_each_entry(drv, &e1inp_driver_list, list) |
| 879 | e1drv_dump_vty(vty, drv); |
| 880 | |
| 881 | return CMD_SUCCESS; |
| 882 | } |
| 883 | |
| 884 | static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line) |
| 885 | { |
| 886 | vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s", |
| 887 | line->num, line->name ? line->name : "", |
| 888 | line->driver->name, VTY_NEWLINE); |
| 889 | } |
| 890 | |
| 891 | DEFUN(show_e1line, |
| 892 | show_e1line_cmd, |
| 893 | "show e1_line [line_nr]", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 894 | SHOW_STR "Display information about a E1 line\n" |
| 895 | "E1 Line Number\n") |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 896 | { |
| 897 | struct e1inp_line *line; |
| 898 | |
| 899 | if (argc >= 1) { |
| 900 | int num = atoi(argv[0]); |
| 901 | llist_for_each_entry(line, &e1inp_line_list, list) { |
| 902 | if (line->num == num) { |
| 903 | e1line_dump_vty(vty, line); |
| 904 | return CMD_SUCCESS; |
| 905 | } |
| 906 | } |
| 907 | return CMD_WARNING; |
| 908 | } |
| 909 | |
| 910 | llist_for_each_entry(line, &e1inp_line_list, list) |
| 911 | e1line_dump_vty(vty, line); |
| 912 | |
| 913 | return CMD_SUCCESS; |
| 914 | } |
| 915 | |
| 916 | static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts) |
| 917 | { |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 918 | if (ts->type == E1INP_TS_TYPE_NONE) |
| 919 | return; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 920 | vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s", |
| 921 | ts->num, ts->line->num, e1inp_tstype_name(ts->type), |
| 922 | VTY_NEWLINE); |
| 923 | } |
| 924 | |
| 925 | DEFUN(show_e1ts, |
| 926 | show_e1ts_cmd, |
| 927 | "show e1_timeslot [line_nr] [ts_nr]", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 928 | SHOW_STR "Display information about a E1 timeslot\n" |
| 929 | "E1 Line Number\n" "E1 Timeslot Number\n") |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 930 | { |
Harald Welte | 49c7956 | 2009-11-17 06:12:16 +0100 | [diff] [blame] | 931 | struct e1inp_line *line = NULL; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 932 | struct e1inp_ts *ts; |
| 933 | int ts_nr; |
| 934 | |
| 935 | if (argc == 0) { |
| 936 | llist_for_each_entry(line, &e1inp_line_list, list) { |
| 937 | for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) { |
| 938 | ts = &line->ts[ts_nr]; |
| 939 | e1ts_dump_vty(vty, ts); |
| 940 | } |
| 941 | } |
| 942 | return CMD_SUCCESS; |
| 943 | } |
| 944 | if (argc >= 1) { |
| 945 | int num = atoi(argv[0]); |
| 946 | llist_for_each_entry(line, &e1inp_line_list, list) { |
| 947 | if (line->num == num) |
| 948 | break; |
| 949 | } |
| 950 | if (!line || line->num != num) { |
| 951 | vty_out(vty, "E1 line %s is invalid%s", |
| 952 | argv[0], VTY_NEWLINE); |
| 953 | return CMD_WARNING; |
| 954 | } |
| 955 | } |
| 956 | if (argc >= 2) { |
| 957 | ts_nr = atoi(argv[1]); |
| 958 | if (ts_nr > NUM_E1_TS) { |
| 959 | vty_out(vty, "E1 timeslot %s is invalid%s", |
| 960 | argv[1], VTY_NEWLINE); |
| 961 | return CMD_WARNING; |
| 962 | } |
| 963 | ts = &line->ts[ts_nr]; |
| 964 | e1ts_dump_vty(vty, ts); |
| 965 | return CMD_SUCCESS; |
| 966 | } else { |
| 967 | for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) { |
| 968 | ts = &line->ts[ts_nr]; |
| 969 | e1ts_dump_vty(vty, ts); |
| 970 | } |
| 971 | return CMD_SUCCESS; |
| 972 | } |
| 973 | return CMD_SUCCESS; |
| 974 | } |
| 975 | |
| 976 | static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag) |
| 977 | { |
| 978 | vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE); |
| 979 | subscr_dump_vty(vty, pag->subscr); |
| 980 | } |
| 981 | |
| 982 | static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts) |
| 983 | { |
| 984 | struct gsm_paging_request *pag; |
| 985 | |
| 986 | llist_for_each_entry(pag, &bts->paging.pending_requests, entry) |
| 987 | paging_dump_vty(vty, pag); |
| 988 | } |
| 989 | |
| 990 | DEFUN(show_paging, |
| 991 | show_paging_cmd, |
| 992 | "show paging [bts_nr]", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 993 | SHOW_STR "Display information about paging reuqests of a BTS\n" |
| 994 | "BTS Number\n") |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 995 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 996 | struct gsm_network *net = gsmnet_from_vty(vty); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 997 | struct gsm_bts *bts; |
| 998 | int bts_nr; |
| 999 | |
| 1000 | if (argc >= 1) { |
| 1001 | /* use the BTS number that the user has specified */ |
| 1002 | bts_nr = atoi(argv[0]); |
| 1003 | if (bts_nr >= net->num_bts) { |
| 1004 | vty_out(vty, "%% can't find BTS %s%s", argv[0], |
| 1005 | VTY_NEWLINE); |
| 1006 | return CMD_WARNING; |
| 1007 | } |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1008 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1009 | bts_paging_dump_vty(vty, bts); |
| 1010 | |
| 1011 | return CMD_SUCCESS; |
| 1012 | } |
| 1013 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1014 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1015 | bts_paging_dump_vty(vty, bts); |
| 1016 | } |
| 1017 | |
| 1018 | return CMD_SUCCESS; |
| 1019 | } |
| 1020 | |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1021 | #define NETWORK_STR "Configure the GSM network\n" |
| 1022 | |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1023 | DEFUN(cfg_net, |
| 1024 | cfg_net_cmd, |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1025 | "network", NETWORK_STR) |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1026 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1027 | vty->index = gsmnet_from_vty(vty); |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1028 | vty->node = GSMNET_NODE; |
| 1029 | |
| 1030 | return CMD_SUCCESS; |
| 1031 | } |
| 1032 | |
| 1033 | |
| 1034 | DEFUN(cfg_net_ncc, |
| 1035 | cfg_net_ncc_cmd, |
| 1036 | "network country code <1-999>", |
| 1037 | "Set the GSM network country code") |
| 1038 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1039 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1040 | |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1041 | gsmnet->country_code = atoi(argv[0]); |
| 1042 | |
| 1043 | return CMD_SUCCESS; |
| 1044 | } |
| 1045 | |
| 1046 | DEFUN(cfg_net_mnc, |
| 1047 | cfg_net_mnc_cmd, |
| 1048 | "mobile network code <1-999>", |
| 1049 | "Set the GSM mobile network code") |
| 1050 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1051 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1052 | |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1053 | gsmnet->network_code = atoi(argv[0]); |
| 1054 | |
| 1055 | return CMD_SUCCESS; |
| 1056 | } |
| 1057 | |
| 1058 | DEFUN(cfg_net_name_short, |
| 1059 | cfg_net_name_short_cmd, |
| 1060 | "short name NAME", |
| 1061 | "Set the short GSM network name") |
| 1062 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1063 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1064 | |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1065 | if (gsmnet->name_short) |
| 1066 | talloc_free(gsmnet->name_short); |
| 1067 | |
| 1068 | gsmnet->name_short = talloc_strdup(gsmnet, argv[0]); |
| 1069 | |
| 1070 | return CMD_SUCCESS; |
| 1071 | } |
| 1072 | |
| 1073 | DEFUN(cfg_net_name_long, |
| 1074 | cfg_net_name_long_cmd, |
| 1075 | "long name NAME", |
| 1076 | "Set the long GSM network name") |
| 1077 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1078 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1079 | |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1080 | if (gsmnet->name_long) |
| 1081 | talloc_free(gsmnet->name_long); |
| 1082 | |
| 1083 | gsmnet->name_long = talloc_strdup(gsmnet, argv[0]); |
| 1084 | |
| 1085 | return CMD_SUCCESS; |
| 1086 | } |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1087 | |
Harald Welte (local) | a59a27e | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 1088 | DEFUN(cfg_net_auth_policy, |
| 1089 | cfg_net_auth_policy_cmd, |
| 1090 | "auth policy (closed|accept-all|token)", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1091 | "Authentication (not cryptographic)\n" |
| 1092 | "Set the GSM network authentication policy\n" |
| 1093 | "Require the MS to be activated in HLR\n" |
| 1094 | "Accept all MS, whether in HLR or not\n" |
| 1095 | "Use SMS-token based authentication\n") |
Harald Welte (local) | a59a27e | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 1096 | { |
| 1097 | enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]); |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1098 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte (local) | a59a27e | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 1099 | |
| 1100 | gsmnet->auth_policy = policy; |
| 1101 | |
| 1102 | return CMD_SUCCESS; |
| 1103 | } |
| 1104 | |
Harald Welte | 59936d7 | 2009-11-18 20:33:19 +0100 | [diff] [blame] | 1105 | DEFUN(cfg_net_reject_cause, |
| 1106 | cfg_net_reject_cause_cmd, |
| 1107 | "location updating reject cause <2-111>", |
| 1108 | "Set the reject cause of location updating reject\n") |
| 1109 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1110 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1111 | |
Harald Welte | 59936d7 | 2009-11-18 20:33:19 +0100 | [diff] [blame] | 1112 | gsmnet->reject_cause = atoi(argv[0]); |
| 1113 | |
| 1114 | return CMD_SUCCESS; |
| 1115 | } |
| 1116 | |
Harald Welte | cca253a | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 1117 | DEFUN(cfg_net_encryption, |
| 1118 | cfg_net_encryption_cmd, |
| 1119 | "encryption a5 (0|1|2)", |
Harald Welte | 18ce31c | 2010-05-14 20:05:17 +0200 | [diff] [blame] | 1120 | "Encryption options\n" |
| 1121 | "A5 encryption\n" "A5/0: No encryption\n" |
| 1122 | "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n") |
Harald Welte | cca253a | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 1123 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1124 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1125 | |
Andreas.Eversberg | 5329329 | 2009-11-17 09:55:26 +0100 | [diff] [blame] | 1126 | gsmnet->a5_encryption= atoi(argv[0]); |
Harald Welte | cca253a | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 1127 | |
| 1128 | return CMD_SUCCESS; |
| 1129 | } |
| 1130 | |
Holger Hans Peter Freyther | 96c8982 | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 1131 | DEFUN(cfg_net_neci, |
| 1132 | cfg_net_neci_cmd, |
| 1133 | "neci (0|1)", |
Harald Welte | 18ce31c | 2010-05-14 20:05:17 +0200 | [diff] [blame] | 1134 | "New Establish Cause Indication\n" |
| 1135 | "Don't set the NECI bit\n" "Set the NECI bit\n") |
Holger Hans Peter Freyther | 96c8982 | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 1136 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1137 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1138 | |
Holger Hans Peter Freyther | 96c8982 | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 1139 | gsmnet->neci = atoi(argv[0]); |
Holger Hans Peter Freyther | f0f37f1 | 2010-09-06 09:36:02 +0800 | [diff] [blame] | 1140 | gsm_net_update_ctype(gsmnet); |
Holger Hans Peter Freyther | 96c8982 | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 1141 | return CMD_SUCCESS; |
| 1142 | } |
| 1143 | |
Harald Welte | 52af195 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 1144 | DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd, |
| 1145 | "rrlp mode (none|ms-based|ms-preferred|ass-preferred)", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1146 | "Radio Resource Location Protocol\n" |
| 1147 | "Set the Radio Resource Location Protocol Mode\n" |
| 1148 | "Don't send RRLP request\n" |
| 1149 | "Request MS-based location\n" |
| 1150 | "Request any location, prefer MS-based\n" |
| 1151 | "Request any location, prefer MS-assisted\n") |
Harald Welte | 52af195 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 1152 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1153 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1154 | |
Harald Welte | 52af195 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 1155 | gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]); |
| 1156 | |
| 1157 | return CMD_SUCCESS; |
| 1158 | } |
| 1159 | |
Harald Welte | a310f3e | 2009-12-14 09:00:24 +0100 | [diff] [blame] | 1160 | DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd, |
| 1161 | "mm info (0|1)", |
| 1162 | "Whether to send MM INFO after LOC UPD ACCEPT") |
| 1163 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1164 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1165 | |
Harald Welte | a310f3e | 2009-12-14 09:00:24 +0100 | [diff] [blame] | 1166 | gsmnet->send_mm_info = atoi(argv[0]); |
| 1167 | |
| 1168 | return CMD_SUCCESS; |
| 1169 | } |
| 1170 | |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1171 | #define HANDOVER_STR "Handover Options\n" |
| 1172 | |
Harald Welte | 0af9c9f | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 1173 | DEFUN(cfg_net_handover, cfg_net_handover_cmd, |
| 1174 | "handover (0|1)", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1175 | HANDOVER_STR |
| 1176 | "Don't perform in-call handover\n" |
| 1177 | "Perform in-call handover\n") |
Harald Welte | 0af9c9f | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 1178 | { |
Holger Hans Peter Freyther | 3524d4b | 2010-01-07 16:14:38 +0100 | [diff] [blame] | 1179 | int enable = atoi(argv[0]); |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1180 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Holger Hans Peter Freyther | 3524d4b | 2010-01-07 16:14:38 +0100 | [diff] [blame] | 1181 | |
| 1182 | if (enable && ipacc_rtp_direct) { |
Harald Welte | aa2c303 | 2009-12-20 13:51:01 +0100 | [diff] [blame] | 1183 | vty_out(vty, "%% Cannot enable handover unless RTP Proxy mode " |
| 1184 | "is enabled by using the -P command line option%s", |
| 1185 | VTY_NEWLINE); |
| 1186 | return CMD_WARNING; |
| 1187 | } |
Holger Hans Peter Freyther | 3524d4b | 2010-01-07 16:14:38 +0100 | [diff] [blame] | 1188 | gsmnet->handover.active = enable; |
Harald Welte | 0af9c9f | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 1189 | |
| 1190 | return CMD_SUCCESS; |
| 1191 | } |
| 1192 | |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1193 | #define HO_WIN_STR HANDOVER_STR "Measurement Window\n" |
| 1194 | #define HO_WIN_RXLEV_STR HO_WIN_STR "Received Level Averaging\n" |
| 1195 | #define HO_WIN_RXQUAL_STR HO_WIN_STR "Received Quality Averaging\n" |
| 1196 | #define HO_PBUDGET_STR HANDOVER_STR "Power Budget\n" |
| 1197 | |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1198 | DEFUN(cfg_net_ho_win_rxlev_avg, cfg_net_ho_win_rxlev_avg_cmd, |
| 1199 | "handover window rxlev averaging <1-10>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1200 | HO_WIN_RXLEV_STR |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1201 | "How many RxLev measurements are used for averaging") |
| 1202 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1203 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1204 | gsmnet->handover.win_rxlev_avg = atoi(argv[0]); |
| 1205 | return CMD_SUCCESS; |
| 1206 | } |
| 1207 | |
| 1208 | DEFUN(cfg_net_ho_win_rxqual_avg, cfg_net_ho_win_rxqual_avg_cmd, |
| 1209 | "handover window rxqual averaging <1-10>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1210 | HO_WIN_RXQUAL_STR |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1211 | "How many RxQual measurements are used for averaging") |
| 1212 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1213 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1214 | gsmnet->handover.win_rxqual_avg = atoi(argv[0]); |
| 1215 | return CMD_SUCCESS; |
| 1216 | } |
| 1217 | |
| 1218 | DEFUN(cfg_net_ho_win_rxlev_neigh_avg, cfg_net_ho_win_rxlev_avg_neigh_cmd, |
| 1219 | "handover window rxlev neighbor averaging <1-10>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1220 | HO_WIN_RXLEV_STR |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1221 | "How many RxQual measurements are used for averaging") |
| 1222 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1223 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1224 | gsmnet->handover.win_rxlev_avg_neigh = atoi(argv[0]); |
| 1225 | return CMD_SUCCESS; |
| 1226 | } |
| 1227 | |
| 1228 | DEFUN(cfg_net_ho_pwr_interval, cfg_net_ho_pwr_interval_cmd, |
| 1229 | "handover power budget interval <1-99>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1230 | HO_PBUDGET_STR |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1231 | "How often to check if we have a better cell (SACCH frames)") |
| 1232 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1233 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1234 | gsmnet->handover.pwr_interval = atoi(argv[0]); |
| 1235 | return CMD_SUCCESS; |
| 1236 | } |
| 1237 | |
| 1238 | DEFUN(cfg_net_ho_pwr_hysteresis, cfg_net_ho_pwr_hysteresis_cmd, |
| 1239 | "handover power budget hysteresis <0-999>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1240 | HO_PBUDGET_STR |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1241 | "How many dB does a neighbor to be stronger to become a HO candidate") |
| 1242 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1243 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1244 | gsmnet->handover.pwr_hysteresis = atoi(argv[0]); |
| 1245 | return CMD_SUCCESS; |
| 1246 | } |
| 1247 | |
| 1248 | DEFUN(cfg_net_ho_max_distance, cfg_net_ho_max_distance_cmd, |
| 1249 | "handover maximum distance <0-9999>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1250 | HANDOVER_STR |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1251 | "How big is the maximum timing advance before HO is forced") |
| 1252 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1253 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 1254 | gsmnet->handover.max_distance = atoi(argv[0]); |
| 1255 | return CMD_SUCCESS; |
| 1256 | } |
Harald Welte | 0af9c9f | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 1257 | |
Holger Hans Peter Freyther | b6b9d70 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 1258 | DEFUN(cfg_net_pag_any_tch, |
| 1259 | cfg_net_pag_any_tch_cmd, |
| 1260 | "paging any use tch (0|1)", |
| 1261 | "Assign a TCH when receiving a Paging Any request") |
| 1262 | { |
Holger Hans Peter Freyther | c562888 | 2010-09-06 10:09:19 +0800 | [diff] [blame] | 1263 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Holger Hans Peter Freyther | b6b9d70 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 1264 | gsmnet->pag_any_tch = atoi(argv[0]); |
| 1265 | gsm_net_update_ctype(gsmnet); |
| 1266 | return CMD_SUCCESS; |
| 1267 | } |
| 1268 | |
Holger Hans Peter Freyther | 13ae980 | 2009-12-22 08:27:21 +0100 | [diff] [blame] | 1269 | #define DECLARE_TIMER(number, doc) \ |
Holger Hans Peter Freyther | 26ba2e7 | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1270 | DEFUN(cfg_net_T##number, \ |
| 1271 | cfg_net_T##number##_cmd, \ |
| 1272 | "timer t" #number " <0-65535>", \ |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1273 | "Configure GSM Timers\n" \ |
Holger Hans Peter Freyther | 13ae980 | 2009-12-22 08:27:21 +0100 | [diff] [blame] | 1274 | doc) \ |
Holger Hans Peter Freyther | 26ba2e7 | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1275 | { \ |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1276 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); \ |
Holger Hans Peter Freyther | 26ba2e7 | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1277 | int value = atoi(argv[0]); \ |
| 1278 | \ |
| 1279 | if (value < 0 || value > 65535) { \ |
| 1280 | vty_out(vty, "Timer value %s out of range.%s", \ |
| 1281 | argv[0], VTY_NEWLINE); \ |
| 1282 | return CMD_WARNING; \ |
| 1283 | } \ |
| 1284 | \ |
| 1285 | gsmnet->T##number = value; \ |
| 1286 | return CMD_SUCCESS; \ |
| 1287 | } |
| 1288 | |
Holger Hans Peter Freyther | 13ae980 | 2009-12-22 08:27:21 +0100 | [diff] [blame] | 1289 | DECLARE_TIMER(3101, "Set the timeout value for IMMEDIATE ASSIGNMENT.") |
| 1290 | DECLARE_TIMER(3103, "Set the timeout value for HANDOVER.") |
| 1291 | DECLARE_TIMER(3105, "Currently not used.") |
| 1292 | DECLARE_TIMER(3107, "Currently not used.") |
| 1293 | DECLARE_TIMER(3109, "Currently not used.") |
Holger Hans Peter Freyther | 4a00c06 | 2010-05-31 21:33:15 +0800 | [diff] [blame] | 1294 | DECLARE_TIMER(3111, "Set the RSL timeout to wait before releasing the RF Channel.") |
Holger Hans Peter Freyther | 13ae980 | 2009-12-22 08:27:21 +0100 | [diff] [blame] | 1295 | DECLARE_TIMER(3113, "Set the time to try paging a subscriber.") |
| 1296 | DECLARE_TIMER(3115, "Currently not used.") |
| 1297 | DECLARE_TIMER(3117, "Currently not used.") |
| 1298 | DECLARE_TIMER(3119, "Currently not used.") |
| 1299 | DECLARE_TIMER(3141, "Currently not used.") |
Holger Hans Peter Freyther | 26ba2e7 | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1300 | |
Holger Hans Peter Freyther | 21d63ff | 2010-09-06 09:25:48 +0800 | [diff] [blame] | 1301 | DEFUN(cfg_net_dtx, |
| 1302 | cfg_net_dtx_cmd, |
| 1303 | "dtx-used (0|1)", |
| 1304 | "Enable the usage of DTX.\n" |
| 1305 | "DTX is enabled/disabled") |
| 1306 | { |
| 1307 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1308 | gsmnet->dtx_enabled = atoi(argv[0]); |
| 1309 | return CMD_SUCCESS; |
| 1310 | } |
Holger Hans Peter Freyther | 26ba2e7 | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1311 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1312 | /* per-BTS configuration */ |
| 1313 | DEFUN(cfg_bts, |
| 1314 | cfg_bts_cmd, |
| 1315 | "bts BTS_NR", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1316 | "Select a BTS to configure\n" |
| 1317 | "BTS Number\n") |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1318 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1319 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1320 | int bts_nr = atoi(argv[0]); |
| 1321 | struct gsm_bts *bts; |
| 1322 | |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1323 | if (bts_nr > gsmnet->num_bts) { |
| 1324 | vty_out(vty, "%% The next unused BTS number is %u%s", |
| 1325 | gsmnet->num_bts, VTY_NEWLINE); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1326 | return CMD_WARNING; |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1327 | } else if (bts_nr == gsmnet->num_bts) { |
| 1328 | /* allocate a new one */ |
| 1329 | bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN, |
| 1330 | HARDCODED_TSC, HARDCODED_BSIC); |
Holger Hans Peter Freyther | 7113514 | 2010-03-29 08:47:44 +0200 | [diff] [blame] | 1331 | } else |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1332 | bts = gsm_bts_num(gsmnet, bts_nr); |
| 1333 | |
Daniel Willmann | 580085f | 2010-01-11 13:43:07 +0100 | [diff] [blame] | 1334 | if (!bts) { |
| 1335 | vty_out(vty, "%% Unable to allocate BTS %u%s", |
| 1336 | gsmnet->num_bts, VTY_NEWLINE); |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1337 | return CMD_WARNING; |
Daniel Willmann | 580085f | 2010-01-11 13:43:07 +0100 | [diff] [blame] | 1338 | } |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1339 | |
| 1340 | vty->index = bts; |
Harald Welte | 8791dac | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 1341 | vty->index_sub = &bts->description; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1342 | vty->node = BTS_NODE; |
| 1343 | |
| 1344 | return CMD_SUCCESS; |
| 1345 | } |
| 1346 | |
| 1347 | DEFUN(cfg_bts_type, |
| 1348 | cfg_bts_type_cmd, |
| 1349 | "type TYPE", |
| 1350 | "Set the BTS type\n") |
| 1351 | { |
| 1352 | struct gsm_bts *bts = vty->index; |
Harald Welte | 59698fb | 2010-01-10 18:01:52 +0100 | [diff] [blame] | 1353 | int rc; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1354 | |
Harald Welte | 59698fb | 2010-01-10 18:01:52 +0100 | [diff] [blame] | 1355 | rc = gsm_set_bts_type(bts, parse_btstype(argv[0])); |
| 1356 | if (rc < 0) |
| 1357 | return CMD_WARNING; |
Harald Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1358 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1359 | return CMD_SUCCESS; |
| 1360 | } |
| 1361 | |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 1362 | DEFUN(cfg_bts_band, |
| 1363 | cfg_bts_band_cmd, |
| 1364 | "band BAND", |
| 1365 | "Set the frequency band of this BTS\n") |
| 1366 | { |
| 1367 | struct gsm_bts *bts = vty->index; |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1368 | int band = gsm_band_parse(argv[0]); |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 1369 | |
| 1370 | if (band < 0) { |
| 1371 | vty_out(vty, "%% BAND %d is not a valid GSM band%s", |
| 1372 | band, VTY_NEWLINE); |
| 1373 | return CMD_WARNING; |
| 1374 | } |
| 1375 | |
| 1376 | bts->band = band; |
| 1377 | |
| 1378 | return CMD_SUCCESS; |
| 1379 | } |
| 1380 | |
Holger Hans Peter Freyther | a098dfb | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 1381 | DEFUN(cfg_bts_ci, |
| 1382 | cfg_bts_ci_cmd, |
| 1383 | "cell_identity <0-65535>", |
| 1384 | "Set the Cell identity of this BTS\n") |
| 1385 | { |
| 1386 | struct gsm_bts *bts = vty->index; |
| 1387 | int ci = atoi(argv[0]); |
| 1388 | |
| 1389 | if (ci < 0 || ci > 0xffff) { |
| 1390 | vty_out(vty, "%% CI %d is not in the valid range (0-65535)%s", |
| 1391 | ci, VTY_NEWLINE); |
| 1392 | return CMD_WARNING; |
| 1393 | } |
| 1394 | bts->cell_identity = ci; |
| 1395 | |
| 1396 | return CMD_SUCCESS; |
| 1397 | } |
| 1398 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1399 | DEFUN(cfg_bts_lac, |
| 1400 | cfg_bts_lac_cmd, |
Holger Hans Peter Freyther | 54a2283 | 2009-09-29 14:02:33 +0200 | [diff] [blame] | 1401 | "location_area_code <0-65535>", |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1402 | "Set the Location Area Code (LAC) of this BTS\n") |
| 1403 | { |
| 1404 | struct gsm_bts *bts = vty->index; |
| 1405 | int lac = atoi(argv[0]); |
| 1406 | |
Holger Hans Peter Freyther | 54a2283 | 2009-09-29 14:02:33 +0200 | [diff] [blame] | 1407 | if (lac < 0 || lac > 0xffff) { |
| 1408 | vty_out(vty, "%% LAC %d is not in the valid range (0-65535)%s", |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1409 | lac, VTY_NEWLINE); |
| 1410 | return CMD_WARNING; |
| 1411 | } |
Holger Hans Peter Freyther | 6c6ab86 | 2009-10-01 04:07:15 +0200 | [diff] [blame] | 1412 | |
| 1413 | if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) { |
| 1414 | vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s", |
| 1415 | lac, VTY_NEWLINE); |
| 1416 | return CMD_WARNING; |
| 1417 | } |
| 1418 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1419 | bts->location_area_code = lac; |
| 1420 | |
| 1421 | return CMD_SUCCESS; |
| 1422 | } |
| 1423 | |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 1424 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1425 | DEFUN(cfg_bts_tsc, |
| 1426 | cfg_bts_tsc_cmd, |
| 1427 | "training_sequence_code <0-255>", |
| 1428 | "Set the Training Sequence Code (TSC) of this BTS\n") |
| 1429 | { |
| 1430 | struct gsm_bts *bts = vty->index; |
| 1431 | int tsc = atoi(argv[0]); |
| 1432 | |
| 1433 | if (tsc < 0 || tsc > 0xff) { |
| 1434 | vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s", |
| 1435 | tsc, VTY_NEWLINE); |
| 1436 | return CMD_WARNING; |
| 1437 | } |
| 1438 | bts->tsc = tsc; |
| 1439 | |
| 1440 | return CMD_SUCCESS; |
| 1441 | } |
| 1442 | |
| 1443 | DEFUN(cfg_bts_bsic, |
| 1444 | cfg_bts_bsic_cmd, |
| 1445 | "base_station_id_code <0-63>", |
| 1446 | "Set the Base Station Identity Code (BSIC) of this BTS\n") |
| 1447 | { |
| 1448 | struct gsm_bts *bts = vty->index; |
| 1449 | int bsic = atoi(argv[0]); |
| 1450 | |
| 1451 | if (bsic < 0 || bsic > 0x3f) { |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1452 | vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s", |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1453 | bsic, VTY_NEWLINE); |
| 1454 | return CMD_WARNING; |
| 1455 | } |
| 1456 | bts->bsic = bsic; |
| 1457 | |
| 1458 | return CMD_SUCCESS; |
| 1459 | } |
| 1460 | |
| 1461 | |
| 1462 | DEFUN(cfg_bts_unit_id, |
| 1463 | cfg_bts_unit_id_cmd, |
Harald Welte | f515aa0 | 2009-08-07 13:27:09 +0200 | [diff] [blame] | 1464 | "ip.access unit_id <0-65534> <0-255>", |
| 1465 | "Set the ip.access BTS Unit ID of this BTS\n") |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1466 | { |
| 1467 | struct gsm_bts *bts = vty->index; |
| 1468 | int site_id = atoi(argv[0]); |
| 1469 | int bts_id = atoi(argv[1]); |
| 1470 | |
Harald Welte | f515aa0 | 2009-08-07 13:27:09 +0200 | [diff] [blame] | 1471 | if (!is_ipaccess_bts(bts)) { |
| 1472 | vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE); |
| 1473 | return CMD_WARNING; |
| 1474 | } |
| 1475 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1476 | bts->ip_access.site_id = site_id; |
| 1477 | bts->ip_access.bts_id = bts_id; |
| 1478 | |
| 1479 | return CMD_SUCCESS; |
| 1480 | } |
| 1481 | |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1482 | #define OML_STR "Organization & Maintenance Link\n" |
| 1483 | #define IPA_STR "ip.access Specific Options\n" |
| 1484 | |
Harald Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1485 | DEFUN(cfg_bts_stream_id, |
| 1486 | cfg_bts_stream_id_cmd, |
| 1487 | "oml ip.access stream_id <0-255>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1488 | OML_STR IPA_STR |
Harald Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1489 | "Set the ip.access Stream ID of the OML link of this BTS\n") |
| 1490 | { |
| 1491 | struct gsm_bts *bts = vty->index; |
| 1492 | int stream_id = atoi(argv[0]); |
| 1493 | |
| 1494 | if (!is_ipaccess_bts(bts)) { |
| 1495 | vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE); |
| 1496 | return CMD_WARNING; |
| 1497 | } |
| 1498 | |
| 1499 | bts->oml_tei = stream_id; |
| 1500 | |
| 1501 | return CMD_SUCCESS; |
| 1502 | } |
| 1503 | |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1504 | #define OML_E1_STR OML_STR "E1 Line\n" |
Harald Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 1505 | |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1506 | DEFUN(cfg_bts_oml_e1, |
| 1507 | cfg_bts_oml_e1_cmd, |
| 1508 | "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1509 | OML_E1_STR |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1510 | "E1 interface to be used for OML\n") |
| 1511 | { |
| 1512 | struct gsm_bts *bts = vty->index; |
| 1513 | |
| 1514 | parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]); |
| 1515 | |
| 1516 | return CMD_SUCCESS; |
| 1517 | } |
| 1518 | |
| 1519 | |
| 1520 | DEFUN(cfg_bts_oml_e1_tei, |
| 1521 | cfg_bts_oml_e1_tei_cmd, |
| 1522 | "oml e1 tei <0-63>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1523 | OML_E1_STR |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1524 | "Set the TEI to be used for OML") |
| 1525 | { |
| 1526 | struct gsm_bts *bts = vty->index; |
| 1527 | |
| 1528 | bts->oml_tei = atoi(argv[0]); |
| 1529 | |
| 1530 | return CMD_SUCCESS; |
| 1531 | } |
| 1532 | |
Harald Welte | 3e77461 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 1533 | DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd, |
| 1534 | "channel allocator (ascending|descending)", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1535 | "Channnel Allocator\n" "Channel Allocator\n" |
| 1536 | "Allocate Timeslots and Transceivers in ascending order\n" |
| 1537 | "Allocate Timeslots and Transceivers in descending order\n") |
Harald Welte | 3e77461 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 1538 | { |
| 1539 | struct gsm_bts *bts = vty->index; |
| 1540 | |
| 1541 | if (!strcmp(argv[0], "ascending")) |
| 1542 | bts->chan_alloc_reverse = 0; |
| 1543 | else |
| 1544 | bts->chan_alloc_reverse = 1; |
| 1545 | |
| 1546 | return CMD_SUCCESS; |
| 1547 | } |
| 1548 | |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1549 | #define RACH_STR "Random Access Control Channel\n" |
| 1550 | |
Sylvain Munaut | 8e2d8de | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 1551 | DEFUN(cfg_bts_rach_tx_integer, |
| 1552 | cfg_bts_rach_tx_integer_cmd, |
| 1553 | "rach tx integer <0-15>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1554 | RACH_STR |
Sylvain Munaut | 8e2d8de | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 1555 | "Set the raw tx integer value in RACH Control parameters IE") |
| 1556 | { |
| 1557 | struct gsm_bts *bts = vty->index; |
| 1558 | bts->si_common.rach_control.tx_integer = atoi(argv[0]) & 0xf; |
| 1559 | return CMD_SUCCESS; |
| 1560 | } |
| 1561 | |
| 1562 | DEFUN(cfg_bts_rach_max_trans, |
| 1563 | cfg_bts_rach_max_trans_cmd, |
| 1564 | "rach max transmission (1|2|4|7)", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1565 | RACH_STR |
Sylvain Munaut | 8e2d8de | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 1566 | "Set the maximum number of RACH burst transmissions") |
| 1567 | { |
| 1568 | struct gsm_bts *bts = vty->index; |
| 1569 | bts->si_common.rach_control.max_trans = rach_max_trans_val2raw(atoi(argv[0])); |
| 1570 | return CMD_SUCCESS; |
| 1571 | } |
| 1572 | |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1573 | #define NM_STR "Network Management\n" |
| 1574 | |
Holger Hans Peter Freyther | 697ed2b | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 1575 | DEFUN(cfg_bts_rach_nm_b_thresh, |
| 1576 | cfg_bts_rach_nm_b_thresh_cmd, |
| 1577 | "rach nm busy threshold <0-255>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1578 | RACH_STR NM_STR |
| 1579 | "Set the NM Busy Threshold in dB") |
Holger Hans Peter Freyther | 697ed2b | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 1580 | { |
| 1581 | struct gsm_bts *bts = vty->index; |
| 1582 | bts->rach_b_thresh = atoi(argv[0]); |
| 1583 | return CMD_SUCCESS; |
| 1584 | } |
| 1585 | |
| 1586 | DEFUN(cfg_bts_rach_nm_ldavg, |
| 1587 | cfg_bts_rach_nm_ldavg_cmd, |
| 1588 | "rach nm load average <0-65535>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1589 | RACH_STR NM_STR |
| 1590 | "Set the NM Loadaverage Slots value") |
Holger Hans Peter Freyther | 697ed2b | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 1591 | { |
| 1592 | struct gsm_bts *bts = vty->index; |
| 1593 | bts->rach_ldavg_slots = atoi(argv[0]); |
| 1594 | return CMD_SUCCESS; |
| 1595 | } |
| 1596 | |
Harald Welte (local) | e19be3f | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 1597 | DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd, |
| 1598 | "cell barred (0|1)", |
| 1599 | "Should this cell be barred from access?") |
| 1600 | { |
| 1601 | struct gsm_bts *bts = vty->index; |
| 1602 | |
Harald Welte | 8c973ba | 2009-12-21 23:08:18 +0100 | [diff] [blame] | 1603 | bts->si_common.rach_control.cell_bar = atoi(argv[0]); |
Harald Welte (local) | e19be3f | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 1604 | |
| 1605 | return CMD_SUCCESS; |
| 1606 | } |
| 1607 | |
Holger Hans Peter Freyther | 440984b | 2010-05-14 00:39:19 +0800 | [diff] [blame] | 1608 | DEFUN(cfg_bts_rach_ec_allowed, cfg_bts_rach_ec_allowed_cmd, |
| 1609 | "rach emergency call allowed (0|1)", |
| 1610 | "Should this cell allow emergency calls?") |
| 1611 | { |
| 1612 | struct gsm_bts *bts = vty->index; |
| 1613 | |
| 1614 | if (atoi(argv[0]) == 0) |
| 1615 | bts->si_common.rach_control.t2 |= 0x4; |
| 1616 | else |
| 1617 | bts->si_common.rach_control.t2 &= ~0x4; |
| 1618 | |
| 1619 | return CMD_SUCCESS; |
| 1620 | } |
| 1621 | |
Harald Welte (local) | cbd4610 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 1622 | DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd, |
| 1623 | "ms max power <0-40>", |
| 1624 | "Maximum transmit power of the MS") |
| 1625 | { |
| 1626 | struct gsm_bts *bts = vty->index; |
| 1627 | |
| 1628 | bts->ms_max_power = atoi(argv[0]); |
| 1629 | |
| 1630 | return CMD_SUCCESS; |
| 1631 | } |
| 1632 | |
Harald Welte | b761bf8 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 1633 | DEFUN(cfg_bts_cell_resel_hyst, cfg_bts_cell_resel_hyst_cmd, |
| 1634 | "cell reselection hysteresis <0-14>", |
| 1635 | "Cell Re-Selection Hysteresis in dB") |
| 1636 | { |
| 1637 | struct gsm_bts *bts = vty->index; |
| 1638 | |
| 1639 | bts->si_common.cell_sel_par.cell_resel_hyst = atoi(argv[0])/2; |
| 1640 | |
| 1641 | return CMD_SUCCESS; |
| 1642 | } |
| 1643 | |
| 1644 | DEFUN(cfg_bts_rxlev_acc_min, cfg_bts_rxlev_acc_min_cmd, |
| 1645 | "rxlev access min <0-63>", |
| 1646 | "Minimum RxLev needed for cell access (better than -110dBm)") |
| 1647 | { |
| 1648 | struct gsm_bts *bts = vty->index; |
| 1649 | |
| 1650 | bts->si_common.cell_sel_par.rxlev_acc_min = atoi(argv[0]); |
| 1651 | |
| 1652 | return CMD_SUCCESS; |
| 1653 | } |
| 1654 | |
Harald Welte (local) | b6ea7f7 | 2009-08-14 23:09:25 +0200 | [diff] [blame] | 1655 | DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd, |
| 1656 | "periodic location update <0-1530>", |
| 1657 | "Periodic Location Updating Interval in Minutes") |
| 1658 | { |
| 1659 | struct gsm_bts *bts = vty->index; |
| 1660 | |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 1661 | bts->si_common.chan_desc.t3212 = atoi(argv[0]) / 10; |
Harald Welte (local) | b6ea7f7 | 2009-08-14 23:09:25 +0200 | [diff] [blame] | 1662 | |
| 1663 | return CMD_SUCCESS; |
| 1664 | } |
| 1665 | |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1666 | #define GPRS_TEXT "GPRS Packet Network\n" |
| 1667 | |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 1668 | DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd, |
Harald Welte | b42fe34 | 2010-04-18 14:00:26 +0200 | [diff] [blame] | 1669 | "gprs cell bvci <2-65535>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1670 | GPRS_TEXT |
| 1671 | "GPRS Cell Settings\n" |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 1672 | "GPRS BSSGP VC Identifier") |
| 1673 | { |
| 1674 | struct gsm_bts *bts = vty->index; |
| 1675 | |
Harald Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 1676 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | c05a4b1 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 1677 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 1678 | return CMD_WARNING; |
| 1679 | } |
| 1680 | |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 1681 | bts->gprs.cell.bvci = atoi(argv[0]); |
| 1682 | |
| 1683 | return CMD_SUCCESS; |
| 1684 | } |
| 1685 | |
Harald Welte | 4a048c5 | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 1686 | DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd, |
| 1687 | "gprs nsei <0-65535>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1688 | GPRS_TEXT |
Harald Welte | 4a048c5 | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 1689 | "GPRS NS Entity Identifier") |
| 1690 | { |
| 1691 | struct gsm_bts *bts = vty->index; |
| 1692 | |
Harald Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 1693 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | 4a048c5 | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 1694 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 1695 | return CMD_WARNING; |
| 1696 | } |
| 1697 | |
| 1698 | bts->gprs.nse.nsei = atoi(argv[0]); |
| 1699 | |
| 1700 | return CMD_SUCCESS; |
| 1701 | } |
| 1702 | |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1703 | #define NSVC_TEXT "Network Service Virtual Connection (NS-VC)\n" \ |
| 1704 | "NSVC Logical Number\n" |
Harald Welte | 4a048c5 | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 1705 | |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 1706 | DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd, |
| 1707 | "gprs nsvc <0-1> nsvci <0-65535>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1708 | GPRS_TEXT NSVC_TEXT |
| 1709 | "NS Virtual Connection Identifier\n" |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 1710 | "GPRS NS VC Identifier") |
| 1711 | { |
| 1712 | struct gsm_bts *bts = vty->index; |
| 1713 | int idx = atoi(argv[0]); |
| 1714 | |
Harald Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 1715 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | c05a4b1 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 1716 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 1717 | return CMD_WARNING; |
| 1718 | } |
| 1719 | |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 1720 | bts->gprs.nsvc[idx].nsvci = atoi(argv[1]); |
| 1721 | |
| 1722 | return CMD_SUCCESS; |
| 1723 | } |
| 1724 | |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 1725 | DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd, |
| 1726 | "gprs nsvc <0-1> local udp port <0-65535>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1727 | GPRS_TEXT NSVC_TEXT |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 1728 | "GPRS NS Local UDP Port") |
| 1729 | { |
| 1730 | struct gsm_bts *bts = vty->index; |
| 1731 | int idx = atoi(argv[0]); |
| 1732 | |
Harald Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 1733 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | c05a4b1 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 1734 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 1735 | return CMD_WARNING; |
| 1736 | } |
| 1737 | |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 1738 | bts->gprs.nsvc[idx].local_port = atoi(argv[1]); |
| 1739 | |
| 1740 | return CMD_SUCCESS; |
| 1741 | } |
| 1742 | |
| 1743 | DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd, |
| 1744 | "gprs nsvc <0-1> remote udp port <0-65535>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1745 | GPRS_TEXT NSVC_TEXT |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 1746 | "GPRS NS Remote UDP Port") |
| 1747 | { |
| 1748 | struct gsm_bts *bts = vty->index; |
| 1749 | int idx = atoi(argv[0]); |
| 1750 | |
Harald Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 1751 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | c05a4b1 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 1752 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 1753 | return CMD_WARNING; |
| 1754 | } |
| 1755 | |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 1756 | bts->gprs.nsvc[idx].remote_port = atoi(argv[1]); |
| 1757 | |
| 1758 | return CMD_SUCCESS; |
| 1759 | } |
| 1760 | |
| 1761 | DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd, |
| 1762 | "gprs nsvc <0-1> remote ip A.B.C.D", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1763 | GPRS_TEXT NSVC_TEXT |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 1764 | "GPRS NS Remote IP Address") |
| 1765 | { |
| 1766 | struct gsm_bts *bts = vty->index; |
| 1767 | int idx = atoi(argv[0]); |
| 1768 | struct in_addr ia; |
| 1769 | |
Harald Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 1770 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | c05a4b1 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 1771 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 1772 | return CMD_WARNING; |
| 1773 | } |
| 1774 | |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 1775 | inet_aton(argv[1], &ia); |
| 1776 | bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr); |
| 1777 | |
| 1778 | return CMD_SUCCESS; |
| 1779 | } |
| 1780 | |
Holger Hans Peter Freyther | 3112f67 | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 1781 | DEFUN(cfg_bts_pag_free, cfg_bts_pag_free_cmd, |
| 1782 | "paging free FREE_NR", |
| 1783 | "Only page when having a certain amount of free slots. -1 to disable") |
| 1784 | { |
| 1785 | struct gsm_bts *bts = vty->index; |
| 1786 | |
| 1787 | bts->paging.free_chans_need = atoi(argv[0]); |
| 1788 | return CMD_SUCCESS; |
| 1789 | } |
| 1790 | |
Harald Welte | a925176 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 1791 | DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd, |
| 1792 | "gprs ns timer " NS_TIMERS " <0-255>", |
| 1793 | GPRS_TEXT "Network Service\n" |
| 1794 | "Network Service Timer\n" |
| 1795 | NS_TIMERS_HELP "Timer Value\n") |
| 1796 | { |
| 1797 | struct gsm_bts *bts = vty->index; |
| 1798 | int idx = get_string_value(gprs_ns_timer_strs, argv[0]); |
| 1799 | int val = atoi(argv[1]); |
| 1800 | |
| 1801 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
| 1802 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 1803 | return CMD_WARNING; |
| 1804 | } |
| 1805 | |
| 1806 | if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer)) |
| 1807 | return CMD_WARNING; |
| 1808 | |
| 1809 | bts->gprs.nse.timer[idx] = val; |
| 1810 | |
| 1811 | return CMD_SUCCESS; |
| 1812 | } |
| 1813 | |
| 1814 | #define BSSGP_TIMERS "(blocking-timer|blocking-retries|unblocking-retries|reset-timer|reset-retries|suspend-timer|suspend-retries|resume-timer|resume-retries|capability-update-timer|capability-update-retries)" |
Harald Welte | 18ce31c | 2010-05-14 20:05:17 +0200 | [diff] [blame] | 1815 | #define BSSGP_TIMERS_HELP \ |
| 1816 | "Tbvc-block timeout\n" \ |
| 1817 | "Tbvc-block retries\n" \ |
| 1818 | "Tbvc-unblock retries\n" \ |
| 1819 | "Tbvcc-reset timeout\n" \ |
| 1820 | "Tbvc-reset retries\n" \ |
| 1821 | "Tbvc-suspend timeout\n" \ |
| 1822 | "Tbvc-suspend retries\n" \ |
| 1823 | "Tbvc-resume timeout\n" \ |
| 1824 | "Tbvc-resume retries\n" \ |
| 1825 | "Tbvc-capa-update timeout\n" \ |
| 1826 | "Tbvc-capa-update retries\n" |
Harald Welte | a925176 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 1827 | |
| 1828 | DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd, |
| 1829 | "gprs cell timer " BSSGP_TIMERS " <0-255>", |
| 1830 | GPRS_TEXT "Cell / BSSGP\n" |
| 1831 | "Cell/BSSGP Timer\n" |
| 1832 | BSSGP_TIMERS_HELP "Timer Value\n") |
| 1833 | { |
| 1834 | struct gsm_bts *bts = vty->index; |
| 1835 | int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]); |
| 1836 | int val = atoi(argv[1]); |
| 1837 | |
| 1838 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
| 1839 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 1840 | return CMD_WARNING; |
| 1841 | } |
| 1842 | |
| 1843 | if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer)) |
| 1844 | return CMD_WARNING; |
| 1845 | |
| 1846 | bts->gprs.cell.timer[idx] = val; |
| 1847 | |
| 1848 | return CMD_SUCCESS; |
| 1849 | } |
| 1850 | |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 1851 | DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd, |
| 1852 | "gprs routing area <0-255>", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1853 | GPRS_TEXT |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 1854 | "GPRS Routing Area Code") |
| 1855 | { |
| 1856 | struct gsm_bts *bts = vty->index; |
| 1857 | |
Harald Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 1858 | if (bts->gprs.mode == BTS_GPRS_NONE) { |
Harald Welte | c05a4b1 | 2010-03-14 23:56:56 +0800 | [diff] [blame] | 1859 | vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE); |
| 1860 | return CMD_WARNING; |
| 1861 | } |
| 1862 | |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 1863 | bts->gprs.rac = atoi(argv[0]); |
| 1864 | |
| 1865 | return CMD_SUCCESS; |
| 1866 | } |
| 1867 | |
Harald Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 1868 | DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd, |
| 1869 | "gprs mode (none|gprs|egprs)", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1870 | GPRS_TEXT |
| 1871 | "GPRS Mode for this BTS\n" |
| 1872 | "GPRS Disabled on this BTS\n" |
| 1873 | "GPRS Enabled on this BTS\n" |
| 1874 | "EGPRS (EDGE) Enabled on this BTS\n") |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 1875 | { |
| 1876 | struct gsm_bts *bts = vty->index; |
Harald Welte | 20e275a | 2010-06-14 22:44:42 +0200 | [diff] [blame] | 1877 | enum bts_gprs_mode mode = bts_gprs_mode_parse(argv[0]); |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 1878 | |
Harald Welte | 20e275a | 2010-06-14 22:44:42 +0200 | [diff] [blame] | 1879 | if (mode != BTS_GPRS_NONE && |
| 1880 | !gsm_bts_has_feature(bts, BTS_FEAT_GPRS)) { |
| 1881 | vty_out(vty, "This BTS type does not support %s%s", argv[0], |
| 1882 | VTY_NEWLINE); |
| 1883 | return CMD_WARNING; |
| 1884 | } |
| 1885 | if (mode == BTS_GPRS_EGPRS && |
| 1886 | !gsm_bts_has_feature(bts, BTS_FEAT_EGPRS)) { |
| 1887 | vty_out(vty, "This BTS type does not support %s%s", argv[0], |
| 1888 | VTY_NEWLINE); |
| 1889 | return CMD_WARNING; |
| 1890 | } |
| 1891 | |
| 1892 | bts->gprs.mode = mode; |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 1893 | |
| 1894 | return CMD_SUCCESS; |
| 1895 | } |
| 1896 | |
Harald Welte | d8acf14 | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 1897 | #define SI_TEXT "System Information Messages\n" |
| 1898 | #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)" |
| 1899 | #define SI_TYPE_HELP "System Information Type 1\n" \ |
| 1900 | "System Information Type 2\n" \ |
| 1901 | "System Information Type 3\n" \ |
| 1902 | "System Information Type 4\n" \ |
| 1903 | "System Information Type 5\n" \ |
| 1904 | "System Information Type 6\n" \ |
| 1905 | "System Information Type 7\n" \ |
| 1906 | "System Information Type 8\n" \ |
| 1907 | "System Information Type 9\n" \ |
| 1908 | "System Information Type 10\n" \ |
| 1909 | "System Information Type 13\n" \ |
| 1910 | "System Information Type 16\n" \ |
| 1911 | "System Information Type 17\n" \ |
| 1912 | "System Information Type 18\n" \ |
| 1913 | "System Information Type 19\n" \ |
| 1914 | "System Information Type 20\n" \ |
| 1915 | "System Information Type 2bis\n" \ |
| 1916 | "System Information Type 2ter\n" \ |
| 1917 | "System Information Type 2quater\n" \ |
| 1918 | "System Information Type 5bis\n" \ |
| 1919 | "System Information Type 5ter\n" |
| 1920 | |
| 1921 | DEFUN(cfg_bts_si_mode, cfg_bts_si_mode_cmd, |
| 1922 | "system-information " SI_TYPE_TEXT " mode (static|computed)", |
| 1923 | SI_TEXT SI_TYPE_HELP |
| 1924 | "System Information Mode\n" |
| 1925 | "Static user-specified\n" |
| 1926 | "Dynamic, BSC-computed\n") |
| 1927 | { |
| 1928 | struct gsm_bts *bts = vty->index; |
| 1929 | int type; |
| 1930 | |
| 1931 | type = get_string_value(osmo_sitype_strs, argv[0]); |
| 1932 | if (type < 0) { |
| 1933 | vty_out(vty, "Error SI Type%s", VTY_NEWLINE); |
| 1934 | return CMD_WARNING; |
| 1935 | } |
| 1936 | |
| 1937 | if (!strcmp(argv[1], "static")) |
| 1938 | bts->si_mode_static |= (1 << type); |
| 1939 | else |
| 1940 | bts->si_mode_static &= ~(1 << type); |
| 1941 | |
| 1942 | return CMD_SUCCESS; |
| 1943 | } |
| 1944 | |
| 1945 | DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd, |
| 1946 | "system-information " SI_TYPE_TEXT " static HEXSTRING", |
| 1947 | SI_TEXT SI_TYPE_HELP |
| 1948 | "Static System Information filling\n" |
| 1949 | "Static user-specified SI content in HEX notation\n") |
| 1950 | { |
| 1951 | struct gsm_bts *bts = vty->index; |
| 1952 | int rc, type; |
| 1953 | |
| 1954 | type = get_string_value(osmo_sitype_strs, argv[0]); |
| 1955 | if (type < 0) { |
| 1956 | vty_out(vty, "Error SI Type%s", VTY_NEWLINE); |
| 1957 | return CMD_WARNING; |
| 1958 | } |
| 1959 | |
| 1960 | if (!(bts->si_mode_static & (1 << type))) { |
| 1961 | vty_out(vty, "SI Type %s is not configured in static mode%s", |
| 1962 | get_value_string(osmo_sitype_strs, type), VTY_NEWLINE); |
| 1963 | return CMD_WARNING; |
| 1964 | } |
| 1965 | |
Harald Welte | 9f09ac3 | 2010-07-30 11:53:18 +0200 | [diff] [blame] | 1966 | /* Fill buffer with padding pattern */ |
| 1967 | memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type])); |
| 1968 | |
| 1969 | /* Parse the user-specified SI in hex format, [partially] overwriting padding */ |
Harald Welte | d8acf14 | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 1970 | rc = hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0])); |
| 1971 | if (rc < 0 || rc > sizeof(bts->si_buf[0])) { |
| 1972 | vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE); |
| 1973 | return CMD_WARNING; |
| 1974 | } |
| 1975 | |
| 1976 | /* Mark this SI as present */ |
| 1977 | bts->si_valid |= (1 << type); |
| 1978 | |
| 1979 | return CMD_SUCCESS; |
| 1980 | } |
| 1981 | |
| 1982 | |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1983 | #define TRX_TEXT "Radio Transceiver\n" |
Harald Welte | 3e77461 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 1984 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1985 | /* per TRX configuration */ |
| 1986 | DEFUN(cfg_trx, |
| 1987 | cfg_trx_cmd, |
| 1988 | "trx TRX_NR", |
Harald Welte | 9e00245 | 2010-05-11 21:53:49 +0200 | [diff] [blame] | 1989 | TRX_TEXT |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1990 | "Select a TRX to configure") |
| 1991 | { |
| 1992 | int trx_nr = atoi(argv[0]); |
| 1993 | struct gsm_bts *bts = vty->index; |
| 1994 | struct gsm_bts_trx *trx; |
| 1995 | |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1996 | if (trx_nr > bts->num_trx) { |
| 1997 | vty_out(vty, "%% The next unused TRX number in this BTS is %u%s", |
| 1998 | bts->num_trx, VTY_NEWLINE); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1999 | return CMD_WARNING; |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 2000 | } else if (trx_nr == bts->num_trx) { |
| 2001 | /* we need to allocate a new one */ |
| 2002 | trx = gsm_bts_trx_alloc(bts); |
Holger Hans Peter Freyther | 7113514 | 2010-03-29 08:47:44 +0200 | [diff] [blame] | 2003 | } else |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 2004 | trx = gsm_bts_trx_num(bts, trx_nr); |
Holger Hans Peter Freyther | 7113514 | 2010-03-29 08:47:44 +0200 | [diff] [blame] | 2005 | |
Harald Welte | e712a5f | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 2006 | if (!trx) |
| 2007 | return CMD_WARNING; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2008 | |
| 2009 | vty->index = trx; |
Harald Welte | 8791dac | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 2010 | vty->index_sub = &trx->description; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2011 | vty->node = TRX_NODE; |
| 2012 | |
| 2013 | return CMD_SUCCESS; |
| 2014 | } |
| 2015 | |
| 2016 | DEFUN(cfg_trx_arfcn, |
| 2017 | cfg_trx_arfcn_cmd, |
Harald Welte | 0004459 | 2010-05-14 19:00:52 +0200 | [diff] [blame] | 2018 | "arfcn <0-1024>", |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2019 | "Set the ARFCN for this TRX\n") |
| 2020 | { |
| 2021 | int arfcn = atoi(argv[0]); |
| 2022 | struct gsm_bts_trx *trx = vty->index; |
| 2023 | |
| 2024 | /* FIXME: check if this ARFCN is supported by this TRX */ |
| 2025 | |
| 2026 | trx->arfcn = arfcn; |
| 2027 | |
| 2028 | /* FIXME: patch ARFCN into SYSTEM INFORMATION */ |
| 2029 | /* FIXME: use OML layer to update the ARFCN */ |
| 2030 | /* FIXME: use RSL layer to update SYSTEM INFORMATION */ |
| 2031 | |
| 2032 | return CMD_SUCCESS; |
| 2033 | } |
| 2034 | |
Harald Welte (local) | b709bfe | 2009-12-27 20:56:38 +0100 | [diff] [blame] | 2035 | DEFUN(cfg_trx_nominal_power, |
| 2036 | cfg_trx_nominal_power_cmd, |
| 2037 | "nominal power <0-100>", |
| 2038 | "Nominal TRX RF Power in dB\n") |
| 2039 | { |
| 2040 | struct gsm_bts_trx *trx = vty->index; |
| 2041 | |
| 2042 | trx->nominal_power = atoi(argv[0]); |
| 2043 | |
| 2044 | return CMD_SUCCESS; |
| 2045 | } |
| 2046 | |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 2047 | DEFUN(cfg_trx_max_power_red, |
| 2048 | cfg_trx_max_power_red_cmd, |
| 2049 | "max_power_red <0-100>", |
| 2050 | "Reduction of maximum BS RF Power in dB\n") |
| 2051 | { |
| 2052 | int maxpwr_r = atoi(argv[0]); |
| 2053 | struct gsm_bts_trx *trx = vty->index; |
Harald Welte | 01acd74 | 2009-11-18 09:20:22 +0100 | [diff] [blame] | 2054 | int upper_limit = 24; /* default 12.21 max power red. */ |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 2055 | |
| 2056 | /* FIXME: check if our BTS type supports more than 12 */ |
| 2057 | if (maxpwr_r < 0 || maxpwr_r > upper_limit) { |
| 2058 | vty_out(vty, "%% Power %d dB is not in the valid range%s", |
| 2059 | maxpwr_r, VTY_NEWLINE); |
| 2060 | return CMD_WARNING; |
| 2061 | } |
| 2062 | if (maxpwr_r & 1) { |
| 2063 | vty_out(vty, "%% Power %d dB is not an even value%s", |
| 2064 | maxpwr_r, VTY_NEWLINE); |
| 2065 | return CMD_WARNING; |
| 2066 | } |
| 2067 | |
| 2068 | trx->max_power_red = maxpwr_r; |
| 2069 | |
| 2070 | /* FIXME: make sure we update this using OML */ |
| 2071 | |
| 2072 | return CMD_SUCCESS; |
| 2073 | } |
| 2074 | |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2075 | DEFUN(cfg_trx_rsl_e1, |
| 2076 | cfg_trx_rsl_e1_cmd, |
| 2077 | "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)", |
| 2078 | "E1 interface to be used for RSL\n") |
| 2079 | { |
| 2080 | struct gsm_bts_trx *trx = vty->index; |
| 2081 | |
| 2082 | parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]); |
| 2083 | |
| 2084 | return CMD_SUCCESS; |
| 2085 | } |
| 2086 | |
| 2087 | DEFUN(cfg_trx_rsl_e1_tei, |
| 2088 | cfg_trx_rsl_e1_tei_cmd, |
| 2089 | "rsl e1 tei <0-63>", |
| 2090 | "Set the TEI to be used for RSL") |
| 2091 | { |
| 2092 | struct gsm_bts_trx *trx = vty->index; |
| 2093 | |
| 2094 | trx->rsl_tei = atoi(argv[0]); |
| 2095 | |
| 2096 | return CMD_SUCCESS; |
| 2097 | } |
| 2098 | |
Holger Hans Peter Freyther | 1c8b480 | 2009-11-11 11:54:24 +0100 | [diff] [blame] | 2099 | DEFUN(cfg_trx_rf_locked, |
| 2100 | cfg_trx_rf_locked_cmd, |
| 2101 | "rf_locked (0|1)", |
| 2102 | "Turn off RF of the TRX.\n") |
| 2103 | { |
| 2104 | int locked = atoi(argv[0]); |
| 2105 | struct gsm_bts_trx *trx = vty->index; |
| 2106 | |
| 2107 | gsm_trx_lock_rf(trx, locked); |
| 2108 | return CMD_SUCCESS; |
| 2109 | } |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2110 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2111 | /* per TS configuration */ |
| 2112 | DEFUN(cfg_ts, |
| 2113 | cfg_ts_cmd, |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2114 | "timeslot <0-7>", |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2115 | "Select a Timeslot to configure") |
| 2116 | { |
| 2117 | int ts_nr = atoi(argv[0]); |
| 2118 | struct gsm_bts_trx *trx = vty->index; |
| 2119 | struct gsm_bts_trx_ts *ts; |
| 2120 | |
| 2121 | if (ts_nr >= TRX_NR_TS) { |
| 2122 | vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s", |
| 2123 | TRX_NR_TS, VTY_NEWLINE); |
| 2124 | return CMD_WARNING; |
| 2125 | } |
| 2126 | |
| 2127 | ts = &trx->ts[ts_nr]; |
| 2128 | |
| 2129 | vty->index = ts; |
| 2130 | vty->node = TS_NODE; |
| 2131 | |
| 2132 | return CMD_SUCCESS; |
| 2133 | } |
| 2134 | |
Harald Welte | 3ffe1b3 | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 2135 | DEFUN(cfg_ts_pchan, |
| 2136 | cfg_ts_pchan_cmd, |
| 2137 | "phys_chan_config PCHAN", |
| 2138 | "Physical Channel configuration (TCH/SDCCH/...)") |
| 2139 | { |
| 2140 | struct gsm_bts_trx_ts *ts = vty->index; |
| 2141 | int pchanc; |
| 2142 | |
| 2143 | pchanc = gsm_pchan_parse(argv[0]); |
| 2144 | if (pchanc < 0) |
| 2145 | return CMD_WARNING; |
| 2146 | |
| 2147 | ts->pchan = pchanc; |
| 2148 | |
| 2149 | return CMD_SUCCESS; |
| 2150 | } |
| 2151 | |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 2152 | #define HOPPING_STR "Configure frequency hopping\n" |
| 2153 | |
| 2154 | DEFUN(cfg_ts_hopping, |
| 2155 | cfg_ts_hopping_cmd, |
| 2156 | "hopping enabled (0|1)", |
| 2157 | HOPPING_STR "Enable or disable frequency hopping\n" |
| 2158 | "Disable frequency hopping\n" "Enable frequency hopping\n") |
| 2159 | { |
| 2160 | struct gsm_bts_trx_ts *ts = vty->index; |
Harald Welte | 059c1ef | 2010-06-14 22:47:37 +0200 | [diff] [blame] | 2161 | int enabled = atoi(argv[0]); |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 2162 | |
Harald Welte | 059c1ef | 2010-06-14 22:47:37 +0200 | [diff] [blame] | 2163 | if (enabled && !gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_HOPPING)) { |
| 2164 | vty_out(vty, "BTS model does not support hopping%s", |
| 2165 | VTY_NEWLINE); |
| 2166 | return CMD_WARNING; |
| 2167 | } |
| 2168 | |
| 2169 | ts->hopping.enabled = enabled; |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 2170 | |
| 2171 | return CMD_SUCCESS; |
| 2172 | } |
| 2173 | |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 2174 | DEFUN(cfg_ts_hsn, |
| 2175 | cfg_ts_hsn_cmd, |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 2176 | "hopping sequence-number <0-63>", |
| 2177 | HOPPING_STR |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 2178 | "Which hopping sequence to use for this channel") |
| 2179 | { |
| 2180 | struct gsm_bts_trx_ts *ts = vty->index; |
| 2181 | |
| 2182 | ts->hopping.hsn = atoi(argv[0]); |
| 2183 | |
| 2184 | return CMD_SUCCESS; |
| 2185 | } |
| 2186 | |
| 2187 | DEFUN(cfg_ts_maio, |
| 2188 | cfg_ts_maio_cmd, |
| 2189 | "hopping maio <0-63>", |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 2190 | HOPPING_STR |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 2191 | "Which hopping MAIO to use for this channel") |
| 2192 | { |
| 2193 | struct gsm_bts_trx_ts *ts = vty->index; |
| 2194 | |
| 2195 | ts->hopping.maio = atoi(argv[0]); |
| 2196 | |
| 2197 | return CMD_SUCCESS; |
| 2198 | } |
| 2199 | |
| 2200 | DEFUN(cfg_ts_arfcn_add, |
| 2201 | cfg_ts_arfcn_add_cmd, |
| 2202 | "hopping arfcn add <0-1023>", |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 2203 | HOPPING_STR "Configure hopping ARFCN list\n" |
| 2204 | "Add an entry to the hopping ARFCN list\n" "ARFCN\n") |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 2205 | { |
| 2206 | struct gsm_bts_trx_ts *ts = vty->index; |
| 2207 | int arfcn = atoi(argv[0]); |
| 2208 | |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 2209 | bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1); |
| 2210 | |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 2211 | return CMD_SUCCESS; |
| 2212 | } |
| 2213 | |
| 2214 | DEFUN(cfg_ts_arfcn_del, |
| 2215 | cfg_ts_arfcn_del_cmd, |
| 2216 | "hopping arfcn del <0-1023>", |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 2217 | HOPPING_STR "Configure hopping ARFCN list\n" |
| 2218 | "Delete an entry to the hopping ARFCN list\n" "ARFCN\n") |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 2219 | { |
| 2220 | struct gsm_bts_trx_ts *ts = vty->index; |
| 2221 | int arfcn = atoi(argv[0]); |
| 2222 | |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 2223 | bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0); |
| 2224 | |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 2225 | return CMD_SUCCESS; |
| 2226 | } |
| 2227 | |
Harald Welte | 3ffe1b3 | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 2228 | DEFUN(cfg_ts_e1_subslot, |
| 2229 | cfg_ts_e1_subslot_cmd, |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2230 | "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)", |
Harald Welte | 3ffe1b3 | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 2231 | "E1 sub-slot connected to this on-air timeslot") |
| 2232 | { |
| 2233 | struct gsm_bts_trx_ts *ts = vty->index; |
| 2234 | |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2235 | parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]); |
Harald Welte | 3ffe1b3 | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 2236 | |
| 2237 | return CMD_SUCCESS; |
| 2238 | } |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2239 | |
Harald Welte | a5b1dae | 2010-05-16 21:47:13 +0200 | [diff] [blame] | 2240 | void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net) |
| 2241 | { |
| 2242 | vty_out(vty, "Channel Requests : %lu total, %lu no channel%s", |
| 2243 | counter_get(net->stats.chreq.total), |
| 2244 | counter_get(net->stats.chreq.no_channel), VTY_NEWLINE); |
| 2245 | vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s", |
| 2246 | counter_get(net->stats.chan.rf_fail), |
| 2247 | counter_get(net->stats.chan.rll_err), VTY_NEWLINE); |
| 2248 | vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s", |
| 2249 | counter_get(net->stats.paging.attempted), |
| 2250 | counter_get(net->stats.paging.completed), |
| 2251 | counter_get(net->stats.paging.expired), VTY_NEWLINE); |
| 2252 | vty_out(vty, "BTS failures : %lu OML, %lu RSL%s", |
| 2253 | counter_get(net->stats.bts.oml_fail), |
| 2254 | counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE); |
| 2255 | } |
| 2256 | |
Harald Welte | 682ee5f | 2010-05-16 22:02:16 +0200 | [diff] [blame] | 2257 | DEFUN(logging_fltr_imsi, |
| 2258 | logging_fltr_imsi_cmd, |
| 2259 | "logging filter imsi IMSI", |
| 2260 | LOGGING_STR FILTER_STR |
| 2261 | "Filter log messages by IMSI\n" "IMSI to be used as filter\n") |
| 2262 | { |
| 2263 | struct telnet_connection *conn; |
| 2264 | |
| 2265 | conn = (struct telnet_connection *) vty->priv; |
| 2266 | if (!conn->dbg) { |
| 2267 | vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE); |
| 2268 | return CMD_WARNING; |
| 2269 | } |
| 2270 | |
| 2271 | log_set_imsi_filter(conn->dbg, argv[0]); |
| 2272 | return CMD_SUCCESS; |
| 2273 | } |
| 2274 | |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 2275 | extern int bsc_vty_init_extra(void); |
Harald Welte | 10c29f6 | 2010-05-16 19:20:24 +0200 | [diff] [blame] | 2276 | extern const char *openbsc_copyright; |
Holger Hans Peter Freyther | c48a2a1 | 2010-04-10 00:08:28 +0200 | [diff] [blame] | 2277 | |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 2278 | int bsc_vty_init(void) |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2279 | { |
Harald Welte | 7bc28f6 | 2010-05-12 16:10:35 +0000 | [diff] [blame] | 2280 | install_element_ve(&show_net_cmd); |
| 2281 | install_element_ve(&show_bts_cmd); |
| 2282 | install_element_ve(&show_trx_cmd); |
| 2283 | install_element_ve(&show_ts_cmd); |
| 2284 | install_element_ve(&show_lchan_cmd); |
Holger Hans Peter Freyther | e959b4e | 2010-05-14 02:08:49 +0800 | [diff] [blame] | 2285 | install_element_ve(&show_lchan_summary_cmd); |
Harald Welte | 682ee5f | 2010-05-16 22:02:16 +0200 | [diff] [blame] | 2286 | install_element_ve(&logging_fltr_imsi_cmd); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2287 | |
Harald Welte | 7bc28f6 | 2010-05-12 16:10:35 +0000 | [diff] [blame] | 2288 | install_element_ve(&show_e1drv_cmd); |
| 2289 | install_element_ve(&show_e1line_cmd); |
| 2290 | install_element_ve(&show_e1ts_cmd); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2291 | |
Harald Welte | 7bc28f6 | 2010-05-12 16:10:35 +0000 | [diff] [blame] | 2292 | install_element_ve(&show_paging_cmd); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2293 | |
Harald Welte | 682ee5f | 2010-05-16 22:02:16 +0200 | [diff] [blame] | 2294 | logging_vty_add_cmds(); |
Holger Hans Peter Freyther | c8d862e | 2009-12-22 22:32:51 +0100 | [diff] [blame] | 2295 | |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 2296 | install_element(CONFIG_NODE, &cfg_net_cmd); |
| 2297 | install_node(&net_node, config_write_net); |
| 2298 | install_default(GSMNET_NODE); |
Harald Welte | 58ed1cb | 2010-05-14 18:59:17 +0200 | [diff] [blame] | 2299 | install_element(GSMNET_NODE, &ournode_exit_cmd); |
Harald Welte | dc82b9b | 2010-05-14 19:11:04 +0200 | [diff] [blame] | 2300 | install_element(GSMNET_NODE, &ournode_end_cmd); |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2301 | install_element(GSMNET_NODE, &cfg_net_ncc_cmd); |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 2302 | install_element(GSMNET_NODE, &cfg_net_mnc_cmd); |
| 2303 | install_element(GSMNET_NODE, &cfg_net_name_short_cmd); |
| 2304 | install_element(GSMNET_NODE, &cfg_net_name_long_cmd); |
Harald Welte (local) | a59a27e | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 2305 | install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd); |
Harald Welte | 59936d7 | 2009-11-18 20:33:19 +0100 | [diff] [blame] | 2306 | install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd); |
Harald Welte | cca253a | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 2307 | install_element(GSMNET_NODE, &cfg_net_encryption_cmd); |
Holger Hans Peter Freyther | 96c8982 | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 2308 | install_element(GSMNET_NODE, &cfg_net_neci_cmd); |
Harald Welte | 52af195 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 2309 | install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd); |
Harald Welte | 284ddba | 2009-12-14 17:49:15 +0100 | [diff] [blame] | 2310 | install_element(GSMNET_NODE, &cfg_net_mm_info_cmd); |
Harald Welte | 0af9c9f | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 2311 | install_element(GSMNET_NODE, &cfg_net_handover_cmd); |
Harald Welte | a8062f1 | 2009-12-21 16:51:50 +0100 | [diff] [blame] | 2312 | install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_cmd); |
| 2313 | install_element(GSMNET_NODE, &cfg_net_ho_win_rxqual_avg_cmd); |
| 2314 | install_element(GSMNET_NODE, &cfg_net_ho_win_rxlev_avg_neigh_cmd); |
| 2315 | install_element(GSMNET_NODE, &cfg_net_ho_pwr_interval_cmd); |
| 2316 | install_element(GSMNET_NODE, &cfg_net_ho_pwr_hysteresis_cmd); |
| 2317 | install_element(GSMNET_NODE, &cfg_net_ho_max_distance_cmd); |
Holger Hans Peter Freyther | 26ba2e7 | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 2318 | install_element(GSMNET_NODE, &cfg_net_T3101_cmd); |
Holger Hans Peter Freyther | 8973386 | 2009-11-21 21:42:26 +0100 | [diff] [blame] | 2319 | install_element(GSMNET_NODE, &cfg_net_T3103_cmd); |
| 2320 | install_element(GSMNET_NODE, &cfg_net_T3105_cmd); |
| 2321 | install_element(GSMNET_NODE, &cfg_net_T3107_cmd); |
| 2322 | install_element(GSMNET_NODE, &cfg_net_T3109_cmd); |
| 2323 | install_element(GSMNET_NODE, &cfg_net_T3111_cmd); |
| 2324 | install_element(GSMNET_NODE, &cfg_net_T3113_cmd); |
| 2325 | install_element(GSMNET_NODE, &cfg_net_T3115_cmd); |
| 2326 | install_element(GSMNET_NODE, &cfg_net_T3117_cmd); |
| 2327 | install_element(GSMNET_NODE, &cfg_net_T3119_cmd); |
| 2328 | install_element(GSMNET_NODE, &cfg_net_T3141_cmd); |
Holger Hans Peter Freyther | 21d63ff | 2010-09-06 09:25:48 +0800 | [diff] [blame] | 2329 | install_element(GSMNET_NODE, &cfg_net_dtx_cmd); |
Holger Hans Peter Freyther | b6b9d70 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 2330 | install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd); |
Harald Welte | e87eb46 | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 2331 | |
| 2332 | install_element(GSMNET_NODE, &cfg_bts_cmd); |
Harald Welte | 97ceef9 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 2333 | install_node(&bts_node, config_write_bts); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2334 | install_default(BTS_NODE); |
Harald Welte | 58ed1cb | 2010-05-14 18:59:17 +0200 | [diff] [blame] | 2335 | install_element(BTS_NODE, &ournode_exit_cmd); |
Harald Welte | dc82b9b | 2010-05-14 19:11:04 +0200 | [diff] [blame] | 2336 | install_element(BTS_NODE, &ournode_end_cmd); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2337 | install_element(BTS_NODE, &cfg_bts_type_cmd); |
Harald Welte | 8791dac | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 2338 | install_element(BTS_NODE, &cfg_description_cmd); |
| 2339 | install_element(BTS_NODE, &cfg_no_description_cmd); |
Harald Welte | 91afe4c | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 2340 | install_element(BTS_NODE, &cfg_bts_band_cmd); |
Holger Hans Peter Freyther | a098dfb | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 2341 | install_element(BTS_NODE, &cfg_bts_ci_cmd); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2342 | install_element(BTS_NODE, &cfg_bts_lac_cmd); |
| 2343 | install_element(BTS_NODE, &cfg_bts_tsc_cmd); |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2344 | install_element(BTS_NODE, &cfg_bts_bsic_cmd); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2345 | install_element(BTS_NODE, &cfg_bts_unit_id_cmd); |
Harald Welte | 2557287 | 2009-10-20 00:22:00 +0200 | [diff] [blame] | 2346 | install_element(BTS_NODE, &cfg_bts_stream_id_cmd); |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2347 | install_element(BTS_NODE, &cfg_bts_oml_e1_cmd); |
| 2348 | install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd); |
Harald Welte | 3e77461 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 2349 | install_element(BTS_NODE, &cfg_bts_challoc_cmd); |
Sylvain Munaut | 8e2d8de | 2009-12-22 13:43:26 +0100 | [diff] [blame] | 2350 | install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd); |
| 2351 | install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd); |
Holger Hans Peter Freyther | 697ed2b | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 2352 | install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd); |
| 2353 | install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd); |
Harald Welte (local) | e19be3f | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 2354 | install_element(BTS_NODE, &cfg_bts_cell_barred_cmd); |
Holger Hans Peter Freyther | 440984b | 2010-05-14 00:39:19 +0800 | [diff] [blame] | 2355 | install_element(BTS_NODE, &cfg_bts_rach_ec_allowed_cmd); |
Harald Welte (local) | cbd4610 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 2356 | install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd); |
Harald Welte (local) | b6ea7f7 | 2009-08-14 23:09:25 +0200 | [diff] [blame] | 2357 | install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd); |
Harald Welte | b761bf8 | 2009-12-12 18:17:25 +0100 | [diff] [blame] | 2358 | install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd); |
| 2359 | install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd); |
Harald Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 2360 | install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd); |
Harald Welte | a925176 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 2361 | install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd); |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2362 | install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd); |
| 2363 | install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd); |
Harald Welte | a925176 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 2364 | install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd); |
Harald Welte | 4a048c5 | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 2365 | install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd); |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 2366 | install_element(BTS_NODE, &cfg_bts_gprs_nsvci_cmd); |
Harald Welte | 410575a | 2010-03-14 23:30:30 +0800 | [diff] [blame] | 2367 | install_element(BTS_NODE, &cfg_bts_gprs_nsvc_lport_cmd); |
| 2368 | install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rport_cmd); |
| 2369 | install_element(BTS_NODE, &cfg_bts_gprs_nsvc_rip_cmd); |
Holger Hans Peter Freyther | 3112f67 | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 2370 | install_element(BTS_NODE, &cfg_bts_pag_free_cmd); |
Harald Welte | d8acf14 | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 2371 | install_element(BTS_NODE, &cfg_bts_si_mode_cmd); |
| 2372 | install_element(BTS_NODE, &cfg_bts_si_static_cmd); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2373 | |
| 2374 | install_element(BTS_NODE, &cfg_trx_cmd); |
| 2375 | install_node(&trx_node, dummy_config_write); |
| 2376 | install_default(TRX_NODE); |
Harald Welte | 58ed1cb | 2010-05-14 18:59:17 +0200 | [diff] [blame] | 2377 | install_element(TRX_NODE, &ournode_exit_cmd); |
Harald Welte | dc82b9b | 2010-05-14 19:11:04 +0200 | [diff] [blame] | 2378 | install_element(TRX_NODE, &ournode_end_cmd); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2379 | install_element(TRX_NODE, &cfg_trx_arfcn_cmd); |
Harald Welte | 8791dac | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 2380 | install_element(TRX_NODE, &cfg_description_cmd); |
| 2381 | install_element(TRX_NODE, &cfg_no_description_cmd); |
Harald Welte (local) | b709bfe | 2009-12-27 20:56:38 +0100 | [diff] [blame] | 2382 | install_element(TRX_NODE, &cfg_trx_nominal_power_cmd); |
Harald Welte | 7f597bc | 2009-06-20 22:36:12 +0200 | [diff] [blame] | 2383 | install_element(TRX_NODE, &cfg_trx_max_power_red_cmd); |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 2384 | install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd); |
| 2385 | install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd); |
Holger Hans Peter Freyther | 1c8b480 | 2009-11-11 11:54:24 +0100 | [diff] [blame] | 2386 | install_element(TRX_NODE, &cfg_trx_rf_locked_cmd); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2387 | |
| 2388 | install_element(TRX_NODE, &cfg_ts_cmd); |
| 2389 | install_node(&ts_node, dummy_config_write); |
| 2390 | install_default(TS_NODE); |
Harald Welte | 58ed1cb | 2010-05-14 18:59:17 +0200 | [diff] [blame] | 2391 | install_element(TS_NODE, &ournode_exit_cmd); |
Harald Welte | dc82b9b | 2010-05-14 19:11:04 +0200 | [diff] [blame] | 2392 | install_element(TS_NODE, &ournode_end_cmd); |
Harald Welte | 3ffe1b3 | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 2393 | install_element(TS_NODE, &cfg_ts_pchan_cmd); |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 2394 | install_element(TS_NODE, &cfg_ts_hopping_cmd); |
Harald Welte | 67104d1 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 2395 | install_element(TS_NODE, &cfg_ts_hsn_cmd); |
| 2396 | install_element(TS_NODE, &cfg_ts_maio_cmd); |
| 2397 | install_element(TS_NODE, &cfg_ts_arfcn_add_cmd); |
| 2398 | install_element(TS_NODE, &cfg_ts_arfcn_del_cmd); |
Harald Welte | 3ffe1b3 | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 2399 | install_element(TS_NODE, &cfg_ts_e1_subslot_cmd); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2400 | |
Harald Welte | 63b964e | 2010-05-31 16:40:40 +0200 | [diff] [blame] | 2401 | abis_nm_vty_init(); |
| 2402 | |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 2403 | bsc_vty_init_extra(); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 2404 | |
| 2405 | return 0; |
| 2406 | } |