aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-07-18 19:11:49 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2017-08-27 03:52:46 +0200
commitb71147a47f663582aa241c4f25f71f3bbaeaf351 (patch)
treef14dc74ee2087a88ef361304812011e4c688d2bd
parent17905c6c96dd3fae05d9b3fc51965657f5e18b9a (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--src/libbsc/bsc_vty.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c
index 09c443c1f..f3ab35f39 100644
--- a/src/libbsc/bsc_vty.c
+++ b/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>
@@ -4093,6 +4094,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)
@@ -4293,6 +4308,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();