hlr: add imsi unknown cause test case

Check if the reject-cause is correct implement when the subscriber
couldn't found.

Depends-on: Icea39020c23fbbea9e92847df76af8986fdbf48a (osmo-hlr)
Change-Id: I87c3a2d7304b81cfc11a364d933567e1a080b99a
diff --git a/hlr/HLR_Tests.ttcn b/hlr/HLR_Tests.ttcn
index e99011d..794ef9b 100644
--- a/hlr/HLR_Tests.ttcn
+++ b/hlr/HLR_Tests.ttcn
@@ -152,6 +152,7 @@
 	f_vty_set_prompts(VTY);
 	f_vty_transceive(VTY, "enable");
 	f_vty_config(VTY, "mslookup", "no mdns bind");
+	f_vty_config(VTY, "hlr", "reject-cause not-found imsi-unknown");
 }
 
 private altstep as_Tguard() runs on test_CT {
@@ -987,6 +988,7 @@
 	vc_conn := f_start_handler(refers(f_TC_ul_unknown_imsi), pars);
 	vc_conn.done;
 }
+
 testcase TC_gsup_ul_unknown_imsi_via_proxy() runs on test_CT {
 	var hexstring imsi := f_rnd_imsi('26242'H);
 	var HLR_ConnHdlrPars pars := valueof(t_Pars_via_proxy(imsi));
@@ -997,6 +999,25 @@
 	vc_conn.done;
 }
 
+/* Test if the HLR can be configured to a different error code if the subscriber can't be found.
+ * E.g. on event networks the HLR should return Roaming Not Allowed to unknown subscribers instead
+ * of Subscriber Unknown in HLR.
+ */
+private function f_TC_ul_unknown_imsi_roaming_not_allowed() runs on HLR_ConnHdlr {
+	f_vty_config(VTY, "hlr", "reject-cause not-found roaming-not-allowed");
+	f_perform_UL(g_pars.sub.imsi, ?, 13, source_name := g_pars.source_name);
+	setverdict(pass);
+}
+testcase TC_gsup_ul_unknown_imsi_roaming_not_allowed() runs on test_CT {
+	var hexstring imsi := f_rnd_imsi('26242'H);
+	var HLR_ConnHdlrPars pars := valueof(t_Pars(imsi));
+	var HLR_ConnHdlr vc_conn;
+
+	f_init(false);
+	vc_conn := f_start_handler(refers(f_TC_ul_unknown_imsi_roaming_not_allowed), pars);
+	vc_conn.done;
+}
+
 /* test UL for a number of different subscriber cases (algo, 2g/3g, ...) */
 private function f_TC_gsup_ul() runs on HLR_ConnHdlr {
 	var GSUP_PDUs res;
@@ -2076,6 +2097,7 @@
 	execute( TC_gsup_sai_eps() );
 	execute( TC_gsup_ul_unknown_imsi() );
 	execute( TC_gsup_ul_unknown_imsi_via_proxy() );
+	execute( TC_gsup_ul_unknown_imsi_roaming_not_allowed() );
 	execute( TC_gsup_sai_err_unknown_imsi() );
 	execute( TC_gsup_ul() );
 	execute( TC_gsup_ul_via_proxy() );