diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c index 2ff9f31df..8d316ca8e 100644 --- a/tests/handover/handover_test.c +++ b/tests/handover/handover_test.c @@ -1045,6 +1045,93 @@ DEFUN(meas_rep_repeat_bspower, meas_rep_repeat_bspower_cmd, return CMD_SUCCESS; } +DEFUN(res_ind, res_ind_cmd, + "res-ind trx <0-255> <0-255> levels .LEVELS", + "Send Resource Indication for a specific TRX, indicating interference levels per lchan\n" + "Indicate a BTS and TRX\n" "BTS nr\n" "TRX nr\n" + "Indicate interference levels: each level is an index to bts->interf_meas_params.bounds_dbm[]," + " i.e. <0-5> or '-' to omit a report for this timeslot/lchan." + " Separate timeslots by spaces, for individual subslots directly concatenate values." + " If a timeslot has more subslots than provided, the last given value is repeated." + " For example: 'res-ind trx 0 0 levels - 1 23 -': on BTS 0 TRX 0, omit ratings for the entire first timeslot," + " send level=1 for timeslot 1, and for timeslot 2 send level=2 for subslot 0 and level=3 for subslot 1.\n") +{ + int i; + uint8_t level; + struct gsm_bts *bts = bts_by_num_str(argv[0]); + struct gsm_bts_trx *trx = trx_by_num_str(bts, argv[1]); + struct msgb *msg = msgb_alloc_headroom(256, 64, "RES-IND"); + struct abis_rsl_common_hdr *rslh; + uint8_t *res_info_len; + VTY_ECHO(); + + argv += 2; + argc -= 2; + + rslh = (struct abis_rsl_common_hdr*)msgb_put(msg, sizeof(*rslh)); + rslh->msg_discr = ABIS_RSL_MDISC_TRX; + rslh->msg_type = RSL_MT_RF_RES_IND; + msgb_put_u8(msg, RSL_IE_RESOURCE_INFO); + res_info_len = msg->tail; + msgb_put_u8(msg, 0); + + level = 0xff; + for (i = 0; i < ARRAY_SIZE(trx->ts); i++) { + const char *ts_str; + struct gsm_lchan *lchan; + size_t given_subslots = 0; + struct gsm_bts_trx_ts *ts = &trx->ts[i]; + + if (i < argc) { + ts_str = argv[i]; + given_subslots = strlen(ts_str); + } + + ts_for_n_lchans(lchan, ts, ts->max_lchans_possible) { + int chan_nr; + + if (lchan->nr < given_subslots) { + char subslot_val = ts_str[lchan->nr]; + switch (subslot_val) { + case '-': + level = INTERF_BAND_UNKNOWN; + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + level = subslot_val - '0'; + break; + default: + OSMO_ASSERT(false); + } + } + + if (level == INTERF_BAND_UNKNOWN) + continue; + + chan_nr = gsm_lchan2chan_nr(lchan, true); + if (chan_nr < 0) + continue; + + msgb_put_u8(msg, chan_nr); + msgb_put_u8(msg, level << 5); + } + } + + *res_info_len = msg->tail - res_info_len - 1; + + msg->dst = trx->rsl_link_primary; + msg->l2h = msg->data; + abis_rsl_rcvmsg(msg); + + return CMD_SUCCESS; +} + DEFUN(congestion_check, congestion_check_cmd, "congestion-check", "Trigger a congestion check\n") @@ -1313,6 +1400,7 @@ static void ho_test_vty_init() install_element(CONFIG_NODE, &meas_rep_cmd); install_element(CONFIG_NODE, &meas_rep_repeat_cmd); install_element(CONFIG_NODE, &meas_rep_repeat_bspower_cmd); + install_element(CONFIG_NODE, &res_ind_cmd); install_element(CONFIG_NODE, &congestion_check_cmd); install_element(CONFIG_NODE, &expect_no_chan_cmd); install_element(CONFIG_NODE, &expect_chan_cmd); diff --git a/tests/handover/handover_tests.ok b/tests/handover/handover_tests.ok index b76c03285..a03454d43 100644 --- a/tests/handover/handover_tests.ok +++ b/tests/handover/handover_tests.ok @@ -47,6 +47,7 @@ pass test_neighbor_congested.ho_vty pass test_neighbor_full.ho_vty pass test_no_congestion.ho_vty pass test_penalty_timer.ho_vty +pass test_resource_indication.ho_vty pass test_rxqual.ho_vty pass test_rxqual_vs_congestion.ho_vty pass test_stay_in_better_cell.ho_vty diff --git a/tests/handover/test_resource_indication.ho_vty b/tests/handover/test_resource_indication.ho_vty new file mode 100644 index 000000000..9dd9d3851 --- /dev/null +++ b/tests/handover/test_resource_indication.ho_vty @@ -0,0 +1,76 @@ +# Test effects of interference levels reported in Resource Indication. +# Note, this is not actually a handover test. + +create-bts trx-count 1 timeslots c+s4 TCH/F TCH/F TCH/F TCH/F TCH/F TCH/F PDCH + +# By default, the ordering is most-interference-first +network + bts 0 + channel allocator avoid-interference 1 + interference-meas level-bounds -85 -91 -97 -103 -109 -115 +# 0 1 2 3 4 5 + +res-ind trx 0 0 levels - 1 2 3 4 3 2 - +create-ms bts 0 TCH/F AMR +# FAIL: interference is ignored +expect-ts-use trx 0 0 states * TCH/F - - - - - * + +# The ordering may also be configured reversed, still the lowest dBm value should win +network + bts 0 + interference-meas level-bounds -115 -109 -103 -97 -91 -85 +# 0 1 2 3 4 5 + +res-ind trx 0 0 levels - 5 4 2 - 3 4 - +create-ms bts 0 TCH/F AMR +# FAIL: interference is ignored +expect-ts-use trx 0 0 states * TCH/F TCH/F - - - - * + +# Favor lchans that have an indicated interference level +res-ind trx 0 0 levels - - - - - 4 3 - +create-ms bts 0 TCH/F AMR +# FAIL: interference is ignored +expect-ts-use trx 0 0 states * TCH/F TCH/F TCH/F - - - * + +# For equal levels, pick the first +res-ind trx 0 0 levels - 2 2 - - 2 - - +create-ms bts 0 TCH/F AMR +# FAIL: interference is ignored +expect-ts-use trx 0 0 states * TCH/F TCH/F TCH/F TCH/F - - * + +# Test clamping of indexes > 5 +res-ind trx 0 0 levels - - 6 - - 4 - - +create-ms bts 0 TCH/F AMR +# FAIL: interference is ignored +expect-ts-use trx 0 0 states * TCH/F TCH/F TCH/F TCH/F TCH/F - * + +# Also test for TCH/H +create-bts trx-count 1 timeslots c+s4 TCH/H TCH/H TCH/H TCH/H TCH/H TCH/H PDCH +network + bts 1 + channel allocator avoid-interference 1 + interference-meas level-bounds -115 -109 -103 -97 -91 -85 +# 0 1 2 3 4 5 + +res-ind trx 1 0 levels - 54 32 21 23 45 54 - +create-ms bts 1 TCH/H AMR +# FAIL: interference is ignored +expect-ts-use trx 1 0 states * TCH/H- - - - - - * + +# Favor lchans that have an indicated interference level +res-ind trx 1 0 levels - - - 4- 3- - - - +create-ms bts 1 TCH/H AMR +# FAIL: interference is ignored +expect-ts-use trx 1 0 states * TCH/HH - - - - - * + +# For equal levels, pick the first +res-ind trx 1 0 levels - -2 22 2- -2 22 2- - +create-ms bts 1 TCH/H AMR +# FAIL: interference is ignored +expect-ts-use trx 1 0 states * TCH/HH TCH/H- - - - - * + +# Test clamping of indexes > 5 +res-ind trx 1 0 levels - 7- 67 6- -7 54 6- - +create-ms bts 1 TCH/H AMR +# FAIL: interference is ignored +expect-ts-use trx 1 0 states * TCH/HH TCH/HH - - - - *