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