summaryrefslogtreecommitdiffstats
path: root/bsc/BSC_Tests.ttcn
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-06-14 10:58:35 +0200
committerHarald Welte <laforge@gnumonks.org>2018-06-14 12:36:13 +0000
commit641fcbe890f7cbb5498885e5c2ffd5b14ee31f5e (patch)
treee8cc06dc7ac57f4e837fbc96be31c3f5c7447ac8 /bsc/BSC_Tests.ttcn
parente6bf4ac879fb44c4bbdbd6a4edf4bdf4024375ba (diff)
bsc: Factor out duplicated code into f_exp_chan_rel_and_clear()
There's a sequence of commands which was repeated over at least four test cases. Let's factor this out into the new f_exp_chan_rel_and_clear() function, and use that function from all the former copy+pasted sections. Change-Id: Ic6791fce4e8787e38b818a12ed526d3e47f313ef
Diffstat (limited to 'bsc/BSC_Tests.ttcn')
-rw-r--r--bsc/BSC_Tests.ttcn59
1 files changed, 19 insertions, 40 deletions
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index bab56d1..a5509fd 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -667,9 +667,23 @@ runs on test_CT return DchanTuple {
return dt;
}
+/* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */
+private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT {
+ var RSL_Message rx_rsl;
+ /* expect BSC to disable the channel */
+ rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX);
+ /* respond with CHAN REL ACK */
+ f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr));
+
+ /* expect Clear Complete from BSC */
+ BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete));
+
+ /* MSC disconnects as instructed. */
+ BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0));
+}
+
/* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */
testcase TC_chan_rel_rll_rel_ind() runs on test_CT {
- var RSL_Message rx_rsl;
var BSSAP_N_DATA_ind rx_di;
var DchanTuple dt;
@@ -688,15 +702,7 @@ testcase TC_chan_rel_rll_rel_ind() runs on test_CT {
BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause)));
/* expect BSC to disable the channel */
- rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX);
- /* respond with CHAN REL ACK */
- f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr));
-
- /* expect Clear Complete from BSC */
- BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete));
-
- /* release the SCCP connection */
- BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0));
+ f_exp_chan_rel_and_clear(dt, 0);
/* wait for SCCP emulation to do its job */
f_sleep(1.0);
@@ -707,7 +713,6 @@ testcase TC_chan_rel_rll_rel_ind() runs on test_CT {
/* Test behavior of channel release after CONN FAIL IND from BTS */
testcase TC_chan_rel_conn_fail() runs on test_CT {
var BSSAP_N_DATA_ind rx_di;
- var RSL_Message rx_rsl;
var DchanTuple dt;
f_init(1);
@@ -726,15 +731,7 @@ testcase TC_chan_rel_conn_fail() runs on test_CT {
BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause)));
/* expect BSC to disable the channel */
- rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX);
- /* respond with CHAN REL ACK */
- f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr));
-
- /* expect Clear Complete from BSC */
- BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete));
-
- /* release the SCCP connection */
- BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0));
+ f_exp_chan_rel_and_clear(dt, 0);
/* wait for SCCP emulation to do its job */
f_sleep(1.0);
@@ -2092,7 +2089,6 @@ testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT {
var integer i;
var DchanTuple dt;
var BSSAP_N_DATA_ind rx_di;
- var RSL_Message rx_rsl;
var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL;
var BssmapCause cause := enum2int(cause_val);
@@ -2120,15 +2116,7 @@ testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT {
BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause)));
/* expect BSC to disable the channel */
- rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX);
- /* respond with CHAN REL ACK */
- f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr));
-
- /* expect Clear Complete from BSC */
- BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete));
-
- /* MSC disconnects as instructed. */
- BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0));
+ f_exp_chan_rel_and_clear(dt, 0);
}
/* In the buggy behavior, a timeout of 2 seconds happens between above
@@ -2148,7 +2136,6 @@ testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT {
var integer i;
var DchanTuple dt;
var BSSAP_N_DATA_ind rx_di;
- var RSL_Message rx_rsl;
var integer j;
f_init();
@@ -2182,15 +2169,7 @@ testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT {
BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause)));
/* expect BSC to disable the channel */
- rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX);
- /* respond with CHAN REL ACK */
- f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr));
-
- /* expect Clear Complete from BSC */
- BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete));
-
- /* MSC disconnects as instructed. */
- BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0));
+ f_exp_chan_rel_and_clear(dt, 0);
}
/* In the buggy behavior, a timeout of 2 seconds happens between above