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