Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1 | /* |
| 2 | * (C) 2013 by Andreas Eversberg <jolly@eversberg.eu> |
| 3 | * All Rights Reserved |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU Affero General Public License as published by |
| 7 | * the Free Software Foundation; either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Affero General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | * |
| 18 | */ |
| 19 | |
| 20 | #include <stdio.h> |
| 21 | #include <stdlib.h> |
| 22 | #include <errno.h> |
| 23 | |
| 24 | #include <assert.h> |
| 25 | |
| 26 | #include <osmocom/core/application.h> |
| 27 | #include <osmocom/core/select.h> |
| 28 | #include <osmocom/core/talloc.h> |
| 29 | |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 30 | #include <osmocom/mgcp_client/mgcp_client_endpoint_fsm.h> |
Pau Espin Pedrol | e249045 | 2018-03-17 01:16:54 +0100 | [diff] [blame] | 31 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 32 | #include <osmocom/bsc/abis_rsl.h> |
| 33 | #include <osmocom/bsc/debug.h> |
| 34 | #include <osmocom/bsc/bsc_subscriber.h> |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 35 | #include <osmocom/bsc/lchan_select.h> |
| 36 | #include <osmocom/bsc/lchan_fsm.h> |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 37 | #include <osmocom/bsc/handover_decision.h> |
| 38 | #include <osmocom/bsc/system_information.h> |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 39 | #include <osmocom/bsc/handover.h> |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 40 | #include <osmocom/bsc/handover_cfg.h> |
| 41 | #include <osmocom/bsc/handover_decision_2.h> |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 42 | #include <osmocom/bsc/bss.h> |
Neels Hofmeyr | 81a4963 | 2018-07-24 18:10:05 +0200 | [diff] [blame] | 43 | #include <osmocom/bsc/gsm_08_08.h> |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 44 | #include <osmocom/bsc/osmo_bsc.h> |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 45 | #include <osmocom/bsc/bsc_subscr_conn_fsm.h> |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 46 | #include <osmocom/bsc/timeslot_fsm.h> |
| 47 | #include <osmocom/bsc/lchan_fsm.h> |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 48 | #include <osmocom/bsc/handover_fsm.h> |
| 49 | #include <osmocom/bsc/bsc_msc_data.h> |
Pau Espin Pedrol | 388ed58 | 2020-07-15 20:53:16 +0200 | [diff] [blame] | 50 | #include <osmocom/bsc/bts.h> |
Neels Hofmeyr | 86ce105 | 2020-09-18 02:49:32 +0200 | [diff] [blame] | 51 | #include <osmocom/bsc/paging.h> |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 52 | |
Neels Hofmeyr | e341618 | 2018-03-05 05:31:14 +0100 | [diff] [blame] | 53 | void *ctx; |
| 54 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 55 | struct gsm_network *bsc_gsmnet; |
| 56 | |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 57 | /* override, requires '-Wl,--wrap=osmo_mgcpc_ep_ci_request'. |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 58 | * Catch modification of an MGCP connection. */ |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 59 | void __real_osmo_mgcpc_ep_ci_request(struct osmo_mgcpc_ep_ci *ci, |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 60 | enum mgcp_verb verb, const struct mgcp_conn_peer *verb_info, |
| 61 | struct osmo_fsm_inst *notify, |
| 62 | uint32_t event_success, uint32_t event_failure, |
| 63 | void *notify_data); |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 64 | void __wrap_osmo_mgcpc_ep_ci_request(struct osmo_mgcpc_ep_ci *ci, |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 65 | enum mgcp_verb verb, const struct mgcp_conn_peer *verb_info, |
| 66 | struct osmo_fsm_inst *notify, |
| 67 | uint32_t event_success, uint32_t event_failure, |
| 68 | void *notify_data) |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 69 | { |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 70 | struct mgcp_conn_peer fake_data = {}; |
| 71 | /* All MGCP shall be successful */ |
| 72 | if (!notify) |
| 73 | return; |
| 74 | osmo_fsm_inst_dispatch(notify, event_success, &fake_data); |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 75 | } |
| 76 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 77 | /* measurement report */ |
| 78 | |
| 79 | uint8_t meas_rep_ba = 0, meas_rep_valid = 1, meas_valid = 1, meas_multi_rep = 0; |
| 80 | uint8_t meas_dl_rxlev = 0, meas_dl_rxqual = 0; |
| 81 | uint8_t meas_ul_rxlev = 0, meas_ul_rxqual = 0; |
| 82 | uint8_t meas_tx_power_ms = 0, meas_tx_power_bs = 0, meas_ta_ms = 0; |
| 83 | uint8_t meas_dtx_ms = 0, meas_dtx_bs = 0, meas_nr = 0; |
| 84 | uint8_t meas_num_nc = 0, meas_rxlev_nc[6], meas_bsic_nc[6], meas_bcch_f_nc[6]; |
| 85 | |
| 86 | static void gen_meas_rep(struct gsm_lchan *lchan) |
| 87 | { |
| 88 | struct msgb *msg = msgb_alloc_headroom(256, 64, "RSL"); |
| 89 | struct abis_rsl_dchan_hdr *dh; |
| 90 | uint8_t chan_nr = gsm_lchan2chan_nr(lchan); |
| 91 | uint8_t ulm[3], l1i[2], *buf; |
| 92 | struct gsm48_hdr *gh; |
| 93 | struct gsm48_meas_res *mr; |
| 94 | |
| 95 | dh = (struct abis_rsl_dchan_hdr *) msgb_put(msg, sizeof(*dh)); |
| 96 | dh->c.msg_discr = ABIS_RSL_MDISC_DED_CHAN; |
| 97 | dh->c.msg_type = RSL_MT_MEAS_RES; |
| 98 | dh->ie_chan = RSL_IE_CHAN_NR; |
| 99 | dh->chan_nr = chan_nr; |
| 100 | |
| 101 | msgb_tv_put(msg, RSL_IE_MEAS_RES_NR, meas_nr++); |
| 102 | |
| 103 | ulm[0] = meas_ul_rxlev | (meas_dtx_bs << 7); |
| 104 | ulm[1] = meas_ul_rxlev; |
| 105 | ulm[2] = (meas_ul_rxqual << 3) | meas_ul_rxqual; |
| 106 | msgb_tlv_put(msg, RSL_IE_UPLINK_MEAS, sizeof(ulm), ulm); |
| 107 | |
| 108 | msgb_tv_put(msg, RSL_IE_BS_POWER, meas_tx_power_bs); |
| 109 | |
| 110 | l1i[0] = 0; |
| 111 | l1i[1] = meas_ta_ms; |
| 112 | msgb_tv_fixed_put(msg, RSL_IE_L1_INFO, sizeof(l1i), l1i); |
| 113 | |
| 114 | buf = msgb_put(msg, 3); |
| 115 | buf[0] = RSL_IE_L3_INFO; |
| 116 | buf[1] = (sizeof(*gh) + sizeof(*mr)) >> 8; |
| 117 | buf[2] = (sizeof(*gh) + sizeof(*mr)) & 0xff; |
| 118 | |
| 119 | gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh)); |
| 120 | mr = (struct gsm48_meas_res *) msgb_put(msg, sizeof(*mr)); |
| 121 | |
| 122 | gh->proto_discr = GSM48_PDISC_RR; |
| 123 | gh->msg_type = GSM48_MT_RR_MEAS_REP; |
| 124 | |
| 125 | /* measurement results */ |
| 126 | mr->rxlev_full = meas_dl_rxlev; |
| 127 | mr->rxlev_sub = meas_dl_rxlev; |
| 128 | mr->rxqual_full = meas_dl_rxqual; |
| 129 | mr->rxqual_sub = meas_dl_rxqual; |
| 130 | mr->dtx_used = meas_dtx_ms; |
| 131 | mr->ba_used = meas_rep_ba; |
| 132 | mr->meas_valid = !meas_valid; /* 0 = valid */ |
| 133 | if (meas_rep_valid) { |
| 134 | mr->no_nc_n_hi = meas_num_nc >> 2; |
| 135 | mr->no_nc_n_lo = meas_num_nc & 3; |
| 136 | } else { |
| 137 | /* no results for serving cells */ |
| 138 | mr->no_nc_n_hi = 1; |
| 139 | mr->no_nc_n_lo = 3; |
| 140 | } |
| 141 | mr->rxlev_nc1 = meas_rxlev_nc[0]; |
| 142 | mr->rxlev_nc2_hi = meas_rxlev_nc[1] >> 1; |
| 143 | mr->rxlev_nc2_lo = meas_rxlev_nc[1] & 1; |
| 144 | mr->rxlev_nc3_hi = meas_rxlev_nc[2] >> 2; |
| 145 | mr->rxlev_nc3_lo = meas_rxlev_nc[2] & 3; |
| 146 | mr->rxlev_nc4_hi = meas_rxlev_nc[3] >> 3; |
| 147 | mr->rxlev_nc4_lo = meas_rxlev_nc[3] & 7; |
| 148 | mr->rxlev_nc5_hi = meas_rxlev_nc[4] >> 4; |
| 149 | mr->rxlev_nc5_lo = meas_rxlev_nc[4] & 15; |
| 150 | mr->rxlev_nc6_hi = meas_rxlev_nc[5] >> 5; |
| 151 | mr->rxlev_nc6_lo = meas_rxlev_nc[5] & 31; |
| 152 | mr->bsic_nc1_hi = meas_bsic_nc[0] >> 3; |
| 153 | mr->bsic_nc1_lo = meas_bsic_nc[0] & 7; |
| 154 | mr->bsic_nc2_hi = meas_bsic_nc[1] >> 4; |
| 155 | mr->bsic_nc2_lo = meas_bsic_nc[1] & 15; |
| 156 | mr->bsic_nc3_hi = meas_bsic_nc[2] >> 5; |
| 157 | mr->bsic_nc3_lo = meas_bsic_nc[2] & 31; |
| 158 | mr->bsic_nc4 = meas_bsic_nc[3]; |
| 159 | mr->bsic_nc5 = meas_bsic_nc[4]; |
| 160 | mr->bsic_nc6 = meas_bsic_nc[5]; |
| 161 | mr->bcch_f_nc1 = meas_bcch_f_nc[0]; |
| 162 | mr->bcch_f_nc2 = meas_bcch_f_nc[1]; |
| 163 | mr->bcch_f_nc3 = meas_bcch_f_nc[2]; |
| 164 | mr->bcch_f_nc4 = meas_bcch_f_nc[3]; |
| 165 | mr->bcch_f_nc5_hi = meas_bcch_f_nc[4] >> 1; |
| 166 | mr->bcch_f_nc5_lo = meas_bcch_f_nc[4] & 1; |
| 167 | mr->bcch_f_nc6_hi = meas_bcch_f_nc[5] >> 2; |
| 168 | mr->bcch_f_nc6_lo = meas_bcch_f_nc[5] & 3; |
| 169 | |
| 170 | msg->dst = lchan->ts->trx->bts->c0->rsl_link; |
| 171 | msg->l2h = (unsigned char *)dh; |
| 172 | msg->l3h = (unsigned char *)gh; |
| 173 | |
| 174 | abis_rsl_rcvmsg(msg); |
| 175 | } |
| 176 | |
Neels Hofmeyr | e3eb67c | 2020-11-12 22:53:59 +0100 | [diff] [blame] | 177 | enum gsm_phys_chan_config pchan_from_str(const char *str) |
| 178 | { |
Neels Hofmeyr | cfbf11f | 2020-11-12 23:12:48 +0100 | [diff] [blame] | 179 | enum gsm_phys_chan_config pchan; |
| 180 | if (!strcmp(str, "dyn")) |
| 181 | return GSM_PCHAN_TCH_F_TCH_H_PDCH; |
| 182 | if (!strcmp(str, "c+s4")) |
| 183 | return GSM_PCHAN_CCCH_SDCCH4; |
| 184 | if (!strcmp(str, "-")) |
| 185 | return GSM_PCHAN_NONE; |
| 186 | pchan = gsm_pchan_parse(str); |
Neels Hofmeyr | e3eb67c | 2020-11-12 22:53:59 +0100 | [diff] [blame] | 187 | if (pchan < 0) { |
| 188 | fprintf(stderr, "Invalid timeslot pchan type: %s\n", str); |
| 189 | exit(1); |
| 190 | } |
| 191 | return pchan; |
| 192 | } |
| 193 | |
| 194 | const char * const bts_default_ts[] = { |
Neels Hofmeyr | cfbf11f | 2020-11-12 23:12:48 +0100 | [diff] [blame] | 195 | "c+s4", "TCH/F", "TCH/F", "TCH/F", "TCH/F", "TCH/H", "TCH/H", "-", |
Neels Hofmeyr | e3eb67c | 2020-11-12 22:53:59 +0100 | [diff] [blame] | 196 | }; |
| 197 | |
Neels Hofmeyr | dd7b710 | 2020-11-12 22:54:58 +0100 | [diff] [blame] | 198 | static struct gsm_bts *create_bts(int num_trx, const char * const *ts_args) |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 199 | { |
Neels Hofmeyr | 2f58de5 | 2020-11-12 22:51:11 +0100 | [diff] [blame] | 200 | static int arfcn = 870; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 201 | struct gsm_bts *bts; |
| 202 | struct e1inp_sign_link *rsl_link; |
| 203 | int i; |
Neels Hofmeyr | dd7b710 | 2020-11-12 22:54:58 +0100 | [diff] [blame] | 204 | int trx_i; |
Neels Hofmeyr | e3eb67c | 2020-11-12 22:53:59 +0100 | [diff] [blame] | 205 | struct gsm_bts_trx *trx; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 206 | |
Neels Hofmeyr | cfbf11f | 2020-11-12 23:12:48 +0100 | [diff] [blame] | 207 | fprintf(stderr, "- Creating BTS %d, %d TRX\n", bsc_gsmnet->num_bts, num_trx); |
| 208 | for (trx_i = 0; trx_i < num_trx; trx_i++) { |
| 209 | for (i = 0; i < 8; i++) |
| 210 | fprintf(stderr, "\t%s", ts_args[8*trx_i + i]); |
| 211 | fprintf(stderr, "\n"); |
| 212 | } |
| 213 | |
Vadim Yanitskiy | 4f3a641 | 2020-05-31 01:56:20 +0700 | [diff] [blame] | 214 | bts = bsc_bts_alloc_register(bsc_gsmnet, GSM_BTS_TYPE_UNKNOWN, 0x3f); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 215 | if (!bts) { |
| 216 | printf("No resource for bts1\n"); |
| 217 | return NULL; |
| 218 | } |
| 219 | |
| 220 | bts->location_area_code = 23; |
Neels Hofmeyr | 2f58de5 | 2020-11-12 22:51:11 +0100 | [diff] [blame] | 221 | bts->c0->arfcn = arfcn++; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 222 | |
| 223 | bts->codec.efr = 1; |
| 224 | bts->codec.hr = 1; |
| 225 | bts->codec.amr = 1; |
| 226 | |
Neels Hofmeyr | e341618 | 2018-03-05 05:31:14 +0100 | [diff] [blame] | 227 | rsl_link = talloc_zero(ctx, struct e1inp_sign_link); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 228 | rsl_link->trx = bts->c0; |
| 229 | bts->c0->rsl_link = rsl_link; |
| 230 | |
Neels Hofmeyr | dd7b710 | 2020-11-12 22:54:58 +0100 | [diff] [blame] | 231 | for (trx_i = 0; trx_i < num_trx; trx_i++) { |
| 232 | while (!(trx = gsm_bts_trx_num(bts, trx_i))) |
| 233 | gsm_bts_trx_alloc(bts); |
Neels Hofmeyr | e3eb67c | 2020-11-12 22:53:59 +0100 | [diff] [blame] | 234 | |
Neels Hofmeyr | dd7b710 | 2020-11-12 22:54:58 +0100 | [diff] [blame] | 235 | trx->mo.nm_state.operational = NM_OPSTATE_ENABLED; |
| 236 | trx->mo.nm_state.availability = NM_AVSTATE_OK; |
| 237 | trx->mo.nm_state.administrative = NM_STATE_UNLOCKED; |
| 238 | trx->bb_transc.mo.nm_state.operational = NM_OPSTATE_ENABLED; |
| 239 | trx->bb_transc.mo.nm_state.availability = NM_AVSTATE_OK; |
| 240 | trx->bb_transc.mo.nm_state.administrative = NM_STATE_UNLOCKED; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 241 | |
Neels Hofmeyr | dd7b710 | 2020-11-12 22:54:58 +0100 | [diff] [blame] | 242 | /* 4 full rate and 4 half rate channels */ |
| 243 | for (i = 0; i < 8; i++) { |
| 244 | trx->ts[i].pchan_from_config = pchan_from_str(ts_args[trx_i * 8 + i]); |
| 245 | if (trx->ts[i].pchan_from_config == GSM_PCHAN_NONE) |
| 246 | continue; |
| 247 | trx->ts[i].mo.nm_state.operational = NM_OPSTATE_ENABLED; |
| 248 | trx->ts[i].mo.nm_state.availability = NM_AVSTATE_OK; |
| 249 | trx->ts[i].mo.nm_state.administrative = NM_STATE_UNLOCKED; |
| 250 | } |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 251 | |
Neels Hofmeyr | cfbf11f | 2020-11-12 23:12:48 +0100 | [diff] [blame] | 252 | for (i = 0; i < ARRAY_SIZE(trx->ts); i++) { |
Neels Hofmeyr | dd7b710 | 2020-11-12 22:54:58 +0100 | [diff] [blame] | 253 | /* make sure ts->lchans[] get initialized */ |
Neels Hofmeyr | cfbf11f | 2020-11-12 23:12:48 +0100 | [diff] [blame] | 254 | osmo_fsm_inst_dispatch(trx->ts[i].fi, TS_EV_RSL_READY, 0); |
| 255 | osmo_fsm_inst_dispatch(trx->ts[i].fi, TS_EV_OML_READY, 0); |
| 256 | |
| 257 | /* Unused dyn TS start out as used for PDCH */ |
| 258 | switch (trx->ts[i].pchan_on_init) { |
| 259 | case GSM_PCHAN_TCH_F_TCH_H_PDCH: |
| 260 | case GSM_PCHAN_TCH_F_PDCH: |
| 261 | trx->ts[i].pchan_is = GSM_PCHAN_PDCH; |
| 262 | break; |
| 263 | default: |
| 264 | break; |
| 265 | } |
Neels Hofmeyr | dd7b710 | 2020-11-12 22:54:58 +0100 | [diff] [blame] | 266 | } |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 267 | } |
Neels Hofmeyr | 780f028 | 2020-11-12 22:51:58 +0100 | [diff] [blame] | 268 | |
| 269 | for (i = 0; i < bsc_gsmnet->num_bts; i++) { |
| 270 | if (gsm_generate_si(gsm_bts_num(bsc_gsmnet, i), SYSINFO_TYPE_2) <= 0) |
| 271 | fprintf(stderr, "Error generating SI2\n"); |
| 272 | } |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 273 | return bts; |
| 274 | } |
| 275 | |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 276 | const char *ts_use_str(struct gsm_bts_trx_ts *ts) |
| 277 | { |
| 278 | switch (ts->pchan_is) { |
| 279 | case GSM_PCHAN_CCCH_SDCCH4: |
| 280 | return "c+s4"; |
| 281 | |
| 282 | case GSM_PCHAN_NONE: |
| 283 | return "-"; |
| 284 | |
| 285 | case GSM_PCHAN_TCH_F: |
| 286 | if (lchan_state_is(&ts->lchan[0], LCHAN_ST_ESTABLISHED)) |
| 287 | return "TCH/F"; |
| 288 | else |
| 289 | return "-"; |
| 290 | |
| 291 | case GSM_PCHAN_TCH_H: |
| 292 | if (lchan_state_is(&ts->lchan[0], LCHAN_ST_ESTABLISHED) |
| 293 | && lchan_state_is(&ts->lchan[1], LCHAN_ST_ESTABLISHED)) |
| 294 | return "TCH/HH"; |
| 295 | if (lchan_state_is(&ts->lchan[0], LCHAN_ST_ESTABLISHED)) |
| 296 | return "TCH/H-"; |
| 297 | if (lchan_state_is(&ts->lchan[1], LCHAN_ST_ESTABLISHED)) |
| 298 | return "TCH/-H"; |
| 299 | return "-"; |
| 300 | |
| 301 | default: |
| 302 | return gsm_pchan_name(ts->pchan_is); |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | bool expect_ts_use(int bts_nr, int trx_nr, const char * const *ts_use) |
| 307 | { |
| 308 | struct gsm_bts *bts; |
| 309 | struct gsm_bts_trx *trx; |
| 310 | int i; |
| 311 | int mismatching_ts = -1; |
| 312 | bts = gsm_bts_num(bsc_gsmnet, bts_nr); |
| 313 | OSMO_ASSERT(bts); |
| 314 | trx = gsm_bts_trx_num(bts, trx_nr); |
| 315 | OSMO_ASSERT(trx); |
| 316 | |
| 317 | fprintf(stderr, "Expect TS use:"); |
| 318 | for (i = 0; i < 8; i++) |
| 319 | fprintf(stderr, "\t%s", ts_use[i]); |
| 320 | fprintf(stderr, "\n"); |
| 321 | fprintf(stderr, " Got TS use:"); |
| 322 | |
| 323 | for (i = 0; i < 8; i++) { |
| 324 | struct gsm_bts_trx_ts *ts = &trx->ts[i]; |
| 325 | const char *use = ts_use_str(ts); |
| 326 | |
| 327 | fprintf(stderr, "\t%s", use); |
| 328 | |
| 329 | if (!strcmp(ts_use[i], "*")) |
| 330 | continue; |
| 331 | if (strcmp(ts_use[i], use) && mismatching_ts < 0) |
| 332 | mismatching_ts = i; |
| 333 | } |
| 334 | fprintf(stderr, "\n"); |
| 335 | |
| 336 | if (mismatching_ts >= 0) { |
| 337 | fprintf(stderr, "Test failed: mismatching TS use in bts %d trx %d ts %d\n", |
| 338 | bts_nr, trx_nr, mismatching_ts); |
| 339 | return false; |
| 340 | } |
| 341 | return true; |
| 342 | } |
| 343 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 344 | void create_conn(struct gsm_lchan *lchan) |
| 345 | { |
Neels Hofmeyr | bb6c13b | 2018-05-24 18:43:58 +0200 | [diff] [blame] | 346 | static unsigned int next_imsi = 0; |
| 347 | char imsi[sizeof(lchan->conn->bsub->imsi)]; |
| 348 | struct gsm_network *net = lchan->ts->trx->bts->network; |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 349 | struct gsm_subscriber_connection *conn; |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 350 | struct mgcp_client *fake_mgcp_client = (void*)talloc_zero(net, int); |
Neels Hofmeyr | bb6c13b | 2018-05-24 18:43:58 +0200 | [diff] [blame] | 351 | |
| 352 | conn = bsc_subscr_con_allocate(net); |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 353 | |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 354 | conn->user_plane.mgw_endpoint = osmo_mgcpc_ep_alloc(conn->fi, |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 355 | GSCON_EV_FORGET_MGW_ENDPOINT, |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 356 | fake_mgcp_client, |
| 357 | net->mgw.tdefs, |
| 358 | "test", |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 359 | "fake endpoint"); |
Alexander Chemeris | 69ba8be | 2020-05-10 22:48:01 +0300 | [diff] [blame] | 360 | conn->sccp.msc = osmo_msc_data_alloc(net, 0); |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 361 | |
| 362 | lchan->conn = conn; |
| 363 | conn->lchan = lchan; |
Neels Hofmeyr | bb6c13b | 2018-05-24 18:43:58 +0200 | [diff] [blame] | 364 | |
| 365 | /* Make up a new IMSI for this test, for logging the subscriber */ |
| 366 | next_imsi ++; |
| 367 | snprintf(imsi, sizeof(imsi), "%06u", next_imsi); |
Neels Hofmeyr | 86a1dca | 2020-09-15 01:03:58 +0000 | [diff] [blame] | 368 | lchan->conn->bsub = bsc_subscr_find_or_create_by_imsi(net->bsc_subscribers, imsi, BSUB_USE_CONN); |
Neels Hofmeyr | bb6c13b | 2018-05-24 18:43:58 +0200 | [diff] [blame] | 369 | |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 370 | /* kick the FSM from INIT through to the ACTIVE state */ |
Neels Hofmeyr | d1e7d39 | 2020-09-27 23:34:57 +0200 | [diff] [blame] | 371 | osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_MO_COMPL_L3, NULL); |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 372 | osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_A_CONN_CFM, NULL); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 373 | } |
| 374 | |
Neels Hofmeyr | 5531fae | 2020-11-13 03:43:57 +0100 | [diff] [blame] | 375 | struct gsm_lchan *lchan_act(struct gsm_lchan *lchan, int full_rate, const char *codec) |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 376 | { |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 377 | /* serious hack into osmo_fsm */ |
| 378 | lchan->fi->state = LCHAN_ST_ESTABLISHED; |
| 379 | lchan->ts->fi->state = TS_ST_IN_USE; |
Neels Hofmeyr | 5531fae | 2020-11-13 03:43:57 +0100 | [diff] [blame] | 380 | lchan->type = full_rate ? GSM_LCHAN_TCH_F : GSM_LCHAN_TCH_H; |
Neels Hofmeyr | fb6d9dc | 2020-11-13 01:13:20 +0100 | [diff] [blame] | 381 | |
| 382 | if (lchan->ts->pchan_on_init == GSM_PCHAN_TCH_F_TCH_H_PDCH) |
| 383 | lchan->ts->pchan_is = full_rate ? GSM_PCHAN_TCH_F : GSM_PCHAN_TCH_H; |
| 384 | if (lchan->ts->pchan_on_init == GSM_PCHAN_TCH_F_PDCH) { |
| 385 | OSMO_ASSERT(full_rate); |
| 386 | lchan->ts->pchan_is = GSM_PCHAN_TCH_F; |
| 387 | } |
| 388 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 389 | LOG_LCHAN(lchan, LOGL_DEBUG, "activated by handover_test.c\n"); |
| 390 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 391 | create_conn(lchan); |
| 392 | if (!strcasecmp(codec, "FR") && full_rate) |
| 393 | lchan->tch_mode = GSM48_CMODE_SPEECH_V1; |
| 394 | else if (!strcasecmp(codec, "HR") && !full_rate) |
| 395 | lchan->tch_mode = GSM48_CMODE_SPEECH_V1; |
| 396 | else if (!strcasecmp(codec, "EFR") && full_rate) |
| 397 | lchan->tch_mode = GSM48_CMODE_SPEECH_EFR; |
Philipp Maier | eda6bfa | 2019-03-11 14:10:26 +0100 | [diff] [blame] | 398 | else if (!strcasecmp(codec, "AMR")) { |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 399 | lchan->tch_mode = GSM48_CMODE_SPEECH_AMR; |
Philipp Maier | eda6bfa | 2019-03-11 14:10:26 +0100 | [diff] [blame] | 400 | lchan->activate.info.s15_s0 = 0x0002; |
| 401 | } else { |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 402 | printf("Given codec unknown\n"); |
| 403 | exit(EXIT_FAILURE); |
| 404 | } |
| 405 | |
| 406 | lchan->conn->codec_list = (struct gsm0808_speech_codec_list){ |
| 407 | .codec = { |
| 408 | { .fi=true, .type=GSM0808_SCT_FR1, }, |
| 409 | { .fi=true, .type=GSM0808_SCT_FR2, }, |
| 410 | { .fi=true, .type=GSM0808_SCT_FR3, }, |
| 411 | { .fi=true, .type=GSM0808_SCT_HR1, }, |
| 412 | { .fi=true, .type=GSM0808_SCT_HR3, }, |
| 413 | }, |
| 414 | .len = 5, |
| 415 | }; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 416 | |
| 417 | return lchan; |
| 418 | } |
| 419 | |
Neels Hofmeyr | 5531fae | 2020-11-13 03:43:57 +0100 | [diff] [blame] | 420 | struct gsm_lchan *create_lchan(struct gsm_bts *bts, int full_rate, const char *codec) |
| 421 | { |
| 422 | struct gsm_lchan *lchan; |
| 423 | |
| 424 | lchan = lchan_select_by_type(bts, (full_rate) ? GSM_LCHAN_TCH_F : GSM_LCHAN_TCH_H); |
| 425 | if (!lchan) { |
| 426 | printf("No resource for lchan\n"); |
| 427 | exit(EXIT_FAILURE); |
| 428 | } |
| 429 | |
| 430 | return lchan_act(lchan, full_rate, codec); |
| 431 | } |
| 432 | |
| 433 | static void lchan_clear(struct gsm_lchan *lchan) |
| 434 | { |
| 435 | lchan_release(lchan, true, false, 0); |
| 436 | } |
| 437 | |
| 438 | static void ts_clear(struct gsm_bts_trx_ts *ts) |
| 439 | { |
| 440 | struct gsm_lchan *lchan; |
| 441 | ts_for_each_lchan(lchan, ts) { |
| 442 | if (lchan_state_is(lchan, LCHAN_ST_UNUSED)) |
| 443 | continue; |
| 444 | lchan_clear(lchan); |
| 445 | } |
| 446 | } |
| 447 | |
| 448 | bool set_ts_use(int bts_nr, int trx_nr, const char * const *ts_use) |
| 449 | { |
| 450 | struct gsm_bts *bts; |
| 451 | struct gsm_bts_trx *trx; |
| 452 | int i; |
| 453 | bts = gsm_bts_num(bsc_gsmnet, bts_nr); |
| 454 | OSMO_ASSERT(bts); |
| 455 | trx = gsm_bts_trx_num(bts, trx_nr); |
| 456 | OSMO_ASSERT(trx); |
| 457 | |
| 458 | fprintf(stderr, "Setting TS use:"); |
| 459 | for (i = 0; i < 8; i++) |
| 460 | fprintf(stderr, "\t%s", ts_use[i]); |
| 461 | fprintf(stderr, "\n"); |
| 462 | |
| 463 | for (i = 0; i < 8; i++) { |
| 464 | struct gsm_bts_trx_ts *ts = &trx->ts[i]; |
| 465 | const char *want_use = ts_use[i]; |
| 466 | const char *is_use = ts_use_str(ts); |
| 467 | |
| 468 | if (!strcmp(want_use, "*")) |
| 469 | continue; |
| 470 | |
| 471 | /* If it is already as desired, don't change anything */ |
| 472 | if (!strcmp(want_use, is_use)) |
| 473 | continue; |
| 474 | |
| 475 | if (!strcmp(want_use, "TCH/F")) { |
| 476 | if (!ts_is_capable_of_pchan(ts, GSM_PCHAN_TCH_F)) { |
| 477 | printf("Error: bts %d trx %d ts %d cannot be used as TCH/F\n", |
| 478 | bts_nr, trx_nr, i); |
| 479 | return false; |
| 480 | } |
| 481 | ts_clear(ts); |
| 482 | |
| 483 | lchan_act(&ts->lchan[0], true, "AMR"); |
| 484 | } else if (!strcmp(want_use, "TCH/H-") |
| 485 | || !strcmp(want_use, "TCH/HH") |
| 486 | || !strcmp(want_use, "TCH/-H")) { |
| 487 | bool act[2]; |
| 488 | int j; |
| 489 | |
| 490 | if (!ts_is_capable_of_pchan(ts, GSM_PCHAN_TCH_H)) { |
| 491 | printf("Error: bts %d trx %d ts %d cannot be used as TCH/H\n", |
| 492 | bts_nr, trx_nr, i); |
| 493 | return false; |
| 494 | } |
| 495 | |
| 496 | if (ts->pchan_is != GSM_PCHAN_TCH_H) |
| 497 | ts_clear(ts); |
| 498 | |
| 499 | act[0] = want_use[4] == 'H'; |
| 500 | act[1] = want_use[5] == 'H'; |
| 501 | |
| 502 | for (j = 0; j < 2; j++) { |
| 503 | if (lchan_state_is(&ts->lchan[j], LCHAN_ST_UNUSED)) { |
| 504 | if (act[j]) |
| 505 | lchan_act(&ts->lchan[j], false, "AMR"); |
| 506 | } else if (!act[j]) |
| 507 | lchan_clear(&ts->lchan[j]); |
| 508 | } |
| 509 | } else if (!strcmp(want_use, "-") || !strcmp(want_use, "PDCH")) { |
| 510 | ts_clear(ts); |
| 511 | } |
| 512 | } |
| 513 | return true; |
| 514 | } |
| 515 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 516 | /* parse channel request */ |
| 517 | |
| 518 | static int got_chan_req = 0; |
| 519 | static struct gsm_lchan *chan_req_lchan = NULL; |
| 520 | |
| 521 | static int parse_chan_act(struct gsm_lchan *lchan, uint8_t *data) |
| 522 | { |
| 523 | chan_req_lchan = lchan; |
| 524 | return 0; |
| 525 | } |
| 526 | |
| 527 | static int parse_chan_rel(struct gsm_lchan *lchan, uint8_t *data) |
| 528 | { |
| 529 | chan_req_lchan = lchan; |
| 530 | return 0; |
| 531 | } |
| 532 | |
| 533 | /* parse handover request */ |
| 534 | |
| 535 | static int got_ho_req = 0; |
| 536 | static struct gsm_lchan *ho_req_lchan = NULL; |
| 537 | |
| 538 | static int parse_ho_command(struct gsm_lchan *lchan, uint8_t *data, int len) |
| 539 | { |
| 540 | struct gsm48_hdr *gh = (struct gsm48_hdr *) data; |
| 541 | struct gsm48_ho_cmd *ho = (struct gsm48_ho_cmd *) gh->data; |
| 542 | int arfcn; |
| 543 | struct gsm_bts *neigh; |
| 544 | |
| 545 | switch (gh->msg_type) { |
| 546 | case GSM48_MT_RR_HANDO_CMD: |
| 547 | arfcn = (ho->cell_desc.arfcn_hi << 8) | ho->cell_desc.arfcn_lo; |
| 548 | |
| 549 | /* look up trx. since every dummy bts uses different arfcn and |
| 550 | * only one trx, it is simple */ |
| 551 | llist_for_each_entry(neigh, &bsc_gsmnet->bts_list, list) { |
| 552 | if (neigh->c0->arfcn != arfcn) |
| 553 | continue; |
| 554 | ho_req_lchan = lchan; |
| 555 | return 0; |
| 556 | } |
| 557 | break; |
| 558 | case GSM48_MT_RR_ASS_CMD: |
| 559 | ho_req_lchan = lchan; |
| 560 | return 0; |
| 561 | break; |
| 562 | default: |
| 563 | fprintf(stderr, "Error, expecting HO or AS command\n"); |
| 564 | return -EINVAL; |
| 565 | } |
| 566 | |
| 567 | return -1; |
| 568 | } |
| 569 | |
| 570 | /* send channel activation ack */ |
| 571 | static void send_chan_act_ack(struct gsm_lchan *lchan, int act) |
| 572 | { |
| 573 | struct msgb *msg = msgb_alloc_headroom(256, 64, "RSL"); |
| 574 | struct abis_rsl_dchan_hdr *dh; |
| 575 | |
| 576 | dh = (struct abis_rsl_dchan_hdr *) msgb_put(msg, sizeof(*dh)); |
| 577 | dh->c.msg_discr = ABIS_RSL_MDISC_DED_CHAN; |
| 578 | dh->c.msg_type = (act) ? RSL_MT_CHAN_ACTIV_ACK : RSL_MT_RF_CHAN_REL_ACK; |
| 579 | dh->ie_chan = RSL_IE_CHAN_NR; |
| 580 | dh->chan_nr = gsm_lchan2chan_nr(lchan); |
| 581 | |
| 582 | msg->dst = lchan->ts->trx->bts->c0->rsl_link; |
| 583 | msg->l2h = (unsigned char *)dh; |
| 584 | |
| 585 | abis_rsl_rcvmsg(msg); |
| 586 | } |
| 587 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 588 | /* Send RLL Est Ind for SAPI[0] */ |
| 589 | static void send_est_ind(struct gsm_lchan *lchan) |
| 590 | { |
| 591 | struct msgb *msg = msgb_alloc_headroom(256, 64, "RSL"); |
| 592 | struct abis_rsl_rll_hdr *rh; |
| 593 | uint8_t chan_nr = gsm_lchan2chan_nr(lchan); |
| 594 | |
| 595 | rh = (struct abis_rsl_rll_hdr *) msgb_put(msg, sizeof(*rh)); |
| 596 | rh->c.msg_discr = ABIS_RSL_MDISC_RLL; |
| 597 | rh->c.msg_type = RSL_MT_EST_IND; |
| 598 | rh->ie_chan = RSL_IE_CHAN_NR; |
| 599 | rh->chan_nr = chan_nr; |
| 600 | rh->ie_link_id = RSL_IE_LINK_IDENT; |
| 601 | rh->link_id = 0x00; |
| 602 | |
| 603 | msg->dst = lchan->ts->trx->bts->c0->rsl_link; |
| 604 | msg->l2h = (unsigned char *)rh; |
| 605 | |
| 606 | abis_rsl_rcvmsg(msg); |
| 607 | } |
| 608 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 609 | /* send handover complete */ |
| 610 | static void send_ho_complete(struct gsm_lchan *lchan, bool success) |
| 611 | { |
| 612 | struct msgb *msg = msgb_alloc_headroom(256, 64, "RSL"); |
| 613 | struct abis_rsl_rll_hdr *rh; |
| 614 | uint8_t chan_nr = gsm_lchan2chan_nr(lchan); |
| 615 | uint8_t *buf; |
| 616 | struct gsm48_hdr *gh; |
| 617 | struct gsm48_ho_cpl *hc; |
| 618 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 619 | send_est_ind(lchan); |
Neels Hofmeyr | ac85b34 | 2018-07-12 21:23:26 +0200 | [diff] [blame] | 620 | osmo_fsm_inst_dispatch(lchan->fi, LCHAN_EV_RTP_READY, 0); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 621 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 622 | rh = (struct abis_rsl_rll_hdr *) msgb_put(msg, sizeof(*rh)); |
| 623 | rh->c.msg_discr = ABIS_RSL_MDISC_RLL; |
| 624 | rh->c.msg_type = RSL_MT_DATA_IND; |
| 625 | rh->ie_chan = RSL_IE_CHAN_NR; |
| 626 | rh->chan_nr = chan_nr; |
| 627 | rh->ie_link_id = RSL_IE_LINK_IDENT; |
| 628 | rh->link_id = 0x00; |
| 629 | |
| 630 | buf = msgb_put(msg, 3); |
| 631 | buf[0] = RSL_IE_L3_INFO; |
| 632 | buf[1] = (sizeof(*gh) + sizeof(*hc)) >> 8; |
| 633 | buf[2] = (sizeof(*gh) + sizeof(*hc)) & 0xff; |
| 634 | |
| 635 | gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh)); |
| 636 | hc = (struct gsm48_ho_cpl *) msgb_put(msg, sizeof(*hc)); |
| 637 | |
| 638 | gh->proto_discr = GSM48_PDISC_RR; |
| 639 | gh->msg_type = |
| 640 | success ? GSM48_MT_RR_HANDO_COMPL : GSM48_MT_RR_HANDO_FAIL; |
| 641 | |
| 642 | msg->dst = lchan->ts->trx->bts->c0->rsl_link; |
| 643 | msg->l2h = (unsigned char *)rh; |
| 644 | msg->l3h = (unsigned char *)gh; |
| 645 | |
| 646 | abis_rsl_rcvmsg(msg); |
| 647 | } |
| 648 | |
Neels Hofmeyr | 1d7473c | 2018-03-05 21:53:18 +0100 | [diff] [blame] | 649 | /* override, requires '-Wl,--wrap=abis_rsl_sendmsg'. |
| 650 | * Catch RSL messages sent towards the BTS. */ |
| 651 | int __real_abis_rsl_sendmsg(struct msgb *msg); |
| 652 | int __wrap_abis_rsl_sendmsg(struct msgb *msg) |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 653 | { |
| 654 | struct abis_rsl_dchan_hdr *dh = (struct abis_rsl_dchan_hdr *) msg->data; |
| 655 | struct e1inp_sign_link *sign_link = msg->dst; |
| 656 | int rc; |
| 657 | struct gsm_lchan *lchan = rsl_lchan_lookup(sign_link->trx, dh->chan_nr, &rc); |
Neels Hofmeyr | fb6d9dc | 2020-11-13 01:13:20 +0100 | [diff] [blame] | 658 | struct gsm_lchan *other_lchan; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 659 | |
| 660 | if (rc) { |
| 661 | printf("rsl_lchan_lookup() failed\n"); |
| 662 | exit(1); |
| 663 | } |
| 664 | |
| 665 | switch (dh->c.msg_type) { |
| 666 | case RSL_MT_CHAN_ACTIV: |
| 667 | rc = parse_chan_act(lchan, dh->data); |
| 668 | if (rc == 0) |
| 669 | got_chan_req = 1; |
| 670 | break; |
| 671 | case RSL_MT_RF_CHAN_REL: |
| 672 | rc = parse_chan_rel(lchan, dh->data); |
| 673 | if (rc == 0) |
| 674 | send_chan_act_ack(chan_req_lchan, 0); |
Neels Hofmeyr | fb6d9dc | 2020-11-13 01:13:20 +0100 | [diff] [blame] | 675 | |
| 676 | /* send dyn TS back to PDCH if unused */ |
| 677 | switch (chan_req_lchan->ts->pchan_on_init) { |
| 678 | case GSM_PCHAN_TCH_F_TCH_H_PDCH: |
| 679 | case GSM_PCHAN_TCH_F_PDCH: |
| 680 | switch (chan_req_lchan->ts->pchan_is) { |
| 681 | case GSM_PCHAN_TCH_H: |
| 682 | other_lchan = &chan_req_lchan->ts->lchan[ |
| 683 | (chan_req_lchan == &chan_req_lchan->ts->lchan[0])? |
| 684 | 1 : 0]; |
| 685 | if (lchan_state_is(other_lchan, LCHAN_ST_ESTABLISHED)) |
| 686 | break; |
| 687 | /* else fall thru */ |
| 688 | case GSM_PCHAN_TCH_F: |
| 689 | chan_req_lchan->ts->pchan_is = GSM_PCHAN_PDCH; |
| 690 | break; |
| 691 | default: |
| 692 | break; |
| 693 | } |
| 694 | break; |
| 695 | default: |
| 696 | break; |
| 697 | } |
| 698 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 699 | break; |
| 700 | case RSL_MT_DATA_REQ: |
| 701 | rc = parse_ho_command(lchan, msg->l3h, msgb_l3len(msg)); |
| 702 | if (rc == 0) |
| 703 | got_ho_req = 1; |
| 704 | break; |
| 705 | case RSL_MT_IPAC_CRCX: |
| 706 | break; |
Neels Hofmeyr | 5b1a7d1 | 2018-11-06 22:24:07 +0100 | [diff] [blame] | 707 | case RSL_MT_DEACTIVATE_SACCH: |
| 708 | break; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 709 | default: |
| 710 | printf("unknown rsl message=0x%x\n", dh->c.msg_type); |
| 711 | } |
| 712 | return 0; |
| 713 | } |
| 714 | |
| 715 | /* test cases */ |
| 716 | |
| 717 | static char *test_case_0[] = { |
| 718 | "2", |
| 719 | |
| 720 | "Stay in better cell\n\n" |
| 721 | "There are many neighbor cells, but only the current cell is the best\n" |
| 722 | "cell, so no handover is performed\n", |
| 723 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 724 | "create-n-bts", "7", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 725 | "create-ms", "0", "TCH/F", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 726 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 727 | "meas-rep", "0","0","1","0", |
| 728 | "30","0", |
| 729 | "6", "0","20", "1","21", "2","18", "3","20", "4","23", "5","19", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 730 | "expect-no-chan", |
| 731 | NULL |
| 732 | }; |
| 733 | |
| 734 | static char *test_case_1[] = { |
| 735 | "2", |
| 736 | |
| 737 | "Handover to best better cell\n\n" |
| 738 | "The best neighbor cell is selected\n", |
| 739 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 740 | "create-n-bts", "7", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 741 | "create-ms", "0", "TCH/F", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 742 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 743 | "meas-rep", "0","0","1","0", |
| 744 | "10","0", |
| 745 | "6", "0","20", "1","21", "2","18", "3","20", "4","23", "5","19", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 746 | "expect-chan", "5", "1", |
| 747 | "ack-chan", |
| 748 | "expect-ho", "0", "1", |
| 749 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 750 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 751 | "expect-ts-use", "5", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 752 | NULL |
| 753 | }; |
| 754 | |
| 755 | static char *test_case_2[] = { |
| 756 | "2", |
| 757 | |
| 758 | "Handover and Assignment must be enabled\n\n" |
| 759 | "This test will start with disabled assignment and handover. A\n" |
| 760 | "better neighbor cell (assignment enabled) will not be selected and \n" |
| 761 | "also no assignment from TCH/H to TCH/F to improve quality. There\n" |
| 762 | "will be no handover nor assignment. After enabling assignment on the\n" |
| 763 | "current cell, the MS will assign to TCH/F. After enabling handover\n" |
| 764 | "in the current cell, but disabling in the neighbor cell, handover\n" |
| 765 | "will not be performed, until it is enabled in the neighbor cell too.\n", |
| 766 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 767 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 768 | "afs-rxlev-improve", "0", "5", |
| 769 | "create-ms", "0", "TCH/H", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 770 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "TCH/H-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 771 | "as-enable", "0", "0", |
| 772 | "ho-enable", "0", "0", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 773 | "meas-rep", "0","0","5","0", "0","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 774 | "expect-no-chan", |
| 775 | "as-enable", "0", "1", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 776 | "meas-rep", "0","0","5","0", "0","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 777 | "expect-chan", "0", "1", |
| 778 | "ack-chan", |
| 779 | "expect-ho", "0", "5", |
| 780 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 781 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 782 | "ho-enable", "0", "1", |
| 783 | "ho-enable", "1", "0", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 784 | "meas-rep", "0","0","1","0", "0","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 785 | "expect-no-chan", |
| 786 | "ho-enable", "1", "1", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 787 | "meas-rep", "0","0","1","0", "0","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 788 | "expect-chan", "1", "1", |
| 789 | "ack-chan", |
| 790 | "expect-ho", "0", "1", |
| 791 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 792 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 793 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 794 | NULL |
| 795 | }; |
| 796 | |
| 797 | static char *test_case_3[] = { |
| 798 | "2", |
| 799 | |
| 800 | "Penalty timer must not run\n\n" |
| 801 | "The MS will try to handover to a better cell, but this will fail.\n" |
| 802 | "Even though the cell is still better, handover will not be performed\n" |
| 803 | "due to penalty timer after handover failure\n", |
| 804 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 805 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 806 | "create-ms", "0", "TCH/F", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 807 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 808 | "meas-rep", "0","0","1","0", "20","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 809 | "expect-chan", "1", "1", |
| 810 | "ack-chan", |
| 811 | "expect-ho", "0", "1", |
| 812 | "ho-failed", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 813 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
| 814 | "expect-ts-use", "1", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 815 | "meas-rep", "0","0","1","0", "20","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 816 | "expect-no-chan", |
| 817 | NULL |
| 818 | }; |
| 819 | |
| 820 | static char *test_case_4[] = { |
| 821 | "2", |
| 822 | |
| 823 | "TCH/H keeping with HR codec\n\n" |
| 824 | "The MS is using half rate V1 codec, but the better cell is congested\n" |
| 825 | "at TCH/H slots. As the congestion is removed, the handover takes\n" |
| 826 | "place.\n", |
| 827 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 828 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 829 | "set-min-free", "1", "TCH/H", "4", |
| 830 | "create-ms", "0", "TCH/H", "HR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 831 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "TCH/H-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 832 | "meas-rep", "0","0","5","0", "20","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 833 | "expect-no-chan", |
| 834 | "set-min-free", "1", "TCH/H", "3", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 835 | "meas-rep", "0","0","5","0", "20","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 836 | "expect-chan", "1", "5", |
| 837 | "ack-chan", |
| 838 | "expect-ho", "0", "5", |
| 839 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 840 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 841 | "expect-ts-use", "1", "0", "*", "-", "-", "-", "-", "TCH/H-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 842 | NULL |
| 843 | }; |
| 844 | |
| 845 | static char *test_case_5[] = { |
| 846 | "2", |
| 847 | |
| 848 | "TCH/F keeping with FR codec\n\n" |
| 849 | "The MS is using full rate V1 codec, but the better cell is congested\n" |
| 850 | "at TCH/F slots. As the congestion is removed, the handover takes\n" |
| 851 | "place.\n", |
| 852 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 853 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 854 | "set-min-free", "1", "TCH/F", "4", |
| 855 | "create-ms", "0", "TCH/F", "FR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 856 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 857 | "meas-rep", "0","0","1","0", "20","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 858 | "expect-no-chan", |
| 859 | "set-min-free", "1", "TCH/F", "3", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 860 | "meas-rep", "0","0","1","0", "20","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 861 | "expect-chan", "1", "1", |
| 862 | "ack-chan", |
| 863 | "expect-ho", "0", "1", |
| 864 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 865 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 866 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 867 | NULL |
| 868 | }; |
| 869 | |
| 870 | static char *test_case_6[] = { |
| 871 | "2", |
| 872 | |
| 873 | "TCH/F keeping with EFR codec\n\n" |
| 874 | "The MS is using full rate V2 codec, but the better cell is congested\n" |
| 875 | "at TCH/F slots. As the congestion is removed, the handover takes\n" |
| 876 | "place.\n", |
| 877 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 878 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 879 | "set-min-free", "1", "TCH/F", "4", |
| 880 | "create-ms", "0", "TCH/F", "EFR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 881 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 882 | "meas-rep", "0","0","1","0", "20","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 883 | "expect-no-chan", |
| 884 | "set-min-free", "1", "TCH/F", "3", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 885 | "meas-rep", "0","0","1","0", "20","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 886 | "expect-chan", "1", "1", |
| 887 | "ack-chan", |
| 888 | "expect-ho", "0", "1", |
| 889 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 890 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 891 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 892 | NULL |
| 893 | }; |
| 894 | |
| 895 | static char *test_case_7[] = { |
| 896 | "2", |
| 897 | |
| 898 | "TCH/F to TCH/H changing with AMR codec\n\n" |
| 899 | "The MS is using AMR V3 codec, the better cell is congested at TCH/F\n" |
| 900 | "slots. The handover is performed to non-congested TCH/H slots.\n", |
| 901 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 902 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 903 | "set-min-free", "1", "TCH/F", "4", |
| 904 | "create-ms", "0", "TCH/F", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 905 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 906 | "meas-rep", "0","0","1","0", "20","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 907 | "expect-chan", "1", "5", |
| 908 | "ack-chan", |
| 909 | "expect-ho", "0", "1", |
| 910 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 911 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 912 | "expect-ts-use", "1", "0", "*", "-", "-", "-", "-", "TCH/H-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 913 | NULL |
| 914 | }; |
| 915 | |
| 916 | static char *test_case_8[] = { |
| 917 | "2", |
| 918 | |
| 919 | "No handover to a cell with no slots available\n\n" |
| 920 | "If no slot is available, no handover is performed\n", |
| 921 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 922 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 923 | "create-ms", "0", "TCH/F", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 924 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 925 | "create-ms", "1", "TCH/F", "AMR", |
| 926 | "create-ms", "1", "TCH/F", "AMR", |
| 927 | "create-ms", "1", "TCH/F", "AMR", |
| 928 | "create-ms", "1", "TCH/F", "AMR", |
| 929 | "create-ms", "1", "TCH/H", "AMR", |
| 930 | "create-ms", "1", "TCH/H", "AMR", |
| 931 | "create-ms", "1", "TCH/H", "AMR", |
| 932 | "create-ms", "1", "TCH/H", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 933 | "expect-ts-use", "1", "0", "*", "TCH/F", "TCH/F", "TCH/F", "TCH/F", "TCH/HH", "TCH/HH", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 934 | "meas-rep", "0","0","1","0", "0","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 935 | "expect-no-chan", |
| 936 | NULL |
| 937 | }; |
| 938 | |
| 939 | static char *test_case_9[] = { |
| 940 | "2", |
| 941 | |
| 942 | "No more parallel handovers, if max_unsync_ho is defined\n\n" |
| 943 | "There are tree mobiles that want to handover, but only two can do\n" |
| 944 | "it at a time, because the maximum number is limited to two.\n", |
| 945 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 946 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 947 | "set-max-ho", "1", "2", |
| 948 | "create-ms", "0", "TCH/F", "AMR", |
| 949 | "create-ms", "0", "TCH/F", "AMR", |
| 950 | "create-ms", "0", "TCH/F", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 951 | "expect-ts-use", "0", "0", "*", "TCH/F", "TCH/F", "TCH/F", "-", "-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 952 | "meas-rep", "0","0","1","0", "0","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 953 | "expect-chan", "1", "1", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 954 | "meas-rep", "0","0","2","0", "0","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 955 | "expect-chan", "1", "2", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 956 | "meas-rep", "0","0","3","0", "0","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 957 | "expect-no-chan", |
| 958 | NULL |
| 959 | }; |
| 960 | |
| 961 | static char *test_case_10[] = { |
| 962 | "2", |
| 963 | |
| 964 | "Hysteresis\n\n" |
| 965 | "If neighbor cell is better, handover is only performed if the\n" |
Martin Hauke | a29affd | 2019-11-13 22:10:41 +0100 | [diff] [blame] | 966 | "amount of improvement is greater or equal hyteresis\n", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 967 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 968 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 969 | "create-ms", "0", "TCH/F", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 970 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 971 | "meas-rep", "0","0","1","0", "27","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 972 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 973 | "meas-rep", "0","0","1","0", "26","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 974 | "expect-chan", "1", "1", |
| 975 | "ack-chan", |
| 976 | "expect-ho", "0", "1", |
| 977 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 978 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 979 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 980 | NULL |
| 981 | }; |
| 982 | |
| 983 | static char *test_case_11[] = { |
| 984 | "2", |
| 985 | |
| 986 | "No Hysteresis and minimum RX level\n\n" |
| 987 | "If current cell's RX level is below mimium level, handover must be\n" |
| 988 | "performed, no matter of the hysteresis. First do not perform\n" |
| 989 | "handover to better neighbor cell, because the hysteresis is not\n" |
| 990 | "met. Second do not perform handover because better neighbor cell is\n" |
| 991 | "below minimum RX level. Third perform handover because current cell\n" |
| 992 | "is below minimum RX level, even if the better neighbor cell (minimum\n" |
| 993 | "RX level reached) does not meet the hysteresis.\n", |
| 994 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 995 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 996 | "create-ms", "0", "TCH/F", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 997 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 998 | "meas-rep", "0","0","1","0", "10","0", "1","0","11", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 999 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1000 | "meas-rep", "0","0","1","0", "8","0", "1","0","9", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1001 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1002 | "meas-rep", "0","0","1","0", "9","0", "1","0","10", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1003 | "expect-chan", "1", "1", |
| 1004 | "ack-chan", |
| 1005 | "expect-ho", "0", "1", |
| 1006 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1007 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 1008 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1009 | NULL |
| 1010 | }; |
| 1011 | |
| 1012 | static char *test_case_12[] = { |
| 1013 | "2", |
| 1014 | |
| 1015 | "No handover to congested cell\n\n" |
| 1016 | "The better neighbor cell is congested, so no handover is performed.\n" |
| 1017 | "After the congestion is over, handover will be performed.\n", |
| 1018 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1019 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1020 | "create-ms", "0", "TCH/F", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1021 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1022 | "set-min-free", "1", "TCH/F", "4", |
| 1023 | "set-min-free", "1", "TCH/H", "4", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1024 | "meas-rep", "0","0","1","0", "20","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1025 | "expect-no-chan", |
| 1026 | "set-min-free", "1", "TCH/F", "3", |
| 1027 | "set-min-free", "1", "TCH/H", "3", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1028 | "meas-rep", "0","0","1","0", "20","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1029 | "expect-chan", "1", "1", |
| 1030 | "ack-chan", |
| 1031 | "expect-ho", "0", "1", |
| 1032 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1033 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 1034 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1035 | NULL |
| 1036 | }; |
| 1037 | |
| 1038 | static char *test_case_13[] = { |
| 1039 | "2", |
| 1040 | |
| 1041 | "Handover to balance congestion\n\n" |
| 1042 | "The current and the better cell are congested, so no handover is\n" |
| 1043 | "performed. This is because handover would congest the neighbor cell\n" |
| 1044 | "more. After congestion raises in the current cell, the handover is\n" |
| 1045 | "performed to balance congestion\n", |
| 1046 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1047 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1048 | "create-ms", "0", "TCH/F", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1049 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1050 | "set-min-free", "0", "TCH/F", "4", |
| 1051 | "set-min-free", "0", "TCH/H", "4", |
| 1052 | "set-min-free", "1", "TCH/F", "4", |
| 1053 | "set-min-free", "1", "TCH/H", "4", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1054 | "meas-rep", "0","0","1","0", "20","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1055 | "expect-no-chan", |
| 1056 | "create-ms", "0", "TCH/F", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1057 | "expect-ts-use", "0", "0", "*", "TCH/F", "TCH/F", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1058 | "meas-rep", "0","0","1","0", "20","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1059 | "expect-chan", "1", "1", |
| 1060 | "ack-chan", |
| 1061 | "expect-ho", "0", "1", |
| 1062 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1063 | "expect-ts-use", "0", "0", "*", "-", "TCH/F", "-", "-", "-", "-", "-", |
| 1064 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1065 | NULL |
| 1066 | }; |
| 1067 | |
| 1068 | static char *test_case_14[] = { |
| 1069 | "2", |
| 1070 | |
| 1071 | "Handover to congested cell, if RX level is below minimum\n\n" |
| 1072 | "The better neighbor cell is congested, so no handover is performed.\n" |
| 1073 | "If the RX level of the current cell drops below minimum acceptable\n" |
| 1074 | "level, the handover is performed.\n", |
| 1075 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1076 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1077 | "create-ms", "0", "TCH/F", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1078 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1079 | "set-min-free", "1", "TCH/F", "4", |
| 1080 | "set-min-free", "1", "TCH/H", "4", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1081 | "meas-rep", "0","0","1","0", "10","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1082 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1083 | "meas-rep", "0","0","1","0", "9","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1084 | "expect-chan", "1", "1", |
| 1085 | "ack-chan", |
| 1086 | "expect-ho", "0", "1", |
| 1087 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1088 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 1089 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1090 | NULL |
| 1091 | }; |
| 1092 | |
| 1093 | static char *test_case_15[] = { |
| 1094 | "2", |
| 1095 | |
| 1096 | "Handover to cell with worse RXLEV, if RXQUAL is below minimum\n\n" |
| 1097 | "The neighbor cell has worse RXLEV, so no handover is performed.\n" |
| 1098 | "If the RXQUAL of the current cell drops below minimum acceptable\n" |
| 1099 | "level, the handover is performed. It is also required that 10\n" |
| 1100 | "reports are received, before RXQUAL is checked.\n", |
| 1101 | /* (See also test 28, which tests for RXQUAL triggering HO to congested cell.) */ |
| 1102 | /* TODO: bad RXQUAL may want to prefer assignment within the same cell to avoid interference. |
Martin Hauke | a29affd | 2019-11-13 22:10:41 +0100 | [diff] [blame] | 1103 | * See Performance Enhancements in a Frequency Hopping GSM Network (Nielsen Wigard 2002), Chapter |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1104 | * 2.1.1, "Interference" in the list of triggers on p.157. */ |
| 1105 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1106 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1107 | "create-ms", "0", "TCH/F", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1108 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1109 | "meas-rep", "0","0","1","0", "40","6", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1110 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1111 | "meas-rep", "0","0","1","0", "40","6", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1112 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1113 | "meas-rep", "0","0","1","0", "40","6", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1114 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1115 | "meas-rep", "0","0","1","0", "40","6", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1116 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1117 | "meas-rep", "0","0","1","0", "40","6", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1118 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1119 | "meas-rep", "0","0","1","0", "40","6", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1120 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1121 | "meas-rep", "0","0","1","0", "40","6", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1122 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1123 | "meas-rep", "0","0","1","0", "40","6", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1124 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1125 | "meas-rep", "0","0","1","0", "40","6", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1126 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1127 | "meas-rep", "0","0","1","0", "40","6", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1128 | "expect-chan", "1", "1", |
| 1129 | "ack-chan", |
| 1130 | "expect-ho", "0", "1", |
| 1131 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1132 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 1133 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1134 | NULL |
| 1135 | }; |
| 1136 | |
| 1137 | static char *test_case_16[] = { |
| 1138 | "2", |
| 1139 | |
| 1140 | "Handover due to maximum TA exceeded\n\n" |
| 1141 | "The MS in the current (best) cell has reached maximum allowed timing\n" |
| 1142 | "advance. No handover is performed until the timing advance exceeds\n" |
| 1143 | "it. The originating cell is still the best, but no handover is\n" |
| 1144 | "performed back to that cell, because the penalty timer (due to\n" |
| 1145 | "maximum allowed timing advance) is running.\n", |
| 1146 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1147 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1148 | "create-ms", "0", "TCH/F", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1149 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1150 | "set-max-ta", "0", "5", /* of cell */ |
| 1151 | "set-ta", "0", "5", /* of ms */ |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1152 | "meas-rep", "0","0","1","0", "30","0", "1","0","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1153 | "expect-no-chan", |
| 1154 | "set-ta", "0", "6", /* of ms */ |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1155 | "meas-rep", "0","0","1","0", "30","0", "1","0","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1156 | "expect-chan", "1", "1", |
| 1157 | "ack-chan", |
| 1158 | "expect-ho", "0", "1", |
| 1159 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1160 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 1161 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1162 | "meas-rep", "1","0","1","0", "20","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1163 | "expect-no-chan", |
| 1164 | NULL |
| 1165 | }; |
| 1166 | |
| 1167 | static char *test_case_17[] = { |
| 1168 | "2", |
| 1169 | |
| 1170 | "Congestion check: No congestion\n\n" |
| 1171 | "Three cells have different number of used slots, but there is no\n" |
| 1172 | "congestion in any of these cells. No handover is performed.\n", |
| 1173 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1174 | "create-n-bts", "3", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1175 | "set-min-free", "0", "TCH/F", "2", |
| 1176 | "set-min-free", "0", "TCH/H", "2", |
| 1177 | "set-min-free", "1", "TCH/F", "2", |
| 1178 | "set-min-free", "1", "TCH/H", "2", |
| 1179 | "set-min-free", "2", "TCH/F", "2", |
| 1180 | "set-min-free", "2", "TCH/H", "2", |
| 1181 | "create-ms", "0", "TCH/F", "AMR", |
| 1182 | "create-ms", "0", "TCH/F", "AMR", |
| 1183 | "create-ms", "0", "TCH/H", "AMR", |
| 1184 | "create-ms", "0", "TCH/H", "AMR", |
| 1185 | "create-ms", "1", "TCH/F", "AMR", |
| 1186 | "create-ms", "1", "TCH/H", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1187 | "expect-ts-use", "0", "0", "*", "TCH/F", "TCH/F", "-", "-", "TCH/HH", "-", "-", |
| 1188 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "TCH/H-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1189 | "meas-rep", "0","0","1","0", "30","0", "2","0","20","1","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1190 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1191 | "meas-rep", "0","0","2","0", "30","0", "2","0","20","1","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1192 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1193 | "meas-rep", "0","0","5","0", "30","0", "2","0","20","1","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1194 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1195 | "meas-rep", "0","0","5","1", "30","0", "2","0","20","1","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1196 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1197 | "meas-rep", "1","0","1","0", "30","0", "2","0","20","1","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1198 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1199 | "meas-rep", "1","0","5","0", "30","0", "2","0","20","1","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1200 | "expect-no-chan", |
| 1201 | "congestion-check", |
| 1202 | "expect-no-chan", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1203 | "expect-ts-use", "0", "0", "*", "TCH/F", "TCH/F", "-", "-", "TCH/HH", "-", "-", |
| 1204 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "TCH/H-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1205 | NULL |
| 1206 | }; |
| 1207 | |
| 1208 | static char *test_case_18[] = { |
| 1209 | "2", |
| 1210 | |
| 1211 | "Congestion check: One out of three cells is congested\n\n" |
| 1212 | "Three cells have different number of used slots, but there is\n" |
| 1213 | "congestion at TCH/F in the first cell. Handover is performed with\n" |
| 1214 | "the best candidate.\n", |
| 1215 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1216 | "create-n-bts", "3", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1217 | "set-min-free", "0", "TCH/F", "2", |
| 1218 | "set-min-free", "0", "TCH/H", "2", |
| 1219 | "set-min-free", "1", "TCH/F", "2", |
| 1220 | "set-min-free", "1", "TCH/H", "2", |
| 1221 | "set-min-free", "2", "TCH/F", "2", |
| 1222 | "set-min-free", "2", "TCH/H", "2", |
| 1223 | "create-ms", "0", "TCH/F", "AMR", |
| 1224 | "create-ms", "0", "TCH/F", "AMR", |
| 1225 | "create-ms", "0", "TCH/F", "AMR", |
| 1226 | "create-ms", "0", "TCH/H", "AMR", |
| 1227 | "create-ms", "0", "TCH/H", "AMR", |
| 1228 | "create-ms", "1", "TCH/F", "AMR", |
| 1229 | "create-ms", "1", "TCH/H", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1230 | "expect-ts-use", "0", "0", "*", "TCH/F", "TCH/F", "TCH/F", "-", "TCH/HH", "-", "-", |
| 1231 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "TCH/H-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1232 | "meas-rep", "0","0","1","0", "30","0", "2","0","20","1","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1233 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1234 | "meas-rep", "0","0","2","0", "30","0", "2","0","20","1","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1235 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1236 | "meas-rep", "0","0","3","0", "30","0", "2","0","21","1","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1237 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1238 | "meas-rep", "0","0","5","0", "30","0", "2","0","20","1","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1239 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1240 | "meas-rep", "0","0","5","1", "30","0", "2","0","20","1","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1241 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1242 | "meas-rep", "1","0","1","0", "30","0", "2","0","20","1","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1243 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1244 | "meas-rep", "1","0","5","0", "30","0", "2","0","20","1","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1245 | "expect-no-chan", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1246 | "expect-ts-use", "0", "0", "*", "TCH/F", "TCH/F", "TCH/F", "-", "TCH/HH", "-", "-", |
| 1247 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "TCH/H-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1248 | "congestion-check", |
| 1249 | "expect-chan", "1", "2", |
| 1250 | "ack-chan", |
Neels Hofmeyr | 72d64e7 | 2020-11-16 18:07:31 +0100 | [diff] [blame] | 1251 | "expect-ho", "0", "3", /* best candidate is MS 2 at BTS 0, TS 3 */ |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1252 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1253 | "expect-ts-use", "0", "0", "*", "TCH/F", "TCH/F", "-", "-", "TCH/HH", "-", "-", |
| 1254 | "expect-ts-use", "1", "0", "*", "TCH/F", "TCH/F", "-", "-", "TCH/H-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1255 | NULL |
| 1256 | }; |
| 1257 | |
| 1258 | static char *test_case_19[] = { |
| 1259 | "2", |
| 1260 | |
| 1261 | "Congestion check: Balancing over congested cells\n\n" |
Neels Hofmeyr | 1336d94 | 2020-08-10 21:13:55 +0200 | [diff] [blame] | 1262 | "Two cells are congested, but the second cell is less congested.\n" |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1263 | "Handover is performed to solve the congestion.\n", |
| 1264 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1265 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1266 | "set-min-free", "0", "TCH/F", "4", |
| 1267 | "set-min-free", "1", "TCH/F", "4", |
| 1268 | "create-ms", "0", "TCH/F", "FR", |
| 1269 | "create-ms", "0", "TCH/F", "FR", |
| 1270 | "create-ms", "0", "TCH/F", "FR", |
| 1271 | "create-ms", "1", "TCH/F", "FR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1272 | "expect-ts-use", "0", "0", "*", "TCH/F", "TCH/F", "TCH/F", "-", "-", "-", "-", |
| 1273 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1274 | "meas-rep", "0","0","1","0", "30","0", "1","0","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1275 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1276 | "meas-rep", "0","0","2","0", "30","0", "1","0","21", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1277 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1278 | "meas-rep", "0","0","3","0", "30","0", "1","0","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1279 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1280 | "meas-rep", "1","0","1","0", "30","0", "1","0","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1281 | "expect-no-chan", |
| 1282 | "congestion-check", |
| 1283 | "expect-chan", "1", "2", |
| 1284 | "ack-chan", |
| 1285 | "expect-ho", "0", "2", /* best candidate is MS 1 at BTS 0, TS 2 */ |
| 1286 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1287 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "TCH/F", "-", "-", "-", "-", |
| 1288 | "expect-ts-use", "1", "0", "*", "TCH/F", "TCH/F", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1289 | NULL |
| 1290 | }; |
| 1291 | |
| 1292 | static char *test_case_20[] = { |
| 1293 | "2", |
| 1294 | |
| 1295 | "Congestion check: Solving congestion by handover TCH/F -> TCH/H\n\n" |
| 1296 | "Two BTS, one MS in the first congested BTS must handover to\n" |
| 1297 | "non-congested TCH/H of second BTS, in order to solve congestion\n", |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1298 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1299 | "set-min-free", "0", "TCH/F", "4", |
| 1300 | "set-min-free", "0", "TCH/H", "4", |
| 1301 | "set-min-free", "1", "TCH/F", "4", |
| 1302 | "create-ms", "0", "TCH/F", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1303 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1304 | "meas-rep", "0","0","1","0", "30","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1305 | "expect-no-chan", |
| 1306 | "congestion-check", |
| 1307 | "expect-chan", "1", "5", |
| 1308 | "ack-chan", |
| 1309 | "expect-ho", "0", "1", |
| 1310 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1311 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 1312 | "expect-ts-use", "1", "0", "*", "-", "-", "-", "-", "TCH/H-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1313 | NULL |
| 1314 | }; |
| 1315 | |
| 1316 | static char *test_case_21[] = { |
| 1317 | "2", |
| 1318 | |
| 1319 | "Congestion check: Balancing congestion by handover TCH/F -> TCH/H\n\n" |
| 1320 | "Two BTS, one MS in the first congested BTS must handover to\n" |
| 1321 | "less-congested TCH/H of second BTS, in order to balance congestion\n", |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1322 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1323 | "set-min-free", "0", "TCH/F", "4", |
| 1324 | "set-min-free", "0", "TCH/H", "4", |
| 1325 | "set-min-free", "1", "TCH/F", "4", |
| 1326 | "set-min-free", "1", "TCH/H", "4", |
| 1327 | "create-ms", "0", "TCH/F", "AMR", |
| 1328 | "create-ms", "0", "TCH/F", "AMR", |
| 1329 | "create-ms", "0", "TCH/H", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1330 | "expect-ts-use", "0", "0", "*", "TCH/F", "TCH/F", "-", "-", "TCH/H-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1331 | "meas-rep", "0","0","1","0", "30","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1332 | "expect-no-chan", |
| 1333 | "congestion-check", |
| 1334 | "expect-chan", "1", "1", |
| 1335 | "ack-chan", |
| 1336 | "expect-ho", "0", "1", |
| 1337 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1338 | "expect-ts-use", "0", "0", "*", "-", "TCH/F", "-", "-", "TCH/H-", "-", "-", |
| 1339 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1340 | NULL |
| 1341 | }; |
| 1342 | |
| 1343 | static char *test_case_22[] = { |
| 1344 | "2", |
| 1345 | |
| 1346 | "Congestion check: Upgrading worst candidate from TCH/H -> TCH/F\n\n" |
| 1347 | "There is only one BTS. The TCH/H slots are congested. Since\n" |
| 1348 | "assignment is performed to less-congested TCH/F, the candidate with\n" |
| 1349 | "the worst RX level is chosen.\n", |
| 1350 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1351 | "create-n-bts", "1", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1352 | "set-min-free", "0", "TCH/F", "4", |
| 1353 | "set-min-free", "0", "TCH/H", "4", |
| 1354 | "create-ms", "0", "TCH/H", "AMR", |
| 1355 | "create-ms", "0", "TCH/H", "AMR", |
| 1356 | "create-ms", "0", "TCH/H", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1357 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "TCH/HH", "TCH/H-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1358 | "meas-rep", "0","0","5","0", "30","0", "0", |
| 1359 | "meas-rep", "0","0","5","1", "34","0", "0", |
| 1360 | "meas-rep", "0","0","6","0", "20","0", "0", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1361 | "expect-no-chan", |
| 1362 | "congestion-check", |
| 1363 | "expect-chan", "0", "1", |
| 1364 | "ack-chan", |
| 1365 | "expect-ho", "0", "6", |
| 1366 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1367 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "TCH/HH", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1368 | NULL |
| 1369 | }; |
| 1370 | |
| 1371 | static char *test_case_23[] = { |
| 1372 | "2", |
| 1373 | |
| 1374 | "Story: 'A neighbor is your friend'\n", |
| 1375 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1376 | "create-n-bts", "3", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1377 | |
| 1378 | "print", |
| 1379 | "Andreas is driving along the coast, on a sunny june afternoon.\n" |
| 1380 | "Suddenly he is getting a call from his friend and neighbor Axel.\n" |
| 1381 | "\n" |
| 1382 | "What happens: Two MS are created, #0 for Axel, #1 for Andreas.", |
| 1383 | /* Axel */ |
| 1384 | "create-ms", "2", "TCH/F", "AMR", |
| 1385 | /* andreas */ |
| 1386 | "create-ms", "0", "TCH/F", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1387 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
| 1388 | "expect-ts-use", "1", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 1389 | "expect-ts-use", "2", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1390 | "meas-rep", "0","0","1","0", "40","0", "1","0","30", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1391 | "expect-no-chan", |
| 1392 | |
| 1393 | "print", |
| 1394 | "Axel asks Andreas if he would like to join them for a barbecue.\n" |
| 1395 | "Axel's house is right in the neighborhood and the weather is fine.\n" |
| 1396 | "Andreas agrees, so he drives to a close store to buy some barbecue\n" |
| 1397 | "skewers.\n" |
| 1398 | "\n" |
| 1399 | "What happens: While driving, a different cell (mounted atop the\n" |
| 1400 | "store) becomes better.", |
| 1401 | /* drive to bts 1 */ |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1402 | "meas-rep", "0","0","1","0", "20","0", "1","0","35", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1403 | "expect-chan", "1", "1", |
| 1404 | "ack-chan", |
| 1405 | "expect-ho", "0", "1", |
| 1406 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1407 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 1408 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
| 1409 | "expect-ts-use", "2", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1410 | |
| 1411 | "print", |
| 1412 | "While Andreas is walking into the store, Axel asks, if he could also\n" |
| 1413 | "bring some beer. Andreas has problems understanding him: \"I have a\n" |
| 1414 | "bad reception here. The cell tower is right atop the store, but poor\n" |
| 1415 | "coverage inside. Can you repeat please?\"\n" |
| 1416 | "\n" |
| 1417 | "What happens: Inside the store the close cell is so bad, that\n" |
| 1418 | "handover back to the previous cell is required.", |
| 1419 | /* bts 1 becomes bad, so bts 0 helps out */ |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1420 | "meas-rep", "1","0","1","0", "5","0", "1","0","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1421 | "expect-chan", "0", "1", |
| 1422 | "ack-chan", |
| 1423 | "expect-ho", "1", "1", |
| 1424 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1425 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
| 1426 | "expect-ts-use", "1", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 1427 | "expect-ts-use", "2", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1428 | |
| 1429 | "print", |
| 1430 | "After Andreas bought skewers and beer, he leaves the store.\n" |
| 1431 | "\n" |
| 1432 | "What happens: Outside the store the close cell is better again, so\n" |
| 1433 | "handover back to the that cell is performed.", |
| 1434 | /* bts 1 becomes better again */ |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1435 | "meas-rep", "0","0","1","0", "20","0", "1","0","35", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1436 | "expect-chan", "1", "1", |
| 1437 | "ack-chan", |
| 1438 | "expect-ho", "0", "1", |
| 1439 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1440 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 1441 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
| 1442 | "expect-ts-use", "2", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1443 | |
| 1444 | "print", |
| 1445 | /* bts 2 becomes better */ |
| 1446 | "Andreas drives down to the lake where Axel's house is.\n" |
| 1447 | "\n" |
| 1448 | "What happens: There is a small cell at Axel's house, which becomes\n" |
| 1449 | "better, because the current cell has no good comverage at the lake.", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1450 | "meas-rep", "1","0","1","0", "14","0", "2","0","2","1","63", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1451 | "expect-chan", "2", "2", |
| 1452 | "ack-chan", |
| 1453 | "expect-ho", "1", "1", |
| 1454 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1455 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 1456 | "expect-ts-use", "1", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 1457 | "expect-ts-use", "2", "0", "*", "TCH/F", "TCH/F", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1458 | |
| 1459 | "print", |
| 1460 | "Andreas wonders why he still has good radio coverage: \"Last time it\n" |
| 1461 | "was so bad\". Axel says: \"I installed a pico cell in my house,\n" |
| 1462 | "now we can use our mobile phones down here at the lake.\"", |
| 1463 | |
| 1464 | NULL |
| 1465 | }; |
| 1466 | |
| 1467 | static char *test_case_24[] = { |
| 1468 | "2", |
| 1469 | "No (or not enough) measurements for handover\n\n" |
| 1470 | "Do not solve congestion in cell, because there is no measurement.\n" |
Martin Hauke | a29affd | 2019-11-13 22:10:41 +0100 | [diff] [blame] | 1471 | "As soon as enough measurements available (1 in our case), perform\n" |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1472 | "handover. Afterwards the old cell becomes congested and the new\n" |
| 1473 | "cell is not. Do not perform handover until new measurements are\n" |
| 1474 | "received.\n", |
| 1475 | |
| 1476 | /* two cells, first in congested, but no handover */ |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1477 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1478 | "set-min-free", "0", "TCH/F", "4", |
| 1479 | "set-min-free", "0", "TCH/H", "4", |
| 1480 | "create-ms", "0", "TCH/F", "AMR", |
| 1481 | "congestion-check", |
| 1482 | "expect-no-chan", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1483 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1484 | |
| 1485 | /* send measurement and trigger congestion check */ |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1486 | "meas-rep", "0","0","1","0", "20","0", "1","0","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1487 | "expect-no-chan", |
| 1488 | "congestion-check", |
| 1489 | "expect-chan", "1", "1", |
| 1490 | "ack-chan", |
| 1491 | "expect-ho", "0", "1", |
| 1492 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1493 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 1494 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1495 | |
| 1496 | /* congest the first cell and remove congestion from second cell */ |
| 1497 | "set-min-free", "0", "TCH/F", "0", |
| 1498 | "set-min-free", "0", "TCH/H", "0", |
| 1499 | "set-min-free", "1", "TCH/F", "4", |
| 1500 | "set-min-free", "1", "TCH/H", "4", |
| 1501 | |
| 1502 | /* no handover until measurements applied */ |
| 1503 | "congestion-check", |
| 1504 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1505 | "meas-rep", "1","0","1","0", "20","0", "1","0","20", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1506 | "expect-no-chan", |
| 1507 | "congestion-check", |
| 1508 | "expect-chan", "0", "1", |
| 1509 | "ack-chan", |
| 1510 | "expect-ho", "1", "1", |
| 1511 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1512 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
| 1513 | "expect-ts-use", "1", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1514 | NULL |
| 1515 | }; |
| 1516 | |
| 1517 | static char *test_case_25[] = { |
| 1518 | "1", |
| 1519 | |
| 1520 | "Stay in better cell\n\n" |
| 1521 | "There are many neighbor cells, but only the current cell is the best\n" |
| 1522 | "cell, so no handover is performed\n", |
| 1523 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1524 | "create-n-bts", "7", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1525 | "create-ms", "0", "TCH/F", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1526 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1527 | "meas-rep", "0","0","1","0", "30","0", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1528 | "6","0","20","1","21","2","18","3","20","4","23","5","19", |
| 1529 | "expect-no-chan", |
| 1530 | NULL |
| 1531 | }; |
| 1532 | |
| 1533 | static char *test_case_26[] = { |
| 1534 | "1", |
| 1535 | |
| 1536 | "Handover to best better cell\n\n" |
| 1537 | "The best neighbor cell is selected\n", |
| 1538 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1539 | "create-n-bts", "7", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1540 | "create-ms", "0", "TCH/F", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1541 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1542 | "meas-rep", "0","0","1","0", "10","0", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1543 | "6","0","20","1","21","2","18","3","20","4","23","5","19", |
| 1544 | "expect-chan", "5", "1", |
| 1545 | "ack-chan", |
| 1546 | "expect-ho", "0", "1", |
| 1547 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1548 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 1549 | "expect-ts-use", "5", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1550 | NULL |
| 1551 | }; |
| 1552 | |
| 1553 | static char *test_case_27[] = { |
| 1554 | "2", |
| 1555 | |
| 1556 | "Congestion check: Upgrading worst candidate from TCH/H -> TCH/F\n\n" |
| 1557 | "There is only one BTS. The TCH/H slots are congested. Since\n" |
| 1558 | "assignment is performed to less-congested TCH/F, the candidate with\n" |
| 1559 | "the worst RX level is chosen. (So far like test 22.)\n" |
| 1560 | "After that, trigger more congestion checks to ensure stability.\n", |
| 1561 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1562 | "create-n-bts", "1", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1563 | "set-min-free", "0", "TCH/F", "2", |
| 1564 | "set-min-free", "0", "TCH/H", "4", |
| 1565 | "create-ms", "0", "TCH/H", "AMR", |
| 1566 | "create-ms", "0", "TCH/H", "AMR", |
| 1567 | "create-ms", "0", "TCH/H", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1568 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "TCH/HH", "TCH/H-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1569 | "meas-rep", "0","0","5","0", "30","0", "0", |
| 1570 | "meas-rep", "0","0","5","1", "34","0", "0", |
| 1571 | "meas-rep", "0","0","6","0", "20","0", "0", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1572 | "expect-no-chan", |
| 1573 | "congestion-check", |
| 1574 | "expect-chan", "0", "1", |
| 1575 | "ack-chan", |
| 1576 | "expect-ho", "0", "6", |
| 1577 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1578 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "TCH/HH", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1579 | "congestion-check", |
| 1580 | "expect-chan", "0", "2", |
| 1581 | "ack-chan", |
| 1582 | "expect-ho", "0", "5", |
| 1583 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1584 | "expect-ts-use", "0", "0", "*", "TCH/F", "TCH/F", "-", "-", "TCH/-H", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1585 | "congestion-check", |
| 1586 | "expect-no-chan", |
| 1587 | "congestion-check", |
| 1588 | "expect-no-chan", |
| 1589 | NULL |
| 1590 | }; |
| 1591 | |
| 1592 | static char *test_case_28[] = { |
| 1593 | "2", |
| 1594 | |
| 1595 | "Handover to congested cell, if RX quality is below minimum\n\n" |
| 1596 | "The better neighbor cell is congested, so no handover is performed.\n" |
| 1597 | "If the RX quality of the current cell drops below minimum acceptable\n" |
| 1598 | "level, the handover is performed. It is also required that 10\n" |
| 1599 | "resports are received, before RX quality is checked.\n", |
| 1600 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1601 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1602 | "create-ms", "0", "TCH/F", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1603 | "expect-ts-use", "0", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1604 | "set-min-free", "1", "TCH/F", "4", |
| 1605 | "set-min-free", "1", "TCH/H", "4", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1606 | "meas-rep", "0","0","1","0", "30","6", "1","0","40", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1607 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1608 | "meas-rep", "0","0","1","0", "30","6", "1","0","40", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1609 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1610 | "meas-rep", "0","0","1","0", "30","6", "1","0","40", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1611 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1612 | "meas-rep", "0","0","1","0", "30","6", "1","0","40", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1613 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1614 | "meas-rep", "0","0","1","0", "30","6", "1","0","40", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1615 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1616 | "meas-rep", "0","0","1","0", "30","6", "1","0","40", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1617 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1618 | "meas-rep", "0","0","1","0", "30","6", "1","0","40", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1619 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1620 | "meas-rep", "0","0","1","0", "30","6", "1","0","40", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1621 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1622 | "meas-rep", "0","0","1","0", "30","6", "1","0","40", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1623 | "expect-no-chan", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1624 | "meas-rep", "0","0","1","0", "30","6", "1","0","40", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1625 | "expect-chan", "1", "1", |
| 1626 | "ack-chan", |
| 1627 | "expect-ho", "0", "1", |
| 1628 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1629 | "expect-ts-use", "0", "0", "*", "-", "-", "-", "-", "-", "-", "-", |
| 1630 | "expect-ts-use", "1", "0", "*", "TCH/F", "-", "-", "-", "-", "-", "-", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1631 | NULL |
| 1632 | }; |
| 1633 | |
Neels Hofmeyr | 7b2b430 | 2020-08-02 02:50:17 +0200 | [diff] [blame] | 1634 | static char *test_case_29[] = { |
| 1635 | "2", |
| 1636 | |
| 1637 | "Congestion check: Balancing congestion by handover TCH/F -> TCH/H\n\n" |
| 1638 | "One BTS, and TCH/F are considered congested, TCH/H are not.\n" |
| 1639 | , |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1640 | "create-n-bts", "1", |
Neels Hofmeyr | 7b2b430 | 2020-08-02 02:50:17 +0200 | [diff] [blame] | 1641 | "set-min-free", "0", "TCH/F", "3", |
| 1642 | "set-min-free", "0", "TCH/H", "0", |
| 1643 | "create-ms", "0", "TCH/F", "AMR", |
| 1644 | "create-ms", "0", "TCH/F", "AMR", |
| 1645 | "create-ms", "0", "TCH/H", "AMR", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1646 | "expect-ts-use", "0", "0", "*", "TCH/F", "TCH/F", "-", "-", "TCH/H-", "-", "-", |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1647 | "meas-rep", "0","0","1","0", "30","0", "1","0","30", |
Neels Hofmeyr | 7b2b430 | 2020-08-02 02:50:17 +0200 | [diff] [blame] | 1648 | "expect-no-chan", |
| 1649 | "congestion-check", |
| 1650 | "expect-chan", "0", "5", |
| 1651 | "ack-chan", |
| 1652 | "expect-ho", "0", "1", |
| 1653 | "ho-complete", |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 1654 | "expect-ts-use", "0", "0", "*", "-", "TCH/F", "-", "-", "TCH/HH", "-", "-", |
Neels Hofmeyr | 7b2b430 | 2020-08-02 02:50:17 +0200 | [diff] [blame] | 1655 | NULL |
| 1656 | }; |
| 1657 | |
| 1658 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1659 | static char **test_cases[] = { |
| 1660 | test_case_0, |
| 1661 | test_case_1, |
| 1662 | test_case_2, |
| 1663 | test_case_3, |
| 1664 | test_case_4, |
| 1665 | test_case_5, |
| 1666 | test_case_6, |
| 1667 | test_case_7, |
| 1668 | test_case_8, |
| 1669 | test_case_9, |
| 1670 | test_case_10, |
| 1671 | test_case_11, |
| 1672 | test_case_12, |
| 1673 | test_case_13, |
| 1674 | test_case_14, |
| 1675 | test_case_15, |
| 1676 | test_case_16, |
| 1677 | test_case_17, |
| 1678 | test_case_18, |
| 1679 | test_case_19, |
| 1680 | test_case_20, |
| 1681 | test_case_21, |
| 1682 | test_case_22, |
| 1683 | test_case_23, |
| 1684 | test_case_24, |
| 1685 | test_case_25, |
| 1686 | test_case_26, |
| 1687 | test_case_27, |
| 1688 | test_case_28, |
Neels Hofmeyr | 7b2b430 | 2020-08-02 02:50:17 +0200 | [diff] [blame] | 1689 | test_case_29, |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1690 | }; |
| 1691 | |
| 1692 | static const struct log_info_cat log_categories[] = { |
| 1693 | [DHO] = { |
| 1694 | .name = "DHO", |
| 1695 | .description = "Hand-Over Process", |
| 1696 | .color = "\033[1;38m", |
| 1697 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1698 | }, |
| 1699 | [DHODEC] = { |
| 1700 | .name = "DHODEC", |
| 1701 | .description = "Hand-Over Decision", |
| 1702 | .color = "\033[1;38m", |
| 1703 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1704 | }, |
| 1705 | [DMEAS] = { |
| 1706 | .name = "DMEAS", |
| 1707 | .description = "Radio Measurement Processing", |
| 1708 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1709 | }, |
| 1710 | [DREF] = { |
| 1711 | .name = "DREF", |
| 1712 | .description = "Reference Counting", |
| 1713 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1714 | }, |
| 1715 | [DRSL] = { |
| 1716 | .name = "DRSL", |
Keith | d925c7c | 2018-04-16 13:40:07 +0200 | [diff] [blame] | 1717 | .description = "A-bis Radio Signalling Link (RSL)", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1718 | .color = "\033[1;35m", |
| 1719 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1720 | }, |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1721 | [DRR] = { |
| 1722 | .name = "DRR", |
| 1723 | .description = "RR", |
| 1724 | .color = "\033[1;35m", |
| 1725 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1726 | }, |
| 1727 | [DRLL] = { |
| 1728 | .name = "DRLL", |
| 1729 | .description = "RLL", |
| 1730 | .color = "\033[1;35m", |
| 1731 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1732 | }, |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 1733 | [DMSC] = { |
| 1734 | .name = "DMSC", |
| 1735 | .description = "Mobile Switching Center", |
| 1736 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1737 | }, |
Neels Hofmeyr | 3c5612f | 2018-07-11 19:53:39 +0200 | [diff] [blame] | 1738 | [DCHAN] = { |
| 1739 | .name = "DCHAN", |
| 1740 | .description = "lchan FSM", |
| 1741 | .color = "\033[1;32m", |
| 1742 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1743 | }, |
| 1744 | [DTS] = { |
| 1745 | .name = "DTS", |
| 1746 | .description = "timeslot FSM", |
| 1747 | .color = "\033[1;31m", |
| 1748 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1749 | }, |
| 1750 | [DAS] = { |
| 1751 | .name = "DAS", |
| 1752 | .description = "assignment FSM", |
| 1753 | .color = "\033[1;33m", |
| 1754 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1755 | }, |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1756 | }; |
| 1757 | |
| 1758 | const struct log_info log_info = { |
| 1759 | .cat = log_categories, |
| 1760 | .num_cat = ARRAY_SIZE(log_categories), |
| 1761 | }; |
| 1762 | |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1763 | struct gsm_bts *bts_by_num_str(const char *num_str) |
| 1764 | { |
| 1765 | struct gsm_bts *bts = gsm_bts_num(bsc_gsmnet, atoi(num_str)); |
| 1766 | OSMO_ASSERT(bts); |
| 1767 | return bts; |
| 1768 | } |
| 1769 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1770 | int main(int argc, char **argv) |
| 1771 | { |
| 1772 | char **test_case; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1773 | int i; |
Neels Hofmeyr | 958f259 | 2018-05-27 01:26:31 +0200 | [diff] [blame] | 1774 | int algorithm; |
Neels Hofmeyr | 0072755 | 2018-02-21 14:33:15 +0100 | [diff] [blame] | 1775 | int test_case_i; |
| 1776 | int last_test_i; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1777 | |
Neels Hofmeyr | e341618 | 2018-03-05 05:31:14 +0100 | [diff] [blame] | 1778 | ctx = talloc_named_const(NULL, 0, "handover_test"); |
| 1779 | msgb_talloc_ctx_init(ctx, 0); |
| 1780 | |
Neels Hofmeyr | 0072755 | 2018-02-21 14:33:15 +0100 | [diff] [blame] | 1781 | test_case_i = argc > 1? atoi(argv[1]) : -1; |
| 1782 | last_test_i = ARRAY_SIZE(test_cases) - 1; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1783 | |
Neels Hofmeyr | 0072755 | 2018-02-21 14:33:15 +0100 | [diff] [blame] | 1784 | if (test_case_i < 0 || test_case_i > last_test_i) { |
| 1785 | for (i = 0; i <= last_test_i; i++) { |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1786 | printf("Test #%d (algorithm %s):\n%s\n", i, |
| 1787 | test_cases[i][0], test_cases[i][1]); |
| 1788 | } |
Neels Hofmeyr | 0072755 | 2018-02-21 14:33:15 +0100 | [diff] [blame] | 1789 | printf("\nPlease specify test case number 0..%d\n", last_test_i); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1790 | return EXIT_FAILURE; |
| 1791 | } |
| 1792 | |
Neels Hofmeyr | e341618 | 2018-03-05 05:31:14 +0100 | [diff] [blame] | 1793 | osmo_init_logging2(ctx, &log_info); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1794 | |
| 1795 | log_set_print_category(osmo_stderr_target, 1); |
| 1796 | log_set_print_category_hex(osmo_stderr_target, 0); |
| 1797 | log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_BASENAME); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1798 | osmo_fsm_log_addr(false); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1799 | |
Neels Hofmeyr | 958f259 | 2018-05-27 01:26:31 +0200 | [diff] [blame] | 1800 | bsc_network_alloc(); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1801 | if (!bsc_gsmnet) |
| 1802 | exit(1); |
| 1803 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1804 | ts_fsm_init(); |
| 1805 | lchan_fsm_init(); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1806 | bsc_subscr_conn_fsm_init(); |
| 1807 | handover_fsm_init(); |
| 1808 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1809 | ho_set_algorithm(bsc_gsmnet->ho, 2); |
| 1810 | ho_set_ho_active(bsc_gsmnet->ho, true); |
| 1811 | ho_set_hodec2_as_active(bsc_gsmnet->ho, true); |
| 1812 | ho_set_hodec2_min_rxlev(bsc_gsmnet->ho, -100); |
| 1813 | ho_set_hodec2_rxlev_avg_win(bsc_gsmnet->ho, 1); |
| 1814 | ho_set_hodec2_rxlev_neigh_avg_win(bsc_gsmnet->ho, 1); |
| 1815 | ho_set_hodec2_rxqual_avg_win(bsc_gsmnet->ho, 10); |
| 1816 | ho_set_hodec2_pwr_hysteresis(bsc_gsmnet->ho, 3); |
| 1817 | ho_set_hodec2_pwr_interval(bsc_gsmnet->ho, 1); |
| 1818 | ho_set_hodec2_afs_bias_rxlev(bsc_gsmnet->ho, 0); |
| 1819 | ho_set_hodec2_min_rxqual(bsc_gsmnet->ho, 5); |
| 1820 | ho_set_hodec2_afs_bias_rxqual(bsc_gsmnet->ho, 0); |
| 1821 | ho_set_hodec2_max_distance(bsc_gsmnet->ho, 9999); |
| 1822 | ho_set_hodec2_ho_max(bsc_gsmnet->ho, 9999); |
| 1823 | ho_set_hodec2_penalty_max_dist(bsc_gsmnet->ho, 300); |
| 1824 | ho_set_hodec2_penalty_failed_ho(bsc_gsmnet->ho, 60); |
| 1825 | ho_set_hodec2_penalty_failed_as(bsc_gsmnet->ho, 60); |
| 1826 | |
Vadim Yanitskiy | 4f3a641 | 2020-05-31 01:56:20 +0700 | [diff] [blame] | 1827 | /* We don't really need any specific model here */ |
| 1828 | bts_model_unknown_init(); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1829 | |
Neels Hofmeyr | 0072755 | 2018-02-21 14:33:15 +0100 | [diff] [blame] | 1830 | test_case = test_cases[test_case_i]; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1831 | |
| 1832 | fprintf(stderr, "--------------------\n"); |
| 1833 | fprintf(stderr, "Performing the following test %d (algorithm %s):\n%s", |
Neels Hofmeyr | 0072755 | 2018-02-21 14:33:15 +0100 | [diff] [blame] | 1834 | test_case_i, test_case[0], test_case[1]); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1835 | algorithm = atoi(test_case[0]); |
| 1836 | test_case += 2; |
| 1837 | fprintf(stderr, "--------------------\n"); |
| 1838 | |
| 1839 | /* Disable the congestion check timer, we will trigger manually. */ |
| 1840 | bsc_gsmnet->hodec2.congestion_check_interval_s = 0; |
| 1841 | |
| 1842 | handover_decision_1_init(); |
| 1843 | hodec2_init(bsc_gsmnet); |
| 1844 | |
| 1845 | while (*test_case) { |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1846 | if (!strcmp(*test_case, "create-n-bts")) { |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1847 | int n = atoi(test_case[1]); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1848 | for (i = 0; i < n; i++) |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1849 | create_bts(1, bts_default_ts); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1850 | test_case += 2; |
| 1851 | } else |
Neels Hofmeyr | cfbf11f | 2020-11-12 23:12:48 +0100 | [diff] [blame] | 1852 | if (!strcmp(*test_case, "create-bts")) { |
| 1853 | /* new BTS with one TRX: |
| 1854 | * "create-bts", "1", "CCCH+SDCCH4", "TCH/F", "TCH/F", "TCH/F", "TCH/F", "TCH/H", "TCH/H", "PDCH", |
| 1855 | * |
| 1856 | * new BTS with two TRX: |
| 1857 | * "create-bts", "2", "CCCH+SDCCH4", "TCH/F", "TCH/F", "TCH/F", "TCH/F", "TCH/H", "TCH/H", "PDCH", |
| 1858 | * "SDCCH8", "TCH/F", "TCH/F", "TCH/F", "TCH/F", "TCH/H", "TCH/H", "PDCH", |
| 1859 | */ |
| 1860 | int num_trx = atoi(test_case[1]); |
| 1861 | const char * const * ts_cfg = (void*)&test_case[2]; |
| 1862 | create_bts(num_trx, ts_cfg); |
| 1863 | test_case += 2 + 8 * num_trx; |
| 1864 | } else |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1865 | if (!strcmp(*test_case, "as-enable")) { |
| 1866 | fprintf(stderr, "- Set assignment enable state at " |
| 1867 | "BTS %s to %s\n", test_case[1], test_case[2]); |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1868 | ho_set_hodec2_as_active(bts_by_num_str(test_case[1])->ho, atoi(test_case[2])); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1869 | test_case += 3; |
| 1870 | } else |
| 1871 | if (!strcmp(*test_case, "ho-enable")) { |
| 1872 | fprintf(stderr, "- Set handover enable state at " |
| 1873 | "BTS %s to %s\n", test_case[1], test_case[2]); |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1874 | ho_set_ho_active(bts_by_num_str(test_case[1])->ho, atoi(test_case[2])); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1875 | test_case += 3; |
| 1876 | } else |
| 1877 | if (!strcmp(*test_case, "afs-rxlev-improve")) { |
| 1878 | fprintf(stderr, "- Set afs RX level improvement at " |
| 1879 | "BTS %s to %s\n", test_case[1], test_case[2]); |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1880 | ho_set_hodec2_afs_bias_rxlev(bts_by_num_str(test_case[1])->ho, atoi(test_case[2])); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1881 | test_case += 3; |
| 1882 | } else |
| 1883 | if (!strcmp(*test_case, "afs-rxqual-improve")) { |
| 1884 | fprintf(stderr, "- Set afs RX quality improvement at " |
| 1885 | "BTS %s to %s\n", test_case[1], test_case[2]); |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1886 | ho_set_hodec2_afs_bias_rxqual(bts_by_num_str(test_case[1])->ho, atoi(test_case[2])); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1887 | test_case += 3; |
| 1888 | } else |
| 1889 | if (!strcmp(*test_case, "set-min-free")) { |
| 1890 | fprintf(stderr, "- Setting minimum required free %s " |
| 1891 | "slots at BTS %s to %s\n", test_case[2], |
| 1892 | test_case[1], test_case[3]); |
| 1893 | if (!strcmp(test_case[2], "TCH/F")) |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1894 | ho_set_hodec2_tchf_min_slots(bts_by_num_str(test_case[1])->ho, atoi(test_case[3])); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1895 | else |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1896 | ho_set_hodec2_tchh_min_slots(bts_by_num_str(test_case[1])->ho, atoi(test_case[3])); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1897 | test_case += 4; |
| 1898 | } else |
| 1899 | if (!strcmp(*test_case, "set-max-ho")) { |
| 1900 | fprintf(stderr, "- Setting maximum parallel handovers " |
| 1901 | "at BTS %s to %s\n", test_case[1], |
| 1902 | test_case[2]); |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1903 | ho_set_hodec2_ho_max( bts_by_num_str(test_case[1])->ho, atoi(test_case[2])); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1904 | test_case += 3; |
| 1905 | } else |
| 1906 | if (!strcmp(*test_case, "set-max-ta")) { |
| 1907 | fprintf(stderr, "- Setting maximum timing advance " |
| 1908 | "at BTS %s to %s\n", test_case[1], |
| 1909 | test_case[2]); |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1910 | ho_set_hodec2_max_distance(bts_by_num_str(test_case[1])->ho, atoi(test_case[2])); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1911 | test_case += 3; |
| 1912 | } else |
| 1913 | if (!strcmp(*test_case, "create-ms")) { |
Neels Hofmeyr | 7424bd2 | 2020-11-13 05:49:12 +0100 | [diff] [blame^] | 1914 | const char *bts_nr_str = test_case[1]; |
| 1915 | const char *tch_type = test_case[2]; |
| 1916 | const char *codec = test_case[3]; |
| 1917 | struct gsm_lchan *lchan; |
| 1918 | fprintf(stderr, "- Creating mobile at BTS %s on " |
| 1919 | "%s with %s codec\n", bts_nr_str, tch_type, codec); |
| 1920 | lchan = create_lchan(bts_by_num_str(bts_nr_str), |
| 1921 | !strcmp(tch_type, "TCH/F"), codec); |
| 1922 | if (!lchan) { |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1923 | printf("Failed to create lchan!\n"); |
| 1924 | return EXIT_FAILURE; |
| 1925 | } |
| 1926 | fprintf(stderr, " * New MS is at BTS %d TS %d\n", |
Neels Hofmeyr | 7424bd2 | 2020-11-13 05:49:12 +0100 | [diff] [blame^] | 1927 | lchan->ts->trx->bts->nr, |
| 1928 | lchan->ts->nr); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1929 | test_case += 4; |
| 1930 | } else |
| 1931 | if (!strcmp(*test_case, "set-ta")) { |
| 1932 | fprintf(stderr, "- Setting maximum timing advance " |
| 1933 | "at MS %s to %s\n", test_case[1], |
| 1934 | test_case[2]); |
| 1935 | meas_ta_ms = atoi(test_case[2]); |
| 1936 | test_case += 3; |
| 1937 | } else |
| 1938 | if (!strcmp(*test_case, "meas-rep")) { |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1939 | /* meas-rep <bts-nr> <trx-nr> <ts-nr> <lchan-nr> <rxlev> <rxqual> <nr-of-neighbors> [<cell-idx> <rxlev> [...]] */ |
| 1940 | int n; |
| 1941 | struct gsm_bts *bts; |
| 1942 | struct gsm_bts_trx *trx; |
| 1943 | struct gsm_bts_trx_ts *ts; |
| 1944 | struct gsm_lchan *lc; |
| 1945 | int bts_nr = atoi(test_case[1]); |
| 1946 | int trx_nr = atoi(test_case[2]); |
| 1947 | int ts_nr = atoi(test_case[3]); |
| 1948 | int ss_nr = atoi(test_case[4]); |
| 1949 | meas_dl_rxlev = atoi(test_case[5]); |
| 1950 | meas_dl_rxqual = atoi(test_case[6]); |
| 1951 | n = atoi(test_case[7]); |
| 1952 | |
| 1953 | bts = gsm_bts_num(bsc_gsmnet, bts_nr); |
| 1954 | trx = gsm_bts_trx_num(bts, trx_nr); |
| 1955 | ts = &trx->ts[ts_nr]; |
| 1956 | lc = &ts->lchan[ss_nr]; |
| 1957 | |
| 1958 | if (!lchan_state_is(lc, LCHAN_ST_ESTABLISHED)) { |
| 1959 | printf("Error: sending measurement report for %d-%d-%d-%d which is in state %s\n", |
| 1960 | bts_nr, trx_nr, ts_nr, ss_nr, |
| 1961 | lchan_state_name(lc)); |
| 1962 | exit(1); |
| 1963 | } |
| 1964 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1965 | fprintf(stderr, "- Sending measurement report from " |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1966 | "%d-%d-%d-%d (rxlev=%d, rxqual=%d)\n", |
| 1967 | bts_nr, trx_nr, ts_nr, ss_nr, |
| 1968 | meas_dl_rxlev, meas_dl_rxqual); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1969 | meas_num_nc = n; |
Neels Hofmeyr | 90d4b98 | 2020-11-13 05:45:53 +0100 | [diff] [blame] | 1970 | test_case += 8; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1971 | for (i = 0; i < n; i++) { |
| 1972 | int nr = atoi(test_case[0]); |
| 1973 | /* since our bts is not in the list of neighbor |
| 1974 | * cells, we need to shift */ |
| 1975 | if (nr >= lc->ts->trx->bts->nr) |
| 1976 | nr++; |
| 1977 | fprintf(stderr, " * Neighbor cell #%s, actual " |
| 1978 | "BTS %d (rxlev=%s)\n", test_case[0], nr, |
| 1979 | test_case[1]); |
| 1980 | meas_bcch_f_nc[i] = atoi(test_case[0]); |
| 1981 | /* bts number, not counting our own */ |
| 1982 | meas_rxlev_nc[i] = atoi(test_case[1]); |
| 1983 | meas_bsic_nc[i] = 0x3f; |
| 1984 | test_case += 2; |
| 1985 | } |
| 1986 | got_chan_req = 0; |
| 1987 | gen_meas_rep(lc); |
| 1988 | } else |
| 1989 | if (!strcmp(*test_case, "congestion-check")) { |
| 1990 | fprintf(stderr, "- Triggering congestion check\n"); |
| 1991 | got_chan_req = 0; |
| 1992 | if (algorithm == 2) |
| 1993 | hodec2_congestion_check(bsc_gsmnet); |
| 1994 | test_case += 1; |
| 1995 | } else |
| 1996 | if (!strcmp(*test_case, "expect-chan")) { |
| 1997 | fprintf(stderr, "- Expecting channel request at BTS %s " |
| 1998 | "TS %s\n", test_case[1], test_case[2]); |
| 1999 | if (!got_chan_req) { |
| 2000 | printf("Test failed, because no channel was " |
| 2001 | "requested\n"); |
| 2002 | return EXIT_FAILURE; |
| 2003 | } |
| 2004 | fprintf(stderr, " * Got channel request at BTS %d " |
| 2005 | "TS %d\n", chan_req_lchan->ts->trx->bts->nr, |
| 2006 | chan_req_lchan->ts->nr); |
| 2007 | if (chan_req_lchan->ts->trx->bts->nr |
| 2008 | != atoi(test_case[1])) { |
| 2009 | printf("Test failed, because channel was not " |
| 2010 | "requested on expected BTS\n"); |
| 2011 | return EXIT_FAILURE; |
| 2012 | } |
| 2013 | if (chan_req_lchan->ts->nr != atoi(test_case[2])) { |
| 2014 | printf("Test failed, because channel was not " |
| 2015 | "requested on expected TS\n"); |
| 2016 | return EXIT_FAILURE; |
| 2017 | } |
| 2018 | test_case += 3; |
| 2019 | } else |
| 2020 | if (!strcmp(*test_case, "expect-no-chan")) { |
| 2021 | fprintf(stderr, "- Expecting no channel request\n"); |
| 2022 | if (got_chan_req) { |
| 2023 | fprintf(stderr, " * Got channel request at " |
| 2024 | "BTS %d TS %d\n", |
| 2025 | chan_req_lchan->ts->trx->bts->nr, |
| 2026 | chan_req_lchan->ts->nr); |
| 2027 | printf("Test failed, because channel was " |
| 2028 | "requested\n"); |
| 2029 | return EXIT_FAILURE; |
| 2030 | } |
| 2031 | fprintf(stderr, " * Got no channel request\n"); |
| 2032 | test_case += 1; |
| 2033 | } else |
| 2034 | if (!strcmp(*test_case, "expect-ho")) { |
| 2035 | fprintf(stderr, "- Expecting handover/assignment " |
| 2036 | "request at BTS %s TS %s\n", test_case[1], |
| 2037 | test_case[2]); |
| 2038 | if (!got_ho_req) { |
| 2039 | printf("Test failed, because no handover was " |
| 2040 | "requested\n"); |
| 2041 | return EXIT_FAILURE; |
| 2042 | } |
| 2043 | fprintf(stderr, " * Got handover/assignment request at " |
| 2044 | "BTS %d TS %d\n", |
| 2045 | ho_req_lchan->ts->trx->bts->nr, |
| 2046 | ho_req_lchan->ts->nr); |
| 2047 | if (ho_req_lchan->ts->trx->bts->nr |
| 2048 | != atoi(test_case[1])) { |
| 2049 | printf("Test failed, because " |
| 2050 | "handover/assignment was not commanded " |
| 2051 | "at the expected BTS\n"); |
| 2052 | return EXIT_FAILURE; |
| 2053 | } |
| 2054 | if (ho_req_lchan->ts->nr != atoi(test_case[2])) { |
| 2055 | printf("Test failed, because " |
| 2056 | "handover/assignment was not commanded " |
| 2057 | "at the expected TS\n"); |
| 2058 | return EXIT_FAILURE; |
| 2059 | } |
| 2060 | test_case += 3; |
| 2061 | } else |
| 2062 | if (!strcmp(*test_case, "ack-chan")) { |
| 2063 | fprintf(stderr, "- Acknowledging channel request\n"); |
| 2064 | if (!got_chan_req) { |
| 2065 | printf("Cannot ack channel, because no " |
| 2066 | "request\n"); |
| 2067 | return EXIT_FAILURE; |
| 2068 | } |
| 2069 | test_case += 1; |
| 2070 | got_ho_req = 0; |
| 2071 | send_chan_act_ack(chan_req_lchan, 1); |
| 2072 | } else |
| 2073 | if (!strcmp(*test_case, "ho-complete")) { |
| 2074 | fprintf(stderr, "- Acknowledging handover/assignment " |
| 2075 | "request\n"); |
| 2076 | if (!got_chan_req) { |
| 2077 | printf("Cannot ack handover/assignment, " |
| 2078 | "because no chan request\n"); |
| 2079 | return EXIT_FAILURE; |
| 2080 | } |
| 2081 | if (!got_ho_req) { |
| 2082 | printf("Cannot ack handover/assignment, " |
| 2083 | "because no ho request\n"); |
| 2084 | return EXIT_FAILURE; |
| 2085 | } |
| 2086 | test_case += 1; |
| 2087 | got_chan_req = 0; |
| 2088 | got_ho_req = 0; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 2089 | send_ho_complete(chan_req_lchan, true); |
| 2090 | } else |
| 2091 | if (!strcmp(*test_case, "ho-failed")) { |
| 2092 | fprintf(stderr, "- Making handover fail\n"); |
| 2093 | if (!got_chan_req) { |
| 2094 | printf("Cannot fail handover, because no chan " |
| 2095 | "request\n"); |
| 2096 | return EXIT_FAILURE; |
| 2097 | } |
| 2098 | test_case += 1; |
| 2099 | got_chan_req = 0; |
| 2100 | got_ho_req = 0; |
| 2101 | send_ho_complete(ho_req_lchan, false); |
| 2102 | } else |
Neels Hofmeyr | 4366654 | 2020-11-13 01:12:34 +0100 | [diff] [blame] | 2103 | if (!strcmp(*test_case, "expect-ts-use")) { |
| 2104 | /* expect-ts-use <bts-nr> <trx-nr> 8x<ts-use> |
| 2105 | * e.g. |
| 2106 | * expect-ts-use 0 0 - TCH/F - - TCH/H- TCH/HH TCH/-H PDCH |
| 2107 | * TCH/F: one FR call. |
| 2108 | * TCH/H-: HR TS with first subslot used as TCH/H, other subslot unused. |
| 2109 | * TCH/HH: HR TS with both subslots used as TCH/H |
| 2110 | * TCH/-H: HR TS with only second subslot used as TCH/H |
| 2111 | * PDCH: TS used for PDCH (e.g. unused dynamic TS) |
| 2112 | */ |
| 2113 | int bts_nr = atoi(test_case[1]); |
| 2114 | int trx_nr = atoi(test_case[2]); |
| 2115 | const char * const * ts_use = (void*)&test_case[3]; |
| 2116 | if (!expect_ts_use(bts_nr, trx_nr, ts_use)) |
| 2117 | return EXIT_FAILURE; |
| 2118 | test_case += 1 + 2 + 8; |
| 2119 | } else |
Neels Hofmeyr | 5531fae | 2020-11-13 03:43:57 +0100 | [diff] [blame] | 2120 | if (!strcmp(*test_case, "set-ts-use")) { |
| 2121 | /* set-ts-use <bts-nr> <trx-nr> 8x<ts-use> |
| 2122 | * e.g. |
| 2123 | * set-ts-use 0 0 * TCH/F - - TCH/H- TCH/HH TCH/-H PDCH |
| 2124 | * '*': keep as is |
| 2125 | * TCH/F: one FR call. |
| 2126 | * TCH/H-: HR TS with first subslot used as TCH/H, other subslot unused. |
| 2127 | * TCH/HH: HR TS with both subslots used as TCH/H |
| 2128 | * TCH/-H: HR TS with only second subslot used as TCH/H |
| 2129 | * PDCH: TS used for PDCH (e.g. unused dynamic TS) |
| 2130 | */ |
| 2131 | int bts_nr = atoi(test_case[1]); |
| 2132 | int trx_nr = atoi(test_case[2]); |
| 2133 | const char * const * ts_use = (void*)&test_case[3]; |
| 2134 | if (!set_ts_use(bts_nr, trx_nr, ts_use)) |
| 2135 | return EXIT_FAILURE; |
| 2136 | if (!expect_ts_use(bts_nr, trx_nr, ts_use)) |
| 2137 | return EXIT_FAILURE; |
| 2138 | test_case += 1 + 2 + 8; |
| 2139 | } else |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 2140 | if (!strcmp(*test_case, "print")) { |
| 2141 | fprintf(stderr, "\n%s\n\n", test_case[1]); |
| 2142 | test_case += 2; |
| 2143 | } else { |
| 2144 | printf("Unknown test command '%s', please fix!\n", |
| 2145 | *test_case); |
| 2146 | return EXIT_FAILURE; |
| 2147 | } |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 2148 | |
| 2149 | { |
| 2150 | /* Help the lchan out of releasing states */ |
| 2151 | struct gsm_bts *bts; |
| 2152 | llist_for_each_entry(bts, &bsc_gsmnet->bts_list, list) { |
| 2153 | struct gsm_bts_trx *trx; |
| 2154 | llist_for_each_entry(trx, &bts->trx_list, list) { |
| 2155 | int ts_nr; |
| 2156 | for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) { |
| 2157 | struct gsm_lchan *lchan; |
| 2158 | ts_for_each_lchan(lchan, &trx->ts[ts_nr]) { |
| 2159 | |
| 2160 | if (lchan->fi && lchan->fi->state == LCHAN_ST_WAIT_BEFORE_RF_RELEASE) { |
| 2161 | osmo_fsm_inst_state_chg(lchan->fi, LCHAN_ST_WAIT_RF_RELEASE_ACK, 0, 0); |
| 2162 | osmo_fsm_inst_dispatch(lchan->fi, LCHAN_EV_RSL_RF_CHAN_REL_ACK, 0); |
| 2163 | } |
| 2164 | } |
| 2165 | } |
| 2166 | } |
| 2167 | } |
| 2168 | } |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 2169 | } |
| 2170 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 2171 | fprintf(stderr, "--------------------\n"); |
| 2172 | |
| 2173 | printf("Test OK\n"); |
| 2174 | |
| 2175 | fprintf(stderr, "--------------------\n"); |
| 2176 | |
Neels Hofmeyr | e341618 | 2018-03-05 05:31:14 +0100 | [diff] [blame] | 2177 | talloc_free(ctx); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 2178 | return EXIT_SUCCESS; |
| 2179 | } |
| 2180 | |
| 2181 | void rtp_socket_free() {} |
| 2182 | void rtp_send_frame() {} |
| 2183 | void rtp_socket_upstream() {} |
| 2184 | void rtp_socket_create() {} |
| 2185 | void rtp_socket_connect() {} |
| 2186 | void rtp_socket_proxy() {} |
| 2187 | void trau_mux_unmap() {} |
| 2188 | void trau_mux_map_lchan() {} |
| 2189 | void trau_recv_lchan() {} |
| 2190 | void trau_send_frame() {} |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 2191 | int osmo_bsc_sigtran_send(struct gsm_subscriber_connection *conn, struct msgb *msg) { return 0; } |
| 2192 | int osmo_bsc_sigtran_open_conn(struct gsm_subscriber_connection *conn, struct msgb *msg) { return 0; } |
Vadim Yanitskiy | 6a26e2c | 2020-08-26 18:49:08 +0700 | [diff] [blame] | 2193 | void bsc_sapi_n_reject(struct gsm_subscriber_connection *conn, uint8_t dlci, enum gsm0808_cause cause) {} |
Neels Hofmeyr | c19581f | 2018-05-27 03:05:18 +0200 | [diff] [blame] | 2194 | void bsc_cipher_mode_compl(struct gsm_subscriber_connection *conn, struct msgb *msg, uint8_t chosen_encr) {} |
Neels Hofmeyr | 2001dd6 | 2020-09-11 23:35:28 +0000 | [diff] [blame] | 2195 | int bsc_compl_l3(struct gsm_lchan *lchan, struct msgb *msg, uint16_t chosen_channel) |
Neels Hofmeyr | c19581f | 2018-05-27 03:05:18 +0200 | [diff] [blame] | 2196 | { return 0; } |
Neels Hofmeyr | 86ce105 | 2020-09-18 02:49:32 +0200 | [diff] [blame] | 2197 | int bsc_paging_start(struct bsc_paging_params *params) |
| 2198 | { return 0; } |
Neels Hofmeyr | c19581f | 2018-05-27 03:05:18 +0200 | [diff] [blame] | 2199 | void bsc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, struct msgb *msg) {} |
| 2200 | void bsc_assign_compl(struct gsm_subscriber_connection *conn, uint8_t rr_cause) {} |
Neels Hofmeyr | c19581f | 2018-05-27 03:05:18 +0200 | [diff] [blame] | 2201 | void bsc_cm_update(struct gsm_subscriber_connection *conn, |
| 2202 | const uint8_t *cm2, uint8_t cm2_len, |
| 2203 | const uint8_t *cm3, uint8_t cm3_len) {} |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 2204 | struct gsm0808_handover_required; |
| 2205 | int bsc_tx_bssmap_ho_required(struct gsm_lchan *lchan, const struct gsm0808_cell_id_list2 *target_cells) |
| 2206 | { return 0; } |
| 2207 | int bsc_tx_bssmap_ho_request_ack(struct gsm_subscriber_connection *conn, struct msgb *rr_ho_command) |
| 2208 | { return 0; } |
| 2209 | int bsc_tx_bssmap_ho_detect(struct gsm_subscriber_connection *conn) { return 0; } |
| 2210 | enum handover_result bsc_tx_bssmap_ho_complete(struct gsm_subscriber_connection *conn, |
| 2211 | struct gsm_lchan *lchan) { return HO_RESULT_OK; } |
| 2212 | void bsc_tx_bssmap_ho_failure(struct gsm_subscriber_connection *conn) {} |
Neels Hofmeyr | c27ae2d | 2020-10-04 21:32:52 +0200 | [diff] [blame] | 2213 | void osmo_bsc_sigtran_tx_reset(void) {} |
Neels Hofmeyr | e95b92b | 2020-10-09 17:18:29 +0200 | [diff] [blame] | 2214 | void osmo_bsc_sigtran_tx_reset_ack(void) {} |
Neels Hofmeyr | c27ae2d | 2020-10-04 21:32:52 +0200 | [diff] [blame] | 2215 | void osmo_bsc_sigtran_reset(void) {} |
| 2216 | void bssmap_reset_alloc(void) {} |
| 2217 | void bssmap_reset_is_conn_ready(void) {} |