bsc: Allow to apply configuration for an individual BTS

This will drop a specific IP based BTS. It will lead to a
re-connect of the BTS and the new settings will be applied
then.

Fixes: SYS#737
This commit is contained in:
Holger Hans Peter Freyther 2014-11-21 10:20:29 +01:00
parent b1edf7b64f
commit b1461152e6
2 changed files with 39 additions and 2 deletions

View File

@ -1,6 +1,6 @@
/*
* (C) 2013 by Holger Hans Peter Freyther
* (C) 2013 by sysmocom s.f.m.c. GmbH
* (C) 2013-2014 by Holger Hans Peter Freyther
* (C) 2013-2014 by sysmocom s.f.m.c. GmbH
*
* All Rights Reserved
*
@ -156,6 +156,33 @@ CTRL_CMD_DEFINE(net_mcc_mnc_apply, "mcc-mnc-apply");
/* BTS related commands below */
CTRL_CMD_DEFINE_RANGE(bts_lac, "location-area-code", struct gsm_bts, location_area_code, 0, 65535);
static int verify_bts_apply_config(struct ctrl_cmd *cmd, const char *v, void *d)
{
return 0;
}
static int get_bts_apply_config(struct ctrl_cmd *cmd, void *data)
{
cmd->reply = "Write only attribute";
return CTRL_CMD_ERROR;
}
static int set_bts_apply_config(struct ctrl_cmd *cmd, void *data)
{
struct gsm_bts *bts = cmd->node;
if (!is_ipaccess_bts(bts)) {
cmd->reply = "BTS is not IP based";
return CTRL_CMD_ERROR;
}
ipaccess_drop_oml(bts);
cmd->reply = "Tried to drop the BTS";
return CTRL_CMD_REPLY;
}
CTRL_CMD_DEFINE(bts_apply_config, "apply-configuration");
/* TRX related commands below here */
CTRL_HELPER_GET_INT(trx_max_power, struct gsm_bts_trx, max_power_red);
static int verify_trx_max_power(struct ctrl_cmd *cmd, const char *value, void *_data)
@ -207,6 +234,7 @@ int bsc_base_ctrl_cmds_install(void)
rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_mcc_mnc_apply);
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_lac);
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_apply_config);
rc |= ctrl_cmd_install(CTRL_NODE_TRX, &cmd_trx_max_power);
return rc;

View File

@ -411,6 +411,15 @@ class TestCtrlNITB(TestCtrlBase):
self.assertEquals(r['var'], 'subscriber-list-active-v1')
self.assertEquals(r['value'], None)
def testApplyConfiguration(self):
r = self.do_get('bts.0.apply-configuration')
self.assertEquals(r['mtype'], 'ERROR')
self.assertEquals(r['error'], 'Write only attribute')
r = self.do_set('bts.0.apply-configuration', '1')
self.assertEquals(r['mtype'], 'SET_REPLY')
self.assertEquals(r['value'], 'Tried to drop the BTS')
class TestCtrlNAT(TestCtrlBase):
def ctrl_command(self):