diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-04-08 22:09:21 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-04-08 22:11:29 +0200 |
commit | 3c0508e94adb498c6fd5b3d5a78faf63cc400860 (patch) | |
tree | 413ded19afcac8df8121f968cd18a26eef097d67 /openbsc/src | |
parent | f535aad6124bca2000db7d8d120250dc6a6fe384 (diff) |
[vty] Add ipa specific command to provoke failures to test OML/RSL reconnect
We need to simulate OML/RSL failure in an easy and fast way
and adding a command to do so seems like a good way to achieve
this. The command is a bit misplaced, in one way it is no config
and does not belong into the config node but then again it does
not belong into the VIEW_NODE either as it is manipulating content.
Diffstat (limited to 'openbsc/src')
-rw-r--r-- | openbsc/src/vty_interface.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/openbsc/src/vty_interface.c b/openbsc/src/vty_interface.c index a420e302f..e0548df62 100644 --- a/openbsc/src/vty_interface.c +++ b/openbsc/src/vty_interface.c @@ -955,6 +955,50 @@ DEFUN(show_stats, return CMD_SUCCESS; } +DEFUN(drop_bts, + drop_bts_cmd, + "drop bts connection [nr] (oml|rsl)", + SHOW_STR "Debug/Simulation command to drop ipaccess BTS\n") +{ + struct gsm_bts_trx *trx; + struct gsm_bts *bts; + unsigned int bts_nr; + + bts_nr = atoi(argv[0]); + if (bts_nr >= gsmnet->num_bts) { + vty_out(vty, "BTS number must be between 0 and %d. It was %d.%s", + gsmnet->num_bts, bts_nr, VTY_NEWLINE); + return CMD_WARNING; + } + + bts = gsm_bts_num(gsmnet, bts_nr); + if (!bts) { + vty_out(vty, "BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE); + return CMD_WARNING; + } + + if (!is_ipaccess_bts(bts)) { + vty_out(vty, "This command only works for ipaccess.%s", VTY_NEWLINE); + return CMD_WARNING; + } + + + /* close all connections */ + if (strcmp(argv[1], "oml") == 0) { + close(bts->oml_link->ts->driver.ipaccess.fd.fd); + } else if (strcmp(argv[1], "rsl") == 0) { + /* close all rsl connections */ + llist_for_each_entry(trx, &bts->trx_list, list) { + close(trx->rsl_link->ts->driver.ipaccess.fd.fd); + } + } else { + vty_out(vty, "Argument must be 'oml# or 'rsl'.%s", VTY_NEWLINE); + return CMD_WARNING; + } + + return CMD_SUCCESS; +} + DEFUN(cfg_net, cfg_net_cmd, "network", @@ -1922,6 +1966,8 @@ int bsc_vty_init(struct gsm_network *net) install_element(VIEW_NODE, &show_paging_cmd); install_element(VIEW_NODE, &show_stats_cmd); + install_element(VIEW_NODE, &drop_bts_cmd); + openbsc_vty_add_cmds(); install_element(CONFIG_NODE, &cfg_net_cmd); |