aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-01-09 17:30:11 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-03-04 14:45:48 +0100
commit6ca9f4f5c33e114940f2f0e66df2b61cd37e0357 (patch)
treeebcefb0c5b2ae67aa2cd487602ebc791e6bef649
parentf8c42191dea8a5ef938ccb6be0038275e736c3cb (diff)
libbsc: Add ctrl command to apply the configuration
Right now this only works for IP based BTS like the sysmoBTS and by dropping the OML link.
-rw-r--r--openbsc/src/libbsc/bsc_ctrl_commands.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/openbsc/src/libbsc/bsc_ctrl_commands.c b/openbsc/src/libbsc/bsc_ctrl_commands.c
index db6e632c3..fa8e63580 100644
--- a/openbsc/src/libbsc/bsc_ctrl_commands.c
+++ b/openbsc/src/libbsc/bsc_ctrl_commands.c
@@ -20,6 +20,7 @@
*/
#include <openbsc/control_cmd.h>
+#include <openbsc/ipaccess.h>
#include <openbsc/gsm_data.h>
#define CTRL_CMD_VTY_STRING(cmdname, cmdstr, dtype, element) \
@@ -63,6 +64,35 @@ CTRL_CMD_DEFINE_RANGE(net_mcc, "mcc", struct gsm_network, country_code, 1, 999);
CTRL_CMD_VTY_STRING(net_short_name, "short-name", struct gsm_network, name_short);
CTRL_CMD_VTY_STRING(net_long_name, "long-name", struct gsm_network, name_long);
+static int verify_net_apply_config(struct ctrl_cmd *cmd, const char *v, void *d)
+{
+ return 0;
+}
+
+static int get_net_apply_config(struct ctrl_cmd *cmd, void *data)
+{
+ cmd->reply = "Write only attribute";
+ return CTRL_CMD_ERROR;
+}
+
+static int set_net_apply_config(struct ctrl_cmd *cmd, void *data)
+{
+ struct gsm_network *net = cmd->node;
+ struct gsm_bts *bts;
+
+ llist_for_each_entry(bts, &net->bts_list, list) {
+ if (!is_ipaccess_bts(bts))
+ continue;
+
+ ipaccess_drop_oml(bts);
+ }
+
+ cmd->reply = "Tried to drop the BTS";
+ return CTRL_CMD_REPLY;
+}
+
+CTRL_CMD_DEFINE(net_apply_config, "apply-configuration");
+
int bsc_base_ctrl_cmds_install(void)
{
int rc = 0;
@@ -70,6 +100,7 @@ int bsc_base_ctrl_cmds_install(void)
rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_mcc);
rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_short_name);
rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_long_name);
+ rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_apply_config);
return rc;
}