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