bsc: reduce code duplication by introducing f_expect_chan_rel()
The handling of channel release is copy+pasted, let's introduce a shared function. Change-Id: If74b0838187f60004b7daf6176db259af511bf87
This commit is contained in:
parent
6ff76ea569
commit
91d54a569c
|
@ -606,11 +606,44 @@ testcase TC_chan_rel_conn_fail() runs on test_CT {
|
|||
setverdict(pass);
|
||||
}
|
||||
|
||||
function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, boolean flush := true,
|
||||
boolean handle_rll_rel := true) runs on test_CT {
|
||||
|
||||
var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0));
|
||||
if (flush) {
|
||||
/* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */
|
||||
IPA_RSL[bts_nr].clear;
|
||||
}
|
||||
alt {
|
||||
/* ignore DEACTIVATE SACCH (if any) */
|
||||
[] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
|
||||
tr_RSL_DEACT_SACCH(rsl_chan_nr))) {
|
||||
repeat;
|
||||
}
|
||||
/* acknowledge RLL release (if any)*/
|
||||
[handle_rll_rel] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
|
||||
tr_RSL_REL_REQ(rsl_chan_nr, ?))) {
|
||||
/* FIXME: Why are we getting this for LinkID SACCH? */
|
||||
f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch));
|
||||
repeat;
|
||||
}
|
||||
/* Expect RF channel release from BSC on Abis */
|
||||
[] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
|
||||
tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) {
|
||||
/* respond with CHAN REL ACK */
|
||||
f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr));
|
||||
}
|
||||
/* ignore any user data */
|
||||
[] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_MsgTypeR(?))) {
|
||||
repeat;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Test behavior of channel release after hard Clear Command from MSC */
|
||||
testcase TC_chan_rel_hard_clear() runs on test_CT {
|
||||
var BSSAP_N_DATA_ind rx_di;
|
||||
var DchanTuple dt;
|
||||
var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0));
|
||||
|
||||
f_init(1);
|
||||
f_bssap_reset();
|
||||
|
@ -627,36 +660,13 @@ testcase TC_chan_rel_hard_clear() runs on test_CT {
|
|||
BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0));
|
||||
}
|
||||
|
||||
/* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */
|
||||
IPA_RSL[0].clear;
|
||||
alt {
|
||||
/* ignore DEACTIVATE SACCH (if any) */
|
||||
[] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
|
||||
tr_RSL_DEACT_SACCH(dt.rsl_chan_nr))) {
|
||||
repeat;
|
||||
}
|
||||
/* acknowledge RLL release (if any)*/
|
||||
[] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
|
||||
tr_RSL_REL_REQ(dt.rsl_chan_nr, ?))) {
|
||||
/* FIXME: Why are we getting this for LinkID SACCH? */
|
||||
f_ipa_tx(0, ts_RSL_REL_CONF(dt.rsl_chan_nr, main_dcch));
|
||||
repeat;
|
||||
}
|
||||
/* Expect RF channel release from BSC on Abis */
|
||||
[] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
|
||||
tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) {
|
||||
/* respond with CHAN REL ACK */
|
||||
f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr));
|
||||
}
|
||||
}
|
||||
|
||||
f_expect_chan_rel(0, dt.rsl_chan_nr);
|
||||
setverdict(pass);
|
||||
}
|
||||
|
||||
/* Test behavior of channel release after hard RLSD from MSC */
|
||||
testcase TC_chan_rel_hard_rlsd() runs on test_CT {
|
||||
var DchanTuple dt;
|
||||
var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0));
|
||||
|
||||
f_init(1);
|
||||
f_bssap_reset();
|
||||
|
@ -666,36 +676,13 @@ testcase TC_chan_rel_hard_rlsd() runs on test_CT {
|
|||
/* release the SCCP connection */
|
||||
BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0));
|
||||
|
||||
/* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */
|
||||
IPA_RSL[0].clear;
|
||||
alt {
|
||||
/* ignore DEACTIVATE SACCH (if any) */
|
||||
[] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
|
||||
tr_RSL_DEACT_SACCH(dt.rsl_chan_nr))) {
|
||||
repeat;
|
||||
}
|
||||
/* acknowledge RLL release (if any)*/
|
||||
[] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
|
||||
tr_RSL_REL_REQ(dt.rsl_chan_nr, ?))) {
|
||||
/* FIXME: Why are we getting this for LinkID SACCH? */
|
||||
f_ipa_tx(0, ts_RSL_REL_CONF(dt.rsl_chan_nr, main_dcch));
|
||||
repeat;
|
||||
}
|
||||
/* Expect RF channel release from BSC on Abis */
|
||||
[] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
|
||||
tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) {
|
||||
/* respond with CHAN REL ACK */
|
||||
f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr));
|
||||
}
|
||||
}
|
||||
|
||||
f_expect_chan_rel(0, dt.rsl_chan_nr);
|
||||
setverdict(pass);
|
||||
}
|
||||
|
||||
/* Test behavior of channel release after BSSMAP RESET from MSC */
|
||||
testcase TC_chan_rel_a_reset() runs on test_CT {
|
||||
var DchanTuple dt;
|
||||
var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0));
|
||||
|
||||
f_init(1);
|
||||
f_bssap_reset();
|
||||
|
@ -712,31 +699,7 @@ testcase TC_chan_rel_a_reset() runs on test_CT {
|
|||
[] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { }
|
||||
}
|
||||
|
||||
alt {
|
||||
/* ignore DEACTIVATE SACCH (if any) */
|
||||
[] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
|
||||
tr_RSL_DEACT_SACCH(dt.rsl_chan_nr))) {
|
||||
repeat;
|
||||
}
|
||||
/* acknowledge RLL release (if any)*/
|
||||
[] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
|
||||
tr_RSL_REL_REQ(dt.rsl_chan_nr, ?))) {
|
||||
/* FIXME: Why are we getting this for LinkID SACCH? */
|
||||
f_ipa_tx(0, ts_RSL_REL_CONF(dt.rsl_chan_nr, main_dcch));
|
||||
repeat;
|
||||
}
|
||||
/* Expect RF channel release from BSC on Abis */
|
||||
[] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
|
||||
tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) {
|
||||
/* respond with CHAN REL ACK */
|
||||
f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr));
|
||||
}
|
||||
/* ignore any user data */
|
||||
[] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_MsgTypeR(?))) {
|
||||
repeat;
|
||||
}
|
||||
}
|
||||
|
||||
f_expect_chan_rel(0, dt.rsl_chan_nr);
|
||||
setverdict(pass);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue