vty: disallow combination of early-IA and frequency hopping

Related: osmo-bts Id9a930e5c67122812b229dc27ea2bfe246b67611
Related: SYS#6655
Change-Id: I8d375e5155be7b53034d5c0be5566d2f33af5db0
This commit is contained in:
Neels Hofmeyr 2023-11-22 18:23:00 +01:00 committed by neels
parent f53c5588d2
commit 2323e577d9
3 changed files with 56 additions and 3 deletions

View File

@ -349,6 +349,13 @@ DEFUN_USRATTR(cfg_ts_hopping,
return CMD_WARNING;
}
if (enabled && bts->imm_ass_time != IMM_ASS_TIME_POST_CHAN_ACK) {
vty_out(vty,
"%% ERROR: 'hopping enabled 1' works only with 'immediate-assignment post-chan-ack'%s",
VTY_NEWLINE);
return CMD_WARNING;
}
ts->hopping.enabled = enabled;
return CMD_SUCCESS;

View File

@ -3242,13 +3242,35 @@ DEFUN_ATTR(cfg_bts_immediate_assignment, cfg_bts_immediate_assignment_cmd,
CMD_ATTR_IMMEDIATE)
{
struct gsm_bts *bts = vty->index;
enum imm_ass_time imm_ass_time;
if (!strcmp(argv[0], "pre-ts-ack"))
bts->imm_ass_time = IMM_ASS_TIME_PRE_TS_ACK;
imm_ass_time = IMM_ASS_TIME_PRE_TS_ACK;
else if (!strcmp(argv[0], "pre-chan-ack"))
bts->imm_ass_time = IMM_ASS_TIME_PRE_CHAN_ACK;
imm_ass_time = IMM_ASS_TIME_PRE_CHAN_ACK;
else
bts->imm_ass_time = IMM_ASS_TIME_POST_CHAN_ACK;
imm_ass_time = IMM_ASS_TIME_POST_CHAN_ACK;
if (imm_ass_time != IMM_ASS_TIME_POST_CHAN_ACK) {
struct gsm_bts_trx *trx;
/* Early-IA does not work with frequency hopping, because the IMM ASS does not convey an ARFCN when
* frequency hopping is in use. Make sure the user knows that. */
llist_for_each_entry(trx, &bts->trx_list, list) {
int ts_nr;
for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
struct gsm_bts_trx_ts *ts = &trx->ts[ts_nr];
if (ts->hopping.enabled) {
vty_out(vty, "%% ERROR: 'hopping enabled 1' works only with"
" 'immediate-assignment post-chan-ack', see timeslot %s%s",
ts->fi->id, VTY_NEWLINE);
return CMD_WARNING;
}
}
}
}
bts->imm_ass_time = imm_ass_time;
return CMD_SUCCESS;
}

24
tests/early_ia.vty Normal file
View File

@ -0,0 +1,24 @@
OsmoBSC> enable
OsmoBSC# configure terminal
OsmoBSC(config)# network
OsmoBSC(config-net)# bts 0
OsmoBSC(config-net-bts)# ### Check that first setting early-IA and then enabling frequency hopping throws an error
OsmoBSC(config-net-bts)# immediate-assignment pre-chan-ack
OsmoBSC(config-net-bts)# trx 0
OsmoBSC(config-net-bts-trx)# timeslot 2
OsmoBSC(config-net-bts-trx-ts)# hopping enabled 1
% ERROR: 'hopping enabled 1' works only with 'immediate-assignment post-chan-ack'
OsmoBSC(config-net-bts-trx-ts)# hopping enabled 0
OsmoBSC(config-net-bts-trx-ts)# exit
OsmoBSC(config-net-bts-trx)# exit
OsmoBSC(config-net-bts)# immediate-assignment post-chan-ack
OsmoBSC(config-net-bts)# ### Check that first enabling frequency hopping and then setting early-IA throws an error
OsmoBSC(config-net-bts)# trx 0
OsmoBSC(config-net-bts-trx)# timeslot 2
OsmoBSC(config-net-bts-trx-ts)# hopping enabled 1
OsmoBSC(config-net-bts-trx-ts)# exit
OsmoBSC(config-net-bts-trx)# exit
OsmoBSC(config-net-bts)# immediate-assignment pre-chan-ack
% ERROR: 'hopping enabled 1' works only with 'immediate-assignment post-chan-ack', see timeslot 0-0-2-NONE