aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-10-26 09:40:13 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-10-26 09:40:13 +0200
commit2484ceb2be16a3e657a01b45de7fcf58c6feb43a (patch)
tree33255b1661300e06ed2a2e31a93c02df7102e5cb
parentf3ca2eeedeb624a2c1e1380b7b21d753e67c87a8 (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. On this merge I have changed it to the ENABLE_NODE.
-rw-r--r--openbsc/src/bsc_vty.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/openbsc/src/bsc_vty.c b/openbsc/src/bsc_vty.c
index 488ecc7f1..b77d4ddb6 100644
--- a/openbsc/src/bsc_vty.c
+++ b/openbsc/src/bsc_vty.c
@@ -2264,6 +2264,54 @@ DEFUN(logging_fltr_imsi,
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_network *gsmnet;
+ struct gsm_bts_trx *trx;
+ struct gsm_bts *bts;
+ unsigned int bts_nr;
+
+ gsmnet = gsmnet_from_vty(vty);
+
+ 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;
+}
+
+
extern int bsc_vty_init_extra(void);
extern const char *openbsc_copyright;
@@ -2390,6 +2438,8 @@ int bsc_vty_init(void)
install_element(TS_NODE, &cfg_ts_arfcn_del_cmd);
install_element(TS_NODE, &cfg_ts_e1_subslot_cmd);
+ install_element(ENABLE_NODE, &drop_bts_cmd);
+
abis_nm_vty_init();
bsc_vty_init_extra();