Change in ...osmo-ttcn3-hacks[master]: hlr: add create-subscriber-on-demand tests

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Jun 18 12:50:37 UTC 2019


laforge has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14424 )

Change subject: hlr: add create-subscriber-on-demand tests
......................................................................

hlr: add create-subscriber-on-demand tests

Test all possible code paths where a subscriber on demand can be
created:
* Check IMEI early
* Location Update
* Send Auth Info

Related: OS#2542
Change-Id: Id544fa906ad442c2bbbccff437c18d04ddccde2e
---
M hlr/HLR_Tests.ttcn
1 file changed, 173 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/hlr/HLR_Tests.ttcn b/hlr/HLR_Tests.ttcn
index 4c158fd..f309575 100644
--- a/hlr/HLR_Tests.ttcn
+++ b/hlr/HLR_Tests.ttcn
@@ -1196,6 +1196,176 @@
 	vc_conn.done;
 }
 
+/* Test create-subscriber-on-demand during Check IMEI (OsmoMSC would be set to "check-imei-rqd early") */
+private function f_TC_subscr_create_on_demand_check_imei_early() runs on HLR_ConnHdlr {
+	var GSUP_PDU res; /* save various return values to prevent ttcn3 compiler warnings */
+	var charstring imsi_pattern := "*IMSI: " & hex2str(g_pars.sub.imsi) & "*";
+
+	/* Random MSISDN and CS+PS NAM (LU must pass) */
+	f_vty_config(VTY, "hlr", "subscriber-create-on-demand 3 cs+ps");
+	f_perform_CHECK_IMEI(g_pars.sub.imsi, '12345678901234'H, result := OSMO_GSUP_IMEI_RESULT_ACK);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern imsi_pattern);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*MSISDN: \d\d\d*"); /* last line, hence not matching "\d\d\d\n" */
+	f_vty_subscr_show_nomatch(VTY, g_pars.sub, pattern "*[CP]S disabled*");
+	res := f_perform_UL(g_pars.sub.imsi, ?);
+	f_vty_subscr_delete(VTY, g_pars.sub);
+
+	/* Random MSISDN and PS NAM (LU must pass) */
+	f_vty_config(VTY, "hlr", "subscriber-create-on-demand 3 ps");
+	f_perform_CHECK_IMEI(g_pars.sub.imsi, '12345678901234'H, result := OSMO_GSUP_IMEI_RESULT_ACK);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern imsi_pattern);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*MSISDN: \d\d\d*");
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*CS disabled*");
+	f_vty_subscr_show_nomatch(VTY, g_pars.sub, pattern "*PS disabled*");
+	res := f_perform_UL(g_pars.sub.imsi, ?);
+	f_vty_subscr_delete(VTY, g_pars.sub);
+
+	/* Random MSISDN and CS NAM (LU must fail) */
+	f_vty_config(VTY, "hlr", "subscriber-create-on-demand 3 cs");
+	f_perform_CHECK_IMEI(g_pars.sub.imsi, '12345678901234'H, result := OSMO_GSUP_IMEI_RESULT_ACK);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern imsi_pattern);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*MSISDN: \d\d\d*");
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*PS disabled*");
+	f_vty_subscr_show_nomatch(VTY, g_pars.sub, pattern "*CS disabled*");
+	res := f_perform_UL(g_pars.sub.imsi, ?, 7 /* GPRS services not allowed */);
+	f_vty_subscr_delete(VTY, g_pars.sub);
+
+	/* Random MSISDN and no NAM (LU must fail) */
+	f_vty_config(VTY, "hlr", "subscriber-create-on-demand 3 none");
+	f_perform_CHECK_IMEI(g_pars.sub.imsi, '12345678901234'H, result := OSMO_GSUP_IMEI_RESULT_ACK);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern imsi_pattern);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*MSISDN: \d\d\d*");
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*CS disabled*PS disabled*");
+	res := f_perform_UL(g_pars.sub.imsi, ?, 7 /* GPRS services not allowed */);
+	f_vty_subscr_delete(VTY, g_pars.sub);
+
+	/* No MSISDN and no NAM (LU must fail) */
+	f_vty_config(VTY, "hlr", "subscriber-create-on-demand no-msisdn none");
+	f_perform_CHECK_IMEI(g_pars.sub.imsi, '12345678901234'H, result := OSMO_GSUP_IMEI_RESULT_ACK);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern imsi_pattern);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*MSISDN: none*");
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*CS disabled*PS disabled*");
+	res := f_perform_UL(g_pars.sub.imsi, ?, 7 /* GPRS services not allowed */);
+	f_vty_subscr_delete(VTY, g_pars.sub);
+
+	/* No MSISDN and CS+PS NAM (LU must pass) */
+	f_vty_config(VTY, "hlr", "subscriber-create-on-demand no-msisdn cs+ps");
+	f_perform_CHECK_IMEI(g_pars.sub.imsi, '12345678901234'H, result := OSMO_GSUP_IMEI_RESULT_ACK);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern imsi_pattern);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*MSISDN: none*");
+	f_vty_subscr_show_nomatch(VTY, g_pars.sub, pattern "*[CP]S disabled*");
+	res := f_perform_UL(g_pars.sub.imsi, omit);
+	f_vty_subscr_delete(VTY, g_pars.sub);
+
+	setverdict(pass);
+}
+testcase TC_subscr_create_on_demand_check_imei_early() 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_subscr_create_on_demand_check_imei_early), pars);
+	vc_conn.done;
+}
+
+/* Test create-subscriber-on-demand during LU (Location Update) */
+private function f_TC_subscr_create_on_demand_ul() runs on HLR_ConnHdlr {
+	var GSUP_PDU res;
+	var charstring imsi_pattern := "*IMSI: " & hex2str(g_pars.sub.imsi) & "*";
+
+	/* Random MSISDN and CS+PS NAM (LU must pass) */
+	f_vty_config(VTY, "hlr", "subscriber-create-on-demand 3 cs+ps");
+	res := f_perform_UL(g_pars.sub.imsi, ?);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern imsi_pattern);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*MSISDN: \d\d\d\n*");
+	f_vty_subscr_show_nomatch(VTY, g_pars.sub, pattern "*[CP]S disabled*");
+	f_vty_subscr_delete(VTY, g_pars.sub);
+
+	/* Random MSISDN and PS NAM (LU must pass) */
+	f_vty_config(VTY, "hlr", "subscriber-create-on-demand 3 ps");
+	res := f_perform_UL(g_pars.sub.imsi, ?);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern imsi_pattern);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*MSISDN: \d\d\d\n*");
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*CS disabled*");
+	f_vty_subscr_show_nomatch(VTY, g_pars.sub, pattern "*PS disabled*");
+	f_vty_subscr_delete(VTY, g_pars.sub);
+
+	/* Random MSISDN and CS NAM (LU must fail) */
+	f_vty_config(VTY, "hlr", "subscriber-create-on-demand 3 cs");
+	res := f_perform_UL(g_pars.sub.imsi, ?, 7 /* GPRS services not allowed */);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern imsi_pattern);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*MSISDN: \d\d\d\n*");
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*PS disabled*");
+	f_vty_subscr_show_nomatch(VTY, g_pars.sub, pattern "*CS disabled*");
+	f_vty_subscr_delete(VTY, g_pars.sub);
+
+	/* Random MSISDN and no NAM (LU must fail) */
+	f_vty_config(VTY, "hlr", "subscriber-create-on-demand 3 none");
+	res := f_perform_UL(g_pars.sub.imsi, ?, 7 /* GPRS services not allowed */);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern imsi_pattern);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*MSISDN: \d\d\d\n*");
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*CS disabled*PS disabled*");
+	f_vty_subscr_delete(VTY, g_pars.sub);
+
+	/* No MSISDN and no NAM (LU must fail) */
+	f_vty_config(VTY, "hlr", "subscriber-create-on-demand no-msisdn none");
+	res := f_perform_UL(g_pars.sub.imsi, ?, 7 /* GPRS services not allowed */);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern imsi_pattern);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*MSISDN: none*");
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*CS disabled*PS disabled*");
+	f_vty_subscr_delete(VTY, g_pars.sub);
+
+	/* No MSISDN and CS+PS NAM (LU must pass) */
+	f_vty_config(VTY, "hlr", "subscriber-create-on-demand no-msisdn cs+ps");
+	res := f_perform_UL(g_pars.sub.imsi, omit);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern imsi_pattern);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*MSISDN: none*");
+	f_vty_subscr_show_nomatch(VTY, g_pars.sub, pattern "*[CP]S disabled*");
+	f_vty_subscr_delete(VTY, g_pars.sub);
+
+	setverdict(pass);
+}
+testcase TC_subscr_create_on_demand_ul() 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_subscr_create_on_demand_ul), pars);
+	vc_conn.done;
+}
+
+/* Test create-subscriber-on-demand during SAI (SendAuthInfo) */
+private function f_TC_subscr_create_on_demand_sai() runs on HLR_ConnHdlr {
+	var GSUP_PDU res;
+	var charstring imsi_pattern := "*IMSI: " & hex2str(g_pars.sub.imsi) & "*";
+
+	/* HLR creates the subscriber on demand. Then the IMSI is known, but there is no auth data, so the HLR returns
+         * the "slightly inaccurate cause 'IMSI Unknown' via GSUP". The MS is able to do a LU afterwards. */
+	f_vty_config(VTY, "hlr", "subscriber-create-on-demand 3 cs+ps");
+	res := f_perform_SAI(g_pars.sub.imsi, 2 /* IMSI Unknown */ );
+
+	/* Verify that it was created before the LU */
+	f_vty_subscr_show(VTY, g_pars.sub, pattern imsi_pattern);
+	f_vty_subscr_show(VTY, g_pars.sub, pattern "*MSISDN: \d\d\d*"); /* last line, hence not matching "\d\d\d\n" */
+	f_vty_subscr_show_nomatch(VTY, g_pars.sub, pattern "*[CP]S disabled*");
+
+	/* Location update */
+	res := f_perform_UL(g_pars.sub.imsi, ?);
+	f_vty_subscr_delete(VTY, g_pars.sub);
+	setverdict(pass);
+}
+testcase TC_subscr_create_on_demand_sai() 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_subscr_create_on_demand_sai), pars);
+	vc_conn.done;
+}
+
 /* TODO:
   * UL with ISD error
   * UL with ISD timeout
@@ -1236,6 +1406,9 @@
 	execute( TC_gsup_check_imei() );
 	execute( TC_gsup_check_imei_invalid_len() );
 	execute( TC_gsup_check_imei_unknown_imsi() );
+	execute( TC_subscr_create_on_demand_check_imei_early() );
+	execute( TC_subscr_create_on_demand_ul() );
+	execute( TC_subscr_create_on_demand_sai() );
 };
 
 };

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14424
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Id544fa906ad442c2bbbccff437c18d04ddccde2e
Gerrit-Change-Number: 14424
Gerrit-PatchSet: 5
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190618/e1075021/attachment.htm>


More information about the gerrit-log mailing list