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