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