aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2022-04-25 13:26:41 +0200
committerHarald Welte <laforge@osmocom.org>2022-04-27 18:39:56 +0200
commit8bb2944c2fb963783c233190c098b48d218d49f9 (patch)
tree74e7bf5547de735a684e663fe6ee26487779bf7c
parent1222f52b43e864c2ccae31b92cbaa66ffb2d8cb1 (diff)
bsc: CBSP code refcator: Add f_exp_rsl_etws()
This function reduces code duplication between CBSP tests. Change-Id: I69bedd43bc88bc619b80bf9038da901bbff9f04b
-rw-r--r--bsc/BSC_Tests_CBSP.ttcn82
1 files changed, 34 insertions, 48 deletions
diff --git a/bsc/BSC_Tests_CBSP.ttcn b/bsc/BSC_Tests_CBSP.ttcn
index 5f470ab0..48769aa5 100644
--- a/bsc/BSC_Tests_CBSP.ttcn
+++ b/bsc/BSC_Tests_CBSP.ttcn
@@ -868,37 +868,53 @@ testcase TC_cbsp_emerg_write_bts_cgi_dchan() runs on cbsp_test_CT {
}
}
-/* Write ETWS PN to single BTS; verify it arrives on CCHAN */
-testcase TC_cbsp_emerg_write_bts_cgi_cchan() runs on cbsp_test_CT {
- var CBSP_IEs pages := {f_gen_page()};
- var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
- var ASP_RSL_Unitdata rx_rsl_ud;
-
- g_pars := valueof(ts_CBSP_Pars_default(false, 16001, 16501));
- f_init();
-
- cell_list := ts_BSSMAP_CIL_CGI({bssmap_cgi(mp_cgi_bts0)});
- f_cbsp_write_emerg(g_cbsp_msg_id, g_cbsp_ser_no, cell_list);
- var template (present) octetstring tr_apdu := f_gen_etws_pn(g_cbsp_ser_no, g_cbsp_msg_id);
+private function f_exp_rsl_etws(integer rsl_idx := 0, boolean enabled) runs on cbsp_test_CT {
+ var template (present) octetstring tr_apdu;
timer T := 5.0;
T.start;
+
+ if (enabled) {
+ tr_apdu := f_gen_etws_pn(g_cbsp_ser_no, g_cbsp_msg_id);
+ } else {
+ tr_apdu := ''O;
+ }
+
alt {
- [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(t_RslChanNr_PCH_AGCH(0), tr_apdu))) {
+ [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(t_RslChanNr_PCH_AGCH(0), tr_apdu))) {
setverdict(pass);
}
- [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(?,?))) {
+ [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(?,?))) {
setverdict(fail, "Received unexpected OSMO_ETWS_CMD");
mtc.stop;
}
- [] IPA_RSL[0].receive { repeat; }
+ [] IPA_RSL[rsl_idx].receive { repeat; }
[] T.timeout {
- setverdict(fail, "Timeout waiting for RSL_OSMO_ETWS_CMD");
+ if (enabled) {
+ setverdict(fail, "Timeout waiting for RSL_OSMO_ETWS_CMD (enable)");
+ } else {
+ setverdict(fail, "Timeout waiting for RSL_OSMO_ETWS_CMD (disable)");
+ }
mtc.stop;
}
}
}
/* Write ETWS PN to single BTS; verify it arrives on CCHAN */
+testcase TC_cbsp_emerg_write_bts_cgi_cchan() runs on cbsp_test_CT {
+ var CBSP_IEs pages := {f_gen_page()};
+ var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
+ var ASP_RSL_Unitdata rx_rsl_ud;
+
+ g_pars := valueof(ts_CBSP_Pars_default(false, 16001, 16501));
+ f_init();
+
+ cell_list := ts_BSSMAP_CIL_CGI({bssmap_cgi(mp_cgi_bts0)});
+ f_cbsp_write_emerg(g_cbsp_msg_id, g_cbsp_ser_no, cell_list);
+
+ f_exp_rsl_etws(0, true);
+}
+
+/* Write ETWS PN to single BTS; verify it arrives on CCHAN */
testcase TC_cbsp_emerg_write_bts_cgi_cchan_disable() runs on cbsp_test_CT {
var CBSP_IEs pages := {f_gen_page()};
var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
@@ -911,40 +927,10 @@ testcase TC_cbsp_emerg_write_bts_cgi_cchan_disable() runs on cbsp_test_CT {
f_cbsp_write_emerg(g_cbsp_msg_id, g_cbsp_ser_no, cell_list);
/* first expect the PN to be enabled */
- var template (present) octetstring tr_apdu := f_gen_etws_pn(g_cbsp_ser_no, g_cbsp_msg_id);
- timer T := 5.0;
- T.start;
- alt {
- [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(t_RslChanNr_PCH_AGCH(0), tr_apdu))) {
- setverdict(pass);
- }
- [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(?,?))) {
- setverdict(fail, "Received unexpected OSMO_ETWS_CMD");
- mtc.stop;
- }
- [] IPA_RSL[0].receive { repeat; }
- [] T.timeout {
- setverdict(fail, "Timeout waiting for RSL_OSMO_ETWS_CMD (enable)");
- mtc.stop;
- }
- }
+ f_exp_rsl_etws(0, true);
/* then expect it to be disabled after the warning period (5s) */
- T.start;
- alt {
- [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(t_RslChanNr_PCH_AGCH(0), ''O))) {
- setverdict(pass);
- }
- [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(?,?))) {
- setverdict(fail, "Received unexpected OSMO_ETWS_CMD");
- mtc.stop;
- }
- [] IPA_RSL[0].receive { repeat; }
- [] T.timeout {
- setverdict(fail, "Timeout waiting for RSL_OSMO_ETWS_CMD (disable)");
- mtc.stop;
- }
- }
+ f_exp_rsl_etws(0, false);
}
/* Send a MSG STATUS QUERY for an unknown message; expect no completion list and present failure list */