[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.
diff --git a/openbsc/src/bsc_vty.c b/openbsc/src/bsc_vty.c
index 488ecc7..b77d4dd 100644
--- a/openbsc/src/bsc_vty.c
+++ b/openbsc/src/bsc_vty.c
@@ -2264,6 +2264,54 @@
 	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 @@
 	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();