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 | |
| 276 | void create_conn(struct gsm_lchan *lchan) |
| 277 | { |
Neels Hofmeyr | bb6c13b | 2018-05-24 18:43:58 +0200 | [diff] [blame] | 278 | static unsigned int next_imsi = 0; |
| 279 | char imsi[sizeof(lchan->conn->bsub->imsi)]; |
| 280 | struct gsm_network *net = lchan->ts->trx->bts->network; |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 281 | struct gsm_subscriber_connection *conn; |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 282 | struct mgcp_client *fake_mgcp_client = (void*)talloc_zero(net, int); |
Neels Hofmeyr | bb6c13b | 2018-05-24 18:43:58 +0200 | [diff] [blame] | 283 | |
| 284 | conn = bsc_subscr_con_allocate(net); |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 285 | |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 286 | conn->user_plane.mgw_endpoint = osmo_mgcpc_ep_alloc(conn->fi, |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 287 | GSCON_EV_FORGET_MGW_ENDPOINT, |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 288 | fake_mgcp_client, |
| 289 | net->mgw.tdefs, |
| 290 | "test", |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 291 | "fake endpoint"); |
Alexander Chemeris | 69ba8be | 2020-05-10 22:48:01 +0300 | [diff] [blame] | 292 | conn->sccp.msc = osmo_msc_data_alloc(net, 0); |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 293 | |
| 294 | lchan->conn = conn; |
| 295 | conn->lchan = lchan; |
Neels Hofmeyr | bb6c13b | 2018-05-24 18:43:58 +0200 | [diff] [blame] | 296 | |
| 297 | /* Make up a new IMSI for this test, for logging the subscriber */ |
| 298 | next_imsi ++; |
| 299 | snprintf(imsi, sizeof(imsi), "%06u", next_imsi); |
Neels Hofmeyr | 86a1dca | 2020-09-15 01:03:58 +0000 | [diff] [blame] | 300 | 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] | 301 | |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 302 | /* kick the FSM from INIT through to the ACTIVE state */ |
Neels Hofmeyr | d1e7d39 | 2020-09-27 23:34:57 +0200 | [diff] [blame] | 303 | osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_MO_COMPL_L3, NULL); |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 304 | osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_A_CONN_CFM, NULL); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | /* create lchan */ |
| 308 | struct gsm_lchan *create_lchan(struct gsm_bts *bts, int full_rate, char *codec) |
| 309 | { |
| 310 | struct gsm_lchan *lchan; |
| 311 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 312 | lchan = lchan_select_by_type(bts, (full_rate) ? GSM_LCHAN_TCH_F : GSM_LCHAN_TCH_H); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 313 | if (!lchan) { |
| 314 | printf("No resource for lchan\n"); |
| 315 | exit(EXIT_FAILURE); |
| 316 | } |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 317 | |
| 318 | /* serious hack into osmo_fsm */ |
| 319 | lchan->fi->state = LCHAN_ST_ESTABLISHED; |
| 320 | lchan->ts->fi->state = TS_ST_IN_USE; |
Neels Hofmeyr | fb6d9dc | 2020-11-13 01:13:20 +0100 | [diff] [blame^] | 321 | |
| 322 | if (lchan->ts->pchan_on_init == GSM_PCHAN_TCH_F_TCH_H_PDCH) |
| 323 | lchan->ts->pchan_is = full_rate ? GSM_PCHAN_TCH_F : GSM_PCHAN_TCH_H; |
| 324 | if (lchan->ts->pchan_on_init == GSM_PCHAN_TCH_F_PDCH) { |
| 325 | OSMO_ASSERT(full_rate); |
| 326 | lchan->ts->pchan_is = GSM_PCHAN_TCH_F; |
| 327 | } |
| 328 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 329 | LOG_LCHAN(lchan, LOGL_DEBUG, "activated by handover_test.c\n"); |
| 330 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 331 | create_conn(lchan); |
| 332 | if (!strcasecmp(codec, "FR") && full_rate) |
| 333 | lchan->tch_mode = GSM48_CMODE_SPEECH_V1; |
| 334 | else if (!strcasecmp(codec, "HR") && !full_rate) |
| 335 | lchan->tch_mode = GSM48_CMODE_SPEECH_V1; |
| 336 | else if (!strcasecmp(codec, "EFR") && full_rate) |
| 337 | lchan->tch_mode = GSM48_CMODE_SPEECH_EFR; |
Philipp Maier | eda6bfa | 2019-03-11 14:10:26 +0100 | [diff] [blame] | 338 | else if (!strcasecmp(codec, "AMR")) { |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 339 | lchan->tch_mode = GSM48_CMODE_SPEECH_AMR; |
Philipp Maier | eda6bfa | 2019-03-11 14:10:26 +0100 | [diff] [blame] | 340 | lchan->activate.info.s15_s0 = 0x0002; |
| 341 | } else { |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 342 | printf("Given codec unknown\n"); |
| 343 | exit(EXIT_FAILURE); |
| 344 | } |
| 345 | |
| 346 | lchan->conn->codec_list = (struct gsm0808_speech_codec_list){ |
| 347 | .codec = { |
| 348 | { .fi=true, .type=GSM0808_SCT_FR1, }, |
| 349 | { .fi=true, .type=GSM0808_SCT_FR2, }, |
| 350 | { .fi=true, .type=GSM0808_SCT_FR3, }, |
| 351 | { .fi=true, .type=GSM0808_SCT_HR1, }, |
| 352 | { .fi=true, .type=GSM0808_SCT_HR3, }, |
| 353 | }, |
| 354 | .len = 5, |
| 355 | }; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 356 | |
| 357 | return lchan; |
| 358 | } |
| 359 | |
| 360 | /* parse channel request */ |
| 361 | |
| 362 | static int got_chan_req = 0; |
| 363 | static struct gsm_lchan *chan_req_lchan = NULL; |
| 364 | |
| 365 | static int parse_chan_act(struct gsm_lchan *lchan, uint8_t *data) |
| 366 | { |
| 367 | chan_req_lchan = lchan; |
| 368 | return 0; |
| 369 | } |
| 370 | |
| 371 | static int parse_chan_rel(struct gsm_lchan *lchan, uint8_t *data) |
| 372 | { |
| 373 | chan_req_lchan = lchan; |
| 374 | return 0; |
| 375 | } |
| 376 | |
| 377 | /* parse handover request */ |
| 378 | |
| 379 | static int got_ho_req = 0; |
| 380 | static struct gsm_lchan *ho_req_lchan = NULL; |
| 381 | |
| 382 | static int parse_ho_command(struct gsm_lchan *lchan, uint8_t *data, int len) |
| 383 | { |
| 384 | struct gsm48_hdr *gh = (struct gsm48_hdr *) data; |
| 385 | struct gsm48_ho_cmd *ho = (struct gsm48_ho_cmd *) gh->data; |
| 386 | int arfcn; |
| 387 | struct gsm_bts *neigh; |
| 388 | |
| 389 | switch (gh->msg_type) { |
| 390 | case GSM48_MT_RR_HANDO_CMD: |
| 391 | arfcn = (ho->cell_desc.arfcn_hi << 8) | ho->cell_desc.arfcn_lo; |
| 392 | |
| 393 | /* look up trx. since every dummy bts uses different arfcn and |
| 394 | * only one trx, it is simple */ |
| 395 | llist_for_each_entry(neigh, &bsc_gsmnet->bts_list, list) { |
| 396 | if (neigh->c0->arfcn != arfcn) |
| 397 | continue; |
| 398 | ho_req_lchan = lchan; |
| 399 | return 0; |
| 400 | } |
| 401 | break; |
| 402 | case GSM48_MT_RR_ASS_CMD: |
| 403 | ho_req_lchan = lchan; |
| 404 | return 0; |
| 405 | break; |
| 406 | default: |
| 407 | fprintf(stderr, "Error, expecting HO or AS command\n"); |
| 408 | return -EINVAL; |
| 409 | } |
| 410 | |
| 411 | return -1; |
| 412 | } |
| 413 | |
| 414 | /* send channel activation ack */ |
| 415 | static void send_chan_act_ack(struct gsm_lchan *lchan, int act) |
| 416 | { |
| 417 | struct msgb *msg = msgb_alloc_headroom(256, 64, "RSL"); |
| 418 | struct abis_rsl_dchan_hdr *dh; |
| 419 | |
| 420 | dh = (struct abis_rsl_dchan_hdr *) msgb_put(msg, sizeof(*dh)); |
| 421 | dh->c.msg_discr = ABIS_RSL_MDISC_DED_CHAN; |
| 422 | dh->c.msg_type = (act) ? RSL_MT_CHAN_ACTIV_ACK : RSL_MT_RF_CHAN_REL_ACK; |
| 423 | dh->ie_chan = RSL_IE_CHAN_NR; |
| 424 | dh->chan_nr = gsm_lchan2chan_nr(lchan); |
| 425 | |
| 426 | msg->dst = lchan->ts->trx->bts->c0->rsl_link; |
| 427 | msg->l2h = (unsigned char *)dh; |
| 428 | |
| 429 | abis_rsl_rcvmsg(msg); |
| 430 | } |
| 431 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 432 | /* Send RLL Est Ind for SAPI[0] */ |
| 433 | static void send_est_ind(struct gsm_lchan *lchan) |
| 434 | { |
| 435 | struct msgb *msg = msgb_alloc_headroom(256, 64, "RSL"); |
| 436 | struct abis_rsl_rll_hdr *rh; |
| 437 | uint8_t chan_nr = gsm_lchan2chan_nr(lchan); |
| 438 | |
| 439 | rh = (struct abis_rsl_rll_hdr *) msgb_put(msg, sizeof(*rh)); |
| 440 | rh->c.msg_discr = ABIS_RSL_MDISC_RLL; |
| 441 | rh->c.msg_type = RSL_MT_EST_IND; |
| 442 | rh->ie_chan = RSL_IE_CHAN_NR; |
| 443 | rh->chan_nr = chan_nr; |
| 444 | rh->ie_link_id = RSL_IE_LINK_IDENT; |
| 445 | rh->link_id = 0x00; |
| 446 | |
| 447 | msg->dst = lchan->ts->trx->bts->c0->rsl_link; |
| 448 | msg->l2h = (unsigned char *)rh; |
| 449 | |
| 450 | abis_rsl_rcvmsg(msg); |
| 451 | } |
| 452 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 453 | /* send handover complete */ |
| 454 | static void send_ho_complete(struct gsm_lchan *lchan, bool success) |
| 455 | { |
| 456 | struct msgb *msg = msgb_alloc_headroom(256, 64, "RSL"); |
| 457 | struct abis_rsl_rll_hdr *rh; |
| 458 | uint8_t chan_nr = gsm_lchan2chan_nr(lchan); |
| 459 | uint8_t *buf; |
| 460 | struct gsm48_hdr *gh; |
| 461 | struct gsm48_ho_cpl *hc; |
| 462 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 463 | send_est_ind(lchan); |
Neels Hofmeyr | ac85b34 | 2018-07-12 21:23:26 +0200 | [diff] [blame] | 464 | osmo_fsm_inst_dispatch(lchan->fi, LCHAN_EV_RTP_READY, 0); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 465 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 466 | rh = (struct abis_rsl_rll_hdr *) msgb_put(msg, sizeof(*rh)); |
| 467 | rh->c.msg_discr = ABIS_RSL_MDISC_RLL; |
| 468 | rh->c.msg_type = RSL_MT_DATA_IND; |
| 469 | rh->ie_chan = RSL_IE_CHAN_NR; |
| 470 | rh->chan_nr = chan_nr; |
| 471 | rh->ie_link_id = RSL_IE_LINK_IDENT; |
| 472 | rh->link_id = 0x00; |
| 473 | |
| 474 | buf = msgb_put(msg, 3); |
| 475 | buf[0] = RSL_IE_L3_INFO; |
| 476 | buf[1] = (sizeof(*gh) + sizeof(*hc)) >> 8; |
| 477 | buf[2] = (sizeof(*gh) + sizeof(*hc)) & 0xff; |
| 478 | |
| 479 | gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh)); |
| 480 | hc = (struct gsm48_ho_cpl *) msgb_put(msg, sizeof(*hc)); |
| 481 | |
| 482 | gh->proto_discr = GSM48_PDISC_RR; |
| 483 | gh->msg_type = |
| 484 | success ? GSM48_MT_RR_HANDO_COMPL : GSM48_MT_RR_HANDO_FAIL; |
| 485 | |
| 486 | msg->dst = lchan->ts->trx->bts->c0->rsl_link; |
| 487 | msg->l2h = (unsigned char *)rh; |
| 488 | msg->l3h = (unsigned char *)gh; |
| 489 | |
| 490 | abis_rsl_rcvmsg(msg); |
| 491 | } |
| 492 | |
Neels Hofmeyr | 1d7473c | 2018-03-05 21:53:18 +0100 | [diff] [blame] | 493 | /* override, requires '-Wl,--wrap=abis_rsl_sendmsg'. |
| 494 | * Catch RSL messages sent towards the BTS. */ |
| 495 | int __real_abis_rsl_sendmsg(struct msgb *msg); |
| 496 | int __wrap_abis_rsl_sendmsg(struct msgb *msg) |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 497 | { |
| 498 | struct abis_rsl_dchan_hdr *dh = (struct abis_rsl_dchan_hdr *) msg->data; |
| 499 | struct e1inp_sign_link *sign_link = msg->dst; |
| 500 | int rc; |
| 501 | 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^] | 502 | struct gsm_lchan *other_lchan; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 503 | |
| 504 | if (rc) { |
| 505 | printf("rsl_lchan_lookup() failed\n"); |
| 506 | exit(1); |
| 507 | } |
| 508 | |
| 509 | switch (dh->c.msg_type) { |
| 510 | case RSL_MT_CHAN_ACTIV: |
| 511 | rc = parse_chan_act(lchan, dh->data); |
| 512 | if (rc == 0) |
| 513 | got_chan_req = 1; |
| 514 | break; |
| 515 | case RSL_MT_RF_CHAN_REL: |
| 516 | rc = parse_chan_rel(lchan, dh->data); |
| 517 | if (rc == 0) |
| 518 | send_chan_act_ack(chan_req_lchan, 0); |
Neels Hofmeyr | fb6d9dc | 2020-11-13 01:13:20 +0100 | [diff] [blame^] | 519 | |
| 520 | /* send dyn TS back to PDCH if unused */ |
| 521 | switch (chan_req_lchan->ts->pchan_on_init) { |
| 522 | case GSM_PCHAN_TCH_F_TCH_H_PDCH: |
| 523 | case GSM_PCHAN_TCH_F_PDCH: |
| 524 | switch (chan_req_lchan->ts->pchan_is) { |
| 525 | case GSM_PCHAN_TCH_H: |
| 526 | other_lchan = &chan_req_lchan->ts->lchan[ |
| 527 | (chan_req_lchan == &chan_req_lchan->ts->lchan[0])? |
| 528 | 1 : 0]; |
| 529 | if (lchan_state_is(other_lchan, LCHAN_ST_ESTABLISHED)) |
| 530 | break; |
| 531 | /* else fall thru */ |
| 532 | case GSM_PCHAN_TCH_F: |
| 533 | chan_req_lchan->ts->pchan_is = GSM_PCHAN_PDCH; |
| 534 | break; |
| 535 | default: |
| 536 | break; |
| 537 | } |
| 538 | break; |
| 539 | default: |
| 540 | break; |
| 541 | } |
| 542 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 543 | break; |
| 544 | case RSL_MT_DATA_REQ: |
| 545 | rc = parse_ho_command(lchan, msg->l3h, msgb_l3len(msg)); |
| 546 | if (rc == 0) |
| 547 | got_ho_req = 1; |
| 548 | break; |
| 549 | case RSL_MT_IPAC_CRCX: |
| 550 | break; |
Neels Hofmeyr | 5b1a7d1 | 2018-11-06 22:24:07 +0100 | [diff] [blame] | 551 | case RSL_MT_DEACTIVATE_SACCH: |
| 552 | break; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 553 | default: |
| 554 | printf("unknown rsl message=0x%x\n", dh->c.msg_type); |
| 555 | } |
| 556 | return 0; |
| 557 | } |
| 558 | |
| 559 | /* test cases */ |
| 560 | |
| 561 | static char *test_case_0[] = { |
| 562 | "2", |
| 563 | |
| 564 | "Stay in better cell\n\n" |
| 565 | "There are many neighbor cells, but only the current cell is the best\n" |
| 566 | "cell, so no handover is performed\n", |
| 567 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 568 | "create-n-bts", "7", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 569 | "create-ms", "0", "TCH/F", "AMR", |
| 570 | "meas-rep", "0", "30","0", |
| 571 | "6","0","20","1","21","2","18","3","20","4","23","5","19", |
| 572 | "expect-no-chan", |
| 573 | NULL |
| 574 | }; |
| 575 | |
| 576 | static char *test_case_1[] = { |
| 577 | "2", |
| 578 | |
| 579 | "Handover to best better cell\n\n" |
| 580 | "The best neighbor cell is selected\n", |
| 581 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 582 | "create-n-bts", "7", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 583 | "create-ms", "0", "TCH/F", "AMR", |
| 584 | "meas-rep", "0", "10","0", |
| 585 | "6","0","20","1","21","2","18","3","20","4","23","5","19", |
| 586 | "expect-chan", "5", "1", |
| 587 | "ack-chan", |
| 588 | "expect-ho", "0", "1", |
| 589 | "ho-complete", |
| 590 | NULL |
| 591 | }; |
| 592 | |
| 593 | static char *test_case_2[] = { |
| 594 | "2", |
| 595 | |
| 596 | "Handover and Assignment must be enabled\n\n" |
| 597 | "This test will start with disabled assignment and handover. A\n" |
| 598 | "better neighbor cell (assignment enabled) will not be selected and \n" |
| 599 | "also no assignment from TCH/H to TCH/F to improve quality. There\n" |
| 600 | "will be no handover nor assignment. After enabling assignment on the\n" |
| 601 | "current cell, the MS will assign to TCH/F. After enabling handover\n" |
| 602 | "in the current cell, but disabling in the neighbor cell, handover\n" |
| 603 | "will not be performed, until it is enabled in the neighbor cell too.\n", |
| 604 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 605 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 606 | "afs-rxlev-improve", "0", "5", |
| 607 | "create-ms", "0", "TCH/H", "AMR", |
| 608 | "as-enable", "0", "0", |
| 609 | "ho-enable", "0", "0", |
| 610 | "meas-rep", "0", "0","0", "1","0","30", |
| 611 | "expect-no-chan", |
| 612 | "as-enable", "0", "1", |
| 613 | "meas-rep", "0", "0","0", "1","0","30", |
| 614 | "expect-chan", "0", "1", |
| 615 | "ack-chan", |
| 616 | "expect-ho", "0", "5", |
| 617 | "ho-complete", |
| 618 | "ho-enable", "0", "1", |
| 619 | "ho-enable", "1", "0", |
| 620 | "meas-rep", "0", "0","0", "1","0","30", |
| 621 | "expect-no-chan", |
| 622 | "ho-enable", "1", "1", |
| 623 | "meas-rep", "0", "0","0", "1","0","30", |
| 624 | "expect-chan", "1", "1", |
| 625 | "ack-chan", |
| 626 | "expect-ho", "0", "1", |
| 627 | "ho-complete", |
| 628 | NULL |
| 629 | }; |
| 630 | |
| 631 | static char *test_case_3[] = { |
| 632 | "2", |
| 633 | |
| 634 | "Penalty timer must not run\n\n" |
| 635 | "The MS will try to handover to a better cell, but this will fail.\n" |
| 636 | "Even though the cell is still better, handover will not be performed\n" |
| 637 | "due to penalty timer after handover failure\n", |
| 638 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 639 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 640 | "create-ms", "0", "TCH/F", "AMR", |
| 641 | "meas-rep", "0", "20","0", "1","0","30", |
| 642 | "expect-chan", "1", "1", |
| 643 | "ack-chan", |
| 644 | "expect-ho", "0", "1", |
| 645 | "ho-failed", |
| 646 | "meas-rep", "0", "20","0", "1","0","30", |
| 647 | "expect-no-chan", |
| 648 | NULL |
| 649 | }; |
| 650 | |
| 651 | static char *test_case_4[] = { |
| 652 | "2", |
| 653 | |
| 654 | "TCH/H keeping with HR codec\n\n" |
| 655 | "The MS is using half rate V1 codec, but the better cell is congested\n" |
| 656 | "at TCH/H slots. As the congestion is removed, the handover takes\n" |
| 657 | "place.\n", |
| 658 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 659 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 660 | "set-min-free", "1", "TCH/H", "4", |
| 661 | "create-ms", "0", "TCH/H", "HR", |
| 662 | "meas-rep", "0", "20","0", "1","0","30", |
| 663 | "expect-no-chan", |
| 664 | "set-min-free", "1", "TCH/H", "3", |
| 665 | "meas-rep", "0", "20","0", "1","0","30", |
| 666 | "expect-chan", "1", "5", |
| 667 | "ack-chan", |
| 668 | "expect-ho", "0", "5", |
| 669 | "ho-complete", |
| 670 | NULL |
| 671 | }; |
| 672 | |
| 673 | static char *test_case_5[] = { |
| 674 | "2", |
| 675 | |
| 676 | "TCH/F keeping with FR codec\n\n" |
| 677 | "The MS is using full rate V1 codec, but the better cell is congested\n" |
| 678 | "at TCH/F slots. As the congestion is removed, the handover takes\n" |
| 679 | "place.\n", |
| 680 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 681 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 682 | "set-min-free", "1", "TCH/F", "4", |
| 683 | "create-ms", "0", "TCH/F", "FR", |
| 684 | "meas-rep", "0", "20","0", "1","0","30", |
| 685 | "expect-no-chan", |
| 686 | "set-min-free", "1", "TCH/F", "3", |
| 687 | "meas-rep", "0", "20","0", "1","0","30", |
| 688 | "expect-chan", "1", "1", |
| 689 | "ack-chan", |
| 690 | "expect-ho", "0", "1", |
| 691 | "ho-complete", |
| 692 | NULL |
| 693 | }; |
| 694 | |
| 695 | static char *test_case_6[] = { |
| 696 | "2", |
| 697 | |
| 698 | "TCH/F keeping with EFR codec\n\n" |
| 699 | "The MS is using full rate V2 codec, but the better cell is congested\n" |
| 700 | "at TCH/F slots. As the congestion is removed, the handover takes\n" |
| 701 | "place.\n", |
| 702 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 703 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 704 | "set-min-free", "1", "TCH/F", "4", |
| 705 | "create-ms", "0", "TCH/F", "EFR", |
| 706 | "meas-rep", "0", "20","0", "1","0","30", |
| 707 | "expect-no-chan", |
| 708 | "set-min-free", "1", "TCH/F", "3", |
| 709 | "meas-rep", "0", "20","0", "1","0","30", |
| 710 | "expect-chan", "1", "1", |
| 711 | "ack-chan", |
| 712 | "expect-ho", "0", "1", |
| 713 | "ho-complete", |
| 714 | NULL |
| 715 | }; |
| 716 | |
| 717 | static char *test_case_7[] = { |
| 718 | "2", |
| 719 | |
| 720 | "TCH/F to TCH/H changing with AMR codec\n\n" |
| 721 | "The MS is using AMR V3 codec, the better cell is congested at TCH/F\n" |
| 722 | "slots. The handover is performed to non-congested TCH/H slots.\n", |
| 723 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 724 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 725 | "set-min-free", "1", "TCH/F", "4", |
| 726 | "create-ms", "0", "TCH/F", "AMR", |
| 727 | "meas-rep", "0", "20","0", "1","0","30", |
| 728 | "expect-chan", "1", "5", |
| 729 | "ack-chan", |
| 730 | "expect-ho", "0", "1", |
| 731 | "ho-complete", |
| 732 | NULL |
| 733 | }; |
| 734 | |
| 735 | static char *test_case_8[] = { |
| 736 | "2", |
| 737 | |
| 738 | "No handover to a cell with no slots available\n\n" |
| 739 | "If no slot is available, no handover is performed\n", |
| 740 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 741 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 742 | "create-ms", "0", "TCH/F", "AMR", |
| 743 | "create-ms", "1", "TCH/F", "AMR", |
| 744 | "create-ms", "1", "TCH/F", "AMR", |
| 745 | "create-ms", "1", "TCH/F", "AMR", |
| 746 | "create-ms", "1", "TCH/F", "AMR", |
| 747 | "create-ms", "1", "TCH/H", "AMR", |
| 748 | "create-ms", "1", "TCH/H", "AMR", |
| 749 | "create-ms", "1", "TCH/H", "AMR", |
| 750 | "create-ms", "1", "TCH/H", "AMR", |
| 751 | "meas-rep", "0", "0","0", "1","0","30", |
| 752 | "expect-no-chan", |
| 753 | NULL |
| 754 | }; |
| 755 | |
| 756 | static char *test_case_9[] = { |
| 757 | "2", |
| 758 | |
| 759 | "No more parallel handovers, if max_unsync_ho is defined\n\n" |
| 760 | "There are tree mobiles that want to handover, but only two can do\n" |
| 761 | "it at a time, because the maximum number is limited to two.\n", |
| 762 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 763 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 764 | "set-max-ho", "1", "2", |
| 765 | "create-ms", "0", "TCH/F", "AMR", |
| 766 | "create-ms", "0", "TCH/F", "AMR", |
| 767 | "create-ms", "0", "TCH/F", "AMR", |
| 768 | "meas-rep", "0", "0","0", "1","0","30", |
| 769 | "expect-chan", "1", "1", |
| 770 | "meas-rep", "1", "0","0", "1","0","30", |
| 771 | "expect-chan", "1", "2", |
| 772 | "meas-rep", "2", "0","0", "1","0","30", |
| 773 | "expect-no-chan", |
| 774 | NULL |
| 775 | }; |
| 776 | |
| 777 | static char *test_case_10[] = { |
| 778 | "2", |
| 779 | |
| 780 | "Hysteresis\n\n" |
| 781 | "If neighbor cell is better, handover is only performed if the\n" |
Martin Hauke | a29affd | 2019-11-13 22:10:41 +0100 | [diff] [blame] | 782 | "amount of improvement is greater or equal hyteresis\n", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 783 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 784 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 785 | "create-ms", "0", "TCH/F", "AMR", |
| 786 | "meas-rep", "0", "27","0", "1","0","30", |
| 787 | "expect-no-chan", |
| 788 | "meas-rep", "0", "26","0", "1","0","30", |
| 789 | "expect-chan", "1", "1", |
| 790 | "ack-chan", |
| 791 | "expect-ho", "0", "1", |
| 792 | "ho-complete", |
| 793 | NULL |
| 794 | }; |
| 795 | |
| 796 | static char *test_case_11[] = { |
| 797 | "2", |
| 798 | |
| 799 | "No Hysteresis and minimum RX level\n\n" |
| 800 | "If current cell's RX level is below mimium level, handover must be\n" |
| 801 | "performed, no matter of the hysteresis. First do not perform\n" |
| 802 | "handover to better neighbor cell, because the hysteresis is not\n" |
| 803 | "met. Second do not perform handover because better neighbor cell is\n" |
| 804 | "below minimum RX level. Third perform handover because current cell\n" |
| 805 | "is below minimum RX level, even if the better neighbor cell (minimum\n" |
| 806 | "RX level reached) does not meet the hysteresis.\n", |
| 807 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 808 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 809 | "create-ms", "0", "TCH/F", "AMR", |
| 810 | "meas-rep", "0", "10","0", "1","0","11", |
| 811 | "expect-no-chan", |
| 812 | "meas-rep", "0", "8","0", "1","0","9", |
| 813 | "expect-no-chan", |
| 814 | "meas-rep", "0", "9","0", "1","0","10", |
| 815 | "expect-chan", "1", "1", |
| 816 | "ack-chan", |
| 817 | "expect-ho", "0", "1", |
| 818 | "ho-complete", |
| 819 | NULL |
| 820 | }; |
| 821 | |
| 822 | static char *test_case_12[] = { |
| 823 | "2", |
| 824 | |
| 825 | "No handover to congested cell\n\n" |
| 826 | "The better neighbor cell is congested, so no handover is performed.\n" |
| 827 | "After the congestion is over, handover will be performed.\n", |
| 828 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 829 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 830 | "create-ms", "0", "TCH/F", "AMR", |
| 831 | "set-min-free", "1", "TCH/F", "4", |
| 832 | "set-min-free", "1", "TCH/H", "4", |
| 833 | "meas-rep", "0", "20","0", "1","0","30", |
| 834 | "expect-no-chan", |
| 835 | "set-min-free", "1", "TCH/F", "3", |
| 836 | "set-min-free", "1", "TCH/H", "3", |
| 837 | "meas-rep", "0", "20","0", "1","0","30", |
| 838 | "expect-chan", "1", "1", |
| 839 | "ack-chan", |
| 840 | "expect-ho", "0", "1", |
| 841 | "ho-complete", |
| 842 | NULL |
| 843 | }; |
| 844 | |
| 845 | static char *test_case_13[] = { |
| 846 | "2", |
| 847 | |
| 848 | "Handover to balance congestion\n\n" |
| 849 | "The current and the better cell are congested, so no handover is\n" |
| 850 | "performed. This is because handover would congest the neighbor cell\n" |
| 851 | "more. After congestion raises in the current cell, the handover is\n" |
| 852 | "performed to balance congestion\n", |
| 853 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 854 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 855 | "create-ms", "0", "TCH/F", "AMR", |
| 856 | "set-min-free", "0", "TCH/F", "4", |
| 857 | "set-min-free", "0", "TCH/H", "4", |
| 858 | "set-min-free", "1", "TCH/F", "4", |
| 859 | "set-min-free", "1", "TCH/H", "4", |
| 860 | "meas-rep", "0", "20","0", "1","0","30", |
| 861 | "expect-no-chan", |
| 862 | "create-ms", "0", "TCH/F", "AMR", |
| 863 | "meas-rep", "0", "20","0", "1","0","30", |
| 864 | "expect-chan", "1", "1", |
| 865 | "ack-chan", |
| 866 | "expect-ho", "0", "1", |
| 867 | "ho-complete", |
| 868 | NULL |
| 869 | }; |
| 870 | |
| 871 | static char *test_case_14[] = { |
| 872 | "2", |
| 873 | |
| 874 | "Handover to congested cell, if RX level is below minimum\n\n" |
| 875 | "The better neighbor cell is congested, so no handover is performed.\n" |
| 876 | "If the RX level of the current cell drops below minimum acceptable\n" |
| 877 | "level, the handover is performed.\n", |
| 878 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 879 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 880 | "create-ms", "0", "TCH/F", "AMR", |
| 881 | "set-min-free", "1", "TCH/F", "4", |
| 882 | "set-min-free", "1", "TCH/H", "4", |
| 883 | "meas-rep", "0", "10","0", "1","0","30", |
| 884 | "expect-no-chan", |
| 885 | "meas-rep", "0", "9","0", "1","0","30", |
| 886 | "expect-chan", "1", "1", |
| 887 | "ack-chan", |
| 888 | "expect-ho", "0", "1", |
| 889 | "ho-complete", |
| 890 | NULL |
| 891 | }; |
| 892 | |
| 893 | static char *test_case_15[] = { |
| 894 | "2", |
| 895 | |
| 896 | "Handover to cell with worse RXLEV, if RXQUAL is below minimum\n\n" |
| 897 | "The neighbor cell has worse RXLEV, so no handover is performed.\n" |
| 898 | "If the RXQUAL of the current cell drops below minimum acceptable\n" |
| 899 | "level, the handover is performed. It is also required that 10\n" |
| 900 | "reports are received, before RXQUAL is checked.\n", |
| 901 | /* (See also test 28, which tests for RXQUAL triggering HO to congested cell.) */ |
| 902 | /* 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] | 903 | * 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] | 904 | * 2.1.1, "Interference" in the list of triggers on p.157. */ |
| 905 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 906 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 907 | "create-ms", "0", "TCH/F", "AMR", |
| 908 | "meas-rep", "0", "40","6", "1","0","30", |
| 909 | "expect-no-chan", |
| 910 | "meas-rep", "0", "40","6", "1","0","30", |
| 911 | "expect-no-chan", |
| 912 | "meas-rep", "0", "40","6", "1","0","30", |
| 913 | "expect-no-chan", |
| 914 | "meas-rep", "0", "40","6", "1","0","30", |
| 915 | "expect-no-chan", |
| 916 | "meas-rep", "0", "40","6", "1","0","30", |
| 917 | "expect-no-chan", |
| 918 | "meas-rep", "0", "40","6", "1","0","30", |
| 919 | "expect-no-chan", |
| 920 | "meas-rep", "0", "40","6", "1","0","30", |
| 921 | "expect-no-chan", |
| 922 | "meas-rep", "0", "40","6", "1","0","30", |
| 923 | "expect-no-chan", |
| 924 | "meas-rep", "0", "40","6", "1","0","30", |
| 925 | "expect-no-chan", |
| 926 | "meas-rep", "0", "40","6", "1","0","30", |
| 927 | "expect-chan", "1", "1", |
| 928 | "ack-chan", |
| 929 | "expect-ho", "0", "1", |
| 930 | "ho-complete", |
| 931 | NULL |
| 932 | }; |
| 933 | |
| 934 | static char *test_case_16[] = { |
| 935 | "2", |
| 936 | |
| 937 | "Handover due to maximum TA exceeded\n\n" |
| 938 | "The MS in the current (best) cell has reached maximum allowed timing\n" |
| 939 | "advance. No handover is performed until the timing advance exceeds\n" |
| 940 | "it. The originating cell is still the best, but no handover is\n" |
| 941 | "performed back to that cell, because the penalty timer (due to\n" |
| 942 | "maximum allowed timing advance) is running.\n", |
| 943 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 944 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 945 | "create-ms", "0", "TCH/F", "AMR", |
| 946 | "set-max-ta", "0", "5", /* of cell */ |
| 947 | "set-ta", "0", "5", /* of ms */ |
| 948 | "meas-rep", "0", "30","0", "1","0","20", |
| 949 | "expect-no-chan", |
| 950 | "set-ta", "0", "6", /* of ms */ |
| 951 | "meas-rep", "0", "30","0", "1","0","20", |
| 952 | "expect-chan", "1", "1", |
| 953 | "ack-chan", |
| 954 | "expect-ho", "0", "1", |
| 955 | "ho-complete", |
| 956 | "meas-rep", "0", "20","0", "1","0","30", |
| 957 | "expect-no-chan", |
| 958 | NULL |
| 959 | }; |
| 960 | |
| 961 | static char *test_case_17[] = { |
| 962 | "2", |
| 963 | |
| 964 | "Congestion check: No congestion\n\n" |
| 965 | "Three cells have different number of used slots, but there is no\n" |
| 966 | "congestion in any of these cells. No handover is performed.\n", |
| 967 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 968 | "create-n-bts", "3", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 969 | "set-min-free", "0", "TCH/F", "2", |
| 970 | "set-min-free", "0", "TCH/H", "2", |
| 971 | "set-min-free", "1", "TCH/F", "2", |
| 972 | "set-min-free", "1", "TCH/H", "2", |
| 973 | "set-min-free", "2", "TCH/F", "2", |
| 974 | "set-min-free", "2", "TCH/H", "2", |
| 975 | "create-ms", "0", "TCH/F", "AMR", |
| 976 | "create-ms", "0", "TCH/F", "AMR", |
| 977 | "create-ms", "0", "TCH/H", "AMR", |
| 978 | "create-ms", "0", "TCH/H", "AMR", |
| 979 | "create-ms", "1", "TCH/F", "AMR", |
| 980 | "create-ms", "1", "TCH/H", "AMR", |
| 981 | "meas-rep", "0", "30","0", "2","0","20","1","20", |
| 982 | "expect-no-chan", |
| 983 | "meas-rep", "1", "30","0", "2","0","20","1","20", |
| 984 | "expect-no-chan", |
| 985 | "meas-rep", "2", "30","0", "2","0","20","1","20", |
| 986 | "expect-no-chan", |
| 987 | "meas-rep", "3", "30","0", "2","0","20","1","20", |
| 988 | "expect-no-chan", |
| 989 | "meas-rep", "4", "30","0", "2","0","20","1","20", |
| 990 | "expect-no-chan", |
| 991 | "meas-rep", "5", "30","0", "2","0","20","1","20", |
| 992 | "expect-no-chan", |
| 993 | "congestion-check", |
| 994 | "expect-no-chan", |
| 995 | NULL |
| 996 | }; |
| 997 | |
| 998 | static char *test_case_18[] = { |
| 999 | "2", |
| 1000 | |
| 1001 | "Congestion check: One out of three cells is congested\n\n" |
| 1002 | "Three cells have different number of used slots, but there is\n" |
| 1003 | "congestion at TCH/F in the first cell. Handover is performed with\n" |
| 1004 | "the best candidate.\n", |
| 1005 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1006 | "create-n-bts", "3", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1007 | "set-min-free", "0", "TCH/F", "2", |
| 1008 | "set-min-free", "0", "TCH/H", "2", |
| 1009 | "set-min-free", "1", "TCH/F", "2", |
| 1010 | "set-min-free", "1", "TCH/H", "2", |
| 1011 | "set-min-free", "2", "TCH/F", "2", |
| 1012 | "set-min-free", "2", "TCH/H", "2", |
| 1013 | "create-ms", "0", "TCH/F", "AMR", |
| 1014 | "create-ms", "0", "TCH/F", "AMR", |
| 1015 | "create-ms", "0", "TCH/F", "AMR", |
| 1016 | "create-ms", "0", "TCH/H", "AMR", |
| 1017 | "create-ms", "0", "TCH/H", "AMR", |
| 1018 | "create-ms", "1", "TCH/F", "AMR", |
| 1019 | "create-ms", "1", "TCH/H", "AMR", |
| 1020 | "meas-rep", "0", "30","0", "2","0","20","1","20", |
| 1021 | "expect-no-chan", |
| 1022 | "meas-rep", "1", "30","0", "2","0","20","1","20", |
| 1023 | "expect-no-chan", |
| 1024 | "meas-rep", "2", "30","0", "2","0","21","1","20", |
| 1025 | "expect-no-chan", |
| 1026 | "meas-rep", "3", "30","0", "2","0","20","1","20", |
| 1027 | "expect-no-chan", |
| 1028 | "meas-rep", "4", "30","0", "2","0","20","1","20", |
| 1029 | "expect-no-chan", |
| 1030 | "meas-rep", "5", "30","0", "2","0","20","1","20", |
| 1031 | "expect-no-chan", |
| 1032 | "meas-rep", "6", "30","0", "2","0","20","1","20", |
| 1033 | "expect-no-chan", |
| 1034 | "congestion-check", |
| 1035 | "expect-chan", "1", "2", |
| 1036 | "ack-chan", |
Neels Hofmeyr | 72d64e7 | 2020-11-16 18:07:31 +0100 | [diff] [blame] | 1037 | "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] | 1038 | "ho-complete", |
| 1039 | NULL |
| 1040 | }; |
| 1041 | |
| 1042 | static char *test_case_19[] = { |
| 1043 | "2", |
| 1044 | |
| 1045 | "Congestion check: Balancing over congested cells\n\n" |
Neels Hofmeyr | 1336d94 | 2020-08-10 21:13:55 +0200 | [diff] [blame] | 1046 | "Two cells are congested, but the second cell is less congested.\n" |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1047 | "Handover is performed to solve the congestion.\n", |
| 1048 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1049 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1050 | "set-min-free", "0", "TCH/F", "4", |
| 1051 | "set-min-free", "1", "TCH/F", "4", |
| 1052 | "create-ms", "0", "TCH/F", "FR", |
| 1053 | "create-ms", "0", "TCH/F", "FR", |
| 1054 | "create-ms", "0", "TCH/F", "FR", |
| 1055 | "create-ms", "1", "TCH/F", "FR", |
| 1056 | "meas-rep", "0", "30","0", "1","0","20", |
| 1057 | "expect-no-chan", |
| 1058 | "meas-rep", "1", "30","0", "1","0","21", |
| 1059 | "expect-no-chan", |
| 1060 | "meas-rep", "2", "30","0", "1","0","20", |
| 1061 | "expect-no-chan", |
| 1062 | "meas-rep", "3", "30","0", "1","0","20", |
| 1063 | "expect-no-chan", |
| 1064 | "congestion-check", |
| 1065 | "expect-chan", "1", "2", |
| 1066 | "ack-chan", |
| 1067 | "expect-ho", "0", "2", /* best candidate is MS 1 at BTS 0, TS 2 */ |
| 1068 | "ho-complete", |
| 1069 | NULL |
| 1070 | }; |
| 1071 | |
| 1072 | static char *test_case_20[] = { |
| 1073 | "2", |
| 1074 | |
| 1075 | "Congestion check: Solving congestion by handover TCH/F -> TCH/H\n\n" |
| 1076 | "Two BTS, one MS in the first congested BTS must handover to\n" |
| 1077 | "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] | 1078 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1079 | "set-min-free", "0", "TCH/F", "4", |
| 1080 | "set-min-free", "0", "TCH/H", "4", |
| 1081 | "set-min-free", "1", "TCH/F", "4", |
| 1082 | "create-ms", "0", "TCH/F", "AMR", |
| 1083 | "meas-rep", "0", "30","0", "1","0","30", |
| 1084 | "expect-no-chan", |
| 1085 | "congestion-check", |
| 1086 | "expect-chan", "1", "5", |
| 1087 | "ack-chan", |
| 1088 | "expect-ho", "0", "1", |
| 1089 | "ho-complete", |
| 1090 | NULL |
| 1091 | }; |
| 1092 | |
| 1093 | static char *test_case_21[] = { |
| 1094 | "2", |
| 1095 | |
| 1096 | "Congestion check: Balancing congestion by handover TCH/F -> TCH/H\n\n" |
| 1097 | "Two BTS, one MS in the first congested BTS must handover to\n" |
| 1098 | "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] | 1099 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1100 | "set-min-free", "0", "TCH/F", "4", |
| 1101 | "set-min-free", "0", "TCH/H", "4", |
| 1102 | "set-min-free", "1", "TCH/F", "4", |
| 1103 | "set-min-free", "1", "TCH/H", "4", |
| 1104 | "create-ms", "0", "TCH/F", "AMR", |
| 1105 | "create-ms", "0", "TCH/F", "AMR", |
| 1106 | "create-ms", "0", "TCH/H", "AMR", |
| 1107 | "meas-rep", "0", "30","0", "1","0","30", |
| 1108 | "expect-no-chan", |
| 1109 | "congestion-check", |
| 1110 | "expect-chan", "1", "1", |
| 1111 | "ack-chan", |
| 1112 | "expect-ho", "0", "1", |
| 1113 | "ho-complete", |
| 1114 | NULL |
| 1115 | }; |
| 1116 | |
| 1117 | static char *test_case_22[] = { |
| 1118 | "2", |
| 1119 | |
| 1120 | "Congestion check: Upgrading worst candidate from TCH/H -> TCH/F\n\n" |
| 1121 | "There is only one BTS. The TCH/H slots are congested. Since\n" |
| 1122 | "assignment is performed to less-congested TCH/F, the candidate with\n" |
| 1123 | "the worst RX level is chosen.\n", |
| 1124 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1125 | "create-n-bts", "1", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1126 | "set-min-free", "0", "TCH/F", "4", |
| 1127 | "set-min-free", "0", "TCH/H", "4", |
| 1128 | "create-ms", "0", "TCH/H", "AMR", |
| 1129 | "create-ms", "0", "TCH/H", "AMR", |
| 1130 | "create-ms", "0", "TCH/H", "AMR", |
| 1131 | "meas-rep", "0", "30","0", "0", |
| 1132 | "meas-rep", "1", "34","0", "0", |
| 1133 | "meas-rep", "2", "20","0", "0", |
| 1134 | "expect-no-chan", |
| 1135 | "congestion-check", |
| 1136 | "expect-chan", "0", "1", |
| 1137 | "ack-chan", |
| 1138 | "expect-ho", "0", "6", |
| 1139 | "ho-complete", |
| 1140 | NULL |
| 1141 | }; |
| 1142 | |
| 1143 | static char *test_case_23[] = { |
| 1144 | "2", |
| 1145 | |
| 1146 | "Story: 'A neighbor is your friend'\n", |
| 1147 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1148 | "create-n-bts", "3", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1149 | |
| 1150 | "print", |
| 1151 | "Andreas is driving along the coast, on a sunny june afternoon.\n" |
| 1152 | "Suddenly he is getting a call from his friend and neighbor Axel.\n" |
| 1153 | "\n" |
| 1154 | "What happens: Two MS are created, #0 for Axel, #1 for Andreas.", |
| 1155 | /* Axel */ |
| 1156 | "create-ms", "2", "TCH/F", "AMR", |
| 1157 | /* andreas */ |
| 1158 | "create-ms", "0", "TCH/F", "AMR", |
| 1159 | "meas-rep", "1", "40","0", "1","0","30", |
| 1160 | "expect-no-chan", |
| 1161 | |
| 1162 | "print", |
| 1163 | "Axel asks Andreas if he would like to join them for a barbecue.\n" |
| 1164 | "Axel's house is right in the neighborhood and the weather is fine.\n" |
| 1165 | "Andreas agrees, so he drives to a close store to buy some barbecue\n" |
| 1166 | "skewers.\n" |
| 1167 | "\n" |
| 1168 | "What happens: While driving, a different cell (mounted atop the\n" |
| 1169 | "store) becomes better.", |
| 1170 | /* drive to bts 1 */ |
| 1171 | "meas-rep", "1", "20","0", "1","0","35", |
| 1172 | "expect-chan", "1", "1", |
| 1173 | "ack-chan", |
| 1174 | "expect-ho", "0", "1", |
| 1175 | "ho-complete", |
| 1176 | |
| 1177 | "print", |
| 1178 | "While Andreas is walking into the store, Axel asks, if he could also\n" |
| 1179 | "bring some beer. Andreas has problems understanding him: \"I have a\n" |
| 1180 | "bad reception here. The cell tower is right atop the store, but poor\n" |
| 1181 | "coverage inside. Can you repeat please?\"\n" |
| 1182 | "\n" |
| 1183 | "What happens: Inside the store the close cell is so bad, that\n" |
| 1184 | "handover back to the previous cell is required.", |
| 1185 | /* bts 1 becomes bad, so bts 0 helps out */ |
| 1186 | "meas-rep", "1", "5","0", "1","0","20", |
| 1187 | "expect-chan", "0", "1", |
| 1188 | "ack-chan", |
| 1189 | "expect-ho", "1", "1", |
| 1190 | "ho-complete", |
| 1191 | |
| 1192 | "print", |
| 1193 | "After Andreas bought skewers and beer, he leaves the store.\n" |
| 1194 | "\n" |
| 1195 | "What happens: Outside the store the close cell is better again, so\n" |
| 1196 | "handover back to the that cell is performed.", |
| 1197 | /* bts 1 becomes better again */ |
| 1198 | "meas-rep", "1", "20","0", "1","0","35", |
| 1199 | "expect-chan", "1", "1", |
| 1200 | "ack-chan", |
| 1201 | "expect-ho", "0", "1", |
| 1202 | "ho-complete", |
| 1203 | |
| 1204 | "print", |
| 1205 | /* bts 2 becomes better */ |
| 1206 | "Andreas drives down to the lake where Axel's house is.\n" |
| 1207 | "\n" |
| 1208 | "What happens: There is a small cell at Axel's house, which becomes\n" |
| 1209 | "better, because the current cell has no good comverage at the lake.", |
| 1210 | "meas-rep", "1", "14","0", "2","0","2","1","63", |
| 1211 | "expect-chan", "2", "2", |
| 1212 | "ack-chan", |
| 1213 | "expect-ho", "1", "1", |
| 1214 | "ho-complete", |
| 1215 | |
| 1216 | "print", |
| 1217 | "Andreas wonders why he still has good radio coverage: \"Last time it\n" |
| 1218 | "was so bad\". Axel says: \"I installed a pico cell in my house,\n" |
| 1219 | "now we can use our mobile phones down here at the lake.\"", |
| 1220 | |
| 1221 | NULL |
| 1222 | }; |
| 1223 | |
| 1224 | static char *test_case_24[] = { |
| 1225 | "2", |
| 1226 | "No (or not enough) measurements for handover\n\n" |
| 1227 | "Do not solve congestion in cell, because there is no measurement.\n" |
Martin Hauke | a29affd | 2019-11-13 22:10:41 +0100 | [diff] [blame] | 1228 | "As soon as enough measurements available (1 in our case), perform\n" |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1229 | "handover. Afterwards the old cell becomes congested and the new\n" |
| 1230 | "cell is not. Do not perform handover until new measurements are\n" |
| 1231 | "received.\n", |
| 1232 | |
| 1233 | /* two cells, first in congested, but no handover */ |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1234 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1235 | "set-min-free", "0", "TCH/F", "4", |
| 1236 | "set-min-free", "0", "TCH/H", "4", |
| 1237 | "create-ms", "0", "TCH/F", "AMR", |
| 1238 | "congestion-check", |
| 1239 | "expect-no-chan", |
| 1240 | |
| 1241 | /* send measurement and trigger congestion check */ |
| 1242 | "meas-rep", "0", "20","0", "1","0","20", |
| 1243 | "expect-no-chan", |
| 1244 | "congestion-check", |
| 1245 | "expect-chan", "1", "1", |
| 1246 | "ack-chan", |
| 1247 | "expect-ho", "0", "1", |
| 1248 | "ho-complete", |
| 1249 | |
| 1250 | /* congest the first cell and remove congestion from second cell */ |
| 1251 | "set-min-free", "0", "TCH/F", "0", |
| 1252 | "set-min-free", "0", "TCH/H", "0", |
| 1253 | "set-min-free", "1", "TCH/F", "4", |
| 1254 | "set-min-free", "1", "TCH/H", "4", |
| 1255 | |
| 1256 | /* no handover until measurements applied */ |
| 1257 | "congestion-check", |
| 1258 | "expect-no-chan", |
| 1259 | "meas-rep", "0", "20","0", "1","0","20", |
| 1260 | "expect-no-chan", |
| 1261 | "congestion-check", |
| 1262 | "expect-chan", "0", "1", |
| 1263 | "ack-chan", |
| 1264 | "expect-ho", "1", "1", |
| 1265 | "ho-complete", |
| 1266 | NULL |
| 1267 | }; |
| 1268 | |
| 1269 | static char *test_case_25[] = { |
| 1270 | "1", |
| 1271 | |
| 1272 | "Stay in better cell\n\n" |
| 1273 | "There are many neighbor cells, but only the current cell is the best\n" |
| 1274 | "cell, so no handover is performed\n", |
| 1275 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1276 | "create-n-bts", "7", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1277 | "create-ms", "0", "TCH/F", "AMR", |
| 1278 | "meas-rep", "0", "30","0", |
| 1279 | "6","0","20","1","21","2","18","3","20","4","23","5","19", |
| 1280 | "expect-no-chan", |
| 1281 | NULL |
| 1282 | }; |
| 1283 | |
| 1284 | static char *test_case_26[] = { |
| 1285 | "1", |
| 1286 | |
| 1287 | "Handover to best better cell\n\n" |
| 1288 | "The best neighbor cell is selected\n", |
| 1289 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1290 | "create-n-bts", "7", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1291 | "create-ms", "0", "TCH/F", "AMR", |
| 1292 | "meas-rep", "0", "10","0", |
| 1293 | "6","0","20","1","21","2","18","3","20","4","23","5","19", |
| 1294 | "expect-chan", "5", "1", |
| 1295 | "ack-chan", |
| 1296 | "expect-ho", "0", "1", |
| 1297 | "ho-complete", |
| 1298 | NULL |
| 1299 | }; |
| 1300 | |
| 1301 | static char *test_case_27[] = { |
| 1302 | "2", |
| 1303 | |
| 1304 | "Congestion check: Upgrading worst candidate from TCH/H -> TCH/F\n\n" |
| 1305 | "There is only one BTS. The TCH/H slots are congested. Since\n" |
| 1306 | "assignment is performed to less-congested TCH/F, the candidate with\n" |
| 1307 | "the worst RX level is chosen. (So far like test 22.)\n" |
| 1308 | "After that, trigger more congestion checks to ensure stability.\n", |
| 1309 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1310 | "create-n-bts", "1", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1311 | "set-min-free", "0", "TCH/F", "2", |
| 1312 | "set-min-free", "0", "TCH/H", "4", |
| 1313 | "create-ms", "0", "TCH/H", "AMR", |
| 1314 | "create-ms", "0", "TCH/H", "AMR", |
| 1315 | "create-ms", "0", "TCH/H", "AMR", |
| 1316 | "meas-rep", "0", "30","0", "0", |
| 1317 | "meas-rep", "1", "34","0", "0", |
| 1318 | "meas-rep", "2", "20","0", "0", |
| 1319 | "expect-no-chan", |
| 1320 | "congestion-check", |
| 1321 | "expect-chan", "0", "1", |
| 1322 | "ack-chan", |
| 1323 | "expect-ho", "0", "6", |
| 1324 | "ho-complete", |
| 1325 | "congestion-check", |
| 1326 | "expect-chan", "0", "2", |
| 1327 | "ack-chan", |
| 1328 | "expect-ho", "0", "5", |
| 1329 | "ho-complete", |
| 1330 | "congestion-check", |
| 1331 | "expect-no-chan", |
| 1332 | "congestion-check", |
| 1333 | "expect-no-chan", |
| 1334 | NULL |
| 1335 | }; |
| 1336 | |
| 1337 | static char *test_case_28[] = { |
| 1338 | "2", |
| 1339 | |
| 1340 | "Handover to congested cell, if RX quality is below minimum\n\n" |
| 1341 | "The better neighbor cell is congested, so no handover is performed.\n" |
| 1342 | "If the RX quality of the current cell drops below minimum acceptable\n" |
| 1343 | "level, the handover is performed. It is also required that 10\n" |
| 1344 | "resports are received, before RX quality is checked.\n", |
| 1345 | |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1346 | "create-n-bts", "2", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1347 | "create-ms", "0", "TCH/F", "AMR", |
| 1348 | "set-min-free", "1", "TCH/F", "4", |
| 1349 | "set-min-free", "1", "TCH/H", "4", |
| 1350 | "meas-rep", "0", "30","6", "1","0","40", |
| 1351 | "expect-no-chan", |
| 1352 | "meas-rep", "0", "30","6", "1","0","40", |
| 1353 | "expect-no-chan", |
| 1354 | "meas-rep", "0", "30","6", "1","0","40", |
| 1355 | "expect-no-chan", |
| 1356 | "meas-rep", "0", "30","6", "1","0","40", |
| 1357 | "expect-no-chan", |
| 1358 | "meas-rep", "0", "30","6", "1","0","40", |
| 1359 | "expect-no-chan", |
| 1360 | "meas-rep", "0", "30","6", "1","0","40", |
| 1361 | "expect-no-chan", |
| 1362 | "meas-rep", "0", "30","6", "1","0","40", |
| 1363 | "expect-no-chan", |
| 1364 | "meas-rep", "0", "30","6", "1","0","40", |
| 1365 | "expect-no-chan", |
| 1366 | "meas-rep", "0", "30","6", "1","0","40", |
| 1367 | "expect-no-chan", |
| 1368 | "meas-rep", "0", "30","6", "1","0","40", |
| 1369 | "expect-chan", "1", "1", |
| 1370 | "ack-chan", |
| 1371 | "expect-ho", "0", "1", |
| 1372 | "ho-complete", |
| 1373 | NULL |
| 1374 | }; |
| 1375 | |
Neels Hofmeyr | 7b2b430 | 2020-08-02 02:50:17 +0200 | [diff] [blame] | 1376 | static char *test_case_29[] = { |
| 1377 | "2", |
| 1378 | |
| 1379 | "Congestion check: Balancing congestion by handover TCH/F -> TCH/H\n\n" |
| 1380 | "One BTS, and TCH/F are considered congested, TCH/H are not.\n" |
| 1381 | , |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1382 | "create-n-bts", "1", |
Neels Hofmeyr | 7b2b430 | 2020-08-02 02:50:17 +0200 | [diff] [blame] | 1383 | "set-min-free", "0", "TCH/F", "3", |
| 1384 | "set-min-free", "0", "TCH/H", "0", |
| 1385 | "create-ms", "0", "TCH/F", "AMR", |
| 1386 | "create-ms", "0", "TCH/F", "AMR", |
| 1387 | "create-ms", "0", "TCH/H", "AMR", |
| 1388 | "meas-rep", "0", "30","0", "1","0","30", |
| 1389 | "expect-no-chan", |
| 1390 | "congestion-check", |
| 1391 | "expect-chan", "0", "5", |
| 1392 | "ack-chan", |
| 1393 | "expect-ho", "0", "1", |
| 1394 | "ho-complete", |
| 1395 | NULL |
| 1396 | }; |
| 1397 | |
| 1398 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1399 | static char **test_cases[] = { |
| 1400 | test_case_0, |
| 1401 | test_case_1, |
| 1402 | test_case_2, |
| 1403 | test_case_3, |
| 1404 | test_case_4, |
| 1405 | test_case_5, |
| 1406 | test_case_6, |
| 1407 | test_case_7, |
| 1408 | test_case_8, |
| 1409 | test_case_9, |
| 1410 | test_case_10, |
| 1411 | test_case_11, |
| 1412 | test_case_12, |
| 1413 | test_case_13, |
| 1414 | test_case_14, |
| 1415 | test_case_15, |
| 1416 | test_case_16, |
| 1417 | test_case_17, |
| 1418 | test_case_18, |
| 1419 | test_case_19, |
| 1420 | test_case_20, |
| 1421 | test_case_21, |
| 1422 | test_case_22, |
| 1423 | test_case_23, |
| 1424 | test_case_24, |
| 1425 | test_case_25, |
| 1426 | test_case_26, |
| 1427 | test_case_27, |
| 1428 | test_case_28, |
Neels Hofmeyr | 7b2b430 | 2020-08-02 02:50:17 +0200 | [diff] [blame] | 1429 | test_case_29, |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1430 | }; |
| 1431 | |
| 1432 | static const struct log_info_cat log_categories[] = { |
| 1433 | [DHO] = { |
| 1434 | .name = "DHO", |
| 1435 | .description = "Hand-Over Process", |
| 1436 | .color = "\033[1;38m", |
| 1437 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1438 | }, |
| 1439 | [DHODEC] = { |
| 1440 | .name = "DHODEC", |
| 1441 | .description = "Hand-Over Decision", |
| 1442 | .color = "\033[1;38m", |
| 1443 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1444 | }, |
| 1445 | [DMEAS] = { |
| 1446 | .name = "DMEAS", |
| 1447 | .description = "Radio Measurement Processing", |
| 1448 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1449 | }, |
| 1450 | [DREF] = { |
| 1451 | .name = "DREF", |
| 1452 | .description = "Reference Counting", |
| 1453 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1454 | }, |
| 1455 | [DRSL] = { |
| 1456 | .name = "DRSL", |
Keith | d925c7c | 2018-04-16 13:40:07 +0200 | [diff] [blame] | 1457 | .description = "A-bis Radio Signalling Link (RSL)", |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1458 | .color = "\033[1;35m", |
| 1459 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1460 | }, |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1461 | [DRR] = { |
| 1462 | .name = "DRR", |
| 1463 | .description = "RR", |
| 1464 | .color = "\033[1;35m", |
| 1465 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1466 | }, |
| 1467 | [DRLL] = { |
| 1468 | .name = "DRLL", |
| 1469 | .description = "RLL", |
| 1470 | .color = "\033[1;35m", |
| 1471 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1472 | }, |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 1473 | [DMSC] = { |
| 1474 | .name = "DMSC", |
| 1475 | .description = "Mobile Switching Center", |
| 1476 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1477 | }, |
Neels Hofmeyr | 3c5612f | 2018-07-11 19:53:39 +0200 | [diff] [blame] | 1478 | [DCHAN] = { |
| 1479 | .name = "DCHAN", |
| 1480 | .description = "lchan FSM", |
| 1481 | .color = "\033[1;32m", |
| 1482 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1483 | }, |
| 1484 | [DTS] = { |
| 1485 | .name = "DTS", |
| 1486 | .description = "timeslot FSM", |
| 1487 | .color = "\033[1;31m", |
| 1488 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1489 | }, |
| 1490 | [DAS] = { |
| 1491 | .name = "DAS", |
| 1492 | .description = "assignment FSM", |
| 1493 | .color = "\033[1;33m", |
| 1494 | .enabled = 1, .loglevel = LOGL_DEBUG, |
| 1495 | }, |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1496 | }; |
| 1497 | |
| 1498 | const struct log_info log_info = { |
| 1499 | .cat = log_categories, |
| 1500 | .num_cat = ARRAY_SIZE(log_categories), |
| 1501 | }; |
| 1502 | |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1503 | struct gsm_bts *bts_by_num_str(const char *num_str) |
| 1504 | { |
| 1505 | struct gsm_bts *bts = gsm_bts_num(bsc_gsmnet, atoi(num_str)); |
| 1506 | OSMO_ASSERT(bts); |
| 1507 | return bts; |
| 1508 | } |
| 1509 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1510 | int main(int argc, char **argv) |
| 1511 | { |
| 1512 | char **test_case; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1513 | struct gsm_lchan *lchan[256]; |
| 1514 | int lchan_num = 0; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1515 | int i; |
Neels Hofmeyr | 958f259 | 2018-05-27 01:26:31 +0200 | [diff] [blame] | 1516 | int algorithm; |
Neels Hofmeyr | 0072755 | 2018-02-21 14:33:15 +0100 | [diff] [blame] | 1517 | int test_case_i; |
| 1518 | int last_test_i; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1519 | |
Neels Hofmeyr | e341618 | 2018-03-05 05:31:14 +0100 | [diff] [blame] | 1520 | ctx = talloc_named_const(NULL, 0, "handover_test"); |
| 1521 | msgb_talloc_ctx_init(ctx, 0); |
| 1522 | |
Neels Hofmeyr | 0072755 | 2018-02-21 14:33:15 +0100 | [diff] [blame] | 1523 | test_case_i = argc > 1? atoi(argv[1]) : -1; |
| 1524 | last_test_i = ARRAY_SIZE(test_cases) - 1; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1525 | |
Neels Hofmeyr | 0072755 | 2018-02-21 14:33:15 +0100 | [diff] [blame] | 1526 | if (test_case_i < 0 || test_case_i > last_test_i) { |
| 1527 | for (i = 0; i <= last_test_i; i++) { |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1528 | printf("Test #%d (algorithm %s):\n%s\n", i, |
| 1529 | test_cases[i][0], test_cases[i][1]); |
| 1530 | } |
Neels Hofmeyr | 0072755 | 2018-02-21 14:33:15 +0100 | [diff] [blame] | 1531 | printf("\nPlease specify test case number 0..%d\n", last_test_i); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1532 | return EXIT_FAILURE; |
| 1533 | } |
| 1534 | |
Neels Hofmeyr | e341618 | 2018-03-05 05:31:14 +0100 | [diff] [blame] | 1535 | osmo_init_logging2(ctx, &log_info); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1536 | |
| 1537 | log_set_print_category(osmo_stderr_target, 1); |
| 1538 | log_set_print_category_hex(osmo_stderr_target, 0); |
| 1539 | log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_BASENAME); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1540 | osmo_fsm_log_addr(false); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1541 | |
Neels Hofmeyr | 958f259 | 2018-05-27 01:26:31 +0200 | [diff] [blame] | 1542 | bsc_network_alloc(); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1543 | if (!bsc_gsmnet) |
| 1544 | exit(1); |
| 1545 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1546 | ts_fsm_init(); |
| 1547 | lchan_fsm_init(); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1548 | bsc_subscr_conn_fsm_init(); |
| 1549 | handover_fsm_init(); |
| 1550 | |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1551 | ho_set_algorithm(bsc_gsmnet->ho, 2); |
| 1552 | ho_set_ho_active(bsc_gsmnet->ho, true); |
| 1553 | ho_set_hodec2_as_active(bsc_gsmnet->ho, true); |
| 1554 | ho_set_hodec2_min_rxlev(bsc_gsmnet->ho, -100); |
| 1555 | ho_set_hodec2_rxlev_avg_win(bsc_gsmnet->ho, 1); |
| 1556 | ho_set_hodec2_rxlev_neigh_avg_win(bsc_gsmnet->ho, 1); |
| 1557 | ho_set_hodec2_rxqual_avg_win(bsc_gsmnet->ho, 10); |
| 1558 | ho_set_hodec2_pwr_hysteresis(bsc_gsmnet->ho, 3); |
| 1559 | ho_set_hodec2_pwr_interval(bsc_gsmnet->ho, 1); |
| 1560 | ho_set_hodec2_afs_bias_rxlev(bsc_gsmnet->ho, 0); |
| 1561 | ho_set_hodec2_min_rxqual(bsc_gsmnet->ho, 5); |
| 1562 | ho_set_hodec2_afs_bias_rxqual(bsc_gsmnet->ho, 0); |
| 1563 | ho_set_hodec2_max_distance(bsc_gsmnet->ho, 9999); |
| 1564 | ho_set_hodec2_ho_max(bsc_gsmnet->ho, 9999); |
| 1565 | ho_set_hodec2_penalty_max_dist(bsc_gsmnet->ho, 300); |
| 1566 | ho_set_hodec2_penalty_failed_ho(bsc_gsmnet->ho, 60); |
| 1567 | ho_set_hodec2_penalty_failed_as(bsc_gsmnet->ho, 60); |
| 1568 | |
Vadim Yanitskiy | 4f3a641 | 2020-05-31 01:56:20 +0700 | [diff] [blame] | 1569 | /* We don't really need any specific model here */ |
| 1570 | bts_model_unknown_init(); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1571 | |
Neels Hofmeyr | 0072755 | 2018-02-21 14:33:15 +0100 | [diff] [blame] | 1572 | test_case = test_cases[test_case_i]; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1573 | |
| 1574 | fprintf(stderr, "--------------------\n"); |
| 1575 | fprintf(stderr, "Performing the following test %d (algorithm %s):\n%s", |
Neels Hofmeyr | 0072755 | 2018-02-21 14:33:15 +0100 | [diff] [blame] | 1576 | test_case_i, test_case[0], test_case[1]); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1577 | algorithm = atoi(test_case[0]); |
| 1578 | test_case += 2; |
| 1579 | fprintf(stderr, "--------------------\n"); |
| 1580 | |
| 1581 | /* Disable the congestion check timer, we will trigger manually. */ |
| 1582 | bsc_gsmnet->hodec2.congestion_check_interval_s = 0; |
| 1583 | |
| 1584 | handover_decision_1_init(); |
| 1585 | hodec2_init(bsc_gsmnet); |
| 1586 | |
| 1587 | while (*test_case) { |
Neels Hofmeyr | 4942da8 | 2020-11-12 22:58:17 +0100 | [diff] [blame] | 1588 | if (!strcmp(*test_case, "create-n-bts")) { |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1589 | int n = atoi(test_case[1]); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1590 | for (i = 0; i < n; i++) |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1591 | create_bts(1, bts_default_ts); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1592 | test_case += 2; |
| 1593 | } else |
Neels Hofmeyr | cfbf11f | 2020-11-12 23:12:48 +0100 | [diff] [blame] | 1594 | if (!strcmp(*test_case, "create-bts")) { |
| 1595 | /* new BTS with one TRX: |
| 1596 | * "create-bts", "1", "CCCH+SDCCH4", "TCH/F", "TCH/F", "TCH/F", "TCH/F", "TCH/H", "TCH/H", "PDCH", |
| 1597 | * |
| 1598 | * new BTS with two TRX: |
| 1599 | * "create-bts", "2", "CCCH+SDCCH4", "TCH/F", "TCH/F", "TCH/F", "TCH/F", "TCH/H", "TCH/H", "PDCH", |
| 1600 | * "SDCCH8", "TCH/F", "TCH/F", "TCH/F", "TCH/F", "TCH/H", "TCH/H", "PDCH", |
| 1601 | */ |
| 1602 | int num_trx = atoi(test_case[1]); |
| 1603 | const char * const * ts_cfg = (void*)&test_case[2]; |
| 1604 | create_bts(num_trx, ts_cfg); |
| 1605 | test_case += 2 + 8 * num_trx; |
| 1606 | } else |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1607 | if (!strcmp(*test_case, "as-enable")) { |
| 1608 | fprintf(stderr, "- Set assignment enable state at " |
| 1609 | "BTS %s to %s\n", test_case[1], test_case[2]); |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1610 | 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] | 1611 | test_case += 3; |
| 1612 | } else |
| 1613 | if (!strcmp(*test_case, "ho-enable")) { |
| 1614 | fprintf(stderr, "- Set handover enable state at " |
| 1615 | "BTS %s to %s\n", test_case[1], test_case[2]); |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1616 | 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] | 1617 | test_case += 3; |
| 1618 | } else |
| 1619 | if (!strcmp(*test_case, "afs-rxlev-improve")) { |
| 1620 | fprintf(stderr, "- Set afs RX level improvement at " |
| 1621 | "BTS %s to %s\n", test_case[1], test_case[2]); |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1622 | 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] | 1623 | test_case += 3; |
| 1624 | } else |
| 1625 | if (!strcmp(*test_case, "afs-rxqual-improve")) { |
| 1626 | fprintf(stderr, "- Set afs RX quality improvement at " |
| 1627 | "BTS %s to %s\n", test_case[1], test_case[2]); |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1628 | 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] | 1629 | test_case += 3; |
| 1630 | } else |
| 1631 | if (!strcmp(*test_case, "set-min-free")) { |
| 1632 | fprintf(stderr, "- Setting minimum required free %s " |
| 1633 | "slots at BTS %s to %s\n", test_case[2], |
| 1634 | test_case[1], test_case[3]); |
| 1635 | if (!strcmp(test_case[2], "TCH/F")) |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1636 | 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] | 1637 | else |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1638 | 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] | 1639 | test_case += 4; |
| 1640 | } else |
| 1641 | if (!strcmp(*test_case, "set-max-ho")) { |
| 1642 | fprintf(stderr, "- Setting maximum parallel handovers " |
| 1643 | "at BTS %s to %s\n", test_case[1], |
| 1644 | test_case[2]); |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1645 | 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] | 1646 | test_case += 3; |
| 1647 | } else |
| 1648 | if (!strcmp(*test_case, "set-max-ta")) { |
| 1649 | fprintf(stderr, "- Setting maximum timing advance " |
| 1650 | "at BTS %s to %s\n", test_case[1], |
| 1651 | test_case[2]); |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1652 | 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] | 1653 | test_case += 3; |
| 1654 | } else |
| 1655 | if (!strcmp(*test_case, "create-ms")) { |
| 1656 | fprintf(stderr, "- Creating mobile #%d at BTS %s on " |
| 1657 | "%s with %s codec\n", lchan_num, test_case[1], |
| 1658 | test_case[2], test_case[3]); |
Neels Hofmeyr | b5a107d | 2020-11-12 23:00:08 +0100 | [diff] [blame] | 1659 | lchan[lchan_num] = create_lchan(bts_by_num_str(test_case[1]), |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1660 | !strcmp(test_case[2], "TCH/F"), test_case[3]); |
| 1661 | if (!lchan[lchan_num]) { |
| 1662 | printf("Failed to create lchan!\n"); |
| 1663 | return EXIT_FAILURE; |
| 1664 | } |
| 1665 | fprintf(stderr, " * New MS is at BTS %d TS %d\n", |
| 1666 | lchan[lchan_num]->ts->trx->bts->nr, |
| 1667 | lchan[lchan_num]->ts->nr); |
| 1668 | lchan_num++; |
| 1669 | test_case += 4; |
| 1670 | } else |
| 1671 | if (!strcmp(*test_case, "set-ta")) { |
| 1672 | fprintf(stderr, "- Setting maximum timing advance " |
| 1673 | "at MS %s to %s\n", test_case[1], |
| 1674 | test_case[2]); |
| 1675 | meas_ta_ms = atoi(test_case[2]); |
| 1676 | test_case += 3; |
| 1677 | } else |
| 1678 | if (!strcmp(*test_case, "meas-rep")) { |
| 1679 | /* meas-rep <lchan-nr> <rxlev> <rxqual> <nr-of-neighbors> [<cell-idx> <rxlev> [...]] */ |
| 1680 | int n = atoi(test_case[4]); |
| 1681 | struct gsm_lchan *lc = lchan[atoi(test_case[1])]; |
| 1682 | fprintf(stderr, "- Sending measurement report from " |
| 1683 | "mobile #%s (rxlev=%s, rxqual=%s)\n", |
| 1684 | test_case[1], test_case[2], test_case[3]); |
| 1685 | meas_dl_rxlev = atoi(test_case[2]); |
| 1686 | meas_dl_rxqual = atoi(test_case[3]); |
| 1687 | meas_num_nc = n; |
| 1688 | test_case += 5; |
| 1689 | for (i = 0; i < n; i++) { |
| 1690 | int nr = atoi(test_case[0]); |
| 1691 | /* since our bts is not in the list of neighbor |
| 1692 | * cells, we need to shift */ |
| 1693 | if (nr >= lc->ts->trx->bts->nr) |
| 1694 | nr++; |
| 1695 | fprintf(stderr, " * Neighbor cell #%s, actual " |
| 1696 | "BTS %d (rxlev=%s)\n", test_case[0], nr, |
| 1697 | test_case[1]); |
| 1698 | meas_bcch_f_nc[i] = atoi(test_case[0]); |
| 1699 | /* bts number, not counting our own */ |
| 1700 | meas_rxlev_nc[i] = atoi(test_case[1]); |
| 1701 | meas_bsic_nc[i] = 0x3f; |
| 1702 | test_case += 2; |
| 1703 | } |
| 1704 | got_chan_req = 0; |
| 1705 | gen_meas_rep(lc); |
| 1706 | } else |
| 1707 | if (!strcmp(*test_case, "congestion-check")) { |
| 1708 | fprintf(stderr, "- Triggering congestion check\n"); |
| 1709 | got_chan_req = 0; |
| 1710 | if (algorithm == 2) |
| 1711 | hodec2_congestion_check(bsc_gsmnet); |
| 1712 | test_case += 1; |
| 1713 | } else |
| 1714 | if (!strcmp(*test_case, "expect-chan")) { |
| 1715 | fprintf(stderr, "- Expecting channel request at BTS %s " |
| 1716 | "TS %s\n", test_case[1], test_case[2]); |
| 1717 | if (!got_chan_req) { |
| 1718 | printf("Test failed, because no channel was " |
| 1719 | "requested\n"); |
| 1720 | return EXIT_FAILURE; |
| 1721 | } |
| 1722 | fprintf(stderr, " * Got channel request at BTS %d " |
| 1723 | "TS %d\n", chan_req_lchan->ts->trx->bts->nr, |
| 1724 | chan_req_lchan->ts->nr); |
| 1725 | if (chan_req_lchan->ts->trx->bts->nr |
| 1726 | != atoi(test_case[1])) { |
| 1727 | printf("Test failed, because channel was not " |
| 1728 | "requested on expected BTS\n"); |
| 1729 | return EXIT_FAILURE; |
| 1730 | } |
| 1731 | if (chan_req_lchan->ts->nr != atoi(test_case[2])) { |
| 1732 | printf("Test failed, because channel was not " |
| 1733 | "requested on expected TS\n"); |
| 1734 | return EXIT_FAILURE; |
| 1735 | } |
| 1736 | test_case += 3; |
| 1737 | } else |
| 1738 | if (!strcmp(*test_case, "expect-no-chan")) { |
| 1739 | fprintf(stderr, "- Expecting no channel request\n"); |
| 1740 | if (got_chan_req) { |
| 1741 | fprintf(stderr, " * Got channel request at " |
| 1742 | "BTS %d TS %d\n", |
| 1743 | chan_req_lchan->ts->trx->bts->nr, |
| 1744 | chan_req_lchan->ts->nr); |
| 1745 | printf("Test failed, because channel was " |
| 1746 | "requested\n"); |
| 1747 | return EXIT_FAILURE; |
| 1748 | } |
| 1749 | fprintf(stderr, " * Got no channel request\n"); |
| 1750 | test_case += 1; |
| 1751 | } else |
| 1752 | if (!strcmp(*test_case, "expect-ho")) { |
| 1753 | fprintf(stderr, "- Expecting handover/assignment " |
| 1754 | "request at BTS %s TS %s\n", test_case[1], |
| 1755 | test_case[2]); |
| 1756 | if (!got_ho_req) { |
| 1757 | printf("Test failed, because no handover was " |
| 1758 | "requested\n"); |
| 1759 | return EXIT_FAILURE; |
| 1760 | } |
| 1761 | fprintf(stderr, " * Got handover/assignment request at " |
| 1762 | "BTS %d TS %d\n", |
| 1763 | ho_req_lchan->ts->trx->bts->nr, |
| 1764 | ho_req_lchan->ts->nr); |
| 1765 | if (ho_req_lchan->ts->trx->bts->nr |
| 1766 | != atoi(test_case[1])) { |
| 1767 | printf("Test failed, because " |
| 1768 | "handover/assignment was not commanded " |
| 1769 | "at the expected BTS\n"); |
| 1770 | return EXIT_FAILURE; |
| 1771 | } |
| 1772 | if (ho_req_lchan->ts->nr != atoi(test_case[2])) { |
| 1773 | printf("Test failed, because " |
| 1774 | "handover/assignment was not commanded " |
| 1775 | "at the expected TS\n"); |
| 1776 | return EXIT_FAILURE; |
| 1777 | } |
| 1778 | test_case += 3; |
| 1779 | } else |
| 1780 | if (!strcmp(*test_case, "ack-chan")) { |
| 1781 | fprintf(stderr, "- Acknowledging channel request\n"); |
| 1782 | if (!got_chan_req) { |
| 1783 | printf("Cannot ack channel, because no " |
| 1784 | "request\n"); |
| 1785 | return EXIT_FAILURE; |
| 1786 | } |
| 1787 | test_case += 1; |
| 1788 | got_ho_req = 0; |
| 1789 | send_chan_act_ack(chan_req_lchan, 1); |
| 1790 | } else |
| 1791 | if (!strcmp(*test_case, "ho-complete")) { |
| 1792 | fprintf(stderr, "- Acknowledging handover/assignment " |
| 1793 | "request\n"); |
| 1794 | if (!got_chan_req) { |
| 1795 | printf("Cannot ack handover/assignment, " |
| 1796 | "because no chan request\n"); |
| 1797 | return EXIT_FAILURE; |
| 1798 | } |
| 1799 | if (!got_ho_req) { |
| 1800 | printf("Cannot ack handover/assignment, " |
| 1801 | "because no ho request\n"); |
| 1802 | return EXIT_FAILURE; |
| 1803 | } |
| 1804 | test_case += 1; |
| 1805 | got_chan_req = 0; |
| 1806 | got_ho_req = 0; |
| 1807 | /* switch lchan */ |
| 1808 | for (i = 0; i < lchan_num; i++) { |
| 1809 | if (lchan[i] == ho_req_lchan) { |
| 1810 | fprintf(stderr, " * MS %d changes from " |
| 1811 | "BTS=%d TS=%d to BTS=%d " |
| 1812 | "TS=%d\n", i, |
| 1813 | lchan[i]->ts->trx->bts->nr, |
| 1814 | lchan[i]->ts->nr, |
| 1815 | chan_req_lchan->ts->trx->bts->nr, |
| 1816 | chan_req_lchan->ts->nr); |
| 1817 | lchan[i] = chan_req_lchan; |
| 1818 | } |
| 1819 | } |
| 1820 | send_ho_complete(chan_req_lchan, true); |
| 1821 | } else |
| 1822 | if (!strcmp(*test_case, "ho-failed")) { |
| 1823 | fprintf(stderr, "- Making handover fail\n"); |
| 1824 | if (!got_chan_req) { |
| 1825 | printf("Cannot fail handover, because no chan " |
| 1826 | "request\n"); |
| 1827 | return EXIT_FAILURE; |
| 1828 | } |
| 1829 | test_case += 1; |
| 1830 | got_chan_req = 0; |
| 1831 | got_ho_req = 0; |
| 1832 | send_ho_complete(ho_req_lchan, false); |
| 1833 | } else |
| 1834 | if (!strcmp(*test_case, "print")) { |
| 1835 | fprintf(stderr, "\n%s\n\n", test_case[1]); |
| 1836 | test_case += 2; |
| 1837 | } else { |
| 1838 | printf("Unknown test command '%s', please fix!\n", |
| 1839 | *test_case); |
| 1840 | return EXIT_FAILURE; |
| 1841 | } |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1842 | |
| 1843 | { |
| 1844 | /* Help the lchan out of releasing states */ |
| 1845 | struct gsm_bts *bts; |
| 1846 | llist_for_each_entry(bts, &bsc_gsmnet->bts_list, list) { |
| 1847 | struct gsm_bts_trx *trx; |
| 1848 | llist_for_each_entry(trx, &bts->trx_list, list) { |
| 1849 | int ts_nr; |
| 1850 | for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) { |
| 1851 | struct gsm_lchan *lchan; |
| 1852 | ts_for_each_lchan(lchan, &trx->ts[ts_nr]) { |
| 1853 | |
| 1854 | if (lchan->fi && lchan->fi->state == LCHAN_ST_WAIT_BEFORE_RF_RELEASE) { |
| 1855 | osmo_fsm_inst_state_chg(lchan->fi, LCHAN_ST_WAIT_RF_RELEASE_ACK, 0, 0); |
| 1856 | osmo_fsm_inst_dispatch(lchan->fi, LCHAN_EV_RSL_RF_CHAN_REL_ACK, 0); |
| 1857 | } |
| 1858 | } |
| 1859 | } |
| 1860 | } |
| 1861 | } |
| 1862 | } |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1863 | } |
| 1864 | |
| 1865 | for (i = 0; i < lchan_num; i++) { |
| 1866 | struct gsm_subscriber_connection *conn = lchan[i]->conn; |
| 1867 | lchan[i]->conn = NULL; |
| 1868 | conn->lchan = NULL; |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 1869 | osmo_fsm_inst_term(conn->fi, OSMO_FSM_TERM_REGULAR, NULL); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1870 | } |
| 1871 | |
| 1872 | fprintf(stderr, "--------------------\n"); |
| 1873 | |
| 1874 | printf("Test OK\n"); |
| 1875 | |
| 1876 | fprintf(stderr, "--------------------\n"); |
| 1877 | |
Neels Hofmeyr | e341618 | 2018-03-05 05:31:14 +0100 | [diff] [blame] | 1878 | talloc_free(ctx); |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1879 | return EXIT_SUCCESS; |
| 1880 | } |
| 1881 | |
| 1882 | void rtp_socket_free() {} |
| 1883 | void rtp_send_frame() {} |
| 1884 | void rtp_socket_upstream() {} |
| 1885 | void rtp_socket_create() {} |
| 1886 | void rtp_socket_connect() {} |
| 1887 | void rtp_socket_proxy() {} |
| 1888 | void trau_mux_unmap() {} |
| 1889 | void trau_mux_map_lchan() {} |
| 1890 | void trau_recv_lchan() {} |
| 1891 | void trau_send_frame() {} |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 1892 | int osmo_bsc_sigtran_send(struct gsm_subscriber_connection *conn, struct msgb *msg) { return 0; } |
| 1893 | 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] | 1894 | 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] | 1895 | 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] | 1896 | 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] | 1897 | { return 0; } |
Neels Hofmeyr | 86ce105 | 2020-09-18 02:49:32 +0200 | [diff] [blame] | 1898 | int bsc_paging_start(struct bsc_paging_params *params) |
| 1899 | { return 0; } |
Neels Hofmeyr | c19581f | 2018-05-27 03:05:18 +0200 | [diff] [blame] | 1900 | void bsc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, struct msgb *msg) {} |
| 1901 | 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] | 1902 | void bsc_cm_update(struct gsm_subscriber_connection *conn, |
| 1903 | const uint8_t *cm2, uint8_t cm2_len, |
| 1904 | const uint8_t *cm3, uint8_t cm3_len) {} |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1905 | struct gsm0808_handover_required; |
| 1906 | int bsc_tx_bssmap_ho_required(struct gsm_lchan *lchan, const struct gsm0808_cell_id_list2 *target_cells) |
| 1907 | { return 0; } |
| 1908 | int bsc_tx_bssmap_ho_request_ack(struct gsm_subscriber_connection *conn, struct msgb *rr_ho_command) |
| 1909 | { return 0; } |
| 1910 | int bsc_tx_bssmap_ho_detect(struct gsm_subscriber_connection *conn) { return 0; } |
| 1911 | enum handover_result bsc_tx_bssmap_ho_complete(struct gsm_subscriber_connection *conn, |
| 1912 | struct gsm_lchan *lchan) { return HO_RESULT_OK; } |
| 1913 | void bsc_tx_bssmap_ho_failure(struct gsm_subscriber_connection *conn) {} |
Neels Hofmeyr | c27ae2d | 2020-10-04 21:32:52 +0200 | [diff] [blame] | 1914 | void osmo_bsc_sigtran_tx_reset(void) {} |
Neels Hofmeyr | e95b92b | 2020-10-09 17:18:29 +0200 | [diff] [blame] | 1915 | void osmo_bsc_sigtran_tx_reset_ack(void) {} |
Neels Hofmeyr | c27ae2d | 2020-10-04 21:32:52 +0200 | [diff] [blame] | 1916 | void osmo_bsc_sigtran_reset(void) {} |
| 1917 | void bssmap_reset_alloc(void) {} |
| 1918 | void bssmap_reset_is_conn_ready(void) {} |