mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-10-23 08:12:01 +00:00
bsc: Allow to generate new system information online
Increase the bcch_change_mark and generate a new copy of the system information. Make the method public, add a small test case. Manually verified using the FakeBTS. I don't know if the MS will re-read these SIs. Related: SYS#739
This commit is contained in:
@@ -423,6 +423,7 @@ void set_ts_e1link(struct gsm_bts_trx_ts *ts, uint8_t e1_nr,
|
||||
void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked);
|
||||
int gsm_bts_has_feature(struct gsm_bts *bts, enum gsm_bts_features feat);
|
||||
struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr);
|
||||
int gsm_bts_trx_set_system_infos(struct gsm_bts_trx *trx);
|
||||
|
||||
/* generic E1 line operations for all ISDN-based BTS. */
|
||||
extern struct e1inp_line_ops bts_isdn_e1inp_line_ops;
|
||||
|
@@ -184,6 +184,41 @@ static int set_bts_apply_config(struct ctrl_cmd *cmd, void *data)
|
||||
|
||||
CTRL_CMD_DEFINE(bts_apply_config, "apply-configuration");
|
||||
|
||||
static int verify_bts_si(struct ctrl_cmd *cmd, const char *v, void *d)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_bts_si(struct ctrl_cmd *cmd, void *data)
|
||||
{
|
||||
cmd->reply = "Write only attribute";
|
||||
return CTRL_CMD_ERROR;
|
||||
}
|
||||
|
||||
static int set_bts_si(struct ctrl_cmd *cmd, void *data)
|
||||
{
|
||||
struct gsm_bts *bts = cmd->node;
|
||||
struct gsm_bts_trx *trx;
|
||||
|
||||
/* Generate a new ID */
|
||||
bts->bcch_change_mark += 1;
|
||||
bts->bcch_change_mark %= 0x7;
|
||||
|
||||
llist_for_each_entry(trx, &bts->trx_list, list) {
|
||||
int rc;
|
||||
|
||||
rc = gsm_bts_trx_set_system_infos(trx);
|
||||
if (rc != 0) {
|
||||
cmd->reply = "Failed to generate SI";
|
||||
return CTRL_CMD_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
cmd->reply = "Generated new System Information";
|
||||
return CTRL_CMD_REPLY;
|
||||
}
|
||||
CTRL_CMD_DEFINE(bts_si, "send-new-system-informations");
|
||||
|
||||
/* 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)
|
||||
@@ -237,6 +272,7 @@ int bsc_base_ctrl_cmds_install(void)
|
||||
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_lac);
|
||||
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_ci);
|
||||
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_apply_config);
|
||||
rc |= ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_si);
|
||||
|
||||
rc |= ctrl_cmd_install(CTRL_NODE_TRX, &cmd_trx_max_power);
|
||||
return rc;
|
||||
|
@@ -121,7 +121,7 @@ static int rsl_si(struct gsm_bts_trx *trx, enum osmo_sysinfo_type i, int si_len)
|
||||
}
|
||||
|
||||
/* set all system information types */
|
||||
static int set_system_infos(struct gsm_bts_trx *trx)
|
||||
int gsm_bts_trx_set_system_infos(struct gsm_bts_trx *trx)
|
||||
{
|
||||
int i, rc;
|
||||
struct gsm_bts *bts = trx->bts;
|
||||
@@ -269,7 +269,7 @@ static void bootstrap_rsl(struct gsm_bts_trx *trx)
|
||||
rsl_nokia_si_begin(trx);
|
||||
}
|
||||
|
||||
set_system_infos(trx);
|
||||
gsm_bts_trx_set_system_infos(trx);
|
||||
|
||||
if (trx->bts->type == GSM_BTS_TYPE_NOKIA_SITE) {
|
||||
/* channel unspecific, power reduction in 2 dB steps */
|
||||
|
@@ -216,6 +216,16 @@ class TestCtrlBSC(TestCtrlBase):
|
||||
self.assertEquals(r['mtype'], 'ERROR')
|
||||
self.assertEquals(r['error'], 'Input not within the range')
|
||||
|
||||
def testBtsGenerateSystemInformation(self):
|
||||
r = self.do_get('bts.0.send-new-system-informations')
|
||||
self.assertEquals(r['mtype'], 'ERROR')
|
||||
self.assertEquals(r['error'], 'Write only attribute')
|
||||
|
||||
# No RSL links so it will fail
|
||||
r = self.do_set('bts.0.send-new-system-informations', '1')
|
||||
self.assertEquals(r['mtype'], 'ERROR')
|
||||
self.assertEquals(r['error'], 'Failed to generate SI')
|
||||
|
||||
def testTrxPowerRed(self):
|
||||
r = self.do_get('bts.0.trx.0.max-power-reduction')
|
||||
self.assertEquals(r['mtype'], 'GET_REPLY')
|
||||
|
Reference in New Issue
Block a user