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