aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-07-18 19:11:49 +0200
committerHarald Welte <laforge@gnumonks.org>2017-07-19 10:03:57 +0000
commit4d87e22980edb5a0ec170801980f76c837183b32 (patch)
tree698380724d6ff5fcd3c816d15793c476b8b50cc5
parent4b731a33783b1eb9cfb83577d8fc414433e20eb0 (diff)
bsc_vty: Add VTY command to test CTRL TRAP feature
Using this new command (introduced in OsmoBSC + OsmoNITB), you can simulate the generation of TRAP events for testin purposes. start the control interface monitor as an example client program: ./openbsc/contrib/bsc_control.py -m -d localhost -p 4249 then start OsmoBSC or OsmoNITB, telnet to the VTY and enter 'enable' mode and issue the following (example) command: ctrl-interface generate-trap my.foo.var 2342 As a result, on the bsc_control.py you will see: Got message: TRAP 0 my.foo.var 2342 Change-Id: Ib1d2ec38290dc94797c1b365d9b733e5215ab7d1
-rw-r--r--openbsc/src/libbsc/bsc_vty.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index 91a90c1e0..6472e9d80 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -30,6 +30,7 @@
#include <osmocom/vty/misc.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <osmocom/gsm/gsm0502.h>
+#include <osmocom/ctrl/control_if.h>
#include <arpa/inet.h>
@@ -4122,6 +4123,20 @@ DEFUN(lchan_mdcx, lchan_mdcx_cmd,
rsl_ipacc_mdcx(lchan, ntohl(ia.s_addr), port, 0);
return CMD_SUCCESS;
}
+
+DEFUN(ctrl_trap, ctrl_trap_cmd,
+ "ctrl-interface generate-trap TRAP VALUE",
+ "Commands related to the CTRL Interface\n"
+ "Generate a TRAP for test purpose\n"
+ "Identity/Name of the TRAP variable\n"
+ "Value of the TRAP variable\n")
+{
+ struct gsm_network *net = gsmnet_from_vty(vty);
+
+ ctrl_cmd_send_trap(net->ctrl, argv[0], (char *) argv[1]);
+ return CMD_SUCCESS;
+}
+
extern int bsc_vty_init_extra(void);
int bsc_vty_init(struct gsm_network *network)
@@ -4325,6 +4340,7 @@ int bsc_vty_init(struct gsm_network *network)
install_element(ENABLE_NODE, &lchan_act_cmd);
install_element(ENABLE_NODE, &lchan_mdcx_cmd);
install_element(ENABLE_NODE, &smscb_cmd_cmd);
+ install_element(ENABLE_NODE, &ctrl_trap_cmd);
abis_nm_vty_init();
abis_om2k_vty_init();