osmith has submitted this change. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37809?usp=email )
Change subject: hnbgw: test for RUA Disconnect when there is no CN
......................................................................
hnbgw: test for RUA Disconnect when there is no CN
Related: OS#6283
Related: osmo-hnbgw Iafb30c31a4c5db53ecdda99a0e0b5937b71e362c
Tweaked-by: Oliver Smith <osmith(a)sysmocom.de>
Change-Id: I2b5c024a395e736538c0c37db40d34f3b8d99991
---
M hnbgw/ConnHdlr.ttcn
M hnbgw/HNBGW_Tests.ttcn
2 files changed, 48 insertions(+), 12 deletions(-)
Approvals:
osmith: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/hnbgw/ConnHdlr.ttcn b/hnbgw/ConnHdlr.ttcn
index 7df3008..d89123e 100644
--- a/hnbgw/ConnHdlr.ttcn
+++ b/hnbgw/ConnHdlr.ttcn
@@ -162,6 +162,7 @@
HnbConfig hnb optional,
boolean expect_separate_sccp_cr,
integer tx_sccp_cr_data_len,
+ boolean expect_compl_l3_success,
charstring pfcp_local_addr,
octetstring nas_pdu optional,
/* local and remote SCCP addresses, used to transmit conectionless
@@ -181,6 +182,7 @@
integer hnb_idx := 0,
boolean expect_separate_sccp_cr := false,
integer tx_sccp_cr_data_len := 0,
+ boolean expect_compl_l3_success := true,
integer cn_idx := 0,
charstring pfcp_local_addr := "127.0.0.1",
template (value) RANAP_IEs.Cause rab_rel_cause := ts_RanapCause_nas_normal,
@@ -706,25 +708,29 @@
}
}
-function f_perform_compl_l3(octetstring nas, boolean do_clear := true, boolean
expect_iu_l3 := true)
+function f_perform_compl_l3(octetstring nas, boolean do_clear := true, boolean
expect_success := true)
runs on ConnHdlr {
timer T := 10.0;
- /* create an expect on the Iu side for the random NAS portion */
- if (g_pars.expect_separate_sccp_cr) {
- f_ran_register_sccp_cr_without_payload();
- } else {
- f_ran_register_exp(nas);
+ if (expect_success) {
+ /* create an expect on the Iu side for the random NAS portion */
+ if (g_pars.expect_separate_sccp_cr) {
+ f_ran_register_sccp_cr_without_payload();
+ } else {
+ f_ran_register_exp(nas);
+ }
}
/* send Connect via Iuh (creating a RUA connection) */
var RANAP_PDU tx := f_build_initial_ue_with_nas(g_pars, nas);
RUA.send(RUA_Conn_Req:{g_pars.ps_domain, tx});
- if (expect_iu_l3) {
+ if (expect_success) {
/* Expect same message to arrive at CN */
f_bssap_expect(tx);
+ } else {
+ RUA.receive(RUA_Disc_Ind:?);
}
}
-} /* module BSC_ConnectionHandler */
\ No newline at end of file
+} /* module BSC_ConnectionHandler */
diff --git a/hnbgw/HNBGW_Tests.ttcn b/hnbgw/HNBGW_Tests.ttcn
index 2328733..61000c3 100644
--- a/hnbgw/HNBGW_Tests.ttcn
+++ b/hnbgw/HNBGW_Tests.ttcn
@@ -1596,14 +1596,16 @@
}
private function f_tc_cnpool_compl_l3(charstring id) runs on ConnHdlr {
- f_perform_compl_l3(g_pars.nas_pdu);
+ f_perform_compl_l3(g_pars.nas_pdu, expect_success := g_pars.expect_compl_l3_success);
}
private function f_TC_cnpool_compl_l3(boolean ps_domain, octetstring nas_pdu, integer
cn_nr,
- template (omit) charstring inc_countername := omit) runs on test_CT {
+ template (omit) charstring inc_countername := omit,
+ boolean expect_compl_l3_success := true) runs on test_CT {
var ConnHdlr vc_conn;
var template (value) TestHdlrParams pars := f_TestHdlrParams(0, ps_domain := ps_domain,
cn_nr := cn_nr);
pars.nas_pdu := nas_pdu;
+ pars.expect_compl_l3_success := expect_compl_l3_success;
log("XXX ", pars);
vc_conn := f_start_handler_with_pars(refers(f_tc_cnpool_compl_l3), pars);
vc_conn.done;
@@ -1614,14 +1616,16 @@
}
function f_TC_cnpool_compl_l3_list(boolean ps_domain, ro_octetstring compl3,
Osmocom_Types.ro_integer cn_nrs,
- charstring inc_countername) runs on test_CT {
+ template (omit) charstring inc_countername,
+ boolean expect_compl_l3_success := true) runs on test_CT {
var integer n := lengthof(compl3);
if (n < lengthof(cn_nrs)) {
n := lengthof(cn_nrs);
}
for (var integer i := 0; i < n; i := i + 1) {
var integer cn_nr := cn_nrs[i mod lengthof(cn_nrs)];
- f_TC_cnpool_compl_l3(ps_domain, compl3[i mod lengthof(compl3)], cn_nr,
inc_countername);
+ f_TC_cnpool_compl_l3(ps_domain, compl3[i mod lengthof(compl3)], cn_nr,
inc_countername,
+ expect_compl_l3_success);
}
}
@@ -2388,6 +2392,30 @@
f_shutdown_helper();
}
+/* When no CN was found for a UE / domain, make sure osmo-hnbgw returns a Disconnect
(OS#6283) */
+function f_TC_cnpool_L3Compl_no_cn(boolean ps_domain) runs on test_CT {
+
+ /* Have one MSC and one SGSN but do not allow attaching.
+ * I would use no MSCs and no SGSNs, but then we need many tweaks to allow test startup
without any "BSSAP"
+ * port. */
+ f_init();
+ f_vty_cnlink_allow_attach(HNBGWVTY, ps_domain, {false});
+
+ f_ctrs_cn_init(ps_domain := ps_domain);
+
+ var ro_octetstring compl3 := f_gen_compl3_by_domain(ps_domain, 4);
+ f_TC_cnpool_compl_l3_list(ps_domain, compl3, {0, 0, 0, 0}, omit,
+ expect_compl_l3_success := false);
+
+ f_shutdown_helper();
+}
+testcase TC_mscpool_L3Compl_no_cn() runs on test_CT {
+ f_TC_cnpool_L3Compl_no_cn(ps_domain := false);
+}
+testcase TC_sgsnpool_L3Compl_no_cn() runs on test_CT {
+ f_TC_cnpool_L3Compl_no_cn(ps_domain := true);
+}
+
control {
execute(TC_hnb_register());
execute(TC_hnb_register_duplicate());
@@ -2427,6 +2455,7 @@
execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() );
execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_1() );
execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_2() );
+ execute( TC_mscpool_L3Compl_no_cn() );
execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() );
execute( TC_mscpool_paging_imsi() );
execute( TC_mscpool_paging_tmsi() );
@@ -2439,6 +2468,7 @@
execute( TC_sgsnpool_L3Complete_no_nri_round_robin() );
execute( TC_sgsnpool_L3Complete_valid_nri_1() );
execute( TC_sgsnpool_L3Complete_valid_nri_2() );
+ execute( TC_sgsnpool_L3Compl_no_cn() );
execute( TC_sgsnpool_nri_from_other_PLMN() );
execute( TC_sgsnpool_sccp_n_pcstate_detaches_cnlink() );
execute( TC_sgsnpool_sccp_n_pcstate_attaches_cnlink() );
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37809?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I2b5c024a395e736538c0c37db40d34f3b8d99991
Gerrit-Change-Number: 37809
Gerrit-PatchSet: 5
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>