[MERGED] osmo-msc[master]: bsc_vty: Add VTY command to test CTRL TRAP feature

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Sun Aug 27 00:34:59 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: bsc_vty: Add VTY command to test CTRL TRAP feature
......................................................................


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
---
M src/libbsc/bsc_vty.c
1 file changed, 16 insertions(+), 0 deletions(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved



diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c
index 09c443c..f3ab35f 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 @@
 	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 @@
 	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();

-- 
To view, visit https://gerrit.osmocom.org/3626
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib1d2ec38290dc94797c1b365d9b733e5215ab7d1
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list