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