Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1 | /* OpenBSC interface to quagga VTY */ |
| 2 | /* (C) 2009 by Harald Welte <laforge@gnumonks.org> |
| 3 | * All Rights Reserved |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License along |
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | #include <stdlib.h> |
| 22 | #include <unistd.h> |
| 23 | #include <sys/types.h> |
| 24 | |
| 25 | #include <vty/command.h> |
Harald Welte | f9daefd | 2009-08-09 15:13:54 +0200 | [diff] [blame] | 26 | #include <vty/buffer.h> |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 27 | #include <vty/vty.h> |
| 28 | |
| 29 | #include <arpa/inet.h> |
| 30 | |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 31 | #include <openbsc/linuxlist.h> |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 32 | #include <openbsc/gsm_data.h> |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 33 | #include <openbsc/e1_input.h> |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 34 | #include <openbsc/abis_nm.h> |
Harald Welte | f9daefd | 2009-08-09 15:13:54 +0200 | [diff] [blame] | 35 | #include <openbsc/gsm_utils.h> |
Harald Welte | 40f8289 | 2009-05-23 17:31:39 +0000 | [diff] [blame] | 36 | #include <openbsc/db.h> |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 37 | #include <openbsc/talloc.h> |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 38 | |
| 39 | static struct gsm_network *gsmnet; |
| 40 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 41 | struct cmd_node net_node = { |
| 42 | GSMNET_NODE, |
| 43 | "%s(network)#", |
| 44 | 1, |
| 45 | }; |
| 46 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 47 | struct cmd_node bts_node = { |
| 48 | BTS_NODE, |
| 49 | "%s(bts)#", |
| 50 | 1, |
| 51 | }; |
| 52 | |
| 53 | struct cmd_node trx_node = { |
| 54 | TRX_NODE, |
| 55 | "%s(trx)#", |
| 56 | 1, |
| 57 | }; |
| 58 | |
| 59 | struct cmd_node ts_node = { |
| 60 | TS_NODE, |
| 61 | "%s(ts)#", |
| 62 | 1, |
| 63 | }; |
| 64 | |
| 65 | static int dummy_config_write(struct vty *v) |
| 66 | { |
| 67 | return CMD_SUCCESS; |
| 68 | } |
| 69 | |
| 70 | static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms) |
| 71 | { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 72 | vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s", |
| 73 | nm_opstate_name(nms->operational), nms->administrative, |
| 74 | nm_avail_name(nms->availability), VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | static void net_dump_vty(struct vty *vty, struct gsm_network *net) |
| 78 | { |
Harald Welte | ef235b5 | 2009-03-10 12:34:02 +0000 | [diff] [blame] | 79 | vty_out(vty, "BSC is on Country Code %u, Network Code %u " |
| 80 | "and has %u BTS%s", net->country_code, net->network_code, |
| 81 | net->num_bts, VTY_NEWLINE); |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 82 | vty_out(vty, " Long network name: '%s'%s", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 83 | net->name_long, VTY_NEWLINE); |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 84 | vty_out(vty, " Short network name: '%s'%s", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 85 | net->name_short, VTY_NEWLINE); |
Harald Welte (local) | 69de397 | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 86 | vty_out(vty, " Authentication policy: %s%s", |
| 87 | gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE); |
Harald Welte | 4381cfe | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 88 | vty_out(vty, " Encryption: A5/%u%s", net->a5_encryption, |
| 89 | VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | DEFUN(show_net, show_net_cmd, "show network", |
| 93 | SHOW_STR "Display information about a GSM NETWORK\n") |
| 94 | { |
| 95 | struct gsm_network *net = gsmnet; |
| 96 | net_dump_vty(vty, net); |
| 97 | |
| 98 | return CMD_SUCCESS; |
| 99 | } |
| 100 | |
| 101 | static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l) |
| 102 | { |
Harald Welte | edb3778 | 2009-05-01 14:59:07 +0000 | [diff] [blame] | 103 | struct e1inp_line *line; |
| 104 | |
| 105 | if (!e1l) { |
| 106 | vty_out(vty, " None%s", VTY_NEWLINE); |
| 107 | return; |
| 108 | } |
| 109 | |
| 110 | line = e1l->ts->line; |
| 111 | |
| 112 | vty_out(vty, " E1 Line %u, Type %s: Timeslot %u, Mode %s%s", |
| 113 | line->num, line->driver->name, e1l->ts->num, |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 114 | e1inp_signtype_name(e1l->type), VTY_NEWLINE); |
Harald Welte | edb3778 | 2009-05-01 14:59:07 +0000 | [diff] [blame] | 115 | vty_out(vty, " E1 TEI %u, SAPI %u%s", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 116 | e1l->tei, e1l->sapi, VTY_NEWLINE); |
| 117 | } |
| 118 | |
| 119 | static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts) |
| 120 | { |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 121 | vty_out(vty, "BTS %u is of %s type in band %s, has LAC %u, " |
| 122 | "BSIC %u, TSC %u and %u TRX%s", |
| 123 | bts->nr, btstype2str(bts->type), gsm_band_name(bts->band), |
| 124 | bts->location_area_code, bts->bsic, bts->tsc, |
| 125 | bts->num_trx, VTY_NEWLINE); |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 126 | if (bts->cell_barred) |
| 127 | vty_out(vty, " CELL IS BARRED%s", VTY_NEWLINE); |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 128 | if (is_ipaccess_bts(bts)) |
| 129 | vty_out(vty, " Unit ID: %u/%u/0%s", |
| 130 | bts->ip_access.site_id, bts->ip_access.bts_id, |
| 131 | VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 132 | vty_out(vty, " NM State: "); |
| 133 | net_dump_nmstate(vty, &bts->nm_state); |
| 134 | vty_out(vty, " Site Mgr NM State: "); |
| 135 | net_dump_nmstate(vty, &bts->site_mgr.nm_state); |
| 136 | vty_out(vty, " Paging: FIXME pending requests, %u free slots%s", |
| 137 | bts->paging.available_slots, VTY_NEWLINE); |
| 138 | vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE); |
| 139 | e1isl_dump_vty(vty, bts->oml_link); |
| 140 | /* FIXME: oml_link, chan_desc */ |
| 141 | } |
| 142 | |
| 143 | DEFUN(show_bts, show_bts_cmd, "show bts [number]", |
| 144 | SHOW_STR "Display information about a BTS\n" |
| 145 | "BTS number") |
| 146 | { |
| 147 | struct gsm_network *net = gsmnet; |
| 148 | int bts_nr; |
| 149 | |
| 150 | if (argc != 0) { |
| 151 | /* use the BTS number that the user has specified */ |
| 152 | bts_nr = atoi(argv[0]); |
| 153 | if (bts_nr > net->num_bts) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 154 | vty_out(vty, "%% can't find BTS '%s'%s", argv[0], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 155 | VTY_NEWLINE); |
| 156 | return CMD_WARNING; |
| 157 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 158 | bts_dump_vty(vty, gsm_bts_num(net, bts_nr)); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 159 | return CMD_SUCCESS; |
| 160 | } |
| 161 | /* print all BTS's */ |
| 162 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 163 | bts_dump_vty(vty, gsm_bts_num(net, bts_nr)); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 164 | |
| 165 | return CMD_SUCCESS; |
| 166 | } |
| 167 | |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 168 | /* utility functions */ |
| 169 | static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line, |
| 170 | const char *ts, const char *ss) |
| 171 | { |
| 172 | e1_link->e1_nr = atoi(line); |
| 173 | e1_link->e1_ts = atoi(ts); |
| 174 | if (!strcmp(ss, "full")) |
| 175 | e1_link->e1_ts_ss = 255; |
| 176 | else |
| 177 | e1_link->e1_ts_ss = atoi(ss); |
| 178 | } |
| 179 | |
| 180 | static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link, |
| 181 | const char *prefix) |
| 182 | { |
| 183 | if (!e1_link->e1_ts) |
| 184 | return; |
| 185 | |
| 186 | if (e1_link->e1_ts_ss == 255) |
| 187 | vty_out(vty, "%se1 line %u timeslot %u sub-slot full%s", |
| 188 | prefix, e1_link->e1_nr, e1_link->e1_ts, VTY_NEWLINE); |
| 189 | else |
| 190 | vty_out(vty, "%se1 line %u timeslot %u sub-slot %u%s", |
| 191 | prefix, e1_link->e1_nr, e1_link->e1_ts, |
| 192 | e1_link->e1_ts_ss, VTY_NEWLINE); |
| 193 | } |
| 194 | |
| 195 | |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 196 | static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts) |
| 197 | { |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 198 | vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE); |
| 199 | if (ts->pchan != GSM_PCHAN_NONE) |
| 200 | vty_out(vty, " phys_chan_config %s%s", |
| 201 | gsm_pchan_name(ts->pchan), VTY_NEWLINE); |
| 202 | config_write_e1_link(vty, &ts->e1_link, " "); |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx) |
| 206 | { |
| 207 | int i; |
| 208 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 209 | vty_out(vty, " trx %u%s", trx->nr, VTY_NEWLINE); |
| 210 | vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE); |
| 211 | vty_out(vty, " max_power_red %u%s", trx->max_power_red, VTY_NEWLINE); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 212 | config_write_e1_link(vty, &trx->rsl_e1_link, " rsl "); |
| 213 | vty_out(vty, " rsl e1 tei %u%s", trx->rsl_tei, VTY_NEWLINE); |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 214 | |
| 215 | for (i = 0; i < TRX_NR_TS; i++) |
| 216 | config_write_ts_single(vty, &trx->ts[i]); |
| 217 | } |
| 218 | |
| 219 | static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) |
| 220 | { |
| 221 | struct gsm_bts_trx *trx; |
| 222 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 223 | vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE); |
| 224 | vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE); |
| 225 | vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE); |
| 226 | vty_out(vty, " location_area_code %u%s", bts->location_area_code, |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 227 | VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 228 | vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE); |
| 229 | vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE); |
Harald Welte (local) | 0e451d0 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 230 | vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE); |
Harald Welte (local) | efc9231 | 2009-08-14 23:09:25 +0200 | [diff] [blame] | 231 | if (bts->chan_desc.t3212) |
| 232 | vty_out(vty, " periodic location update %u%s", |
| 233 | bts->chan_desc.t3212 * 10, VTY_NEWLINE); |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 234 | vty_out(vty, " channel allocator %s%s", |
| 235 | bts->chan_alloc_reverse ? "descending" : "ascending", |
| 236 | VTY_NEWLINE); |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 237 | if (bts->cell_barred) |
| 238 | vty_out(vty, " cell barred 1%s", VTY_NEWLINE); |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 239 | if (is_ipaccess_bts(bts)) |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 240 | vty_out(vty, " ip.access unit_id %u %u%s", |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 241 | bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 242 | else { |
| 243 | config_write_e1_link(vty, &bts->oml_e1_link, " oml "); |
| 244 | vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE); |
| 245 | } |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 246 | |
| 247 | llist_for_each_entry(trx, &bts->trx_list, list) |
| 248 | config_write_trx_single(vty, trx); |
| 249 | } |
| 250 | |
| 251 | static int config_write_bts(struct vty *v) |
| 252 | { |
| 253 | struct gsm_bts *bts; |
| 254 | |
| 255 | llist_for_each_entry(bts, &gsmnet->bts_list, list) |
| 256 | config_write_bts_single(v, bts); |
| 257 | |
| 258 | return CMD_SUCCESS; |
| 259 | } |
| 260 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 261 | static int config_write_net(struct vty *vty) |
| 262 | { |
| 263 | vty_out(vty, "network%s", VTY_NEWLINE); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 264 | vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 265 | vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 266 | vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE); |
| 267 | vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE); |
Harald Welte (local) | 69de397 | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 268 | vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE); |
Harald Welte | 4381cfe | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 269 | vty_out(vty, " encryption a5 %u%s", gsmnet->a5_encryption, VTY_NEWLINE); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 270 | |
| 271 | return CMD_SUCCESS; |
| 272 | } |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 273 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 274 | static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx) |
| 275 | { |
| 276 | vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s", |
| 277 | trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE); |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 278 | vty_out(vty, " RF Nominal Power: %d dBm, reduced by %u dB, " |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 279 | "resulting BS power: %d dBm%s", |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 280 | trx->nominal_power, trx->max_power_red, |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 281 | trx->nominal_power - trx->max_power_red, VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 282 | vty_out(vty, " NM State: "); |
| 283 | net_dump_nmstate(vty, &trx->nm_state); |
| 284 | vty_out(vty, " Baseband Transceiver NM State: "); |
| 285 | net_dump_nmstate(vty, &trx->bb_transc.nm_state); |
| 286 | vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE); |
| 287 | e1isl_dump_vty(vty, trx->rsl_link); |
| 288 | } |
| 289 | |
| 290 | DEFUN(show_trx, |
| 291 | show_trx_cmd, |
| 292 | "show trx [bts_nr] [trx_nr]", |
| 293 | SHOW_STR "Display information about a TRX\n") |
| 294 | { |
| 295 | struct gsm_network *net = gsmnet; |
| 296 | struct gsm_bts *bts = NULL; |
| 297 | struct gsm_bts_trx *trx; |
| 298 | int bts_nr, trx_nr; |
| 299 | |
| 300 | if (argc >= 1) { |
| 301 | /* use the BTS number that the user has specified */ |
| 302 | bts_nr = atoi(argv[0]); |
| 303 | if (bts_nr >= net->num_bts) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 304 | vty_out(vty, "%% can't find BTS '%s'%s", argv[0], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 305 | VTY_NEWLINE); |
| 306 | return CMD_WARNING; |
| 307 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 308 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 309 | } |
| 310 | if (argc >= 2) { |
| 311 | trx_nr = atoi(argv[1]); |
| 312 | if (trx_nr >= bts->num_trx) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 313 | vty_out(vty, "%% can't find TRX '%s'%s", argv[1], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 314 | VTY_NEWLINE); |
| 315 | return CMD_WARNING; |
| 316 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 317 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 318 | trx_dump_vty(vty, trx); |
| 319 | return CMD_SUCCESS; |
| 320 | } |
| 321 | if (bts) { |
| 322 | /* print all TRX in this BTS */ |
| 323 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 324 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 325 | trx_dump_vty(vty, trx); |
| 326 | } |
| 327 | return CMD_SUCCESS; |
| 328 | } |
| 329 | |
| 330 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 331 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 332 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 333 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 334 | trx_dump_vty(vty, trx); |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | return CMD_SUCCESS; |
| 339 | } |
| 340 | |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 341 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 342 | static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts) |
| 343 | { |
| 344 | struct in_addr ia; |
| 345 | |
| 346 | vty_out(vty, "Timeslot %u of TRX %u in BTS %u, phys cfg %s%s", |
| 347 | ts->nr, ts->trx->nr, ts->trx->bts->nr, |
| 348 | gsm_pchan_name(ts->pchan), VTY_NEWLINE); |
| 349 | vty_out(vty, " NM State: "); |
| 350 | net_dump_nmstate(vty, &ts->nm_state); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 351 | if (is_ipaccess_bts(ts->trx->bts)) { |
| 352 | ia.s_addr = ts->abis_ip.bound_ip; |
Harald Welte | 2085554 | 2009-07-12 09:50:35 +0200 | [diff] [blame] | 353 | vty_out(vty, " Bound IP: %s Port %u RTP_TYPE2=%u CONN_ID=%u%s", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 354 | inet_ntoa(ia), ts->abis_ip.bound_port, |
Harald Welte | 2085554 | 2009-07-12 09:50:35 +0200 | [diff] [blame] | 355 | ts->abis_ip.rtp_payload2, ts->abis_ip.conn_id, |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 356 | VTY_NEWLINE); |
Harald Welte | ef235b5 | 2009-03-10 12:34:02 +0000 | [diff] [blame] | 357 | } else { |
| 358 | vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s", |
| 359 | ts->e1_link.e1_nr, ts->e1_link.e1_ts, |
| 360 | ts->e1_link.e1_ts_ss, VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 361 | } |
| 362 | } |
| 363 | |
| 364 | DEFUN(show_ts, |
| 365 | show_ts_cmd, |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 366 | "show timeslot [bts_nr] [trx_nr] [ts_nr]", |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 367 | SHOW_STR "Display information about a TS\n") |
| 368 | { |
| 369 | struct gsm_network *net = gsmnet; |
| 370 | struct gsm_bts *bts; |
| 371 | struct gsm_bts_trx *trx; |
| 372 | struct gsm_bts_trx_ts *ts; |
| 373 | int bts_nr, trx_nr, ts_nr; |
| 374 | |
| 375 | if (argc >= 1) { |
| 376 | /* use the BTS number that the user has specified */ |
| 377 | bts_nr = atoi(argv[0]); |
| 378 | if (bts_nr >= net->num_bts) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 379 | vty_out(vty, "%% can't find BTS '%s'%s", argv[0], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 380 | VTY_NEWLINE); |
| 381 | return CMD_WARNING; |
| 382 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 383 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 384 | } |
| 385 | if (argc >= 2) { |
| 386 | trx_nr = atoi(argv[1]); |
| 387 | if (trx_nr >= bts->num_trx) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 388 | vty_out(vty, "%% can't find TRX '%s'%s", argv[1], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 389 | VTY_NEWLINE); |
| 390 | return CMD_WARNING; |
| 391 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 392 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 393 | } |
| 394 | if (argc >= 3) { |
| 395 | ts_nr = atoi(argv[2]); |
| 396 | if (ts_nr >= TRX_NR_TS) { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 397 | vty_out(vty, "%% can't find TS '%s'%s", argv[2], |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 398 | VTY_NEWLINE); |
| 399 | return CMD_WARNING; |
| 400 | } |
| 401 | ts = &trx->ts[ts_nr]; |
| 402 | ts_dump_vty(vty, ts); |
| 403 | return CMD_SUCCESS; |
| 404 | } |
| 405 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 406 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 407 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 408 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 409 | for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) { |
| 410 | ts = &trx->ts[ts_nr]; |
| 411 | ts_dump_vty(vty, ts); |
| 412 | } |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | return CMD_SUCCESS; |
| 417 | } |
| 418 | |
Holger Hans Peter Freyther | cfa90d4 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 419 | void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr) |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 420 | { |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 421 | vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id, |
Harald Welte | 40f8289 | 2009-05-23 17:31:39 +0000 | [diff] [blame] | 422 | subscr->authorized, VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 423 | if (subscr->name) |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 424 | vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 425 | if (subscr->extension) |
| 426 | vty_out(vty, " Extension: %s%s", subscr->extension, |
| 427 | VTY_NEWLINE); |
| 428 | if (subscr->imsi) |
| 429 | vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE); |
| 430 | if (subscr->tmsi) |
Harald Welte | 731fd91 | 2009-08-15 03:24:51 +0200 | [diff] [blame] | 431 | vty_out(vty, " TMSI: %08X%s", atoi(subscr->tmsi), |
| 432 | VTY_NEWLINE); |
Harald Welte (local) | 15920de | 2009-08-14 20:27:16 +0200 | [diff] [blame] | 433 | vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 434 | } |
| 435 | |
| 436 | static void lchan_dump_vty(struct vty *vty, struct gsm_lchan *lchan) |
| 437 | { |
| 438 | vty_out(vty, "Lchan %u in Timeslot %u of TRX %u in BTS %u, Type %s%s", |
| 439 | lchan->nr, lchan->ts->nr, lchan->ts->trx->nr, |
| 440 | lchan->ts->trx->bts->nr, gsm_lchan_name(lchan->type), |
| 441 | VTY_NEWLINE); |
| 442 | vty_out(vty, " Use Count: %u%s", lchan->use_count, VTY_NEWLINE); |
| 443 | vty_out(vty, " BS Power %u, MS Power %u%s", lchan->bs_power, |
| 444 | lchan->ms_power, VTY_NEWLINE); |
| 445 | if (lchan->subscr) { |
| 446 | vty_out(vty, " Subscriber:%s", VTY_NEWLINE); |
| 447 | subscr_dump_vty(vty, lchan->subscr); |
| 448 | } else |
| 449 | vty_out(vty, " No Subscriber%s", VTY_NEWLINE); |
| 450 | } |
| 451 | |
Harald Welte | 4bfdfe7 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 452 | #if 0 |
| 453 | TODO: callref and remote callref of call must be resolved to get gsm_trans object |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 454 | static void call_dump_vty(struct vty *vty, struct gsm_call *call) |
| 455 | { |
| 456 | vty_out(vty, "Call Type %u, State %u, Transaction ID %u%s", |
| 457 | call->type, call->state, call->transaction_id, VTY_NEWLINE); |
| 458 | |
| 459 | if (call->local_lchan) { |
| 460 | vty_out(vty, "Call Local Channel:%s", VTY_NEWLINE); |
| 461 | lchan_dump_vty(vty, call->local_lchan); |
| 462 | } else |
| 463 | vty_out(vty, "Call has no Local Channel%s", VTY_NEWLINE); |
| 464 | |
| 465 | if (call->remote_lchan) { |
| 466 | vty_out(vty, "Call Remote Channel:%s", VTY_NEWLINE); |
| 467 | lchan_dump_vty(vty, call->remote_lchan); |
| 468 | } else |
| 469 | vty_out(vty, "Call has no Remote Channel%s", VTY_NEWLINE); |
| 470 | |
| 471 | if (call->called_subscr) { |
| 472 | vty_out(vty, "Called Subscriber:%s", VTY_NEWLINE); |
| 473 | subscr_dump_vty(vty, call->called_subscr); |
| 474 | } else |
| 475 | vty_out(vty, "Call has no Called Subscriber%s", VTY_NEWLINE); |
| 476 | } |
Harald Welte | 4bfdfe7 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 477 | #endif |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 478 | |
| 479 | DEFUN(show_lchan, |
| 480 | show_lchan_cmd, |
| 481 | "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]", |
| 482 | SHOW_STR "Display information about a logical channel\n") |
| 483 | { |
| 484 | struct gsm_network *net = gsmnet; |
| 485 | struct gsm_bts *bts; |
| 486 | struct gsm_bts_trx *trx; |
| 487 | struct gsm_bts_trx_ts *ts; |
| 488 | struct gsm_lchan *lchan; |
| 489 | int bts_nr, trx_nr, ts_nr, lchan_nr; |
| 490 | |
| 491 | if (argc >= 1) { |
| 492 | /* use the BTS number that the user has specified */ |
| 493 | bts_nr = atoi(argv[0]); |
| 494 | if (bts_nr >= net->num_bts) { |
| 495 | vty_out(vty, "%% can't find BTS %s%s", argv[0], |
| 496 | VTY_NEWLINE); |
| 497 | return CMD_WARNING; |
| 498 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 499 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 500 | } |
| 501 | if (argc >= 2) { |
| 502 | trx_nr = atoi(argv[1]); |
| 503 | if (trx_nr >= bts->num_trx) { |
| 504 | vty_out(vty, "%% can't find TRX %s%s", argv[1], |
| 505 | VTY_NEWLINE); |
| 506 | return CMD_WARNING; |
| 507 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 508 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 509 | } |
| 510 | if (argc >= 3) { |
| 511 | ts_nr = atoi(argv[2]); |
| 512 | if (ts_nr >= TRX_NR_TS) { |
| 513 | vty_out(vty, "%% can't find TS %s%s", argv[2], |
| 514 | VTY_NEWLINE); |
| 515 | return CMD_WARNING; |
| 516 | } |
| 517 | ts = &trx->ts[ts_nr]; |
| 518 | } |
| 519 | if (argc >= 4) { |
| 520 | lchan_nr = atoi(argv[3]); |
| 521 | if (lchan_nr >= TS_MAX_LCHAN) { |
| 522 | vty_out(vty, "%% can't find LCHAN %s%s", argv[3], |
| 523 | VTY_NEWLINE); |
| 524 | return CMD_WARNING; |
| 525 | } |
| 526 | lchan = &ts->lchan[lchan_nr]; |
| 527 | lchan_dump_vty(vty, lchan); |
| 528 | return CMD_SUCCESS; |
| 529 | } |
| 530 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 531 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 532 | for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 533 | trx = gsm_bts_trx_num(bts, trx_nr); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 534 | for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) { |
| 535 | ts = &trx->ts[ts_nr]; |
| 536 | for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN; |
| 537 | lchan_nr++) { |
| 538 | lchan = &ts->lchan[lchan_nr]; |
Harald Welte | ef235b5 | 2009-03-10 12:34:02 +0000 | [diff] [blame] | 539 | if (lchan->type == GSM_LCHAN_NONE) |
| 540 | continue; |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 541 | lchan_dump_vty(vty, lchan); |
| 542 | } |
| 543 | } |
| 544 | } |
| 545 | } |
| 546 | |
| 547 | return CMD_SUCCESS; |
| 548 | } |
| 549 | |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 550 | static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv) |
| 551 | { |
| 552 | vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE); |
| 553 | } |
| 554 | |
| 555 | DEFUN(show_e1drv, |
| 556 | show_e1drv_cmd, |
| 557 | "show e1_driver", |
| 558 | SHOW_STR "Display information about available E1 drivers\n") |
| 559 | { |
| 560 | struct e1inp_driver *drv; |
| 561 | |
| 562 | llist_for_each_entry(drv, &e1inp_driver_list, list) |
| 563 | e1drv_dump_vty(vty, drv); |
| 564 | |
| 565 | return CMD_SUCCESS; |
| 566 | } |
| 567 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 568 | static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line) |
| 569 | { |
| 570 | vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s", |
| 571 | line->num, line->name ? line->name : "", |
| 572 | line->driver->name, VTY_NEWLINE); |
| 573 | } |
| 574 | |
| 575 | DEFUN(show_e1line, |
| 576 | show_e1line_cmd, |
| 577 | "show e1_line [line_nr]", |
| 578 | SHOW_STR "Display information about a E1 line\n") |
| 579 | { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 580 | struct e1inp_line *line; |
| 581 | |
| 582 | if (argc >= 1) { |
| 583 | int num = atoi(argv[0]); |
| 584 | llist_for_each_entry(line, &e1inp_line_list, list) { |
| 585 | if (line->num == num) { |
| 586 | e1line_dump_vty(vty, line); |
| 587 | return CMD_SUCCESS; |
| 588 | } |
| 589 | } |
| 590 | return CMD_WARNING; |
| 591 | } |
| 592 | |
| 593 | llist_for_each_entry(line, &e1inp_line_list, list) |
| 594 | e1line_dump_vty(vty, line); |
| 595 | |
| 596 | return CMD_SUCCESS; |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 597 | } |
| 598 | |
| 599 | static void e1ts_dump_vty(struct vty *vty, struct e1inp_ts *ts) |
| 600 | { |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 601 | if (ts->type == E1INP_TS_TYPE_NONE) |
| 602 | return; |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 603 | vty_out(vty, "E1 Timeslot %2u of Line %u is Type %s%s", |
| 604 | ts->num, ts->line->num, e1inp_tstype_name(ts->type), |
| 605 | VTY_NEWLINE); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 606 | } |
| 607 | |
| 608 | DEFUN(show_e1ts, |
| 609 | show_e1ts_cmd, |
| 610 | "show e1_timeslot [line_nr] [ts_nr]", |
| 611 | SHOW_STR "Display information about a E1 timeslot\n") |
| 612 | { |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 613 | struct e1inp_line *line; |
| 614 | struct e1inp_ts *ts; |
| 615 | int ts_nr; |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 616 | |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 617 | if (argc == 0) { |
| 618 | llist_for_each_entry(line, &e1inp_line_list, list) { |
| 619 | for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) { |
| 620 | ts = &line->ts[ts_nr]; |
| 621 | e1ts_dump_vty(vty, ts); |
| 622 | } |
| 623 | } |
| 624 | return CMD_SUCCESS; |
| 625 | } |
| 626 | if (argc >= 1) { |
| 627 | int num = atoi(argv[0]); |
| 628 | llist_for_each_entry(line, &e1inp_line_list, list) { |
| 629 | if (line->num == num) |
| 630 | break; |
| 631 | } |
| 632 | if (!line || line->num != num) { |
| 633 | vty_out(vty, "E1 line %s is invalid%s", |
| 634 | argv[0], VTY_NEWLINE); |
| 635 | return CMD_WARNING; |
| 636 | } |
| 637 | } |
| 638 | if (argc >= 2) { |
| 639 | ts_nr = atoi(argv[1]); |
| 640 | if (ts_nr > NUM_E1_TS) { |
| 641 | vty_out(vty, "E1 timeslot %s is invalid%s", |
| 642 | argv[1], VTY_NEWLINE); |
| 643 | return CMD_WARNING; |
| 644 | } |
| 645 | ts = &line->ts[ts_nr]; |
| 646 | e1ts_dump_vty(vty, ts); |
| 647 | return CMD_SUCCESS; |
| 648 | } else { |
| 649 | for (ts_nr = 0; ts_nr < NUM_E1_TS; ts_nr++) { |
| 650 | ts = &line->ts[ts_nr]; |
| 651 | e1ts_dump_vty(vty, ts); |
| 652 | } |
| 653 | return CMD_SUCCESS; |
| 654 | } |
| 655 | return CMD_SUCCESS; |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 656 | } |
| 657 | |
Harald Welte | be4b730 | 2009-05-23 16:59:33 +0000 | [diff] [blame] | 658 | static void paging_dump_vty(struct vty *vty, struct gsm_paging_request *pag) |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 659 | { |
| 660 | vty_out(vty, "Paging on BTS %u%s", pag->bts->nr, VTY_NEWLINE); |
| 661 | subscr_dump_vty(vty, pag->subscr); |
| 662 | } |
| 663 | |
Harald Welte | be4b730 | 2009-05-23 16:59:33 +0000 | [diff] [blame] | 664 | static void bts_paging_dump_vty(struct vty *vty, struct gsm_bts *bts) |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 665 | { |
| 666 | struct gsm_paging_request *pag; |
| 667 | |
| 668 | llist_for_each_entry(pag, &bts->paging.pending_requests, entry) |
| 669 | paging_dump_vty(vty, pag); |
| 670 | } |
| 671 | |
| 672 | DEFUN(show_paging, |
| 673 | show_paging_cmd, |
| 674 | "show paging [bts_nr]", |
Harald Welte | be4b730 | 2009-05-23 16:59:33 +0000 | [diff] [blame] | 675 | SHOW_STR "Display information about paging reuqests of a BTS\n") |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 676 | { |
| 677 | struct gsm_network *net = gsmnet; |
| 678 | struct gsm_bts *bts; |
| 679 | int bts_nr; |
| 680 | |
| 681 | if (argc >= 1) { |
| 682 | /* use the BTS number that the user has specified */ |
| 683 | bts_nr = atoi(argv[0]); |
| 684 | if (bts_nr >= net->num_bts) { |
| 685 | vty_out(vty, "%% can't find BTS %s%s", argv[0], |
| 686 | VTY_NEWLINE); |
| 687 | return CMD_WARNING; |
| 688 | } |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 689 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 690 | bts_paging_dump_vty(vty, bts); |
| 691 | |
| 692 | return CMD_SUCCESS; |
| 693 | } |
| 694 | for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 695 | bts = gsm_bts_num(net, bts_nr); |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 696 | bts_paging_dump_vty(vty, bts); |
| 697 | } |
| 698 | |
| 699 | return CMD_SUCCESS; |
| 700 | } |
| 701 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 702 | DEFUN(cfg_net, |
| 703 | cfg_net_cmd, |
| 704 | "network", |
| 705 | "Configure the GSM network") |
| 706 | { |
| 707 | vty->index = gsmnet; |
| 708 | vty->node = GSMNET_NODE; |
| 709 | |
| 710 | return CMD_SUCCESS; |
| 711 | } |
| 712 | |
| 713 | |
| 714 | DEFUN(cfg_net_ncc, |
| 715 | cfg_net_ncc_cmd, |
| 716 | "network country code <1-999>", |
| 717 | "Set the GSM network country code") |
| 718 | { |
| 719 | gsmnet->country_code = atoi(argv[0]); |
| 720 | |
| 721 | return CMD_SUCCESS; |
| 722 | } |
| 723 | |
| 724 | DEFUN(cfg_net_mnc, |
| 725 | cfg_net_mnc_cmd, |
| 726 | "mobile network code <1-999>", |
| 727 | "Set the GSM mobile network code") |
| 728 | { |
| 729 | gsmnet->network_code = atoi(argv[0]); |
| 730 | |
| 731 | return CMD_SUCCESS; |
| 732 | } |
| 733 | |
| 734 | DEFUN(cfg_net_name_short, |
| 735 | cfg_net_name_short_cmd, |
| 736 | "short name NAME", |
| 737 | "Set the short GSM network name") |
| 738 | { |
| 739 | if (gsmnet->name_short) |
| 740 | talloc_free(gsmnet->name_short); |
| 741 | |
| 742 | gsmnet->name_short = talloc_strdup(gsmnet, argv[0]); |
| 743 | |
| 744 | return CMD_SUCCESS; |
| 745 | } |
| 746 | |
| 747 | DEFUN(cfg_net_name_long, |
| 748 | cfg_net_name_long_cmd, |
| 749 | "long name NAME", |
| 750 | "Set the long GSM network name") |
| 751 | { |
| 752 | if (gsmnet->name_long) |
| 753 | talloc_free(gsmnet->name_long); |
| 754 | |
| 755 | gsmnet->name_long = talloc_strdup(gsmnet, argv[0]); |
| 756 | |
| 757 | return CMD_SUCCESS; |
| 758 | } |
Harald Welte | 40f8289 | 2009-05-23 17:31:39 +0000 | [diff] [blame] | 759 | |
Harald Welte (local) | 69de397 | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 760 | DEFUN(cfg_net_auth_policy, |
| 761 | cfg_net_auth_policy_cmd, |
| 762 | "auth policy (closed|accept-all|token)", |
| 763 | "Set the GSM network authentication policy\n") |
| 764 | { |
| 765 | enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]); |
| 766 | |
| 767 | gsmnet->auth_policy = policy; |
| 768 | |
| 769 | return CMD_SUCCESS; |
| 770 | } |
| 771 | |
Harald Welte | 4381cfe | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 772 | DEFUN(cfg_net_encryption, |
| 773 | cfg_net_encryption_cmd, |
| 774 | "encryption a5 (0|1|2)", |
| 775 | "Enable or disable encryption (A5) for this network\n") |
| 776 | { |
| 777 | gsmnet->auth_policy = atoi(argv[0]); |
| 778 | |
| 779 | return CMD_SUCCESS; |
| 780 | } |
| 781 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 782 | /* per-BTS configuration */ |
| 783 | DEFUN(cfg_bts, |
| 784 | cfg_bts_cmd, |
| 785 | "bts BTS_NR", |
| 786 | "Select a BTS to configure\n") |
| 787 | { |
| 788 | int bts_nr = atoi(argv[0]); |
| 789 | struct gsm_bts *bts; |
| 790 | |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 791 | if (bts_nr > gsmnet->num_bts) { |
| 792 | vty_out(vty, "%% The next unused BTS number is %u%s", |
| 793 | gsmnet->num_bts, VTY_NEWLINE); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 794 | return CMD_WARNING; |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 795 | } else if (bts_nr == gsmnet->num_bts) { |
| 796 | /* allocate a new one */ |
| 797 | bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN, |
| 798 | HARDCODED_TSC, HARDCODED_BSIC); |
| 799 | } else |
| 800 | bts = gsm_bts_num(gsmnet, bts_nr); |
| 801 | |
| 802 | if (!bts) |
| 803 | return CMD_WARNING; |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 804 | |
| 805 | vty->index = bts; |
| 806 | vty->node = BTS_NODE; |
| 807 | |
| 808 | return CMD_SUCCESS; |
| 809 | } |
| 810 | |
| 811 | DEFUN(cfg_bts_type, |
| 812 | cfg_bts_type_cmd, |
| 813 | "type TYPE", |
| 814 | "Set the BTS type\n") |
| 815 | { |
| 816 | struct gsm_bts *bts = vty->index; |
| 817 | |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 818 | bts->type = parse_btstype(argv[0]); |
| 819 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 820 | return CMD_SUCCESS; |
| 821 | } |
| 822 | |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 823 | DEFUN(cfg_bts_band, |
| 824 | cfg_bts_band_cmd, |
| 825 | "band BAND", |
| 826 | "Set the frequency band of this BTS\n") |
| 827 | { |
| 828 | struct gsm_bts *bts = vty->index; |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 829 | int band = gsm_band_parse(argv[0]); |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 830 | |
| 831 | if (band < 0) { |
| 832 | vty_out(vty, "%% BAND %d is not a valid GSM band%s", |
| 833 | band, VTY_NEWLINE); |
| 834 | return CMD_WARNING; |
| 835 | } |
| 836 | |
| 837 | bts->band = band; |
| 838 | |
| 839 | return CMD_SUCCESS; |
| 840 | } |
| 841 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 842 | DEFUN(cfg_bts_lac, |
| 843 | cfg_bts_lac_cmd, |
| 844 | "location_area_code <0-255>", |
| 845 | "Set the Location Area Code (LAC) of this BTS\n") |
| 846 | { |
| 847 | struct gsm_bts *bts = vty->index; |
| 848 | int lac = atoi(argv[0]); |
| 849 | |
| 850 | if (lac < 0 || lac > 0xff) { |
| 851 | vty_out(vty, "%% LAC %d is not in the valid range (0-255)%s", |
| 852 | lac, VTY_NEWLINE); |
| 853 | return CMD_WARNING; |
| 854 | } |
| 855 | bts->location_area_code = lac; |
| 856 | |
| 857 | return CMD_SUCCESS; |
| 858 | } |
| 859 | |
| 860 | DEFUN(cfg_bts_tsc, |
| 861 | cfg_bts_tsc_cmd, |
| 862 | "training_sequence_code <0-255>", |
| 863 | "Set the Training Sequence Code (TSC) of this BTS\n") |
| 864 | { |
| 865 | struct gsm_bts *bts = vty->index; |
| 866 | int tsc = atoi(argv[0]); |
| 867 | |
| 868 | if (tsc < 0 || tsc > 0xff) { |
| 869 | vty_out(vty, "%% TSC %d is not in the valid range (0-255)%s", |
| 870 | tsc, VTY_NEWLINE); |
| 871 | return CMD_WARNING; |
| 872 | } |
| 873 | bts->tsc = tsc; |
| 874 | |
| 875 | return CMD_SUCCESS; |
| 876 | } |
| 877 | |
Harald Welte | 78f2f50 | 2009-05-23 16:56:52 +0000 | [diff] [blame] | 878 | DEFUN(cfg_bts_bsic, |
| 879 | cfg_bts_bsic_cmd, |
| 880 | "base_station_id_code <0-63>", |
| 881 | "Set the Base Station Identity Code (BSIC) of this BTS\n") |
| 882 | { |
| 883 | struct gsm_bts *bts = vty->index; |
| 884 | int bsic = atoi(argv[0]); |
| 885 | |
| 886 | if (bsic < 0 || bsic > 0x3f) { |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 887 | vty_out(vty, "%% BSIC %d is not in the valid range (0-255)%s", |
Harald Welte | 78f2f50 | 2009-05-23 16:56:52 +0000 | [diff] [blame] | 888 | bsic, VTY_NEWLINE); |
| 889 | return CMD_WARNING; |
| 890 | } |
| 891 | bts->bsic = bsic; |
| 892 | |
| 893 | return CMD_SUCCESS; |
| 894 | } |
| 895 | |
| 896 | |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 897 | DEFUN(cfg_bts_unit_id, |
| 898 | cfg_bts_unit_id_cmd, |
Harald Welte | 07dc73d | 2009-08-07 13:27:09 +0200 | [diff] [blame] | 899 | "ip.access unit_id <0-65534> <0-255>", |
| 900 | "Set the ip.access BTS Unit ID of this BTS\n") |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 901 | { |
| 902 | struct gsm_bts *bts = vty->index; |
| 903 | int site_id = atoi(argv[0]); |
| 904 | int bts_id = atoi(argv[1]); |
| 905 | |
Harald Welte | 07dc73d | 2009-08-07 13:27:09 +0200 | [diff] [blame] | 906 | if (!is_ipaccess_bts(bts)) { |
| 907 | vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE); |
| 908 | return CMD_WARNING; |
| 909 | } |
| 910 | |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 911 | bts->ip_access.site_id = site_id; |
| 912 | bts->ip_access.bts_id = bts_id; |
| 913 | |
| 914 | return CMD_SUCCESS; |
| 915 | } |
| 916 | |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 917 | DEFUN(cfg_bts_oml_e1, |
| 918 | cfg_bts_oml_e1_cmd, |
| 919 | "oml e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)", |
| 920 | "E1 interface to be used for OML\n") |
| 921 | { |
| 922 | struct gsm_bts *bts = vty->index; |
| 923 | |
| 924 | parse_e1_link(&bts->oml_e1_link, argv[0], argv[1], argv[2]); |
| 925 | |
| 926 | return CMD_SUCCESS; |
| 927 | } |
| 928 | |
| 929 | |
| 930 | DEFUN(cfg_bts_oml_e1_tei, |
| 931 | cfg_bts_oml_e1_tei_cmd, |
| 932 | "oml e1 tei <0-63>", |
| 933 | "Set the TEI to be used for OML") |
| 934 | { |
| 935 | struct gsm_bts *bts = vty->index; |
| 936 | |
| 937 | bts->oml_tei = atoi(argv[0]); |
| 938 | |
| 939 | return CMD_SUCCESS; |
| 940 | } |
| 941 | |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 942 | DEFUN(cfg_bts_challoc, cfg_bts_challoc_cmd, |
| 943 | "channel allocator (ascending|descending)", |
| 944 | "Should the channel allocator allocate in reverse TRX order?") |
| 945 | { |
| 946 | struct gsm_bts *bts = vty->index; |
| 947 | |
| 948 | if (!strcmp(argv[0], "ascending")) |
| 949 | bts->chan_alloc_reverse = 0; |
| 950 | else |
| 951 | bts->chan_alloc_reverse = 1; |
| 952 | |
| 953 | return CMD_SUCCESS; |
| 954 | } |
| 955 | |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 956 | DEFUN(cfg_bts_cell_barred, cfg_bts_cell_barred_cmd, |
| 957 | "cell barred (0|1)", |
| 958 | "Should this cell be barred from access?") |
| 959 | { |
| 960 | struct gsm_bts *bts = vty->index; |
| 961 | |
| 962 | bts->cell_barred = atoi(argv[0]); |
| 963 | |
| 964 | return CMD_SUCCESS; |
| 965 | } |
| 966 | |
Harald Welte (local) | 0e451d0 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 967 | DEFUN(cfg_bts_ms_max_power, cfg_bts_ms_max_power_cmd, |
| 968 | "ms max power <0-40>", |
| 969 | "Maximum transmit power of the MS") |
| 970 | { |
| 971 | struct gsm_bts *bts = vty->index; |
| 972 | |
| 973 | bts->ms_max_power = atoi(argv[0]); |
| 974 | |
| 975 | return CMD_SUCCESS; |
| 976 | } |
| 977 | |
Harald Welte (local) | efc9231 | 2009-08-14 23:09:25 +0200 | [diff] [blame] | 978 | DEFUN(cfg_bts_per_loc_upd, cfg_bts_per_loc_upd_cmd, |
| 979 | "periodic location update <0-1530>", |
| 980 | "Periodic Location Updating Interval in Minutes") |
| 981 | { |
| 982 | struct gsm_bts *bts = vty->index; |
| 983 | |
| 984 | bts->chan_desc.t3212 = atoi(argv[0]) / 10; |
| 985 | |
| 986 | return CMD_SUCCESS; |
| 987 | } |
| 988 | |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 989 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 990 | /* per TRX configuration */ |
| 991 | DEFUN(cfg_trx, |
| 992 | cfg_trx_cmd, |
| 993 | "trx TRX_NR", |
| 994 | "Select a TRX to configure") |
| 995 | { |
| 996 | int trx_nr = atoi(argv[0]); |
| 997 | struct gsm_bts *bts = vty->index; |
| 998 | struct gsm_bts_trx *trx; |
| 999 | |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1000 | if (trx_nr > bts->num_trx) { |
| 1001 | vty_out(vty, "%% The next unused TRX number in this BTS is %u%s", |
| 1002 | bts->num_trx, VTY_NEWLINE); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1003 | return CMD_WARNING; |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1004 | } else if (trx_nr == bts->num_trx) { |
| 1005 | /* we need to allocate a new one */ |
| 1006 | trx = gsm_bts_trx_alloc(bts); |
| 1007 | } else |
| 1008 | trx = gsm_bts_trx_num(bts, trx_nr); |
| 1009 | |
| 1010 | if (!trx) |
| 1011 | return CMD_WARNING; |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1012 | |
| 1013 | vty->index = trx; |
| 1014 | vty->node = TRX_NODE; |
| 1015 | |
| 1016 | return CMD_SUCCESS; |
| 1017 | } |
| 1018 | |
| 1019 | DEFUN(cfg_trx_arfcn, |
| 1020 | cfg_trx_arfcn_cmd, |
| 1021 | "arfcn <1-1024>", |
| 1022 | "Set the ARFCN for this TRX\n") |
| 1023 | { |
| 1024 | int arfcn = atoi(argv[0]); |
| 1025 | struct gsm_bts_trx *trx = vty->index; |
| 1026 | |
| 1027 | /* FIXME: check if this ARFCN is supported by this TRX */ |
| 1028 | |
| 1029 | trx->arfcn = arfcn; |
| 1030 | |
| 1031 | /* FIXME: patch ARFCN into SYSTEM INFORMATION */ |
| 1032 | /* FIXME: use OML layer to update the ARFCN */ |
| 1033 | /* FIXME: use RSL layer to update SYSTEM INFORMATION */ |
| 1034 | |
| 1035 | return CMD_SUCCESS; |
| 1036 | } |
| 1037 | |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 1038 | DEFUN(cfg_trx_max_power_red, |
| 1039 | cfg_trx_max_power_red_cmd, |
| 1040 | "max_power_red <0-100>", |
| 1041 | "Reduction of maximum BS RF Power in dB\n") |
| 1042 | { |
| 1043 | int maxpwr_r = atoi(argv[0]); |
| 1044 | struct gsm_bts_trx *trx = vty->index; |
| 1045 | int upper_limit = 12; /* default 12.21 max power red. */ |
| 1046 | |
| 1047 | /* FIXME: check if our BTS type supports more than 12 */ |
| 1048 | if (maxpwr_r < 0 || maxpwr_r > upper_limit) { |
| 1049 | vty_out(vty, "%% Power %d dB is not in the valid range%s", |
| 1050 | maxpwr_r, VTY_NEWLINE); |
| 1051 | return CMD_WARNING; |
| 1052 | } |
| 1053 | if (maxpwr_r & 1) { |
| 1054 | vty_out(vty, "%% Power %d dB is not an even value%s", |
| 1055 | maxpwr_r, VTY_NEWLINE); |
| 1056 | return CMD_WARNING; |
| 1057 | } |
| 1058 | |
| 1059 | trx->max_power_red = maxpwr_r; |
| 1060 | |
| 1061 | /* FIXME: make sure we update this using OML */ |
| 1062 | |
| 1063 | return CMD_SUCCESS; |
| 1064 | } |
| 1065 | |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1066 | DEFUN(cfg_trx_rsl_e1, |
| 1067 | cfg_trx_rsl_e1_cmd, |
| 1068 | "rsl e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)", |
| 1069 | "E1 interface to be used for RSL\n") |
| 1070 | { |
| 1071 | struct gsm_bts_trx *trx = vty->index; |
| 1072 | |
| 1073 | parse_e1_link(&trx->rsl_e1_link, argv[0], argv[1], argv[2]); |
| 1074 | |
| 1075 | return CMD_SUCCESS; |
| 1076 | } |
| 1077 | |
| 1078 | DEFUN(cfg_trx_rsl_e1_tei, |
| 1079 | cfg_trx_rsl_e1_tei_cmd, |
| 1080 | "rsl e1 tei <0-63>", |
| 1081 | "Set the TEI to be used for RSL") |
| 1082 | { |
| 1083 | struct gsm_bts_trx *trx = vty->index; |
| 1084 | |
| 1085 | trx->rsl_tei = atoi(argv[0]); |
| 1086 | |
| 1087 | return CMD_SUCCESS; |
| 1088 | } |
| 1089 | |
| 1090 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1091 | /* per TS configuration */ |
| 1092 | DEFUN(cfg_ts, |
| 1093 | cfg_ts_cmd, |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1094 | "timeslot <0-7>", |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1095 | "Select a Timeslot to configure") |
| 1096 | { |
| 1097 | int ts_nr = atoi(argv[0]); |
| 1098 | struct gsm_bts_trx *trx = vty->index; |
| 1099 | struct gsm_bts_trx_ts *ts; |
| 1100 | |
| 1101 | if (ts_nr >= TRX_NR_TS) { |
| 1102 | vty_out(vty, "%% A GSM TRX only has %u Timeslots per TRX%s", |
| 1103 | TRX_NR_TS, VTY_NEWLINE); |
| 1104 | return CMD_WARNING; |
| 1105 | } |
| 1106 | |
| 1107 | ts = &trx->ts[ts_nr]; |
| 1108 | |
| 1109 | vty->index = ts; |
| 1110 | vty->node = TS_NODE; |
| 1111 | |
| 1112 | return CMD_SUCCESS; |
| 1113 | } |
| 1114 | |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 1115 | DEFUN(cfg_ts_pchan, |
| 1116 | cfg_ts_pchan_cmd, |
| 1117 | "phys_chan_config PCHAN", |
| 1118 | "Physical Channel configuration (TCH/SDCCH/...)") |
| 1119 | { |
| 1120 | struct gsm_bts_trx_ts *ts = vty->index; |
| 1121 | int pchanc; |
| 1122 | |
| 1123 | pchanc = gsm_pchan_parse(argv[0]); |
| 1124 | if (pchanc < 0) |
| 1125 | return CMD_WARNING; |
| 1126 | |
| 1127 | ts->pchan = pchanc; |
| 1128 | |
| 1129 | return CMD_SUCCESS; |
| 1130 | } |
| 1131 | |
| 1132 | DEFUN(cfg_ts_e1_subslot, |
| 1133 | cfg_ts_e1_subslot_cmd, |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1134 | "e1 line E1_LINE timeslot <1-31> sub-slot (0|1|2|3|full)", |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 1135 | "E1 sub-slot connected to this on-air timeslot") |
| 1136 | { |
| 1137 | struct gsm_bts_trx_ts *ts = vty->index; |
| 1138 | |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1139 | parse_e1_link(&ts->e1_link, argv[0], argv[1], argv[2]); |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 1140 | |
| 1141 | return CMD_SUCCESS; |
| 1142 | } |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1143 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1144 | int bsc_vty_init(struct gsm_network *net) |
| 1145 | { |
| 1146 | gsmnet = net; |
| 1147 | |
| 1148 | cmd_init(1); |
| 1149 | vty_init(); |
| 1150 | |
| 1151 | install_element(VIEW_NODE, &show_net_cmd); |
| 1152 | install_element(VIEW_NODE, &show_bts_cmd); |
| 1153 | install_element(VIEW_NODE, &show_trx_cmd); |
| 1154 | install_element(VIEW_NODE, &show_ts_cmd); |
| 1155 | install_element(VIEW_NODE, &show_lchan_cmd); |
Harald Welte | 1bc7735 | 2009-03-10 19:47:51 +0000 | [diff] [blame] | 1156 | |
| 1157 | install_element(VIEW_NODE, &show_e1drv_cmd); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1158 | install_element(VIEW_NODE, &show_e1line_cmd); |
| 1159 | install_element(VIEW_NODE, &show_e1ts_cmd); |
| 1160 | |
Harald Welte | f5025b6 | 2009-03-28 16:55:11 +0000 | [diff] [blame] | 1161 | install_element(VIEW_NODE, &show_paging_cmd); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1162 | |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1163 | install_element(CONFIG_NODE, &cfg_net_cmd); |
| 1164 | install_node(&net_node, config_write_net); |
| 1165 | install_default(GSMNET_NODE); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1166 | install_element(GSMNET_NODE, &cfg_net_ncc_cmd); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1167 | install_element(GSMNET_NODE, &cfg_net_mnc_cmd); |
| 1168 | install_element(GSMNET_NODE, &cfg_net_name_short_cmd); |
| 1169 | install_element(GSMNET_NODE, &cfg_net_name_long_cmd); |
Harald Welte (local) | 69de397 | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 1170 | install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd); |
Harald Welte | 4381cfe | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 1171 | install_element(GSMNET_NODE, &cfg_net_encryption_cmd); |
Harald Welte | 5013b2a | 2009-08-07 13:29:14 +0200 | [diff] [blame] | 1172 | |
| 1173 | install_element(GSMNET_NODE, &cfg_bts_cmd); |
Harald Welte | 67ce073 | 2009-08-06 19:06:46 +0200 | [diff] [blame] | 1174 | install_node(&bts_node, config_write_bts); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1175 | install_default(BTS_NODE); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1176 | install_element(BTS_NODE, &cfg_bts_type_cmd); |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 1177 | install_element(BTS_NODE, &cfg_bts_band_cmd); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1178 | install_element(BTS_NODE, &cfg_bts_lac_cmd); |
| 1179 | install_element(BTS_NODE, &cfg_bts_tsc_cmd); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1180 | install_element(BTS_NODE, &cfg_bts_bsic_cmd); |
Harald Welte | 4cc3422 | 2009-05-01 15:12:31 +0000 | [diff] [blame] | 1181 | install_element(BTS_NODE, &cfg_bts_unit_id_cmd); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1182 | install_element(BTS_NODE, &cfg_bts_oml_e1_cmd); |
| 1183 | install_element(BTS_NODE, &cfg_bts_oml_e1_tei_cmd); |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 1184 | install_element(BTS_NODE, &cfg_bts_challoc_cmd); |
Harald Welte (local) | 5dececf | 2009-08-12 13:28:23 +0200 | [diff] [blame] | 1185 | install_element(BTS_NODE, &cfg_bts_cell_barred_cmd); |
Harald Welte (local) | 0e451d0 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 1186 | install_element(BTS_NODE, &cfg_bts_ms_max_power_cmd); |
Harald Welte (local) | efc9231 | 2009-08-14 23:09:25 +0200 | [diff] [blame] | 1187 | install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd); |
Harald Welte | 7a8fa41 | 2009-08-10 13:48:16 +0200 | [diff] [blame] | 1188 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1189 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1190 | install_element(BTS_NODE, &cfg_trx_cmd); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1191 | install_node(&trx_node, dummy_config_write); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1192 | install_default(TRX_NODE); |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1193 | install_element(TRX_NODE, &cfg_trx_arfcn_cmd); |
Harald Welte | 879dc97 | 2009-06-20 22:36:12 +0200 | [diff] [blame] | 1194 | install_element(TRX_NODE, &cfg_trx_max_power_red_cmd); |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 1195 | install_element(TRX_NODE, &cfg_trx_rsl_e1_cmd); |
| 1196 | install_element(TRX_NODE, &cfg_trx_rsl_e1_tei_cmd); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1197 | |
Harald Welte | 5258fc4 | 2009-03-28 19:07:53 +0000 | [diff] [blame] | 1198 | install_element(TRX_NODE, &cfg_ts_cmd); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1199 | install_node(&ts_node, dummy_config_write); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1200 | install_default(TS_NODE); |
Harald Welte | a6fd58e | 2009-08-07 00:25:23 +0200 | [diff] [blame] | 1201 | install_element(TS_NODE, &cfg_ts_pchan_cmd); |
| 1202 | install_element(TS_NODE, &cfg_ts_e1_subslot_cmd); |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1203 | |
Holger Hans Peter Freyther | cfa90d4 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 1204 | bsc_vty_init_extra(net); |
Harald Welte | 40f8289 | 2009-05-23 17:31:39 +0000 | [diff] [blame] | 1205 | |
Harald Welte | 68628e8 | 2009-03-10 12:17:57 +0000 | [diff] [blame] | 1206 | return 0; |
| 1207 | } |