Harald Welte has submitted this change and it was merged. Change subject: bts: Introduce f_rsl_transceive() and reduce code duplication ......................................................................
bts: Introduce f_rsl_transceive() and reduce code duplication Change-Id: I56de61e08bd1508a0531f720561ead84d1075de3 --- M bts/BTS_Tests.ttcn 1 file changed, 23 insertions(+), 33 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn index 00143bf..267d7a3 100644 --- a/bts/BTS_Tests.ttcn +++ b/bts/BTS_Tests.ttcn @@ -225,33 +225,35 @@ fn.apply(id); } - -function f_rsl_chan_act(RSL_IE_ChannelMode mode) runs on ConnHdlr { - RSL.send(ts_RSL_CHAN_ACT(g_chan_nr, mode)); +function f_rsl_transceive(template RSL_Message tx, template RSL_Message exp_rx, charstring id) +runs on ConnHdlr { + timer T := 3.0; + RSL.send(tx); + T.start; alt { - [] RSL.receive(tr_RSL_CHAN_ACT_ACK(g_chan_nr)) { - g_Tmeas_exp.start; + [] RSL.receive(exp_rx) { + T.stop; + setverdict(pass); } - [] RSL.receive(tr_RSL_CHAN_ACT_NACK(g_chan_nr)) { - setverdict(fail, "Unexpected RF CHAN ACT NACK"); + [] T.timeout { + setverdict(fail, "Timeout expecting " & id); + self.stop; + } + [] RSL.receive { + setverdict(fail, "Unexpected RSL message received"); } } +} + +function f_rsl_chan_act(RSL_IE_ChannelMode mode) runs on ConnHdlr { + f_rsl_transceive(ts_RSL_CHAN_ACT(g_chan_nr, mode), tr_RSL_CHAN_ACT_ACK(g_chan_nr), + "RSL CHAN ACT"); } function f_rsl_chan_deact() runs on ConnHdlr { - timer T := 3.0; - RSL.send(ts_RSL_RF_CHAN_REL(g_chan_nr)); - T.start; - alt { - [] RSL.receive(tr_RSL_RF_CHAN_REL_ACK(g_chan_nr)) { - g_Tmeas_exp.stop; - } - [] T.timeout { - setverdict(fail, "Timeout waiting for RF CHAN REL ACK"); - } - } + f_rsl_transceive(ts_RSL_RF_CHAN_REL(g_chan_nr), tr_RSL_RF_CHAN_REL_ACK(g_chan_nr), + "RF CHAN REL"); } - private template ConnHdlrPars t_Pars(template RslChannelNr chan_nr, template RSL_IE_ChannelMode chan_mode, @@ -1001,20 +1003,8 @@ /* Send IPA DLCX to inactive lchan */ function f_TC_ipa_dlcx_not_active(charstring id) runs on ConnHdlr { - timer T := 3.0; - RSL.send(ts_RSL_IPA_DLCX(g_chan_nr, 0)); - T.start; - alt { - [] RSL.receive(tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?)) { - setverdict(pass); - } - [] RSL.receive(tr_RSL_IPA_DLCX_NACK(g_chan_nr, ?)) { - setverdict(fail); - } - [] T.timeout { - setverdict(fail, "Timeout expecting RF_CHAN_REL_ACK"); - } - } + f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, 0), tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?), + "IPA DLCX ACK"); } testcase TC_ipa_dlcx_not_active() runs on test_CT { var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); -- To view, visit https://gerrit.osmocom.org/6895 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I56de61e08bd1508a0531f720561ead84d1075de3 Gerrit-PatchSet: 2 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder