aboutsummaryrefslogtreecommitdiffstats
path: root/src/libbsc/bsc_ctrl_commands.c
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2017-10-10 14:50:35 +0200
committerHarald Welte <laforge@gnumonks.org>2017-10-11 01:28:10 +0000
commit25cc407c5be8d3f130886353bf49836d19bebfe2 (patch)
tree512bbcc0bde7f27e42857616a7870d69b117fad6 /src/libbsc/bsc_ctrl_commands.c
parente1ceb6f76740c12bc8529e0329dfc9dbf515fb3a (diff)
ctrl: add oml-uptime command
Expose OML link uptime available via vts's "sh bts 0" command with the new "bts.0.oml-uptime" ctrl command. To avoid code duplication, move uptime computation into separate function and use it for both. Change-Id: Iec405aa949d6a38a9c8e64cd7ee4b49fd416835d Related: OS#2486
Diffstat (limited to 'src/libbsc/bsc_ctrl_commands.c')
-rw-r--r--src/libbsc/bsc_ctrl_commands.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libbsc/bsc_ctrl_commands.c b/src/libbsc/bsc_ctrl_commands.c
index d925e67e7..2d6fcb677 100644
--- a/src/libbsc/bsc_ctrl_commands.c
+++ b/src/libbsc/bsc_ctrl_commands.c
@@ -240,6 +240,21 @@ static int get_bts_oml_conn(struct ctrl_cmd *cmd, void *data)
CTRL_CMD_DEFINE_RO(bts_oml_conn, "oml-connection-state");
+static int get_bts_oml_up(struct ctrl_cmd *cmd, void *data)
+{
+ const struct gsm_bts *bts = cmd->node;
+
+ cmd->reply = talloc_asprintf(cmd, "%llu", bts_uptime(bts));
+ if (!cmd->reply) {
+ cmd->reply = "OOM";
+ return CTRL_CMD_ERROR;
+ }
+
+ return CTRL_CMD_REPLY;
+}
+
+CTRL_CMD_DEFINE_RO(bts_oml_up, "oml-uptime");
+
static int verify_bts_gprs_mode(struct ctrl_cmd *cmd, const char *value, void *_data)
{
int valid;
@@ -450,6 +465,7 @@ int bsc_base_ctrl_cmds_install(void)
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_si);
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_chan_load);
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_oml_conn);
+ rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_oml_up);
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_gprs_mode);
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_rf_state);