summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Kluchnikov <kluchnikovi@gmail.com>2014-04-14 17:47:20 +0400
committerIvan Kluchnikov <kluchnikovi@gmail.com>2014-05-06 15:40:30 +0400
commit7f53932f6885a9877046053dce20418cda1d719d (patch)
treec1360cd902f02c89a5a671cfcefcd556f1f749df
parent90c95e36dc2afe4c54e1a2bb8fefa674d209f152 (diff)
nitb: Add network-status ctrl command to get all network counters, SMS queue status and channels status
-rwxr-xr-xopenbsc/contrib/bsc_control.py4
-rw-r--r--openbsc/src/libbsc/bsc_ctrl_commands.c24
-rw-r--r--openbsc/src/libctrl/control_cmd.c2
3 files changed, 26 insertions, 4 deletions
diff --git a/openbsc/contrib/bsc_control.py b/openbsc/contrib/bsc_control.py
index 9dc01e3bf..f601ca3f5 100755
--- a/openbsc/contrib/bsc_control.py
+++ b/openbsc/contrib/bsc_control.py
@@ -85,14 +85,14 @@ if options.cmd_get:
parser.error("Get requires the var argument")
do_get(args[0], options.id, sock)
-data = sock.recv(1024)
+data = sock.recv(40960)
while (len(data)>0):
(answer, data) = remove_ipa_ctrl_header(data)
print "Got message:", answer
if options.monitor:
while (True):
- data = sock.recv(1024)
+ data = sock.recv(40960)
if len(data) == 0:
print "Connection is gone."
break
diff --git a/openbsc/src/libbsc/bsc_ctrl_commands.c b/openbsc/src/libbsc/bsc_ctrl_commands.c
index f8cd2c023..af9fcd0bb 100644
--- a/openbsc/src/libbsc/bsc_ctrl_commands.c
+++ b/openbsc/src/libbsc/bsc_ctrl_commands.c
@@ -480,9 +480,10 @@ static int get_net_counters(struct ctrl_cmd *cmd, void *data)
if (!strcmp(cmd->variable,"counters")) {
cmd->reply = talloc_strdup(cmd, "\n");
- osmo_counters_for_each(print_counter, cmd);
}
+ osmo_counters_for_each(print_counter, cmd);
+
if (!cmd->reply) {
cmd->reply = "OOM";
return CTRL_CMD_ERROR;
@@ -493,6 +494,26 @@ static int get_net_counters(struct ctrl_cmd *cmd, void *data)
CTRL_CMD_DEFINE(net_counters, "counters");
+CTRL_HELPER_VERIFY_STATUS(net_status);
+CTRL_HELPER_SET_STATUS(net_status);
+
+static int get_net_status(struct ctrl_cmd *cmd, void *data)
+{
+ struct gsm_network *net = cmd->node;
+ cmd->reply = talloc_strdup(cmd, "\n");
+ cmd->reply = talloc_asprintf_append(cmd->reply,"time,%u\n", (unsigned)time(NULL));
+ get_net_counters(cmd, net);
+ get_net_channels_load(cmd, net);
+ get_net_paging(cmd, net);
+ get_net_oml_link(cmd, net);
+ get_net_smsqueue(cmd, net);
+ get_net_lchan(cmd, net);
+
+ return CTRL_CMD_REPLY;
+}
+
+CTRL_CMD_DEFINE(net_status, "network-status");
+
/* BTS related commands below here */
static int verify_bts_band(struct ctrl_cmd *cmd, const char *value, void *data)
{
@@ -581,6 +602,7 @@ int bsc_base_ctrl_cmds_install(void)
rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_oml_link);
rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_smsqueue);
rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_counters);
+ rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_status);
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_band);
diff --git a/openbsc/src/libctrl/control_cmd.c b/openbsc/src/libctrl/control_cmd.c
index 3c4efc06d..5bfa7830d 100644
--- a/openbsc/src/libctrl/control_cmd.c
+++ b/openbsc/src/libctrl/control_cmd.c
@@ -411,7 +411,7 @@ struct msgb *ctrl_cmd_make(struct ctrl_cmd *cmd)
if (!cmd->id)
return NULL;
- msg = msgb_alloc_headroom(4096, 128, "ctrl command make");
+ msg = msgb_alloc_headroom(40960, 128, "ctrl command make");
if (!msg)
return NULL;