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