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